заменил
This commit is contained in:
parent
13a7829016
commit
fef11d3bdc
@ -34,7 +34,7 @@ class FluidTankBlockEntity(blockPos: BlockPos, blockState: BlockState) : Mattery
|
||||
if (level is ServerLevel) {
|
||||
markDirtyFast()
|
||||
}
|
||||
}), FluidStack.STREAM_CODEC.wrap()))
|
||||
}), FluidStack.OPTIONAL_STREAM_CODEC.wrap()))
|
||||
|
||||
val fillInput = MatteryContainer(::markDirtyFast, 1).also(::addDroppableContainer)
|
||||
val drainInput = MatteryContainer(::markDirtyFast, 1).also(::addDroppableContainer)
|
||||
|
@ -26,7 +26,7 @@ open class BlockMatteryFluidHandler(private val _capacity: IntSupplier, field: D
|
||||
get() = _capacity.asInt
|
||||
|
||||
override fun serializeNBT(registry: HolderLookup.Provider): Tag {
|
||||
return fluid.save(registry)
|
||||
return fluid.saveOptional(registry)
|
||||
}
|
||||
|
||||
override fun deserializeNBT(registry: HolderLookup.Provider, nbt: Tag?) {
|
||||
|
@ -17,7 +17,7 @@ class FluidGaugeWidget(synchronizer: SynchableGroup) {
|
||||
var fluidSupplier = Supplier { FluidStack.EMPTY }
|
||||
|
||||
val maxCapacity by synchronizer.computedInt(IntSupplier { maxCapacitySupplier.asInt })
|
||||
val fluid by synchronizer.computed({ fluidSupplier.get() }, FluidStack.STREAM_CODEC.wrap())
|
||||
val fluid by synchronizer.computed({ fluidSupplier.get() }, FluidStack.OPTIONAL_STREAM_CODEC.wrap())
|
||||
|
||||
val percentage: Float get() {
|
||||
if (maxCapacity <= 0 || fluid.isEmpty) {
|
||||
|
Loading…
Reference in New Issue
Block a user