aboutsummaryrefslogtreecommitdiff
path: root/src/Java/gtPlusPlus/core/block
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/block
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/block')
-rw-r--r--src/Java/gtPlusPlus/core/block/base/BlockBaseModular.java67
1 files changed, 61 insertions, 6 deletions
diff --git a/src/Java/gtPlusPlus/core/block/base/BlockBaseModular.java b/src/Java/gtPlusPlus/core/block/base/BlockBaseModular.java
index b089688193..8310fa3c23 100644
--- a/src/Java/gtPlusPlus/core/block/base/BlockBaseModular.java
+++ b/src/Java/gtPlusPlus/core/block/base/BlockBaseModular.java
@@ -1,14 +1,19 @@
package gtPlusPlus.core.block.base;
+import java.util.HashMap;
+import java.util.Map;
+
import cpw.mods.fml.common.registry.GameRegistry;
import cpw.mods.fml.relauncher.Side;
import cpw.mods.fml.relauncher.SideOnly;
import net.minecraft.client.renderer.texture.IIconRegister;
+import net.minecraft.item.ItemStack;
import net.minecraft.world.IBlockAccess;
+import gregtech.api.enums.OrePrefixes;
import gregtech.api.enums.TextureSet;
import gregtech.api.util.GT_OreDictUnificator;
-
+import gtPlusPlus.api.objects.Logger;
import gtPlusPlus.core.item.base.itemblock.ItemBlockGtBlock;
import gtPlusPlus.core.item.base.itemblock.ItemBlockGtFrameBox;
import gtPlusPlus.core.lib.CORE;
@@ -34,6 +39,7 @@ public class BlockBaseModular extends BasicBlock {
this(material.getUnlocalizedName(), material.getLocalizedName(), net.minecraft.block.material.Material.iron,
blockType, colour, Math.min(Math.max(material.vTier, 1), 6));
blockMaterial = material;
+ registerComponent();
}
protected BlockBaseModular(final String unlocalizedName, final String blockMaterial,
@@ -47,8 +53,8 @@ public class BlockBaseModular extends BasicBlock {
this.thisBlockMaterial = blockMaterial;
this.thisBlockType = blockType.name().toUpperCase();
this.setBlockName(this.GetProperName());
-
- if (this.thisBlockType.equals(BlockTypes.STANDARD.name().toUpperCase())) {
+ int fx = getBlockTypeMeta();
+ if (fx == 0) {
GameRegistry.registerBlock(this, ItemBlockGtBlock.class,
Utils.sanitizeString(blockType.getTexture() + unlocalizedName));
GT_OreDictUnificator.registerOre(
@@ -56,7 +62,7 @@ public class BlockBaseModular extends BasicBlock {
.replace("Of", "").replace("Block", "").replace("-", "").replace("_", "").replace(" ", ""),
ItemUtils.getSimpleStack(this));
}
- else if (this.thisBlockType.equals(BlockTypes.FRAME.name().toUpperCase())) {
+ else if (fx == 1) {
GameRegistry.registerBlock(this, ItemBlockGtBlock.class,
Utils.sanitizeString(blockType.getTexture() + unlocalizedName));
GT_OreDictUnificator.registerOre(
@@ -64,7 +70,7 @@ public class BlockBaseModular extends BasicBlock {
.replace("-", "").replace("_", "").replace(" ", "").replace("FrameBox", ""),
ItemUtils.getSimpleStack(this));
}
- else if (this.thisBlockType.equals(BlockTypes.ORE.name().toUpperCase())) {
+ else if (fx == 2) {
GameRegistry.registerBlock(this, ItemBlockGtBlock.class,
Utils.sanitizeString(blockType.getTexture() + unlocalizedName));
GT_OreDictUnificator.registerOre(
@@ -72,7 +78,47 @@ public class BlockBaseModular extends BasicBlock {
.replace("Of", "").replace("Block", "").replace("-", "").replace("_", "").replace(" ", ""),
ItemUtils.getSimpleStack(this));
}
-
+ }
+
+ public boolean registerComponent() {
+ Logger.MATERIALS("Attempting to register "+this.getUnlocalizedName()+".");
+ if (this.blockMaterial == null) {
+ Logger.MATERIALS("Tried to register "+this.getUnlocalizedName()+" but the material was null.");
+ return false;
+ }
+ String aName = blockMaterial.getUnlocalizedName();
+ //Register Component
+ Map<String, ItemStack> aMap = Material.mComponentMap.get(aName);
+ if (aMap == null) {
+ aMap = new HashMap<String, ItemStack>();
+ }
+ int fx = getBlockTypeMeta();
+ String aKey = (fx == 0 ? OrePrefixes.block.name() : ( fx == 1 ? OrePrefixes.frameGt.name() : OrePrefixes.ore.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;
+ }
+ }
+
+ public int getBlockTypeMeta() {
+ if (this.thisBlockType.equals(BlockTypes.STANDARD.name().toUpperCase())) {
+ return 0;
+ }
+ else if (this.thisBlockType.equals(BlockTypes.FRAME.name().toUpperCase())) {
+ return 1;
+ }
+ else if (this.thisBlockType.equals(BlockTypes.ORE.name().toUpperCase())) {
+ return 2;
+ }
+ return 0;
}
/**
@@ -153,4 +199,13 @@ public class BlockBaseModular extends BasicBlock {
return this.blockColour;
}
+ @Override
+ public int getBlockColor() {
+ if (this.blockColour == 0) {
+ return MathUtils.generateSingularRandomHexValue();
+ }
+
+ return this.blockColour;
+ }
+
}