diff options
Diffstat (limited to 'src/main/java/gtPlusPlus/xmod/gregtech/api')
7 files changed, 5 insertions, 927 deletions
diff --git a/src/main/java/gtPlusPlus/xmod/gregtech/api/enums/GregtechItemList.java b/src/main/java/gtPlusPlus/xmod/gregtech/api/enums/GregtechItemList.java index f7fc2712ce..90fd1e2358 100644 --- a/src/main/java/gtPlusPlus/xmod/gregtech/api/enums/GregtechItemList.java +++ b/src/main/java/gtPlusPlus/xmod/gregtech/api/enums/GregtechItemList.java @@ -31,35 +31,27 @@ public enum GregtechItemList implements GregtechItemContainer { Electric_Motor_LuV, Electric_Motor_ZPM, Electric_Motor_UV, - Electric_Motor_MAX, Electric_Pump_LuV, Electric_Pump_ZPM, Electric_Pump_UV, - Electric_Pump_MAX, Conveyor_Module_LuV, Conveyor_Module_ZPM, Conveyor_Module_UV, - Conveyor_Module_MAX, Electric_Piston_LuV, Electric_Piston_ZPM, Electric_Piston_UV, - Electric_Piston_MAX, Robot_Arm_LuV, Robot_Arm_ZPM, Robot_Arm_UV, - Robot_Arm_MAX, Field_Generator_LuV, Field_Generator_ZPM, Field_Generator_UV, - Field_Generator_MAX, Emitter_LuV, Emitter_ZPM, Emitter_UV, - Emitter_MAX, Sensor_LuV, Sensor_ZPM, Sensor_UV, - Sensor_MAX, // ULV Components Electric_Motor_ULV, @@ -179,10 +171,6 @@ public enum GregtechItemList implements GregtechItemContainer { Compressed_Fusion_Reactor, // Carbon Materials - NanoTube_Base_Substrate, - NanoTube_Finished, - Carbyne_Tube_Finished, - Carbyne_Sheet_Finished, // End Game Laser Engraver Lens Laser_Lens_WoodsGlass, @@ -198,13 +186,6 @@ public enum GregtechItemList implements GregtechItemContainer { // Pellet Mold Pellet_Mold, - // Charged Items for Tree Farms - Farm_Processor_EV, - Farm_Processor_IV, - Farm_Processor_LuV, - Farm_Processor_ZPM, - Farm_Processor_UV, - // Upgrade chip for Distillus Distillus_Upgrade_Chip, Maceration_Upgrade_Chip, @@ -532,9 +513,6 @@ public enum GregtechItemList implements GregtechItemContainer { // Standard Turbine Rotor Hatch Hatch_Input_TurbineHousing, - // Control Core - Hatch_Control_Core, - // Milling Ball Bus Bus_Milling_Balls, @@ -555,9 +533,6 @@ public enum GregtechItemList implements GregtechItemContainer { Hatch_Input_Elemental_Duplicator, // RTG Hatch - Hatch_RTG_LV, - Hatch_RTG_MV, - Hatch_RTG_HV, // Battery hatches for PSS Hatch_Input_Battery_MV, @@ -709,7 +684,6 @@ public enum GregtechItemList implements GregtechItemContainer { // Debug machine Pollution_Creator, - Garbage_Collector_Debug_Machine, // Basically is an automatic Cauldron SimpleDustWasher_ULV, @@ -764,8 +738,6 @@ public enum GregtechItemList implements GregtechItemContainer { GT_Solar_UV, GT_Solar_MAX, - // 512v Creative Buffer - Energy_Buffer_CREATIVE, // Variable voltage RF convertor Energy_Buffer_RF_Convertor, // Energy Buffers @@ -795,31 +767,11 @@ public enum GregtechItemList implements GregtechItemContainer { // The max Steam condenser Condensor_MAX, - // Player owned Safes - GT_Safe_ULV, - GT_Safe_LV, - GT_Safe_MV, - GT_Safe_HV, - GT_Safe_EV, - GT_Safe_IV, - GT_Safe_LuV, - GT_Safe_ZPM, - GT_Safe_UV, - GT_Safe_MAX, - // Rocket Engines Rocket_Engine_EV, Rocket_Engine_IV, Rocket_Engine_LuV, - // GT4 Shelves - GT4_Shelf, - GT4_Shelf_Iron, - GT4_Shelf_FileCabinet, - GT4_Shelf_Desk, - GT4_Shelf_Compartment, - GT4_Shelf_Large, - // Hi Amp Transformers Transformer_HA_LV_ULV, Transformer_HA_MV_LV, diff --git a/src/main/java/gtPlusPlus/xmod/gregtech/api/enums/GregtechOrePrefixes.java b/src/main/java/gtPlusPlus/xmod/gregtech/api/enums/GregtechOrePrefixes.java index 695474e5ec..61abc48a18 100644 --- a/src/main/java/gtPlusPlus/xmod/gregtech/api/enums/GregtechOrePrefixes.java +++ b/src/main/java/gtPlusPlus/xmod/gregtech/api/enums/GregtechOrePrefixes.java @@ -90,8 +90,6 @@ public enum GregtechOrePrefixes { type2("16x Wires", "16x ", " Wire", true, true, false, false, false, false, true, false, false, false, 0, M * 8, 64, -1), - toolSkookumChoocher("Skookum Choocher", "", " Skookum Choocher", true, true, false, false, false, false, true, true, - false, false, B[6], M * 6, 16, 37), // consisting out of 6 Ingots. toolAngleGrinder("Angle Grinder", "", "Angle Grinder", true, true, false, false, false, false, true, true, false, false, B[6], M * 6, 16, 37), // consisting out of 6 Ingots. toolElectricSnips("Electric Snips", "", "Electric Snips", true, true, false, false, false, false, true, true, false, diff --git a/src/main/java/gtPlusPlus/xmod/gregtech/api/enums/GregtechToolDictNames.java b/src/main/java/gtPlusPlus/xmod/gregtech/api/enums/GregtechToolDictNames.java index bae91b53fe..0a116b1b9f 100644 --- a/src/main/java/gtPlusPlus/xmod/gregtech/api/enums/GregtechToolDictNames.java +++ b/src/main/java/gtPlusPlus/xmod/gregtech/api/enums/GregtechToolDictNames.java @@ -1,7 +1,6 @@ package gtPlusPlus.xmod.gregtech.api.enums; public enum GregtechToolDictNames { - craftingToolSkookumChoocher, craftingToolHandPump, craftingToolAngleGrinder, craftingToolElectricSnips, diff --git a/src/main/java/gtPlusPlus/xmod/gregtech/api/metatileentity/implementations/GT_MetaTileEntity_Hatch_ControlCore.java b/src/main/java/gtPlusPlus/xmod/gregtech/api/metatileentity/implementations/GT_MetaTileEntity_Hatch_ControlCore.java deleted file mode 100644 index e85cc1f6c2..0000000000 --- a/src/main/java/gtPlusPlus/xmod/gregtech/api/metatileentity/implementations/GT_MetaTileEntity_Hatch_ControlCore.java +++ /dev/null @@ -1,166 +0,0 @@ -package gtPlusPlus.xmod.gregtech.api.metatileentity.implementations; - -import net.minecraft.entity.player.EntityPlayer; -import net.minecraft.item.ItemStack; -import net.minecraft.tileentity.TileEntity; -import net.minecraftforge.common.util.ForgeDirection; - -import org.apache.commons.lang3.ArrayUtils; - -import com.gtnewhorizons.modularui.api.screen.ModularWindow; -import com.gtnewhorizons.modularui.api.screen.UIBuildContext; - -import gregtech.api.gui.modularui.GT_UIInfos; -import gregtech.api.interfaces.ITexture; -import gregtech.api.interfaces.tileentity.IGregTechTileEntity; -import gregtech.api.metatileentity.MetaTileEntity; -import gregtech.api.metatileentity.implementations.GT_MetaTileEntity_Hatch; -import gregtech.api.objects.GT_RenderedTexture; -import gregtech.api.util.GT_Recipe.GT_Recipe_Map; -import gregtech.api.util.GT_Utility; -import gtPlusPlus.api.objects.minecraft.BlockPos; -import gtPlusPlus.core.item.general.ItemControlCore; -import gtPlusPlus.core.lib.CORE; -import gtPlusPlus.xmod.gregtech.common.blocks.textures.TexturesGtBlock; - -public class GT_MetaTileEntity_Hatch_ControlCore extends GT_MetaTileEntity_Hatch { - - public GT_Recipe_Map mRecipeMap = null; - - public BlockPos mControllerLocation; - - public GT_MetaTileEntity_Hatch_ControlCore(int aID, String aName, String aNameRegional, int aTier) { - super( - aID, - aName, - aNameRegional, - aTier, - getSlots(aTier), - "Core determines maximum tier machine will operate at"); - } - - public GT_MetaTileEntity_Hatch_ControlCore(String aName, int aTier, String aDescription, ITexture[][][] aTextures) { - super(aName, aTier, aTier < 1 ? 1 : aTier == 1 ? 4 : aTier == 2 ? 9 : 16, aDescription, aTextures); - } - - public GT_MetaTileEntity_Hatch_ControlCore(String aName, int aTier, String[] aDescription, - ITexture[][][] aTextures) { - super(aName, aTier, aTier < 1 ? 1 : aTier == 1 ? 4 : aTier == 2 ? 9 : 16, aDescription[0], aTextures); - } - - @Override - public String[] getDescription() { - return ArrayUtils.add(this.mDescriptionArray, CORE.GT_Tooltip.get()); - } - - @Override - public ITexture[] getTexturesActive(ITexture aBaseTexture) { - return new ITexture[] { aBaseTexture, new GT_RenderedTexture(TexturesGtBlock.Overlay_Hatch_Control_Core) }; - } - - @Override - public ITexture[] getTexturesInactive(ITexture aBaseTexture) { - return new ITexture[] { aBaseTexture, new GT_RenderedTexture(TexturesGtBlock.Overlay_Hatch_Control_Core) }; - } - - @Override - public boolean isSimpleMachine() { - return true; - } - - @Override - 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_Hatch_ControlCore(mName, mTier, mDescriptionArray, mTextures); - } - - @Override - public boolean onRightclick(IGregTechTileEntity aBaseMetaTileEntity, EntityPlayer aPlayer) { - GT_UIInfos.openGTTileEntityUI(aBaseMetaTileEntity, aPlayer); - return true; - } - - @Override - public void onPostTick(IGregTechTileEntity aBaseMetaTileEntity, long aTimer) { - if (aBaseMetaTileEntity.isServerSide() && aBaseMetaTileEntity.hasInventoryBeenModified()) { - fillStacksIntoFirstSlots(); - } - } - - public void updateSlots() { - for (int i = 0; i < mInventory.length; i++) - if (mInventory[i] != null && mInventory[i].stackSize <= 0) mInventory[i] = null; - fillStacksIntoFirstSlots(); - } - - protected void fillStacksIntoFirstSlots() { - for (int i = 0; i < mInventory.length; i++) - for (int j = i + 1; j < mInventory.length; j++) if (mInventory[j] != null - && (mInventory[i] == null || GT_Utility.areStacksEqual(mInventory[i], mInventory[j]))) { - GT_Utility.moveStackFromSlotAToSlotB( - getBaseMetaTileEntity(), - getBaseMetaTileEntity(), - j, - i, - (byte) 64, - (byte) 1, - (byte) 64, - (byte) 1); - } - } - - @Override - public boolean allowPullStack(IGregTechTileEntity aBaseMetaTileEntity, int aIndex, ForgeDirection side, - ItemStack aStack) { - return false; - } - - @Override - public boolean allowPutStack(IGregTechTileEntity aBaseMetaTileEntity, int aIndex, ForgeDirection side, - ItemStack aStack) { - return side == getBaseMetaTileEntity().getFrontFacing() - && (aStack != null && aStack.getItem() instanceof ItemControlCore); - } - - public boolean setOwner(TileEntity aTileEntity) { - if (mControllerLocation != null) { - return false; - } else { - mControllerLocation = new BlockPos(aTileEntity); - return true; - } - } - - public boolean setOwner(IGregTechTileEntity aTileEntity) { - if (mControllerLocation != null) { - return false; - } else { - mControllerLocation = new BlockPos(aTileEntity); - return true; - } - } - - @Override - public boolean useModularUI() { - return true; - } - - @Override - public void addUIWidgets(ModularWindow.Builder builder, UIBuildContext buildContext) { - getBaseMetaTileEntity().add1by1Slot(builder); - } -} diff --git a/src/main/java/gtPlusPlus/xmod/gregtech/api/metatileentity/implementations/GT_MetaTileEntity_Hatch_Energy_RTG.java b/src/main/java/gtPlusPlus/xmod/gregtech/api/metatileentity/implementations/GT_MetaTileEntity_Hatch_Energy_RTG.java deleted file mode 100644 index 3fd3c7a82b..0000000000 --- a/src/main/java/gtPlusPlus/xmod/gregtech/api/metatileentity/implementations/GT_MetaTileEntity_Hatch_Energy_RTG.java +++ /dev/null @@ -1,289 +0,0 @@ -package gtPlusPlus.xmod.gregtech.api.metatileentity.implementations; - -import static gregtech.api.enums.GT_Values.V; - -import java.util.HashMap; - -import net.minecraft.entity.player.EntityPlayer; -import net.minecraft.item.Item; -import net.minecraft.item.ItemStack; -import net.minecraft.nbt.NBTTagCompound; -import net.minecraftforge.common.util.ForgeDirection; - -import com.gtnewhorizons.modularui.api.screen.ModularWindow; -import com.gtnewhorizons.modularui.api.screen.UIBuildContext; - -import gregtech.api.gui.modularui.GT_UIInfos; -import gregtech.api.interfaces.ITexture; -import gregtech.api.interfaces.tileentity.IGregTechTileEntity; -import gregtech.api.metatileentity.MetaTileEntity; -import gregtech.api.metatileentity.implementations.GT_MetaTileEntity_Hatch_Energy; -import gregtech.api.util.GT_Utility; -import gtPlusPlus.api.objects.Logger; -import gtPlusPlus.core.lib.CORE; -import gtPlusPlus.core.util.minecraft.InventoryUtils; -import gtPlusPlus.core.util.minecraft.ItemUtils; -import gtPlusPlus.xmod.gregtech.common.blocks.textures.TexturesGtBlock; - -public class GT_MetaTileEntity_Hatch_Energy_RTG extends GT_MetaTileEntity_Hatch_Energy { - - public GT_MetaTileEntity_Hatch_Energy_RTG(int aID, String aName, String aNameRegional, int aTier, - int aInvSlotCount) { - super( - aID, - aName, - aNameRegional, - aTier, - aInvSlotCount, - new String[] { "Energy Injector for Multiblocks", "Accepts up to 2 Amps" }); - } - - public GT_MetaTileEntity_Hatch_Energy_RTG(String aName, int aTier, int aInvSlotCount, String[] aDescription, - ITexture[][][] aTextures) { - super(aName, aTier, aInvSlotCount, aDescription, aTextures); - } - - @Override - public String[] getDescription() { - String[] S = super.getDescription(); - final String[] desc = new String[S.length + 1]; - System.arraycopy(S, 0, desc, 0, S.length); - desc[S.length] = CORE.GT_Tooltip.get(); - return desc; - } - - @Override - public ITexture[] getTexturesActive(ITexture aBaseTexture) { - return new ITexture[] { aBaseTexture, TexturesGtBlock - .getTextureFromIcon(TexturesGtBlock.Overlay_Hatch_RTG_On, new short[] { 220, 220, 220, 0 }) }; - } - - @Override - public ITexture[] getTexturesInactive(ITexture aBaseTexture) { - return new ITexture[] { aBaseTexture, TexturesGtBlock - .getTextureFromIcon(TexturesGtBlock.Overlay_Hatch_RTG_Off, new short[] { 220, 220, 220, 0 }) }; - } - - @Override - public boolean isSimpleMachine() { - return true; - } - - @Override - public boolean isFacingValid(ForgeDirection facing) { - return true; - } - - @Override - public boolean isAccessAllowed(EntityPlayer aPlayer) { - return true; - } - - @Override - public boolean isEnetInput() { - return false; - } - - @Override - public boolean isInputFacing(ForgeDirection side) { - return side == getBaseMetaTileEntity().getFrontFacing(); - } - - @Override - public boolean isValidSlot(int aIndex) { - return true; - } - - @Override - public long getMinimumStoredEU() { - return 0; - } - - @Override - public long maxEUInput() { - return V[mTier]; - } - - @Override - public long maxEUStore() { - return Long.MAX_VALUE / (Short.MAX_VALUE * Byte.MAX_VALUE); - } - - @Override - public long maxAmperesIn() { - return 0; - } - - @Override - public MetaTileEntity newMetaEntity(IGregTechTileEntity aTileEntity) { - return new GT_MetaTileEntity_Hatch_Energy_RTG(mName, mTier, 9, mDescriptionArray, mTextures); - } - - @Override - public boolean allowPullStack(IGregTechTileEntity aBaseMetaTileEntity, int aIndex, ForgeDirection side, - ItemStack aStack) { - return false; - } - - @Override - public boolean allowPutStack(IGregTechTileEntity aBaseMetaTileEntity, int aIndex, ForgeDirection side, - ItemStack aStack) { - return true; - } - - @Override - public boolean onRightclick(IGregTechTileEntity aBaseMetaTileEntity, EntityPlayer aPlayer) { - GT_UIInfos.openGTTileEntityUI(aBaseMetaTileEntity, aPlayer); - return true; - } - - private static class Dat { - - protected final String mUniqueDataTag; - private final ItemStack mStack; - private final NBTTagCompound mNBT; - - public Dat(ItemStack aStack) { - mStack = aStack; - mNBT = (aStack.getTagCompound() != null ? aStack.getTagCompound() : new NBTTagCompound()); - mUniqueDataTag = "" + Item - .getIdFromItem(aStack.getItem()) + "" + aStack.getItemDamage() + "" + 1 + "" + mNBT.getId(); - } - - public int getKey() { - return Item.getIdFromItem(mStack.getItem()) + mStack.getItemDamage(); - } - } - - private static final HashMap<String, ItemStack> mFuelInstanceMap = new HashMap<String, ItemStack>(); - private static final HashMap<String, Long> mFuelValueMap = new HashMap<String, Long>(); - private static final HashMap<String, Integer> mFuelTypeMap = new HashMap<String, Integer>(); - private static final HashMap<Integer, String> mFuelTypeMapReverse = new HashMap<Integer, String>(); - - public static boolean registerPelletForHatch(ItemStack aStack, long aFuelValue) { - if (!ItemUtils.checkForInvalidItems(aStack)) { - return false; - } - ItemStack aTemp = aStack.copy(); - aTemp.stackSize = 1; - Dat aDat = new Dat(aTemp); - String aKey = aDat.mUniqueDataTag; - mFuelInstanceMap.put(aKey, aTemp); - mFuelValueMap.put(aKey, aFuelValue); - mFuelTypeMap.put(aKey, aDat.getKey()); - mFuelTypeMapReverse.put(aDat.getKey(), aKey); - Logger.INFO( - "RTG Hatch: Registered Fuel Pellet: " + ItemUtils.getItemName( - aTemp) + ", Fuel Value: " + aFuelValue + ", Key: " + aKey + ", Key2: " + aDat.getKey()); - return true; - } - - @Override - public void onPostTick(IGregTechTileEntity aBaseMetaTileEntity, long aTimer) { - if (aBaseMetaTileEntity.isServerSide() && aBaseMetaTileEntity.hasInventoryBeenModified()) { - InventoryUtils.sortInventoryItems(this); - } - if (aTimer % 100 == 0 && aBaseMetaTileEntity.isServerSide()) { - if (hasPellet(this)) { - Logger.INFO("Has Pellet"); - tryConsumePellet(this); - } - } - } - - private static void tryConsumePellet(GT_MetaTileEntity_Hatch_Energy_RTG aTile) { - ItemStack aPellet = getPelletToConsume(aTile); - if (aPellet != null) { - Logger.INFO("Found Pellet"); - long aFuel = getFuelValueOfPellet(aPellet); - if (aFuel > 0) { - Logger.INFO("Has Fuel Value: " + aFuel); - if (hasSpaceForEnergy(aTile, aFuel)) { - Logger.INFO("Can buffer"); - aPellet.stackSize = 0; - Logger.INFO("Stack set to 0"); - aPellet = null; - Logger.INFO("null stack"); - addEnergyToInternalStorage(aTile, aFuel); - Logger.INFO("Consumed"); - } - } - } - aTile.updateSlots(); - Logger.INFO("updating slots"); - } - - private static void addEnergyToInternalStorage(GT_MetaTileEntity_Hatch_Energy_RTG aTile, long aFuel) { - aTile.getBaseMetaTileEntity().increaseStoredEnergyUnits(aFuel, true); - } - - public static boolean hasSpaceForEnergy(GT_MetaTileEntity_Hatch_Energy_RTG aTile, long aAmount) { - long aMax = aTile.maxEUStore(); - long aCurrent = aTile.getEUVar(); - if ((aMax - aCurrent) >= aAmount) { - return true; - } - return false; - } - - public void updateSlots() { - for (int i = 0; i < mInventory.length; i++) { - if (mInventory[i] != null && mInventory[i].stackSize <= 0) { - mInventory[i] = null; - } - } - InventoryUtils.sortInventoryItems(this); - } - - public static boolean hasPellet(GT_MetaTileEntity_Hatch_Energy_RTG aTile) { - for (ItemStack o : aTile.mInventory) { - if (o != null) { - for (ItemStack i : mFuelInstanceMap.values()) { - if (GT_Utility.areStacksEqual(o, i)) { - return true; - } - } - } - } - return false; - } - - public static String getPelletType(ItemStack o) { - if (o == null) { - return "error"; - } - Dat aDat = new Dat(o); - return mFuelTypeMapReverse.get(aDat.getKey()); - } - - public static long getFuelValueOfPellet(ItemStack aPellet) { - String aType = getPelletType(aPellet); - if (mFuelValueMap.containsKey(aType)) { - return mFuelValueMap.get(aType); - } - return 0; - } - - public static ItemStack getPelletToConsume(GT_MetaTileEntity_Hatch_Energy_RTG aTile) { - for (ItemStack o : aTile.mInventory) { - if (o != null) { - for (ItemStack i : mFuelInstanceMap.values()) { - if (GT_Utility.areStacksEqual(o, i)) { - return o; - } - } - } - } - return null; - } - - @Override - public boolean useModularUI() { - return true; - } - - @Override - public void addUIWidgets(ModularWindow.Builder builder, UIBuildContext buildContext) { - getBaseMetaTileEntity().add3by3Slots(builder); - } -} diff --git a/src/main/java/gtPlusPlus/xmod/gregtech/api/metatileentity/implementations/base/GregtechMeta_MultiBlockBase.java b/src/main/java/gtPlusPlus/xmod/gregtech/api/metatileentity/implementations/base/GregtechMeta_MultiBlockBase.java index 3c567db889..194729a4a2 100644 --- a/src/main/java/gtPlusPlus/xmod/gregtech/api/metatileentity/implementations/base/GregtechMeta_MultiBlockBase.java +++ b/src/main/java/gtPlusPlus/xmod/gregtech/api/metatileentity/implementations/base/GregtechMeta_MultiBlockBase.java @@ -83,7 +83,6 @@ import gtPlusPlus.core.util.reflect.ReflectionUtils; import gtPlusPlus.preloader.CORE_Preloader; import gtPlusPlus.preloader.asm.AsmConfig; import gtPlusPlus.xmod.gregtech.api.metatileentity.implementations.GT_MetaTileEntity_Hatch_AirIntake; -import gtPlusPlus.xmod.gregtech.api.metatileentity.implementations.GT_MetaTileEntity_Hatch_ControlCore; import gtPlusPlus.xmod.gregtech.api.metatileentity.implementations.GT_MetaTileEntity_Hatch_InputBattery; import gtPlusPlus.xmod.gregtech.api.metatileentity.implementations.GT_MetaTileEntity_Hatch_OutputBattery; import gtPlusPlus.xmod.gregtech.api.metatileentity.implementations.GT_MetaTileEntity_Hatch_Steam_BusInput; @@ -102,7 +101,6 @@ public abstract class GregtechMeta_MultiBlockBase<T extends GT_MetaTileEntity_Ex public GT_Recipe mLastRecipe; protected long mTotalRunTime = 0; - public ArrayList<GT_MetaTileEntity_Hatch_ControlCore> mControlCoreBus = new ArrayList<>(); /** * Don't use this for recipe input check, otherwise you'll get duplicated fluids */ @@ -168,7 +166,8 @@ public abstract class GregtechMeta_MultiBlockBase<T extends GT_MetaTileEntity_Ex long seconds = (this.mTotalRunTime / 20); int weeks = (int) (TimeUnit.SECONDS.toDays(seconds) / 7); int days = (int) (TimeUnit.SECONDS.toDays(seconds) - 7 * weeks); - long hours = TimeUnit.SECONDS.toHours(seconds) - TimeUnit.DAYS.toHours(days) - TimeUnit.DAYS.toHours(7 * weeks); + long hours = TimeUnit.SECONDS.toHours(seconds) - TimeUnit.DAYS.toHours(days) + - TimeUnit.DAYS.toHours(7L * weeks); long minutes = TimeUnit.SECONDS.toMinutes(seconds) - (TimeUnit.SECONDS.toHours(seconds) * 60); long second = TimeUnit.SECONDS.toSeconds(seconds) - (TimeUnit.SECONDS.toMinutes(seconds) * 60); @@ -179,11 +178,11 @@ public abstract class GregtechMeta_MultiBlockBase<T extends GT_MetaTileEntity_Ex mInfo.add( StatCollector.translateToLocal("GTPP.multiblock.progress") + ": " + EnumChatFormatting.GREEN - + Integer.toString(mProgresstime / 20) + + mProgresstime / 20 + EnumChatFormatting.RESET + " s / " + EnumChatFormatting.YELLOW - + Integer.toString(mMaxProgresstime / 20) + + mMaxProgresstime / 20 + EnumChatFormatting.RESET + " s"); @@ -272,15 +271,6 @@ public abstract class GregtechMeta_MultiBlockBase<T extends GT_MetaTileEntity_Ex + " %"); } - if (this.mControlCoreBus.size() > 0) { - int tTier = this.getControlCoreTier(); - mInfo.add( - StatCollector.translateToLocal("GTPP.CC.machinetier") + ": " - + EnumChatFormatting.GREEN - + tTier - + EnumChatFormatting.RESET); - } - mInfo.add( StatCollector.translateToLocal("GTPP.CC.parallel") + ": " + EnumChatFormatting.GREEN @@ -448,7 +438,6 @@ public abstract class GregtechMeta_MultiBlockBase<T extends GT_MetaTileEntity_Ex if (this.mUpdate == 1 || this.mStartUpCheck == 1) { this.mChargeHatches.clear(); this.mDischargeHatches.clear(); - this.mControlCoreBus.clear(); this.mAirIntakes.clear(); this.mTecTechEnergyHatches.clear(); this.mTecTechDynamoHatches.clear(); @@ -563,15 +552,6 @@ public abstract class GregtechMeta_MultiBlockBase<T extends GT_MetaTileEntity_Ex super.updateSlots(); } - public boolean isToolCreative(ItemStack mStack) { - Materials t1 = GT_MetaGenerated_Tool.getPrimaryMaterial(mStack); - Materials t2 = GT_MetaGenerated_Tool.getSecondaryMaterial(mStack); - if (t1 == Materials._NULL && t2 == Materials._NULL) { - return true; - } - return false; - } - /** * Causes a Random Maint. Issue. * @@ -705,59 +685,6 @@ public abstract class GregtechMeta_MultiBlockBase<T extends GT_MetaTileEntity_Ex return false; } - public int getControlCoreTier() { - - // Always return best tier if config is off. - /* - * boolean aCoresConfig = gtPlusPlus.core.lib.CORE.ConfigSwitches.requireControlCores; if (!aCoresConfig) { - * return 10; } - */ - - if (mControlCoreBus.isEmpty()) { - log("No Control Core Modules Found."); - return 0; - } - GT_MetaTileEntity_Hatch_ControlCore i = getControlCoreBus(); - if (i != null) { - ItemStack x = i.mInventory[0]; - if (x != null) { - return x.getItemDamage(); - } - } - log("Control Core Module was null."); - return 0; - } - - public GT_MetaTileEntity_Hatch_ControlCore getControlCoreBus() { - if (this.mControlCoreBus == null || this.mControlCoreBus.isEmpty()) { - return null; - } - GT_MetaTileEntity_Hatch_ControlCore x = this.mControlCoreBus.get(0); - if (x != null) { - log("getControlCore(ok)"); - return x; - } - log("getControlCore(bad)"); - return null; - } - - // mControlCoreBus - public boolean addControlCoreToMachineList(final IGregTechTileEntity aTileEntity, final int aBaseCasingIndex) { - if (!mControlCoreBus.isEmpty()) { - log("Tried to add a secondary control core module."); - return false; - } - GT_MetaTileEntity_Hatch_ControlCore Module = (GT_MetaTileEntity_Hatch_ControlCore) getMetaTileEntity( - aTileEntity); - if (Module != null) { - if (Module.setOwner(aTileEntity)) { - log("Adding control core module."); - return addToMachineListInternal(mControlCoreBus, Module, aBaseCasingIndex); - } - } - return false; - } - private IMetaTileEntity getMetaTileEntity(final IGregTechTileEntity aTileEntity) { if (aTileEntity == null) { return null; @@ -780,14 +707,7 @@ public abstract class GregtechMeta_MultiBlockBase<T extends GT_MetaTileEntity_Ex boolean aDidAdd = false; // Handle Custom Hatches - if (aMetaTileEntity instanceof GT_MetaTileEntity_Hatch_ControlCore) { - log("Found GT_MetaTileEntity_Hatch_ControlCore"); - if (!mControlCoreBus.isEmpty()) { - log("Tried to add a secondary control core module."); - return false; - } - aDidAdd = addToMachineListInternal(this.mControlCoreBus, aMetaTileEntity, aBaseCasingIndex); - } else if (aMetaTileEntity instanceof GT_MetaTileEntity_Hatch_InputBattery) { + if (aMetaTileEntity instanceof GT_MetaTileEntity_Hatch_InputBattery) { log("Found GT_MetaTileEntity_Hatch_InputBattery"); aDidAdd = addToMachineListInternal(mChargeHatches, aMetaTileEntity, aBaseCasingIndex); } else if (aMetaTileEntity instanceof GT_MetaTileEntity_Hatch_OutputBattery) { @@ -1782,14 +1702,6 @@ public abstract class GregtechMeta_MultiBlockBase<T extends GT_MetaTileEntity_Ex return t.mAirIntakes.size(); } }, - ControlCore(GregtechMeta_MultiBlockBase::addControlCoreToMachineList, - GT_MetaTileEntity_Hatch_ControlCore.class) { - - @Override - public long count(GregtechMeta_MultiBlockBase<?> t) { - return t.mControlCoreBus.size(); - } - }, TTDynamo(GregtechMeta_MultiBlockBase::addMultiAmpDynamoToMachineList, "com.github.technus.tectech.thing.metaTileEntity.hatch.GT_MetaTileEntity_Hatch_DynamoMulti") { diff --git a/src/main/java/gtPlusPlus/xmod/gregtech/api/metatileentity/implementations/base/machines/GregtechMetaSafeBlockBase.java b/src/main/java/gtPlusPlus/xmod/gregtech/api/metatileentity/implementations/base/machines/GregtechMetaSafeBlockBase.java deleted file mode 100644 index a53915b3d6..0000000000 --- a/src/main/java/gtPlusPlus/xmod/gregtech/api/metatileentity/implementations/base/machines/GregtechMetaSafeBlockBase.java +++ /dev/null @@ -1,328 +0,0 @@ -package gtPlusPlus.xmod.gregtech.api.metatileentity.implementations.base.machines; - -import static gregtech.api.enums.GT_Values.V; - -import java.util.UUID; - -import net.minecraft.entity.player.EntityPlayer; -import net.minecraft.item.ItemStack; -import net.minecraft.nbt.NBTTagCompound; -import net.minecraftforge.common.util.ForgeDirection; - -import gregtech.api.enums.Textures; -import gregtech.api.gui.modularui.GT_UIInfos; -import gregtech.api.interfaces.ITexture; -import gregtech.api.interfaces.tileentity.IGregTechTileEntity; -import gregtech.api.metatileentity.implementations.GT_MetaTileEntity_TieredMachineBlock; -import gregtech.api.objects.GT_RenderedTexture; -import gtPlusPlus.api.objects.Logger; -import gtPlusPlus.core.util.minecraft.PlayerUtils; -import gtPlusPlus.core.util.player.PlayerCache; - -public abstract class GregtechMetaSafeBlockBase extends GT_MetaTileEntity_TieredMachineBlock { - - public boolean bOutput = false, bRedstoneIfFull = false, bInvert = false, bUnbreakable = false; - public int mSuccess = 0, mTargetStackSize = 0; - public UUID ownerUUID; - - public GregtechMetaSafeBlockBase(final int aID, final String aName, final String aNameRegional, final int aTier, - final int aInvSlotCount, final String aDescription) { - super(aID, aName, aNameRegional, aTier, aInvSlotCount, aDescription); - } - - public GregtechMetaSafeBlockBase(final String aName, final int aTier, final int aInvSlotCount, - final String[] aDescription, final ITexture[][][] aTextures) { - super(aName, aTier, aInvSlotCount, aDescription, aTextures); - } - - @Override - public ITexture[][][] getTextureSet(final ITexture[] aTextures) { - final ITexture[][][] rTextures = new ITexture[6][17][]; - final ITexture tIcon = this.getOverlayIcon(), tOut = new GT_RenderedTexture(Textures.BlockIcons.OVERLAY_QCHEST), - tUp = new GT_RenderedTexture(Textures.BlockIcons.MACHINE_CASING_VENT); - for (byte i = -1; i < 16; i++) { - rTextures[0][i + 1] = new ITexture[] { Textures.BlockIcons.MACHINE_CASINGS[this.mTier][i + 1], tUp, tIcon }; // Back - rTextures[1][i + 1] = new ITexture[] { Textures.BlockIcons.MACHINE_CASINGS[this.mTier][i + 1], tIcon }; // Right, - // Strangely - // The - // top - // side - // as - // well - // when - // facing - // East? - rTextures[2][i + 1] = new ITexture[] { Textures.BlockIcons.MACHINE_CASINGS[this.mTier][i + 1], tIcon }; // Top - // And - // Bottom, - // When - // Facing - // South - // (What - // the - // hell?) - rTextures[3][i + 1] = new ITexture[] { Textures.BlockIcons.MACHINE_CASINGS[this.mTier][i + 1], tIcon }; // Left, - // Top - // if - // facing - // West - // and - // Bottom - // if - // facing - // east? - rTextures[4][i + 1] = new ITexture[] { Textures.BlockIcons.MACHINE_CASINGS[this.mTier][i + 1], tIcon }; // Top - // and - // Bottom - // when - // Facing - // North.. - rTextures[5][i + 1] = new ITexture[] { Textures.BlockIcons.MACHINE_CASINGS[this.mTier][i + 1], tOut }; // Front - } - return rTextures; - } - - @Override - public ITexture[] getTexture(final IGregTechTileEntity aBaseMetaTileEntity, final ForgeDirection side, - final ForgeDirection facing, final int aColorIndex, final boolean aActive, final boolean aRedstone) { - if (side == facing) { - return this.mTextures[5][aColorIndex + 1]; - } - if (side.getOpposite() == facing) { - return this.mTextures[0][aColorIndex + 1]; - } - switch (facing) { - case DOWN: - return this.mTextures[4][aColorIndex + 1]; - case UP: - return this.mTextures[2][aColorIndex + 1]; - case NORTH: - switch (side) { - case DOWN: - return this.mTextures[2][aColorIndex + 1]; - case UP: - return this.mTextures[2][aColorIndex + 1]; - case WEST: - return this.mTextures[1][aColorIndex + 1]; - case EAST: - return this.mTextures[3][aColorIndex + 1]; - } - case SOUTH: - switch (side) { - case DOWN: - return this.mTextures[4][aColorIndex + 1]; - case UP: - return this.mTextures[4][aColorIndex + 1]; - case WEST: - return this.mTextures[3][aColorIndex + 1]; - case EAST: - return this.mTextures[1][aColorIndex + 1]; - } - case WEST: - switch (side) { - case DOWN: - return this.mTextures[3][aColorIndex + 1]; - case UP: - return this.mTextures[1][aColorIndex + 1]; - case NORTH: - return this.mTextures[3][aColorIndex + 1]; - case SOUTH: - return this.mTextures[1][aColorIndex + 1]; - } - case EAST: - switch (side) { - case DOWN: - return this.mTextures[1][aColorIndex + 1]; - case UP: - return this.mTextures[3][aColorIndex + 1]; - case NORTH: - return this.mTextures[1][aColorIndex + 1]; - case SOUTH: - return this.mTextures[3][aColorIndex + 1]; - } - } - return this.mTextures[5][aColorIndex + 1]; - } - - @Override - public boolean isSimpleMachine() { - return false; - } - - @Override - public boolean isValidSlot(final int aIndex) { - return aIndex < (this.mInventory.length - 1); - } - - @Override - public boolean isFacingValid(final ForgeDirection facing) { - return true; - } - - @Override - public boolean isEnetInput() { - return true; - } - - @Override - public boolean isEnetOutput() { - return true; - } - - @Override - public boolean isInputFacing(final ForgeDirection side) { - return !this.isOutputFacing(side); - } - - @Override - public boolean isOutputFacing(final ForgeDirection side) { - return this.getBaseMetaTileEntity().getBackFacing() == side; - } - - @Override - public boolean isTeleporterCompatible() { - return false; - } - - @Override - public long getMinimumStoredEU() { - return 512; - } - - @Override - public long maxEUStore() { - return 512 + (V[this.mTier] * 50); - } - - @Override - public long maxEUInput() { - return V[this.mTier]; - } - - @Override - public long maxEUOutput() { - return this.bOutput ? V[this.mTier] : 0; - } - - @Override - public long maxAmperesIn() { - return 1; - } - - @Override - public long maxAmperesOut() { - return 1; - } - - @Override - public boolean isAccessAllowed(final EntityPlayer aPlayer) { - return true; - } - - public abstract ITexture getOverlayIcon(); - - @Override - public boolean onRightclick(final IGregTechTileEntity aBaseMetaTileEntity, final EntityPlayer aPlayer) { - - if (aBaseMetaTileEntity.isClientSide()) { - // Utils.LOG_WARNING("Clicky Clicky."); - return true; - } - if (aPlayer != null) { - final UUID tempUUID = aPlayer.getUniqueID(); - /* - * if (!aPlayer.worldObj.isRemote){ //PlayerCache.appendParamChanges(aPlayer.getDisplayName(), - * aPlayer.getUniqueID().toString()); } - */ - // Utils.LOG_INFO("test"); - if (this.ownerUUID == null) { - Logger.INFO("No owner yet for this block."); - } else { - // Utils.LOG_INFO("test"); - Logger.INFO( - "Current Owner: " + PlayerCache.lookupPlayerByUUID(this.ownerUUID) - + " - UUID: " - + this.ownerUUID); - } - Logger.WARNING("Is ownerUUID Null"); - if (this.ownerUUID == null) { - Logger.WARNING("OwnerUUID is Null, let's set it."); - Logger.WARNING("Accessing Players UUID is: " + tempUUID); - this.ownerUUID = tempUUID; - // Utils.messagePlayer(aPlayer, "Owner of this safe, now set. Try accessing it again."); - Logger.WARNING("Block Owner is now set to: " + this.ownerUUID); - } - Logger.WARNING("No, it is not."); - Logger.WARNING("Checking ownerUUID."); - if (this.ownerUUID != null) { - Logger.WARNING("ownerUUID != Null, if accessor == owner."); - Logger.WARNING("Accessing is: " + PlayerCache.lookupPlayerByUUID(tempUUID)); - if (this.ownerUUID.equals(tempUUID)) { - Logger.WARNING("Owner's UUID: " + this.ownerUUID); - GT_UIInfos.openGTTileEntityUI(aBaseMetaTileEntity, aPlayer); - // Utils.LOG_WARNING("GUI should now be open for you sir."); - } else { - PlayerUtils.messagePlayer(aPlayer, "Access Denied, This does not belong to you."); - PlayerUtils.messagePlayer( - aPlayer, - "it is owned by: " + PlayerCache.lookupPlayerByUUID(this.ownerUUID)); - Logger.WARNING("Expecting Player : " + PlayerCache.lookupPlayerByUUID(this.ownerUUID)); - Logger.ERROR("Access Denied."); - return true; - } - } - - /* - * else { Utils.LOG_ERROR("This is NOT good. Tell Draknyte1 your safe broke."); } - */ - /* - * Utils.LOG_WARNING("Clicky Clicky."); Utils.messagePlayer(aPlayer, "Owner of this safe, now set."); - * aBaseMetaTileEntity.openGUI(aPlayer); - */ - - } - return true; - } - - @Override - public void saveNBTData(final NBTTagCompound aNBT) { - aNBT.setBoolean("bUnbreakable", this.bUnbreakable); - aNBT.setBoolean("bOutput", this.bOutput); - aNBT.setBoolean("bRedstoneIfFull", this.bRedstoneIfFull); - aNBT.setInteger("mTargetStackSize", this.mTargetStackSize); - if (this.ownerUUID != null) { - aNBT.setString("ownerUUID", this.ownerUUID.toString()); - } - } - - @Override - public void loadNBTData(final NBTTagCompound aNBT) { - this.bUnbreakable = aNBT.getBoolean("bUnbreakable"); - this.bOutput = aNBT.getBoolean("bOutput"); - this.bRedstoneIfFull = aNBT.getBoolean("bRedstoneIfFull"); - this.mTargetStackSize = aNBT.getInteger("mTargetStackSize"); - if (aNBT.hasKey("ownerUUID")) { - this.ownerUUID = UUID.fromString(aNBT.getString("ownerUUID")); - } - } - - @Override - public void setItemNBT(final NBTTagCompound aNBT) { - super.setItemNBT(aNBT); - if (this.mTargetStackSize > 0) { - aNBT.setInteger("mTargetStackSize", this.mTargetStackSize); - } - } - - @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 side != aBaseMetaTileEntity.getBackFacing(); - } -} |