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

@@ -15,46 +15,50 @@ import tconstruct.library.tools.*;
import tconstruct.tools.TinkerTools;
import tconstruct.tools.logic.EquipLogic;
public class FryingPan extends Weapon
{
public FryingPan()
{
public class FryingPan extends Weapon {
public FryingPan() {
super(2);
this.setUnlocalizedName("InfiTool.FryPan");
}
@Override
public boolean hitEntity (ItemStack stack, EntityLivingBase mob, EntityLivingBase player)
{
public boolean hitEntity(ItemStack stack, EntityLivingBase mob, EntityLivingBase player) {
AbilityHelper.knockbackEntity(mob, 1.7f);
mob.addPotionEffect(new PotionEffect(Potion.moveSlowdown.id, 100, 0)); // 5
// seconds
// of
// stun
// seconds
// of
// stun
return true;
}
@Override
public boolean onLeftClickEntity (ItemStack stack, EntityPlayer player, Entity mob)
{
public boolean onLeftClickEntity(ItemStack stack, EntityPlayer player, Entity mob) {
if (mob.canAttackWithItem() && !mob.hitByEntity(player) && mob.hurtResistantTime < 14)
AbilityHelper.onLeftClickEntity(stack, player, mob, this);
return false;
}
@Override
public void onEntityDamaged (World world, EntityLivingBase player, Entity entity)
{
world.playSoundEffect(entity.posX, entity.posY, entity.posZ, "tinker:frypan_hit", 1.0F, (random.nextFloat() - random.nextFloat()) * 0.2F + 1.0F);
public void onEntityDamaged(World world, EntityLivingBase player, Entity entity) {
world.playSoundEffect(
entity.posX,
entity.posY,
entity.posZ,
"tinker:frypan_hit",
1.0F,
(random.nextFloat() - random.nextFloat()) * 0.2F + 1.0F);
}
@Override
public void getSubItems (Item id, CreativeTabs tab, List list)
{
public void getSubItems(Item id, CreativeTabs tab, List list) {
super.getSubItems(id, tab, list);
Item accessory = getAccessoryItem();
ItemStack tool = ToolBuilder.instance.buildTool(new ItemStack(getHeadItem(), 1, 2), new ItemStack(getHandleItem(), 1, 16), null, StatCollector.translateToLocal("tool.baneofpigs"));
ItemStack tool = ToolBuilder.instance.buildTool(
new ItemStack(getHeadItem(), 1, 2),
new ItemStack(getHandleItem(), 1, 16),
null,
StatCollector.translateToLocal("tool.baneofpigs"));
NBTTagCompound tags = tool.getTagCompound().getCompoundTag("InfiTool");
tags.setBoolean("Special", true);
@@ -64,7 +68,7 @@ public class FryingPan extends Weapon
tags.setInteger("BaseDurability", Integer.MAX_VALUE / 100);
tags.setInteger("MiningSpeed", Integer.MAX_VALUE / 100);
int[] keyPair = new int[] { Integer.MAX_VALUE / 100, 0, 0 };
int[] keyPair = new int[] {Integer.MAX_VALUE / 100, 0, 0};
tags.setIntArray("Blaze", keyPair);
tags.setInteger("Necrotic", Integer.MAX_VALUE / 100);
tags.setInteger("Effect1", 7);
@@ -74,56 +78,51 @@ public class FryingPan extends Weapon
}
@Override
public boolean onItemUse (ItemStack stack, EntityPlayer player, World world, int x, int y, int z, int side, float clickX, float clickY, float clickZ)
{
if (side == 0 || !player.isSneaking())
{
public boolean onItemUse(
ItemStack stack,
EntityPlayer player,
World world,
int x,
int y,
int z,
int side,
float clickX,
float clickY,
float clickZ) {
if (side == 0 || !player.isSneaking()) {
return false;
}
else if (!world.getBlock(x, y, z).getMaterial().isSolid())
{
} else if (!world.getBlock(x, y, z).getMaterial().isSolid()) {
return false;
}
else
{
if (side == 1)
{
} else {
if (side == 1) {
++y;
}
if (side == 2)
{
if (side == 2) {
--z;
}
if (side == 3)
{
if (side == 3) {
++z;
}
if (side == 4)
{
if (side == 4) {
--x;
}
if (side == 5)
{
if (side == 5) {
++x;
}
if (!player.canPlayerEdit(x, y, z, side, stack))
{
if (!player.canPlayerEdit(x, y, z, side, stack)) {
return false;
}
else if (!TinkerTools.heldItemBlock.canPlaceBlockAt(world, x, y, z))
{
} else if (!TinkerTools.heldItemBlock.canPlaceBlockAt(world, x, y, z)) {
return false;
}
else
{
} else {
world.setBlock(x, y, z, TinkerTools.heldItemBlock, 0, 3);
TinkerTools.heldItemBlock.onBlockPlacedBy(world, x, y, z, player, stack);
world.playSoundEffect(x, y, z, "tinker:frypan_hit", 1.0F, (random.nextFloat() - random.nextFloat()) * 0.2F + 0.65F);
world.playSoundEffect(
x, y, z, "tinker:frypan_hit", 1.0F, (random.nextFloat() - random.nextFloat()) * 0.2F + 0.65F);
EquipLogic logic = (EquipLogic) world.getTileEntity(x, y, z);
logic.setEquipmentItem(stack);
@@ -135,56 +134,48 @@ public class FryingPan extends Weapon
}
@Override
public Item getHeadItem ()
{
public Item getHeadItem() {
return TinkerTools.frypanHead;
}
@Override
public Item getAccessoryItem ()
{
public Item getAccessoryItem() {
return null;
}
@Override
public int getPartAmount ()
{
public int getPartAmount() {
return 2;
}
@Override
public void registerPartPaths (int index, String[] location)
{
public void registerPartPaths(int index, String[] location) {
headStrings.put(index, location[0]);
brokenPartStrings.put(index, location[1]);
handleStrings.put(index, location[2]);
}
@Override
public String getIconSuffix (int partType)
{
switch (partType)
{
case 0:
return "_frypan_head";
case 1:
return "_frypan_head_broken";
case 2:
return "_frypan_handle";
default:
return "";
public String getIconSuffix(int partType) {
switch (partType) {
case 0:
return "_frypan_head";
case 1:
return "_frypan_head_broken";
case 2:
return "_frypan_handle";
default:
return "";
}
}
@Override
public String getEffectSuffix ()
{
public String getEffectSuffix() {
return "_frypan_effect";
}
@Override
public String getDefaultFolder ()
{
public String getDefaultFolder() {
return "frypan";
}
}