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

@@ -8,14 +8,12 @@ import net.minecraft.potion.*;
import net.minecraft.util.IIcon;
import net.minecraft.world.World;
public class DiamondApple extends ItemFood
{
public class DiamondApple extends ItemFood {
public IIcon[] icons;
public String[] textureNames = new String[] { "food/apple_diamond" };
public String[] itemNames = new String[] { "apple.diamond" };
public String[] textureNames = new String[] {"food/apple_diamond"};
public String[] itemNames = new String[] {"apple.diamond"};
public DiamondApple()
{
public DiamondApple() {
super(4, 2.0F, false);
setHasSubtypes(true);
setMaxDamage(0);
@@ -23,58 +21,54 @@ public class DiamondApple extends ItemFood
}
@Override
protected void onFoodEaten (ItemStack stack, World world, EntityPlayer player)
{
if (!world.isRemote)
{
protected void onFoodEaten(ItemStack stack, World world, EntityPlayer player) {
if (!world.isRemote) {
int duration = 0;
PotionEffect potion;
potion = player.getActivePotionEffect(Potion.resistance);
if (potion != null)
duration = potion.getDuration();
if (potion != null) duration = potion.getDuration();
player.addPotionEffect(new PotionEffect(Potion.field_76444_x.id, duration + 60 * 40, 4));
potion = player.getActivePotionEffect(Potion.resistance);
if (potion != null)
duration = potion.getDuration();
if (potion != null) duration = potion.getDuration();
player.addPotionEffect(new PotionEffect(Potion.resistance.id, duration + 60 * 20, 0));
potion = player.getActivePotionEffect(Potion.digSpeed);
if (potion != null)
duration = potion.getDuration();
if (potion != null) duration = potion.getDuration();
player.addPotionEffect(new PotionEffect(Potion.digSpeed.id, duration + 60 * 20, 0));
potion = player.getActivePotionEffect(Potion.damageBoost);
if (potion != null)
duration = potion.getDuration();
if (potion != null) duration = potion.getDuration();
player.addPotionEffect(new PotionEffect(Potion.damageBoost.id, duration + 60 * 20, 0));
}
}
@SideOnly(Side.CLIENT)
@Override
public IIcon getIconFromDamage (int meta)
{
public IIcon getIconFromDamage(int meta) {
return icons[meta];
}
@SideOnly(Side.CLIENT)
@Override
public void registerIcons (IIconRegister iconRegister)
{
public void registerIcons(IIconRegister iconRegister) {
this.icons = new IIcon[textureNames.length];
for (int i = 0; i < this.icons.length; ++i)
{
for (int i = 0; i < this.icons.length; ++i) {
this.icons[i] = iconRegister.registerIcon("tinker:" + textureNames[i]);
}
}
/* Name override */
@Override
public String getUnlocalizedName (ItemStack itemstack)
{
return (new StringBuilder()).append("item.food.").append(itemNames[(itemstack.getItemDamage()>=itemNames.length||itemstack.getItemDamage()<0)?(0):(itemstack.getItemDamage())]).toString();
public String getUnlocalizedName(ItemStack itemstack) {
return (new StringBuilder())
.append("item.food.")
.append(itemNames[
(itemstack.getItemDamage() >= itemNames.length || itemstack.getItemDamage() < 0)
? (0)
: (itemstack.getItemDamage())])
.toString();
}
}