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

@@ -16,11 +16,9 @@ import tconstruct.library.TConstructRegistry;
import tconstruct.world.TinkerWorld;
import tconstruct.world.model.PunjiRender;
public class Punji extends MantleBlock
{
public class Punji extends MantleBlock {
public Punji()
{
public Punji() {
super(Material.plants);
this.setBlockBounds(0.125f, 0, 0.125f, 0.875f, 0.375f, 0.875f);
this.stepSound = Block.soundTypeGrass;
@@ -29,13 +27,10 @@ public class Punji extends MantleBlock
}
@Override
public void onEntityCollidedWithBlock (World world, int x, int y, int z, Entity entity)
{
if (entity instanceof EntityLivingBase)
{
public void onEntityCollidedWithBlock(World world, int x, int y, int z, Entity entity) {
if (entity instanceof EntityLivingBase) {
int damage = world.getBlockMetadata(x, y, z) / 2 + 1;
if (entity.fallDistance > 0)
damage += ((entity.fallDistance) * 1.5 + 2);
if (entity.fallDistance > 0) damage += ((entity.fallDistance) * 1.5 + 2);
entity.attackEntityFrom(DamageSource.cactus, damage);
((EntityLivingBase) entity).addPotionEffect(new PotionEffect(Potion.moveSlowdown.id, 20, 1));
}
@@ -43,26 +38,28 @@ public class Punji extends MantleBlock
/* Right-click adds sticks */
@Override
public boolean onBlockActivated (World world, int x, int y, int z, EntityPlayer player, int par6, float hitX, float hitY, float hitZ)
{
public boolean onBlockActivated(
World world, int x, int y, int z, EntityPlayer player, int par6, float hitX, float hitY, float hitZ) {
/*
* if (world.isRemote) return false;
*/
int meta = world.getBlockMetadata(x, y, z);
if (meta < 4)
{
if (meta < 4) {
ItemStack stack = player.getCurrentEquippedItem();
if (stack != null && stack.getItem() == Item.getItemFromBlock(TinkerWorld.punji))
{
if (stack != null && stack.getItem() == Item.getItemFromBlock(TinkerWorld.punji)) {
world.setBlockMetadataWithNotify(x, y, z, meta + 1, 3);
world.playSoundEffect((double) ((float) x + 0.5F), (double) ((float) y + 0.5F), (double) ((float) z + 0.5F), this.stepSound.soundName, (this.stepSound.getVolume() + 1.0F) / 2.0F, this.stepSound.getPitch() * 0.8F);
world.playSoundEffect(
(double) ((float) x + 0.5F),
(double) ((float) y + 0.5F),
(double) ((float) z + 0.5F),
this.stepSound.soundName,
(this.stepSound.getVolume() + 1.0F) / 2.0F,
this.stepSound.getPitch() * 0.8F);
player.swingItem();
if (!player.capabilities.isCreativeMode)
{
if (!player.capabilities.isCreativeMode) {
stack.stackSize--;
if (stack.stackSize <= 0)
player.destroyCurrentEquippedItem();
if (stack.stackSize <= 0) player.destroyCurrentEquippedItem();
}
}
}
@@ -70,8 +67,7 @@ public class Punji extends MantleBlock
}
@Override
public int quantityDropped (int meta, int fortune, Random random)
{
public int quantityDropped(int meta, int fortune, Random random) {
return meta + 1;
}
@@ -81,8 +77,7 @@ public class Punji extends MantleBlock
* the player can attach torches, redstone wire, etc to this block.
*/
@Override
public boolean isOpaqueCube ()
{
public boolean isOpaqueCube() {
return false;
}
@@ -91,29 +86,24 @@ public class Punji extends MantleBlock
* (examples: signs, buttons, stairs, etc)
*/
@Override
public boolean renderAsNormalBlock ()
{
public boolean renderAsNormalBlock() {
return false;
}
@Override
public int getRenderType ()
{
public int getRenderType() {
return PunjiRender.model;
}
@Override
@SideOnly(Side.CLIENT)
public void registerBlockIcons (IIconRegister iconRegister)
{
public void registerBlockIcons(IIconRegister iconRegister) {
this.blockIcon = iconRegister.registerIcon("tinker:punji");
}
@Override
@SideOnly(Side.CLIENT)
public boolean shouldSideBeRendered (IBlockAccess world, int x, int y, int z, int side)
{
public boolean shouldSideBeRendered(IBlockAccess world, int x, int y, int z, int side) {
return true;
}
}