aboutsummaryrefslogtreecommitdiff
path: root/src/Java/gtPlusPlus/xmod
diff options
context:
space:
mode:
Diffstat (limited to 'src/Java/gtPlusPlus/xmod')
-rw-r--r--src/Java/gtPlusPlus/xmod/gregtech/common/tileentities/machines/multi/processing/GregtechMetaTileEntity_IndustrialCokeOven.java2
-rw-r--r--src/Java/gtPlusPlus/xmod/gregtech/common/tileentities/machines/multi/processing/GregtechMetaTileEntity_IndustrialPlatePress.java52
-rw-r--r--src/Java/gtPlusPlus/xmod/gregtech/common/tileentities/machines/multi/processing/GregtechMetaTileEntity_IndustrialWashPlant.java1
-rw-r--r--src/Java/gtPlusPlus/xmod/gregtech/common/tileentities/machines/multi/storage/GregtechMetaTileEntity_PowerSubStationController.java4
-rw-r--r--src/Java/gtPlusPlus/xmod/thaumcraft/commands/CommandDumpAspects.java90
-rw-r--r--src/Java/gtPlusPlus/xmod/thaumcraft/objects/ThreadAspectScanner.java158
6 files changed, 292 insertions, 15 deletions
diff --git a/src/Java/gtPlusPlus/xmod/gregtech/common/tileentities/machines/multi/processing/GregtechMetaTileEntity_IndustrialCokeOven.java b/src/Java/gtPlusPlus/xmod/gregtech/common/tileentities/machines/multi/processing/GregtechMetaTileEntity_IndustrialCokeOven.java
index 236a071988..1a4906daab 100644
--- a/src/Java/gtPlusPlus/xmod/gregtech/common/tileentities/machines/multi/processing/GregtechMetaTileEntity_IndustrialCokeOven.java
+++ b/src/Java/gtPlusPlus/xmod/gregtech/common/tileentities/machines/multi/processing/GregtechMetaTileEntity_IndustrialCokeOven.java
@@ -87,7 +87,7 @@ extends GregtechMeta_MultiBlockBase {
@Override
public Object getClientGUI(final int aID, final InventoryPlayer aPlayerInventory, final IGregTechTileEntity aBaseMetaTileEntity) {
- return new GT_GUIContainer_MultiMachine(aPlayerInventory, aBaseMetaTileEntity, this.getLocalName(), "CokeOven.png");
+ return new GUI_MultiMachine(aPlayerInventory, aBaseMetaTileEntity, this.getLocalName(), "CokeOven.png");
}
@Override
diff --git a/src/Java/gtPlusPlus/xmod/gregtech/common/tileentities/machines/multi/processing/GregtechMetaTileEntity_IndustrialPlatePress.java b/src/Java/gtPlusPlus/xmod/gregtech/common/tileentities/machines/multi/processing/GregtechMetaTileEntity_IndustrialPlatePress.java
index 76ed97993b..9b49c888a0 100644
--- a/src/Java/gtPlusPlus/xmod/gregtech/common/tileentities/machines/multi/processing/GregtechMetaTileEntity_IndustrialPlatePress.java
+++ b/src/Java/gtPlusPlus/xmod/gregtech/common/tileentities/machines/multi/processing/GregtechMetaTileEntity_IndustrialPlatePress.java
@@ -4,9 +4,10 @@ import java.util.ArrayList;
import gregtech.api.util.GT_Utility;
import net.minecraft.block.Block;
+import net.minecraft.entity.player.EntityPlayer;
import net.minecraft.entity.player.InventoryPlayer;
import net.minecraft.item.ItemStack;
-
+import net.minecraft.nbt.NBTTagCompound;
import gregtech.api.GregTech_API;
import gregtech.api.enums.TAE;
import gregtech.api.enums.Textures;
@@ -21,13 +22,15 @@ import gregtech.api.util.GT_Recipe;
import gtPlusPlus.core.block.ModBlocks;
import gtPlusPlus.core.lib.CORE;
import gtPlusPlus.core.util.Utils;
+import gtPlusPlus.core.util.minecraft.PlayerUtils;
import gtPlusPlus.xmod.gregtech.api.gui.GUI_MultiMachine;
import gtPlusPlus.xmod.gregtech.api.metatileentity.implementations.base.GregtechMeta_MultiBlockBase;
import net.minecraftforge.common.util.ForgeDirection;
import net.minecraftforge.fluids.FluidStack;
-public class GregtechMetaTileEntity_IndustrialPlatePress
-extends GregtechMeta_MultiBlockBase {
+public class GregtechMetaTileEntity_IndustrialPlatePress extends GregtechMeta_MultiBlockBase {
+
+ private boolean mFormingMode = false;
public GregtechMetaTileEntity_IndustrialPlatePress(final int aID, final String aName, final String aNameRegional) {
super(aID, aName, aNameRegional);
@@ -44,16 +47,17 @@ extends GregtechMeta_MultiBlockBase {
@Override
public String getMachineType() {
- return "Bending Machine";
+ return "Bending Machine, Forming Press";
}
@Override
public String[] getDescription() {
- return new String[]{"Controller Block for the Material Press",
+ return new String[]{"Controller Block for Advanced Bending & Forming",
+ "Can be configured with a screwdriver to activate Forming Press Mode",
"500% faster than using single block machines of the same voltage",
"Processes four items per voltage tier",
"Circuit for recipe goes in the Input Bus",
- "Each Input Bus can have a different Circuit!",
+ "Each Input Bus can have a different Circuit/Shape!",
"Size: 3x3x3 (Hollow)",
"Controller (front centered)",
"1x Input Bus (anywhere)",
@@ -61,7 +65,7 @@ extends GregtechMeta_MultiBlockBase {
"1x Energy Hatch (anywhere)",
"1x Maintenance Hatch (anywhere)",
"1x Muffler Hatch (anywhere)",
- "Material Press Machine Casings for the rest (16 at least!)",
+ "Material Press Machine Casings for the rest (12 at least!)",
getPollutionTooltip(),
getMachineTooltip(),
CORE.GT_Tooltip};
@@ -82,17 +86,17 @@ extends GregtechMeta_MultiBlockBase {
@Override
public boolean hasSlotInGUI() {
- return true;
+ return false;
}
@Override
public Object getClientGUI(final int aID, final InventoryPlayer aPlayerInventory, final IGregTechTileEntity aBaseMetaTileEntity) {
- return new GT_GUIContainer_MultiMachine(aPlayerInventory, aBaseMetaTileEntity, this.getLocalName(), "MaterialPress.png");
+ return new GUI_MultiMachine(aPlayerInventory, aBaseMetaTileEntity, this.getLocalName(), "MaterialPress.png");
}
@Override
public GT_Recipe.GT_Recipe_Map getRecipeMap() {
- return GT_Recipe.GT_Recipe_Map.sBenderRecipes;
+ return mFormingMode ? GT_Recipe.GT_Recipe_Map.sPressRecipes : GT_Recipe.GT_Recipe_Map.sBenderRecipes;
}
@Override
@@ -148,7 +152,7 @@ extends GregtechMeta_MultiBlockBase {
}
}
}
- return tAmount >= 16;
+ return tAmount >= 12;
}
@Override
@@ -158,7 +162,7 @@ extends GregtechMeta_MultiBlockBase {
@Override
public int getPollutionPerTick(final ItemStack aStack) {
- return 12;
+ return this.mFormingMode ? 12 : 24;
}
@Override
@@ -170,4 +174,28 @@ extends GregtechMeta_MultiBlockBase {
public boolean explodesOnComponentBreak(final ItemStack aStack) {
return false;
}
+
+ @Override
+ public void saveNBTData(NBTTagCompound aNBT) {
+ aNBT.setBoolean("mFormingMode", mFormingMode);
+ super.saveNBTData(aNBT);
+ }
+
+ @Override
+ public void loadNBTData(NBTTagCompound aNBT) {
+ mFormingMode = aNBT.getBoolean("mFormingMode");
+ super.loadNBTData(aNBT);
+ }
+
+ @Override
+ public void onScrewdriverRightClick(byte aSide, EntityPlayer aPlayer, float aX, float aY, float aZ) {
+ mFormingMode = Utils.invertBoolean(mFormingMode);
+ if (mFormingMode){
+ PlayerUtils.messagePlayer(aPlayer, "Now running in Forming Press Mode.");
+ }
+ else {
+ PlayerUtils.messagePlayer(aPlayer, "Now running in Bending Mode.");
+ }
+ super.onScrewdriverRightClick(aSide, aPlayer, aX, aY, aZ);
+ }
}
diff --git a/src/Java/gtPlusPlus/xmod/gregtech/common/tileentities/machines/multi/processing/GregtechMetaTileEntity_IndustrialWashPlant.java b/src/Java/gtPlusPlus/xmod/gregtech/common/tileentities/machines/multi/processing/GregtechMetaTileEntity_IndustrialWashPlant.java
index bff82400ca..490f4b690d 100644
--- a/src/Java/gtPlusPlus/xmod/gregtech/common/tileentities/machines/multi/processing/GregtechMetaTileEntity_IndustrialWashPlant.java
+++ b/src/Java/gtPlusPlus/xmod/gregtech/common/tileentities/machines/multi/processing/GregtechMetaTileEntity_IndustrialWashPlant.java
@@ -70,6 +70,7 @@ extends GregtechMeta_MultiBlockBase {
"1x Energy Hatch (Any casing)",
"Wash Plant Casings for the rest",
getPollutionTooltip(),
+ getMachineTooltip(),
CORE.GT_Tooltip
};
diff --git a/src/Java/gtPlusPlus/xmod/gregtech/common/tileentities/machines/multi/storage/GregtechMetaTileEntity_PowerSubStationController.java b/src/Java/gtPlusPlus/xmod/gregtech/common/tileentities/machines/multi/storage/GregtechMetaTileEntity_PowerSubStationController.java
index c1e2666871..842db02479 100644
--- a/src/Java/gtPlusPlus/xmod/gregtech/common/tileentities/machines/multi/storage/GregtechMetaTileEntity_PowerSubStationController.java
+++ b/src/Java/gtPlusPlus/xmod/gregtech/common/tileentities/machines/multi/storage/GregtechMetaTileEntity_PowerSubStationController.java
@@ -267,7 +267,7 @@ public class GregtechMetaTileEntity_PowerSubStationController extends GregtechMe
checkMachineProblem("Energy hatch (tier " + tier + ") is too strong for cells (tier " + tOverallCellTier + ")");
return false;
}
- if(tier < 512) {
+ if(tier < 3) {
checkMachineProblem("Energy hatch (tier " + tier + ") is too weak for cells (tier " + tOverallCellTier + ")");
return false;
}
@@ -281,7 +281,7 @@ public class GregtechMetaTileEntity_PowerSubStationController extends GregtechMe
checkMachineProblem("Dynamo hatch (tier " + tier + ") is too strong for cells (tier " + tOverallCellTier + ")");
return false;
}
- if(tier < 512) {
+ if(tier < 3) {
checkMachineProblem("Energy hatch (tier " + tier + ") is too weak for cells (tier " + tOverallCellTier + ")");
return false;
}
diff --git a/src/Java/gtPlusPlus/xmod/thaumcraft/commands/CommandDumpAspects.java b/src/Java/gtPlusPlus/xmod/thaumcraft/commands/CommandDumpAspects.java
new file mode 100644
index 0000000000..dda5a62b27
--- /dev/null
+++ b/src/Java/gtPlusPlus/xmod/thaumcraft/commands/CommandDumpAspects.java
@@ -0,0 +1,90 @@
+package gtPlusPlus.xmod.thaumcraft.commands;
+
+import static gtPlusPlus.core.util.minecraft.PlayerUtils.messagePlayer;
+
+import java.util.ArrayList;
+import java.util.List;
+
+import gtPlusPlus.api.objects.Logger;
+import gtPlusPlus.core.commands.CommandUtils;
+import gtPlusPlus.core.util.minecraft.PlayerUtils;
+import gtPlusPlus.xmod.thaumcraft.objects.ThreadAspectScanner;
+import net.minecraft.command.ICommand;
+import net.minecraft.command.ICommandSender;
+import net.minecraft.entity.player.EntityPlayer;
+
+public class CommandDumpAspects implements ICommand {
+ private final List<String> aliases;
+ public static long mLastScanTime = System.currentTimeMillis();
+
+ public CommandDumpAspects() {
+ this.aliases = new ArrayList<>();
+ this.aliases.add("DA");
+ this.aliases.add("da");
+ this.aliases.add("dumpaspects");
+ this.aliases.add("dumptc");
+ Logger.INFO("Registered Aspect Dump Command.");
+ }
+
+ @Override
+ public int compareTo(final Object o) {
+ return 0;
+ }
+
+ @Override
+ public String getCommandName() {
+ return "DumpAspects";
+ }
+
+ @Override
+ public String getCommandUsage(final ICommandSender var1) {
+ return "/DumpAspects";
+ }
+
+ @Override
+ public List<String> getCommandAliases() {
+ return this.aliases;
+ }
+
+ @Override
+ public void processCommand(final ICommandSender S, final String[] argString) {
+ final EntityPlayer P = CommandUtils.getPlayer(S);
+ final long T = System.currentTimeMillis();
+ final long D = T - mLastScanTime;
+ final int Z = (int) (D / 1000);
+ if (Z >= 30) {
+ // Lets process this in the Background on a new Thread.
+ Thread t = createNewThread();
+ messagePlayer(P, "Beginning to dump information about all items/blocks & their aspects to file.");
+ messagePlayer(P, "Please do not close your game during this process, you will be notified upon completion.");
+ t.start();
+ } else {
+ messagePlayer(P, "Your last run of DA was less than 30 seconds ago, please wait " + (30 - Z)
+ + " seconds before trying again.");
+ }
+ }
+
+ @Override
+ public boolean canCommandSenderUseCommand(final ICommandSender var1) {
+ final EntityPlayer P = CommandUtils.getPlayer(var1);
+ if (P == null || !PlayerUtils.isPlayerOP(P)) {
+ return false;
+ }
+ return true;
+ }
+
+ @Override
+ public List<?> addTabCompletionOptions(final ICommandSender var1, final String[] var2) {
+ return null;
+ }
+
+ @Override
+ public boolean isUsernameIndex(final String[] var1, final int var2) {
+ return false;
+ }
+
+ private static Thread createNewThread() {
+ return new ThreadAspectScanner();
+ }
+
+} \ No newline at end of file
diff --git a/src/Java/gtPlusPlus/xmod/thaumcraft/objects/ThreadAspectScanner.java b/src/Java/gtPlusPlus/xmod/thaumcraft/objects/ThreadAspectScanner.java
new file mode 100644
index 0000000000..491633b381
--- /dev/null
+++ b/src/Java/gtPlusPlus/xmod/thaumcraft/objects/ThreadAspectScanner.java
@@ -0,0 +1,158 @@
+package gtPlusPlus.xmod.thaumcraft.objects;
+
+import java.io.File;
+import java.util.ArrayList;
+import java.util.HashMap;
+import java.util.Iterator;
+import java.util.List;
+import java.util.Map;
+import java.util.Set;
+
+import gtPlusPlus.api.objects.Logger;
+import gtPlusPlus.api.objects.data.AutoMap;
+import gtPlusPlus.api.objects.data.Pair;
+import gtPlusPlus.core.util.Utils;
+import gtPlusPlus.core.util.data.FileUtils;
+import gtPlusPlus.core.util.minecraft.ItemUtils;
+import gtPlusPlus.xmod.thaumcraft.commands.CommandDumpAspects;
+import net.minecraft.block.Block;
+import net.minecraft.item.Item;
+import net.minecraft.item.ItemStack;
+
+public class ThreadAspectScanner extends Thread {
+
+ public static boolean mDoWeScan = false;
+ private static final Map<String, AutoMap<ItemStack>> mAllGameContent = new HashMap<String, AutoMap<ItemStack>>();
+ public final File mAspectCacheFile;
+
+ public ThreadAspectScanner() {
+ mAspectCacheFile = FileUtils.getFile("config/GTplusplus", "AspectInfo", "txt");
+ mDoWeScan = true;
+ }
+
+ private void tryCacheObject(ItemStack aStack) {
+ if (aStack == null) {
+ return;
+ }
+ String nameKey;
+ try {
+ nameKey = aStack.getUnlocalizedName();
+ } catch (NullPointerException n) {
+ try {
+ nameKey = Utils.sanitizeString(aStack.getDisplayName().toLowerCase());
+ } catch (NullPointerException n2) {
+ try {
+ nameKey = aStack.getItem().getUnlocalizedName();
+ } catch (NullPointerException n3) {
+ nameKey = "BadItemsGalore";
+ }
+ }
+ }
+ AutoMap<ItemStack> m = new AutoMap<ItemStack>();
+ if (mAllGameContent.containsKey(nameKey)) {
+ m = mAllGameContent.get(nameKey);
+ }
+ m.put(aStack);
+ mAllGameContent.put(nameKey, m);
+ }
+
+ @SuppressWarnings({ "rawtypes" })
+ @Override
+ public void run() {
+ if (mDoWeScan) {
+ Iterator iterator;
+ Logger.INFO("Finding Blocks and Items to scan for Aspect data.");
+ long mBlocksCounter = 0;
+ long mItemsCounter = 0;
+
+ // First, find blocks
+ iterator = Block.blockRegistry.getKeys().iterator();
+ while (iterator.hasNext()) {
+ String s = (String) iterator.next();
+ Block block = (Block) Block.blockRegistry.getObject(s);
+ if (block != null) {
+ tryCacheObject(ItemUtils.getSimpleStack(block));
+ mBlocksCounter++;
+ }
+ }
+ Logger.INFO("Completed Block Scan. Counted "+mBlocksCounter);
+
+ // Second Find items, Skipping things that exist.
+ iterator = Item.itemRegistry.getKeys().iterator();
+ while (iterator.hasNext()) {
+ String s = (String) iterator.next();
+ Item item = (Item) Item.itemRegistry.getObject(s);
+ if (item != null) {
+ if (item.getHasSubtypes()) {
+ List q1 = new ArrayList();
+ item.getSubItems(item, item.getCreativeTab(), q1);
+ if (q1 != null && q1.size() > 0) {
+ for (int e = 0; e < q1.size(); e++) {
+ ItemStack check = ItemUtils.simpleMetaStack(item, e, 1);
+ if (check != null) {
+ tryCacheObject(check);
+ mItemsCounter++;
+ }
+ }
+ } else {
+ tryCacheObject(ItemUtils.getSimpleStack(item));
+ mItemsCounter++;
+ }
+ } else {
+ tryCacheObject(ItemUtils.getSimpleStack(item));
+ mItemsCounter++;
+ }
+ }
+ }
+ Logger.INFO("Completed Item Scan. Counted "+mItemsCounter);
+
+ Set<String> y = mAllGameContent.keySet();
+ Logger.INFO("Beginning iteration of "+y.size()+" itemstacks for aspect information.");
+
+ for (String key : y) {
+ //Logger.INFO("Looking for key: "+key);
+ if (mAllGameContent.containsKey(key)) {
+ AutoMap<ItemStack> group = mAllGameContent.get(key);
+ if (group == null || group.size() <= 0) {
+ continue;
+ }
+ for (ItemStack stack : group) {
+ thaumcraft.api.aspects.AspectList a = thaumcraft.common.lib.crafting.ThaumcraftCraftingManager
+ .getObjectTags(stack);
+ if (a == null) {
+ continue;
+ } else {
+ AutoMap<Pair<String, Integer>> aspectPairs = new AutoMap<Pair<String, Integer>>();
+ for (thaumcraft.api.aspects.Aspect c : a.getAspectsSortedAmount()) {
+ if (c != null) {
+ aspectPairs.put(new Pair<String, Integer>(c.getName(), a.getAmount(c)));
+ }
+ }
+ try {
+ List<String> mList = new ArrayList<String>();
+ mList.add(stack.getDisplayName() + " | Meta: " + stack.getItemDamage()
+ + " | Unlocal: " + stack.getUnlocalizedName());
+ for (Pair<String, Integer> r : aspectPairs) {
+ if (r != null) {
+ mList.add(r.getKey() + " x" + r.getValue());
+ }
+ }
+ mList.add("");
+ if (mAspectCacheFile != null && mList.size() >= 3) {
+ FileUtils.appendListToFile(mAspectCacheFile, mList);
+ }
+ }
+ catch (Throwable t) {
+ Logger.INFO("Error while iterating one item. "+t);
+ }
+ }
+ }
+ }
+ }
+ Logger.INFO("Completed Aspect Iteration. AspectInfo.txt is now available to process in the GTplusplus configuration folder.");
+ CommandDumpAspects.mLastScanTime = System.currentTimeMillis();
+ }
+ return;
+ }
+
+}