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

@@ -11,37 +11,31 @@ import net.minecraft.potion.*;
import net.minecraft.util.*;
import net.minecraft.world.World;
public class LaunchedPotion extends EntityThrowable
{
public class LaunchedPotion extends EntityThrowable {
/**
* The damage value of the thrown potion that this EntityPotion represents.
*/
private ItemStack potionDamage;
public LaunchedPotion(World par1World)
{
public LaunchedPotion(World par1World) {
super(par1World);
}
public LaunchedPotion(World par1World, EntityLivingBase par2EntityLiving, int par3)
{
public LaunchedPotion(World par1World, EntityLivingBase par2EntityLiving, int par3) {
this(par1World, par2EntityLiving, new ItemStack(Items.potionitem, 1, par3));
}
public LaunchedPotion(World par1World, EntityLivingBase par2EntityLiving, ItemStack par3ItemStack)
{
public LaunchedPotion(World par1World, EntityLivingBase par2EntityLiving, ItemStack par3ItemStack) {
super(par1World, par2EntityLiving);
this.potionDamage = par3ItemStack;
}
@SideOnly(Side.CLIENT)
public LaunchedPotion(World par1World, double par2, double par4, double par6, int par8)
{
public LaunchedPotion(World par1World, double par2, double par4, double par6, int par8) {
this(par1World, par2, par4, par6, new ItemStack(Items.potionitem, 1, par8));
}
public LaunchedPotion(World par1World, double par2, double par4, double par6, ItemStack par8ItemStack)
{
public LaunchedPotion(World par1World, double par2, double par4, double par6, ItemStack par8ItemStack) {
super(par1World, par2, par4, par6);
this.potionDamage = par8ItemStack;
}
@@ -50,27 +44,22 @@ public class LaunchedPotion extends EntityThrowable
* Gets the amount of gravity to apply to the thrown entity with each tick.
*/
@Override
protected float getGravityVelocity ()
{
protected float getGravityVelocity() {
return 0.05F;
}
@Override
protected float func_70182_d ()
{
protected float func_70182_d() {
return 1.0F;
}
@Override
protected float func_70183_g ()
{
protected float func_70183_g() {
return -10.0F;
}
public void setPotionDamage (int par1)
{
if (this.potionDamage == null)
{
public void setPotionDamage(int par1) {
if (this.potionDamage == null) {
this.potionDamage = new ItemStack(Items.potionitem, 1, 0);
}
@@ -81,10 +70,8 @@ public class LaunchedPotion extends EntityThrowable
* Returns the damage value of the thrown potion that this EntityPotion
* represents.
*/
public int getPotionDamage ()
{
if (this.potionDamage == null)
{
public int getPotionDamage() {
if (this.potionDamage == null) {
this.potionDamage = new ItemStack(Items.potionitem, 1, 0);
}
@@ -95,53 +82,43 @@ public class LaunchedPotion extends EntityThrowable
* Called when this EntityThrowable hits a block or entity.
*/
@Override
protected void onImpact (MovingObjectPosition par1MovingObjectPosition)
{
if (!this.worldObj.isRemote)
{
protected void onImpact(MovingObjectPosition par1MovingObjectPosition) {
if (!this.worldObj.isRemote) {
List list = Items.potionitem.getEffects(this.potionDamage);
if (list != null && !list.isEmpty())
{
if (list != null && !list.isEmpty()) {
AxisAlignedBB axisalignedbb = this.boundingBox.expand(4.0D, 2.0D, 4.0D);
List list1 = this.worldObj.getEntitiesWithinAABB(EntityLivingBase.class, axisalignedbb);
if (list1 != null && !list1.isEmpty())
{
if (list1 != null && !list1.isEmpty()) {
Iterator iterator = list1.iterator();
while (iterator.hasNext())
{
while (iterator.hasNext()) {
EntityLivingBase entityliving = (EntityLivingBase) iterator.next();
double d0 = this.getDistanceSqToEntity(entityliving);
if (d0 < 16.0D)
{
if (d0 < 16.0D) {
double d1 = 1.0D - Math.sqrt(d0) / 4.0D;
if (entityliving == par1MovingObjectPosition.entityHit)
{
if (entityliving == par1MovingObjectPosition.entityHit) {
d1 = 1.0D;
}
Iterator iterator1 = list.iterator();
while (iterator1.hasNext())
{
while (iterator1.hasNext()) {
PotionEffect potioneffect = (PotionEffect) iterator1.next();
int i = potioneffect.getPotionID();
if (Potion.potionTypes[i].isInstant())
{
Potion.potionTypes[i].affectEntity(this.getThrower(), entityliving, potioneffect.getAmplifier(), d1);
}
else
{
if (Potion.potionTypes[i].isInstant()) {
Potion.potionTypes[i].affectEntity(
this.getThrower(), entityliving, potioneffect.getAmplifier(), d1);
} else {
int j = (int) (d1 * (double) potioneffect.getDuration() + 0.5D);
if (j > 20)
{
entityliving.addPotionEffect(new PotionEffect(i, j, potioneffect.getAmplifier()));
if (j > 20) {
entityliving.addPotionEffect(
new PotionEffect(i, j, potioneffect.getAmplifier()));
}
}
}
@@ -150,7 +127,12 @@ public class LaunchedPotion extends EntityThrowable
}
}
this.worldObj.playAuxSFX(2002, (int) Math.round(this.posX), (int) Math.round(this.posY), (int) Math.round(this.posZ), this.getPotionDamage());
this.worldObj.playAuxSFX(
2002,
(int) Math.round(this.posX),
(int) Math.round(this.posY),
(int) Math.round(this.posZ),
this.getPotionDamage());
this.setDead();
}
}
@@ -159,21 +141,16 @@ public class LaunchedPotion extends EntityThrowable
* (abstract) Protected helper method to read subclass entity data from NBT.
*/
@Override
public void readEntityFromNBT (NBTTagCompound par1NBTTagCompound)
{
public void readEntityFromNBT(NBTTagCompound par1NBTTagCompound) {
super.readEntityFromNBT(par1NBTTagCompound);
if (par1NBTTagCompound.hasKey("Potion"))
{
if (par1NBTTagCompound.hasKey("Potion")) {
this.potionDamage = ItemStack.loadItemStackFromNBT(par1NBTTagCompound.getCompoundTag("Potion"));
}
else
{
} else {
this.setPotionDamage(par1NBTTagCompound.getInteger("potionValue"));
}
if (this.potionDamage == null)
{
if (this.potionDamage == null) {
this.setDead();
}
}
@@ -182,12 +159,10 @@ public class LaunchedPotion extends EntityThrowable
* (abstract) Protected helper method to write subclass entity data to NBT.
*/
@Override
public void writeEntityToNBT (NBTTagCompound par1NBTTagCompound)
{
public void writeEntityToNBT(NBTTagCompound par1NBTTagCompound) {
super.writeEntityToNBT(par1NBTTagCompound);
if (this.potionDamage != null)
{
if (this.potionDamage != null) {
par1NBTTagCompound.setTag("Potion", this.potionDamage.writeToNBT(new NBTTagCompound()));
}
}