aboutsummaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
Diffstat (limited to 'src')
-rw-r--r--src/main/java/gregtech/api/enums/OrePrefixes.java30
-rw-r--r--src/main/java/gregtech/api/metatileentity/implementations/GT_MetaTileEntity_BasicGenerator.java21
-rw-r--r--src/main/java/gregtech/api/util/GT_ModHandler.java17
-rw-r--r--src/main/java/gregtech/common/GT_Proxy.java28
-rw-r--r--src/main/java/gregtech/common/items/GT_MetaGenerated_Item_04.java146
-rw-r--r--src/main/java/gregtech/loaders/preload/GT_Loader_Item_Block_And_Fluid.java1
6 files changed, 221 insertions, 22 deletions
diff --git a/src/main/java/gregtech/api/enums/OrePrefixes.java b/src/main/java/gregtech/api/enums/OrePrefixes.java
index 3aaea29f28..77b6ee9426 100644
--- a/src/main/java/gregtech/api/enums/OrePrefixes.java
+++ b/src/main/java/gregtech/api/enums/OrePrefixes.java
@@ -1,6 +1,7 @@
package gregtech.api.enums;
import com.google.common.base.Objects;
+import com.google.common.collect.ImmutableList;
import gregtech.api.GregTech_API;
import gregtech.api.enums.TC_Aspects.TC_AspectStack;
import gregtech.api.interfaces.ICondition;
@@ -319,8 +320,27 @@ public enum OrePrefixes {
bars("Bars", "", "", false, false, false, false, false, false, false, false, false, false, 0, -1, 64, -1),
bar("Bars", "", "", false, false, false, false, false, false, false, false, false, false, 0, -1, 64, -1),
toolHeadMallet("Mallet Heads", "", " Mallet Head", true, true, false, false, false, false, true, true, false, false, B[6], M * 6, 16, 127), // Reverse Head consisting out of 6 Ingots.
- handleMallet("Mallet Handle", "", " Handle", true, true, false, false, false, false, true, true, false, false, B[1] | B[2], M / 2, 64, 126); // Reverse Stick made of half an Ingot. Introduced by Eloraam
-
+ handleMallet("Mallet Handle", "", " Handle", true, true, false, false, false, false, true, true, false, false, B[1] | B[2], M / 2, 64, 126), // Reverse Stick made of half an Ingot. Introduced by Eloraam
+
+ // Cracked fluids
+ cellHydroCracked1("Cells", "Lightly Hydro-Cracked ", " Cell", true, true, true, true, false, false, false, true, false, false, 0, M * 1, 64, 30),
+ cellHydroCracked2("Cells", "Moderately Hydro-Cracked ", " Cell", true, true, true, true, false, false, false, true, false, false, 0, M * 1, 64, 30),
+ cellHydroCracked3("Cells", "Severely Hydro-Cracked ", " Cell", true, true, true, true, false, false, false, true, false, false, 0, M * 1, 64, 30),
+ cellSteamCracked1("Cells", "Lightly Steam-Cracked ", " Cell", true, true, true, true, false, false, false, true, false, false, 0, M * 1, 64, 30),
+ cellSteamCracked2("Cells", "Moderately Steam-Cracked ", " Cell", true, true, true, true, false, false, false, true, false, false, 0, M * 1, 64, 30),
+ cellSteamCracked3("Cells", "Severely Steam-Cracked ", " Cell", true, true, true, true, false, false, false, true, false, false, 0, M * 1, 64, 30);
+
+ public static final ImmutableList<OrePrefixes> CELL_TYPES =
+ ImmutableList.of(
+ cell, cellMolten, cellPlasma,
+ cellHydroCracked1, cellHydroCracked2, cellHydroCracked3,
+ cellSteamCracked1, cellSteamCracked2, cellSteamCracked3);
+
+ public static final ImmutableList<OrePrefixes> CRACKED_CELL_TYPES =
+ ImmutableList.of(
+ cellHydroCracked1, cellHydroCracked2, cellHydroCracked3,
+ cellSteamCracked1, cellSteamCracked2, cellSteamCracked3);
+
public static volatile int VERSION = 509;
static {
@@ -531,6 +551,12 @@ public enum OrePrefixes {
cell.mSecondaryMaterial = new MaterialStack(Materials.Tin, plate.mMaterialAmount * 2);
cellPlasma.mSecondaryMaterial = new MaterialStack(Materials.Tin, plate.mMaterialAmount * 2);
cellMolten.mSecondaryMaterial = new MaterialStack(Materials.Tin, plate.mMaterialAmount * 2);
+ cellHydroCracked1.mSecondaryMaterial = new MaterialStack(Materials.Tin, plate.mMaterialAmount * 2);
+ cellHydroCracked2.mSecondaryMaterial = new MaterialStack(Materials.Tin, plate.mMaterialAmount * 2);
+ cellHydroCracked3.mSecondaryMaterial = new MaterialStack(Materials.Tin, plate.mMaterialAmount * 2);
+ cellSteamCracked1.mSecondaryMaterial = new MaterialStack(Materials.Tin, plate.mMaterialAmount * 2);
+ cellSteamCracked2.mSecondaryMaterial = new MaterialStack(Materials.Tin, plate.mMaterialAmount * 2);
+ cellSteamCracked3.mSecondaryMaterial = new MaterialStack(Materials.Tin, plate.mMaterialAmount * 2);
oreRedgranite.mSecondaryMaterial = new MaterialStack(Materials.GraniteRed, dust.mMaterialAmount);
oreBlackgranite.mSecondaryMaterial = new MaterialStack(Materials.GraniteBlack, dust.mMaterialAmount);
oreNetherrack.mSecondaryMaterial = new MaterialStack(Materials.Netherrack, dust.mMaterialAmount);
diff --git a/src/main/java/gregtech/api/metatileentity/implementations/GT_MetaTileEntity_BasicGenerator.java b/src/main/java/gregtech/api/metatileentity/implementations/GT_MetaTileEntity_BasicGenerator.java
index 48d1bd8a18..57f7073e24 100644
--- a/src/main/java/gregtech/api/metatileentity/implementations/GT_MetaTileEntity_BasicGenerator.java
+++ b/src/main/java/gregtech/api/metatileentity/implementations/GT_MetaTileEntity_BasicGenerator.java
@@ -245,16 +245,17 @@ public abstract class GT_MetaTileEntity_BasicGenerator extends GT_MetaTileEntity
public boolean solidFuelOverride(ItemStack stack) {
//this could be used for a coal generator for example aswell...
ItemData association = GT_OreDictUnificator.getAssociation(stack);
- //if it is a gregtech Item, make sure its not a VOLUMETRIC_FLASK, cell, motlen cell or plasma cell, else do vanilla checks
- return association != null ? !OrePrefixes.cell.equals(association.mPrefix) &&
- !OrePrefixes.cellMolten.equals(association.mPrefix) &&
- !OrePrefixes.cellPlasma.equals(association.mPrefix) &&
- !GT_Utility.areStacksEqual(ItemList.VOLUMETRIC_FLASK.get(1L), stack, true) :
- stack != null && //when the stack is null its not a solid
- stack.getItem() != null && //when the item in the stack is null its not a solid
- !(stack.getItem() instanceof IFluidContainerItem) && //when the item is a fluid container its not a solid...
- !(stack.getItem() instanceof IFluidHandler) && //when the item is a fluid handler its not a solid...
- !stack.getItem().getUnlocalizedName().contains("bucket"); //since we cant really check for buckets...
+ //if it is a gregtech Item, make sure its not a VOLUMETRIC_FLASK or any type of cell, else do vanilla checks
+ if (association != null) {
+ return !OrePrefixes.CELL_TYPES.contains(association.mPrefix) &&
+ !GT_Utility.areStacksEqual(ItemList.VOLUMETRIC_FLASK.get(1L), stack, true);
+ } else {
+ return stack != null && //when the stack is null its not a solid
+ stack.getItem() != null && //when the item in the stack is null its not a solid
+ !(stack.getItem() instanceof IFluidContainerItem) && //when the item is a fluid container its not a solid...
+ !(stack.getItem() instanceof IFluidHandler) && //when the item is a fluid handler its not a solid...
+ !stack.getItem().getUnlocalizedName().contains("bucket"); //since we cant really check for buckets...
+ }
}
public abstract int getPollution();
diff --git a/src/main/java/gregtech/api/util/GT_ModHandler.java b/src/main/java/gregtech/api/util/GT_ModHandler.java
index ac9f7bd3d4..a910723069 100644
--- a/src/main/java/gregtech/api/util/GT_ModHandler.java
+++ b/src/main/java/gregtech/api/util/GT_ModHandler.java
@@ -2008,7 +2008,22 @@ public class GT_ModHandler {
public static int getCapsuleCellContainerCount(ItemStack aStack) {
if (aStack == null) return 0;
- return GT_Utility.areStacksEqual(GT_Utility.getContainerForFilledItem(aStack, true), ItemList.Cell_Empty.get(1)) || OrePrefixes.cell.contains(aStack) || OrePrefixes.cellMolten.contains(aStack) || OrePrefixes.cellPlasma.contains(aStack) || GT_Utility.areStacksEqual(aStack, getIC2Item("waterCell", 1, W)) ? 1 : 0;
+
+ if (GT_Utility.areStacksEqual(GT_Utility.getContainerForFilledItem(aStack, true), ItemList.Cell_Empty.get(1))) {
+ return 1;
+ }
+
+ if (GT_Utility.areStacksEqual(aStack, getIC2Item("waterCell", 1, W))) {
+ return 1;
+ }
+
+ for (OrePrefixes cellType : OrePrefixes.CELL_TYPES) {
+ if (cellType.contains(aStack)) {
+ return 1;
+ }
+ }
+
+ return 0;
}
public static class RecipeBits {
diff --git a/src/main/java/gregtech/common/GT_Proxy.java b/src/main/java/gregtech/common/GT_Proxy.java
index 51aadf574e..3e76335410 100644
--- a/src/main/java/gregtech/common/GT_Proxy.java
+++ b/src/main/java/gregtech/common/GT_Proxy.java
@@ -1781,8 +1781,8 @@ public abstract class GT_Proxy implements IGT_Mod, IGuiHandler, IFuelHandler {
public void addAutoGeneratedHydroCrackedFluids(Materials aMaterial){
Fluid[] crackedFluids = new Fluid[3];
- String[] prefixes = {"lightlyhydrocracked.", "moderatelyhydrocracked.", "severelyhydrocracked."};
- String[] localPrefixes = {"Lightly Hydro-Cracked ", "Moderately Hydro-Cracked ", "Severely Hydro-Cracked "};
+ String[] namePrefixes = { "lightlyhydrocracked.", "moderatelyhydrocracked.", "severelyhydrocracked." };
+ OrePrefixes[] orePrefixes = { OrePrefixes.cellHydroCracked1, OrePrefixes.cellHydroCracked2, OrePrefixes.cellHydroCracked3 };
GT_Fluid uncrackedFluid = null;
if (aMaterial.mFluid != null) {
uncrackedFluid = (GT_Fluid) aMaterial.mFluid;
@@ -1790,8 +1790,13 @@ public abstract class GT_Proxy implements IGT_Mod, IGuiHandler, IFuelHandler {
uncrackedFluid = (GT_Fluid) aMaterial.mGas;
}
for (int i = 0; i < 3; i++) {
- crackedFluids[i] = addFluid(prefixes[i] + aMaterial.mName.toLowerCase(Locale.ENGLISH), uncrackedFluid.mTextureName,
- localPrefixes[i] + aMaterial.mDefaultLocalName, null, aMaterial.mRGBa, 2, 775, null, null, 0);
+ crackedFluids[i] = addFluid(
+ namePrefixes[i] + aMaterial.mName.toLowerCase(Locale.ENGLISH), uncrackedFluid.mTextureName,
+ orePrefixes[i].mLocalizedMaterialPre + aMaterial.mDefaultLocalName,
+ null, aMaterial.mRGBa, 2, 775,
+ GT_OreDictUnificator.get(orePrefixes[i], aMaterial, 1L),
+ ItemList.Cell_Empty.get(1L, new Object[0]), 1000);
+
int hydrogenAmount = 2 * i + 2;
GT_Values.RA.addCrackingRecipe(i + 1, new FluidStack(uncrackedFluid, 1000), Materials.Hydrogen.getGas(hydrogenAmount * 1000),
new FluidStack(crackedFluids[i], 1000), 40 + 20 * i, 120 + 60 * i);
@@ -1805,8 +1810,8 @@ public abstract class GT_Proxy implements IGT_Mod, IGuiHandler, IFuelHandler {
public void addAutoGeneratedSteamCrackedFluids(Materials aMaterial){
Fluid[] crackedFluids = new Fluid[3];
- String[] prefixes = {"lightlysteamcracked.", "moderatelysteamcracked.", "severelysteamcracked."};
- String[] localPrefixes = {"Lightly Steam-Cracked ", "Moderately Steam-Cracked ", "Severely Steam-Cracked "};
+ String[] namePrefixes = { "lightlysteamcracked.", "moderatelysteamcracked.", "severelysteamcracked." };
+ OrePrefixes[] orePrefixes = { OrePrefixes.cellSteamCracked1, OrePrefixes.cellSteamCracked2, OrePrefixes.cellSteamCracked3 };
GT_Fluid uncrackedFluid = null;
if (aMaterial.mFluid != null) {
uncrackedFluid = (GT_Fluid) aMaterial.mFluid;
@@ -1814,9 +1819,14 @@ public abstract class GT_Proxy implements IGT_Mod, IGuiHandler, IFuelHandler {
uncrackedFluid = (GT_Fluid) aMaterial.mGas;
}
for (int i = 0; i < 3; i++) {
- crackedFluids[i] = addFluid(prefixes[i] + aMaterial.mName.toLowerCase(Locale.ENGLISH), uncrackedFluid.mTextureName,
- localPrefixes[i] + aMaterial.mDefaultLocalName, null, aMaterial.mRGBa, 2, 775, null, null, 0);
- GT_Values.RA.addCrackingRecipe(i + 1, new FluidStack(uncrackedFluid, 1000), GT_ModHandler.getSteam(1000),
+ crackedFluids[i] = addFluid(
+ namePrefixes[i] + aMaterial.mName.toLowerCase(Locale.ENGLISH), uncrackedFluid.mTextureName,
+ orePrefixes[i].mLocalizedMaterialPre + aMaterial.mDefaultLocalName,
+ null, aMaterial.mRGBa, 2, 775,
+ GT_OreDictUnificator.get(orePrefixes[i], aMaterial, 1L),
+ ItemList.Cell_Empty.get(1L, new Object[0]), 1000);
+
+ GT_Values.RA.addCrackingRecipe(i + 1, new FluidStack(uncrackedFluid, 1000), GT_ModHandler.getSteam(1000),
new FluidStack(crackedFluids[i], 1000), 40 + 20 * i, 240 + 120 * i);
GT_Values.RA.addChemicalRecipe(GT_ModHandler.getIC2Item("steamCell", 1L), GT_Utility.getIntegratedCircuit(i + 1), new FluidStack(uncrackedFluid, 1000),
new FluidStack(crackedFluids[i], 800), Materials.Empty.getCells(1), 160 + 80 * i, 30);
diff --git a/src/main/java/gregtech/common/items/GT_MetaGenerated_Item_04.java b/src/main/java/gregtech/common/items/GT_MetaGenerated_Item_04.java
new file mode 100644
index 0000000000..728128ac39
--- /dev/null
+++ b/src/main/java/gregtech/common/items/GT_MetaGenerated_Item_04.java
@@ -0,0 +1,146 @@
+package gregtech.common.items;
+
+import cpw.mods.fml.relauncher.Side;
+import cpw.mods.fml.relauncher.SideOnly;
+import gregtech.api.GregTech_API;
+import gregtech.api.enums.Materials;
+import gregtech.api.enums.OrePrefixes;
+import gregtech.api.interfaces.IIconContainer;
+import gregtech.api.items.GT_MetaGenerated_Item;
+import gregtech.api.util.GT_LanguageManager;
+import gregtech.api.util.GT_OreDictUnificator;
+import net.minecraft.creativetab.CreativeTabs;
+import net.minecraft.item.Item;
+import net.minecraft.item.ItemStack;
+import net.minecraft.util.IIcon;
+
+import java.util.BitSet;
+import java.util.List;
+
+import static gregtech.api.enums.GT_Values.M;
+
+/** Generates cells for cracked fluids. */
+public class GT_MetaGenerated_Item_04 extends GT_MetaGenerated_Item {
+ public static GT_MetaGenerated_Item_04 INSTANCE;
+
+ private static final int NUM_CRACKED_CELL_TYPES = OrePrefixes.CRACKED_CELL_TYPES.size();
+
+ private BitSet enabled = new BitSet();
+
+ public GT_MetaGenerated_Item_04() {
+ super("metaitem.04", (short) (NUM_CRACKED_CELL_TYPES * 1000), (short) 0);
+ INSTANCE = this;
+
+ for (Materials tMaterial : GregTech_API.sGeneratedMaterials) {
+ if (tMaterial == null || !tMaterial.canBeCracked() || tMaterial.mMetaItemSubID < 0 || tMaterial.mMetaItemSubID >= 1000) {
+ continue;
+ }
+ register(tMaterial, tMaterial.mMetaItemSubID);
+ }
+
+ // We're not going to use these BitSets, so clear them to save memory.
+ mEnabledItems.clear();
+ mVisibleItems.clear();
+ }
+
+ private void register(Materials tMaterial, int i) {
+ int currIndex = NUM_CRACKED_CELL_TYPES * i;
+ for (OrePrefixes type : OrePrefixes.CRACKED_CELL_TYPES) {
+ ItemStack tStack = new ItemStack(this, 1, currIndex);
+ GT_LanguageManager.addStringLocalization(getUnlocalizedName(tStack) + ".name", type.getDefaultLocalNameFormatForItem(tMaterial));
+ GT_LanguageManager.addStringLocalization(getUnlocalizedName(tStack) + ".tooltip", tMaterial.getToolTip(type.mMaterialAmount / M));
+
+ if (type.mIsUnificatable) {
+ GT_OreDictUnificator.set(type, tMaterial, tStack);
+ } else {
+ GT_OreDictUnificator.registerOre(type.get(tMaterial), tStack);
+ }
+
+ enabled.set(currIndex);
+ currIndex++;
+ }
+ }
+
+ private int getMaterialIndex(int damage) {
+ return damage / NUM_CRACKED_CELL_TYPES;
+ }
+
+ /** Returns null for item damage out of bounds. */
+ private OrePrefixes getOrePrefix(int damage) {
+ if (damage < 0 || damage >= NUM_CRACKED_CELL_TYPES * 1000) {
+ return null;
+ }
+ return OrePrefixes.CRACKED_CELL_TYPES.get(damage % NUM_CRACKED_CELL_TYPES);
+ }
+
+ @Override
+ public short[] getRGBa(ItemStack aStack) {
+ Materials tMaterial = GregTech_API.sGeneratedMaterials[getMaterialIndex(aStack.getItemDamage())];
+ return tMaterial == null ? Materials._NULL.mRGBa : tMaterial.mRGBa;
+ }
+
+ @Override
+ public String getItemStackDisplayName(ItemStack aStack) {
+ String aName = super.getItemStackDisplayName(aStack);
+
+ int index = getMaterialIndex(aStack.getItemDamage());
+ if (index >= 0 && index < 1000) {
+ return Materials.getLocalizedNameForItem(aName, index);
+ }
+
+ return aName;
+ }
+
+ @Override
+ public ItemStack getContainerItem(ItemStack aStack) {
+ OrePrefixes prefix = getOrePrefix(aStack.getItemDamage());
+ if (prefix != null) {
+ return prefix.mContainerItem;
+ }
+ return null;
+ }
+
+ @Override
+ @SideOnly(Side.CLIENT)
+ public void getSubItems(Item var1, CreativeTabs aCreativeTab, List aList) {
+ enabled.stream()
+ .mapToObj(i -> new ItemStack(this, 1, i))
+ .forEach(aList::add);
+ }
+
+ @Override
+ public final IIcon getIconFromDamage(int aMetaData) {
+ IIconContainer iconContainer = getIconContainer(aMetaData);
+ if (iconContainer != null) {
+ return iconContainer.getIcon();
+ }
+ return null;
+ }
+
+ @Override
+ public IIconContainer getIconContainer(int aMetaData) {
+ int index = getMaterialIndex(aMetaData);
+ if (index < 0 || index >= 1000) {
+ return null;
+ }
+
+ Materials material = GregTech_API.sGeneratedMaterials[index];
+ OrePrefixes prefix = getOrePrefix(aMetaData);
+ if (material != null && prefix != null) {
+ return material.mIconSet.mTextures[prefix.mTextureIndex];
+ }
+
+ return null;
+ }
+
+ @Override
+ public int getItemStackLimit(ItemStack aStack) {
+ OrePrefixes prefix = getOrePrefix(aStack.getItemDamage());
+ if (prefix != null) {
+ return prefix.mDefaultStackSize;
+ } else {
+ // If we're here, then something went wrong. Use cell.mDefaultStackSize as a fallback.
+ return OrePrefixes.cell.mDefaultStackSize;
+ }
+ }
+}
diff --git a/src/main/java/gregtech/loaders/preload/GT_Loader_Item_Block_And_Fluid.java b/src/main/java/gregtech/loaders/preload/GT_Loader_Item_Block_And_Fluid.java
index 4fbc25f226..77b65e5b18 100644
--- a/src/main/java/gregtech/loaders/preload/GT_Loader_Item_Block_And_Fluid.java
+++ b/src/main/java/gregtech/loaders/preload/GT_Loader_Item_Block_And_Fluid.java
@@ -71,6 +71,7 @@ public class GT_Loader_Item_Block_And_Fluid implements Runnable {
new GT_MetaGenerated_Item_01();
new GT_MetaGenerated_Item_02();
new GT_MetaGenerated_Item_03();
+ new GT_MetaGenerated_Item_04();
new GT_MetaGenerated_Item_99();
new GT_MetaGenerated_Tool_01();
new GT_FluidDisplayItem();