Fixed NEI, fixed TNT dupe

This commit is contained in:
Aidan C. Brady 2013-10-19 12:55:21 -04:00
parent 8c51e4dd25
commit e150df8743
4 changed files with 18 additions and 26 deletions

View file

@ -37,14 +37,14 @@ public abstract class AdvancedMachineRecipeHandler extends TemplateRecipeHandler
public void drawExtras(int i) public void drawExtras(int i)
{ {
float f = ticksPassed >= 40 ? (ticksPassed - 40) % 20 / 20.0F : 0.0F; float f = ticksPassed >= 40 ? (ticksPassed - 40) % 20 / 20.0F : 0.0F;
drawProgressBar(63, 34, 176 + 26, 0, 24, 7, f, 0); drawProgressBar(63, 34, 176, 0, 24, 7, f, 0);
f = ticksPassed >= 20 && ticksPassed < 40 ? (ticksPassed - 20) % 20 / 20.0F : 1.0F; f = ticksPassed >= 20 && ticksPassed < 40 ? (ticksPassed - 20) % 20 / 20.0F : 1.0F;
if(ticksPassed < 20) f = 0.0F; if(ticksPassed < 20) f = 0.0F;
drawProgressBar(45, 32, 176 + 26, 7, 5, 12, f, 3); drawProgressBar(45, 32, 176, 7, 5, 12, f, 3);
f = ticksPassed <= 20 ? ticksPassed / 20.0F : 1.0F; f = ticksPassed <= 20 ? ticksPassed / 20.0F : 1.0F;
drawProgressBar(149, 12, 176 + 26, 19, 4, 52, f, 3); drawProgressBar(149, 12, 176, 19, 4, 52, f, 3);
} }
@Override @Override

View file

@ -35,9 +35,9 @@ public abstract class MachineRecipeHandler extends TemplateRecipeHandler
public void drawExtras(int i) public void drawExtras(int i)
{ {
float f = ticksPassed >= 20 ? (ticksPassed - 20) % 20 / 20.0F : 0.0F; float f = ticksPassed >= 20 ? (ticksPassed - 20) % 20 / 20.0F : 0.0F;
drawProgressBar(63, 34, 176 + 26, 0, 24, 7, f, 0); drawProgressBar(63, 34, 176, 0, 24, 7, f, 0);
f = ticksPassed <= 20 ? ticksPassed / 20.0F : 1.0F; f = ticksPassed <= 20 ? ticksPassed / 20.0F : 1.0F;
drawProgressBar(149, 12, 176 + 26, 7, 4, 52, f, 3); drawProgressBar(149, 12, 176, 7, 4, 52, f, 3);
} }
@Override @Override

View file

@ -24,12 +24,17 @@ public class EntityObsidianTNT extends Entity
public EntityObsidianTNT(World world, double x, double y, double z) public EntityObsidianTNT(World world, double x, double y, double z)
{ {
this(world); this(world);
setPosition(x, y, z); setPosition(x, y, z);
float randPi = (float)(Math.random()*Math.PI*2); float randPi = (float)(Math.random()*Math.PI*2);
motionX = -(Math.sin(randPi))*0.02F; motionX = -(Math.sin(randPi))*0.02F;
motionY = 0.2; motionY = 0.2;
motionZ = -(Math.cos(randPi))*0.02F; motionZ = -(Math.cos(randPi))*0.02F;
fuse = Mekanism.obsidianTNTDelay; fuse = Mekanism.obsidianTNTDelay;
prevPosX = x; prevPosX = x;
prevPosY = y; prevPosY = y;
prevPosZ = z; prevPosZ = z;

View file

@ -59,7 +59,7 @@ public class BlockObsidianTNT extends Block
if(world.isBlockIndirectlyGettingPowered(x, y, z)) if(world.isBlockIndirectlyGettingPowered(x, y, z))
{ {
onBlockDestroyedByPlayer(world, x, y, z, 1); explode(world, x, y, z);
world.setBlockToAir(x, y, z); world.setBlockToAir(x, y, z);
} }
} }
@ -69,7 +69,7 @@ public class BlockObsidianTNT extends Block
{ {
if(world.isBlockIndirectlyGettingPowered(x, y, z)) if(world.isBlockIndirectlyGettingPowered(x, y, z))
{ {
onBlockDestroyedByPlayer(world, x, y, z, 1); explode(world, x, y, z);
world.setBlockToAir(x, y, z); world.setBlockToAir(x, y, z);
} }
} }
@ -85,20 +85,13 @@ public class BlockObsidianTNT extends Block
} }
} }
@Override public void explode(World world, int x, int y, int z)
public void onBlockDestroyedByPlayer(World world, int x, int y, int z, int meta)
{ {
if(!world.isRemote) if(!world.isRemote)
{ {
if((meta & 1) == 0) EntityObsidianTNT entity = new EntityObsidianTNT(world, x + 0.5F, y + 0.5F, z + 0.5F);
{ world.spawnEntityInWorld(entity);
dropBlockAsItem_do(world, x, y, z, new ItemStack(Mekanism.ObsidianTNT, 1, 0)); world.playSoundAtEntity(entity, "random.fuse", 1.0F, 1.0F);
}
else {
EntityObsidianTNT entity = new EntityObsidianTNT(world, x + 0.5F, y + 0.5F, z + 0.5F);
world.spawnEntityInWorld(entity);
world.playSoundAtEntity(entity, "random.fuse", 1.0F, 1.0F);
}
} }
} }
@ -107,7 +100,7 @@ public class BlockObsidianTNT extends Block
{ {
if(entityplayer.getCurrentEquippedItem() != null && entityplayer.getCurrentEquippedItem().itemID == Item.flintAndSteel.itemID) if(entityplayer.getCurrentEquippedItem() != null && entityplayer.getCurrentEquippedItem().itemID == Item.flintAndSteel.itemID)
{ {
onBlockDestroyedByPlayer(world, x, y, z, 1); explode(world, x, y, z);
world.setBlockToAir(x, y, z); world.setBlockToAir(x, y, z);
return true; return true;
} }
@ -131,15 +124,9 @@ public class BlockObsidianTNT extends Block
if(entityarrow.isBurning()) if(entityarrow.isBurning())
{ {
onBlockDestroyedByPlayer(world, x, y, z, 1); explode(world, x, y, z);
world.setBlockToAir(x, y, z); world.setBlockToAir(x, y, z);
} }
} }
} }
@Override
protected ItemStack createStackedBlock(int i)
{
return null;
}
} }