From 76719d65a90d98e228a914774d3b11ed9f01ac8e Mon Sep 17 00:00:00 2001 From: Connor-Colenso <52056774+Connor-Colenso@users.noreply.github.com> Date: Mon, 4 Sep 2023 03:05:22 +0100 Subject: Clean-up v2 (#729) * Remove test items from NEI with no texture * Add number formatting to hand pumps * Remove heavy plates (no recipes & completely unused). * Remove helium generator (no texture, no recipe) * Remove fire pit and fire starter (no use, no recipe, no textures) * Remove giant chicken and associated unused stuff, has no texture and is unobtainable. Used to be relevant but isn't anymore. * Remove villagers with silly trades like 1 motor + 1 hull = 1 hull. Why? * Remove trade bench, no recipe, missing textures. Unused. * Remove farm processors, no texture, no recipe. Unused. * Remove MAX tier components, these exist in GT now, have no recipe here and are unused. * Hide untextured light block from NEI * Update buildscript * Remove unused backpacks, no recipe and contains dupe bugs. Bad. * Remove eatotronic, universal toolbox and magic tool bag. All 3 are missing textures and uncraftable. * Remove eatotronic, universal toolbox and magic tool bag. All 3 are missing textures and uncraftable. part 2 * Remove dragon catcher (what?), no texture, no recipe, unused. * Remove empty item, does nothing, has no recipe, no idea why it is here. * Empty item v2 removal * Revert "Empty item v2 removal" This reverts commit 75bcd3ccfaf55bbfe2c12b2e4167d5c37636030d. * Revert "Remove empty item, does nothing, has no recipe, no idea why it is here." This reverts commit e41a9f484392776331c58530ab1faa5ef978ef36. * Remove debug square. No recipe, unused. * Number formatting overflow covers * Remove JVM garbage collection block. Unused, no recipe. * Remove nanotubes, no recipe for them. Unused. * Remove "git" item, doesn't seem to work. Has no recipe. * Remove uncraftable food with awful textures. * Remove "bat king" mob, unused content. Does not spawn. * Remove uncraftable doors with bad textures. Unused content. * Remove uncraftable, unlocalised redstone stuff that crashes game when placed. * Remove weird spawner item. No recipe, does not exist in world. * Remove sunnarium bit, no recipe, no usage. * Remove unused modularity table and some misc uncraftable, unused items. * Remove Interconnecting Storage Crate, no recipe, unused. * Delete worse debug power gen, this already exists as part of GT. Unneeded duplication. * Delete unused placeholder circuit * Delete uncraftable generator hatches. * Spotless * Remove XP tank thing, unused and uncraftable. * Remove null item, this fluid registry only seemed to register one null fluid. All others exist? * Remove EU -> RF battery. Unused in GTNH. * Remove some shelf nonsense, why is this in this mod? * Remove some weird random tools. These have no realistic usage in GTNH. * Remove firemaker. Useless in GTNH. * Removed helium blob. Deprecated item, not used anymore, uncraftable. * spotlessApply (#730) Co-authored-by: GitHub GTNH Actions <> * Stop modulators generating unused blocks with no textures * Remove more unused untextured casings * Remove more unused untextured casings * Remove more unused untextured casings * Remove more unused untextured casings * Remove more unused untextured casings * Remove some weird methods and uncraftable mining parts, probably part of deprecated multiblock. * spotlessApply (#732) Co-authored-by: GitHub GTNH Actions <> * Remove gem shards, unused. * Remove unused atoms * Remove unused gum * Remove unused elements/materials * Bye bye * Remove some unused reflection stuff * Remove control cores, obsolete now. * Remove mob killing thing with no texture and no recipe. * Remove uncraftable covers * Remove pizza gloves * Net and rope removal, unused * Remove force crop * Removal of some old event stuff * Remove unused nuclear chem items * Remove player safe, mostly because of the horrible event code that was intercepting every block break. I can't see any real usage of this via discord. * Remove Force material and associated other nonsense. Also remove some nuclear chem stuff. * Remove force for realsies * Skookum Chooker purge. * Remove some enderio compat, these plates/dusts are added via GT5 anyway now. This is obsolete. * spotlessApply (#733) Co-authored-by: GitHub GTNH Actions <> * Unused textures * Bump dep * Revert "Remove force for realsies" This reverts commit 0d288912a99f9dabce56d2a2623d4d3510f4804e. * Revert "Remove Force material and associated other nonsense. Also remove some nuclear chem stuff." This reverts commit 3455e6e916defe1f2aef923be6f9696a6cf3095b. * Remove nuclear items that are unused * spotlessApply (#734) Co-authored-by: GitHub GTNH Actions <> --------- Co-authored-by: GTNH-Colen <54497873+GTNH-Colen@users.noreply.github.com> Co-authored-by: Connor Colenso Co-authored-by: github-actions[bot] <41898282+github-actions[bot]@users.noreply.github.com> --- .../generators/GregtechMetaTileEntity_RTG.java | 2 - .../creative/GregtechMetaCreativeEnergyBuffer.java | 234 --------- .../basic/GregtechMetaGarbageCollector.java | 386 -------------- .../GT_MetaTileEntity_ConnectableCrate.java | 578 --------------------- .../storage/GregtechMetaSafeBlock.java | 77 --- .../storage/shelving/GT4Entity_Shelf.java | 365 ------------- .../shelving/GT4Entity_Shelf_Compartment.java | 40 -- .../storage/shelving/GT4Entity_Shelf_Desk.java | 49 -- .../shelving/GT4Entity_Shelf_FileCabinet.java | 60 --- .../storage/shelving/GT4Entity_Shelf_Iron.java | 47 -- .../storage/shelving/GT4Entity_Shelf_Large.java | 276 ---------- 11 files changed, 2114 deletions(-) delete mode 100644 src/main/java/gtPlusPlus/xmod/gregtech/common/tileentities/generators/creative/GregtechMetaCreativeEnergyBuffer.java delete mode 100644 src/main/java/gtPlusPlus/xmod/gregtech/common/tileentities/machines/basic/GregtechMetaGarbageCollector.java delete mode 100644 src/main/java/gtPlusPlus/xmod/gregtech/common/tileentities/storage/GT_MetaTileEntity_ConnectableCrate.java delete mode 100644 src/main/java/gtPlusPlus/xmod/gregtech/common/tileentities/storage/GregtechMetaSafeBlock.java delete mode 100644 src/main/java/gtPlusPlus/xmod/gregtech/common/tileentities/storage/shelving/GT4Entity_Shelf.java delete mode 100644 src/main/java/gtPlusPlus/xmod/gregtech/common/tileentities/storage/shelving/GT4Entity_Shelf_Compartment.java delete mode 100644 src/main/java/gtPlusPlus/xmod/gregtech/common/tileentities/storage/shelving/GT4Entity_Shelf_Desk.java delete mode 100644 src/main/java/gtPlusPlus/xmod/gregtech/common/tileentities/storage/shelving/GT4Entity_Shelf_FileCabinet.java delete mode 100644 src/main/java/gtPlusPlus/xmod/gregtech/common/tileentities/storage/shelving/GT4Entity_Shelf_Iron.java delete mode 100644 src/main/java/gtPlusPlus/xmod/gregtech/common/tileentities/storage/shelving/GT4Entity_Shelf_Large.java (limited to 'src/main/java/gtPlusPlus/xmod/gregtech/common/tileentities') diff --git a/src/main/java/gtPlusPlus/xmod/gregtech/common/tileentities/generators/GregtechMetaTileEntity_RTG.java b/src/main/java/gtPlusPlus/xmod/gregtech/common/tileentities/generators/GregtechMetaTileEntity_RTG.java index 51d7b4d186..3b54fb46a7 100644 --- a/src/main/java/gtPlusPlus/xmod/gregtech/common/tileentities/generators/GregtechMetaTileEntity_RTG.java +++ b/src/main/java/gtPlusPlus/xmod/gregtech/common/tileentities/generators/GregtechMetaTileEntity_RTG.java @@ -28,7 +28,6 @@ import gtPlusPlus.xmod.gregtech.api.enums.GregtechItemList; public class GregtechMetaTileEntity_RTG extends GT_MetaTileEntity_BasicGenerator { public int mEfficiency; - private int mDays; private long mTicksToBurnFor; private int mVoltage = 0; private GT_Recipe mCurrentRecipe; @@ -79,7 +78,6 @@ public class GregtechMetaTileEntity_RTG extends GT_MetaTileEntity_BasicGenerator @Override public void loadNBTData(NBTTagCompound aNBT) { super.loadNBTData(aNBT); - // this.mMachineBlock = aNBT.getByte("mMachineBlock"); this.mTicksToBurnFor = aNBT.getLong("mTicksToBurnFor"); this.mVoltage = aNBT.getInteger("mVoltage"); this.mDaysRemaining = aNBT.getInteger("mDaysRemaining"); diff --git a/src/main/java/gtPlusPlus/xmod/gregtech/common/tileentities/generators/creative/GregtechMetaCreativeEnergyBuffer.java b/src/main/java/gtPlusPlus/xmod/gregtech/common/tileentities/generators/creative/GregtechMetaCreativeEnergyBuffer.java deleted file mode 100644 index c04a04ae3c..0000000000 --- a/src/main/java/gtPlusPlus/xmod/gregtech/common/tileentities/generators/creative/GregtechMetaCreativeEnergyBuffer.java +++ /dev/null @@ -1,234 +0,0 @@ -package gtPlusPlus.xmod.gregtech.common.tileentities.generators.creative; - -import static gregtech.api.enums.GT_Values.V; - -import net.minecraft.entity.player.EntityPlayer; -import net.minecraft.item.ItemStack; -import net.minecraft.nbt.NBTTagCompound; -import net.minecraft.util.EnumChatFormatting; -import net.minecraft.world.World; -import net.minecraftforge.common.util.ForgeDirection; - -import com.gtnewhorizon.gtnhlib.reflect.Fields; - -import gregtech.api.enums.GT_Values; -import gregtech.api.enums.Textures; -import gregtech.api.interfaces.ITexture; -import gregtech.api.interfaces.metatileentity.IMetaTileEntity; -import gregtech.api.interfaces.tileentity.IGregTechTileEntity; -import gregtech.api.objects.GT_RenderedTexture; -import gregtech.api.util.GT_Utility; -import gtPlusPlus.api.objects.Logger; -import gtPlusPlus.core.lib.CORE; -import gtPlusPlus.core.util.math.MathUtils; -import gtPlusPlus.core.util.minecraft.PlayerUtils; -import gtPlusPlus.core.util.sys.KeyboardUtils; -import gtPlusPlus.xmod.gregtech.common.blocks.textures.TexturesGtBlock; -import gtPlusPlus.xmod.gregtech.common.blocks.textures.TexturesGtBlock.CustomIcon; -import gtPlusPlus.xmod.gregtech.common.tileentities.storage.GregtechMetaEnergyBuffer; - -/** - * NEVER INCLUDE THIS FILE IN YOUR MOD!!! - * - * This is the main construct for my Basic Machines such as the Automatic Extractor Extend this class to make a simple - * Machine - */ -public class GregtechMetaCreativeEnergyBuffer extends GregtechMetaEnergyBuffer { - - private int mVoltageTier = 3; - - public GregtechMetaCreativeEnergyBuffer(final String aName, final int aTier, final String aDescription, - final ITexture[][][] aTextures, final int aSlotCount) { - super(aName, aTier, aDescription, aTextures, aSlotCount); - // TODO Auto-generated constructor stub - } - - public GregtechMetaCreativeEnergyBuffer(final int aID, final String aName, final String aNameRegional, - final int aTier, final String aDescription, final int aSlotCount) { - super(aID, aName, aNameRegional, aTier, aDescription, aSlotCount); - } - - @Override - public String[] getDescription() { - return new String[] { this.mDescription, "Use Screwdriver to change voltage", - "Hold Shift while using Screwdriver to change amperage", EnumChatFormatting.GREEN + "CREATIVE MACHINE", - CORE.GT_Tooltip.get() }; - } - - /* - * MACHINE_STEEL_SIDE - */ - @Override - public ITexture[][][] getTextureSet(final ITexture[] aTextures) { - CustomIcon h = TexturesGtBlock.Casing_Material_RedSteel; - CustomIcon g = TexturesGtBlock.Casing_Material_Grisium; - CustomIcon k; - boolean j = MathUtils.isNumberEven(this.mVoltageTier); - final ITexture[][][] rTextures = new ITexture[2][17][]; - k = j ? g : h; - for (byte i = -1; i < 16; i++) { - rTextures[0][i + 1] = new ITexture[] { new GT_RenderedTexture(k) }; - rTextures[1][i + 1] = new ITexture[] { new GT_RenderedTexture(k), - this.mInventory.length > 4 ? Textures.BlockIcons.OVERLAYS_ENERGY_OUT_MULTI[this.mVoltageTier] - : Textures.BlockIcons.OVERLAYS_ENERGY_OUT[this.mVoltageTier] }; - } - return rTextures; - } - - @Override - public ITexture[] getTexture(final IGregTechTileEntity aBaseMetaTileEntity, final ForgeDirection side, - final ForgeDirection facing, final int aColorIndex, final boolean aActive, final boolean aRedstone) { - return this.mTextures[side == facing ? 1 : 0][aColorIndex + 1]; - } - - @Override - protected void showEnergy(final World worldIn, final EntityPlayer playerIn) { - final long tempStorage = this.getBaseMetaTileEntity().getStoredEU(); - final double c = ((double) tempStorage / this.maxEUStore()) * 100; - final double roundOff = Math.round(c * 100.00) / 100.00; - PlayerUtils.messagePlayer( - playerIn, - "Energy: " + GT_Utility - .formatNumbers(tempStorage) + " EU at " + V[this.mVoltageTier] + "v (" + roundOff + "%)"); - PlayerUtils.messagePlayer(playerIn, "Amperage: " + GT_Utility.formatNumbers(maxAmperesOut()) + "A"); - } - - @Override - public IMetaTileEntity newMetaEntity(final IGregTechTileEntity aTileEntity) { - return new GregtechMetaCreativeEnergyBuffer( - this.mName, - this.mTier, - this.mDescription, - this.mTextures, - this.mInventory.length); - } - - @Override - public long getMinimumStoredEU() { - return 0; - } - - @Override - public long maxEUStore() { - return Long.MAX_VALUE; - } - - @Override - public long maxEUInput() { - return V[mVoltageTier]; - } - - @Override - public long maxEUOutput() { - return V[mVoltageTier]; - } - - @Override - public long maxAmperesIn() { - return aCurrentOutputAmperage; - } - - @Override - public long maxAmperesOut() { - return aCurrentOutputAmperage; - } - - @Override - public int getProgresstime() { - return Integer.MAX_VALUE; - } - - @Override - public int maxProgresstime() { - return Integer.MAX_VALUE; - } - - @Override - public boolean isAccessAllowed(final EntityPlayer aPlayer) { - return true; - } - - @Override - public void onPostTick(final IGregTechTileEntity aBaseMetaTileEntity, final long aTick) { - if (aBaseMetaTileEntity.isServerSide()) { - aBaseMetaTileEntity.increaseStoredEnergyUnits(Integer.MAX_VALUE, true); - } - } - - @Override - public boolean allowPullStack(final IGregTechTileEntity aBaseMetaTileEntity, final int aIndex, - final ForgeDirection side, final ItemStack aStack) { - return false; - } - - @Override - public boolean allowPutStack(final IGregTechTileEntity aBaseMetaTileEntity, final int aIndex, - final ForgeDirection side, final ItemStack aStack) { - return false; - } - - @Override - public String[] getInfoData() { - String[] infoData = super.getInfoData(); - return new String[] { infoData[0], "THIS IS A CREATIVE ITEM - FOR TESTING | Tier: " + this.mVoltageTier, - infoData[1], infoData[2] }; - } - - @Override - public boolean isGivingInformation() { - return true; - } - - @Override - public void saveNBTData(NBTTagCompound aNBT) { - aNBT.setInteger("mVoltageTier", this.mVoltageTier); - super.saveNBTData(aNBT); - } - - @Override - public void loadNBTData(NBTTagCompound aNBT) { - this.mVoltageTier = aNBT.getInteger("mVoltageTier"); - super.loadNBTData(aNBT); - } - - private static Fields.ClassFields.Field mTexturesAccessor; - - @Override - public void onScrewdriverRightClick(ForgeDirection side, EntityPlayer aPlayer, float aX, float aY, float aZ) { - if (KeyboardUtils.isShiftKeyDown()) { - super.onScrewdriverRightClick(side, aPlayer, aX, aY, aZ); - } else { - if (this.mVoltageTier < (GT_Values.VN[9].equals("UHV") ? GT_Values.V.length - 1 : 9)) { - this.mVoltageTier++; - } else { - this.mVoltageTier = 0; - } - this.markDirty(); - try { - if (mTexturesAccessor == null) { - mTexturesAccessor = Fields.ofClass(GregtechMetaCreativeEnergyBuffer.class) - .getField(Fields.LookupType.PUBLIC, "mTextures", ITexture[][][].class); - } - ITexture[][][] V = getTextureSet(null); - if (V != null) { - Logger.REFLECTION("Got Valid Textures."); - if (this.getBaseMetaTileEntity().isClientSide()) { - Logger.REFLECTION("Clientside Call."); - Logger.REFLECTION("Refreshing Textures on buffer."); - mTexturesAccessor.setValue(this, V); - Logger.REFLECTION("Refreshed Textures on buffer."); - } else { - Logger.REFLECTION("Serverside Call."); - } - } else { - Logger.REFLECTION("Bad mTextures setter."); - } - } catch (Throwable t) { - // Bad refresh. - t.printStackTrace(); - Logger.REFLECTION("Bad mTextures setter."); - } - PlayerUtils.messagePlayer(aPlayer, "Now running at " + GT_Values.VOLTAGE_NAMES[this.mVoltageTier] + "."); - } - } -} diff --git a/src/main/java/gtPlusPlus/xmod/gregtech/common/tileentities/machines/basic/GregtechMetaGarbageCollector.java b/src/main/java/gtPlusPlus/xmod/gregtech/common/tileentities/machines/basic/GregtechMetaGarbageCollector.java deleted file mode 100644 index e815a622d9..0000000000 --- a/src/main/java/gtPlusPlus/xmod/gregtech/common/tileentities/machines/basic/GregtechMetaGarbageCollector.java +++ /dev/null @@ -1,386 +0,0 @@ -package gtPlusPlus.xmod.gregtech.common.tileentities.machines.basic; - -import net.minecraft.entity.player.EntityPlayer; -import net.minecraft.item.ItemStack; -import net.minecraft.nbt.NBTTagCompound; -import net.minecraft.world.World; -import net.minecraftforge.common.util.ForgeDirection; - -import gregtech.api.enums.Textures; -import gregtech.api.interfaces.ITexture; -import gregtech.api.interfaces.metatileentity.IMetaTileEntity; -import gregtech.api.interfaces.tileentity.IGregTechTileEntity; -import gregtech.api.objects.GT_RenderedTexture; -import gtPlusPlus.core.lib.CORE; -import gtPlusPlus.core.util.Utils; -import gtPlusPlus.core.util.minecraft.PlayerUtils; -import gtPlusPlus.xmod.gregtech.api.metatileentity.implementations.base.GregtechMetaTileEntity; -import gtPlusPlus.xmod.gregtech.common.blocks.textures.TexturesGtBlock; - -public class GregtechMetaGarbageCollector extends GregtechMetaTileEntity { - - long mLastCleanup = 0; - long mLocalTickVar = 0; - int mFrequency = 5; - - public GregtechMetaGarbageCollector(final String aName, final String aNameRegional, final String aDescription) { - super(991, aName, aNameRegional, 5, 0, aDescription); - } - - public GregtechMetaGarbageCollector(final String aName, final String aDescription, final ITexture[][][] aTextures) { - super(aName, 5, 0, aDescription, aTextures); - } - - @Override - public String[] getDescription() { - return new String[] { this.mDescription, "Can request the JVM to perform garbage collection", - "Configurable to run once every 5 minute interval (5-180)", "This Machine has no recipe", - "Admin Tool, Limit one per world if possible", CORE.GT_Tooltip.get() }; - } - - @Override - public ITexture[][][] getTextureSet(final ITexture[] aTextures) { - final ITexture[][][] rTextures = new ITexture[10][17][]; - for (byte i = -1; i < 16; i++) { - rTextures[0][i + 1] = this.getFront(i); - rTextures[1][i + 1] = this.getBack(i); - rTextures[2][i + 1] = this.getBottom(i); - rTextures[3][i + 1] = this.getTop(i); - rTextures[4][i + 1] = this.getSides(i); - rTextures[5][i + 1] = this.getFrontActive(i); - rTextures[6][i + 1] = this.getBackActive(i); - rTextures[7][i + 1] = this.getBottomActive(i); - rTextures[8][i + 1] = this.getTopActive(i); - rTextures[9][i + 1] = this.getSidesActive(i); - } - return rTextures; - } - - @Override - public ITexture[] getTexture(final IGregTechTileEntity aBaseMetaTileEntity, final ForgeDirection side, - final ForgeDirection facing, final int aColorIndex, final boolean aActive, final boolean aRedstone) { - return this.mTextures[(aActive ? 5 : 0) - + (side == facing ? 0 - : side == facing.getOpposite() ? 1 - : side == ForgeDirection.DOWN ? 2 : side == ForgeDirection.UP ? 3 : 4)][aColorIndex - + 1]; - } - - public ITexture[] getFront(final byte aColor) { - return new ITexture[] { Textures.BlockIcons.MACHINE_CASINGS[this.mTier + 3][aColor + 1], - new GT_RenderedTexture(TexturesGtBlock.Casing_Material_RedSteel) }; - } - - public ITexture[] getBack(final byte aColor) { - return new ITexture[] { Textures.BlockIcons.MACHINE_CASINGS[this.mTier + 3][aColor + 1], - new GT_RenderedTexture(TexturesGtBlock.Casing_Material_RedSteel) }; - } - - public ITexture[] getBottom(final byte aColor) { - return new ITexture[] { Textures.BlockIcons.MACHINE_CASINGS[this.mTier + 3][aColor + 1], - new GT_RenderedTexture(TexturesGtBlock.Casing_Material_Grisium) }; - } - - public ITexture[] getTop(final byte aColor) { - return new ITexture[] { Textures.BlockIcons.MACHINE_CASINGS[this.mTier + 3][aColor + 1], - new GT_RenderedTexture(TexturesGtBlock.Casing_Material_Grisium) }; - } - - public ITexture[] getSides(final byte aColor) { - return new ITexture[] { Textures.BlockIcons.MACHINE_CASINGS[this.mTier + 3][aColor + 1], - new GT_RenderedTexture(TexturesGtBlock.Casing_Redox_3) }; - } - - public ITexture[] getFrontActive(final byte aColor) { - return new ITexture[] { Textures.BlockIcons.MACHINE_CASINGS[this.mTier + 3][aColor + 1], - new GT_RenderedTexture(TexturesGtBlock.Casing_Material_RedSteel) }; - } - - public ITexture[] getBackActive(final byte aColor) { - return new ITexture[] { Textures.BlockIcons.MACHINE_CASINGS[this.mTier + 3][aColor + 1], - new GT_RenderedTexture(TexturesGtBlock.Casing_Material_RedSteel) }; - } - - public ITexture[] getBottomActive(final byte aColor) { - return new ITexture[] { Textures.BlockIcons.MACHINE_CASINGS[this.mTier + 3][aColor + 1], - new GT_RenderedTexture(TexturesGtBlock.Casing_Material_Grisium) }; - } - - public ITexture[] getTopActive(final byte aColor) { - return new ITexture[] { Textures.BlockIcons.MACHINE_CASINGS[this.mTier + 3][aColor + 1], - new GT_RenderedTexture(TexturesGtBlock.Casing_Material_Grisium) }; - } - - public ITexture[] getSidesActive(final byte aColor) { - return new ITexture[] { Textures.BlockIcons.MACHINE_CASINGS[this.mTier + 3][aColor + 1], - new GT_RenderedTexture(TexturesGtBlock.Casing_Redox_3) }; - } - - @Override - public void onScrewdriverRightClick(ForgeDirection side, EntityPlayer aPlayer, float aX, float aY, float aZ) { - if (mFrequency < 180) { - mFrequency += 5; - } else { - mFrequency = 5; - } - PlayerUtils.messagePlayer(aPlayer, "Running every " + mFrequency + " minutes."); - super.onScrewdriverRightClick(side, aPlayer, aX, aY, aZ); - } - - @Override - public IMetaTileEntity newMetaEntity(final IGregTechTileEntity aTileEntity) { - return new GregtechMetaGarbageCollector(this.mName, this.mDescription, this.mTextures); - } - - @Override - public boolean isSimpleMachine() { - return true; - } - - @Override - public boolean isElectric() { - return false; - } - - @Override - public boolean isValidSlot(final int aIndex) { - return false; - } - - @Override - public boolean isFacingValid(final ForgeDirection facing) { - return true; - } - - @Override - public boolean isEnetInput() { - return false; - } - - @Override - public boolean isEnetOutput() { - return false; - } - - @Override - public boolean isInputFacing(final ForgeDirection side) { - return side != this.getBaseMetaTileEntity().getFrontFacing(); - } - - @Override - public boolean isOutputFacing(final ForgeDirection side) { - return side == this.getBaseMetaTileEntity().getFrontFacing(); - } - - @Override - public boolean isTeleporterCompatible() { - return false; - } - - @Override - public long getMinimumStoredEU() { - return 0; - } - - @Override - public long maxEUStore() { - return 0; - } - - @Override - public int getCapacity() { - return 0; - } - - @Override - public long maxEUInput() { - return 0; - } - - @Override - public long maxEUOutput() { - return 0; - } - - @Override - public long maxAmperesIn() { - return 0; - } - - @Override - public long maxAmperesOut() { - return 0; - } - - @Override - public int rechargerSlotStartIndex() { - return 0; - } - - @Override - public int dechargerSlotStartIndex() { - return 0; - } - - @Override - public int rechargerSlotCount() { - return 0; - } - - @Override - public int dechargerSlotCount() { - return 0; - } - - @Override - public int getProgresstime() { - return (int) this.getBaseMetaTileEntity().getUniversalEnergyStored(); - } - - @Override - public int maxProgresstime() { - return (int) this.getBaseMetaTileEntity().getUniversalEnergyCapacity(); - } - - @Override - public boolean isAccessAllowed(final EntityPlayer aPlayer) { - return true; - } - - @Override - public boolean onRightclick(final IGregTechTileEntity aBaseMetaTileEntity, final EntityPlayer aPlayer) { - if (aBaseMetaTileEntity.isClientSide()) { - return true; - } - this.showPollution(aPlayer.getEntityWorld(), aPlayer); - return true; - } - - private void showPollution(final World worldIn, final EntityPlayer playerIn) { - PlayerUtils.messagePlayer( - playerIn, - "Running every " + mFrequency + " minutes. Owner: " + this.getBaseMetaTileEntity().getOwnerName()); - long aDiff = mLocalTickVar - this.mLastCleanup; - PlayerUtils.messagePlayer(playerIn, "Last run: " + Utils.getSecondsFromMillis(aDiff) + " seconds ago."); - } - - @Override - public boolean allowPullStack(final IGregTechTileEntity aBaseMetaTileEntity, final int aIndex, - final ForgeDirection side, final ItemStack aStack) { - return false; - } - - @Override - public boolean allowPutStack(final IGregTechTileEntity aBaseMetaTileEntity, final int aIndex, - final ForgeDirection side, final ItemStack aStack) { - return false; - } - - @Override - public String[] getInfoData() { - return new String[] { this.getLocalName() }; - } - - @Override - public boolean isGivingInformation() { - return true; - } - - @Override - public int[] getAccessibleSlotsFromSide(final int p_94128_1_) { - return new int[] {}; - } - - @Override - public boolean canInsertItem(final int p_102007_1_, final ItemStack p_102007_2_, final int p_102007_3_) { - return false; - } - - @Override - public boolean canExtractItem(final int p_102008_1_, final ItemStack p_102008_2_, final int p_102008_3_) { - return false; - } - - @Override - public int getSizeInventory() { - return 0; - } - - @Override - public ItemStack getStackInSlot(final int p_70301_1_) { - return null; - } - - @Override - public ItemStack decrStackSize(final int p_70298_1_, final int p_70298_2_) { - return null; - } - - @Override - public ItemStack getStackInSlotOnClosing(final int p_70304_1_) { - return null; - } - - @Override - public void setInventorySlotContents(final int p_70299_1_, final ItemStack p_70299_2_) {} - - @Override - public String getInventoryName() { - return null; - } - - @Override - public boolean hasCustomInventoryName() { - return false; - } - - @Override - public int getInventoryStackLimit() { - return 0; - } - - @Override - public boolean isUseableByPlayer(final EntityPlayer p_70300_1_) { - return true; - } - - @Override - public void openInventory() {} - - @Override - public void closeInventory() {} - - @Override - public boolean isItemValidForSlot(final int p_94041_1_, final ItemStack p_94041_2_) { - return false; - } - - @Override - public boolean isOverclockerUpgradable() { - return false; - } - - @Override - public boolean isTransformerUpgradable() { - return false; - } - - @Override - public void saveNBTData(final NBTTagCompound aNBT) {} - - @Override - public void loadNBTData(final NBTTagCompound aNBT) {} - - @Override - public void onPostTick(final IGregTechTileEntity aBaseMetaTileEntity, final long aTick) { - super.onPostTick(aBaseMetaTileEntity, aTick); - if (this.getBaseMetaTileEntity().isServerSide()) { - mLocalTickVar = System.currentTimeMillis(); - long aDiff = mLocalTickVar - this.mLastCleanup; - if (Utils.getSecondsFromMillis(aDiff) >= (this.mFrequency * 60)) { - System.gc(); - this.mLastCleanup = mLocalTickVar; - } - } - } -} diff --git a/src/main/java/gtPlusPlus/xmod/gregtech/common/tileentities/storage/GT_MetaTileEntity_ConnectableCrate.java b/src/main/java/gtPlusPlus/xmod/gregtech/common/tileentities/storage/GT_MetaTileEntity_ConnectableCrate.java deleted file mode 100644 index 9a073e9e30..0000000000 --- a/src/main/java/gtPlusPlus/xmod/gregtech/common/tileentities/storage/GT_MetaTileEntity_ConnectableCrate.java +++ /dev/null @@ -1,578 +0,0 @@ -package gtPlusPlus.xmod.gregtech.common.tileentities.storage; - -import net.minecraft.block.Block; -import net.minecraft.entity.player.EntityPlayer; -import net.minecraft.item.ItemStack; -import net.minecraft.nbt.NBTTagCompound; -import net.minecraft.tileentity.TileEntity; -import net.minecraftforge.common.util.ForgeDirection; - -import com.gtnewhorizons.modularui.api.screen.ModularWindow; -import com.gtnewhorizons.modularui.api.screen.UIBuildContext; -import com.gtnewhorizons.modularui.common.widget.DrawableWidget; -import com.gtnewhorizons.modularui.common.widget.SlotWidget; -import com.gtnewhorizons.modularui.common.widget.TextWidget; - -import gregtech.api.GregTech_API; -import gregtech.api.enums.Textures.BlockIcons; -import gregtech.api.gui.modularui.GT_UIInfos; -import gregtech.api.gui.modularui.GT_UITextures; -import gregtech.api.interfaces.ITexture; -import gregtech.api.interfaces.metatileentity.IMetaTileEntity; -import gregtech.api.interfaces.modularui.IAddUIWidgets; -import gregtech.api.interfaces.tileentity.IGregTechTileEntity; -import gregtech.api.metatileentity.MetaTileEntity; -import gregtech.api.metatileentity.implementations.GT_MetaTileEntity_TieredMachineBlock; -import gregtech.api.objects.GT_RenderedTexture; -import gregtech.api.util.GT_Utility; -import gtPlusPlus.api.objects.data.AutoMap; -import gtPlusPlus.api.objects.minecraft.BlockPos; -import gtPlusPlus.core.lib.CORE; -import gtPlusPlus.core.util.data.ArrayUtils; -import gtPlusPlus.xmod.gregtech.common.blocks.textures.TexturesGtBlock; - -public class GT_MetaTileEntity_ConnectableCrate extends GT_MetaTileEntity_TieredMachineBlock implements IAddUIWidgets { - - /* - * sides.put(getUp()); sides.put(getDown()); sides.put(getXPos()); sides.put(getXNeg()); sides.put(getZPos()); - * sides.put(getZNeg()); - */ - - public int mItemCount = 0; - public ItemStack mItemStack = null; - private static final double mStorageFactor = 2; - - // Meta Tile ID - public static final int mCrateID = 955; - - // Sides - public static final int SIDE_Up = 0; - public static final int SIDE_Down = 1; - public static final int SIDE_XPos = 2; - public static final int SIDE_XNeg = 3; - public static final int SIDE_ZPos = 4; - public static final int SIDE_ZNeg = 5; - public static final int[] SIDES = new int[] { SIDE_Up, SIDE_Down, SIDE_XPos, SIDE_XNeg, SIDE_ZPos, SIDE_ZNeg }; - - // Neighbour Cache - private GT_MetaTileEntity_ConnectableCrate[] mNeighbourCache = new GT_MetaTileEntity_ConnectableCrate[6]; - // Cached Crate Location - private BlockPos mCurrentPos = null; - // Master Crate Position - protected BlockPos mMasterCrateLocation = null; - // Is Master? - protected boolean mIsMaster = false; - // Is Connected? - protected boolean mIsConnected[] = new boolean[] { false, false, false, false, false, false }; - // How many are connected? - protected int mConnectedCount = 0; - // Map of connected locations - protected AutoMap mConnectedCache = new AutoMap(); - - public GT_MetaTileEntity_ConnectableCrate(int aID, String aName, String aNameRegional, int aTier) { - super( - aID, - aName, - aNameRegional, - aTier, - 3, - "This Crate stores " + (int) (Math.pow(6.0D, (double) aTier) * mStorageFactor) + " Items", - new ITexture[0]); - } - - public GT_MetaTileEntity_ConnectableCrate(String aName, int aTier, String[] aDescription, - ITexture[][][] aTextures) { - super(aName, aTier, 3, aDescription, aTextures); - } - - @Override - public String[] getDescription() { - return org.apache.commons.lang3.ArrayUtils.add(this.mDescriptionArray, CORE.GT_Tooltip.get()); - } - - @Override - public boolean isSimpleMachine() { - return true; - } - - public boolean isFacingValid(ForgeDirection facing) { - return true; - } - - @Override - public boolean isAccessAllowed(EntityPlayer aPlayer) { - return true; - } - - @Override - public boolean isValidSlot(int aIndex) { - return true; - } - - @Override - public MetaTileEntity newMetaEntity(IGregTechTileEntity aTileEntity) { - return new GT_MetaTileEntity_ConnectableCrate(this.mName, this.mTier, this.mDescriptionArray, this.mTextures); - } - - public int getOppositeSide(int side) { - if (side == SIDE_Up) { - return SIDE_Down; - } else if (side == SIDE_Down) { - return SIDE_Up; - } else if (side == SIDE_XNeg) { - return SIDE_XPos; - } else if (side == SIDE_XPos) { - return SIDE_XNeg; - } else if (side == SIDE_ZNeg) { - return SIDE_ZPos; - } else { - return SIDE_ZNeg; - } - } - - public boolean calculateOwnershipIfConnected() { - if (mCurrentPos == null) { - mCurrentPos = new BlockPos( - this.getBaseMetaTileEntity().getXCoord(), - this.getBaseMetaTileEntity().getYCoord(), - this.getBaseMetaTileEntity().getZCoord(), - this.getBaseMetaTileEntity().getWorld()); - } - AutoMap n = mCurrentPos.getSurroundingBlocks(); - int p = 0; - for (BlockPos i : n) { - if (i != null) { - if (doesSideContainCrate(p)) { - GT_MetaTileEntity_ConnectableCrate yu = getCrateAtBlockPos(i); - if (yu != null) { - mNeighbourCache[p] = yu; - } - } - } - p++; - } - - int e4 = 0; - if (mNeighbourCache.length > 0) { - for (GT_MetaTileEntity_ConnectableCrate e : mNeighbourCache) { - this.mConnectedCount = this.mConnectedCache.size(); - if (e != null) { - // First, we check if this Crate is a Master, if not, continue checking what it is. - if (this.mIsMaster) { - // So this other Crate is also a master? Which is more Powerful - if (e.mIsMaster) { - // This crate holds more connected, it becomes master now. - if (this.mConnectedCount > e.mConnectedCount) { - e.mIsMaster = false; - e.mMasterCrateLocation = this.mCurrentPos; - if (!e.mIsConnected[getOppositeSide(e4)]) { - e.mIsConnected[getOppositeSide(e4)] = true; - } - if (!this.mIsConnected[e4]) { - this.mIsConnected[e4] = true; - } - this.mConnectedCache = ArrayUtils.mergeTwoMaps(this.mConnectedCache, e.mConnectedCache); - continue; - } - // Other crate held more connected, it is now master. - else { - this.mIsMaster = false; - this.mMasterCrateLocation = e.mCurrentPos; - if (!this.mIsConnected[e4]) { - this.mIsConnected[e4] = true; - } - if (!e.mIsConnected[getOppositeSide(e4)]) { - e.mIsConnected[getOppositeSide(e4)] = true; - } - e.mConnectedCache = ArrayUtils.mergeTwoMaps(e.mConnectedCache, this.mConnectedCache); - // Best wipe our cache of connected blocks then, since they no longer hold value. - mConnectedCache.clear(); - continue; - } - } - // Other Crate was not a Master, but we are, time to inherit it into our connection hivemind. - else { - // It would appear this controller has another master, time to query it. - if (e.mMasterCrateLocation != null && !e.mMasterCrateLocation.getUniqueIdentifier() - .equalsIgnoreCase(this.mMasterCrateLocation.getUniqueIdentifier())) { - GT_MetaTileEntity_ConnectableCrate gM = getCrateAtBlockPos(e.mMasterCrateLocation); - if (gM != null) { - // Lets compare controller strengths - int gM_Owned = gM.mConnectedCount; - // We are stronger, let's inherit it. - if (this.mConnectedCount > gM_Owned) { - e.mIsMaster = false; - e.mMasterCrateLocation = this.mCurrentPos; - gM.mIsMaster = false; - gM.mMasterCrateLocation = this.mCurrentPos; - if (!e.mIsConnected[getOppositeSide(e4)]) { - e.mIsConnected[getOppositeSide(e4)] = true; - } - if (!this.mIsConnected[e4]) { - this.mIsConnected[e4] = true; - } - this.mConnectedCache = ArrayUtils - .mergeTwoMaps(this.mConnectedCache, gM.mConnectedCache); - continue; - } - // We lost, time to submit to a new master crate - else { - this.mIsMaster = false; - this.mMasterCrateLocation = e.mMasterCrateLocation; - if (!this.mIsConnected[e4]) { - this.mIsConnected[e4] = true; - } - if (!e.mIsConnected[getOppositeSide(e4)]) { - e.mIsConnected[getOppositeSide(e4)] = true; - } - gM.mConnectedCache = ArrayUtils - .mergeTwoMaps(gM.mConnectedCache, this.mConnectedCache); - // Best wipe our cache of connected blocks then, since they no longer hold - // value. - mConnectedCache.clear(); - continue; - } - } else { - // Could not get the Tile Entity for the Other Master Crate.. Guess I can just - // ignore this case for now~ TODO - continue; - } - } - // Either the other crate has no known Master or it is already this crate. - else { - // The other crate has no master, time to inherit. - if (e.mMasterCrateLocation == null || (!e.mIsConnected[getOppositeSide(e4)])) { - e.mMasterCrateLocation = this.mCurrentPos; - if (!e.mIsConnected[getOppositeSide(e4)]) { - e.mIsConnected[getOppositeSide(e4)] = true; - } - if (!this.mIsConnected[e4]) { - this.mIsConnected[e4] = true; - } - mConnectedCache.put(e.mCurrentPos.getUniqueIdentifier()); - continue; - } else { - // Do nothing, we own this Crate already :) - continue; - } - } - } - } - - // We are not a Storage Master Crate, into a brave new world we go - else { - // Best wipe our cache of connected blocks then, since they no longer hold value. - mConnectedCache.clear(); - - // Dang, the other crate is a master, time to get incorporated. - if (e.mIsMaster) { - this.mIsMaster = false; - this.mMasterCrateLocation = e.mCurrentPos; - this.mIsConnected[e4] = true; - if (!e.mIsConnected[e4]) { - e.mIsConnected[e4] = true; - } - if (e.mMasterCrateLocation == null) { - e.mMasterCrateLocation = e.mCurrentPos; - } - e.mConnectedCache.put(this.mCurrentPos.getUniqueIdentifier()); - continue; - } - // So the Crate we Checked is not a Master, so let's see if it knows where one is - else { - // So, this Crate we have found knows about a master - if (e.mMasterCrateLocation != null) { - GT_MetaTileEntity_ConnectableCrate gM = getCrateAtBlockPos(e.mMasterCrateLocation); - // Found the master crate - if (gM != null) { - this.mIsMaster = false; - this.mMasterCrateLocation = e.mMasterCrateLocation; - if (!this.mIsConnected[e4]) { - this.mIsConnected[e4] = true; - } - if (!e.mIsConnected[getOppositeSide(e4)]) { - e.mIsConnected[getOppositeSide(e4)] = true; - } - gM.mConnectedCache.put(this.mCurrentPos.getUniqueIdentifier()); - continue; - } else { - // Could not get the Tile Entity for the Other Master Crate.. Guess I can just - // ignore this case for now~ TODO - continue; - } - } - // This crate has no master, not going to check if it's connected. - else { - this.mIsMaster = true; - this.mMasterCrateLocation = this.mCurrentPos; - e.mIsMaster = false; - e.mMasterCrateLocation = this.mCurrentPos; - if (!e.mIsConnected[getOppositeSide(e4)]) { - e.mIsConnected[getOppositeSide(e4)] = true; - } - if (!this.mIsConnected[e4]) { - this.mIsConnected[e4] = true; - } - mConnectedCache.put(e.mCurrentPos.getUniqueIdentifier()); - continue; - } - } - } - } - e4++; - } - return true; - } else { - return false; - } - } - - public boolean doesSideContainCrate(int side) { - return checkSideForDataType(0, side); - } - - public boolean isCrateAtSideController(int side) { - return checkSideForDataType(1, side); - } - - private boolean checkSideForDataType(int aType, int ordinalSide) { - BlockPos mPosToCheck = ordinalSide == SIDE_Up ? mCurrentPos.getUp() - : ordinalSide == SIDE_Down ? mCurrentPos.getDown() - : ordinalSide == SIDE_XPos ? mCurrentPos.getXPos() - : ordinalSide == SIDE_XNeg ? mCurrentPos.getXNeg() - : ordinalSide == SIDE_ZPos ? mCurrentPos.getZPos() : mCurrentPos.getZNeg(); - GT_MetaTileEntity_ConnectableCrate g = getCrateAtBlockPos(mPosToCheck); - if (g != null) { - if (aType == 0) { - return true; - } else { - if (g.mIsMaster) { - return true; - } - } - } - return false; - } - - public GT_MetaTileEntity_ConnectableCrate getCrateAtBlockPos(BlockPos pos) { - if (pos != null) { - Block b = pos.getBlockAtPos(); - int m = pos.getMetaAtPos(); - TileEntity t = pos.world.getTileEntity(pos.xPos, pos.yPos, pos.zPos); - if (b != null && t != null) { - if (b == GregTech_API.sBlockMachines && m == mCrateID) { - if (t instanceof IGregTechTileEntity) { - IGregTechTileEntity g = (IGregTechTileEntity) t; - final IMetaTileEntity aMetaTileEntity = g.getMetaTileEntity(); - if (aMetaTileEntity == null) { - return null; - } - if (aMetaTileEntity instanceof GT_MetaTileEntity_ConnectableCrate) { - return ((GT_MetaTileEntity_ConnectableCrate) aMetaTileEntity); - } - } - } - } - } - return null; - } - - @Override - public boolean onRightclick(IGregTechTileEntity aBaseMetaTileEntity, EntityPlayer aPlayer) { - GT_UIInfos.openGTTileEntityUI(aBaseMetaTileEntity, aPlayer); - return true; - } - - @Override - public void onPostTick(IGregTechTileEntity aBaseMetaTileEntity, long aTimer) { - if (this.getBaseMetaTileEntity().isServerSide() && this.getBaseMetaTileEntity().isAllowedToWork()) { - if (this.getItemCount() <= 0) { - this.mItemStack = null; - this.mItemCount = 0; - } - - if (this.mItemStack == null && this.mInventory[0] != null) { - this.mItemStack = this.mInventory[0].copy(); - } - - if (this.mInventory[0] != null && this.mItemCount < this.getMaxItemCount() - && GT_Utility.areStacksEqual(this.mInventory[0], this.mItemStack)) { - this.mItemCount += this.mInventory[0].stackSize; - if (this.mItemCount > this.getMaxItemCount()) { - this.mInventory[0].stackSize = this.mItemCount - this.getMaxItemCount(); - this.mItemCount = this.getMaxItemCount(); - } else { - this.mInventory[0] = null; - } - } - - if (this.mInventory[1] == null && this.mItemStack != null) { - this.mInventory[1] = this.mItemStack.copy(); - this.mInventory[1].stackSize = Math.min(this.mItemStack.getMaxStackSize(), this.mItemCount); - this.mItemCount -= this.mInventory[1].stackSize; - } else if (this.mItemCount > 0 && GT_Utility.areStacksEqual(this.mInventory[1], this.mItemStack) - && this.mInventory[1].getMaxStackSize() > this.mInventory[1].stackSize) { - int tmp = Math.min( - this.mItemCount, - this.mInventory[1].getMaxStackSize() - this.mInventory[1].stackSize); - this.mInventory[1].stackSize += tmp; - this.mItemCount -= tmp; - } - - if (this.mItemStack != null) { - this.mInventory[2] = this.mItemStack.copy(); - this.mInventory[2].stackSize = Math.min(this.mItemStack.getMaxStackSize(), this.mItemCount); - } else { - this.mInventory[2] = null; - } - } - } - - private int getItemCount() { - return this.mItemCount; - } - - @Override - public void setItemCount(int aCount) { - this.mItemCount = aCount; - } - - @Override - public int getProgresstime() { - return this.mItemCount + (this.mInventory[0] == null ? 0 : this.mInventory[0].stackSize) - + (this.mInventory[1] == null ? 0 : this.mInventory[1].stackSize); - } - - @Override - public int maxProgresstime() { - return this.getMaxItemCount(); - } - - @Override - public int getMaxItemCount() { - return (int) (Math.pow(6.0D, (double) this.mTier) * mStorageFactor - 128.0D); - } - - public boolean allowPullStack(IGregTechTileEntity aBaseMetaTileEntity, int aIndex, ForgeDirection side, - ItemStack aStack) { - return aIndex == 1; - } - - public boolean allowPutStack(IGregTechTileEntity aBaseMetaTileEntity, int aIndex, ForgeDirection side, - ItemStack aStack) { - return aIndex == 0 && (this.mInventory[0] == null || GT_Utility.areStacksEqual(this.mInventory[0], aStack)); - } - - @Override - public String[] getInfoData() { - return this.mItemStack == null - ? new String[] { "Super Storage Chest", "Stored Items:", "No Items", Integer.toString(0), - Integer.toString(this.getMaxItemCount()) } - : new String[] { "Super Storage Chest", "Stored Items:", this.mItemStack.getDisplayName(), - Integer.toString(this.mItemCount), Integer.toString(this.getMaxItemCount()) }; - } - - @Override - public boolean isGivingInformation() { - return true; - } - - @Override - public void saveNBTData(NBTTagCompound aNBT) { - aNBT.setInteger("mItemCount", this.mItemCount); - if (this.mItemStack != null) { - aNBT.setTag("mItemStack", this.mItemStack.writeToNBT(new NBTTagCompound())); - } - aNBT.setString("mMasterCrateLocation", mMasterCrateLocation.getUniqueIdentifier()); - aNBT.setBoolean("mIsMaster", mIsMaster); - for (int y = 0; y < this.mIsConnected.length; y++) { - aNBT.setBoolean("mIsConnected" + y, mIsConnected[y]); - } - aNBT.setInteger("mConnectedCount", mConnectedCount); - } - - @Override - public void loadNBTData(NBTTagCompound aNBT) { - if (aNBT.hasKey("mItemCount")) { - this.mItemCount = aNBT.getInteger("mItemCount"); - } - if (aNBT.hasKey("mItemStack")) { - this.mItemStack = ItemStack.loadItemStackFromNBT((NBTTagCompound) aNBT.getTag("mItemStack")); - } - if (aNBT.hasKey("mMasterCrateLocation")) { - this.mMasterCrateLocation = BlockPos.generateBlockPos(aNBT.getString("mMasterCrateLocation")); - } - if (aNBT.hasKey("mIsMaster")) { - this.mIsMaster = aNBT.getBoolean("mIsMaster"); - } - - for (int y = 0; y < this.mIsConnected.length; y++) { - if (aNBT.hasKey("mIsConnected" + y)) { - this.mIsConnected[y] = aNBT.getBoolean("mIsConnected" + y); - } - } - - if (aNBT.hasKey("mConnectedCount")) { - this.mConnectedCount = aNBT.getInteger("mConnectedCount"); - } - } - - public ITexture[] getTexture(IGregTechTileEntity aBaseMetaTileEntity, ForgeDirection side, ForgeDirection facing, - int aColorIndex, boolean aActive, boolean aRedstone) { - return aBaseMetaTileEntity.getFrontFacing() == ForgeDirection.DOWN && side == ForgeDirection.WEST - ? new ITexture[] { new GT_RenderedTexture(TexturesGtBlock.TEXTURE_CASING_AMAZON), - new GT_RenderedTexture(BlockIcons.OVERLAY_QCHEST) } - : (side == aBaseMetaTileEntity.getFrontFacing() - ? new ITexture[] { new GT_RenderedTexture(TexturesGtBlock.TEXTURE_CASING_AMAZON), - new GT_RenderedTexture(BlockIcons.OVERLAY_QCHEST) } - : new ITexture[] { new GT_RenderedTexture(TexturesGtBlock.TEXTURE_CASING_AMAZON) }); - } - - @Override - public ITexture[][][] getTextureSet(ITexture[] aTextures) { - return new ITexture[0][0][0]; - } - - @Override - public void onExplosion() { - // TODO Auto-generated method stub - super.onExplosion(); - } - - @Override - public void onRemoval() { - // TODO Auto-generated method stub - super.onRemoval(); - } - - @Override - public void onMachineBlockUpdate() { - // TODO Auto-generated method stub - super.onMachineBlockUpdate(); - } - - @Override - public boolean useModularUI() { - return true; - } - - @Override - public void addUIWidgets(ModularWindow.Builder builder, UIBuildContext buildContext) { - builder.widget( - new DrawableWidget().setDrawable(GT_UITextures.PICTURE_SCREEN_BLACK).setPos(7, 16).setSize(71, 45)) - .widget( - new SlotWidget(inventoryHandler, 0) - .setBackground(getGUITextureSet().getItemSlot(), GT_UITextures.OVERLAY_SLOT_IN) - .setPos(79, 16)) - .widget( - new SlotWidget(inventoryHandler, 1).setAccess(true, false) - .setBackground(getGUITextureSet().getItemSlot(), GT_UITextures.OVERLAY_SLOT_OUT) - .setPos(79, 52)) - .widget( - SlotWidget.phantom(inventoryHandler, 2).disableInteraction() - .setBackground(GT_UITextures.TRANSPARENT).setPos(59, 42)) - .widget(new TextWidget("Item Amount").setDefaultColor(COLOR_TEXT_WHITE.get()).setPos(10, 20)).widget( - TextWidget.dynamicString(() -> GT_Utility.parseNumberToString(mItemCount)) - .setDefaultColor(COLOR_TEXT_WHITE.get()).setPos(10, 30)); - } -} diff --git a/src/main/java/gtPlusPlus/xmod/gregtech/common/tileentities/storage/GregtechMetaSafeBlock.java b/src/main/java/gtPlusPlus/xmod/gregtech/common/tileentities/storage/GregtechMetaSafeBlock.java deleted file mode 100644 index 9e7b7d03e5..0000000000 --- a/src/main/java/gtPlusPlus/xmod/gregtech/common/tileentities/storage/GregtechMetaSafeBlock.java +++ /dev/null @@ -1,77 +0,0 @@ -package gtPlusPlus.xmod.gregtech.common.tileentities.storage; - -import org.apache.commons.lang3.ArrayUtils; - -import com.gtnewhorizons.modularui.api.screen.ModularWindow; -import com.gtnewhorizons.modularui.api.screen.UIBuildContext; -import com.gtnewhorizons.modularui.common.widget.ButtonWidget; -import com.gtnewhorizons.modularui.common.widget.FakeSyncWidget; -import com.gtnewhorizons.modularui.common.widget.SlotGroup; -import com.gtnewhorizons.modularui.common.widget.TextWidget; - -import gregtech.api.enums.Textures; -import gregtech.api.gui.modularui.GT_UITextures; -import gregtech.api.interfaces.ITexture; -import gregtech.api.interfaces.metatileentity.IMetaTileEntity; -import gregtech.api.interfaces.modularui.IAddUIWidgets; -import gregtech.api.interfaces.tileentity.IGregTechTileEntity; -import gregtech.api.objects.GT_RenderedTexture; -import gtPlusPlus.core.lib.CORE; -import gtPlusPlus.xmod.gregtech.api.gui.GTPP_UITextures; -import gtPlusPlus.xmod.gregtech.api.metatileentity.implementations.base.machines.GregtechMetaSafeBlockBase; - -public class GregtechMetaSafeBlock extends GregtechMetaSafeBlockBase implements IAddUIWidgets { - - public GregtechMetaSafeBlock(final int aID, final String aName, final String aNameRegional, final int aTier) { - super(aID, aName, aNameRegional, aTier, 28, "Protecting your items from sticky fingers."); - } - - public GregtechMetaSafeBlock(final String aName, final int aTier, final int aInvSlotCount, - final String[] aDescription, final ITexture[][][] aTextures) { - super(aName, aTier, aInvSlotCount, aDescription, aTextures); - } - - @Override - public String[] getDescription() { - return ArrayUtils.add(this.mDescriptionArray, CORE.GT_Tooltip.get()); - } - - @Override - public IMetaTileEntity newMetaEntity(final IGregTechTileEntity aTileEntity) { - return new GregtechMetaSafeBlock( - this.mName, - this.mTier, - this.mInventory.length, - this.mDescriptionArray, - this.mTextures); - } - - @Override - public ITexture getOverlayIcon() { - return new GT_RenderedTexture(Textures.BlockIcons.VOID); - } - - @Override - public boolean isValidSlot(final int aIndex) { - return aIndex < (this.mInventory.length - 1); - } - - @Override - public boolean useModularUI() { - return true; - } - - @Override - public void addUIWidgets(ModularWindow.Builder builder, UIBuildContext buildContext) { - builder.widget(SlotGroup.ofItemHandler(inventoryHandler, 9).endAtSlot(26).build().setPos(7, 4)) - .widget( - new ButtonWidget().setOnClick((clickData, widget) -> bUnbreakable = !bUnbreakable) - .setBackground(GT_UITextures.BUTTON_STANDARD, GTPP_UITextures.OVERLAY_BUTTON_LOCK) - .setPos(43, 62).setSize(18, 18)) - .widget(new TextWidget("Safe Status").setPos(76, 61)) - .widget( - TextWidget.dynamicString(() -> bUnbreakable ? "Locked" : "Unlocked").setSynced(false) - .setPos(82, 73)) - .widget(new FakeSyncWidget.BooleanSyncer(() -> bUnbreakable, val -> bUnbreakable = val)); - } -} diff --git a/src/main/java/gtPlusPlus/xmod/gregtech/common/tileentities/storage/shelving/GT4Entity_Shelf.java b/src/main/java/gtPlusPlus/xmod/gregtech/common/tileentities/storage/shelving/GT4Entity_Shelf.java deleted file mode 100644 index aeea5b33e8..0000000000 --- a/src/main/java/gtPlusPlus/xmod/gregtech/common/tileentities/storage/shelving/GT4Entity_Shelf.java +++ /dev/null @@ -1,365 +0,0 @@ -package gtPlusPlus.xmod.gregtech.common.tileentities.storage.shelving; - -import net.minecraft.entity.item.EntityItem; -import net.minecraft.entity.player.EntityPlayer; -import net.minecraft.item.ItemStack; -import net.minecraft.nbt.NBTTagCompound; -import net.minecraftforge.common.util.ForgeDirection; - -import org.apache.commons.lang3.ArrayUtils; - -import gregtech.api.interfaces.ITexture; -import gregtech.api.interfaces.tileentity.IGregTechTileEntity; -import gregtech.api.metatileentity.MetaTileEntity; -import gregtech.api.metatileentity.implementations.GT_MetaTileEntity_BasicHull_NonElectric; -import gregtech.api.objects.GT_ItemStack; -import gregtech.api.objects.GT_RenderedTexture; -import gregtech.api.util.GT_Utility; -import gregtech.common.items.GT_MetaGenerated_Tool_01; -import gtPlusPlus.core.util.Utils; -import gtPlusPlus.core.util.math.MathUtils; -import gtPlusPlus.core.util.minecraft.PlayerUtils; -import gtPlusPlus.core.util.sys.KeyboardUtils; -import gtPlusPlus.xmod.gregtech.common.blocks.textures.TexturesGtBlock; -import gtPlusPlus.xmod.gregtech.common.blocks.textures.TexturesGtBlock.CustomIcon; - -public class GT4Entity_Shelf extends GT_MetaTileEntity_BasicHull_NonElectric { - - public byte mType = 0; - public boolean mLocked = false; - protected byte mIndex = (byte) MathUtils.randInt(1, 3); - public static GT_RenderedTexture texBottom = new GT_RenderedTexture( - new CustomIcon("TileEntities/gt4/machine_bottom")); - public static GT_RenderedTexture texTop = new GT_RenderedTexture(new CustomIcon("TileEntities/gt4/machine_top")); - public static GT_RenderedTexture texSide = new GT_RenderedTexture(new CustomIcon("TileEntities/gt4/machine_side")); - public static GT_RenderedTexture texSideCabinet = new GT_RenderedTexture( - new CustomIcon("TileEntities/gt4/machine_side_cabinet")); - - public GT4Entity_Shelf(final int aID, final String aName, final String aNameRegional, final String aDescription) { - super(aID, aName, aNameRegional, 0, aDescription); - } - - public GT4Entity_Shelf(final String aName, final String[] aDescription, final ITexture[][][] aTextures) { - super(aName, 0, aDescription, aTextures); - } - - @Override - public boolean isSimpleMachine() { - return true; - } - - @Override - public boolean isFacingValid(ForgeDirection facing) { - return facing.offsetY == 0; - } - - @Override - public boolean isAccessAllowed(EntityPlayer aPlayer) { - if (this.getBaseMetaTileEntity().getOwnerName().equalsIgnoreCase(aPlayer.getDisplayName())) { - return true; - } - PlayerUtils.messagePlayer( - aPlayer, - "This container belongs to " + this.getBaseMetaTileEntity().getOwnerName() + "."); - return false; - } - - @Override - public boolean ownerControl() { - return false; - } - - @Override - public boolean isEnetOutput() { - return false; - } - - @Override - public boolean isEnetInput() { -