diff --git a/.gitignore b/.gitignore index e5a436002a..27a8ae0f17 100644 --- a/.gitignore +++ b/.gitignore @@ -1,6 +1,7 @@ .gradle .settings /.idea/ +/.vscode/ /run/ /build/ /eclipse/ @@ -25,12 +26,13 @@ whitelist.json *.iml *.ipr *.iws -src/main/resources/mixins.*.json +src/main/resources/mixins.*([!.]).json *.bat -*.bak -/screenshots -/world -/saves -/asm -/.vscode +*.DS_Store +!gradlew.bat .factorypath +addon.local.gradle +addon.local.gradle.kts +addon.late.local.gradle +addon.late.local.gradle.kts +layout.json \ No newline at end of file diff --git a/build.gradle b/build.gradle index 621bc62fa6..b74b980f9e 100644 --- a/build.gradle +++ b/build.gradle @@ -1,4 +1,4 @@ -//version: 1696265388 +//version: 1696952014 /* DO NOT CHANGE THIS FILE! Also, you may replace this file at any time if there is an update available. @@ -793,7 +793,7 @@ ext.java17PatchDependenciesCfg = configurations.create("java17PatchDependencies" } dependencies { - def lwjgl3ifyVersion = '1.5.0' + def lwjgl3ifyVersion = '1.5.1' if (modId != 'lwjgl3ify') { java17Dependencies("com.github.GTNewHorizons:lwjgl3ify:${lwjgl3ifyVersion}") } diff --git a/src/main/java/gregtech/api/util/GTPP_Recipe.java b/src/main/java/gregtech/api/util/GTPP_Recipe.java index 07290aeb54..3058ea836e 100644 --- a/src/main/java/gregtech/api/util/GTPP_Recipe.java +++ b/src/main/java/gregtech/api/util/GTPP_Recipe.java @@ -271,22 +271,6 @@ public static class GTPP_Recipe_Map { E, true, true).setUsualFluidInputCount(3).setUsualFluidOutputCount(3); - public static final GT_Recipe_Map sSteamTurbineFuels = new GT_Recipe_Map( - new HashSet<>(10), - "gtpp.recipe.steamturbinefuel", - "GeoThermal Fuel", - null, - "", - 1, - 1, - 0, - 0, - 1, - "Fuel Value: ", - 1000, - " EU", - true, - false).useModularUI(true); // LFTR recipes public static final GT_Recipe_Map sLiquidFluorineThoriumReactorRecipes = new GT_Recipe_Map_FluidOnly( diff --git a/src/main/java/gregtech/api/util/ThermalFuel.java b/src/main/java/gregtech/api/util/ThermalFuel.java deleted file mode 100644 index 7bfb2b6a07..0000000000 --- a/src/main/java/gregtech/api/util/ThermalFuel.java +++ /dev/null @@ -1,41 +0,0 @@ -package gregtech.api.util; - -import net.minecraftforge.fluids.FluidStack; - -import gtPlusPlus.core.util.math.MathUtils; - -public class ThermalFuel { - - public static void addThermalFuel(FluidStack aInput1, FluidStack aInput2, FluidStack aOutput1, int euValue, - int aSpecialValue) { - GTPP_Recipe x = new GTPP_Recipe( - true, - null, - null, - null, - null, - new FluidStack[] { aInput1, aInput2 }, - new FluidStack[] { aOutput1 }, - 20, // 1 Tick - euValue, // No Eu produced - aSpecialValue // Magic Number - ); - GTPP_Recipe.GTPP_Recipe_Map.sGeoThermalFuels.addRecipe(x); - } - - public static void addSteamTurbineFuel(FluidStack aInput1) { - GTPP_Recipe x = new GTPP_Recipe( - true, - null, - null, - null, - null, - new FluidStack[] { aInput1 }, - null, - 20, // 1 Tick - MathUtils.findPercentageOfInt((aInput1.amount / 2), 95), // No Eu produced - 0 // Magic Number - ); - GTPP_Recipe.GTPP_Recipe_Map.sSteamTurbineFuels.addRecipe(x); - } -} diff --git a/src/main/java/gtPlusPlus/GTplusplus.java b/src/main/java/gtPlusPlus/GTplusplus.java index 9d4e041bbb..d5d8f9b6ab 100644 --- a/src/main/java/gtPlusPlus/GTplusplus.java +++ b/src/main/java/gtPlusPlus/GTplusplus.java @@ -47,7 +47,6 @@ import gtPlusPlus.core.handler.PacketHandler; import gtPlusPlus.core.handler.Recipes.RegistrationHandler; import gtPlusPlus.core.handler.events.LoginEventHandler; -import gtPlusPlus.core.handler.events.MissingMappingsEvent; import gtPlusPlus.core.lib.CORE; import gtPlusPlus.core.material.Material; import gtPlusPlus.core.util.Utils; @@ -175,7 +174,6 @@ public void preInit(final FMLPreInitializationEvent event) { // Utils.LOG_INFO("User's Country: " + CORE.USER_COUNTRY); Utils.registerEvent(new LoginEventHandler()); - Utils.registerEvent(new MissingMappingsEvent()); Utils.registerEvent(new MobMentality()); Logger.INFO("Login Handler Initialized"); diff --git a/src/main/java/gtPlusPlus/GenerateDictionaries.java b/src/main/java/gtPlusPlus/GenerateDictionaries.java index 0ac2a3241d..6313a07c87 100644 --- a/src/main/java/gtPlusPlus/GenerateDictionaries.java +++ b/src/main/java/gtPlusPlus/GenerateDictionaries.java @@ -11,9 +11,8 @@ import java.util.ArrayList; import java.util.HashSet; import java.util.List; -import java.util.Random; -import gtPlusPlus.api.objects.random.XSTR; +import gregtech.api.objects.XSTR; public class GenerateDictionaries { @@ -97,14 +96,13 @@ public static void main(String[] args) { private static final class Utils { private static final Charset utf8 = StandardCharsets.UTF_8; - private static final Random rand = new XSTR(); private static final void log(String s) { System.out.println("[GTPP-Proguard] " + s); } public static int randInt(final int min, final int max) { - return rand.nextInt((max - min) + 1) + min; + return XSTR.XSTR_INSTANCE.nextInt((max - min) + 1) + min; } public static boolean doesFileExist(File f) { diff --git a/src/main/java/gtPlusPlus/RoadMap.java b/src/main/java/gtPlusPlus/RoadMap.java deleted file mode 100644 index e10c40d1cf..0000000000 --- a/src/main/java/gtPlusPlus/RoadMap.java +++ /dev/null @@ -1,47 +0,0 @@ -package gtPlusPlus; - -/** - * This Class purely exists to note down ideas and or plans to (re)implement things. - * - * @author Alkalus - * - */ -public class RoadMap { - - // Reorganization of Item, Block and Common Class loading. - /* - * So, due to the complex/silly way I've done things, I've ran into some circular loading problems around the mod. - * Issues occur where Classes like CI.java try access the GregtechItemList.java objects before they're actually set. - * A plan should be created to organize the best scheme to load things in the best order. - */ - - // Recreation of GUIs for all Multiblocks - /* - * Most Multi's use generic or straight out wrong GUI's on the controller. I'd like to go back and recreate all of - * these. Some could even benefit from a totally new type of UI (Instead of Text issues, just change a 2x2px area - * between red and green for status lights) These advanced GUIs are probably out of my capability, but if anyone - * thinks they're a good idea, I'll give them a go. - */ - - // Better Integration with GTNH - /* - * Refactor things to be more common, refactor things to automatically switch between GTNH and standard variants - * without having to over-abuse CORE.GTNH switches everywhere. Most of this can be done via expanding CI.java, so - * that we have automated handlers for everything (IE. getX(5) will get 5x of the correct version of X) - */ - - /* - * Thallium - Everglades only. (Mostly useless) Technetium - Has some recipes but seem to be dead ends so - * unobtainable. Polonium - Unobtainable. (Radioactive, Mostly Useless) Francium - Unobtainable. (Radioactive, - * Mostly Useless) Promethium - Unobtainable. Radium - Everglades only. (Do use, Moderately Rare) Actinium - - * Unobtainable. (Radioactive, Do use) Proactinium - Unobtainable. (Do use) Neptunium - Has some recipes but seem to - * be dead ends so unobtainable. Curium - Fusion only. Berkelium - Unobtainable. Californium - Fusion only. - * Einsteinium - Unobtainable. Fermium - Unobtainable. Strontium - Everglades only. (Do use 1) Iodine - Everglades - * only. Dysprosium - Everglades only. (Do use 1) Rhenium - Weird ABS recipe only. Flerovium - Unobtainable. Dubnium - * - Unobtainable. Seaborgium - Unobtainable. Bohrium - Unobtainable. Hassium - Unobtainable. Meitnerium - - * Unobtainable. Darmstadtium - Unobtainable. Roentgenium - Unobtainable. Copernicium - Unobtainable. Nihonium - - * Unobtainable. Moscovium - Unobtainable. Livermorium - Unobtainable. Tennessine - Unobtainable. Nobelium - - * Unobtainable. Lawrencium - Unobtainable. Astatine - Unobtainable. (Radioactive, Mostly Useless) - */ - -} diff --git a/src/main/java/gtPlusPlus/api/helpers/MaterialHelper.java b/src/main/java/gtPlusPlus/api/helpers/MaterialHelper.java deleted file mode 100644 index 4bfa15855c..0000000000 --- a/src/main/java/gtPlusPlus/api/helpers/MaterialHelper.java +++ /dev/null @@ -1,80 +0,0 @@ -package gtPlusPlus.api.helpers; - -import java.lang.reflect.Constructor; -import java.lang.reflect.InvocationTargetException; - -import net.minecraft.item.ItemStack; - -import gregtech.api.enums.Materials; -import gregtech.api.enums.OrePrefixes; -import gregtech.api.metatileentity.implementations.GT_MetaPipeEntity_Fluid; -import gregtech.api.util.GT_OreDictUnificator; -import gtPlusPlus.core.material.Material; -import gtPlusPlus.core.util.minecraft.ItemUtils; - -public class MaterialHelper { - - public static ItemStack getComponentFromMaterial(OrePrefixes oreprefix, Material material, int amount) { - return ItemUtils.getOrePrefixStack(oreprefix, material, amount); - } - - /** - * Generates a 16 Fluid Pipe - * - * @see {@code Example: Copper 16x Pipe (Materials.Copper, Materials.Copper.mName, "Copper", ID, 60, 1000, true)} - * @param aMaterial - Pipe Material - * @param name - Pipe Internal name - * @param displayName - Pipe Display Name - * @param aID - Pipe's Meta ID - * @param baseCapacity - Pipes Base Capacity - * @param heatCapacity - Pipe Max Temp - * @param gasProof - Is Gas Proof? - * @return A boolean which corresponds to whether or not the Pipe was registered to the Ore Dictionary. - */ - public static boolean generateHexadecuplePipe(Materials aMaterial, String name, String displayName, int aID, - int baseCapacity, int heatCapacity, boolean gasProof) { - try { - Class aPipeEntity = GT_MetaPipeEntity_Fluid.class; - Constructor constructor = aPipeEntity.getConstructor( - new Class[] { int.class, String.class, String.class, float.class, Materials.class, int.class, - int.class, boolean.class, int.class }); - if (constructor != null) { - GT_MetaPipeEntity_Fluid aPipe; - aPipe = constructor.newInstance( - aID, - "GT_Pipe_" + name + "_Hexadecuple", - "Hexadecuple " + displayName + " Fluid Pipe", - 1.0F, - aMaterial, - baseCapacity, - heatCapacity, - gasProof, - 16); - return GT_OreDictUnificator.registerOre("pipeHexadecuple" + aMaterial, aPipe.getStackForm(1L)); - } - - } catch (NoSuchMethodException | SecurityException | InstantiationException | IllegalAccessException - | IllegalArgumentException | InvocationTargetException e) {} - return false; - } - - public static ItemStack getCells(Materials aMaterial, int i) { - return ItemUtils.getOrePrefixStack(OrePrefixes.cell, aMaterial, i); - } - - public static ItemStack getDust(Materials aMaterial, int i) { - return ItemUtils.getOrePrefixStack(OrePrefixes.dust, aMaterial, i); - } - - public static ItemStack getDustSmall(Materials aMaterial, int i) { - return ItemUtils.getOrePrefixStack(OrePrefixes.dustSmall, aMaterial, i); - } - - public static ItemStack getDustTiny(Materials aMaterial, int i) { - return ItemUtils.getOrePrefixStack(OrePrefixes.dustTiny, aMaterial, i); - } - - public static ItemStack getGems(Materials aMaterial, int i) { - return ItemUtils.getOrePrefixStack(OrePrefixes.gem, aMaterial, i); - } -} diff --git a/src/main/java/gtPlusPlus/api/interfaces/IEntityCatcher.java b/src/main/java/gtPlusPlus/api/interfaces/IEntityCatcher.java deleted file mode 100644 index e3aa00e7a1..0000000000 --- a/src/main/java/gtPlusPlus/api/interfaces/IEntityCatcher.java +++ /dev/null @@ -1,20 +0,0 @@ -package gtPlusPlus.api.interfaces; - -import net.minecraft.entity.Entity; -import net.minecraft.item.ItemStack; -import net.minecraft.world.World; - -import gtPlusPlus.api.objects.minecraft.BlockPos; - -public interface IEntityCatcher { - - public boolean hasEntity(ItemStack aStack); - - public Entity getStoredEntity(World aWorld, ItemStack aStack); - - public boolean setStoredEntity(World aWorld, ItemStack aStack, Entity aEntity); - - public Class getStoredEntityClass(ItemStack aStack); - - public boolean spawnStoredEntity(World aWorld, ItemStack aStack, BlockPos aPos); -} diff --git a/src/main/java/gtPlusPlus/api/interfaces/IToolable.java b/src/main/java/gtPlusPlus/api/interfaces/IToolable.java deleted file mode 100644 index d696585b76..0000000000 --- a/src/main/java/gtPlusPlus/api/interfaces/IToolable.java +++ /dev/null @@ -1,22 +0,0 @@ -package gtPlusPlus.api.interfaces; - -public interface IToolable { - - public boolean isScrewdriverable(); - - public boolean onScrewdriverLMB(); - - public boolean onScrewdriverRMB(); - - public boolean isWrenchable(); - - public boolean onWrenchLMB(); - - public boolean onWrenchRMB(); - - public boolean isMalletable(); - - public boolean onMalletLMB(); - - public boolean onMalletRMB(); -} diff --git a/src/main/java/gtPlusPlus/api/objects/GregtechException.java b/src/main/java/gtPlusPlus/api/objects/GregtechException.java deleted file mode 100644 index 083a15f790..0000000000 --- a/src/main/java/gtPlusPlus/api/objects/GregtechException.java +++ /dev/null @@ -1,25 +0,0 @@ -package gtPlusPlus.api.objects; - -public class GregtechException extends Throwable { - - private static final long serialVersionUID = 3601884582161841486L; - - public GregtechException(String aError) { - this(aError, true); - } - - public GregtechException(String aError, boolean aIsVerbose) { - Logger.ERROR("Throwing GT++ Exception!"); - Logger.ERROR("[EXCEPTION] " + aError); - if (aIsVerbose) { - Logger.INFO("Throwing GT++ Exception!"); - Logger.INFO("[EXCEPTION] " + aError); - printStackTrace(); - } - } - - @Override - public void printStackTrace() { - super.printStackTrace(); - } -} diff --git a/src/main/java/gtPlusPlus/api/objects/data/ConcurrentHashSet.java b/src/main/java/gtPlusPlus/api/objects/data/ConcurrentHashSet.java deleted file mode 100644 index 1d6cad3a38..0000000000 --- a/src/main/java/gtPlusPlus/api/objects/data/ConcurrentHashSet.java +++ /dev/null @@ -1,17 +0,0 @@ -package gtPlusPlus.api.objects.data; - -import java.util.concurrent.ConcurrentHashMap; -import java.util.concurrent.ConcurrentMap; - -public class ConcurrentHashSet extends ConcurrentSet { - - private static final long serialVersionUID = -1293478938482781728L; - - public ConcurrentHashSet() { - this(new ConcurrentHashMap()); - } - - public ConcurrentHashSet(ConcurrentMap defaultMapType) { - super(defaultMapType); - } -} diff --git a/src/main/java/gtPlusPlus/api/objects/data/ConcurrentSet.java b/src/main/java/gtPlusPlus/api/objects/data/ConcurrentSet.java deleted file mode 100644 index aaa759edfa..0000000000 --- a/src/main/java/gtPlusPlus/api/objects/data/ConcurrentSet.java +++ /dev/null @@ -1,53 +0,0 @@ -package gtPlusPlus.api.objects.data; - -import java.io.Serializable; -import java.util.AbstractSet; -import java.util.Iterator; -import java.util.concurrent.ConcurrentMap; - -public abstract class ConcurrentSet extends AbstractSet implements Serializable { - - private static final long serialVersionUID = -6761513279741915432L; - - private final ConcurrentMap mInternalMap; - - private int mInternalID = 0; - - /** - * Creates a new instance which wraps the specified {@code map}. - */ - public ConcurrentSet(ConcurrentMap aMap) { - mInternalMap = aMap; - } - - @Override - public int size() { - return mInternalMap.size(); - } - - @Override - public boolean contains(Object o) { - return mInternalMap.containsKey(o); - } - - @Override - public boolean add(E o) { - return mInternalMap.putIfAbsent(mInternalID++, o) == null; - } - - @Override - public boolean remove(Object o) { - return mInternalMap.remove(o) != null; - } - - @Override - public void clear() { - this.mInternalID = 0; - mInternalMap.clear(); - } - - @Override - public Iterator iterator() { - return mInternalMap.values().iterator(); - } -} diff --git a/src/main/java/gtPlusPlus/api/objects/data/FlexiblePair.java b/src/main/java/gtPlusPlus/api/objects/data/FlexiblePair.java deleted file mode 100644 index 8ec21dab59..0000000000 --- a/src/main/java/gtPlusPlus/api/objects/data/FlexiblePair.java +++ /dev/null @@ -1,39 +0,0 @@ -package gtPlusPlus.api.objects.data; - -import java.io.Serializable; - -import com.google.common.base.Objects; - -public class FlexiblePair implements Serializable { - - /** - * SVUID - */ - private static final long serialVersionUID = 1250550491092812443L; - - private final K key; - private V value; - - public FlexiblePair(final K key, final V value) { - this.key = key; - this.value = value; - } - - public final K getKey() { - return this.key; - } - - public final V getValue() { - return this.value; - } - - public final void setValue(V aObj) { - value = aObj; - } - - @Override - public int hashCode() { - Integer aCode = Objects.hashCode(getKey(), getValue()); - return aCode != null ? aCode : super.hashCode(); - } -} diff --git a/src/main/java/gtPlusPlus/api/objects/data/WeightedCollection.java b/src/main/java/gtPlusPlus/api/objects/data/WeightedCollection.java index 46cb8b35d9..9d9201066b 100644 --- a/src/main/java/gtPlusPlus/api/objects/data/WeightedCollection.java +++ b/src/main/java/gtPlusPlus/api/objects/data/WeightedCollection.java @@ -7,7 +7,7 @@ import java.util.Set; import java.util.TreeMap; -import gtPlusPlus.api.objects.random.XSTR; +import gregtech.api.objects.XSTR; public class WeightedCollection implements Map { diff --git a/src/main/java/gtPlusPlus/api/objects/minecraft/FakeBlockPos.java b/src/main/java/gtPlusPlus/api/objects/minecraft/FakeBlockPos.java deleted file mode 100644 index 4af3df18ba..0000000000 --- a/src/main/java/gtPlusPlus/api/objects/minecraft/FakeBlockPos.java +++ /dev/null @@ -1,272 +0,0 @@ -package gtPlusPlus.api.objects.minecraft; - -import java.util.HashSet; -import java.util.Set; - -import net.minecraft.block.Block; -import net.minecraft.init.Blocks; -import net.minecraft.world.World; -import net.minecraftforge.common.DimensionManager; - -import gtPlusPlus.api.objects.data.AutoMap; - -public class FakeBlockPos extends BlockPos { - - private static final long serialVersionUID = -6442245826092414593L; - private transient Block aBlockAtPos; - private int aBlockMetaAtPos = 0; - - public static FakeBlockPos generateBlockPos(String sUUID) { - String[] s2 = sUUID.split("@"); - return new FakeBlockPos(s2); - } - - public FakeBlockPos(String[] s) { - this(Integer.parseInt(s[1]), Integer.parseInt(s[2]), Integer.parseInt(s[3]), Integer.parseInt(s[0])); - } - - public FakeBlockPos(int x, int y, int z, Block aBlock, int aMeta) { - this(x, y, z, 0); - aBlockAtPos = aBlock; - aBlockMetaAtPos = aMeta; - } - - private FakeBlockPos(int x, int y, int z, int dim) { - this(x, y, z, DimensionManager.getWorld(dim)); - } - - private FakeBlockPos(int x, int y, int z, World dim) { - super(x, y, z, null); - } - - @Override - public String getLocationString() { - String S = "" + this.xPos + "@" + this.yPos + "@" + this.zPos; - return S; - } - - @Override - public String getUniqueIdentifier() { - String S = "" + this.xPos - + "@" - + this.yPos - + "@" - + this.zPos - + this.aBlockAtPos.getLocalizedName() - + "@" - + this.aBlockMetaAtPos; - return S; - } - - @Override - public int hashCode() { - int hash = 5; - hash += (13 * this.xPos); - hash += (19 * this.yPos); - hash += (31 * this.zPos); - hash += (17 * this.dim); - return hash; - } - - @Override - public boolean equals(Object other) { - if (other == null) { - return false; - } - if (other == this) { - return true; - } - if (!(other instanceof FakeBlockPos)) { - return false; - } - FakeBlockPos otherPoint = (FakeBlockPos) other; - return this.xPos == otherPoint.xPos && this.yPos == otherPoint.yPos && this.zPos == otherPoint.zPos; - } - - public int distanceFrom(FakeBlockPos target) { - if (target.dim != this.dim) { - return Short.MIN_VALUE; - } - return distanceFrom(target.xPos, target.yPos, target.zPos); - } - - /** - * - * @param x X coordinate of target. - * @param y Y coordinate of target. - * @param z Z coordinate of target. - * @return square of distance - */ - @Override - public int distanceFrom(int x, int y, int z) { - int distanceX = this.xPos - x; - int distanceY = this.yPos - y; - int distanceZ = this.zPos - z; - return distanceX * distanceX + distanceY * distanceY + distanceZ * distanceZ; - } - - public boolean isWithinRange(FakeBlockPos target, int range) { - if (target.dim != this.dim) { - return false; - } - return isWithinRange(target.xPos, target.yPos, target.zPos, range); - } - - @Override - public boolean isWithinRange(int x, int y, int z, int range) { - return distanceFrom(x, y, z) <= (range * range); - } - - @Override - public FakeBlockPos getUp() { - return new FakeBlockPos(this.xPos, this.yPos + 1, this.zPos, this.dim); - } - - @Override - public FakeBlockPos getDown() { - return new FakeBlockPos(this.xPos, this.yPos - 1, this.zPos, this.dim); - } - - @Override - public FakeBlockPos getXPos() { - return new FakeBlockPos(this.xPos + 1, this.yPos, this.zPos, this.dim); - } - - @Override - public FakeBlockPos getXNeg() { - return new FakeBlockPos(this.xPos - 1, this.yPos, this.zPos, this.dim); - } - - @Override - public FakeBlockPos getZPos() { - return new FakeBlockPos(this.xPos, this.yPos, this.zPos + 1, this.dim); - } - - @Override - public FakeBlockPos getZNeg() { - return new FakeBlockPos(this.xPos, this.yPos, this.zPos - 1, this.dim); - } - - @Override - public AutoMap getSurroundingBlocks() { - AutoMap sides = new AutoMap(); - sides.put(getUp()); - sides.put(getDown()); - sides.put(getXPos()); - sides.put(getXNeg()); - sides.put(getZPos()); - sides.put(getZNeg()); - return sides; - } - - @Override - public Block getBlockAtPos() { - return getBlockAtPos(this); - } - - public Block getBlockAtPos(FakeBlockPos pos) { - return getBlockAtPos(world, pos); - } - - public Block getBlockAtPos(World world, FakeBlockPos pos) { - return aBlockAtPos; - } - - @Override - public int getMetaAtPos() { - return getMetaAtPos(this); - } - - public int getMetaAtPos(FakeBlockPos pos) { - return getMetaAtPos(world, pos); - } - - public int getMetaAtPos(World world, FakeBlockPos pos) { - return aBlockMetaAtPos; - } - - @Override - public boolean hasSimilarNeighbour() { - return hasSimilarNeighbour(false); - } - - /** - * @param strict - Does this check Meta Data? - * @return - Does this block have a neighbour that is the same? - */ - @Override - public boolean hasSimilarNeighbour(boolean strict) { - for (BlockPos g : getSurroundingBlocks().values()) { - if (getBlockAtPos(g) == getBlockAtPos()) { - if (!strict) { - return true; - } else { - if (getMetaAtPos() == getMetaAtPos(g)) { - return true; - } - } - } - } - return false; - } - - @Override - public AutoMap getSimilarNeighbour() { - return getSimilarNeighbour(false); - } - - /** - * @param strict - Does this check Meta Data? - * @return - Does this block have a neighbour that is the same? - */ - @Override - public AutoMap getSimilarNeighbour(boolean strict) { - AutoMap sides = new AutoMap(); - for (BlockPos g : getSurroundingBlocks().values()) { - if (getBlockAtPos(g) == getBlockAtPos()) { - if (!strict) { - sides.put(g); - } else { - if (getMetaAtPos() == getMetaAtPos(g)) { - sides.put(g); - } - } - } - } - return sides; - } - - @Override - public Set getValidNeighboursAndSelf() { - AutoMap h = getSimilarNeighbour(true); - h.put(this); - Set result = new HashSet(); - for (BlockPos f : h.values()) { - result.add(f); - } - return result; - } - - /** - * Called when a plant grows on this block, only implemented for saplings using the WorldGen*Trees classes right - * now. Modder may implement this for custom plants. This does not use ForgeDirection, because large/huge trees can - * be located in non-representable direction, so the source location is specified. Currently this just changes the - * block to dirt if it was grass. - * - * Note: This happens DURING the generation, the generation may not be complete when this is called. - * - * @param world Current world - * @param x Soil X - * @param y Soil Y - * @param z Soil Z - * @param sourceX Plant growth location X - * @param sourceY Plant growth location Y - * @param sourceZ Plant growth location Z - */ - public void onPlantGrow(FakeWorld world, int x, int y, int z, int sourceX, int sourceY, int sourceZ) { - if (getBlockAtPos() == Blocks.grass || getBlockAtPos() == Blocks.farmland) { - this.aBlockAtPos = Blocks.dirt; - this.aBlockMetaAtPos = 0; - } - } -} diff --git a/src/main/java/gtPlusPlus/api/objects/minecraft/FakeWorld.java b/src/main/java/gtPlusPlus/api/objects/minecraft/FakeWorld.java deleted file mode 100644 index be158a38cd..0000000000 --- a/src/main/java/gtPlusPlus/api/objects/minecraft/FakeWorld.java +++ /dev/null @@ -1,154 +0,0 @@ -package gtPlusPlus.api.objects.minecraft; - -import java.util.HashMap; - -import net.minecraft.block.Block; -import net.minecraft.block.material.Material; -import net.minecraft.init.Blocks; -import net.minecraft.item.ItemStack; -import net.minecraft.tileentity.TileEntity; -import net.minecraft.world.IBlockAccess; -import net.minecraft.world.biome.BiomeGenBase; -import net.minecraftforge.common.util.ForgeDirection; - -import gtPlusPlus.api.objects.Logger; -import gtPlusPlus.api.objects.data.AutoMap; -import gtPlusPlus.core.util.math.MathUtils; -import gtPlusPlus.core.util.minecraft.ItemUtils; - -public class FakeWorld implements IBlockAccess { - - public static HashMap mStaticFakeWorldData; - - public HashMap mFakeWorldData = new HashMap(); - - /** - * Must be an odd number - */ - private int aWorldSize = 99; - - private final int aDistanceFromOrigin; - private final int aWorldHeight; - - public FakeWorld() { - this(99); - } - - public FakeWorld(int aSize) { - if (MathUtils.isNumberEven(aSize)) { - aSize++; - } - aWorldSize = aSize; - aDistanceFromOrigin = ((aWorldSize - 1) / 2); - aWorldHeight = aDistanceFromOrigin >= 255 ? 255 : aDistanceFromOrigin; - Logger.WARNING("Created a Fake World with data:"); - Logger.WARNING("World Size: " + aWorldSize); - Logger.WARNING("Distance from Origin in each dir: " + aDistanceFromOrigin); - Logger.WARNING("World Height: " + aWorldHeight); - init(); - } - - public void init() { - - /* - * if (mStaticFakeWorldData == null) { Logger.WARNING("Setting all Blocks in Fake World to Air."); - * mStaticFakeWorldData = new HashMap(); for (int y=0;y<=aWorldHeight;y++) { for (int - * x=-aDistanceFromOrigin;x<=aDistanceFromOrigin;x++) { for (int - * z=-aDistanceFromOrigin;z<=aDistanceFromOrigin;z++) { FakeBlockPos aTempPos = new FakeBlockPos(x, y, z, - * Blocks.air, 0); mStaticFakeWorldData.put(aTempPos.getLocationString(), aTempPos); } } } } - */ - // if (mStaticFakeWorldData != null) { - // Logger.WARNING(" Instancing static air world."); - mFakeWorldData = new HashMap(); - // mFakeWorldData = (HashMap) mStaticFakeWorldData.clone(); - // } - - // Logger.WARNING("Initialisation of FakeWorld is now complete."); - } - - public FakeBlockPos getBlockAtCoords(int x, int y, int z) { - String S = "" + x + "@" + y + "@" + z; - FakeBlockPos aBlock = mFakeWorldData.get(S); - if (aBlock == null) { - return new FakeBlockPos(x, y, z, Blocks.air, 0); - } - return aBlock; - } - - public void setBlockAtCoords(int x, int y, int z, Block aBlock, int aMeta) { - FakeBlockPos aTempPos = new FakeBlockPos(x, y, z, aBlock, aMeta); - Logger.WARNING("Setting " + x + ", " + y + ", " + z + " to " + aBlock.getLocalizedName() + ":" + aMeta); - mFakeWorldData.put(aTempPos.getLocationString(), aTempPos); - } - - public AutoMap getAllBlocksStoredInFakeWorld() { - AutoMap aOutput = new AutoMap(); - for (FakeBlockPos aPos : mFakeWorldData.values()) { - if (aPos == null || aPos.getBlockAtPos() == Blocks.air) { - continue; - } else { - ItemStack aTempStack = ItemUtils.simpleMetaStack(aPos.getBlockAtPos(), aPos.getMetaAtPos(), 1); - if (ItemUtils.checkForInvalidItems(aTempStack)) { - // Logger.WARNING("Output: "+aTempStack.getDisplayName()); - aOutput.put(aTempStack); - } - } - } - return aOutput; - } - - @Override - public Block getBlock(int x, int y, int z) { - FakeBlockPos aPos = getBlockAtCoords(x, y, z); - return aPos.getBlockAtPos(); - } - - @Override - public boolean isAirBlock(int x, int y, int z) { - Block aBlock = getBlock(x, y, z); - return aBlock == Blocks.air || aBlock.getMaterial() == Material.air; - } - - @Override - public TileEntity getTileEntity(int p_147438_1_, int p_147438_2_, int p_147438_3_) { - return null; - } - - @Override - public int getLightBrightnessForSkyBlocks(int p_72802_1_, int p_72802_2_, int p_72802_3_, int p_72802_4_) { - return 0; - } - - @Override - public int getBlockMetadata(int x, int y, int z) { - return getBlockAtCoords(x, y, z).getMetaAtPos(); - } - - @Override - public int isBlockProvidingPowerTo(int p_72879_1_, int p_72879_2_, int p_72879_3_, int p_72879_4_) { - return 0; - } - - @Override - public BiomeGenBase getBiomeGenForCoords(int p_72807_1_, int p_72807_2_) { - return BiomeGenBase.plains; - } - - @Override - public int getHeight() { - return aWorldHeight; - } - - @Override - public boolean extendedLevelsInChunkCache() { - return false; - } - - @Override - public boolean isSideSolid(int x, int y, int z, ForgeDirection side, boolean _default) { - if (!isAirBlock(x, y, z)) { - return true; - } - return false; - } -} diff --git a/src/main/java/gtPlusPlus/api/objects/minecraft/FormattedTooltipString.java b/src/main/java/gtPlusPlus/api/objects/minecraft/FormattedTooltipString.java deleted file mode 100644 index 73d17aba39..0000000000 --- a/src/main/java/gtPlusPlus/api/objects/minecraft/FormattedTooltipString.java +++ /dev/null @@ -1,23 +0,0 @@ -package gtPlusPlus.api.objects.minecraft; - -public class FormattedTooltipString { - - public final String mText; - public final boolean mPrefix; - - public FormattedTooltipString(String aText, boolean aPrefix) { - mText = aText; - mPrefix = aPrefix; - } - - public String getTooltip(Object aTagValue) { - String aTip; - - if (mPrefix) { - aTip = mText + ": " + aTagValue.toString(); - } else { - aTip = "" + aTagValue.toString() + ": " + mText; - } - return aTip; - } -} diff --git a/src/main/java/gtPlusPlus/api/objects/random/XSTR.java b/src/main/java/gtPlusPlus/api/objects/random/XSTR.java deleted file mode 100644 index 087f9535ce..0000000000 --- a/src/main/java/gtPlusPlus/api/objects/random/XSTR.java +++ /dev/null @@ -1,253 +0,0 @@ -package gtPlusPlus.api.objects.random; - -/** - * A subclass of java.util.random that implements the Xorshift random number generator - * - * - it is 30% faster than the generator from Java's library - it produces random sequences of higher quality than - * java.util.Random - this class also provides a clone() function - * - * Usage: XSRandom rand = new XSRandom(); //Instantiation x = rand.nextInt(); //pull a random number - * - * To use the class in legacy code, you may also instantiate an XSRandom object and assign it to a java.util.Random - * object: java.util.Random rand = new XSRandom(); - * - * for an explanation of the algorithm, see http://demesos.blogspot.com/2011/09/pseudo-random-number-generators.html - * - * @author Wilfried Elmenreich University of Klagenfurt/Lakeside Labs http://www.elmenreich.tk - * - * This code is released under the GNU Lesser General Public License Version 3 - * http://www.gnu.org/licenses/lgpl-3.0.txt - */ -import java.util.Random; -import java.util.concurrent.atomic.AtomicLong; - -/** - * XSTR - Xorshift ThermiteRandom Modified by Bogdan-G 03.06.2016 version 0.0.4 - */ -public class XSTR extends Random implements Cloneable { - - private static final long serialVersionUID = 6208727693524452904L; - private long seed; - private long last; - private static final long GAMMA = 0x9e3779b97f4a7c15L; - private static final int PROBE_INCREMENT = 0x9e3779b9; - private static final long SEEDER_INCREMENT = 0xbb67ae8584caa73bL; - private static final double DOUBLE_UNIT = 0x1.0p-53; // 1.0 / (1L << 53) - private static final float FLOAT_UNIT = 0x1.0p-24f; // 1.0f / (1 << 24) - - /* - * MODIFIED BY: Robotia Modification: Implemented Random class seed generator - */ - /** - * Creates a new pseudo random number generator. The seed is initialized to the current time, as if by - * setSeed(System.currentTimeMillis());. - */ - public XSTR() { - this(seedUniquifier() ^ System.nanoTime()); - } - - private static final AtomicLong seedUniquifier = new AtomicLong(8682522807148012L); - - private static long seedUniquifier() { - // L'Ecuyer, "Tables of Linear Congruential Generators of - // Different Sizes and Good Lattice Structure", 1999 - for (;;) { - final long current = seedUniquifier.get(); - final long next = current * 181783497276652981L; - if (seedUniquifier.compareAndSet(current, next)) { - return next; - } - } - } - - /** - * Creates a new pseudo random number generator, starting with the specified seed, using - * setSeed(seed);. - * - * @param seed the initial seed - */ - public XSTR(final long seed) { - this.seed = seed; - } - - @Override - public boolean nextBoolean() { - return this.next(1) != 0; - } - - @Override - public double nextDouble() { - return (((long) (this.next(26)) << 27) + this.next(27)) * DOUBLE_UNIT; - } - - /** - * Returns the current state of the seed, can be used to clone the object - * - * @return the current seed - */ - public synchronized long getSeed() { - return this.seed; - } - - /** - * Sets the seed for this pseudo random number generator. As described above, two instances of the same random - * class, starting with the same seed, produce the same results, if the same methods are called. - * - * @param seed the new seed - */ - @Override - public synchronized void setSeed(final long seed) { - this.seed = seed; - } - - /** - * @return Returns an XSRandom object with the same state as the original - */ - @Override - public XSTR clone() { - try { - super.clone(); - } catch (CloneNotSupportedException e) { - // TODO Auto-generated catch block - e.printStackTrace(); - } - return new XSTR(this.getSeed()); - } - - /** - * Implementation of George Marsaglia's elegant Xorshift random generator 30% faster and better quality than the - * built-in java.util.random see also see http://www.javamex.com/tutorials/random_numbers/xorshift.shtml - * - * @param nbits - * @return - */ - @Override - public int next(final int nbits) { - long x = this.seed; - x ^= (x << 21); - x ^= (x >>> 35); - x ^= (x << 4); - this.seed = x; - x &= ((1L << nbits) - 1); - return (int) x; - } - - boolean haveNextNextGaussian = false; - double nextNextGaussian = 0; - - @Override - public synchronized double nextGaussian() { - // See Knuth, ACP, Section 3.4.1 Algorithm C. - if (this.haveNextNextGaussian) { - this.haveNextNextGaussian = false; - return this.nextNextGaussian; - } - double v1, v2, s; - do { - v1 = (2 * this.nextDouble()) - 1; // between -1 and 1 - v2 = (2 * this.nextDouble()) - 1; // between -1 and 1 - s = (v1 * v1) + (v2 * v2); - } while ((s >= 1) || (s == 0)); - final double multiplier = StrictMath.sqrt((-2 * StrictMath.log(s)) / s); - this.nextNextGaussian = v2 * multiplier; - this.haveNextNextGaussian = true; - return v1 * multiplier; - } - - /** - * Returns a pseudorandom, uniformly distributed {@code int} value between 0 (inclusive) and the specified value - * (exclusive), drawn from this random number generator's sequence. The general contract of {@code nextInt} is that - * one {@code int} value in the specified range is pseudorandomly generated and returned. All {@code bound} possible - * {@code int} values are produced with (approximately) equal probability. The method {@code nextInt(int bound)} is - * implemented by class {@code Random} as if by: - * - *
-     *  {@code
-     * public int nextInt(int bound) {
-     *   if (bound <= 0)
-     *     throw new IllegalArgumentException("bound must be positive");
-     *
-     *   if ((bound & -bound) == bound)  // i.e., bound is a power of 2
-     *     return (int)((bound * (long)next(31)) >> 31);
-     *
-     *   int bits, val;
-     *   do {
-     *       bits = next(31);
-     *       val = bits % bound;
-     *   } while (bits - val + (bound-1) < 0);
-     *   return val;
-     * }}
-     * 
- * - *

- * The hedge "approx imately" is used in the foregoing description only because the next method is only - * approximately an unbiased source of independently chosen bits. If it were a perfect source of randomly chosen - * bits, then the algorithm shown would choose {@code int} values from the stated range with perfect uniformity. - *

- * The algorithm is slightly tricky. It rejects values that would result in an uneven distribution (due to the fact - * that 2^31 is not divisible by n). The probability of a value being rejected depends on n. The worst case is - * n=2^30+1, for which the probability of a reject is 1/2, and the expected number of iterations before the loop - * terminates is 2. - *

- * The algorithm treats the case where n is a power of two specially: it returns the correct number of high-order - * bits from the underlying pseudo-random number generator. In the absence of special treatment, the correct number - * of low-order bits would be returned. Linear congruential pseudo-random number generators such as the one - * implemented by this class are known to have short periods in the sequence of values of their low-order bits. - * Thus, this special case greatly increases the length of the sequence of values returned by successive calls to - * this method if n is a small power of two. - * - * @param bound the upper bound (exclusive). Must be positive. - * @return the next pseudorandom, uniformly distributed {@code int} value between zero (inclusive) and {@code bound} - * (exclusive) from this random number generator's sequence - * @throws IllegalArgumentException if bound is not positive - * @since 1.2 - */ - @Override - public int nextInt(final int bound) { - final int newBound; - if (bound <= 0) { - newBound = 1; - // throw new RuntimeException("BadBound"); - } else { - newBound = bound; - } - - /* - * int r = next(31); int m = bound - 1; if ((bound & m) == 0) // i.e., bound is a power of 2 { r = (int) ((bound - * * (long) r) >> 31); } else { for (int u = r; u - (r = u % bound) + m < 0; u = next(31)) ; } return r; - */ - // speedup, new nextInt ~+40% - this.last = this.seed ^ (this.seed << 21); - this.last ^= (this.last >>> 35); - this.last ^= (this.last << 4); - this.seed = this.last; - final int out = (int) this.last % newBound; - return (out < 0) ? -out : out; - } - - @Override - public int nextInt() { - return this.next(32); - } - - @Override - public float nextFloat() { - return this.next(24) * FLOAT_UNIT; - } - - @Override - public long nextLong() { - // it's okay that the bottom word remains signed. - return ((long) (this.next(32)) << 32) + this.next(32); - } - - @Override - public void nextBytes(final byte[] bytes_arr) { - for (int iba = 0, lenba = bytes_arr.length; iba < lenba;) { - for (int rndba = this.nextInt(), nba = Math.min(lenba - iba, Integer.SIZE / Byte.SIZE); nba-- - > 0; rndba >>= Byte.SIZE) { - bytes_arr[iba++] = (byte) rndba; - } - } - } -} diff --git a/src/main/java/gtPlusPlus/core/block/base/BlockBaseNBT.java b/src/main/java/gtPlusPlus/core/block/base/BlockBaseNBT.java deleted file mode 100644 index 55f1df240f..0000000000 --- a/src/main/java/gtPlusPlus/core/block/base/BlockBaseNBT.java +++ /dev/null @@ -1,86 +0,0 @@ -package gtPlusPlus.core.block.base; - -import net.minecraft.block.Block; -import net.minecraft.block.BlockContainer; -import net.minecraft.block.material.Material; -import net.minecraft.entity.EnumCreatureType; -import net.minecraft.entity.player.EntityPlayer; -import net.minecraft.tileentity.TileEntity; -import net.minecraft.util.IIcon; -import net.minecraft.world.Explosion; -import net.minecraft.world.IBlockAccess; -import net.minecraft.world.World; - -import cpw.mods.fml.common.registry.GameRegistry; -import cpw.mods.fml.relauncher.Side; -import cpw.mods.fml.relauncher.SideOnly; -import gtPlusPlus.core.creative.AddToCreativeTab; -import gtPlusPlus.core.item.base.itemblock.ItemBlockNBT; - -public abstract class BlockBaseNBT extends BlockContainer { - - @SideOnly(Side.CLIENT) - private IIcon textureTop; - - @SideOnly(Side.CLIENT) - private IIcon textureBottom; - - @SideOnly(Side.CLIENT) - private IIcon textureFront; - - public BlockBaseNBT(final Material material, final String unlocalName, final String displayName) { - super(material); - this.setBlockName(unlocalName); - this.setCreativeTab(AddToCreativeTab.tabMachines); - GameRegistry.registerBlock(this, ItemBlockNBT.class, unlocalName); - // LanguageRegistry.addName(this, displayName); - } - - /** - * Gets the block's texture. Args: side, meta - */ - @Override - @SideOnly(Side.CLIENT) - public IIcon getIcon(final int ordinalSide, final int meta) { - return ordinalSide == 1 ? this.textureTop - : (ordinalSide == 0 ? this.textureBottom - : ((ordinalSide != 2) && (ordinalSide != 4) ? this.blockIcon : this.textureFront)); - } - - @Override - public abstract TileEntity createNewTileEntity(final World world, final int p_149915_2_); - - @Override - public void breakBlock(final World world, final int x, final int y, final int z, final Block block, - final int meta) { - super.breakBlock(world, x, y, z, block, meta); - } - - @Override - public void onBlockDestroyedByPlayer(final World world, final int x, final int y, final int z, final int meta) { - super.onBlockDestroyedByPlayer(world, x, y, z, meta); - } - - @Override - public void onBlockDestroyedByExplosion(final World world, final int x, final int y, final int z, - final Explosion explosion) { - super.onBlockDestroyedByExplosion(world, x, y, z, explosion); - } - - @Override - public void onBlockHarvested(final World world, final int x, final int y, final int z, final int meta, - final EntityPlayer player) { - super.onBlockHarvested(world, x, y, z, meta, player); - } - - @Override - public void onBlockExploded(final World world, final int x, final int y, final int z, final Explosion explosion) { - super.onBlockExploded(world, x, y, z, explosion); - } - - @Override - public boolean canCreatureSpawn(final EnumCreatureType type, final IBlockAccess world, final int x, final int y, - final int z) { - return false; - } -} diff --git a/src/main/java/gtPlusPlus/core/block/general/HellFire.java b/src/main/java/gtPlusPlus/core/block/general/HellFire.java index 916385647c..15a5c5ae17 100644 --- a/src/main/java/gtPlusPlus/core/block/general/HellFire.java +++ b/src/main/java/gtPlusPlus/core/block/general/HellFire.java @@ -29,7 +29,7 @@ import cpw.mods.fml.common.registry.GameRegistry; import cpw.mods.fml.relauncher.Side; import cpw.mods.fml.relauncher.SideOnly; -import gtPlusPlus.api.objects.random.XSTR; +import gregtech.api.objects.XSTR; import gtPlusPlus.core.creative.AddToCreativeTab; import gtPlusPlus.core.util.math.MathUtils; diff --git a/src/main/java/gtPlusPlus/core/fluids/BlockFluidBase.java b/src/main/java/gtPlusPlus/core/fluids/BlockFluidBase.java deleted file mode 100644 index 9c4fb4d66a..0000000000 --- a/src/main/java/gtPlusPlus/core/fluids/BlockFluidBase.java +++ /dev/null @@ -1,106 +0,0 @@ -package gtPlusPlus.core.fluids; - -import static gregtech.api.enums.Mods.GTPlusPlus; - -import net.minecraft.block.material.Material; -import net.minecraft.client.renderer.texture.IIconRegister; -import net.minecraft.entity.Entity; -import net.minecraft.entity.EntityLivingBase; -import net.minecraft.util.IIcon; -import net.minecraft.world.IBlockAccess; -import net.minecraft.world.World; -import net.minecraftforge.common.util.ForgeDirection; -import net.minecraftforge.fluids.BlockFluidClassic; -import net.minecraftforge.fluids.Fluid; - -import cpw.mods.fml.relauncher.Side; -import cpw.mods.fml.relauncher.SideOnly; -import gtPlusPlus.core.util.Utils; - -public class BlockFluidBase extends BlockFluidClassic { - - @SideOnly(Side.CLIENT) - protected static IIcon stillIcon; - - @SideOnly(Side.CLIENT) - protected static IIcon flowingIcon; - - protected final short[] mRGB; - - public BlockFluidBase(Fluid fluid, short[] aRGB) { - this(fluid, Material.water, aRGB); - } - - public BlockFluidBase(Fluid fluid, Material material, short[] aRGB) { - super(fluid, material); - mRGB = aRGB; - this.setHardness(100.0F); - this.setLightOpacity(3); - this.disableStats(); - } - - @Override - public void onEntityCollidedWithBlock(World world, int x, int y, int z, Entity ent) { - if (!(ent instanceof EntityLivingBase)) { - return; - } - /* - * EntityLivingBase player = (EntityLivingBase) ent; int pot = world.rand.nextInt(Potion.potionTypes.length); - * Potion.potionTypes[pot].performEffect(player, 40); - */ - } - - @Override - public IIcon getIcon(int ordinalSide, int meta) { - return (ordinalSide == 0 || ordinalSide == 1) ? stillIcon : flowingIcon; - } - - @SideOnly(Side.CLIENT) - @Override - public void registerBlockIcons(IIconRegister register) { - if (stillIcon == null) { - stillIcon = register.registerIcon(GTPlusPlus.ID + ":" + "fluids/fluid.fluid.autogenerated.still"); - } - if (flowingIcon == null) { - flowingIcon = register.registerIcon(GTPlusPlus.ID + ":" + "fluids/fluid.fluid.autogenerated.flowing"); - } - } - - @Override - public int getBlockColor() { - if (mRGB != null && mRGB.length >= 3) { - return Utils.rgbtoHexValue(mRGB[0], mRGB[1], mRGB[2]); - } - return super.getBlockColor(); - } - - @Override - public int getRenderColor(int aMeta) { - if (mRGB != null && mRGB.length >= 3) { - return Utils.rgbtoHexValue(mRGB[0], mRGB[1], mRGB[2]); - } - return super.getRenderColor(aMeta); - } - - @Override - public boolean recolourBlock(World world, int x, int y, int z, ForgeDirection side, int colour) { - // TODO Auto-generated method stub - return super.recolourBlock(world, x, y, z, side, colour); - } - - @Override - public boolean canDisplace(IBlockAccess world, int x, int y, int z) { - if (world.getBlock(x, y, z).getMaterial().isLiquid()) { - return false; - } - return super.canDisplace(world, x, y, z); - } - - @Override - public boolean displaceIfPossible(World world, int x, int y, int z) { - if (world.getBlock(x, y, z).getMaterial().isLiquid()) { - return false; - } - return super.displaceIfPossible(world, x, y, z); - } -} diff --git a/src/main/java/gtPlusPlus/core/fluids/FactoryFluid.java b/src/main/java/gtPlusPlus/core/fluids/FactoryFluid.java deleted file mode 100644 index 96936cced8..0000000000 --- a/src/main/java/gtPlusPlus/core/fluids/FactoryFluid.java +++ /dev/null @@ -1,67 +0,0 @@ -package gtPlusPlus.core.fluids; - -import static gregtech.api.enums.Mods.GTPlusPlus; - -import net.minecraft.block.Block; -import net.minecraft.item.EnumRarity; -import net.minecraftforge.fluids.Fluid; - -import gregtech.api.GregTech_API; - -public class FactoryFluid extends Fluid implements Runnable { - - private final String mTextureName; - private final short[] mRGBa; - - public FactoryFluid(String fluidName, final short[] aRGBa) { - this( - fluidName, - null, - Short.MIN_VALUE, - Short.MIN_VALUE, - Short.MIN_VALUE, - Short.MIN_VALUE, - false, - EnumRarity.common, - aRGBa); - } - - public FactoryFluid(String fluidName, int luminosity, int density, int temp, int viscosity, final short[] aRGBa) { - this( - fluidName, - null, - luminosity, - density, - temp, - viscosity, - (density == Short.MIN_VALUE || density >= 0 ? false : true), - EnumRarity.common, - aRGBa); - } - - public FactoryFluid(String fluidName, Block aBlock, int luminosity, int density, int temp, int viscosity, - boolean gas, EnumRarity aRarity, final short[] aRGBa) { - super(fluidName); - this.mRGBa = aRGBa; - this.setBlock(aBlock); - if (luminosity != Short.MIN_VALUE) this.setLuminosity(luminosity); - if (density != Short.MIN_VALUE) this.setDensity(density); - if (temp != Short.MIN_VALUE) this.setTemperature(temp); - if (viscosity != Short.MIN_VALUE) this.setViscosity(viscosity); - this.setGaseous(gas); - this.setRarity(aRarity); - this.mTextureName = GTPlusPlus.ID + ":fluids/fluid.fluid.autogenerated"; - GregTech_API.sGTBlockIconload.add(this); - } - - @Override - public int getColor() { - return (Math.max(0, Math.min(255, this.mRGBa[0])) << 16) | (Math.max(0, Math.min(255, this.mRGBa[1])) << 8) - | Math.max(0, Math.min(255, this.mRGBa[2])); - } - - @Override - public void run() { - this.setIcons(GregTech_API.sBlockIcons.registerIcon(this.mTextureName)); - } -} diff --git a/src/main/java/gtPlusPlus/core/gui/item/box/GuiBaseBox.java b/src/main/java/gtPlusPlus/core/gui/item/box/GuiBaseBox.java deleted file mode 100644 index 5bbb405aa3..0000000000 --- a/src/main/java/gtPlusPlus/core/gui/item/box/GuiBaseBox.java +++ /dev/null @@ -1,124 +0,0 @@ -package gtPlusPlus.core.gui.item.box; - -import net.minecraft.client.gui.inventory.GuiContainer; -import net.minecraft.client.renderer.OpenGlHelper; -import net.minecraft.client.renderer.RenderHelper; -import net.minecraft.client.renderer.entity.RenderManager; -import net.minecraft.client.resources.I18n; -import net.minecraft.entity.EntityLivingBase; -import net.minecraft.util.ResourceLocation; - -import org.lwjgl.opengl.GL11; -import org.lwjgl.opengl.GL12; - -import gtPlusPlus.core.item.tool.misc.box.ContainerBoxBase; -import gtPlusPlus.core.item.tool.misc.box.CustomBoxInventory; - -public class GuiBaseBox extends GuiContainer { - - /** - * x and y size of the inventory window in pixels. Defined as float, passed as int These are used for drawing the - * player model. - */ - private float xSize_lo; - - private float ySize_lo; - - /** - * ResourceLocation takes 2 parameters: ModId, path to texture at the location: "src/minecraft/assets/modid/" - * - * I have provided a sample texture file that works with this tutorial. Download it from - * Forge_Tutorials/textures/gui/ - */ - private final ResourceLocation iconLocation; - - /** The inventory to render on screen */ - private final CustomBoxInventory inventory; - - public GuiBaseBox(ContainerBoxBase containerItem, ResourceLocation aGuiTexture) { - super(containerItem); - this.inventory = containerItem.getInventoryObject(); - this.iconLocation = aGuiTexture; - } - - /** - * Draws the screen and all the components in it. - */ - @Override - public void drawScreen(int par1, int par2, float par3) { - super.drawScreen(par1, par2, par3); - this.xSize_lo = (float) par1; - this.ySize_lo = (float) par2; - } - - /** - * Draw the foreground layer for the GuiContainer (everything in front of the items) - */ - @Override - protected void drawGuiContainerForegroundLayer(int par1, int par2) { - String s = this.inventory.hasCustomInventoryName() ? this.inventory.getInventoryName() - : I18n.format(this.inventory.getInventoryName()); - this.fontRendererObj.drawString(s, this.xSize / 2 - this.fontRendererObj.getStringWidth(s) / 2, 0, 4210752); - this.fontRendererObj.drawString(I18n.format("container.inventory"), 26, this.ySize - 96 + 4, 4210752); - } - - /** - * Draw the background layer for the GuiContainer (everything behind the items) - */ - @Override - protected void drawGuiContainerBackgroundLayer(float par1, int par2, int par3) { - GL11.glColor4f(1.0F, 1.0F, 1.0F, 1.0F); - this.mc.getTextureManager().bindTexture(iconLocation); - int k = (this.width - this.xSize) / 2; - int l = (this.height - this.ySize) / 2; - this.drawTexturedModalRect(k, l, 0, 0, this.xSize, this.ySize); - int i1; - drawPlayerModel( - k + 51, - l + 75, - 30, - (float) (k + 51) - this.xSize_lo, - (float) (l + 75 - 50) - this.ySize_lo, - this.mc.thePlayer); - } - - /** - * This renders the player model in standard inventory position (in later versions of Minecraft / Forge, you can - * simply call GuiInventory.drawEntityOnScreen directly instead of copying this code) - */ - public static void drawPlayerModel(int x, int y, int scale, float yaw, float pitch, EntityLivingBase entity) { - GL11.glEnable(GL11.GL_COLOR_MATERIAL); - GL11.glPushMatrix(); - GL11.glTranslatef(x, y, 50.0F); - GL11.glScalef(-scale, scale, scale); - GL11.glRotatef(180.0F, 0.0F, 0.0F, 1.0F); - float f2 = entity.renderYawOffset; - float f3 = entity.rotationYaw; - float f4 = entity.rotationPitch; - float f5 = entity.prevRotationYawHead; - float f6 = entity.rotationYawHead; - GL11.glRotatef(135.0F, 0.0F, 1.0F, 0.0F); - RenderHelper.enableStandardItemLighting(); - GL11.glRotatef(-135.0F, 0.0F, 1.0F, 0.0F); - GL11.glRotatef(-((float) Math.atan(pitch / 40.0F)) * 20.0F, 1.0F, 0.0F, 0.0F); - entity.renderYawOffset = (float) Math.atan(yaw / 40.0F) * 20.0F; - entity.rotationYaw = (float) Math.atan(yaw / 40.0F) * 40.0F; - entity.rotationPitch = -((float) Math.atan(pitch / 40.0F)) * 20.0F; - entity.rotationYawHead = entity.rotationYaw; - entity.prevRotationYawHead = entity.rotationYaw; - GL11.glTranslatef(0.0F, entity.yOffset, 0.0F); - RenderManager.instance.playerViewY = 180.0F; - RenderManager.instance.renderEntityWithPosYaw(entity, 0.0D, 0.0D, 0.0D, 0.0F, 1.0F); - entity.renderYawOffset = f2; - entity.rotationYaw = f3; - entity.rotationPitch = f4; - entity.prevRotationYawHead = f5; - entity.rotationYawHead = f6; - GL11.glPopMatrix(); - RenderHelper.disableStandardItemLighting(); - GL11.glDisable(GL12.GL_RESCALE_NORMAL); - OpenGlHelper.setActiveTexture(OpenGlHelper.lightmapTexUnit); - GL11.glDisable(GL11.GL_TEXTURE_2D); - OpenGlHelper.setActiveTexture(OpenGlHelper.defaultTexUnit); - } -} diff --git a/src/main/java/gtPlusPlus/core/gui/item/box/LunchBoxGui.java b/src/main/java/gtPlusPlus/core/gui/item/box/LunchBoxGui.java deleted file mode 100644 index 80d2d6902f..0000000000 --- a/src/main/java/gtPlusPlus/core/gui/item/box/LunchBoxGui.java +++ /dev/null @@ -1,14 +0,0 @@ -package gtPlusPlus.core.gui.item.box; - -import static gregtech.api.enums.Mods.GTPlusPlus; - -import net.minecraft.util.ResourceLocation; - -import gtPlusPlus.core.item.tool.misc.box.ContainerBoxBase; - -public class LunchBoxGui extends GuiBaseBox { - - public LunchBoxGui(ContainerBoxBase containerItem) { - super(containerItem, new ResourceLocation(GTPlusPlus.ID, "textures/gui/schematic_rocket_GS1.png")); - } -} diff --git a/src/main/java/gtPlusPlus/core/gui/item/box/MagicBagGui.java b/src/main/java/gtPlusPlus/core/gui/item/box/MagicBagGui.java deleted file mode 100644 index 6858c17afb..0000000000 --- a/src/main/java/gtPlusPlus/core/gui/item/box/MagicBagGui.java +++ /dev/null @@ -1,14 +0,0 @@ -package gtPlusPlus.core.gui.item.box; - -import static gregtech.api.enums.Mods.GTPlusPlus; - -import net.minecraft.util.ResourceLocation; - -import gtPlusPlus.core.item.tool.misc.box.ContainerBoxBase; - -public class MagicBagGui extends GuiBaseBox { - - public MagicBagGui(ContainerBoxBase containerItem) { - super(containerItem, new ResourceLocation(GTPlusPlus.ID, "textures/gui/schematic_rocket_GS1.png")); - } -} diff --git a/src/main/java/gtPlusPlus/core/gui/item/box/ToolBoxGui.java b/src/main/java/gtPlusPlus/core/gui/item/box/ToolBoxGui.java deleted file mode 100644 index 4d994eee41..0000000000 --- a/src/main/java/gtPlusPlus/core/gui/item/box/ToolBoxGui.java +++ /dev/null @@ -1,14 +0,0 @@ -package gtPlusPlus.core.gui.item.box; - -import static gregtech.api.enums.Mods.GTPlusPlus; - -import net.minecraft.util.ResourceLocation; - -import gtPlusPlus.core.item.tool.misc.box.ContainerBoxBase; - -public class ToolBoxGui extends GuiBaseBox { - - public ToolBoxGui(ContainerBoxBase containerItem) { - super(containerItem, new ResourceLocation(GTPlusPlus.ID, "textures/gui/schematic_rocket_GS1.png")); - } -} diff --git a/src/main/java/gtPlusPlus/core/handler/COMPAT_IntermodStaging.java b/src/main/java/gtPlusPlus/core/handler/COMPAT_IntermodStaging.java index f511e3e6ae..0593c833f3 100644 --- a/src/main/java/gtPlusPlus/core/handler/COMPAT_IntermodStaging.java +++ b/src/main/java/gtPlusPlus/core/handler/COMPAT_IntermodStaging.java @@ -12,7 +12,6 @@ import gtPlusPlus.xmod.ic2.HANDLER_IC2; import gtPlusPlus.xmod.ob.HANDLER_OpenBlocks; import gtPlusPlus.xmod.railcraft.HANDLER_Railcraft; -import gtPlusPlus.xmod.thaumcraft.HANDLER_Thaumcraft; import gtPlusPlus.xmod.thermalfoundation.HANDLER_TF; import gtPlusPlus.xmod.tinkers.HANDLER_Tinkers; @@ -31,7 +30,6 @@ public static void preInit(FMLPreInitializationEvent preinit) { public static void init(FMLInitializationEvent init) { HANDLER_GT.init(); HANDLER_TF.init(); - HANDLER_Thaumcraft.init(); HANDLER_OpenBlocks.init(); } diff --git a/src/main/java/gtPlusPlus/core/handler/events/MissingMappingsEvent.java b/src/main/java/gtPlusPlus/core/handler/events/MissingMappingsEvent.java deleted file mode 100644 index 7ba06f4bbd..0000000000 --- a/src/main/java/gtPlusPlus/core/handler/events/MissingMappingsEvent.java +++ /dev/null @@ -1,47 +0,0 @@ -package gtPlusPlus.core.handler.events; - -import static gregtech.api.enums.Mods.GTPlusPlus; -import static gtPlusPlus.core.item.base.dusts.BaseItemDustEx.mCachedPileLinkages; - -import net.minecraft.item.ItemStack; - -import org.apache.commons.lang3.StringUtils; - -import cpw.mods.fml.common.Mod.EventHandler; -import cpw.mods.fml.common.event.FMLMissingMappingsEvent; -import cpw.mods.fml.common.event.FMLMissingMappingsEvent.MissingMapping; -import gtPlusPlus.api.objects.Logger; - -public class MissingMappingsEvent { - - @EventHandler - public void onMissingMapping(FMLMissingMappingsEvent event) { - for (MissingMapping mapping : event.get()) { - boolean bool1 = mapping.name.contains(GTPlusPlus.ID); - // Missing Blocks - if (mapping.type == cpw.mods.fml.common.registry.GameRegistry.Type.BLOCK && bool1) { - - // Example - // if(mapping.name.equals("PneumaticCraft:etchingAcid")) { - // mapping.remap(Fluids.etchingAcid.getBlock()); - // } - - } - - // Missing Items - if (mapping.type == cpw.mods.fml.common.registry.GameRegistry.Type.ITEM && bool1) { - if (mapping.name.contains("miscutils:itemDustTiny")) { - ItemStack stack = null; - String missingItemString = StringUtils.remove(mapping.name, "miscutils:itemDustTiny"); - missingItemString = StringUtils.prependIfMissing(missingItemString, "item.itemDust"); - if (mCachedPileLinkages.containsKey(missingItemString)) { - // stack = ItemUtils.getSimpleStack(Item.itemRegistry.) - Logger.REFLECTION("Mapping Event Found Missing Item in the Pile Linkage Cache."); - } - - // mapping.remap(stack.getItem()); - } - } - } - } -} diff --git a/src/main/java/gtPlusPlus/core/item/base/BaseEuItem.java b/src/main/java/gtPlusPlus/core/item/base/BaseEuItem.java deleted file mode 100644 index 194e585c0d..0000000000 --- a/src/main/java/gtPlusPlus/core/item/base/BaseEuItem.java +++ /dev/null @@ -1,636 +0,0 @@ -package gtPlusPlus.core.item.base; - -import static gregtech.api.enums.GT_Values.D1; -import static gregtech.api.enums.GT_Values.V; -import static gregtech.api.enums.Mods.GTPlusPlus; - -import java.util.ArrayList; -import java.util.BitSet; -import java.util.HashMap; -import java.util.List; - -import net.minecraft.client.renderer.texture.IIconRegister; -import net.minecraft.creativetab.CreativeTabs; -import net.minecraft.entity.EntityLivingBase; -import net.minecraft.entity.player.EntityPlayer; -import net.minecraft.inventory.Container; -import net.minecraft.item.EnumRarity; -import net.minecraft.item.Item; -import net.minecraft.item.ItemStack; -import net.minecraft.nbt.NBTTagCompound; -import net.minecraft.util.EnumChatFormatting; -import net.minecraft.util.IIcon; -import net.minecraft.util.StatCollector; - -import cpw.mods.fml.common.registry.GameRegistry; -import cpw.mods.fml.relauncher.Side; -import cpw.mods.fml.relauncher.SideOnly; -import gregtech.api.GregTech_API; -import gregtech.api.enums.GT_Values; -import gregtech.api.enums.SubTag; -import gregtech.api.enums.TC_Aspects.TC_AspectStack; -import gregtech.api.interfaces.IItemBehaviour; -import gregtech.api.interfaces.IItemContainer; -import gregtech.api.objects.ItemData; -import gregtech.api.util.GT_LanguageManager; -import gregtech.api.util.GT_ModHandler; -import gregtech.api.util.GT_OreDictUnificator; -import gregtech.api.util.GT_Utility; -import gtPlusPlus.api.objects.data.Pair; -import gtPlusPlus.core.creative.AddToCreativeTab; -import ic2.api.item.ElectricItem; -import ic2.api.item.IElectricItem; -import ic2.api.item.IElectricItemManager; -import ic2.api.item.ISpecialElectricItem; - -public class BaseEuItem extends Item implements ISpecialElectricItem, IElectricItemManager { - - /* ---------- CONSTRUCTOR AND MEMBER VARIABLES ---------- */ - private final HashMap>> mItemBehaviors = new HashMap<>(); - public final short mOffset, mItemAmount; - public final BitSet mEnabledItems; - public final BitSet mVisibleItems; - public final IIcon[][] mIconList; - /** The unlocalized name of this item. */ - private String unlocalizedName; - - private final ArrayList> rarity = new ArrayList<>(); - private final ArrayList> descColour = new ArrayList<>(); - private final ArrayList> itemName = new ArrayList<>(); - private final ArrayList> itemDescription = new ArrayList<>(); - private final ArrayList> hasEffect = new ArrayList<>(); - - public final HashMap mElectricStats = new HashMap<>(); - public final HashMap mBurnValues = new HashMap<>(); - - public BaseEuItem() { - this("MU-metaitem.02", AddToCreativeTab.tabOther, (short) 1000, (short) 31766); - } - - public BaseEuItem(final String unlocalizedName, final CreativeTabs creativeTab, final short aOffset, - final short aItemAmount) { - this.mEnabledItems = new BitSet(aItemAmount); - this.mVisibleItems = new BitSet(aItemAmount); - this.mOffset = (short) Math.min(32766, aOffset); - this.mItemAmount = (short) Math.min(aItemAmount, 32766 - this.mOffset); - this.mIconList = new IIcon[aItemAmount][1]; - this.setHasSubtypes(true); - this.setMaxDamage(0); - this.setUnlocalizedName(unlocalizedName); - this.setCreativeTab(creativeTab); - this.setMaxStackSize(1); - GameRegistry.registerItem(this, unlocalizedName); - } - - public void registerItem(final int id, final String localizedName, final long euStorage, final int tier, - final String description) { - this.registerItem( - id, - localizedName, - euStorage, - (short) tier, - description, - EnumRarity.common, - EnumChatFormatting.GRAY, - false); - } - - public void registerItem(final int id, final String localizedName, final long euStorage, final int tier, - final String description, final int burnTime) { - this.registerItem( - id, - localizedName, - euStorage, - (short) tier, - description, - EnumRarity.common, - EnumChatFormatting.GRAY, - false); - this.setBurnValue(id, burnTime); - } - - public void registerItem(final int id, final String localizedName, final long euStorage, final short tier, - final String description, final EnumRarity regRarity, final EnumChatFormatting colour, - final boolean Effect) { - this.addItem(id, localizedName, colour + description, new Object[] {}); - this.setElectricStats(this.mOffset + id, euStorage, GT_Values.V[tier], tier, -3L, true); - this.rarity.add(new Pair<>(id, regRarity)); - this.hasEffect.add(new Pair<>(id, Effect)); - } - - @Override - @SideOnly(Side.CLIENT) - public EnumRarity getRarity(final ItemStack par1ItemStack) { - if (this.rarity.get(par1ItemStack.getItemDamage() - this.mOffset) != null) { - return this.rarity.get(par1ItemStack.getItemDamage() - this.mOffset).getValue(); - } - return EnumRarity.common; - } - - @Override - public boolean hasEffect(final ItemStack par1ItemStack, final int pass) { - if (this.hasEffect.get(par1ItemStack.getItemDamage() - this.mOffset) != null) { - return this.hasEffect.get(par1ItemStack.getItemDamage() - this.mOffset).getValue(); - } - return false; - } - - @SuppressWarnings({ "unchecked", "rawtypes" }) - @Override - public void addInformation(final ItemStack aStack, final EntityPlayer aPlayer, List aList, final boolean aF3_H) { - // aList.add("Meta: "+(aStack.getItemDamage()-mOffset)); - int keyValue = aStack.getItemDamage() - this.mOffset; - final String tKey = "gtplusplus." + this.getUnlocalizedName(aStack) + "." + keyValue + ".tooltip", - tString = GT_LanguageManager.getTranslation(tKey); - if (GT_Utility.isStringValid(tString) && !tKey.equals(tString)) { - aList.add(tString); - } - aList.add(StatCollector.translateToLocal("item.itemBaseEuItem.tooltip.0")); - final Long[] tStats = this.getElectricStats(aStack); - if (tStats != null) { - if (tStats[3] > 0) { - aList.add( - EnumChatFormatting.AQUA + StatCollector.translateToLocalFormatted( - "item.itemBaseEuItem.tooltip.1", - GT_Utility.formatNumbers(tStats[3]), - (tStats[2] >= 0 ? tStats[2] : 0)) + EnumChatFormatting.GRAY); - } else { - final long tCharge = this.getRealCharge(aStack); - if ((tStats[3] == -2) && (tCharge <= 0)) { - aList.add( - EnumChatFormatting.AQUA + StatCollector.translateToLocal("item.itemBaseEuItem.tooltip.2") - + EnumChatFormatting.GRAY); - } else { - aList.add( - EnumChatFormatting.AQUA + StatCollector.translateToLocalFormatted( - "item.itemBaseEuItem.tooltip.3", - GT_Utility.formatNumbers(tCharge), - GT_Utility.formatNumbers(Math.abs(tStats[0])), - V[(int) (tStats[2] >= 0 ? tStats[2] < V.length ? tStats[2] : V.length - 1 : 1)]) - + EnumChatFormatting.GRAY); - } - } - } - final ArrayList> tList = this.mItemBehaviors.get((short) this.getDamage(aStack)); - if (tList != null) { - for (final IItemBehaviour tBehavior : tList) { - aList = tBehavior.getAdditionalToolTips(this, aList, aStack); - } - } - } - - @Override - public final Item getChargedItem(final ItemStack itemStack) { - return this; - } - - @Override - public final Item getEmptyItem(final ItemStack itemStack) { - return this; - } - - @Override - public final double getMaxCharge(final ItemStack aStack) { - final Long[] tStats = this.getElectricStats(aStack); - if (tStats == null) { - return 0; - } - return Math.abs(tStats[0]); - } - - @Override - public final double getTransferLimit(final ItemStack aStack) { - final Long[] tStats = this.getElectricStats(aStack); - if (tStats == null) { - return 0; - } - return Math.max(tStats[1], tStats[3]); - } - - @Override - public final int getTier(final ItemStack aStack) { - final Long[] tStats = this.getElectricStats(aStack); - return (int) (tStats == null ? Integer.MAX_VALUE : tStats[2]); - } - - @Override - public final double charge(final ItemStack aStack, final double aCharge, final int aTier, - final boolean aIgnoreTransferLimit, final boolean aSimulate) { - final Long[] tStats = this.getElectricStats(aStack); - if ((tStats == null) || (tStats[2] > aTier) - || !((tStats[3] == -1) || (tStats[3] == -3) || ((tStats[3] < 0) && (aCharge == Integer.MAX_VALUE))) - || (aStack.stackSize != 1)) { - return 0; - } - final long tChargeBefore = this.getRealCharge(aStack), tNewCharge = aCharge == Integer.MAX_VALUE - ? Long.MAX_VALUE - : Math.min( - Math.abs(tStats[0]), - tChargeBefore + (aIgnoreTransferLimit ? (long) aCharge : Math.min(tStats[1], (long) aCharge))); - if (!aSimulate) { - this.setCharge(aStack, tNewCharge); - } - return tNewCharge - tChargeBefore; - } - - @Override - public final double discharge(final ItemStack aStack, final double aCharge, final int aTier, - final boolean aIgnoreTransferLimit, final boolean aBatteryAlike, final boolean aSimulate) { - final Long[] tStats = this.getElectricStats(aStack); - if ((tStats == null) || (tStats[2] > aTier)) { - return 0; - } - if (aBatteryAlike && !this.canProvideEnergy(aStack)) { - return 0; - } - if (tStats[3] > 0) { - if ((aCharge < tStats[3]) || (aStack.stackSize < 1)) { - return 0; - } - if (!aSimulate) { - aStack.stackSize--; - } - return tStats[3]; - } - final long tChargeBefore = this.getRealCharge(aStack), tNewCharge = Math - .max(0, tChargeBefore - (aIgnoreTransferLimit ? (long) aCharge : Math.min(tStats[1], (long) aCharge))); - if (!aSimulate) { - this.setCharge(aStack, tNewCharge); - } - return tChargeBefore - tNewCharge; - } - - @Override - public final double getCharge(final ItemStack aStack) { - return this.getRealCharge(aStack); - } - - @Override - public final boolean canUse(final ItemStack aStack, final double aAmount) { - return this.getRealCharge(aStack) >= aAmount; - } - - @Override - public final boolean use(final ItemStack aStack, final double aAmount, final EntityLivingBase aPlayer) { - this.chargeFromArmor(aStack, aPlayer); - if ((aPlayer instanceof EntityPlayer) && ((EntityPlayer) aPlayer).capabilities.isCreativeMode) { - return true; - } - final double tTransfer = this.discharge(aStack, aAmount, Integer.MAX_VALUE, true, false, true); - if (tTransfer == aAmount) { - this.discharge(aStack, aAmount, Integer.MAX_VALUE, true, false, false); - this.chargeFromArmor(aStack, aPlayer); - return true; - } - this.discharge(aStack, aAmount, Integer.MAX_VALUE, true, false, false); - this.chargeFromArmor(aStack, aPlayer); - return false; - } - - @Override - public final boolean canProvideEnergy(final ItemStack aStack) { - final Long[] tStats = this.getElectricStats(aStack); - if (tStats == null) { - return false; - } - return (tStats[3] > 0) || ((aStack.stackSize == 1) && ((tStats[3] == -2) || (tStats[3] == -3))); - } - - @Override - public final void chargeFromArmor(final ItemStack aStack, final EntityLivingBase aPlayer) { - if ((aPlayer == null) || aPlayer.worldObj.isRemote) { - return; - } - for (int i = 1; i < 5; i++) { - final ItemStack tArmor = aPlayer.getEquipmentInSlot(i); - if (GT_ModHandler.isElectricItem(tArmor)) { - final IElectricItem tArmorItem = (IElectricItem) tArmor.getItem(); - if (tArmorItem.canProvideEnergy(tArmor) && (tArmorItem.getTier(tArmor) >= this.getTier(aStack))) { - final double tCharge = ElectricItem.manager.discharge( - tArmor, - this.charge(aStack, Integer.MAX_VALUE - 1, Integer.MAX_VALUE, true, true), - Integer.MAX_VALUE, - true, - true, - false); - if (tCharge > 0) { - this.charge(aStack, tCharge, Integer.MAX_VALUE, true, false); - if (aPlayer instanceof EntityPlayer) { - final Container tContainer = ((EntityPlayer) aPlayer).openContainer; - if (tContainer != null) { - tContainer.detectAndSendChanges(); - } - } - } - } - } - } - } - - public final long getRealCharge(final ItemStack aStack) { - final Long[] tStats = this.getElectricStats(aStack); - if (tStats == null) { - return 0; - } - if (tStats[3] > 0) { - return (int) (long) tStats[3]; - } - final NBTTagCompound tNBT = aStack.getTagCompound(); - return tNBT == null ? 0 : tNBT.getLong("GT.ItemCharge"); - } - - public final boolean setCharge(final ItemStack aStack, long aCharge) { - final Long[] tStats = this.getElectricStats(aStack); - if ((tStats == null) || (tStats[3] > 0)) { - return false; - } - NBTTagCompound tNBT = aStack.getTagCompound(); - if (tNBT == null) { - tNBT = new NBTTagCompound(); - } - tNBT.removeTag("GT.ItemCharge"); - aCharge = Math.min(tStats[0] < 0 ? Math.abs(tStats[0] / 2) : aCharge, Math.abs(tStats[0])); - if (aCharge > 0) { - aStack.setItemDamage(this.getChargedMetaData(aStack)); - tNBT.setLong("GT.ItemCharge", aCharge); - } else { - aStack.setItemDamage(this.getEmptyMetaData(aStack)); - } - if (tNBT.hasNoTags()) { - aStack.setTagCompound(null); - } else { - aStack.setTagCompound(tNBT); - } - this.isItemStackUsable(aStack); - return true; - } - - public short getChargedMetaData(final ItemStack aStack) { - return (short) aStack.getItemDamage(); - } - - public short getEmptyMetaData(final ItemStack aStack) { - return (short) aStack.getItemDamage(); - } - - public boolean isItemStackUsable(final ItemStack aStack) { - final ArrayList> tList = this.mItemBehaviors.get((short) this.getDamage(aStack)); - if (tList != null) { - for (final IItemBehaviour tBehavior : tList) { - if (!tBehavior.isItemStackUsable(this, aStack)) { - return false; - } - } - } - return true; - } - - @Override - public final String getToolTip(final ItemStack aStack) { - return null; - } // This has its own ToolTip Handler, no need to let the IC2 Handler screw us up at this Point - - @Override - public final IElectricItemManager getManager(final ItemStack aStack) { - return this; - } // We are our own Manager - - /** - * Sets the Furnace Burn Value for the Item. - * - * @param aMetaValue the Meta Value of the Item you want to set it to. [0 - 32765] - * @param aValue 200 = 1 Burn Process = 500 EU, max = 32767 (that is 81917.5 EU) - * @return the Item itself for convenience in constructing. - */ - public final BaseEuItem setBurnValue(final int aMetaValue, final int aValue) { - if ((aMetaValue < 0) || (aValue < 0)) { - return this; - } - if (aValue == 0) { - this.mBurnValues.remove((short) aMetaValue); - } else { - this.mBurnValues.put((short) aMetaValue, aValue > Short.MAX_VALUE ? Short.MAX_VALUE : (short) aValue); - } - return this; - } - - /** - * @param aMetaValue the Meta Value of the Item you want to set it to. [0 - 32765] - * @param aMaxCharge Maximum Charge. (if this is == 0 it will remove the Electric Behavior) - * @param aTransferLimit Transfer Limit. - * @param aTier The electric Tier. - * @param aSpecialData If this Item has a Fixed Charge, like a SingleUse Battery (if > 0). Use -1 if you want to - * make this Battery chargeable (the use and canUse Functions will still discharge if you just - * use this) Use -2 if you want to make this Battery dischargeable. Use -3 if you want to make - * this Battery charge/discharge-able. - * @return the Item itself for convenience in constructing. - */ - public final BaseEuItem setElectricStats(final int aMetaValue, final long aMaxCharge, final long aTransferLimit, - final long aTier, final long aSpecialData, final boolean aUseAnimations) { - if (aMetaValue < 0) { - return this; - } - if (aMaxCharge == 0) { - this.mElectricStats.remove((short) aMetaValue); - } else { - this.mElectricStats.put( - (short) aMetaValue, - new Long[] { aMaxCharge, Math.max(0, aTransferLimit), Math.max(-1, aTier), aSpecialData }); - } - return this; - } - - @SuppressWarnings({ "rawtypes", "unchecked" }) - @Override - @SideOnly(Side.CLIENT) - public void getSubItems(final Item var1, final CreativeTabs aCreativeTab, final List aList) { - for (int i = 0, j = this.mEnabledItems.length(); i < j; i++) { - if (this.mVisibleItems.get(i) || (D1 && this.mEnabledItems.get(i))) { - final Long[] tStats = this.mElectricStats.get((short) (this.mOffset + i)); - if ((tStats != null) && (tStats[3] < 0)) { - final ItemStack tStack = new ItemStack(this, 1, this.mOffset + i); - this.setCharge(tStack, Math.abs(tStats[0])); - this.isItemStackUsable(tStack); - aList.add(tStack); - } - if ((tStats == null) || (tStats[3] != -2)) { - final ItemStack tStack = new ItemStack(this, 1, this.mOffset + i); - this.isItemStackUsable(tStack); - aList.add(tStack); - } - } - } - } - - @Override - @SideOnly(Side.CLIENT) - public final void registerIcons(final IIconRegister aIconRegister) { - for (short i = 0, j = (short) this.mEnabledItems.length(); i < j; i++) { - if (this.mEnabledItems.get(i)) { - for (byte k = 1; k < this.mIconList[i].length; k++) { - this.mIconList[i][k] = aIconRegister - .registerIcon(GTPlusPlus.ID + ":" + (this.getUnlocalizedName() + "/" + i + "/" + k)); - } - this.mIconList[i][0] = aIconRegister - .registerIcon(GTPlusPlus.ID + ":" + (this.getUnlocalizedName() + "/" + i)); - } - } - } - - @Override - public final IIcon getIconFromDamage(final int aMetaData) { - if (aMetaData < 0) { - return null; - } - return (aMetaData - this.mOffset) < this.mIconList.length ? this.mIconList[aMetaData - this.mOffset][0] : null; - } - - /** - * Sets the unlocalized name of this item to the string passed as the parameter" - */ - @Override - public Item setUnlocalizedName(final String p_77655_1_) { - this.unlocalizedName = p_77655_1_; - super.setUnlocalizedName(p_77655_1_); - return this; - } - - /** - * Returns the unlocalized name of this item. - */ - @Override - public String getUnlocalizedName() { - return this.unlocalizedName; - } - - public final Long[] getElectricStats(final ItemStack aStack) { - return this.mElectricStats.get((short) aStack.getItemDamage()); - } - - @Override - public int getItemEnchantability() { - return 0; - } - - @Override - public boolean isBookEnchantable(final ItemStack aStack, final ItemStack aBook) { - return false; - } - - @Override - public boolean getIsRepairable(final ItemStack aStack, final ItemStack aMaterial) { - return false; - } - - /** - * Adds a special Item Behaviour to the Item. - *

- * Note: the boolean Behaviours sometimes won't be executed if another boolean Behaviour returned true before. - * - * @param aMetaValue the Meta Value of the Item you want to add it to. [0 - 32765] - * @param aBehavior the Click Behavior you want to add. - * @return the Item itself for convenience in constructing. - */ - public final BaseEuItem addItemBehavior(final int aMetaValue, final IItemBehaviour aBehavior) { - if ((aMetaValue < 0) || (aMetaValue >= 32766) || (aBehavior == null)) { - return this; - } - ArrayList> tList = this.mItemBehaviors.get((short) aMetaValue); - if (tList == null) { - tList = new ArrayList<>(1); - this.mItemBehaviors.put((short) aMetaValue, tList); - } - tList.add(aBehavior); - return this; - } - - /** - * This adds a Custom Item to the ending Range. - * - * @param aID The Id of the assigned Item [0 - mItemAmount] (The MetaData gets auto-shifted by +mOffset) - * @param aEnglish The Default Localized Name of the created Item - * @param aToolTip The Default ToolTip of the created Item, you can also insert null for having no ToolTip - * @param aFoodBehavior The Food Value of this Item. Can be null aswell. Just a convenience thing. - * @param aRandomData The OreDict Names you want to give the Item. Also used for TC Aspects and some other things. - * @return An ItemStack containing the newly created Item. - */ - @SuppressWarnings("unchecked") - public final ItemStack addItem(final int aID, final String aEnglish, String aToolTip, final Object... aRandomData) { - if (aToolTip == null) { - aToolTip = ""; - } - if ((aID >= 0) && (aID < this.mItemAmount)) { - final ItemStack rStack = new ItemStack(this, 1, this.mOffset + aID); - this.mEnabledItems.set(aID); - this.mVisibleItems.set(aID); - GT_LanguageManager.addStringLocalization( - "gtplusplus." + this.getUnlocalizedName(rStack) + "." + aID + ".name", - aEnglish); - GT_LanguageManager.addStringLocalization( - "gtplusplus." + this.getUnlocalizedName(rStack) + "." + aID + ".tooltip", - aToolTip); - final List tAspects = new ArrayList<>(); - // Important Stuff to do first - for (final Object tRandomData : aRandomData) { - if (tRandomData instanceof SubTag) { - if (tRandomData == SubTag.INVISIBLE) { - this.mVisibleItems.set(aID, false); - continue; - } - if (tRandomData == SubTag.NO_UNIFICATION) { - GT_OreDictUnificator.addToBlacklist(rStack); - continue; - } - } - } - // now check for the rest - for (final Object tRandomData : aRandomData) { - if (tRandomData != null) { - boolean tUseOreDict = true; - if (tRandomData instanceof IItemBehaviour) { - this.addItemBehavior(this.mOffset + aID, (IItemBehaviour) tRandomData); - tUseOreDict = false; - } - if (tRandomData instanceof IItemContainer) { - ((IItemContainer) tRandomData).set(rStack); - tUseOreDict = false; - } - if (tRandomData instanceof SubTag) { - continue; - } - if (tRandomData instanceof TC_AspectStack) { - ((TC_AspectStack) tRandomData).addToAspectList(tAspects); - continue; - } - if (tRandomData instanceof ItemData) { - if (GT_Utility.isStringValid(tRandomData)) { - GT_OreDictUnificator.registerOre(tRandomData, rStack); - } else { - GT_OreDictUnificator.addItemData(rStack, (ItemData) tRandomData); - } - continue; - } - if (tUseOreDict) { - GT_OreDictUnificator.registerOre(tRandomData, rStack); - continue; - } - } - } - if (GregTech_API.sThaumcraftCompat != null) { - GregTech_API.sThaumcraftCompat.registerThaumcraftAspectsToItem(rStack, tAspects, false); - } - return rStack; - } - return null; - } - - @Override - public String getItemStackDisplayName(final ItemStack par1ItemStack) { - int keyValue = (par1ItemStack.getItemDamage() - this.mOffset); - if (keyValue < 0 || keyValue > 5) { - keyValue = 0; - } - return GT_LanguageManager - .getTranslation("gtplusplus." + this.getUnlocalizedName(par1ItemStack) + "." + keyValue + ".name"); - } -} diff --git a/src/main/java/gtPlusPlus/core/item/base/BaseItemComponent.java b/src/main/java/gtPlusPlus/core/item/base/BaseItemComponent.java index b54811947f..485e508805 100644 --- a/src/main/java/gtPlusPlus/core/item/base/BaseItemComponent.java +++ b/src/main/java/gtPlusPlus/core/item/base/BaseItemComponent.java @@ -2,7 +2,6 @@ import static gregtech.api.enums.Mods.GTPlusPlus; import static gregtech.api.enums.Mods.GregTech; -import static gregtech.api.enums.Mods.Thaumcraft; import java.awt.Color; import java.util.HashMap; @@ -78,14 +77,6 @@ public BaseItemComponent(final Material material, final ComponentTypes component if (componentType == ComponentTypes.GEAR) { GT_OreDictUnificator.registerOre("gear" + material.getUnlocalizedName(), ItemUtils.getSimpleStack(this)); } - if (Thaumcraft.isModLoaded()) { - // ThaumcraftUtils.addAspectToItem(ItemUtils.getSimpleStack(this), - // TC_Aspect_Wrapper.generate(TC_Aspects.METALLUM.mAspect), 1); - if (componentMaterial.isRadioactive) { - // ThaumcraftUtils.addAspectToItem(ItemUtils.getSimpleStack(this), - // TC_Aspect_Wrapper.generate(TC_Aspects.RADIO.mAspect), componentMaterial.vRadiationLevel); - } - } registerComponent(); GT_LanguageManager.addStringLocalization("gtplusplus.item." + unlocalName + ".name", getFormattedLangName()); diff --git a/src/main/java/gtPlusPlus/core/item/base/dusts/BaseItemDustAbstract.java b/src/main/java/gtPlusPlus/core/item/base/dusts/BaseItemDustAbstract.java deleted file mode 100644 index c89bbb1d7d..0000000000 --- a/src/main/java/gtPlusPlus/core/item/base/dusts/BaseItemDustAbstract.java +++ /dev/null @@ -1,43 +0,0 @@ -package gtPlusPlus.core.item.base.dusts; - -import static gregtech.api.enums.Mods.GTPlusPlus; - -import java.util.List; - -import net.minecraft.entity.player.EntityPlayer; -import net.minecraft.item.Item; -import net.minecraft.item.ItemStack; - -import cpw.mods.fml.common.registry.GameRegistry; - -public abstract class BaseItemDustAbstract extends Item { - - protected int colour = 0; - protected String materialName; - protected String pileType; - - public BaseItemDustAbstract(final String unlocalizedName, final String materialName, final int colour, - final String pileSize) { - this.setUnlocalizedName(unlocalizedName); - this.setMaxStackSize(64); - if (pileSize.equalsIgnoreCase("dust")) { - this.setTextureName(GTPlusPlus.ID + ":" + "dust"); - } else { - this.setTextureName(GTPlusPlus.ID + ":" + "dust" + pileSize); - } - this.setMaxStackSize(64); - this.colour = colour; - this.materialName = materialName; - this.setUnlocalizedName(unlocalizedName); - GameRegistry.registerItem(this, unlocalizedName); - } - - @SuppressWarnings("rawtypes") - @Override - public abstract void addInformation(ItemStack stack, EntityPlayer aPlayer, List list, boolean bool); - - public abstract String getMaterialName(); - - @Override - public abstract int getColorFromItemStack(ItemStack stack, int hex); -} diff --git a/src/main/java/gtPlusPlus/core/item/base/dusts/BaseItemDustEx.java b/src/main/java/gtPlusPlus/core/item/base/dusts/BaseItemDustEx.java deleted file mode 100644 index 13dacd065d..0000000000 --- a/src/main/java/gtPlusPlus/core/item/base/dusts/BaseItemDustEx.java +++ /dev/null @@ -1,127 +0,0 @@ -package gtPlusPlus.core.item.base.dusts; - -import static gregtech.api.enums.Mods.GTPlusPlus; -import static gregtech.api.enums.Mods.GregTech; - -import java.util.HashMap; -import java.util.List; -import java.util.Map; - -import net.minecraft.client.renderer.texture.IIconRegister; -import net.minecraft.creativetab.CreativeTabs; -import net.minecraft.item.Item; -import net.minecraft.item.ItemStack; -import net.minecraft.util.IIcon; - -import org.apache.commons.lang3.StringUtils; - -import gregtech.api.enums.TextureSet; -import gregtech.api.util.GT_OreDictUnificator; -import gtPlusPlus.core.item.base.BaseItemComponent; -import gtPlusPlus.core.lib.CORE; -import gtPlusPlus.core.material.Material; -import gtPlusPlus.core.util.minecraft.ItemUtils; - -public class BaseItemDustEx extends BaseItemComponent { - - public static Map mCachedPileLinkages = new HashMap(); - - protected IIcon[] baseAr = new IIcon[3]; - protected IIcon[] overlayAr = new IIcon[3]; - public static final ComponentTypes[] componentTypeAr = new ComponentTypes[] { ComponentTypes.DUST, - ComponentTypes.DUSTSMALL, ComponentTypes.DUSTTINY }; - - public BaseItemDustEx(final Material material) { - super(material, componentTypeAr[0]); - // OreDict this beauty - GT_OreDictUnificator.registerOre( - componentTypeAr[0].getOreDictName() + material.getUnlocalizedName(), - ItemUtils.simpleMetaStack(this, 0, 1)); - GT_OreDictUnificator.registerOre( - componentTypeAr[1].getOreDictName() + material.getUnlocalizedName(), - ItemUtils.simpleMetaStack(this, 0, 1)); - GT_OreDictUnificator.registerOre( - componentTypeAr[2].getOreDictName() + material.getUnlocalizedName(), - ItemUtils.simpleMetaStack(this, 0, 1)); - bakeRegistry(); - } - - private void bakeRegistry() { - String unlocalName = getUnlocalizedName(); - if (unlocalName.contains("item.")) { - unlocalName = StringUtils.remove(unlocalName, "item."); - } - if (unlocalName.contains("itemDust")) { - unlocalName = StringUtils.remove(unlocalName, "itemDust"); - } - mCachedPileLinkages.put(this.getUnlocalizedName(), "itemDust" + unlocalName); - mCachedPileLinkages.put(this.getUnlocalizedName(), "itemDustSmall" + unlocalName); - mCachedPileLinkages.put(this.getUnlocalizedName(), "itemDustTiny" + unlocalName); - } - - @Override - public void getSubItems(Item item, CreativeTabs tab, List list) { - for (int i = 0; i < 3; i++) { - list.add(new ItemStack(item, 1, i)); - } - } - - @Override - public IIcon getIconFromDamageForRenderPass(int meta, int pass) { - if (CORE.ConfigSwitches.useGregtechTextures) { - if (meta == 0) { - if (pass == 0) { - return this.baseAr[0]; - } else { - return this.overlayAr[0]; - } - } else if (meta == 1) { - if (pass == 0) { - return this.baseAr[1]; - } else { - return this.overlayAr[1]; - } - } else { - if (pass == 0) { - return this.baseAr[2]; - } else { - return this.overlayAr[2]; - } - } - } else { - return this.baseAr[meta]; - } - } - - @Override - public void registerIcons(final IIconRegister i) { - if (CORE.ConfigSwitches.useGregtechTextures) { - this.baseAr[0] = i.registerIcon(getCorrectTextures()); - this.overlayAr[0] = i.registerIcon(getCorrectTextures() + "_OVERLAY"); - this.baseAr[1] = i.registerIcon(getCorrectTextures() + "Small"); - this.overlayAr[1] = i.registerIcon(getCorrectTextures() + "Small_OVERLAY"); - this.baseAr[2] = i.registerIcon(getCorrectTextures() + "Tiny"); - this.overlayAr[2] = i.registerIcon(getCorrectTextures() + "Tiny_OVERLAY"); - } else { - this.baseAr[0] = i.registerIcon(getCorrectTextures()); - this.baseAr[1] = i.registerIcon(getCorrectTextures() + "Small"); - this.baseAr[2] = i.registerIcon(getCorrectTextures() + "Tiny"); - } - } - - @Override - public String getCorrectTextures() { - if (!CORE.ConfigSwitches.useGregtechTextures) { - return GTPlusPlus.ID + ":" + "item" + this.componentType.getComponent(); - } - String metType = "9j4852jyo3rjmh3owlhw9oe"; - if (this.componentMaterial != null) { - TextureSet u = this.componentMaterial.getTextureSet(); - if (u != null) { - metType = u.mSetName; - } - } - metType = (metType.equals("9j4852jyo3rjmh3owlhw9oe") ? "METALLIC" : metType); - return GregTech.ID + ":" + "materialicons/" + metType + "/" + this.componentType.getOreDictName(); - } -} diff --git a/src/main/java/gtPlusPlus/core/item/base/dusts/decimal/BaseItemCentidust.java b/src/main/java/gtPlusPlus/core/item/base/dusts/decimal/BaseItemCentidust.java deleted file mode 100644 index 78af2155b1..0000000000 --- a/src/main/java/gtPlusPlus/core/item/base/dusts/decimal/BaseItemCentidust.java +++ /dev/null @@ -1,57 +0,0 @@ -package gtPlusPlus.core.item.base.dusts.decimal; - -import static gregtech.api.enums.Mods.GTPlusPlus; - -import java.util.List; - -import net.minecraft.entity.player.EntityPlayer; -import net.minecraft.item.Item; -import net.minecraft.item.ItemStack; -import net.minecraft.util.EnumChatFormatting; - -import cpw.mods.fml.common.registry.GameRegistry; -import gtPlusPlus.core.creative.AddToCreativeTab; -import gtPlusPlus.core.material.Material; - -public class BaseItemCentidust extends Item { - - final Material dustMaterial; - final String materialName; - final String unlocalName; - - public BaseItemCentidust(final Material material) { - this.dustMaterial = material; - this.unlocalName = "itemCentidust" + material.getUnlocalizedName(); - this.materialName = material.getLocalizedName(); - this.setCreativeTab(AddToCreativeTab.tabMisc); - this.setUnlocalizedName(this.unlocalName); - this.setMaxStackSize(10); - this.setTextureName(GTPlusPlus.ID + ":" + "itemCentidust"); // TODO - GameRegistry.registerItem(this, this.unlocalName); - // GT_OreDictUnificator.registerOre(unlocalName.replace("itemR", "r"), UtilsItems.getSimpleStack(this)); //TODO - } - - @Override - public String getItemStackDisplayName(final ItemStack p_77653_1_) { - - return (this.materialName + " Centidust"); - } - - @SuppressWarnings({ "rawtypes", "unchecked" }) - @Override - public void addInformation(final ItemStack stack, final EntityPlayer aPlayer, final List list, final boolean bool) { - if ((this.materialName != null) && (this.materialName != "") && !this.materialName.equals("")) { - list.add(EnumChatFormatting.GRAY + "1% of a " + this.materialName + " dust pile."); - } - super.addInformation(stack, aPlayer, list, bool); - } - - public final String getMaterialName() { - return this.materialName; - } - - @Override - public int getColorFromItemStack(final ItemStack stack, final int HEX_OxFFFFFF) { - return this.dustMaterial.getRgbAsHex(); - } -} diff --git a/src/main/java/gtPlusPlus/core/item/base/dusts/decimal/BaseItemDecidust.java b/src/main/java/gtPlusPlus/core/item/base/dusts/decimal/BaseItemDecidust.java deleted file mode 100644 index de1b63794e..0000000000 --- a/src/main/java/gtPlusPlus/core/item/base/dusts/decimal/BaseItemDecidust.java +++ /dev/null @@ -1,57 +0,0 @@ -package gtPlusPlus.core.item.base.dusts.decimal; - -import static gregtech.api.enums.Mods.GTPlusPlus; - -import java.util.List; - -import net.minecraft.entity.player.EntityPlayer; -import net.minecraft.item.Item; -import net.minecraft.item.ItemStack; -import net.minecraft.util.EnumChatFormatting; - -import cpw.mods.fml.common.registry.GameRegistry; -import gtPlusPlus.core.creative.AddToCreativeTab; -import gtPlusPlus.core.material.Material; - -public class BaseItemDecidust extends Item { - - final Material dustMaterial; - final String materialName; - final String unlocalName; - - public BaseItemDecidust(final Material material) { - this.dustMaterial = material; - this.unlocalName = "itemDecidust" + material.getUnlocalizedName(); - this.materialName = material.getLocalizedName(); - this.setCreativeTab(AddToCreativeTab.tabMisc); - this.setUnlocalizedName(this.unlocalName); - this.setMaxStackSize(10); - this.setTextureName(GTPlusPlus.ID + ":" + "itemDecidust"); // TODO - GameRegistry.registerItem(this, this.unlocalName); - // GT_OreDictUnificator.registerOre(unlocalName.replace("itemR", "r"), UtilsItems.getSimpleStack(this)); //TODO - } - - @Override - public String getItemStackDisplayName(final ItemStack p_77653_1_) { - - return (this.materialName + " Decidust"); - } - - @SuppressWarnings({ "rawtypes", "unchecked" }) - @Override - public void addInformation(final ItemStack stack, final EntityPlayer aPlayer, final List list, final boolean bool) { - if ((this.materialName != null) && (this.materialName != "") && !this.materialName.equals("")) { - list.add(EnumChatFormatting.GRAY + "10% of a " + this.materialName + " dust pile."); - } - super.addInformation(stack, aPlayer, list, bool); - } - - public final String getMaterialName() { - return this.materialName; - } - - @Override - public int getColorFromItemStack(final ItemStack stack, final int HEX_OxFFFFFF) { - return this.dustMaterial.getRgbAsHex(); - } -} diff --git a/src/main/java/gtPlusPlus/core/item/base/foods/BaseItemFood.java b/src/main/java/gtPlusPlus/core/item/base/foods/BaseItemFood.java deleted file mode 100644 index f101bb969b..0000000000 --- a/src/main/java/gtPlusPlus/core/item/base/foods/BaseItemFood.java +++ /dev/null @@ -1,45 +0,0 @@ -package gtPlusPlus.core.item.base.foods; - -import static gregtech.api.enums.Mods.GTPlusPlus; - -import net.minecraft.entity.player.EntityPlayer; -import net.minecraft.item.ItemFood; -import net.minecraft.item.ItemStack; -import net.minecraft.potion.PotionEffect; -import net.minecraft.world.World; - -import cpw.mods.fml.common.registry.GameRegistry; -import gtPlusPlus.core.creative.AddToCreativeTab; - -public class BaseItemFood extends ItemFood { - - private final PotionEffect[] effects; - protected String localName; - - public BaseItemFood(final String unlocalizedName, final String localizedName, final int healAmount, - final float saturationModifier, final boolean wolvesFavorite, final PotionEffect... effects) { - super(healAmount, saturationModifier, wolvesFavorite); - this.setUnlocalizedName(unlocalizedName); - this.setTextureName(GTPlusPlus.ID + ":" + unlocalizedName.replace("Hot", "")); - this.setCreativeTab(AddToCreativeTab.tabMisc); - this.effects = effects; - this.localName = localizedName; - GameRegistry.registerItem(this, unlocalizedName); - } - - @Override - protected void onFoodEaten(final ItemStack stack, final World world, final EntityPlayer player) { - super.onFoodEaten(stack, world, player); - - for (int i = 0; i < this.effects.length; i++) { - if (!world.isRemote && (this.effects[i] != null) && (this.effects[i].getPotionID() > 0)) { - player.addPotionEffect( - new PotionEffect( - this.effects[i].getPotionID(), - this.effects[i].getDuration(), - this.effects[i].getAmplifier(), - this.effects[i].getIsAmbient())); - } - } - } -} diff --git a/src/main/java/gtPlusPlus/core/item/base/foods/BaseItemHotFood.java b/src/main/java/gtPlusPlus/core/item/base/foods/BaseItemHotFood.java deleted file mode 100644 index b68d7a5d7f..0000000000 --- a/src/main/java/gtPlusPlus/core/item/base/foods/BaseItemHotFood.java +++ /dev/null @@ -1,84 +0,0 @@ -package gtPlusPlus.core.item.base.foods; - -import java.util.List; - -import net.minecraft.entity.Entity; -import net.minecraft.entity.player.EntityPlayer; -import net.minecraft.item.Item; -import net.minecraft.item.ItemStack; -import net.minecraft.util.DamageSource; -import net.minecraft.util.EnumChatFormatting; -import net.minecraft.util.StatCollector; -import net.minecraft.world.World; - -import gtPlusPlus.api.objects.Logger; -import gtPlusPlus.core.util.Utils; -import gtPlusPlus.core.util.math.MathUtils; -import gtPlusPlus.core.util.minecraft.ItemUtils; - -public class BaseItemHotFood extends BaseItemFood { - - protected String materialName; - protected String unlocalName; - protected int cooldownTime; - protected Item output; - - public BaseItemHotFood(final String unlocalizedName, final int healAmount, final float healSaturation, - final String foodName, final int timeToCoolInSeconds, final Item cooledFood) { - super(unlocalizedName, "Hot " + foodName, healAmount, healSaturation, false); - this.unlocalName = unlocalizedName; - this.cooldownTime = timeToCoolInSeconds * 20; - this.materialName = foodName; - this.output = cooledFood; - this.setMaxStackSize(1); - } - - @Override - public ItemStack onEaten(final ItemStack iStack, final World world, final EntityPlayer player) { - return super.onEaten(iStack, world, player); - } - - @Override - public void onUpdate(final ItemStack iStack, final World world, final Entity entityHolding, final int p_77663_4_, - final boolean p_77663_5_) { - // Utils.LOG_INFO("Item Damage: "+iStack.getItemDamage()+" Max Damage: "+iStack.getMaxDamage()); - if (!world.isRemote) { - if (iStack.getItemDamage() == this.cooldownTime) { - if (entityHolding instanceof EntityPlayer) { - Logger.INFO("Foods Done."); - ((EntityPlayer) entityHolding).inventory - .addItemStackToInventory(ItemUtils.getSimpleStack(this.output)); - ((EntityPlayer) entityHolding).inventory.consumeInventoryItem(this); - } - } else if (iStack.getItemDamage() < this.cooldownTime) { - iStack.setItemDamage(iStack.getItemDamage() + 1); - } - if (MathUtils.divideXintoY(iStack.getItemDamage(), 150)) { - entityHolding.attackEntityFrom(DamageSource.onFire, 1); - } - } - super.onUpdate(iStack, world, entityHolding, p_77663_4_, p_77663_5_); - } - - @SuppressWarnings({ "rawtypes", "unchecked" }) - @Override - public void addInformation(final ItemStack stack, final EntityPlayer aPlayer, final List list, final boolean bool) { - if ((this.materialName != null) && (this.materialName != "") && !this.materialName.equals("")) { - list.add(StatCollector.translateToLocal("item.itemBaseItemHotFood.tooltip.0")); - list.add( - EnumChatFormatting.GRAY + StatCollector.translateToLocalFormatted( - "item.itemBaseItemHotFood.tooltip.1", - (this.cooldownTime - stack.getItemDamage()) / 20)); - } - super.addInformation(stack, aPlayer, list, bool); - } - - public final String getMaterialName() { - return this.materialName; - } - - @Override - public int getColorFromItemStack(final ItemStack stack, final int HEX_OxFFFFFF) { - return Utils.rgbtoHexValue(230, 96, 96); - } -} diff --git a/src/main/java/gtPlusPlus/core/item/base/itemblock/FluidItemBlock.java b/src/main/java/gtPlusPlus/core/item/base/itemblock/FluidItemBlock.java deleted file mode 100644 index 8c2278d50b..0000000000 --- a/src/main/java/gtPlusPlus/core/item/base/itemblock/FluidItemBlock.java +++ /dev/null @@ -1,60 +0,0 @@ -package gtPlusPlus.core.item.base.itemblock; - -import java.util.List; - -import net.minecraft.block.Block; -import net.minecraft.entity.player.EntityPlayer; -import net.minecraft.item.ItemBlock; -import net.minecraft.item.ItemStack; - -import gtPlusPlus.core.fluids.BlockFluidBase; -import gtPlusPlus.core.util.math.MathUtils; - -public class FluidItemBlock extends ItemBlock { - - protected final int blockColour; - final BlockFluidBase baseBlock; - String name; - - public FluidItemBlock(final Block block) { - super(block); - this.baseBlock = (BlockFluidBase) block; - this.blockColour = this.baseBlock.getRenderColor(1); - this.name = this.baseBlock.getLocalizedName().replace("tile", "").replace("fluid", "").replace("name", "") - .replace("block", "").replace(".", ""); - // GT_OreDictUnificator.registerOre("frameGt"+block.getUnlocalizedName().replace("tile.", - // "").replace("tile.BlockGtFrame", "").replace("-", "").replace("_", "").replace(" ", "").replace("FrameBox", - // ""), UtilsItems.getSimpleStack(this)); - } - - public int getRenderColor(final int aMeta) { - return this.blockColour; - } - - @Override - public String getItemStackDisplayName(final ItemStack iStack) { - /* - * if (this.thisFluid != null){ this.name = "Molten "+this.thisFluid.getLocalizedName(); return this.name; } - */ - this.name = "Molten " + this.baseBlock.getLocalizedName().replace("tile", "").replace("fluid", "") - .replace("name", "").replace("block", "").replace(".", ""); - return this.name; - } - - @Override - public int getColorFromItemStack(final ItemStack stack, final int HEX_OxFFFFFF) { - if (this.blockColour == 0) { - return MathUtils.generateSingularRandomHexValue(); - } - return this.blockColour; - } - - @Override - public void addInformation(final ItemStack stack, final EntityPlayer aPlayer, final List list, final boolean bool) { - /* - * list.add("Temperature: "+MathUtils.celsiusToKelvin(this.thisFluid.getMeltingPointC())+"K"); if - * (this.sRadiation > 0){ list.add(CORE.GT_Tooltip_Radioactive.get()); } - */ - super.addInformation(stack, aPlayer, list, bool); - } -} diff --git a/src/main/java/gtPlusPlus/core/item/base/itemblock/ItemBlockDoor.java b/src/main/java/gtPlusPlus/core/item/base/itemblock/ItemBlockDoor.java deleted file mode 100644 index 54c8b89704..0000000000 --- a/src/main/java/gtPlusPlus/core/item/base/itemblock/ItemBlockDoor.java +++ /dev/null @@ -1,101 +0,0 @@ -package gtPlusPlus.core.item.base.itemblock; - -import java.util.List; - -import net.minecraft.block.Block; -import net.minecraft.entity.player.EntityPlayer; -import net.minecraft.item.ItemBlock; -import net.minecraft.item.ItemStack; -import net.minecraft.util.IIcon; -import net.minecraft.util.MathHelper; -import net.minecraft.world.World; - -import cpw.mods.fml.relauncher.Side; -import cpw.mods.fml.relauncher.SideOnly; - -public class ItemBlockDoor extends ItemBlock { - - @SideOnly(Side.CLIENT) - private IIcon field_150938_b; - - public ItemBlockDoor(Block p_i45328_1_) { - super(p_i45328_1_); - } - - /** - * Callback for item usage. If the item does something special on right clicking, he will have one of those. Return - * True if something happen and false if it don't. This is for ITEMS, not BLOCKS - */ - @Override - public boolean onItemUse(ItemStack par1ItemStack, EntityPlayer par2EntityPlayer, World par3World, int par4, - int par5, int par6, int par7, float par8, float par9, float par10) { - if (par7 != 1) { - return false; - } else { - ++par5; - Block block; - - block = field_150939_a; - - if (par2EntityPlayer.canPlayerEdit(par4, par5, par6, par7, par1ItemStack) - && par2EntityPlayer.canPlayerEdit(par4, par5 + 1, par6, par7, par1ItemStack)) { - if (!block.canPlaceBlockAt(par3World, par4, par5, par6)) { - return false; - } else { - int i1 = MathHelper.floor_double( - (double) ((par2EntityPlayer.rotationYaw + 180.0F) * 4.0F / 360.0F) - 0.5D) & 3; - byte b0 = 0; - byte b1 = 0; - - if (i1 == 0) { - b1 = 1; - } - - if (i1 == 1) { - b0 = -1; - } - - if (i1 == 2) { - b1 = -1; - } - - if (i1 == 3) { - b0 = 1; - } - - int i2 = (par3World.getBlock(par4 - b0, par5, par6 - b1).isNormalCube() ? 1 : 0) - + (par3World.getBlock(par4 - b0, par5 + 1, par6 - b1).isNormalCube() ? 1 : 0); - int j1 = (par3World.getBlock(par4 + b0, par5, par6 + b1).isNormalCube() ? 1 : 0) - + (par3World.getBlock(par4 + b0, par5 + 1, par6 + b1).isNormalCube() ? 1 : 0); - boolean flag = par3World.getBlock(par4 - b0, par5, par6 - b1) == block - || par3World.getBlock(par4 - b0, par5 + 1, par6 - b1) == block; - boolean flag1 = par3World.getBlock(par4 + b0, par5, par6 + b1) == block - || par3World.getBlock(par4 + b0, par5 + 1, par6 + b1) == block; - boolean flag2 = false; - - if (flag && !flag1) { - flag2 = true; - } else if (j1 > i2) { - flag2 = true; - } - - par3World.setBlock(par4, par5, par6, block, i1, 2); - par3World.setBlock(par4, par5 + 1, par6, block, 8 | (flag2 ? 1 : 0), 2); - par3World.notifyBlocksOfNeighborChange(par4, par5, par6, block); - par3World.notifyBlocksOfNeighborChange(par4, par5 + 1, par6, block); - - --par1ItemStack.stackSize; - return true; - } - } else { - return false; - } - } - } - - @Override - public void addInformation(ItemStack p_77624_1_, EntityPlayer p_77624_2_, List p_77624_3_, boolean p_77624_4_) { - p_77624_3_.add("This is a block, you can place it by right clicking"); - super.addInformation(p_77624_1_, p_77624_2_, p_77624_3_, p_77624_4_); - } -} diff --git a/src/main/java/gtPlusPlus/core/item/base/itemblock/ItemBlockGtFrameBox.java b/src/main/java/gtPlusPlus/core/item/base/itemblock/ItemBlockGtFrameBox.java deleted file mode 100644 index 914e39e2a5..0000000000 --- a/src/main/java/gtPlusPlus/core/item/base/itemblock/ItemBlockGtFrameBox.java +++ /dev/null @@ -1,91 +0,0 @@ -package gtPlusPlus.core.item.base.itemblock; - -import java.util.List; - -import net.minecraft.block.Block; -import net.minecraft.entity.Entity; -import net.minecraft.entity.player.EntityPlayer; -import net.minecraft.item.ItemBlock; -import net.minecraft.item.ItemStack; -import net.minecraft.util.EnumChatFormatting; -import net.minecraft.world.World; - -import gtPlusPlus.core.block.base.BlockBaseModular; -import gtPlusPlus.core.lib.CORE; -import gtPlusPlus.core.material.Material; -import gtPlusPlus.core.material.MaterialStack; -import gtPlusPlus.core.util.minecraft.EntityUtils; -import gtPlusPlus.core.util.sys.KeyboardUtils; - -public class ItemBlockGtFrameBox extends ItemBlock { - - protected int blockColour; - private Material mMaterial; - private int sRadiation; - - public ItemBlockGtFrameBox(final Block block) { - super(block); - final BlockBaseModular baseBlock = (BlockBaseModular) block; - this.blockColour = baseBlock.getRenderColor(1); - - if (block instanceof BlockBaseModular) { - BlockBaseModular g = (BlockBaseModular) block; - this.mMaterial = g.getMaterialEx(); - sRadiation = mMaterial.vRadiationLevel; - } else { - this.mMaterial = null; - sRadiation = 0; - } - - // GT_OreDictUnificator.registerOre("frameGt"+block.getUnlocalizedName().replace("tile.", - // "").replace("tile.BlockGtFrame", "").replace("-", "").replace("_", "").replace(" ", "").replace("FrameBox", - // ""), ItemUtils.getSimpleStack(this)); - } - - public int getRenderColor(final int aMeta) { - return this.blockColour; - } - - @SuppressWarnings("unchecked") - @Override - public void addInformation(final ItemStack stack, final EntityPlayer aPlayer, final List list, final boolean bool) { - if (this.mMaterial != null) { - list.add(this.mMaterial.vChemicalFormula); - if (this.mMaterial.vRadiationLevel > 0) { - list.add(CORE.GT_Tooltip_Radioactive.get()); - } - } else { - list.add("Material is Null."); - } - if (KeyboardUtils.isCtrlKeyDown()) { - Block b = Block.getBlockFromItem(stack.getItem()); - if (b != null) { - String aTool = b.getHarvestTool(stack.getItemDamage()); - int aMiningLevel1 = b.getHarvestLevel(stack.getItemDamage()); - list.add("Mining Level: " + Math.min(Math.max(aMiningLevel1, 0), 5)); - if (this.mMaterial != null) { - list.add("Contains: "); - if (mMaterial.getComposites().isEmpty()) { - list.add("- " + mMaterial.getLocalizedName()); - } else { - for (MaterialStack m : mMaterial.getComposites()) { - list.add("- " + m.getStackMaterial().getLocalizedName() + " x" + m.getPartsPerOneHundred()); - } - } - } - } - } else { - list.add(EnumChatFormatting.DARK_GRAY + "Hold Ctrl to show additional info."); - } - super.addInformation(stack, aPlayer, list, bool); - } - - @Override - public void onUpdate(final ItemStack iStack, final World world, final Entity entityHolding, final int p_77663_4_, - final boolean p_77663_5_) { - - if (this.sRadiation > 0) { - EntityUtils.applyRadiationDamageToEntity(iStack.stackSize, this.sRadiation, world, entityHolding); - } - } -} diff --git a/src/main/java/gtPlusPlus/core/item/base/itemblock/ItemBlockNBT.java b/src/main/java/gtPlusPlus/core/item/base/itemblock/ItemBlockNBT.java deleted file mode 100644 index abbdd61ff1..0000000000 --- a/src/main/java/gtPlusPlus/core/item/base/itemblock/ItemBlockNBT.java +++ /dev/null @@ -1,96 +0,0 @@ -package gtPlusPlus.core.item.base.itemblock; - -import java.util.List; - -import net.minecraft.block.Block; -import net.minecraft.entity.Entity; -import net.minecraft.entity.player.EntityPlayer; -import net.minecraft.entity.player.EntityPlayerMP; -import net.minecraft.item.ItemBlock; -import net.minecraft.item.ItemStack; -import net.minecraft.nbt.NBTTagCompound; -import net.minecraft.world.World; - -import gregtech.api.util.GT_Utility; -import gtPlusPlus.api.interfaces.ITileTooltip; -import gtPlusPlus.api.objects.Logger; -import gtPlusPlus.core.tileentities.base.TileEntityBase; -import gtPlusPlus.core.util.minecraft.PlayerUtils; - -public class ItemBlockNBT extends ItemBlock { - - protected final int mID; - - public ItemBlockNBT(final Block block) { - super(block); - this.mID = ((ITileTooltip) block).getTooltipID(); - } - - @Override - public void addInformation(final ItemStack stack, final EntityPlayer aPlayer, final List list, final boolean bool) { - - // if () - - if (this.mID == 0) { // blockDarkWorldPortalFrame - list.add("Assembled in the same shape as the Nether Portal."); - } - } - - @Override - public void onCreated(ItemStack item, World world, EntityPlayer player) { - addNBT(player, item); - super.onCreated(item, world, player); - } - - @Override - public void onUpdate(ItemStack item, World world, Entity entity, int p_77663_4_, boolean p_77663_5_) { - if (entity instanceof EntityPlayerMP) { - EntityPlayerMP mPlayer = (EntityPlayerMP) entity; - - NBTTagCompound rNBT = item.getTagCompound(); - rNBT = ((rNBT == null) ? new NBTTagCompound() : rNBT); - if (!rNBT.hasKey("mOwner")) { - addNBT(mPlayer, item); - } - } - super.onUpdate(item, world, entity, p_77663_4_, p_77663_5_); - } - - private void addNBT(EntityPlayer player, ItemStack item) { - NBTTagCompound rNBT = item.getTagCompound(); - rNBT = ((rNBT == null) ? new NBTTagCompound() : rNBT); - if (player != null) { - boolean mOP = PlayerUtils.isPlayerOP(player); - rNBT.setString("mOwner", player.getDisplayName()); - rNBT.setString("mUUID", "" + player.getUniqueID()); - rNBT.setBoolean("mOP", mOP); - } else if (player == null) { - rNBT.setString("mOwner", "fakeplayer"); - rNBT.setString("mUUID", "00000000"); - rNBT.setBoolean("mOP", false); - } - GT_Utility.ItemNBT.setNBT(item, rNBT); - } - - @Override - public boolean placeBlockAt(ItemStack aStack, EntityPlayer aPlayer, World aWorld, int aX, int aY, int aZ, int side, - float hitX, float hitY, float hitZ, int aMeta) { - if (!(aWorld.setBlock(aX, aY, aZ, this.field_150939_a, 0, 3))) { - return false; - } - if (aWorld.getBlock(aX, aY, aZ) == this.field_150939_a) { - this.field_150939_a.onBlockPlacedBy(aWorld, aX, aY, aZ, aPlayer, aStack); - this.field_150939_a.onPostBlockPlaced(aWorld, aX, aY, aZ, aMeta); - } - TileEntityBase tTileEntity = (TileEntityBase) aWorld.getTileEntity(aX, aY, aZ); - if (tTileEntity != null && aPlayer != null) { - if (tTileEntity.isServerSide()) { - Logger.INFO("Setting Tile Entity information"); - NBTTagCompound aNBT = GT_Utility.ItemNBT.getNBT(aStack); - tTileEntity - .setOwnerInformation(aNBT.getString("mOwner"), aNBT.getString("mUUID"), aNBT.getBoolean("mOP")); - } - } - return true; - } -} diff --git a/src/main/java/gtPlusPlus/core/item/tool/misc/box/BaseBoxItem.java b/src/main/java/gtPlusPlus/core/item/tool/misc/box/BaseBoxItem.java deleted file mode 100644 index 2679441d76..0000000000 --- a/src/main/java/gtPlusPlus/core/item/tool/misc/box/BaseBoxItem.java +++ /dev/null @@ -1,75 +0,0 @@ -package gtPlusPlus.core.item.tool.misc.box; - -import static gregtech.api.enums.Mods.GTPlusPlus; - -import net.minecraft.client.renderer.texture.IIconRegister; -import net.minecraft.entity.player.EntityPlayer; -import net.minecraft.item.EnumRarity; -import net.minecraft.item.ItemStack; -import net.minecraft.util.EnumChatFormatting; -import net.minecraft.world.World; - -import cpw.mods.fml.relauncher.Side; -import cpw.mods.fml.relauncher.SideOnly; -import gtPlusPlus.GTplusplus; -import gtPlusPlus.core.creative.AddToCreativeTab; -import gtPlusPlus.core.item.base.CoreItem; -import gtPlusPlus.core.util.Utils; - -public class BaseBoxItem extends CoreItem { - - private final int GUI; - - public BaseBoxItem(String displayName, String[] description, int GUI_ID) { - super( - "item." + Utils.sanitizeString(displayName), - displayName, - AddToCreativeTab.tabTools, - 1, - 0, - modifyDescriptionStringArray(description), - EnumRarity.uncommon, - EnumChatFormatting.GRAY, - false, - null); - GUI = GUI_ID; - } - - private static String[] modifyDescriptionStringArray(String[] array) { - String[] a = new String[array.length + 1]; - for (int b = 0; b < array.length; b++) { - a[b] = array[b]; - } - a[a.length - 1] = "Right Click to open"; - return a; - } - - // Without this method, your inventory will NOT work!!! - @Override - public int getMaxItemUseDuration(ItemStack stack) { - return 1; // return any value greater than zero - } - - @Override - public ItemStack onItemRightClick(ItemStack itemstack, World world, EntityPlayer player) { - if (!world.isRemote) { - // If player not sneaking, open the inventory gui - if (!player.isSneaking()) { - player.openGui( - GTplusplus.instance, - GUI, - world, - (int) player.posX, - (int) player.posY, - (int) player.posZ); - } - } - return itemstack; - } - - @Override - @SideOnly(Side.CLIENT) - public void registerIcons(IIconRegister iconRegister) { - this.itemIcon = iconRegister.registerIcon(GTPlusPlus.ID + ":" + this.getUnlocalizedName().substring(5)); - } -} diff --git a/src/main/java/gtPlusPlus/core/item/tool/misc/box/ContainerBoxBase.java b/src/main/java/gtPlusPlus/core/item/tool/misc/box/ContainerBoxBase.java deleted file mode 100644 index 3f24ba5e29..0000000000 --- a/src/main/java/gtPlusPlus/core/item/tool/misc/box/ContainerBoxBase.java +++ /dev/null @@ -1,314 +0,0 @@ -package gtPlusPlus.core.item.tool.misc.box; - -import java.lang.reflect.Constructor; -import java.lang.reflect.InvocationTargetException; - -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.Slot; -import net.minecraft.item.ItemStack; - -public class ContainerBoxBase extends Container { - - /* - * Finally, in your Container class, you will need to check if the currently opened inventory's uniqueID is equal to - * the itemstack's uniqueID in the method 'transferStackInSlot' as well as check if the itemstack is the currently - * equipped item in the method 'slotClick'. In both cases, you'll need to prevent the itemstack from being moved or - * it will cause bad things to happen. - */ - - /** - * Step 3: Create a custom Container for your Inventory - */ - - /* - * There's a LOT of code in this one, but read through all of the comments carefully and it should become clear what - * everything does. As a bonus, one of my previous tutorials is included within! - * "How to Properly Override Shift-Clicking" is here and better than ever! At least in my opinion. If you're like - * me, and you find no end of frustration trying to figure out which f-ing index you should use for which slots in - * your container when overriding transferStackInSlot, or if your following the original tutorial, then read on. - */ - - /** - * The Item Inventory for this Container, only needed if you want to reference isUseableByPlayer - */ - private final CustomBoxInventory inventory; - /** - * Using these will make transferStackInSlot easier to understand and implement INV_START is the index of the first - * slot in the Player's Inventory, so our CustomBoxInventory's number of slots (e.g. 5 slots is array indices 0-4, - * so start at 5) Notice how we don't have to remember how many slots we made? We can just use - * CustomBoxInventory.INV_SIZE and if we ever change it, the Container updates automatically. - */ - private final int INV_START, INV_END, HOTBAR_START, HOTBAR_END; - - // If you're planning to add armor slots, put those first like this: - // ARMOR_START = CustomBoxInventory.INV_SIZE, ARMOR_END = ARMOR_START+3, - // INV_START = ARMOR_END+1, and then carry on like above. - - private Slot generateSlot(final Constructor aClazz, final IInventory base, final int id, final int x, - final int y) { - Slot aSlot; - try { - aSlot = (Slot) aClazz.newInstance(base, id, x, y); - if (aSlot != null) { - return aSlot; - } - } catch (InstantiationException | IllegalAccessException | IllegalArgumentException - | InvocationTargetException e) { - e.printStackTrace(); - } - return null; - } - - public ContainerBoxBase(EntityPlayer par1Player, InventoryPlayer inventoryPlayer, - CustomBoxInventory CustomBoxInventory, Class aClazz, int aSlotCount) { - - INV_START = aSlotCount; - INV_END = INV_START + 26; - HOTBAR_START = INV_END + 1; - HOTBAR_END = HOTBAR_START + 8; - - this.inventory = CustomBoxInventory; - try { - - Constructor constructor; - constructor = aClazz.getConstructor(IInventory.class, int.class, int.class, int.class); - - int i; - - // ITEM INVENTORY - you'll need to adjust the slot locations to match your - // texture file - // I have them set vertically in columns of 4 to the right of the player model - for (i = 0; i < CustomBoxInventory.INV_SIZE; ++i) { - // You can make a custom Slot if you need different behavior, - // such as only certain item types can be put into this slot - // We made a custom slot to prevent our inventory-storing item - // from being stored within itself, but if you want to allow that and - // you followed my advice at the end of the above step, then you - // could get away with using the vanilla Slot class - this.addSlotToContainer( - generateSlot( - constructor, - this.getInventoryObject(), - i, - 80 + (18 * (int) (i / 4)), - 8 + (18 * (i % 4)))); - } - - // If you want, you can add ARMOR SLOTS here as well, but you need to - // make a public version of SlotArmor. I won't be doing that in this tutorial. - /* - * for (i = 0; i < 4; ++i) { // These are the standard positions for survival inventory layout - * this.addSlotToContainer(new SlotArmor(this.player, inventoryPlayer, inventoryPlayer.getSizeInventory() - - * 1 - i, 8, 8 + i * 18, i)); } - */ - - // PLAYER INVENTORY - uses default locations for standard inventory texture file - for (i = 0; i < 3; ++i) { - for (int j = 0; j < 9; ++j) { - this.addSlotToContainer(new Slot(inventoryPlayer, j + i * 9 + 9, 8 + j * 18, 84 + i * 18)); - } - } - - // PLAYER ACTION BAR - uses default locations for standard action bar texture - // file - for (i = 0; i < 9; ++i) { - this.addSlotToContainer(new Slot(inventoryPlayer, i, 8 + i * 18, 142)); - } - - } catch (NoSuchMethodException | SecurityException e) { - e.printStackTrace(); - } - } - - @Override - public boolean canInteractWith(EntityPlayer entityplayer) { - // be sure to return the inventory's isUseableByPlayer method - // if you defined special behavior there: - return getInventoryObject().isUseableByPlayer(entityplayer); - } - - /** - * 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 par1EntityPlayer, int index) { - ItemStack itemstack = null; - Slot slot = (Slot) this.inventorySlots.get(index); - - if (slot != null && slot.getHasStack()) { - ItemStack itemstack1 = slot.getStack(); - itemstack = itemstack1.copy(); - - // If item is in our custom Inventory or armor slot - if (index < INV_START) { - // try to place in player inventory / action bar - if (!this.mergeItemStack(itemstack1, INV_START, HOTBAR_END + 1, true)) { - return null; - } - - slot.onSlotChange(itemstack1, itemstack); - } - // Item is in inventory / hotbar, try to place in custom inventory or armor - // slots - else { - /* - * If your inventory only stores certain instances of Items, you can implement shift-clicking to your - * inventory like this: // Check that the item is the right type if (itemstack1.getItem() instanceof - * ItemCustom) { // Try to merge into your custom inventory slots // We use - * 'CustomBoxInventory.INV_SIZE' instead of INV_START just in case // you also add armor or other custom - * slots if (!this.mergeItemStack(itemstack1, 0, CustomBoxInventory.INV_SIZE, false)) { return null; } } - * // If you added armor slots, check them here as well: // Item being shift-clicked is armor - try to - * put in armor slot if (itemstack1.getItem() instanceof ItemArmor) { int type = ((ItemArmor) - * itemstack1.getItem()).armorType; if (!this.mergeItemStack(itemstack1, ARMOR_START + type, ARMOR_START - * + type + 1, false)) { return null; } } Otherwise, you have basically 2 choices: 1. shift-clicking - * between player inventory and custom inventory 2. shift-clicking between action bar and inventory Be - * sure to choose only ONE of the following implementations!!! - */ - /** - * Implementation number 1: Shift-click into your custom inventory - */ - if (index >= INV_START) { - // place in custom inventory - if (!this.mergeItemStack(itemstack1, 0, INV_START, false)) { - return null; - } - } - - /** - * Implementation number 2: Shift-click items between action bar and inventory - */ - // item is in player's inventory, but not in action bar - if (index >= INV_START && index < HOTBAR_START) { - // place in action bar - if (!this.mergeItemStack(itemstack1, HOTBAR_START, HOTBAR_END + 1, false)) { - return null; - } - } - // item in action bar - place in player inventory - else if (index >= HOTBAR_START && index < HOTBAR_END + 1) { - if (!this.mergeItemStack(itemstack1, INV_START, INV_END + 1, false)) { - return null; - } - } - } - - if (itemstack1.stackSize == 0) { - slot.putStack((ItemStack) null); - } else { - slot.onSlotChanged(); - } - - if (itemstack1.stackSize == itemstack.stackSize) { - return null; - } - - slot.onPickupFromSlot(par1EntityPlayer, itemstack1); - } - - return itemstack; - } - - /** - * You should override this method to prevent the player from moving the stack that opened the inventory, otherwise - * if the player moves it, the inventory will not be able to save properly - */ - @Override - public ItemStack slotClick(int slot, int button, int flag, EntityPlayer player) { - // this will prevent the player from interacting with the item that opened the - // inventory: - if (slot >= 0 && getSlot(slot) != null && getSlot(slot).getStack() == player.getHeldItem()) { - return null; - } - return super.slotClick(slot, button, flag, player); - } - - /* - * Special note: If your custom inventory's stack limit is 1 and you allow shift-clicking itemstacks into it, you - * will need to override mergeStackInSlot to avoid losing all the items but one in a stack when you shift-click. - */ - /** - * Vanilla mergeItemStack method doesn't correctly handle inventories whose max stack size is 1 when you shift-click - * into the inventory. This is a modified method I wrote to handle such cases. Note you only need it if your slot / - * inventory's max stack size is 1 - */ - @Override - protected boolean mergeItemStack(ItemStack stack, int start, int end, boolean backwards) { - boolean flag1 = false; - int k = (backwards ? end - 1 : start); - Slot slot; - ItemStack itemstack1; - - if (stack.isStackable()) { - while (stack.stackSize > 0 && (!backwards && k < end || backwards && k >= start)) { - slot = (Slot) inventorySlots.get(k); - itemstack1 = slot.getStack(); - - if (!slot.isItemValid(stack)) { - k += (backwards ? -1 : 1); - continue; - } - - if (itemstack1 != null && itemstack1.getItem() == stack.getItem() - && (!stack.getHasSubtypes() || stack.getItemDamage() == itemstack1.getItemDamage()) - && ItemStack.areItemStackTagsEqual(stack, itemstack1)) { - int l = itemstack1.stackSize + stack.stackSize; - - if (l <= stack.getMaxStackSize() && l <= slot.getSlotStackLimit()) { - stack.stackSize = 0; - itemstack1.stackSize = l; - getInventoryObject().markDirty(); - flag1 = true; - } else if (itemstack1.stackSize < stack.getMaxStackSize() && l < slot.getSlotStackLimit()) { - stack.stackSize -= stack.getMaxStackSize() - itemstack1.stackSize; - itemstack1.stackSize = stack.getMaxStackSize(); - getInventoryObject().markDirty(); - flag1 = true; - } - } - - k += (backwards ? -1 : 1); - } - } - if (stack.stackSize > 0) { - k = (backwards ? end - 1 : start); - while (!backwards && k < end || backwards && k >= start) { - slot = (Slot) inventorySlots.get(k); - itemstack1 = slot.getStack(); - - if (!slot.isItemValid(stack)) { - k += (backwards ? -1 : 1); - continue; - } - - if (itemstack1 == null) { - int l = stack.stackSize; - if (l <= slot.getSlotStackLimit()) { - slot.putStack(stack.copy()); - stack.stackSize = 0; - getInventoryObject().markDirty(); - flag1 = true; - break; - } else { - putStackInSlot( - k, - new ItemStack(stack.getItem(), slot.getSlotStackLimit(), stack.getItemDamage())); - stack.stackSize -= slot.getSlotStackLimit(); - getInventoryObject().markDirty(); - flag1 = true; - } - } - - k += (backwards ? -1 : 1); - } - } - - return flag1; - } - - public CustomBoxInventory getInventoryObject() { - return inventory; - } -} diff --git a/src/main/java/gtPlusPlus/core/item/tool/misc/box/CustomBoxInventory.java b/src/main/java/gtPlusPlus/core/item/tool/misc/box/CustomBoxInventory.java deleted file mode 100644 index 858689f33d..0000000000 --- a/src/main/java/gtPlusPlus/core/item/tool/misc/box/CustomBoxInventory.java +++ /dev/null @@ -1,216 +0,0 @@ -package gtPlusPlus.core.item.tool.misc.box; - -import java.util.UUID; - -import net.minecraft.entity.player.EntityPlayer; -import net.minecraft.inventory.IInventory; -import net.minecraft.item.ItemStack; -import net.minecraft.nbt.NBTTagCompound; -import net.minecraft.nbt.NBTTagList; -import net.minecraftforge.common.util.Constants; - -public abstract class CustomBoxInventory implements IInventory { - - private final String name; - protected String uniqueID; - - /** Provides NBT Tag Compound to reference */ - private final ItemStack invItem; - - /** Defining your inventory size this way is handy */ - public final int INV_SIZE; - - /** Inventory's size must be same as number of slots you add to the Container class */ - private ItemStack[] inventory; - - /** - * @param itemstack - the ItemStack to which this inventory belongs - */ - public CustomBoxInventory(ItemStack stack, String name2) { - this(stack, name2, 8); - } - - /** - * @param itemstack - the ItemStack to which this inventory belongs - */ - public CustomBoxInventory(ItemStack stack, String name2, int slots) { - invItem = stack; - name = name2; - INV_SIZE = slots; - inventory = new ItemStack[INV_SIZE]; - - /** initialize variable within the constructor: */ - uniqueID = ""; - - if (!stack.hasTagCompound()) { - stack.setTagCompound(new NBTTagCompound()); - // no tag compound means the itemstack does not yet have a UUID, so assign one: - uniqueID = UUID.randomUUID().toString(); - } - - /** When reading from NBT: */ - if ("".equals(uniqueID)) { - // try to read unique ID from NBT - uniqueID = stack.getTagCompound().getString("uniqueID"); - // if it's still "", assign a new one: - if ("".equals(uniqueID)) { - uniqueID = UUID.randomUUID().toString(); - } - } - - /** Writing to NBT: */ - // just add this line: - stack.getTagCompound().setString("uniqueID", this.uniqueID); - - // note that it's okay to use stack instead of invItem right there - // both reference the same memory location, so whatever you change using - // either reference will change in the other - - // Read the inventory contents from NBT - readFromNBT(stack.getTagCompound()); - } - - @Override - public int getSizeInventory() { - return inventory.length; - } - - @Override - public ItemStack getStackInSlot(int slot) { - return inventory[slot]; - } - - @Override - public ItemStack decrStackSize(int slot, int amount) { - ItemStack stack = getStackInSlot(slot); - if (stack != null) { - if (stack.stackSize > amount) { - stack = stack.splitStack(amount); - // Don't forget this line or your inventory will not be saved! - markDirty(); - } else { - // this method also calls onInventoryChanged, so we don't need to call it again - setInventorySlotContents(slot, null); - } - } - return stack; - } - - @Override - public ItemStack getStackInSlotOnClosing(int slot) { - ItemStack stack = getStackInSlot(slot); - setInventorySlotContents(slot, null); - return stack; - } - - @Override - public void setInventorySlotContents(int slot, ItemStack stack) { - inventory[slot] = stack; - - if (stack != null && stack.stackSize > getInventoryStackLimit()) { - stack.stackSize = getInventoryStackLimit(); - } - - // Don't forget this line or your inventory will not be saved! - markDirty(); - } - - // 1.7.2+ renamed to getInventoryName - @Override - public String getInventoryName() { - return name; - } - - // 1.7.2+ renamed to hasCustomInventoryName - @Override - public boolean hasCustomInventoryName() { - return name.length() > 0; - } - - @Override - public int getInventoryStackLimit() { - return 64; - } - - /** - * This is the method that will handle saving the inventory contents, as it is called (or should be called!) anytime - * the inventory changes. Perfect. Much better than using onUpdate in an Item, as this will also let you change - * things in your inventory without ever opening a Gui, if you want. - */ - // 1.7.2+ renamed to markDirty - @Override - public void markDirty() { - for (int i = 0; i < getSizeInventory(); ++i) { - if (getStackInSlot(i) != null && getStackInSlot(i).stackSize == 0) { - inventory[i] = null; - } - } - - // This line here does the work: - writeToNBT(invItem.getTagCompound()); - } - - @Override - public boolean isUseableByPlayer(EntityPlayer entityplayer) { - return true; - } - - // 1.7.2+ renamed to openInventory(EntityPlayer player) - @Override - public void openInventory() {} - - // 1.7.2+ renamed to closeInventory(EntityPlayer player) - @Override - public void closeInventory() {} - - /** - * This method doesn't seem to do what it claims to do, as items can still be left-clicked and placed in the - * inventory even when this returns false - */ - @Override - public abstract boolean isItemValidForSlot(int slot, ItemStack itemstack); - - /** - * A custom method to read our inventory from an ItemStack's NBT compound - */ - public void readFromNBT(NBTTagCompound compound) { - // Gets the custom taglist we wrote to this compound, if any - // 1.7.2+ change to compound.getTagList("ItemInventory", Constants.NBT.TAG_COMPOUND); - NBTTagList items = compound.getTagList("ItemInventory", Constants.NBT.TAG_COMPOUND); - - for (int i = 0; i < items.tagCount(); ++i) { - // 1.7.2+ change to items.getCompoundTagAt(i) - NBTTagCompound item = (NBTTagCompound) items.getCompoundTagAt(i); - int slot = item.getInteger("Slot"); - - // Just double-checking that the saved slot index is within our inventory array bounds - if (slot >= 0 && slot < getSizeInventory()) { - inventory[slot] = ItemStack.loadItemStackFromNBT(item); - } - } - } - - /** - * A custom method to write our inventory to an ItemStack's NBT compound - */ - public void writeToNBT(NBTTagCompound tagcompound) { - // Create a new NBT Tag List to store itemstacks as NBT Tags - NBTTagList items = new NBTTagList(); - - for (int i = 0; i < getSizeInventory(); ++i) { - // Only write stacks that contain items - if (getStackInSlot(i) != null) { - // Make a new NBT Tag Compound to write the itemstack and slot index to - NBTTagCompound item = new NBTTagCompound(); - item.setInteger("Slot", i); - // Writes the itemstack in slot(i) to the Tag Compound we just made - getStackInSlot(i).writeToNBT(item); - - // add the tag compound to our tag list - items.appendTag(item); - } - } - // Add the TagList to the ItemStack's Tag Compound with the name "ItemInventory" - tagcompound.setTag("ItemInventory", items); - } -} diff --git a/src/main/java/gtPlusPlus/core/lib/CORE.java b/src/main/java/gtPlusPlus/core/lib/CORE.java index acb2ab1a07..a47fa597be 100644 --- a/src/main/java/gtPlusPlus/core/lib/CORE.java +++ b/src/main/java/gtPlusPlus/core/lib/CORE.java @@ -23,9 +23,9 @@ import com.mojang.authlib.GameProfile; import cpw.mods.fml.common.FMLCommonHandler; +import gregtech.api.objects.XSTR; import gtPlusPlus.api.objects.Logger; import gtPlusPlus.api.objects.data.Pair; -import gtPlusPlus.api.objects.random.XSTR; import gtPlusPlus.core.util.reflect.ReflectionUtils; import gtPlusPlus.preloader.CORE_Preloader; import gtPlusPlus.xmod.gregtech.api.enums.GregtechOrePrefixes.GT_Materials; diff --git a/src/main/java/gtPlusPlus/core/material/Material.java b/src/main/java/gtPlusPlus/core/material/Material.java index 8068d6ab35..fe1dcd618d 100644 --- a/src/main/java/gtPlusPlus/core/material/Material.java +++ b/src/main/java/gtPlusPlus/core/material/Material.java @@ -32,7 +32,6 @@ import gtPlusPlus.core.util.minecraft.FluidUtils; import gtPlusPlus.core.util.minecraft.ItemUtils; import gtPlusPlus.core.util.minecraft.MaterialUtils; -import gtPlusPlus.xmod.thaumcraft.objects.wrapper.aspect.TC_Aspect_Wrapper; import gtPlusPlus.xmod.tinkers.material.BaseTinkersMaterial; public class Material { @@ -85,8 +84,6 @@ public class Material { public int vToolQuality; public int vHarvestLevel; - private TC_Aspect_Wrapper[] vAspects; - public BaseTinkersMaterial vTiConHandler; public short werkstoffID; @@ -531,8 +528,6 @@ public Material(final String materialName, final MaterialState defaultState, fin this.vNeutrons = this.calculateNeutrons(); } - this.vAspects = null; - this.vMass = this.getMass(); // Sets tool Durability diff --git a/src/main/java/gtPlusPlus/core/players/FakeFarmer.java b/src/main/java/gtPlusPlus/core/players/FakeFarmer.java deleted file mode 100644 index ba8d5f9d77..0000000000 --- a/src/main/java/gtPlusPlus/core/players/FakeFarmer.java +++ /dev/null @@ -1,85 +0,0 @@ -package gtPlusPlus.core.players; - -import java.util.UUID; - -import net.minecraft.entity.player.EntityPlayer; -import net.minecraft.entity.player.EntityPlayerMP; -import net.minecraft.item.ItemStack; -import net.minecraft.network.play.client.C15PacketClientSettings; -import net.minecraft.server.management.ItemInWorldManager; -import net.minecraft.stats.StatBase; -import net.minecraft.util.ChunkCoordinates; -import net.minecraft.util.DamageSource; -import net.minecraft.util.IChatComponent; -import net.minecraft.world.World; -import net.minecraft.world.WorldServer; - -import com.mojang.authlib.GameProfile; - -import cpw.mods.fml.common.FMLCommonHandler; - -public class FakeFarmer extends EntityPlayerMP { - - private static final UUID uuid = UUID.fromString("c1ddfd7f-120a-4437-8b64-38660d3ec62d"); - - private static GameProfile FAKE_PROFILE = new GameProfile(uuid, "[GT_Farm_Manager]"); - - public FakeFarmer(final WorldServer world) { - super( - FMLCommonHandler.instance().getMinecraftServerInstance(), - world, - FAKE_PROFILE, - new ItemInWorldManager(world)); - } - - @Override - public boolean canCommandSenderUseCommand(final int i, final String s) { - return false; - } - - @Override - public ChunkCoordinates getPlayerCoordinates() { - return new ChunkCoordinates(0, 0, 0); - } - - @Override - public void addChatComponentMessage(final IChatComponent chatmessagecomponent) {} - - @Override - public void addChatMessage(final IChatComponent p_145747_1_) {} - - @Override - public void addStat(final StatBase par1StatBase, final int par2) {} - - @Override - public void openGui(final Object mod, final int modGuiId, final World world, final int x, final int y, - final int z) {} - - @Override - public boolean isEntityInvulnerable() { - return true; - } - - @Override - public boolean canAttackPlayer(final EntityPlayer player) { - return false; - } - - @Override - public void onDeath(final DamageSource source) {} - - @Override - public void onUpdate() {} - - @Override - public void travelToDimension(final int dim) {} - - @Override - public void func_147100_a(final C15PacketClientSettings pkt) {} - - @Override - public boolean canPlayerEdit(final int par1, final int par2, final int par3, final int par4, - final ItemStack par5ItemStack) { - return true; - } -} diff --git a/src/main/java/gtPlusPlus/core/recipe/RECIPES_GREGTECH.java b/src/main/java/gtPlusPlus/core/recipe/RECIPES_GREGTECH.java index 4e6298caf4..601b02cb6c 100644 --- a/src/main/java/gtPlusPlus/core/recipe/RECIPES_GREGTECH.java +++ b/src/main/java/gtPlusPlus/core/recipe/RECIPES_GREGTECH.java @@ -54,7 +54,6 @@ import gregtech.api.util.GT_RecipeConstants; import gregtech.api.util.GT_Utility; import gregtech.api.util.HotFuel; -import gregtech.api.util.ThermalFuel; import gtPlusPlus.api.objects.Logger; import gtPlusPlus.core.block.ModBlocks; import gtPlusPlus.core.item.ModItems; @@ -1209,8 +1208,6 @@ private static void addFuels() { FluidUtils.getSuperHeatedSteam(100000), 0); - ThermalFuel.addSteamTurbineFuel(FluidUtils.getFluidStack("steam", 1024)); - GT_Values.RA.stdBuilder().itemInputs(ItemUtils.getSimpleStack(Items.lava_bucket)).metadata(FUEL_VALUE, 32) .metadata(FUEL_TYPE, 2).duration(0).eut(0).addTo(GT_RecipeConstants.Fuel); GT_Values.RA.stdBuilder().itemInputs(ItemUtils.getIC2Cell(2)).metadata(FUEL_VALUE, 32).metadata(FUEL_TYPE, 2) diff --git a/src/main/java/gtPlusPlus/core/slots/SlotBlockedInv.java b/src/main/java/gtPlusPlus/core/slots/SlotBlockedInv.java deleted file mode 100644 index 3132baf159..0000000000 --- a/src/main/java/gtPlusPlus/core/slots/SlotBlockedInv.java +++ /dev/null @@ -1,39 +0,0 @@ -package gtPlusPlus.core.slots; - -import net.minecraft.entity.player.EntityPlayer; -import net.minecraft.inventory.IInventory; -import net.minecraft.inventory.Slot; -import net.minecraft.item.ItemStack; - -public class SlotBlockedInv extends Slot { - - public SlotBlockedInv(IInventory inv, int index, int xPos, int yPos) { - super(inv, index, xPos, yPos); - } - - @Override - public boolean isItemValid(ItemStack stack) { - return false; - } - - @Override - public boolean canTakeStack(EntityPlayer player) { - return false; - } - - @Override - public void putStack(ItemStack itemStack) {} - - @Override - public void onPickupFromSlot(EntityPlayer player, ItemStack itemStack) {} - - @Override - public boolean getHasStack() { - return false; - } - - @Override - public ItemStack decrStackSize(int i) { - return null; - } -} diff --git a/src/main/java/gtPlusPlus/core/slots/SlotBuzzSaw.java b/src/main/java/gtPlusPlus/core/slots/SlotBuzzSaw.java deleted file mode 100644 index 588f17c92a..0000000000 --- a/src/main/java/gtPlusPlus/core/slots/SlotBuzzSaw.java +++ /dev/null @@ -1,73 +0,0 @@ -package gtPlusPlus.core.slots; - -import net.minecraft.inventory.IInventory; -import net.minecraft.inventory.Slot; -import net.minecraft.item.ItemStack; - -import gregtech.api.enums.OrePrefixes; -import gregtech.api.items.GT_MetaGenerated_Tool; -import gregtech.common.items.GT_MetaGenerated_Item_02; - -public class SlotBuzzSaw extends Slot { - - public SAWTOOL currentTool = SAWTOOL.NONE; - - public SlotBuzzSaw(final IInventory inventory, final int slot, final int x, final int y) { - super(inventory, slot, x, y); - } - - @Override - public boolean isItemValid(final ItemStack itemstack) { - boolean isValid = false; - - if (itemstack != null) { - if ((itemstack.getItem() instanceof GT_MetaGenerated_Item_02) - || (itemstack.getItem() instanceof GT_MetaGenerated_Tool)) { - // Buzzsaw Blade //TODO - /* - * if (OrePrefixes.toolHeadBuzzSaw.contains(itemstack)){ isValid = false; } - */ - if (OrePrefixes.craftingTool.contains(itemstack)) { - if (itemstack.getDisplayName().toLowerCase().contains("saw") - || itemstack.getDisplayName().toLowerCase().contains("gt.metatool.01.10") - || itemstack.getDisplayName().toLowerCase().contains("gt.metatool.01.110") - || itemstack.getDisplayName().toLowerCase().contains("gt.metatool.01.112") - || itemstack.getDisplayName().toLowerCase().contains("gt.metatool.01.114") - || itemstack.getDisplayName().toLowerCase().contains("gt.metatool.01.140")) { - if (itemstack.getItemDamage() == 10) { - isValid = true; - this.currentTool = SAWTOOL.SAW; - } else if (itemstack.getItemDamage() == 110) { - isValid = true; - this.currentTool = SAWTOOL.CHAINSAW; - } else if (itemstack.getItemDamage() == 112) { - isValid = true; - this.currentTool = SAWTOOL.CHAINSAW; - } else if (itemstack.getItemDamage() == 114) { - isValid = true; - this.currentTool = SAWTOOL.CHAINSAW; - } else if (itemstack.getItemDamage() == 140) { - isValid = true; - this.currentTool = SAWTOOL.BUZZSAW; - } - return isValid; - } - } - } - } - this.currentTool = SAWTOOL.NONE; - return isValid; - } - - @Override - public int getSlotStackLimit() { - return 1; - } - - public enum SAWTOOL { - NONE, - SAW, - BUZZSAW, - CHAINSAW - } -} diff --git a/src/main/java/gtPlusPlus/core/slots/SlotFuelRod.java b/src/main/java/gtPlusPlus/core/slots/SlotFuelRod.java deleted file mode 100644 index 0dd050b5aa..0000000000 --- a/src/main/java/gtPlusPlus/core/slots/SlotFuelRod.java +++ /dev/null @@ -1,52 +0,0 @@ -package gtPlusPlus.core.slots; - -import net.minecraft.inventory.IInventory; -import net.minecraft.inventory.Slot; -import net.minecraft.item.ItemStack; - -import gregtech.api.enums.ItemList; -import ic2.core.Ic2Items; - -public class SlotFuelRod extends Slot { - - public SlotFuelRod(final IInventory inventory, final int index, final int x, final int y) { - super(inventory, index, x, y); - } - - @Override - public boolean isItemValid(final ItemStack itemstack) { - boolean returnValue = false; - // Uranium Rods - if (itemstack.getItem() == Ic2Items.reactorUraniumSimple.getItem()) { - returnValue = true; - } else if (itemstack.getItem() == Ic2Items.reactorUraniumDual.getItem()) { - returnValue = true; - } else if (itemstack.getItem() == Ic2Items.reactorUraniumQuad.getItem()) { - returnValue = true; - } - - // Mox Rods - if (itemstack.getItem() == Ic2Items.reactorMOXSimple.getItem()) { - returnValue = true; - } else if (itemstack.getItem() == Ic2Items.reactorMOXDual.getItem()) { - returnValue = true; - } else if (itemstack.getItem() == Ic2Items.reactorMOXQuad.getItem()) { - returnValue = true; - } - - // Thorium Rods - if (itemstack.getItem() == ItemList.ThoriumCell_1.getItem()) { - returnValue = true; - } else if (itemstack.getItem() == ItemList.ThoriumCell_2.getItem()) { - returnValue = true; - } else if (itemstack.getItem() == ItemList.ThoriumCell_4.getItem()) { - returnValue = true; - } - return returnValue; - } - - @Override - public int getSlotStackLimit() { - return 1; - } -} diff --git a/src/main/java/gtPlusPlus/core/slots/SlotGtTool.java b/src/main/java/gtPlusPlus/core/slots/SlotGtTool.java deleted file mode 100644 index 4047c4e62c..0000000000 --- a/src/main/java/gtPlusPlus/core/slots/SlotGtTool.java +++ /dev/null @@ -1,30 +0,0 @@ -package gtPlusPlus.core.slots; - -import net.minecraft.inventory.IInventory; -import net.minecraft.inventory.Slot; -import net.minecraft.item.ItemStack; - -import gregtech.api.items.GT_MetaGenerated_Tool; -import gtPlusPlus.api.objects.Logger; - -public class SlotGtTool extends Slot { - - public SlotGtTool(final IInventory inventory, final int x, final int y, final int z) { - super(inventory, x, y, z); - } - - @Override - public boolean isItemValid(final ItemStack itemstack) { - if (itemstack.getItem() instanceof GT_MetaGenerated_Tool) { - Logger.WARNING(itemstack.getDisplayName() + " is a valid Tool."); - return true; - } - Logger.WARNING(itemstack.getDisplayName() + " is not a valid Tool."); - return false; - } - - @Override - public int getSlotStackLimit() { - return 1; - } -} diff --git a/src/main/java/gtPlusPlus/core/slots/SlotLunchBox.java b/src/main/java/gtPlusPlus/core/slots/SlotLunchBox.java deleted file mode 100644 index ffd9f6dcae..0000000000 --- a/src/main/java/gtPlusPlus/core/slots/SlotLunchBox.java +++ /dev/null @@ -1,29 +0,0 @@ -package gtPlusPlus.core.slots; - -import net.minecraft.inventory.IInventory; -import net.minecraft.item.ItemFood; -import net.minecraft.item.ItemStack; - -import gtPlusPlus.api.objects.Logger; -import gtPlusPlus.core.util.minecraft.FoodUtils; - -public class SlotLunchBox extends SlotGtTool { - - public SlotLunchBox(final IInventory base, final int x, final int y, final int z) { - super(base, x, y, z); - } - - @Override - public boolean isItemValid(final ItemStack itemstack) { - return isItemValid_STATIC(itemstack); - } - - public static boolean isItemValid_STATIC(final ItemStack itemstack) { - if ((itemstack.getItem() instanceof ItemFood) || (FoodUtils.isFood(itemstack))) { - Logger.WARNING(itemstack.getDisplayName() + " is a valid food."); - return true; - } - Logger.WARNING(itemstack.getDisplayName() + " is not a valid food."); - return false; - } -} diff --git a/src/main/java/gtPlusPlus/core/slots/SlotMagicToolBag.java b/src/main/java/gtPlusPlus/core/slots/SlotMagicToolBag.java deleted file mode 100644 index 7c13dd1c7a..0000000000 --- a/src/main/java/gtPlusPlus/core/slots/SlotMagicToolBag.java +++ /dev/null @@ -1,29 +0,0 @@ -package gtPlusPlus.core.slots; - -import net.minecraft.inventory.IInventory; -import net.minecraft.item.ItemFood; -import net.minecraft.item.ItemStack; - -import gtPlusPlus.api.objects.Logger; -import gtPlusPlus.core.util.minecraft.FoodUtils; - -public class SlotMagicToolBag extends SlotGtTool { - - public SlotMagicToolBag(final IInventory base, final int x, final int y, final int z) { - super(base, x, y, z); - } - - @Override - public boolean isItemValid(final ItemStack itemstack) { - return isItemValid_STATIC(itemstack); - } - - public static boolean isItemValid_STATIC(final ItemStack itemstack) { - if ((itemstack.getItem() instanceof ItemFood) || (FoodUtils.isFood(itemstack))) { - Logger.WARNING(itemstack.getDisplayName() + " is a valid food."); - return true; - } - Logger.WARNING(itemstack.getDisplayName() + " is not a valid food."); - return false; - } -} diff --git a/src/main/java/gtPlusPlus/core/slots/SlotToolBox.java b/src/main/java/gtPlusPlus/core/slots/SlotToolBox.java deleted file mode 100644 index 29ad60fa18..0000000000 --- a/src/main/java/gtPlusPlus/core/slots/SlotToolBox.java +++ /dev/null @@ -1,107 +0,0 @@ -package gtPlusPlus.core.slots; - -import net.minecraft.inventory.IInventory; -import net.minecraft.item.ItemStack; -import net.minecraft.item.ItemTool; - -import gregtech.api.items.GT_MetaGenerated_Tool; -import gtPlusPlus.api.objects.Logger; -import gtPlusPlus.api.objects.data.AutoMap; -import gtPlusPlus.core.util.reflect.ReflectionUtils; - -public class SlotToolBox extends SlotGtTool { - - private static final AutoMap mSupportedCustomTools = new AutoMap(); - - static { - // Look for Supported custom tool types - Class temp; - - // IC2 Electrics - temp = ReflectionUtils.getClass("ic2.api.item.IElectricItem"); - if (temp != null) { - mSupportedCustomTools.put(temp); - temp = null; - } - - // IC2 Boxables - temp = ReflectionUtils.getClass(" ic2.api.item.IBoxable"); - if (temp != null) { - mSupportedCustomTools.put(temp); - temp = null; - } - - // Tinkers Tools - temp = ReflectionUtils.getClass("tconstruct.library.tools.Weapon"); - if (temp != null) { - mSupportedCustomTools.put(temp); - temp = null; - } - // BattleGear Weapons - temp = ReflectionUtils.getClass("mods.battlegear2.api.weapons.IBattlegearWeapon"); - if (temp != null) { - mSupportedCustomTools.put(temp); - temp = null; - } - - // OpenMods - String[] OpenModsContent = new String[] { "openblocks.common.item.ItemDevNull", - "openblocks.common.item.ItemHangGlider", "openblocks.common.item.ItemWrench", - "openblocks.common.item.ItemSleepingBag" }; - for (String t : OpenModsContent) { - temp = ReflectionUtils.getClass(t); - if (temp != null) { - mSupportedCustomTools.put(temp); - temp = null; - } - } - - // GC Wrench - temp = ReflectionUtils.getClass("micdoodle8.mods.galacticraft.core.items.ItemUniversalWrench"); - if (temp != null) { - mSupportedCustomTools.put(temp); - temp = null; - } - - // EIO - String[] EioContent = new String[] { "crazypants.enderio.api.tool.ITool", "crazypants.enderio.item.ItemMagnet", - "crazypants.enderio.item.ItemConduitProbe" }; - for (String t : EioContent) { - temp = ReflectionUtils.getClass(t); - if (temp != null) { - mSupportedCustomTools.put(temp); - temp = null; - } - } - - // Forestry - temp = ReflectionUtils.getClass("forestry.core.items.ItemForestryTool"); - if (temp != null) { - mSupportedCustomTools.put(temp); - temp = null; - } - } - - public SlotToolBox(final IInventory base, final int x, final int y, final int z) { - super(base, x, y, z); - } - - @Override - public boolean isItemValid(final ItemStack itemstack) { - return isItemValid_STATIC(itemstack); - } - - public static boolean isItemValid_STATIC(final ItemStack itemstack) { - if ((itemstack.getItem() instanceof GT_MetaGenerated_Tool) || (itemstack.getItem() instanceof ItemTool)) { - Logger.WARNING(itemstack.getDisplayName() + " is a valid Tool."); - return true; - } - for (Class C : mSupportedCustomTools) { - if (C.isInstance(itemstack.getItem())) { - return true; - } - } - Logger.WARNING(itemstack.getDisplayName() + " is not a valid Tool."); - return false; - } -} diff --git a/src/main/java/gtPlusPlus/core/tileentities/base/TileBasicTank.java b/src/main/java/gtPlusPlus/core/tileentities/base/TileBasicTank.java deleted file mode 100644 index 563249672d..0000000000 --- a/src/main/java/gtPlusPlus/core/tileentities/base/TileBasicTank.java +++ /dev/null @@ -1,157 +0,0 @@ -package gtPlusPlus.core.tileentities.base; - -import net.minecraftforge.common.util.ForgeDirection; -import net.minecraftforge.fluids.Fluid; -import net.minecraftforge.fluids.FluidStack; -import net.minecraftforge.fluids.FluidTankInfo; -import net.minecraftforge.fluids.IFluidHandler; -import net.minecraftforge.fluids.IFluidTank; - -import gregtech.common.covers.CoverInfo; -import gtPlusPlus.api.objects.minecraft.BTF_FluidTank; - -public class TileBasicTank extends TileEntityBase implements IFluidHandler, IFluidTank { - - public final BTF_FluidTank mTank; - - public TileBasicTank(int aMaxSlots, int aFluidCapacity) { - super(aMaxSlots); - mTank = new BTF_FluidTank(aFluidCapacity); - } - - @Override - public boolean onPreTick(long aTick) { - - if (this.isServerSide()) { - if (mTank.isFluidChangingAllowed() && mTank.getFillableStack() != null - && mTank.getFillableStack().amount <= 0) { - mTank.setFillableStack((FluidStack) null); - } - } - - return super.onPreTick(aTick); - } - - private final boolean canFillEx(ForgeDirection aSide, Fluid aFluid) { - return this.fill(aSide, new FluidStack(aFluid, 1), false) == 1; - } - - private final boolean canDrainEx(ForgeDirection aSide, Fluid aFluid) { - return this.drain(aSide, new FluidStack(aFluid, 1), false) != null; - } - - private final FluidTankInfo[] getTankInfoEx(ForgeDirection aSide) { - return mTank.getCapacity() <= 0 ? new FluidTankInfo[0] : new FluidTankInfo[] { mTank.getInfo() }; - } - - private final int fill_default(ForgeDirection aSide, FluidStack aFluid, boolean doFill) { - return mTank.fill(aFluid, doFill); - } - - private final int fillEx(ForgeDirection aSide, FluidStack aFluid, boolean doFill) { - return this.fill_default(aSide, aFluid, doFill); - } - - private final FluidStack drainEx(ForgeDirection aSide, FluidStack aFluid, boolean doDrain) { - return mTank.getFluid() != null && aFluid != null && mTank.getFluid().isFluidEqual(aFluid) - ? mTank.drain(aFluid.amount, doDrain) - : null; - } - - private final FluidStack drainEx(ForgeDirection aSide, int maxDrain, boolean doDrain) { - return mTank.drain(maxDrain, doDrain); - } - - public boolean isLiquidInput(ForgeDirection side) { - return true; - } - - public boolean isLiquidOutput(ForgeDirection side) { - return true; - } - - @Override - public int fill(ForgeDirection side, FluidStack aFluid, boolean doFill) { - if (mTickTimer > 5 && canAccessData() - && (mRunningThroughTick || !mInputDisabled) - && (side == ForgeDirection.UNKNOWN || (this.isLiquidInput(side) - && getCoverInfoAtSide(side).letsFluidIn(aFluid == null ? null : aFluid.getFluid())))) - return this.fillEx(side, aFluid, doFill); - return 0; - } - - @Override - public FluidStack drain(ForgeDirection side, int maxDrain, boolean doDrain) { - if (mTickTimer > 5 && canAccessData() - && (mRunningThroughTick || !mOutputDisabled) - && (side == ForgeDirection.UNKNOWN || (this.isLiquidOutput(side) && getCoverInfoAtSide(side) - .letsFluidOut(this.getFluid() == null ? null : this.getFluid().getFluid())))) - return this.drainEx(side, maxDrain, doDrain); - return null; - } - - @Override - public FluidStack drain(ForgeDirection side, FluidStack aFluid, boolean doDrain) { - if (mTickTimer > 5 && canAccessData() - && (mRunningThroughTick || !mOutputDisabled) - && (side == ForgeDirection.UNKNOWN || (this.isLiquidOutput(side) - && getCoverInfoAtSide(side).letsFluidOut(aFluid == null ? null : aFluid.getFluid())))) - return this.drainEx(side, aFluid, doDrain); - return null; - } - - @Override - public boolean canFill(ForgeDirection side, Fluid aFluid) { - if (mTickTimer > 5 && canAccessData() - && (mRunningThroughTick || !mInputDisabled) - && (side == ForgeDirection.UNKNOWN - || (this.isLiquidInput(side) && getCoverInfoAtSide(side).letsFluidIn(aFluid)))) - return this.canFillEx(side, aFluid); - return false; - } - - @Override - public boolean canDrain(ForgeDirection side, Fluid aFluid) { - if (mTickTimer > 5 && canAccessData() - && (mRunningThroughTick || !mOutputDisabled) - && (side == ForgeDirection.UNKNOWN - || (this.isLiquidOutput(side) && getCoverInfoAtSide(side).letsFluidOut(aFluid)))) - return this.canDrainEx(side, aFluid); - return false; - } - - @Override - public FluidTankInfo[] getTankInfo(ForgeDirection side) { - CoverInfo coverInfo = getCoverInfoAtSide(side); - if (canAccessData() - && (side == ForgeDirection.UNKNOWN || (this.isLiquidInput(side) && coverInfo.letsFluidIn(null)) - || (this.isLiquidOutput(side) && coverInfo.letsFluidOut(null)))) - return this.getTankInfoEx(side); - return new FluidTankInfo[] {}; - } - - @Override - public FluidStack getFluid() { - return mTank.getFluid(); - } - - @Override - public int getFluidAmount() { - return mTank.getFluidAmount(); - } - - @Override - public FluidTankInfo getInfo() { - return mTank.getInfo(); - } - - @Override - public int fill(FluidStack resource, boolean doFill) { - return mTank.fill(resource, doFill); - } - - @Override - public FluidStack drain(int maxDrain, boolean doDrain) { - return mTank.drain(maxDrain, doDrain); - } -} diff --git a/src/main/java/gtPlusPlus/core/tileentities/general/redstone/TileEntityRedstoneHandler.java b/src/main/java/gtPlusPlus/core/tileentities/general/redstone/TileEntityRedstoneHandler.java deleted file mode 100644 index 62b1e365aa..0000000000 --- a/src/main/java/gtPlusPlus/core/tileentities/general/redstone/TileEntityRedstoneHandler.java +++ /dev/null @@ -1,441 +0,0 @@ -package gtPlusPlus.core.tileentities.general.redstone; - -import net.minecraft.block.Block; -import net.minecraft.init.Blocks; -import net.minecraft.nbt.NBTTagCompound; -import net.minecraft.tileentity.TileEntity; -import net.minecraft.util.IIcon; -import net.minecraft.world.EnumSkyBlock; -import net.minecraft.world.IBlockAccess; - -import cpw.mods.fml.common.registry.GameRegistry; -import gtPlusPlus.api.interfaces.IToolable; -import gtPlusPlus.api.objects.Logger; -import gtPlusPlus.api.objects.minecraft.BlockPos; -import gtPlusPlus.core.util.Utils; -import gtPlusPlus.core.util.minecraft.EntityUtils; - -public abstract class TileEntityRedstoneHandler extends TileEntity implements IToolable { - - private final int mTileType; - private BlockPos mTilePos; - private boolean mRequiresUpdate = false; - private Long mStartTime; - private Byte mRedstoneLevel; - - public boolean mLightMode = false; - public float mLightValue = 0; - - /** - * Sets the Redstone Handler Type. - * - * @param aTileType - A type of the handler designated by an int. 0 = receiver, 1 = emitter, 2 = both, anything else - * = nothing. - */ - public TileEntityRedstoneHandler(int aTileType) { - mTileType = aTileType; - registerTileEntity(); - } - - private void registerTileEntity() { - if (!EntityUtils.isTileEntityRegistered(getTileEntityClass(), getTileEntityNameForRegistration())) { - GameRegistry.registerTileEntity(getTileEntityClass(), getTileEntityNameForRegistration()); - } - } - - protected abstract Class getTileEntityClass(); - - protected abstract String getTileEntityNameForRegistration(); - - public Block getBlock() { - return mTilePos != null ? mTilePos.getBlockAtPos() : Blocks.redstone_block; - } - - public final boolean isLight() { - return mLightMode; - } - - public final float getLightBrightness() { - if (!isLight()) { - return 0; - } else { - return mLightValue; - } - } - - @Override - public void readFromNBT(NBTTagCompound aNBT) { - mStartTime = aNBT.getLong("mStartTime"); - mInvName = aNBT.getString("mInvName"); - mLightValue = aNBT.getFloat("mLightValue"); - mLightMode = aNBT.getBoolean("mLightMode"); - mRedstoneLevel = aNBT.getByte("mRedstoneLevel"); - super.readFromNBT(aNBT); - } - - @Override - public void writeToNBT(NBTTagCompound aNBT) { - aNBT.setInteger("mTileType", mTileType); - aNBT.setLong("mStartTime", mStartTime); - aNBT.setString("mInvName", mInvName); - aNBT.setFloat("mLightValue", getLightBrightness()); - aNBT.setBoolean("mLightMode", isLight()); - aNBT.setByte("mRedstoneLevel", mRedstoneLevel); - super.writeToNBT(aNBT); - } - - private boolean mHasUpdatedRecently = false; - - private final boolean init() { - if (mTilePos == null) { - try { - mTilePos = new BlockPos(this); - } catch (Throwable t) { - return false; - } - } - if (mStartTime == null) { - try { - mStartTime = System.currentTimeMillis(); - } catch (Throwable t) { - return false; - } - } - return true; - } - - private Long mLastUpdate; - private String mInvName = ""; - - @Override - public void updateEntity() { - // Handle init - if (!init()) { - return; - } - if (mRequiresUpdate || mLastUpdate == null) { - mRequiresUpdate = false; - mHasUpdatedRecently = true; - mLastUpdate = System.currentTimeMillis(); - if (mTilePos.world.getBlockLightValue(xCoord, yCoord, zCoord) != getLightBrightness() / 0.0625f) { - mTilePos.getBlockAtPos().setLightLevel(getLightBrightness() / 0.0625f); - mTilePos.world.setLightValue( - EnumSkyBlock.Block, - xCoord, - yCoord, - zCoord, - (int) (getLightBrightness() / 0.0625f)); - mTilePos.world.updateLightByType(EnumSkyBlock.Block, xCoord, yCoord, zCoord); - Logger.INFO("Updating Light"); - } - mTilePos.world.scheduleBlockUpdate(xCoord, yCoord, zCoord, mTilePos.getBlockAtPos(), 1); - markDirty(); - } - if (Utils.getMillisSince(mLastUpdate, System.currentTimeMillis()) >= 5000) { - if (mHasUpdatedRecently) { - mHasUpdatedRecently = false; - this.markForUpdate(); - } - } - - if (Utils.getMillisSince(mStartTime, System.currentTimeMillis()) % 50 == 0) {} - - super.updateEntity(); - } - - public final void markForUpdate() { - mRequiresUpdate = true; - } - - public final boolean hasUpdatedRecently() { - return mHasUpdatedRecently; - } - - @Override - public int getBlockMetadata() { - return super.getBlockMetadata(); - } - - @Override - public void markDirty() { - super.markDirty(); - } - - @Override - public boolean canUpdate() { - return true; - } - - public void setRedstoneState(boolean aRedstoneActive) {} - - public void setCurrentTextureArray(IIcon[] aTextures) {} - - /** - * Used to see if one of the blocks next to you or your block is getting power from a neighboring block. Used by - * items like TNT or Doors so they don't have redstone going straight into them. Args: x, y, z - */ - public boolean isGettingIndirectlyPowered() { - if (mTilePos == null) { - return false; - } - return mTilePos.world.isBlockIndirectlyGettingPowered(xCoord, yCoord, zCoord); - } - - public int getStrongestIndirectPower() { - if (mTilePos == null) { - return 0; - } - return mTilePos.world.getStrongestIndirectPower(xCoord, yCoord, zCoord); - } - - /** - * Gets the power level from a certain block face. Args: x, y, z, direction - */ - public int getIndirectPowerForSide(int aSide) { - if (mTilePos == null || aSide < 0 || aSide > 5) { - return 0; - } - return mTilePos.world.getIndirectPowerLevelTo(xCoord, yCoord, zCoord, aSide); - } - - /** - * Returns the highest redstone signal strength powering the given block. Args: X, Y, Z. - */ - public int getBlockPowerInput() { - if (mTilePos == null) { - return 0; - } - return mTilePos.world.getBlockPowerInput(xCoord, yCoord, zCoord); - } - - /** - * Determine if this block can make a redstone connection on the side provided, Useful to control which sides are - * inputs and outputs for redstone wires. - * - * Side: -1: UP 0: NORTH 1: EAST 2: SOUTH 3: WEST - * - * @param world The current world - * @param x X Position - * @param y Y Position - * @param z Z Position - * @param side The side that is trying to make the connection - * @return True to make the connection - */ - public boolean canConnectRedstone(IBlockAccess world, int x, int y, int z, int side) { - if (mTilePos == null) { - return false; - } - return canAcceptRedstoneSignal() || canSupplyRedstoneSignal(); - } - - /** - * Called to determine whether to allow the a block to handle its own indirect power rather than using the default - * rules. - * - * @param world The world - * @param x The x position of this block instance - * @param y The y position of this block instance - * @param z The z position of this block instance - * @param side The INPUT side of the block to be powered - ie the opposite of this block's output side - * @return Whether Block#isProvidingWeakPower should be called when determining indirect power - */ - public boolean shouldCheckWeakPower(IBlockAccess world, int x, int y, int z, int side) { - if (mTilePos == null) { - return false; - } - return getBlock().isNormalCube(); - } - - /** - * If this block should be notified of weak changes. Weak changes are changes 1 block away through a solid block. - * Similar to comparators. - * - * @param world The current world - * @param x X Position - * @param y Y position - * @param z Z position - * @param side The side to check - * @return true To be notified of changes - */ - public boolean getWeakChanges(IBlockAccess world, int x, int y, int z) { - if (mTilePos == null) { - return false; - } - return false; - } - - /** - * Override this to change the level of redstone output. - * - * @return - */ - public int getRedstoneLevel() { - if (mTilePos == null || mRedstoneLevel == null) { - return 0; - } else { - if (canSupplyRedstoneSignal()) { - if (this.hasUpdatedRecently()) { - int aInputPower = getInputPowerLevel(); - mRedstoneLevel = (byte) ((aInputPower >= 0 && aInputPower <= 127) ? aInputPower : 0); - } - return mRedstoneLevel; - } - } - return 0; - } - - public boolean providesWeakPower() { - return isProvidingPower(); - } - - public boolean providesStrongPower() { - return isProvidingPower(); - } - - /** - * Returns the amount of week power this block is providing to a side. - * - * @param world - * @param x - * @param y - * @param z - * @param side - * @return - */ - public int isProvidingWeakPower(IBlockAccess world, int x, int y, int z, int side) { - if (!providesWeakPower()) { - return 0; - } - return getOutputPowerLevel(); - } - - /** - * Returns the amount of strong power this block is providing to a side. - * - * @param world - * @param x - * @param y - * @param z - * @param side - * @return - */ - public int isProvidingStrongPower(IBlockAccess world, int x, int y, int z, int side) { - if (!providesStrongPower()) { - return 0; - } - return getOutputPowerLevel(); - } - - /* - * GT++ Simplified Redstone Handling functions. - */ - - /** - * - * @return - Does this Block supply redstone signal at all? - */ - public final boolean isPowered() { - return canAcceptRedstoneSignal() && getInputPowerLevel() > 0; - } - - /** - * - * @return - Can this Block provide redstone signal at all? - */ - public final boolean isProvidingPower() { - return canSupplyRedstoneSignal() && getOutputPowerLevel() > 0; - } - - /** - * - * @return - (0-15) Redstone Output signal level - */ - public final int getOutputPowerLevel() { - return getRedstoneLevel(); - } - - /** - * - * @return (0-15) Redstone Input Signal level - */ - public final int getInputPowerLevel() { - return getBlockPowerInput(); - } - - /** - * - * @return - Does this Tile Entity support outputting redstone? - */ - public final boolean canSupplyRedstoneSignal() { - return mTileType == 1 || mTileType == 2; - } - - /** - * - * @return - Does this Tile Entity support inputting redstone? - */ - public final boolean canAcceptRedstoneSignal() { - return mTileType == 0 || mTileType == 2; - } - - @Override - public boolean isScrewdriverable() { - return false; - } - - @Override - public boolean onScrewdriverLMB() { - return false; - } - - @Override - public boolean onScrewdriverRMB() { - return false; - } - - @Override - public boolean isWrenchable() { - return false; - } - - @Override - public boolean onWrenchLMB() { - return false; - } - - @Override - public boolean onWrenchRMB() { - return false; - } - - @Override - public boolean isMalletable() { - return false; - } - - @Override - public boolean onMalletLMB() { - return false; - } - - @Override - public boolean onMalletRMB() { - return false; - } - - public void setCustomName(String displayName) { - this.mInvName = displayName; - } - - public String getCustomName() { - return this.mInvName; - } - - public String getInventoryName() { - return this.hasCustomInventoryName() ? this.mInvName : "container.redstone.generic"; - } - - public boolean hasCustomInventoryName() { - return (this.mInvName != null) && !this.mInvName.equals(""); - } -} diff --git a/src/main/java/gtPlusPlus/core/util/minecraft/FoodUtils.java b/src/main/java/gtPlusPlus/core/util/minecraft/FoodUtils.java deleted file mode 100644 index 2825ac80fd..0000000000 --- a/src/main/java/gtPlusPlus/core/util/minecraft/FoodUtils.java +++ /dev/null @@ -1,61 +0,0 @@ -package gtPlusPlus.core.util.minecraft; - -import net.minecraft.init.Items; -import net.minecraft.item.EnumAction; -import net.minecraft.item.Item; -import net.minecraft.item.ItemBlock; -import net.minecraft.item.ItemFood; -import net.minecraft.item.ItemStack; - -import gtPlusPlus.core.util.reflect.ReflectionUtils; - -public class FoodUtils { - - public static final Class IEdibleClass; - - static { - IEdibleClass = ReflectionUtils.getClass("squeek.applecore.api.food.IEdible"); - } - - public static boolean isFood(ItemStack food) { - - if (food == null) { - return false; - } - - Item item = food.getItem(); - - if (item == null) { - return false; - } - - EnumAction action = item.getItemUseAction(food); - - if (item instanceof ItemBlock || action == EnumAction.eat || action == EnumAction.drink) { - if (getUnmodifiedFoodValues(food) > 0) { - return true; - } - } - - return false; - } - - private static int getUnmodifiedFoodValues(ItemStack stack) { - - if (stack == null) { - return 0; - } - - Item item = stack.getItem(); - - if (item == null) { - return 0; - } - - if (IEdibleClass.isInstance(item) || item instanceof ItemFood || item == Items.cake) { - return 1; - } - - return 0; - } -} diff --git a/src/main/java/gtPlusPlus/core/util/minecraft/particles/BlockBreakParticles.java b/src/main/java/gtPlusPlus/core/util/minecraft/particles/BlockBreakParticles.java deleted file mode 100644 index ff28f59eb2..0000000000 --- a/src/main/java/gtPlusPlus/core/util/minecraft/particles/BlockBreakParticles.java +++ /dev/null @@ -1,17 +0,0 @@ -package gtPlusPlus.core.util.minecraft.particles; - -import net.minecraft.block.Block; -import net.minecraft.world.World; - -import gtPlusPlus.xmod.forestry.HANDLER_FR; - -public class BlockBreakParticles { - - public BlockBreakParticles(final World world, final int x, final int y, final int z, final Block block) { - try { - HANDLER_FR.createBlockBreakParticles(world, x, y, z, block); - } catch (final Throwable T) { - - } - } -} diff --git a/src/main/java/gtPlusPlus/core/util/sys/SystemUtils.java b/src/main/java/gtPlusPlus/core/util/sys/SystemUtils.java deleted file mode 100644 index 71ed513618..0000000000 --- a/src/main/java/gtPlusPlus/core/util/sys/SystemUtils.java +++ /dev/null @@ -1,85 +0,0 @@ -package gtPlusPlus.core.util.sys; - -public class SystemUtils { - - private static OS SystemType; - - public static OS getOS() { - if (SystemType != null) { - return SystemType; - } else { - SystemType = getOperatingSystem(); - return SystemType; - } - } - - /** - * Try invoke the runtime's Garbage Collector. - */ - public static void invokeGC() { - try { - Runtime r = Runtime.getRuntime(); - r.gc(); - } catch (Throwable t) { - // Do nothing. - } - } - - public static boolean isWindows() { - return (getOSString().indexOf("win") >= 0); - } - - public static boolean isMac() { - return (getOSString().indexOf("mac") >= 0); - } - - public static boolean isUnix() { - return (getOSString().indexOf("nix") >= 0 || getOSString().indexOf("nux") >= 0 - || getOSString().indexOf("aix") > 0); - } - - public static boolean isSolaris() { - return (getOSString().indexOf("sunos") >= 0); - } - - public static String getOSString() { - try { - return System.getProperty("os.name").toLowerCase(); - } catch (Throwable t) { - return "other"; - } - } - - public static OS getOperatingSystem() { - if (isMac()) { - return OS.MAC; - } else if (isWindows()) { - return OS.WINDOWS; - } else if (isUnix()) { - return OS.UNIX; - } else if (isSolaris()) { - return OS.SOLARIS; - } else { - return OS.OTHER; - } - } - - public static enum OS { - - MAC(1), - WINDOWS(2), - UNIX(3), - SOLARIS(4), - OTHER(0); - - private int mID; - - private OS(final int ID) { - this.mID = ID; - } - - public int getID() { - return this.mID; - } - } -} diff --git a/src/main/java/gtPlusPlus/core/world/explosions/MiningExplosion.java b/src/main/java/gtPlusPlus/core/world/explosions/MiningExplosion.java index 08fa644785..6e35868cb7 100644 --- a/src/main/java/gtPlusPlus/core/world/explosions/MiningExplosion.java +++ b/src/main/java/gtPlusPlus/core/world/explosions/MiningExplosion.java @@ -22,7 +22,7 @@ import net.minecraft.world.Explosion; import net.minecraft.world.World; -import gtPlusPlus.api.objects.random.XSTR; +import gregtech.api.objects.XSTR; import gtPlusPlus.core.entity.EntityPrimedMiningExplosive; import gtPlusPlus.core.util.math.MathUtils; diff --git a/src/main/java/gtPlusPlus/everglades/gen/gt/WorldGen_GT_Base.java b/src/main/java/gtPlusPlus/everglades/gen/gt/WorldGen_GT_Base.java index a6ad406f85..2608b0b024 100644 --- a/src/main/java/gtPlusPlus/everglades/gen/gt/WorldGen_GT_Base.java +++ b/src/main/java/gtPlusPlus/everglades/gen/gt/WorldGen_GT_Base.java @@ -13,10 +13,10 @@ import net.minecraft.world.gen.feature.WorldGenMinable; import cpw.mods.fml.common.IWorldGenerator; +import gregtech.api.objects.XSTR; import gregtech.api.util.GT_Log; import gregtech.common.GT_Worldgenerator; import gtPlusPlus.api.objects.Logger; -import gtPlusPlus.api.objects.random.XSTR; import gtPlusPlus.core.material.ELEMENT; import gtPlusPlus.everglades.dimension.Dimension_Everglades; import gtPlusPlus.xmod.gregtech.HANDLER_GT; diff --git a/src/main/java/gtPlusPlus/plugin/fixes/vanilla/music/MusicTocker.java b/src/main/java/gtPlusPlus/plugin/fixes/vanilla/music/MusicTocker.java index c2af6ea591..98657b455f 100644 --- a/src/main/java/gtPlusPlus/plugin/fixes/vanilla/music/MusicTocker.java +++ b/src/main/java/gtPlusPlus/plugin/fixes/vanilla/music/MusicTocker.java @@ -11,9 +11,9 @@ import cpw.mods.fml.relauncher.Side; import cpw.mods.fml.relauncher.SideOnly; +import gregtech.api.objects.XSTR; import gtPlusPlus.api.interfaces.IPlugin; import gtPlusPlus.api.objects.Logger; -import gtPlusPlus.api.objects.random.XSTR; import gtPlusPlus.core.util.reflect.ReflectionUtils; import gtPlusPlus.preloader.CORE_Preloader; 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/api/metatileentity/implementations/GT_MetaTileEntity_Hatch_FluidGenerator.java b/src/main/java/gtPlusPlus/xmod/gregtech/api/metatileentity/implementations/GT_MetaTileEntity_Hatch_FluidGenerator.java index fa6cdff33b..e50ec67d80 100644 --- a/src/main/java/gtPlusPlus/xmod/gregtech/api/metatileentity/implementations/GT_MetaTileEntity_Hatch_FluidGenerator.java +++ b/src/main/java/gtPlusPlus/xmod/gregtech/api/metatileentity/implementations/GT_MetaTileEntity_Hatch_FluidGenerator.java @@ -15,8 +15,8 @@ import gregtech.api.metatileentity.MetaTileEntity; import gregtech.api.metatileentity.implementations.GT_MetaTileEntity_Hatch_Input; import gregtech.api.objects.GT_RenderedTexture; +import gregtech.api.objects.XSTR; import gregtech.api.util.GT_Utility; -import gtPlusPlus.api.objects.random.XSTR; import gtPlusPlus.core.lib.CORE; import gtPlusPlus.core.util.minecraft.FluidUtils; diff --git a/src/main/java/gtPlusPlus/xmod/gregtech/common/Meta_GT_Proxy.java b/src/main/java/gtPlusPlus/xmod/gregtech/common/Meta_GT_Proxy.java index 757b3eb3bf..71f809ae99 100644 --- a/src/main/java/gtPlusPlus/xmod/gregtech/common/Meta_GT_Proxy.java +++ b/src/main/java/gtPlusPlus/xmod/gregtech/common/Meta_GT_Proxy.java @@ -11,12 +11,10 @@ import gregtech.api.util.GT_LanguageManager; import gtPlusPlus.api.objects.Logger; import gtPlusPlus.core.handler.AchievementHandler; -import gtPlusPlus.core.util.Utils; import gtPlusPlus.core.util.minecraft.ItemUtils; import gtPlusPlus.core.util.minecraft.LangUtils; import gtPlusPlus.core.util.minecraft.gregtech.PollutionUtils; import gtPlusPlus.xmod.gregtech.common.covers.CoverManager; -import gtPlusPlus.xmod.gregtech.common.helpers.MachineUpdateHandler; import ic2.core.init.BlocksItems; import ic2.core.init.InternalName; @@ -34,7 +32,6 @@ public static void preInit() { public static void init() { PollutionUtils.setPollutionFluids(); fixIC2FluidNames(); - Utils.registerEvent(new MachineUpdateHandler()); } public static void postInit() { diff --git a/src/main/java/gtPlusPlus/xmod/gregtech/common/covers/GTPP_Cover_ToggleVisual.java b/src/main/java/gtPlusPlus/xmod/gregtech/common/covers/GTPP_Cover_ToggleVisual.java index 2366bbe87f..44ddf9f6cf 100644 --- a/src/main/java/gtPlusPlus/xmod/gregtech/common/covers/GTPP_Cover_ToggleVisual.java +++ b/src/main/java/gtPlusPlus/xmod/gregtech/common/covers/GTPP_Cover_ToggleVisual.java @@ -11,12 +11,12 @@ import gregtech.api.interfaces.tileentity.ICoverable; import gregtech.api.interfaces.tileentity.IGregTechTileEntity; +import gregtech.api.objects.XSTR; import gregtech.api.util.GT_CoverBehavior; import gregtech.api.util.GT_Utility; import gregtech.api.util.ISerializableObject; import gtPlusPlus.api.objects.Logger; import gtPlusPlus.api.objects.minecraft.BlockPos; -import gtPlusPlus.api.objects.random.XSTR; import gtPlusPlus.core.util.minecraft.PlayerUtils; public class GTPP_Cover_ToggleVisual extends GT_CoverBehavior { diff --git a/src/main/java/gtPlusPlus/xmod/gregtech/common/helpers/MachineUpdateHandler.java b/src/main/java/gtPlusPlus/xmod/gregtech/common/helpers/MachineUpdateHandler.java deleted file mode 100644 index 2710f5dc78..0000000000 --- a/src/main/java/gtPlusPlus/xmod/gregtech/common/helpers/MachineUpdateHandler.java +++ /dev/null @@ -1,41 +0,0 @@ -package gtPlusPlus.xmod.gregtech.common.helpers; - -import java.util.HashMap; - -import net.minecraft.block.Block; -import net.minecraftforge.event.world.BlockEvent; - -import cpw.mods.fml.common.eventhandler.SubscribeEvent; -import gregtech.api.GregTech_API; - -public class MachineUpdateHandler { - - private static final HashMap mBlockCache = new HashMap(); - - public static void registerBlockToCauseMachineUpdate(String aUnlocalName, Block aBlock) { - mBlockCache.put(aUnlocalName, aBlock); - } - - @SubscribeEvent - public void onBlockEvent(BlockEvent event) { - Block aBlock = event.block; - String aUnlocalName = aBlock != null ? aBlock.getUnlocalizedName() : "NULL"; - boolean aDoUpdate = false; - if (aBlock != null && aUnlocalName != null && !aUnlocalName.equals("NULL")) { - for (String aCachedName : mBlockCache.keySet()) { - if (aCachedName.equals(aUnlocalName)) { - aDoUpdate = true; - break; - } else { - if (aBlock == mBlockCache.get(aCachedName)) { - aDoUpdate = true; - break; - } - } - } - if (aDoUpdate) { - GregTech_API.causeMachineUpdate(event.world, event.x, event.y, event.z); - } - } - } -} diff --git a/src/main/java/gtPlusPlus/xmod/gregtech/common/helpers/TreeFarmHelper.java b/src/main/java/gtPlusPlus/xmod/gregtech/common/helpers/TreeFarmHelper.java index 6ed8c7ed0a..a8b3ea15ea 100644 --- a/src/main/java/gtPlusPlus/xmod/gregtech/common/helpers/TreeFarmHelper.java +++ b/src/main/java/gtPlusPlus/xmod/gregtech/common/helpers/TreeFarmHelper.java @@ -3,7 +3,6 @@ import net.minecraft.item.ItemStack; import gregtech.common.items.GT_MetaGenerated_Tool_01; -import gtPlusPlus.core.slots.SlotBuzzSaw.SAWTOOL; public class TreeFarmHelper { @@ -29,4 +28,11 @@ public static SAWTOOL isCorrectMachinePart(final ItemStack aStack) { return SAWTOOL.NONE; } + public enum SAWTOOL { + NONE, + SAW, + BUZZSAW, + CHAINSAW + } + } 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_); - } -} diff --git a/src/main/java/gtPlusPlus/xmod/gregtech/common/helpers/autocrafter/AC_Helper_Utils.java b/src/main/java/gtPlusPlus/xmod/gregtech/common/helpers/autocrafter/AC_Helper_Utils.java deleted file mode 100644 index a3c33f0290..0000000000 --- a/src/main/java/gtPlusPlus/xmod/gregtech/common/helpers/autocrafter/AC_Helper_Utils.java +++ /dev/null @@ -1,54 +0,0 @@ -package gtPlusPlus.xmod.gregtech.common.helpers.autocrafter; - -import java.util.HashMap; -import java.util.Iterator; -import java.util.Map; -import java.util.Map.Entry; -import java.util.Set; - -import gtPlusPlus.api.objects.Logger; -import gtPlusPlus.xmod.gregtech.common.tileentities.machines.multi.production.GT4Entity_AutoCrafter; - -public class AC_Helper_Utils { - - // AC maps - public static final Map sAutocrafterMap = new HashMap(); - - // Add Crafter - public static final int addCrafter(GT4Entity_AutoCrafter AC) { - if (!sAutocrafterMap.containsValue(AC)) { - int increase = sAutocrafterMap.size() + 1; - sAutocrafterMap.put(increase, AC); - Logger.INFO("[A-C] " + "Added Auto-Crafter to index on position " + increase + "."); - return increase; - } else { - Logger.INFO("[A-C] Tried adding an Auto-Crafter to Index, but found one already there."); - } - return 0; - } - - public static final boolean removeCrafter(GT4Entity_AutoCrafter AC) { - if (!sAutocrafterMap.isEmpty()) { - if (sAutocrafterMap.containsValue(AC)) { - sAutocrafterMap.remove(getIDByCrafter(AC)); - return true; - } - } - return false; - } - - public static final int getIDByCrafter(GT4Entity_AutoCrafter AC) { - if (!sAutocrafterMap.isEmpty()) { - Set> players = sAutocrafterMap.entrySet(); - Iterator> i = players.iterator(); - while (i.hasNext()) { - Entry current = i.next(); - if (current.getValue().equals(AC)) { - return current.getKey(); - } - } - } - Logger.WARNING("Failed. [getIDByCrafter]"); - return 0; - } -} diff --git a/src/main/java/gtPlusPlus/xmod/gregtech/common/tileentities/machines/multi/production/GT4Entity_AutoCrafter.java b/src/main/java/gtPlusPlus/xmod/gregtech/common/tileentities/machines/multi/production/GT4Entity_AutoCrafter.java index e37a6783f5..25fe69da96 100644 --- a/src/main/java/gtPlusPlus/xmod/gregtech/common/tileentities/machines/multi/production/GT4Entity_AutoCrafter.java +++ b/src/main/java/gtPlusPlus/xmod/gregtech/common/tileentities/machines/multi/production/GT4Entity_AutoCrafter.java @@ -30,7 +30,6 @@ import gtPlusPlus.core.block.ModBlocks; import gtPlusPlus.core.lib.CORE; import gtPlusPlus.xmod.gregtech.api.metatileentity.implementations.base.GregtechMeta_MultiBlockBase; -import gtPlusPlus.xmod.gregtech.common.helpers.autocrafter.AC_Helper_Utils; public class GT4Entity_AutoCrafter extends GregtechMeta_MultiBlockBase implements ISurvivalConstructable { @@ -179,18 +178,6 @@ public String[] getExtraInfoData() { return new String[] { "Large Scale Auto-Assembler v1.01c", running, maintenance, tSpecialText }; } - @Override - public void explodeMultiblock() { - AC_Helper_Utils.removeCrafter(this); - super.explodeMultiblock(); - } - - @Override - public void doExplosion(long aExplosionPower) { - AC_Helper_Utils.removeCrafter(this); - super.doExplosion(aExplosionPower); - } - @Override public boolean supportsInputSeparation() { return true; diff --git a/src/main/java/gtPlusPlus/xmod/gregtech/common/tileentities/machines/multi/production/GregtechMetaTileEntityTreeFarm.java b/src/main/java/gtPlusPlus/xmod/gregtech/common/tileentities/machines/multi/production/GregtechMetaTileEntityTreeFarm.java index fb4a210d84..fbc6b638d3 100644 --- a/src/main/java/gtPlusPlus/xmod/gregtech/common/tileentities/machines/multi/production/GregtechMetaTileEntityTreeFarm.java +++ b/src/main/java/gtPlusPlus/xmod/gregtech/common/tileentities/machines/multi/production/GregtechMetaTileEntityTreeFarm.java @@ -65,7 +65,6 @@ import gtPlusPlus.core.block.ModBlocks; import gtPlusPlus.core.item.ModItems; import gtPlusPlus.core.lib.CORE; -import gtPlusPlus.core.slots.SlotBuzzSaw.SAWTOOL; import gtPlusPlus.core.util.math.MathUtils; import gtPlusPlus.core.util.minecraft.FluidUtils; import gtPlusPlus.core.util.minecraft.ItemUtils; @@ -73,6 +72,7 @@ import gtPlusPlus.xmod.gregtech.api.metatileentity.implementations.base.GregtechMeta_MultiBlockBase; import gtPlusPlus.xmod.gregtech.common.blocks.textures.TexturesGtBlock; import gtPlusPlus.xmod.gregtech.common.helpers.TreeFarmHelper; +import gtPlusPlus.xmod.gregtech.common.helpers.TreeFarmHelper.SAWTOOL; public class GregtechMetaTileEntityTreeFarm extends GregtechMeta_MultiBlockBase implements ISurvivalConstructable { diff --git a/src/main/java/gtPlusPlus/xmod/thaumcraft/HANDLER_Thaumcraft.java b/src/main/java/gtPlusPlus/xmod/thaumcraft/HANDLER_Thaumcraft.java deleted file mode 100644 index 0bca8535fe..0000000000 --- a/src/main/java/gtPlusPlus/xmod/thaumcraft/HANDLER_Thaumcraft.java +++ /dev/null @@ -1,32 +0,0 @@ -package gtPlusPlus.xmod.thaumcraft; - -import static gregtech.api.enums.Mods.Thaumcraft; - -import net.minecraft.init.Items; -import net.minecraft.item.Item; -import net.minecraft.item.ItemStack; - -import gtPlusPlus.api.objects.data.AutoMap; -import gtPlusPlus.api.objects.data.Pair; -import gtPlusPlus.core.util.reflect.ReflectionUtils; -import gtPlusPlus.xmod.thaumcraft.aspect.GTPP_AspectCompat; -import gtPlusPlus.xmod.thaumcraft.aspect.GTPP_AspectStack; - -public class HANDLER_Thaumcraft { - - public static GTPP_AspectCompat sThaumcraftCompat; - public static Item mResearchNotes; - public static final AutoMap> sItemsToGetAspects = new AutoMap>(); - - public static void init() { - if (Thaumcraft.isModLoaded()) { - try { - mResearchNotes = (Item) ReflectionUtils - .getField(ReflectionUtils.getClass("thaumcraft.common.config.ConfigItems"), "itemResearchNotes") - .get(null); - } catch (IllegalArgumentException | IllegalAccessException e) { - mResearchNotes = Items.paper; - } - } - } -} diff --git a/src/main/java/gtPlusPlus/xmod/thaumcraft/aspect/GTPP_AspectCompat.java b/src/main/java/gtPlusPlus/xmod/thaumcraft/aspect/GTPP_AspectCompat.java deleted file mode 100644 index feda254313..0000000000 --- a/src/main/java/gtPlusPlus/xmod/thaumcraft/aspect/GTPP_AspectCompat.java +++ /dev/null @@ -1,147 +0,0 @@ -package gtPlusPlus.xmod.thaumcraft.aspect; - -import static gregtech.api.enums.Mods.GTPlusPlus; - -import java.lang.reflect.InvocationTargetException; -import java.lang.reflect.Method; -import java.util.HashMap; -import java.util.LinkedHashMap; -import java.util.List; - -import net.minecraft.util.ResourceLocation; - -import gregtech.api.enums.TC_Aspects; -import gregtech.common.GT_ThaumcraftCompat; -import gtPlusPlus.api.objects.Logger; -import gtPlusPlus.core.util.Utils; -import gtPlusPlus.xmod.thaumcraft.objects.wrapper.aspect.TC_AspectList_Wrapper; -import gtPlusPlus.xmod.thaumcraft.objects.wrapper.aspect.TC_Aspect_Wrapper; - -public class GTPP_AspectCompat { - - public static volatile Method m = null; - - private static HashMap mAspectCache = new LinkedHashMap(); - - public static TC_Aspect_Wrapper ASPECT_BALANCE; - public static TC_Aspect_Wrapper ASPECT_LUST; - public static TC_Aspect_Wrapper ASPECT_STARBOUND; - public static TC_Aspect_Wrapper ASPECT_TOXIC; - public static TC_Aspect_Wrapper ASPECT_HEAVEN; - - /* - * TC_Aspects.AER.mAspect = Aspect.AIR; TC_Aspects.ALIENIS.mAspect = Aspect.ELDRITCH; TC_Aspects.AQUA.mAspect = - * Aspect.WATER; TC_Aspects.ARBOR.mAspect = Aspect.TREE; TC_Aspects.AURAM.mAspect = Aspect.AURA; - * TC_Aspects.BESTIA.mAspect = Aspect.BEAST; TC_Aspects.COGNITIO.mAspect = Aspect.MIND; TC_Aspects.CORPUS.mAspect = - * Aspect.FLESH; TC_Aspects.EXANIMIS.mAspect = Aspect.UNDEAD; TC_Aspects.FABRICO.mAspect = Aspect.CRAFT; - * TC_Aspects.FAMES.mAspect = Aspect.HUNGER; TC_Aspects.GELUM.mAspect = Aspect.COLD; TC_Aspects.GRANUM.mAspect = - * Aspect.PLANT; TC_Aspects.HERBA.mAspect = Aspect.PLANT; TC_Aspects.HUMANUS.mAspect = Aspect.MAN; - * TC_Aspects.IGNIS.mAspect = Aspect.FIRE; TC_Aspects.INSTRUMENTUM.mAspect = Aspect.TOOL; TC_Aspects.ITER.mAspect = - * Aspect.TRAVEL; TC_Aspects.LIMUS.mAspect = Aspect.SLIME; TC_Aspects.LUCRUM.mAspect = Aspect.GREED; - * TC_Aspects.LUX.mAspect = Aspect.LIGHT; TC_Aspects.MACHINA.mAspect = Aspect.MECHANISM; TC_Aspects.MESSIS.mAspect = - * Aspect.CROP; TC_Aspects.METALLUM.mAspect = Aspect.METAL; TC_Aspects.METO.mAspect = Aspect.HARVEST; - * TC_Aspects.MORTUUS.mAspect = Aspect.DEATH; TC_Aspects.MOTUS.mAspect = Aspect.MOTION; TC_Aspects.ORDO.mAspect = - * Aspect.ORDER; TC_Aspects.PANNUS.mAspect = Aspect.CLOTH; TC_Aspects.PERDITIO.mAspect = Aspect.ENTROPY; - * TC_Aspects.PERFODIO.mAspect = Aspect.MINE; TC_Aspects.PERMUTATIO.mAspect = Aspect.EXCHANGE; - * TC_Aspects.POTENTIA.mAspect = Aspect.ENERGY; TC_Aspects.PRAECANTATIO.mAspect = Aspect.MAGIC; - * TC_Aspects.SANO.mAspect = Aspect.HEAL; TC_Aspects.SENSUS.mAspect = Aspect.SENSES; TC_Aspects.SPIRITUS.mAspect = - * Aspect.SOUL; TC_Aspects.TELUM.mAspect = Aspect.WEAPON; TC_Aspects.TERRA.mAspect = Aspect.EARTH; - * TC_Aspects.TEMPESTAS.mAspect = Aspect.WEATHER; TC_Aspects.TENEBRAE.mAspect = Aspect.DARKNESS; - * TC_Aspects.TUTAMEN.mAspect = Aspect.ARMOR; TC_Aspects.VACUOS.mAspect = Aspect.VOID; TC_Aspects.VENENUM.mAspect = - * Aspect.POISON; TC_Aspects.VICTUS.mAspect = Aspect.LIFE; TC_Aspects.VINCULUM.mAspect = Aspect.TRAP; - * TC_Aspects.VITIUM.mAspect = Aspect.TAINT; TC_Aspects.VITREUS.mAspect = Aspect.CRYSTAL; TC_Aspects.VOLATUS.mAspect - * = Aspect.FLIGHT; - */ - - public GTPP_AspectCompat() { - - // Generate all existing Aspects as TC_Aspects - LinkedHashMap h = TC_Aspect_Wrapper.getVanillaAspectList(); - for (String g : h.keySet()) { - Object aBaseAspect = h.get(g); - if (aBaseAspect != null && TC_Aspect_Wrapper.isObjectAnAspect(aBaseAspect)) { - TC_Aspect_Wrapper aS = TC_Aspect_Wrapper.getAspect(g); - if (aS != null) { - mAspectCache.put(g, aS); - continue; - } - } - } - - // Custom Aspects - ASPECT_BALANCE = new TC_Aspect_Wrapper( - "Sagrausten", - Utils.rgbtoHexValue(125, 125, 125), - new TC_Aspect_Wrapper[] { ASPECT_STARBOUND, get(TC_Aspects.RADIO) }, - new ResourceLocation(GTPlusPlus.ID + ":textures/aspects/" + "Sagrausten.png"), - false, - 1, - "Ancient Knowledge"); - - ASPECT_LUST = new TC_Aspect_Wrapper( - "Slusium", - Utils.rgbtoHexValue(175, 125, 25), - new TC_Aspect_Wrapper[] { ASPECT_BALANCE, get(TC_Aspects.NEBRISUM) }, - new ResourceLocation(GTPlusPlus.ID + ":textures/aspects/" + "Slusium.png"), - false, - 1, - "Warped Thoughts"); - - ASPECT_STARBOUND = new TC_Aspect_Wrapper( - "Xenil", - Utils.rgbtoHexValue(25, 25, 25), - new TC_Aspect_Wrapper[] { get(TC_Aspects.MAGNETO), get(TC_Aspects.RADIO) }, - new ResourceLocation(GTPlusPlus.ID + ":textures/aspects/" + "Xenil.png"), - false, - 1, - "A beginning to something new"); - - ASPECT_TOXIC = new TC_Aspect_Wrapper( - "Xablum", - Utils.rgbtoHexValue(25, 185, 25), - new TC_Aspect_Wrapper[] { ASPECT_STARBOUND, ASPECT_LUST }, - new ResourceLocation(GTPlusPlus.ID + ":textures/aspects/" + "Xablum.png"), - false, - 1, - "Insanity"); - - ASPECT_HEAVEN = new TC_Aspect_Wrapper( - "Zetralt", - Utils.rgbtoHexValue(225, 225, 225), - new TC_Aspect_Wrapper[] { get(TC_Aspects.AURAM), ASPECT_TOXIC }, - new ResourceLocation(GTPlusPlus.ID + ":textures/aspects/" + "Zetralt.png"), - false, - 1, - "Control, Respect, Glory"); - } - - private TC_Aspect_Wrapper get(TC_Aspects aGtObjects) { - try { - return TC_Aspect_Wrapper.generate(aGtObjects.mAspect); - } catch (IllegalArgumentException e) { - e.printStackTrace(); - return null; - } - } - - public static final synchronized TC_AspectList_Wrapper getTC_AspectList_Wrapper( - final List aAspects) { - TC_AspectList_Wrapper o = null; - try { - if (m == null || (m != null && !m.isAccessible())) { - m = GT_ThaumcraftCompat.class.getDeclaredMethod("getTC_AspectList_Wrapper", List.class); - m.setAccessible(true); - } - if (m != null) { - o = (TC_AspectList_Wrapper) m.invoke(null, aAspects); - } - } catch (NoSuchMethodException | SecurityException | IllegalAccessException | IllegalArgumentException - | InvocationTargetException e) { - e.printStackTrace(); - } - if (o == null) { - Logger.REFLECTION("[Aspect] Did not retrieve valid aspect list from reflective invocation."); - } - return o; - } -} diff --git a/src/main/java/gtPlusPlus/xmod/thaumcraft/aspect/GTPP_AspectStack.java b/src/main/java/gtPlusPlus/xmod/thaumcraft/aspect/GTPP_AspectStack.java deleted file mode 100644 index e48bd64e53..0000000000 --- a/src/main/java/gtPlusPlus/xmod/thaumcraft/aspect/GTPP_AspectStack.java +++ /dev/null @@ -1,14 +0,0 @@ -package gtPlusPlus.xmod.thaumcraft.aspect; - -import gtPlusPlus.xmod.thaumcraft.objects.wrapper.aspect.TC_Aspect_Wrapper; - -public class GTPP_AspectStack { - - public final TC_Aspect_Wrapper mAspect; - public final int mAmount; - - public GTPP_AspectStack(TC_Aspect_Wrapper aAspect, int aAmount) { - mAspect = aAspect; - mAmount = aAmount; - } -} diff --git a/src/main/java/gtPlusPlus/xmod/thaumcraft/objects/wrapper/aspect/TC_AspectList_Wrapper.java b/src/main/java/gtPlusPlus/xmod/thaumcraft/objects/wrapper/aspect/TC_AspectList_Wrapper.java deleted file mode 100644 index 346d0d3c8b..0000000000 --- a/src/main/java/gtPlusPlus/xmod/thaumcraft/objects/wrapper/aspect/TC_AspectList_Wrapper.java +++ /dev/null @@ -1,32 +0,0 @@ -package gtPlusPlus.xmod.thaumcraft.objects.wrapper.aspect; - -import net.minecraft.item.ItemStack; - -public class TC_AspectList_Wrapper { - - // thaumcraft.api.aspects.Aspect; - // thaumcraft.api.aspects.AspectList; - - public TC_AspectList_Wrapper() {} - - public TC_AspectList_Wrapper(ItemStack stack) {} - - public TC_AspectList_Wrapper(Object invoke) { - // TODO Auto-generated constructor stub - } - - public int size() { - // TODO Auto-generated method stub - return 0; - } - - public Object getVanillaAspectList() { - // TODO Auto-generated method stub - return null; - } - - public void add(TC_Aspect_Wrapper mAspect, int mAmount) { - // TODO Auto-generated method stub - - } -} diff --git a/src/main/java/gtPlusPlus/xmod/thaumcraft/objects/wrapper/aspect/TC_Aspect_Wrapper.java b/src/main/java/gtPlusPlus/xmod/thaumcraft/objects/wrapper/aspect/TC_Aspect_Wrapper.java deleted file mode 100644 index 76d1998527..0000000000 --- a/src/main/java/gtPlusPlus/xmod/thaumcraft/objects/wrapper/aspect/TC_Aspect_Wrapper.java +++ /dev/null @@ -1,327 +0,0 @@ -package gtPlusPlus.xmod.thaumcraft.objects.wrapper.aspect; - -import static gregtech.api.enums.Mods.GTPlusPlus; - -import java.lang.reflect.Array; -import java.lang.reflect.Constructor; -import java.lang.reflect.Field; -import java.lang.reflect.Method; -import java.util.LinkedHashMap; -import java.util.Map; - -import net.minecraft.util.ResourceLocation; - -import gregtech.api.enums.TC_Aspects; -import gregtech.api.util.GT_LanguageManager; -import gtPlusPlus.api.objects.Logger; -import gtPlusPlus.core.util.reflect.ReflectionUtils; -import gtPlusPlus.xmod.thaumcraft.util.ThaumcraftUtils; - -/** - * Wrapper class for Thaumcraft Aspects. Used to avoid compile time dependencies. - * - * @author Alkalus - * - */ -public class TC_Aspect_Wrapper { - - private static Class mClass_Aspect; - private static Field mField_Aspects; - - private final String tag; - private final TC_Aspect_Wrapper[] components; - private final int color; - private String chatcolor; - private final ResourceLocation image; - private final int blend; - - public final Object mAspect; - - /** - * May be null, but links back to the TC_Aspects class from GT for convinience. - */ - public final TC_Aspects mGtEnumField; - - /** - * Statically set the Class objects - */ - static { - mClass_Aspect = ReflectionUtils.getClass("thaumcraft.api.aspects.Aspect"); - } - - /** - * Gets the total aspect list from Thaumcraft, which should contain all other registered aspects. - * - * @return - A LinkedHashMap(String, Aspect); - */ - public static LinkedHashMap getVanillaAspectList() { - try { - if (mField_Aspects == null) { - mField_Aspects = ReflectionUtils.getField(mClass_Aspect, "aspects"); - } - return (LinkedHashMap) mField_Aspects.get(null); - } catch (IllegalArgumentException | IllegalAccessException e) { - Logger.REFLECTION("Failed configuring TC Aspect compatibility."); - return new LinkedHashMap(); - } - } - - public static Object getVanillaAspectObject(String aAspectName) { - return getVanillaAspectList().get(aAspectName); - } - - /** - * Vanilla Aspect Constructor - * - * @param tag - Aspect Name - * @param color - * @param chatcolor - * @param blend - */ - public TC_Aspect_Wrapper(String tag, int color, String chatcolor, int blend, String aTooltip) { - this(tag, color, (TC_Aspect_Wrapper[]) null, blend, aTooltip); - this.chatcolor = chatcolor; - } - - /** - * - * Vanilla Aspect Constructor - * - * @param tag - Aspect Name - * @param color - * @param components - */ - public TC_Aspect_Wrapper(String tag, int color, TC_Aspect_Wrapper[] components, String aTooltip) { - this(tag, color, components, false, 1, aTooltip); - } - - /** - * - * Vanilla Aspect Constructor - * - * @param tag - Aspect Name - * @param color - * @param components - * @param blend - */ - public TC_Aspect_Wrapper(String tag, int color, TC_Aspect_Wrapper[] components, int blend, String aTooltip) { - this(tag, color, components, false, blend, aTooltip); - } - - /** - * - * Vanilla Aspect Constructor - * - * @param tag - Aspect Name - * @param color - * @param components - * @param image - * @param blend - */ - public TC_Aspect_Wrapper(String tag, int color, TC_Aspect_Wrapper[] components, boolean vanilla, int blend, - String aTooltip) { - this( - tag, - color, - components, - vanilla ? new ResourceLocation("thaumcraft", "textures/aspects/" + tag.toLowerCase() + ".png") - : new ResourceLocation(GTPlusPlus.ID, "textures/aspects/" + tag.toLowerCase() + ".png"), - vanilla, - blend, - aTooltip); - } - - private static int aInternalAspectIDAllocation = 1; - - public TC_Aspect_Wrapper(String tag, int color, TC_Aspect_Wrapper[] components, ResourceLocation image, - boolean vanilla, int blend, String aTooltip) { - if (components == null) { - components = new TC_Aspect_Wrapper[] {}; - } - // String aTag = vanilla ? tag.toLowerCase() : "custom"+(aInternalAspectIDAllocation++); - String aTag = tag.toLowerCase(); - if (getAspectList().containsKey(tag.toLowerCase())) { - this.tag = aTag; - this.components = components; - this.color = color; - this.image = image; - this.blend = blend; - this.mAspect = null; - this.mGtEnumField = null; - } else { - this.tag = aTag; - this.components = components; - this.color = color; - this.image = image; - this.blend = blend; - this.mAspect = vanilla ? getVanillaAspectObject(this.tag) : this.generateTcAspect(); - - // Set GT Type if exists - TC_Aspects y = null; - for (TC_Aspects e : TC_Aspects.values()) { - try { - String gtTag = ThaumcraftUtils.getTagFromAspectObject(e.mAspect); - if (gtTag != null) { - if (gtTag.equals(this.tag)) { - y = e; - break; - } - } - } catch (IllegalArgumentException e1) { - e1.printStackTrace(); - } - } - this.mGtEnumField = y; - mInternalAspectCache.put(this.tag, this); - // Double link custom Aspects, but internalise names using custom# instead - if (!vanilla) { - mInternalAspectCache.put("custom" + (aInternalAspectIDAllocation++), this); - GT_LanguageManager.addStringLocalization("tc.aspect." + aTag, aTooltip); - } - Logger.INFO("[Thaumcraft++] Adding support for Aspect: " + tag); - } - } - - /** - * Generates a TC_Aspect from an object, presummed to be a TC Aspect. - * - * @param aBaseAspect - The TC Aspect to generate from. - * @return - * @throws IllegalArgumentException - * @throws IllegalAccessException - */ - @SuppressWarnings("unused") - public static TC_Aspect_Wrapper generate(Object aBaseAspect) { - try { - Field aTagF = ReflectionUtils.getField(mClass_Aspect, "tag"); - if (aTagF == null) { - return null; - } - String aTafB = (String) aTagF.get(aBaseAspect); - if (aTafB == null) { - return null; - } - String aTag = aTafB.toLowerCase(); - if (aTag != null && getAspectList().containsKey(aTag.toLowerCase())) { - return getAspect(aTag); - } else { - TC_Aspect_Wrapper aTemp = new TC_Aspect_Wrapper( - aTag, - (int) ReflectionUtils.getField(mClass_Aspect, "color").get(aBaseAspect), - generateAspectArrayInternal( - ReflectionUtils.getField(mClass_Aspect, "components"), - (aBaseAspect)), - (ResourceLocation) ReflectionUtils.getField(mClass_Aspect, "image").get(aBaseAspect), - true, - (int) ReflectionUtils.getField(mClass_Aspect, "blend").get(aBaseAspect), - ""); - if (aTemp != null) { - aTemp.chatcolor = (String) ReflectionUtils.getField(mClass_Aspect, "chatcolor").get(aBaseAspect); - return aTemp; - } else { - return null; - } - } - } catch (Throwable t) { - t.printStackTrace(); - return null; - } - } - - /** - * Internal Map containing all the TC_Aspects. - */ - private static Map mInternalAspectCache = new LinkedHashMap(); - - /** - * Public getter for all TC_Aspects - * - * @param aAspectName - Aspect Name - * @return - A GT++ Aspect wrapper or null. (TC_Aspect) - */ - public static TC_Aspect_Wrapper getAspect(String aAspectName) { - String aName = aAspectName.toLowerCase(); - TC_Aspect_Wrapper g = mInternalAspectCache.get(aName); - if (g != null) { - return g; - } else { - try { - TC_Aspect_Wrapper aTemp = generate(getVanillaAspectList().get(aName)); - if (aTemp != null) { - mInternalAspectCache.put(aName, aTemp); - return aTemp; - } - } catch (IllegalArgumentException e) { - e.printStackTrace(); - } - } - return null; - } - - public static Map getAspectList() { - return mInternalAspectCache; - } - - private static TC_Aspect_Wrapper[] generateAspectArrayInternal(Field aField, Object aInstance) { - // thaumcraft.api.aspects.Aspect.Aspect() - Object[] components; - TC_Aspect_Wrapper[] aAspectArray; - try { - components = (Object[]) aField.get(aInstance); - aAspectArray = new TC_Aspect_Wrapper[components == null ? 0 : components.length]; - if (aAspectArray.length > 0) { - int i = 0; - for (Object g : components) { - aAspectArray[i] = getAspect((String) ReflectionUtils.getField(mClass_Aspect, "tag").get(g)); - i++; - } - } - } catch (IllegalArgumentException | IllegalAccessException e) { - e.printStackTrace(); - aAspectArray = new TC_Aspect_Wrapper[0]; - } - return aAspectArray; - } - - /** - * Tasty code to generate TC Aspects reflectively. - * - * @return - */ - public Object generateTcAspect() { - try { - // thaumcraft.api.aspects.Aspect.Aspect() - Object aAspectArray = (Object[]) Array.newInstance(mClass_Aspect, 0); - if (components.length > 0) { - aAspectArray = (Object[]) Array.newInstance(mClass_Aspect, components.length); - int i = 0; - for (TC_Aspect_Wrapper g : components) { - if (g != null && g.mAspect != null) ((Object[]) aAspectArray)[i++] = g.mAspect; - } - } - Constructor constructor = mClass_Aspect.getConstructor( - String.class, - int.class, - aAspectArray.getClass(), - ResourceLocation.class, - int.class); - Object myObject = constructor.newInstance(tag, color, aAspectArray, image, blend); - - // Set chat colour - if (chatcolor != null && chatcolor.length() > 0) { - Method setChatColour = ReflectionUtils.getMethod(mClass_Aspect, "setChatcolor", String.class); - if (setChatColour != null) { - setChatColour.invoke(myObject, chatcolor); - } - } - return myObject; - } catch (Throwable t) { - t.printStackTrace(); - return null; - } - } - - public static boolean isObjectAnAspect(Object aAspect) { - return mClass_Aspect.isInstance(aAspect); - } -} diff --git a/src/main/java/gtPlusPlus/xmod/thaumcraft/objects/wrapper/recipe/Base_Recipe_Wrapper.java b/src/main/java/gtPlusPlus/xmod/thaumcraft/objects/wrapper/recipe/Base_Recipe_Wrapper.java deleted file mode 100644 index 8a173e2b0a..0000000000 --- a/src/main/java/gtPlusPlus/xmod/thaumcraft/objects/wrapper/recipe/Base_Recipe_Wrapper.java +++ /dev/null @@ -1,10 +0,0 @@ -package gtPlusPlus.xmod.thaumcraft.objects.wrapper.recipe; - -import net.minecraft.item.ItemStack; - -public interface Base_Recipe_Wrapper { - - public abstract ItemStack getRecipeOutput(); - - public abstract ItemStack getRecipeInput(); -} diff --git a/src/main/java/gtPlusPlus/xmod/thaumcraft/objects/wrapper/recipe/TC_CrucibleRecipe_Wrapper.java b/src/main/java/gtPlusPlus/xmod/thaumcraft/objects/wrapper/recipe/TC_CrucibleRecipe_Wrapper.java deleted file mode 100644 index 004c18955c..0000000000 --- a/src/main/java/gtPlusPlus/xmod/thaumcraft/objects/wrapper/recipe/TC_CrucibleRecipe_Wrapper.java +++ /dev/null @@ -1,18 +0,0 @@ -package gtPlusPlus.xmod.thaumcraft.objects.wrapper.recipe; - -import net.minecraft.item.ItemStack; - -public class TC_CrucibleRecipe_Wrapper implements Base_Recipe_Wrapper { - - @Override - public ItemStack getRecipeInput() { - // TODO Auto-generated method stub - return null; - } - - @Override - public ItemStack getRecipeOutput() { - // TODO Auto-generated method stub - return null; - } -} diff --git a/src/main/java/gtPlusPlus/xmod/thaumcraft/objects/wrapper/recipe/TC_IArcaneRecipe_Wrapper.java b/src/main/java/gtPlusPlus/xmod/thaumcraft/objects/wrapper/recipe/TC_IArcaneRecipe_Wrapper.java deleted file mode 100644 index 8276af9f0e..0000000000 --- a/src/main/java/gtPlusPlus/xmod/thaumcraft/objects/wrapper/recipe/TC_IArcaneRecipe_Wrapper.java +++ /dev/null @@ -1,18 +0,0 @@ -package gtPlusPlus.xmod.thaumcraft.objects.wrapper.recipe; - -import net.minecraft.item.ItemStack; - -public class TC_IArcaneRecipe_Wrapper implements Base_Recipe_Wrapper { - - @Override - public ItemStack getRecipeInput() { - // TODO Auto-generated method stub - return null; - } - - @Override - public ItemStack getRecipeOutput() { - // TODO Auto-generated method stub - return null; - } -} diff --git a/src/main/java/gtPlusPlus/xmod/thaumcraft/objects/wrapper/recipe/TC_InfusionEnchantmentRecipe_Wrapper.java b/src/main/java/gtPlusPlus/xmod/thaumcraft/objects/wrapper/recipe/TC_InfusionEnchantmentRecipe_Wrapper.java deleted file mode 100644 index 9431978ca0..0000000000 --- a/src/main/java/gtPlusPlus/xmod/thaumcraft/objects/wrapper/recipe/TC_InfusionEnchantmentRecipe_Wrapper.java +++ /dev/null @@ -1,18 +0,0 @@ -package gtPlusPlus.xmod.thaumcraft.objects.wrapper.recipe; - -import net.minecraft.item.ItemStack; - -public class TC_InfusionEnchantmentRecipe_Wrapper implements Base_Recipe_Wrapper { - - @Override - public ItemStack getRecipeInput() { - // TODO Auto-generated method stub - return null; - } - - @Override - public ItemStack getRecipeOutput() { - // TODO Auto-generated method stub - return null; - } -} diff --git a/src/main/java/gtPlusPlus/xmod/thaumcraft/objects/wrapper/recipe/TC_InfusionRecipe_Wrapper.java b/src/main/java/gtPlusPlus/xmod/thaumcraft/objects/wrapper/recipe/TC_InfusionRecipe_Wrapper.java deleted file mode 100644 index 0338644949..0000000000 --- a/src/main/java/gtPlusPlus/xmod/thaumcraft/objects/wrapper/recipe/TC_InfusionRecipe_Wrapper.java +++ /dev/null @@ -1,18 +0,0 @@ -package gtPlusPlus.xmod.thaumcraft.objects.wrapper.recipe; - -import net.minecraft.item.ItemStack; - -public class TC_InfusionRecipe_Wrapper implements Base_Recipe_Wrapper { - - @Override - public ItemStack getRecipeInput() { - // TODO Auto-generated method stub - return null; - } - - @Override - public ItemStack getRecipeOutput() { - // TODO Auto-generated method stub - return null; - } -} diff --git a/src/main/java/gtPlusPlus/xmod/thaumcraft/objects/wrapper/research/TC_PageType_Wrapper.java b/src/main/java/gtPlusPlus/xmod/thaumcraft/objects/wrapper/research/TC_PageType_Wrapper.java deleted file mode 100644 index 3a06ac1b90..0000000000 --- a/src/main/java/gtPlusPlus/xmod/thaumcraft/objects/wrapper/research/TC_PageType_Wrapper.java +++ /dev/null @@ -1,16 +0,0 @@ -package gtPlusPlus.xmod.thaumcraft.objects.wrapper.research; - -public class TC_PageType_Wrapper { - - public static final TC_PageType_Wrapper TEXT = null; - public static final TC_PageType_Wrapper TEXT_CONCEALED = null; - public static final TC_PageType_Wrapper NORMAL_CRAFTING = null; - public static final TC_PageType_Wrapper ARCANE_CRAFTING = null; - public static final TC_PageType_Wrapper CRUCIBLE_CRAFTING = null; - public static final TC_PageType_Wrapper INFUSION_CRAFTING = null; - public static final TC_PageType_Wrapper COMPOUND_CRAFTING = null; - public static final TC_PageType_Wrapper SMELTING = null; - public static final TC_PageType_Wrapper INFUSION_ENCHANTMENT = null; - public static final TC_PageType_Wrapper IMAGE = null; - public static final TC_PageType_Wrapper ASPECTS = null; -} diff --git a/src/main/java/gtPlusPlus/xmod/thaumcraft/objects/wrapper/research/TC_ResearchCategories_Wrapper.java b/src/main/java/gtPlusPlus/xmod/thaumcraft/objects/wrapper/research/TC_ResearchCategories_Wrapper.java deleted file mode 100644 index 5ed57574d2..0000000000 --- a/src/main/java/gtPlusPlus/xmod/thaumcraft/objects/wrapper/research/TC_ResearchCategories_Wrapper.java +++ /dev/null @@ -1,92 +0,0 @@ -package gtPlusPlus.xmod.thaumcraft.objects.wrapper.research; - -import java.util.Collection; -import java.util.Iterator; -import java.util.LinkedHashMap; - -import net.minecraft.util.ResourceLocation; -import net.minecraft.util.StatCollector; - -import org.apache.logging.log4j.Level; - -import cpw.mods.fml.common.FMLLog; - -public class TC_ResearchCategories_Wrapper { - - public static LinkedHashMap researchCategories = new LinkedHashMap(); - - public static TC_ResearchCategoryList_Wrapper getResearchList(String key) { - return (TC_ResearchCategoryList_Wrapper) researchCategories.get(key); - } - - public static String getCategoryName(String key) { - return StatCollector.translateToLocal("tc.research_category." + key); - } - - public static TC_ResearchItem_Wrapper getResearch(String key) { - Collection rc = researchCategories.values(); - Iterator i$ = rc.iterator(); - - while (i$.hasNext()) { - Object cat = i$.next(); - Collection rl = ((TC_ResearchCategoryList_Wrapper) cat).research.values(); - Iterator i$1 = rl.iterator(); - - while (i$1.hasNext()) { - Object ri = i$1.next(); - if (((TC_ResearchItem_Wrapper) ri).key.equals(key)) { - return (TC_ResearchItem_Wrapper) ri; - } - } - } - - return null; - } - - public static void registerCategory(String key, ResourceLocation icon, ResourceLocation background) { - if (getResearchList(key) == null) { - TC_ResearchCategoryList_Wrapper rl = new TC_ResearchCategoryList_Wrapper(icon, background); - researchCategories.put(key, rl); - } - } - - public static void addResearch(TC_ResearchItem_Wrapper ri) { - TC_ResearchCategoryList_Wrapper rl = getResearchList(ri.category); - if (rl != null && !rl.research.containsKey(ri.key)) { - if (!ri.isVirtual()) { - Iterator i$ = rl.research.values().iterator(); - - while (i$.hasNext()) { - TC_ResearchItem_Wrapper rr = (TC_ResearchItem_Wrapper) i$.next(); - if (rr.displayColumn == ri.displayColumn && rr.displayRow == ri.displayRow) { - FMLLog.log( - Level.FATAL, - "[Thaumcraft] Research [" + ri.getName() - + "] not added as it overlaps with existing research [" - + rr.getName() - + "]", - new Object[0]); - return; - } - } - } - - rl.research.put(ri.key, ri); - if (ri.displayColumn < rl.minDisplayColumn) { - rl.minDisplayColumn = ri.displayColumn; - } - - if (ri.displayRow < rl.minDisplayRow) { - rl.minDisplayRow = ri.displayRow; - } - - if (ri.displayColumn > rl.maxDisplayColumn) { - rl.maxDisplayColumn = ri.displayColumn; - } - - if (ri.displayRow > rl.maxDisplayRow) { - rl.maxDisplayRow = ri.displayRow; - } - } - } -} diff --git a/src/main/java/gtPlusPlus/xmod/thaumcraft/objects/wrapper/research/TC_ResearchCategoryList_Wrapper.java b/src/main/java/gtPlusPlus/xmod/thaumcraft/objects/wrapper/research/TC_ResearchCategoryList_Wrapper.java deleted file mode 100644 index f8066abe2d..0000000000 --- a/src/main/java/gtPlusPlus/xmod/thaumcraft/objects/wrapper/research/TC_ResearchCategoryList_Wrapper.java +++ /dev/null @@ -1,22 +0,0 @@ -package gtPlusPlus.xmod.thaumcraft.objects.wrapper.research; - -import java.util.HashMap; -import java.util.Map; - -import net.minecraft.util.ResourceLocation; - -public class TC_ResearchCategoryList_Wrapper { - - public int minDisplayColumn; - public int minDisplayRow; - public int maxDisplayColumn; - public int maxDisplayRow; - public ResourceLocation icon; - public ResourceLocation background; - public Map research = new HashMap(); - - public TC_ResearchCategoryList_Wrapper(ResourceLocation icon, ResourceLocation background) { - this.icon = icon; - this.background = background; - } -} diff --git a/src/main/java/gtPlusPlus/xmod/thaumcraft/objects/wrapper/research/TC_ResearchItem_Wrapper.java b/src/main/java/gtPlusPlus/xmod/thaumcraft/objects/wrapper/research/TC_ResearchItem_Wrapper.java deleted file mode 100644 index 1baefdc465..0000000000 --- a/src/main/java/gtPlusPlus/xmod/thaumcraft/objects/wrapper/research/TC_ResearchItem_Wrapper.java +++ /dev/null @@ -1,245 +0,0 @@ -package gtPlusPlus.xmod.thaumcraft.objects.wrapper.research; - -import net.minecraft.item.ItemStack; -import net.minecraft.util.ResourceLocation; -import net.minecraft.util.StatCollector; - -import gtPlusPlus.xmod.thaumcraft.objects.wrapper.aspect.TC_AspectList_Wrapper; -import gtPlusPlus.xmod.thaumcraft.objects.wrapper.aspect.TC_Aspect_Wrapper; -import gtPlusPlus.xmod.thaumcraft.util.ThaumcraftUtils; - -public class TC_ResearchItem_Wrapper { - - public final String key; - public final String category; - public final TC_AspectList_Wrapper tags; - public String[] parents = null; - public String[] parentsHidden = null; - public String[] siblings = null; - public final int displayColumn; - public final int displayRow; - public final ItemStack icon_item; - public final ResourceLocation icon_resource; - private int complexity; - private boolean isSpecial; - private boolean isSecondary; - private boolean isRound; - private boolean isStub; - private boolean isVirtual; - private boolean isConcealed; - private boolean isHidden; - private boolean isLost; - private boolean isAutoUnlock; - private ItemStack[] itemTriggers; - private String[] entityTriggers; - private TC_Aspect_Wrapper[] aspectTriggers; - private Object[] pages = null; - - public TC_ResearchItem_Wrapper(String key, String category) { - this.key = key; - this.category = category; - this.tags = new TC_AspectList_Wrapper(); - this.icon_resource = null; - this.icon_item = null; - this.displayColumn = 0; - this.displayRow = 0; - this.setVirtual(); - } - - public TC_ResearchItem_Wrapper(String key, String category, TC_AspectList_Wrapper tags, int col, int row, - int complex, ResourceLocation icon) { - this.key = key; - this.category = category; - this.tags = tags; - this.icon_resource = icon; - this.icon_item = null; - this.displayColumn = col; - this.displayRow = row; - this.complexity = complex; - if (this.complexity < 1) { - this.complexity = 1; - } - - if (this.complexity > 3) { - this.complexity = 3; - } - } - - public TC_ResearchItem_Wrapper(String key, String category, TC_AspectList_Wrapper tags, int col, int row, - int complex, ItemStack icon) { - this.key = key; - this.category = category; - this.tags = tags; - this.icon_item = icon; - this.icon_resource = null; - this.displayColumn = col; - this.displayRow = row; - this.complexity = complex; - if (this.complexity < 1) { - this.complexity = 1; - } - - if (this.complexity > 3) { - this.complexity = 3; - } - } - - public TC_ResearchItem_Wrapper setSpecial() { - this.isSpecial = true; - return this; - } - - public TC_ResearchItem_Wrapper setStub() { - this.isStub = true; - return this; - } - - public TC_ResearchItem_Wrapper setLost() { - this.isLost = true; - return this; - } - - public TC_ResearchItem_Wrapper setConcealed() { - this.isConcealed = true; - return this; - } - - public TC_ResearchItem_Wrapper setHidden() { - this.isHidden = true; - return this; - } - - public TC_ResearchItem_Wrapper setVirtual() { - this.isVirtual = true; - return this; - } - - public TC_ResearchItem_Wrapper setParents(String... par) { - this.parents = par; - return this; - } - - public TC_ResearchItem_Wrapper setParentsHidden(String... par) { - this.parentsHidden = par; - return this; - } - - public TC_ResearchItem_Wrapper setSiblings(String... sib) { - this.siblings = sib; - return this; - } - - public TC_ResearchItem_Wrapper setPages(Object... par) { - this.pages = par; - return this; - } - - public Object[] getPages() { - return this.pages; - } - - public TC_ResearchItem_Wrapper setItemTriggers(ItemStack... par) { - this.itemTriggers = par; - return this; - } - - public TC_ResearchItem_Wrapper setEntityTriggers(String... par) { - this.entityTriggers = par; - return this; - } - - public TC_ResearchItem_Wrapper setAspectTriggers(TC_Aspect_Wrapper... par) { - this.aspectTriggers = par; - return this; - } - - public ItemStack[] getItemTriggers() { - return this.itemTriggers; - } - - public String[] getEntityTriggers() { - return this.entityTriggers; - } - - public TC_Aspect_Wrapper[] getAspectTriggers() { - return this.aspectTriggers; - } - - public TC_ResearchItem_Wrapper registerResearchItem() { - ThaumcraftUtils.addResearch(this); - return this; - } - - public String getName() { - return StatCollector.translateToLocal("tc.research_name." + this.key); - } - - public String getText() { - return StatCollector.translateToLocal("tc.research_text." + this.key); - } - - public boolean isSpecial() { - return this.isSpecial; - } - - public boolean isStub() { - return this.isStub; - } - - public boolean isLost() { - return this.isLost; - } - - public boolean isConcealed() { - return this.isConcealed; - } - - public boolean isHidden() { - return this.isHidden; - } - - public boolean isVirtual() { - return this.isVirtual; - } - - public boolean isAutoUnlock() { - return this.isAutoUnlock; - } - - public TC_ResearchItem_Wrapper setAutoUnlock() { - this.isAutoUnlock = true; - return this; - } - - public boolean isRound() { - return this.isRound; - } - - public TC_ResearchItem_Wrapper setRound() { - this.isRound = true; - return this; - } - - public boolean isSecondary() { - return this.isSecondary; - } - - public TC_ResearchItem_Wrapper setSecondary() { - this.isSecondary = true; - return this; - } - - public int getComplexity() { - return this.complexity; - } - - public TC_ResearchItem_Wrapper setComplexity(int complexity) { - this.complexity = complexity; - return this; - } - - public TC_Aspect_Wrapper getResearchPrimaryTag() { - // TODO - return null; - } -} diff --git a/src/main/java/gtPlusPlus/xmod/thaumcraft/objects/wrapper/research/TC_ResearchNoteData_Wrapper.java b/src/main/java/gtPlusPlus/xmod/thaumcraft/objects/wrapper/research/TC_ResearchNoteData_Wrapper.java deleted file mode 100644 index df8d21bbaa..0000000000 --- a/src/main/java/gtPlusPlus/xmod/thaumcraft/objects/wrapper/research/TC_ResearchNoteData_Wrapper.java +++ /dev/null @@ -1,13 +0,0 @@ -package gtPlusPlus.xmod.thaumcraft.objects.wrapper.research; - -public class TC_ResearchNoteData_Wrapper { - - public TC_ResearchNoteData_Wrapper(Object researchNoteData) { - // TODO Auto-generated constructor stub - } - - public Object getResearchNoteData() { - // TODO Auto-generated method stub - return null; - } -} diff --git a/src/main/java/gtPlusPlus/xmod/thaumcraft/objects/wrapper/research/TC_ResearchPage_Wrapper.java b/src/main/java/gtPlusPlus/xmod/thaumcraft/objects/wrapper/research/TC_ResearchPage_Wrapper.java deleted file mode 100644 index 4632909620..0000000000 --- a/src/main/java/gtPlusPlus/xmod/thaumcraft/objects/wrapper/research/TC_ResearchPage_Wrapper.java +++ /dev/null @@ -1,229 +0,0 @@ -package gtPlusPlus.xmod.thaumcraft.objects.wrapper.research; - -import java.util.List; - -import net.minecraft.item.ItemStack; -import net.minecraft.item.crafting.FurnaceRecipes; -import net.minecraft.item.crafting.IRecipe; -import net.minecraft.util.ResourceLocation; -import net.minecraft.util.StatCollector; - -import gtPlusPlus.xmod.thaumcraft.objects.wrapper.aspect.TC_AspectList_Wrapper; -import gtPlusPlus.xmod.thaumcraft.objects.wrapper.recipe.TC_CrucibleRecipe_Wrapper; -import gtPlusPlus.xmod.thaumcraft.objects.wrapper.recipe.TC_IArcaneRecipe_Wrapper; -import gtPlusPlus.xmod.thaumcraft.objects.wrapper.recipe.TC_InfusionEnchantmentRecipe_Wrapper; -import gtPlusPlus.xmod.thaumcraft.objects.wrapper.recipe.TC_InfusionRecipe_Wrapper; - -public class TC_ResearchPage_Wrapper { - - public TC_PageType_Wrapper type; - public String text; - public String research; - public ResourceLocation image; - public TC_AspectList_Wrapper aspects; - public Object recipe; - public ItemStack recipeOutput; - - public TC_ResearchPage_Wrapper(String text) { - this.type = TC_PageType_Wrapper.TEXT; - this.text = null; - this.research = null; - this.image = null; - this.aspects = null; - this.recipe = null; - this.recipeOutput = null; - this.type = TC_PageType_Wrapper.TEXT; - this.text = text; - } - - public TC_ResearchPage_Wrapper(String research, String text) { - this.type = TC_PageType_Wrapper.TEXT; - this.text = null; - this.research = null; - this.image = null; - this.aspects = null; - this.recipe = null; - this.recipeOutput = null; - this.type = TC_PageType_Wrapper.TEXT_CONCEALED; - this.research = research; - this.text = text; - } - - public TC_ResearchPage_Wrapper(IRecipe recipe) { - this.type = TC_PageType_Wrapper.TEXT; - this.text = null; - this.research = null; - this.image = null; - this.aspects = null; - this.recipe = null; - this.recipeOutput = null; - this.type = TC_PageType_Wrapper.NORMAL_CRAFTING; - this.recipe = recipe; - this.recipeOutput = recipe.getRecipeOutput(); - } - - public TC_ResearchPage_Wrapper(IRecipe[] recipe) { - this.type = TC_PageType_Wrapper.TEXT; - this.text = null; - this.research = null; - this.image = null; - this.aspects = null; - this.recipe = null; - this.recipeOutput = null; - this.type = TC_PageType_Wrapper.NORMAL_CRAFTING; - this.recipe = recipe; - } - - public TC_ResearchPage_Wrapper(TC_IArcaneRecipe_Wrapper[] recipe) { - this.type = TC_PageType_Wrapper.TEXT; - this.text = null; - this.research = null; - this.image = null; - this.aspects = null; - this.recipe = null; - this.recipeOutput = null; - this.type = TC_PageType_Wrapper.ARCANE_CRAFTING; - this.recipe = recipe; - } - - public TC_ResearchPage_Wrapper(TC_CrucibleRecipe_Wrapper[] recipe) { - this.type = TC_PageType_Wrapper.TEXT; - this.text = null; - this.research = null; - this.image = null; - this.aspects = null; - this.recipe = null; - this.recipeOutput = null; - this.type = TC_PageType_Wrapper.CRUCIBLE_CRAFTING; - this.recipe = recipe; - } - - public TC_ResearchPage_Wrapper(TC_InfusionRecipe_Wrapper[] recipe) { - this.type = TC_PageType_Wrapper.TEXT; - this.text = null; - this.research = null; - this.image = null; - this.aspects = null; - this.recipe = null; - this.recipeOutput = null; - this.type = TC_PageType_Wrapper.INFUSION_CRAFTING; - this.recipe = recipe; - } - - public TC_ResearchPage_Wrapper(List recipe) { - this.type = TC_PageType_Wrapper.TEXT; - this.text = null; - this.research = null; - this.image = null; - this.aspects = null; - this.recipe = null; - this.recipeOutput = null; - this.type = TC_PageType_Wrapper.COMPOUND_CRAFTING; - this.recipe = recipe; - } - - public TC_ResearchPage_Wrapper(TC_IArcaneRecipe_Wrapper recipe) { - this.type = TC_PageType_Wrapper.TEXT; - this.text = null; - this.research = null; - this.image = null; - this.aspects = null; - this.recipe = null; - this.recipeOutput = null; - this.type = TC_PageType_Wrapper.ARCANE_CRAFTING; - this.recipe = recipe; - this.recipeOutput = recipe.getRecipeOutput(); - } - - public TC_ResearchPage_Wrapper(TC_CrucibleRecipe_Wrapper recipe) { - this.type = TC_PageType_Wrapper.TEXT; - this.text = null; - this.research = null; - this.image = null; - this.aspects = null; - this.recipe = null; - this.recipeOutput = null; - this.type = TC_PageType_Wrapper.CRUCIBLE_CRAFTING; - this.recipe = recipe; - this.recipeOutput = recipe.getRecipeOutput(); - } - - public TC_ResearchPage_Wrapper(ItemStack input) { - this.type = TC_PageType_Wrapper.TEXT; - this.text = null; - this.research = null; - this.image = null; - this.aspects = null; - this.recipe = null; - this.recipeOutput = null; - this.type = TC_PageType_Wrapper.SMELTING; - this.recipe = input; - this.recipeOutput = FurnaceRecipes.smelting().getSmeltingResult(input); - } - - public TC_ResearchPage_Wrapper(TC_InfusionRecipe_Wrapper recipe) { - this.type = TC_PageType_Wrapper.TEXT; - this.text = null; - this.research = null; - this.image = null; - this.aspects = null; - this.recipe = null; - this.recipeOutput = null; - this.type = TC_PageType_Wrapper.INFUSION_CRAFTING; - this.recipe = recipe; - if (recipe.getRecipeOutput() instanceof ItemStack) { - this.recipeOutput = (ItemStack) recipe.getRecipeOutput(); - } else { - this.recipeOutput = recipe.getRecipeInput(); - } - } - - public TC_ResearchPage_Wrapper(TC_InfusionEnchantmentRecipe_Wrapper recipe) { - this.type = TC_PageType_Wrapper.TEXT; - this.text = null; - this.research = null; - this.image = null; - this.aspects = null; - this.recipe = null; - this.recipeOutput = null; - this.type = TC_PageType_Wrapper.INFUSION_ENCHANTMENT; - this.recipe = recipe; - } - - public TC_ResearchPage_Wrapper(ResourceLocation image, String caption) { - this.type = TC_PageType_Wrapper.TEXT; - this.text = null; - this.research = null; - this.image = null; - this.aspects = null; - this.recipe = null; - this.recipeOutput = null; - this.type = TC_PageType_Wrapper.IMAGE; - this.image = image; - this.text = caption; - } - - public TC_ResearchPage_Wrapper(TC_AspectList_Wrapper as) { - this.type = TC_PageType_Wrapper.TEXT; - this.text = null; - this.research = null; - this.image = null; - this.aspects = null; - this.recipe = null; - this.recipeOutput = null; - this.type = TC_PageType_Wrapper.ASPECTS; - this.aspects = as; - } - - public String getTranslatedText() { - String ret = ""; - if (this.text != null) { - ret = StatCollector.translateToLocal(this.text); - if (ret.isEmpty()) { - ret = this.text; - } - } - - return ret; - } -} diff --git a/src/main/java/gtPlusPlus/xmod/thaumcraft/util/ThaumcraftUtils.java b/src/main/java/gtPlusPlus/xmod/thaumcraft/util/ThaumcraftUtils.java deleted file mode 100644 index 78da4ff31f..0000000000 --- a/src/main/java/gtPlusPlus/xmod/thaumcraft/util/ThaumcraftUtils.java +++ /dev/null @@ -1,454 +0,0 @@ -package gtPlusPlus.xmod.thaumcraft.util; - -import static gtPlusPlus.xmod.thaumcraft.HANDLER_Thaumcraft.sItemsToGetAspects; - -import java.lang.reflect.Field; -import java.lang.reflect.InvocationTargetException; -import java.lang.reflect.Method; -import java.util.ArrayList; -import java.util.Iterator; -import java.util.List; - -import net.minecraft.block.Block; -import net.minecraft.item.ItemStack; -import net.minecraft.item.crafting.IRecipe; -import net.minecraft.world.World; - -import gregtech.api.GregTech_API; -import gregtech.api.enums.ConfigCategories; -import gregtech.api.enums.TC_Aspects; -import gregtech.api.util.GT_LanguageManager; -import gregtech.api.util.GT_Utility; -import gtPlusPlus.api.objects.Logger; -import gtPlusPlus.api.objects.data.Pair; -import gtPlusPlus.core.util.reflect.ReflectionUtils; -import gtPlusPlus.xmod.thaumcraft.HANDLER_Thaumcraft; -import gtPlusPlus.xmod.thaumcraft.aspect.GTPP_AspectStack; -import gtPlusPlus.xmod.thaumcraft.objects.wrapper.aspect.TC_AspectList_Wrapper; -import gtPlusPlus.xmod.thaumcraft.objects.wrapper.aspect.TC_Aspect_Wrapper; -import gtPlusPlus.xmod.thaumcraft.objects.wrapper.recipe.TC_CrucibleRecipe_Wrapper; -import gtPlusPlus.xmod.thaumcraft.objects.wrapper.recipe.TC_IArcaneRecipe_Wrapper; -import gtPlusPlus.xmod.thaumcraft.objects.wrapper.recipe.TC_InfusionEnchantmentRecipe_Wrapper; -import gtPlusPlus.xmod.thaumcraft.objects.wrapper.recipe.TC_InfusionRecipe_Wrapper; -import gtPlusPlus.xmod.thaumcraft.objects.wrapper.research.TC_ResearchCategories_Wrapper; -import gtPlusPlus.xmod.thaumcraft.objects.wrapper.research.TC_ResearchCategoryList_Wrapper; -import gtPlusPlus.xmod.thaumcraft.objects.wrapper.research.TC_ResearchItem_Wrapper; -import gtPlusPlus.xmod.thaumcraft.objects.wrapper.research.TC_ResearchNoteData_Wrapper; -import gtPlusPlus.xmod.thaumcraft.objects.wrapper.research.TC_ResearchPage_Wrapper; - -public class ThaumcraftUtils { - - private static Class mClass_Aspect; - private static Field mField_Aspects; - - static { - mClass_Aspect = ReflectionUtils.getClass("thaumcraft.api.aspects.Aspect"); - if (mClass_Aspect != null) { - Field aTagF = ReflectionUtils.getField(mClass_Aspect, "tag"); - if (aTagF != null) { - mField_Aspects = aTagF; - } - } - } - - public static boolean addAspectToItem(ItemStack item, TC_Aspect_Wrapper aspect, int amount) { - return addAspectToItem(item, new TC_Aspect_Wrapper[] { aspect }, new Integer[] { amount }); - } - - public static boolean addAspectToItem(ItemStack item, TC_Aspect_Wrapper[] aspect, Integer[] amounts) { - GTPP_AspectStack[] aspects = new GTPP_AspectStack[aspect.length]; - for (int g = 0; g < aspect.length; g++) { - if (amounts[g] != null && amounts[g] > 0) { - // aspects[g] = new GTPP_AspectStack(aspect[g], amounts[g]); - } - } - Pair k = new Pair(item, aspects); - int mSizeA = sItemsToGetAspects.size(); - sItemsToGetAspects.put(k); - if (sItemsToGetAspects.size() > mSizeA) { - Logger.MATERIALS("[Aspect] Successfully queued an ItemStack for Aspect addition."); - return true; - } - Logger.MATERIALS("[Aspect] Failed to queue an ItemStack for Aspect addition."); - // Logger.INFO("[Aspect] "); - return false; - } - - public static TC_Aspect_Wrapper getAspect(String name) { - return TC_Aspect_Wrapper.getAspect(name); - } - - public static TC_Aspects getEnumAspect(String name) { - TC_Aspect_Wrapper r = getAspect(name); - return r.mGtEnumField; - } - - public static Object addResearch(String aResearch, String aName, String aText, String[] aParentResearches, - String aCategory, ItemStack aIcon, int aComplexity, int aType, int aX, int aY, - List aAspects, ItemStack[] aResearchTriggers, Object[] aPages) { - if (!GregTech_API.sRecipeFile.get(ConfigCategories.Recipes.researches, aResearch, true)) { - return null; - } - TC_ResearchCategoryList_Wrapper tCategory = TC_ResearchCategories_Wrapper.getResearchList(aCategory); - if (tCategory == null) { - return null; - } - for (Iterator i$ = tCategory.research.values().iterator(); i$.hasNext();) { - TC_ResearchItem_Wrapper tResearch = (TC_ResearchItem_Wrapper) i$.next(); - if ((tResearch.displayColumn == aX) && (tResearch.displayRow == aY)) { - aX += (aX > 0 ? 5 : -5); - aY += (aY > 0 ? 5 : -5); - } - } - TC_ResearchItem_Wrapper rResearch = new TC_ResearchItem_Wrapper( - aResearch, - aCategory, - getAspectList_Ex(aAspects), - aX, - aY, - aComplexity, - aIcon); - ArrayList tPages = new ArrayList(aPages.length); - GT_LanguageManager.addStringLocalization("tc.research_name." + aResearch, aName); - GT_LanguageManager.addStringLocalization("tc.research_text." + aResearch, "[GT++] " + aText); - for (Object tPage : aPages) { - if ((tPage instanceof String)) { - tPages.add(new TC_ResearchPage_Wrapper((String) tPage)); - } else if ((tPage instanceof IRecipe)) { - tPages.add(new TC_ResearchPage_Wrapper((IRecipe) tPage)); - } else if ((tPage instanceof TC_IArcaneRecipe_Wrapper)) { - tPages.add(new TC_ResearchPage_Wrapper((TC_IArcaneRecipe_Wrapper) tPage)); - } else if ((tPage instanceof TC_CrucibleRecipe_Wrapper)) { - tPages.add(new TC_ResearchPage_Wrapper((TC_CrucibleRecipe_Wrapper) tPage)); - } else if ((tPage instanceof TC_InfusionRecipe_Wrapper)) { - tPages.add(new TC_ResearchPage_Wrapper((TC_InfusionRecipe_Wrapper) tPage)); - } else if ((tPage instanceof TC_InfusionEnchantmentRecipe_Wrapper)) { - tPages.add(new TC_ResearchPage_Wrapper((TC_InfusionEnchantmentRecipe_Wrapper) tPage)); - } - } - if ((aType & 0x40) != 0) { - rResearch.setAutoUnlock(); - } - if ((aType & 0x1) != 0) { - rResearch.setSecondary(); - } - if ((aType & 0x20) != 0) { - rResearch.setSpecial(); - } - if ((aType & 0x8) != 0) { - rResearch.setVirtual(); - } - if ((aType & 0x4) != 0) { - rResearch.setHidden(); - } - if ((aType & 0x10) != 0) { - rResearch.setRound(); - } - if ((aType & 0x2) != 0) { - rResearch.setStub(); - } - if (aParentResearches != null) { - ArrayList tParentResearches = new ArrayList(); - for (String tParent : aParentResearches) { - if (GregTech_API.sRecipeFile.get(ConfigCategories.Recipes.researches, aResearch, true)) { - tParentResearches.add(tParent); - } - } - if (tParentResearches.size() > 0) { - rResearch.setParents((String[]) tParentResearches.toArray(new String[tParentResearches.size()])); - rResearch.setConcealed(); - } - } - if (aResearchTriggers != null) { - rResearch.setItemTriggers(aResearchTriggers); - rResearch.setHidden(); - } - - Object[] aVarArgs = (TC_ResearchPage_Wrapper[]) tPages.toArray(new TC_ResearchPage_Wrapper[tPages.size()]); - rResearch.setPages(aVarArgs); - return rResearch.registerResearchItem(); - } - - public static Object addCrucibleRecipe(final String aResearch, final Object aInput, final ItemStack aOutput, - final List aAspects) { - if (GT_Utility.isStringInvalid((Object) aResearch) || aInput == null - || aOutput == null - || aAspects == null - || aAspects.isEmpty()) { - return null; - } - return addCrucibleRecipe( - aResearch, - GT_Utility.copy(new Object[] { aOutput }), - (aInput instanceof ItemStack || aInput instanceof ArrayList) ? aInput : aInput.toString(), - getAspectList_Ex(aAspects)); - } - - public static Object addInfusionRecipe(final String aResearch, final ItemStack aMainInput, - final ItemStack[] aSideInputs, final ItemStack aOutput, final int aInstability, - final List aAspects) { - if (GT_Utility.isStringInvalid((Object) aResearch) || aMainInput == null - || aSideInputs == null - || aOutput == null - || aAspects == null - || aAspects.isEmpty()) { - return null; - } - return addInfusionCraftingRecipe( - aResearch, - (Object) GT_Utility.copy(new Object[] { aOutput }), - aInstability, - getAspectList_Ex(aAspects), - aMainInput, - aSideInputs); - } - - public static boolean registerThaumcraftAspectsToItem(final ItemStack aExampleStack, - final List aAspects, final String aOreDict) { - if (aAspects.isEmpty()) { - return false; - } - registerObjectTag(aOreDict, getAspectList_Ex(aAspects)); - return true; - } - - public static boolean registerThaumcraftAspectsToItem(final ItemStack aStack, final List aAspects, - final boolean aAdditive) { - try { - if (aAspects.isEmpty()) { - return false; - } - TC_AspectList_Wrapper h = getAspectList_Ex(aAspects); - if (aAdditive && (h != null && h.size() > 0)) { - registerComplexObjectTag(aStack, getAspectList_Ex(aAspects)); - return true; - } else { - Logger.MATERIALS("[Aspect] Failed adding aspects to " + aStack.getDisplayName() + "."); - } - final TC_AspectList_Wrapper tAlreadyRegisteredAspects = getObjectAspects(aStack); - if (tAlreadyRegisteredAspects == null || tAlreadyRegisteredAspects.size() <= 0) { - registerObjectTag(aStack, getAspectList_Ex(aAspects)); - } - return true; - } catch (Throwable t) { - Logger.MATERIALS("[Aspect] Failed adding aspects to " + aStack.getDisplayName() + "."); - t.printStackTrace(); - return false; - } - } - - private static final Class mClass_ThaumcraftApi; - private static final Class mClass_ThaumcraftApiHelper; - private static final Class mClass_AspectList; - private static final Class mClass_ResearchManager; - private static final Method mMethod_registerObjectTag1; - private static final Method mMethod_registerObjectTag2; - private static final Method mMethod_registerComplexObjectTag; - private static final Method mMethod_addInfusionCraftingRecipe; - private static final Method mMethod_addCrucibleRecipe; - private static final Method mMethod_getObjectAspects; - private static final Method mMethod_updateData; - private static final Method mMethod_getData; - - private static final Field mField_PortholeBlacklist; - - static { - /* - * Classes - */ - mClass_ThaumcraftApi = ReflectionUtils.getClass("thaumcraft.api.ThaumcraftApi"); - mClass_ThaumcraftApiHelper = ReflectionUtils.getClass("thaumcraft.api.ThaumcraftApiHelper"); - mClass_AspectList = ReflectionUtils.getClass("thaumcraft.api.aspects.AspectList"); - mClass_ResearchManager = ReflectionUtils.getClass("thaumcraft.common.lib.research.ResearchManager"); - - /* - * Methods - */ - mMethod_registerObjectTag1 = ReflectionUtils - .getMethod(mClass_ThaumcraftApi, "registerObjectTag", ItemStack.class, mClass_AspectList); - - mMethod_registerObjectTag2 = ReflectionUtils - .getMethod(mClass_ThaumcraftApi, "registerObjectTag", String.class, mClass_AspectList); - - mMethod_registerComplexObjectTag = ReflectionUtils - .getMethod(mClass_ThaumcraftApi, "registerComplexObjectTag", ItemStack.class, mClass_AspectList); - - mMethod_addInfusionCraftingRecipe = ReflectionUtils.getMethod( - mClass_ThaumcraftApi, - "addInfusionCraftingRecipe", - String.class, - Object.class, - int.class, - mClass_AspectList, - ItemStack.class, - ItemStack[].class); - - mMethod_addCrucibleRecipe = ReflectionUtils.getMethod( - mClass_ThaumcraftApi, - "addCrucibleRecipe", - String.class, - ItemStack.class, - Object.class, - mClass_AspectList); - - mMethod_getObjectAspects = ReflectionUtils - .getMethod(mClass_ThaumcraftApiHelper, "getObjectAspects", ItemStack.class); - - mMethod_updateData = ReflectionUtils.getMethod( - mClass_ResearchManager, - "updateData", - ItemStack.class, - ReflectionUtils.getClass("thaumcraft.common.lib.research.ResearchNoteData")); - mMethod_getData = ReflectionUtils.getMethod(mClass_ResearchManager, "getData", ItemStack.class); - - /* - * Fields - */ - mField_PortholeBlacklist = ReflectionUtils.getField(mClass_ThaumcraftApi, "portableHoleBlackList"); - } - - public static void registerObjectTag(ItemStack aStack, TC_AspectList_Wrapper aAspectList) { - try { - mMethod_registerObjectTag1.invoke(null, aStack, aAspectList.getVanillaAspectList()); - } catch (IllegalAccessException | IllegalArgumentException | InvocationTargetException e) { - e.printStackTrace(); - } - } - - public static void registerObjectTag(String aOreDict, TC_AspectList_Wrapper aAspectList) { - try { - mMethod_registerObjectTag2.invoke(null, aOreDict, aAspectList.getVanillaAspectList()); - } catch (IllegalAccessException | IllegalArgumentException | InvocationTargetException e) { - e.printStackTrace(); - } - } - - public static void registerComplexObjectTag(ItemStack aStack, TC_AspectList_Wrapper aAspectList) { - try { - mMethod_registerComplexObjectTag.invoke(null, aStack, aAspectList.getVanillaAspectList()); - } catch (IllegalAccessException | IllegalArgumentException | InvocationTargetException e) { - e.printStackTrace(); - } - } - - public static TC_AspectList_Wrapper getObjectAspects(ItemStack aStack) { - try { - return new TC_AspectList_Wrapper(mMethod_getObjectAspects.invoke(null, aStack)); - } catch (IllegalAccessException | IllegalArgumentException | InvocationTargetException e) { - e.printStackTrace(); - } - return null; - } - - public static Object addCrucibleRecipe(String aResearch, ItemStack copy, Object aOutput, - TC_AspectList_Wrapper aAspectList) { - try { - return mMethod_addCrucibleRecipe.invoke(null, aResearch, copy, aOutput, aAspectList); - } catch (IllegalAccessException | IllegalArgumentException | InvocationTargetException e) { - e.printStackTrace(); - } - return null; - } - - public static Object addInfusionCraftingRecipe(String aResearch, Object copy, int aInstability, - TC_AspectList_Wrapper aAspectList, ItemStack aMainInput, ItemStack[] aSideInputs) { - try { - return mMethod_addInfusionCraftingRecipe - .invoke(null, aResearch, copy, aInstability, aAspectList, aMainInput, aSideInputs); - } catch (IllegalAccessException | IllegalArgumentException | InvocationTargetException e) { - e.printStackTrace(); - } - return null; - } - - public static boolean registerPortholeBlacklistedBlock(final Block aBlock) { - try { - ((ArrayList) mField_PortholeBlacklist.get(null)).add(aBlock); - } catch (IllegalArgumentException | IllegalAccessException e) { - e.printStackTrace(); - return false; - } - return true; - } - - public static String getTagFromAspectObject(Object aAspect) { - try { - if (mClass_Aspect == null || mField_Aspects == null) { - return null; - } - String aTafB = (String) mField_Aspects.get(aAspect); - if (aTafB == null) { - return null; - } - String aTag = aTafB.toLowerCase(); - return aTag; - } catch (IllegalArgumentException | IllegalAccessException e) { - // TODO Auto-generated catch block - e.printStackTrace(); - return "error"; - } - } - - public static void updateResearchNote(ItemStack a, TC_ResearchNoteData_Wrapper b) { - // updateData(a, b.getResearchNoteData()); - try { - mMethod_updateData.invoke(a, b.getResearchNoteData()); - } catch (IllegalAccessException | IllegalArgumentException | InvocationTargetException e) { - e.printStackTrace(); - } - } - - public static Object getResearchNoteData(ItemStack a) { - // getData(a); - try { - return mMethod_getData.invoke(a); - } catch (IllegalAccessException | IllegalArgumentException | InvocationTargetException e) { - e.printStackTrace(); - } - return null; - } - - public static boolean isItemResearchNotes(ItemStack aStack) { - if (aStack != null && aStack.getItem() == HANDLER_Thaumcraft.mResearchNotes - && HANDLER_Thaumcraft.mResearchNotes.getClass().isInstance(aStack.getItem())) { - return true; - } - return false; - } - - public static boolean isItemStackValidResearchNotes(ItemStack aStack) { - if (isItemResearchNotes(aStack) && aStack.getItemDamage() < 64) { - return true; - } - return false; - } - - public static TC_ResearchNoteData_Wrapper gatherResults(ItemStack note) { - TC_ResearchNoteData_Wrapper research = null; - if (isItemResearchNotes(note)) { - research = new TC_ResearchNoteData_Wrapper(getResearchNoteData(note)); - } - return research; - } - - public static void completeResearchNote(World aWorld, ItemStack aStack) { - if (!aWorld.isRemote) { - if (isItemResearchNotes(aStack)) { - aStack.setItemDamage(64); - } - } - } - - public static final synchronized TC_AspectList_Wrapper getAspectList_Ex(final List aAspects) { - final TC_AspectList_Wrapper rAspects = new TC_AspectList_Wrapper(); - for (final GTPP_AspectStack tAspect : aAspects) { - rAspects.add(tAspect.mAspect, tAspect.mAmount); - } - return rAspects; - } - - public static void addResearch(TC_ResearchItem_Wrapper tc_ResearchItem_Wrapper) { - // TODO Auto-generated method stub - - } -} diff --git a/src/main/resources/assets/miscutils/lang/de_DE.lang b/src/main/resources/assets/miscutils/lang/de_DE.lang index 2766a45265..e9e5be9332 100644 --- a/src/main/resources/assets/miscutils/lang/de_DE.lang +++ b/src/main/resources/assets/miscutils/lang/de_DE.lang @@ -150,12 +150,6 @@ item.itemGemShards.name=Diamantscherbe item.itemHalfCompleteCasings.name=Halb-fertige Hülle I item.itemSulfuricPotion.name=Werfbare Phiole mit Schwefelsäure item.itemHydrofluoricPotion.name=Werfbare Phiole mit Flusssäure -item.itemIngotRaisinBread.name=Eine Portion Rosinenbrot -item.itemHotIngotRaisinBread.name=Eine Portion heißes Rosinenbrot -item.itemFoodRaisinToast.name=Eine Portion Rosinentoast -item.itemHotFoodRaisinToast.name=Eine Portion heißer Rosinentoast -item.itemFoodCurriedSausages.name=Eine Portion Currywurst -item.itemHotFoodCurriedSausages.name=Eine Portion heiße Currywurst diff --git a/src/main/resources/assets/miscutils/lang/en_US.lang b/src/main/resources/assets/miscutils/lang/en_US.lang index 646ef553e7..a9ff7d4707 100644 --- a/src/main/resources/assets/miscutils/lang/en_US.lang +++ b/src/main/resources/assets/miscutils/lang/en_US.lang @@ -185,12 +185,6 @@ item.itemGemShards.tooltip=Diamond Shards item.itemHalfCompleteCasings.name=Half Complete Casing item.itemSulfuricPotion.name=Throwable Vial of Sulfuric Acid item.itemHydrofluoricPotion.name=Throwable Vial of Hydrofluoric Acid -item.itemIngotRaisinBread.name=A Serving of Raisin Bread -item.itemHotIngotRaisinBread.name=A Serving of Hot Raisin Bread -item.itemFoodRaisinToast.name=A Serving of Raisin Toast -item.itemHotFoodRaisinToast.name=A Serving of Hot Raisin Toast -item.itemFoodCurriedSausages.name=A Serving of Curried Sausages -item.itemHotFoodCurriedSausages.name=A Serving of Hot Curried Sausages item.itemBaseItemHotFood.tooltip.0=§7Warning: §cVery hot!§7 Avoid direct handling.. item.itemBaseItemHotFood.tooltip.1=This food has %d seconds left, until it is cool. item.itemBoilerChassis.name=Advanced Boiler Chassis [Tier %d] diff --git a/src/main/resources/assets/miscutils/lang/ru_RU.lang b/src/main/resources/assets/miscutils/lang/ru_RU.lang index dc3b86e628..90e6babf05 100644 --- a/src/main/resources/assets/miscutils/lang/ru_RU.lang +++ b/src/main/resources/assets/miscutils/lang/ru_RU.lang @@ -163,12 +163,6 @@ item.itemGemShards.name=Diamond Shards item.itemHalfCompleteCasings.name=Half Complete Casing item.itemSulfuricPotion.name=Throwable Vial of Sulfuric Acid item.itemHydrofluoricPotion.name=Throwable Vial of Hydrofluoric Acid -item.itemIngotRaisinBread.name=A Serving of Raisin Bread -item.itemHotIngotRaisinBread.name=A Serving of Hot Raisin Bread -item.itemFoodRaisinToast.name=A Serving of Raisin Toast -item.itemHotFoodRaisinToast.name=A Serving of Hot Raisin Toast -item.itemFoodCurriedSausages.name=A Serving of Curried Sausages -item.itemHotFoodCurriedSausages.name=A Serving of Hot Curried Sausages //Conversion Dusts diff --git a/src/main/resources/assets/miscutils/lang/zh_CN.lang b/src/main/resources/assets/miscutils/lang/zh_CN.lang index 52f4b38a0c..e6468fa983 100644 --- a/src/main/resources/assets/miscutils/lang/zh_CN.lang +++ b/src/main/resources/assets/miscutils/lang/zh_CN.lang @@ -163,12 +163,6 @@ item.itemGemShards.name=钻石碎片 item.itemHalfCompleteCasings.name=半成品机械方块 item.itemSulfuricPotion.name=喷溅型 硫酸 item.itemHydrofluoricPotion.name=喷溅型 氢氟酸 -item.itemIngotRaisinBread.name=一份葡萄干面包 -item.itemHotIngotRaisinBread.name=一份热葡萄干面包 -item.itemFoodRaisinToast.name=一份葡萄干烤面包 -item.itemHotFoodRaisinToast.name=一份热葡萄干烤面包 -item.itemFoodCurriedSausages.name=一份咖喱香肠 -item.itemHotFoodCurriedSausages.name=一份热咖喱香肠 //Conversion Dusts