mirror of
https://github.com/GTNewHorizons/Mantle.git
synced 2026-11-22 04:52:15 +00:00
Update Mantle to 1.12, Some things might not work/need to be tested!
This commit is contained in:
1 parent
b4a223b6ae
commit
e7f02fe28e
27 files changed
+93
-186
No files matched your search
@@ -6,15 +6,12 @@ import net.minecraft.block.properties.PropertyEnum;
|
||||
import net.minecraft.block.state.BlockStateContainer;
|
||||
import net.minecraft.block.state.IBlockState;
|
||||
import net.minecraft.creativetab.CreativeTabs;
|
||||
import net.minecraft.item.Item;
|
||||
import net.minecraft.item.ItemStack;
|
||||
import net.minecraft.util.IStringSerializable;
|
||||
import net.minecraft.util.NonNullList;
|
||||
import net.minecraftforge.fml.relauncher.Side;
|
||||
import net.minecraftforge.fml.relauncher.SideOnly;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
import javax.annotation.Nonnull;
|
||||
|
||||
public class EnumBlock<E extends Enum<E> & EnumBlock.IEnumMeta & IStringSerializable> extends Block {
|
||||
@@ -37,7 +34,7 @@ public class EnumBlock<E extends Enum<E> & EnumBlock.IEnumMeta & IStringSerializ
|
||||
|
||||
@SideOnly(Side.CLIENT)
|
||||
@Override
|
||||
public void getSubBlocks(@Nonnull Item itemIn, CreativeTabs tab, NonNullList<ItemStack> list) {
|
||||
public void getSubBlocks(CreativeTabs tab, NonNullList<ItemStack> list) {
|
||||
for(E type : values) {
|
||||
list.add(new ItemStack(this, 1, type.getMeta()));
|
||||
}
|
||||
|
||||
@@ -7,15 +7,12 @@ import net.minecraft.block.properties.PropertyEnum;
|
||||
import net.minecraft.block.state.BlockStateContainer;
|
||||
import net.minecraft.block.state.IBlockState;
|
||||
import net.minecraft.creativetab.CreativeTabs;
|
||||
import net.minecraft.item.Item;
|
||||
import net.minecraft.item.ItemStack;
|
||||
import net.minecraft.util.IStringSerializable;
|
||||
import net.minecraft.util.NonNullList;
|
||||
import net.minecraftforge.fml.relauncher.Side;
|
||||
import net.minecraftforge.fml.relauncher.SideOnly;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
import javax.annotation.Nonnull;
|
||||
|
||||
public abstract class EnumBlockSlab<E extends Enum<E> & EnumBlock.IEnumMeta & IStringSerializable> extends BlockSlab {
|
||||
@@ -40,7 +37,7 @@ public abstract class EnumBlockSlab<E extends Enum<E> & EnumBlock.IEnumMeta & IS
|
||||
|
||||
@SideOnly(Side.CLIENT)
|
||||
@Override
|
||||
public void getSubBlocks(@Nonnull Item itemIn, CreativeTabs tab, NonNullList<ItemStack> list) {
|
||||
public void getSubBlocks(CreativeTabs tab, NonNullList<ItemStack> list) {
|
||||
for(E type : values) {
|
||||
list.add(new ItemStack(this, 1, type.getMeta()));
|
||||
}
|
||||
|
||||
@@ -1,9 +1,11 @@
|
||||
package slimeknights.mantle.client.book.data;
|
||||
|
||||
import net.minecraft.advancements.Advancement;
|
||||
import net.minecraft.advancements.AdvancementManager;
|
||||
import net.minecraft.client.Minecraft;
|
||||
import net.minecraft.client.resources.IResource;
|
||||
import net.minecraft.stats.Achievement;
|
||||
import net.minecraft.stats.AchievementList;
|
||||
import net.minecraft.stats.StatisticsManager;
|
||||
import net.minecraft.util.ResourceLocation;
|
||||
import net.minecraftforge.fml.relauncher.Side;
|
||||
import net.minecraftforge.fml.relauncher.SideOnly;
|
||||
|
||||
@@ -111,20 +113,20 @@ public class SectionData implements IDataItem {
|
||||
return true;
|
||||
}
|
||||
|
||||
Achievement achievement = findAchievement(requirement);
|
||||
Advancement advancement = findAdvancement(requirement);
|
||||
|
||||
return achievement == null || writer.hasAchievementUnlocked(achievement);
|
||||
return advancement == null;//TODO: Readd || writer.hasAchievementUnlocked(advancement);
|
||||
|
||||
}
|
||||
|
||||
public static Achievement findAchievement(String name) {
|
||||
public static Advancement findAdvancement(String name) {
|
||||
if(name == null || name.isEmpty()) {
|
||||
return null;
|
||||
}
|
||||
|
||||
for(Achievement achievement : AchievementList.ACHIEVEMENTS) {
|
||||
if(achievement.statId.equals(name)) {
|
||||
return achievement;
|
||||
for(Advancement advancement : Minecraft.getMinecraft().player.connection.getAdvancementManager().getAdvancementList().getAdvancements()) {
|
||||
if(advancement.getId().equals(new ResourceLocation(name))) {
|
||||
return advancement;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -33,11 +33,11 @@ public class GuiArrow extends GuiButton {
|
||||
}
|
||||
|
||||
@Override
|
||||
public void drawButton(@Nonnull Minecraft mc, int mouseX, int mouseY) {
|
||||
public void drawButton(@Nonnull Minecraft mc, int mouseX, int mouseY, float partialTicks) {
|
||||
if(this.visible) {
|
||||
mc.getTextureManager().bindTexture(TEX_BOOK);
|
||||
|
||||
this.hovered = mouseX >= this.xPosition && mouseY >= this.yPosition && mouseX < this.xPosition + this.width && mouseY < this.yPosition + this.height;
|
||||
this.hovered = mouseX >= this.x && mouseY >= this.y && mouseX < this.x + this.width && mouseY < this.y + this.height;
|
||||
|
||||
int color = this.hovered ? this.hoverColor : this.color;
|
||||
|
||||
@@ -46,7 +46,7 @@ public class GuiArrow extends GuiButton {
|
||||
float b = (color & 0xff) / 255.F;
|
||||
|
||||
GlStateManager.color(r, g, b);
|
||||
Gui.drawScaledCustomSizeModalRect(xPosition, yPosition, arrowType.x, arrowType.y, width, height, width, height, 512, 512);
|
||||
Gui.drawScaledCustomSizeModalRect(x, y, arrowType.x, arrowType.y, width, height, width, height, 512, 512);
|
||||
this.mouseDragged(mc, mouseX, mouseY);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -463,22 +463,22 @@ public class GuiBook extends GuiScreen implements IProgressMeter {
|
||||
backArrow.visible = oldPage >= -1;
|
||||
|
||||
if(page == -1) {
|
||||
nextArrow.xPosition = width / 2 + 80;
|
||||
nextArrow.x = width / 2 + 80;
|
||||
indexArrow.visible = false;
|
||||
} else {
|
||||
previousArrow.xPosition = width / 2 - 184;
|
||||
nextArrow.xPosition = width / 2 + 165;
|
||||
previousArrow.x = width / 2 - 184;
|
||||
nextArrow.x = width / 2 + 165;
|
||||
|
||||
indexArrow.visible = book.findSection("index") != null && (page - 1) * 2 + 2 > book.findSection("index")
|
||||
.getPageCount();
|
||||
}
|
||||
|
||||
previousArrow.yPosition = height / 2 + 75;
|
||||
nextArrow.yPosition = height / 2 + 75;
|
||||
previousArrow.y = height / 2 + 75;
|
||||
nextArrow.y = height / 2 + 75;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void doneLoading() {
|
||||
public void onStatsUpdated() {
|
||||
loadingAchievements = false;
|
||||
|
||||
initGui();
|
||||
|
||||
@@ -32,7 +32,7 @@ public class GuiBookmark extends GuiButton {
|
||||
}
|
||||
|
||||
@Override
|
||||
public void drawButton(@Nonnull Minecraft mc, int mouseX, int mouseY) {
|
||||
public void drawButton(@Nonnull Minecraft mc, int mouseX, int mouseY, float partialTicks) {
|
||||
if(visible) {
|
||||
int tex_y = TEX_Y + HEIGHT * type;
|
||||
|
||||
@@ -43,17 +43,17 @@ public class GuiBookmark extends GuiButton {
|
||||
float b = (data.color & 0xff) / 255.F;
|
||||
|
||||
GlStateManager.color(r, g, b);
|
||||
Gui.drawScaledCustomSizeModalRect(xPosition, yPosition, TEX_X, tex_y, WIDTH, HEIGHT, width, height, 512, 512);
|
||||
Gui.drawScaledCustomSizeModalRect(x, y, TEX_X, tex_y, WIDTH, HEIGHT, width, height, 512, 512);
|
||||
|
||||
if(data.text != null && !data.text.isEmpty()) {
|
||||
TextDataRenderer
|
||||
.drawScaledString(mc.fontRenderer, data.text, xPosition + 1, yPosition + height / 2 - mc.fontRenderer.FONT_HEIGHT * TEXT_SCALE / 2 + 1, 0xFFFFFFFF, true, TEXT_SCALE);
|
||||
.drawScaledString(mc.fontRenderer, data.text, x + 1, y + height / 2 - mc.fontRenderer.FONT_HEIGHT * TEXT_SCALE / 2 + 1, 0xFFFFFFFF, true, TEXT_SCALE);
|
||||
}
|
||||
|
||||
GlStateManager.color(1F, 1F, 1F);
|
||||
|
||||
if(data.page.equals("ADD")) {
|
||||
Gui.drawModalRectWithCustomSizedTexture(xPosition + width / 2 - ADD_W / 2, yPosition + height / 2 - ADD_H / 2, ADD_X, ADD_Y, ADD_W, ADD_H, 512, 512);
|
||||
Gui.drawModalRectWithCustomSizedTexture(x + width / 2 - ADD_W / 2, y + height / 2 - ADD_H / 2, ADD_X, ADD_Y, ADD_W, ADD_H, 512, 512);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -6,7 +6,7 @@ import net.minecraft.client.gui.FontRenderer;
|
||||
import net.minecraft.client.renderer.GlStateManager;
|
||||
import net.minecraft.client.renderer.RenderHelper;
|
||||
import net.minecraft.client.renderer.Tessellator;
|
||||
import net.minecraft.client.renderer.VertexBuffer;
|
||||
import net.minecraft.client.renderer.BufferBuilder;
|
||||
import net.minecraft.client.renderer.vertex.DefaultVertexFormats;
|
||||
import net.minecraft.util.text.TextFormatting;
|
||||
import net.minecraft.util.text.translation.I18n;
|
||||
@@ -241,7 +241,7 @@ public class TextDataRenderer {
|
||||
GlStateManager.tryBlendFuncSeparate(770, 771, 1, 0);
|
||||
GlStateManager.shadeModel(7425);
|
||||
Tessellator tessellator = Tessellator.getInstance();
|
||||
VertexBuffer vertexBuffer = tessellator.getBuffer();
|
||||
BufferBuilder vertexBuffer = tessellator.getBuffer();
|
||||
vertexBuffer.begin(7, DefaultVertexFormats.POSITION_COLOR);
|
||||
vertexBuffer.pos((double) right, (double) top, 0D).color(f1, f2, f3, f).endVertex();
|
||||
vertexBuffer.pos((double) left, (double) top, 0D).color(f1, f2, f3, f).endVertex();
|
||||
|
||||
@@ -27,7 +27,7 @@ public class GuiBookEditor extends GuiScreen {
|
||||
|
||||
innerUi = new GuiBook(book, null, null);
|
||||
innerUi.mc = Minecraft.getMinecraft();
|
||||
innerUi.doneLoading();
|
||||
innerUi.onStatsUpdated();
|
||||
|
||||
innerUi._setPage(-1);
|
||||
}
|
||||
|
||||
@@ -6,6 +6,7 @@ import net.minecraft.client.gui.Gui;
|
||||
import net.minecraft.client.renderer.GlStateManager;
|
||||
import net.minecraft.client.renderer.RenderHelper;
|
||||
import net.minecraft.client.renderer.texture.TextureManager;
|
||||
import net.minecraft.client.util.ITooltipFlag;
|
||||
import net.minecraft.item.ItemStack;
|
||||
import net.minecraft.util.text.TextFormatting;
|
||||
import net.minecraftforge.fml.client.config.GuiUtils;
|
||||
@@ -54,7 +55,7 @@ public abstract class BookElement extends Gui {
|
||||
|
||||
public void renderToolTip(FontRenderer fontRenderer, ItemStack stack, int x, int y) {
|
||||
if(stack != null) {
|
||||
List<String> list = stack.getTooltip(mc.player, mc.gameSettings.advancedItemTooltips);
|
||||
List<String> list = stack.getTooltip(mc.player, mc.gameSettings.advancedItemTooltips ? ITooltipFlag.TooltipFlags.ADVANCED : ITooltipFlag.TooltipFlags.NORMAL);
|
||||
|
||||
for(int i = 0; i < list.size(); ++i) {
|
||||
if(i == 0) {
|
||||
|
||||
@@ -16,7 +16,7 @@ public class ElementArrow extends ElementButton {
|
||||
|
||||
@Override
|
||||
public void draw(int mouseX, int mouseY, float partialTicks, FontRenderer fontRenderer) {
|
||||
button.drawButton(mc, mouseX, mouseY);
|
||||
button.drawButton(mc, mouseX, mouseY, partialTicks);
|
||||
}
|
||||
|
||||
}
|
||||
@@ -1,9 +1,9 @@
|
||||
package slimeknights.mantle.client.gui.book.element;
|
||||
|
||||
import net.minecraft.advancements.Advancement;
|
||||
import net.minecraft.client.gui.FontRenderer;
|
||||
import net.minecraft.client.renderer.GlStateManager;
|
||||
import net.minecraft.client.renderer.RenderHelper;
|
||||
import net.minecraft.stats.Achievement;
|
||||
import net.minecraft.util.text.TextFormatting;
|
||||
|
||||
import java.util.ArrayList;
|
||||
@@ -84,11 +84,11 @@ public class ElementSection extends SizedBookElement {
|
||||
text.add("Requirements:");
|
||||
|
||||
for(String requirement : section.requirements) {
|
||||
Achievement achievement = SectionData.findAchievement(requirement);
|
||||
if(achievement != null) {
|
||||
Advancement advancement = SectionData.findAdvancement(requirement);
|
||||
if(advancement != null) {
|
||||
text.add((SectionData
|
||||
.requirementSatisfied(requirement, parent.statisticsManager) ? TextFormatting.GREEN : TextFormatting.RED) + TextFormatting
|
||||
.getTextWithoutFormattingCodes(achievement.getStatName().getFormattedText()));
|
||||
.getTextWithoutFormattingCodes(advancement.getDisplay().getTitle().getFormattedText()));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -7,7 +7,7 @@ import net.minecraft.client.renderer.BlockRendererDispatcher;
|
||||
import net.minecraft.client.renderer.GlStateManager;
|
||||
import net.minecraft.client.renderer.RenderHelper;
|
||||
import net.minecraft.client.renderer.Tessellator;
|
||||
import net.minecraft.client.renderer.VertexBuffer;
|
||||
import net.minecraft.client.renderer.BufferBuilder;
|
||||
import net.minecraft.client.renderer.texture.TextureMap;
|
||||
import net.minecraft.client.renderer.vertex.DefaultVertexFormats;
|
||||
import net.minecraft.item.ItemStack;
|
||||
@@ -230,7 +230,7 @@ public class ElementStructure extends SizedBookElement implements IButtonClickHa
|
||||
if(!blockAccess.isAirBlock(pos)) {
|
||||
IBlockState state = blockAccess.getBlockState(pos);
|
||||
Tessellator tessellator = Tessellator.getInstance();
|
||||
VertexBuffer buffer = tessellator.getBuffer();
|
||||
BufferBuilder buffer = tessellator.getBuffer();
|
||||
buffer.begin(GL11.GL_QUADS, DefaultVertexFormats.BLOCK);
|
||||
blockRender.renderBlock(state, pos, blockAccess, buffer);
|
||||
tessellator.draw();
|
||||
|
||||
@@ -10,7 +10,7 @@ import net.minecraft.client.renderer.block.model.ItemCameraTransforms;
|
||||
import net.minecraft.client.renderer.block.model.ItemOverrideList;
|
||||
import net.minecraft.client.renderer.texture.TextureAtlasSprite;
|
||||
import net.minecraft.util.EnumFacing;
|
||||
import net.minecraftforge.client.model.IPerspectiveAwareModel;
|
||||
import net.minecraftforge.client.model.PerspectiveMapWrapper;
|
||||
import net.minecraftforge.common.model.TRSRTransformation;
|
||||
|
||||
import org.apache.commons.lang3.tuple.Pair;
|
||||
@@ -20,7 +20,7 @@ import java.util.List;
|
||||
import javax.annotation.Nonnull;
|
||||
import javax.vecmath.Matrix4f;
|
||||
|
||||
public class BakedSimple implements IPerspectiveAwareModel {
|
||||
public class BakedSimple implements IBakedModel {
|
||||
|
||||
private final List<BakedQuad> quads;
|
||||
private final ImmutableMap<ItemCameraTransforms.TransformType, TRSRTransformation> transforms;
|
||||
@@ -101,14 +101,14 @@ public class BakedSimple implements IPerspectiveAwareModel {
|
||||
|
||||
@Override
|
||||
public Pair<? extends IBakedModel, Matrix4f> handlePerspective(ItemCameraTransforms.TransformType cameraTransformType) {
|
||||
return IPerspectiveAwareModel.MapWrapper.handlePerspective(this, transforms, cameraTransformType);
|
||||
return PerspectiveMapWrapper.handlePerspective(this, transforms, cameraTransformType);
|
||||
}
|
||||
|
||||
public static class Wrapper extends BakedSimple {
|
||||
|
||||
private final IPerspectiveAwareModel parent;
|
||||
private final IBakedModel parent;
|
||||
|
||||
public Wrapper(ImmutableList<BakedQuad> quads, IPerspectiveAwareModel base) {
|
||||
public Wrapper(ImmutableList<BakedQuad> quads, IBakedModel base) {
|
||||
super(quads, null, base);
|
||||
|
||||
parent = base;
|
||||
|
||||
@@ -9,7 +9,7 @@ import net.minecraft.client.renderer.block.model.ItemCameraTransforms;
|
||||
import net.minecraft.client.renderer.block.model.ItemOverrideList;
|
||||
import net.minecraft.client.renderer.texture.TextureAtlasSprite;
|
||||
import net.minecraft.util.EnumFacing;
|
||||
import net.minecraftforge.client.model.IPerspectiveAwareModel;
|
||||
import net.minecraftforge.client.model.PerspectiveMapWrapper;
|
||||
import net.minecraftforge.common.model.TRSRTransformation;
|
||||
|
||||
import org.apache.commons.lang3.tuple.Pair;
|
||||
@@ -66,7 +66,7 @@ public class BakedWrapper implements IBakedModel {
|
||||
return parent.getOverrides();
|
||||
}
|
||||
|
||||
public static class Perspective extends BakedWrapper implements IPerspectiveAwareModel {
|
||||
public static class Perspective extends BakedWrapper implements IBakedModel {
|
||||
protected final ImmutableMap<ItemCameraTransforms.TransformType, TRSRTransformation> transforms;
|
||||
|
||||
public Perspective(IBakedModel parent, ImmutableMap<ItemCameraTransforms.TransformType, TRSRTransformation> transforms) {
|
||||
@@ -76,7 +76,7 @@ public class BakedWrapper implements IBakedModel {
|
||||
|
||||
@Override
|
||||
public Pair<? extends IBakedModel, Matrix4f> handlePerspective(ItemCameraTransforms.TransformType cameraTransformType) {
|
||||
return IPerspectiveAwareModel.MapWrapper.handlePerspective(this, transforms, cameraTransformType);
|
||||
return PerspectiveMapWrapper.handlePerspective(this, transforms, cameraTransformType);
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -7,7 +7,6 @@ import net.minecraft.client.renderer.block.model.ItemCameraTransforms;
|
||||
import net.minecraft.client.renderer.block.model.ItemOverrideList;
|
||||
import net.minecraft.client.renderer.texture.TextureAtlasSprite;
|
||||
import net.minecraft.util.EnumFacing;
|
||||
import net.minecraftforge.client.model.IPerspectiveAwareModel;
|
||||
|
||||
import org.apache.commons.lang3.tuple.Pair;
|
||||
|
||||
@@ -21,7 +20,7 @@ import slimeknights.mantle.client.ModelHelper;
|
||||
/**
|
||||
* Takes a blockmodel and applies the standard-block-perspective for third_person to it
|
||||
*/
|
||||
public class BlockItemModelWrapper implements IPerspectiveAwareModel, IBakedModel {
|
||||
public class BlockItemModelWrapper implements IBakedModel {
|
||||
|
||||
private final IBakedModel parent;
|
||||
|
||||
|
||||
@@ -5,9 +5,9 @@ import com.google.common.reflect.TypeToken;
|
||||
import net.minecraft.block.Block;
|
||||
import net.minecraft.item.Item;
|
||||
import net.minecraft.util.ResourceLocation;
|
||||
import net.minecraftforge.fml.common.registry.GameData;
|
||||
import net.minecraftforge.fml.common.registry.IForgeRegistry;
|
||||
import net.minecraftforge.fml.common.registry.IForgeRegistryEntry;
|
||||
import net.minecraftforge.fml.common.registry.ForgeRegistries;
|
||||
import net.minecraftforge.registries.IForgeRegistry;
|
||||
import net.minecraftforge.registries.IForgeRegistryEntry;
|
||||
|
||||
import java.io.BufferedReader;
|
||||
import java.io.ByteArrayInputStream;
|
||||
@@ -206,14 +206,14 @@ public abstract class AbstractConfigFile implements Serializable {
|
||||
TypeSerializers.getDefaultSerializers().registerType(TypeToken.of(Block.class), new RegistrySerializer<Block>() {
|
||||
@Override
|
||||
IForgeRegistry<Block> getRegistry() {
|
||||
return GameData.getBlockRegistry();
|
||||
return ForgeRegistries.BLOCKS;
|
||||
}
|
||||
});
|
||||
|
||||
TypeSerializers.getDefaultSerializers().registerType(TypeToken.of(Item.class), new RegistrySerializer<Item>() {
|
||||
@Override
|
||||
IForgeRegistry<Item> getRegistry() {
|
||||
return GameData.getItemRegistry();
|
||||
return ForgeRegistries.ITEMS;
|
||||
}
|
||||
});
|
||||
|
||||
|
||||
@@ -118,7 +118,7 @@ public class SlotWrapper extends Slot {
|
||||
|
||||
@SideOnly(Side.CLIENT)
|
||||
@Override
|
||||
public boolean canBeHovered() {
|
||||
return parent.canBeHovered();
|
||||
public boolean isEnabled() {
|
||||
return parent.isEnabled();
|
||||
}
|
||||
}
|
||||
@@ -1,9 +1,10 @@
|
||||
package slimeknights.mantle.item;
|
||||
|
||||
import net.minecraft.entity.player.EntityPlayer;
|
||||
import net.minecraft.client.util.ITooltipFlag;
|
||||
import net.minecraft.inventory.EntityEquipmentSlot;
|
||||
import net.minecraft.item.ItemArmor;
|
||||
import net.minecraft.item.ItemStack;
|
||||
import net.minecraft.world.World;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
@@ -14,7 +15,7 @@ public class ItemArmorTooltip extends ItemArmor {
|
||||
}
|
||||
|
||||
@Override
|
||||
public void addInformation(ItemStack p_addInformation_1_, EntityPlayer p_addInformation_2_, List<String> p_addInformation_3_, boolean p_addInformation_4_) {
|
||||
public void addInformation(ItemStack p_addInformation_1_, World p_addInformation_2_, List<String> p_addInformation_3_, ITooltipFlag p_addInformation_4_) {
|
||||
ItemTooltip.addOptionalTooltip(p_addInformation_1_, p_addInformation_3_);
|
||||
super.addInformation(p_addInformation_1_, p_addInformation_2_, p_addInformation_3_, p_addInformation_4_);
|
||||
}
|
||||
|
||||
@@ -4,15 +4,16 @@ import net.minecraft.block.Block;
|
||||
import net.minecraft.block.properties.IProperty;
|
||||
import net.minecraft.block.state.IBlockState;
|
||||
import net.minecraft.client.renderer.block.model.ModelResourceLocation;
|
||||
import net.minecraft.entity.player.EntityPlayer;
|
||||
import net.minecraft.client.util.ITooltipFlag;
|
||||
import net.minecraft.item.Item;
|
||||
import net.minecraft.item.ItemColored;
|
||||
import net.minecraft.item.ItemStack;
|
||||
import net.minecraft.util.ResourceLocation;
|
||||
import net.minecraft.util.text.TextFormatting;
|
||||
import net.minecraft.util.text.translation.I18n;
|
||||
import net.minecraft.world.World;
|
||||
import net.minecraftforge.client.model.ModelLoader;
|
||||
import net.minecraftforge.fml.common.registry.GameData;
|
||||
import net.minecraftforge.fml.common.registry.ForgeRegistries;
|
||||
import net.minecraftforge.fml.relauncher.Side;
|
||||
import net.minecraftforge.fml.relauncher.SideOnly;
|
||||
|
||||
@@ -49,7 +50,7 @@ public class ItemBlockMeta extends ItemColored {
|
||||
}
|
||||
|
||||
@Override
|
||||
public void addInformation(@Nonnull ItemStack stack, @Nonnull EntityPlayer playerIn, @Nonnull List<String> tooltip, boolean advanced) {
|
||||
public void addInformation(@Nonnull ItemStack stack, @Nonnull World worldIn, @Nonnull List<String> tooltip, ITooltipFlag advanced) {
|
||||
if(I18n.canTranslate(this.getUnlocalizedName(stack) + ".tooltip")) {
|
||||
tooltip.addAll(LocUtils.getTooltips(TextFormatting.GRAY.toString() +
|
||||
LocUtils.translateRecursive(this.getUnlocalizedName(stack) + ".tooltip")));
|
||||
@@ -58,13 +59,13 @@ public class ItemBlockMeta extends ItemColored {
|
||||
tooltip.addAll(LocUtils.getTooltips(
|
||||
TextFormatting.GRAY.toString() + LocUtils.translateRecursive(super.getUnlocalizedName(stack) + ".tooltip")));
|
||||
}
|
||||
super.addInformation(stack, playerIn, tooltip, advanced);
|
||||
super.addInformation(stack, worldIn, tooltip, advanced);
|
||||
}
|
||||
|
||||
@SideOnly(Side.CLIENT)
|
||||
public void registerItemModels() {
|
||||
final Item item = this;
|
||||
final ResourceLocation loc = GameData.getBlockRegistry().getNameForObject(block);
|
||||
final ResourceLocation loc = ForgeRegistries.BLOCKS.getKey(block);
|
||||
|
||||
|
||||
for(Comparable o : (Collection<Comparable>) mappingProperty.getAllowedValues()) {
|
||||
|
||||
@@ -3,7 +3,6 @@ package slimeknights.mantle.item;
|
||||
import net.minecraft.block.Block;
|
||||
import net.minecraft.block.BlockSlab;
|
||||
import net.minecraft.block.SoundType;
|
||||
import net.minecraft.block.properties.IProperty;
|
||||
import net.minecraft.block.state.IBlockState;
|
||||
import net.minecraft.client.renderer.block.model.ModelResourceLocation;
|
||||
import net.minecraft.entity.player.EntityPlayer;
|
||||
@@ -19,7 +18,7 @@ import net.minecraft.util.math.AxisAlignedBB;
|
||||
import net.minecraft.util.math.BlockPos;
|
||||
import net.minecraft.world.World;
|
||||
import net.minecraftforge.client.model.ModelLoader;
|
||||
import net.minecraftforge.fml.common.registry.GameData;
|
||||
import net.minecraftforge.fml.common.registry.ForgeRegistries;
|
||||
import net.minecraftforge.fml.relauncher.Side;
|
||||
import net.minecraftforge.fml.relauncher.SideOnly;
|
||||
|
||||
@@ -124,7 +123,7 @@ public class ItemBlockSlab<T extends Enum<T> &EnumBlock.IEnumMeta & IStringSeria
|
||||
@SideOnly(Side.CLIENT)
|
||||
public void registerItemModels() {
|
||||
final Item item = this;
|
||||
final ResourceLocation loc = GameData.getBlockRegistry().getNameForObject(block);
|
||||
final ResourceLocation loc = ForgeRegistries.BLOCKS.getKey(block);
|
||||
|
||||
for(T o : (Collection<T>) mappingProperty.getAllowedValues()) {
|
||||
int meta = block.getMetaFromState(block.getDefaultState().withProperty(mappingProperty, o));
|
||||
|
||||
@@ -1,18 +1,16 @@
|
||||
package slimeknights.mantle.item;
|
||||
|
||||
import com.google.common.collect.ImmutableList;
|
||||
|
||||
import gnu.trove.map.hash.TIntFloatHashMap;
|
||||
import gnu.trove.map.hash.TIntIntHashMap;
|
||||
import gnu.trove.map.hash.TIntObjectHashMap;
|
||||
|
||||
import net.minecraft.client.util.ITooltipFlag;
|
||||
import net.minecraft.creativetab.CreativeTabs;
|
||||
import net.minecraft.entity.player.EntityPlayer;
|
||||
import net.minecraft.item.Item;
|
||||
import net.minecraft.item.ItemFood;
|
||||
import net.minecraft.item.ItemStack;
|
||||
import net.minecraft.potion.PotionEffect;
|
||||
import net.minecraft.potion.PotionUtils;
|
||||
import net.minecraft.util.ActionResult;
|
||||
import net.minecraft.util.EnumActionResult;
|
||||
import net.minecraft.util.EnumHand;
|
||||
@@ -119,8 +117,8 @@ public class ItemEdible extends ItemFood {
|
||||
}
|
||||
|
||||
@Override
|
||||
public void addInformation(ItemStack stack, EntityPlayer playerIn, List<String> tooltip, boolean advanced) {
|
||||
dynamic.addInformation(stack, playerIn, tooltip, advanced);
|
||||
public void addInformation(ItemStack stack, World worldIn, List<String> tooltip, ITooltipFlag advanced) {
|
||||
dynamic.addInformation(stack, worldIn, tooltip, advanced);
|
||||
|
||||
// effect info
|
||||
if(displayEffectsTooltip) {
|
||||
@@ -132,8 +130,14 @@ public class ItemEdible extends ItemFood {
|
||||
|
||||
@SideOnly(Side.CLIENT)
|
||||
@Override
|
||||
public void getSubItems(@Nonnull Item itemIn, CreativeTabs tab, NonNullList<ItemStack> subItems) {
|
||||
dynamic.getSubItems(itemIn, tab, subItems);
|
||||
public void getSubItems(CreativeTabs tab, NonNullList<ItemStack> subItems) {
|
||||
if(this.isInCreativeTab(tab)) {
|
||||
for(int i = 0; i <= dynamic.availabilityMask.length; i++) {
|
||||
if(dynamic.isValid(i)) {
|
||||
subItems.add(new ItemStack(this, 1, i));
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@SideOnly(Side.CLIENT)
|
||||
|
||||
@@ -5,19 +5,15 @@ import gnu.trove.procedure.TIntObjectProcedure;
|
||||
|
||||
import net.minecraft.client.renderer.block.model.ModelResourceLocation;
|
||||
import net.minecraft.creativetab.CreativeTabs;
|
||||
import net.minecraft.entity.player.EntityPlayer;
|
||||
import net.minecraft.item.Item;
|
||||
import net.minecraft.item.ItemStack;
|
||||
import net.minecraft.util.NonNullList;
|
||||
import net.minecraft.util.text.TextFormatting;
|
||||
import net.minecraft.util.text.translation.I18n;
|
||||
import net.minecraftforge.client.model.ModelLoader;
|
||||
import net.minecraftforge.fml.common.Loader;
|
||||
import net.minecraftforge.fml.relauncher.Side;
|
||||
import net.minecraftforge.fml.relauncher.SideOnly;
|
||||
|
||||
import java.util.Arrays;
|
||||
import java.util.List;
|
||||
|
||||
import javax.annotation.Nonnull;
|
||||
|
||||
@@ -81,10 +77,12 @@ public class ItemMetaDynamic extends ItemTooltip {
|
||||
}
|
||||
|
||||
@Override
|
||||
public void getSubItems(@Nonnull Item itemIn, CreativeTabs tab, NonNullList<ItemStack> subItems) {
|
||||
for(int i = 0; i <= availabilityMask.length; i++) {
|
||||
if(isValid(i)) {
|
||||
subItems.add(new ItemStack(itemIn, 1, i));
|
||||
public void getSubItems(CreativeTabs tab, NonNullList<ItemStack> subItems) {
|
||||
if(this.isInCreativeTab(tab)) {
|
||||
for(int i = 0; i <= availabilityMask.length; i++) {
|
||||
if(isValid(i)) {
|
||||
subItems.add(new ItemStack(this, 1, i));
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,10 +1,11 @@
|
||||
package slimeknights.mantle.item;
|
||||
|
||||
import net.minecraft.entity.player.EntityPlayer;
|
||||
import net.minecraft.client.util.ITooltipFlag;
|
||||
import net.minecraft.item.Item;
|
||||
import net.minecraft.item.ItemStack;
|
||||
import net.minecraft.util.text.TextFormatting;
|
||||
import net.minecraft.util.text.translation.I18n;
|
||||
import net.minecraft.world.World;
|
||||
import net.minecraftforge.fml.relauncher.Side;
|
||||
import net.minecraftforge.fml.relauncher.SideOnly;
|
||||
|
||||
@@ -17,9 +18,9 @@ public class ItemTooltip extends Item {
|
||||
|
||||
@Override
|
||||
@SideOnly(Side.CLIENT)
|
||||
public void addInformation(ItemStack stack, EntityPlayer playerIn, List<String> tooltip, boolean advanced) {
|
||||
public void addInformation(ItemStack stack, World worldIn, List<String> tooltip, ITooltipFlag advanced) {
|
||||
addOptionalTooltip(stack, tooltip);
|
||||
super.addInformation(stack, playerIn, tooltip, advanced);
|
||||
super.addInformation(stack, worldIn, tooltip, advanced);
|
||||
}
|
||||
|
||||
public static void addOptionalTooltip(ItemStack stack, List<String> tooltip) {
|
||||
|
||||
@@ -9,7 +9,7 @@ import net.minecraft.tileentity.TileEntity;
|
||||
import net.minecraft.util.ResourceLocation;
|
||||
import net.minecraft.util.math.BlockPos;
|
||||
import net.minecraft.world.World;
|
||||
import net.minecraftforge.fml.common.registry.GameData;
|
||||
import net.minecraftforge.fml.common.registry.ForgeRegistries;
|
||||
|
||||
import javax.annotation.Nonnull;
|
||||
|
||||
@@ -109,7 +109,7 @@ public class MultiServantLogic extends TileEntity implements IServantLogic {
|
||||
int yCenter = tags.getInteger("yCenter");
|
||||
int zCenter = tags.getInteger("zCenter");
|
||||
this.master = new BlockPos(xCenter, yCenter, zCenter);
|
||||
this.masterBlock = GameData.getBlockRegistry().getObject(new ResourceLocation(tags.getString("MasterBlockName")));
|
||||
this.masterBlock = ForgeRegistries.BLOCKS.getValue(new ResourceLocation(tags.getString("MasterBlockName")));
|
||||
this.state = Block.getStateById(tags.getInteger("masterState"));
|
||||
}
|
||||
}
|
||||
@@ -120,7 +120,7 @@ public class MultiServantLogic extends TileEntity implements IServantLogic {
|
||||
tags.setInteger("xCenter", this.master.getX());
|
||||
tags.setInteger("yCenter", this.master.getY());
|
||||
tags.setInteger("zCenter", this.master.getZ());
|
||||
tags.setString("MasterBlockName", GameData.getBlockRegistry().getNameForObject(this.masterBlock).toString());
|
||||
tags.setString("MasterBlockName", ForgeRegistries.BLOCKS.getKey(this.masterBlock).toString());
|
||||
tags.setInteger("masterState", Block.getStateId(this.state));
|
||||
}
|
||||
return tags;
|
||||
|
||||
@@ -1,93 +0,0 @@
|
||||
package slimeknights.mantle.util;
|
||||
|
||||
import net.minecraft.item.Item;
|
||||
import net.minecraft.item.ItemStack;
|
||||
import net.minecraft.item.crafting.CraftingManager;
|
||||
import net.minecraft.item.crafting.FurnaceRecipes;
|
||||
import net.minecraft.item.crafting.IRecipe;
|
||||
import net.minecraft.item.crafting.ShapedRecipes;
|
||||
import net.minecraft.item.crafting.ShapelessRecipes;
|
||||
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
|
||||
@SuppressWarnings("unchecked")
|
||||
public class RecipeRemover {
|
||||
|
||||
public static void removeShapedRecipes(List<ItemStack> removelist) {
|
||||
for(ItemStack stack : removelist) {
|
||||
removeShapedRecipe(stack);
|
||||
}
|
||||
}
|
||||
|
||||
public static void removeAnyRecipe(ItemStack resultItem) {
|
||||
List<IRecipe> recipes = CraftingManager.getInstance().getRecipeList();
|
||||
for(int i = 0; i < recipes.size(); i++) {
|
||||
IRecipe tmpRecipe = recipes.get(i);
|
||||
ItemStack recipeResult = tmpRecipe.getRecipeOutput();
|
||||
if(ItemStack.areItemStacksEqual(resultItem, recipeResult)) {
|
||||
recipes.remove(i--);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public static void removeShapedRecipe(ItemStack resultItem) {
|
||||
List<IRecipe> recipes = CraftingManager.getInstance().getRecipeList();
|
||||
for(int i = 0; i < recipes.size(); i++) {
|
||||
IRecipe tmpRecipe = recipes.get(i);
|
||||
if(tmpRecipe instanceof ShapedRecipes) {
|
||||
ShapedRecipes recipe = (ShapedRecipes) tmpRecipe;
|
||||
ItemStack recipeResult = recipe.getRecipeOutput();
|
||||
|
||||
if(ItemStack.areItemStacksEqual(resultItem, recipeResult)) {
|
||||
recipes.remove(i--);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public static void removeShapelessRecipe(ItemStack resultItem) {
|
||||
List<IRecipe> recipes = CraftingManager.getInstance().getRecipeList();
|
||||
for(int i = 0; i < recipes.size(); i++) {
|
||||
IRecipe tmpRecipe = recipes.get(i);
|
||||
if(tmpRecipe instanceof ShapelessRecipes) {
|
||||
ShapelessRecipes recipe = (ShapelessRecipes) tmpRecipe;
|
||||
ItemStack recipeResult = recipe.getRecipeOutput();
|
||||
|
||||
if(ItemStack.areItemStacksEqual(resultItem, recipeResult)) {
|
||||
recipes.remove(i--);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public static void removeFurnaceRecipe(ItemStack resultItem) {
|
||||
Map<ItemStack, ItemStack> recipes = FurnaceRecipes.instance().getSmeltingList();
|
||||
recipes.remove(resultItem);
|
||||
}
|
||||
|
||||
public static void removeFurnaceRecipe(Item i, int metadata) {
|
||||
removeFurnaceRecipe(new ItemStack(i, 1, metadata));
|
||||
}
|
||||
|
||||
public static void removeFurnaceRecipe(Item i) {
|
||||
removeFurnaceRecipe(new ItemStack(i, 1, 32767));
|
||||
}
|
||||
/*
|
||||
// todo: 1.9
|
||||
//removes from all vanilla worldgen chests :D
|
||||
public static void removeFromChests(ItemStack resultItem)
|
||||
{
|
||||
ChestGenHooks.getInfo(ChestGenHooks.BONUS_CHEST).removeItem(resultItem);
|
||||
ChestGenHooks.getInfo(ChestGenHooks.VILLAGE_BLACKSMITH).removeItem(resultItem);
|
||||
ChestGenHooks.getInfo(ChestGenHooks.DUNGEON_CHEST).removeItem(resultItem);
|
||||
ChestGenHooks.getInfo(ChestGenHooks.MINESHAFT_CORRIDOR).removeItem(resultItem);
|
||||
ChestGenHooks.getInfo(ChestGenHooks.PYRAMID_DESERT_CHEST).removeItem(resultItem);
|
||||
ChestGenHooks.getInfo(ChestGenHooks.PYRAMID_JUNGLE_CHEST).removeItem(resultItem);
|
||||
ChestGenHooks.getInfo(ChestGenHooks.PYRAMID_JUNGLE_DISPENSER).removeItem(resultItem);
|
||||
ChestGenHooks.getInfo(ChestGenHooks.STRONGHOLD_CORRIDOR).removeItem(resultItem);
|
||||
ChestGenHooks.getInfo(ChestGenHooks.STRONGHOLD_CROSSING).removeItem(resultItem);
|
||||
ChestGenHooks.getInfo(ChestGenHooks.STRONGHOLD_LIBRARY).removeItem(resultItem);
|
||||
|
||||
}*/
|
||||
}
|
||||
Reference in new issue
Block a user