diff options
| author | miozune <miozune@gmail.com> | 2023-05-17 00:01:01 +0900 |
|---|---|---|
| committer | GitHub <noreply@github.com> | 2023-05-16 17:01:01 +0200 |
| commit | 04514282c08ebefdb3e68a46db34092f72be2316 (patch) | |
| tree | 0c9bc99f480f7e7f45a99a55a5b6619ebb5b014b /src/main/java/gtPlusPlus/core/util | |
| parent | cd58ff7cd4dc4b5ffe917a24a4b4c6da577f462d (diff) | |
| download | GT5-Unofficial-04514282c08ebefdb3e68a46db34092f72be2316.tar.gz GT5-Unofficial-04514282c08ebefdb3e68a46db34092f72be2316.tar.bz2 GT5-Unofficial-04514282c08ebefdb3e68a46db34092f72be2316.zip | |
Remove a lot of unused classes (#629)
Diffstat (limited to 'src/main/java/gtPlusPlus/core/util')
19 files changed, 0 insertions, 3169 deletions
diff --git a/src/main/java/gtPlusPlus/core/util/data/EnumUtils.java b/src/main/java/gtPlusPlus/core/util/data/EnumUtils.java deleted file mode 100644 index 71d0c16e14..0000000000 --- a/src/main/java/gtPlusPlus/core/util/data/EnumUtils.java +++ /dev/null @@ -1,45 +0,0 @@ -package gtPlusPlus.core.util.data; - -import com.google.common.base.Enums; -import com.google.common.base.Optional; - -public class EnumUtils { - - /** - * Returns the value of an Enum if it exists. If value is not found, case-insensitive search will occur. If value - * still not found, an IllegalArgumentException is thrown. - **/ - public static <T extends Enum<T>> T getValue(Class<T> enumeration, String name) { - Optional<T> j = Enums.getIfPresent(enumeration, name); - T VALUE; - if (j == null || !j.isPresent()) { - VALUE = valueOfIgnoreCase(enumeration, name); - } else { - VALUE = j.get(); - } - return VALUE; - } - - /** - * Finds the value of the given enumeration by name, case-insensitive. Throws an IllegalArgumentException if no - * match is found. - **/ - private static <T extends Enum<T>> T valueOfIgnoreCase(Class<T> enumeration, String name) { - - for (T enumValue : enumeration.getEnumConstants()) { - if (enumValue.name().equalsIgnoreCase(name)) { - return enumValue; - } - } - - throw new IllegalArgumentException( - String.format("There is no value with name '%s' in Enum %s", name, enumeration.getName())); - } - - public static Object getValue(Class class1, String materialName, boolean bool) { - if (Enum.class.isInstance(class1)) { - return getValue(class1, materialName); - } - return null; - } -} diff --git a/src/main/java/gtPlusPlus/core/util/data/LoggingUtils.java b/src/main/java/gtPlusPlus/core/util/data/LoggingUtils.java deleted file mode 100644 index 5332c82bf7..0000000000 --- a/src/main/java/gtPlusPlus/core/util/data/LoggingUtils.java +++ /dev/null @@ -1,50 +0,0 @@ -package gtPlusPlus.core.util.data; - -import java.io.BufferedWriter; -import java.io.File; -import java.io.FileWriter; -import java.io.IOException; -import java.util.Date; - -public class LoggingUtils { - - public static void profileLog(final Object o) { - try { - String content; - final File file = new File("GregtechTimingsTC.txt"); - // if file doesnt exists, then create it - if (!file.exists()) { - file.createNewFile(); - final FileWriter fw = new FileWriter(file.getAbsoluteFile(), true); - final BufferedWriter bw = new BufferedWriter(fw); - bw.write("============================================================"); - bw.write(System.lineSeparator()); - bw.close(); - } - if (o instanceof String) { - content = (String) o; - } else { - content = o.toString(); - } - final FileWriter fw = new FileWriter(file.getAbsoluteFile(), true); - final BufferedWriter bw = new BufferedWriter(fw); - bw.write(content); - bw.write(System.lineSeparator()); - bw.close(); - System.out.println("Data Logged."); - - } catch (final IOException e) { - System.out.println("Data logging failed."); - } - } - - public static boolean logCurrentSystemTime(final String message) { - final Date date = new Date(System.currentTimeMillis()); - try { - profileLog(message + " | " + date.toString()); - return true; - } catch (final Throwable r) { - return false; - } - } -} diff --git a/src/main/java/gtPlusPlus/core/util/data/UUIDUtils.java b/src/main/java/gtPlusPlus/core/util/data/UUIDUtils.java deleted file mode 100644 index 71634b3af7..0000000000 --- a/src/main/java/gtPlusPlus/core/util/data/UUIDUtils.java +++ /dev/null @@ -1,24 +0,0 @@ -package gtPlusPlus.core.util.data; - -import java.nio.ByteBuffer; -import java.util.UUID; - -public class UUIDUtils { - - // UUID Methods below created by https://gist.github.com/jeffjohnson9046 - // https://gist.github.com/jeffjohnson9046/c663dd22bbe6bb0b3f5e - - public static byte[] getBytesFromUUID(UUID uuid) { - ByteBuffer bb = ByteBuffer.wrap(new byte[16]); - bb.putLong(uuid.getMostSignificantBits()); - bb.putLong(uuid.getLeastSignificantBits()); - return bb.array(); - } - - public static UUID getUUIDFromBytes(byte[] bytes) { - ByteBuffer byteBuffer = ByteBuffer.wrap(bytes); - Long high = byteBuffer.getLong(); - Long low = byteBuffer.getLong(); - return new UUID(high, low); - } -} diff --git a/src/main/java/gtPlusPlus/core/util/debug/DEBUG_INIT.java b/src/main/java/gtPlusPlus/core/util/debug/DEBUG_INIT.java deleted file mode 100644 index 56c93d4a4d..0000000000 --- a/src/main/java/gtPlusPlus/core/util/debug/DEBUG_INIT.java +++ /dev/null @@ -1,30 +0,0 @@ -package gtPlusPlus.core.util.debug; - -import gtPlusPlus.preloader.CORE_Preloader; - -public class DEBUG_INIT { - - public static void registerBlocks() { - // Debug Loading - if (CORE_Preloader.DEBUG_MODE) {} - } - - public static void registerItems() { - /* - * ModItems.itemDebugShapeSpawner = new DEBUG_ITEM_ShapeSpawner("itemDebugShapeSpawner", - * AddToCreativeTab.tabMisc, 1, 500); GameRegistry.registerItem(ModItems.itemDebugShapeSpawner, - * "itemDebugShapeSpawner"); ModItems.itemBedLocator_Base = new BedLocator_Base("itemBedLocator_Base"); - * GameRegistry.registerItem(ModItems.itemBedLocator_Base, "itemBedLocator_Base"); - * ModItems.itemBaseItemWithCharge = new BaseItemWithCharge("itemBaseItemWithCharge", 0, 1000); - * GameRegistry.registerItem(ModItems.itemBaseItemWithCharge, "itemBaseItemWithCharge"); - */ - } - - public static void registerTEs() {} - - public static void registerMisc() {} - - public static void registerHandlers() { - // MinecraftForge.EVENT_BUS.register(new DEBUG_ScreenOverlay()); - } -} diff --git a/src/main/java/gtPlusPlus/core/util/debug/DEBUG_ITEM_ShapeSpawner.java b/src/main/java/gtPlusPlus/core/util/debug/DEBUG_ITEM_ShapeSpawner.java deleted file mode 100644 index 07f8d6385a..0000000000 --- a/src/main/java/gtPlusPlus/core/util/debug/DEBUG_ITEM_ShapeSpawner.java +++ /dev/null @@ -1,53 +0,0 @@ -package gtPlusPlus.core.util.debug; - -import static net.minecraftforge.event.entity.player.PlayerInteractEvent.Action.RIGHT_CLICK_BLOCK; - -import java.util.List; - -import net.minecraft.creativetab.CreativeTabs; -import net.minecraft.entity.player.EntityPlayer; -import net.minecraft.item.ItemStack; -import net.minecraft.util.EnumChatFormatting; -import net.minecraft.world.World; -import net.minecraftforge.event.entity.player.PlayerInteractEvent; - -import cpw.mods.fml.common.eventhandler.SubscribeEvent; -import gtPlusPlus.api.objects.Logger; -import gtPlusPlus.core.creative.AddToCreativeTab; -import gtPlusPlus.core.item.base.BaseItemGeneric; - -public class DEBUG_ITEM_ShapeSpawner extends BaseItemGeneric { - - public DEBUG_ITEM_ShapeSpawner(String s, CreativeTabs c, int stackSize, int maxDmg) { - super(s, c, stackSize, maxDmg); - s = "itemDebugShapeSpawner"; - c = AddToCreativeTab.tabMisc; - stackSize = 1; - maxDmg = 500; - } - - @Override - public ItemStack onItemRightClick(final ItemStack stack, final World world, final EntityPlayer player) { - - if (!world.isRemote) { - Logger.INFO("Constructing the shape for the " + "VACUUM FREEZER"); - final Thread thread = new Thread(new DEBUG_TimerThread(world, player)); - thread.start(); - } - return stack; - } - - @SubscribeEvent - public void playerInteractEventHandler(final PlayerInteractEvent event) { - if (event.isCanceled() || event.world.isRemote || (event.action != RIGHT_CLICK_BLOCK)) { - return; - } - } - - @SuppressWarnings({ "unchecked", "rawtypes" }) - @Override - public void addInformation(final ItemStack stack, final EntityPlayer aPlayer, final List list, final boolean bool) { - list.add(EnumChatFormatting.GOLD + "For Testing Gregtech Shapes!"); - super.addInformation(stack, aPlayer, list, bool); - } -} diff --git a/src/main/java/gtPlusPlus/core/util/debug/DEBUG_MULTIBLOCK_ShapeSpawner.java b/src/main/java/gtPlusPlus/core/util/debug/DEBUG_MULTIBLOCK_ShapeSpawner.java deleted file mode 100644 index 0df691624f..0000000000 --- a/src/main/java/gtPlusPlus/core/util/debug/DEBUG_MULTIBLOCK_ShapeSpawner.java +++ /dev/null @@ -1,953 +0,0 @@ -package gtPlusPlus.core.util.debug; - -import static gregtech.api.enums.GT_Values.V; - -import java.util.ArrayList; - -import net.minecraft.entity.player.EntityPlayer; -import net.minecraft.item.ItemStack; -import net.minecraft.nbt.NBTTagCompound; -import net.minecraftforge.common.util.ForgeDirection; -import net.minecraftforge.fluids.FluidStack; - -import gregtech.GT_Mod; -import gregtech.api.GregTech_API; -import gregtech.api.enums.ConfigCategories; -import gregtech.api.enums.Materials; -import gregtech.api.enums.OrePrefixes; -import gregtech.api.gui.modularui.GT_UIInfos; -import gregtech.api.interfaces.metatileentity.IMetaTileEntity; -import gregtech.api.interfaces.tileentity.IGregTechTileEntity; -import gregtech.api.items.GT_MetaGenerated_Tool; -import gregtech.api.metatileentity.MetaTileEntity; -import gregtech.api.metatileentity.implementations.GT_MetaTileEntity_Hatch; -import gregtech.api.metatileentity.implementations.GT_MetaTileEntity_Hatch_Dynamo; -import gregtech.api.metatileentity.implementations.GT_MetaTileEntity_Hatch_Energy; -import gregtech.api.metatileentity.implementations.GT_MetaTileEntity_Hatch_Input; -import gregtech.api.metatileentity.implementations.GT_MetaTileEntity_Hatch_InputBus; -import gregtech.api.metatileentity.implementations.GT_MetaTileEntity_Hatch_Maintenance; -import gregtech.api.metatileentity.implementations.GT_MetaTileEntity_Hatch_Muffler; -import gregtech.api.metatileentity.implementations.GT_MetaTileEntity_Hatch_Output; -import gregtech.api.metatileentity.implementations.GT_MetaTileEntity_Hatch_OutputBus; -import gregtech.api.objects.GT_ItemStack; -import gregtech.api.util.GT_ModHandler; -import gregtech.api.util.GT_OreDictUnificator; -import gregtech.api.util.GT_Recipe.GT_Recipe_Map; -import gregtech.api.util.GT_Utility; -import gregtech.common.items.GT_MetaGenerated_Tool_01; - -public abstract class DEBUG_MULTIBLOCK_ShapeSpawner extends MetaTileEntity { - - public static boolean disableMaintenance; - public boolean mMachine = false, mWrench = false, mScrewdriver = false, mSoftHammer = false, mHardHammer = false, - mSolderingTool = false, mCrowbar = false, mRunningOnLoad = false; - public int mPollution = 0, mProgresstime = 0, mMaxProgresstime = 0, mEUt = 0, mEfficiencyIncrease = 0, mUpdate = 0, - mStartUpCheck = 100, mRuntime = 0, mEfficiency = 0; - public ItemStack[] mOutputItems = null; - public FluidStack[] mOutputFluids = null; - public ArrayList<GT_MetaTileEntity_Hatch_Input> mInputHatches = new ArrayList<>(); - public ArrayList<GT_MetaTileEntity_Hatch_Output> mOutputHatches = new ArrayList<>(); - public ArrayList<GT_MetaTileEntity_Hatch_InputBus> mInputBusses = new ArrayList<>(); - public ArrayList<GT_MetaTileEntity_Hatch_OutputBus> mOutputBusses = new ArrayList<>(); - public ArrayList<GT_MetaTileEntity_Hatch_Dynamo> mDynamoHatches = new ArrayList<>(); - public ArrayList<GT_MetaTileEntity_Hatch_Muffler> mMufflerHatches = new ArrayList<>(); - public ArrayList<GT_MetaTileEntity_Hatch_Energy> mEnergyHatches = new ArrayList<>(); - public ArrayList<GT_MetaTileEntity_Hatch_Maintenance> mMaintenanceHatches = new ArrayList<>(); - - public DEBUG_MULTIBLOCK_ShapeSpawner(final int aID, final String aName, final String aNameRegional) { - super(aID, aName, aNameRegional, 2); - DEBUG_MULTIBLOCK_ShapeSpawner.disableMaintenance = GregTech_API.sMachineFile - .get(ConfigCategories.machineconfig, "MultiBlockMachines.disableMaintenance", false); - } - - public DEBUG_MULTIBLOCK_ShapeSpawner(final String aName) { - super(aName, 2); - DEBUG_MULTIBLOCK_ShapeSpawner.disableMaintenance = GregTech_API.sMachineFile - .get(ConfigCategories.machineconfig, "MultiBlockMachines.disableMaintenance", false); - } - - public static boolean isValidMetaTileEntity(final MetaTileEntity aMetaTileEntity) { - return (aMetaTileEntity.getBaseMetaTileEntity() != null) - && (aMetaTileEntity.getBaseMetaTileEntity().getMetaTileEntity() == aMetaTileEntity) - && !aMetaTileEntity.getBaseMetaTileEntity().isDead(); - } - - @Override - public boolean allowCoverOnSide(final ForgeDirection side, final GT_ItemStack aCoverID) { - return side != this.getBaseMetaTileEntity().getFrontFacing(); - } - - @Override - public boolean isSimpleMachine() { - return false; - } - - @Override - public boolean isFacingValid(final ForgeDirection facing) { - return true; - } - - @Override - public boolean isAccessAllowed(final EntityPlayer aPlayer) { - return true; - } - - @Override - public boolean isValidSlot(final int aIndex) { - return aIndex > 0; - } - - @Override - public int getProgresstime() { - return this.mProgresstime; - } - - @Override - public int maxProgresstime() { - return this.mMaxProgresstime; - } - - @Override - public int increaseProgress(final int aProgress) { - return aProgress; - } - - @Override - public void saveNBTData(final NBTTagCompound aNBT) { - aNBT.setInteger("mEUt", this.mEUt); - aNBT.setInteger("mProgresstime", this.mProgresstime); - aNBT.setInteger("mMaxProgresstime", this.mMaxProgresstime); - aNBT.setInteger("mEfficiencyIncrease", this.mEfficiencyIncrease); - aNBT.setInteger("mEfficiency", this.mEfficiency); - aNBT.setInteger("mPollution", this.mPollution); - aNBT.setInteger("mRuntime", this.mRuntime); - - if (this.mOutputItems != null) { - for (int i = 0; i < this.mOutputItems.length; i++) { - if (this.mOutputItems[i] != null) { - final NBTTagCompound tNBT = new NBTTagCompound(); - this.mOutputItems[i].writeToNBT(tNBT); - aNBT.setTag("mOutputItem" + i, tNBT); - } - } - } - if (this.mOutputFluids != null) { - for (int i = 0; i < this.mOutputFluids.length; i++) { - if (this.mOutputFluids[i] != null) { - final NBTTagCompound tNBT = new NBTTagCompound(); - this.mOutputFluids[i].writeToNBT(tNBT); - aNBT.setTag("mOutputFluids" + i, tNBT); - } - } - } - - aNBT.setBoolean("mWrench", this.mWrench); - aNBT.setBoolean("mScrewdriver", this.mScrewdriver); - aNBT.setBoolean("mSoftHammer", this.mSoftHammer); - aNBT.setBoolean("mHardHammer", this.mHardHammer); - aNBT.setBoolean("mSolderingTool", this.mSolderingTool); - aNBT.setBoolean("mCrowbar", this.mCrowbar); - } - - @Override - public void loadNBTData(final NBTTagCompound aNBT) { - this.mEUt = aNBT.getInteger("mEUt"); - this.mProgresstime = aNBT.getInteger("mProgresstime"); - this.mMaxProgresstime = aNBT.getInteger("mMaxProgresstime"); - if (this.mMaxProgresstime > 0) { - this.mRunningOnLoad = true; - } - this.mEfficiencyIncrease = aNBT.getInteger("mEfficiencyIncrease"); - this.mEfficiency = aNBT.getInteger("mEfficiency"); - this.mPollution = aNBT.getInteger("mPollution"); - this.mRuntime = aNBT.getInteger("mRuntime"); - this.mOutputItems = new ItemStack[this.getAmountOfOutputs()]; - for (int i = 0; i < this.mOutputItems.length; i++) { - this.mOutputItems[i] = GT_Utility.loadItem(aNBT, "mOutputItem" + i); - } - this.mOutputFluids = new FluidStack[this.getAmountOfOutputs()]; - for (int i = 0; i < this.mOutputFluids.length; i++) { - this.mOutputFluids[i] = GT_Utility.loadFluid(aNBT, "mOutputFluids" + i); - } - this.mWrench = aNBT.getBoolean("mWrench"); - this.mScrewdriver = aNBT.getBoolean("mScrewdriver"); - this.mSoftHammer = aNBT.getBoolean("mSoftHammer"); - this.mHardHammer = aNBT.getBoolean("mHardHammer"); - this.mSolderingTool = aNBT.getBoolean("mSolderingTool"); - this.mCrowbar = aNBT.getBoolean("mCrowbar"); - } - - @Override - public boolean onRightclick(final IGregTechTileEntity aBaseMetaTileEntity, final EntityPlayer aPlayer) { - GT_UIInfos.openGTTileEntityUI(aBaseMetaTileEntity, aPlayer); - return true; - } - - @Override - public byte getTileEntityBaseType() { - return 2; - } - - @Override - public void onMachineBlockUpdate() { - this.mUpdate = 50; - } - - @Override - public void onPostTick(final IGregTechTileEntity aBaseMetaTileEntity, final long aTick) { - if (aBaseMetaTileEntity.isServerSide()) { - if (this.mEfficiency < 0) { - this.mEfficiency = 0; - } - if ((--this.mUpdate == 0) || (--this.mStartUpCheck == 0)) { - this.mInputHatches.clear(); - this.mInputBusses.clear(); - this.mOutputHatches.clear(); - this.mOutputBusses.clear(); - this.mDynamoHatches.clear(); - this.mEnergyHatches.clear(); - this.mMufflerHatches.clear(); - this.mMaintenanceHatches.clear(); - this.mMachine = this.checkMachine(aBaseMetaTileEntity, this.mInventory[1]); - } - if (this.mStartUpCheck < 0) { - if (this.mMachine) { - for (final GT_MetaTileEntity_Hatch_Maintenance tHatch : this.mMaintenanceHatches) { - if (isValidMetaTileEntity(tHatch)) { - if (!DEBUG_MULTIBLOCK_ShapeSpawner.disableMaintenance) { - if (tHatch.mWrench) { - this.mWrench = true; - } - if (tHatch.mScrewdriver) { - this.mScrewdriver = true; - } - if (tHatch.mSoftHammer) { - this.mSoftHammer = true; - } - if (tHatch.mHardHammer) { - this.mHardHammer = true; - } - if (tHatch.mSolderingTool) { - this.mSolderingTool = true; - } - if (tHatch.mCrowbar) { - this.mCrowbar = true; - } - } else { - this.mWrench = true; - this.mScrewdriver = true; - this.mSoftHammer = true; - this.mHardHammer = true; - this.mSolderingTool = true; - this.mCrowbar = true; - } - - tHatch.mWrench = false; - tHatch.mScrewdriver = false; - tHatch.mSoftHammer = false; - tHatch.mHardHammer = false; - tHatch.mSolderingTool = false; - tHatch.mCrowbar = false; - } - } - if (this.getRepairStatus() > 0) { - if ((this.mMaxProgresstime > 0) && this.doRandomMaintenanceDamage()) { - if (this.onRunningTick(this.mInventory[1])) { - if (!this.polluteEnvironment(this.getPollutionPerTick(this.mInventory[1]))) { - this.stopMachine(); - } - if ((this.mMaxProgresstime > 0) && (++this.mProgresstime >= this.mMaxProgresstime)) { - if (this.mOutputItems != null) { - for (final ItemStack tStack : this.mOutputItems) { - if (tStack != null) { - try { - GT_Mod.achievements.issueAchivementHatch( - aBaseMetaTileEntity.getWorld().getPlayerEntityByName( - aBaseMetaTileEntity.getOwnerName()), - tStack); - } catch (final Exception e) {} - this.addOutput(tStack); - } - } - } - if ((this.mOutputFluids != null) && (this.mOutputFluids.length == 1)) { - for (final FluidStack tStack : this.mOutputFluids) { - if (tStack != null) { - this.addOutput(tStack); - } - } - } else if ((this.mOutputFluids != null) && (this.mOutputFluids.length > 1)) { - this.addFluidOutputs(this.mOutputFluids); - } - this.mEfficiency = Math.max( - 0, - Math.min( - this.mEfficiency + this.mEfficiencyIncrease, - this.getMaxEfficiency(this.mInventory[1]) - - ((this.getIdealStatus() - this.getRepairStatus()) - * 1000))); - this.mOutputItems = null; - this.mProgresstime = 0; - this.mMaxProgresstime = 0; - this.mEfficiencyIncrease = 0; - if (aBaseMetaTileEntity.isAllowedToWork()) { - this.checkRecipe(this.mInventory[1]); - } - if ((this.mOutputFluids != null) && (this.mOutputFluids.length > 0)) { - if (this.mOutputFluids.length > 1) { - GT_Mod.achievements.issueAchievement( - aBaseMetaTileEntity.getWorld() - .getPlayerEntityByName(aBaseMetaTileEntity.getOwnerName()), - "oilplant"); - } - } - } - } - } else { - if (((aTick % 100) == 0) || aBaseMetaTileEntity.hasWorkJustBeenEnabled() - || aBaseMetaTileEntity.hasInventoryBeenModified()) { - - if (aBaseMetaTileEntity.isAllowedToWork()) { - this.checkRecipe(this.mInventory[1]); - } - if (this.mMaxProgresstime <= 0) { - this.mEfficiency = Math.max(0, this.mEfficiency - 1000); - } - } - } - } else { - this.stopMachine(); - } - } else { - this.stopMachine(); - } - } - aBaseMetaTileEntity.setErrorDisplayID( - (aBaseMetaTileEntity.getErrorDisplayID() & ~127) | (this.mWrench ? 0 : 1) - | (this.mScrewdriver ? 0 : 2) - | (this.mSoftHammer ? 0 : 4) - | (this.mHardHammer ? 0 : 8) - | (this.mSolderingTool ? 0 : 16) - | (this.mCrowbar ? 0 : 32) - | (this.mMachine ? 0 : 64)); - aBaseMetaTileEntity.setActive(this.mMaxProgresstime > 0); - } - } - - public boolean polluteEnvironment(final int aPollutionLevel) { - this.mPollution += aPollutionLevel; - for (final GT_MetaTileEntity_Hatch_Muffler tHatch : this.mMufflerHatches) { - if (isValidMetaTileEntity(tHatch)) { - if (this.mPollution >= 10000) { - if (tHatch.polluteEnvironment()) { - this.mPollution -= 10000; - } - } else { - break; - } - } - } - return this.mPollution < 10000; - } - - /** - * Called every tick the Machine runs - */ - public boolean onRunningTick(final ItemStack aStack) { - if (this.mEUt > 0) { - this.addEnergyOutput(((long) this.mEUt * this.mEfficiency) / 10000); - return true; - } - if (this.mEUt < 0) { - if (!this.drainEnergyInput(((long) -this.mEUt * 10000) / Math.max(1000, this.mEfficiency))) { - this.stopMachine(); - return false; - } - } - return true; - } - - /** - * Checks if this is a Correct Machine Part for this kind of Machine (Turbine Rotor for example) - */ - public abstract boolean isCorrectMachinePart(ItemStack aStack); - - /** - * Checks the Recipe - */ - public abstract boolean checkRecipe(ItemStack aStack); - - /** - * Checks the Machine. You have to assign the MetaTileEntities for the Hatches here. - */ - public abstract boolean checkMachine(IGregTechTileEntity aBaseMetaTileEntity, ItemStack aStack); - - /** - * Gets the maximum Efficiency that spare Part can get (0 - 10000) - */ - public abstract int getMaxEfficiency(ItemStack aStack); - - /** - * Gets the pollution this Device outputs to a Muffler per tick (10000 = one Pullution Block) - */ - public abstract int getPollutionPerTick(ItemStack aStack); - - /** - * Gets the damage to the ItemStack, usually 0 or 1. - */ - public abstract int getDamageToComponent(ItemStack aStack); - - /** - * Gets the Amount of possibly outputted Items for loading the Output Stack Array from NBT. This should be the - * largest Amount that can ever happen legitimately. - */ - public abstract int getAmountOfOutputs(); - - /** - * If it explodes when the Component has to be replaced. - */ - public abstract boolean explodesOnComponentBreak(ItemStack aStack); - - public void stopMachine() { - this.mOutputItems = null; - this.mEUt = 0; - this.mEfficiency = 0; - this.mProgresstime = 0; - this.mMaxProgresstime = 0; - this.mEfficiencyIncrease = 0; - this.getBaseMetaTileEntity().disableWorking(); - } - - public int getRepairStatus() { - return (this.mWrench ? 1 : 0) + (this.mScrewdriver ? 1 : 0) - + (this.mSoftHammer ? 1 : 0) - + (this.mHardHammer ? 1 : 0) - + (this.mSolderingTool ? 1 : 0) - + (this.mCrowbar ? 1 : 0); - } - - public int getIdealStatus() { - return 6; - } - - public boolean doRandomMaintenanceDamage() { - if (!this.isCorrectMachinePart(this.mInventory[1]) || (this.getRepairStatus() == 0)) { - this.stopMachine(); - return false; - } - if (this.mRuntime++ > 1000) { - this.mRuntime = 0; - if (this.getBaseMetaTileEntity().getRandomNumber(6000) == 0) { - switch (this.getBaseMetaTileEntity().getRandomNumber(6)) { - case 0: - this.mWrench = false; - break; - case 1: - this.mScrewdriver = false; - break; - case 2: - this.mSoftHammer = false; - break; - case 3: - this.mHardHammer = false; - break; - case 4: - this.mSolderingTool = false; - break; - case 5: - this.mCrowbar = false; - break; - } - } - if ((this.mInventory[1] != null) && (this.getBaseMetaTileEntity().getRandomNumber(2) == 0) - && !this.mInventory[1].getUnlocalizedName().startsWith("gt.blockmachines.basicmachine.")) { - if (this.mInventory[1].getItem() instanceof GT_MetaGenerated_Tool_01) { - final NBTTagCompound tNBT = this.mInventory[1].getTagCompound(); - if (tNBT != null) { - NBTTagCompound tNBT2 = tNBT.getCompoundTag("GT.CraftingComponents"); - if (!tNBT.getBoolean("mDis")) { - tNBT2 = new NBTTagCompound(); - final Materials tMaterial = GT_MetaGenerated_Tool.getPrimaryMaterial(this.mInventory[1]); - final ItemStack tTurbine = GT_OreDictUnificator.get(OrePrefixes.turbineBlade, tMaterial, 1); - final int i = this.mInventory[1].getItemDamage(); - if (i == 170) { - ItemStack tStack = GT_Utility.copyAmount(1, tTurbine); - tNBT2.setTag("Ingredient.0", tStack.writeToNBT(new NBTTagCompound())); - tNBT2.setTag("Ingredient.1", tStack.writeToNBT(new NBTTagCompound())); - tNBT2.setTag("Ingredient.2", tStack.writeToNBT(new NBTTagCompound())); - tNBT2.setTag("Ingredient.3", tStack.writeToNBT(new NBTTagCompound())); - tStack = GT_OreDictUnificator.get(OrePrefixes.stickLong, Materials.Magnalium, 1); - tNBT2.setTag("Ingredient.4", tStack.writeToNBT(new NBTTagCompound())); - } else if (i == 172) { - ItemStack tStack = GT_Utility.copyAmount(1, tTurbine); |
