aboutsummaryrefslogtreecommitdiff
path: root/src/Java/gtPlusPlus/core/block/base
diff options
context:
space:
mode:
authorJordan Byrne <draknyte1@hotmail.com>2018-02-26 08:08:00 +1000
committerJordan Byrne <draknyte1@hotmail.com>2018-02-26 08:08:00 +1000
commit41eb02602c8a6d5899b3e375572ee9990a5a752b (patch)
tree80263f91e6a304fe7ab527fbab18d2810e134aff /src/Java/gtPlusPlus/core/block/base
parent90addb9717e2a1bffeec55d064248d6f98835f01 (diff)
downloadGT5-Unofficial-41eb02602c8a6d5899b3e375572ee9990a5a752b.tar.gz
GT5-Unofficial-41eb02602c8a6d5899b3e375572ee9990a5a752b.tar.bz2
GT5-Unofficial-41eb02602c8a6d5899b3e375572ee9990a5a752b.zip
% Made all GTNH recipes use cheaper circuits for all recipes I add.
% Recipe tweaks. % Tried to fluorite ore not having correct recipe outputs during ore processing. (This is still broken due to an invalid output) $ Fixed old fluorite ore not having a valid shapeless recipe. $ Fixed all custom ores trying to register static textures. $ Fixed plugin loading system not registering plugins, I think? $ Fixed missing texture for Nitro Fix.
Diffstat (limited to 'src/Java/gtPlusPlus/core/block/base')
-rw-r--r--src/Java/gtPlusPlus/core/block/base/BasicBlock.java14
-rw-r--r--src/Java/gtPlusPlus/core/block/base/BlockBaseModular.java118
-rw-r--r--src/Java/gtPlusPlus/core/block/base/BlockBaseOre.java101
3 files changed, 127 insertions, 106 deletions
diff --git a/src/Java/gtPlusPlus/core/block/base/BasicBlock.java b/src/Java/gtPlusPlus/core/block/base/BasicBlock.java
index f97763dd54..01db44f28b 100644
--- a/src/Java/gtPlusPlus/core/block/base/BasicBlock.java
+++ b/src/Java/gtPlusPlus/core/block/base/BasicBlock.java
@@ -13,13 +13,21 @@ import net.minecraft.world.World;
public class BasicBlock extends BlockContainer {
public BasicBlock(final String unlocalizedName, final Material material) {
- this(unlocalizedName, material, 2);
+ this(BlockTypes.STANDARD, unlocalizedName, material, 2);
}
- public BasicBlock(final String unlocalizedName, final Material material, final int harvestLevel) {
+ public BasicBlock(final BlockTypes type, final String unlocalizedName, final Material material) {
+ this(type, unlocalizedName, material, 2);
+ }
+
+ public BasicBlock(BlockTypes type, final String unlocalizedName, final Material material, final int harvestLevel) {
super(material);
this.setBlockName(Utils.sanitizeString(unlocalizedName));
- this.setBlockTextureName(CORE.MODID + ":" + unlocalizedName);
+
+ if (type != BlockTypes.ORE) {
+ this.setBlockTextureName(CORE.MODID + ":" + unlocalizedName);
+ }
+
this.setCreativeTab(AddToCreativeTab.tabBlock);
this.setHardness(2.0F);
this.setResistance(6.0F);
diff --git a/src/Java/gtPlusPlus/core/block/base/BlockBaseModular.java b/src/Java/gtPlusPlus/core/block/base/BlockBaseModular.java
index 2f7b3338d7..351c44b0c5 100644
--- a/src/Java/gtPlusPlus/core/block/base/BlockBaseModular.java
+++ b/src/Java/gtPlusPlus/core/block/base/BlockBaseModular.java
@@ -1,7 +1,6 @@
package gtPlusPlus.core.block.base;
import cpw.mods.fml.common.registry.GameRegistry;
-import cpw.mods.fml.common.registry.LanguageRegistry;
import cpw.mods.fml.relauncher.Side;
import cpw.mods.fml.relauncher.SideOnly;
import gregtech.api.util.GT_OreDictUnificator;
@@ -15,106 +14,87 @@ import gtPlusPlus.core.util.minecraft.ItemUtils;
import net.minecraft.client.renderer.texture.IIconRegister;
import net.minecraft.world.IBlockAccess;
-public class BlockBaseModular extends BasicBlock{
+public class BlockBaseModular extends BasicBlock {
protected Material blockMaterial;
-
+
protected int blockColour;
protected BlockTypes thisBlock;
protected String thisBlockMaterial;
protected final String thisBlockType;
public BlockBaseModular(final Material material, final BlockTypes blockType, final int colour) {
- this(material.getUnlocalizedName(), material.getLocalizedName(), net.minecraft.block.material.Material.iron, blockType, colour, 2);
+ this(material.getUnlocalizedName(), material.getLocalizedName(), net.minecraft.block.material.Material.iron,
+ blockType, colour, 2);
}
-
- public BlockBaseModular(final String unlocalizedName, final String blockMaterial, final BlockTypes blockType, final int colour) {
+
+ public BlockBaseModular(final String unlocalizedName, final String blockMaterial, final BlockTypes blockType,
+ final int colour) {
this(unlocalizedName, blockMaterial, net.minecraft.block.material.Material.iron, blockType, colour, 2);
}
- public BlockBaseModular(final String unlocalizedName, final String blockMaterial, final net.minecraft.block.material.Material vanillaMaterial, final BlockTypes blockType, final int colour, final int miningLevel) {
+ public BlockBaseModular(final String unlocalizedName, final String blockMaterial,
+ final net.minecraft.block.material.Material vanillaMaterial, final BlockTypes blockType, final int colour,
+ final int miningLevel) {
super(unlocalizedName, vanillaMaterial);
this.setHarvestLevel(blockType.getHarvestTool(), miningLevel);
- this.setBlockTextureName(CORE.MODID+":"+blockType.getTexture());
+ this.setBlockTextureName(CORE.MODID + ":" + blockType.getTexture());
this.blockColour = colour;
this.thisBlock = blockType;
this.thisBlockMaterial = blockMaterial;
this.thisBlockType = blockType.name().toUpperCase();
this.setBlockName(this.GetProperName());
- if (!CORE.DEBUG){
- //Utils.LOG_INFO("=============Block Info Dump=============");
- //Utils.LOG_INFO("thisBlock.name().toLowerCase() - "+thisBlock.name().toLowerCase());
- //Utils.LOG_INFO("This Blocks Type - "+thisBlockType);
- //Utils.LOG_INFO("BlockTypes.STANDARD.name().toLowerCase() - "+BlockTypes.STANDARD.name().toLowerCase());
- //Utils.LOG_INFO("BlockTypes.FRAME.name().toLowerCase() - "+BlockTypes.FRAME.name().toLowerCase());
- //Utils.LOG_INFO("blockMaterial - "+blockMaterial);
- //Utils.LOG_INFO("==========================================");
- }
-
- if (this.thisBlockType.equals(BlockTypes.STANDARD.name().toUpperCase())){
- //LanguageRegistry.addName(this, "Block of "+blockMaterial);
- //Utils.LOG_INFO("Registered Block in Language Registry as: "+"Block of "+blockMaterial);
+ if (this.thisBlockType.equals(BlockTypes.STANDARD.name().toUpperCase())) {
+ GameRegistry.registerBlock(this, ItemBlockGtBlock.class,
+ Utils.sanitizeString(blockType.getTexture() + unlocalizedName));
+ GT_OreDictUnificator.registerOre(
+ "block" + getUnlocalizedName().replace("tile.block", "").replace("tile.", "").replace("of", "")
+ .replace("Of", "").replace("Block", "").replace("-", "").replace("_", "").replace(" ", ""),
+ ItemUtils.getSimpleStack(this));
}
- else if (this.thisBlockType.equals(BlockTypes.FRAME.name().toUpperCase())){
- //LanguageRegistry.addName(this, blockMaterial+ " Frame Box");
- //Utils.LOG_INFO("Registered Block in Language Registry as: "+blockMaterial+ " Frame Box");
+ else if (this.thisBlockType.equals(BlockTypes.FRAME.name().toUpperCase())) {
+ GameRegistry.registerBlock(this, ItemBlockGtFrameBox.class,
+ Utils.sanitizeString(blockType.getTexture() + unlocalizedName));
+ GT_OreDictUnificator.registerOre(
+ "frameGt" + getUnlocalizedName().replace("tile.", "").replace("tile.BlockGtFrame", "")
+ .replace("-", "").replace("_", "").replace(" ", "").replace("FrameBox", ""),
+ ItemUtils.getSimpleStack(this));
}
-
- //setOreDict(unlocalizedName, blockType);
- if (this.thisBlockType.equals(BlockTypes.STANDARD.name().toUpperCase())){
- GameRegistry.registerBlock(this, ItemBlockGtBlock.class, Utils.sanitizeString(blockType.getTexture()+unlocalizedName));
- GT_OreDictUnificator.registerOre("block"+getUnlocalizedName().replace("tile.block", "").replace("tile.", "").replace("of", "").replace("Of", "").replace("Block", "").replace("-", "").replace("_", "").replace(" ", ""), ItemUtils.getSimpleStack(this));
- //Utils.LOG_INFO("Registered Block in Block Registry as: "+"Block of "+blockMaterial);
- }
- else if (this.thisBlockType.equals(BlockTypes.FRAME.name().toUpperCase())){
- GameRegistry.registerBlock(this, ItemBlockGtFrameBox.class, Utils.sanitizeString(blockType.getTexture()+unlocalizedName));
- GT_OreDictUnificator.registerOre("frameGt"+getUnlocalizedName().replace("tile.", "").replace("tile.BlockGtFrame", "").replace("-", "").replace("_", "").replace(" ", "").replace("FrameBox", ""), ItemUtils.getSimpleStack(this));
- //Utils.LOG_INFO("Registered Block in Block Registry as: "+blockMaterial+" Frame Box");
+ else if (this.thisBlockType.equals(BlockTypes.ORE.name().toUpperCase())) {
+ GameRegistry.registerBlock(this, ItemBlockGtBlock.class,
+ Utils.sanitizeString(blockType.getTexture() + unlocalizedName));
+ GT_OreDictUnificator.registerOre(
+ "block" + getUnlocalizedName().replace("tile.block", "").replace("tile.", "").replace("of", "")
+ .replace("Of", "").replace("Block", "").replace("-", "").replace("_", "").replace(" ", ""),
+ ItemUtils.getSimpleStack(this));
}
-
}
/**
- * Returns which pass should this block be rendered on. 0 for solids and 1 for alpha
+ * Returns which pass should this block be rendered on. 0 for solids and 1
+ * for alpha
*/
@Override
@SideOnly(Side.CLIENT)
- public int getRenderBlockPass()
- {
- if (this.thisBlock == BlockTypes.FRAME){
+ public int getRenderBlockPass() {
+ if (this.thisBlock == BlockTypes.FRAME) {
return 1;
}
return 0;
}
- /*@Override
- public String getLocalizedName() {
- String tempIngot;
- if (thisBlock == BlockTypes.STANDARD){
- tempIngot = "Block of "+thisBlockMaterial;
- }
- else if (thisBlock == BlockTypes.FRAME){
- tempIngot = thisBlockMaterial + " Frame Box";
- }
- else {
-
- tempIngot = getUnlocalizedName().replace("tile.blockGt", "ingot");
- }
- return tempIngot;
- }*/
-
public String GetProperName() {
String tempIngot;
- if (this.thisBlock == BlockTypes.STANDARD){
- tempIngot = "Block of "+this.thisBlockMaterial;
+ if (this.thisBlock == BlockTypes.STANDARD) {
+ tempIngot = "Block of " + this.thisBlockMaterial;
}
- else if (this.thisBlock == BlockTypes.FRAME){
+ else if (this.thisBlock == BlockTypes.FRAME) {
tempIngot = this.thisBlockMaterial + " Frame Box";
}
- else if (this.thisBlock == BlockTypes.ORE){
- tempIngot = this.thisBlockMaterial + " Ore";
+ else if (this.thisBlock == BlockTypes.ORE) {
+ tempIngot = this.thisBlockMaterial + " Ore [Old]";
}
else {
@@ -124,22 +104,22 @@ public class BlockBaseModular extends BasicBlock{
}
@Override
- public boolean isOpaqueCube()
- {
+ public boolean isOpaqueCube() {
return false;
}
@Override
@SideOnly(Side.CLIENT)
- public void registerBlockIcons(final IIconRegister iIcon)
- {
- this.blockIcon = iIcon.registerIcon(CORE.MODID + ":" + this.thisBlock.getTexture());
+ public void registerBlockIcons(final IIconRegister iIcon) {
+ if (this.thisBlock != BlockTypes.ORE) {
+ this.blockIcon = iIcon.registerIcon(CORE.MODID + ":" + this.thisBlock.getTexture());
+ }
}
@Override
- public int colorMultiplier(final IBlockAccess par1IBlockAccess, final int par2, final int par3, final int par4){
+ public int colorMultiplier(final IBlockAccess par1IBlockAccess, final int par2, final int par3, final int par4) {
- if (this.blockColour == 0){
+ if (this.blockColour == 0) {
return MathUtils.generateSingularRandomHexValue();
}
@@ -148,7 +128,7 @@ public class BlockBaseModular extends BasicBlock{
@Override
public int getRenderColor(final int aMeta) {
- if (this.blockColour == 0){
+ if (this.blockColour == 0) {
return MathUtils.generateSingularRandomHexValue();
}
diff --git a/src/Java/gtPlusPlus/core/block/base/BlockBaseOre.java b/src/Java/gtPlusPlus/core/block/base/BlockBaseOre.java
index d444f11261..5f476ef8df 100644
--- a/src/Java/gtPlusPlus/core/block/base/BlockBaseOre.java
+++ b/src/Java/gtPlusPlus/core/block/base/BlockBaseOre.java
@@ -3,10 +3,6 @@ package gtPlusPlus.core.block.base;
import java.lang.reflect.Field;
import cpw.mods.fml.common.registry.GameRegistry;
-import cpw.mods.fml.common.registry.LanguageRegistry;
-import cpw.mods.fml.relauncher.Side;
-import cpw.mods.fml.relauncher.SideOnly;
-import gregtech.api.enums.Materials;
import gregtech.api.enums.OrePrefixes;
import gregtech.api.enums.Textures;
import gregtech.api.interfaces.IIconContainer;
@@ -21,11 +17,9 @@ import gtPlusPlus.core.item.base.itemblock.ItemBlockOre;
import gtPlusPlus.core.lib.CORE;
import gtPlusPlus.core.material.Material;
import gtPlusPlus.core.util.Utils;
-import gtPlusPlus.core.util.math.MathUtils;
import gtPlusPlus.core.util.minecraft.ItemUtils;
import gtPlusPlus.core.util.reflect.ReflectionUtils;
import net.minecraft.block.Block;
-import net.minecraft.client.renderer.texture.IIconRegister;
import net.minecraft.entity.EnumCreatureType;
import net.minecraft.init.Blocks;
import net.minecraft.util.IIcon;
@@ -34,9 +28,9 @@ import net.minecraft.world.IBlockAccess;
public class BlockBaseOre extends BasicBlock implements ITexturedBlock {
private final Material blockMaterial;
-
+
public BlockBaseOre(final Material material, final BlockTypes blockType, final int colour) {
- super(Utils.sanitizeString(material.getUnlocalizedName()), net.minecraft.block.material.Material.rock);
+ super(blockType, Utils.sanitizeString(material.getUnlocalizedName()), net.minecraft.block.material.Material.rock);
this.blockMaterial = material;
this.setHardness(2.0f);
this.setResistance(6.0F);
@@ -45,15 +39,9 @@ public class BlockBaseOre extends BasicBlock implements ITexturedBlock {
this.setCreativeTab(AddToCreativeTab.tabBlock);
this.setStepSound(soundTypeStone);
this.setBlockName("Ore"+Utils.sanitizeString(Utils.sanitizeString(material.getUnlocalizedName())));
-
-
- //this.setBlockTextureName(CORE.MODID+":"+blockType.getTexture());
- //this.setBlockName(this.blockMaterial.getLocalizedName()+" Ore");
-
try {
GameRegistry.registerBlock(this, ItemBlockOre.class, Utils.sanitizeString("ore"+Utils.sanitizeString(this.blockMaterial.getLocalizedName())));
GT_OreDictUnificator.registerOre("ore"+Utils.sanitizeString(this.blockMaterial.getLocalizedName()), ItemUtils.getSimpleStack(this));
- //LanguageRegistry.addName(this, blockMaterial.getLocalizedName()+ " Ore");
}
catch (Throwable t){
t.printStackTrace();
@@ -89,7 +77,7 @@ public class BlockBaseOre extends BasicBlock implements ITexturedBlock {
*/
//.08 compat
- IIconContainer[] hiddenTextureArray;
+ public static IIconContainer[] hiddenTextureArray;
public ITexture[] getTexture(byte arg0) {
return getTexture(null, arg0);
}
@@ -98,7 +86,6 @@ public class BlockBaseOre extends BasicBlock implements ITexturedBlock {
if (this.blockMaterial != null){
GT_RenderedTexture aIconSet = new GT_RenderedTexture(blockMaterial.getTextureSet().mTextures[OrePrefixes.ore.mTextureIndex], this.blockMaterial.getRGBA());
if (aIconSet != null){
- //Logger.INFO("[Render] Good Overlay.");
return new ITexture[]{new GT_CopiedBlockTexture(Blocks.stone, 0, 0), aIconSet};
}
}
@@ -111,30 +98,21 @@ public class BlockBaseOre extends BasicBlock implements ITexturedBlock {
try {
Field o = ReflectionUtils.getField(Textures.BlockIcons.class, "STONES");
if (o != null){
- hiddenTextureArray = (IIconContainer[]) o.get(Textures.BlockIcons.class);
- if (hiddenTextureArray != null){
- //Found
- }
- else {
- hiddenTextureArray = new IIconContainer[6];
- }
+ hiddenTextureArray = (IIconContainer[]) o.get(Textures.BlockIcons.class);
+ }
+ if (hiddenTextureArray == null){
+ hiddenTextureArray = new IIconContainer[6];
}
}
catch (NoSuchFieldException | IllegalArgumentException | IllegalAccessException e) {
+ hiddenTextureArray = new IIconContainer[6];
}
}
}
-
- //return new ITexture[]{new GT_RenderedTexture(Textures.BlockIcons.STONES[0], new short[]{240, 240, 240, 0})};
- return new ITexture[]{new GT_RenderedTexture(hiddenTextureArray[0], new short[]{240, 240, 240, 0})};
+ return new ITexture[]{new GT_RenderedTexture(hiddenTextureArray[0], new short[]{240, 240, 240, 0})};
}
- public static class oldOreBlock extends BlockBaseModular{
-
- @SuppressWarnings("unused")
- private IIcon base;
- @SuppressWarnings("unused")
- private IIcon overlay;
+ public static class oldOreBlock extends BlockBaseModular implements ITexturedBlock{
public oldOreBlock(final String unlocalizedName, final String blockMaterial, final BlockTypes blockType, final int colour) {
this(unlocalizedName, blockMaterial, net.minecraft.block.material.Material.iron, blockType, colour, 2);
@@ -144,7 +122,7 @@ public class BlockBaseOre extends BasicBlock implements ITexturedBlock {
super(unlocalizedName, blockMaterial, vanillaMaterial, blockType, colour, miningLevel);
}
- @Override
+ /*@Override
@SideOnly(Side.CLIENT)
public void registerBlockIcons(final IIconRegister iIcon)
{
@@ -167,11 +145,66 @@ public class BlockBaseOre extends BasicBlock implements ITexturedBlock {
return MathUtils.generateSingularRandomHexValue();
}
return this.blockColour;
- }
+ }*/
@Override
public boolean canCreatureSpawn(final EnumCreatureType type, final IBlockAccess world, final int x, final int y, final int z) {
return false;
+ }
+
+ @Override
+ public int getRenderType() {
+ return CustomOreBlockRenderer.INSTANCE.mRenderID;
+ }
+
+ @Override
+ public IIcon getIcon(IBlockAccess aIBlockAccess, int aX, int aY, int aZ, int aSide) {
+ return Blocks.stone.getIcon(0, 0);
+ }
+
+ @Override
+ public IIcon getIcon(int aSide, int aMeta) {
+ return Blocks.stone.getIcon(0, 0);
+ }
+
+ /**
+ * GT Texture Handler
+ */
+
+ //.08 compat
+ IIconContainer[] hiddenTextureArray;
+ public ITexture[] getTexture(byte arg0) {
+ return getTexture(null, arg0);
+ }
+
+ public ITexture[] getTexture(Block block, byte side) {
+ if (this.blockMaterial != null){
+ GT_RenderedTexture aIconSet = new GT_RenderedTexture(blockMaterial.getTextureSet().mTextures[OrePrefixes.ore.mTextureIndex], this.blockMaterial.getRGBA());
+ if (aIconSet != null){
+ return new ITexture[]{new GT_CopiedBlockTexture(Blocks.stone, 0, 0), aIconSet};
+ }
+ }
+
+ if (hiddenTextureArray == null){
+ if (!CORE.MAIN_GREGTECH_5U_EXPERIMENTAL_FORK){
+ hiddenTextureArray = Textures.BlockIcons.GRANITES;
+ }
+ else {
+ try {
+ Field o = ReflectionUtils.getField(Textures.BlockIcons.class, "STONES");
+ if (o != null){
+ hiddenTextureArray = (IIconContainer[]) o.get(Textures.BlockIcons.class);
+ }
+ if (hiddenTextureArray == null){
+ hiddenTextureArray = new IIconContainer[6];
+ }
+ }
+ catch (NoSuchFieldException | IllegalArgumentException | IllegalAccessException e) {
+ hiddenTextureArray = new IIconContainer[6];
+ }
+ }
+ }
+ return new ITexture[]{new GT_RenderedTexture(hiddenTextureArray[0], new short[]{240, 240, 240, 0})};
}
}