aboutsummaryrefslogtreecommitdiff
path: root/src/Java/gtPlusPlus/core/item/base
diff options
context:
space:
mode:
authorAlkalus <3060479+draknyte1@users.noreply.github.com>2018-12-24 03:59:59 +0000
committerAlkalus <3060479+draknyte1@users.noreply.github.com>2018-12-24 03:59:59 +0000
commit12dab5d109ac81034fd0a8fe18317024a996af61 (patch)
treec08e9a305f081fef24df556126be744d19f4c0f8 /src/Java/gtPlusPlus/core/item/base
parentc1606dd2997151dbf09797092a04294230d42059 (diff)
downloadGT5-Unofficial-12dab5d109ac81034fd0a8fe18317024a996af61.tar.gz
GT5-Unofficial-12dab5d109ac81034fd0a8fe18317024a996af61.tar.bz2
GT5-Unofficial-12dab5d109ac81034fd0a8fe18317024a996af61.zip
+ Added a config option to adjust the Turbine Rotor removal cut-off point.
+ Added some new Bags/Packs for various things. An Automatic Lunchbox, a Tool Box and a Magicians Satchel. + Added full compound of Eglin Steel to ABS. Closes #392. - Removed all Multi-Tools. $ Rewrote and Fixed the recipe system. All recipes are queued regardless of when called, then created during the end of the POST_INIT load phase. Fixes too many bugs to list. (Few more to do before tomorrow) $ Fixed COFH Hard requirement. Closes #398. % Adjusted the internal map type of the AutoMap. Should improve performance, if only in single digit cpu cycles. > To-Do) Fix Recipes pertaining to compound materials made from using fluids. State may be detected wrong after recipe system changes.
Diffstat (limited to 'src/Java/gtPlusPlus/core/item/base')
-rw-r--r--src/Java/gtPlusPlus/core/item/base/BaseItemComponent.java1
-rw-r--r--src/Java/gtPlusPlus/core/item/base/dusts/BaseItemDustUnique.java31
-rw-r--r--src/Java/gtPlusPlus/core/item/base/ore/BaseOreComponent.java52
-rw-r--r--src/Java/gtPlusPlus/core/item/base/rods/BaseItemRod.java2
-rw-r--r--src/Java/gtPlusPlus/core/item/base/rods/BaseItemRodLong.java15
5 files changed, 89 insertions, 12 deletions
diff --git a/src/Java/gtPlusPlus/core/item/base/BaseItemComponent.java b/src/Java/gtPlusPlus/core/item/base/BaseItemComponent.java
index b07815fa60..ec0b490f63 100644
--- a/src/Java/gtPlusPlus/core/item/base/BaseItemComponent.java
+++ b/src/Java/gtPlusPlus/core/item/base/BaseItemComponent.java
@@ -105,6 +105,7 @@ public class BaseItemComponent extends Item{
ItemStack x = aMap.get(aKey);
if (x == null) {
aMap.put(aKey, ItemUtils.getSimpleStack(this));
+ Logger.MATERIALS("Registering a material component. Item: ["+componentMaterial.getUnlocalizedName()+"] Map: ["+aKey+"]");
Material.mComponentMap.put(componentMaterial.getUnlocalizedName(), aMap);
return true;
}
diff --git a/src/Java/gtPlusPlus/core/item/base/dusts/BaseItemDustUnique.java b/src/Java/gtPlusPlus/core/item/base/dusts/BaseItemDustUnique.java
index df46dd2052..273995e181 100644
--- a/src/Java/gtPlusPlus/core/item/base/dusts/BaseItemDustUnique.java
+++ b/src/Java/gtPlusPlus/core/item/base/dusts/BaseItemDustUnique.java
@@ -2,18 +2,21 @@ package gtPlusPlus.core.item.base.dusts;
import static gtPlusPlus.core.creative.AddToCreativeTab.tabMisc;
+import java.util.HashMap;
import java.util.List;
+import java.util.Map;
import cpw.mods.fml.common.registry.GameRegistry;
import net.minecraft.entity.player.EntityPlayer;
import net.minecraft.item.Item;
import net.minecraft.item.ItemStack;
-
+import gregtech.api.enums.OrePrefixes;
import gregtech.api.util.GT_OreDictUnificator;
import gtPlusPlus.api.objects.Logger;
import gtPlusPlus.core.lib.CORE;
+import gtPlusPlus.core.material.Material;
import gtPlusPlus.core.util.data.StringUtils;
import gtPlusPlus.core.util.math.MathUtils;
import gtPlusPlus.core.util.minecraft.ItemUtils;
@@ -80,6 +83,32 @@ public class BaseItemDustUnique extends Item{
if ((temp != null) && !temp.equals("")){
GT_OreDictUnificator.registerOre(temp, ItemUtils.getSimpleStack(this));
}
+ registerComponent();
+ }
+
+ public boolean registerComponent() {
+ if (this.materialName == null) {
+ return false;
+ }
+ String aName = materialName;
+ //Register Component
+ Map<String, ItemStack> aMap = Material.mComponentMap.get(aName);
+ if (aMap == null) {
+ aMap = new HashMap<String, ItemStack>();
+ }
+ String aKey = OrePrefixes.dust.name();
+ ItemStack x = aMap.get(aKey);
+ if (x == null) {
+ aMap.put(aKey, ItemUtils.getSimpleStack(this));
+ Logger.MATERIALS("Registering a material component. Item: ["+aName+"] Map: ["+aKey+"]");
+ Material.mComponentMap.put(aName, aMap);
+ return true;
+ }
+ else {
+ //Bad
+ Logger.MATERIALS("Tried to double register a material component. ");
+ return false;
+ }
}
@Override
diff --git a/src/Java/gtPlusPlus/core/item/base/ore/BaseOreComponent.java b/src/Java/gtPlusPlus/core/item/base/ore/BaseOreComponent.java
index 08517776ec..2b3f477c56 100644
--- a/src/Java/gtPlusPlus/core/item/base/ore/BaseOreComponent.java
+++ b/src/Java/gtPlusPlus/core/item/base/ore/BaseOreComponent.java
@@ -1,6 +1,8 @@
package gtPlusPlus.core.item.base.ore;
+import java.util.HashMap;
import java.util.List;
+import java.util.Map;
import cpw.mods.fml.common.registry.GameRegistry;
import cpw.mods.fml.relauncher.Side;
@@ -13,9 +15,9 @@ 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.util.GT_OreDictUnificator;
-
+import gtPlusPlus.api.objects.Logger;
import gtPlusPlus.core.creative.AddToCreativeTab;
import gtPlusPlus.core.lib.CORE;
import gtPlusPlus.core.lib.LoadedMods;
@@ -52,6 +54,7 @@ public class BaseOreComponent extends Item{
//this.setTextureName(this.getCorrectTextures());
this.componentColour = material.getRgbAsHex();
GameRegistry.registerItem(this, this.unlocalName);
+ registerComponent();
GT_OreDictUnificator.registerOre(componentType.getComponent()+material.getUnlocalizedName(), ItemUtils.getSimpleStack(this));
if (LoadedMods.Thaumcraft) {
ThaumcraftUtils.addAspectToItem(ItemUtils.getSimpleStack(this), GTPP_Aspects.METALLUM, 2);
@@ -61,6 +64,51 @@ public class BaseOreComponent extends Item{
}
}
+
+ public boolean registerComponent() {
+ Logger.MATERIALS("Attempting to register "+this.getUnlocalizedName()+".");
+ if (this.componentMaterial == null) {
+ Logger.MATERIALS("Tried to register "+this.getUnlocalizedName()+" but the material was null.");
+ return false;
+ }
+ //Register Component
+ Map<String, ItemStack> aMap = Material.mComponentMap.get(componentMaterial.getUnlocalizedName());
+ if (aMap == null) {
+ aMap = new HashMap<String, ItemStack>();
+ }
+ String aKey = "Invalid";
+ if (componentType == ComponentTypes.CRUSHED) {
+ aKey = OrePrefixes.crushed.name();
+ }
+ else if (componentType == ComponentTypes.CRUSHEDCENTRIFUGED) {
+ aKey = OrePrefixes.crushedCentrifuged.name();
+ }
+ else if (componentType == ComponentTypes.CRUSHEDPURIFIED) {
+ aKey = OrePrefixes.crushedPurified.name();
+ }
+ else if (componentType == ComponentTypes.DUST) {
+ aKey = OrePrefixes.dust.name();
+ }
+ else if (componentType == ComponentTypes.DUSTIMPURE) {
+ aKey = OrePrefixes.dustImpure.name();
+ }
+ else if (componentType == ComponentTypes.DUSTPURE) {
+ aKey = OrePrefixes.dustPure.name();
+ }
+
+ ItemStack x = aMap.get(aKey);
+ if (x == null) {
+ aMap.put(aKey, ItemUtils.getSimpleStack(this));
+ Logger.MATERIALS("Registering a material component. Item: ["+componentMaterial.getUnlocalizedName()+"] Map: ["+aKey+"]");
+ Material.mComponentMap.put(componentMaterial.getUnlocalizedName(), aMap);
+ return true;
+ }
+ else {
+ //Bad
+ Logger.MATERIALS("Tried to double register a material component. ");
+ return false;
+ }
+ }
public String getCorrectTextures(){
if (!CORE.ConfigSwitches.useGregtechTextures){
diff --git a/src/Java/gtPlusPlus/core/item/base/rods/BaseItemRod.java b/src/Java/gtPlusPlus/core/item/base/rods/BaseItemRod.java
index f0a0f9f4ea..b6a5dff2ac 100644
--- a/src/Java/gtPlusPlus/core/item/base/rods/BaseItemRod.java
+++ b/src/Java/gtPlusPlus/core/item/base/rods/BaseItemRod.java
@@ -7,6 +7,7 @@ import gregtech.api.enums.GT_Values;
import gtPlusPlus.api.objects.Logger;
import gtPlusPlus.core.item.base.BaseItemComponent;
import gtPlusPlus.core.material.Material;
+import gtPlusPlus.core.util.minecraft.ItemUtils;
public class BaseItemRod extends BaseItemComponent{
@@ -22,6 +23,7 @@ public class BaseItemRod extends BaseItemComponent{
final ItemStack stackStick = this.componentMaterial.getRod(1);
final ItemStack stackBolt = this.componentMaterial.getBolt(4);
+ if (ItemUtils.checkForInvalidItems(new ItemStack[] {stackStick, stackBolt}))
GT_Values.RA.addCutterRecipe(
stackStick,
stackBolt,
diff --git a/src/Java/gtPlusPlus/core/item/base/rods/BaseItemRodLong.java b/src/Java/gtPlusPlus/core/item/base/rods/BaseItemRodLong.java
index 0870683c46..9b232f95c5 100644
--- a/src/Java/gtPlusPlus/core/item/base/rods/BaseItemRodLong.java
+++ b/src/Java/gtPlusPlus/core/item/base/rods/BaseItemRodLong.java
@@ -24,23 +24,20 @@ public class BaseItemRodLong extends BaseItemComponent{
private void addExtruderRecipe(){
Logger.WARNING("Adding recipe for Long "+this.materialName+" Rods");
- final String tempStick = this.unlocalName.replace("itemRodLong", "stick");
- final String tempStickLong = this.unlocalName.replace("itemRodLong", "stickLong");
- final ItemStack stackStick = ItemUtils.getItemStackOfAmountFromOreDict(tempStick, 1);
- final ItemStack stackLong = ItemUtils.getItemStackOfAmountFromOreDict(tempStickLong, 1);
-
- final ItemStack temp = stackStick;
- temp.stackSize = 2;
+ final ItemStack stackStick = this.componentMaterial.getRod(2);
+ final ItemStack stackLong = this.componentMaterial.getLongRod(1);
+ if (ItemUtils.checkForInvalidItems(new ItemStack[] {stackStick, stackLong}))
GT_Values.RA.addForgeHammerRecipe(
- temp,
+ stackStick,
stackLong,
(int) Math.max(this.componentMaterial.getMass(), 1L),
16);
+ if (ItemUtils.checkForInvalidItems(new ItemStack[] {stackStick, stackLong}))
GT_Values.RA.addCutterRecipe(
stackLong,
- temp,
+ stackStick,
null,
(int) Math.max(this.componentMaterial.getMass(), 1L),
4);