From d61c09ec39c7293755d9c12c9717e8d05501dfbe Mon Sep 17 00:00:00 2001 From: makeo Date: Tue, 10 Nov 2015 16:19:49 +0100 Subject: [PATCH] Removed redundant handling from eldritch focus --- .../makeo/gadomancy/client/ClientProxy.java | 6 ++-- .../tile/RenderTileManipulationFocus.java | 7 ++--- .../common/blocks/BlockStoneMachine.java | 4 +-- .../blocks/tiles/TileManipulationFocus.java | 29 ++---------------- ...n_focus_1.png => manipulation_focus_3.png} | Bin 5 files changed, 11 insertions(+), 35 deletions(-) rename src/main/resources/assets/gadomancy/textures/models/{manipulation_focus_1.png => manipulation_focus_3.png} (100%) diff --git a/src/main/java/makeo/gadomancy/client/ClientProxy.java b/src/main/java/makeo/gadomancy/client/ClientProxy.java index d1e2779..58797f6 100644 --- a/src/main/java/makeo/gadomancy/client/ClientProxy.java +++ b/src/main/java/makeo/gadomancy/client/ClientProxy.java @@ -123,8 +123,10 @@ public class ClientProxy extends CommonProxy { ItemRenderStoneMachine itemRenderStoneMachine = new ItemRenderStoneMachine(); MinecraftForgeClient.registerItemRenderer(Item.getItemFromBlock(RegisteredBlocks.blockStoneMachine), itemRenderStoneMachine); - itemRenderStoneMachine.registerRenderer(0, new TileManipulationFocus().setFociId(0), renderTileManipulationFocus); - itemRenderStoneMachine.registerRenderer(3, new TileManipulationFocus().setFociId(1), renderTileManipulationFocus); + itemRenderStoneMachine.registerRenderer(0, new TileManipulationFocus(), renderTileManipulationFocus); + TileManipulationFocus tileManipulationFocus = new TileManipulationFocus(); + tileManipulationFocus.blockMetadata = 3; + itemRenderStoneMachine.registerRenderer(3, tileManipulationFocus, renderTileManipulationFocus); MinecraftForgeClient.registerItemRenderer(RegisteredItems.itemFamiliar, new ItemRenderFamiliar()); MinecraftForgeClient.registerItemRenderer(RegisteredItems.itemCreativeNode, new ItemCreativeNodeRenderer()); diff --git a/src/main/java/makeo/gadomancy/client/renderers/tile/RenderTileManipulationFocus.java b/src/main/java/makeo/gadomancy/client/renderers/tile/RenderTileManipulationFocus.java index 41c6cdb..d96b6a1 100644 --- a/src/main/java/makeo/gadomancy/client/renderers/tile/RenderTileManipulationFocus.java +++ b/src/main/java/makeo/gadomancy/client/renderers/tile/RenderTileManipulationFocus.java @@ -21,19 +21,18 @@ public class RenderTileManipulationFocus extends TileEntitySpecialRenderer { private static final ModelFocusPortalPart PORTAL_FOCUS = new ModelFocusPortalPart(); public void renderTileEntityAt(TileManipulationFocus tile, double x, double y, double z, float partialTicks) { - if(tile.getFociId() == -1) return; GL11.glPushMatrix(); GL11.glTranslated(x, y, z); - bindTexture(new SimpleResourceLocation("models/manipulation_focus_" + tile.getFociId() + ".png")); + bindTexture(new SimpleResourceLocation("models/manipulation_focus_" + tile.getBlockMetadata() + ".png")); GL11.glRotatef(180, 1, 0, 0); GL11.glTranslatef(0.5f, -1.5f + (2/16f), -0.5f); - if(tile.getFociId() == 0 || tile.getFociId() == 1) { + if(tile.getBlockMetadata() == 0 || tile.getBlockMetadata() == 3) { GL11.glPushMatrix(); for(int i = 0; i < 4; i++) { - if(tile.getFociId() == 0) { + if(tile.getBlockMetadata() == 0) { RANDOM_FOCUS.render(null, 0, 0, 0, 0, 0, 0.0625f); } else { PORTAL_FOCUS.render(null, 0, 0, 0, 0, 0, 0.0625f); diff --git a/src/main/java/makeo/gadomancy/common/blocks/BlockStoneMachine.java b/src/main/java/makeo/gadomancy/common/blocks/BlockStoneMachine.java index 20488fa..7eb689a 100644 --- a/src/main/java/makeo/gadomancy/common/blocks/BlockStoneMachine.java +++ b/src/main/java/makeo/gadomancy/common/blocks/BlockStoneMachine.java @@ -167,7 +167,7 @@ public class BlockStoneMachine extends Block { } } - @Override + /*@Override public void onPostBlockPlaced(World world, int x, int y, int z, int metadata) { if(metadata == 0 || metadata == 3) { TileEntity te = world.getTileEntity(x, y, z); @@ -175,7 +175,7 @@ public class BlockStoneMachine extends Block { ((TileManipulationFocus) te).setFociId(metadata == 0 ? 0 : 1); } } - } + }*/ @Override public boolean onBlockActivated(World world, int x, int y, int z, EntityPlayer player, int side, float hitX, float hitY, float hitZ) { diff --git a/src/main/java/makeo/gadomancy/common/blocks/tiles/TileManipulationFocus.java b/src/main/java/makeo/gadomancy/common/blocks/tiles/TileManipulationFocus.java index 79163f6..41967ef 100644 --- a/src/main/java/makeo/gadomancy/common/blocks/tiles/TileManipulationFocus.java +++ b/src/main/java/makeo/gadomancy/common/blocks/tiles/TileManipulationFocus.java @@ -1,6 +1,6 @@ package makeo.gadomancy.common.blocks.tiles; -import net.minecraft.nbt.NBTTagCompound; +import net.minecraft.tileentity.TileEntity; /** * This class is part of the Gadomancy Mod @@ -10,34 +10,9 @@ import net.minecraft.nbt.NBTTagCompound; * * Created by makeo @ 28.10.2015 16:27 */ -public class TileManipulationFocus extends SynchronizedTileEntity { - - private int fociId = -1; - - - public int getFociId() { - return fociId == -1 ? blockMetadata != -1 ? blockMetadata == 0 ? 0 : 1 : -1 : fociId; - } - - public TileManipulationFocus setFociId(int fociId) { - this.fociId = fociId; - return this; - } - +public class TileManipulationFocus extends TileEntity { @Override public boolean canUpdate() { return false; } - - @Override - public void writeCustomNBT(NBTTagCompound compound) { - compound.setInteger("fociId", this.fociId); - super.writeCustomNBT(compound); - } - - @Override - public void readCustomNBT(NBTTagCompound compound) { - this.fociId = compound.getInteger("fociId"); - super.readCustomNBT(compound); - } } diff --git a/src/main/resources/assets/gadomancy/textures/models/manipulation_focus_1.png b/src/main/resources/assets/gadomancy/textures/models/manipulation_focus_3.png similarity index 100% rename from src/main/resources/assets/gadomancy/textures/models/manipulation_focus_1.png rename to src/main/resources/assets/gadomancy/textures/models/manipulation_focus_3.png