diff options
author | miozune <miozune@gmail.com> | 2023-10-17 13:37:11 +0900 |
---|---|---|
committer | miozune <miozune@gmail.com> | 2023-10-17 17:39:55 +0900 |
commit | 325a5f154e8d8d7dac6c03deb632a0041b3d69ca (patch) | |
tree | 323c840a7478f6550ce6fac4606589a24f440f89 /src/main/java/gtPlusPlus/xmod | |
parent | 6f27cb977e0ff601a540e9dbfd3d7565d0b05273 (diff) | |
download | GT5-Unofficial-325a5f154e8d8d7dac6c03deb632a0041b3d69ca.tar.gz GT5-Unofficial-325a5f154e8d8d7dac6c03deb632a0041b3d69ca.tar.bz2 GT5-Unofficial-325a5f154e8d8d7dac6c03deb632a0041b3d69ca.zip |
Remove unused classes
Diffstat (limited to 'src/main/java/gtPlusPlus/xmod')
-rw-r--r-- | src/main/java/gtPlusPlus/xmod/galacticraft/util/GalacticUtils.java | 160 | ||||
-rw-r--r-- | src/main/java/gtPlusPlus/xmod/gregtech/common/helpers/autocrafter/AC_Helper_Container.java | 113 |
2 files changed, 0 insertions, 273 deletions
diff --git a/src/main/java/gtPlusPlus/xmod/galacticraft/util/GalacticUtils.java b/src/main/java/gtPlusPlus/xmod/galacticraft/util/GalacticUtils.java deleted file mode 100644 index c25d6b4352..0000000000 --- a/src/main/java/gtPlusPlus/xmod/galacticraft/util/GalacticUtils.java +++ /dev/null @@ -1,160 +0,0 @@ -package gtPlusPlus.xmod.galacticraft.util; - -import java.lang.reflect.InvocationTargetException; -import java.lang.reflect.Method; - -import net.minecraft.entity.Entity; -import net.minecraftforge.fluids.FluidStack; - -import gregtech.api.enums.Materials; -import gtPlusPlus.api.objects.Logger; -import gtPlusPlus.core.item.chemistry.RocketFuels; -import gtPlusPlus.core.util.minecraft.FluidUtils; -import gtPlusPlus.core.util.reflect.ReflectionUtils; - -public class GalacticUtils { - - private static final Class<?> aTieredRocket; - private static final Class<?> aLandingPad; - private static final Class<?> aBuggyPad; - private static final Class<?> aIDockable; - private static final Class<?> aIFuelable; - private static final Method getRocketTier; - private static final Method getRocket; - private static final Method getBuggy; - - static { - Class<?> a1, a2, a3, a4, a5; - Method m1, m2, m3; - try { - a1 = ReflectionUtils.getClass("micdoodle8.mods.galacticraft.api.prefab.entity.EntityTieredRocket"); - a2 = ReflectionUtils.getClass("micdoodle8.mods.galacticraft.core.tile.TileEntityLandingPad"); - a3 = ReflectionUtils.getClass("micdoodle8.mods.galacticraft.core.tile.TileEntityBuggyFueler"); - a4 = ReflectionUtils.getClass("micdoodle8.mods.galacticraft.api.entity.IDockable"); - a5 = ReflectionUtils.getClass("micdoodle8.mods.galacticraft.api.entity.IFuelable"); - m1 = ReflectionUtils.getMethod(a1, "getRocketTier"); - m2 = ReflectionUtils.getMethod(a2, "getDockedEntity"); - m3 = ReflectionUtils.getMethod(a3, "getDockedEntity"); - } catch (Throwable t) { - a1 = null; - a2 = null; - a3 = null; - a4 = null; - a5 = null; - m1 = null; - m2 = null; - m3 = null; - } - aTieredRocket = a1; - aLandingPad = a2; - aBuggyPad = a3; - aIDockable = a4; - aIFuelable = a5; - getRocketTier = m1; - getRocket = m2; - getBuggy = m3; - if (a1 != null && a2 != null - && a3 != null - && a4 != null - && a5 != null - && m1 != null - && m2 != null - && m3 != null) { - Logger.SPACE("Successfully relfected into 5 classes and 3 methods."); - } else { - Logger.SPACE("Failed to relfect into Galacticraft classes and methods."); - if (a1 == null) { - Logger.SPACE("micdoodle8.mods.galacticraft.api.prefab.entity.EntityTieredRocket was null.."); - } - if (a2 == null) { - Logger.SPACE("micdoodle8.mods.galacticraft.core.tile.TileEntityLandingPad was null.."); - } - if (a3 == null) { - Logger.SPACE("micdoodle8.mods.galacticraft.core.tile.TileEntityBuggyFueler was null.."); - } - if (a4 == null) { - Logger.SPACE("micdoodle8.mods.galacticraft.api.entity.IDockable was null.."); - } - if (a5 == null) { - Logger.SPACE("micdoodle8.mods.galacticraft.api.entity.IFuelable was null.."); - } - if (m1 == null) { - Logger.SPACE("getRocketTier was null.."); - } - if (m2 == null) { - Logger.SPACE("getDockedEntity was null.."); - } - if (m3 == null) { - Logger.SPACE("getDockedEntity(buggy) was null.."); - } - } - } - - public static int getRocketTier(Entity aEntity) { - if (aTieredRocket.isInstance(aEntity)) { - if (getRocketTier != null) { - try { - return (int) getRocketTier.invoke(aEntity, new Object[] {}); - } catch (IllegalAccessException | IllegalArgumentException | InvocationTargetException e) {} - } - } - return -1; - } - - public static int getRocketTier(Object aEntity) { - if (aIFuelable.isInstance(aEntity)) { - if (aLandingPad.isInstance(aEntity)) { - Object rocket; - try { - rocket = getRocket.invoke(aLandingPad, new Object[] {}); - if (aIDockable.isInstance(rocket) && rocket != null) { - return getRocketTier((Entity) rocket); - } - } catch (IllegalAccessException | IllegalArgumentException | InvocationTargetException e) {} - } else if (aBuggyPad.isInstance(aEntity)) { - Object buggy; - try { - buggy = getBuggy.invoke(aBuggyPad, new Object[] {}); - if (aIDockable.isInstance(buggy) && buggy != null) { - return 0; - } - } catch (IllegalAccessException | IllegalArgumentException | InvocationTargetException e) {} - } - } - return -1; - } - - public static boolean isFuelValidForTier(int aTier, FluidStack aFuel) { - FluidStack aValidForThisTier = getValidFuelForTier(aTier); - if (aFuel.isFluidEqual(aValidForThisTier)) { - return true; - } - return false; - } - - public static FluidStack getValidFuelForTier(Entity aEntity) { - if (aTieredRocket.isInstance(aEntity)) { - return getValidFuelForTier(getRocketTier(aEntity)); - } else { - Logger.SPACE("Failed to get valid rocket fuel for " + aEntity.getClass().getCanonicalName()); - return getValidFuelForTier(0); - } - } - - public static FluidStack getValidFuelForTier(int aTier) { - if (aTier > 0 && aTier <= 2) { - return FluidUtils.getFluidStack(RocketFuels.RP1_Plus_Liquid_Oxygen, 1000); - } else if (aTier >= 3 && aTier <= 5) { - return FluidUtils.getFluidStack(RocketFuels.Dense_Hydrazine_Mix, 1000); - } else if (aTier >= 6 && aTier <= 7) { - return FluidUtils.getFluidStack(RocketFuels.Monomethylhydrazine_Plus_Nitric_Acid, 1000); - } else if (aTier >= 8 && aTier <= 10) { - return FluidUtils.getFluidStack(RocketFuels.Unsymmetrical_Dimethylhydrazine_Plus_Nitrogen_Tetroxide, 1000); - } else { - if (aTier == 0) { - return Materials.Fuel.getFluid(1000); - } - return null; - } - } -} diff --git a/src/main/java/gtPlusPlus/xmod/gregtech/common/helpers/autocrafter/AC_Helper_Container.java b/src/main/java/gtPlusPlus/xmod/gregtech/common/helpers/autocrafter/AC_Helper_Container.java deleted file mode 100644 index e54542f35b..0000000000 --- a/src/main/java/gtPlusPlus/xmod/gregtech/common/helpers/autocrafter/AC_Helper_Container.java +++ /dev/null @@ -1,113 +0,0 @@ -package gtPlusPlus.xmod.gregtech.common.helpers.autocrafter; - -import net.minecraft.entity.player.EntityPlayer; -import net.minecraft.entity.player.InventoryPlayer; -import net.minecraft.inventory.Container; -import net.minecraft.inventory.IInventory; -import net.minecraft.inventory.InventoryCraftResult; -import net.minecraft.inventory.InventoryCrafting; -import net.minecraft.inventory.Slot; -import net.minecraft.inventory.SlotCrafting; -import net.minecraft.item.ItemStack; -import net.minecraft.item.crafting.CraftingManager; -import net.minecraft.world.World; - -import gtPlusPlus.api.objects.Logger; - -public class AC_Helper_Container extends Container { - - /** The crafting matrix inventory (3x3). */ - public InventoryCrafting craftMatrix = new InventoryCrafting(this, 3, 3); - - public IInventory craftResult = new InventoryCraftResult(); - private World worldObj; - - public InventoryCrafting getMatrix() { - return this.craftMatrix; - } - - public boolean putItemsIntoGrid(ItemStack[] inputs) { - if (inputs.length < 9) { - return false; - } - for (int i = 0; i < 9; i++) { - this.putStackInSlot(i, inputs[i]); - } - this.onCraftMatrixChanged(this.craftMatrix); - return true; - } - - public AC_Helper_Container(InventoryPlayer playerInventory, World world, int x, int y, int z) { - this.worldObj = world; - this.addSlotToContainer( - new SlotCrafting(playerInventory.player, this.craftMatrix, this.craftResult, 0, 124, 35)); - int l; - int i1; - - for (l = 0; l < 3; ++l) { - for (i1 = 0; i1 < 3; ++i1) { - this.addSlotToContainer(new Slot(this.craftMatrix, i1 + l * 3, 30 + i1 * 18, 17 + l * 18)); - } - } - - for (l = 0; l < 3; ++l) { - for (i1 = 0; i1 < 9; ++i1) { - this.addSlotToContainer(new Slot(playerInventory, i1 + l * 9 + 9, 8 + i1 * 18, 84 + l * 18)); - } - } - - for (l = 0; l < 9; ++l) { - this.addSlotToContainer(new Slot(playerInventory, l, 8 + l * 18, 142)); - } - - this.onCraftMatrixChanged(this.craftMatrix); - } - - /** - * Callback for when the crafting matrix is changed. - */ - @Override - public void onCraftMatrixChanged(IInventory p_75130_1_) { - this.craftResult.setInventorySlotContents( - 0, - CraftingManager.getInstance().findMatchingRecipe(this.craftMatrix, this.worldObj)); - Logger.INFO("Crafted " + this.craftResult.getStackInSlot(0)); - } - - /** - * Called when the container is closed. - */ - @Override - public void onContainerClosed(EntityPlayer p_75134_1_) { - super.onContainerClosed(p_75134_1_); - - if (!this.worldObj.isRemote) { - for (int i = 0; i < 9; ++i) { - ItemStack itemstack = this.craftMatrix.getStackInSlotOnClosing(i); - - if (itemstack != null) { - p_75134_1_.dropPlayerItemWithRandomChoice(itemstack, false); - } - } - } - } - - @Override - public boolean canInteractWith(EntityPlayer p_75145_1_) { - return true; - } - - /** - * Called when a player shift-clicks on a slot. You must override this or you will crash when someone does that. - */ - @Override - public ItemStack transferStackInSlot(EntityPlayer p_82846_1_, int p_82846_2_) { - ItemStack itemstack = null; - return itemstack; - } - - @Override - public boolean func_94530_a(ItemStack p_94530_1_, Slot p_94530_2_) { - return p_94530_2_.inventory != this.craftResult && super.func_94530_a(p_94530_1_, p_94530_2_); - } -} |