diff --git a/ee3_common/com/pahimar/ee3/block/BlockEE.java b/ee3_common/com/pahimar/ee3/block/BlockEE.java index efdb2f60..db52fc33 100644 --- a/ee3_common/com/pahimar/ee3/block/BlockEE.java +++ b/ee3_common/com/pahimar/ee3/block/BlockEE.java @@ -43,7 +43,7 @@ public abstract class BlockEE extends BlockContainer { */ @Override public void onBlockPlacedBy(World world, int x, int y, int z, EntityLiving entityLiving, ItemStack itemStack) { - + int direction = 0; int facing = MathHelper.floor_double(entityLiving.rotationYaw * 4.0F / 360.0F + 0.5D) & 3; diff --git a/ee3_common/com/pahimar/ee3/block/BlockGlassBell.java b/ee3_common/com/pahimar/ee3/block/BlockGlassBell.java index 1e7d6e17..e905ebe0 100644 --- a/ee3_common/com/pahimar/ee3/block/BlockGlassBell.java +++ b/ee3_common/com/pahimar/ee3/block/BlockGlassBell.java @@ -2,7 +2,6 @@ package com.pahimar.ee3.block; import java.util.Random; -import net.minecraft.block.Block; import net.minecraft.block.material.Material; import net.minecraft.entity.EntityLiving; import net.minecraft.entity.item.EntityItem; @@ -15,7 +14,6 @@ import net.minecraft.util.MovingObjectPosition; import net.minecraft.util.Vec3; import net.minecraft.world.IBlockAccess; import net.minecraft.world.World; -import net.minecraftforge.common.ForgeDirection; import com.pahimar.ee3.EquivalentExchange3; import com.pahimar.ee3.lib.GuiIds; @@ -88,79 +86,77 @@ public class BlockGlassBell extends BlockEE { return true; } } - + @Override public void onBlockPlacedBy(World world, int x, int y, int z, EntityLiving entityLiving, ItemStack itemStack) { if (itemStack.hasDisplayName()) { ((TileEE) world.getBlockTileEntity(x, y, z)).setCustomName(itemStack.getDisplayName()); } - + ((TileEE) world.getBlockTileEntity(x, y, z)).setOrientation(world.getBlockMetadata(x, y, z)); + + world.setBlockMetadataWithNotify(x, y, z, 0, 3); } - + @Override public int onBlockPlaced(World world, int x, int y, int z, int sideHit, float hitX, float hitY, float hitZ, int metaData) { - + return sideHit; } - + /** - * Ray traces through the blocks collision from start vector to end vector returning a ray trace hit. Args: world, - * x, y, z, startVec, endVec + * Ray traces through the blocks collision from start vector to end vector + * returning a ray trace hit. Args: world, x, y, z, startVec, endVec */ @Override - public MovingObjectPosition collisionRayTrace(World world, int x, int y, int z, Vec3 startVec, Vec3 endVec) - { - int metaData = world.getBlockMetadata(x, y, z) & 7; + public MovingObjectPosition collisionRayTrace(World world, int x, int y, int z, Vec3 startVec, Vec3 endVec) { + TileEntity tileEntity = world.getBlockTileEntity(x, y, z); - switch (ForgeDirection.getOrientation(metaData)) { - case DOWN: { - this.setBlockBounds(0.125F, 0.33F, 0.125F, 0.875F, 1.0F, 0.875F); - break; - } - case UP: { - this.setBlockBounds(0.125F, 0.0F, 0.125F, 0.875F, 0.66F, 0.875F); - break; - } - case NORTH: { - this.setBlockBounds(0.125F, 0.125F, 0.33F, 0.875F, 0.875F, 1.0F); - break; - } - case SOUTH: { - this.setBlockBounds(0.125F, 0.125F, 0.0F, 0.875F, 0.875F, 0.66F); - break; - } - case EAST: { - this.setBlockBounds(0.0F, 0.125F, 0.125F, 0.66F, 0.875F, 0.875F); - break; - } - case WEST: { - this.setBlockBounds(0.33F, 0.125F, 0.125F, 1.0F, 0.875F, 0.875F); - break; - } - case UNKNOWN: { - break; + if (tileEntity != null) { + if (tileEntity instanceof TileGlassBell) { + + TileGlassBell tileGlassBell = (TileGlassBell) tileEntity; + + switch (tileGlassBell.getOrientation()) { + case DOWN: { + this.setBlockBounds(0.125F, 0.33F, 0.125F, 0.875F, 1.0F, 0.875F); + break; + } + case UP: { + this.setBlockBounds(0.125F, 0.0F, 0.125F, 0.875F, 0.66F, 0.875F); + break; + } + case NORTH: { + this.setBlockBounds(0.125F, 0.125F, 0.33F, 0.875F, 0.875F, 1.0F); + break; + } + case SOUTH: { + this.setBlockBounds(0.125F, 0.125F, 0.0F, 0.875F, 0.875F, 0.66F); + break; + } + case EAST: { + this.setBlockBounds(0.0F, 0.125F, 0.125F, 0.66F, 0.875F, 0.875F); + break; + } + case WEST: { + this.setBlockBounds(0.33F, 0.125F, 0.125F, 1.0F, 0.875F, 0.875F); + break; + } + case UNKNOWN: { + break; + } + } } } return super.collisionRayTrace(world, x, y, z, startVec, endVec); } - + @Override public int getLightValue(IBlockAccess world, int x, int y, int z) { - - TileGlassBell tileGlassBell = (TileGlassBell) world.getBlockTileEntity(x, y, z); - - if (tileGlassBell != null) { - if (tileGlassBell.getStackInSlot(0) != null) { - if (tileGlassBell.getStackInSlot(0).itemID < 4096) { - return Block.lightValue[tileGlassBell.getStackInSlot(0).itemID]; - } - } - } - - return 0; + + return world.getBlockMetadata(x, y, z); } private void dropInventory(World world, int x, int y, int z) { @@ -196,5 +192,4 @@ public class BlockGlassBell extends BlockEE { } } } - } diff --git a/ee3_common/com/pahimar/ee3/block/ModBlocks.java b/ee3_common/com/pahimar/ee3/block/ModBlocks.java index 4368aa4c..a5bc6905 100644 --- a/ee3_common/com/pahimar/ee3/block/ModBlocks.java +++ b/ee3_common/com/pahimar/ee3/block/ModBlocks.java @@ -49,7 +49,7 @@ public class ModBlocks { private static void initBlockRecipes() { - GameRegistry.addRecipe(new ItemStack(glassBell), new Object[] {"iii", "i i", "i i", Character.valueOf('i'), Block.glass }); - GameRegistry.addRecipe(new ItemStack(aludelBase), new Object[] {"iii", "sis", "iii", Character.valueOf('i'), Item.ingotIron, Character.valueOf('s'), Block.stone }); + GameRegistry.addRecipe(new ItemStack(glassBell), new Object[] { "iii", "i i", "i i", Character.valueOf('i'), Block.glass }); + GameRegistry.addRecipe(new ItemStack(aludelBase), new Object[] { "iii", "sis", "iii", Character.valueOf('i'), Item.ingotIron, Character.valueOf('s'), Block.stone }); } } diff --git a/ee3_common/com/pahimar/ee3/client/renderer/tileentity/TileEntityAlchemicalChestRenderer.java b/ee3_common/com/pahimar/ee3/client/renderer/tileentity/TileEntityAlchemicalChestRenderer.java index dff09bba..1b9a6d2f 100644 --- a/ee3_common/com/pahimar/ee3/client/renderer/tileentity/TileEntityAlchemicalChestRenderer.java +++ b/ee3_common/com/pahimar/ee3/client/renderer/tileentity/TileEntityAlchemicalChestRenderer.java @@ -25,7 +25,8 @@ import cpw.mods.fml.relauncher.SideOnly; * */ @SideOnly(Side.CLIENT) -public class TileEntityAlchemicalChestRenderer extends TileEntitySpecialRenderer { +public class TileEntityAlchemicalChestRenderer extends + TileEntitySpecialRenderer { private ModelChest modelChest = new ModelChest(); diff --git a/ee3_common/com/pahimar/ee3/client/renderer/tileentity/TileEntityGlassBellRenderer.java b/ee3_common/com/pahimar/ee3/client/renderer/tileentity/TileEntityGlassBellRenderer.java index 54771a76..dbbefdac 100644 --- a/ee3_common/com/pahimar/ee3/client/renderer/tileentity/TileEntityGlassBellRenderer.java +++ b/ee3_common/com/pahimar/ee3/client/renderer/tileentity/TileEntityGlassBellRenderer.java @@ -53,7 +53,7 @@ public class TileEntityGlassBellRenderer extends TileEntitySpecialRenderer { if (tileEntity instanceof TileGlassBell) { TileGlassBell tileGlassBell = (TileGlassBell) tileEntity; - + GL11.glDisable(GL11.GL_LIGHTING); GL11.glDisable(GL11.GL_CULL_FACE); @@ -76,14 +76,14 @@ public class TileEntityGlassBellRenderer extends TileEntitySpecialRenderer { * Render the ghost item inside of the Glass Bell, slowly spinning */ GL11.glPushMatrix(); - + for (int i = 0; i < tileGlassBell.getSizeInventory(); i++) { - + if (tileGlassBell.getStackInSlot(i) != null) { - + float scaleFactor = getGhostItemScaleFactor(tileGlassBell.getStackInSlot(i)); - float rotationAngle = (float) (720.0 * (double) (System.currentTimeMillis() & 0x3FFFL) / (double) 0x3FFFL); - + float rotationAngle = (float) (720.0 * (System.currentTimeMillis() & 0x3FFFL) / 0x3FFFL); + EntityItem ghostEntityItem = new EntityItem(tileGlassBell.worldObj); ghostEntityItem.hoverStart = 0.0F; ghostEntityItem.setEntityItemStack(tileGlassBell.getStackInSlot(i)); @@ -91,20 +91,20 @@ public class TileEntityGlassBellRenderer extends TileEntitySpecialRenderer { translateGhostItemByOrientation(ghostEntityItem.getEntityItem(), x, y, z, tileGlassBell.getOrientation()); GL11.glScalef(scaleFactor, scaleFactor, scaleFactor); GL11.glRotatef(rotationAngle, 0.0F, 1.0F, 0.0F); - + customRenderItem.doRenderItem(ghostEntityItem, 0, 0, 0, 0, 0); } } - + GL11.glPopMatrix(); GL11.glEnable(GL11.GL_CULL_FACE); GL11.glEnable(GL11.GL_LIGHTING); } } - + private void renderGlassBellByOrientation(double x, double y, double z, ForgeDirection forgeDirection) { - + switch (forgeDirection) { case DOWN: { GL11.glScalef(1.0F, 1.0F, 1.0F); @@ -151,9 +151,9 @@ public class TileEntityGlassBellRenderer extends TileEntitySpecialRenderer { } } } - + private void translateGhostItemByOrientation(ItemStack ghostItemStack, double x, double y, double z, ForgeDirection forgeDirection) { - + if (ghostItemStack != null) { if (ghostItemStack.getItem() instanceof ItemBlock) { switch (forgeDirection) { @@ -225,32 +225,43 @@ public class TileEntityGlassBellRenderer extends TileEntitySpecialRenderer { } } } - + private float getGhostItemScaleFactor(ItemStack itemStack) { float scaleFactor = 1.0F; - + if (itemStack != null) { if (itemStack.getItem() instanceof ItemBlock) { switch (customRenderItem.getMiniBlockCount(itemStack)) { - case 1: return 0.90F; - case 2: return 0.90F; - case 3: return 0.90F; - case 4: return 0.90F; - case 5: return 0.80F; - default: return 0.90F; + case 1: + return 0.90F; + case 2: + return 0.90F; + case 3: + return 0.90F; + case 4: + return 0.90F; + case 5: + return 0.80F; + default: + return 0.90F; } } else { switch (customRenderItem.getMiniItemCount(itemStack)) { - case 1: return 0.65F; - case 2: return 0.65F; - case 3: return 0.65F; - case 4: return 0.65F; - default: return 0.65F; + case 1: + return 0.65F; + case 2: + return 0.65F; + case 3: + return 0.65F; + case 4: + return 0.65F; + default: + return 0.65F; } } } - + return scaleFactor; } } diff --git a/ee3_common/com/pahimar/ee3/core/handlers/DrawBlockHighlightHandler.java b/ee3_common/com/pahimar/ee3/core/handlers/DrawBlockHighlightHandler.java index daaff7b5..0bdfd9a6 100644 --- a/ee3_common/com/pahimar/ee3/core/handlers/DrawBlockHighlightHandler.java +++ b/ee3_common/com/pahimar/ee3/core/handlers/DrawBlockHighlightHandler.java @@ -39,7 +39,7 @@ public class DrawBlockHighlightHandler { public void onDrawBlockHighlightEvent(DrawBlockHighlightEvent event) { Minecraft minecraft = FMLClientHandler.instance().getClient(); - + if (event.currentItem != null) { if (event.currentItem.getItem() instanceof ITransmutationStone) { if (event.target.typeOfHit == EnumMovingObjectType.TILE) { diff --git a/ee3_common/com/pahimar/ee3/core/handlers/EquivalencyHandler.java b/ee3_common/com/pahimar/ee3/core/handlers/EquivalencyHandler.java index 2033a3f1..1e6887ad 100644 --- a/ee3_common/com/pahimar/ee3/core/handlers/EquivalencyHandler.java +++ b/ee3_common/com/pahimar/ee3/core/handlers/EquivalencyHandler.java @@ -1,10 +1,12 @@ package com.pahimar.ee3.core.handlers; import java.util.ArrayList; +import java.util.logging.Level; import net.minecraft.item.ItemStack; import com.pahimar.ee3.core.helper.GeneralHelper; +import com.pahimar.ee3.core.helper.LogHelper; /** * Equivalent-Exchange-3 @@ -246,7 +248,7 @@ public class EquivalencyHandler { int i = 0; for (ArrayList list : equivalencyList) { - System.out.println("equivalencyList[" + i + "]: " + list.toString()); + LogHelper.log(Level.INFO, "equivalencyList[" + i + "]: " + list.toString()); ++i; } } diff --git a/ee3_common/com/pahimar/ee3/core/helper/ItemHelper.java b/ee3_common/com/pahimar/ee3/core/helper/ItemHelper.java index 0edaa9e3..e4f9770f 100644 --- a/ee3_common/com/pahimar/ee3/core/helper/ItemHelper.java +++ b/ee3_common/com/pahimar/ee3/core/helper/ItemHelper.java @@ -23,12 +23,12 @@ public class ItemHelper { private static double rand; public static boolean hasColor(ItemStack itemStack) { - + return !itemStack.hasTagCompound() ? false : !itemStack.getTagCompound().hasKey(Strings.NBT_ITEM_DISPLAY) ? false : itemStack.getTagCompound().getCompoundTag(Strings.NBT_ITEM_DISPLAY).hasKey(Strings.NBT_ITEM_COLOR); } - + public static int getColor(ItemStack itemStack) { - + NBTTagCompound nbtTagCompound = itemStack.getTagCompound(); if (nbtTagCompound == null) @@ -39,9 +39,9 @@ public class ItemHelper { return displayTagCompound == null ? Integer.parseInt(Colours.PURE_WHITE, 16) : displayTagCompound.hasKey(Strings.NBT_ITEM_COLOR) ? displayTagCompound.getInteger(Strings.NBT_ITEM_COLOR) : Integer.parseInt(Colours.PURE_WHITE, 16); } } - + public static void setColor(ItemStack itemStack, int color) { - + if (itemStack != null) { NBTTagCompound nbtTagCompound = itemStack.getTagCompound(); @@ -61,7 +61,7 @@ public class ItemHelper { colourTagCompound.setInteger(Strings.NBT_ITEM_COLOR, color); } } - + public static void dropMiniumShard(EntityPlayer player, EntityLiving entity) { if (GeneralHelper.isHostileEntity(entity)) { diff --git a/ee3_common/com/pahimar/ee3/core/helper/VersionHelper.java b/ee3_common/com/pahimar/ee3/core/helper/VersionHelper.java index 2728dd2e..1cb4493c 100644 --- a/ee3_common/com/pahimar/ee3/core/helper/VersionHelper.java +++ b/ee3_common/com/pahimar/ee3/core/helper/VersionHelper.java @@ -114,12 +114,10 @@ public class VersionHelper implements Runnable { String[] versionTokens = Reference.VERSION_NUMBER.split(" "); - if (versionTokens.length >= 1) { + if (versionTokens.length >= 1) return versionTokens[0]; - } - else { + else return Reference.VERSION_NUMBER; - } } public static void logResult() { diff --git a/ee3_common/com/pahimar/ee3/core/proxy/ClientProxy.java b/ee3_common/com/pahimar/ee3/core/proxy/ClientProxy.java index f0a11467..a79626a3 100644 --- a/ee3_common/com/pahimar/ee3/core/proxy/ClientProxy.java +++ b/ee3_common/com/pahimar/ee3/core/proxy/ClientProxy.java @@ -27,6 +27,7 @@ import com.pahimar.ee3.core.helper.TransmutationHelper; import com.pahimar.ee3.item.IChargeable; import com.pahimar.ee3.lib.ActionTypes; import com.pahimar.ee3.lib.BlockIds; +import com.pahimar.ee3.lib.Colours; import com.pahimar.ee3.lib.RenderIds; import com.pahimar.ee3.network.PacketTypeHandler; import com.pahimar.ee3.network.packet.PacketRequestEvent; @@ -130,21 +131,25 @@ public class ClientProxy extends CommonProxy { } } } - + @Override public void handleTileWithItemPacket(int x, int y, int z, ForgeDirection orientation, byte state, String customName, int itemID, int metaData, int stackSize, int color) { - - TileEntity tileEntity = FMLClientHandler.instance().getClient().theWorld.getBlockTileEntity(x, y, z); - + + World world = FMLClientHandler.instance().getClient().theWorld; + TileEntity tileEntity = world.getBlockTileEntity(x, y, z); + this.handleTileEntityPacket(x, y, z, orientation, state, customName); - + if (tileEntity != null) { if (tileEntity instanceof TileGlassBell) { - + ItemStack itemStack = new ItemStack(itemID, stackSize, metaData); - ItemHelper.setColor(itemStack, color); - + if (color != Integer.parseInt(Colours.PURE_WHITE, 16)) { + ItemHelper.setColor(itemStack, color); + } + ((TileGlassBell) tileEntity).setInventorySlotContents(0, itemStack); + world.updateAllLightTypes(x, y, z); } } } diff --git a/ee3_common/com/pahimar/ee3/core/proxy/CommonProxy.java b/ee3_common/com/pahimar/ee3/core/proxy/CommonProxy.java index e454fbd4..1a9ff867 100644 --- a/ee3_common/com/pahimar/ee3/core/proxy/CommonProxy.java +++ b/ee3_common/com/pahimar/ee3/core/proxy/CommonProxy.java @@ -83,9 +83,9 @@ public class CommonProxy implements IGuiHandler { public void handleTileEntityPacket(int x, int y, int z, ForgeDirection orientation, byte state, String customName) { } - + public void handleTileWithItemPacket(int x, int y, int z, ForgeDirection orientation, byte state, String customName, int itemID, int metaData, int stackSize, int color) { - + } @Override diff --git a/ee3_common/com/pahimar/ee3/item/ItemMiniumStone.java b/ee3_common/com/pahimar/ee3/item/ItemMiniumStone.java index f518a600..86481f41 100644 --- a/ee3_common/com/pahimar/ee3/item/ItemMiniumStone.java +++ b/ee3_common/com/pahimar/ee3/item/ItemMiniumStone.java @@ -24,7 +24,8 @@ import cpw.mods.fml.relauncher.SideOnly; * @license Lesser GNU Public License v3 (http://www.gnu.org/licenses/lgpl.html) * */ -public class ItemMiniumStone extends ItemEE implements ITransmutationStone, IKeyBound { +public class ItemMiniumStone extends ItemEE + implements ITransmutationStone, IKeyBound { public ItemMiniumStone(int id) { diff --git a/ee3_common/com/pahimar/ee3/lib/Localizations.java b/ee3_common/com/pahimar/ee3/lib/Localizations.java index 6957f3ca..4c32c2a7 100644 --- a/ee3_common/com/pahimar/ee3/lib/Localizations.java +++ b/ee3_common/com/pahimar/ee3/lib/Localizations.java @@ -11,9 +11,8 @@ package com.pahimar.ee3.lib; */ public class Localizations { - private static final String LANG_RESOURCE_LOCATION = "/mods/ee3/lang/"; + private static final String LANG_RESOURCE_LOCATION = "/mods/ee3/lang/"; - public static String[] localeFiles = { - LANG_RESOURCE_LOCATION + "cs_CZ.xml", LANG_RESOURCE_LOCATION + "cy_GB.xml", LANG_RESOURCE_LOCATION + "da_DK.xml", LANG_RESOURCE_LOCATION + "de_DE.xml", LANG_RESOURCE_LOCATION + "en_US.xml", LANG_RESOURCE_LOCATION + "es_ES.xml", LANG_RESOURCE_LOCATION + "fi_FI.xml", LANG_RESOURCE_LOCATION + "fr_FR.xml", LANG_RESOURCE_LOCATION + "it_IT.xml", LANG_RESOURCE_LOCATION + "ja_JP.xml", LANG_RESOURCE_LOCATION + "la_IT.xml", LANG_RESOURCE_LOCATION + "nl_NL.xml", LANG_RESOURCE_LOCATION + "nb_NO.xml", LANG_RESOURCE_LOCATION + "pl_PL.xml", LANG_RESOURCE_LOCATION + "pt_BR.xml", LANG_RESOURCE_LOCATION + "pt_PT.xml", LANG_RESOURCE_LOCATION + "ru_RU.xml", LANG_RESOURCE_LOCATION + "sk_SK.xml", LANG_RESOURCE_LOCATION + "sr_RS.xml", LANG_RESOURCE_LOCATION + "sv_SE.xml", LANG_RESOURCE_LOCATION + "tr_TR.xml", LANG_RESOURCE_LOCATION + "zh_CN.xml", LANG_RESOURCE_LOCATION + "zh_TW.xml", LANG_RESOURCE_LOCATION + "el_GR.xml"}; + public static String[] localeFiles = { LANG_RESOURCE_LOCATION + "cs_CZ.xml", LANG_RESOURCE_LOCATION + "cy_GB.xml", LANG_RESOURCE_LOCATION + "da_DK.xml", LANG_RESOURCE_LOCATION + "de_DE.xml", LANG_RESOURCE_LOCATION + "en_US.xml", LANG_RESOURCE_LOCATION + "es_ES.xml", LANG_RESOURCE_LOCATION + "fi_FI.xml", LANG_RESOURCE_LOCATION + "fr_FR.xml", LANG_RESOURCE_LOCATION + "it_IT.xml", LANG_RESOURCE_LOCATION + "ja_JP.xml", LANG_RESOURCE_LOCATION + "la_IT.xml", LANG_RESOURCE_LOCATION + "nl_NL.xml", LANG_RESOURCE_LOCATION + "nb_NO.xml", LANG_RESOURCE_LOCATION + "pl_PL.xml", LANG_RESOURCE_LOCATION + "pt_BR.xml", LANG_RESOURCE_LOCATION + "pt_PT.xml", LANG_RESOURCE_LOCATION + "ru_RU.xml", LANG_RESOURCE_LOCATION + "sk_SK.xml", LANG_RESOURCE_LOCATION + "sr_RS.xml", LANG_RESOURCE_LOCATION + "sv_SE.xml", LANG_RESOURCE_LOCATION + "tr_TR.xml", LANG_RESOURCE_LOCATION + "zh_CN.xml", LANG_RESOURCE_LOCATION + "zh_TW.xml", LANG_RESOURCE_LOCATION + "el_GR.xml" }; } diff --git a/ee3_common/com/pahimar/ee3/lib/Strings.java b/ee3_common/com/pahimar/ee3/lib/Strings.java index b7936531..2ad3fc12 100644 --- a/ee3_common/com/pahimar/ee3/lib/Strings.java +++ b/ee3_common/com/pahimar/ee3/lib/Strings.java @@ -52,7 +52,7 @@ public class Strings { public static final String INERT_STONE_NAME = "stoneInert"; public static final String MINIUM_STONE_NAME = "stoneMinium"; public static final String PHILOSOPHERS_STONE_NAME = "stonePhilosophers"; - public static final String ALCHEMICAL_DUST_NAME = "alchemicalDust"; + public static final String ALCHEMICAL_DUST_NAME = "alchemicalDust"; public static final String ALCHEMICAL_BAG_NAME = "alchemicalBag"; /* TileEntity name constants */ diff --git a/ee3_common/com/pahimar/ee3/network/PacketTypeHandler.java b/ee3_common/com/pahimar/ee3/network/PacketTypeHandler.java index 22b91922..c0e736d2 100644 --- a/ee3_common/com/pahimar/ee3/network/PacketTypeHandler.java +++ b/ee3_common/com/pahimar/ee3/network/PacketTypeHandler.java @@ -26,12 +26,12 @@ import com.pahimar.ee3.network.packet.PacketTileWithItemUpdate; * */ public enum PacketTypeHandler { - KEY(PacketKeyPressed.class), + KEY(PacketKeyPressed.class), TILE(PacketTileUpdate.class), REQUEST_EVENT(PacketRequestEvent.class), - SPAWN_PARTICLE(PacketSpawnParticle.class), - SOUND_EVENT(PacketSoundEvent.class), - ITEM_UPDATE(PacketItemUpdate.class), + SPAWN_PARTICLE(PacketSpawnParticle.class), + SOUND_EVENT(PacketSoundEvent.class), + ITEM_UPDATE(PacketItemUpdate.class), TILE_WITH_ITEM(PacketTileWithItemUpdate.class); private Class clazz; diff --git a/ee3_common/com/pahimar/ee3/network/packet/PacketTileUpdate.java b/ee3_common/com/pahimar/ee3/network/packet/PacketTileUpdate.java index f8f4a8a3..266137f2 100644 --- a/ee3_common/com/pahimar/ee3/network/packet/PacketTileUpdate.java +++ b/ee3_common/com/pahimar/ee3/network/packet/PacketTileUpdate.java @@ -69,7 +69,6 @@ public class PacketTileUpdate extends PacketEE { @Override public void execute(INetworkManager manager, Player player) { - System.out.println("PacketTileUpdate - Execute"); EquivalentExchange3.proxy.handleTileEntityPacket(x, y, z, ForgeDirection.getOrientation(orientation), state, customName); } diff --git a/ee3_common/com/pahimar/ee3/network/packet/PacketTileWithItemUpdate.java b/ee3_common/com/pahimar/ee3/network/packet/PacketTileWithItemUpdate.java index 1b0b4426..0fc0193b 100644 --- a/ee3_common/com/pahimar/ee3/network/packet/PacketTileWithItemUpdate.java +++ b/ee3_common/com/pahimar/ee3/network/packet/PacketTileWithItemUpdate.java @@ -12,22 +12,21 @@ import com.pahimar.ee3.network.PacketTypeHandler; import cpw.mods.fml.common.network.Player; - public class PacketTileWithItemUpdate extends PacketEE { - + public int x, y, z; public byte orientation; public byte state; public String customName; public int itemID, metaData, stackSize, color; - + public PacketTileWithItemUpdate() { super(PacketTypeHandler.TILE_WITH_ITEM, true); } - + public PacketTileWithItemUpdate(int x, int y, int z, ForgeDirection orientation, byte state, String customName, int itemID, int metaData, int stackSize, int color) { - + super(PacketTypeHandler.TILE_WITH_ITEM, true); this.x = x; this.y = y; @@ -40,7 +39,7 @@ public class PacketTileWithItemUpdate extends PacketEE { this.stackSize = stackSize; this.color = color; } - + @Override public void writeData(DataOutputStream data) throws IOException { @@ -74,7 +73,6 @@ public class PacketTileWithItemUpdate extends PacketEE { @Override public void execute(INetworkManager manager, Player player) { - System.out.println("PacketTileWithItemUpdate - Execute"); EquivalentExchange3.proxy.handleTileWithItemPacket(x, y, z, ForgeDirection.getOrientation(orientation), state, customName, itemID, metaData, stackSize, color); } } diff --git a/ee3_common/com/pahimar/ee3/tileentity/TileGlassBell.java b/ee3_common/com/pahimar/ee3/tileentity/TileGlassBell.java index fcfc24c6..750e01ef 100644 --- a/ee3_common/com/pahimar/ee3/tileentity/TileGlassBell.java +++ b/ee3_common/com/pahimar/ee3/tileentity/TileGlassBell.java @@ -1,5 +1,6 @@ package com.pahimar.ee3.tileentity; +import net.minecraft.block.Block; import net.minecraft.inventory.IInventory; import net.minecraft.item.ItemStack; import net.minecraft.nbt.NBTTagCompound; @@ -100,14 +101,14 @@ public class TileGlassBell extends TileEE implements IInventory { public void closeChest() { } - + public ItemStack getGhostItemStack() { - + return ghostItemStack; } - + public void setGhostItemStack(ItemStack ghostItemStack) { - + this.ghostItemStack = ghostItemStack; } @@ -157,15 +158,26 @@ public class TileGlassBell extends TileEE implements IInventory { return true; } - + @Override public Packet getDescriptionPacket() { - if ((inventory[0] != null) && (inventory[0].stackSize > 0)) { + if (inventory[0] != null && inventory[0].stackSize > 0) return PacketTypeHandler.populatePacket(new PacketTileWithItemUpdate(xCoord, yCoord, zCoord, orientation, state, customName, inventory[0].itemID, inventory[0].getItemDamage(), inventory[0].stackSize, ItemHelper.getColor(inventory[0]))); + else + return super.getDescriptionPacket(); + } + + @Override + public void onInventoryChanged() { + + if (inventory[0] != null) { + if (inventory[0].itemID < 4096) { + worldObj.setBlockMetadataWithNotify(xCoord, yCoord, zCoord, Block.lightValue[inventory[0].itemID], 2); + } } else { - return super.getDescriptionPacket(); + worldObj.setBlockMetadataWithNotify(xCoord, yCoord, zCoord, 0, 2); } } }