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

@@ -12,36 +12,29 @@ import net.minecraft.util.AxisAlignedBB;
import net.minecraft.world.World;
import tconstruct.library.crafting.DryingRackRecipes;
public class DryingRackLogic extends InventoryLogic
{
public class DryingRackLogic extends InventoryLogic {
int currentTime;
int maxTime;
public DryingRackLogic()
{
public DryingRackLogic() {
super(1, 1);
}
@Override
public Container getGuiContainer (InventoryPlayer inventoryplayer, World world, int x, int y, int z)
{
public Container getGuiContainer(InventoryPlayer inventoryplayer, World world, int x, int y, int z) {
return null;
}
@Override
public String getDefaultName ()
{
public String getDefaultName() {
return "";
}
@Override
public void updateEntity ()
{
if (!worldObj.isRemote && maxTime > 0 && currentTime < maxTime)
{
public void updateEntity() {
if (!worldObj.isRemote && maxTime > 0 && currentTime < maxTime) {
currentTime++;
if (currentTime >= maxTime)
{
if (currentTime >= maxTime) {
inventory[0] = DryingRackRecipes.getDryingResult(inventory[0]);
updateDryingTime();
}
@@ -49,103 +42,88 @@ public class DryingRackLogic extends InventoryLogic
}
@Override
public void setInventorySlotContents (int slot, ItemStack itemstack)
{
public void setInventorySlotContents(int slot, ItemStack itemstack) {
super.setInventorySlotContents(slot, itemstack);
updateDryingTime();
}
@Override
public ItemStack decrStackSize (int slot, int quantity)
{
public ItemStack decrStackSize(int slot, int quantity) {
ItemStack stack = super.decrStackSize(slot, quantity);
maxTime = 0;
currentTime = 0;
return stack;
}
public void updateDryingTime ()
{
public void updateDryingTime() {
currentTime = 0;
if (inventory[0] != null)
maxTime = DryingRackRecipes.getDryingTime(inventory[0]);
else
maxTime = 0;
if (inventory[0] != null) maxTime = DryingRackRecipes.getDryingTime(inventory[0]);
else maxTime = 0;
worldObj.markBlockForUpdate(xCoord, yCoord, zCoord);
}
@Override
public void readFromNBT (NBTTagCompound tags)
{
public void readFromNBT(NBTTagCompound tags) {
currentTime = tags.getInteger("Time");
maxTime = tags.getInteger("MaxTime");
readCustomNBT(tags);
}
@Override
public void writeToNBT (NBTTagCompound tags)
{
public void writeToNBT(NBTTagCompound tags) {
tags.setInteger("Time", currentTime);
tags.setInteger("MaxTime", maxTime);
writeCustomNBT(tags);
}
public void readCustomNBT (NBTTagCompound tags)
{
public void readCustomNBT(NBTTagCompound tags) {
super.readFromNBT(tags);
}
public void writeCustomNBT (NBTTagCompound tags)
{
public void writeCustomNBT(NBTTagCompound tags) {
super.writeToNBT(tags);
}
/* Packets */
@Override
public Packet getDescriptionPacket ()
{
public Packet getDescriptionPacket() {
NBTTagCompound tag = new NBTTagCompound();
writeCustomNBT(tag);
return new S35PacketUpdateTileEntity(xCoord, yCoord, zCoord, 1, tag);
}
@Override
public void onDataPacket (NetworkManager net, S35PacketUpdateTileEntity packet)
{
public void onDataPacket(NetworkManager net, S35PacketUpdateTileEntity packet) {
readCustomNBT(packet.func_148857_g());
worldObj.func_147479_m(xCoord, yCoord, zCoord);
}
@Override
@SideOnly(Side.CLIENT)
public AxisAlignedBB getRenderBoundingBox ()
{
AxisAlignedBB cbb = AxisAlignedBB.getBoundingBox(xCoord, yCoord - 1, zCoord, xCoord + 1, yCoord + 1, zCoord + 1);
public AxisAlignedBB getRenderBoundingBox() {
AxisAlignedBB cbb =
AxisAlignedBB.getBoundingBox(xCoord, yCoord - 1, zCoord, xCoord + 1, yCoord + 1, zCoord + 1);
return cbb;
}
@Override
public String getInventoryName ()
{
public String getInventoryName() {
return null;
}
@Override
public boolean hasCustomInventoryName ()
{
public boolean hasCustomInventoryName() {
return false;
}
@Override
public void closeInventory ()
{
public void closeInventory() {
// TODO Auto-generated method stub
}
@Override
public void openInventory ()
{
public void openInventory() {
// TODO Auto-generated method stub
}