Fix JABBA-related issues with crafting station slots (#54)

* Fix shift-merging tools voiding items

fixes <https://github.com/GTNewHorizons/GT-New-Horizons-Modpack/issues/11392>

* Change 0-sized ItemStacks into null stacks in crafting station attached slots

Fixes <https://github.com/GTNewHorizons/GT-New-Horizons-Modpack/issues/10425>

* Update buildscript

* spotlessApply
This commit is contained in:
Raven Szewczyk authored and GitHub committed 2022-09-22 20:51:23 +02:00
1 parent 18bfeaff32
commit 39be06c23b
571 files changed
+25959 -28223

No files matched your search

@@ -11,19 +11,14 @@ import tconstruct.TConstruct;
import tconstruct.smeltery.inventory.SmelteryContainer;
import tconstruct.smeltery.logic.SmelteryLogic;
public class SmelteryPacket extends AbstractPacket
{
public class SmelteryPacket extends AbstractPacket {
int dimension, x, y, z, fluidID;
boolean isShiftPressed;
public SmelteryPacket()
{
public SmelteryPacket() {}
}
public SmelteryPacket(int dimension, int x, int y, int z, boolean isShiftPressed, int fluidID)
{
public SmelteryPacket(int dimension, int x, int y, int z, boolean isShiftPressed, int fluidID) {
this.dimension = dimension;
this.x = x;
this.y = y;
@@ -33,20 +28,17 @@ public class SmelteryPacket extends AbstractPacket
}
@Override
public void encodeInto (ChannelHandlerContext ctx, ByteBuf buffer)
{
public void encodeInto(ChannelHandlerContext ctx, ByteBuf buffer) {
buffer.writeInt(dimension);
buffer.writeInt(x);
buffer.writeInt(y);
buffer.writeInt(z);
buffer.writeBoolean(isShiftPressed);
buffer.writeInt(fluidID);
}
@Override
public void decodeInto (ChannelHandlerContext ctx, ByteBuf buffer)
{
public void decodeInto(ChannelHandlerContext ctx, ByteBuf buffer) {
dimension = buffer.readInt();
x = buffer.readInt();
y = buffer.readInt();
@@ -56,41 +48,36 @@ public class SmelteryPacket extends AbstractPacket
}
@Override
public void handleClientSide (EntityPlayer player)
{
}
public void handleClientSide(EntityPlayer player) {}
@Override
public void handleServerSide (EntityPlayer player)
{
if (player.openContainer instanceof SmelteryContainer)
{
public void handleServerSide(EntityPlayer player) {
if (player.openContainer instanceof SmelteryContainer) {
SmelteryContainer container = (SmelteryContainer) player.openContainer;
SmelteryLogic logic = container.logic;
if (logic != null && logic.hasWorldObj() && logic.getWorldObj().provider.dimensionId == this.dimension && logic.xCoord == this.x && logic.yCoord == this.y && logic.zCoord == this.z)
{
if (logic != null
&& logic.hasWorldObj()
&& logic.getWorldObj().provider.dimensionId == this.dimension
&& logic.xCoord == this.x
&& logic.yCoord == this.y
&& logic.zCoord == this.z) {
FluidStack temp = null;
for (FluidStack liquid : logic.moltenMetal)
{
if (liquid.getFluidID() == this.fluidID)
temp = liquid;
for (FluidStack liquid : logic.moltenMetal) {
if (liquid.getFluidID() == this.fluidID) temp = liquid;
}
if (temp != null)
{
if (temp != null) {
logic.moltenMetal.remove(temp);
if (this.isShiftPressed)
logic.moltenMetal.add(temp);
else
logic.moltenMetal.add(0, temp);
if (this.isShiftPressed) logic.moltenMetal.add(temp);
else logic.moltenMetal.add(0, temp);
}
NBTTagCompound data = new NBTTagCompound();
logic.writeToNBT(data);
TConstruct.packetPipeline.sendToDimension(new PacketUpdateTE(this.x, this.y, this.z, data), this.dimension);
TConstruct.packetPipeline.sendToDimension(
new PacketUpdateTE(this.x, this.y, this.z, data), this.dimension);
}
}
}
}
}