Removed redundant handling from eldritch focus

This commit is contained in:
makeo committed 2015-11-10 16:19:49 +01:00
1 parent 2088f3d2d2
commit d61c09ec39
5 files changed
+11 -35

No files matched your search

@@ -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());
@@ -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);
@@ -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) {
@@ -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);
}
}