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

@@ -1,19 +1,11 @@
package tconstruct.library.tools;
import net.minecraft.block.Block;
import net.minecraft.client.Minecraft;
import net.minecraft.client.multiplayer.PlayerControllerMP;
import net.minecraft.entity.player.EntityPlayer;
import net.minecraft.entity.player.EntityPlayerMP;
import net.minecraft.item.ItemStack;
import net.minecraft.nbt.NBTTagCompound;
import net.minecraft.server.management.ItemInWorldManager;
import net.minecraft.util.MovingObjectPosition;
import java.lang.reflect.Field;
import java.lang.reflect.InvocationTargetException;
import java.lang.reflect.Method;
public abstract class AOEHarvestTool extends HarvestTool {
public int breakRadius;
public int breakDepth;
@@ -28,21 +20,19 @@ public abstract class AOEHarvestTool extends HarvestTool {
@Override
public boolean onBlockStartBreak(ItemStack stack, int x, int y, int z, EntityPlayer player) {
// only effective materials matter. We don't want to aoe when beraking dirt with a hammer.
Block block = player.worldObj.getBlock(x,y,z);
int meta = player.worldObj.getBlockMetadata(x,y,z);
if(block == null || !isEffective(block, meta) || !stack.hasTagCompound())
return super.onBlockStartBreak(stack, x,y,z, player);
Block block = player.worldObj.getBlock(x, y, z);
int meta = player.worldObj.getBlockMetadata(x, y, z);
if (block == null || !isEffective(block, meta) || !stack.hasTagCompound())
return super.onBlockStartBreak(stack, x, y, z, player);
// tool broken?
NBTTagCompound toolTags = stack.getTagCompound().getCompoundTag("InfiTool");
if(toolTags == null || toolTags.getBoolean("Broken"))
return super.onBlockStartBreak(stack, x,y,z, player);
if (toolTags == null || toolTags.getBoolean("Broken")) return super.onBlockStartBreak(stack, x, y, z, player);
MovingObjectPosition mop = AbilityHelper.raytraceFromEntity(player.worldObj, player, false, 4.5d);
if(mop == null)
return super.onBlockStartBreak(stack, x,y,z, player);
if (mop == null) return super.onBlockStartBreak(stack, x, y, z, player);
int sideHit = mop.sideHit;
//int sideHit = Minecraft.getMinecraft().objectMouseOver.sideHit;
// int sideHit = Minecraft.getMinecraft().objectMouseOver.sideHit;
// we successfully destroyed a block. time to do AOE!
int xRange = breakRadius;
@@ -70,15 +60,12 @@ public abstract class AOEHarvestTool extends HarvestTool {
for (int yPos = y - yRange; yPos <= y + yRange; yPos++)
for (int zPos = z - zRange; zPos <= z + zRange; zPos++) {
// don't break the originally already broken block, duh
if (xPos == x && yPos == y && zPos == z)
continue;
if (xPos == x && yPos == y && zPos == z) continue;
if(!super.onBlockStartBreak(stack, xPos, yPos, zPos, player))
breakExtraBlock(player.worldObj, xPos, yPos, zPos, sideHit, player, x,y,z);
if (!super.onBlockStartBreak(stack, xPos, yPos, zPos, player))
breakExtraBlock(player.worldObj, xPos, yPos, zPos, sideHit, player, x, y, z);
}
return super.onBlockStartBreak(stack, x, y, z, player);
}
}