aboutsummaryrefslogtreecommitdiff
path: root/src/Java/miscutil/core/block/base
diff options
context:
space:
mode:
Diffstat (limited to 'src/Java/miscutil/core/block/base')
-rw-r--r--src/Java/miscutil/core/block/base/BlockBaseModular.java44
1 files changed, 41 insertions, 3 deletions
diff --git a/src/Java/miscutil/core/block/base/BlockBaseModular.java b/src/Java/miscutil/core/block/base/BlockBaseModular.java
index f8d965f6d7..19f40c4ef0 100644
--- a/src/Java/miscutil/core/block/base/BlockBaseModular.java
+++ b/src/Java/miscutil/core/block/base/BlockBaseModular.java
@@ -1,9 +1,11 @@
package miscutil.core.block.base;
import miscutil.core.lib.CORE;
+import miscutil.core.util.Utils;
import net.minecraft.block.material.Material;
import net.minecraft.client.renderer.texture.IIconRegister;
import net.minecraft.world.IBlockAccess;
+import cpw.mods.fml.common.registry.LanguageRegistry;
import cpw.mods.fml.relauncher.Side;
import cpw.mods.fml.relauncher.SideOnly;
@@ -11,13 +13,17 @@ public class BlockBaseModular extends BasicBlock{
protected int blockColour;
protected BlockTypes thisBlock;
+ protected String thisBlockMaterial;
- public BlockBaseModular(String unlocalizedName, BlockTypes blockType, int colour) {
+ public BlockBaseModular(String unlocalizedName, String blockMaterial, BlockTypes blockType, int colour) {
super(unlocalizedName, Material.iron);
this.setHarvestLevel(blockType.getHarvestTool(), 2);
this.setBlockTextureName(CORE.MODID+":"+blockType.getTexture());
this.blockColour = colour;
this.thisBlock = blockType;
+ this.thisBlockMaterial = blockMaterial;
+ this.setBlockName(getLocalizedName());
+ LanguageRegistry.addName(this, getLocalizedName());
}
/**
@@ -27,13 +33,26 @@ public class BlockBaseModular extends BasicBlock{
@SideOnly(Side.CLIENT)
public int getRenderBlockPass()
{
- if (thisBlock.name() == BlockTypes.FRAME.name()){
+ if (thisBlock == BlockTypes.FRAME){
return 1;
}
return 0;
}
@Override
+ public String getLocalizedName() {
+ String tempIngot = getUnlocalizedName().replace("tile.blockGtFrame", "");
+ if (thisBlock == BlockTypes.FRAME){
+ tempIngot = thisBlockMaterial + " Frame Box";
+ }
+ else {
+
+ tempIngot = getUnlocalizedName().replace("tile.blockGt", "ingot");
+ }
+ return tempIngot;
+ }
+
+ @Override
public boolean isOpaqueCube()
{
return false;
@@ -47,7 +66,26 @@ public class BlockBaseModular extends BasicBlock{
}
@Override
- public int colorMultiplier(IBlockAccess par1IBlockAccess, int par2, int par3, int par4){
+ public int colorMultiplier(IBlockAccess par1IBlockAccess, int par2, int par3, int par4){
+
+ if (this.blockColour == 0){
+ return Utils.generateSingularRandomHexValue();
+ }
+
+ return this.blockColour;
+ }
+
+ @Override
+ public int getRenderColor(int aMeta) {
+ if (this.blockColour == 0){
+ return Utils.generateSingularRandomHexValue();
+ }
+
+ return this.blockColour;
+ }
+
+ @Override
+ public int getBlockColor() {
return this.blockColour;
}