Posted 21 January 2013 - 11:38 AM
ComputerCraft Version Information: 1.4.7 Client
Description of Bug: Putting in a big lava bucket from my mod and using turtle.refuel() empties the bucket of all liquid in it but only adds 1000 fuel to the turtle
Steps to Reproduce Bug: See above. Program I used was:
How to Fix the Bug:
This occurs because of the use of getContainerItem() instead of getContainerItemStack() in the refuel code in CC.
getContainerItem() works fine for fuel items which don't use damage to store any information, but for mods like mine, where this information is used to store how much fuel is left in the bucket, using getContainerItem() loses this extra information and just empties the bucket.
getContainerItemStack() on the other hand preserves this information while working in all cases getContainerItem works. You'll should null check the return value of it to be safe, but I think this is a 2 or 3 line fix overall.
KingLemming made the same change to ThermalExpansion to fix a similar interaction (for which I am grateful to him). I'd love to fix this on my end but I don't think there's anything I can do.
Thoughts?
Description of Bug: Putting in a big lava bucket from my mod and using turtle.refuel() empties the bucket of all liquid in it but only adds 1000 fuel to the turtle
Steps to Reproduce Bug: See above. Program I used was:
turtle.refuel( 1 )
print(turtle.getFuelLevel())
How to Fix the Bug:
This occurs because of the use of getContainerItem() instead of getContainerItemStack() in the refuel code in CC.
getContainerItem() works fine for fuel items which don't use damage to store any information, but for mods like mine, where this information is used to store how much fuel is left in the bucket, using getContainerItem() loses this extra information and just empties the bucket.
getContainerItemStack() on the other hand preserves this information while working in all cases getContainerItem works. You'll should null check the return value of it to be safe, but I think this is a 2 or 3 line fix overall.
KingLemming made the same change to ThermalExpansion to fix a similar interaction (for which I am grateful to him). I'd love to fix this on my end but I don't think there's anything I can do.
Thoughts?