Ore system rewrite

This commit is contained in:
Muramasa 2016-07-18 19:00:53 +01:00
parent 51e269e3f5
commit de6e90a000
14 changed files with 681 additions and 264 deletions

View file

@ -175,7 +175,7 @@ public class GregTech_API {
* Initialized by the Block creation.
*/
public static Block sBlockMachines;
public static Block sBlockOres1, sBlockGem, sBlockMetal1, sBlockMetal2, sBlockMetal3, sBlockMetal4, sBlockMetal5, sBlockMetal6, sBlockMetal7, sBlockMetal8, sBlockGem1, sBlockGem2, sBlockGem3, sBlockReinforced;
public static Block sBlockOres1, sBlockOresUb1, sBlockOresUb2, sBlockOresUb3, sBlockGem, sBlockMetal1, sBlockMetal2, sBlockMetal3, sBlockMetal4, sBlockMetal5, sBlockMetal6, sBlockMetal7, sBlockMetal8, sBlockGem1, sBlockGem2, sBlockGem3, sBlockReinforced;
public static Block sBlockGranites, sBlockConcretes, sBlockStones;
public static Block sBlockCasings1, sBlockCasings2, sBlockCasings3, sBlockCasings4;
/**

View file

@ -7,7 +7,7 @@ import gregtech.api.enums.ConfigCategories;
import gregtech.api.enums.Materials;
import gregtech.api.enums.OrePrefixes;
import gregtech.api.objects.ItemData;
import gregtech.common.blocks.GT_Block_Ores;
import gregtech.common.blocks.GT_Block_Ores_Abstract;
import gregtech.common.blocks.GT_TileEntity_Ores;
import ic2.api.crops.CropCard;
import ic2.api.crops.Crops;
@ -200,7 +200,7 @@ public class GT_BaseCrop extends CropCard implements ICropCardInfo {
}
for (int i = 1; i < this.getrootslength(aCrop); i++) {
Block tBlock = aCrop.getWorld().getBlock(aCrop.getLocation().posX, aCrop.getLocation().posY - i, aCrop.getLocation().posZ);
if ((tBlock instanceof GT_Block_Ores)) {
if ((tBlock instanceof GT_Block_Ores_Abstract)) {
TileEntity tTileEntity = aCrop.getWorld().getTileEntity(aCrop.getLocation().posX, aCrop.getLocation().posY - i, aCrop.getLocation().posZ);
if ((tTileEntity instanceof GT_TileEntity_Ores)) {
Materials tMaterial = GregTech_API.sGeneratedMaterials[(((GT_TileEntity_Ores) tTileEntity).mMetaData % 1000)];

View file

@ -69,29 +69,28 @@ public class GT_Worldgen_GT_Ore_Layer
if (this.mSecondaryMeta > 0) {
for (int i = tMinY - 1; i < tMinY + 2; i++) {
if ((aRandom.nextInt(Math.max(1, Math.max(Math.abs(cZ - tZ), Math.abs(eZ - tZ)) / this.mDensity)) == 0) || (aRandom.nextInt(Math.max(1, Math.max(Math.abs(cX - tX), Math.abs(eX - tX)) / this.mDensity)) == 0)) {
GT_TileEntity_Ores.setOreBlock(aWorld, tX, i, tZ, this.mSecondaryMeta);
GT_TileEntity_Ores.setOreBlock(aWorld, tX, i, tZ, this.mSecondaryMeta, false);
}
}
}
if ((this.mBetweenMeta > 0) && ((aRandom.nextInt(Math.max(1, Math.max(Math.abs(cZ - tZ), Math.abs(eZ - tZ)) / this.mDensity)) == 0) || (aRandom.nextInt(Math.max(1, Math.max(Math.abs(cX - tX), Math.abs(eX - tX)) / this.mDensity)) == 0))) {
GT_TileEntity_Ores.setOreBlock(aWorld, tX, tMinY + 2 + aRandom.nextInt(2), tZ, this.mBetweenMeta);
GT_TileEntity_Ores.setOreBlock(aWorld, tX, tMinY + 2 + aRandom.nextInt(2), tZ, this.mBetweenMeta, false);
}
if (this.mPrimaryMeta > 0) {
for (int i = tMinY + 3; i < tMinY + 6; i++) {
if ((aRandom.nextInt(Math.max(1, Math.max(Math.abs(cZ - tZ), Math.abs(eZ - tZ)) / this.mDensity)) == 0) || (aRandom.nextInt(Math.max(1, Math.max(Math.abs(cX - tX), Math.abs(eX - tX)) / this.mDensity)) == 0)) {
GT_TileEntity_Ores.setOreBlock(aWorld, tX, i, tZ, this.mPrimaryMeta);
GT_TileEntity_Ores.setOreBlock(aWorld, tX, i, tZ, this.mPrimaryMeta, false);
}
}
}
if ((this.mSporadicMeta > 0) && ((aRandom.nextInt(Math.max(1, Math.max(Math.abs(cZ - tZ), Math.abs(eZ - tZ)) / this.mDensity)) == 0) || (aRandom.nextInt(Math.max(1, Math.max(Math.abs(cX - tX), Math.abs(eX - tX)) / this.mDensity)) == 0))) {
GT_TileEntity_Ores.setOreBlock(aWorld, tX, tMinY - 1 + aRandom.nextInt(7), tZ, this.mSporadicMeta);
GT_TileEntity_Ores.setOreBlock(aWorld, tX, tMinY - 1 + aRandom.nextInt(7), tZ, this.mSporadicMeta, false);
}
}
}
if (GT_Values.D1) {
System.out.println("Generated Orevein: " + this.mWorldGenName);
}
System.out.println("######META: " + this.mPrimaryMeta);
return true;
}
}

View file

@ -37,7 +37,7 @@ public class GT_Worldgen_GT_Ore_SmallPieces
if (this.mMeta > 0) {
int i = 0;
for (int j = Math.max(1, this.mAmount / 2 + aRandom.nextInt(this.mAmount) / 2); i < j; i++) {
GT_TileEntity_Ores.setOreBlock(aWorld, aChunkX + aRandom.nextInt(16), this.mMinY + aRandom.nextInt(Math.max(1, this.mMaxY - this.mMinY)), aChunkZ + aRandom.nextInt(16), this.mMeta + 16000);
GT_TileEntity_Ores.setOreBlock(aWorld, aChunkX + aRandom.nextInt(16), this.mMinY + aRandom.nextInt(Math.max(1, this.mMaxY - this.mMinY)), aChunkZ + aRandom.nextInt(16), /*this.mMeta + 16000*/this.mMeta, true);
}
}
return true;

View file

@ -1,48 +1,26 @@
package gregtech.common.blocks;
import cpw.mods.fml.common.Loader;
import cpw.mods.fml.relauncher.Side;
import cpw.mods.fml.relauncher.SideOnly;
import gregtech.GT_Mod;
import gregtech.api.GregTech_API;
import gregtech.api.enums.Materials;
import gregtech.api.enums.OrePrefixes;
import gregtech.api.items.GT_Generic_Block;
import gregtech.api.enums.Textures;
import gregtech.api.interfaces.ITexture;
import gregtech.api.objects.GT_CopiedBlockTexture;
import gregtech.api.objects.GT_RenderedTexture;
import gregtech.api.util.GT_LanguageManager;
import gregtech.api.util.GT_ModHandler;
import gregtech.api.util.GT_OreDictUnificator;
import gregtech.common.render.GT_Renderer_Block;
import net.minecraft.block.Block;
import net.minecraft.block.ITileEntityProvider;
import net.minecraft.block.material.Material;
import net.minecraft.client.renderer.texture.IIconRegister;
import net.minecraft.creativetab.CreativeTabs;
import net.minecraft.entity.Entity;
import net.minecraft.entity.boss.EntityDragon;
import net.minecraft.init.Blocks;
import net.minecraft.item.Item;
import net.minecraft.item.ItemStack;
import net.minecraft.tileentity.TileEntity;
import net.minecraft.util.IIcon;
import net.minecraft.util.StatCollector;
import net.minecraft.world.IBlockAccess;
import net.minecraft.world.World;
import java.util.ArrayList;
import java.util.List;
public class GT_Block_Ores
extends GT_Generic_Block
implements ITileEntityProvider {
public static ThreadLocal<GT_TileEntity_Ores> mTemporaryTileEntity = new ThreadLocal();
public static boolean FUCKING_LOCK = false;
public class GT_Block_Ores extends GT_Block_Ores_Abstract {
public GT_Block_Ores() {
super(GT_Item_Ores.class, "gt.blockores", Material.rock);
this.isBlockContainer = true;
setStepSound(soundTypeStone);
setCreativeTab(GregTech_API.TAB_GREGTECH_ORES);
boolean tHideOres = Loader.isModLoaded("NotEnoughItems") && GT_Mod.gregtechproxy.mHideUnusedOres;
super("gt.blockores", Material.rock);
for (int i = 0; i < 16; i++) {
GT_ModHandler.addValuableOre(this, i, 1);
}
@ -59,9 +37,6 @@ public class GT_Block_Ores
GT_LanguageManager.addStringLocalization(getUnlocalizedName() + "." + (i + 18000) + ".name", "Small " + getLocalizedName(GregTech_API.sGeneratedMaterials[i]));
GT_LanguageManager.addStringLocalization(getUnlocalizedName() + "." + (i + 19000) + ".name", "Small " + getLocalizedName(GregTech_API.sGeneratedMaterials[i]));
GT_LanguageManager.addStringLocalization(getUnlocalizedName() + "." + (i + 20000) + ".name", "Small " + getLocalizedName(GregTech_API.sGeneratedMaterials[i]));
GT_LanguageManager.addStringLocalization(getUnlocalizedName() + "." + (i + 21000) + ".name", getLocalizedName(GregTech_API.sGeneratedMaterials[i]));
//GT_LanguageManager.addStringLocalization(getUnlocalizedName() + "." + (i + 30000) + ".name", getLocalizedName(GregTech_API.sGeneratedMaterials[i]));
//GT_LanguageManager.addStringLocalization(getUnlocalizedName() + "." + (i + 50000) + ".name", getLocalizedName(GregTech_API.sGeneratedMaterials[i]));
if ((GregTech_API.sGeneratedMaterials[i].mTypes & 0x8) != 0) {
GT_OreDictUnificator.registerOre(OrePrefixes.ore.get(GregTech_API.sGeneratedMaterials[i]), new ItemStack(this, 1, i));
@ -70,191 +45,35 @@ public class GT_Block_Ores
GT_OreDictUnificator.registerOre(OrePrefixes.oreBlackgranite.get(GregTech_API.sGeneratedMaterials[i]), new ItemStack(this, 1, i + 3000));
GT_OreDictUnificator.registerOre(OrePrefixes.oreRedgranite.get(GregTech_API.sGeneratedMaterials[i]), new ItemStack(this, 1, i + 4000));
GT_OreDictUnificator.registerOre(OrePrefixes.oreMarble.get(GregTech_API.sGeneratedMaterials[i]), new ItemStack(this, 1, i + 5000));
GT_OreDictUnificator.registerOre("oreIgneousStone", new ItemStack(this, 1, i + 21000));
//GT_OreDictUnificator.registerOre("oreMetamorphicStone", new ItemStack(this, 1, i + 40000));
//GT_OreDictUnificator.registerOre("oreSedimentaryStone", new ItemStack(this, 1, i + 50000));
if (tHideOres) {
codechicken.nei.api.API.hideItem(new ItemStack(this, 1, i + 1000));
codechicken.nei.api.API.hideItem(new ItemStack(this, 1, i + 2000));
codechicken.nei.api.API.hideItem(new ItemStack(this, 1, i + 3000));
codechicken.nei.api.API.hideItem(new ItemStack(this, 1, i + 4000));
codechicken.nei.api.API.hideItem(new ItemStack(this, 1, i + 5000));
codechicken.nei.api.API.hideItem(new ItemStack(this, 1, i + 16000));
codechicken.nei.api.API.hideItem(new ItemStack(this, 1, i + 17000));
codechicken.nei.api.API.hideItem(new ItemStack(this, 1, i + 18000));
codechicken.nei.api.API.hideItem(new ItemStack(this, 1, i + 19000));
codechicken.nei.api.API.hideItem(new ItemStack(this, 1, i + 20000));
codechicken.nei.api.API.hideItem(new ItemStack(this, 1, i + 21000));
//codechicken.nei.api.API.hideItem(new ItemStack(this, 1, i + 40000));
//codechicken.nei.api.API.hideItem(new ItemStack(this, 1, i + 50000));
}
if (tHideOres) {
codechicken.nei.api.API.hideItem(new ItemStack(this, 1, i + 1000));
codechicken.nei.api.API.hideItem(new ItemStack(this, 1, i + 2000));
codechicken.nei.api.API.hideItem(new ItemStack(this, 1, i + 3000));
codechicken.nei.api.API.hideItem(new ItemStack(this, 1, i + 4000));
codechicken.nei.api.API.hideItem(new ItemStack(this, 1, i + 5000));
codechicken.nei.api.API.hideItem(new ItemStack(this, 1, i + 16000));
codechicken.nei.api.API.hideItem(new ItemStack(this, 1, i + 17000));
codechicken.nei.api.API.hideItem(new ItemStack(this, 1, i + 18000));
codechicken.nei.api.API.hideItem(new ItemStack(this, 1, i + 19000));
codechicken.nei.api.API.hideItem(new ItemStack(this, 1, i + 20000));
}
}
}
}
}
public void onNeighborChange(IBlockAccess aWorld, int aX, int aY, int aZ, int aTileX, int aTileY, int aTileZ) {
if (!FUCKING_LOCK) {
FUCKING_LOCK = true;
TileEntity tTileEntity = aWorld.getTileEntity(aX, aY, aZ);
if ((tTileEntity instanceof GT_TileEntity_Ores)) {
((GT_TileEntity_Ores) tTileEntity).onUpdated();
}
}
FUCKING_LOCK = false;
}
public void onNeighborBlockChange(World aWorld, int aX, int aY, int aZ, Block aBlock) {
if (!FUCKING_LOCK) {
FUCKING_LOCK = true;
TileEntity tTileEntity = aWorld.getTileEntity(aX, aY, aZ);
if ((tTileEntity instanceof GT_TileEntity_Ores)) {
((GT_TileEntity_Ores) tTileEntity).onUpdated();
}
}
FUCKING_LOCK = false;
}
public String getLocalizedName(Materials aMaterial) {
switch (aMaterial) {
case InfusedAir:
case InfusedDull:
case InfusedEarth:
case InfusedEntropy:
case InfusedFire:
case InfusedOrder:
case InfusedVis:
case InfusedWater:
return aMaterial.mDefaultLocalName + " Infused Stone";
case Vermiculite:
case Bentonite:
case Kaolinite:
case Talc:
case BasalticMineralSand:
case GraniticMineralSand:
case GlauconiteSand:
case CassiteriteSand:
case GarnetSand:
case QuartzSand:
case Pitchblende:
case FullersEarth:
return aMaterial.mDefaultLocalName;
default:
return aMaterial.mDefaultLocalName + OrePrefixes.ore.mLocalizedMaterialPost;
}
}
public boolean onBlockEventReceived(World p_149696_1_, int p_149696_2_, int p_149696_3_, int p_149696_4_, int p_149696_5_, int p_149696_6_) {
super.onBlockEventReceived(p_149696_1_, p_149696_2_, p_149696_3_, p_149696_4_, p_149696_5_, p_149696_6_);
TileEntity tileentity = p_149696_1_.getTileEntity(p_149696_2_, p_149696_3_, p_149696_4_);
return tileentity != null ? tileentity.receiveClientEvent(p_149696_5_, p_149696_6_) : false;
}
public boolean canEntityDestroy(IBlockAccess world, int x, int y, int z, Entity entity) {
return (!(entity instanceof EntityDragon)) && (super.canEntityDestroy(world, x, y, z, entity));
}
public String getHarvestTool(int aMeta) {
return aMeta < 8 ? "pickaxe" : "shovel";
}
public int getHarvestLevel(int aMeta) {
return aMeta % 8;
}
public float getBlockHardness(World aWorld, int aX, int aY, int aZ) {
return 1.0F + getHarvestLevel(aWorld.getBlockMetadata(aX, aY, aZ)) * 1.0F;
}
public float getExplosionResistance(Entity par1Entity, World aWorld, int aX, int aY, int aZ, double explosionX, double explosionY, double explosionZ) {
return 1.0F + getHarvestLevel(aWorld.getBlockMetadata(aX, aY, aZ)) * 1.0F;
}
protected boolean canSilkHarvest() {
return false;
}
@Override
public String getUnlocalizedName() {
return "gt.blockores";
}
public String getLocalizedName() {
return StatCollector.translateToLocal(getUnlocalizedName() + ".name");
@Override
public ITexture[] getStoneTexture(byte aSide, int aMetaData, Materials aMaterial) {
ITexture[] mStoneTextures = {new GT_CopiedBlockTexture(Blocks.stone, 0, 0), new GT_CopiedBlockTexture(Blocks.netherrack, 0, 0), new GT_CopiedBlockTexture(Blocks.end_stone, 0, 0), new GT_RenderedTexture(Textures.BlockIcons.GRANITE_BLACK_STONE), new GT_RenderedTexture(Textures.BlockIcons.GRANITE_RED_STONE), new GT_CopiedBlockTexture(Blocks.stone, 0, 0), new GT_CopiedBlockTexture(Blocks.stone, 0, 0), new GT_CopiedBlockTexture(Blocks.stone, 0, 0), new GT_CopiedBlockTexture(Blocks.stone, 0, 0), new GT_CopiedBlockTexture(Blocks.stone, 0, 0), new GT_CopiedBlockTexture(Blocks.stone, 0, 0), new GT_CopiedBlockTexture(Blocks.stone, 0, 0), new GT_CopiedBlockTexture(Blocks.stone, 0, 0), new GT_CopiedBlockTexture(Blocks.stone, 0, 0), new GT_CopiedBlockTexture(Blocks.stone, 0, 0), new GT_CopiedBlockTexture(Blocks.stone, 0, 0)};
return new ITexture[]{mStoneTextures[(aMetaData / 1000 % 16)], new GT_RenderedTexture(aMaterial.mIconSet.mTextures[aMetaData / 16000 == 0 ? OrePrefixes.ore.mTextureIndex : OrePrefixes.oreSmall.mTextureIndex], aMaterial.mRGBa)};
}
public int getRenderType() {
if (GT_Renderer_Block.INSTANCE == null) {
return super.getRenderType();
}
return GT_Renderer_Block.INSTANCE.mRenderID;
}
public boolean canBeReplacedByLeaves(IBlockAccess aWorld, int aX, int aY, int aZ) {
return false;
}
public boolean isNormalCube(IBlockAccess aWorld, int aX, int aY, int aZ) {
return true;
}
public boolean hasTileEntity(int aMeta) {
return true;
}
public boolean renderAsNormalBlock() {
return true;
}
public boolean isOpaqueCube() {
return true;
}
public TileEntity createNewTileEntity(World aWorld, int aMeta) {
return createTileEntity(aWorld, aMeta);
}
public IIcon getIcon(IBlockAccess aIBlockAccess, int aX, int aY, int aZ, int aSide) {
return Blocks.stone.getIcon(0, 0);
}
public IIcon getIcon(int aSide, int aMeta) {
return Blocks.stone.getIcon(0, 0);
}
@SideOnly(Side.CLIENT)
public void registerBlockIcons(IIconRegister aIconRegister) {
}
public int getDamageValue(World aWorld, int aX, int aY, int aZ) {
TileEntity tTileEntity = aWorld.getTileEntity(aX, aY, aZ);
if ((tTileEntity != null) && ((tTileEntity instanceof GT_TileEntity_Ores))) {
return ((GT_TileEntity_Ores) tTileEntity).getMetaData();
}
return 0;
}
public void breakBlock(World aWorld, int aX, int aY, int aZ, Block par5, int par6) {
TileEntity tTileEntity = aWorld.getTileEntity(aX, aY, aZ);
if ((tTileEntity instanceof GT_TileEntity_Ores)) {
mTemporaryTileEntity.set((GT_TileEntity_Ores) tTileEntity);
}
super.breakBlock(aWorld, aX, aY, aZ, par5, par6);
aWorld.removeTileEntity(aX, aY, aZ);
}
public ArrayList<ItemStack> getDrops(World aWorld, int aX, int aY, int aZ, int aMeta, int aFortune) {
TileEntity tTileEntity = aWorld.getTileEntity(aX, aY, aZ);
if ((tTileEntity instanceof GT_TileEntity_Ores)) {
return ((GT_TileEntity_Ores) tTileEntity).getDrops(aFortune);
}
return mTemporaryTileEntity.get() == null ? new ArrayList() : ((GT_TileEntity_Ores) mTemporaryTileEntity.get()).getDrops(aFortune);
}
public TileEntity createTileEntity(World aWorld, int aMeta) {
return new GT_TileEntity_Ores();
}
@SideOnly(Side.CLIENT)
@Override
public void getSubBlocks(Item aItem, CreativeTabs aTab, List aList) {
for (int i = 0; i < GregTech_API.sGeneratedMaterials.length; i++) {
Materials tMaterial = GregTech_API.sGeneratedMaterials[i];
@ -270,10 +89,7 @@ public class GT_Block_Ores
aList.add(new ItemStack(aItem, 1, i + 18000));
aList.add(new ItemStack(aItem, 1, i + 19000));
aList.add(new ItemStack(aItem, 1, i + 20000));
aList.add(new ItemStack(aItem, 1, i + 21000));
//aList.add(new ItemStack(aItem, 1, i + 40000));
//aList.add(new ItemStack(aItem, 1, i + 50000));
}
}
}
}
}

View file

@ -0,0 +1,208 @@
package gregtech.common.blocks;
import cpw.mods.fml.common.Loader;
import cpw.mods.fml.relauncher.Side;
import cpw.mods.fml.relauncher.SideOnly;
import gregtech.GT_Mod;
import gregtech.api.GregTech_API;
import gregtech.api.enums.Materials;
import gregtech.api.enums.OrePrefixes;
import gregtech.api.interfaces.ITexture;
import gregtech.api.items.GT_Generic_Block;
import gregtech.common.render.GT_Renderer_Block;
import net.minecraft.block.Block;
import net.minecraft.block.ITileEntityProvider;
import net.minecraft.block.material.Material;
import net.minecraft.client.renderer.texture.IIconRegister;
import net.minecraft.creativetab.CreativeTabs;
import net.minecraft.entity.Entity;
import net.minecraft.entity.boss.EntityDragon;
import net.minecraft.init.Blocks;
import net.minecraft.item.Item;
import net.minecraft.item.ItemStack;
import net.minecraft.tileentity.TileEntity;
import net.minecraft.util.IIcon;
import net.minecraft.util.StatCollector;
import net.minecraft.world.IBlockAccess;
import net.minecraft.world.World;
import java.util.ArrayList;
import java.util.List;
public abstract class GT_Block_Ores_Abstract extends GT_Generic_Block implements ITileEntityProvider {
public static ThreadLocal<GT_TileEntity_Ores> mTemporaryTileEntity = new ThreadLocal();
public static boolean FUCKING_LOCK = false;
public static boolean tHideOres;
protected GT_Block_Ores_Abstract(String aUnlocalizedName, Material aMaterial) {
super(GT_Item_Ores.class, aUnlocalizedName, aMaterial);
this.isBlockContainer = true;
setStepSound(soundTypeStone);
setCreativeTab(GregTech_API.TAB_GREGTECH_ORES);
tHideOres = Loader.isModLoaded("NotEnoughItems") && GT_Mod.gregtechproxy.mHideUnusedOres;
}
public void onNeighborChange(IBlockAccess aWorld, int aX, int aY, int aZ, int aTileX, int aTileY, int aTileZ) {
if (!FUCKING_LOCK) {
FUCKING_LOCK = true;
TileEntity tTileEntity = aWorld.getTileEntity(aX, aY, aZ);
if ((tTileEntity instanceof GT_TileEntity_Ores)) {
((GT_TileEntity_Ores) tTileEntity).onUpdated();
}
}
FUCKING_LOCK = false;
}
public void onNeighborBlockChange(World aWorld, int aX, int aY, int aZ, Block aBlock) {
if (!FUCKING_LOCK) {
FUCKING_LOCK = true;
TileEntity tTileEntity = aWorld.getTileEntity(aX, aY, aZ);
if ((tTileEntity instanceof GT_TileEntity_Ores)) {
((GT_TileEntity_Ores) tTileEntity).onUpdated();
}
}
FUCKING_LOCK = false;
}
public String getLocalizedName(Materials aMaterial) {
switch (aMaterial) {
case InfusedAir:
case InfusedDull:
case InfusedEarth:
case InfusedEntropy:
case InfusedFire:
case InfusedOrder:
case InfusedVis:
case InfusedWater:
return aMaterial.mDefaultLocalName + " Infused Stone";
case Vermiculite:
case Bentonite:
case Kaolinite:
case Talc:
case BasalticMineralSand:
case GraniticMineralSand:
case GlauconiteSand:
case CassiteriteSand:
case GarnetSand:
case QuartzSand:
case Pitchblende:
case FullersEarth:
return aMaterial.mDefaultLocalName;
default:
return aMaterial.mDefaultLocalName + OrePrefixes.ore.mLocalizedMaterialPost;
}
}
public boolean onBlockEventReceived(World p_149696_1_, int p_149696_2_, int p_149696_3_, int p_149696_4_, int p_149696_5_, int p_149696_6_) {
super.onBlockEventReceived(p_149696_1_, p_149696_2_, p_149696_3_, p_149696_4_, p_149696_5_, p_149696_6_);
TileEntity tileentity = p_149696_1_.getTileEntity(p_149696_2_, p_149696_3_, p_149696_4_);
return tileentity != null ? tileentity.receiveClientEvent(p_149696_5_, p_149696_6_) : false;
}
public boolean canEntityDestroy(IBlockAccess world, int x, int y, int z, Entity entity) {
return (!(entity instanceof EntityDragon)) && (super.canEntityDestroy(world, x, y, z, entity));
}
public String getHarvestTool(int aMeta) {
return aMeta < 8 ? "pickaxe" : "shovel";
}
public int getHarvestLevel(int aMeta) {
return aMeta % 8;
}
public float getBlockHardness(World aWorld, int aX, int aY, int aZ) {
return 1.0F + getHarvestLevel(aWorld.getBlockMetadata(aX, aY, aZ)) * 1.0F;
}
public float getExplosionResistance(Entity par1Entity, World aWorld, int aX, int aY, int aZ, double explosionX, double explosionY, double explosionZ) {
return 1.0F + getHarvestLevel(aWorld.getBlockMetadata(aX, aY, aZ)) * 1.0F;
}
protected boolean canSilkHarvest() {
return false;
}
public abstract String getUnlocalizedName();
public String getLocalizedName() {
return StatCollector.translateToLocal(getUnlocalizedName() + ".name");
}
public int getRenderType() {
if (GT_Renderer_Block.INSTANCE == null) {
return super.getRenderType();
}
return GT_Renderer_Block.INSTANCE.mRenderID;
}
public boolean canBeReplacedByLeaves(IBlockAccess aWorld, int aX, int aY, int aZ) {
return false;
}
public boolean isNormalCube(IBlockAccess aWorld, int aX, int aY, int aZ) {
return true;
}
public boolean hasTileEntity(int aMeta) {
return true;
}
public boolean renderAsNormalBlock() {
return true;
}
public boolean isOpaqueCube() {
return true;
}
public TileEntity createNewTileEntity(World aWorld, int aMeta) {
return createTileEntity(aWorld, aMeta);
}
public IIcon getIcon(IBlockAccess aIBlockAccess, int aX, int aY, int aZ, int aSide) {
return Blocks.stone.getIcon(0, 0);
}
public IIcon getIcon(int aSide, int aMeta) {
return Blocks.stone.getIcon(0, 0);
}
@SideOnly(Side.CLIENT)
public void registerBlockIcons(IIconRegister aIconRegister) {
}
public int getDamageValue(World aWorld, int aX, int aY, int aZ) {
TileEntity tTileEntity = aWorld.getTileEntity(aX, aY, aZ);
if ((tTileEntity != null) && ((tTileEntity instanceof GT_TileEntity_Ores))) {
return ((GT_TileEntity_Ores) tTileEntity).getMetaData();
}
return 0;
}
public void breakBlock(World aWorld, int aX, int aY, int aZ, Block par5, int par6) {
TileEntity tTileEntity = aWorld.getTileEntity(aX, aY, aZ);
if ((tTileEntity instanceof GT_TileEntity_Ores)) {
mTemporaryTileEntity.set((GT_TileEntity_Ores) tTileEntity);
}
super.breakBlock(aWorld, aX, aY, aZ, par5, par6);
aWorld.removeTileEntity(aX, aY, aZ);
}
public ArrayList<ItemStack> getDrops(World aWorld, int aX, int aY, int aZ, int aMeta, int aFortune) {
TileEntity tTileEntity = aWorld.getTileEntity(aX, aY, aZ);
if ((tTileEntity instanceof GT_TileEntity_Ores)) {
return ((GT_TileEntity_Ores) tTileEntity).getDrops(aFortune);
}
return mTemporaryTileEntity.get() == null ? new ArrayList() : mTemporaryTileEntity.get().getDrops(aFortune);
}
public TileEntity createTileEntity(World aWorld, int aMeta) {
return new GT_TileEntity_Ores();
}
@SideOnly(Side.CLIENT)
public abstract void getSubBlocks(Item aItem, CreativeTabs aTab, List aList);
public abstract ITexture[] getStoneTexture(byte aSide, int aMetaData, Materials aMaterial);
}

View file

@ -0,0 +1,121 @@
package gregtech.common.blocks;
import cpw.mods.fml.relauncher.Side;
import cpw.mods.fml.relauncher.SideOnly;
import exterminatorJeff.undergroundBiomes.common.UndergroundBiomes;
import gregtech.api.GregTech_API;
import gregtech.api.enums.Materials;
import gregtech.api.enums.OrePrefixes;
import gregtech.api.interfaces.ITexture;
import gregtech.api.objects.GT_CopiedBlockTexture;
import gregtech.api.objects.GT_RenderedTexture;
import gregtech.api.util.GT_LanguageManager;
import gregtech.api.util.GT_ModHandler;
import gregtech.api.util.GT_OreDictUnificator;
import net.minecraft.block.material.Material;
import net.minecraft.creativetab.CreativeTabs;
import net.minecraft.item.Item;
import net.minecraft.item.ItemStack;
import java.util.List;
public class GT_Block_Ores_UB1 extends GT_Block_Ores_Abstract {
public GT_Block_Ores_UB1() {
super("gt.blockores.ub1", Material.rock);
for (int i = 0; i < 16; i++) {
GT_ModHandler.addValuableOre(this, i, 1);
}
for (int i = 1; i < GregTech_API.sGeneratedMaterials.length; i++) {
if (GregTech_API.sGeneratedMaterials[i] != null) {
GT_LanguageManager.addStringLocalization(getUnlocalizedName() + "." + i + ".name", getLocalizedName(GregTech_API.sGeneratedMaterials[i]));
GT_LanguageManager.addStringLocalization(getUnlocalizedName() + "." + (i + 1000) + ".name", getLocalizedName(GregTech_API.sGeneratedMaterials[i]));
GT_LanguageManager.addStringLocalization(getUnlocalizedName() + "." + (i + 2000) + ".name", getLocalizedName(GregTech_API.sGeneratedMaterials[i]));
GT_LanguageManager.addStringLocalization(getUnlocalizedName() + "." + (i + 3000) + ".name", getLocalizedName(GregTech_API.sGeneratedMaterials[i]));
GT_LanguageManager.addStringLocalization(getUnlocalizedName() + "." + (i + 4000) + ".name", getLocalizedName(GregTech_API.sGeneratedMaterials[i]));
GT_LanguageManager.addStringLocalization(getUnlocalizedName() + "." + (i + 5000) + ".name", getLocalizedName(GregTech_API.sGeneratedMaterials[i]));
GT_LanguageManager.addStringLocalization(getUnlocalizedName() + "." + (i + 6000) + ".name", getLocalizedName(GregTech_API.sGeneratedMaterials[i]));
GT_LanguageManager.addStringLocalization(getUnlocalizedName() + "." + (i + 7000) + ".name", getLocalizedName(GregTech_API.sGeneratedMaterials[i]));
GT_LanguageManager.addStringLocalization(getUnlocalizedName() + "." + (i + 8000) + ".name", "Small " + getLocalizedName(GregTech_API.sGeneratedMaterials[i]));
GT_LanguageManager.addStringLocalization(getUnlocalizedName() + "." + (i + 9000) + ".name", "Small " + getLocalizedName(GregTech_API.sGeneratedMaterials[i]));
GT_LanguageManager.addStringLocalization(getUnlocalizedName() + "." + (i + 10000) + ".name", "Small " + getLocalizedName(GregTech_API.sGeneratedMaterials[i]));
GT_LanguageManager.addStringLocalization(getUnlocalizedName() + "." + (i + 11000) + ".name", "Small " + getLocalizedName(GregTech_API.sGeneratedMaterials[i]));
GT_LanguageManager.addStringLocalization(getUnlocalizedName() + "." + (i + 12000) + ".name", "Small " + getLocalizedName(GregTech_API.sGeneratedMaterials[i]));
GT_LanguageManager.addStringLocalization(getUnlocalizedName() + "." + (i + 13000) + ".name", "Small " + getLocalizedName(GregTech_API.sGeneratedMaterials[i]));
GT_LanguageManager.addStringLocalization(getUnlocalizedName() + "." + (i + 14000) + ".name", "Small " + getLocalizedName(GregTech_API.sGeneratedMaterials[i]));
GT_LanguageManager.addStringLocalization(getUnlocalizedName() + "." + (i + 15000) + ".name", "Small " + getLocalizedName(GregTech_API.sGeneratedMaterials[i]));
if ((GregTech_API.sGeneratedMaterials[i].mTypes & 0x8) != 0) {
GT_OreDictUnificator.registerOre("ore", new ItemStack(this, 1, i));
GT_OreDictUnificator.registerOre("ore", new ItemStack(this, 1, i + 1000));
GT_OreDictUnificator.registerOre("ore", new ItemStack(this, 1, i + 2000));
GT_OreDictUnificator.registerOre("ore", new ItemStack(this, 1, i + 3000));
GT_OreDictUnificator.registerOre("ore", new ItemStack(this, 1, i + 4000));
GT_OreDictUnificator.registerOre("ore", new ItemStack(this, 1, i + 5000));
GT_OreDictUnificator.registerOre("ore", new ItemStack(this, 1, i + 6000));
GT_OreDictUnificator.registerOre("ore", new ItemStack(this, 1, i + 7000));
GT_OreDictUnificator.registerOre("ore", new ItemStack(this, 1, i + 8000));
GT_OreDictUnificator.registerOre("ore", new ItemStack(this, 1, i + 9000));
GT_OreDictUnificator.registerOre("ore", new ItemStack(this, 1, i + 10000));
GT_OreDictUnificator.registerOre("ore", new ItemStack(this, 1, i + 11000));
GT_OreDictUnificator.registerOre("ore", new ItemStack(this, 1, i + 12000));
GT_OreDictUnificator.registerOre("ore", new ItemStack(this, 1, i + 13000));
GT_OreDictUnificator.registerOre("ore", new ItemStack(this, 1, i + 14000));
GT_OreDictUnificator.registerOre("ore", new ItemStack(this, 1, i + 15000));
if (tHideOres) {
codechicken.nei.api.API.hideItem(new ItemStack(this, 1, i));
codechicken.nei.api.API.hideItem(new ItemStack(this, 1, i + 1000));
codechicken.nei.api.API.hideItem(new ItemStack(this, 1, i + 2000));
codechicken.nei.api.API.hideItem(new ItemStack(this, 1, i + 3000));
codechicken.nei.api.API.hideItem(new ItemStack(this, 1, i + 4000));
codechicken.nei.api.API.hideItem(new ItemStack(this, 1, i + 5000));
codechicken.nei.api.API.hideItem(new ItemStack(this, 1, i + 6000));
codechicken.nei.api.API.hideItem(new ItemStack(this, 1, i + 7000));
codechicken.nei.api.API.hideItem(new ItemStack(this, 1, i + 8000));
codechicken.nei.api.API.hideItem(new ItemStack(this, 1, i + 9000));
codechicken.nei.api.API.hideItem(new ItemStack(this, 1, i + 10000));
codechicken.nei.api.API.hideItem(new ItemStack(this, 1, i + 11000));
codechicken.nei.api.API.hideItem(new ItemStack(this, 1, i + 12000));
codechicken.nei.api.API.hideItem(new ItemStack(this, 1, i + 13000));
codechicken.nei.api.API.hideItem(new ItemStack(this, 1, i + 14000));
codechicken.nei.api.API.hideItem(new ItemStack(this, 1, i + 15000));
}
}
}
}
}
@Override
public String getUnlocalizedName() {
return "gt.blockores.ub1";
}
@Override
public ITexture[] getStoneTexture(byte aSide, int aMetaData, Materials aMaterial) {
ITexture[] mStoneTextures = {new GT_CopiedBlockTexture(UndergroundBiomes.igneousStone, 0, 0), new GT_CopiedBlockTexture(UndergroundBiomes.igneousStone, 0, 1), new GT_CopiedBlockTexture(UndergroundBiomes.igneousStone, 0, 2), new GT_CopiedBlockTexture(UndergroundBiomes.igneousStone, 0, 3), new GT_CopiedBlockTexture(UndergroundBiomes.igneousStone, 0, 4), new GT_CopiedBlockTexture(UndergroundBiomes.igneousStone, 0, 5), new GT_CopiedBlockTexture(UndergroundBiomes.igneousStone, 0, 6), new GT_CopiedBlockTexture(UndergroundBiomes.igneousStone, 0, 7), new GT_CopiedBlockTexture(UndergroundBiomes.igneousStone, 0, 0), new GT_CopiedBlockTexture(UndergroundBiomes.igneousStone, 0, 1), new GT_CopiedBlockTexture(UndergroundBiomes.igneousStone, 0, 2), new GT_CopiedBlockTexture(UndergroundBiomes.igneousStone, 0, 3), new GT_CopiedBlockTexture(UndergroundBiomes.igneousStone, 0, 4), new GT_CopiedBlockTexture(UndergroundBiomes.igneousStone, 0, 5), new GT_CopiedBlockTexture(UndergroundBiomes.igneousStone, 0, 6), new GT_CopiedBlockTexture(UndergroundBiomes.igneousStone, 0, 7)};
return new ITexture[]{mStoneTextures[(aMetaData / 1000 % 16)], new GT_RenderedTexture(aMaterial.mIconSet.mTextures[aMetaData < 8000 ? OrePrefixes.ore.mTextureIndex : OrePrefixes.oreSmall.mTextureIndex], aMaterial.mRGBa)};
}
@SideOnly(Side.CLIENT)
public void getSubBlocks(Item aItem, CreativeTabs aTab, List aList) {
for (int i = 0; i < GregTech_API.sGeneratedMaterials.length; i++) {
Materials tMaterial = GregTech_API.sGeneratedMaterials[i];
if ((tMaterial != null) && ((tMaterial.mTypes & 0x8) != 0)) {
aList.add(new ItemStack(aItem, 1, i));
aList.add(new ItemStack(aItem, 1, i + 1000));
aList.add(new ItemStack(aItem, 1, i + 2000));
aList.add(new ItemStack(aItem, 1, i + 3000));
aList.add(new ItemStack(aItem, 1, i + 4000));
aList.add(new ItemStack(aItem, 1, i + 5000));
aList.add(new ItemStack(aItem, 1, i + 6000));
aList.add(new ItemStack(aItem, 1, i + 7000));
aList.add(new ItemStack(aItem, 1, i + 8000));
aList.add(new ItemStack(aItem, 1, i + 9000));
aList.add(new ItemStack(aItem, 1, i + 10000));
aList.add(new ItemStack(aItem, 1, i + 11000));
aList.add(new ItemStack(aItem, 1, i + 12000));
aList.add(new ItemStack(aItem, 1, i + 13000));
aList.add(new ItemStack(aItem, 1, i + 14000));
aList.add(new ItemStack(aItem, 1, i + 15000));
}
}
}
}

View file

@ -0,0 +1,121 @@
package gregtech.common.blocks;
import cpw.mods.fml.relauncher.Side;
import cpw.mods.fml.relauncher.SideOnly;
import exterminatorJeff.undergroundBiomes.common.UndergroundBiomes;
import gregtech.api.GregTech_API;
import gregtech.api.enums.Materials;
import gregtech.api.enums.OrePrefixes;
import gregtech.api.interfaces.ITexture;
import gregtech.api.objects.GT_CopiedBlockTexture;
import gregtech.api.objects.GT_RenderedTexture;
import gregtech.api.util.GT_LanguageManager;
import gregtech.api.util.GT_ModHandler;
import gregtech.api.util.GT_OreDictUnificator;
import net.minecraft.block.material.Material;
import net.minecraft.creativetab.CreativeTabs;
import net.minecraft.item.Item;
import net.minecraft.item.ItemStack;
import java.util.List;
public class GT_Block_Ores_UB2 extends GT_Block_Ores_Abstract {
public GT_Block_Ores_UB2() {
super("gt.blockores.ub2", Material.rock);
for (int i = 0; i < 16; i++) {
GT_ModHandler.addValuableOre(this, i, 1);
}
for (int i = 1; i < GregTech_API.sGeneratedMaterials.length; i++) {
if (GregTech_API.sGeneratedMaterials[i] != null) {
GT_LanguageManager.addStringLocalization(getUnlocalizedName() + "." + i + ".name", getLocalizedName(GregTech_API.sGeneratedMaterials[i]));
GT_LanguageManager.addStringLocalization(getUnlocalizedName() + "." + (i + 1000) + ".name", getLocalizedName(GregTech_API.sGeneratedMaterials[i]));
GT_LanguageManager.addStringLocalization(getUnlocalizedName() + "." + (i + 2000) + ".name", getLocalizedName(GregTech_API.sGeneratedMaterials[i]));
GT_LanguageManager.addStringLocalization(getUnlocalizedName() + "." + (i + 3000) + ".name", getLocalizedName(GregTech_API.sGeneratedMaterials[i]));
GT_LanguageManager.addStringLocalization(getUnlocalizedName() + "." + (i + 4000) + ".name", getLocalizedName(GregTech_API.sGeneratedMaterials[i]));
GT_LanguageManager.addStringLocalization(getUnlocalizedName() + "." + (i + 5000) + ".name", getLocalizedName(GregTech_API.sGeneratedMaterials[i]));
GT_LanguageManager.addStringLocalization(getUnlocalizedName() + "." + (i + 6000) + ".name", getLocalizedName(GregTech_API.sGeneratedMaterials[i]));
GT_LanguageManager.addStringLocalization(getUnlocalizedName() + "." + (i + 7000) + ".name", getLocalizedName(GregTech_API.sGeneratedMaterials[i]));
GT_LanguageManager.addStringLocalization(getUnlocalizedName() + "." + (i + 8000) + ".name", "Small " + getLocalizedName(GregTech_API.sGeneratedMaterials[i]));
GT_LanguageManager.addStringLocalization(getUnlocalizedName() + "." + (i + 9000) + ".name", "Small " + getLocalizedName(GregTech_API.sGeneratedMaterials[i]));
GT_LanguageManager.addStringLocalization(getUnlocalizedName() + "." + (i + 10000) + ".name", "Small " + getLocalizedName(GregTech_API.sGeneratedMaterials[i]));
GT_LanguageManager.addStringLocalization(getUnlocalizedName() + "." + (i + 11000) + ".name", "Small " + getLocalizedName(GregTech_API.sGeneratedMaterials[i]));
GT_LanguageManager.addStringLocalization(getUnlocalizedName() + "." + (i + 12000) + ".name", "Small " + getLocalizedName(GregTech_API.sGeneratedMaterials[i]));
GT_LanguageManager.addStringLocalization(getUnlocalizedName() + "." + (i + 13000) + ".name", "Small " + getLocalizedName(GregTech_API.sGeneratedMaterials[i]));
GT_LanguageManager.addStringLocalization(getUnlocalizedName() + "." + (i + 14000) + ".name", "Small " + getLocalizedName(GregTech_API.sGeneratedMaterials[i]));
GT_LanguageManager.addStringLocalization(getUnlocalizedName() + "." + (i + 15000) + ".name", "Small " + getLocalizedName(GregTech_API.sGeneratedMaterials[i]));
if ((GregTech_API.sGeneratedMaterials[i].mTypes & 0x8) != 0) {
GT_OreDictUnificator.registerOre("ore", new ItemStack(this, 1, i));
GT_OreDictUnificator.registerOre("ore", new ItemStack(this, 1, i + 1000));
GT_OreDictUnificator.registerOre("ore", new ItemStack(this, 1, i + 2000));
GT_OreDictUnificator.registerOre("ore", new ItemStack(this, 1, i + 3000));
GT_OreDictUnificator.registerOre("ore", new ItemStack(this, 1, i + 4000));
GT_OreDictUnificator.registerOre("ore", new ItemStack(this, 1, i + 5000));
GT_OreDictUnificator.registerOre("ore", new ItemStack(this, 1, i + 6000));
GT_OreDictUnificator.registerOre("ore", new ItemStack(this, 1, i + 7000));
GT_OreDictUnificator.registerOre("ore", new ItemStack(this, 1, i + 8000));
GT_OreDictUnificator.registerOre("ore", new ItemStack(this, 1, i + 9000));
GT_OreDictUnificator.registerOre("ore", new ItemStack(this, 1, i + 10000));
GT_OreDictUnificator.registerOre("ore", new ItemStack(this, 1, i + 11000));
GT_OreDictUnificator.registerOre("ore", new ItemStack(this, 1, i + 12000));
GT_OreDictUnificator.registerOre("ore", new ItemStack(this, 1, i + 13000));
GT_OreDictUnificator.registerOre("ore", new ItemStack(this, 1, i + 14000));
GT_OreDictUnificator.registerOre("ore", new ItemStack(this, 1, i + 15000));
if (tHideOres) {
codechicken.nei.api.API.hideItem(new ItemStack(this, 1, i));
codechicken.nei.api.API.hideItem(new ItemStack(this, 1, i + 1000));
codechicken.nei.api.API.hideItem(new ItemStack(this, 1, i + 2000));
codechicken.nei.api.API.hideItem(new ItemStack(this, 1, i + 3000));
codechicken.nei.api.API.hideItem(new ItemStack(this, 1, i + 4000));
codechicken.nei.api.API.hideItem(new ItemStack(this, 1, i + 5000));
codechicken.nei.api.API.hideItem(new ItemStack(this, 1, i + 6000));
codechicken.nei.api.API.hideItem(new ItemStack(this, 1, i + 7000));
codechicken.nei.api.API.hideItem(new ItemStack(this, 1, i + 8000));
codechicken.nei.api.API.hideItem(new ItemStack(this, 1, i + 9000));
codechicken.nei.api.API.hideItem(new ItemStack(this, 1, i + 10000));
codechicken.nei.api.API.hideItem(new ItemStack(this, 1, i + 11000));
codechicken.nei.api.API.hideItem(new ItemStack(this, 1, i + 12000));
codechicken.nei.api.API.hideItem(new ItemStack(this, 1, i + 13000));
codechicken.nei.api.API.hideItem(new ItemStack(this, 1, i + 14000));
codechicken.nei.api.API.hideItem(new ItemStack(this, 1, i + 15000));
}
}
}
}
}
@Override
public String getUnlocalizedName() {
return "gt.blockores.ub2";
}
@Override
public ITexture[] getStoneTexture(byte aSide, int aMetaData, Materials aMaterial) {
ITexture[] mStoneTextures = {new GT_CopiedBlockTexture(UndergroundBiomes.metamorphicStone, 0, 0), new GT_CopiedBlockTexture(UndergroundBiomes.metamorphicStone, 0, 1), new GT_CopiedBlockTexture(UndergroundBiomes.metamorphicStone, 0, 2), new GT_CopiedBlockTexture(UndergroundBiomes.metamorphicStone, 0, 3), new GT_CopiedBlockTexture(UndergroundBiomes.metamorphicStone, 0, 4), new GT_CopiedBlockTexture(UndergroundBiomes.metamorphicStone, 0, 5), new GT_CopiedBlockTexture(UndergroundBiomes.metamorphicStone, 0, 6), new GT_CopiedBlockTexture(UndergroundBiomes.metamorphicStone, 0, 7), new GT_CopiedBlockTexture(UndergroundBiomes.metamorphicStone, 0, 0), new GT_CopiedBlockTexture(UndergroundBiomes.metamorphicStone, 0, 1), new GT_CopiedBlockTexture(UndergroundBiomes.metamorphicStone, 0, 2), new GT_CopiedBlockTexture(UndergroundBiomes.metamorphicStone, 0, 3), new GT_CopiedBlockTexture(UndergroundBiomes.metamorphicStone, 0, 4), new GT_CopiedBlockTexture(UndergroundBiomes.metamorphicStone, 0, 5), new GT_CopiedBlockTexture(UndergroundBiomes.metamorphicStone, 0, 6), new GT_CopiedBlockTexture(UndergroundBiomes.metamorphicStone, 0, 7)};
return new ITexture[]{mStoneTextures[(aMetaData / 1000 % 16)], new GT_RenderedTexture(aMaterial.mIconSet.mTextures[aMetaData < 8000 ? OrePrefixes.ore.mTextureIndex : OrePrefixes.oreSmall.mTextureIndex], aMaterial.mRGBa)};
}
@SideOnly(Side.CLIENT)
public void getSubBlocks(Item aItem, CreativeTabs aTab, List aList) {
for (int i = 0; i < GregTech_API.sGeneratedMaterials.length; i++) {
Materials tMaterial = GregTech_API.sGeneratedMaterials[i];
if ((tMaterial != null) && ((tMaterial.mTypes & 0x8) != 0)) {
aList.add(new ItemStack(aItem, 1, i));
aList.add(new ItemStack(aItem, 1, i + 1000));
aList.add(new ItemStack(aItem, 1, i + 2000));
aList.add(new ItemStack(aItem, 1, i + 3000));
aList.add(new ItemStack(aItem, 1, i + 4000));
aList.add(new ItemStack(aItem, 1, i + 5000));
aList.add(new ItemStack(aItem, 1, i + 6000));
aList.add(new ItemStack(aItem, 1, i + 7000));
aList.add(new ItemStack(aItem, 1, i + 8000));
aList.add(new ItemStack(aItem, 1, i + 9000));
aList.add(new ItemStack(aItem, 1, i + 10000));
aList.add(new ItemStack(aItem, 1, i + 11000));
aList.add(new ItemStack(aItem, 1, i + 12000));
aList.add(new ItemStack(aItem, 1, i + 13000));
aList.add(new ItemStack(aItem, 1, i + 14000));
aList.add(new ItemStack(aItem, 1, i + 15000));
}
}
}
}

View file

@ -0,0 +1,121 @@
package gregtech.common.blocks;
import cpw.mods.fml.relauncher.Side;
import cpw.mods.fml.relauncher.SideOnly;
import exterminatorJeff.undergroundBiomes.common.UndergroundBiomes;
import gregtech.api.GregTech_API;
import gregtech.api.enums.Materials;
import gregtech.api.enums.OrePrefixes;
import gregtech.api.interfaces.ITexture;
import gregtech.api.objects.GT_CopiedBlockTexture;
import gregtech.api.objects.GT_RenderedTexture;
import gregtech.api.util.GT_LanguageManager;
import gregtech.api.util.GT_ModHandler;
import gregtech.api.util.GT_OreDictUnificator;
import net.minecraft.block.material.Material;
import net.minecraft.creativetab.CreativeTabs;
import net.minecraft.item.Item;
import net.minecraft.item.ItemStack;
import java.util.List;
public class GT_Block_Ores_UB3 extends GT_Block_Ores_Abstract {
public GT_Block_Ores_UB3() {
super("gt.blockores.ub3", Material.rock);
for (int i = 0; i < 16; i++) {
GT_ModHandler.addValuableOre(this, i, 1);
}
for (int i = 1; i < GregTech_API.sGeneratedMaterials.length; i++) {
if (GregTech_API.sGeneratedMaterials[i] != null) {
GT_LanguageManager.addStringLocalization(getUnlocalizedName() + "." + i + ".name", getLocalizedName(GregTech_API.sGeneratedMaterials[i]));
GT_LanguageManager.addStringLocalization(getUnlocalizedName() + "." + (i + 1000) + ".name", getLocalizedName(GregTech_API.sGeneratedMaterials[i]));
GT_LanguageManager.addStringLocalization(getUnlocalizedName() + "." + (i + 2000) + ".name", getLocalizedName(GregTech_API.sGeneratedMaterials[i]));
GT_LanguageManager.addStringLocalization(getUnlocalizedName() + "." + (i + 3000) + ".name", getLocalizedName(GregTech_API.sGeneratedMaterials[i]));
GT_LanguageManager.addStringLocalization(getUnlocalizedName() + "." + (i + 4000) + ".name", getLocalizedName(GregTech_API.sGeneratedMaterials[i]));
GT_LanguageManager.addStringLocalization(getUnlocalizedName() + "." + (i + 5000) + ".name", getLocalizedName(GregTech_API.sGeneratedMaterials[i]));
GT_LanguageManager.addStringLocalization(getUnlocalizedName() + "." + (i + 6000) + ".name", getLocalizedName(GregTech_API.sGeneratedMaterials[i]));
GT_LanguageManager.addStringLocalization(getUnlocalizedName() + "." + (i + 7000) + ".name", getLocalizedName(GregTech_API.sGeneratedMaterials[i]));
GT_LanguageManager.addStringLocalization(getUnlocalizedName() + "." + (i + 8000) + ".name", "Small " + getLocalizedName(GregTech_API.sGeneratedMaterials[i]));
GT_LanguageManager.addStringLocalization(getUnlocalizedName() + "." + (i + 9000) + ".name", "Small " + getLocalizedName(GregTech_API.sGeneratedMaterials[i]));
GT_LanguageManager.addStringLocalization(getUnlocalizedName() + "." + (i + 10000) + ".name", "Small " + getLocalizedName(GregTech_API.sGeneratedMaterials[i]));
GT_LanguageManager.addStringLocalization(getUnlocalizedName() + "." + (i + 11000) + ".name", "Small " + getLocalizedName(GregTech_API.sGeneratedMaterials[i]));
GT_LanguageManager.addStringLocalization(getUnlocalizedName() + "." + (i + 12000) + ".name", "Small " + getLocalizedName(GregTech_API.sGeneratedMaterials[i]));
GT_LanguageManager.addStringLocalization(getUnlocalizedName() + "." + (i + 13000) + ".name", "Small " + getLocalizedName(GregTech_API.sGeneratedMaterials[i]));
GT_LanguageManager.addStringLocalization(getUnlocalizedName() + "." + (i + 14000) + ".name", "Small " + getLocalizedName(GregTech_API.sGeneratedMaterials[i]));
GT_LanguageManager.addStringLocalization(getUnlocalizedName() + "." + (i + 15000) + ".name", "Small " + getLocalizedName(GregTech_API.sGeneratedMaterials[i]));
if ((GregTech_API.sGeneratedMaterials[i].mTypes & 0x8) != 0) {
GT_OreDictUnificator.registerOre("ore", new ItemStack(this, 1, i));
GT_OreDictUnificator.registerOre("ore", new ItemStack(this, 1, i + 1000));
GT_OreDictUnificator.registerOre("ore", new ItemStack(this, 1, i + 2000));
GT_OreDictUnificator.registerOre("ore", new ItemStack(this, 1, i + 3000));
GT_OreDictUnificator.registerOre("ore", new ItemStack(this, 1, i + 4000));
GT_OreDictUnificator.registerOre("ore", new ItemStack(this, 1, i + 5000));
GT_OreDictUnificator.registerOre("ore", new ItemStack(this, 1, i + 6000));
GT_OreDictUnificator.registerOre("ore", new ItemStack(this, 1, i + 7000));
GT_OreDictUnificator.registerOre("ore", new ItemStack(this, 1, i + 8000));
GT_OreDictUnificator.registerOre("ore", new ItemStack(this, 1, i + 9000));
GT_OreDictUnificator.registerOre("ore", new ItemStack(this, 1, i + 10000));
GT_OreDictUnificator.registerOre("ore", new ItemStack(this, 1, i + 11000));
GT_OreDictUnificator.registerOre("ore", new ItemStack(this, 1, i + 12000));
GT_OreDictUnificator.registerOre("ore", new ItemStack(this, 1, i + 13000));
GT_OreDictUnificator.registerOre("ore", new ItemStack(this, 1, i + 14000));
GT_OreDictUnificator.registerOre("ore", new ItemStack(this, 1, i + 15000));
if (tHideOres) {
codechicken.nei.api.API.hideItem(new ItemStack(this, 1, i));
codechicken.nei.api.API.hideItem(new ItemStack(this, 1, i + 1000));
codechicken.nei.api.API.hideItem(new ItemStack(this, 1, i + 2000));
codechicken.nei.api.API.hideItem(new ItemStack(this, 1, i + 3000));
codechicken.nei.api.API.hideItem(new ItemStack(this, 1, i + 4000));
codechicken.nei.api.API.hideItem(new ItemStack(this, 1, i + 5000));
codechicken.nei.api.API.hideItem(new ItemStack(this, 1, i + 6000));
codechicken.nei.api.API.hideItem(new ItemStack(this, 1, i + 7000));
codechicken.nei.api.API.hideItem(new ItemStack(this, 1, i + 8000));
codechicken.nei.api.API.hideItem(new ItemStack(this, 1, i + 9000));
codechicken.nei.api.API.hideItem(new ItemStack(this, 1, i + 10000));
codechicken.nei.api.API.hideItem(new ItemStack(this, 1, i + 11000));
codechicken.nei.api.API.hideItem(new ItemStack(this, 1, i + 12000));
codechicken.nei.api.API.hideItem(new ItemStack(this, 1, i + 13000));
codechicken.nei.api.API.hideItem(new ItemStack(this, 1, i + 14000));
codechicken.nei.api.API.hideItem(new ItemStack(this, 1, i + 15000));
}
}
}
}
}
@Override
public String getUnlocalizedName() {
return "gt.blockores.ub3";
}
@Override
public ITexture[] getStoneTexture(byte aSide, int aMetaData, Materials aMaterial) {
ITexture[] mStoneTextures = {new GT_CopiedBlockTexture(UndergroundBiomes.sedimentaryStone, 0, 0), new GT_CopiedBlockTexture(UndergroundBiomes.sedimentaryStone, 0, 1), new GT_CopiedBlockTexture(UndergroundBiomes.sedimentaryStone, 0, 2), new GT_CopiedBlockTexture(UndergroundBiomes.sedimentaryStone, 0, 3), new GT_CopiedBlockTexture(UndergroundBiomes.sedimentaryStone, 0, 4), new GT_CopiedBlockTexture(UndergroundBiomes.sedimentaryStone, 0, 5), new GT_CopiedBlockTexture(UndergroundBiomes.sedimentaryStone, 0, 6), new GT_CopiedBlockTexture(UndergroundBiomes.sedimentaryStone, 0, 7), new GT_CopiedBlockTexture(UndergroundBiomes.sedimentaryStone, 0, 0), new GT_CopiedBlockTexture(UndergroundBiomes.sedimentaryStone, 0, 1), new GT_CopiedBlockTexture(UndergroundBiomes.sedimentaryStone, 0, 2), new GT_CopiedBlockTexture(UndergroundBiomes.sedimentaryStone, 0, 3), new GT_CopiedBlockTexture(UndergroundBiomes.sedimentaryStone, 0, 4), new GT_CopiedBlockTexture(UndergroundBiomes.sedimentaryStone, 0, 5), new GT_CopiedBlockTexture(UndergroundBiomes.sedimentaryStone, 0, 6), new GT_CopiedBlockTexture(UndergroundBiomes.sedimentaryStone, 0, 7)};
return new ITexture[]{mStoneTextures[(aMetaData / 1000 % 16)], new GT_RenderedTexture(aMaterial.mIconSet.mTextures[aMetaData < 8000 ? OrePrefixes.ore.mTextureIndex : OrePrefixes.oreSmall.mTextureIndex], aMaterial.mRGBa)};
}
@SideOnly(Side.CLIENT)
public void getSubBlocks(Item aItem, CreativeTabs aTab, List aList) {
for (int i = 0; i < GregTech_API.sGeneratedMaterials.length; i++) {
Materials tMaterial = GregTech_API.sGeneratedMaterials[i];
if ((tMaterial != null) && ((tMaterial.mTypes & 0x8) != 0)) {
aList.add(new ItemStack(aItem, 1, i));
aList.add(new ItemStack(aItem, 1, i + 1000));
aList.add(new ItemStack(aItem, 1, i + 2000));
aList.add(new ItemStack(aItem, 1, i + 3000));
aList.add(new ItemStack(aItem, 1, i + 4000));
aList.add(new ItemStack(aItem, 1, i + 5000));
aList.add(new ItemStack(aItem, 1, i + 6000));
aList.add(new ItemStack(aItem, 1, i + 7000));
aList.add(new ItemStack(aItem, 1, i + 8000));
aList.add(new ItemStack(aItem, 1, i + 9000));
aList.add(new ItemStack(aItem, 1, i + 10000));
aList.add(new ItemStack(aItem, 1, i + 11000));
aList.add(new ItemStack(aItem, 1, i + 12000));
aList.add(new ItemStack(aItem, 1, i + 13000));
aList.add(new ItemStack(aItem, 1, i + 14000));
aList.add(new ItemStack(aItem, 1, i + 15000));
}
}
}
}

View file

@ -25,65 +25,79 @@ import net.minecraft.world.World;
import java.util.ArrayList;
import java.util.Random;
public class GT_TileEntity_Ores
extends TileEntity
implements ITexturedTileEntity {
//private static final ITexture[] mStoneTextures = {new GT_CopiedBlockTexture(Blocks.stone, 0, 0), new GT_CopiedBlockTexture(Blocks.netherrack, 0, 0), new GT_CopiedBlockTexture(Blocks.end_stone, 0, 0), new GT_RenderedTexture(Textures.BlockIcons.GRANITE_BLACK_STONE), new GT_RenderedTexture(Textures.BlockIcons.GRANITE_RED_STONE), new GT_CopiedBlockTexture(Blocks.stone, 0, 0), new GT_CopiedBlockTexture(Blocks.stone, 0, 0), new GT_CopiedBlockTexture(Blocks.stone, 0, 0), new GT_CopiedBlockTexture(Blocks.stone, 0, 0), new GT_CopiedBlockTexture(Blocks.stone, 0, 0), new GT_CopiedBlockTexture(Blocks.stone, 0, 0), new GT_CopiedBlockTexture(Blocks.stone, 0, 0), new GT_CopiedBlockTexture(Blocks.stone, 0, 0), new GT_CopiedBlockTexture(Blocks.stone, 0, 0), new GT_CopiedBlockTexture(Blocks.stone, 0, 0), new GT_CopiedBlockTexture(Blocks.stone, 0, 0), new GT_CopiedBlockTexture(Blocks.stone, 0, 0), new GT_CopiedBlockTexture(Blocks.stone, 0, 0), new GT_CopiedBlockTexture(Blocks.stone, 0, 0), new GT_CopiedBlockTexture(Blocks.stone, 0, 0), new GT_CopiedBlockTexture(UndergroundBiomes.igneousStone, 0, 0), new GT_CopiedBlockTexture(UndergroundBiomes.igneousStone, 0, 1), new GT_CopiedBlockTexture(UndergroundBiomes.igneousStone, 0, 2), new GT_CopiedBlockTexture(UndergroundBiomes.igneousStone, 0, 3), new GT_CopiedBlockTexture(UndergroundBiomes.igneousStone, 0, 4), new GT_CopiedBlockTexture(UndergroundBiomes.igneousStone, 0, 5), new GT_CopiedBlockTexture(UndergroundBiomes.igneousStone, 0, 6), new GT_CopiedBlockTexture(UndergroundBiomes.igneousStone, 0, 7), new GT_CopiedBlockTexture(UndergroundBiomes.igneousStone, 0, 8), new GT_CopiedBlockTexture(Blocks.stone, 0, 0), new GT_CopiedBlockTexture(Blocks.stone, 0, 8)};
private static final ITexture[] mStoneTextures = {new GT_RenderedTexture(Textures.BlockIcons.GRANITE_RED_STONE), new GT_CopiedBlockTexture(Blocks.netherrack, 0, 0), new GT_CopiedBlockTexture(Blocks.end_stone, 0, 0), new GT_RenderedTexture(Textures.BlockIcons.GRANITE_BLACK_STONE), new GT_RenderedTexture(Textures.BlockIcons.GRANITE_RED_STONE), new GT_RenderedTexture(Textures.BlockIcons.GRANITE_RED_STONE), new GT_RenderedTexture(Textures.BlockIcons.GRANITE_RED_STONE), new GT_RenderedTexture(Textures.BlockIcons.GRANITE_RED_STONE), new GT_RenderedTexture(Textures.BlockIcons.GRANITE_RED_STONE), new GT_RenderedTexture(Textures.BlockIcons.GRANITE_RED_STONE), new GT_RenderedTexture(Textures.BlockIcons.GRANITE_RED_STONE), new GT_RenderedTexture(Textures.BlockIcons.GRANITE_RED_STONE), new GT_RenderedTexture(Textures.BlockIcons.GRANITE_RED_STONE), new GT_RenderedTexture(Textures.BlockIcons.GRANITE_RED_STONE), new GT_RenderedTexture(Textures.BlockIcons.GRANITE_RED_STONE), new GT_RenderedTexture(Textures.BlockIcons.GRANITE_RED_STONE), new GT_RenderedTexture(Textures.BlockIcons.GRANITE_RED_STONE), new GT_RenderedTexture(Textures.BlockIcons.GRANITE_RED_STONE), new GT_RenderedTexture(Textures.BlockIcons.GRANITE_RED_STONE), new GT_RenderedTexture(Textures.BlockIcons.GRANITE_RED_STONE), new GT_CopiedBlockTexture(Blocks.stone, 0, 0), new GT_CopiedBlockTexture(UndergroundBiomes.igneousStone, 0, 0), new GT_CopiedBlockTexture(UndergroundBiomes.igneousStone, 0, 1), new GT_CopiedBlockTexture(UndergroundBiomes.igneousStone, 0, 2), new GT_CopiedBlockTexture(UndergroundBiomes.igneousStone, 0, 3), new GT_CopiedBlockTexture(UndergroundBiomes.igneousStone, 0, 4), new GT_CopiedBlockTexture(UndergroundBiomes.igneousStone, 0, 5), new GT_CopiedBlockTexture(UndergroundBiomes.igneousStone, 0, 6), new GT_CopiedBlockTexture(UndergroundBiomes.igneousStone, 0, 7), new GT_CopiedBlockTexture(UndergroundBiomes.igneousStone, 0, 8), new GT_CopiedBlockTexture(Blocks.stone, 0, 0)};
public class GT_TileEntity_Ores extends TileEntity implements ITexturedTileEntity {
public static final ITexture[] mStoneTextures = {new GT_CopiedBlockTexture(Blocks.stone, 0, 0), new GT_CopiedBlockTexture(Blocks.netherrack, 0, 0), new GT_CopiedBlockTexture(Blocks.end_stone, 0, 0), new GT_RenderedTexture(Textures.BlockIcons.GRANITE_BLACK_STONE), new GT_RenderedTexture(Textures.BlockIcons.GRANITE_RED_STONE), new GT_CopiedBlockTexture(Blocks.stone, 0, 0), new GT_CopiedBlockTexture(Blocks.stone, 0, 0), new GT_CopiedBlockTexture(Blocks.stone, 0, 0), new GT_CopiedBlockTexture(Blocks.stone, 0, 0), new GT_CopiedBlockTexture(Blocks.stone, 0, 0), new GT_CopiedBlockTexture(Blocks.stone, 0, 0), new GT_CopiedBlockTexture(Blocks.stone, 0, 0), new GT_CopiedBlockTexture(Blocks.stone, 0, 0), new GT_CopiedBlockTexture(Blocks.stone, 0, 0), new GT_CopiedBlockTexture(Blocks.stone, 0, 0), new GT_CopiedBlockTexture(Blocks.stone, 0, 0)};
public static final ITexture[] mStoneTexturesUb1 = {new GT_CopiedBlockTexture(UndergroundBiomes.igneousStone, 0, 0), new GT_CopiedBlockTexture(UndergroundBiomes.igneousStone, 0, 1), new GT_CopiedBlockTexture(UndergroundBiomes.igneousStone, 0, 2), new GT_CopiedBlockTexture(UndergroundBiomes.igneousStone, 0, 3), new GT_CopiedBlockTexture(UndergroundBiomes.igneousStone, 0, 4), new GT_CopiedBlockTexture(UndergroundBiomes.igneousStone, 0, 5), new GT_CopiedBlockTexture(UndergroundBiomes.igneousStone, 0, 6), new GT_CopiedBlockTexture(UndergroundBiomes.igneousStone, 0, 7), new GT_CopiedBlockTexture(UndergroundBiomes.igneousStone, 0, 0), new GT_CopiedBlockTexture(UndergroundBiomes.igneousStone, 0, 1), new GT_CopiedBlockTexture(UndergroundBiomes.igneousStone, 0, 2), new GT_CopiedBlockTexture(UndergroundBiomes.igneousStone, 0, 3), new GT_CopiedBlockTexture(UndergroundBiomes.igneousStone, 0, 4), new GT_CopiedBlockTexture(UndergroundBiomes.igneousStone, 0, 5), new GT_CopiedBlockTexture(UndergroundBiomes.igneousStone, 0, 6), new GT_CopiedBlockTexture(UndergroundBiomes.igneousStone, 0, 7)};
public static final ITexture[] mStoneTexturesUb2 = {new GT_CopiedBlockTexture(UndergroundBiomes.metamorphicStone, 0, 0), new GT_CopiedBlockTexture(UndergroundBiomes.metamorphicStone, 0, 1), new GT_CopiedBlockTexture(UndergroundBiomes.metamorphicStone, 0, 2), new GT_CopiedBlockTexture(UndergroundBiomes.metamorphicStone, 0, 3), new GT_CopiedBlockTexture(UndergroundBiomes.metamorphicStone, 0, 4), new GT_CopiedBlockTexture(UndergroundBiomes.metamorphicStone, 0, 5), new GT_CopiedBlockTexture(UndergroundBiomes.metamorphicStone, 0, 6), new GT_CopiedBlockTexture(UndergroundBiomes.metamorphicStone, 0, 7), new GT_CopiedBlockTexture(UndergroundBiomes.metamorphicStone, 0, 0), new GT_CopiedBlockTexture(UndergroundBiomes.metamorphicStone, 0, 1), new GT_CopiedBlockTexture(UndergroundBiomes.metamorphicStone, 0, 2), new GT_CopiedBlockTexture(UndergroundBiomes.metamorphicStone, 0, 3), new GT_CopiedBlockTexture(UndergroundBiomes.metamorphicStone, 0, 4), new GT_CopiedBlockTexture(UndergroundBiomes.metamorphicStone, 0, 5), new GT_CopiedBlockTexture(UndergroundBiomes.metamorphicStone, 0, 6), new GT_CopiedBlockTexture(UndergroundBiomes.metamorphicStone, 0, 7)};
public static final ITexture[] mStoneTexturesUb3 = {new GT_CopiedBlockTexture(UndergroundBiomes.sedimentaryStone, 0, 0), new GT_CopiedBlockTexture(UndergroundBiomes.sedimentaryStone, 0, 1), new GT_CopiedBlockTexture(UndergroundBiomes.sedimentaryStone, 0, 2), new GT_CopiedBlockTexture(UndergroundBiomes.sedimentaryStone, 0, 3), new GT_CopiedBlockTexture(UndergroundBiomes.sedimentaryStone, 0, 4), new GT_CopiedBlockTexture(UndergroundBiomes.sedimentaryStone, 0, 5), new GT_CopiedBlockTexture(UndergroundBiomes.sedimentaryStone, 0, 6), new GT_CopiedBlockTexture(UndergroundBiomes.sedimentaryStone, 0, 7), new GT_CopiedBlockTexture(UndergroundBiomes.sedimentaryStone, 0, 0), new GT_CopiedBlockTexture(UndergroundBiomes.sedimentaryStone, 0, 1), new GT_CopiedBlockTexture(UndergroundBiomes.sedimentaryStone, 0, 2), new GT_CopiedBlockTexture(UndergroundBiomes.sedimentaryStone, 0, 3), new GT_CopiedBlockTexture(UndergroundBiomes.sedimentaryStone, 0, 4), new GT_CopiedBlockTexture(UndergroundBiomes.sedimentaryStone, 0, 5), new GT_CopiedBlockTexture(UndergroundBiomes.sedimentaryStone, 0, 6), new GT_CopiedBlockTexture(UndergroundBiomes.sedimentaryStone, 0, 7)};
public short mMetaData = 0;
public boolean mNatural = false;
public boolean mBlocked = true;
public static String mOreBlock = ""; //TODO remove static
//public static Block mOreBlock = GregTech_API.sBlockOres1;
public static byte getHarvestData(short aMetaData) {
Materials aMaterial = GregTech_API.sGeneratedMaterials[(aMetaData % 1000)];
byte tByte = aMaterial == null ? 0 : (byte) Math.max((aMetaData % 16000 / 1000 == 3) || (aMetaData % 16000 / 1000 == 4) ? 3 : 0, Math.min(7, aMaterial.mToolQuality - (aMetaData < 16000 ? 0 : 1)));
if(GT_Mod.gregtechproxy.mChangeHarvestLevels ){
tByte = aMaterial == null ? 0 : (byte) Math.max((aMetaData % 16000 / 1000 == 3) || (aMetaData % 16000 / 1000 == 4) ? GT_Mod.gregtechproxy.mGraniteHavestLevel : 0, Math.min(GT_Mod.gregtechproxy.mMaxHarvestLevel, GT_Mod.gregtechproxy.mHarvestLevel[aMaterial.mMetaItemSubID] - (aMetaData < 16000 ? 0 : 1)));
tByte = aMaterial == null ? 0 : (byte) Math.max((aMetaData % 16000 / 1000 == 3) || (aMetaData % 16000 / 1000 == 4) ? GT_Mod.gregtechproxy.mGraniteHavestLevel : 0, Math.min(GT_Mod.gregtechproxy.mMaxHarvestLevel, GT_Mod.gregtechproxy.mHarvestLevel[aMaterial.mMetaItemSubID] - (aMetaData < 16000 ? 0 : 1)));
}
return tByte;
}
public static boolean setOreBlock(World aWorld, int aX, int aY, int aZ, int aMetaData) {
return setOreBlock(aWorld, aX, aY, aZ, aMetaData, false);
public static byte getOreMeta(short aMetaData, Block tBlock) {
return (byte) (aMetaData % 16000 / 1000);
}
public static boolean setOreBlock(World aWorld, int aX, int aY, int aZ, int aMetaData, boolean air) {
public static boolean setOreBlock(World aWorld, int aX, int aY, int aZ, int aMetaData, boolean smallOre) {
return setOreBlock(aWorld, aX, aY, aZ, aMetaData, false, false);
}
public static boolean setOreBlock(World aWorld, int aX, int aY, int aZ, int aMetaData, boolean smallOre, boolean air) {
if (!air) {
aY = Math.min(aWorld.getActualHeight(), Math.max(aY, 1));
}
Block tBlock = aWorld.getBlock(aX, aY, aZ);
Block tOreBlock = GregTech_API.sBlockOres1;
int BlockMeta = aWorld.getBlockMetadata(aX, aY, aZ);
if ((aMetaData > 0) && ((tBlock != Blocks.air) || air)) {
if (tBlock.isReplaceableOreGen(aWorld, aX, aY, aZ, Blocks.netherrack)) {
aMetaData += 1000;
} else if (tBlock.isReplaceableOreGen(aWorld, aX, aY, aZ, Blocks.end_stone)) {
aMetaData += 2000;
} else if (tBlock.isReplaceableOreGen(aWorld, aX, aY, aZ, GregTech_API.sBlockGranites)) {
if (tBlock == GregTech_API.sBlockGranites) {
if (aWorld.getBlockMetadata(aX, aY, aZ) < 8) {
aMetaData += 3000;
} else {
aMetaData += 4000;
}
} else {
aMetaData += 3000;
if (tBlock instanceof BlockMetadataBase) { //UBC Handling
if (tBlock == UndergroundBiomes.igneousStone) {
tOreBlock = GregTech_API.sBlockOresUb1;
} else if(tBlock == UndergroundBiomes.metamorphicStone) {
tOreBlock = GregTech_API.sBlockOresUb2;
} else if(tBlock == UndergroundBiomes.sedimentaryStone) {
tOreBlock = GregTech_API.sBlockOresUb3;
}
aMetaData += smallOre ? 8000 + (BlockMeta * 1000) : (BlockMeta * 1000);
} else { //Default Handling
if (tBlock.isReplaceableOreGen(aWorld, aX, aY, aZ, Blocks.netherrack)) {
aMetaData += 1000;
} else if (tBlock.isReplaceableOreGen(aWorld, aX, aY, aZ, Blocks.end_stone)) {
aMetaData += 2000;
} else if (tBlock.isReplaceableOreGen(aWorld, aX, aY, aZ, GregTech_API.sBlockGranites)) {
if (tBlock == GregTech_API.sBlockGranites) {
if (aWorld.getBlockMetadata(aX, aY, aZ) < 8) {
aMetaData += 3000;
} else {
aMetaData += 4000;
}
} else {
aMetaData += 3000;
}
} else if (tBlock.isReplaceableOreGen(aWorld, aX, aY, aZ, Blocks.stone) && smallOre) {
aMetaData += 16000;
} else if (!tBlock.isReplaceableOreGen(aWorld, aX, aY, aZ, Blocks.stone)) {
return false;
}
} else if (tBlock instanceof BlockMetadataBase) { //TODO Implement config option
int aMeta = aWorld.getBlockMetadata(aX, aY, aZ);
if(tBlock == UndergroundBiomes.igneousStone) {
aMetaData += (21000 + (aMeta * 1000));
} /*else if(tBlock == UndergroundBiomes.metamorphicStone && tBlock.isReplaceableOreGen(aWorld, aX, aY, aZ, UndergroundBiomes.metamorphicStone)) {
//aMetaData += (40000 + (aMeta * 1000));
} else if(tBlock == UndergroundBiomes.sedimentaryStone && tBlock.isReplaceableOreGen(aWorld, aX, aY, aZ, UndergroundBiomes.sedimentaryStone)) {
//aMetaData += (50000 + (aMeta * 1000));
}*/
} else if (!tBlock.isReplaceableOreGen(aWorld, aX, aY, aZ, Blocks.stone)) {
return false;
}
aWorld.setBlock(aX, aY, aZ, GregTech_API.sBlockOres1, getHarvestData((short) aMetaData), 0);
aWorld.setBlock(aX, aY, aZ, tOreBlock, getHarvestData((short) aMetaData), 0);
TileEntity tTileEntity = aWorld.getTileEntity(aX, aY, aZ);
if ((tTileEntity instanceof GT_TileEntity_Ores)) {
((GT_TileEntity_Ores) tTileEntity).mMetaData = ((short) aMetaData);
((GT_TileEntity_Ores) tTileEntity).mNatural = true;
((GT_TileEntity_Ores) tTileEntity).mOreBlock = tOreBlock.getUnlocalizedName();
//System.out.println(mOreBlock);
}
return true;
}
@ -94,12 +108,14 @@ public class GT_TileEntity_Ores
super.readFromNBT(aNBT);
this.mMetaData = aNBT.getShort("m");
this.mNatural = aNBT.getBoolean("n");
this.mOreBlock = aNBT.getString("o");
}
public void writeToNBT(NBTTagCompound aNBT) {
super.writeToNBT(aNBT);
aNBT.setShort("m", this.mMetaData);
aNBT.setBoolean("n", this.mNatural);
aNBT.setString("o", this.mOreBlock);
}
public void onUpdated() {
@ -242,11 +258,24 @@ public class GT_TileEntity_Ores
}
public ITexture[] getTexture(byte aSide) {
Materials aMaterial = GregTech_API.sGeneratedMaterials[(this.mMetaData % 1000)];
if ((aMaterial != null) && (this.mMetaData < 32767)) {
System.out.println((this.mMetaData / 1000 % 31));
return new ITexture[]{mStoneTextures[(this.mMetaData / 1000 % 31)], new GT_RenderedTexture(aMaterial.mIconSet.mTextures[!(this.mMetaData >=16000 && this.mMetaData <=20999) ? OrePrefixes.ore.mTextureIndex : OrePrefixes.oreSmall.mTextureIndex], aMaterial.mRGBa)};
if(this.mMetaData % 1000 >=0) {
Materials aMaterial = GregTech_API.sGeneratedMaterials[(this.mMetaData % 1000)];
if ((aMaterial != null) && (this.mMetaData < 16000)) {
//return ((GT_Block_Ores_Abstract) mOreBlock).getStoneTexture(aSide, this.mMetaData, aMaterial);
//System.out.println(this.mOreBlock + " -- " + this.mMetaData);
if (this.mOreBlock.equalsIgnoreCase("gt.blockores")) {
return new ITexture[]{mStoneTextures[(this.mMetaData / 1000 % 16)], new GT_RenderedTexture(aMaterial.mIconSet.mTextures[this.mMetaData / 16000 == 0 ? OrePrefixes.ore.mTextureIndex : OrePrefixes.oreSmall.mTextureIndex], aMaterial.mRGBa)};
} else if (this.mOreBlock.equalsIgnoreCase("gt.blockores.ub1")) {
return new ITexture[]{mStoneTexturesUb1[(this.mMetaData / 1000 % 16)], new GT_RenderedTexture(aMaterial.mIconSet.mTextures[this.mMetaData < 8000 ? OrePrefixes.ore.mTextureIndex : OrePrefixes.oreSmall.mTextureIndex], aMaterial.mRGBa)};
} else if (this.mOreBlock.equalsIgnoreCase("gt.blockores.ub2")) {
return new ITexture[]{mStoneTexturesUb2[(this.mMetaData / 1000 % 16)], new GT_RenderedTexture(aMaterial.mIconSet.mTextures[this.mMetaData < 8000 ? OrePrefixes.ore.mTextureIndex : OrePrefixes.oreSmall.mTextureIndex], aMaterial.mRGBa)};
} else if (this.mOreBlock.equalsIgnoreCase("gt.blockores.ub3")) {
return new ITexture[]{mStoneTexturesUb3[(this.mMetaData / 1000 % 16)], new GT_RenderedTexture(aMaterial.mIconSet.mTextures[this.mMetaData < 8000 ? OrePrefixes.ore.mTextureIndex : OrePrefixes.oreSmall.mTextureIndex], aMaterial.mRGBa)};
}
}
} else {
System.out.println(this.mMetaData + "######################## ERROR ########################");
}
return new ITexture[]{mStoneTextures[0], new GT_RenderedTexture(gregtech.api.enums.TextureSet.SET_NONE.mTextures[OrePrefixes.ore.mTextureIndex])};
return new ITexture[]{new GT_CopiedBlockTexture(Blocks.stone, 0, 0), new GT_RenderedTexture(gregtech.api.enums.TextureSet.SET_NONE.mTextures[OrePrefixes.ore.mTextureIndex])};
}
}

View file

@ -9,7 +9,7 @@ import gregtech.api.util.GT_LanguageManager;
import gregtech.api.util.GT_ModHandler;
import gregtech.api.util.GT_OreDictUnificator;
import gregtech.api.util.GT_Utility;
import gregtech.common.blocks.GT_Block_Ores;
import gregtech.common.blocks.GT_Block_Ores_Abstract;
import gregtech.common.blocks.GT_TileEntity_Ores;
import net.minecraft.block.Block;
import net.minecraft.entity.player.EntityPlayer;
@ -94,7 +94,7 @@ public class Behaviour_Prospecting
tY = aY - 4 - tQuality + tRandom.nextInt(j);
tZ = aZ - 4 - tQuality + tRandom.nextInt(j);
Block tBlock = aWorld.getBlock(tX, tY, tZ);
if ((tBlock instanceof GT_Block_Ores)) {
if ((tBlock instanceof GT_Block_Ores_Abstract)) {
TileEntity tTileEntity = aWorld.getTileEntity(tX, tY, tZ);
if ((tTileEntity instanceof GT_TileEntity_Ores)) {
Materials tMaterial = GregTech_API.sGeneratedMaterials[(((GT_TileEntity_Ores) tTileEntity).mMetaData % 1000)];

View file

@ -9,7 +9,7 @@ import gregtech.api.interfaces.tileentity.IGregTechTileEntity;
import gregtech.api.interfaces.tileentity.IPipeRenderedTileEntity;
import gregtech.api.interfaces.tileentity.ITexturedTileEntity;
import gregtech.common.blocks.GT_Block_Machines;
import gregtech.common.blocks.GT_Block_Ores;
import gregtech.common.blocks.GT_Block_Ores_Abstract;
import gregtech.common.blocks.GT_TileEntity_Ores;
import net.minecraft.block.Block;
import net.minecraft.client.renderer.RenderBlocks;
@ -529,7 +529,7 @@ public class GT_Renderer_Block
(!GregTech_API.METATILEENTITIES[aMeta].renderInInventory(aBlock, aMeta, aRenderer))) {
renderNormalInventoryMetaTileEntity(aBlock, aMeta, aRenderer);
}
} else if ((aBlock instanceof GT_Block_Ores)) {
} else if ((aBlock instanceof GT_Block_Ores_Abstract)) {
GT_TileEntity_Ores tTileEntity = new GT_TileEntity_Ores();
tTileEntity.mMetaData = ((short) aMeta);

View file

@ -10,10 +10,9 @@ import gregtech.api.metatileentity.MetaTileEntity;
import gregtech.api.metatileentity.implementations.GT_MetaTileEntity_BasicMachine;
import gregtech.api.objects.GT_RenderedTexture;
import gregtech.api.objects.ItemData;
import gregtech.api.objects.MaterialStack;
import gregtech.api.util.GT_OreDictUnificator;
import gregtech.api.util.GT_Utility;
import gregtech.common.blocks.GT_Block_Ores;
import gregtech.common.blocks.GT_Block_Ores_Abstract;
import gregtech.common.blocks.GT_TileEntity_Ores;
import ic2.core.Ic2Items;
import net.minecraft.block.Block;
@ -74,7 +73,7 @@ public class GT_MetaTileEntity_SeismicProspector extends GT_MetaTileEntity_Basic
for (int f = -2; f < 3; f++) {
for (int g = -2; g < 3; g++) {
Block tBlock = this.getBaseMetaTileEntity().getBlockOffset(f, -i, g);
if ((tBlock instanceof GT_Block_Ores)) {
if ((tBlock instanceof GT_Block_Ores_Abstract)) {
TileEntity tTileEntity = getBaseMetaTileEntity().getWorld().getTileEntity(getBaseMetaTileEntity().getXCoord() + f, getBaseMetaTileEntity().getYCoord() + (-i), getBaseMetaTileEntity().getZCoord() + g);
if ((tTileEntity instanceof GT_TileEntity_Ores)) {
if(((GT_TileEntity_Ores) tTileEntity).mMetaData < 16000){

View file

@ -137,6 +137,9 @@ public class GT_Loader_Item_Block_And_Fluid
GregTech_API.sBlockConcretes = new GT_Block_Concretes();
GregTech_API.sBlockStones = new GT_Block_Stones();
GregTech_API.sBlockOres1 = new GT_Block_Ores();
GregTech_API.sBlockOresUb1 = new GT_Block_Ores_UB1();
GregTech_API.sBlockOresUb2 = new GT_Block_Ores_UB2();
GregTech_API.sBlockOresUb3 = new GT_Block_Ores_UB3();
GregTech_API.sBlockMetal1 = new GT_Block_Metal("gt.blockmetal1", new Materials[]{
Materials.Adamantium,
Materials.Aluminium,