aboutsummaryrefslogtreecommitdiff
path: root/src/Java/miscutil/core/util
diff options
context:
space:
mode:
authorDraknyte1 <Draknyte1@hotmail.com>2016-06-02 00:13:32 +1000
committerDraknyte1 <Draknyte1@hotmail.com>2016-06-02 00:13:32 +1000
commitecff67654aac93b33907a0784d9c0b88648cfd1a (patch)
tree728ab9131bacd866313c65c37e3f37a53e73520a /src/Java/miscutil/core/util
parente6d4747d4cb4e648f2b6f8f88ad0aceca59d3d8b (diff)
downloadGT5-Unofficial-ecff67654aac93b33907a0784d9c0b88648cfd1a.tar.gz
GT5-Unofficial-ecff67654aac93b33907a0784d9c0b88648cfd1a.tar.bz2
GT5-Unofficial-ecff67654aac93b33907a0784d9c0b88648cfd1a.zip
~Changed Coke Oven Recipes
~Cleaned up a handful of classes (ModItems.java, RECIPES_Machines.java, Utils.java & UtilsItems.java) +Added a handful of DEBUG classes (To resolve multiblock shaping issues) +Added GregtechMetaTileEntityIndustrialPlatePress.java +Added textures for itemStickyRubber, itemIngotBatteryAlloy & itemPlateBatteryAlloy. +Added a basic wrapper for direct MineTweaker script usage (Ultra W.I.P.) >This will probably be changed to preload .zs scripts, regex and handle appropriately, but undecided.
Diffstat (limited to 'src/Java/miscutil/core/util')
-rw-r--r--src/Java/miscutil/core/util/Utils.java20
-rw-r--r--src/Java/miscutil/core/util/UtilsItems.java226
-rw-r--r--src/Java/miscutil/core/util/debug/DEBUG_BLOCK_ShapeSpawner.java139
-rw-r--r--src/Java/miscutil/core/util/debug/DEBUG_INIT.java37
-rw-r--r--src/Java/miscutil/core/util/debug/DEBUG_ITEM_ShapeSpawner.java55
-rw-r--r--src/Java/miscutil/core/util/debug/DEBUG_MULTIBLOCK_ShapeSpawner.java805
-rw-r--r--src/Java/miscutil/core/util/debug/DEBUG_TimerThread.java63
-rw-r--r--src/Java/miscutil/core/util/wrapper/var.java67
8 files changed, 1367 insertions, 45 deletions
diff --git a/src/Java/miscutil/core/util/Utils.java b/src/Java/miscutil/core/util/Utils.java
index 4e303c8e39..37a4b5bb56 100644
--- a/src/Java/miscutil/core/util/Utils.java
+++ b/src/Java/miscutil/core/util/Utils.java
@@ -5,6 +5,8 @@ import static gregtech.api.enums.GT_Values.F;
import java.awt.Color;
import java.awt.Graphics;
import java.util.Random;
+import java.util.Timer;
+import java.util.TimerTask;
import miscutil.core.lib.CORE;
import net.minecraft.block.Block;
@@ -18,6 +20,13 @@ import cpw.mods.fml.common.FMLLog;
public class Utils {
public static final int WILDCARD_VALUE = Short.MAX_VALUE;
+
+ static class ShortTimerTask extends TimerTask {
+ @Override
+ public void run() {
+ Utils.LOG_WARNING("Timer expired.");
+ }
+ }
/**
* Returns a psuedo-random number between min and max, inclusive.
@@ -193,4 +202,15 @@ public class Utils {
double f = i + 273.15F;
return (int)decimalRoundingToWholes(f);
}
+
+ public static Timer ShortTimer(int seconds) {
+ Timer timer;
+ timer = new Timer();
+ timer.schedule(new ShortTimerTask(), seconds * 1000);
+ return timer;
+ }
+
+
}
+
+
diff --git a/src/Java/miscutil/core/util/UtilsItems.java b/src/Java/miscutil/core/util/UtilsItems.java
index c2bf2823fc..d939f2a9bc 100644
--- a/src/Java/miscutil/core/util/UtilsItems.java
+++ b/src/Java/miscutil/core/util/UtilsItems.java
@@ -7,12 +7,16 @@ import java.util.Iterator;
import java.util.List;
import miscutil.core.handler.registration.RegistrationHandler;
+import miscutil.core.lib.CORE;
+import miscutil.core.lib.LoadedMods;
+import miscutil.core.util.wrapper.var;
import net.minecraft.client.Minecraft;
import net.minecraft.item.Item;
import net.minecraft.item.ItemStack;
import net.minecraft.item.crafting.CraftingManager;
import net.minecraft.item.crafting.IRecipe;
import net.minecraftforge.oredict.ShapedOreRecipe;
+import net.minecraftforge.oredict.ShapelessOreRecipe;
import cpw.mods.fml.common.registry.GameRegistry;
public class UtilsItems {
@@ -44,16 +48,16 @@ public class UtilsItems {
}
return null;
}
-
+
public static ItemStack getSimpleStack(Item x){
try {
- ItemStack r = new ItemStack(x, 1);
- return r;
+ ItemStack r = new ItemStack(x, 1);
+ return r;
} catch(Throwable e){
return null;
}
}
-
+
public static void getItemForOreDict(String FQRN, String oreDictName, String itemName, int meta){
try {
@@ -76,14 +80,64 @@ public class UtilsItems {
}
}
+ @SuppressWarnings("unused")
+ public static ItemStack getItemStackWithMeta(boolean MOD, String FQRN, String itemName, int meta, int itemstackSize){
+ if (MOD){
+ try {
+ Item em = null;
+ Item em1 = getItem(FQRN);
+ Utils.LOG_WARNING("Found: "+em1.getUnlocalizedName()+":"+meta);
+ if (em1 != null){
+ if (null == em){
+ em = em1;
+ }
+ if (em != null){
+ ItemStack metaStack = new ItemStack(em,itemstackSize,meta);
+ return metaStack;
+ }
+ }
+ return null;
+ } catch (NullPointerException e) {
+ Utils.LOG_ERROR(itemName+" not found. [NULL]");
+ return null;
+ }
+ }
+ return null;
+ }
+
+ public static ItemStack getCorrectStacktype(String fqrn, int stackSize){
+ String oreDict = "ore:";
+ ItemStack temp;
+ if (fqrn.toLowerCase().contains(oreDict.toLowerCase())){
+ String sanitizedName = fqrn.replace(oreDict, "");
+ temp = UtilsItems.getItemStack(sanitizedName, stackSize);
+ return temp;
+ }
+ String[] fqrnSplit = fqrn.split(":");
+ if(fqrnSplit[2] == null){fqrnSplit[2] = "0";}
+ temp = UtilsItems.getItemStackWithMeta(LoadedMods.MiscUtils, fqrn, fqrnSplit[1], Integer.parseInt(fqrnSplit[2]), stackSize);
+ return temp;
+ }
+
+ public static ItemStack getCorrectStacktype(Object item_Input, int stackSize) {
+ if (item_Input instanceof String){
+ return getCorrectStacktype(item_Input, stackSize);
+ }
+ else if (item_Input instanceof ItemStack){
+ return (ItemStack) item_Input;
+ }
+ if (item_Input instanceof var){
+ return ((var) item_Input).getStack(stackSize);
+ }
+ return null;
+ }
+
public static void recipeBuilder(Object slot_1, Object slot_2, Object slot_3, Object slot_4, Object slot_5, Object slot_6, Object slot_7, Object slot_8, Object slot_9, ItemStack resultItem){
ArrayList<Object> validSlots = new ArrayList<Object>();
- //, String lineFirst, String lineSecond, String lineThird
Utils.LOG_INFO("Trying to add a recipe for "+resultItem.toString());
- String a,b,c,d,e,f,g,h,i;
- //ItemStack empty = new ItemStack(Blocks.air);
+ String a,b,c,d,e,f,g,h,i;
if (slot_1 == null){ a = " ";} else { a = "1";validSlots.add('1');validSlots.add(slot_1);}
Utils.LOG_WARNING(a);
if (slot_2 == null){ b = " ";} else { b = "2";validSlots.add('2');validSlots.add(slot_2);}
@@ -118,8 +172,11 @@ public class UtilsItems {
validSlots.add(0, lineOne);
validSlots.add(1, lineTwo);
validSlots.add(2, lineThree);
- Boolean AadvancedLog = true;
- if (AadvancedLog){
+ boolean advancedLog = false;
+ if (CORE.DEBUG){
+ advancedLog = true;
+ }
+ if (advancedLog){
int j = 0;
int l = validSlots.size();
Utils.LOG_WARNING("l:"+l);
@@ -152,40 +209,9 @@ public class UtilsItems {
}
try {
- /*Utils.LOG_WARNING("validSlots to array: "+validSlots.toArray());
- Object[] validSlotsArray = (Object[]) validSlots.toArray();
-
- for(int j = 0; j < validSlotsArray.length; j++)
- {
- Utils.LOG_ERROR(""+validSlotsArray[j]);
- }*/
-
GameRegistry.addRecipe(new ShapedOreRecipe(resultItem.copy(), (Object[]) validSlots.toArray()));
Utils.LOG_INFO("Success! Added a recipe for "+resultItem.toString());
- RegistrationHandler.recipesSuccess++;
- /*try {
- try {
- try {
- //Code
- }
- catch (NullPointerException | ClassCastException r){
- Utils.LOG_WARNING("@@@: Invalid Recipe detected for: "+resultItem.getUnlocalizedName());
- RegistrationHandler.recipesFailed++;
- r.printStackTrace();
- //System.exit(1);
- }
- }
- catch (NullPointerException o){
-
- Utils.LOG_WARNING("@@@: Invalid Recipe detected for: "+resultItem.getUnlocalizedName());
- o.printStackTrace();
- RegistrationHandler.recipesFailed++;
- //System.exit(1);
- }
- }
- catch (ClassCastException r){
- Utils.LOG_WARNING("@@@: Casting to ObjectArray Failed :(");
- }*/
+ RegistrationHandler.recipesSuccess++;
}
catch(NullPointerException | ClassCastException k){
k.getMessage();
@@ -194,10 +220,71 @@ public class UtilsItems {
k.getLocalizedMessage();
Utils.LOG_WARNING("@@@: Invalid Recipe detected for: "+resultItem.getUnlocalizedName());
RegistrationHandler.recipesFailed++;
- //System.exit(1);
}
}
+ public static void shapelessBuilder(ItemStack Output, Object slot_1, Object slot_2, Object slot_3, Object slot_4, Object slot_5, Object slot_6, Object slot_7, Object slot_8, Object slot_9){
+ //Item output_ITEM = Output.getItem();
+
+ ArrayList<Object> validSlots = new ArrayList<Object>();
+
+ Utils.LOG_INFO("Trying to add a recipe for "+Output.toString());
+ String a,b,c,d,e,f,g,h,i;
+ if (slot_1 == null){ a = " ";} else { a = "1";validSlots.add('1');validSlots.add(slot_1);}
+ Utils.LOG_WARNING(a);
+ if (slot_2 == null){ b = " ";} else { b = "2";validSlots.add('2');validSlots.add(slot_2);}
+ Utils.LOG_WARNING(b);
+ if (slot_3 == null){ c = " ";} else { c = "3";validSlots.add('3');validSlots.add(slot_3);}
+ Utils.LOG_WARNING(c);
+ if (slot_4 == null){ d = " ";} else { d = "4";validSlots.add('4');validSlots.add(slot_4);}
+ Utils.LOG_WARNING(d);
+ if (slot_5 == null){ e = " ";} else { e = "5";validSlots.add('5');validSlots.add(slot_5);}
+ Utils.LOG_WARNING(e);
+ if (slot_6 == null){ f = " ";} else { f = "6";validSlots.add('6');validSlots.add(slot_6);}
+ Utils.LOG_WARNING(f);
+ if (slot_7 == null){ g = " ";} else { g = "7";validSlots.add('7');validSlots.add(slot_7);}
+ Utils.LOG_WARNING(g);
+ if (slot_8 == null){ h = " ";} else { h = "8";validSlots.add('8');validSlots.add(slot_8);}
+ Utils.LOG_WARNING(h);
+ if (slot_9 == null){ i = " ";} else { i = "9";validSlots.add('9');validSlots.add(slot_9);}
+ Utils.LOG_WARNING(i);
+
+
+ Utils.LOG_ERROR("_______");
+ String lineOne = a+b+c;
+ Utils.LOG_ERROR("|"+a+"|"+b+"|"+c+"|");
+ Utils.LOG_ERROR("_______");
+ String lineTwo = d+e+f;
+ Utils.LOG_ERROR("|"+d+"|"+e+"|"+f+"|");
+ Utils.LOG_ERROR("_______");
+ String lineThree = g+h+i;
+ Utils.LOG_ERROR("|"+g+"|"+h+"|"+i+"|");
+ Utils.LOG_ERROR("_______");
+
+ validSlots.add(0, lineOne);
+ validSlots.add(1, lineTwo);
+ validSlots.add(2, lineThree);
+
+ try {
+ //GameRegistry.addRecipe(new ShapelessOreRecipe(Output, outputAmount), (Object[]) validSlots.toArray());
+ GameRegistry.addRecipe(new ShapelessOreRecipe(Output, (Object[]) validSlots.toArray()));
+ //GameRegistry.addShapelessRecipe(new ItemStack(output_ITEM, 1), new Object[] {slot_1, slot_2});
+ Utils.LOG_INFO("Success! Added a recipe for "+Output.toString());
+ RegistrationHandler.recipesSuccess++;
+ }
+ catch(RuntimeException k){
+ k.getMessage();
+ k.getClass();
+ k.printStackTrace();
+ k.getLocalizedMessage();
+ Utils.LOG_WARNING("@@@: Invalid Recipe detected for: "+Output.getUnlocalizedName());
+ RegistrationHandler.recipesFailed++;
+ }
+
+
+ //GameRegistry.addShapelessRecipe(new ItemStack(output_ITEM, 1), new Object[] {slot_1, slot_2});
+ }
+
public static Item getItem(String fqrn) // fqrn = fully qualified resource name
{
String[] fqrnSplit = fqrn.split(":");
@@ -209,14 +296,14 @@ public class UtilsItems {
String[] fqrnSplit = fqrn.split(":");
return GameRegistry.findItemStack(fqrnSplit[0], fqrnSplit[1], Size);
}
-
+
// TODO
/*public static FluidStack getFluidStack(Materials m, int Size) // fqrn = fully qualified resource name
{
String[] fqrnSplit = fqrn.split(":");
-
+
FluidStack x = (FluidStack) "Materials."+m+".getFluid"(Size);
-
+
return GameRegistry.findItemStack(fqrnSplit[0], fqrnSplit[1], Size);
}*/
@@ -304,4 +391,53 @@ public class UtilsItems {
Utils.LOG_INFO("Return false, because something went wrong.");
return false;
}
+
+ public static void recipeBuilder(Object[] array, ItemStack outPut) {
+ Object a=null;
+ Object b=null;
+ Object c=null;
+ Object d=null;
+ Object e=null;
+ Object f=null;
+ Object g=null;
+ Object h=null;
+ Object i=null;
+ for(int z =0; z < array.length; z++){
+ array[z].toString();
+ switch(z)
+ {
+ case 0:
+ a = array[z];
+ break;
+ case 1:
+ b = array[z];
+ break;
+ case 2:
+ c = array[z];
+ break;
+ case 3:
+ d = array[z];
+ break;
+ case 4:
+ e = array[z];
+ break;
+ case 5:
+ f = array[z];
+ break;
+ case 6:
+ g = array[z];
+ break;
+ case 7:
+ h = array[z];
+ break;
+ case 8:
+ i = array[z];
+ break;
+ default:
+ break;
+ }
+ recipeBuilder(a, b, c, d, e, f, g, h, i, outPut);
+ }
+ }
+
}
diff --git a/src/Java/miscutil/core/util/debug/DEBUG_BLOCK_ShapeSpawner.java b/src/Java/miscutil/core/util/debug/DEBUG_BLOCK_ShapeSpawner.java
new file mode 100644
index 0000000000..2c39fe0917
--- /dev/null
+++ b/src/Java/miscutil/core/util/debug/DEBUG_BLOCK_ShapeSpawner.java
@@ -0,0 +1,139 @@
+package miscutil.core.util.debug;
+
+import gregtech.api.interfaces.ITexture;
+import gregtech.api.interfaces.metatileentity.IMetaTileEntity;
+import gregtech.api.interfaces.tileentity.IGregTechTileEntity;
+import miscutil.core.util.Utils;
+import net.minecraft.item.ItemStack;
+import net.minecraftforge.common.util.ForgeDirection;
+
+public class DEBUG_BLOCK_ShapeSpawner extends DEBUG_MULTIBLOCK_ShapeSpawner {
+
+ private static boolean controller;
+
+ public DEBUG_BLOCK_ShapeSpawner(int aID, String aName, String aNameRegional) {
+ super(aID, aName, aNameRegional);
+ }
+
+ public DEBUG_BLOCK_ShapeSpawner(String aName) {
+ super(aName);
+ }
+
+ @Override
+ public IMetaTileEntity newMetaEntity(IGregTechTileEntity aTileEntity) {
+ return new DEBUG_BLOCK_ShapeSpawner(this.mName);
+ }
+
+
+ public String[] getDescription() {
+ return new String[]{
+ "Controller Block for the Testing",
+ "Create the shapes for Multiblocks.",};
+ }
+
+
+ @Override
+ public ITexture[] getTexture(IGregTechTileEntity arg0, byte arg1,
+ byte arg2, byte arg3, boolean arg4, boolean arg5) {
+ // TODO Auto-generated method stub
+ return null;
+ }
+
+ @Override
+ public boolean isCorrectMachinePart(ItemStack aStack) {
+ // TODO Auto-generated method stub
+ return false;
+ }
+
+ @Override
+ public boolean checkRecipe(ItemStack aStack) {
+ // TODO Auto-generated method stub
+ return false;
+ }
+
+ @Override
+ public boolean checkMachine(IGregTechTileEntity aBaseMetaTileEntity, ItemStack aStack) {
+
+ int xDir = ForgeDirection.getOrientation(aBaseMetaTileEntity.getBackFacing()).offsetX;
+ int zDir = ForgeDirection.getOrientation(aBaseMetaTileEntity.getBackFacing()).offsetZ;
+
+ if (!aBaseMetaTileEntity.getAirOffset(xDir, 0, zDir)) {
+ return false;
+ }
+
+ int stepX = aBaseMetaTileEntity.getXCoord();
+ int stepY = aBaseMetaTileEntity.getYCoord();
+ int stepZ = aBaseMetaTileEntity.getZCoord();
+ int temp = 0;
+
+ Utils.LOG_INFO("Starting Block located @ "+"[X:"+stepX+"][Y:"+stepY+"][Z:"+stepZ+"]");
+
+ int tAmount = 0;
+ switch (xDir) {
+ case -1:
+ stepX++;
+ Utils.LOG_INFO("Modifying stepX + accomodate a "+xDir+" xDir - [X:"+stepX+"][Y:"+stepY+"][Z:"+stepZ+"]");
+ break;
+
+ case 1:
+ stepX--;
+ Utils.LOG_INFO("Modifying stepX - accomodate a "+xDir+" xDir - [X:"+stepX+"][Y:"+stepY+"][Z:"+stepZ+"]");
+ break;
+ }
+ switch (zDir) {
+ case -1:
+ stepZ++;
+ Utils.LOG_INFO("Modifying stepZ + accomodate a "+zDir+" zDir - [X:"+stepX+"][Y:"+stepY+"][Z:"+stepZ+"]");
+ break;
+
+ case 1:
+ stepZ--;
+ Utils.LOG_INFO("Modifying stepZ - accomodate a "+zDir+" zDir - [X:"+stepX+"][Y:"+stepY+"][Z:"+stepZ+"]");
+ break;
+ }
+
+ for (int i = stepX-1; i <= stepX+1; i++){
+ for (int j = stepZ-1; j <= stepZ+1; j++){
+ for (int h = stepY-1; h <= stepY+1; h++){
+
+
+ Utils.LOG_INFO("Block Facing - X:"+xDir+" Z:"+zDir);
+ Utils.LOG_INFO("(h != 0) || (((xDir + i != 0) || (zDir + j != 0)) && ((i != 0) || (j != 0)))");
+ Utils.LOG_INFO(" "+(h != 0)+" || "+(((xDir + i != 0)+" || "+(zDir + j != 0))+" && "+((i != 0)+" || "+(j != 0))));
+ }
+ }
+ }
+ return false;
+ }
+
+ @Override
+ public int getMaxEfficiency(ItemStack aStack) {
+ // TODO Auto-generated method stub
+ return 0;
+ }
+
+ @Override
+ public int getPollutionPerTick(ItemStack aStack) {
+ // TODO Auto-generated method stub
+ return 0;
+ }
+
+ @Override
+ public int getDamageToComponent(ItemStack aStack) {
+ // TODO Auto-generated method stub
+ return 0;
+ }
+
+ @Override
+ public int getAmountOfOutputs() {
+ // TODO Auto-generated method stub
+ return 0;
+ }
+
+ @Override
+ public boolean explodesOnComponentBreak(ItemStack aStack) {
+ // TODO Auto-generated method stub
+ return false;
+ }
+
+}
diff --git a/src/Java/miscutil/core/util/debug/DEBUG_INIT.java b/src/Java/miscutil/core/util/debug/DEBUG_INIT.java
new file mode 100644
index 0000000000..7b83137860
--- /dev/null
+++ b/src/Java/miscutil/core/util/debug/DEBUG_INIT.java
@@ -0,0 +1,37 @@
+package miscutil.core.util.debug;
+
+import miscutil.core.creative.AddToCreativeTab;
+import miscutil.core.item.ModItems;
+import miscutil.core.lib.CORE;
+import net.minecraftforge.common.MinecraftForge;
+import cpw.mods.fml.common.registry.GameRegistry;
+
+public class DEBUG_INIT {
+
+ public static void registerBlocks(){
+ //Debug Loading
+ if (CORE.DEBUG){
+
+ }
+ }
+
+ public static void registerItems(){
+ ModItems.itemDebugShapeSpawner = new DEBUG_ITEM_ShapeSpawner("itemDebugShapeSpawner", AddToCreativeTab.tabMisc, 1, 500);
+ GameRegistry.registerItem(ModItems.itemDebugShapeSpawner, "itemDebugShapeSpawner");
+ }
+
+ public static void registerTEs(){
+
+ }
+
+ public static void registerMisc(){
+
+
+
+ }
+
+ public static void registerHandlers(){
+ MinecraftForge.EVENT_BUS.register(new DEBUG_ScreenOverlay());
+ }
+
+}
diff --git a/src/Java/miscutil/core/util/debug/DEBUG_ITEM_ShapeSpawner.java b/src/Java/miscutil/core/util/debug/DEBUG_ITEM_ShapeSpawner.java
new file mode 100644
index 0000000000..47bf9977ff
--- /dev/null
+++ b/src/Java/miscutil/core/util/debug/DEBUG_ITEM_ShapeSpawner.java
@@ -0,0 +1,55 @@
+package miscutil.core.util.debug;
+
+import static net.minecraftforge.event.entity.player.PlayerInteractEvent.Action.RIGHT_CLICK_BLOCK;
+
+import java.util.List;
+
+import miscutil.core.creative.AddToCreativeTab;
+import miscutil.core.item.base.BaseItemGeneric;
+import miscutil.core.util.Utils;
+import net.minecraft.creativetab.CreativeTabs;
+import net.minecraft.entity.player.EntityPlayer;
+import net.minecraft.item.ItemStack;
+import net.minecraft.util.EnumChatFormatting;
+import net.minecraft.world.World;
+import net.minecraftforge.event.entity.player.PlayerInteractEvent;
+import cpw.mods.fml.common.eventhandler.SubscribeEvent;
+
+public class DEBUG_ITEM_ShapeSpawner extends BaseItemGeneric{
+
+ public DEBUG_ITEM_ShapeSpawner(String s, CreativeTabs c, int stackSize, int maxDmg) {
+ super(s, c, stackSize, maxDmg);
+ s = "itemDebugShapeSpawner";
+ c = AddToCreativeTab.tabMisc;
+ stackSize = 1;
+ maxDmg = 500;
+ }
+
+ @Override
+ public ItemStack onItemRightClick(ItemStack stack, World world, EntityPlayer player){
+
+ if (!world.isRemote){
+ Utils.LOG_INFO("Constructing the shape for the "+"VACUUM FREEZER");
+ Thread thread = new Thread(new DEBUG_TimerThread(world, player));
+ thread.start();
+ }
+ return stack;
+ }
+
+
+
+ @SuppressWarnings("static-method")
+ @SubscribeEvent
+ public void playerInteractEventHandler(PlayerInteractEvent event)
+ {
+ if (event.isCanceled() || event.world.isRemote || event.action != RIGHT_CLICK_BLOCK) return;
+ }
+
+ @SuppressWarnings({ "unchecked", "rawtypes" })
+ @Override
+ public void addInformation(ItemStack stack, EntityPlayer aPlayer, List list, boolean bool) {
+ list.add(EnumChatFormatting.GOLD+"For Testing Gregtech Shapes!");
+ super.addInformation(stack, aPlayer, list, bool);
+ }
+
+}
diff --git a/src/Java/miscutil/core/util/debug/DEBUG_MULTIBLOCK_ShapeSpawner.java b/src/Java/miscutil/core/util/debug/DEBUG_MULTIBLOCK_ShapeSpawner.java
new file mode 100644
index 0000000000..b81a08ecf6
--- /dev/null
+++ b/src/Java/miscutil/core/util/debug/DEBUG_MULTIBLOCK_ShapeSpawner.java
@@ -0,0 +1,805 @@
+package miscutil.core.util.debug;
+
+import static gregtech.api.enums.GT_Values.V;
+import gregtech.GT_Mod;
+import gregtech.api.GregTech_API;
+import gregtech.api.enums.ConfigCategories;
+import gregtech.api.enums.Materials;
+import gregtech.api.enums.OrePrefixes;
+import gregtech.api.gui.GT_Container_MultiMachine;
+import gregtech.api.gui.GT_GUIContainer_MultiMachine;
+import gregtech.api.interfaces.metatileentity.IMetaTileEntity;
+import gregtech.api.interfaces.tileentity.IGregTechTileEntity;
+import gregtech.api.items.GT_MetaGenerated_Tool;
+import gregtech.api.metatileentity.MetaTileEntity;
+import gregtech.api.metatileentity.implementations.GT_MetaTileEntity_Hatch;
+import gregtech.api.metatileentity.implementations.GT_MetaTileEntity_Hatch_Dynamo;
+import gregtech.api.metatileentity.implementations.GT_MetaTileEntity_Hatch_Energy;
+import gregtech.api.metatileentity.implementations.GT_MetaTileEntity_Hatch_Input;
+import gregtech.api.metatileentity.implementations.GT_MetaTileEntity_Hatch_InputBus;
+import gregtech.api.metatileentity.implementations.GT_MetaTileEntity_Hatch_Maintenance;
+import gregtech.api.metatileentity.implementations.GT_MetaTileEntity_Hatch_Muffler;
+import gregtech.api.metatileentity.implementations.GT_MetaTileEntity_Hatch_Output;
+import gregtech.api.metatileentity.implementations.GT_MetaTileEntity_Hatch_OutputBus;
+import gregtech.api.objects.GT_ItemStack;
+import gregtech.api.util.GT_ModHandler;
+import gregtech.api.util.GT_OreDictUnificator;
+import gregtech.api.util.GT_Recipe.GT_Recipe_Map;
+import gregtech.api.util.GT_Utility;
+import gregtech.common.items.GT_MetaGenerated_Tool_01;
+
+import java.util.ArrayList;
+
+import net.minecraft.entity.player.EntityPlayer;
+import net.minecraft.entity.player.InventoryPlayer;
+import net.minecraft.item.ItemStack;
+import net.minecraft.nbt.NBTTagCompound;
+import net.minecraftforge.fluids.FluidStack;
+
+public abstract class DEBUG_MULTIBLOCK_ShapeSpawner extends MetaTileEntity {
+
+ public static boolean disableMaintenance;
+ public boolean mMachine = false, mWrench = false, mScrewdriver = false, mSoftHammer = false, mHardHammer = false, mSolderingTool = false, mCrowbar = false, mRunningOnLoad = false;
+ public int mPollution = 0, mProgresstime = 0, mMaxProgresstime = 0, mEUt = 0, mEfficiencyIncrease = 0, mUpdate = 0, mStartUpCheck = 100, mRuntime = 0, mEfficiency = 0;
+ public ItemStack[] mOutputItems = null;
+ public FluidStack[] mOutputFluids = null;
+ public ArrayList<GT_MetaTileEntity_Hatch_Input> mInputHatches = new ArrayList<GT_MetaTileEntity_Hatch_Input>();
+ public ArrayList<GT_MetaTileEntity_Hatch_Output> mOutputHatches = new ArrayList<GT_MetaTileEntity_Hatch_Output>();
+ public ArrayList<GT_MetaTileEntity_Hatch_InputBus> mInputBusses = new ArrayList<GT_MetaTileEntity_Hatch_InputBus>();
+ public ArrayList<GT_MetaTileEntity_Hatch_OutputBus> mOutputBusses = new ArrayList<GT_MetaTileEntity_Hatch_OutputBus>();
+ public ArrayList<GT_MetaTileEntity_Hatch_Dynamo> mDynamoHatches = new ArrayList<GT_MetaTileEntity_Hatch_Dynamo>();
+ public ArrayList<GT_MetaTileEntity_Hatch_Muffler> mMufflerHatches = new ArrayList<GT_MetaTileEntity_Hatch_Muffler>();
+ public ArrayList<GT_MetaTileEntity_Hatch_Energy> mEnergyHatches = new ArrayList<GT_MetaTileEntity_Hatch_Energy>();
+ public ArrayList<GT_MetaTileEntity_Hatch_Maintenance> mMaintenanceHatches = new ArrayList<GT_MetaTileEntity_Hatch_Maintenance>();
+
+ public DEBUG_MULTIBLOCK_ShapeSpawner(int aID, String aName, String aNameRegional) {
+ super(aID, aName, aNameRegional, 2);
+ this.disableMaintenance = GregTech_API.sMachineFile.get(ConfigCategories.machineconfig, "MultiBlockMachines.disableMaintenance", false);
+ }
+
+ public DEBUG_MULTIBLOCK_ShapeSpawner(String aName) {
+ super(aName, 2);
+ this.disableMaintenance = GregTech_API.sMachineFile.get(ConfigCategories.machineconfig, "MultiBlockMachines.disableMaintenance", false);
+ }
+
+ public static boolean isValidMetaTileEntity(MetaTileEntity aMetaTileEntity) {
+ return aMetaTileEntity.getBaseMetaTileEntity() != null && aMetaTileEntity.getBaseMetaTileEntity().getMetaTileEntity() == aMetaTileEntity && !aMetaTileEntity.getBaseMetaTileEntity().isDead();
+ }
+
+ @Override
+ public boolean allowCoverOnSide(byte aSide, GT_ItemStack aCoverID) {
+ return aSide != getBaseMetaTileEntity().getFrontFacing();
+ }
+
+ @Override
+ public boolean isSimpleMachine() {
+ return false;
+ }
+
+ @Override
+ public boolean isFacingValid(byte aFacing) {
+ return true;
+ }
+
+ @Override
+ public boolean isAccessAllowed(EntityPlayer aPlayer) {
+ return true;
+ }
+
+ @Override
+ public boolean isValidSlot(int aIndex) {
+ return aIndex > 0;
+ }
+
+ @Override
+ public int getProgresstime() {
+ return mProgresstime;
+ }
+
+ @Override
+ public int maxProgresstime() {
+ return mMaxProgresstime;
+ }
+
+ @Override
+ public int increaseProgress(int aProgress) {
+ return aProgress;
+ }
+
+ @Override
+ public void saveNBTData(NBTTagCompound aNBT) {
+ aNBT.setInteger("mEUt", mEUt);
+ aNBT.setInteger("mProgresstime", mProgresstime);
+ aNBT.setInteger("mMaxProgresstime", mMaxProgresstime);
+ aNBT.setInteger("mEfficiencyIncrease", mEfficiencyIncrease);
+ aNBT.setInteger("mEfficiency", mEfficiency);
+ aNBT.setInteger("mPollution", mPollution);
+ aNBT.setInteger("mRuntime", mRuntime);
+
+ if (mOutputItems != null) for (int i = 0; i < mOutputItems.length; i++)
+ if (mOutputItems[i] != null) {
+ NBTTagCompound tNBT = new NBTTagCompound();
+ mOutputItems[i].writeToNBT(tNBT);
+ aNBT.setTag("mOutputItem" + i, tNBT);
+ }
+ if (mOutputFluids != null) for (int i = 0; i < mOutputFluids.length; i++)
+ if (mOutputFluids[i] != null) {
+ NBTTagCompound tNBT = new NBTTagCompound();
+ mOutputFluids[i].writeToNBT(tNBT);
+ aNBT.setTag("mOutputFluids" + i, tNBT);
+ }
+
+ aNBT.setBoolean("mWrench", mWrench);
+ aNBT.setBoolean("mScrewdriver", mScrewdriver);
+ aNBT.setBoolean("mSoftHammer", mSoftHammer);
+ aNBT.setBoolean("mHardHammer", mHardHammer);
+ aNBT.setBoolean("mSolderingTool", mSolderingTool);
+ aNBT.setBoolean("mCrowbar", mCrowbar);
+ }
+
+ @Override
+ public void loadNBTData(NBTTagCompound aNBT) {
+ mEUt = aNBT.getInteger("mEUt");
+ mProgresstime = aNBT.getInteger("mProgresstime");
+ mMaxProgresstime = aNBT.getInteger("mMaxProgresstime");
+ if (mMaxProgresstime > 0) mRunningOnLoad = true;
+ mEfficiencyIncrease = aNBT.getInteger("mEfficiencyIncrease");
+ mEfficiency = aNBT.getInteger("mEfficiency");
+ mPollution = aNBT.getInteger("mPollution");
+ mRuntime = aNBT.getInteger("mRuntime");
+ mOutputItems = new ItemStack[getAmountOfOutputs()];
+ for (int i = 0; i < mOutputItems.length; i++) mOutputItems[i] = GT_Utility.loadItem(aNBT, "mOutputItem" + i);
+ mOutputFluids = new FluidStack[getAmountOfOutputs()];
+ for (int i = 0; i < mOutputFluids.length; i++)
+ mOutputFluids[i] = GT_Utility.loadFluid(aNBT, "mOutputFluids" + i);
+ mWrench = aNBT.getBoolean("mWrench");
+ mScrewdriver = aNBT.getBoolean("mScrewdriver");
+ mSoftHammer = aNBT.getBoolean("mSoftHammer");
+ mHardHammer = aNBT.getBoolean("mHardHammer");
+ mSolderingTool = aNBT.getBoolean("mSolderingTool");
+ mCrowbar = aNBT.getBoolean("mCrowbar");
+ }
+
+ @Override
+ public boolean onRightclick(IGregTechTileEntity aBaseMetaTileEntity, EntityPlayer aPlayer) {
+ if (aBaseMetaTileEntity.isClientSide()) return true;
+ aBaseMetaTileEntity.openGUI(aPlayer);
+ return true;
+ }
+
+ @Override
+ public Object getServerGUI(int aID, InventoryPlayer aPlayerInventory, IGregTechTileEntity aBaseMetaTileEntity) {
+ return new GT_Container_MultiMachine(aPlayerInventory, aBaseMetaTileEntity);
+ }
+
+ @Override
+ public Object getClientGUI(int aID, InventoryPlayer aPlayerInventory, IGregTechTileEntity aBaseMetaTileEntity) {
+ return new GT_GUIContainer_MultiMachine(aPlayerInventory, aBaseMetaTileEntity, getLocalName(), "MultiblockDisplay.png");
+ }
+
+ @Override
+ public byte getTileEntityBaseType() {
+ return 2;
+ }
+
+ @Override
+ public void onMachineBlockUpdate() {
+ mUpdate = 50;
+ }
+
+ @Override
+ public void onPostTick(IGregTechTileEntity aBaseMetaTileEntity, long aTick) {
+ if (aBaseMetaTileEntity.isServerSide()) {
+ if (mEfficiency < 0) mEfficiency = 0;
+ if (--mUpdate == 0 || --mStartUpCheck == 0) {
+ mInputHatches.clear();
+ mInputBusses.clear();
+ mOutputHatches.clear();
+ mOutputBusses.clear();
+ mDynamoHatches.clear();
+ mEnergyHatches.clear();
+ mMufflerHatches.clear();
+ mMaintenanceHatches.clear();
+ mMachine = checkMachine(aBaseMetaTileEntity, mInventory[1]);
+ }
+ if (mStartUpCheck < 0) {
+ if (mMachine) {
+ for (GT_MetaTileEntity_Hatch_Maintenance tHatch : mMaintenanceHatches) {
+ if (isValidMetaTileEntity(tHatch)) {
+ if (!this.disableMaintenance) {
+ if (tHatch.mWrench) mWrench = true;
+ if (tHatch.mScrewdriver) mScrewdriver = true;
+ if (tHatch.mSoftHammer) mSoftHammer = true;
+ if (tHatch.mHardHammer) mHardHammer = true;
+ if (tHatch.mSolderingTool) mSolderingTool = true;
+ if (tHatch.mCrowbar) mCrowbar = true;
+ } else {
+ mWrench = true;
+ mScrewdriver = true;
+ mSoftHammer = true;
+ mHardHammer = true;
+ mSolderingTool = true;
+ mCrowbar = true;
+ }
+
+ tHatch.mWrench = false;
+ tHatch.mScrewdriver = false;
+ tHatch.mSoftHammer = false;
+ tHatch.mHardHammer = false;
+ tHatch.mSolderingTool = false;
+ tHatch.mCrowbar = false;
+ }
+ }
+ if (getRepairStatus() > 0) {
+ if (mMaxProgresstime > 0 && doRandomMaintenanceDamage()) {
+ if (onRunningTick(mInventory[1])) {
+ if (!polluteEnvironment(getPollutionPerTick(mInventory[1]))) {
+ stopMachine();
+ }
+ if (mMaxProgresstime > 0 && ++mProgresstime >= mMaxProgresstime) {
+ if (mOutputItems != null) for (ItemStack tStack : mOutputItems)
+ if (tStack != null) {
+ try {
+ GT_Mod.instance.achievements.issueAchivementHatch(aBaseMetaTileEntity.getWorld().getPlayerEntityByName(aBaseMetaTileEntity.getOwnerName()), tStack);
+ } catch (Exception e) {
+ }
+ addOutput(tStack);
+ }
+ if (mOutputFluids != null && mOutputFluids.length == 1) {
+ for (FluidStack tStack : mOutputFluids)
+ if (tStack != null) {
+ addOutput(tStack);
+ }
+ } else if (mOutputFluids != null && mOutputFluids.length > 1) {
+ addFluidOutputs(mOutputFluids);
+ }
+ mEfficiency = Math.max(0, Math.min(mEfficiency + mEfficiencyIncrease, getMaxEfficiency(mInventory[1]) - ((getIdealStatus() - getRepairStatus()) * 1000)));
+ mOutputItems = null;
+ mProgresstime = 0;
+ mMaxProgresstime = 0;
+ mEfficiencyIncrease = 0;
+ if (aBaseMetaTileEntity.isAllowedToWork()) checkRecipe(mInventory[1]);
+ if (mOutputFluids != null && mOutputFluids.length > 0) {
+ if (mOutputFluids.length > 1) {
+ GT_Mod.instance.achievements.issueAchievement(aBaseMetaTileEntity.getWorld().getPlayerEntityByName(aBaseMetaTileEntity.getOwnerName()), "oilplant");
+ }
+ }
+ }
+ }
+ } else {
+ if (aTick % 100 == 0 || aBaseMetaTileEntity.hasWorkJustBeenEnabled() || aBaseMetaTileEntity.hasInventoryBeenModified()) {
+
+ if (aBaseMetaTileEntity.isAllowedToWork()) {
+ checkRecipe(mInventory[1]);
+ }
+ if (mMaxProgresstime <= 0) mEfficiency = Math.max(0, mEfficiency - 1000);
+ }
+ }
+ } else {
+ stopMachine();
+ }
+ } else {
+ stopMachine();
+ }
+ }
+ aBaseMetaTileEntity.setErrorDisplayID((aBaseMetaTileEntity.getErrorDisplayID() & ~127) | (mWrench ? 0 : 1) | (mScrewdriver ? 0 : 2) | (mSoftHammer ? 0 : 4) | (mHardHammer ? 0 : 8) | (mSolderingTool ? 0 : 16) | (mCrowbar ? 0 : 32) | (mMachine ? 0 : 64));
+ aBaseMetaTileEntity.setActive(mMaxProgresstime > 0);