aboutsummaryrefslogtreecommitdiff
path: root/src/main/java/gtPlusPlus/core/block
diff options
context:
space:
mode:
authorRaven Szewczyk <git@eigenraven.me>2024-07-26 10:26:18 +0100
committerGitHub <noreply@github.com>2024-07-26 10:26:18 +0100
commit2d09c1d5693de31bb500752a8dcc9074acecbd73 (patch)
treede00b34ed53ec860943afd1a5c72d5087d059f81 /src/main/java/gtPlusPlus/core/block
parent0cb32ba6d9f2acf9352af667fa7bcf311b011d9c (diff)
downloadGT5-Unofficial-2d09c1d5693de31bb500752a8dcc9074acecbd73.tar.gz
GT5-Unofficial-2d09c1d5693de31bb500752a8dcc9074acecbd73.tar.bz2
GT5-Unofficial-2d09c1d5693de31bb500752a8dcc9074acecbd73.zip
Fix Lead Lined Box gui and add ModularUI2 as a dependency (#2767)
Diffstat (limited to 'src/main/java/gtPlusPlus/core/block')
-rw-r--r--src/main/java/gtPlusPlus/core/block/machine/DecayablesChest.java39
1 files changed, 16 insertions, 23 deletions
diff --git a/src/main/java/gtPlusPlus/core/block/machine/DecayablesChest.java b/src/main/java/gtPlusPlus/core/block/machine/DecayablesChest.java
index c333e7a5ca..16d038bea9 100644
--- a/src/main/java/gtPlusPlus/core/block/machine/DecayablesChest.java
+++ b/src/main/java/gtPlusPlus/core/block/machine/DecayablesChest.java
@@ -15,14 +15,14 @@ import net.minecraft.util.IIcon;
import net.minecraft.world.IBlockAccess;
import net.minecraft.world.World;
+import com.cleanroommc.modularui.factory.TileEntityGuiFactory;
+
import cpw.mods.fml.common.registry.GameRegistry;
import cpw.mods.fml.relauncher.Side;
import cpw.mods.fml.relauncher.SideOnly;
-import gtPlusPlus.GTplusplus;
import gtPlusPlus.api.interfaces.ITileTooltip;
import gtPlusPlus.core.client.renderer.RenderDecayChest;
import gtPlusPlus.core.creative.AddToCreativeTab;
-import gtPlusPlus.core.handler.GuiHandler;
import gtPlusPlus.core.item.base.itemblock.ItemBlockBasicTile;
import gtPlusPlus.core.tileentities.general.TileEntityDecayablesChest;
import gtPlusPlus.core.util.minecraft.InventoryUtils;
@@ -43,8 +43,6 @@ public class DecayablesChest extends BlockContainer implements ITileTooltip {
*/
private final int mTooltipID = 5;
- public final int field_149956_a = 0;
-
@Override
public int getTooltipID() {
return this.mTooltipID;
@@ -94,18 +92,17 @@ public class DecayablesChest extends BlockContainer implements ITileTooltip {
}
/**
- * Updates the blocks bounds based on its current state. Args: world, x, y, z
+ * Updates the blocks bounds based on its current state.
*/
@Override
- public void setBlockBoundsBasedOnState(IBlockAccess p_149719_1_, int p_149719_2_, int p_149719_3_,
- int p_149719_4_) {
- if (p_149719_1_.getBlock(p_149719_2_, p_149719_3_, p_149719_4_ - 1) == this) {
+ public void setBlockBoundsBasedOnState(IBlockAccess world, int x, int y, int z) {
+ if (world.getBlock(x, y, z - 1) == this) {
this.setBlockBounds(0.0625F, 0.0F, 0.0F, 0.9375F, 0.875F, 0.9375F);
- } else if (p_149719_1_.getBlock(p_149719_2_, p_149719_3_, p_149719_4_ + 1) == this) {
+ } else if (world.getBlock(x, y, z + 1) == this) {
this.setBlockBounds(0.0625F, 0.0F, 0.0625F, 0.9375F, 0.875F, 1.0F);
- } else if (p_149719_1_.getBlock(p_149719_2_ - 1, p_149719_3_, p_149719_4_) == this) {
+ } else if (world.getBlock(x - 1, y, z) == this) {
this.setBlockBounds(0.0F, 0.0F, 0.0625F, 0.9375F, 0.875F, 0.9375F);
- } else if (p_149719_1_.getBlock(p_149719_2_ + 1, p_149719_3_, p_149719_4_) == this) {
+ } else if (world.getBlock(x + 1, y, z) == this) {
this.setBlockBounds(0.0625F, 0.0F, 0.0625F, 1.0F, 0.875F, 0.9375F);
} else {
this.setBlockBounds(0.0625F, 0.0F, 0.0625F, 0.9375F, 0.875F, 0.9375F);
@@ -118,7 +115,11 @@ public class DecayablesChest extends BlockContainer implements ITileTooltip {
@Override
@SideOnly(Side.CLIENT)
public IIcon getIcon(final int ordinalSide, final int meta) {
- return ordinalSide == 1 ? this.textureTop : (ordinalSide == 0 ? this.textureBottom : this.textureFront);
+ return switch (ordinalSide) {
+ case 0 -> textureBottom;
+ case 1 -> textureTop;
+ default -> textureFront;
+ };
}
@Override
@@ -130,19 +131,16 @@ public class DecayablesChest extends BlockContainer implements ITileTooltip {
this.textureFront = p_149651_1_.registerIcon(GTPlusPlus.ID + ":" + "TileEntities/" + "DecayablesChest_bottom");
}
- /**
- * Called upon block activation (right click on the block.)
- */
@Override
public boolean onBlockActivated(final World world, final int x, final int y, final int z, final EntityPlayer player,
final int side, final float lx, final float ly, final float lz) {
- if (world.isRemote) {
+ if (world.isRemote || player == null || player.worldObj != world) {
return true;
}
final TileEntity te = world.getTileEntity(x, y, z);
- if ((te != null) && (te instanceof TileEntityDecayablesChest)) {
- player.openGui(GTplusplus.instance, GuiHandler.GUI13, world, x, y, z);
+ if (te instanceof TileEntityDecayablesChest) {
+ TileEntityGuiFactory.open(player, x, y, z);
return true;
}
return false;
@@ -159,11 +157,6 @@ public class DecayablesChest extends BlockContainer implements ITileTooltip {
}
@Override
- public void onBlockAdded(final World world, final int x, final int y, final int z) {
- super.onBlockAdded(world, x, y, z);
- }
-
- @Override
public void breakBlock(final World world, final int x, final int y, final int z, final Block block,
final int number) {
InventoryUtils.dropInventoryItems(world, x, y, z, block);