More smoke comes out based on smelting time
This commit is contained in:
parent
eb3f9d499d
commit
6dd263a9dd
|
@ -148,7 +148,7 @@ class TileFirebox extends SpatialTile(Material.rock) with IFluidHandler with TIn
|
||||||
if (isBurning)
|
if (isBurning)
|
||||||
{
|
{
|
||||||
val f: Float = x.toFloat + 0.5F
|
val f: Float = x.toFloat + 0.5F
|
||||||
val f1: Float = y.toFloat + 0.0F + world.rand.nextFloat() * 6.0F / 16.0F
|
val f1: Float = y.toFloat + 0.5F + world.rand.nextFloat() * 6.0F / 16.0F
|
||||||
val f2: Float = z.toFloat + 0.5F
|
val f2: Float = z.toFloat + 0.5F
|
||||||
val f3: Float = 0.52F
|
val f3: Float = 0.52F
|
||||||
val f4: Float = world.rand.nextFloat() * 0.6F - 0.3F
|
val f4: Float = world.rand.nextFloat() * 0.6F - 0.3F
|
||||||
|
|
|
@ -27,11 +27,12 @@ import resonantinduction.core.Reference
|
||||||
*/
|
*/
|
||||||
object TileHotPlate
|
object TileHotPlate
|
||||||
{
|
{
|
||||||
final val MAX_SMELT_TIME: Int = 200
|
final val maxSmeltTime: Int = 200
|
||||||
}
|
}
|
||||||
|
|
||||||
class TileHotPlate extends TileInventory(Material.iron) with TPacketSender with TPacketReceiver
|
class TileHotPlate extends TileInventory(Material.iron) with TPacketSender with TPacketReceiver
|
||||||
{
|
{
|
||||||
|
/** Amount of smelt time left */
|
||||||
final val smeltTime = Array[Int](0, 0, 0, 0)
|
final val smeltTime = Array[Int](0, 0, 0, 0)
|
||||||
final val stackSizeCache = Array[Int](0, 0, 0, 0)
|
final val stackSizeCache = Array[Int](0, 0, 0, 0)
|
||||||
|
|
||||||
|
@ -57,7 +58,7 @@ class TileHotPlate extends TileInventory(Material.iron) with TPacketSender with
|
||||||
if (smeltTime(i) <= 0)
|
if (smeltTime(i) <= 0)
|
||||||
{
|
{
|
||||||
stackSizeCache(i) = this.getStackInSlot(i).stackSize
|
stackSizeCache(i) = this.getStackInSlot(i).stackSize
|
||||||
smeltTime(i) = TileHotPlate.MAX_SMELT_TIME * stackSizeCache(i)
|
smeltTime(i) = TileHotPlate.maxSmeltTime * stackSizeCache(i)
|
||||||
worldObj.markBlockForUpdate(xCoord, yCoord, zCoord)
|
worldObj.markBlockForUpdate(xCoord, yCoord, zCoord)
|
||||||
}
|
}
|
||||||
else if (smeltTime(i) > 0)
|
else if (smeltTime(i) > 0)
|
||||||
|
@ -88,20 +89,26 @@ class TileHotPlate extends TileInventory(Material.iron) with TPacketSender with
|
||||||
override def randomDisplayTick()
|
override def randomDisplayTick()
|
||||||
{
|
{
|
||||||
val height = 0.2
|
val height = 0.2
|
||||||
val deviation = 0.2
|
val deviation = 0.22
|
||||||
|
|
||||||
(0 until 4).foreach(
|
(0 to 3).foreach(
|
||||||
i =>
|
i =>
|
||||||
{
|
{
|
||||||
if (smeltTime(0) > 0)
|
if (smeltTime(i) > 0)
|
||||||
world.spawnParticle("smoke", x + 0.5 - deviation + world.rand.deviate(0.1), y + height, z + 0.5 - deviation + world.rand.deviate(0.1), 0.0D, 0.0D, 0.0D)
|
{
|
||||||
if (smeltTime(1) > 0)
|
for (t <- 0 until (TileHotPlate.maxSmeltTime * stackSizeCache(i) - smeltTime(i)))
|
||||||
world.spawnParticle("smoke", x + 0.5 - deviation + world.rand.deviate(0.1), y + height, z + 0.5 + deviation + world.rand.deviate(0.1), 0.0D, 0.0D, 0.0D)
|
{
|
||||||
if (smeltTime(2) > 0)
|
i match
|
||||||
world.spawnParticle("smoke", x + 0.5 + deviation + world.rand.deviate(0.1), y + height, z + 0.5 - deviation + world.rand.deviate(0.1), 0.0D, 0.0D, 0.0D)
|
{
|
||||||
if (smeltTime(3) > 0)
|
case 0 => world.spawnParticle("smoke", x + 0.5 - deviation + world.rand.deviate(0.1), y + height, z + 0.5 - deviation + world.rand.deviate(0.1), 0.0D, 0.0D, 0.0D)
|
||||||
world.spawnParticle("smoke", x + 0.5 + deviation + world.rand.deviate(0.1), y + height, z + 0.5 + deviation + world.rand.deviate(0.1), 0.0D, 0.0D, 0.0D)
|
case 1 => world.spawnParticle("smoke", x + 0.5 - deviation + world.rand.deviate(0.1), y + height, z + 0.5 + deviation + world.rand.deviate(0.1), 0.0D, 0.0D, 0.0D)
|
||||||
})
|
case 2 => world.spawnParticle("smoke", x + 0.5 + deviation + world.rand.deviate(0.1), y + height, z + 0.5 - deviation + world.rand.deviate(0.1), 0.0D, 0.0D, 0.0D)
|
||||||
|
case 3 => world.spawnParticle("smoke", x + 0.5 + deviation + world.rand.deviate(0.1), y + height, z + 0.5 + deviation + world.rand.deviate(0.1), 0.0D, 0.0D, 0.0D)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
)
|
||||||
}
|
}
|
||||||
|
|
||||||
override def onInventoryChanged()
|
override def onInventoryChanged()
|
||||||
|
@ -114,7 +121,7 @@ class TileHotPlate extends TileInventory(Material.iron) with TPacketSender with
|
||||||
{
|
{
|
||||||
if (smeltTime(i) > 0)
|
if (smeltTime(i) > 0)
|
||||||
{
|
{
|
||||||
smeltTime(i) += (getStackInSlot(i).stackSize - stackSizeCache(i)) * TileHotPlate.MAX_SMELT_TIME
|
smeltTime(i) += (getStackInSlot(i).stackSize - stackSizeCache(i)) * TileHotPlate.maxSmeltTime
|
||||||
}
|
}
|
||||||
stackSizeCache(i) = getStackInSlot(i).stackSize
|
stackSizeCache(i) = getStackInSlot(i).stackSize
|
||||||
}
|
}
|
||||||
|
@ -177,20 +184,18 @@ class TileHotPlate extends TileInventory(Material.iron) with TPacketSender with
|
||||||
override def readFromNBT(nbt: NBTTagCompound)
|
override def readFromNBT(nbt: NBTTagCompound)
|
||||||
{
|
{
|
||||||
super.readFromNBT(nbt)
|
super.readFromNBT(nbt)
|
||||||
for (i <- 0 until getSizeInventory)
|
|
||||||
{
|
(0 until stackSizeCache.size).foreach(i => stackSizeCache(i) = nbt.getInteger("stackSizeCache" + i))
|
||||||
smeltTime(i) = nbt.getInteger("smeltTime" + i)
|
(0 until getSizeInventory).foreach(i => smeltTime(i) = nbt.getInteger("smeltTime" + i))
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
override def writeToNBT(nbt: NBTTagCompound)
|
override def writeToNBT(nbt: NBTTagCompound)
|
||||||
{
|
{
|
||||||
super.writeToNBT(nbt)
|
super.writeToNBT(nbt)
|
||||||
|
|
||||||
for (i <- 0 until getSizeInventory)
|
(0 until stackSizeCache.size).foreach(i => nbt.setInteger("stackSizeCache" + i, stackSizeCache(i)))
|
||||||
{
|
(0 until getSizeInventory).foreach(i => nbt.setInteger("smeltTime" + i, smeltTime(i)))
|
||||||
nbt.setInteger("smeltTime" + i, smeltTime(i))
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
@SideOnly(Side.CLIENT)
|
@SideOnly(Side.CLIENT)
|
||||||
|
|
Loading…
Reference in a new issue