Fixed some minor hot plate issues

This commit is contained in:
Calclavia 2014-01-17 22:29:23 +08:00
parent db964cda7b
commit cd593898a3
2 changed files with 18 additions and 10 deletions

View file

@ -96,15 +96,16 @@ public class BlockHotPlate extends BlockRI
{
int i = j * 2 + k;
if (tile.getSmeltTime(i) > 0)
if (tile.getStackInSlot(i) != null && tile.getSmeltTime(i) > 0)
{
int timeSmelt = TileHotPlate.MAX_SMELT_TIME - tile.getSmeltTime(i);
System.out.println(timeSmelt);
int timeSmelt = TileHotPlate.MAX_SMELT_TIME * tile.getStackInSlot(i).stackSize - tile.getSmeltTime(i);
for (int spawn = 0; spawn < timeSmelt / 20; spawn++)
{
Vector3 particlePosition = new Vector3(x, y, z).translate((double) (i / 2) / ((double) 2) + (0.5 / ((double) 2)), 0.2, (double) (i % 2) / ((double) 2) + (0.5 / ((double) 2)));
particlePosition.translate(new Vector3(random.nextFloat() * 0.1f, random.nextFloat() * 0.1f, random.nextFloat() * 0.1f));
particlePosition.translate(new Vector3((random.nextFloat() - 0.5) * 0.15, (random.nextFloat() - 0.5) * 0.15, (random.nextFloat() - 0.5) * 0.15));
world.spawnParticle("smoke", particlePosition.x, particlePosition.y, particlePosition.z, 0.0D, 0.0D, 0.0D);
world.spawnParticle("flame", particlePosition.x, particlePosition.y, particlePosition.z, 0.0D, 0.01D, 0.0D);
}
}
}

View file

@ -43,7 +43,7 @@ public class TileHotPlate extends TileExternalInventory implements IPacketSender
@Override
public void updateEntity()
{
if (!worldObj.isRemote)
// if (!worldObj.isRemote)
{
TileEntity tileEntity = worldObj.getBlockTileEntity(xCoord, yCoord - 1, zCoord);
@ -70,10 +70,13 @@ public class TileHotPlate extends TileExternalInventory implements IPacketSender
*/
if (--smeltTime[i] == 0)
{
ItemStack outputStack = FurnaceRecipes.smelting().getSmeltingResult(getStackInSlot(i)).copy();
outputStack.stackSize = this.getStackInSlot(i).stackSize;
setInventorySlotContents(i, outputStack);
worldObj.markBlockForUpdate(xCoord, yCoord, zCoord);
if (!worldObj.isRemote)
{
ItemStack outputStack = FurnaceRecipes.smelting().getSmeltingResult(getStackInSlot(i)).copy();
outputStack.stackSize = this.getStackInSlot(i).stackSize;
setInventorySlotContents(i, outputStack);
worldObj.markBlockForUpdate(xCoord, yCoord, zCoord);
}
}
}
}
@ -126,7 +129,11 @@ public class TileHotPlate extends TileExternalInventory implements IPacketSender
public void onInventoryChanged()
{
super.onInventoryChanged();
worldObj.markBlockForUpdate(xCoord, yCoord, zCoord);
if (worldObj != null)
{
worldObj.markBlockForUpdate(xCoord, yCoord, zCoord);
}
}
/**