aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--src/Java/gtPlusPlus/api/objects/minecraft/BlockPos.java12
-rw-r--r--src/Java/gtPlusPlus/api/objects/minecraft/FakeBlockPos.java253
-rw-r--r--src/Java/gtPlusPlus/api/objects/minecraft/FakeWorld.java170
-rw-r--r--src/Java/gtPlusPlus/api/objects/minecraft/ThreadFakeWorldGenerator.java61
-rw-r--r--src/Java/gtPlusPlus/core/item/base/BaseItemComponent.java3
-rw-r--r--src/Java/gtPlusPlus/core/item/base/ore/BaseOreComponent.java18
-rw-r--r--src/Java/gtPlusPlus/core/recipe/RECIPES_Machines.java8
-rw-r--r--src/Java/gtPlusPlus/core/util/Utils.java13
-rw-r--r--src/Java/gtPlusPlus/core/util/math/MathUtils.java5
-rw-r--r--src/Java/gtPlusPlus/preloader/asm/transformers/ClassTransformer_GT_Client.java384
-rw-r--r--src/Java/gtPlusPlus/preloader/asm/transformers/ClassTransformer_GT_Utility.java117
-rw-r--r--src/Java/gtPlusPlus/preloader/asm/transformers/ClassTransformer_IC2_Hazmat.java1
-rw-r--r--src/Java/gtPlusPlus/preloader/asm/transformers/Preloader_Transformer_Handler.java16
-rw-r--r--src/Java/gtPlusPlus/xmod/gregtech/api/metatileentity/implementations/base/GregtechMeta_MultiBlockBase.java3
-rw-r--r--src/Java/gtPlusPlus/xmod/gregtech/common/blocks/GregtechMetaCasingBlocks2.java2
-rw-r--r--src/Java/gtPlusPlus/xmod/gregtech/common/blocks/textures/CasingTextureHandler2.java5
-rw-r--r--src/Java/gtPlusPlus/xmod/gregtech/common/helpers/TreeFarmHelper.java31
-rw-r--r--src/Java/gtPlusPlus/xmod/gregtech/common/helpers/treefarm/TreeGenerator.java180
-rw-r--r--src/Java/gtPlusPlus/xmod/gregtech/common/tileentities/machines/multi/production/GregtechMetaTileEntityTreeFarm.java495
-rw-r--r--src/Java/gtPlusPlus/xmod/gregtech/common/tileentities/machines/multi/production/GregtechMetaTileEntity_IndustrialFishingPond.java3
-rw-r--r--src/Java/gtPlusPlus/xmod/gregtech/common/tileentities/machines/multi/production/bedrock/GregtechMetaTileEntity_BedrockMiningPlatform1.java4
-rw-r--r--src/Java/gtPlusPlus/xmod/gregtech/common/tileentities/machines/multi/production/bedrock/GregtechMetaTileEntity_BedrockMiningPlatform2.java2
-rw-r--r--src/Java/gtPlusPlus/xmod/gregtech/common/tileentities/machines/multi/production/bedrock/GregtechMetaTileEntity_BedrockMiningPlatformBase.java333
-rw-r--r--src/Java/gtPlusPlus/xmod/thaumcraft/HANDLER_Thaumcraft.java5
-rw-r--r--src/Java/gtPlusPlus/xmod/thaumcraft/aspect/GTPP_AspectCompat.java1
25 files changed, 1181 insertions, 944 deletions
diff --git a/src/Java/gtPlusPlus/api/objects/minecraft/BlockPos.java b/src/Java/gtPlusPlus/api/objects/minecraft/BlockPos.java
index 9ab0f2eefb..7c11e7232b 100644
--- a/src/Java/gtPlusPlus/api/objects/minecraft/BlockPos.java
+++ b/src/Java/gtPlusPlus/api/objects/minecraft/BlockPos.java
@@ -42,8 +42,16 @@ public class BlockPos implements Serializable{
this.xPos = x;
this.yPos = y;
this.zPos = z;
- this.dim = dim.provider.dimensionId;
- this.world = dim;
+
+ if (dim != null) {
+ this.dim = dim.provider.dimensionId;
+ this.world = dim;
+ }
+ else {
+ this.dim = 0;
+ this.world = null;
+ }
+
}
public BlockPos(IGregTechTileEntity b) {
diff --git a/src/Java/gtPlusPlus/api/objects/minecraft/FakeBlockPos.java b/src/Java/gtPlusPlus/api/objects/minecraft/FakeBlockPos.java
new file mode 100644
index 0000000000..d0c1f3f040
--- /dev/null
+++ b/src/Java/gtPlusPlus/api/objects/minecraft/FakeBlockPos.java
@@ -0,0 +1,253 @@
+package gtPlusPlus.api.objects.minecraft;
+
+import java.util.HashSet;
+import java.util.Set;
+
+import gtPlusPlus.api.objects.data.AutoMap;
+import net.minecraft.block.Block;
+import net.minecraft.init.Blocks;
+import net.minecraft.world.World;
+import net.minecraftforge.common.DimensionManager;
+
+public class FakeBlockPos extends BlockPos {
+
+ private static final long serialVersionUID = -6442245826092414593L;
+ private 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);
+ }
+
+ public String getLocationString() {
+ String S = ""+this.xPos+"@"+this.yPos+"@"+this.zPos;
+ return S;
+ }
+
+ 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
+ */
+ 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);
+ }
+
+ public boolean isWithinRange(int x, int y, int z, int range) {
+ return distanceFrom(x, y, z) <= (range * range);
+ }
+
+
+ public FakeBlockPos getUp() {
+ return new FakeBlockPos(this.xPos, this.yPos+1, this.zPos, this.dim);
+ }
+
+ public FakeBlockPos getDown() {
+ return new FakeBlockPos(this.xPos, this.yPos-1, this.zPos, this.dim);
+ }
+
+ public FakeBlockPos getXPos() {
+ return new FakeBlockPos(this.xPos+1, this.yPos, this.zPos, this.dim);
+ }
+
+ public FakeBlockPos getXNeg() {
+ return new FakeBlockPos(this.xPos-1, this.yPos, this.zPos, this.dim);
+ }
+
+ public FakeBlockPos getZPos() {
+ return new FakeBlockPos(this.xPos, this.yPos, this.zPos+1, this.dim);
+ }
+
+ public FakeBlockPos getZNeg() {
+ return new FakeBlockPos(this.xPos, this.yPos, this.zPos-1, this.dim);
+ }
+
+ public AutoMap<BlockPos> getSurroundingBlocks(){
+ AutoMap<BlockPos> sides = new AutoMap<BlockPos>();
+ sides.put(getUp());
+ sides.put(getDown());
+ sides.put(getXPos());
+ sides.put(getXNeg());
+ sides.put(getZPos());
+ sides.put(getZNeg());
+ return sides;
+ }
+
+ public Block getBlockAtPos() {
+ return getBlockAtPos(this);
+ }
+
+ public Block getBlockAtPos(FakeBlockPos pos) {
+ return getBlockAtPos(world, pos);
+ }
+
+ public Block getBlockAtPos(World world, FakeBlockPos pos) {
+ return aBlockAtPos;
+ }
+
+ public int getMetaAtPos() {
+ return getMetaAtPos(this);
+ }
+
+ public int getMetaAtPos(FakeBlockPos pos) {
+ return getMetaAtPos(world, pos);
+ }
+
+ public int getMetaAtPos(World world, FakeBlockPos pos) {
+ return aBlockMetaAtPos;
+ }
+
+ public boolean hasSimilarNeighbour() {
+ return hasSimilarNeighbour(false);
+ }
+
+ /**
+ * @param strict - Does this check Meta Data?
+ * @return - Does this block have a neighbour that is the same?
+ */
+ 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;
+ }
+
+ public AutoMap<BlockPos> getSimilarNeighbour() {
+ return getSimilarNeighbour(false);
+ }
+
+ /**
+ * @param strict - Does this check Meta Data?
+ * @return - Does this block have a neighbour that is the same?
+ */
+ public AutoMap<BlockPos> getSimilarNeighbour(boolean strict) {
+ AutoMap<BlockPos> sides = new AutoMap<BlockPos>();
+ for (BlockPos g : getSurroundingBlocks().values()) {
+ if (getBlockAtPos(g) == getBlockAtPos()) {
+ if (!strict) {
+ sides.put(g);
+ }
+ else {
+ if (getMetaAtPos() == getMetaAtPos(g)) {
+ sides.put(g);
+ }
+ }
+ }
+ }
+ return sides;
+ }
+
+ public Set<BlockPos> getValidNeighboursAndSelf(){
+ AutoMap<BlockPos> h = getSimilarNeighbour(true);
+ h.put(this);
+ Set<BlockPos> result = new HashSet<BlockPos>();
+ 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/Java/gtPlusPlus/api/objects/minecraft/FakeWorld.java b/src/Java/gtPlusPlus/api/objects/minecraft/FakeWorld.java
index 38cde74317..8ee033a341 100644
--- a/src/Java/gtPlusPlus/api/objects/minecraft/FakeWorld.java
+++ b/src/Java/gtPlusPlus/api/objects/minecraft/FakeWorld.java
@@ -1,5 +1,173 @@
package gtPlusPlus.api.objects.minecraft;
-public class FakeWorld {
+import java.util.HashMap;
+import gregtech.api.enums.Materials;
+import gtPlusPlus.api.objects.Logger;
+import gtPlusPlus.api.objects.data.AutoMap;
+import gtPlusPlus.core.util.math.MathUtils;
+import gtPlusPlus.core.util.minecraft.ItemUtils;
+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;
+
+public class FakeWorld implements IBlockAccess {
+
+ public static HashMap<String, FakeBlockPos> mStaticFakeWorldData;
+
+ public HashMap<String, FakeBlockPos> mFakeWorldData = new HashMap<String, FakeBlockPos>();
+
+ /**
+ * 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<String, FakeBlockPos>();
+ 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<String, FakeBlockPos>();
+ //mFakeWorldData = (HashMap<String, FakeBlockPos>) 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<ItemStack> getAllBlocksStoredInFakeWorld(){
+ AutoMap<ItemStack> aOutput = new AutoMap<ItemStack>();
+ 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;
+ }
+
+ public Block getBlock(int x, int y, int z) {
+ FakeBlockPos aPos = getBlockAtCoords(x, y, z);
+ return aPos.getBlockAtPos();
+ }
+
+ 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/Java/gtPlusPlus/api/objects/minecraft/ThreadFakeWorldGenerator.java b/src/Java/gtPlusPlus/api/objects/minecraft/ThreadFakeWorldGenerator.java
new file mode 100644
index 0000000000..393d3260b5
--- /dev/null
+++ b/src/Java/gtPlusPlus/api/objects/minecraft/ThreadFakeWorldGenerator.java
@@ -0,0 +1,61 @@
+package gtPlusPlus.api.objects.minecraft;
+
+import gtPlusPlus.xmod.gregtech.common.helpers.treefarm.TreeGenerator;
+
+public class ThreadFakeWorldGenerator extends Thread {
+
+ public boolean canRun = true;
+ public boolean isRunning = false;
+
+ private static final long INIT_TIME;
+ private static long internalTickCounter = 0;
+
+ public TreeGenerator mGenerator;
+
+ private static final ThreadFakeWorldGenerator mThread;
+
+ static {
+ mThread = new ThreadFakeWorldGenerator();
+ INIT_TIME = (System.currentTimeMillis());
+ }
+
+ public ThreadFakeWorldGenerator() {
+ setName("gtpp.handler.fakeworldtrees");
+ run();
+ }
+
+ public static ThreadFakeWorldGenerator getInstance() {
+ return mThread;
+ }
+
+ public static void stopThread() {
+ mThread.canRun = false;
+ }
+
+
+ @Override
+ public void run() {
+
+ if (!isRunning) {
+ isRunning = true;
+ }
+ else {
+ return;
+ }
+
+ if (canRun){
+ if (mGenerator == null) {
+ mGenerator = new TreeGenerator();
+ }
+ }
+
+ while (mGenerator == null) {
+ if (mGenerator != null) {
+ break;
+ }
+ }
+ stopThread();
+ }
+
+
+}
diff --git a/src/Java/gtPlusPlus/core/item/base/BaseItemComponent.java b/src/Java/gtPlusPlus/core/item/base/BaseItemComponent.java
index fe3934ed10..33198e8d41 100644
--- a/src/Java/gtPlusPlus/core/item/base/BaseItemComponent.java
+++ b/src/Java/gtPlusPlus/core/item/base/BaseItemComponent.java
@@ -8,7 +8,6 @@ import cpw.mods.fml.common.registry.GameRegistry;
import cpw.mods.fml.relauncher.Side;
import cpw.mods.fml.relauncher.SideOnly;
import gregtech.api.enums.OrePrefixes;
-import gregtech.api.enums.TC_Aspects;
import gregtech.api.enums.TextureSet;
import gregtech.api.util.GT_OreDictUnificator;
import gtPlusPlus.api.objects.Logger;
@@ -23,8 +22,6 @@ import gtPlusPlus.core.util.math.MathUtils;
import gtPlusPlus.core.util.minecraft.EntityUtils;
import gtPlusPlus.core.util.minecraft.ItemUtils;
import gtPlusPlus.core.util.sys.KeyboardUtils;
-import gtPlusPlus.xmod.thaumcraft.objects.wrapper.aspect.TC_Aspect_Wrapper;
-import gtPlusPlus.xmod.thaumcraft.util.ThaumcraftUtils;
import net.minecraft.client.renderer.texture.IIconRegister;
import net.minecraft.entity.Entity;
import net.minecraft.entity.player.EntityPlayer;
diff --git a/src/Java/gtPlusPlus/core/item/base/ore/BaseOreComponent.java b/src/Java/gtPlusPlus/core/item/base/ore/BaseOreComponent.java
index 6bb0ea8be8..277114a6ae 100644
--- a/src/Java/gtPlusPlus/core/item/base/ore/BaseOreComponent.java
+++ b/src/Java/gtPlusPlus/core/item/base/ore/BaseOreComponent.java
@@ -7,16 +7,7 @@ import java.util.Map;
import cpw.mods.fml.common.registry.GameRegistry;
import cpw.mods.fml.relauncher.Side;
import cpw.mods.fml.relauncher.SideOnly;
-
-import net.minecraft.client.renderer.texture.IIconRegister;
-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.IIcon;
-import net.minecraft.world.World;
import gregtech.api.enums.OrePrefixes;
-import gregtech.api.enums.TC_Aspects;
import gregtech.api.util.GT_OreDictUnificator;
import gtPlusPlus.api.objects.Logger;
import gtPlusPlus.core.creative.AddToCreativeTab;
@@ -27,8 +18,13 @@ import gtPlusPlus.core.material.state.MaterialState;
import gtPlusPlus.core.util.Utils;
import gtPlusPlus.core.util.minecraft.EntityUtils;
import gtPlusPlus.core.util.minecraft.ItemUtils;
-import gtPlusPlus.xmod.thaumcraft.objects.wrapper.aspect.TC_Aspect_Wrapper;
-import gtPlusPlus.xmod.thaumcraft.util.ThaumcraftUtils;
+import net.minecraft.client.renderer.texture.IIconRegister;
+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.IIcon;
+import net.minecraft.world.World;
public class BaseOreComponent extends Item{
diff --git a/src/Java/gtPlusPlus/core/recipe/RECIPES_Machines.java b/src/Java/gtPlusPlus/core/recipe/RECIPES_Machines.java
index c26b01d0f7..e9c1da024c 100644
--- a/src/Java/gtPlusPlus/core/recipe/RECIPES_Machines.java
+++ b/src/Java/gtPlusPlus/core/recipe/RECIPES_Machines.java
@@ -801,10 +801,10 @@ public class RECIPES_Machines {
RECIPE_IndustrialSieveGrate);
}
- if (CORE.ConfigSwitches.enableMultiblock_TreeFarmer){/*
+ if (CORE.ConfigSwitches.enableMultiblock_TreeFarmer){
//Industrial Tree Farmer
RECIPE_TreeFarmController = GregtechItemList.Industrial_TreeFarm.get(1);
- RECIPE_TreeFarmFrame = GregtechItemList.TreeFarmer_Structural.get(Casing_Amount);
+ RECIPE_TreeFarmFrame = GregtechItemList.Casing_PLACEHOLDER_TreeFarmer.get(Casing_Amount);
//Industrial Tree Farm Controller
if (!GTNH) {
RecipeUtils.addShapedGregtechRecipe(
@@ -813,7 +813,7 @@ public class RECIPES_Machines {
"plateEglinSteel", CI.machineCasing_MV, "plateEglinSteel",
RECIPE_TreeFarmController);
}
- if (GTNH) {
+ else {
RecipeUtils.addShapedGregtechRecipe(
"plateEglinSteel", "rotorEglinSteel", "plateEglinSteel",
"cableGt02Silver", "pipeMediumStainlessSteel", "cableGt02Silver",
@@ -826,7 +826,7 @@ public class RECIPES_Machines {
"plankWood", "frameGtTumbaga", "plankWood",
"plankWood", "plankWood", "plankWood",
RECIPE_TreeFarmFrame);
- */}
+ }
if (CORE.ConfigSwitches.enableMachine_Tesseracts){
//Tesseracts
diff --git a/src/Java/gtPlusPlus/core/util/Utils.java b/src/Java/gtPlusPlus/core/util/Utils.java
index d032384638..3b3ba88e88 100644
--- a/src/Java/gtPlusPlus/core/util/Utils.java
+++ b/src/Java/gtPlusPlus/core/util/Utils.java
@@ -31,6 +31,7 @@ import net.minecraft.util.IChatComponent;
import net.minecraft.world.World;
import gregtech.GT_Mod;
+import gregtech.api.enums.GT_Values;
import gregtech.api.enums.ItemList;
import gregtech.api.enums.Materials;
import gregtech.api.enums.OrePrefixes;
@@ -959,5 +960,17 @@ public class Utils {
public static long getTicksFromSeconds(long aSeconds) {
return (aSeconds*20);
}
+
+ public static byte getTier(long l) {
+ byte i = -1;
+ do {
+ ++i;
+ if (i >= GT_Values.V.length) {
+ return i;
+ }
+ } while (l > GT_Values.V[i]);
+ i = (byte) MathUtils.getValueWithinRange(i, 0, 15);
+ return i;
+ }
}
diff --git a/src/Java/gtPlusPlus/core/util/math/MathUtils.java b/src/Java/gtPlusPlus/core/util/math/MathUtils.java
index f9a4d8f548..4ba9d54271 100644
--- a/src/Java/gtPlusPlus/core/util/math/MathUtils.java
+++ b/src/Java/gtPlusPlus/core/util/math/MathUtils.java
@@ -692,4 +692,9 @@ public class MathUtils {
return Math.max(Math.min(aInput, aMax), aMin);
}
+ public static int getValueWithinRange(byte aInput, int aMin, int aMax) {
+ int aAmount = Math.max(Math.min(aInput, aMax), aMin);
+ return aAmount;
+ }
+
}
diff --git a/src/Java/gtPlusPlus/preloader/asm/transformers/ClassTransformer_GT_Client.java b/src/Java/gtPlusPlus/preloader/asm/transformers/ClassTransformer_GT_Client.java
index eb33366401..da6abfe57c 100644
--- a/src/Java/gtPlusPlus/preloader/asm/transformers/ClassTransformer_GT_Client.java
+++ b/src/Java/gtPlusPlus/preloader/asm/transformers/ClassTransformer_GT_Client.java
@@ -3,13 +3,13 @@ package gtPlusPlus.preloader.asm.transformers;
import static org.objectweb.asm.Opcodes.ACC_PUBLIC;
import static org.objectweb.asm.Opcodes.ALOAD;
import static org.objectweb.asm.Opcodes.ASM5;
+import static org.objectweb.asm.Opcodes.INVOKESPECIAL;
import static org.objectweb.asm.Opcodes.INVOKESTATIC;
import static org.objectweb.asm.Opcodes.RETURN;
import java.io.File;
import java.io.FileInputStream;
import java.io.IOException;
-import java.lang.reflect.Field;
import java.net.URL;
import java.net.URLClassLoader;
import java.util.ArrayList;
@@ -40,16 +40,17 @@ import cpw.mods.fml.common.gameevent.TickEvent.Phase;
import cpw.mods.fml.common.gameevent.TickEvent.PlayerTickEvent;
import cpw.mods.fml.relauncher.FMLRelaunchLog;
import gregtech.api.GregTech_API;
+import gregtech.api.util.GT_Log;
import gregtech.api.util.GT_PlayedSound;
import gregtech.api.util.GT_Recipe;
import gregtech.api.util.GT_Recipe.GT_Recipe_Map;
import gregtech.api.util.GT_Utility;
import gtPlusPlus.api.objects.Logger;
import gtPlusPlus.core.util.minecraft.ItemUtils;
-import gtPlusPlus.core.util.reflect.ReflectionUtils;
import gtPlusPlus.xmod.gregtech.common.StaticFields59;
import gtPlusPlus.xmod.gregtech.loaders.misc.AssLineAchievements;
import net.minecraft.client.Minecraft;
+import net.minecraft.entity.player.EntityPlayer;
import net.minecraft.item.ItemStack;
import net.minecraft.stats.StatFileWriter;
@@ -58,13 +59,16 @@ public class ClassTransformer_GT_Client {
private final boolean valid;
private final ClassReader read;
private final ClassWriter write;
- private boolean mModern;
+ private boolean mModern = true;
+ private boolean mObfuscated = true;
private byte[] mTooledClass;
- public ClassTransformer_GT_Client(byte[] basicClass) {
+ public ClassTransformer_GT_Client(byte[] basicClass, boolean obfuscated) {
ClassReader aTempReader = null;
ClassWriter aTempWriter = null;
+
+ mObfuscated = obfuscated;
aTempReader = new ClassReader(basicClass);
aTempWriter = new ClassWriter(aTempReader, ClassWriter.COMPUTE_FRAMES);
@@ -72,12 +76,14 @@ public class ClassTransformer_GT_Client {
/**
* Let's just read the GT archive for some info
*/
- mModern = findAssemblyLineClass();
- FMLRelaunchLog.log("[GT++ ASM] Gregtech Achievements Patch", Level.INFO, "Found Assembly Line? "+mModern+".");
+ //mModern = findAssemblyLineClass();
+ //FMLRelaunchLog.log("[GT++ ASM] Gregtech Client Proxy Patch", Level.INFO, "Found Assembly Line? "+mModern+".");
+ FMLRelaunchLog.log("[GT++ ASM] Gregtech Client Proxy Patch", Level.INFO, "Fixing Issues in vanilla GT.");
if (mModern) {
aTempReader.accept(new MethodAdaptor2(aTempWriter), 0);
- FMLRelaunchLog.log("[GT++ ASM] Gregtech Achievements Patch", Level.INFO, "Patching Client handling of Assembly Line recipe visibility for GT 5.09");
- injectMethod(aTempWriter);
+ //FMLRelaunchLog.log("[GT++ ASM] Gregtech Client Proxy Patch", Level.INFO, "Patching Client handling of Assembly Line recipe visibility for GT 5.09");
+ //injectMethod(aTempWriter, "onPlayerTickEventClient");
+ injectMethod(aTempWriter, "onPostLoad");
if (aTempReader != null && aTempWriter != null) {
valid = true;
mTooledClass = aTempWriter.toByteArray();
@@ -90,7 +96,7 @@ public class ClassTransformer_GT_Client {
mTooledClass = basicClass;
valid = true;
}
- FMLRelaunchLog.log("[GT++ ASM] Gregtech Achievements Patch", Level.INFO, "Valid? "+valid+".");
+ FMLRelaunchLog.log("[GT++ ASM] Gregtech Client Proxy Patch", Level.INFO, "Valid? "+valid+".");
read = aTempReader;
write = aTempWriter;
}
@@ -114,7 +120,7 @@ public class ClassTransformer_GT_Client {
if (classesInPackage != null && classesInPackage.size() > 0) {
for (ClassInfo x : classesInPackage) {
if (x.getResourceName().contains("GT_MetaTileEntity_AssemblyLine")) {
- FMLRelaunchLog.log("[GT++ ASM] Gregtech Achievements Patch", Level.INFO,
+ FMLRelaunchLog.log("[GT++ ASM] Gregtech Client Proxy Patch", Level.INFO,
"Patchable class | " + x.getResourceName());
return true;
}
@@ -123,7 +129,7 @@ public class ClassTransformer_GT_Client {
} catch (IOException e) {
}
- FMLRelaunchLog.log("[GT++ ASM] Gregtech Achievements Patch", Level.INFO, "Failed to find Gregtech classes using prefered method, using backup.");
+ FMLRelaunchLog.log("[GT++ ASM] Gregtech Client Proxy Patch", Level.INFO, "Failed to find Gregtech classes using prefered method, using backup.");
cl = ClassLoader.getSystemClassLoader();
ImmutableMap<File, ClassLoader> g = getClassPathEntries(cl);
@@ -136,7 +142,7 @@ public class ClassTransformer_GT_Client {
aName = aF.getName();
if (aName != null && aName.length() > 0) {
if (aName.toLowerCase().contains("gregtech")) {
- FMLRelaunchLog.log("[GT++ ASM] Gregtech Achievements Patch", Level.INFO, "Patchable class | "+aName);
+ FMLRelaunchLog.log("[GT++ ASM] Gregtech Client Proxy Patch", Level.INFO, "Patchable class | "+aName);
aGregtech = aF;
}
}
@@ -154,7 +160,7 @@ public class ClassTransformer_GT_Client {
JarEntry je;
while((je=jis.getNextJarEntry())!=null){
if (je.getName().contains("GT_MetaTileEntity_AssemblyLine")) {
- FMLRelaunchLog.log("[GT++ ASM] Gregtech Achievements Patch", Level.INFO, "Patchable class | "+je.getName());
+ FMLRelaunchLog.log("[GT++ ASM] Gregtech Client Proxy Patch", Level.INFO, "Patchable class | "+je.getName());
return true;
}
}
@@ -163,7 +169,7 @@ public class ClassTransformer_GT_Client {
} catch (IOException e1) {
}
}
- FMLRelaunchLog.log("[GT++ ASM] Gregtech Achievements Patch", Level.INFO, "Failed to find Gregtech classes using backup method, probably using GT 5.08");
+ FMLRelaunchLog.log("[GT++ ASM] Gregtech Client Proxy Patch", Level.INFO, "Failed to find Gregtech classes using backup method, probably using GT 5.08");
return false;
}
@@ -189,277 +195,69 @@ public class ClassTransformer_GT_Client {
return ImmutableMap.copyOf(entries);
}
- public boolean injectMethod(ClassWriter cw) {
+ public boolean injectMethod(ClassWriter cw, String string) {
MethodVisitor mv;
boolean didInject = false;
- FMLRelaunchLog.log("[GT++ ASM] Gregtech Achievements Patch", Level.INFO, "Injecting " + "onPlayerTickEventClient" + ".");
-
- /**
- * Inject new, safer code
- */
-
- AnnotationVisitor av0;
-
-
- /**
- * Full Patch ASM - Original Idea, now second to static injection of a custom handler.
- */
-
- /*mv = cw.visitMethod(ACC_PUBLIC, "onPlayerTickEventClient", "(Lcpw/mods/fml/common/gameevent/TickEvent$PlayerTickEvent;)V", null, null);
- {
+ FMLRelaunchLog.log("[GT++ ASM] Gregtech Client Proxy Patch", Level.INFO, "Injecting " + string + ". Obfuscated? "+mObfuscated);
+
+ if (string.equals("onPlayerTickEventClient")) {
+ /**
+ * Inject new, safer code
+ */
+ AnnotationVisitor av0;
+ /**
+ * Static invocation of custom handler instead
+ */
+ mv = cw.visitMethod(ACC_PUBLIC, "onPlayerTickEventClient", "(Lcpw/mods/fml/common/gameevent/TickEvent$PlayerTickEvent;)V", null, null);
av0 = mv.visitAnnotation("Lcpw/mods/fml/common/eventhandler/SubscribeEvent;", true);
av0.visitEnd();
+ mv.visitCode();
+ Label l0 = new Label();
+ mv.visitLabel(l0);
+ mv.visitLineNumber(371, l0);
+ mv.visitVarInsn(ALOAD, 1);
+ mv.visitMethodInsn(INVOKESTATIC, "gtPlusPlus/preloader/asm/transformers/ClassTransformer_GT_Client", "onPlayerTickEventClient", "(Lcpw/mods/fml/common/gameevent/TickEvent$PlayerTickEvent;)V", false);
+ Label l1 = new Label();
+ mv.visitLabel(l1);
+ mv.visitLineNumber(372, l1);
+ mv.visitInsn(RETURN);
+ Label l2 = new Label();
+ mv.visitLabel(l2);
+ mv.visitLocalVariable("this", "Lgregtech/common/GT_Client;", null, l0, l2, 0);
+ mv.visitLocalVariable("aEvent", "Lcpw/mods/fml/common/gameevent/TickEvent$PlayerTickEvent;", null, l0, l2, 1);
+ mv.visitMaxs(1, 2);
+ mv.visitEnd();
+ didInject = true;
+ }
+ else if (string.equals("onPostLoad")) {
+ mv = cw.visitMethod(ACC_PUBLIC, "onPostLoad", "()V", null, null);
+ mv.visitCode();
+ Label l0 = new Label();
+ mv.visitLabel(l0);
+ mv.visitLineNumber(315, l0);
+ mv.visitVarInsn(ALOAD, 0);
+ mv.visitMethodInsn(INVOKESPECIAL, "gregtech/common/GT_Proxy", "onPostLoad", "()V", false);
+ Label l1 = new Label();
+ mv.visitLabel(l1);
+ mv.visitLineNumber(316, l1);
+ mv.visitMethodInsn(INVOKESTATIC, "gtPlusPlus/preloader/asm/transformers/ClassTransformer_GT_Client", "onPostLoad", "()V", false);
+ Label l2 = new Label();
+ mv.visitLabel(l2);
+ mv.visitLineNumber(317, l2);
+ mv.visitInsn(RETURN);
+ Label l3 = new Label();
+ mv.visitLabel(l3);
+ mv.visitLocalVariable("this", "Lgregtech/common/GT_Client;", null, l0, l3, 0);
+ mv.visitMaxs(1, 1);
+ mv.visitEnd();
+ didInject = true;
}
- mv.visitCode();
- Label l0 = new Label();
- Label l1 = new Label();
- Label l2 = new Label();
- mv.visitTryCatchBlock(l0, l1, l2, "java/lang/Exception");
- Label l3 = new Label();
- mv.visitLabel(l3);
- mv.visitLineNumber(370, l3);
- mv.visitVarInsn(ALOAD, 1);
- mv.visitFieldInsn(GETFIELD, "cpw/mods/fml/common/gameevent/TickEvent$PlayerTickEvent", "side", "Lcpw/mods/fml/relauncher/Side;");
- mv.visitMethodInsn(INVOKEVIRTUAL, "cpw/mods/fml/relauncher/Side", "isClient", "()Z", false);
- Label l4 = new Label();
- mv.visitJumpInsn(IFEQ, l4);
- mv.visitVarInsn(ALOAD, 1);
- mv.visitFieldInsn(GETFIELD, "cpw/mods/fml/common/gameevent/TickEvent$PlayerTickEvent", "phase", "Lcpw/mods/fml/common/gameevent/TickEvent$Phase;");
- mv.visitFieldInsn(GETSTATIC, "cpw/mods/fml/common/gameevent/TickEvent$Phase", "END", "Lcpw/mods/fml/common/gameevent/TickEvent$Phase;");
- mv.visitJumpInsn(IF_ACMPNE, l4);
- mv.visitVarInsn(ALOAD, 1);
- mv.visitFieldInsn(GETFIELD, "cpw/mods/fml/common/gameevent/TickEvent$PlayerTickEvent", "player", "Lnet/minecraft/entity/player/EntityPlayer;");
- mv.visitFieldInsn(GETFIELD, "net/minecraft/entity/player/EntityPlayer", "isDead", "Z");
- mv.visitJumpInsn(IFNE, l4);
- Label l5 = new Label();
- mv.visitLabel(l5);
- mv.visitLineNumber(371, l5);
- mv.visitVarInsn(ALOAD, 0);
- mv.visitInsn(DUP);
- mv.visitFieldInsn(GETFIELD, "gregtech/common/GT_Client", "afterSomeTime", "J");
- mv.visitInsn(LCONST_1);
- mv.visitInsn(LADD);
- mv.visitFieldInsn(PUTFIELD, "gregtech/common/GT_Client", "afterSomeTime", "J");
- Label l6 = new Label();
- mv.visitLabel(l6);
- mv.visitLineNumber(372, l6);
- mv.visitVarInsn(ALOAD, 0);
- mv.visitFieldInsn(GETFIELD, "gregtech/common/GT_Client", "afterSomeTime", "J");
- mv.visitLdcInsn(new Long(100L));
- mv.visitInsn(LCMP);
- Label l7 = new Label();
- mv.visitJumpInsn(IFLT, l7);
- Label l8 = new Label();
- mv.visitLabel(l8);
- mv.visitLineNumber(373, l8);
- mv.visitVarInsn(ALOAD, 0);
- mv.visitInsn(LCONST_0);
- mv.visitFieldInsn(PUTFIELD, "gregtech/common/GT_Client", "afterSomeTime", "J");
- Label l9 = new Label();
- mv.visitLabel(l9);
- mv.visitLineNumber(374, l9);
- mv.visitMethodInsn(INVOKESTATIC, "net/minecraft/client/Minecraft", "getMinecraft", "()Lnet/minecraft/client/Minecraft;", false);
- mv.visitFieldInsn(GETFIELD, "net/minecraft/client/Minecraft", "thePlayer", "Lnet/minecraft/client/entity/EntityClientPlayerMP;");
- mv.visitMethodInsn(INVOKEVIRTUAL, "net/minecraft/client/entity/EntityClientPlayerMP", "getStatFileWriter", "()Lnet/minecraft/stats/StatFileWriter;", false);
- mv.visitVarInsn(ASTORE, 2);
- mv.visitLabel(l0);
- mv.visitLineNumber(376, l0);
- mv.visitFieldInsn(GETSTATIC, "gregtech/api/util/GT_Recipe$GT_Recipe_Map", "sAssemblylineVisualRecipes", "Lgregtech/api/util/GT_Recipe$GT_Recipe_Map;");
- mv.visitFieldInsn(GETFIELD, "gregtech/api/util/GT_Recipe$GT_Recipe_Map", "mRecipeList", "Ljava/util/Collection;");
- mv.visitMethodInsn(INVOKEINTERFACE, "java/util/Collection", "iterator", "()Ljava/util/Iterator;", true);
- mv.visitVarInsn(ASTORE, 4);
- Label l10 = new Label();
- mv.visitJumpInsn(GOTO, l10);
- Label l11 = new Label();
- mv.visitLabel(l11);
- mv.visitFrame(F_FULL, 5, new Object[] {"gregtech/common/GT_Client", "cpw/mods/fml/common/gameevent/TickEvent$PlayerTickEvent", "net/minecraft/stats/StatFileWriter", TOP, "java/util/Iterator"}, 0, new Object[] {});
- mv.visitVarInsn(ALOAD, 4);
- mv.visitMethodInsn(INVOKEINTERFACE, "java/util/Iterator", "next", "()Ljava/lang/Object;", true);
- mv.visitTypeInsn(CHECKCAST, "gregtech/api/util/GT_Recipe");
- mv.visitVarInsn(ASTORE, 3);
- Label l12 = new Label();
- mv.visitLabel(l12);
- mv.visitLineNumber(377, l12);
- mv.visitVarInsn(ALOAD, 3);
- mv.visitVarInsn(ALOAD, 2);
- mv.visitVarInsn(ALOAD, 3);
- mv.visitInsn(ICONST_0);
- mv.visitMethodInsn(INVOKEVIRTUAL, "gregtech/api/util/GT_Recipe", "getOutput", "(I)Lnet/minecraft/item/ItemStack;", false);
- mv.visitMethodInsn(INVOKEVIRTUAL, "net/minecraft/item/ItemStack", "getUnlocalizedName", "()Ljava/lang/String;", false);
- mv.visitMethodInsn(INVOKESTATIC, "gtPlusPlus/xmod/gregtech/loaders/misc/AssLineAchievements", "getAchievement", "(Ljava/lang/String;)Lnet/minecraft/stats/Achievement;", false);
- mv.visitMethodInsn(INVOKEVIRTUAL, "net/minecraft/stats/StatFileWriter", "hasAchievementUnlocked", "(Lnet/minecraft/stats/Achievement;)Z", false);
- Label l13 = new Label();
- mv.visitJumpInsn(IFEQ, l13);
- mv.visitInsn(ICONST_0);
- Label l14 = new Label();
- mv.visitJumpInsn(GOTO, l14);
- mv.visitLabel(l13);
- mv.visitFrame(F_FULL, 5, new Object[] {"gregtech/common/GT_Client", "cpw/mods/fml/common/gameevent/TickEvent$PlayerTickEvent", "net/minecraft/stats/StatFileWriter", "gregtech/api/util/GT_Recipe", "java/util/Iterator"}, 1, new Object[] {"gregtech/api/util/GT_Recipe"});
- mv.visitInsn(ICONST_1);
- mv.visitLabel(l14);
- mv.visitFrame(F_FULL, 5, new Object[] {"gregtech/common/GT_Client", "cpw/mods/fml/common/gameevent/TickEvent$PlayerTickEvent", "net/minecraft/stats/StatFileWriter", "gregtech/api/util/GT_Recipe", "java/util/Iterator"}, 2, new Object[] {"gregtech/api/util/GT_Recipe", INTEGER});
- mv.visitFieldInsn(PUTFIELD, "gregtech/api/util/GT_Recipe", "mHidden", "Z");
- mv.visitLabel(l10);
- mv.visitLineNumber(376, l10);
- mv.visitFrame(F_FULL, 5, new Object[] {"gregtech/common/GT_Client", "cpw/mods/fml/common/gameevent/TickEvent$PlayerTickEvent", "net/minecraft/stats/StatFileWriter", TOP, "java/util/Iterator"}, 0, new Object[] {});
- mv.visitVarInsn(ALOAD, 4);
- mv.visitMethodInsn(INVOKEINTERFACE, "java/util/Iterator", "hasNext", "()Z", true);
- mv.visitJumpInsn(IFNE, l11);
- mv.visitLabel(l1);
- mv.visitLineNumber(379, l1);
- mv.visitJumpInsn(GOTO, l7);
- mv.visitLabel(l2);
- mv.visitFrame(F_FULL, 3, new Object[] {"gregtech/common/GT_Client", "cpw/mods/fml/common/gameevent/TickEvent$PlayerTickEvent", "net/minecraft/stats/StatFileWriter"}, 1, new Object[] {"java/lang/Exception"});
- mv.visitVarInsn(ASTORE, 3);
- mv.visitLabel(l7);
- mv.visitLineNumber(381, l7);
- mv.visitFrame(F_CHOP,1, null, 0, null);
- mv.visitTypeInsn(NEW, "java/util/ArrayList");
- mv.visitInsn(DUP);
- mv.visitMethodInsn(INVOKESPECIAL, "java/util/ArrayList", "<init>", "()V", false);
- mv.visitVarInsn(ASTORE, 2);
- Label l15 = new Label();
- mv.visitLabel(l15);
- mv.visitLineNumber(382, l15);
- mv.visitFieldInsn(GETSTATIC, "gregtech/api/util/GT_Utility", "sPlayedSoundMap", "Ljava/util/Map;");
- mv.visitMethodInsn(INVOKEINTERFACE, "java/util/Map", "entrySet", "()Ljava/util/Set;", true);
- mv.visitMethodInsn(INVOKEINTERFACE, "java/util/Set", "iterator", "()Ljava/util/Iterator;", true);
- mv.visitVarInsn(ASTORE, 4);
- Label l16 = new Label();
- mv.visitJumpInsn(GOTO, l16);
- Label l17 = new Label();
- mv.visitLabel(l17);
- mv.visitFrame(F_FULL, 5, new Object[] {"gregtech/common/GT_Client", "cpw/mods/fml/common/gameevent/TickEvent$PlayerTickEvent", "java/util/ArrayList", TOP, "java/util/Iterator"}, 0, new Object[] {});
- mv.visitVarInsn(ALOAD, 4);
- mv.visitMethodInsn(INVOKEINTERFACE, "java/util/Iterator", "next", "()Ljava/lang/Object;", true);
- mv.visitTypeInsn(CHECKCAST, "java/util/Map$Entry");
- mv.visitVarInsn(ASTORE, 3);
- Label l18 = new Label();
- mv.visitLabel(l18);
- mv.visitLineNumber(383, l18);
- mv.visitVarInsn(ALOAD, 3);
- mv.visitMethodInsn(INVOKEINTERFACE, "java/util/Map$Entry", "getValue", "()Ljava/lang/Object;", true);
- mv.visitTypeInsn(CHECKCAST, "java/lang/Integer");
- mv.visitMethodInsn(INVOKEVIRTUAL, "java/lang/Integer", "intValue", "()I", false);
- Label l19 = new Label();
- mv.visitJumpInsn(IFGE, l19);
- Label l20 = new Label();
- mv.visitLabel(l20);
- mv.visitLineNumber(384, l20);
- mv.visitVarInsn(ALOAD, 2);
- mv.visitVarInsn(ALOAD, 3);
- mv.visitMethodInsn(INVOKEINTERFACE, "java/util/Map$Entry", "getKey", "()Ljava/lang/Object;", true);
- mv.visitTypeInsn(CHECKCAST, "gregtech/api/util/GT_PlayedSound");
- mv.visitMethodInsn(INVOKEVIRTUAL, "java/util/ArrayList", "add", "(Ljava/lang/Object;)Z", false);
- mv.visitInsn(POP);
- Label l21 = new Label();
- mv.visitLabel(l21);
- mv.visitLineNumber(385, l21);
- mv.visitJumpInsn(GOTO, l16);
- mv.visitLabel(l19);
- mv.visitLineNumber(386, l19);
- mv.visitFrame(F_FULL, 5, new Object[] {"gregtech/common/GT_Client", "cpw/mods/fml/common/gameevent/TickEvent$PlayerTickEvent", "java/util/ArrayList", "java/util/Map$Entry", "java/util/Iterator"}, 0, new Object[] {});
- mv.visitVarInsn(ALOAD, 3);
- mv.visitVarInsn(ALOAD, 3);
- mv.visitMethodInsn(INVOKEINTERFACE, "java/util/Map$Entry", "getValue", "()Ljava/lang/Object;", true);
- mv.visitTypeInsn(CHECKCAST, "java/lang/Integer");
- mv.visitMethodInsn(INVOKEVIRTUAL, "java/lang/Integer", "intValue", "()I", false);
- mv.visitInsn(ICONST_1);
- mv.visitInsn(ISUB);
- mv.visitMethodInsn(INVOKESTATIC, "java/lang/Integer", "valueOf", "(I)Ljava/lang/Integer;", false);
- mv.visitMethodInsn(INVOKEINTERFACE, "java/util/Map$Entry", "setValue", "(Ljava/lang/Object;)Ljava/lang/Object;", true);
- mv.visitInsn(POP);
- mv.visitLabel(l16);
- mv.visitLineNumber(382, l16);
- mv.visitFrame(F_FULL, 5, new Object[] {"gregtech/common/GT_Client", "cpw/mods/fml/common/gameevent/TickEvent$PlayerTickEvent", "java/util/ArrayList", TOP, "java/util/Iterator"}, 0, new Object[] {});
- mv.visitVarInsn(ALOAD, 4);
- mv.visitMethodInsn(INVOKEINTERFACE, "java/util/Iterator", "hasNext", "()Z", true);
- mv.visitJumpInsn(IFNE, l17);
- Label l22 = new Label();
- mv.visitLabel(l22);
- mv.visitLineNumber(390, l22);
- mv.visitVarInsn(ALOAD, 2);
- mv.visitMethodInsn(INVOKEVIRTUAL, "java/util/ArrayList", "iterator", "()Ljava/util/Iterator;", false);
- mv.visitVarInsn(ASTORE, 4);
- Label l23 = new Label();
- mv.visitLabel(l23);
- Label l24 = new Label();
- mv.visitJumpInsn(GOTO, l24);
- Label l25 = new Label();
- mv.visitLabel(l25);
- mv.visitLineNumber(391, l25);
- mv.visitFrame(F_SAME, 0, null, 0, null);
- mv.visitVarInsn(ALOAD, 4);
- mv.visitMethodInsn(INVOKEINTERFACE, "java/util/Iterator", "next", "()Ljava/lang/Object;", true);
- mv.visitTypeInsn(CHECKCAST, "gregtech/api/util/GT_PlayedSound");
- mv.visitVarInsn(ASTORE, 3);
- Label l26 = new Label();
- mv.visitLabel(l26);
- mv.visitLineNumber(390, l26);
- mv.visitFieldInsn(GETSTATIC, "gregtech/api/util/GT_Utility", "sPlayedSoundMap", "Ljava/util/Map;");
- mv.visitVarInsn(ALOAD, 3);
- mv.visitMethodInsn(INVOKEINTERFACE, "java/util/Map", "remove", "(Ljava/lang/Object;)Ljava/lang/Object;", true);
- mv.visitInsn(POP);
- mv.visitLabel(l24);
- mv.visitFrame(F_SAME, 0, null, 0, null);
- mv.visitVarInsn(ALOAD, 4);
- mv.visitMethodInsn(INVOKEINTERFACE, "java/util/Iterator", "hasNext", "()Z", true);
- mv.visitJumpInsn(IFNE, l25);
- Label l27 = new Label();
- mv.visitLabel(l27);
- mv.visitLineNumber(393, l27);
- mv.visitFieldInsn(GETSTATIC, "gregtech/api/GregTech_API", "mServerStarted", "Z");
- mv.visitJumpInsn(IFNE, l4);
- Label l28 = new Label();
- mv.visitLabel(l28);
- mv.visitLineNumber(394, l28);
- mv.visitInsn(ICONST_1);
- mv.visitFieldInsn(PUTSTATIC, "gregtech/api/GregTech_API", "mServerStarted", "Z");
- mv.visitLabel(l4);
- mv.visitLineNumber(397, l4);
- mv.visitFrame(F_FULL, 2, new Object[] {"gregtech/common/GT_Client", "cpw/mods/fml/common/gameevent/TickEvent$PlayerTickEvent"}, 0, new Object[] {});
- mv.visitInsn(RETURN);
- Label l29 = new Label();
- mv.visitLabel(l29);
- mv.visitLocalVariable("this", "Lgregtech/common/GT_Client;", null, l3, l29, 0);
- mv.visitLocalVariable("aEvent", "Lcpw/mods/fml/common/gameevent/TickEvent$PlayerTickEvent;", null, l3, l29, 1);
- mv.visitLocalVariable("sfw", "Lnet/minecraft/stats/StatFileWriter;", null, l0, l7, 2);
- mv.visitLocalVariable("recipe", "Lgregtech/api/util/GT_Recipe;", null, l12, l10, 3);
- mv.visitLocalVariable("tList", "Ljava/util/ArrayList;", "Ljava/util/ArrayList<Lgregtech/api/util/GT_PlayedSound;>;", l15, l4, 2);
- mv.visitLocalVariable("tEntry", "Ljava/util/Map$Entry;", "Ljava/util/Map$Entry<Lgregtech/api/util/GT_PlayedSound;Ljava/lang/Integer;>;", l18, l16, 3);
- mv.visitLocalVariable("tKey", "Lgregtech/api/util/GT_PlayedSound;", null, l26, l24, 3);
- mv.visitLocalVariable("i", "Ljava/util/Iterator;", "Ljava/util/Iterator<Lgregtech/api/util/GT_PlayedSound;>;", l23, l27, 4);
- mv.visitMaxs(5, 5);
- mv.visitEnd();*/
+
+
- /**
- * Static invocation of custom handler instead
- */
- mv = cw.visitMethod(ACC_PUBLIC, "onPlayerTickEventClient", "(Lcpw/mods/fml/common/gameevent/TickEvent$PlayerTickEvent;)V", null, null);
- av0 = mv.visitAnnotation("Lcpw/mods/fml/common/eventhandler/SubscribeEvent;", true);
- av0.visitEnd();
- mv.visitCode();
- Label l0 = new Label();
- mv.visitLabel(l0);
- mv.visitLineNumber(371, l0);
- mv.visitVarInsn(ALOAD, 1);
- mv.visitMethodInsn(INVOKESTATIC, "gtPlusPlus/preloader/asm/transformers/ClassTransformer_GT_Client", "onPlayerTickEventClient", "(Lcpw/mods/fml/common/gameevent/TickEvent$PlayerTickEvent;)V", false);
- Label l1 = new Label();
- mv.visitLabel(l1);
- mv.visitLineNumber(372, l1);
- mv.visitInsn(RETURN);
- Label l2 = new Label();
- mv.visitLabel(l2);
- mv.visitLocalVariable("this", "Lgregtech/common/GT_Client;", null, l0, l2, 0);
- mv.visitLocalVariable("aEvent", "Lcpw/mods/fml/common/gameevent/TickEvent$PlayerTickEvent;", null, l0, l2, 1);
- mv.visitMaxs(1, 2);
- mv.visitEnd();
-
-
- didInject = true;
- FMLRelaunchLog.log("[GT++ ASM] Gregtech Achievements Patch", Level.INFO, "Method injection complete.");
+ FMLRelaunchLog.log("[GT++ ASM] Gregtech Client Proxy Patch", Level.INFO, "Method injection complete.");
return didInject;
}
@@ -474,11 +272,12 @@ public class ClassTransformer_GT_Client {
@Override
public MethodVisitor visitMethod(int access, String name, String desc, String signature, String[] exceptions) {
MethodVisitor methodVisitor;
- if (name.equals("onPlayerTickEventClient")) {
- FMLRelaunchLog.log("[GT++ ASM] Gregtech Achievements Patch", Level.INFO,
+ if (/*name.equals("onPlayerTickEventClient") || */name.equals("onPostLoad")) {
+ FMLRelaunchLog.log("[GT++ ASM] Gregtech Client Proxy Patch", Level.INFO,
"Found method " + name + ", removing.");
methodVisitor = null;
- } else {
+ }
+ else {
methodVisitor = super.visitMethod(access, name, desc, signature, exceptions);
}
return methodVisitor;
@@ -571,6 +370,31 @@ public class ClassTransformer_GT_Client {
}
}
}
+
+
+
+
+ /**
+ * GT_Client's onPostLoad
+ */
+
+ public static void onPostLoad() {
+ try {
+ for (int i = 0; i < GregTech_API.METATILEENTITIES.length; i++) {
+ try {
+ if (GregTech_API.METATILEENTITIES[i] != null) {
+ GregTech_API.METATILEENTITIES[i].getStackForm(1L).getTooltip((EntityPlayer) null, true);
+ }
+ }
+ catch (Throwable t) {
+ GT_Log.err.println("Error in MetaTileEntity with ID of "+i);
+ t.printStackTrace(GT_Log.err);
+ }
+ }
+ } catch (Throwable var2) {
+ var2.printStackTrace();
+ }
+ }
diff --git a/src/Java/gtPlusPlus/preloader/asm/transformers/ClassTransformer_GT_Utility.java b/src/Java/gtPlusPlus/preloader/asm/transformers/ClassTransformer_GT_Utility.java
new file mode 100644
index 0000000000..36c09688bc
--- /dev/null
+++ b/src/Java/gtPlusPlus/preloader/asm/transformers/ClassTransformer_GT_Utility.java
@@ -0,0 +1,117 @@
+package gtPlusPlus.preloader.asm.transformers;
+
+import static org.objectweb.asm.Opcodes.ACC_PUBLIC;
+import static org.objectweb.asm.Opcodes.ACC_STATIC;
+import static org.objectweb.asm.Opcodes.ASM5;
+import static org.objectweb.asm.Opcodes.INVOKESTATIC;
+import static org.objectweb.asm.Opcodes.IRETURN;
+import static org.objectweb.asm.Opcodes.LLOAD;
+
+import org.apache.logging.log4j.Level;
+import org.objectweb.asm.ClassReader;
+import org.objectweb.asm.ClassVisitor;
+import org.objectweb.asm.ClassWriter;
+import org.objectweb.asm.Label;
+import org.objectweb.asm.MethodVisitor;
+
+import cpw.mods.fml.relauncher.FMLRelaunchLog;
+
+public class ClassTransformer_GT_Utility {
+
+ private final boolean isValid;
+ private final ClassReader reader;
+ private final ClassWriter writer;
+ private final String className;
+
+ public ClassTransformer_GT_Utility(byte[] basicClass, String aClassName) {
+
+ className = aClassName;
+ ClassReader aTempReader = null;
+ ClassWriter aTempWriter = null;
+
+ aTempReader = new ClassReader(basicClass);
+ aTempWriter = new ClassWriter(aTempReader, ClassWriter.COMPUTE_FRAMES);
+ aTempReader.accept(new localClassVisitor(aTempWriter, className), 0);
+
+ if (aTempReader != null && aTempWriter != null) {
+ isValid = true;
+ } else {
+ isValid = false;
+ }
+
+ FMLRelaunchLog.log("[GT++ ASM] Gregtech Utilities Patch", Level.INFO, "Valid patch? " + isValid + ".");
+ reader = aTempReader;
+ writer = aTempWriter;
+
+ if (reader != null && writer != null) {
+ FMLRelaunchLog.log("[GT++ ASM] Gregtech Utilities Patch", Level.INFO, "Attempting Method Injection.");
+ injectMethod("getTier");
+ }
+
+ }
+
+ public boolean isValidTransformer() {
+ return isValid;
+ }
+
+ public ClassReader getReader() {
+ return reader;
+ }
+
+ public ClassWriter getWriter() {
+ return writer;
+ }
+
+ public boolean injectMethod(String aMethodName) {
+ MethodVisitor mv;
+ boolean didInject = false;
+ ClassWriter cw = getWriter();
+ FMLRelaunchLog.log("[GT++ ASM] Gregtech Utilities Patch", Level.INFO, "Injecting " + aMethodName + ".");
+ if (aMethodName.equals("getTier")) {
+ mv = cw.visitMethod(ACC_PUBLIC + ACC_STATIC, "getTier", "(J)B", null, null);
+ mv.visitCode();
+ Label l0 = new Label();
+ mv.visitLabel(l0);
+ mv.visitLineNumber(23, l0);
+ mv.visitVarInsn(LLOAD, 0);
+ mv.visitMethodInsn(INVOKESTATIC, "gtPlusPlus/core/util/Utils", "getTier", "(J)B", false);
+ mv.visitInsn(IRETURN);
+ Label l1 = new Label();
+ mv.visitLabel(l1);
+ mv.visitLocalVariable("l", "J", null, l0, l1, 0);
+ mv.visitMaxs(2, 2);
+ mv.visitEnd();
+ didInject = true;
+ }
+ FMLRelaunchLog.log("[GT++ ASM] Gregtech Utilities Patch", Level.INFO, "Method injection complete.");
+ return didInject;
+ }
+
+ public final class localClassVisitor extends ClassVisitor {
+
+ String aClassName;
+
+ public localClassVisitor(ClassVisitor cv, String aName) {
+ super(ASM5, cv);
+ aClassName = aName;
+ }
+
+ @Override
+ public MethodVisitor visitMethod(int access, String name, String desc, String signature, String[] exceptions) {
+ MethodVisitor methodVisitor;
+
+ if (name.equals("getTier")) {
+ methodVisitor = null;
+ } else {
+ methodVisitor = super.visitMethod(access, name, desc, signature, exceptions);
+ }
+
+ if (methodVisitor == null) {
+ FMLRelaunchLog.log("[GT++ ASM] Gregtech Utilities Patch", Level.INFO,
+ "Found method " + name + ", removing.");
+ }
+ return methodVisitor;
+ }
+ }
+
+}
diff --git a/src/Java/gtPlusPlus/preloader/asm/transformers/ClassTransformer_IC2_Hazmat.java b/src/Java/gtPlusPlus/preloader/asm/transformers/ClassTransformer_IC2_Hazmat.java
index 59edf8dec0..52e4d7d99d 100644
--- a/src/Java/gtPlusPlus/preloader/asm/transformers/ClassTransformer_IC2_Hazmat.java
+++ b/src/Java/gtPlusPlus/preloader/asm/transformers/ClassTransformer_IC2_Hazmat.java
@@ -115,6 +115,7 @@ public class ClassTransformer_IC2_Hazmat {
mv.visitLocalVariable("living", "L"+aEntityLivingBase+";", null, l0, l1, 0);
mv.visitMaxs(1, 1);
mv.visitEnd();
+ didInject = true;
}
FMLRelaunchLog.log("[GT++ ASM] IC2 Hazmat Patch", Level.INFO, "Method injection complete.");
return didInject;
diff --git a/src/Java/gtPlusPlus/preloader/asm/transformers/Preloader_Transformer_Handler.java b/src/Java/gtPlusPlus/preloader/asm/transformers/Preloader_Transformer_Handler.java
index 3f5897d590..5642b700f5 100644
--- a/src/Java/gtPlusPlus/preloader/asm/transformers/Preloader_Transformer_Handler.java
+++ b/src/Java/gtPlusPlus/preloader/asm/transformers/Preloader_Transformer_Handler.java
@@ -122,15 +122,23 @@ public class Preloader_Transformer_Handler implements IClassTransformer {
* Gregtech ASM Patches
*/
+ //Make GT_Utilities safer
+ if (transformedName.equals("gtPlusPlus.preloader.asm.transformers.ClassTransformer_GT_Utility")) {
+ FMLRelaunchLog.log("[GT++ ASM] Gregtech Utilities Patch", Level.INFO, "Transforming %s", transformedName);
+ return new ClassTransformer_GT_Utility(basicClass, transformedName).getWriter().toByteArray();
+ }
//Try patch achievements
if (transformedName.equals("gregtech.loaders.misc.GT_Achievements")) {
FMLRelaunchLog.log("[GT++ ASM] Gregtech Achievements Patch", Level.INFO, "Transforming %s", transformedName);
return new ClassTransformer_GT_Achievements_CrashFix(basicClass, obfuscated).getWriter().toByteArray();
}
- /*if (transformedName.equals("gregtech.common.GT_Client")) {
- FMLRelaunchLog.log("[GT++ ASM] Gregtech Achievements Patch", Level.INFO, "Transforming %s", transformedName);
- return new ClassTransformer_GT_Client(basicClass).getByteArray();
- }*/
+
+ //Fix bad handling of a loop left from original decompilation
+ //Also Fix Achievements, although currently disabled.
+ if (transformedName.equals("gregtech.common.GT_Client")) {
+ FMLRelaunchLog.log("[GT++ ASM] Gregtech Client Proxy Patch", Level.INFO, "Transforming %s", transformedName);
+ return new ClassTransformer_GT_Client(basicClass, obfuscated).getByteArray();
+ }
//Make GT packets safer, fill them with debug info.
if (transformedName.equals("gregtech.api.net.GT_Packet_TileEntity")) {
diff --git a/src/Java/gtPlusPlus/xmod/gregtech/api/metatileentity/implementations/base/GregtechMeta_MultiBlockBase.java b/src/Java/gtPlusPlus/xmod/gregtech/api/metatileentity/implementations/base/GregtechMeta_MultiBlockBase.java
index 516f78038d..e352712138 100644
--- a/src/Java/gtPlusPlus/xmod/gregtech/api/metatileentity/implementations/base/GregtechMeta_MultiBlockBase.java
+++ b/src/Java/gtPlusPlus/xmod/gregtech/api/metatileentity/implementations/base/GregtechMeta_MultiBlockBase.java
@@ -577,6 +577,7 @@ GT_MetaTileEntity_MultiBlockBase {
tTier = (byte) aControlCoreTier;
}
+ tTier = (byte) MathUtils.getValueWithinRange(tTier, 0, 9);
GT_Recipe tRecipe = aRecipe != null ? aRecipe : findRecipe(
getBaseMetaTileEntity(), mLastRecipe, false,
@@ -1922,8 +1923,8 @@ GT_MetaTileEntity_MultiBlockBase {
return true;
}
else if (aFoundBlock != aExpectedBlock) {
- log("A1 - Found: "+aFoundBlock.getLocalizedName()+":"+aFoundMeta+", Expected: "+aExpectedBlock.getLocalizedName()+":"+aExpectedMeta);
if (GTplusplus.CURRENT_LOAD_PHASE == INIT_PHASE.STARTED) {
+ log("A1 - Found: "+aFoundBlock.getLocalizedName()+":"+aFoundMeta+", Expected: "+aExpectedBlock.getLocalizedName()+":"+aExpectedMeta);
log("Loc: "+(new BlockPos(aBaseMetaTileEntity).getLocationString()));
}
return false;
diff --git a/src/Java/gtPlusPlus/xmod/gregtech/common/blocks/GregtechMetaCasingBlocks2.java b/src/Java/gtPlusPlus/xmod/gregtech/common/blocks/GregtechMetaCasingBlocks2.java
index 8dd52c7074..528aed2029 100644
--- a/src/Java/gtPlusPlus/xmod/gregtech/common/blocks/GregtechMetaCasingBlocks2.java
+++ b/src/Java/gtPlusPlus/xmod/gregtech/common/blocks/GregtechMetaCasingBlocks2.java
@@ -60,7 +60,7 @@ extends GregtechMetaCasingBlocksAbstract {
GT_LanguageManager.addStringLocalization(this.getUnlocalizedName() + ".12.name", "Autocrafter Frame");
GT_LanguageManager.addStringLocalization(this.getUnlocalizedName() + ".13.name", "Cutting Factory Frame");
GT_LanguageManager.addStringLocalization(this.getUnlocalizedName() + ".14.name", "Tesla Containment Casing");
- GT_LanguageManager.addStringLocalization(this.getUnlocalizedName() + ".15.name", "Casing "); //Tree Farmer Textures
+ GT_LanguageManager.addStringLocalization(this.getUnlocalizedName() + ".15.name", "Sterile Farm Casing"); //Tree Farmer Textures
GregtechItemList.Casing_ThermalCentrifuge.set(new ItemStack(this, 1, 0));
GregtechItemList.Casing_Refinery_External.set(new ItemStack(this, 1, 1));
GregtechItemList.Casing_Refinery_Structural.set(new ItemStack(this, 1, 2));
diff --git a/src/Java/gtPlusPlus/xmod/gregtech/common/blocks/textures/CasingTextureHandler2.java b/src/Java/gtPlusPlus/xmod/gregtech/common/blocks/textures/CasingTextureHandler2.java
index 8f107b8ab6..1c7109fad2 100644
--- a/src/Java/gtPlusPlus/xmod/gregtech/common/blocks/textures/CasingTextureHandler2.java
+++ b/src/Java/gtPlusPlus/xmod/gregtech/common/blocks/textures/CasingTextureHandler2.java
@@ -60,7 +60,8 @@ public class CasingTextureHandler2 {
case 14:
return TexturesGtBlock.Casing_Material_RedSteel.getIcon();
case 15:
- if (aSide <2) {
+ return TexturesGtBlock.Casing_Machine_Acacia_Log.getIcon();
+ /*if (aSide <2) {
if (aSide == 1) {
return TexturesGtBlock.Casing_Machine_Podzol.getIcon();
}
@@ -68,7 +69,7 @@ public class CasingTextureHandler2 {
}
else {
return TexturesGtBlock.Casing_Machine_Farm_Manager.getIcon();
- }
+ }*/
default:
return TexturesGtBlock.Overlay_UU_Matter.getIcon();
diff --git a/src/Java/gtPlusPlus/xmod/gregtech/common/helpers/TreeFarmHelper.java b/src/Java/gtPlusPlus/xmod/gregtech/common/helpers/TreeFarmHelper.java
index 624058f356..a87fac1dfd 100644
--- a/src/Java/gtPlusPlus/xmod/gregtech/common/helpers/TreeFarmHelper.java
+++ b/src/Java/gtPlusPlus/xmod/gregtech/common/helpers/TreeFarmHelper.java
@@ -285,6 +285,37 @@ public class TreeFarmHelper {
}
return SAWTOOL.NONE;
}
+
+ public static boolean isCorrectPart(final ItemStack aStack) {
+ if (aStack != null){
+ //Utils.LOG_WARNING("Found "+aStack.getDisplayName()+" in the GUI slot.");
+ if ((aStack.getItem() instanceof GT_MetaGenerated_Item_02) || (aStack.getItem() instanceof GT_MetaGenerated_Tool)){
+ if (OrePrefixes.craftingTool.contains(aStack)){
+ if (aStack.getDisplayName().toLowerCase().contains("saw") || aStack.getDisplayName().toLowerCase().contains("gt.metatool.01")){
+ if (aStack.getItemDamage() == 10){
+ return true;
+ }
+ else if (aStack.getItemDamage() == 140 || aStack.getDisplayName().toLowerCase().contains("gt.metatool.01.140")){
+ return true;
+ }
+ else if (aStack.getItemDamage() == 110 || aStack.getDisplayName().toLowerCase().contains("gt.metatool.01.110")){
+ return true;
+ }
+ else if (aStack.getItemDamage() == 112 || aStack.getDisplayName().toLowerCase().contains("gt.metatool.01.112")){
+ return true;
+ }
+ else if (aStack.getItemDamage() == 114 || aStack.getDisplayName().toLowerCase().contains("gt.metatool.01.114")){
+ return true;
+ }
+ else {
+ return false;
+ }
+ }
+ }
+ }
+ }
+ return false;
+ }
public static boolean isHumusLoaded = false;
public static boolean isForestryLogsLoaded = false;
diff --git a/src/Java/gtPlusPlus/xmod/gregtech/common/helpers/treefarm/TreeGenerator.java b/src/Java/gtPlusPlus/xmod/gregtech/common/helpers/treefarm/TreeGenerator.java
index 7437bf19da..b94ebf2918 100644
--- a/src/Java/gtPlusPlus/xmod/gregtech/common/helpers/treefarm/TreeGenerator.java
+++ b/src/Java/gtPlusPlus/xmod/gregtech/common/helpers/treefarm/TreeGenerator.java
@@ -2,10 +2,15 @@ package gtPlusPlus.xmod.gregtech.common.helpers.treefarm;
import java.util.Random;
+import gtPlusPlus.api.objects.Logger;
import gtPlusPlus.api.objects.data.AutoMap;
+import gtPlusPlus.api.objects.minecraft.FakeBlockPos;
+import gtPlusPlus.api.objects.minecraft.FakeWorld;
import gtPlusPlus.core.lib.CORE;
+import gtPlusPlus.core.util.math.MathUtils;
import net.minecraft.block.Block;
import net.minecraft.block.BlockSapling;
+import net.minecraft.block.material.Material;
import net.minecraft.init.Blocks;
import net.minecraft.item.ItemStack;
import net.minecraft.util.Direction;
@@ -15,14 +20,32 @@ import net.minecraftforge.common.util.ForgeDirection;
public class TreeGenerator {
- public static AutoMap<ItemStack> generateOutput(int aTreeSize){
- AutoMap<ItemStack> aOutputMap = new AutoMap<ItemStack>();
-
-
- return aOutputMap;
+ private static final FakeTreeInFakeWorldGenerator mTreeData;
+
+ static {
+ Logger.WARNING("Created Fake Tree Generator.");
+ mTreeData = new FakeTreeInFakeWorldGenerator();
}
- public class FakeWorldGenerator extends WorldGenAbstractTree
+
+ public TreeGenerator() {
+ if (!mTreeData.hasGenerated) {
+ mTreeData.generate(null, CORE.RANDOM, 0, 0, 0);
+ }
+ }
+
+ public AutoMap<ItemStack> generateOutput(int aTreeSize){
+ AutoMap<ItemStack> aTemp = new AutoMap<ItemStack>();
+ AutoMap<ItemStack> aOutputMap = mTreeData.getOutputFromTree();
+ if (aOutputMap != null && aOutputMap.size() > 0) {
+ Logger.WARNING("Valid tree data output");
+ return aOutputMap;
+ }
+ Logger.WARNING("Invalid tree data output");
+ return aTemp;
+ }
+
+ public static class FakeTreeInFakeWorldGenerator extends WorldGenAbstractTree
{
/** The minimum height of a generated tree. */
private final int minTreeHeight;
@@ -33,42 +56,105 @@ public class TreeGenerator {
/** The metadata value of the leaves to use in tree generation. */
private final int metaLeaves;
+ private final AutoMap<FakeWorld> mFakeWorld;
+ private final int mTreesToGenerate;
+
+ private int mCurrentGeneratorIteration = 0;
+
private boolean hasGenerated = false;
private AutoMap<ItemStack> aOutputsFromGenerator = new AutoMap<ItemStack>();
- public FakeWorldGenerator()
+ public FakeTreeInFakeWorldGenerator()
{
- this(4, 0, 0, false);
+ this(4, 0, 0, false, 5000);
}
- public FakeWorldGenerator(int aMinHeight, int aWoodMeta, int aLeafMeta, boolean aVines)
+ public FakeTreeInFakeWorldGenerator(int aMinHeight, int aWoodMeta, int aLeafMeta, boolean aVines, int aTreeCount)
{
super(false);
this.minTreeHeight = aMinHeight;
this.metaWood = aWoodMeta;
this.metaLeaves = aLeafMeta;
this.vinesGrow = aVines;
+ this.mFakeWorld = new AutoMap<FakeWorld>();
+ this.mTreesToGenerate = aTreeCount;
+ Logger.WARNING("Created Fake Tree In Fake World Instance.");
}
public AutoMap<ItemStack> getOutputFromTree(){
if (!hasGenerated) {
+ Logger.WARNING("Generating Tree sample data");
generate(null, CORE.RANDOM, 0, 0, 0);
}
- return aOutputsFromGenerator;
+ AutoMap<ItemStack> aOutputMap = new AutoMap<ItemStack>();
+ int aRandomTreeID = MathUtils.randInt(0, this.mFakeWorld.size()-1);
+ FakeWorld aWorld = this.mFakeWorld.get(aRandomTreeID);
+ if (aWorld != null) {
+ //Logger.WARNING("Getting all block data from fake world");
+ aOutputMap = aWorld.getAllBlocksStoredInFakeWorld();
+ }
+ return aOutputMap;
+
}
+ @Override
+ protected boolean func_150523_a(Block p_150523_1_)
+ {
+ return p_150523_1_.getMaterial() == Material.air || p_150523_1_.getMaterial() == Material.leaves || p_150523_1_ == Blocks.grass || p_150523_1_ == Blocks.dirt || p_150523_1_ == Blocks.log || p_150523_1_ == Blocks.log2 || p_150523_1_ == Blocks.sapling || p_150523_1_ == Blocks.vine;
+ }
+
+ @Override
+ protected boolean isReplaceable(World world, int x, int y, int z)
+ {
+ FakeWorld aWorld = getWorld();
+ Block block = aWorld.getBlock(x, y, z);
+ return block.isAir(null, x, y, z) || block.isLeaves(null, x, y, z) || block.isWood(null, x, y, z) || func_150523_a(block);
+ }
@Override
- public boolean generate(World aWorld, Random aRand, int aWorldX, int aWorldRealY, int aWorldZ){
-
+ public boolean generate(World world, Random aRand, int aWorldX, int aWorldRealY, int aWorldZ){
//Only Generate Once - This object is Cached
if (hasGenerated) {
return hasGenerated;
+ }
+ else {
+ for (int yy=0;yy<mTreesToGenerate;yy++) {
+ generateTree(0, 0, 0);
+ mCurrentGeneratorIteration++;
+ }
+ hasGenerated = true;
+ if (this.mFakeWorld.size() > 0) {
+ for (FakeWorld aWorld : this.mFakeWorld) {
+ for (ItemStack aBlockInFakeWorld : aWorld.getAllBlocksStoredInFakeWorld()) {
+ aOutputsFromGenerator.add(aBlockInFakeWorld);
+ }
+ }
+ return true;
+ }
+ else {
+ return false;
+ }
+ }
+ }
+
+ private FakeWorld aFakeWorld;
+
+ public FakeWorld getWorld() {
+ FakeWorld aWorld = this.mFakeWorld.get(mCurrentGeneratorIteration);
+ if (aWorld == null) {
+ this.mFakeWorld.set(mCurrentGeneratorIteration, new FakeWorld(200));
+ aWorld = this.mFakeWorld.get(mCurrentGeneratorIteration);
}
+ return aWorld;
+ }
+
+ public boolean generateTree(int aWorldX, int aWorldRealY, int aWorldZ) {
+ FakeWorld aWorld = getWorld();
//Set some static values
-
+
+ Logger.WARNING("Stepping through generateTree [0]");
//Dummy Value
int aWorldY = 10;
@@ -77,6 +163,7 @@ public class TreeGenerator {
if (aWorldY >= 1 && aWorldY + l + 1 <= 256)
{
+ Logger.WARNING("Stepping through generateTree [1]");
byte b0;
int k1;
Block block;
@@ -103,7 +190,7 @@ public class TreeGenerator {
{
block = aWorld.getBlock(j1, i1, k1);
- if (!this.isReplaceable(aWorld, j1, i1, k1))
+ if (!this.isReplaceable(null, j1, i1, k1))
{
flag = false;
}
@@ -118,16 +205,20 @@ public class TreeGenerator {
if (!flag)
{
+ Logger.WARNING("Stepping through generateTree [2]");
return false;
}
else
{
+ Logger.WARNING("Stepping through generateTree [3]");
Block block2 = aWorld.getBlock(aWorldX, aWorldY - 1, aWorldZ);
+ FakeBlockPos aBlockToGrowPlantOn = aWorld.getBlockAtCoords(aWorldX, aWorldY-1, aWorldZ);
boolean isSoil = block2.canSustainPlant(aWorld, aWorldX, aWorldY - 1, aWorldZ, ForgeDirection.UP, (BlockSapling)Blocks.sapling);
- if (isSoil && aWorldY < 256 - l - 1)
+ if (/*isSoil &&*/ aWorldY < 256 - l - 1)
{
- block2.onPlantGrow(aWorld, aWorldX, aWorldY - 1, aWorldZ, aWorldX, aWorldY, aWorldZ);
+ Logger.WARNING("Stepping through generateTree [4]");
+ aBlockToGrowPlantOn.onPlantGrow(aWorld, aWorldX, aWorldY - 1, aWorldZ, aWorldX, aWorldY, aWorldZ);
b0 = 3;
byte b1 = 0;
int l1;
@@ -152,7 +243,7 @@ public class TreeGenerator {
{
Block block1 = aWorld.getBlock(i2, k1, k2);
- if (block1.isAir(aWorld, i2, k1, k2) || block1.isLeaves(aWorld, i2, k1, k2))
+ if (block1.isAir(null, i2, k1, k2) || block1.isLeaves(null, i2, k1, k2))
{
this.setBlockAndNotifyAdequately(aWorld, i2, k1, k2, Blocks.leaves, this.metaLeaves);
}
@@ -160,12 +251,13 @@ public class TreeGenerator {
}
}
}
+ Logger.WARNING("Stepping through generateTree [5]");
for (k1 = 0; k1 < l; ++k1)
{
block = aWorld.getBlock(aWorldX, aWorldY + k1, aWorldZ);
- if (block.isAir(aWorld, aWorldX, aWorldY + k1, aWorldZ) || block.isLeaves(aWorld, aWorldX, aWorldY + k1, aWorldZ))
+ if (block.isAir(null, aWorldX, aWorldY + k1, aWorldZ) || block.isLeaves(null, aWorldX, aWorldY + k1, aWorldZ))
{
this.setBlockAndNotifyAdequately(aWorld, aWorldX, aWorldY + k1, aWorldZ, Blocks.log, this.metaWood);
@@ -193,9 +285,11 @@ public class TreeGenerator {
}
}
}
+ Logger.WARNING("Stepping through generateTree [6]");
if (this.vinesGrow)
{
+ Logger.WARNING("Stepping through generateTree [7]");
for (k1 = aWorldY - 3 + l; k1 <= aWorldY + l; ++k1)
{
i3 = k1 - (aWorldY + l);
@@ -205,24 +299,24 @@ public class TreeGenerator {
{
for (j2 = aWorldZ - l1; j2 <= aWorldZ + l1; ++j2)
{
- if (aWorld.getBlock(i2, k1, j2).isLeaves(aWorld, i2, k1, j2))
+ if (aWorld.getBlock(i2, k1, j2).isLeaves(null, i2, k1, j2))
{
- if (CORE.RANDOM.nextInt(4) == 0 && aWorld.getBlock(i2 - 1, k1, j2).isAir(aWorld, i2 - 1, k1, j2))
+ if (CORE.RANDOM.nextInt(4) == 0 && aWorld.getBlock(i2 - 1, k1, j2).isAir(null, i2 - 1, k1, j2))
{
this.growVines(aWorld, i2 - 1, k1, j2, 8);
}
- if (CORE.RANDOM.nextInt(4) == 0 && aWorld.getBlock(i2 + 1, k1, j2).isAir(aWorld, i2 + 1, k1, j2))
+ if (CORE.RANDOM.nextInt(4) == 0 && aWorld.getBlock(i2 + 1, k1, j2).isAir(null, i2 + 1, k1, j2))
{
this.growVines(aWorld, i2 + 1, k1, j2, 2);
}
- if (CORE.RANDOM.nextInt(4) == 0 && aWorld.getBlock(i2, k1, j2 - 1).isAir(aWorld, i2, k1, j2 - 1))
+ if (CORE.RANDOM.nextInt(4) == 0 && aWorld.getBlock(i2, k1, j2 - 1).isAir(null, i2, k1, j2 - 1))
{
this.growVines(aWorld, i2, k1, j2 - 1, 1);
}
- if (CORE.RANDOM.nextInt(4) == 0 && aWorld.getBlock(i2, k1, j2 + 1).isAir(aWorld, i2, k1, j2 + 1))
+ if (CORE.RANDOM.nextInt(4) == 0 && aWorld.getBlock(i2, k1, j2 + 1).isAir(null, i2, k1, j2 + 1))
{
this.growVines(aWorld, i2, k1, j2 + 1, 4);
}
@@ -230,6 +324,7 @@ public class TreeGenerator {
}
}
}
+ Logger.WARNING("Stepping through generateTree [8]");
if (CORE.RANDOM.nextInt(5) == 0 && l > 5)
{
@@ -246,48 +341,45 @@ public class TreeGenerator {
}
}
}
-
- hasGenerated = true;
+ Logger.WARNING("Stepping through generateTree [9]");
return true;
}
else
{
+ Logger.WARNING("Stepping through generateTree [10]");
return false;
}
}
}
else
{
+ Logger.WARNING("Stepping through generateTree [11]");
return false;
}
}
- /**
+ /**
* Grows vines downward from the given block for a given length. Args: World, x, starty, z, vine-length
*/
- private void growVines(World aWorld, int aX, int aY, int aZ, int aMeta)
+ private void growVines(FakeWorld aWorld, int aX, int aY, int aZ, int aMeta)
{
- this.setBlockAndNotifyAdequately(aWorld, aX, aY, aZ, Blocks.vine, aMeta);
- int i1 = 4;
-
- while (true)
- {
- --aY;
-
- if (!aWorld.getBlock(aX, aY, aZ).isAir(aWorld, aX, aY, aZ) || i1 <= 0)
- {
- return;
- }
-
- this.setBlockAndNotifyAdequately(aWorld, aX, aY, aZ, Blocks.vine, aMeta);
- --i1;
+ int aLoopSize = vinesGrow ? MathUtils.randInt(0, 4) : 0;
+ for (int i=0;i<aLoopSize;i++) {
+ this.setBlockAndNotifyAdequately(aWorld, aX, aY, aZ, Blocks.vine, aMeta);
}
}
@Override
- protected void setBlockAndNotifyAdequately(World aWorld, int aX, int aY, int aZ, Block aBlock, int aMeta) {
-
- super.setBlockAndNotifyAdequately(aWorld, aX, aY, aZ, aBlock, aMeta);
+ protected void setBlockAndNotifyAdequately(World aWorld, int aX, int aY, int aZ, Block aBlock, int aMeta) {
+ setBlockAndNotifyAdequately(getWorld(), aX, aY, aZ, aBlock, aMeta);
+ }
+
+ protected void setBlockAndNotifyAdequately(FakeWorld aWorld, int aX, int aY, int aZ, Block aBlock, int aMeta) {
+ if (aBlock != null && (aMeta >= 0 && aMeta <= Short.MAX_VALUE)) {
+ Logger.WARNING("Setting block "+aX+", "+aY+", "+aZ+" | "+aBlock.getLocalizedName()+" | "+aMeta);
+ aWorld.setBlockAtCoords(aX, aY, aZ, aBlock, aMeta);
+ //aOutputsFromGenerator.put(ItemUtils.simpleMetaStack(aBlock, aMeta, 1));
+ }
}
}
diff --git a/src/Java/gtPlusPlus/xmod/gregtech/common/tileentities/machines/multi/production/GregtechMetaTileEntityTreeFarm.java b/src/Java/gtPlusPlus/xmod/gregtech/common/tileentities/machines/multi/production/GregtechMetaTileEntityTreeFarm.java
index 9081e6bc64..fc4611686f 100644
--- a/src/Java/gtPlusPlus/xmod/gregtech/common/tileentities/machines/multi/production/GregtechMetaTileEntityTreeFarm.java
+++ b/src/Java/gtPlusPlus/xmod/gregtech/common/tileentities/machines/multi/production/GregtechMetaTileEntityTreeFarm.java
@@ -1,48 +1,103 @@
package gtPlusPlus.xmod.gregtech.common.tileentities.machines.multi.production;
+import java.util.concurrent.Executors;
+import java.util.concurrent.ScheduledExecutorService;
+import java.util.concurrent.TimeUnit;
+
import gregtech.api.GregTech_API;
-import gregtech.api.enums.GT_Values;
import gregtech.api.enums.TAE;
+import gregtech.api.enums.Textures;
+import gregtech.api.interfaces.IIconContainer;
import gregtech.api.interfaces.ITexture;
+import gregtech.api.interfaces.metatileentity.IMetaTileEntity;
import gregtech.api.interfaces.tileentity.IGregTechTileEntity;
-import gregtech.api.metatileentity.MetaTileEntity;
-import gregtech.api.metatileentity.implementations.GT_MetaTileEntity_Hatch_Energy;
-import gregtech.api.objects.GT_ItemStack;
import gregtech.api.objects.GT_RenderedTexture;
import gregtech.api.util.GT_Recipe;
+import gregtech.api.util.GT_Utility;
import gtPlusPlus.api.objects.Logger;
-import gtPlusPlus.api.objects.minecraft.BlockPos;
+import gtPlusPlus.api.objects.data.AutoMap;
+import gtPlusPlus.api.objects.minecraft.ThreadFakeWorldGenerator;
import gtPlusPlus.core.block.ModBlocks;
-import gtPlusPlus.core.slots.SlotBuzzSaw.SAWTOOL;
-import gtPlusPlus.xmod.gregtech.api.gui.CONTAINER_TreeFarmer;
-import gtPlusPlus.xmod.gregtech.api.gui.GUI_TreeFarmer;
+import gtPlusPlus.core.util.math.MathUtils;
+import gtPlusPlus.core.util.minecraft.FluidUtils;
+import gtPlusPlus.core.util.minecraft.ItemUtils;
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.treefarm.TreeGenerator;
import net.minecraft.block.Block;
-import net.minecraft.entity.player.EntityPlayer;
-import net.minecraft.entity.player.InventoryPlayer;
+import net.minecraft.init.Blocks;
import net.minecraft.item.ItemStack;
-import net.minecraft.nbt.NBTTagCompound;
+import net.minecraftforge.common.util.ForgeDirection;
+import net.minecraftforge.fluids.FluidStack;
public class GregtechMetaTileEntityTreeFarm extends GregtechMeta_MultiBlockBase {
- public final static int TEX_INDEX = 31;
- protected boolean mIsCurrentlyWorking = false;
-
-
-
+ public static int CASING_TEXTURE_ID;
+ public static String mCryoFuelName = "Gelid Cryotheum";
+ public static String mCasingName = "Advanced Cryogenic Casing";
+ public static String mHatchName = "Cryotheum Hatch";
+ public static FluidStack mFuelStack;
+ public static TreeGenerator mTreeData;
public GregtechMetaTileEntityTreeFarm(final int aID, final String aName, final String aNameRegional) {
super(aID, aName, aNameRegional);
+ mFuelStack = FluidUtils.getFluidStack("cryotheum", 1);
+ CASING_TEXTURE_ID = TAE.getIndexFromPage(1, 15);
+ mCryoFuelName = mFuelStack.getLocalizedName();
+ mCasingName = ItemUtils.getLocalizedNameOfBlock(ModBlocks.blockCasings2Misc, 15);
+ mHatchName = ItemUtils.getLocalizedNameOfBlock(GregTech_API.sBlockMachines, 967);
}
+
+
+ /*
+ * Static thread for Fake World Handling
+ */
+
+
+ private static ScheduledExecutorService executor;
+ private static ThreadFakeWorldGenerator aThread;
+
public GregtechMetaTileEntityTreeFarm(final String aName) {
super(aName);
+ mFuelStack = FluidUtils.getFluidStack("cryotheum", 1);
+ CASING_TEXTURE_ID = TAE.getIndexFromPage(1, 15);
+ mCryoFuelName = mFuelStack.getLocalizedName();
+ mCasingName = ItemUtils.getLocalizedNameOfBlock(ModBlocks.blockCasings2Misc, 15);
+ mHatchName = ItemUtils.getLocalizedNameOfBlock(GregTech_API.sBlockMachines, 967);
+
+ /*if (executor == null || mTreeData == null) {
+ if (executor == null) {
+ executor = Executors.newScheduledThreadPool(10);
+ }
+ if (executor != null) {
+ if (aThread == null) {
+ aThread = new ThreadFakeWorldGenerator();
+ executor.scheduleAtFixedRate(aThread, 0, 1, TimeUnit.SECONDS);
+ while (aThread.mGenerator == null) {
+ if (aThread.mGenerator != null) {
+ break;
+ }
+ }
+ if (aThread.mGenerator != null) {
+ mTreeData = aThread.mGenerator;
+ }
+ }
+ }
+ }*/
+
+ if (mTreeData == null) {
+ mTreeData = new TreeGenerator();
+ }
+
+
+
+
}
- public boolean isCurrentlyWorking() {
- return this.mIsCurrentlyWorking;
+ public IMetaTileEntity newMetaEntity(final IGregTechTileEntity aTileEntity) {
+ return (IMetaTileEntity) new GregtechMetaTileEntityTreeFarm(this.mName);
}
@Override
@@ -50,206 +105,136 @@ public class GregtechMetaTileEntityTreeFarm extends GregtechMeta_MultiBlockBase
return "Tree Farm";
}
- @Override
public String[] getTooltip() {
- return new String[]{
- "THIS MULTIBLOCK IS DISABLED - DO NOT BUILD",
- };
- }
- @Override
- public long maxEUStore() {
- return 3244800; //13*13*150*128
- }
-
- @Override
- public boolean drainEnergyInput(final long aEU) {
- if (aEU <= 0L) {
- return true;
+ if (mCasingName.toLowerCase().contains(".name")) {
+ mCasingName = ItemUtils.getLocalizedNameOfBlock(ModBlocks.blockCasings2Misc, 15);
}
-
- //Special Override, so that this function uses internally stored power first.
- if (this.getEUVar() >= aEU) {
- this.setEUVar(this.getEUVar()-aEU);
- return true;
+ if (mCryoFuelName.toLowerCase().contains(".")) {
+ mCryoFuelName = FluidUtils.getFluidStack("cryotheum", 1).getLocalizedName();
}
-
- for (final GT_MetaTileEntity_Hatch_Energy tHatch : this.mEnergyHatches) {
- if (isValidMetaTileEntity((MetaTileEntity) tHatch)
- && tHatch.getBaseMetaTileEntity().decreaseStoredEnergyUnits(aEU, false)) {
- return true;
- }
+ if (mHatchName.toLowerCase().contains(".name")) {
+ mHatchName = ItemUtils.getLocalizedNameOfBlock(GregTech_API.sBlockMachines, 967);
}
- return false;
+
+ return new String[]{
+ "Factory Grade Tree Growth Simulator",
+ "Speed: Very Fast | Eu Usage: 100% | Parallel: 1",
+ //"Consumes 1L of "+mCryoFuelName+"/t during operation",
+ "Constructed exactly the same as a normal Vacuum Freezer",
+ "Use "+mCasingName+"s (10 at least!)",
+ "1x " + mHatchName + " (Required)",
+ "TAG_HIDE_HATCHES"
+ };
}
- @Override
- public ITexture[] getTexture(final IGregTechTileEntity aBaseMetaTileEntity, final byte aSide, final byte aFacing, final byte aColorIndex, final boolean aActive, final boolean aRedstone) {
- if (aSide == 0) {
- return new ITexture[]{new GT_RenderedTexture(TexturesGtBlock.Casing_Machine_Acacia_Log)};
+ public ITexture[] getTexture(final IGregTechTileEntity aBaseMetaTileEntity, final byte aSide, final byte aFacing,
+ final byte aColorIndex, final boolean aActive, final boolean aRedstone) {
+ if (aSide == aFacing) {
+ return new ITexture[]{Textures.BlockIcons.CASING_BLOCKS[CASING_TEXTURE_ID],
+ new GT_RenderedTexture((IIconContainer) (aActive ? TexturesGtBlock.Overlay_Machine_Controller_Advanced_Active : TexturesGtBlock.Overlay_Machine_Controller_Advanced))};
}
- if (aSide == 1) {
- return new ITexture[]{new GT_RenderedTexture(TexturesGtBlock.Casing_Machine_Acacia_Log), new GT_RenderedTexture(isCurrentlyWorking() ? TexturesGtBlock.Overlay_Machine_Vent_Fast : TexturesGtBlock.Overlay_Machine_Vent)};
- }
- return new ITexture[]{new GT_RenderedTexture(TexturesGtBlock.Casing_Machine_Farm_Manager)};
- }
-
- @Override
- public GT_Recipe.GT_Recipe_Map getRecipeMap() {
- return null;
+ return new ITexture[]{Textures.BlockIcons.CASING_BLOCKS[CASING_TEXTURE_ID]};
}
-
- @Override
- public void loadNBTData(NBTTagCompound arg0) {
- super.loadNBTData(arg0);
- }
-
-
@Override
- public void saveNBTData(NBTTagCompound arg0) {
- super.saveNBTData(arg0);
- }
-
- @Override
- public boolean isAccessAllowed(final EntityPlayer aPlayer) {
+ public boolean hasSlotInGUI() {
return true;
}
-
- @Override
- public boolean allowCoverOnSide(final byte aSide, final GT_ItemStack aCoverID) {
- return (GregTech_API.getCoverBehavior(aCoverID.toStack()).isSimpleCover()) && (super.allowCoverOnSide(aSide, aCoverID));
- }
-
- @Override
- public MetaTileEntity newMetaEntity(final IGregTechTileEntity aTileEntity) {
- return new GregtechMetaTileEntityTreeFarm(this.mName);
- }
-
+
@Override
- public boolean hasSlotInGUI() {
+ public boolean requiresVanillaGtGUI() {
return true;
}
@Override
public String getCustomGUIResourceName() {
- return "TreeFarmer";
- }
-
- @Override
- public Object getClientGUI(final int aID, final InventoryPlayer aPlayerInventory, final IGregTechTileEntity aBaseMetaTileEntity) {
- return new GUI_TreeFarmer(aPlayerInventory, aBaseMetaTileEntity, this.getLocalName(), "TreeFarmer.png");
+ return "VacuumFreezer";
}
- @Override
- public Object getServerGUI(final int aID, final InventoryPlayer aPlayerInventory, final IGregTechTileEntity aBaseMetaTileEntity) {
- return new CONTAINER_TreeFarmer(aPlayerInventory, aBaseMetaTileEntity);
+ public GT_Recipe.GT_Recipe_Map getRecipeMap() {
+ return null;
}
- @Override
- public boolean onRightclick(final IGregTechTileEntity aBaseMetaTileEntity, final EntityPlayer aPlayer) {
- if (aBaseMetaTileEntity.isClientSide() || aBaseMetaTileEntity.getWorld().isRemote) {
- Logger.WARNING("Doing nothing Client Side.");
- return false;
- }
- aBaseMetaTileEntity.openGUI(aPlayer);
+ public boolean isCorrectMachinePart(final ItemStack aStack) {
+ //return TreeFarmHelper.isCorrectPart(aStack);
return true;
}
- public Block getCasingBlock() {
- return ModBlocks.blockCasings2Misc;
- }
-
-
- public byte getCasingMeta() {
- return 15;
- }
-
-
- public byte getCasingTextureIndex() {
- return (byte) TAE.GTPP_INDEX(31);
- }
-
- @Override
- public int getMaxEfficiency(ItemStack p0) {
- return 10000;
- }
-
- @Override
- public String[] getExtraInfoData() {
- String[] mSuper = new String[0];
- String[] mDesc = new String[mSuper.length+1];
- mDesc[0] = "Yggdrasil"; // Machine name
- for (int i=0;i<mSuper.length;i++) {
- mDesc[i+1] = mSuper[i];
- }
- return mDesc;
- }
-
- @Override
- public boolean explodesOnComponentBreak(ItemStack p0) {
- return false;
- }
- @Override
- public boolean onRunningTick(final ItemStack aStack) {
- //Logger.INFO("s");
-
- return super.onRunningTick(aStack);
- }
-
- @Override
- public void onPostTick(final IGregTechTileEntity aBaseMetaTileEntity, final long aTick) {
- //Do Main Multi Logic first
- super.onPostTick(aBaseMetaTileEntity, aTick);
-
- //Do Tree Farm logic next on server side, once per second
- if (aBaseMetaTileEntity.isServerSide() && (aTick % 20 == 0)) {
-
- //Simple Repairs for a simple machine
- if (isCurrentlyWorking()) {
- this.mSolderingTool = true;
+ public boolean isFacingValid(final byte aFacing) {
+ return aFacing > 1;
+ }
+
+ public boolean checkRecipe(final ItemStack aStack) {
+ //Logger.WARNING("Trying to process virtual tree farming");
+ if (mTreeData != null) {
+ //Logger.WARNING("Tree Data is valid");
+
+ long tVoltage = getMaxInputVoltage();
+ byte tTier = (byte) Math.max(1, GT_Utility.getTier(tVoltage));
+
+ this.mMaxProgresstime = 100;
+ this.mEUt = (int) tVoltage;
+
+ this.mEfficiency = (10000 - (getIdealStatus() - getRepairStatus()) * 1000);
+ this.mEfficiencyIncrease = 10000;
+
+ // Overclock
+ if (this.mEUt <= 16) {
+ this.mEUt = (this.mEUt * (1 << tTier - 1) * (1 << tTier - 1));
+ this.mMaxProgresstime = (this.mMaxProgresstime / (1 << tTier - 1));
+ } else {
+ while (this.mEUt <= gregtech.api.enums.GT_Values.V[(tTier - 1)]) {
+ this.mEUt *= 4;
+ this.mMaxProgresstime /= 2;
+ }
}
- if (this.getBaseMetaTileEntity().isServerSide()) {
- if (this.mEnergyHatches.size() > 0) {
- for (GT_MetaTileEntity_Hatch_Energy j : this.mEnergyHatches) {
- //Logger.INFO(""+j.getInputTier());
- if (this.getEUVar() <= (this.maxEUStore()-GT_Values.V[(int) j.getInputTier()])) {
- this.setEUVar(this.getEUVar()+GT_Values.V[(int) j.getInputTier()]);
- j.setEUVar(j.getEUVar()-GT_Values.V[(int) j.getInputTier()]);
- }
- else if (this.getEUVar() > (this.maxEUStore()-GT_Values.V[(int) j.getInputTier()])) {
- long diff = (this.maxEUStore()-this.getEUVar());
- this.setEUVar(this.getEUVar()+diff);
- j.setEUVar(j.getEUVar()-diff);
+ if (this.mEUt > 0) {
+ this.mEUt = (-this.mEUt);
+ }
+
+
+
+ int aChance = MathUtils.randInt(0, 10);
+ AutoMap<ItemStack> aOutputs = new AutoMap<ItemStack>();
+
+ try {
+ //Logger.WARNING("Output Chance - "+aChance+" | Valid number? "+(aChance < 1000));
+ if (aChance < 8) {
+ //1% Chance per Tick
+ for (int u=0; u<(Math.max(20, (MathUtils.randInt((3*tTier), 100)*tTier*tTier)/8));u++) {
+ aOutputs = mTreeData.generateOutput(0);
+ if (aOutputs.size() > 0) {
+ Logger.WARNING("Generated some Loot, adding it to the output busses");
+
+ ItemStack aLeaves = ItemUtils.getSimpleStack(Blocks.leaves);
+
+ for (ItemStack aOutputItemStack : aOutputs) {
+ if (!GT_Utility.areStacksEqual(aLeaves, aOutputItemStack)) {
+ this.addOutput(aOutputItemStack);
+ }
}
- }
- }
+ Logger.WARNING("Updating Slots");
+ this.updateSlots();
+ }
+ }
+
+ }
}
-
-
- //Try Work
- if (this.drainEnergyInput(32)) {
- BlockPos t;
- if ((t = TreeFarmHelper.checkForLogsInGrowArea(this.getBaseMetaTileEntity())) != null) {
- //Logger.INFO("Lets try find new logs/branches.");
- TreeFarmHelper.findTreeFromBase(this.getBaseMetaTileEntity().getWorld(), t);
- }
+ catch (Throwable t) {
+ t.printStackTrace();
}
-
-
+
+ //Logger.WARNING("Valid Recipe");
+ return true;
}
+ else {
+ //Logger.WARNING("Invalid Recipe");
+ return false;
+ }
+ //return this.checkRecipeGeneric(4, 100, 100);
}
-
-
- @Override
- public boolean checkRecipe(ItemStack p0) {
- mIsCurrentlyWorking = (isCorrectMachinePart(p0) && this.getEUVar() > 0);
- if (isCurrentlyWorking()) {
- return true;
- }
- return false;
- }
@Override
public int getMaxParallelRecipes() {
@@ -261,121 +246,65 @@ public class GregtechMetaTileEntityTreeFarm extends GregtechMeta_MultiBlockBase
return 0;
}
-
- @Override
- public boolean isCorrectMachinePart(final ItemStack aStack) {
- boolean isValid = false;
- final SAWTOOL currentInputItem = TreeFarmHelper.isCorrectMachinePart(aStack);
- if (currentInputItem != SAWTOOL.NONE){
- isValid = true;
- }
- return isValid;
- }
-
- @Override
public boolean checkMultiblock(final IGregTechTileEntity aBaseMetaTileEntity, final ItemStack aStack) {
- Logger.WARNING("Step 1");
- final int xDir = net.minecraftforge.common.util.ForgeDirection.getOrientation(aBaseMetaTileEntity.getBackFacing()).offsetX * 7;
- final int zDir = net.minecraftforge.common.util.ForgeDirection.getOrientation(aBaseMetaTileEntity.getBackFacing()).offsetZ * 7;
-
- for (int i = -7; i <= 7; i++) {
- Logger.WARNING("Step 2");
- for (int j = -7; j <= 7; j++) {
- Logger.WARNING("Step 3");
- for (int h = 0; h <= 1; h++) {
- Logger.WARNING("Step 4");
- final IGregTechTileEntity tTileEntity = aBaseMetaTileEntity.getIGregTechTileEntityOffset(xDir + i, h, zDir + j);
- //Farm Floor inner 14x14
- if (((i != -7) && (i != 7)) && ((j != -7) && (j != 7))) {
- Logger.WARNING("Step 5 - H:"+h);
- // Farm Dirt Floor and Inner Air/Log space.
- if (h == 0) {
- //Dirt Floor
- if (!TreeFarmHelper.isDirtBlock(aBaseMetaTileEntity.getBlockOffset(xDir + i, h, zDir + j))) {
- Logger.MACHINE_INFO("Dirt like block missing from inner 14x14.");
- Logger.MACHINE_INFO("Instead, found "+aBaseMetaTileEntity.getBlockOffset(xDir + i, h, zDir + j).getLocalizedName());
- return false;
- }
- }
- }
- //Dealt with inner 5x5, now deal with the exterior.
- else {
- Logger.WARNING("Step 6 - H:"+h);
- //Deal with all 4 sides (Fenced area)
- if (h == 1) {
- if (!TreeFarmHelper.isFenceBlock(aBaseMetaTileEntity.getBlockOffset(xDir + i, h, zDir + j))) {
- Logger.MACHINE_INFO("Fence/Gate missing from outside the second layer.");
- Logger.MACHINE_INFO("Instead, found "+aBaseMetaTileEntity.getBlockOffset(xDir + i, h, zDir + j).getLocalizedName());
+ int xDir = ForgeDirection.getOrientation(aBaseMetaTileEntity.getBackFacing()).offsetX;
+ int zDir = ForgeDirection.getOrientation(aBaseMetaTileEntity.getBackFacing()).offsetZ;
+ int tAmount = 0;
+ if (!aBaseMetaTileEntity.getAirOffset(xDir, 0, zDir)) {
+ return false;
+ } else {
+ for (int i = -1; i < 2; ++i) {
+ for (int j = -1; j < 2; ++j) {
+ for (int h = -1; h < 2; ++h) {
+ if (h != 0 || (xDir + i != 0 || zDir + j != 0) && (i != 0 || j != 0)) {
+ IGregTechTileEntity tTileEntity = aBaseMetaTileEntity.getIGregTechTileEntityOffset(xDir + i,
+ h, zDir + j);
+ Block aBlock = aBaseMetaTileEntity.getBlockOffset(xDir + i, h, zDir + j);
+ int aMeta = aBaseMetaTileEntity.getMetaIDOffset(xDir + i, h, zDir + j);
+
+ if (!isValidBlockForStructure(tTileEntity, CASING_TEXTURE_ID, true, aBlock, aMeta,
+ ModBlocks.blockCasings2Misc, 15)) {
+ Logger.WARNING("Bad centrifuge casing");
return false;
}
- }
- //Deal with Bottom edges (Add Hatches/Busses first, othercheck make sure it's dirt) //TODO change the casings to not dirt~?
- else if (h == 0) {
- if (tTileEntity != null)
- if ((!this.addMaintenanceToMachineList(tTileEntity, TAE.GTPP_INDEX(TEX_INDEX))) && (!this.addInputToMachineList(tTileEntity, TAE.GTPP_INDEX(TEX_INDEX))) && (!this.addOutputToMachineList(tTileEntity, TAE.GTPP_INDEX(TEX_INDEX))) && (!this.addEnergyInputToMachineList(tTileEntity, TAE.GTPP_INDEX(TEX_INDEX)))) {
- if (((xDir + i) != 0) || ((zDir + j) != 0)) {//no controller
+ ++tAmount;
- if (tTileEntity.getMetaTileID() != 752) {
- Logger.MACHINE_INFO("Farm Keeper Casings Missing from one of the edges on the bottom edge. x:"+(xDir+i)+" y:"+h+" z:"+(zDir+j)+" | "+aBaseMetaTileEntity.getClass());
- Logger.MACHINE_INFO("Instead, found "+aBaseMetaTileEntity.getBlockOffset(xDir + i, h, zDir + j).getLocalizedName()+" "+tTileEntity.getMetaTileID());
- return false;
- }
- Logger.WARNING("Found a farm keeper.");
- }
- }
}
}
}
}
+ return tAmount >= 10;
}
+ }
- //Must have at least one energy hatch.
- if (this.mEnergyHatches != null) {
- for (int i = 0; i < this.mEnergyHatches.size(); i++) {
- if (this.mEnergyHatches.get(i).mTier < 1){
- Logger.MACHINE_INFO("You require at LEAST MV tier Energy Hatches.");
- Logger.MACHINE_INFO(this.mOutputHatches.get(i).getBaseMetaTileEntity().getXCoord()+","+this.mOutputHatches.get(i).getBaseMetaTileEntity().getYCoord()+","+this.mOutputHatches.get(i).getBaseMetaTileEntity().getZCoord());
- return false;
- }
- }
- }
- //Must have at least one output hatch.
- if (this.mOutputHatches != null) {
- for (int i = 0; i < this.mOutputHatches.size(); i++) {
-
- if (this.mOutputHatches.get(i).mTier < 1){
- Logger.MACHINE_INFO("You require at LEAST MV tier Output Hatches.");
- Logger.MACHINE_INFO(this.mOutputHatches.get(i).getBaseMetaTileEntity().getXCoord()+","+this.mOutputHatches.get(i).getBaseMetaTileEntity().getYCoord()+","+this.mOutputHatches.get(i).getBaseMetaTileEntity().getZCoord());
- Logger.MACHINE_INFO(this.mOutputHatches.get(i).getBaseMetaTileEntity().getInventoryName());
- return false;
- }
- }
- }
- //Must have at least one input hatch.
- if (this.mInputHatches != null) {
- for (int i = 0; i < this.mInputHatches.size(); i++) {
- if (this.mInputHatches.get(i).mTier < 1){
- Logger.MACHINE_INFO("You require at LEAST MV tier Input Hatches.");
- Logger.MACHINE_INFO(this.mOutputHatches.get(i).getBaseMetaTileEntity().getXCoord()+","+this.mOutputHatches.get(i).getBaseMetaTileEntity().getYCoord()+","+this.mOutputHatches.get(i).getBaseMetaTileEntity().getZCoord());
- Logger.MACHINE_INFO(this.mOutputHatches.get(i).getBaseMetaTileEntity().getInventoryName());
- return false;
- }
- }
- }
- Logger.MACHINE_INFO("Multiblock Formed.");
- return true;
+ public int getMaxEfficiency(final ItemStack aStack) {
+ return 10000;
}
+ public int getPollutionPerTick(final ItemStack aStack) {
+ return 25;
+ }
- @Override
- public int getPollutionPerTick(ItemStack arg0) {
+ public int getDamageToComponent(final ItemStack aStack) {
return 0;
}
+ public boolean explodesOnComponentBreak(final ItemStack aStack) {
+ return false;
+ }
@Override
- public void onServerStart() {
- super.onServerStart();
+ public void onPostTick(IGregTechTileEntity aBaseMetaTileEntity, long aTick) {
+ if (mTreeData != null) {
+ //this.getBaseMetaTileEntity().enableWorking();
+ }
+
+
+ /*if (this.getBaseMetaTileEntity().isActive()) {
+ if (!this.depleteInput(mFuelStack.copy())) {
+ this.getBaseMetaTileEntity().setActive(false);
+ }
+ } */
+ super.onPostTick(aBaseMetaTileEntity, aTick);
}
-
} \ No newline at end of file
diff --git a/src/Java/gtPlusPlus/xmod/gregtech/common/tileentities/machines/multi/production/GregtechMetaTileEntity_IndustrialFishingPond.java b/src/Java/gtPlusPlus/xmod/gregtech/common/tileentities/machines/multi/production/GregtechMetaTileEntity_IndustrialFishingPond.java
index fc0cb85bac..031bf16b17 100644
--- a/src/Java/gtPlusPlus/xmod/gregtech/common/tileentities/machines/multi/production/GregtechMetaTileEntity_IndustrialFishingPond.java
+++ b/src/Java/gtPlusPlus/xmod/gregtech/common/tileentities/machines/multi/production/GregtechMetaTileEntity_IndustrialFishingPond.java
@@ -6,7 +6,6 @@ import java.util.ArrayList;
import java.util.HashMap;
import java.util.Map;
-import cofh.asmhooks.block.BlockWater;
import gregtech.api.enums.TAE;
import gregtech.api.enums.Textures;
import gregtech.api.interfaces.ITexture;
@@ -18,7 +17,6 @@ import gregtech.api.util.FishPondFakeRecipe;
import gregtech.api.util.GT_Recipe;
import gregtech.api.util.GT_Utility;
import gregtech.api.util.Recipe_GT;
-import gtPlusPlus.api.objects.Logger;
import gtPlusPlus.api.objects.data.AutoMap;
import gtPlusPlus.core.block.ModBlocks;
import gtPlusPlus.core.lib.CORE;
@@ -31,7 +29,6 @@ import gtPlusPlus.xmod.gregtech.api.metatileentity.implementations.base.Gregtech
import ic2.core.init.BlocksItems;
import ic2.core.init.InternalName;
import net.minecraft.block.Block;
-import net.minecraft.block.BlockAir;
import net.minecraft.init.Blocks;
import net.minecraft.item.Item;
import net.minecraft.item.ItemStack;
diff --git a/src/Java/gtPlusPlus/xmod/gregtech/common/tileentities/machines/multi/production/bedrock/GregtechMetaTileEntity_BedrockMiningPlatform1.java b/src/Java/gtPlusPlus/xmod/gregtech/common/tileentities/machines/multi/production/bedrock/GregtechMetaTileEntity_BedrockMiningPlatform1.java
index 7c1cc343ed..a3e288c33c 100644
--- a/src/Java/gtPlusPlus/xmod/gregtech/common/tileentities/machines/multi/production/bedrock/GregtechMetaTileEntity_BedrockMiningPlatform1.java
+++ b/src/Java/gtPlusPlus/xmod/gregtech/common/tileentities/machines/multi/production/bedrock/GregtechMetaTileEntity_BedrockMiningPlatform1.java
@@ -3,10 +3,8 @@ package gtPlusPlus.xmod.gregtech.common.tileentities.machines.multi.production.b
import gregtech.api.enums.TAE;
import gregtech.api.interfaces.metatileentity.IMetaTileEntity;
import gregtech.api.interfaces.tileentity.IGregTechTileEntity;
-
import gtPlusPlus.core.material.ALLOY;
import gtPlusPlus.core.material.Material;
-import gtPlusPlus.xmod.gregtech.api.enums.GregtechItemList;
public class GregtechMetaTileEntity_BedrockMiningPlatform1 extends GregtechMetaTileEntity_BedrockMiningPlatformBase {
public GregtechMetaTileEntity_BedrockMiningPlatform1(final int aID, final String aName, final String aNameRegional) {
@@ -17,7 +15,7 @@ public class GregtechMetaTileEntity_BedrockMiningPlatform1 extends GregtechMetaT
super(aName);
}
- public String[] getDescription() {
+ public String[] getTooltip() {
return this.getDescriptionInternal("I");
}
diff --git a/src/Java/gtPlusPlus/xmod/gregtech/common/tileentities/machines/multi/production/bedrock/GregtechMetaTileEntity_BedrockMiningPlatform2.java b/src/Java/gtPlusPlus/xmod/gregtech/common/tileentities/machines/multi/production/bedrock/GregtechMetaTileEntity_BedrockMiningPlatform2.java
index 0ea38f685f..6910f4e97c 100644
--- a/src/Java/gtPlusPlus/xmod/gregtech/common/tileentities/machines/multi/production/bedrock/GregtechMetaTileEntity_BedrockMiningPlatform2.java
+++ b/src/Java/gtPlusPlus/xmod/gregtech/common/tileentities/machines/multi/production/bedrock/GregtechMetaTileEntity_BedrockMiningPlatform2.java
@@ -15,7 +15,7 @@ public class GregtechMetaTileEntity_BedrockMiningPlatform2 extends GregtechMetaT
super(aName);
}
- public String[] getDescription() {
+ public String[] getTooltip() {
return this.getDescriptionInternal("II");
}
diff --git a/src/Java/gtPlusPlus/xmod/gregtech/common/tileentities/machines/multi/production/bedrock/GregtechMetaTileEntity_BedrockMiningPlatformBase.java b/src/Java/gtPlusPlus/xmod/gregtech/common/tileentities/machines/multi/production/bedrock/GregtechMetaTileEntity_BedrockMiningPlatformBase.java
index fb4884e278..d264a759ec 100644
--- a/src/Java/gtPlusPlus/xmod/gregtech/common/tileentities/machines/multi/production/bedrock/GregtechMetaTileEntity_BedrockMiningPlatformBase.java
+++ b/src/Java/gtPlusPlus/xmod/gregtech/common/tileentities/machines/multi/production/bedrock/GregtechMetaTileEntity_BedrockMiningPlatformBase.java
@@ -1,8 +1,5 @@
package gtPlusPlus.xmod.gregtech.common.tileentities.machines.multi.production.bedrock;
-import java.util.ArrayList;
-import java.util.HashMap;
-
import gregtech.api.GregTech_API;
import gregtech.api.enums.GT_Values;
import gregtech.api.enums.Textures;
@@ -11,7 +8,6 @@ import gregtech.api.interfaces.IIconContainer;
import gregtech.api.interfaces.ITexture;
import gregtech.api.interfaces.tileentity.IGregTechTileEntity;
import gregtech.api.metatileentity.implementations.GT_MetaTileEntity_Hatch_Energy;
-import gregtech.api.metatileentity.implementations.GT_MetaTileEntity_MultiBlockBase;
import gregtech.api.objects.GT_RenderedTexture;
import gregtech.api.util.GT_ModHandler;
import gregtech.api.util.GT_Utility;
@@ -19,8 +15,6 @@ import gregtech.common.GT_Worldgen_GT_Ore_Layer;
import gtPlusPlus.api.objects.Logger;
import gtPlusPlus.api.objects.data.AutoMap;
import gtPlusPlus.api.objects.data.Pair;
-import gtPlusPlus.api.objects.minecraft.BlockPos;
-import gtPlusPlus.core.block.ModBlocks;
import gtPlusPlus.core.lib.LoadedMods;
import gtPlusPlus.core.material.ELEMENT;
import gtPlusPlus.core.material.Material;
@@ -30,24 +24,22 @@ import gtPlusPlus.core.util.minecraft.FluidUtils;
import gtPlusPlus.core.util.minecraft.ItemUtils;
import gtPlusPlus.core.util.minecraft.MiningUtils;
import gtPlusPlus.xmod.gregtech.api.enums.GregtechItemList;
+import gtPlusPlus.xmod.gregtech.api.metatileentity.implementations.base.GregtechMeta_MultiBlockBase;
import net.minecraft.block.Block;
import net.minecraft.entity.player.InventoryPlayer;
import net.minecraft.item.ItemStack;
import net.minecraft.nbt.NBTTagCompound;
-import net.minecraft.world.ChunkPosition;
import net.minecraftforge.common.util.ForgeDirection;
import net.minecraftforge.oredict.OreDictionary;
-public abstract class GregtechMetaTileEntity_BedrockMiningPlatformBase extends GT_MetaTileEntity_MultiBlockBase {
-
- private static final ItemStack miningPipe;
- private static final ItemStack miningPipeTip;
- private static final Block miningPipeBlock;
- private static final Block miningPipeTipBlock;
+public abstract class GregtechMetaTileEntity_BedrockMiningPlatformBase extends GregtechMeta_MultiBlockBase {
- private final ArrayList<ChunkPosition> oreBlockPositions;
protected double mProductionModifier = 0;
+
+ private static final ItemStack miningPipe;
+ private static final ItemStack miningPipeTip;
+
private Block casingBlock;
private int casingMeta;
// private int frameMeta;
@@ -61,36 +53,22 @@ public abstract class GregtechMetaTileEntity_BedrockMiningPlatformBase extends G
private int[] xCenter = new int[5];
private int[] zCenter = new int[5];
- private int[] yHead = new int[5];
- private boolean[] isPickingPipes = new boolean[5];
public GregtechMetaTileEntity_BedrockMiningPlatformBase(final int aID, final String aName,
final String aNameRegional) {
super(aID, aName, aNameRegional);
- this.oreBlockPositions = new ArrayList<ChunkPosition>();
this.initFields();
}
public GregtechMetaTileEntity_BedrockMiningPlatformBase(final String aName) {
super(aName);
- this.oreBlockPositions = new ArrayList<ChunkPosition>();
this.initFields();
}
private void initFields() {
this.casingBlock = this.getCasingBlockItem().getBlock();
this.casingMeta = this.getCasingBlockItem().get(0L, new Object[0]).getItemDamage();
- /*
- * final int frameId = 4096 + this.getFrameMaterial().mMetaItemSubID;
- * this.frameMeta = ((GregTech_API.METATILEENTITIES[frameId] != null) ?
- * GregTech_API.METATILEENTITIES[frameId].getTileEntityBaseType() :
- * 32767);
- */
this.casingTextureIndex = this.getCasingTextureIndex();
-
- for (int g = 0; g < 5; g++) {
- this.isPickingPipes[g] = false;
- }
}
public ITexture[] getTexture(final IGregTechTileEntity aBaseMetaTileEntity, final byte aSide, final byte aFacing,
@@ -168,7 +146,7 @@ public abstract class GregtechMetaTileEntity_BedrockMiningPlatformBase extends G
}
}
- this.mEUt = 8000;
+ this.mEUt = -8000;
this.mMaxProgresstime = 1;
this.mEfficiencyIncrease = 10000;
@@ -186,30 +164,6 @@ public abstract class GregtechMetaTileEntity_BedrockMiningPlatformBase extends G
return false;
}
- private boolean tryPickPipe(int pipe) {
- if (this.yHead[pipe] == this.yDrill) {
- return false;
- }
- boolean didWork[] = new boolean[3];
- didWork[0] = this.checkBlockAndMeta(this.xCenter[pipe], this.yHead[pipe] + 1, this.zCenter[pipe],
- GregtechMetaTileEntity_BedrockMiningPlatformBase.miningPipeBlock, 32767);
- if (didWork[0]) {
- didWork[1] = this.getBaseMetaTileEntity().getWorld().setBlock(this.xCenter[pipe], this.yHead[pipe] + 1,
- this.zCenter[pipe], GregtechMetaTileEntity_BedrockMiningPlatformBase.miningPipeTipBlock);
- }
- if (didWork[1]) {
- mMiningHeads.put(pipe, new BlockPos(this.xCenter[pipe], this.yHead[pipe] + 1, this.zCenter[pipe],
- this.getBaseMetaTileEntity().getWorld()));
- didWork[2] = this.getBaseMetaTileEntity().getWorld().setBlockToAir(this.xCenter[pipe], this.yHead[pipe],
- this.zCenter[pipe]);
- }
-
- if (didWork[0] && didWork[1] && didWork[2]) {
- return true;
- }
- return false;
- }
-
private void setElectricityStats() {
//this.mEfficiency = this.getCurrentEfficiency((ItemStack) null);
this.mEfficiencyIncrease = 10000;
@@ -218,52 +172,12 @@ public abstract class GregtechMetaTileEntity_BedrockMiningPlatformBase extends G
Logger.INFO("Trying to set EU to "+(12 * overclock * overclock));
int mCombinedAvgTime = 0;
for (int g = 0; g < 5; g++) {
- mCombinedAvgTime += (this.isPickingPipes[g] ? 80 : this.getBaseProgressTime()) / overclock;
+ mCombinedAvgTime += this.getBaseProgressTime() / overclock;
}
Logger.INFO("Trying to set Max Time to "+(mCombinedAvgTime));
//this.mMaxProgresstime = (mCombinedAvgTime / 5);
}
- /*
- * private ItemStack[] getOutputByDrops(final ArrayList<ItemStack>
- * oreBlockDrops) { final long voltage = this.getMaxInputVoltage(); final
- * ArrayList<ItemStack> outputItems = new ArrayList<ItemStack>(); while
- * (!oreBlockDrops.isEmpty()) { final ItemStack currentItem =
- * oreBlockDrops.remove(0).copy(); if
- * (!this.doUseMaceratorRecipe(currentItem)) {
- * this.multiplyStackSize(currentItem); outputItems.add(currentItem); } else
- * { final GT_Recipe tRecipe =
- * GT_Recipe.GT_Recipe_Map.sMaceratorRecipes.findRecipe(
- * (IHasWorldObjectAndCoords) this.getBaseMetaTileEntity(), false, voltage,
- * (FluidStack[]) null, new ItemStack[]{currentItem}); if (tRecipe == null)
- * { outputItems.add(currentItem); } else { for (int i = 0; i <
- * tRecipe.mOutputs.length; ++i) { final ItemStack recipeOutput =
- * tRecipe.mOutputs[i].copy(); if
- * (this.getBaseMetaTileEntity().getRandomNumber(10000) <
- * tRecipe.getOutputChance(i)) { this.multiplyStackSize(recipeOutput); }
- * outputItems.add(recipeOutput); } } } } return outputItems.toArray(new
- * ItemStack[0]); }
- */
-
- /*
- * private boolean doUseMaceratorRecipe(final ItemStack currentItem) { final
- * ItemData itemData = GT_OreDictUnificator.getItemData(currentItem); return
- * itemData == null || (itemData.mPrefix != OrePrefixes.crushed &&
- * itemData.mPrefix != OrePrefixes.dustImpure && itemData.mPrefix !=
- * OrePrefixes.dust && itemData.mMaterial.mMaterial != Materials.Oilsands);
- * } private void multiplyStackSize(final ItemStack itemStack) {
- * itemStack.stackSize *= this.getBaseMetaTileEntity().getRandomNumber(4) +
- * 1; } private ArrayList<ItemStack> getBlockDrops(final Block oreBlock,
- * final int posX, final int posY, final int posZ) { final int blockMeta =
- * this.getBaseMetaTileEntity().getMetaID(posX, posY, posZ); if
- * (oreBlock.canSilkHarvest(this.getBaseMetaTileEntity().getWorld(),
- * (EntityPlayer) null, posX, posY, posZ, blockMeta)) { return new
- * ArrayList<ItemStack>() { { this.add(new ItemStack(oreBlock, 1,
- * blockMeta)); } }; } return (ArrayList<ItemStack>)
- * oreBlock.getDrops(this.getBaseMetaTileEntity().getWorld(), posX, posY,
- * posZ, blockMeta, 1); }
- */
-
private boolean tryConsumeDrillingFluid() {
boolean consumed = false;
boolean g = (this.getBaseMetaTileEntity().getWorld().getTotalWorldTime() % 2 == 0);
@@ -285,30 +199,8 @@ public abstract class GregtechMetaTileEntity_BedrockMiningPlatformBase extends G
return this.depleteInput(FluidUtils.getFluidStack("cryotheum", 4));
}
- private boolean lowerProduction(int reduce) {
- if ((mProductionModifier - reduce) >= 10) {
- this.mProductionModifier -= reduce;
- return true;
- }
- else {
- this.mProductionModifier = 10;
- return false;
- }
- }
-
- private boolean increaseProduction(int increase) {
- if ((mProductionModifier + increase) <= 150) {
- this.mProductionModifier += increase;
- return true;
- }
- else {
- this.mProductionModifier = 150;
- return false;
- }
- }
-
private void putMiningPipesFromInputsInController() {
- final int maxPipes = GregtechMetaTileEntity_BedrockMiningPlatformBase.miningPipe.getMaxStackSize();
+ final int maxPipes = 64;
if (this.isHasMiningPipes(maxPipes)) {
return;
}
@@ -335,74 +227,7 @@ public abstract class GregtechMetaTileEntity_BedrockMiningPlatformBase extends G
this.updateSlots();
}
- /*
- * private void fillMineListIfEmpty() { if
- * (!this.oreBlockPositions.isEmpty()) { return; }
- * this.tryAddOreBlockToMineList(this.xCenter, this.yHead - 1,
- * this.zCenter); if (this.yHead == this.yDrill) { return; } for (int radius
- * = this.getRadiusInChunks() << 4, xOff = -radius; xOff <= radius; ++xOff)
- * { for (int zOff = -radius; zOff <= radius; ++zOff) {
- * this.tryAddOreBlockToMineList(this.xDrill + xOff, this.yHead, this.zDrill
- * + zOff); } } } private void tryAddOreBlockToMineList(final int x, final
- * int y, final int z) { final Block block =
- * this.getBaseMetaTileEntity().getBlock(x, y, z); final int blockMeta =
- * this.getBaseMetaTileEntity().getMetaID(x, y, z); final ChunkPosition
- * blockPos = new ChunkPosition(x, y, z); if
- * (this.oreBlockPositions.contains(blockPos)) { return; } if (block
- * instanceof GT_Block_Ores_Abstract) { final TileEntity tTileEntity =
- * this.getBaseMetaTileEntity().getTileEntity(x, y, z); if (tTileEntity !=
- * null && tTileEntity instanceof GT_TileEntity_Ores &&
- * ((GT_TileEntity_Ores) tTileEntity).mNatural) {
- * this.oreBlockPositions.add(blockPos); } } else { final ItemData
- * association = GT_OreDictUnificator.getAssociation(new ItemStack(block, 1,
- * blockMeta)); if (association != null &&
- * association.mPrefix.toString().startsWith("ore")) {
- * this.oreBlockPositions.add(blockPos); } } }
- */
- private HashMap<Integer, BlockPos> mMiningHeads = new HashMap<Integer, BlockPos>();
-
- private boolean tryLowerPipe(int pipe) {
- if (!this.isHasMiningPipes()) {
- Logger.INFO("[Bedrock Miner] No Pipes to Lower.");
- return false;
- }
- boolean didWork[] = new boolean[3];
-
- /*if (this.checkBlockAndMeta(this.xCenter[pipe], this.yHead[pipe] - 1, this.zCenter[pipe], Blocks.bedrock,
- 32767)) {
- // Logger.INFO("[Bedrock Miner] Pipe "+pipe+" is at Bedrock.");
- return false;
- }*/
- didWork[0] = this.getBaseMetaTileEntity().getWorld().setBlock(this.xCenter[pipe], this.yHead[pipe] - 1,
- this.zCenter[pipe], GregtechMetaTileEntity_BedrockMiningPlatformBase.miningPipeTipBlock);
- if (didWork[0]) {
- mMiningHeads.put(pipe, new BlockPos(this.xCenter[pipe], this.yHead[pipe] - 1, this.zCenter[pipe],
- this.getBaseMetaTileEntity().getWorld()));
- }
-
- didWork[1] = (this.yHead[pipe] != this.yDrill);
- Logger.INFO("A: " + this.yHead[pipe] + " | B: " + this.yDrill);
-
- if (didWork[1]) {
- didWork[2] = this.getBaseMetaTileEntity().getWorld().setBlock(this.xCenter[pipe], this.yHead[pipe],
- this.zCenter[pipe], GregtechMetaTileEntity_BedrockMiningPlatformBase.miningPipeBlock);
- }
-
- if (didWork[0] && didWork[1] && didWork[2]) {
- this.getBaseMetaTileEntity().decrStackSize(1, 1);
- Logger.INFO("[Bedrock Miner] Lowered Pipe " + pipe + ".");
- return true;
- }
-
- Logger.INFO("[Bedrock Miner] Issue when lowering Pipe " + pipe + ". 1: " + didWork[0] + " | 2: " + didWork[1]
- + " | 3: " + didWork[2]);
- return false;
- }
-
- private boolean isHasMiningPipes() {
- return this.isHasMiningPipes(1);
- }
private boolean isHasMiningPipes(final int minCount) {
final ItemStack pipe = this.getStackInSlot(1);
@@ -410,11 +235,8 @@ public abstract class GregtechMetaTileEntity_BedrockMiningPlatformBase extends G
&& pipe.isItemEqual(GregtechMetaTileEntity_BedrockMiningPlatformBase.miningPipe);
}
- public boolean checkMachine(final IGregTechTileEntity aBaseMetaTileEntity, final ItemStack aStack) {
- this.updateCoordinates();
-
-
-
+ public boolean checkMultiblock(final IGregTechTileEntity aBaseMetaTileEntity, final ItemStack aStack) {
+ this.updateCoordinates();
int xDir = ForgeDirection.getOrientation(aBaseMetaTileEntity.getBackFacing()).offsetX;
int zDir = ForgeDirection.getOrientation(aBaseMetaTileEntity.getBackFacing()).offsetZ;
int tAmount = 0;
@@ -459,66 +281,6 @@ public abstract class GregtechMetaTileEntity_BedrockMiningPlatformBase extends G
return tAmount >= 10;
}
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
- /*for (int xOff = -1 + this.back.offsetX; xOff <= 1 + this.back.offsetX; ++xOff) {
- for (int zOff = -1 + this.back.offsetZ; zOff <= 1 + this.back.offsetZ; ++zOff) {
- if (xOff != 0 || zOff != 0) {
- final Block tBlock = aBaseMetaTileEntity.getBlockOffset(xOff, 0, zOff);
- final IGregTechTileEntity tTileEntity = aBaseMetaTileEntity.getIGregTechTileEntityOffset(xOff, 0,
- zOff);
- if (!this.checkCasingBlock(xOff, 0, zOff)
- && !this.addMaintenanceToMachineList(tTileEntity, this.casingTextureIndex)
- && !this.addInputToMachineList(tTileEntity, this.casingTextureIndex)
- && !this.addOutputToMachineList(tTileEntity, this.casingTextureIndex)
- && !this.addEnergyInputToMachineList(tTileEntity, this.casingTextureIndex)) {
- Logger.INFO("[Bedrock Miner] Found bad block in Structure.");
- if (tBlock != null) {
- //Logger.INFO("[Bedrock Miner] Found "+(new ItemStack(tBlock, tBlock.getDamageValue(aBaseMetaTileEntity.getWorld(), xOff, 0, zOff))).getDisplayName()+", expected "+this.getCasingBlockItem().get(0L, new Object[0]).getDisplayName());
- }
- return false;
- }
- }
- }
- }
- if (this.mMaintenanceHatches.isEmpty() || this.mInputHatches.isEmpty() || this.mOutputBusses.isEmpty()
- || this.mEnergyHatches.isEmpty()) {
- Logger.INFO("[Bedrock Miner] Missing Hatches/Busses.");
- return false;
- }
- if (GT_Utility.getTier(this.getMaxInputVoltage()) < this.getMinTier()) {
- Logger.INFO("[Bedrock Miner] getMaxInputVoltage() < getMinTier().");
- return false;
- }
- for (int yOff = 1; yOff < 4; ++yOff) {
- if (!this.checkCasingBlock(this.back.offsetX, yOff, this.back.offsetZ)
- || !this.checkFrameBlock(this.back.offsetX + 1, yOff, this.back.offsetZ)
- || !this.checkFrameBlock(this.back.offsetX - 1, yOff, this.back.offsetZ)
- || !this.checkFrameBlock(this.back.offsetX, yOff, this.back.offsetZ + 1)
- || !this.checkFrameBlock(this.back.offsetX, yOff, this.back.offsetZ - 1)
- || !this.checkFrameBlock(this.back.offsetX, yOff + 3, this.back.offsetZ)) {
- Logger.INFO("[Bedrock Miner] Missing Frames? yOff = " + yOff);
- return false;
- }
- }
- Logger.INFO("[Bedrock Miner] Built.");
- return true;*/
}
private void updateCoordinates() {
@@ -545,46 +307,6 @@ public abstract class GregtechMetaTileEntity_BedrockMiningPlatformBase extends G
}
- private boolean checkPipesAndSetYHead() {
- for (int g = 0; g < 5; g++) {
- this.yHead[g] = this.yDrill -5;
- // Logger.INFO("[Bedrock Miner] Set yHead["+g+"] to
- // "+this.yHead[g]+".");
- while (this.checkBlockAndMeta(this.xCenter[g], this.yHead[g], this.zCenter[g],
- GregtechMetaTileEntity_BedrockMiningPlatformBase.miningPipeBlock, 32767)) {
- --this.yHead[g];
- }
- if (this.checkBlockAndMeta(this.xCenter[g], this.yHead[g], this.zCenter[g],
- GregtechMetaTileEntity_BedrockMiningPlatformBase.miningPipeTipBlock, 32767)
- || ++this.yHead[g] == this.yDrill || GT_Utility.isBlockAir(this.getBaseMetaTileEntity().getWorld(), this.xCenter[g], this.yHead[g], this.zCenter[g])) {
- continue;
- }
- this.getBaseMetaTileEntity().getWorld().setBlock(this.xCenter[g], this.yHead[g], this.zCenter[g],
- GregtechMetaTileEntity_BedrockMiningPlatformBase.miningPipeTipBlock);
-
- }
- return true;
- }
-
- private boolean checkCasingBlock(final int xOff, final int yOff, final int zOff) {
- return this.checkBlockAndMetaOffset(xOff, yOff, zOff, this.casingBlock, this.casingMeta);
- }
-
- private boolean checkFrameBlock(final int xOff, final int yOff, final int zOff) {
- return this.checkBlockAndMetaOffset(xOff, yOff, zOff,
- Block.getBlockFromItem(this.getFrameMaterial().getFrameBox(1).getItem()), 0);
- }
-
- private boolean checkBlockAndMetaOffset(final int xOff, final int yOff, final int zOff, final Block block,
- final int meta) {
- return this.checkBlockAndMeta(this.xDrill + xOff, this.yDrill + yOff, this.zDrill + zOff, block, meta);
- }
-
- private boolean checkBlockAndMeta(final int x, final int y, final int z, final Block block, final int meta) {
- Logger.INFO("Found "+this.getBaseMetaTileEntity().getBlock(x, y, z).getLocalizedName()+":"+this.getBaseMetaTileEntity().getMetaID(x, y, z)+" | Expected: "+block.getUnlocalizedName()+":"+meta);
- return (this.getBaseMetaTileEntity().getMetaID(x, y, z) == meta) && this.getBaseMetaTileEntity().getBlock(x, y, z) == block;
- }
-
public boolean isCorrectMachinePart(final ItemStack aStack) {
return true;
}
@@ -640,12 +362,6 @@ public abstract class GregtechMetaTileEntity_BedrockMiningPlatformBase extends G
static {
miningPipe = GT_ModHandler.getIC2Item("miningPipe", 0L);
miningPipeTip = GT_ModHandler.getIC2Item("miningPipeTip", 0L);
- // miningPipeBlock =
- // GT_Utility.getBlockFromStack(GregtechMetaTileEntity_BedrockMiningPlatformBase.miningPipe);
- // miningPipeTipBlock =
- // GT_Utility.getBlockFromStack(GregtechMetaTileEntity_BedrockMiningPlatformBase.miningPipeTip);
- miningPipeBlock = ModBlocks.blockFakeMiningPipe;
- miningPipeTipBlock = ModBlocks.blockFakeMiningHead;
}
@@ -925,6 +641,33 @@ public abstract class GregtechMetaTileEntity_BedrockMiningPlatformBase extends G
}
}
+
+
+ @Override
+ public boolean hasSlotInGUI() {
+ return true;
+ }
+
+ @Override
+ public String getCustomGUIResourceName() {
+ return null;
+ }
+
+ @Override
+ public String getMachineType() {
+ return "Miner";
+ }
+
+ @Override
+ public int getMaxParallelRecipes() {
+ return 1;
+ }
+
+ @Override
+ public int getEuDiscountForParallelism() {
+ return 0;
+ }
+
diff --git a/src/Java/gtPlusPlus/xmod/thaumcraft/HANDLER_Thaumcraft.java b/src/Java/gtPlusPlus/xmod/thaumcraft/HANDLER_Thaumcraft.java
index 8cdfb2afb6..b1353cc481 100644
--- a/src/Java/gtPlusPlus/xmod/thaumcraft/HANDLER_Thaumcraft.java
+++ b/src/Java/gtPlusPlus/xmod/thaumcraft/HANDLER_Thaumcraft.java
@@ -1,16 +1,11 @@
package gtPlusPlus.xmod.thaumcraft;
-import java.util.Arrays;
-import java.util.List;
-
-import gtPlusPlus.api.objects.Logger;
import gtPlusPlus.api.objects.data.AutoMap;
import gtPlusPlus.api.objects.data.Pair;
import gtPlusPlus.core.lib.LoadedMods;
import gtPlusPlus.core.util.reflect.ReflectionUtils;
import gtPlusPlus.xmod.thaumcraft.aspect.GTPP_AspectCompat;
import gtPlusPlus.xmod.thaumcraft.aspect.GTPP_AspectStack;
-import gtPlusPlus.xmod.thaumcraft.util.ThaumcraftUtils;
import net.minecraft.init.Items;
import net.minecraft.item.Item;
import net.minecraft.item.ItemStack;
diff --git a/src/Java/gtPlusPlus/xmod/thaumcraft/aspect/GTPP_AspectCompat.java b/src/Java/gtPlusPlus/xmod/thaumcraft/aspect/GTPP_AspectCompat.java
index 6cd5af02b6..56ad95c5e3 100644
--- a/src/Java/gtPlusPlus/xmod/thaumcraft/aspect/GTPP_AspectCompat.java
+++ b/src/Java/gtPlusPlus/xmod/thaumcraft/aspect/GTPP_AspectCompat.java
@@ -7,7 +7,6 @@ import java.util.LinkedHashMap;
import java.util.List;
import gregtech.api.enums.TC_Aspects;
-import gregtech.api.util.GT_LanguageManager;
import gregtech.common.GT_ThaumcraftCompat;
import gtPlusPlus.api.objects.Logger;
import gtPlusPlus.core.lib.CORE;