Merge branch 'development' of https://github.com/aidancbrady/Mekanism into development

This commit is contained in:
Aidan C. Brady 2014-01-05 16:28:11 -05:00
commit 1129a33bf6
7 changed files with 63 additions and 17 deletions

View file

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

View file

@ -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,6 +64,11 @@ 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
@ -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)
{
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()));
}
}

View file

@ -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");
}
/**

View file

@ -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);

View file

@ -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);

View file

@ -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

View file

@ -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