diff --git a/.classpath b/.classpath index c3151cc0..770a4f99 100644 --- a/.classpath +++ b/.classpath @@ -4,63 +4,63 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/.gradle/2.0/taskArtifacts/cache.properties.lock b/.gradle/2.0/taskArtifacts/cache.properties.lock index 44915c06..ed8e0970 100644 Binary files a/.gradle/2.0/taskArtifacts/cache.properties.lock and b/.gradle/2.0/taskArtifacts/cache.properties.lock differ diff --git a/.gradle/2.0/taskArtifacts/fileHashes.bin b/.gradle/2.0/taskArtifacts/fileHashes.bin index 74baf615..59b30c8e 100644 Binary files a/.gradle/2.0/taskArtifacts/fileHashes.bin and b/.gradle/2.0/taskArtifacts/fileHashes.bin differ diff --git a/.gradle/2.0/taskArtifacts/fileSnapshots.bin b/.gradle/2.0/taskArtifacts/fileSnapshots.bin index b80c0c48..91769b8d 100644 Binary files a/.gradle/2.0/taskArtifacts/fileSnapshots.bin and b/.gradle/2.0/taskArtifacts/fileSnapshots.bin differ diff --git a/.gradle/2.0/taskArtifacts/taskArtifacts.bin b/.gradle/2.0/taskArtifacts/taskArtifacts.bin index 53323a1c..1d325e34 100644 Binary files a/.gradle/2.0/taskArtifacts/taskArtifacts.bin and b/.gradle/2.0/taskArtifacts/taskArtifacts.bin differ diff --git a/.gradle/gradle.log b/.gradle/gradle.log index 7d52b4d2..ad385c35 100644 --- a/.gradle/gradle.log +++ b/.gradle/gradle.log @@ -12,4 +12,4 @@ BUILD SUCCESSFUL -Total time: 7.332 secs +Total time: 17.823 secs diff --git a/.settings/org.eclipse.jdt.core.prefs b/.settings/org.eclipse.jdt.core.prefs index 378f6e5d..37a0d482 100644 --- a/.settings/org.eclipse.jdt.core.prefs +++ b/.settings/org.eclipse.jdt.core.prefs @@ -1,5 +1,5 @@ # -#Mon Jul 06 13:18:27 EDT 2015 +#Tue Jul 07 00:22:43 EDT 2015 org.eclipse.jdt.core.compiler.debug.localVariable=generate org.eclipse.jdt.core.compiler.compliance=1.6 org.eclipse.jdt.core.compiler.codegen.unusedLocal=preserve diff --git a/bin/com/kitsu/medievalcraft/Main.class b/bin/com/kitsu/medievalcraft/Main.class index 0ffdddfb..bbcbc182 100644 Binary files a/bin/com/kitsu/medievalcraft/Main.class and b/bin/com/kitsu/medievalcraft/Main.class differ diff --git a/bin/com/kitsu/medievalcraft/block/machines/Firebox.class b/bin/com/kitsu/medievalcraft/block/machines/Firebox.class index 1929438c..04e9f9c3 100644 Binary files a/bin/com/kitsu/medievalcraft/block/machines/Firebox.class and b/bin/com/kitsu/medievalcraft/block/machines/Firebox.class differ diff --git a/bin/com/kitsu/medievalcraft/block/machines/Forge.class b/bin/com/kitsu/medievalcraft/block/machines/Forge.class index d680f9c8..3e4fafb3 100644 Binary files a/bin/com/kitsu/medievalcraft/block/machines/Forge.class and b/bin/com/kitsu/medievalcraft/block/machines/Forge.class differ diff --git a/bin/com/kitsu/medievalcraft/block/machines/ForgeAnvil.class b/bin/com/kitsu/medievalcraft/block/machines/ForgeAnvil.class index b925d45c..9e3dc010 100644 Binary files a/bin/com/kitsu/medievalcraft/block/machines/ForgeAnvil.class and b/bin/com/kitsu/medievalcraft/block/machines/ForgeAnvil.class differ diff --git a/bin/com/kitsu/medievalcraft/contain/ContainerFirebox.class b/bin/com/kitsu/medievalcraft/contain/ContainerFirebox.class index f4b1fb3b..07ee5def 100644 Binary files a/bin/com/kitsu/medievalcraft/contain/ContainerFirebox.class and b/bin/com/kitsu/medievalcraft/contain/ContainerFirebox.class differ diff --git a/bin/com/kitsu/medievalcraft/contain/ContainerForgeAnvil.class b/bin/com/kitsu/medievalcraft/contain/ContainerForgeAnvil.class index bddf6f39..7821fe13 100644 Binary files a/bin/com/kitsu/medievalcraft/contain/ContainerForgeAnvil.class and b/bin/com/kitsu/medievalcraft/contain/ContainerForgeAnvil.class differ diff --git a/bin/com/kitsu/medievalcraft/crafting/ModCrafting.class b/bin/com/kitsu/medievalcraft/crafting/ModCrafting.class index 691c7692..a984c46e 100644 Binary files a/bin/com/kitsu/medievalcraft/crafting/ModCrafting.class and b/bin/com/kitsu/medievalcraft/crafting/ModCrafting.class differ diff --git a/bin/com/kitsu/medievalcraft/packethandle/forge/MsgHandleBurning.class b/bin/com/kitsu/medievalcraft/packethandle/forge/MsgHandleBurning.class deleted file mode 100644 index f75e07b7..00000000 Binary files a/bin/com/kitsu/medievalcraft/packethandle/forge/MsgHandleBurning.class and /dev/null differ diff --git a/bin/com/kitsu/medievalcraft/packethandle/forge/MsgHandleForgeX.class b/bin/com/kitsu/medievalcraft/packethandle/forge/MsgHandleForgeX.class deleted file mode 100644 index 88c10ebb..00000000 Binary files a/bin/com/kitsu/medievalcraft/packethandle/forge/MsgHandleForgeX.class and /dev/null differ diff --git a/bin/com/kitsu/medievalcraft/packethandle/forge/MsgHandleForgeY.class b/bin/com/kitsu/medievalcraft/packethandle/forge/MsgHandleForgeY.class deleted file mode 100644 index 1303533b..00000000 Binary files a/bin/com/kitsu/medievalcraft/packethandle/forge/MsgHandleForgeY.class and /dev/null differ diff --git a/bin/com/kitsu/medievalcraft/packethandle/forge/MsgHandleForgeZ.class b/bin/com/kitsu/medievalcraft/packethandle/forge/MsgHandleForgeZ.class deleted file mode 100644 index 017bdb99..00000000 Binary files a/bin/com/kitsu/medievalcraft/packethandle/forge/MsgHandleForgeZ.class and /dev/null differ diff --git a/bin/com/kitsu/medievalcraft/packethandle/forge/MsgHandleOn.class b/bin/com/kitsu/medievalcraft/packethandle/forge/MsgHandleOn.class deleted file mode 100644 index 2d99d97c..00000000 Binary files a/bin/com/kitsu/medievalcraft/packethandle/forge/MsgHandleOn.class and /dev/null differ diff --git a/bin/com/kitsu/medievalcraft/packethandle/forge/MsgPacketBurning.class b/bin/com/kitsu/medievalcraft/packethandle/forge/MsgPacketBurning.class deleted file mode 100644 index 547357e6..00000000 Binary files a/bin/com/kitsu/medievalcraft/packethandle/forge/MsgPacketBurning.class and /dev/null differ diff --git a/bin/com/kitsu/medievalcraft/packethandle/forge/MsgPacketForgeX.class b/bin/com/kitsu/medievalcraft/packethandle/forge/MsgPacketForgeX.class deleted file mode 100644 index 61ed3385..00000000 Binary files a/bin/com/kitsu/medievalcraft/packethandle/forge/MsgPacketForgeX.class and /dev/null differ diff --git a/bin/com/kitsu/medievalcraft/packethandle/forge/MsgPacketForgeY.class b/bin/com/kitsu/medievalcraft/packethandle/forge/MsgPacketForgeY.class deleted file mode 100644 index b4509fce..00000000 Binary files a/bin/com/kitsu/medievalcraft/packethandle/forge/MsgPacketForgeY.class and /dev/null differ diff --git a/bin/com/kitsu/medievalcraft/packethandle/forge/MsgPacketForgeZ.class b/bin/com/kitsu/medievalcraft/packethandle/forge/MsgPacketForgeZ.class deleted file mode 100644 index 7a054b1b..00000000 Binary files a/bin/com/kitsu/medievalcraft/packethandle/forge/MsgPacketForgeZ.class and /dev/null differ diff --git a/bin/com/kitsu/medievalcraft/packethandle/forge/MsgPacketOn.class b/bin/com/kitsu/medievalcraft/packethandle/forge/MsgPacketOn.class deleted file mode 100644 index b2eb6a3d..00000000 Binary files a/bin/com/kitsu/medievalcraft/packethandle/forge/MsgPacketOn.class and /dev/null differ diff --git a/bin/com/kitsu/medievalcraft/renderer/blocks/machine/FireboxRenderer.class b/bin/com/kitsu/medievalcraft/renderer/blocks/machine/FireboxRenderer.class index 115a2160..bf551672 100644 Binary files a/bin/com/kitsu/medievalcraft/renderer/blocks/machine/FireboxRenderer.class and b/bin/com/kitsu/medievalcraft/renderer/blocks/machine/FireboxRenderer.class differ diff --git a/bin/com/kitsu/medievalcraft/renderer/blocks/machine/ForgeAnvilRenderer.class b/bin/com/kitsu/medievalcraft/renderer/blocks/machine/ForgeAnvilRenderer.class index 1f3a9bd3..53a7169b 100644 Binary files a/bin/com/kitsu/medievalcraft/renderer/blocks/machine/ForgeAnvilRenderer.class and b/bin/com/kitsu/medievalcraft/renderer/blocks/machine/ForgeAnvilRenderer.class differ diff --git a/bin/com/kitsu/medievalcraft/renderer/blocks/machine/ForgeRenderer.class b/bin/com/kitsu/medievalcraft/renderer/blocks/machine/ForgeRenderer.class index 4b9c99a4..a73113d4 100644 Binary files a/bin/com/kitsu/medievalcraft/renderer/blocks/machine/ForgeRenderer.class and b/bin/com/kitsu/medievalcraft/renderer/blocks/machine/ForgeRenderer.class differ diff --git a/bin/com/kitsu/medievalcraft/tileents/crucible/empty/TileEntityBoilingWaterCrucible.class b/bin/com/kitsu/medievalcraft/tileents/crucible/empty/TileEntityBoilingWaterCrucible.class index 8f20134a..078063b7 100644 Binary files a/bin/com/kitsu/medievalcraft/tileents/crucible/empty/TileEntityBoilingWaterCrucible.class and b/bin/com/kitsu/medievalcraft/tileents/crucible/empty/TileEntityBoilingWaterCrucible.class differ diff --git a/bin/com/kitsu/medievalcraft/tileents/crucible/empty/TileEntityFilledWaterCrucible.class b/bin/com/kitsu/medievalcraft/tileents/crucible/empty/TileEntityFilledWaterCrucible.class index 725fa86d..0ac790b4 100644 Binary files a/bin/com/kitsu/medievalcraft/tileents/crucible/empty/TileEntityFilledWaterCrucible.class and b/bin/com/kitsu/medievalcraft/tileents/crucible/empty/TileEntityFilledWaterCrucible.class differ diff --git a/bin/com/kitsu/medievalcraft/tileents/crucible/empty/TileEntitySoftEmptyCrucible.class b/bin/com/kitsu/medievalcraft/tileents/crucible/empty/TileEntitySoftEmptyCrucible.class index e527c70d..b170c289 100644 Binary files a/bin/com/kitsu/medievalcraft/tileents/crucible/empty/TileEntitySoftEmptyCrucible.class and b/bin/com/kitsu/medievalcraft/tileents/crucible/empty/TileEntitySoftEmptyCrucible.class differ diff --git a/bin/com/kitsu/medievalcraft/tileents/ingots/TileIngotBase.class b/bin/com/kitsu/medievalcraft/tileents/ingots/TileIngotBase.class index 0b781fdd..b3857f56 100644 Binary files a/bin/com/kitsu/medievalcraft/tileents/ingots/TileIngotBase.class and b/bin/com/kitsu/medievalcraft/tileents/ingots/TileIngotBase.class differ diff --git a/bin/com/kitsu/medievalcraft/tileents/ingots/TileMyIronIngot.class b/bin/com/kitsu/medievalcraft/tileents/ingots/TileMyIronIngot.class index 3beed000..1de8189c 100644 Binary files a/bin/com/kitsu/medievalcraft/tileents/ingots/TileMyIronIngot.class and b/bin/com/kitsu/medievalcraft/tileents/ingots/TileMyIronIngot.class differ diff --git a/bin/com/kitsu/medievalcraft/tileents/machine/TileEntityAnvilForge.class b/bin/com/kitsu/medievalcraft/tileents/machine/TileEntityAnvilForge.class index aa4be226..704370ff 100644 Binary files a/bin/com/kitsu/medievalcraft/tileents/machine/TileEntityAnvilForge.class and b/bin/com/kitsu/medievalcraft/tileents/machine/TileEntityAnvilForge.class differ diff --git a/bin/com/kitsu/medievalcraft/tileents/machine/TileEntityFirebox.class b/bin/com/kitsu/medievalcraft/tileents/machine/TileEntityFirebox.class index b4af8afc..af69b54a 100644 Binary files a/bin/com/kitsu/medievalcraft/tileents/machine/TileEntityFirebox.class and b/bin/com/kitsu/medievalcraft/tileents/machine/TileEntityFirebox.class differ diff --git a/bin/com/kitsu/medievalcraft/tileents/machine/TileForge.class b/bin/com/kitsu/medievalcraft/tileents/machine/TileForge.class index 97a7a828..2b47c12b 100644 Binary files a/bin/com/kitsu/medievalcraft/tileents/machine/TileForge.class and b/bin/com/kitsu/medievalcraft/tileents/machine/TileForge.class differ diff --git a/src/main/java/com/kitsu/medievalcraft/Main.java b/src/main/java/com/kitsu/medievalcraft/Main.java index f8033a79..de23b049 100644 --- a/src/main/java/com/kitsu/medievalcraft/Main.java +++ b/src/main/java/com/kitsu/medievalcraft/Main.java @@ -19,18 +19,8 @@ import com.kitsu.medievalcraft.packethandle.curedLeather.MsgHandleCuredLeatherZ; import com.kitsu.medievalcraft.packethandle.curedLeather.MsgPacketCuredLeatherX; import com.kitsu.medievalcraft.packethandle.curedLeather.MsgPacketCuredLeatherY; import com.kitsu.medievalcraft.packethandle.curedLeather.MsgPacketCuredLeatherZ; -import com.kitsu.medievalcraft.packethandle.forge.MsgHandleBurning; import com.kitsu.medievalcraft.packethandle.forge.MsgHandleForge; -import com.kitsu.medievalcraft.packethandle.forge.MsgHandleForgeX; -import com.kitsu.medievalcraft.packethandle.forge.MsgHandleForgeY; -import com.kitsu.medievalcraft.packethandle.forge.MsgHandleForgeZ; -import com.kitsu.medievalcraft.packethandle.forge.MsgHandleOn; -import com.kitsu.medievalcraft.packethandle.forge.MsgPacketBurning; import com.kitsu.medievalcraft.packethandle.forge.MsgPacketForge; -import com.kitsu.medievalcraft.packethandle.forge.MsgPacketForgeX; -import com.kitsu.medievalcraft.packethandle.forge.MsgPacketForgeY; -import com.kitsu.medievalcraft.packethandle.forge.MsgPacketForgeZ; -import com.kitsu.medievalcraft.packethandle.forge.MsgPacketOn; import com.kitsu.medievalcraft.packethandle.forgeHammerParticles.MsgHandle; import com.kitsu.medievalcraft.packethandle.forgeHammerParticles.MsgHandleLocX; import com.kitsu.medievalcraft.packethandle.forgeHammerParticles.MsgHandleLocY; @@ -95,11 +85,7 @@ public class Main { sNet.registerMessage(MsgHandleCuredLeatherZ.class, MsgPacketCuredLeatherZ.class, 8, Side.SERVER); sNet.registerMessage(MsgHandleShelfCase.class, MsgPacketShelfCase.class, 9, Side.SERVER); sNet.registerMessage(MsgHandleForge.class, MsgPacketForge.class, 10, Side.SERVER); - sNet.registerMessage(MsgHandleOn.class, MsgPacketOn.class, 11, Side.CLIENT); - sNet.registerMessage(MsgHandleBurning.class, MsgPacketBurning.class, 12, Side.CLIENT); - sNet.registerMessage(MsgHandleForgeX.class, MsgPacketForgeX.class, 13, Side.CLIENT); - sNet.registerMessage(MsgHandleForgeY.class, MsgPacketForgeY.class, 14, Side.CLIENT); - sNet.registerMessage(MsgHandleForgeZ.class, MsgPacketForgeZ.class, 15, Side.CLIENT); + CustomTab.MedievalTab(); ModBlocks.init(); ModItems.init(); diff --git a/src/main/java/com/kitsu/medievalcraft/block/machines/Firebox.java b/src/main/java/com/kitsu/medievalcraft/block/machines/Firebox.java index 5c7fe7b2..efd984ae 100644 --- a/src/main/java/com/kitsu/medievalcraft/block/machines/Firebox.java +++ b/src/main/java/com/kitsu/medievalcraft/block/machines/Firebox.java @@ -79,7 +79,7 @@ public class Firebox extends BlockContainer{ public void randomDisplayTick(World world, int x, int y, int z, Random rand) { super.randomDisplayTick(world, x, y, z, random); - if(world.getBlock(x, y+1, z).equals(Blocks.fire)){ + if(world.getBlockMetadata(x, y, z)==1){ int l; float f; float f1; @@ -87,7 +87,7 @@ public class Firebox extends BlockContainer{ for (l = 0; l < 3; ++l) { f = (float)(x+0.25) + (rand.nextFloat()/2); - f1 = (float)y + rand.nextFloat() * 0.4F + 0.2F; + f1 = (float)y+0.3f + rand.nextFloat() * 0.4F; f2 = (float)(z+0.25) + (rand.nextFloat()/2); world.spawnParticle("fire", (double)f, (double)f1, (double)f2, 0.0D, 0.0D, 0.0D); world.spawnParticle("flame", (double)f, (double)f1, (double)f2, 0.0D, 0.0D, 0.0D); @@ -100,21 +100,17 @@ public class Firebox extends BlockContainer{ public boolean onBlockActivated (World world, int x, int y, int z, EntityPlayer player, int q, float a, float b, float c) { TileEntityFirebox tileEnt = (TileEntityFirebox) world.getTileEntity(x, y, z); - - //System.out.println(""); if(!world.isRemote){ - if(player.inventory.getCurrentItem()!=null){ if((player.inventory.getCurrentItem().getItem()==Item.getItemFromBlock(Blocks.torch))|| (player.inventory.getCurrentItem().getItem()==Items.flint_and_steel)|| (player.inventory.getCurrentItem().getItem()==ModItems.fireBow) ){ - tileEnt.isOn=true; + world.setBlockMetadataWithNotify(x, y, z, 1, 2); + player.inventory.getCurrentItem().damageItem(1, player); if(world.getBlock(x, y, z).equals(Blocks.air)){ world.setBlock(x, y+1, z, Blocks.fire, 0, 2); } - - System.out.println(tileEnt.isOn); } } if(player.inventory.getCurrentItem()!=null){ @@ -156,30 +152,18 @@ public class Firebox extends BlockContainer{ } return true; } - - //tileEnt.markDirty(); - } - tileEnt.markForUpdate(); tileEnt.markDirty(); - //System.out.println(player.inventory.getCurrentItem()); return true; } - /*public void onBlockClicked(World world, int x, int y, int z, EntityPlayer player) { + @Override + public void onBlockPlacedBy(World world, int x, int y, int z, EntityLivingBase player, ItemStack p_149689_6_) { + world.setBlockMetadataWithNotify(x, y, z, 0, 2); - if(!world.isRemote){ - if(player.inventory.getCurrentItem()!= null){ - if(player.inventory.getCurrentItem().equals(ModItems.fireBow)||player.inventory.getCurrentItem().equals(Items.flint_and_steel)){ - TileEntityFirebox tileEnt = (TileEntityFirebox) world.getTileEntity(x, y, z); - tileEnt.isOn = true; - - } - } - } - - }*/ + world.markBlockForUpdate(x, y, z); + } public void breakBlock(World world, int x, int y, int z, Block block, int meta) { TileEntityFirebox tileEnt = (TileEntityFirebox) world.getTileEntity(x, y, z); diff --git a/src/main/java/com/kitsu/medievalcraft/block/machines/Forge.java b/src/main/java/com/kitsu/medievalcraft/block/machines/Forge.java index eab63522..1d6df06e 100644 --- a/src/main/java/com/kitsu/medievalcraft/block/machines/Forge.java +++ b/src/main/java/com/kitsu/medievalcraft/block/machines/Forge.java @@ -27,18 +27,12 @@ import net.minecraftforge.common.util.ForgeDirection; import com.kitsu.medievalcraft.Main; import com.kitsu.medievalcraft.item.ModItems; -import com.kitsu.medievalcraft.packethandle.forge.MsgPacketBurning; import com.kitsu.medievalcraft.packethandle.forge.MsgPacketForge; -import com.kitsu.medievalcraft.packethandle.forge.MsgPacketForgeX; -import com.kitsu.medievalcraft.packethandle.forge.MsgPacketForgeY; -import com.kitsu.medievalcraft.packethandle.forge.MsgPacketForgeZ; -import com.kitsu.medievalcraft.packethandle.forge.MsgPacketOn; import com.kitsu.medievalcraft.renderer.RenderId; import com.kitsu.medievalcraft.tileents.machine.TileForge; import com.kitsu.medievalcraft.util.CustomTab; import com.kitsu.medievalcraft.util.TileForgePlaceables; -import cpw.mods.fml.common.network.NetworkRegistry.TargetPoint; import cpw.mods.fml.common.registry.GameRegistry; import cpw.mods.fml.relauncher.Side; import cpw.mods.fml.relauncher.SideOnly; @@ -46,8 +40,7 @@ import cpw.mods.fml.relauncher.SideOnly; public class Forge extends BlockContainer implements TileForgePlaceables{ private final Random random = new Random(); - public static int sideMeta, locX, locY, locZ; - public static boolean furnaceParts, coalParts; + public static int sideMeta; private int c; public Forge(String unlocalizedName, Material material) { @@ -142,7 +135,7 @@ public class Forge extends BlockContainer implements TileForgePlaceables{ } l=l-2; world.setBlockMetadataWithNotify(x, y, z, l, 2); - System.out.println(l); + //System.out.println(l); world.markBlockForUpdate(x, y, z); } @@ -162,7 +155,7 @@ public class Forge extends BlockContainer implements TileForgePlaceables{ c = (int)mop.sideHit; Main.sNet.sendToServer(new MsgPacketForge((int) c)); } - System.out.println(sideMeta + " " + world.getBlockMetadata(x, y, z)); + if(!world.isRemote){ if(player.inventory.getCurrentItem()!=null){ if((player.inventory.getCurrentItem().getItem()==Item.getItemFromBlock(Blocks.torch))|| @@ -221,10 +214,9 @@ public class Forge extends BlockContainer implements TileForgePlaceables{ return true; } } - if(sideMeta-2 == world.getBlockMetadata(x, y, z)||sideMeta == world.getBlockMetadata(x, y, z)-4||sideMeta == world.getBlockMetadata(x, y, z)-8){ + if(sideMeta!=1){ if(player.inventory.getCurrentItem()!=null){ if(tileEnt.getStackInSlot(0)==null){ - System.out.println(); if(isItemFuel(player.inventory.getCurrentItem())==true){ tileEnt.setInventorySlotContents(0, player.inventory.getCurrentItem()); player.inventory.setInventorySlotContents(player.inventory.currentItem, null); diff --git a/src/main/java/com/kitsu/medievalcraft/block/machines/ForgeAnvil.java b/src/main/java/com/kitsu/medievalcraft/block/machines/ForgeAnvil.java index de68488b..ad59b076 100644 --- a/src/main/java/com/kitsu/medievalcraft/block/machines/ForgeAnvil.java +++ b/src/main/java/com/kitsu/medievalcraft/block/machines/ForgeAnvil.java @@ -23,11 +23,10 @@ import com.kitsu.medievalcraft.renderer.RenderId; import com.kitsu.medievalcraft.tileents.machine.TileEntityAnvilForge; import com.kitsu.medievalcraft.util.CustomTab; -import cpw.mods.fml.common.network.internal.FMLNetworkHandler; import cpw.mods.fml.relauncher.Side; import cpw.mods.fml.relauncher.SideOnly; -public class ForgeAnvil extends BlockContainer { +public class ForgeAnvil extends BlockContainer{ private final Random random = new Random(); @@ -69,7 +68,56 @@ public class ForgeAnvil extends BlockContainer { @Override public boolean onBlockActivated(World world, int x, int y, int z,EntityPlayer player, int metadata, float what, float these, float are) { - FMLNetworkHandler.openGui(player, Main.instance, 2, world, x, y, z); + TileEntityAnvilForge tileEnt = (TileEntityAnvilForge) world.getTileEntity(x, y, z); + if(!world.isRemote){ + + if(player.inventory.getCurrentItem()!=null){ + if (tileEnt.getStackInSlot(0)==null){ + tileEnt.setInventorySlotContents(0, player.inventory.getCurrentItem()); + player.inventory.setInventorySlotContents(player.inventory.currentItem, null); + tileEnt.markForUpdate(); + } + if (tileEnt.getStackInSlot(0)!=null){ + if(player.inventory.getCurrentItem()!=null){ + ItemStack pStack = player.inventory.getCurrentItem().copy(); + ItemStack sStack = tileEnt.getStackInSlot(0).copy(); + ItemStack sStackTemp = tileEnt.getStackInSlot(0).copy(); + if(tileEnt.getStackInSlot(0).stackSize < 64){ + sStackTemp.stackSize++; + if ((sStack.getItem().equals(pStack.getItem())) && (sStack.getItemDamage() == pStack.getItemDamage()) ){ + tileEnt.setInventorySlotContents(0, sStackTemp); + player.inventory.decrStackSize(player.inventory.currentItem, 1); + } + } + } + } + tileEnt.markForUpdate(); + return true; + } + if (player.isSneaking() && player.inventory.getCurrentItem()==null) { + if(tileEnt.getStackInSlot(0)!=null){ + player.inventory.setInventorySlotContents(player.inventory.currentItem, tileEnt.getStackInSlot(0)); + tileEnt.setInventorySlotContents(0, null); + } + tileEnt.markForUpdate(); + return true; + } + if (!player.isSneaking()){ + if((player.inventory.getCurrentItem()==null)){ + if(tileEnt.getStackInSlot(0)!=null){ + ItemStack pStack = tileEnt.getStackInSlot(0).copy(); + pStack.stackSize = 1; + world.spawnEntityInWorld(new EntityItem(world, player.posX, player.posY, player.posZ, pStack)); + tileEnt.setInventorySlotContents(0, null); + tileEnt.markForUpdate(); + } + } + tileEnt.markForUpdate(); + return true; + } + } + tileEnt.markForUpdate(); + tileEnt.markDirty(); return true; } @@ -81,13 +129,6 @@ public class ForgeAnvil extends BlockContainer { return Item.getItemFromBlock(ModBlocks.forgeAnvil); } - @Override - @SideOnly(Side.CLIENT) - public void randomDisplayTick(World world, int x, int y, int z, Random random) - { - super.randomDisplayTick(world, x, y, z, random); - } - public void breakBlock(World world, int x, int y, int z, Block block, int meta) { TileEntityAnvilForge tileEnt = (TileEntityAnvilForge) world.getTileEntity(x, y, z); @@ -122,7 +163,6 @@ public class ForgeAnvil extends BlockContainer { } } } - world.func_147453_f(x, y, z, block); } super.breakBlock(world, x, y, z, block, meta); @@ -150,6 +190,8 @@ public class ForgeAnvil extends BlockContainer { //System.out.println(dir); } + + } diff --git a/src/main/java/com/kitsu/medievalcraft/contain/ContainerFirebox.java b/src/main/java/com/kitsu/medievalcraft/contain/ContainerFirebox.java index 3c1a9424..68cd5609 100644 --- a/src/main/java/com/kitsu/medievalcraft/contain/ContainerFirebox.java +++ b/src/main/java/com/kitsu/medievalcraft/contain/ContainerFirebox.java @@ -11,74 +11,51 @@ import com.kitsu.medievalcraft.tileents.machine.TileEntityFirebox; import com.kitsu.medievalcraft.tileents.machine.TileEntityShelfFour; public class ContainerFirebox extends Container { - + protected TileEntityFirebox tileEnt; - @Override - public boolean canInteractWith(EntityPlayer player) { - return tileEnt.isUseableByPlayer(player); - } - - public ContainerFirebox (InventoryPlayer inventoryPlayer, TileEntityFirebox te){ - tileEnt = te; + @Override + public boolean canInteractWith(EntityPlayer player) { + return tileEnt.isUseableByPlayer(player); + } - //the Slot constructor takes the IInventory and the slot number in that it binds to - //and the x-y coordinates it resides on-screen - /* for (int i = 0; i < 2; i++) { - for (int j = 0; j < 2; j++) { - addSlotToContainer(new Slot(tileEnt, j + i * 3, 62 + j * 18, 17 + i * 18)); - } - }*/ - addSlotToContainer(new Slot(tileEnt, 0, 80, 34)); + public ContainerFirebox (InventoryPlayer inventoryPlayer, TileEntityFirebox te){ + tileEnt = te; + addSlotToContainer(new Slot(tileEnt, 0, 80, 34)); + bindPlayerInventory(inventoryPlayer); + } + protected void bindPlayerInventory(InventoryPlayer inventoryPlayer) { + for (int i = 0; i < 3; i++) { + for (int j = 0; j < 9; j++) { + addSlotToContainer(new Slot(inventoryPlayer, j + i * 9 + 9, + 8 + j * 18, 84 + i * 18)); + } + } + for (int i = 0; i < 9; i++) { + addSlotToContainer(new Slot(inventoryPlayer, i, 8 + i * 18, 142)); + } + } - //commonly used vanilla code that adds the player's inventory - bindPlayerInventory(inventoryPlayer); - } - - protected void bindPlayerInventory(InventoryPlayer inventoryPlayer) { - for (int i = 0; i < 3; i++) { - for (int j = 0; j < 9; j++) { - addSlotToContainer(new Slot(inventoryPlayer, j + i * 9 + 9, - 8 + j * 18, 84 + i * 18)); - } - } - - for (int i = 0; i < 9; i++) { - addSlotToContainer(new Slot(inventoryPlayer, i, 8 + i * 18, 142)); - } - } - - @Override + @Override public ItemStack transferStackInSlot(EntityPlayer player, int slot) { ItemStack stack = null; Slot slotObject = (Slot) inventorySlots.get(slot); - - //null checks and checks if the item can be stacked (maxStackSize > 1) if (slotObject != null && slotObject.getHasStack()) { ItemStack stackInSlot = slotObject.getStack(); stack = stackInSlot.copy(); - - //merges the item into player inventory since its in the tileEntity if (slot < 9) { if (!this.mergeItemStack(stackInSlot, 9, this.inventorySlots.size(), true)) { return null; } } - //places it into the tileEntity is possible since its in the player inventory else if (!this.mergeItemStack(stackInSlot, 0, 9, false)) { return null; } - if (stackInSlot.stackSize == 0) { slotObject.putStack((ItemStack)null); } else { slotObject.onSlotChanged(); } - - /*if (stackInSlot.stackSize == stack.stackSize) { - return null; - }*/ - //slotObject.onPickupFromSlot(player, stackInSlot); } return stack; } diff --git a/src/main/java/com/kitsu/medievalcraft/contain/ContainerForgeAnvil.java b/src/main/java/com/kitsu/medievalcraft/contain/ContainerForgeAnvil.java index cc84978e..afe679d0 100644 --- a/src/main/java/com/kitsu/medievalcraft/contain/ContainerForgeAnvil.java +++ b/src/main/java/com/kitsu/medievalcraft/contain/ContainerForgeAnvil.java @@ -7,89 +7,56 @@ import net.minecraft.inventory.Slot; import net.minecraft.item.ItemStack; import com.kitsu.medievalcraft.tileents.machine.TileEntityAnvilForge; - +import com.kitsu.medievalcraft.tileents.machine.TileEntityFirebox; public class ContainerForgeAnvil extends Container { - + protected TileEntityAnvilForge tileEnt; - @Override - public boolean canInteractWith(EntityPlayer player) { - return tileEnt.isUseableByPlayer(player); - } - - public ContainerForgeAnvil (InventoryPlayer inventoryPlayer, TileEntityAnvilForge te){ - tileEnt = te; + @Override + public boolean canInteractWith(EntityPlayer player) { + return tileEnt.isUseableByPlayer(player); + } - //the Slot constructor takes the IInventory and the slot number in that it binds to - //and the x-y coordinates it resides on-screen - /*for (int i = 0; i < 3; i++) { - for (int j = 0; j < 3; j++) { - addSlotToContainer(new Slot(tileEnt, j + i * 3, 62 + j * 18, 17 + i * 18)); - } - }*/ - addSlotToContainer(new Slot(tileEnt, 0, 80, 34)); + public ContainerForgeAnvil (InventoryPlayer inventoryPlayer, TileEntityAnvilForge te){ + tileEnt = te; + addSlotToContainer(new Slot(tileEnt, 0, 80, 34)); + bindPlayerInventory(inventoryPlayer); + } + protected void bindPlayerInventory(InventoryPlayer inventoryPlayer) { + for (int i = 0; i < 3; i++) { + for (int j = 0; j < 9; j++) { + addSlotToContainer(new Slot(inventoryPlayer, j + i * 9 + 9, + 8 + j * 18, 84 + i * 18)); + } + } + for (int i = 0; i < 9; i++) { + addSlotToContainer(new Slot(inventoryPlayer, i, 8 + i * 18, 142)); + } + } - //commonly used vanilla code that adds the player's inventory - bindPlayerInventory(inventoryPlayer); - } - - protected void bindPlayerInventory(InventoryPlayer inventoryPlayer) { - for (int i = 0; i < 3; i++) { - for (int j = 0; j < 9; j++) { - addSlotToContainer(new Slot(inventoryPlayer, j + i * 9 + 9, - 8 + j * 18, 84 + i * 18)); - } - } - - for (int i = 0; i < 9; i++) { - addSlotToContainer(new Slot(inventoryPlayer, i, 8 + i * 18, 142)); - } - } - - @Override + @Override public ItemStack transferStackInSlot(EntityPlayer player, int slot) { ItemStack stack = null; Slot slotObject = (Slot) inventorySlots.get(slot); - - //null checks and checks if the item can be stacked (maxStackSize > 1) if (slotObject != null && slotObject.getHasStack()) { ItemStack stackInSlot = slotObject.getStack(); stack = stackInSlot.copy(); - - //merges the item into player inventory since its in the tileEntity if (slot < 9) { if (!this.mergeItemStack(stackInSlot, 9, this.inventorySlots.size(), true)) { return null; } } - //places it into the tileEntity is possible since its in the player inventory else if (!this.mergeItemStack(stackInSlot, 0, 9, false)) { return null; } - if (stackInSlot.stackSize == 0) { slotObject.putStack((ItemStack)null); } else { slotObject.onSlotChanged(); } - - /*if (stackInSlot.stackSize == stack.stackSize) { - return null; - }*/ - //slotObject.onPickupFromSlot(player, stackInSlot); } return stack; } -} - - - - - - - - - - +} \ No newline at end of file diff --git a/src/main/java/com/kitsu/medievalcraft/crafting/ModCrafting.java b/src/main/java/com/kitsu/medievalcraft/crafting/ModCrafting.java index a45b6084..d1d66587 100644 --- a/src/main/java/com/kitsu/medievalcraft/crafting/ModCrafting.java +++ b/src/main/java/com/kitsu/medievalcraft/crafting/ModCrafting.java @@ -184,7 +184,6 @@ public final class ModCrafting { 'x', ModBlocks.ironPlate, 'i', Blocks.iron_bars, 'y', ModItems.charcoalFilter}); - GameRegistry.addRecipe(new ItemStack(ModItems.itemSmallBarrelLid), new Object[] {"ixi", "xxx", "ixi", 'x', ModItems.halfSplitBoard, @@ -197,7 +196,6 @@ public final class ModCrafting { {"x x", "x x", "xxx", 'x', Items.brick}); - //-----------------------LEATHER STUFF-----------------------// //GameRegistry.addRecipe(new ItemStack(ModItems.rawCuredLeather), new Object[]{"x", "z", 'x', Items.leather, 'z', ModItems.salt}); @@ -218,26 +216,42 @@ public final class ModCrafting { GameRegistry.addRecipe(longbow0, new Object[]{"ya", 'y', ModItems.unstrungLongbow, 'a', Items.string}); //-----------------------CRUCIBLE STUFF-----------------------// - /*//GameRegistry.addRecipe(new ItemStack(ModItems.crucibleLid), new Object[]{"x", "y", 'x', Items.clay_ball, 'y', Blocks.stone_slab}); + //GameRegistry.addRecipe(new ItemStack(ModItems.crucibleLid), new Object[]{"x", "y", 'x', Items.clay_ball, 'y', Blocks.stone_slab}); GameRegistry.addRecipe(new ItemStack(ModBlocks.emptySoftCrucible), new Object[]{"y y", "y y", "yyy", 'y', Items.clay_ball}); - GameRegistry.addRecipe(new ItemStack(ModBlocks.filledCrucibleIron), new Object[]{" x ", "abc", " y ", 'x', Blocks.stone_slab, 'y', ModBlocks.emptyCookedCrucible, - 'a', Blocks.sand, 'b', Blocks.iron_ore, 'c', new ItemStack(Items.coal,0,1)}); - GameRegistry.addRecipe(new ItemStack(ModBlocks.filledCrucibleIronIngot), new Object[]{" x ", "abc", " y ", 'x', Blocks.stone_slab, 'y', ModBlocks.emptyCookedCrucible, - 'a', Blocks.sand, 'b', Items.iron_ingot, 'c', new ItemStack(Items.coal,0,1)}); GameRegistry.addRecipe(new ItemStack(ModItems.charcoalLeafPellet), new Object[]{"xxx", "xyx", "xxx", 'x', new ItemStack(Blocks.leaves,0,3), 'y', new ItemStack(Items.coal,0,1)}); - GameRegistry.addRecipe(new ItemStack(ModBlocks.filledCrucibleDamascus), new Object[]{" x ", "abc", " y ", 'x', Blocks.stone_slab, 'y', ModBlocks.emptyCookedCrucible, - 'a', Blocks.sand, 'b', ModBlocks.wootzOre, 'c', ModItems.charcoalLeafPellet}); - GameRegistry.addRecipe(new ItemStack(ModBlocks.filledLapisCrucible), + GameRegistry.addRecipe(new ItemStack(ModBlocks.crucibleIronOre), + new Object[]{" x ", "abc", " y ", + 'x', Blocks.stone_slab, + 'y', ModBlocks.emptyCookedCrucible, + 'a', Blocks.sand, + 'b', Blocks.iron_ore, + 'c', new ItemStack(Items.coal,0,1)}); + GameRegistry.addRecipe(new ItemStack(ModBlocks.crucibleIronIngot), + new Object[]{" x ", "abc"," y ", + 'x', Blocks.stone_slab, + 'y', ModBlocks.emptyCookedCrucible, + 'a', Blocks.sand, + 'b', Items.iron_ingot, + 'c', new ItemStack(Items.coal,0,1)}); + + GameRegistry.addRecipe(new ItemStack(ModBlocks.crucibleWootz), + new Object[]{" x ", "abc", " y ", + 'x', Blocks.stone_slab, + 'y', ModBlocks.emptyCookedCrucible, + 'a', Blocks.sand, + 'b', ModBlocks.wootzOre, + 'c', ModItems.charcoalLeafPellet}); + GameRegistry.addRecipe(new ItemStack(ModBlocks.crucibleLapis), new Object[]{" x ", "abb", " y ", 'x', Blocks.stone_slab, 'a', Blocks.sand, 'b', Blocks.lapis_block, 'y', ModBlocks.emptyCookedCrucible}); - GameRegistry.addRecipe(new ItemStack(ModBlocks.filledRedstoneCrucible), + GameRegistry.addRecipe(new ItemStack(ModBlocks.crucibleRedstone), new Object[]{" x ", "abb", " y ", 'x', Blocks.stone_slab, 'a', Blocks.sand, 'b', Blocks.redstone_block, 'y', ModBlocks.emptyCookedCrucible}); -*/ + //-----------------------WEAPONS-----------------------// GameRegistry.addRecipe(new ShapedOreRecipe((ModItems.longSword), new Object[]{"b", "a", Character.valueOf('a'), "strapLeather", 'b', ModItems.ironlongswordBlade})); GameRegistry.addRecipe(new ShapedOreRecipe((ModItems.heavyMace), new Object[]{" a ", "aba", " c ", 'a', ModItems.ironsharpTip, 'b', ModItems.ironmaceHead, 'c', ModItems.ironweaponHandle})); diff --git a/src/main/java/com/kitsu/medievalcraft/packethandle/forge/MsgHandleBurning.java b/src/main/java/com/kitsu/medievalcraft/packethandle/forge/MsgHandleBurning.java deleted file mode 100644 index 9ad2f2af..00000000 --- a/src/main/java/com/kitsu/medievalcraft/packethandle/forge/MsgHandleBurning.java +++ /dev/null @@ -1,16 +0,0 @@ -package com.kitsu.medievalcraft.packethandle.forge; - -import com.kitsu.medievalcraft.block.machines.Forge; - -import cpw.mods.fml.common.network.simpleimpl.IMessage; -import cpw.mods.fml.common.network.simpleimpl.IMessageHandler; -import cpw.mods.fml.common.network.simpleimpl.MessageContext; - -public class MsgHandleBurning implements IMessageHandler{ - - @Override - public IMessage onMessage(MsgPacketBurning message, MessageContext ctx) { - Forge.coalParts = message.packetOn; - return null; - } -} diff --git a/src/main/java/com/kitsu/medievalcraft/packethandle/forge/MsgHandleForgeX.java b/src/main/java/com/kitsu/medievalcraft/packethandle/forge/MsgHandleForgeX.java deleted file mode 100644 index 69e705c5..00000000 --- a/src/main/java/com/kitsu/medievalcraft/packethandle/forge/MsgHandleForgeX.java +++ /dev/null @@ -1,25 +0,0 @@ -package com.kitsu.medievalcraft.packethandle.forge; - -import com.kitsu.medievalcraft.block.ingots.IngotBase; -import com.kitsu.medievalcraft.block.machines.Forge; -import com.kitsu.medievalcraft.packethandle.forgeHammerParticles.MsgPacketLocX; - -import cpw.mods.fml.common.network.simpleimpl.IMessage; -import cpw.mods.fml.common.network.simpleimpl.IMessageHandler; -import cpw.mods.fml.common.network.simpleimpl.MessageContext; - -public class MsgHandleForgeX implements IMessageHandler{ - - @Override - public IMessage onMessage(MsgPacketForgeX message, MessageContext ctx) { - - //IngotBase.locX = message.locx; - Forge.locX = message.locx; - //ItemRendererLongbow.tick = message.lTick; - - //System.out.println(message.lTick); - //ctx.getClientHandler().addToSendQueue(new MsgPacket(message.useme)); - - return null; - } -} diff --git a/src/main/java/com/kitsu/medievalcraft/packethandle/forge/MsgHandleForgeY.java b/src/main/java/com/kitsu/medievalcraft/packethandle/forge/MsgHandleForgeY.java deleted file mode 100644 index 9eee1be3..00000000 --- a/src/main/java/com/kitsu/medievalcraft/packethandle/forge/MsgHandleForgeY.java +++ /dev/null @@ -1,23 +0,0 @@ -package com.kitsu.medievalcraft.packethandle.forge; - -import com.kitsu.medievalcraft.block.machines.Forge; - -import cpw.mods.fml.common.network.simpleimpl.IMessage; -import cpw.mods.fml.common.network.simpleimpl.IMessageHandler; -import cpw.mods.fml.common.network.simpleimpl.MessageContext; - -public class MsgHandleForgeY implements IMessageHandler{ - - @Override - public IMessage onMessage(MsgPacketForgeY message, MessageContext ctx) { - - //IngotBase.locX = message.locx; - Forge.locY = message.locy; - //ItemRendererLongbow.tick = message.lTick; - - //System.out.println(message.lTick); - //ctx.getClientHandler().addToSendQueue(new MsgPacket(message.useme)); - - return null; - } -} diff --git a/src/main/java/com/kitsu/medievalcraft/packethandle/forge/MsgHandleForgeZ.java b/src/main/java/com/kitsu/medievalcraft/packethandle/forge/MsgHandleForgeZ.java deleted file mode 100644 index 83029e7b..00000000 --- a/src/main/java/com/kitsu/medievalcraft/packethandle/forge/MsgHandleForgeZ.java +++ /dev/null @@ -1,23 +0,0 @@ -package com.kitsu.medievalcraft.packethandle.forge; - -import com.kitsu.medievalcraft.block.machines.Forge; - -import cpw.mods.fml.common.network.simpleimpl.IMessage; -import cpw.mods.fml.common.network.simpleimpl.IMessageHandler; -import cpw.mods.fml.common.network.simpleimpl.MessageContext; - -public class MsgHandleForgeZ implements IMessageHandler{ - - @Override - public IMessage onMessage(MsgPacketForgeZ message, MessageContext ctx) { - - //IngotBase.locX = message.locx; - Forge.locZ = message.locz; - //ItemRendererLongbow.tick = message.lTick; - - //System.out.println(message.lTick); - //ctx.getClientHandler().addToSendQueue(new MsgPacket(message.useme)); - - return null; - } -} diff --git a/src/main/java/com/kitsu/medievalcraft/packethandle/forge/MsgHandleOn.java b/src/main/java/com/kitsu/medievalcraft/packethandle/forge/MsgHandleOn.java deleted file mode 100644 index fddf6709..00000000 --- a/src/main/java/com/kitsu/medievalcraft/packethandle/forge/MsgHandleOn.java +++ /dev/null @@ -1,16 +0,0 @@ -package com.kitsu.medievalcraft.packethandle.forge; - -import com.kitsu.medievalcraft.block.machines.Forge; - -import cpw.mods.fml.common.network.simpleimpl.IMessage; -import cpw.mods.fml.common.network.simpleimpl.IMessageHandler; -import cpw.mods.fml.common.network.simpleimpl.MessageContext; - -public class MsgHandleOn implements IMessageHandler{ - - @Override - public IMessage onMessage(MsgPacketOn message, MessageContext ctx) { - Forge.furnaceParts = message.packetOn; - return null; - } -} diff --git a/src/main/java/com/kitsu/medievalcraft/packethandle/forge/MsgPacketBurning.java b/src/main/java/com/kitsu/medievalcraft/packethandle/forge/MsgPacketBurning.java deleted file mode 100644 index 46823626..00000000 --- a/src/main/java/com/kitsu/medievalcraft/packethandle/forge/MsgPacketBurning.java +++ /dev/null @@ -1,26 +0,0 @@ -package com.kitsu.medievalcraft.packethandle.forge; - -import io.netty.buffer.ByteBuf; -import cpw.mods.fml.common.network.simpleimpl.IMessage; - -public class MsgPacketBurning implements IMessage { - - public boolean packetOn; - - public MsgPacketBurning() {} - - public MsgPacketBurning(boolean x){ - this.packetOn = x; - } - - @Override - public void fromBytes(ByteBuf buf) { - this.packetOn = buf.readBoolean(); - } - - @Override - public void toBytes(ByteBuf buf) { - buf.writeBoolean(this.packetOn); - } - -} diff --git a/src/main/java/com/kitsu/medievalcraft/packethandle/forge/MsgPacketForgeX.java b/src/main/java/com/kitsu/medievalcraft/packethandle/forge/MsgPacketForgeX.java deleted file mode 100644 index 0fae0d6d..00000000 --- a/src/main/java/com/kitsu/medievalcraft/packethandle/forge/MsgPacketForgeX.java +++ /dev/null @@ -1,28 +0,0 @@ -package com.kitsu.medievalcraft.packethandle.forge; - -import io.netty.buffer.ByteBuf; -import cpw.mods.fml.common.network.simpleimpl.IMessage; - -public class MsgPacketForgeX implements IMessage { - - public int locx; - - public MsgPacketForgeX() {} - - public MsgPacketForgeX(int x){ - this.locx = x; - } - - - @Override - public void fromBytes(ByteBuf buf) { - - this.locx = buf.readInt(); - } - - @Override - public void toBytes(ByteBuf buf) { - buf.writeInt(this.locx); - } - -} diff --git a/src/main/java/com/kitsu/medievalcraft/packethandle/forge/MsgPacketForgeY.java b/src/main/java/com/kitsu/medievalcraft/packethandle/forge/MsgPacketForgeY.java deleted file mode 100644 index ad83cbd4..00000000 --- a/src/main/java/com/kitsu/medievalcraft/packethandle/forge/MsgPacketForgeY.java +++ /dev/null @@ -1,28 +0,0 @@ -package com.kitsu.medievalcraft.packethandle.forge; - -import io.netty.buffer.ByteBuf; -import cpw.mods.fml.common.network.simpleimpl.IMessage; - -public class MsgPacketForgeY implements IMessage { - - public int locy; - - public MsgPacketForgeY() {} - - public MsgPacketForgeY(int y){ - this.locy = y; - } - - - @Override - public void fromBytes(ByteBuf buf) { - - this.locy = buf.readInt(); - } - - @Override - public void toBytes(ByteBuf buf) { - buf.writeInt(this.locy); - } - -} diff --git a/src/main/java/com/kitsu/medievalcraft/packethandle/forge/MsgPacketForgeZ.java b/src/main/java/com/kitsu/medievalcraft/packethandle/forge/MsgPacketForgeZ.java deleted file mode 100644 index 36487de7..00000000 --- a/src/main/java/com/kitsu/medievalcraft/packethandle/forge/MsgPacketForgeZ.java +++ /dev/null @@ -1,28 +0,0 @@ -package com.kitsu.medievalcraft.packethandle.forge; - -import io.netty.buffer.ByteBuf; -import cpw.mods.fml.common.network.simpleimpl.IMessage; - -public class MsgPacketForgeZ implements IMessage { - - public int locz; - - public MsgPacketForgeZ() {} - - public MsgPacketForgeZ(int z){ - this.locz = z; - } - - - @Override - public void fromBytes(ByteBuf buf) { - - this.locz = buf.readInt(); - } - - @Override - public void toBytes(ByteBuf buf) { - buf.writeInt(this.locz); - } - -} diff --git a/src/main/java/com/kitsu/medievalcraft/packethandle/forge/MsgPacketOn.java b/src/main/java/com/kitsu/medievalcraft/packethandle/forge/MsgPacketOn.java deleted file mode 100644 index ab97efa2..00000000 --- a/src/main/java/com/kitsu/medievalcraft/packethandle/forge/MsgPacketOn.java +++ /dev/null @@ -1,26 +0,0 @@ -package com.kitsu.medievalcraft.packethandle.forge; - -import io.netty.buffer.ByteBuf; -import cpw.mods.fml.common.network.simpleimpl.IMessage; - -public class MsgPacketOn implements IMessage { - - public boolean packetOn; - - public MsgPacketOn() {} - - public MsgPacketOn(boolean x){ - this.packetOn = x; - } - - @Override - public void fromBytes(ByteBuf buf) { - this.packetOn = buf.readBoolean(); - } - - @Override - public void toBytes(ByteBuf buf) { - buf.writeBoolean(this.packetOn); - } - -} diff --git a/src/main/java/com/kitsu/medievalcraft/renderer/blocks/machine/FireboxRenderer.java b/src/main/java/com/kitsu/medievalcraft/renderer/blocks/machine/FireboxRenderer.java index ee8b3934..3fb6e656 100644 --- a/src/main/java/com/kitsu/medievalcraft/renderer/blocks/machine/FireboxRenderer.java +++ b/src/main/java/com/kitsu/medievalcraft/renderer/blocks/machine/FireboxRenderer.java @@ -45,8 +45,9 @@ public class FireboxRenderer extends TileEntitySpecialRenderer { this.entItem.hoverStart = 0.0F; RenderItem.renderInFrame = true; GL11.glScalef(1.0f, 1.0f, 1.0f); - //GL11.glRotatef(90, 0, 1, 0); RenderManager.instance.renderEntityWithPosYaw(entItem, 0.5D, 0.3D, 0.5D, 0.0F, 0.0F); + GL11.glRotatef(90, 0, 1, 0); + RenderManager.instance.renderEntityWithPosYaw(entItem, -0.5D, 0.3D, 0.5D, 0.0F, 0.0F); RenderItem.renderInFrame = false; GL11.glPopMatrix(); } @@ -60,10 +61,6 @@ public class FireboxRenderer extends TileEntitySpecialRenderer { @SuppressWarnings({ "cast"}) public void renderBlock(TileEntityFirebox tl, World world, int i, int j,int k, Block block) { - Tessellator tessellator = Tessellator.instance; - // This will make your block brightness dependent from surroundings - // lighting. - int dir = world.getBlockMetadata(i, j, k); GL11.glPushMatrix(); diff --git a/src/main/java/com/kitsu/medievalcraft/renderer/blocks/machine/ForgeAnvilRenderer.java b/src/main/java/com/kitsu/medievalcraft/renderer/blocks/machine/ForgeAnvilRenderer.java index 18b31eae..9c90444c 100644 --- a/src/main/java/com/kitsu/medievalcraft/renderer/blocks/machine/ForgeAnvilRenderer.java +++ b/src/main/java/com/kitsu/medievalcraft/renderer/blocks/machine/ForgeAnvilRenderer.java @@ -33,6 +33,11 @@ public class ForgeAnvilRenderer extends TileEntitySpecialRenderer { TileEntityAnvilForge tileEntity = (TileEntityAnvilForge)tile; GL11.glPushMatrix(); GL11.glTranslatef((float) x, (float) y, (float) z); + + if(tileEntity.getStackInSlot(0)==null){ + entItem=null; + } + if(tileEntity.getStackInSlot(0)!=null){ entItem = new EntityItem(tileEntity.getWorldObj(), x, y, z, tileEntity.getStackInSlot(0)); GL11.glPushMatrix(); @@ -43,8 +48,12 @@ public class ForgeAnvilRenderer extends TileEntitySpecialRenderer { RenderItem.renderInFrame = false; GL11.glPopMatrix(); tileEntity.markForUpdate(); + tileEntity.markDirty(); } + renderBlock(tileEntity, tile.getWorldObj(), tile.xCoord,tile.yCoord, tile.zCoord, ModBlocks.forgeAnvil); + tileEntity.markForUpdate(); + tileEntity.markDirty(); GL11.glPopMatrix(); } diff --git a/src/main/java/com/kitsu/medievalcraft/renderer/blocks/machine/ForgeRenderer.java b/src/main/java/com/kitsu/medievalcraft/renderer/blocks/machine/ForgeRenderer.java index 54edb25b..b2f619f7 100644 --- a/src/main/java/com/kitsu/medievalcraft/renderer/blocks/machine/ForgeRenderer.java +++ b/src/main/java/com/kitsu/medievalcraft/renderer/blocks/machine/ForgeRenderer.java @@ -74,9 +74,11 @@ public class ForgeRenderer extends TileEntitySpecialRenderer { GL11.glPushMatrix(); this.entItem.hoverStart = 0.0F; RenderItem.renderInFrame = true; + GL11.glScalef(1.0f, 1.0f, 1.0f); //GL11.glRotatef(10, 0, 1, 0); RenderManager.instance.renderEntityWithPosYaw(entItem, 0.55D, 0.25D, 0.5D, 0.0F, 0.0F); + RenderItem.renderInFrame = false; GL11.glPopMatrix(); tileEntity.markForUpdate(); diff --git a/src/main/java/com/kitsu/medievalcraft/tileents/crucible/empty/TileEntityBoilingWaterCrucible.java b/src/main/java/com/kitsu/medievalcraft/tileents/crucible/empty/TileEntityBoilingWaterCrucible.java index ef141c8a..75a1974e 100644 --- a/src/main/java/com/kitsu/medievalcraft/tileents/crucible/empty/TileEntityBoilingWaterCrucible.java +++ b/src/main/java/com/kitsu/medievalcraft/tileents/crucible/empty/TileEntityBoilingWaterCrucible.java @@ -23,10 +23,8 @@ public class TileEntityBoilingWaterCrucible extends TileEntity { this.boilingWaterCrucibleName = string; } private void heat(World world, int x, int y, int z){ - Block ironbar = this.worldObj.getBlock(x, y - 1, z); - Block fire = this.worldObj.getBlock(x, y-2, z); if(!world.isRemote){ - if((ironbar == Blocks.iron_bars) && (fire == Blocks.fire)){ + if(world.getBlock(x, y-1, z).equals(ModBlocks.firebox)&&world.getBlockMetadata(x, y-1, z)==1){ cticks = 0; if((dotan==true)){ bticks++; @@ -49,16 +47,14 @@ public class TileEntityBoilingWaterCrucible extends TileEntity { Block fire = this.worldObj.getBlock(x, y-2, z); Block ironbar = this.worldObj.getBlock(x, y - 1, z); if(!world.isRemote){ - if((fire != Blocks.fire)&&(ironbar == Blocks.iron_bars)){ + if(world.getBlock(x, y-1, z)!=(ModBlocks.firebox)||world.getBlock(x, y-1, z)!=(Blocks.fire)){ cticks++; - //System.out.println(tagCompound.getInteger("CTICKS")); if(cticks >= 500 + world.rand.nextInt(50)){ world.setBlock(x, y, z, ModBlocks.filledWaterCrucible, 0, 2); } } - if((fire != Blocks.fire)&&(ironbar != Blocks.iron_bars)){ + if(world.getBlock(x, y-1, z)==(ModBlocks.firebox)&&world.getBlockMetadata(x, y, z)==0){ cticks++; - //System.out.println(tagCompound.getInteger("CTICKS")); if(cticks >= 500 + world.rand.nextInt(50)){ world.setBlock(x, y, z, ModBlocks.filledWaterCrucible, 0, 2); } diff --git a/src/main/java/com/kitsu/medievalcraft/tileents/crucible/empty/TileEntityFilledWaterCrucible.java b/src/main/java/com/kitsu/medievalcraft/tileents/crucible/empty/TileEntityFilledWaterCrucible.java index 99450afd..8bc0dfde 100644 --- a/src/main/java/com/kitsu/medievalcraft/tileents/crucible/empty/TileEntityFilledWaterCrucible.java +++ b/src/main/java/com/kitsu/medievalcraft/tileents/crucible/empty/TileEntityFilledWaterCrucible.java @@ -14,62 +14,12 @@ import net.minecraft.world.World; public class TileEntityFilledWaterCrucible extends TileEntity { private String filledWaterCrucibleName; - private int cticks; - NBTTagCompound nbt = new NBTTagCompound(); + public int cookTime = 450; + public int coolTime = 500; + public Block cookBlock = ModBlocks.boilingWaterCrucible; - public void forgeName(String string){ - this.filledWaterCrucibleName = string; - } - private void heat(World world, int x, int y, int z){ - Block testBlock = this.worldObj.getBlock(x, y - 1, z); - Block fire = this.worldObj.getBlock(x, y-2, z); + public TileEntityFilledWaterCrucible() { - if((!world.isRemote) && (testBlock == Blocks.iron_bars) && (fire == Blocks.fire)){ - cticks++; - if(cticks >= 500 + world.rand.nextInt(50)){ - world.setBlock(x, y, z, ModBlocks.boilingWaterCrucible, 0, 2); - //System.out.println("Boiled"); - } - } - } - - @Override - public void readFromNBT(NBTTagCompound tagCompound) { - super.readFromNBT(tagCompound); - this.cticks = tagCompound.getInteger("CTICKS"); - if (tagCompound.hasKey("CustomName", 8)) { - this.filledWaterCrucibleName = tagCompound.getString("CustomName"); - } - } - - @Override - public void writeToNBT(NBTTagCompound tagCompound) { - super.writeToNBT(tagCompound); - tagCompound.setInteger("CTICKS", cticks); - } - - @Override - public void updateEntity() { - World world = this.getWorldObj(); - int x = this.xCoord; - int y = this.yCoord; - int z = this.zCoord; - if(!world.isRemote){ - heat(world, x, y, z); - } - } - @Override - public Packet getDescriptionPacket() { - NBTTagCompound nbt = new NBTTagCompound(); - writeToNBT(nbt); - return new S35PacketUpdateTileEntity(xCoord, yCoord, zCoord, -998, nbt); - } - - @Override - public void onDataPacket(NetworkManager net, S35PacketUpdateTileEntity pkt) { - readFromNBT(pkt.func_148857_g()); - worldObj.markBlockForUpdate(xCoord, yCoord, zCoord); } + } - - diff --git a/src/main/java/com/kitsu/medievalcraft/tileents/crucible/empty/TileEntitySoftEmptyCrucible.java b/src/main/java/com/kitsu/medievalcraft/tileents/crucible/empty/TileEntitySoftEmptyCrucible.java index b2969e34..d94bb9fc 100644 --- a/src/main/java/com/kitsu/medievalcraft/tileents/crucible/empty/TileEntitySoftEmptyCrucible.java +++ b/src/main/java/com/kitsu/medievalcraft/tileents/crucible/empty/TileEntitySoftEmptyCrucible.java @@ -1,10 +1,15 @@ package com.kitsu.medievalcraft.tileents.crucible.empty; +import net.minecraft.block.Block; import net.minecraft.tileentity.TileEntity; +import com.kitsu.medievalcraft.block.ModBlocks; + public class TileEntitySoftEmptyCrucible extends TileEntity { private String emptyCrucibleName; + public int cookTime = 250; + public Block cookBlock = ModBlocks.emptyCookedCrucible; public void emptyCrucibleName(String string){ this.emptyCrucibleName = string; diff --git a/src/main/java/com/kitsu/medievalcraft/tileents/ingots/TileIngotBase.java b/src/main/java/com/kitsu/medievalcraft/tileents/ingots/TileIngotBase.java index 453a0604..7a16c9c6 100644 --- a/src/main/java/com/kitsu/medievalcraft/tileents/ingots/TileIngotBase.java +++ b/src/main/java/com/kitsu/medievalcraft/tileents/ingots/TileIngotBase.java @@ -12,21 +12,23 @@ import com.kitsu.medievalcraft.tileents.machine.TileEntityAnvilForge; import com.kitsu.medievalcraft.util.AnvilUtil; public class TileIngotBase extends TileEntity implements AnvilUtil{ - + private String specName; public int hits = 0; + protected int heatBase = 300; public int coolTicks = 250; - public int heatTicks = 100; + public int heatTicks = 300; + protected int coolBase = 250; public boolean hot; public TileIngotBase(String name){ specName = name; } - + public void markForUpdate(){ worldObj.markBlockForUpdate(this.xCoord, this.yCoord, this.zCoord); } - + @Override public void updateEntity() { World world = this.getWorldObj(); @@ -34,10 +36,11 @@ public class TileIngotBase extends TileEntity implements AnvilUtil{ int y = this.yCoord; int z = this.zCoord; if(!world.isRemote){ + System.out.println(this.heatTicks); if(this.heatTicks<=0){ world.setBlockMetadataWithNotify(x, y, z, 1, 2); this.hot=true; - this.heatTicks=100; + //this.heatTicks=100; } if(this.coolTicks<=0){ world.setBlockMetadataWithNotify(x, y, z, 0, 2); @@ -47,30 +50,33 @@ public class TileIngotBase extends TileEntity implements AnvilUtil{ } } - + private void coolDown(World world, int x, int y, int z){ if(!world.isRemote){ - if((world.getBlock(x, y-1, z)!=ModBlocks.forge)&&(this.hot==true)){ - coolTicks--; - if(coolTicks <= 0){ - this.hot=false; - this.coolTicks=100; - this.heatTicks=100; - this.markForUpdate(); - this.markDirty(); + if(this.hot==true){ + if(world.getBlockMetadata(x, y-1, z)<8){ + coolTicks--; + if(coolTicks <= 0){ + world.setBlockMetadataWithNotify(x, y, z, 0, 2); + this.hot=false; + this.coolTicks=coolBase; + this.heatTicks=heatBase; + this.markForUpdate(); + this.markDirty(); + } } } } } - + /* private void makeItem(World world, int x, int y, int z){ if(this.hits==0 && this.hot==true && world.getBlock(x, y-1, z).equals(ModBlocks.forgeAnvil)){ TileEntityAnvilForge tile = (TileEntityAnvilForge) world.getTileEntity(x, y-1, z); if(tile.getStackInSlot(0)!=null){ - - - + + + System.out.println(forms.get(tile.getStackInSlot(0).getItem().getUnlocalizedName())); if(tile.getStackInSlot(0).equals(forms.get(tile.getStackInSlot(0).getItem().getUnlocalizedName()))){ System.out.println("Logic is Working"); @@ -78,8 +84,8 @@ public class TileIngotBase extends TileEntity implements AnvilUtil{ } } } - */ - + */ + @Override public void readFromNBT(NBTTagCompound tagCompound) { diff --git a/src/main/java/com/kitsu/medievalcraft/tileents/ingots/TileMyIronIngot.java b/src/main/java/com/kitsu/medievalcraft/tileents/ingots/TileMyIronIngot.java index c890a1a6..1466aa85 100644 --- a/src/main/java/com/kitsu/medievalcraft/tileents/ingots/TileMyIronIngot.java +++ b/src/main/java/com/kitsu/medievalcraft/tileents/ingots/TileMyIronIngot.java @@ -8,8 +8,9 @@ public class TileMyIronIngot extends TileIngotBase{ super(nameCustom); this.hits = 0; this.hot = false; - - this.heatTicks = 300; + this.heatBase = 50; + this.heatTicks = 50; + this.coolBase = 50; } } diff --git a/src/main/java/com/kitsu/medievalcraft/tileents/machine/TileEntityAnvilForge.java b/src/main/java/com/kitsu/medievalcraft/tileents/machine/TileEntityAnvilForge.java index a0fb6a2b..b1c2c28b 100644 --- a/src/main/java/com/kitsu/medievalcraft/tileents/machine/TileEntityAnvilForge.java +++ b/src/main/java/com/kitsu/medievalcraft/tileents/machine/TileEntityAnvilForge.java @@ -1,52 +1,104 @@ package com.kitsu.medievalcraft.tileents.machine; +import com.kitsu.medievalcraft.block.ModBlocks; +import com.kitsu.medievalcraft.block.crucible.CrucibleBase; +import com.kitsu.medievalcraft.tileents.crucible.TileCrucibleBase; +import com.kitsu.medievalcraft.tileents.crucible.empty.TileEntityFilledWaterCrucible; +import com.kitsu.medievalcraft.tileents.crucible.empty.TileEntitySoftEmptyCrucible; + +import cpw.mods.fml.common.registry.GameRegistry; +import net.minecraft.block.Block; +import net.minecraft.block.BlockFurnace; +import net.minecraft.block.material.Material; import net.minecraft.entity.player.EntityPlayer; +import net.minecraft.init.Blocks; +import net.minecraft.init.Items; import net.minecraft.inventory.IInventory; +import net.minecraft.item.Item; +import net.minecraft.item.ItemBlock; +import net.minecraft.item.ItemHoe; import net.minecraft.item.ItemStack; +import net.minecraft.item.ItemSword; +import net.minecraft.item.ItemTool; import net.minecraft.nbt.NBTTagCompound; import net.minecraft.nbt.NBTTagList; import net.minecraft.network.NetworkManager; import net.minecraft.network.Packet; import net.minecraft.network.play.server.S35PacketUpdateTileEntity; import net.minecraft.tileentity.TileEntity; +import net.minecraft.tileentity.TileEntityFurnace; +import net.minecraft.world.World; -public class TileEntityAnvilForge extends TileEntity implements IInventory { +public class TileEntityAnvilForge extends TileEntity implements IInventory{ - private String forgeAnvilName; - public ItemStack[] inv; - NBTTagCompound tag = new NBTTagCompound(); + private String anvilName; + private ItemStack[] inv; + private NBTTagCompound tag = new NBTTagCompound(); + private int ticks; + public boolean isOn; public TileEntityAnvilForge(){ - inv = new ItemStack[1]; - } - - public void forgeName(String string){ - this.forgeAnvilName = string; + this.inv = new ItemStack[1]; } @Override public int getSizeInventory() { - return inv.length; + return this.inv.length; } - @Override public ItemStack getStackInSlot(int slot) { - return inv[slot]; + return this.inv[slot]; } @Override - public ItemStack getStackInSlotOnClosing(int p_70304_1_) + public ItemStack decrStackSize(int p_70298_1_, int p_70298_2_) { - if (this.inv[p_70304_1_] != null) + if (this.inv[p_70298_1_] != null) { - ItemStack itemstack = this.inv[p_70304_1_]; - this.inv[p_70304_1_] = null; + ItemStack itemstack; + + if (this.inv[p_70298_1_].stackSize <= p_70298_2_) + { + itemstack = this.inv[p_70298_1_]; + this.inv[p_70298_1_] = null; + this.markForUpdate(); + this.markDirty(); + return itemstack; + } + itemstack = this.inv[p_70298_1_].splitStack(p_70298_2_); + + if (this.inv[p_70298_1_].stackSize == 0) + { + this.inv[p_70298_1_] = null; + } + this.markForUpdate(); + this.markDirty(); return itemstack; } this.markForUpdate(); + this.markDirty(); return null; } + @Override + public ItemStack getStackInSlotOnClosing(int i) + { + if (this.inv[i] != null) + { + ItemStack itemstack = this.inv[i]; + this.inv[i] = null; + this.markForUpdate(); + this.markDirty(); + return itemstack; + } + else + { + this.markForUpdate(); + this.markDirty(); + return null; + } + } + @Override public void setInventorySlotContents(int slot, ItemStack stack) { @@ -62,44 +114,54 @@ public class TileEntityAnvilForge extends TileEntity implements IInventory { @Override public String getInventoryName() { - return this.hasCustomInventoryName() ? this.forgeAnvilName : "Forge"; + return this.hasCustomInventoryName() ? this.anvilName : "anvilName"; } @Override public boolean hasCustomInventoryName() { - return this.forgeAnvilName != null && this.forgeAnvilName.length() > 0; + return this.anvilName != null && this.anvilName.length() > 0; } @Override public int getInventoryStackLimit() { - return 1; + return 64; } - + @Override public boolean isUseableByPlayer(EntityPlayer player) { return this.worldObj.getTileEntity(this.xCoord, this.yCoord, this.zCoord) != this ? false : player.getDistanceSq(this.xCoord + 0.5D, this.yCoord + 0.5D, this.zCoord + 0.5D) <= 64.0D; } @Override - public boolean isItemValidForSlot(int par1, ItemStack itemstack) { + public void openInventory() {} + @Override + public void closeInventory() {} + @Override + public boolean isItemValidForSlot(int par1, ItemStack itemstack) { return false; } + + public void markForUpdate(){ + worldObj.markBlockForUpdate(this.xCoord, this.yCoord, this.zCoord); + } + @Override public void readFromNBT(NBTTagCompound tagCompound) { super.readFromNBT(tagCompound); - NBTTagList tagList = tagCompound.getTagList("Inventory", 10); + this.inv = new ItemStack[this.getSizeInventory()]; for (int i = 0; i < tagList.tagCount(); i++) { NBTTagCompound tag = tagList.getCompoundTagAt(i); byte slot = tag.getByte("Slot"); - if (slot >= 0 && slot < inv.length) { - inv[slot] = ItemStack.loadItemStackFromNBT(tag); + if (slot >= 0 && slot < this.inv.length) { + this.inv[slot] = ItemStack.loadItemStackFromNBT(tag); } } if (tagCompound.hasKey("CustomName", 8)) { - this.forgeAnvilName = tagCompound.getString("CustomName"); + this.anvilName = tagCompound.getString("CustomName"); } + } @Override @@ -108,59 +170,22 @@ public class TileEntityAnvilForge extends TileEntity implements IInventory { NBTTagList itemList = new NBTTagList(); for (int i = 0; i < inv.length; i++) { - ItemStack stack = inv[i]; - if (stack != null) { + //ItemStack stack = inv[i]; + if (inv[i] != null) { NBTTagCompound tag = new NBTTagCompound(); tag.setByte("Slot", (byte) i); - stack.writeToNBT(tag); + this.inv[i].writeToNBT(tag); itemList.appendTag(tag); } } tagCompound.setTag("Inventory", itemList); + } - - @Override - public void openInventory() {} - - @Override - public void closeInventory() {} - - /** - * Removes from an inventory slot (first arg) up to a specified number (second arg) of items and returns them in a - * new stack. - */ - - @Override - public ItemStack decrStackSize(int p_70298_1_, int p_70298_2_) - { - if (this.inv[p_70298_1_] != null) - { - ItemStack itemstack; - - if (this.inv[p_70298_1_].stackSize <= p_70298_2_) - { - itemstack = this.inv[p_70298_1_]; - this.inv[p_70298_1_] = null; - return itemstack; - } - itemstack = this.inv[p_70298_1_].splitStack(p_70298_2_); - - if (this.inv[p_70298_1_].stackSize == 0) - { - this.inv[p_70298_1_] = null; - } - this.markForUpdate(); - return itemstack; - } - this.markForUpdate(); - return null; - } - @Override public Packet getDescriptionPacket() { NBTTagCompound tag = new NBTTagCompound(); - writeToNBT(tag); - return new S35PacketUpdateTileEntity(xCoord, yCoord, zCoord, -998, tag); + this.writeToNBT(tag); + return new S35PacketUpdateTileEntity(xCoord, yCoord, zCoord, 998, tag); } @Override @@ -168,12 +193,26 @@ public class TileEntityAnvilForge extends TileEntity implements IInventory { readFromNBT(pkt.func_148857_g()); worldObj.markBlockForUpdate(xCoord, yCoord, zCoord); } - public void markForUpdate(){ - worldObj.markBlockForUpdate(this.xCoord, this.yCoord, this.zCoord); + + @Override + public void updateEntity() { + + World world = getWorldObj(); + int x = this.xCoord; + int y = this.yCoord; + int z = this.zCoord; + if(!world.isRemote){ + + } + if (worldObj.isRemote) return; } + + + } + diff --git a/src/main/java/com/kitsu/medievalcraft/tileents/machine/TileEntityFirebox.java b/src/main/java/com/kitsu/medievalcraft/tileents/machine/TileEntityFirebox.java index 3425197a..3abe63ae 100644 --- a/src/main/java/com/kitsu/medievalcraft/tileents/machine/TileEntityFirebox.java +++ b/src/main/java/com/kitsu/medievalcraft/tileents/machine/TileEntityFirebox.java @@ -24,9 +24,9 @@ import net.minecraft.world.World; import com.kitsu.medievalcraft.block.ModBlocks; import com.kitsu.medievalcraft.block.crucible.CrucibleBase; -import com.kitsu.medievalcraft.block.ingots.IngotBase; import com.kitsu.medievalcraft.tileents.crucible.TileCrucibleBase; -import com.kitsu.medievalcraft.tileents.ingots.TileIngotBase; +import com.kitsu.medievalcraft.tileents.crucible.empty.TileEntityFilledWaterCrucible; +import com.kitsu.medievalcraft.tileents.crucible.empty.TileEntitySoftEmptyCrucible; import cpw.mods.fml.common.registry.GameRegistry; @@ -212,25 +212,24 @@ public class TileEntityFirebox extends TileEntity implements IInventory{ fireboxFuelDec(world, x, y, z, this.getStackInSlot(0), this.ticks); isFurnace(world, x, y, z); isCrucible(world, x, y, z); - isIngot(world, x, y, z); + //isIngot(world, x, y, z); } if (worldObj.isRemote) return; } private void fireboxMaint(World world, int x, int y, int z){ - if(world.getBlock(x, y+1, z).equals(Blocks.air)||this.getStackInSlot(0)==null){ - this.isOn = false; - } - if((this.getStackInSlot(0)==null)&&(world.getBlock(x, y+1, z).equals(Blocks.fire))){ + if(world.getBlockMetadata(x, y, z)==0&&world.getBlock(x, y+1, z).equals(Blocks.fire)){ world.setBlock(x, y+1, z, Blocks.air, 0, 2); - this.isOn=false; } - if(this.isOn==true && world.getBlock(x, y+1, z).equals(Blocks.air)){ + if((this.getStackInSlot(0)==null)){ + world.setBlockMetadataWithNotify(x, y, z, 0, 2); + } + if(world.getBlockMetadata(x, y, z)==1 && world.getBlock(x, y+1, z).equals(Blocks.air)){ world.setBlock(x, y+1, z, Blocks.fire, 0, 2); } - if(world.getBlock(x, y+1, z).equals(Blocks.fire)){ - this.isOn = true; - } + /*if(world.getBlock(x, y+1, z).equals(Blocks.fire)){ + world.setBlockMetadataWithNotify(x, y, z, 1, 2); + }*/ } private void fireboxFuelDec(World world, int x, int y, int z, ItemStack stack, int time){ if(world.getBlock(x, y+1, z).equals(Blocks.fire)){ @@ -332,7 +331,7 @@ public class TileEntityFirebox extends TileEntity implements IInventory{ public void isCrucible(World world, int x, int y, int z){ if(world.getBlock(x, y+1, z) instanceof CrucibleBase){ TileCrucibleBase tile = (TileCrucibleBase) world.getTileEntity(x, y+1, z); - if(tile.hot == false && tile.cooked == false && this.isOn == true){ + if(tile.hot == false && tile.cooked == false && world.getBlockMetadata(x, y, z)==1){ tile.heatTicks--; if(tile.heatTicks<=0){ tile.hot=true; @@ -341,21 +340,27 @@ public class TileEntityFirebox extends TileEntity implements IInventory{ } } } - } - public void isIngot(World world, int x, int y, int z){ - if(world.getBlock(x, y+1, z) instanceof IngotBase){ - TileIngotBase tile = (TileIngotBase) world.getTileEntity(x, y+1, z); - if(tile.hot == false && this.isOn == true){ - tile.heatTicks--; - if(tile.heatTicks<=0){ - tile.hot=true; - tile.markForUpdate(); - tile.markDirty(); + if(world.getBlock(x, y+1, z).equals(ModBlocks.emptySoftCrucible)){ + TileEntitySoftEmptyCrucible tile = (TileEntitySoftEmptyCrucible) world.getTileEntity(x, y+1, z); + if(world.getBlockMetadata(x, y, z)==1){ + tile.cookTime--; + if(tile.cookTime<=0){ + world.setBlock(x, y+1, z, tile.cookBlock, 0, 2); + } + } + } + if(world.getBlock(x, y+1, z).equals(ModBlocks.filledWaterCrucible)){ + TileEntityFilledWaterCrucible tile = (TileEntityFilledWaterCrucible) world.getTileEntity(x, y+1, z); + if(world.getBlockMetadata(x, y, z)==1){ + tile.cookTime--; + if(tile.cookTime<=0){ + world.setBlock(x, y+1, z, tile.cookBlock, 0, 2); } } } } + } diff --git a/src/main/java/com/kitsu/medievalcraft/tileents/machine/TileForge.java b/src/main/java/com/kitsu/medievalcraft/tileents/machine/TileForge.java index 63e417a2..a89fd2d6 100644 --- a/src/main/java/com/kitsu/medievalcraft/tileents/machine/TileForge.java +++ b/src/main/java/com/kitsu/medievalcraft/tileents/machine/TileForge.java @@ -22,13 +22,7 @@ import net.minecraft.network.play.server.S35PacketUpdateTileEntity; import net.minecraft.tileentity.TileEntity; import net.minecraft.world.World; -import com.kitsu.medievalcraft.Main; import com.kitsu.medievalcraft.block.ingots.IngotBase; -import com.kitsu.medievalcraft.packethandle.forge.MsgPacketBurning; -import com.kitsu.medievalcraft.packethandle.forge.MsgPacketForgeX; -import com.kitsu.medievalcraft.packethandle.forge.MsgPacketForgeY; -import com.kitsu.medievalcraft.packethandle.forge.MsgPacketForgeZ; -import com.kitsu.medievalcraft.packethandle.forge.MsgPacketOn; import com.kitsu.medievalcraft.tileents.ingots.TileIngotBase; import cpw.mods.fml.common.registry.GameRegistry; @@ -221,6 +215,7 @@ public class TileForge extends TileEntity implements IInventory{ heatIngot(world, x, y, z); fireboxFuelDec(world, x, y, z,this.getStackInSlot(0), this.ticks); fireboxFuelDec2(world, x, y, z,this.getStackInSlot(1), this.ticks); + //System.out.println(world.getBlockMetadata(x, y, z)); } if (worldObj.isRemote) return; @@ -230,7 +225,7 @@ public class TileForge extends TileEntity implements IInventory{ if(!world.isRemote){ if(world.getBlock(x, y+1, z) instanceof IngotBase){ TileIngotBase tile = (TileIngotBase) world.getTileEntity(x, y+1, z); - if(this.isOn==true){ + if(world.getBlockMetadata(x, y, z)>7){ if(tile.hot==false){ tile.heatTicks--; } @@ -240,7 +235,7 @@ public class TileForge extends TileEntity implements IInventory{ } private void fireboxFuelDec(World world, int x, int y, int z, ItemStack stack, int time){ - if(world.getBlock(x, y+1, z).equals(Blocks.fire)){ + if(world.getBlockMetadata(x, y, z)>3){ if(stack!=null){ if(isItemFuel(stack)==true){ this.ticks++; @@ -258,7 +253,7 @@ public class TileForge extends TileEntity implements IInventory{ private void fireboxFuelDec2(World world, int x, int y, int z, ItemStack stack, int time){ - if(world.getBlock(x, y+1, z).equals(Blocks.fire)){ + if(world.getBlockMetadata(x, y, z)>7){ if(stack!=null){ if(isItemFuel(stack)==true){ this.ticks++; @@ -335,7 +330,7 @@ public class TileForge extends TileEntity implements IInventory{ { return getItemBurnTime(stack) > 0; } - + //Main.sNet.sendToAll(new MsgPacketOn(tileEnt.isBurning)); //Main.sNet.sendToAll(new MsgPacketForgeX(tileEnt.xCoord)); //Main.sNet.sendToAll(new MsgPacketForgeY(tileEnt.yCoord)); @@ -353,6 +348,11 @@ public class TileForge extends TileEntity implements IInventory{ world.setBlockMetadataWithNotify(x, y, z, world.getBlockMetadata(x, y, z)-4, 2); } } + if(world.getBlockMetadata(x, y, z)>3&&world.getBlockMetadata(x, y, z)<8){ + if(this.getStackInSlot(1)!=null){ + world.setBlockMetadataWithNotify(x, y, z, world.getBlockMetadata(x, y, z)+4, 2); + } + } } }