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

@@ -13,67 +13,79 @@ import net.minecraftforge.common.IPlantable;
import net.minecraftforge.common.util.ForgeDirection;
import tconstruct.world.TinkerWorld;
public class OreberryBushSecondItem extends MultiItemBlock
{
public class OreberryBushSecondItem extends MultiItemBlock {
public Block blockB;
public static final String blockTypes[] = { "aluminum", "essence", "", "", "aluminum", "essence", "", "", "aluminum", "essence", "", "", "aluminum", "essence", "", "" };
public static final String blockTypes[] = {
"aluminum",
"essence",
"",
"",
"aluminum",
"essence",
"",
"",
"aluminum",
"essence",
"",
"",
"aluminum",
"essence",
"",
""
};
public OreberryBushSecondItem(Block b)
{
public OreberryBushSecondItem(Block b) {
super(b, "block.oreberry", blockTypes);
blockB = b;
setHasSubtypes(true);
}
@Override
public int getMetadata (int meta)
{
public int getMetadata(int meta) {
return meta % 4;
}
/* Place bushes on dirt, grass, or other bushes only */
@Override
public boolean onItemUse (ItemStack stack, EntityPlayer player, World world, int x, int y, int z, int side, float hitX, float hitY, float hitZ)
{
if (side != 1)
return false;
public boolean onItemUse(
ItemStack stack,
EntityPlayer player,
World world,
int x,
int y,
int z,
int side,
float hitX,
float hitY,
float hitZ) {
if (side != 1) return false;
int meta = stack.getItemDamage();
if (meta % 4 != 1 && world.getFullBlockLightValue(x, y + 1, z) >= 13)
return false;
else if (player.canPlayerEdit(x, y, z, side, stack) && player.canPlayerEdit(x, y + 1, z, side, stack))
{
if (meta % 4 != 1 && world.getFullBlockLightValue(x, y + 1, z) >= 13) return false;
else if (player.canPlayerEdit(x, y, z, side, stack) && player.canPlayerEdit(x, y + 1, z, side, stack)) {
Block block = world.getBlock(x, y, z);
if (block != null && block.canSustainPlant(world, x, y, z, ForgeDirection.UP, (IPlantable) TinkerWorld.oreBerrySecond) && WorldHelper.isAirBlock(world, x, y + 1, z))
{
if (block != null
&& block.canSustainPlant(world, x, y, z, ForgeDirection.UP, (IPlantable) TinkerWorld.oreBerrySecond)
&& WorldHelper.isAirBlock(world, x, y + 1, z)) {
world.setBlock(x, y + 1, z, blockB, stack.getItemDamage() % 4, 3);
if (!player.capabilities.isCreativeMode)
stack.stackSize--;
if (!world.isRemote)
world.playAuxSFX(2001, x, y, z, Block.getIdFromBlock(block));
if (!player.capabilities.isCreativeMode) stack.stackSize--;
if (!world.isRemote) world.playAuxSFX(2001, x, y, z, Block.getIdFromBlock(block));
return true;
}
else
return false;
}
else
return false;
} else return false;
} else return false;
}
@Override
@SideOnly(Side.CLIENT)
public void addInformation (ItemStack stack, EntityPlayer player, List list, boolean par4)
{
switch (stack.getItemDamage() % 4)
{
case 0:
list.add(StatCollector.translateToLocal("oreberrybush5.tooltip"));
break;
case 1:
list.add(StatCollector.translateToLocal("oreberrybush6.tooltip"));
break;
public void addInformation(ItemStack stack, EntityPlayer player, List list, boolean par4) {
switch (stack.getItemDamage() % 4) {
case 0:
list.add(StatCollector.translateToLocal("oreberrybush5.tooltip"));
break;
case 1:
list.add(StatCollector.translateToLocal("oreberrybush6.tooltip"));
break;
}
}
}