mirror of
https://github.com/GTNewHorizons/bdlib.git
synced 2026-11-12 00:07:31 +00:00
Removed redundant size field on DataSlotTank, fixed div by 0 crash with the widget
This commit is contained in:
1 parent
2c94505c97
commit
b4cc77d3cc
2 files changed
+4
-5
No files matched your search
@@ -15,7 +15,6 @@ import net.bdew.lib.data.base.{UpdateKind, TileDataSlots, DataSlot}
|
||||
|
||||
abstract class DataSlotTankBase(sz: Int) extends FluidTank(sz) with IFluidTank with DataSlot {
|
||||
var oldStack: FluidStack = null
|
||||
var size: Int
|
||||
|
||||
parent.serverTick.listen(checkUpdate)
|
||||
|
||||
@@ -38,7 +37,7 @@ abstract class DataSlotTankBase(sz: Int) extends FluidTank(sz) with IFluidTank w
|
||||
val tag = new NBTTagCompound()
|
||||
writeToNBT(tag)
|
||||
if (k == UpdateKind.GUI)
|
||||
tag.setInteger("size", size)
|
||||
tag.setInteger("size", getCapacity)
|
||||
t.setCompoundTag(name, tag)
|
||||
}
|
||||
|
||||
@@ -46,11 +45,11 @@ abstract class DataSlotTankBase(sz: Int) extends FluidTank(sz) with IFluidTank w
|
||||
val tag = t.getCompoundTag(name)
|
||||
readFromNBT(tag)
|
||||
if (k == UpdateKind.GUI)
|
||||
size = tag.getInteger("size")
|
||||
setCapacity(tag.getInteger("size"))
|
||||
}
|
||||
}
|
||||
|
||||
case class DataSlotTank(name: String, parent: TileDataSlots, var size: Int) extends DataSlotTankBase(size)
|
||||
case class DataSlotTank(name: String, parent: TileDataSlots, size: Int) extends DataSlotTankBase(size)
|
||||
|
||||
case class DataSlotTankRestricted(name: String, parent: TileDataSlots, var size: Int, fluidID: Int) extends DataSlotTankBase(size) {
|
||||
def fill(amount: Int, doFill: Boolean) = super.fill(new FluidStack(fluidID, amount), doFill)
|
||||
|
||||
@@ -37,7 +37,7 @@ class WidgetFluidGauge(val rect: Rect, overlay: TextureLocation, dslot: DataSlot
|
||||
if (fstack != null && fstack.getFluid.getStillIcon != null) {
|
||||
val icon = fstack.getFluid.getStillIcon
|
||||
bindTexture(TextureMap.locationBlocksTexture)
|
||||
var fillHeight: Int = (rect.h * fstack.amount / dslot.getCapacity).round
|
||||
var fillHeight: Int = if (dslot.getCapacity > 0) (rect.h * fstack.amount / dslot.getCapacity).round else 0
|
||||
var yStart: Int = 0
|
||||
|
||||
while (fillHeight > 0) {
|
||||
|
||||
Reference in new issue
Block a user