Fixed motor IO and Stat persistence
This commit is contained in:
parent
0dfcc9e98c
commit
374a9ae0bc
2 changed files with 16 additions and 1 deletions
|
@ -8,6 +8,7 @@ import io.netty.buffer.ByteBuf
|
|||
import net.minecraft.block.material.Material
|
||||
import net.minecraft.client.Minecraft
|
||||
import net.minecraft.entity.EntityLivingBase
|
||||
import net.minecraft.entity.player.EntityPlayer
|
||||
import net.minecraft.item.ItemStack
|
||||
import net.minecraft.nbt.NBTTagCompound
|
||||
import net.minecraft.util.ResourceLocation
|
||||
|
@ -90,7 +91,7 @@ class TileBattery extends SpatialTile(Material.iron) with TIO with TElectric wit
|
|||
if (energy > 0)
|
||||
{
|
||||
//TODO: Allow player to set the power output
|
||||
electricNode.generatePower(100000)
|
||||
electricNode.generatePower(10000)
|
||||
val dissipatedEnergy = electricNode.power / 20
|
||||
energy -= dissipatedEnergy
|
||||
markUpdate()
|
||||
|
@ -271,4 +272,15 @@ class TileBattery extends SpatialTile(Material.iron) with TIO with TElectric wit
|
|||
super.writeToNBT(nbt)
|
||||
energy.save(nbt)
|
||||
}
|
||||
|
||||
override protected def use(player: EntityPlayer, side: Int, hit: Vector3): Boolean =
|
||||
{
|
||||
if (player.isSneaking)
|
||||
{
|
||||
electricNode.frequency = (electricNode.frequency + 10) % 60
|
||||
return true
|
||||
}
|
||||
|
||||
return super.use(player, side, hit)
|
||||
}
|
||||
}
|
|
@ -47,6 +47,7 @@ class TileMotor extends SpatialTile(Material.iron) with TIO with TElectric with
|
|||
normalRender = false
|
||||
isOpaqueCube = false
|
||||
ioMap = 0
|
||||
saveIOMap = true
|
||||
nodes.add(electricNode)
|
||||
nodes.add(mechNode)
|
||||
|
||||
|
@ -123,12 +124,14 @@ class TileMotor extends SpatialTile(Material.iron) with TIO with TElectric with
|
|||
|
||||
override def readFromNBT(nbt: NBTTagCompound)
|
||||
{
|
||||
super[TIO].readFromNBT(nbt)
|
||||
super.readFromNBT(nbt)
|
||||
gearRatio = nbt.getByte("gear")
|
||||
}
|
||||
|
||||
override def writeToNBT(nbt: NBTTagCompound)
|
||||
{
|
||||
super[TIO].writeToNBT(nbt)
|
||||
super.writeToNBT(nbt)
|
||||
nbt.setByte("gear", gearRatio.toByte)
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue