aboutsummaryrefslogtreecommitdiff
path: root/src/Java/gtPlusPlus/core
diff options
context:
space:
mode:
authorAlkalus <draknyte1@hotmail.com>2017-10-07 13:04:05 +1000
committerAlkalus <draknyte1@hotmail.com>2017-10-07 13:04:05 +1000
commitd98e0b22cb0d7dbb7145cf0f751f6e4e44ed08d1 (patch)
treee1719570ed4cbf62c202c5b6548a9f365ea7332e /src/Java/gtPlusPlus/core
parentab880b63b5aa60b8e3d4f65b38c1d2ec880d1ed2 (diff)
downloadGT5-Unofficial-d98e0b22cb0d7dbb7145cf0f751f6e4e44ed08d1.tar.gz
GT5-Unofficial-d98e0b22cb0d7dbb7145cf0f751f6e4e44ed08d1.tar.bz2
GT5-Unofficial-d98e0b22cb0d7dbb7145cf0f751f6e4e44ed08d1.zip
$ Fixed custom IC2 cells. (HF, SO2, etc)
% Changed how cells can be generated for further flexibility. - Removed logging from the LFTR.
Diffstat (limited to 'src/Java/gtPlusPlus/core')
-rw-r--r--src/Java/gtPlusPlus/core/item/ModItems.java6
-rw-r--r--src/Java/gtPlusPlus/core/item/base/cell/BaseItemCell.java18
-rw-r--r--src/Java/gtPlusPlus/core/util/Utils.java29
-rw-r--r--src/Java/gtPlusPlus/core/util/fluid/FluidUtils.java33
4 files changed, 65 insertions, 21 deletions
diff --git a/src/Java/gtPlusPlus/core/item/ModItems.java b/src/Java/gtPlusPlus/core/item/ModItems.java
index 7527a5d149..e134c789d6 100644
--- a/src/Java/gtPlusPlus/core/item/ModItems.java
+++ b/src/Java/gtPlusPlus/core/item/ModItems.java
@@ -444,10 +444,10 @@ public final class ModItems {
//Leagrisium
MaterialGenerator.generate(ALLOY.LEAGRISIUM);
-
+
//Super Conductor
MaterialGenerator.generate(ALLOY.HG1223, false, false);
-
+
//Must be the final Alloy to Generate
MaterialGenerator.generate(ALLOY.QUANTUM);
@@ -619,7 +619,7 @@ public final class ModItems {
//Vanadium
if (ItemUtils.getItemStackOfAmountFromOreDictNoBroken("plateVanadium", 1) == null){
itemPlateVanadium = new BaseItemPlate(MaterialUtils.generateMaterialFromGtENUM(Materials.Vanadium));
- }
+ }
//EnderIO Resources
if ((LoadedMods.EnderIO || LOAD_ALL_CONTENT) && !CORE.GTNH){
diff --git a/src/Java/gtPlusPlus/core/item/base/cell/BaseItemCell.java b/src/Java/gtPlusPlus/core/item/base/cell/BaseItemCell.java
index c9340badda..f5fff65882 100644
--- a/src/Java/gtPlusPlus/core/item/base/cell/BaseItemCell.java
+++ b/src/Java/gtPlusPlus/core/item/base/cell/BaseItemCell.java
@@ -6,9 +6,14 @@ import gtPlusPlus.core.item.base.BaseItemComponent;
import gtPlusPlus.core.lib.CORE;
import gtPlusPlus.core.material.Material;
import gtPlusPlus.core.util.Utils;
+import gtPlusPlus.core.util.fluid.FluidUtils;
+import gtPlusPlus.core.util.item.ItemUtils;
+import ic2.core.Ic2Items;
import net.minecraft.client.renderer.texture.IIconRegister;
import net.minecraft.item.ItemStack;
import net.minecraft.util.IIcon;
+import net.minecraftforge.fluids.Fluid;
+import net.minecraftforge.fluids.FluidContainerRegistry;
public class BaseItemCell extends BaseItemComponent{
@@ -19,6 +24,19 @@ public class BaseItemCell extends BaseItemComponent{
public BaseItemCell(final Material material) {
super(material, BaseItemComponent.ComponentTypes.CELL);
this.fluidColour = (short[]) ((material == null) ? this.extraData : material.getRGBA());
+ //FluidContainerRegistry.registerFluidContainer(material.getFluid(1000), ItemUtils.getSimpleStack(this), Ic2Items.cell.copy());
+ }
+
+ public BaseItemCell(final String unlocalName, final String localName, final short[] RGBa) {
+ super(unlocalName, localName, RGBa);
+ this.fluidColour = RGBa;
+ FluidContainerRegistry.registerFluidContainer(FluidUtils.getFluidStack(unlocalName.toLowerCase(), 0), ItemUtils.getSimpleStack(this), Ic2Items.cell.copy());
+ }
+
+ public BaseItemCell(final String unlocalName, final String localName, final short[] RGBa, final Fluid cellFluid) {
+ super(unlocalName, localName, RGBa);
+ this.fluidColour = RGBa;
+ FluidContainerRegistry.registerFluidContainer(FluidUtils.getFluidStack(cellFluid, 1000), ItemUtils.getSimpleStack(this), Ic2Items.cell.copy());
}
@Override
diff --git a/src/Java/gtPlusPlus/core/util/Utils.java b/src/Java/gtPlusPlus/core/util/Utils.java
index 3b2bafe9fb..63137382ae 100644
--- a/src/Java/gtPlusPlus/core/util/Utils.java
+++ b/src/Java/gtPlusPlus/core/util/Utils.java
@@ -523,7 +523,7 @@ public class Utils {
Utils.LOG_WARNING("7 "+methode.isAccessible());
final ItemStack temp = (ItemStack) methode.invoke(item, cellID++, yourName, new Block[0]);
Utils.LOG_WARNING("Successfully created "+temp.getDisplayName()+"s.");
- FluidContainerRegistry.registerFluidContainer(FluidUtils.getFluidStack(s.toLowerCase(), 0), temp.copy(), Ic2Items.cell.copy());
+ FluidContainerRegistry.registerFluidContainer(FluidUtils.getFluidStack(s.toLowerCase(), 1000), temp.copy(), Ic2Items.cell.copy());
ItemUtils.addItemToOreDictionary(temp.copy(), "cell"+s);
return temp;
}
@@ -532,6 +532,33 @@ public class Utils {
}
return null;
}
+
+ public static ItemStack createInternalNameAndFluidCellNoOreDict(final String s){
+ Utils.LOG_WARNING("1");
+ final InternalName yourName = EnumHelper.addEnum(InternalName.class, s, new Class[0], new Object[0]);
+ Utils.LOG_WARNING("2 "+yourName.name());
+ final ItemCell item = (ItemCell)Ic2Items.cell.getItem();
+ Utils.LOG_WARNING("3 "+item.getUnlocalizedName());
+ try
+ {
+ Utils.LOG_WARNING("4");
+ final Class<? extends ItemCell> clz = item.getClass();
+ Utils.LOG_WARNING("5 "+clz.getSimpleName());
+ final Method methode = clz.getDeclaredMethod("addCell", int.class, InternalName.class, Block[].class);
+ Utils.LOG_WARNING("6 "+methode.getName());
+ methode.setAccessible(true);
+ Utils.LOG_WARNING("7 "+methode.isAccessible());
+ final ItemStack temp = (ItemStack) methode.invoke(item, cellID++, yourName, new Block[0]);
+ Utils.LOG_WARNING("Successfully created "+temp.getDisplayName()+"s.");
+ FluidContainerRegistry.registerFluidContainer(FluidUtils.getFluidStack(s.toLowerCase(), 1000), temp.copy(), Ic2Items.cell.copy());
+ //ItemUtils.addItemToOreDictionary(temp.copy(), "cell"+s);
+ return temp;
+ }
+ catch(final Exception e){
+ e.printStackTrace();
+ }
+ return null;
+ }
public static String sanitizeString(final String input){
String temp;
diff --git a/src/Java/gtPlusPlus/core/util/fluid/FluidUtils.java b/src/Java/gtPlusPlus/core/util/fluid/FluidUtils.java
index 02835a92ef..009651db68 100644
--- a/src/Java/gtPlusPlus/core/util/fluid/FluidUtils.java
+++ b/src/Java/gtPlusPlus/core/util/fluid/FluidUtils.java
@@ -4,6 +4,7 @@ import gregtech.api.enums.*;
import gregtech.api.util.GT_LanguageManager;
import gtPlusPlus.core.fluids.GenericFluid;
import gtPlusPlus.core.item.base.BaseItemComponent;
+import gtPlusPlus.core.item.base.cell.BaseItemCell;
import gtPlusPlus.core.item.base.cell.BaseItemPlasmaCell;
import gtPlusPlus.core.material.Material;
import gtPlusPlus.core.material.MaterialStack;
@@ -227,7 +228,7 @@ public class FluidUtils {
public static Fluid addGTFluidNonMolten(final String aName, final String aLocalized, final short[] aRGBa, final int aState, final long aTemperatureK, final ItemStack aFullContainer, final ItemStack aEmptyContainer, final int aFluidAmount) {
return addGTFluid("fluid."+aName, "fluid.autogenerated", aLocalized, aRGBa, aState, aTemperatureK, aFullContainer, aEmptyContainer, aFluidAmount);
}
-
+
public static Fluid addGTFluidNoPrefix(final String aName, final String aLocalized, final short[] aRGBa, final int aState, final long aTemperatureK, final ItemStack aFullContainer, final ItemStack aEmptyContainer, final int aFluidAmount) {
return addGTFluid(aName, "fluid.autogenerated", aLocalized, aRGBa, aState, aTemperatureK, aFullContainer, aEmptyContainer, aFluidAmount);
}
@@ -485,19 +486,12 @@ public class FluidUtils {
Utils.LOG_INFO("FLUID GENERATION FAILED FOR "+localizedName);
return null;
}
-
+
public final static Fluid generateFluidNoPrefix(final String unlocalizedName, final String localizedName, final int MeltingPoint, final short[] RGBA){
- if ((FluidUtils.getFluidStack(unlocalizedName.toLowerCase(), 1) == null)/* && ((dustStack != null) || (dustStack2 != null))*/){
+ Fluid gtFluid;
+ if (FluidUtils.getFluidStack(unlocalizedName.toLowerCase(), 1) == null){
Utils.LOG_WARNING("Generating our own fluid.");
-
- //Generate a Cell if we need to
- if (ItemUtils.getItemStackOfAmountFromOreDictNoBroken("cell"+unlocalizedName, 1) == null){
- @SuppressWarnings("unused")
- final
- Item temp = new BaseItemComponent(unlocalizedName, localizedName, RGBA);
- }
-
- final Fluid gtFluid = FluidUtils.addGTFluidNoPrefix(
+ gtFluid = FluidUtils.addGTFluidNoPrefix(
unlocalizedName,
localizedName,
RGBA,
@@ -506,11 +500,16 @@ public class FluidUtils {
ItemUtils.getItemStackOfAmountFromOreDictNoBroken("cell"+unlocalizedName, 1),
ItemList.Cell_Empty.get(1L, new Object[0]),
1000);
-
- return gtFluid;
}
- Utils.LOG_INFO("FLUID GENERATION FAILED FOR "+localizedName);
- return null; }
-
+ else {
+ gtFluid = FluidUtils.getFluidStack(unlocalizedName.toLowerCase(), 1).getFluid();
+ }
+ //Generate a Cell if we need to
+ if (ItemUtils.getItemStackOfAmountFromOreDictNoBroken("cell"+unlocalizedName, 1) == null){
+ new BaseItemCell(unlocalizedName, localizedName, RGBA, gtFluid);
+ }
+ return gtFluid;
+ }
+
}