aboutsummaryrefslogtreecommitdiff
path: root/src/Java/gtPlusPlus/core/block
diff options
context:
space:
mode:
Diffstat (limited to 'src/Java/gtPlusPlus/core/block')
-rw-r--r--src/Java/gtPlusPlus/core/block/base/BlockBaseOre.java51
1 files changed, 42 insertions, 9 deletions
diff --git a/src/Java/gtPlusPlus/core/block/base/BlockBaseOre.java b/src/Java/gtPlusPlus/core/block/base/BlockBaseOre.java
index 0a74a9f2aa..0bab9638e0 100644
--- a/src/Java/gtPlusPlus/core/block/base/BlockBaseOre.java
+++ b/src/Java/gtPlusPlus/core/block/base/BlockBaseOre.java
@@ -1,5 +1,7 @@
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;
@@ -7,6 +9,7 @@ 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;
import gregtech.api.interfaces.ITexture;
import gregtech.api.interfaces.tileentity.ITexturedTileEntity;
import gregtech.api.objects.GT_CopiedBlockTexture;
@@ -20,6 +23,7 @@ import gtPlusPlus.core.material.Material;
import gtPlusPlus.core.util.Utils;
import gtPlusPlus.core.util.item.ItemUtils;
import gtPlusPlus.core.util.math.MathUtils;
+import gtPlusPlus.core.util.reflect.ReflectionUtils;
import net.minecraft.block.Block;
import net.minecraft.client.renderer.texture.IIconRegister;
import net.minecraft.entity.EnumCreatureType;
@@ -42,14 +46,14 @@ public class BlockBaseOre extends BasicBlock implements ITexturedTileEntity {
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");
+ 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();
@@ -60,7 +64,7 @@ public class BlockBaseOre extends BasicBlock implements ITexturedTileEntity {
public boolean canCreatureSpawn(final EnumCreatureType type, final IBlockAccess world, final int x, final int y, final int z) {
return false;
}
-
+
public Material getMaterialEx(){
return this.blockMaterial;
}
@@ -84,7 +88,12 @@ public class BlockBaseOre extends BasicBlock implements ITexturedTileEntity {
* GT Texture Handler
*/
- @Override
+ //.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(Materials.Iron.mIconSet.mTextures[OrePrefixes.ore.mTextureIndex], this.blockMaterial.getRGBA());
@@ -93,7 +102,31 @@ public class BlockBaseOre extends BasicBlock implements ITexturedTileEntity {
return new ITexture[]{new GT_CopiedBlockTexture(Blocks.stone, 0, 0), aIconSet};
}
}
- return new ITexture[]{new GT_RenderedTexture(Textures.BlockIcons.STONES[0], new short[]{240, 240, 240, 0})};
+
+ 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){
+ //Found
+ }
+ else {
+ hiddenTextureArray = new IIconContainer[6];
+ }
+ }
+ }
+ catch (NoSuchFieldException | IllegalArgumentException | IllegalAccessException e) {
+ }
+ }
+ }
+
+ //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})};
}
public static class oldOreBlock extends BlockBaseModular{
@@ -141,6 +174,6 @@ public class BlockBaseOre extends BasicBlock implements ITexturedTileEntity {
return false;
}
- }
+ }
}