diff --git a/common/mekanism/api/Coord4D.java b/common/mekanism/api/Coord4D.java index a58c7fc74..8254bfce1 100644 --- a/common/mekanism/api/Coord4D.java +++ b/common/mekanism/api/Coord4D.java @@ -276,6 +276,16 @@ public class Coord4D return world.getChunkFromBlockCoords(xCoord >> 4, zCoord >> 4); } + /** + * Whether or not the block this Coord4D represents is an air block. + * @param world - world this Coord4D is in + * @return if this Coord4D is an air block + */ + public boolean isAirBlock(IBlockAccess world) + { + return world.isAirBlock(xCoord, yCoord, zCoord); + } + @Override public Coord4D clone() { diff --git a/common/mekanism/common/EntityBalloon.java b/common/mekanism/common/EntityBalloon.java index 664c5b956..2b54b3f83 100644 --- a/common/mekanism/common/EntityBalloon.java +++ b/common/mekanism/common/EntityBalloon.java @@ -19,6 +19,7 @@ import cpw.mods.fml.common.registry.IEntityAdditionalSpawnData; public class EntityBalloon extends Entity implements IEntityAdditionalSpawnData { public EnumColor color = EnumColor.DARK_BLUE; + public Coord4D latched; public EntityBalloon(World world) @@ -31,6 +32,11 @@ public class EntityBalloon extends Entity implements IEntityAdditionalSpawnData yOffset = height / 2.0F; setSize(0.25F, 0.25F); motionY = 0.04; + + dataWatcher.addObject(2, new Byte((byte)0)); + dataWatcher.addObject(3, new Integer(0)); /* Latched X */ + dataWatcher.addObject(4, new Integer(0)); /* Latched Y */ + dataWatcher.addObject(5, new Integer(0)); /* Latched Z */ } public EntityBalloon(World world, double x, double y, double z, EnumColor c) @@ -58,11 +64,16 @@ public class EntityBalloon extends Entity implements IEntityAdditionalSpawnData prevPosZ = posZ; color = c; + + dataWatcher.updateObject(2, new Byte(latched != null ? (byte)1 : (byte)0)); /* Is latched */ + dataWatcher.updateObject(3, new Integer(latched != null ? latched.xCoord : 0)); /* Latched X */ + dataWatcher.updateObject(4, new Integer(latched != null ? latched.yCoord : 0)); /* Latched Y */ + dataWatcher.updateObject(5, new Integer(latched != null ? latched.zCoord : 0)); /* Latched Z */ } @Override public void onUpdate() - { + { prevPosX = posX; prevPosY = posY; prevPosZ = posZ; @@ -73,9 +84,34 @@ public class EntityBalloon extends Entity implements IEntityAdditionalSpawnData return; } - if(latched != null && (latched.exists(worldObj) && latched.getBlockId(worldObj) == 0)) + if(worldObj.isRemote) { - latched = null; + if(dataWatcher.getWatchableObjectByte(2) == 1) + { + latched = new Coord4D(dataWatcher.getWatchableObjectInt(3), dataWatcher.getWatchableObjectInt(4), dataWatcher.getWatchableObjectInt(5), worldObj.provider.dimensionId); + } + else { + latched = null; + } + } + else { + if(ticksExisted == 1) + { + dataWatcher.updateObject(2, new Byte(latched != null ? (byte)1 : (byte)0)); /* Is latched */ + dataWatcher.updateObject(3, new Integer(latched != null ? latched.xCoord : 0)); /* Latched X */ + dataWatcher.updateObject(4, new Integer(latched != null ? latched.yCoord : 0)); /* Latched Y */ + dataWatcher.updateObject(5, new Integer(latched != null ? latched.zCoord : 0)); /* Latched Z */ + } + } + + if(!worldObj.isRemote) + { + if(latched != null && (latched.exists(worldObj) && latched.isAirBlock(worldObj))) + { + latched = null; + + dataWatcher.updateObject(2, (byte)0); /* Is latched */ + } } if(latched == null) @@ -155,7 +191,7 @@ public class EntityBalloon extends Entity implements IEntityAdditionalSpawnData if(nbtTags.hasKey("latched")) { - latched = Coord4D.read(nbtTags); + latched = Coord4D.read(nbtTags.getCompoundTag("latched")); } } @@ -173,7 +209,7 @@ public class EntityBalloon extends Entity implements IEntityAdditionalSpawnData if(latched != null) { - latched.write(nbtTags); + nbtTags.setCompoundTag("latched", latched.write(new NBTTagCompound())); } } diff --git a/common/mekanism/common/Mekanism.java b/common/mekanism/common/Mekanism.java index c07faa12f..0e3afdb55 100644 --- a/common/mekanism/common/Mekanism.java +++ b/common/mekanism/common/Mekanism.java @@ -742,15 +742,7 @@ public class Mekanism GameRegistry.registerBlock(EnergyCube, ItemBlockEnergyCube.class, "EnergyCube"); GameRegistry.registerBlock(ObsidianTNT, "ObsidianTNT"); GameRegistry.registerBlock(BoundingBlock, "BoundingBlock"); - GameRegistry.registerBlock(GasTank, ItemBlockBasic.class, "GasTank"); - - //Add block items into itemsList for blocks with common IDs. - Item.itemsList[basicBlockID] = new ItemBlockBasic(basicBlockID - 256, BasicBlock).setUnlocalizedName("BasicBlock"); - Item.itemsList[machineBlockID] = new ItemBlockMachine(machineBlockID - 256, MachineBlock).setUnlocalizedName("MachineBlock"); - Item.itemsList[machineBlock2ID] = new ItemBlockMachine(machineBlock2ID - 256, MachineBlock2).setUnlocalizedName("MachineBlock2"); - Item.itemsList[oreBlockID] = new ItemBlockOre(oreBlockID - 256, OreBlock).setUnlocalizedName("OreBlock"); - Item.itemsList[energyCubeID] = new ItemBlockEnergyCube(energyCubeID - 256, EnergyCube).setUnlocalizedName("EnergyCube"); - Item.itemsList[gasTankID] = new ItemBlockGasTank(gasTankID - 256, GasTank).setUnlocalizedName("GasTank"); + GameRegistry.registerBlock(GasTank, ItemBlockGasTank.class, "GasTank"); } /** diff --git a/common/mekanism/generators/client/BlockRenderingHandler.java b/common/mekanism/generators/client/BlockRenderingHandler.java index 2f6da4286..7a7a8f4bf 100644 --- a/common/mekanism/generators/client/BlockRenderingHandler.java +++ b/common/mekanism/generators/client/BlockRenderingHandler.java @@ -81,7 +81,7 @@ public class BlockRenderingHandler implements ISimpleBlockRenderingHandler Minecraft.getMinecraft().renderEngine.bindTexture(MekanismUtils.getResource(ResourceType.RENDER, "WindTurbine.png")); windTurbine.render(0.018F, 0); } - else { + else if(metadata != 2) { MekanismRenderer.renderItem(renderer, metadata, block); } } @@ -96,7 +96,7 @@ public class BlockRenderingHandler implements ISimpleBlockRenderingHandler { int metadata = world.getBlockMetadata(x, y, z); - if(!GeneratorType.getFromMetadata(metadata).hasModel) + if(GeneratorType.getFromMetadata(metadata) == null || !GeneratorType.getFromMetadata(metadata).hasModel) { renderer.renderStandardBlock(block, x, y, z); renderer.setRenderBoundsFromBlock(block); diff --git a/common/mekanism/generators/common/block/BlockGenerator.java b/common/mekanism/generators/common/block/BlockGenerator.java index cca4f6d1f..19661ecf5 100644 --- a/common/mekanism/generators/common/block/BlockGenerator.java +++ b/common/mekanism/generators/common/block/BlockGenerator.java @@ -434,6 +434,11 @@ public class BlockGenerator extends BlockContainer implements ISpecialBounds TileEntityElectricBlock tileEntity = (TileEntityElectricBlock)world.getBlockTileEntity(x, y, z); ItemStack itemStack = new ItemStack(MekanismGenerators.Generator, 1, world.getBlockMetadata(x, y, z)); + if(tileEntity == null) + { + return null; + } + IEnergizedItem electricItem = (IEnergizedItem)itemStack.getItem(); electricItem.setEnergy(itemStack, tileEntity.electricityStored); diff --git a/resources/assets/mekanism/lang/en_GB.lang b/resources/assets/mekanism/lang/en_GB.lang index 195805813..e7b94c275 100644 --- a/resources/assets/mekanism/lang/en_GB.lang +++ b/resources/assets/mekanism/lang/en_GB.lang @@ -1,6 +1,6 @@ tile.MachineBlock.EnergizedSmelter.name=Energised Smelter tile.Transmitter.PressurizedTube.name=Pressurised Tube -tile.MachineBlock2.ChemicalOxidizer=Chemical Oxidiser +tile.MachineBlock2.ChemicalOxidizer.name=Chemical Oxidiser item.MultipartTransmitter.PressurizedTube.name=Pressurised Tube item.sulfurDust.name=Sulphur Dust gas.water=Water Vapour diff --git a/resources/assets/mekanism/lang/en_US.lang b/resources/assets/mekanism/lang/en_US.lang index 608682175..f0982522a 100644 --- a/resources/assets/mekanism/lang/en_US.lang +++ b/resources/assets/mekanism/lang/en_US.lang @@ -27,6 +27,7 @@ item.ScubaTank.name=Scuba Tank item.GasMask.name=Gas Mask item.Dictionary.name=Dictionary item.ElectrolyticCore.name=Electrolytic Core +item.CompressedRedstone.name=Compressed Redstone //Gas Tank tile.GasTank.GasTank.name=Gas Tank @@ -159,6 +160,7 @@ gas.chlorine=Chlorine gas.sulfurDioxideGas=Sulfur Dioxide gas.sulfurTrioxideGas=Sulfur Trioxide gas.sulfuricAcid=Sulfuric Acid +gas.hydrogenChloride=Hydrogen Chloride //Fluids fluid.hydrogen=Liquid Hydrogen @@ -167,6 +169,7 @@ fluid.chlorine=Liquid Chlorine fluid.sulfurDioxideGas=Liquid Sulfur Dioxide fluid.sulfurTrioxideGas=Liquid Sulfur Trioxide fluid.sulfuricAcid=Liquid Sulfuric Acid +fluid.hydrogenChloride=Liquid Hydrogen Chloride //Gui text gui.removeSpeedUpgrade=Remove speed upgrade