diff options
author | Jordan Byrne <draknyte1@hotmail.com> | 2018-01-24 18:38:51 +1000 |
---|---|---|
committer | Jordan Byrne <draknyte1@hotmail.com> | 2018-01-24 18:38:51 +1000 |
commit | 7ddb7f5e8ed9fe60b730183c7a04f3bce3b8f815 (patch) | |
tree | 735ad1d98be4b7ec4469df6bec8370ee4f503e03 /src/Java/gtPlusPlus/core/block/base | |
parent | f357e3a1753c7c542d48bb217d8a2545cb9544c4 (diff) | |
download | GT5-Unofficial-7ddb7f5e8ed9fe60b730183c7a04f3bce3b8f815.tar.gz GT5-Unofficial-7ddb7f5e8ed9fe60b730183c7a04f3bce3b8f815.tar.bz2 GT5-Unofficial-7ddb7f5e8ed9fe60b730183c7a04f3bce3b8f815.zip |
$ Several 5.08 compat fixes.
$ Fixed pollution, which was causing all multiblocks to fail. This was pointed out in #191 by @CodeWarrior0, however I decided to re-do it myself to better handle the .08 compat.
$ Fixed all multiblocks being broken as fuck. Fixes #190, fixes #186 and also fixes #176.
- Removed some useless logging from the mining explosives.
Diffstat (limited to 'src/Java/gtPlusPlus/core/block/base')
-rw-r--r-- | src/Java/gtPlusPlus/core/block/base/BlockBaseOre.java | 51 |
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; } - } + } } |