update changelog, add empty table check to ConverterFluidContainerItem

This commit is contained in:
Adrian Siekierka 2023-06-04 08:54:22 +02:00
parent 39739b7003
commit 9c95f10879
2 changed files with 8 additions and 3 deletions

View File

@ -3,6 +3,7 @@
* [#3533] Added support for observing the contents of fluid container items.
* [#3620] Fixed OC 1.8.0+ regression involving API arguments and numbers.
* [#3013] Fixed rare server-side deadlock when sending disk activity update packets.
* Added Spanish translation.
* Fixed string.gmatch not supporting the "init" argument on Lua 5.4.
* Update GNU Unifont to 15.0.04.
@ -13,4 +14,4 @@
## List of contributors
asie, ds84182, Possseidon, repo-alt
asie, ds84182, Possseidon, repo-alt, sanmofe

View File

@ -16,8 +16,12 @@ object ConverterFluidContainerItem extends api.driver.Converter {
output += "capacity" -> Int.box(fc.getCapacity(stack))
val fluidStack = fc.getFluid(stack)
if (fluidStack != null) {
output += "fluid" -> Registry.convert(Array[AnyRef](fluidStack))(0)
} else {
val fluidData = Registry.convert(Array[AnyRef](fluidStack))
if (fluidData.nonEmpty) {
output += "fluid" -> fluidData(0)
}
}
if (!output.containsKey("fluid")) {
val fluidMap = new util.HashMap[AnyRef, AnyRef]()
fluidMap += "amount" -> Int.box(0)
output += "fluid" -> fluidMap