aboutsummaryrefslogtreecommitdiff
path: root/src/main/java/gregtech/common/blocks
diff options
context:
space:
mode:
Diffstat (limited to 'src/main/java/gregtech/common/blocks')
-rw-r--r--src/main/java/gregtech/common/blocks/GT_Block_Casings8.java94
-rw-r--r--src/main/java/gregtech/common/blocks/GT_Block_Casings_Abstract.java244
-rw-r--r--src/main/java/gregtech/common/blocks/GT_Block_Machines.java1096
-rw-r--r--src/main/java/gregtech/common/blocks/GT_Block_Metal.java86
-rw-r--r--src/main/java/gregtech/common/blocks/GT_Block_Ores_Abstract.java552
-rw-r--r--src/main/java/gregtech/common/blocks/GT_Block_Stones_Abstract.java300
-rw-r--r--src/main/java/gregtech/common/blocks/GT_Item_Casings8.java20
-rw-r--r--src/main/java/gregtech/common/blocks/GT_Item_Machines.java406
-rw-r--r--src/main/java/gregtech/common/blocks/GT_Item_Ores.java108
-rw-r--r--src/main/java/gregtech/common/blocks/GT_Item_Storage.java80
10 files changed, 1493 insertions, 1493 deletions
diff --git a/src/main/java/gregtech/common/blocks/GT_Block_Casings8.java b/src/main/java/gregtech/common/blocks/GT_Block_Casings8.java
index c6e83f2847..8d2c976b1b 100644
--- a/src/main/java/gregtech/common/blocks/GT_Block_Casings8.java
+++ b/src/main/java/gregtech/common/blocks/GT_Block_Casings8.java
@@ -1,47 +1,47 @@
-package gregtech.common.blocks;
-
-import cpw.mods.fml.relauncher.Side;
-import cpw.mods.fml.relauncher.SideOnly;
-import gregtech.api.enums.ItemList;
-import gregtech.api.enums.Textures;
-import gregtech.api.objects.GT_CopiedBlockTexture;
-import gregtech.api.util.GT_LanguageManager;
-import net.minecraft.item.ItemStack;
-import net.minecraft.util.IIcon;
-
-public class GT_Block_Casings8
- extends GT_Block_Casings_Abstract {
-
- //WATCH OUT FOR TEXTURE ID's
- public GT_Block_Casings8() {
- super(GT_Item_Casings8.class, "gt.blockcasings8", GT_Material_Casings.INSTANCE);
- for (int i = 0; i < 4; i = (i + 1)) {
- Textures.BlockIcons.casingTexturePages[1][i+48] = new GT_CopiedBlockTexture(this, 6, i);
- }
- GT_LanguageManager.addStringLocalization(getUnlocalizedName() + ".0.name", "Chemically Inert Machine Casing");
- GT_LanguageManager.addStringLocalization(getUnlocalizedName() + ".1.name", "PTFE Pipe Casing");
- GT_LanguageManager.addStringLocalization(getUnlocalizedName() + ".2.name", "Mining Neutronium Casing");
- GT_LanguageManager.addStringLocalization(getUnlocalizedName() + ".3.name", "Mining Black Plutonium Casing");
-
- ItemList.Casing_Chemically_Inert.set(new ItemStack(this, 1, 0));
- ItemList.Casing_Pipe_Polytetrafluoroethylene.set(new ItemStack(this, 1, 1));
- ItemList.Casing_MiningNeutronium.set(new ItemStack(this, 1, 2));
- ItemList.Casing_MiningBlackPlutonium.set(new ItemStack(this, 1, 3));
- }
-
- @Override
- @SideOnly(Side.CLIENT)
- public IIcon getIcon(int aSide, int aMeta) {
- switch (aMeta) {
- case 0:
- return Textures.BlockIcons.MACHINE_CASING_CHEMICALLY_INERT.getIcon();
- case 1:
- return Textures.BlockIcons.MACHINE_CASING_PIPE_POLYTETRAFLUOROETHYLENE.getIcon();
- case 2:
- return Textures.BlockIcons.MACHINE_CASING_MINING_NEUTRONIUM.getIcon();
- case 3:
- return Textures.BlockIcons.MACHINE_CASING_MINING_BLACKPLUTONIUM.getIcon();
- }
- return Textures.BlockIcons.MACHINE_CASING_ROBUST_TUNGSTENSTEEL.getIcon();
- }
-}
+package gregtech.common.blocks;
+
+import cpw.mods.fml.relauncher.Side;
+import cpw.mods.fml.relauncher.SideOnly;
+import gregtech.api.enums.ItemList;
+import gregtech.api.enums.Textures;
+import gregtech.api.objects.GT_CopiedBlockTexture;
+import gregtech.api.util.GT_LanguageManager;
+import net.minecraft.item.ItemStack;
+import net.minecraft.util.IIcon;
+
+public class GT_Block_Casings8
+ extends GT_Block_Casings_Abstract {
+
+ //WATCH OUT FOR TEXTURE ID's
+ public GT_Block_Casings8() {
+ super(GT_Item_Casings8.class, "gt.blockcasings8", GT_Material_Casings.INSTANCE);
+ for (int i = 0; i < 4; i = (i + 1)) {
+ Textures.BlockIcons.casingTexturePages[1][i+48] = new GT_CopiedBlockTexture(this, 6, i);
+ }
+ GT_LanguageManager.addStringLocalization(getUnlocalizedName() + ".0.name", "Chemically Inert Machine Casing");
+ GT_LanguageManager.addStringLocalization(getUnlocalizedName() + ".1.name", "PTFE Pipe Casing");
+ GT_LanguageManager.addStringLocalization(getUnlocalizedName() + ".2.name", "Mining Neutronium Casing");
+ GT_LanguageManager.addStringLocalization(getUnlocalizedName() + ".3.name", "Mining Black Plutonium Casing");
+
+ ItemList.Casing_Chemically_Inert.set(new ItemStack(this, 1, 0));
+ ItemList.Casing_Pipe_Polytetrafluoroethylene.set(new ItemStack(this, 1, 1));
+ ItemList.Casing_MiningNeutronium.set(new ItemStack(this, 1, 2));
+ ItemList.Casing_MiningBlackPlutonium.set(new ItemStack(this, 1, 3));
+ }
+
+ @Override
+ @SideOnly(Side.CLIENT)
+ public IIcon getIcon(int aSide, int aMeta) {
+ switch (aMeta) {
+ case 0:
+ return Textures.BlockIcons.MACHINE_CASING_CHEMICALLY_INERT.getIcon();
+ case 1:
+ return Textures.BlockIcons.MACHINE_CASING_PIPE_POLYTETRAFLUOROETHYLENE.getIcon();
+ case 2:
+ return Textures.BlockIcons.MACHINE_CASING_MINING_NEUTRONIUM.getIcon();
+ case 3:
+ return Textures.BlockIcons.MACHINE_CASING_MINING_BLACKPLUTONIUM.getIcon();
+ }
+ return Textures.BlockIcons.MACHINE_CASING_ROBUST_TUNGSTENSTEEL.getIcon();
+ }
+}
diff --git a/src/main/java/gregtech/common/blocks/GT_Block_Casings_Abstract.java b/src/main/java/gregtech/common/blocks/GT_Block_Casings_Abstract.java
index 8b03a10b29..830a407777 100644
--- a/src/main/java/gregtech/common/blocks/GT_Block_Casings_Abstract.java
+++ b/src/main/java/gregtech/common/blocks/GT_Block_Casings_Abstract.java
@@ -1,122 +1,122 @@
-package gregtech.common.blocks;
-
-import cpw.mods.fml.relauncher.Side;
-import cpw.mods.fml.relauncher.SideOnly;
-import gregtech.api.GregTech_API;
-import gregtech.api.items.GT_Generic_Block;
-import gregtech.api.util.GT_LanguageManager;
-import net.minecraft.block.Block;
-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.EnumCreatureType;
-import net.minecraft.init.Blocks;
-import net.minecraft.item.Item;
-import net.minecraft.item.ItemBlock;
-import net.minecraft.item.ItemStack;
-import net.minecraft.util.StatCollector;
-import net.minecraft.world.IBlockAccess;
-import net.minecraft.world.World;
-
-import java.util.List;
-import java.util.Random;
-
-public abstract class GT_Block_Casings_Abstract
- extends GT_Generic_Block {
- public GT_Block_Casings_Abstract(Class<? extends ItemBlock> aItemClass, String aName, Material aMaterial) {
- super(aItemClass, aName, aMaterial);
- setStepSound(soundTypeMetal);
- setCreativeTab(GregTech_API.TAB_GREGTECH);
- GregTech_API.registerMachineBlock(this, -1);
- GT_LanguageManager.addStringLocalization(getUnlocalizedName() + "." + 32767 + ".name", "Any Sub Block of this");
- }
-
- public String getHarvestTool(int aMeta) {
- return "wrench";
- }
-
- public int getHarvestLevel(int aMeta) {
- return 2;
- }
-
- public float getBlockHardness(World aWorld, int aX, int aY, int aZ) {
- return Blocks.iron_block.getBlockHardness(aWorld, aX, aY, aZ);
- }
-
- public float getExplosionResistance(Entity aTNT) {
- return Blocks.iron_block.getExplosionResistance(aTNT);
- }
-
- protected boolean canSilkHarvest() {
- return false;
- }
-
- public void onBlockAdded(World aWorld, int aX, int aY, int aZ) {
- if (GregTech_API.isMachineBlock(this, aWorld.getBlockMetadata(aX, aY, aZ))) {
- GregTech_API.causeMachineUpdate(aWorld, aX, aY, aZ);
- }
- }
-
- public String getUnlocalizedName() {
- return this.mUnlocalizedName;
- }
-
- public String getLocalizedName() {
- return StatCollector.translateToLocal(this.mUnlocalizedName + ".name");
- }
-
- 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 renderAsNormalBlock() {
- return true;
- }
-
- public boolean isOpaqueCube() {
- return true;
- }
-
- public void breakBlock(World aWorld, int aX, int aY, int aZ, Block aBlock, int aMetaData) {
- if (GregTech_API.isMachineBlock(this, aWorld.getBlockMetadata(aX, aY, aZ))) {
- GregTech_API.causeMachineUpdate(aWorld, aX, aY, aZ);
- }
- }
-
- public boolean canCreatureSpawn(EnumCreatureType type, IBlockAccess world, int x, int y, int z) {
- return false;
- }
-
- public int damageDropped(int par1) {
- return par1;
- }
-
- public int getDamageValue(World par1World, int par2, int par3, int par4) {
- return par1World.getBlockMetadata(par2, par3, par4);
- }
-
- public int quantityDropped(Random par1Random) {
- return 1;
- }
-
- public Item getItemDropped(int par1, Random par2Random, int par3) {
- return Item.getItemFromBlock(this);
- }
-
- @SideOnly(Side.CLIENT)
- public void registerBlockIcons(IIconRegister aIconRegister) {
- }
-
- @SideOnly(Side.CLIENT)
- public void getSubBlocks(Item aItem, CreativeTabs par2CreativeTabs, List aList) {
- for (int i = 0; i < 16; i++) {
- ItemStack aStack = new ItemStack(aItem, 1, i);
- if (!aStack.getDisplayName().contains(".name")) aList.add(aStack);
- }
- }
-}
+package gregtech.common.blocks;
+
+import cpw.mods.fml.relauncher.Side;
+import cpw.mods.fml.relauncher.SideOnly;
+import gregtech.api.GregTech_API;
+import gregtech.api.items.GT_Generic_Block;
+import gregtech.api.util.GT_LanguageManager;
+import net.minecraft.block.Block;
+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.EnumCreatureType;
+import net.minecraft.init.Blocks;
+import net.minecraft.item.Item;
+import net.minecraft.item.ItemBlock;
+import net.minecraft.item.ItemStack;
+import net.minecraft.util.StatCollector;
+import net.minecraft.world.IBlockAccess;
+import net.minecraft.world.World;
+
+import java.util.List;
+import java.util.Random;
+
+public abstract class GT_Block_Casings_Abstract
+ extends GT_Generic_Block {
+ public GT_Block_Casings_Abstract(Class<? extends ItemBlock> aItemClass, String aName, Material aMaterial) {
+ super(aItemClass, aName, aMaterial);
+ setStepSound(soundTypeMetal);
+ setCreativeTab(GregTech_API.TAB_GREGTECH);
+ GregTech_API.registerMachineBlock(this, -1);
+ GT_LanguageManager.addStringLocalization(getUnlocalizedName() + "." + 32767 + ".name", "Any Sub Block of this");
+ }
+
+ public String getHarvestTool(int aMeta) {
+ return "wrench";
+ }
+
+ public int getHarvestLevel(int aMeta) {
+ return 2;
+ }
+
+ public float getBlockHardness(World aWorld, int aX, int aY, int aZ) {
+ return Blocks.iron_block.getBlockHardness(aWorld, aX, aY, aZ);
+ }
+
+ public float getExplosionResistance(Entity aTNT) {
+ return Blocks.iron_block.getExplosionResistance(aTNT);
+ }
+
+ protected boolean canSilkHarvest() {
+ return false;
+ }
+
+ public void onBlockAdded(World aWorld, int aX, int aY, int aZ) {
+ if (GregTech_API.isMachineBlock(this, aWorld.getBlockMetadata(aX, aY, aZ))) {
+ GregTech_API.causeMachineUpdate(aWorld, aX, aY, aZ);
+ }
+ }
+
+ public String getUnlocalizedName() {
+ return this.mUnlocalizedName;
+ }
+
+ public String getLocalizedName() {
+ return StatCollector.translateToLocal(this.mUnlocalizedName + ".name");
+ }
+
+ 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 renderAsNormalBlock() {
+ return true;
+ }
+
+ public boolean isOpaqueCube() {
+ return true;
+ }
+
+ public void breakBlock(World aWorld, int aX, int aY, int aZ, Block aBlock, int aMetaData) {
+ if (GregTech_API.isMachineBlock(this, aWorld.getBlockMetadata(aX, aY, aZ))) {
+ GregTech_API.causeMachineUpdate(aWorld, aX, aY, aZ);
+ }
+ }
+
+ public boolean canCreatureSpawn(EnumCreatureType type, IBlockAccess world, int x, int y, int z) {
+ return false;
+ }
+
+ public int damageDropped(int par1) {
+ return par1;
+ }
+
+ public int getDamageValue(World par1World, int par2, int par3, int par4) {
+ return par1World.getBlockMetadata(par2, par3, par4);
+ }
+
+ public int quantityDropped(Random par1Random) {
+ return 1;
+ }
+
+ public Item getItemDropped(int par1, Random par2Random, int par3) {
+ return Item.getItemFromBlock(this);
+ }
+
+ @SideOnly(Side.CLIENT)
+ public void registerBlockIcons(IIconRegister aIconRegister) {
+ }
+
+ @SideOnly(Side.CLIENT)
+ public void getSubBlocks(Item aItem, CreativeTabs par2CreativeTabs, List aList) {
+ for (int i = 0; i < 16; i++) {
+ ItemStack aStack = new ItemStack(aItem, 1, i);
+ if (!aStack.getDisplayName().contains(".name")) aList.add(aStack);
+ }
+ }
+}
diff --git a/src/main/java/gregtech/common/blocks/GT_Block_Machines.java b/src/main/java/gregtech/common/blocks/GT_Block_Machines.java
index d0ca757e3c..cc75124a05 100644
--- a/src/main/java/gregtech/common/blocks/GT_Block_Machines.java
+++ b/src/main/java/gregtech/common/blocks/GT_Block_Machines.java
@@ -1,548 +1,548 @@
-package gregtech.common.blocks;
-
-import cpw.mods.fml.relauncher.Side;
-import cpw.mods.fml.relauncher.SideOnly;
-import gregtech.api.GregTech_API;
-import gregtech.api.enums.Textures;
-import gregtech.api.interfaces.IDebugableBlock;
-import gregtech.api.interfaces.metatileentity.IMetaTileEntity;
-import gregtech.api.interfaces.tileentity.ICoverable;
-import gregtech.api.interfaces.tileentity.IGregTechTileEntity;
-import gregtech.api.items.GT_Generic_Block;
-import gregtech.api.metatileentity.BaseMetaPipeEntity;
-import gregtech.api.metatileentity.BaseMetaTileEntity;
-import gregtech.api.metatileentity.BaseTileEntity;
-import gregtech.api.util.GT_BaseCrop;
-import gregtech.api.util.GT_Log;
-import gregtech.api.util.GT_Utility;
-import gregtech.common.render.GT_Renderer_Block;
-import net.minecraft.block.Block;
-import net.minecraft.block.ITileEntityProvider;
-import net.minecraft.client.renderer.texture.IIconRegister;
-import net.minecraft.creativetab.CreativeTabs;
-import net.minecraft.entity.Entity;
-import net.minecraft.entity.EntityLivingBase;
-import net.minecraft.entity.EnumCreatureType;
-import net.minecraft.entity.item.EntityItem;
-import net.minecraft.entity.player.EntityPlayer;
-import net.minecraft.item.Item;
-import net.minecraft.item.ItemStack;
-import net.minecraft.nbt.NBTTagCompound;
-import net.minecraft.tileentity.TileEntity;
-import net.minecraft.util.AxisAlignedBB;
-import net.minecraft.util.IIcon;
-import net.minecraft.util.MathHelper;
-import net.minecraft.util.StatCollector;
-import net.minecraft.world.Explosion;
-import net.minecraft.world.IBlockAccess;
-import net.minecraft.world.World;
-import net.minecraftforge.common.util.ForgeDirection;
-
-import java.util.ArrayList;
-import java.util.List;
-
-import static gregtech.GT_Mod.GT_FML_LOGGER;
-import static gregtech.api.objects.XSTR.XSTR_INSTANCE;
-
-public class GT_Block_Machines
- extends GT_Generic_Block
- implements IDebugableBlock, ITileEntityProvider {
- public static ThreadLocal<IGregTechTileEntity> mTemporaryTileEntity = new ThreadLocal();
-
- public GT_Block_Machines() {
- super(GT_Item_Machines.class, "gt.blockmachines", new GT_Material_Machines());
- GregTech_API.registerMachineBlock(this, -1);
- setHardness(1.0F);
- setResistance(10.0F);
- setStepSound(soundTypeMetal);
- setCreativeTab(GregTech_API.TAB_GREGTECH);
- this.isBlockContainer = true;
- }
-
- public String getHarvestTool(int aMeta) {
- if (aMeta >= 8 && aMeta <= 11) {
- return "cutter";
- }
- return "wrench";
- }
-
- public int getHarvestLevel(int aMeta) {
- return aMeta % 4;
- }
-
- protected boolean canSilkHarvest() {
- return false;
- }
-
- public void onNeighborChange(IBlockAccess aWorld, int aX, int aY, int aZ, int aTileX, int aTileY, int aTileZ) {
- TileEntity tTileEntity = aWorld.getTileEntity(aX, aY, aZ);
- if ((tTileEntity instanceof BaseTileEntity)) {
- ((BaseTileEntity) tTileEntity).onAdjacentBlockChange(aTileX, aTileY, aTileZ);
- }
- }
-
- public void onNeighborBlockChange(World aWorld, int aX, int aY, int aZ, Block aBlock) {
- TileEntity tTileEntity = aWorld.getTileEntity(aX, aY, aZ);
- if ((tTileEntity instanceof BaseMetaPipeEntity)) {
- ((BaseMetaPipeEntity) tTileEntity).onNeighborBlockChange(aX, aY, aZ);
- }
- }
-
- public void onBlockAdded(World aWorld, int aX, int aY, int aZ) {
- super.onBlockAdded(aWorld, aX, aY, aZ);
- if (GregTech_API.isMachineBlock(this, aWorld.getBlockMetadata(aX, aY, aZ))) {
- GregTech_API.causeMachineUpdate(aWorld, aX, aY, aZ);
- }
- }
-
- public String getUnlocalizedName() {
- return "gt.blockmachines";
- }
-
- public String getLocalizedName() {
- return StatCollector.translateToLocal(getUnlocalizedName() + ".name");
- }
-
- public int getFlammability(IBlockAccess aWorld, int aX, int aY, int aZ, ForgeDirection face) {
- return 0;
- }
-
- public int getFireSpreadSpeed(IBlockAccess aWorld, int aX, int aY, int aZ, ForgeDirection face) {
- return (GregTech_API.sMachineFlammable) && (aWorld.getBlockMetadata(aX, aY, aZ) == 0) ? 100 : 0;
- }
-
- public int getRenderType() {
- if (GT_Renderer_Block.INSTANCE == null) {
- return super.getRenderType();
- }
- return GT_Renderer_Block.INSTANCE.mRenderID;
- }
-
- public boolean isFireSource(World aWorld, int aX, int aY, int aZ, ForgeDirection side) {
- return (GregTech_API.sMachineFlammable) && (aWorld.getBlockMetadata(aX, aY, aZ) == 0);
- }
-
- public boolean isFlammable(IBlockAccess aWorld, int aX, int aY, int aZ, ForgeDirection face) {
- return (GregTech_API.sMachineFlammable) && (aWorld.getBlockMetadata(aX, aY, aZ) == 0);
- }
-
- public boolean canCreatureSpawn(EnumCreatureType type, IBlockAccess aWorld, int aX, int aY, int aZ) {
- return false;
- }
-
- public boolean canConnectRedstone(IBlockAccess var1, int var2, int var3, int var4, int var5) {
- return true;
- }
-
- 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 false;
- }
-
- public boolean hasTileEntity(int aMeta) {
- return true;
- }
-
- public boolean hasComparatorInputOverride() {
- return true;
- }
-
- public boolean renderAsNormalBlock() {
- return false;
- }
-
- public boolean canProvidePower() {
- return true;
- }
-
- public boolean isOpaqueCube() {
- return false;
- }
-
- 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 Textures.BlockIcons.MACHINE_LV_SIDE.getIcon();
- }
-
- public IIcon getIcon(int aSide, int aMeta) {
- return Textures.BlockIcons.MACHINE_LV_SIDE.getIcon();
- }
-
- public boolean onBlockEventReceived(World aWorld, int aX, int aY, int aZ, int aData1, int aData2) {
- super.onBlockEventReceived(aWorld, aX, aY, aZ, aData1, aData2);
- TileEntity tTileEntity = aWorld.getTileEntity(aX, aY, aZ);
- return tTileEntity != null ? tTileEntity.receiveClientEvent(aData1, aData2) : false;
- }
-
- public void addCollisionBoxesToList(World aWorld, int aX, int aY, int aZ, AxisAlignedBB inputAABB, List outputAABB, Entity collider) {
- TileEntity tTileEntity = aWorld.getTileEntity(aX, aY, aZ);
- if (((tTileEntity instanceof IGregTechTileEntity)) && (((IGregTechTileEntity) tTileEntity).getMetaTileEntity() != null)) {
- ((IGregTechTileEntity) tTileEntity).addCollisionBoxesToList(aWorld, aX, aY, aZ, inputAABB, outputAABB, collider);
- return;
- }
- super.addCollisionBoxesToList(aWorld, aX, aY, aZ, inputAABB, outputAABB, collider);
- }
-
- public AxisAlignedBB getCollisionBoundingBoxFromPool(World aWorld, int aX, int aY, int aZ) {
- TileEntity tTileEntity = aWorld.getTileEntity(aX, aY, aZ);
- if (((tTileEntity instanceof IGregTechTileEntity)) && (((IGregTechTileEntity) tTileEntity).getMetaTileEntity() != null)) {
- return ((IGregTechTileEntity) tTileEntity).getCollisionBoundingBoxFromPool(aWorld, aX, aY, aZ);
- }
- return super.getCollisionBoundingBoxFromPool(aWorld, aX, aY, aZ);
- }
-
- @Override
- @SideOnly(Side.CLIENT)
- public AxisAlignedBB getSelectedBoundingBoxFromPool(World aWorld, int aX, int aY, int aZ)
- {
- TileEntity tTileEntity = aWorld.getTileEntity(aX, aY, aZ);
- if (((tTileEntity instanceof IGregTechTileEntity)) && (((IGregTechTileEntity) tTileEntity).getMetaTileEntity() != null)) {
- return ((IGregTechTileEntity) tTileEntity).getCollisionBoundingBoxFromPool(aWorld, aX, aY, aZ);
- }
- return super.getSelectedBoundingBoxFromPool(aWorld, aX, aY, aZ);
- }
-
- @Override //THIS
- public void setBlockBoundsBasedOnState(IBlockAccess blockAccess, int aX, int aY, int aZ) {
- TileEntity tTileEntity = blockAccess.getTileEntity(aX, aY, aZ);
- if (((tTileEntity instanceof IGregTechTileEntity)) && (((IGregTechTileEntity) tTileEntity).getMetaTileEntity() != null)) {
- AxisAlignedBB bbb=((IGregTechTileEntity)tTileEntity).getCollisionBoundingBoxFromPool(((IGregTechTileEntity)tTileEntity).getWorld(), 0, 0, 0);
- minX=bbb.minX;//This essentially sets block bounds
- minY=bbb.minY;
- minZ=bbb.minZ;
- maxX=bbb.maxX;
- maxY=bbb.maxY;
- maxZ=bbb.maxZ;
- return;
- }
- super.setBlockBoundsBasedOnState(blockAccess,aX,aY,aZ);
- }
-
- @Override
- public void setBlockBoundsForItemRender() {
- super.setBlockBounds(0,0,0,1,1,1);
- }
-
- public void onEntityCollidedWithBlock(World aWorld, int aX, int aY, int aZ, Entity collider) {
- TileEntity tTileEntity = aWorld.getTileEntity(aX, aY, aZ);
- if (((tTileEntity instanceof IGregTechTileEntity)) && (((IGregTechTileEntity) tTileEntity).getMetaTileEntity() != null)) {
- ((IGregTechTileEntity) tTileEntity).onEntityCollidedWithBlock(aWorld, aX, aY, aZ, collider);
- return;
- }
- super.onEntityCollidedWithBlock(aWorld, aX, aY, aZ, collider);
- }
-
- @SideOnly(Side.CLIENT)
- public void registerBlockIcons(IIconRegister aIconRegister) {
- if (GregTech_API.sPostloadFinished) {
- GT_Log.out.println("GT_Mod: Setting up Icon Register for Blocks");
- GregTech_API.sBlockIcons = aIconRegister;
-
- GT_Log.out.println("GT_Mod: Registering MetaTileEntity specific Textures");
- try {
- for (IMetaTileEntity tMetaTileEntity : GregTech_API.METATILEENTITIES) {
- if (tMetaTileEntity != null) {
- tMetaTileEntity.registerIcons(aIconRegister);
- }
- }
- } catch (Throwable e) {e.printStackTrace(GT_Log.err);}
- GT_Log.out.println("GT_Mod: Registering Crop specific Textures");
- try {
- for (GT_BaseCrop tCrop : GT_BaseCrop.sCropList) {
- tCrop.registerSprites(aIconRegister);
- }
- } catch (Throwable e) {
- e.printStackTrace(GT_Log.err);
- }
- GT_Log.out.println("GT_Mod: Starting Block Icon Load Phase");
- GT_FML_LOGGER.info("GT_Mod: Starting Block Icon Load Phase");
- try {
- for (Runnable tRunnable : GregTech_API.sGTBlockIconload) {
- tRunnable.run();
- }
- } catch (Throwable e) {e.printStackTrace(GT_Log.err);}
- GT_Log.out.println("GT_Mod: Finished Block Icon Load Phase");
- GT_FML_LOGGER.info("GT_Mod: Finished Block Icon Load Phase");
- }
- }
-
- public float getBlockHardness(World aWorld, int aX, int aY, int aZ) {
- return super.getBlockHardness(aWorld, aX, aY, aZ);
- }
-
- public float getPlayerRelativeBlockHardness(EntityPlayer aPlayer, World aWorld, int aX, int aY, int aZ) {
- TileEntity tTileEntity = aWorld.getTileEntity(aX, aY, aZ);
- if (((tTileEntity instanceof BaseMetaTileEntity)) && (((BaseMetaTileEntity) tTileEntity).privateAccess()) && (!((BaseMetaTileEntity) tTileEntity).playerOwnsThis(aPlayer, true))) {
- return -1.0F;
- }
- return super.getPlayerRelativeBlockHardness(aPlayer, aWorld, aX, aY, aZ);
- }
-
- public boolean onBlockActivated(World aWorld, int aX, int aY, int aZ, EntityPlayer aPlayer, int aSide, float par1, float par2, float par3) {
- TileEntity tTileEntity = aWorld.getTileEntity(aX, aY, aZ);
- if (tTileEntity == null) {
- return false;
- }
- if(aPlayer.isSneaking()){
- ItemStack tCurrentItem = aPlayer.inventory.getCurrentItem();
- if(tCurrentItem!=null){
- if(!GT_Utility.isStackInList(tCurrentItem, GregTech_API.sScrewdriverList) && !GT_Utility.isStackInList(tCurrentItem, GregTech_API.sWrenchList) && !GT_Utility.isStackInList(tCurrentItem, GregTech_API.sWireCutterList) && !GT_Utility.isStackInList(tCurrentItem, GregTech_API.sSolderingToolList)){
- return false;
- }
- }else {return false;}
- }
- if ((tTileEntity instanceof IGregTechTileEntity)) {
- if (((IGregTechTileEntity) tTileEntity).getTimer() < 50L) {
- return false;
- }
- if ((!aWorld.isRemote) && (!((IGregTechTileEntity) tTileEntity).isUseableByPlayer(aPlayer))) {
- return true;
- }
- return ((IGregTechTileEntity) tTileEntity).onRightclick(aPlayer, (byte) aSide, par1, par2, par3);
- }
- return false;
- }
-
- public void onBlockClicked(World aWorld, int aX, int aY, int aZ, EntityPlayer aPlayer) {
- TileEntity tTileEntity = aWorld.getTileEntity(aX, aY, aZ);
- if (((tTileEntity instanceof IGregTechTileEntity))) {
- ((IGregTechTileEntity) tTileEntity).onLeftclick(aPlayer);
- }
- }
-
- public int getDamageValue(World aWorld, int aX, int aY, int aZ) {
- TileEntity tTileEntity = aWorld.getTileEntity(aX, aY, aZ);
- if ((tTileEntity instanceof IGregTechTileEntity)) {
- return ((IGregTechTileEntity) tTileEntity).getMetaTileID();
- }
- return 0;
- }
-
- public void onBlockExploded(World aWorld, int aX, int aY, int aZ, Explosion aExplosion) {
- TileEntity tTileEntity = aWorld.getTileEntity(aX, aY, aZ);
- if ((tTileEntity instanceof BaseMetaTileEntity)) {
- GT_Log.exp.println("Explosion at :"+aX + " | " + aY+ " | " + aZ +" DIMID: " + aWorld.provider.dimensionId+ " due to near explosion!");
- ((BaseMetaTileEntity) tTileEntity).doEnergyExplosion();
- }
- super.onBlockExploded(aWorld, aX, aY, aZ, aExplosion);
- }
-
- public void breakBlock(World aWorld, int aX, int aY, int aZ, Block par5, int par6) {
- GregTech_API.causeMachineUpdate(aWorld, aX, aY, aZ);
- TileEntity tTileEntity = aWorld.getTileEntity(aX, aY, aZ);
- if ((tTileEntity instanceof IGregTechTileEntity)) {
- IGregTechTileEntity tGregTechTileEntity = (IGregTechTileEntity) tTileEntity;
- mTemporaryTileEntity.set(tGregTechTileEntity);
- for (int i = 0; i < tGregTechTileEntity.getSizeInventory(); i++) {
- ItemStack tItem = tGregTechTileEntity.getStackInSlot(i);
- if ((tItem != null) && (tItem.stackSize > 0) && (tGregTechTileEntity.isValidSlot(i))) {
- EntityItem tItemEntity = new EntityItem(aWorld, aX + XSTR_INSTANCE.nextFloat() * 0.8F + 0.1F, aY + XSTR_INSTANCE.nextFloat() * 0.8F + 0.1F, aZ + XSTR_INSTANCE.nextFloat() * 0.8F + 0.1F, new ItemStack(tItem.getItem(), tItem.stackSize, tItem.getItemDamage()));
- if (tItem.hasTagCompound()) {
- tItemEntity.getEntityItem().setTagCompound((NBTTagCompound) tItem.getTagCompound().copy());
- }
- tItemEntity.motionX = (XSTR_INSTANCE.nextGaussian() * 0.0500000007450581D);
- tItemEntity.motionY = (XSTR_INSTANCE.nextGaussian() * 0.0500000007450581D + 0.2000000029802322D);
- tItemEntity.motionZ = (XSTR_INSTANCE.nextGaussian() * 0.0500000007450581D);
- aWorld.spawnEntityInWorld(tItemEntity);
- tItem.stackSize = 0;
- tGregTechTileEntity.setInventorySlotContents(i, null);
- }
- }
- }
- 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 IGregTechTileEntity)) {
- return ((IGregTechTileEntity) tTileEntity).getDrops();
- }
- return mTemporaryTileEntity.get() == null ? new ArrayList() : ((IGregTechTileEntity) mTemporaryTileEntity.get()).getDrops();
- }
- @Override
- public boolean removedByPlayer(World aWorld, EntityPlayer aPlayer, int aX, int aY, int aZ, boolean aWillHarvest) {
- if (aWillHarvest) {
- return true; // This delays deletion of the block until after getDrops
- } else {
- return super.removedByPlayer(aWorld, aPlayer, aX, aY, aZ, false);
- }
- }
-
- @Override
- public void harvestBlock(World aWorld, EntityPlayer aPlayer, int aX, int aY, int aZ, int aMeta)
- {
- super.harvestBlock(aWorld, aPlayer, aX, aY, aZ, aMeta);
- aWorld.setBlockToAir(aX, aY, aZ);
- }
-
- public int getComparatorInputOverride(World aWorld, int aX, int aY, int aZ, int aSide) {
- TileEntity tTileEntity = aWorld.getTileEntity(aX, aY, aZ);
- if (((tTileEntity instanceof IGregTechTileEntity))) {
- return ((IGregTechTileEntity) tTileEntity).getComparatorValue((byte) aSide);
- }
- return 0;
- }
-
- public int isProvidingWeakPower(IBlockAccess aWorld, int aX, int aY, int aZ, int aSide) {
- if ((aSide < 0) || (aSide > 5)) {
- return 0;
- }
- TileEntity tTileEntity = aWorld.getTileEntity(aX, aY, aZ);
- if (((tTileEntity instanceof IGregTechTileEntity))) {
- return ((IGregTechTileEntity) tTileEntity).getOutputRedstoneSignal(GT_Utility.getOppositeSide(aSide));
- }
- return 0;
- }
-
- public int isProvidingStrongPower(IBlockAccess aWorld, int aX, int aY, int aZ, int aSide) {
- if ((aSide < 0) || (aSide > 5)) {
- return 0;
- }
- TileEntity tTileEntity = aWorld.getTileEntity(aX, aY, aZ);
- if (((tTileEntity instanceof IGregTechTileEntity))) {
- return ((IGregTechTileEntity) tTileEntity).getStrongOutputRedstoneSignal(GT_Utility.getOppositeSide(aSide));
- }
- return 0;
- }
-
- public void dropBlockAsItemWithChance(World aWorld, int aX, int aY, int aZ, int par5, float chance, int par7) {
- if (!aWorld.isRemote) {
- TileEntity tTileEntity = aWorld.getTileEntity(aX, aY, aZ);
- if ((tTileEntity != null) && (chance < 1.0F)) {
- if (((tTileEntity instanceof BaseMetaTileEntity)) && (GregTech_API.sMachineNonWrenchExplosions)) {
- GT_Log.exp.println("Explosion at :"+aX + " | " + aY+ " | " + aZ +" DIMID: "+ aWorld.provider.dimensionId+ " due to NonWrench picking/Rain!");
- ((BaseMetaTileEntity) tTileEntity).doEnergyExplosion();
- }
- } else {
- super.dropBlockAsItemWithChance(aWorld, aX, aY, aZ, par5, chance, par7);
- }
- }
- }
-
- public boolean isSideSolid(IBlockAccess aWorld, int aX, int aY, int aZ, ForgeDirection aSide) {
- if (aWorld.getBlockMetadata(aX, aY, aZ) == 0) {
- return true;
- }
- TileEntity tTileEntity = aWorld.getTileEntity(aX, aY, aZ);
- if (tTileEntity != null) {
- if ((tTileEntity instanceof BaseMetaTileEntity)) {
- return true;
- }
- if (((tTileEntity instanceof BaseMetaPipeEntity)) && ((((BaseMetaPipeEntity) tTileEntity).mConnections & 0xFFFFFFC0) != 0)) {
- return true;
- }
- if (((tTileEntity instanceof ICoverable)) && (((ICoverable) tTileEntity).getCoverIDAtSide((byte) aSide.ordinal()) != 0)) {
- return true;
- }
- }
- return false;
- }
-
- public int getLightOpacity(IBlockAccess aWorld, int aX, int aY, int aZ) {
- TileEntity tTileEntity = aWorld.getTileEntity(aX, aY, aZ);
- if (tTileEntity == null) {
- return 0;
- }
- if ((tTileEntity instanceof IGregTechTileEntity)) {
- return ((IGregTechTileEntity) tTileEntity).getLightOpacity();
- }
- return aWorld.getBlockMetadata(aX, aY, aZ) == 0 ? 255 : 0;
- }
-
- public int getLightValue(IBlockAccess aWorld, int aX, int aY, int aZ) {
- TileEntity tTileEntity = aWorld.getTileEntity(aX, aY, aZ);
- if ((tTileEntity instanceof BaseMetaTileEntity)) {
- return ((BaseMetaTileEntity) tTileEntity).getLightValue();
- }
- return 0;
- }
-
- public TileEntity createTileEntity(World aWorld, int aMeta) {
- if (aMeta < 4) {
- return GregTech_API.constructBaseMetaTileEntity();
- }
- return new BaseMetaPipeEntity();
- }
-
- public float getExplosionResistance(Entity par1Entity, World aWorld, int aX, int aY, int aZ, double explosionX, double explosionY, double explosionZ) {
- TileEntity tTileEntity = aWorld.getTileEntity(aX, aY, aZ);
- if (((tTileEntity instanceof IGregTechTileEntity))) {
- return ((IGregTechTileEntity) tTileEntity).getBlastResistance((byte) 6);
- }
- return 10.0F;
- }
-
- @SideOnly(Side.CLIENT)
- public void getSubBlocks(Item par1, CreativeTabs par2CreativeTabs, List par3List) {
- for (int i = 1; i < GregTech_API.METATILEENTITIES.length; i++) {
- if (GregTech_API.METATILEENTITIES[i] != null) {
- par3List.add(new ItemStack(par1, 1, i));
- }
- }
- }
-
- public void onBlockPlacedBy(World aWorld, int aX, int aY, int aZ, EntityLivingBase aPlayer, ItemStack aStack) {
- TileEntity tTileEntity = aWorld.getTileEntity(aX, aY, aZ);
- if (tTileEntity == null) {
- return;
- }
- if ((tTileEntity instanceof IGregTechTileEntity)) {
- IGregTechTileEntity var6 = (IGregTechTileEntity) tTileEntity;
- if (aPlayer == null) {
- var6.setFrontFacing((byte) 1);
- } else {
- int var7 = MathHelper.floor_double(aPlayer.rotationYaw * 4.0F / 360.0F + 0.5D) & 0x3;
- int var8 = Math.round(aPlayer.rotationPitch);
- if ((var8 >= 65) && (var6.isValidFacing((byte) 1))) {
- var6.setFrontFacing((byte) 1);
- } else if ((var8 <= -65) && (var6.isValidFacing((byte) 0))) {
- var6.setFrontFacing((byte) 0);
- } else {
- switch (var7) {
- case 0:
- var6.setFrontFacing((byte) 2);
- break;
- case 1:
- var6.setFrontFacing((byte) 5);
- break;
- case 2:
- var6.setFrontFacing((byte) 3);
- break;
- case 3:
- var6.setFrontFacing((byte) 4);
- }
- }
- }
- }
- }
-
- public ArrayList<String> getDebugInfo(EntityPlayer aPlayer, int aX, int aY, int aZ, int aLogLevel) {
- TileEntity tTileEntity = aPlayer.worldObj.getTileEntity(aX, aY, aZ);
- if ((tTileEntity instanceof BaseMetaTileEntity)) {
- return ((BaseMetaTileEntity) tTileEntity).getDebugInfo(aPlayer, aLogLevel);
- }
- if ((tTileEntity instanceof BaseMetaPipeEntity)) {
- return ((BaseMetaPipeEntity) tTileEntity).getDebugInfo(aPlayer, aLogLevel);
- }
- return null;
- }
-
- public boolean recolourBlock(World aWorld, int aX, int aY, int aZ, ForgeDirection aSide, int aColor) {
- TileEntity tTileEntity = aWorld.getTileEntity(aX, aY, aZ);
- if ((tTileEntity instanceof IGregTechTileEntity)) {
- if (((IGregTechTileEntity) tTileEntity).getColorization() == (byte) ((aColor ^ 0xFFFFFFFF) & 0xF)) {
- return false;
- }
- ((IGregTechTileEntity) tTileEntity).setColorization((byte) ((aColor ^ 0xFFFFFFFF) & 0xF));
- return true;
- }
- return false;
- }
-}
+package gregtech.common.blocks;
+
+import cpw.mods.fml.relauncher.Side;
+import cpw.mods.fml.relauncher.SideOnly;
+import gregtech.api.GregTech_API;
+import gregtech.api.enums.Textures;
+import gregtech.api.interfaces.IDebugableBlock;
+import gregtech.api.interfaces.metatileentity.IMetaTileEntity;
+import gregtech.api.interfaces.tileentity.ICoverable;
+import gregtech.api.interfaces.tileentity.IGregTechTileEntity;
+import gregtech.api.items.GT_Generic_Block;
+import gregtech.api.metatileentity.BaseMetaPipeEntity;
+import gregtech.api.metatileentity.BaseMetaTileEntity;
+import gregtech.api.metatileentity.BaseTileEntity;
+import gregtech.api.util.GT_BaseCrop;
+import gregtech.api.util.GT_Log;
+import gregtech.api.util.GT_Utility;
+import gregtech.common.render.GT_Renderer_Block;
+import net.minecraft.block.Block;
+import net.minecraft.block.ITileEntityProvider;
+import net.minecraft.client.renderer.texture.IIconRegister;
+import net.minecraft.creativetab.CreativeTabs;
+import net.minecraft.entity.Entity;
+import net.minecraft.entity.EntityLivingBase;
+import net.minecraft.entity.EnumCreatureType;
+import net.minecraft.entity.item.EntityItem;
+import net.minecraft.entity.player.EntityPlayer;
+import net.minecraft.item.Item;
+import net.minecraft.item.ItemStack;
+import net.minecraft.nbt.NBTTagCompound;
+import net.minecraft.tileentity.TileEntity;
+import net.minecraft.util.AxisAlignedBB;
+import net.minecraft.util.IIcon;
+import net.minecraft.util.MathHelper;
+import net.minecraft.util.StatCollector;
+import net.minecraft.world.Explosion;
+import net.minecraft.world.IBlockAccess;
+import net.minecraft.world.World;
+import net.minecraftforge.common.util.ForgeDirection;
+
+import java.util.ArrayList;
+import java.util.List;
+
+import static gregtech.GT_Mod.GT_FML_LOGGER;
+import static gregtech.api.objects.XSTR.XSTR_INSTANCE;
+
+public class GT_Block_Machines
+ extends GT_Generic_Block
+ implements IDebugableBlock, ITileEntityProvider {
+ public static ThreadLocal<IGregTechTileEntity> mTemporaryTileEntity = new ThreadLocal();
+
+ public GT_Block_Machines() {
+ super(GT_Item_Machines.class, "gt.blockmachines", new GT_Material_Machines());
+ GregTech_API.registerMachineBlock(this, -1);
+ setHardness(1.0F);
+ setResistance(10.0F);
+ setStepSound(soundTypeMetal);
+ setCreativeTab(GregTech_API.TAB_GREGTECH);
+ this.isBlockContainer = true;
+ }
+
+ public String getHarvestTool(int aMeta) {
+ if (aMeta >= 8 && aMeta <= 11) {
+ return "cutter";
+ }
+ return "wrench";
+ }
+
+ public int getHarvestLevel(int aMeta) {
+ return aMeta % 4;
+ }
+
+ protected boolean canSilkHarvest() {
+ return false;
+ }
+
+ public void onNeighborChange(IBlockAccess aWorld, int aX, int aY, int aZ, int aTileX, int aTileY, int aTileZ) {
+ TileEntity tTileEntity = aWorld.getTileEntity(aX, aY, aZ);
+ if ((tTileEntity instanceof BaseTileEntity)) {
+ ((BaseTileEntity) tTileEntity).onAdjacentBlockChange(aTileX, aTileY, aTileZ);
+ }
+ }
+
+ public void onNeighborBlockChange(World aWorld, int aX, int aY, int aZ, Block aBlock) {
+ TileEntity tTileEntity = aWorld.getTileEntity(aX, aY, aZ);
+ if ((tTileEntity instanceof BaseMetaPipeEntity)) {
+ ((BaseMetaPipeEntity) tTileEntity).onNeighborBlockChange(aX, aY, aZ);
+ }
+ }
+
+ public void onBlockAdded(World aWorld, int aX, int aY, int aZ) {
+ super.onBlockAdded(aWorld, aX, aY, aZ);
+ if (GregTech_API.isMachineBlock(this, aWorld.getBlockMetadata(aX, aY, aZ))) {
+ GregTech_API.causeMachineUpdate(aWorld, aX, aY, aZ);
+ }
+ }
+
+ public String getUnlocalizedName() {
+ return "gt.blockmachines";
+ }
+
+ public String getLocalizedName() {
+ return StatCollector.translateToLocal(getUnlocalizedName() + ".name");
+ }
+
+ public int getFlammability(IBlockAccess aWorld, int aX, int aY, int aZ, ForgeDirection face) {
+ return 0;
+ }
+
+ public int getFireSpreadSpeed(IBlockAccess aWorld, int aX, int aY, int aZ, ForgeDirection face) {
+ return (GregTech_API.sMachineFlammable) && (aWorld.getBlockMetadata(aX, aY, aZ) == 0) ? 100 : 0;
+ }
+
+ public int getRenderType() {
+ if (GT_Renderer_Block.INSTANCE == null) {
+ return super.getRenderType();
+ }
+ return GT_Renderer_Block.INSTANCE.mRenderID;
+ }
+
+ public boolean isFireSource(World aWorld, int aX, int aY, int aZ, ForgeDirection side) {
+ return (GregTech_API.sMachineFlammable) && (aWorld.getBlockMetadata(aX, aY, aZ) == 0);
+ }
+
+ public boolean isFlammable(IBlockAccess aWorld, int aX, int aY, int aZ, ForgeDirection face) {
+ return (GregTech_API.sMachineFlammable) && (aWorld.getBlockMetadata(aX, aY, aZ) == 0);
+ }
+
+ public boolean canCreatureSpawn(EnumCreatureType type, IBlockAccess aWorld, int aX, int aY, int aZ) {
+ return false;
+ }
+
+ public boolean canConnectRedstone(IBlockAccess var1, int var2, int var3, int var4, int var5) {
+ return true;
+ }
+
+ 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 false;
+ }
+
+ public boolean hasTileEntity(int aMeta) {
+ return true;
+ }
+
+ public boolean hasComparatorInputOverride() {
+ return true;
+ }
+
+ public boolean renderAsNormalBlock() {
+ return false;
+ }
+
+ public boolean canProvidePower() {
+ return true;
+ }
+
+ public boolean isOpaqueCube() {
+ return false;
+ }
+
+ 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 Textures.BlockIcons.MACHINE_LV_SIDE.getIcon();
+ }
+
+ public IIcon getIcon(int aSide, int aMeta) {
+ return Textures.BlockIcons.MACHINE_LV_SIDE.getIcon();
+ }
+
+ public boolean onBlockEventReceived(World aWorld, int aX, int aY, int aZ, int aData1, int aData2) {
+ super.onBlockEventReceived(aWorld, aX, aY, aZ, aData1, aData2);
+ TileEntity tTileEntity = aWorld.getTileEntity(aX, aY, aZ);
+ return tTileEntity != null ? tTileEntity.receiveClientEvent(aData1, aData2) : false;
+ }
+
+ public void addCollisionBoxesToList(World aWorld, int aX, int aY, int aZ, AxisAlignedBB inputAABB, List outputAABB, Entity collider) {
+ TileEntity tTileEntity = aWorld.getTileEntity(aX, aY, aZ);
+ if (((tTileEntity instanceof IGregTechTileEntity)) && (((IGregTechTileEntity) tTileEntity).getMetaTileEntity() != null)) {
+ ((IGregTechTileEntity) tTileEntity).addCollisionBoxesToList(aWorld, aX, aY, aZ, inputAABB, outputAABB, collider);
+ return;
+ }
+ super.addCollisionBoxesToList(aWorld, aX, aY, aZ, inputAABB, outputAABB, collider);
+ }
+
+ public AxisAlignedBB getCollisionBoundingBoxFromPool(World aWorld, int aX, int aY, int aZ) {
+ TileEntity tTileEntity = aWorld.getTileEntity(aX, aY, aZ);
+ if (((tTileEntity instanceof IGregTechTileEntity)) && (((IGregTechTileEntity) tTileEntity).getMetaTileEntity() != null)) {
+ return ((IGregTechTileEntity) tTileEntity).getCollisionBoundingBoxFromPool(aWorld, aX, aY, aZ);
+ }
+ return super.getCollisionBoundingBoxFromPool(aWorld, aX, aY, aZ);
+ }
+
+ @Override
+ @SideOnly(Side.CLIENT)
+ public AxisAlignedBB getSelectedBoundingBoxFromPool(World aWorld, int aX, int aY, int aZ)
+ {
+ TileEntity tTileEntity = aWorld.getTileEntity(aX, aY, aZ);
+ if (((tTileEntity instanceof IGregTechTileEntity)) && (((IGregTechTileEntity) tTileEntity).getMetaTileEntity() != null)) {
+ return ((IGregTechTileEntity) tTileEntity).getCollisionBoundingBoxFromPool(aWorld, aX, aY, aZ);
+ }
+ return super.getSelectedBoundingBoxFromPool(aWorld, aX, aY, aZ);
+ }
+
+ @Override //THIS
+ public void setBlockBoundsBasedOnState(IBlockAccess blockAccess, int aX, int aY, int aZ) {
+ TileEntity tTileEntity = blockAccess.getTileEntity(aX, aY, aZ);
+ if (((tTileEntity instanceof IGregTechTileEntity)) && (((IGregTechTileEntity) tTileEntity).getMetaTileEntity() != null)) {
+ AxisAlignedBB bbb=((IGregTechTileEntity)tTileEntity).getCollisionBoundingBoxFromPool(((IGregTechTileEntity)tTileEntity).getWorld(), 0, 0, 0);
+ minX=bbb.minX;//This essentially sets block bounds
+ minY=bbb.minY;
+ minZ=bbb.minZ;
+ maxX=bbb.maxX;
+ maxY=bbb.maxY;
+ maxZ=bbb.maxZ;
+ return;
+ }
+ super.setBlockBoundsBasedOnState(blockAccess,aX,aY,aZ);
+ }
+
+ @Override
+ public void setBlockBoundsForItemRender() {
+ super.setBlockBounds(0,0,0,1,1,1);
+ }
+
+ public void onEntityCollidedWithBlock(World aWorld, int aX, int aY, int aZ, Entity collider) {
+ TileEntity tTileEntity = aWorld.getTileEntity(aX, aY, aZ);
+ if (((tTileEntity instanceof IGregTechTileEntity)) && (((IGregTechTileEntity) tTileEntity).getMetaTileEntity() != null)) {
+ ((IGregTechTileEntity) tTileEntity).onEntityCollidedWithBlock(aWorld, aX, aY, aZ, collider);
+ return;
+ }
+ super.onEntityCollidedWithBlock(aWorld, aX, aY, aZ, collider);
+ }
+
+ @SideOnly(Side.CLIENT)
+ public void registerBlockIcons(IIconRegister aIconRegister) {
+ if (GregTech_API.sPostloadFinished) {
+ GT_Log.out.println("GT_Mod: Setting up Icon Register for Blocks");
+ GregTech_API.sBlockIcons = aIconRegister;
+
+ GT_Log.out.println("GT_Mod: Registering MetaTileEntity specific Textures");
+ try {
+ for (IMetaTileEntity tMetaTileEntity : GregTech_API.METATILEENTITIES) {
+ if (tMetaTileEntity != null) {
+ tMetaTileEntity.registerIcons(aIconRegister);
+ }
+ }
+ } catch (Throwable e) {e.printStackTrace(GT_Log.err);}
+ GT_Log.out.println("GT_Mod: Registering Crop specific Textures");
+ try {
+ for (GT_BaseCrop tCrop : GT_BaseCrop.sCropList) {
+ tCrop.registerSprites(aIconRegister);
+ }
+ } catch (Throwable e) {
+ e.printStackTrace(GT_Log.err);
+ }
+ GT_Log.out.println("GT_Mod: Starting Block Icon Load Phase");
+ GT_FML_LOGGER.info("GT_Mod: Starting Block Icon Load Phase");
+ try {
+ for (Runnable tRunnable : GregTech_API.sGTBlockIconload) {
+ tRunnable.run();
+ }
+ } catch (Throwable e) {e.printStackTrace(GT_Log.err);}
+ GT_Log.out.println("GT_Mod: Finished Block Icon Load Phase");
+ GT_FML_LOGGER.info("GT_Mod: Finished Block Icon Load Phase");
+ }
+ }
+
+ public float getBlockHardness(World aWorld, int aX, int aY, int aZ) {
+ return super.getBlockHardness(aWorld, aX, aY, aZ);
+ }
+
+ public float getPlayerRelativeBlockHardness(EntityPlayer aPlayer, World aWorld, int aX, int aY, int aZ) {
+ TileEntity tTileEntity = aWorld.getTileEntity(aX, aY, aZ);
+ if (((tTileEntity instanceof BaseMetaTileEntity)) && (((BaseMetaTileEntity) tTileEntity).privateAccess()) && (!((BaseMetaTileEntity) tTileEntity).playerOwnsThis(aPlayer, true))) {
+ return -1.0F;
+ }
+ return super.getPlayerRelativeBlockHardness(aPlayer, aWorld, aX, aY, aZ);
+ }
+
+ public boolean onBlockActivated(World aWorld, int aX, int aY, int aZ, EntityPlayer aPlayer, int aSide, float par1, float par2, float par3) {
+ TileEntity tTileEntity = aWorld.getTileEntity(aX, aY, aZ);
+ if (tTileEntity == null) {
+ return false;
+ }
+ if(aPlayer.isSneaking()){
+ ItemStack tCurrentItem = aPlayer.inventory.getCurrentItem();
+ if(tCurrentItem!=null){
+ if(!GT_Utility.isStackInList(tCurrentItem, GregTech_API.sScrewdriverList) && !GT_Utility.isStackInList(tCurrentItem, GregTech_API.sWrenchList) && !GT_Utility.isStackInList(tCurrentItem, GregTech_API.sWireCutterList) && !GT_Utility.isStackInList(tCurrentItem, GregTech_API.sSolderingToolList)){
+ return false;
+ }
+ }else {return false;}
+ }
+ if ((tTileEntity instanceof IGregTechTileEntity)) {
+ if (((IGregTechTileEntity) tTileEntity).getTimer() < 50L) {
+ return false;
+ }
+ if ((!aWorld.isRemote) && (!((IGregTechTileEntity) tTileEntity).isUseableByPlayer(aPlayer))) {
+ return true;
+ }
+ return ((IGregTechTileEntity) tTileEntity).onRightclick(aPlayer, (byte) aSide, par1, par2, par3);
+ }
+ return false;
+ }
+
+ public void onBlockClicked(World aWorld, int aX, int aY, int aZ, EntityPlayer aPlayer) {
+ TileEntity tTileEntity = aWorld.getTileEntity(aX, aY, aZ);
+ if (((tTileEntity instanceof IGregTechTileEntity))) {
+ ((IGregTechTileEntity) tTileEntity).onLeftclick(aPlayer);
+ }
+ }
+
+ public int getDamageValue(World aWorld, int aX, int aY, int aZ) {
+ TileEntity tTileEntity = aWorld.getTileEntity(aX, aY, aZ);
+ if ((tTileEntity instanceof IGregTechTileEntity)) {
+ return ((IGregTechTileEntity) tTileEntity).getMetaTileID();
+ }
+ return 0;
+ }
+
+ public void onBlockExploded(World aWorld, int aX, int aY, int aZ, Explosion aExplosion) {
+ TileEntity tTileEntity = aWorld.getTileEntity(aX, aY, aZ);
+ if ((tTileEntity instanceof BaseMetaTileEntity)) {
+ GT_Log.exp.println("Explosion at :"+aX + " | " + aY+ " | " + aZ +" DIMID: " + aWorld.provider.dimensionId+ " due to near explosion!");
+ ((BaseMetaTileEntity) tTileEntity).doEnergyExplosion();
+ }
+ super.onBlockExploded(aWorld, aX, aY, aZ, aExplosion);
+ }
+
+ public void breakBlock(World aWorld, int aX, int aY, int aZ, Block par5, int par6) {
+ GregTech_API.causeMachineUpdate(aWorld, aX, aY, aZ);
+ TileEntity tTileEntity = aWorld.getTileEntity(aX, aY, aZ);
+ if ((tTileEntity instanceof IGregTechTileEntity)) {
+ IGregTechTileEntity tGregTechTileEntity = (IGregTechTileEntity) tTileEntity;
+ mTemporaryTileEntity.set(tGregTechTileEntity);
+ for (int i = 0; i < tGregTechTileEntity.getSizeInventory(); i++) {
+ ItemStack tItem = tGregTechTileEntity.getStackInSlot(i);
+ if ((tItem != null) && (tItem.stackSize > 0) && (tGregTechTileEntity.isValidSlot(i))) {
+ EntityItem tItemEntity = new EntityItem(aWorld, aX + XSTR_INSTANCE.nextFloat() * 0.8F + 0.1F, aY + XSTR_INSTANCE.nextFloat() * 0.8F + 0.1F, aZ + XSTR_INSTANCE.nextFloat() * 0.8F + 0.1F, new ItemStack(tItem.getItem(), tItem.stackSize, tItem.getItemDamage()));
+ if (tItem.hasTagCompound()) {
+ tItemEntity.getEntityItem().setTagCompound((NBTTagCompound) tItem.getTagCompound().copy());
+ }
+ tItemEntity.motionX = (XSTR_INSTANCE.nextGaussian() * 0.0500000007450581D);
+ tItemEntity.motionY = (XSTR_INSTANCE.nextGaussian() * 0.0500000007450581D + 0.2000000029802322D);
+ tItemEntity.motionZ = (XSTR_INSTANCE.nextGaussian() * 0.0500000007450581D);
+ aWorld.spawnEntityInWorld(tItemEntity);
+ tItem.stackSize = 0;
+ tGregTechTileEntity.setInventorySlotContents(i, null);
+ }
+ }
+ }
+ 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 IGregTechTileEntity)) {
+ return ((IGregTechTileEntity) tTileEntity).getDrops();
+ }
+ return mTemporaryTileEntity.get() == null ? new ArrayList() : ((IGregTechTileEntity) mTemporaryTileEntity.get()).getDrops();
+ }
+ @Override
+ public boolean removedByPlayer(World aWorld, EntityPlayer aPlayer, int aX, int aY, int aZ, boolean aWillHarvest) {
+ if (aWillHarvest) {
+ return true; // This delays deletion of the block until after getDrops
+ } else {
+ return super.removedByPlayer(aWorld, aPlayer, aX, aY, aZ, false);
+ }
+ }
+
+ @Override
+ public void harvestBlock(World aWorld, EntityPlayer aPlayer, int aX, int aY, int aZ, int aMeta)
+ {
+ super.harvestBlock(aWorld, aPlayer, aX, aY, aZ, aMeta);
+ aWorld.setBlockToAir(aX, aY, aZ);
+ }
+
+ public int getComparatorInputOverride(World aWorld, int aX, int aY, int aZ, int aSide) {
+ TileEntity tTileEntity = aWorld.getTileEntity(aX, aY, aZ);
+ if (((tTileEntity instanceof IGregTechTileEntity))) {
+ return ((IGregTechTileEntity) tTileEntity).getComparatorValue((byte) aSide);
+ }
+ return 0;
+ }
+
+ public int isProvidingWeakPower(IBlockAccess aWorld, int aX, int aY, int aZ, int aSide) {
+ if ((aSide < 0) || (aSide > 5)) {
+ return 0;
+ }
+ TileEntity tTileEntity = aWorld.getTileEntity(aX, aY, aZ);
+ if (((tTileEntity instanceof IGregTechTileEntity))) {
+ return ((IGregTechTileEntity) tTileEntity).getOutputRedstoneSignal(GT_Utility.getOppositeSide(aSide));
+ }
+ return 0;
+ }
+
+ public int isProvidingStrongPower(IBlockAccess aWorld, int aX, int aY, int aZ, int aSide) {
+ if ((aSide < 0) || (aSide > 5)) {
+ return 0;
+ }
+ TileEntity tTileEntity = aWorld.getTileEntity(aX, aY, aZ);
+ if (((tTileEntity instanceof IGregTechTileEntity))) {
+ return ((IGregTechTileEntity) tTileEntity).getStrongOutputRedstoneSignal(GT_Utility.getOppositeSide(aSide));
+ }
+ return 0;
+ }
+
+ public void dropBlockAsItemWithChance(World aWorld, int aX, int aY, int aZ, int par5, float chance, int par7) {
+ if (!aWorld.isRemote) {
+ TileEntity tTileEntity = aWorld.getTileEntity(aX, aY, aZ);
+ if ((tTileEntity != null) && (chance < 1.0F)) {
+ if (((tTileEntity instanceof BaseMetaTileEntity)) && (GregTech_API.sMachineNonWrenchExplosions)) {
+ GT_Log.exp.println("Explosion at :"+aX + " | " + aY+ " | " + aZ +" DIMID: "+ aWorld.provider.dimensionId+ " due to NonWrench picking/Rain!");
+ ((BaseMetaTileEntity) tTileEntity).doEnergyExplosion();
+ }
+ } else {
+ super.dropBlockAsItemWithChance(aWorld, aX, aY, aZ, par5, chance, par7);
+ }
+ }
+ }
+
+ public boolean isSideSolid(IBlockAccess aWorld, int aX, int aY, int aZ, ForgeDirection aSide) {
+ if (aWorld.getBlockMetadata(aX, aY, aZ) == 0) {
+ return true;
+ }
+ TileEntity tTileEntity = aWorld.getTileEntity(aX, aY, aZ);
+ if (tTileEntity != null) {
+ if ((tTileEntity instanceof BaseMetaTileEntity)) {
+ return true;
+ }
+ if (((tTileEntity instanceof BaseMetaPipeEntity)) && ((((BaseMetaPipeEntity) tTileEntity).mConnections & 0xFFFFFFC0) != 0)) {
+ return true;
+ }
+ if (((tTileEntity instanceof ICoverable)) && (((ICoverable) tTileEntity).getCoverIDAtSide((byte) aSide.ordinal()) != 0)) {
+ return true;
+ }
+ }
+ return false;
+ }
+
+ public int getLightOpacity(IBlockAccess aWorld, int aX, int aY, int aZ) {
+ TileEntity tTileEntity = aWorld.getTileEntity(aX, aY, aZ);
+ if (tTileEntity == null) {
+ return 0;
+ }
+ if ((tTileEntity instanceof IGregTechTileEntity)) {
+ return ((IGregTechTileEntity) tTileEntity).getLightOpacity();
+ }
+ return aWorld.getBlockMetadata(aX, aY, aZ) == 0 ? 255 : 0;
+ }
+
+ public int getLightValue(IBlockAccess aWorld, int aX, int aY, int aZ) {
+ TileEntity tTileEntity = aWorld.getTileEntity(aX, aY, aZ);
+ if ((tTileEntity instanceof BaseMetaTileEntity)) {
+ return ((BaseMetaTileEntity) tTileEntity).getLightValue();
+ }
+ return 0;
+ }
+
+ public TileEntity createTileEntity(World aWorld, int aMeta) {
+ if (aMeta < 4) {
+ return GregTech_API.constructBaseMetaTileEntity();
+ }
+ return new BaseMetaPipeEntity();
+ }
+
+ public float getExplosionResistance(Entity par1Entity, World aWorld, int aX, int aY, int aZ, double explosionX, double explosionY, double explosionZ) {
+ TileEntity tTileEntity = aWorld.getTileEntity(aX, aY, aZ);
+ if (((tTileEntity instanceof IGregTechTileEntity))) {
+ return ((IGregTechTileEntity) tTileEntity).getBlastResistance((byte) 6);
+ }
+ return 10.0F;
+ }
+
+ @SideOnly(Side.CLIENT)
+ public void getSubBlocks(Item par1, CreativeTabs par2CreativeTabs, List par3List) {
+ for (int i = 1; i < GregTech_API.METATILEENTITIES.length; i++) {
+ if (GregTech_API.METATILEENTITIES[i] != null) {
+ par3List.add(new ItemStack(par1, 1, i));
+ }
+ }
+ }
+
+ public void onBlockPlacedBy(World aWorld, int aX, int aY, int aZ, EntityLivingBase aPlayer, ItemStack aStack) {
+ TileEntity tTileEntity = aWorld.getTileEntity(aX, aY, aZ);
+ if (tTileEntity == null) {
+ return;
+ }
+ if ((tTileEntity instanceof IGregTechTileEntity)) {
+ IGregTechTileEntity var6 = (IGregTechTileEntity) tTileEntity;
+ if (aPlayer == null) {
+ var6.setFrontFacing((byte) 1);
+ } else {
+ int var7 = MathHelper.floor_double(aPlayer.rotationYaw * 4.0F / 360.0F + 0.5D) & 0x3;
+ int var8 = Math.round(aPlayer.rotationPitch);
+ if ((var8 >= 65) && (var6.isValidFacing((byte) 1))) {
+ var6.setFrontFacing((byte) 1);
+ } else if ((var8 <= -65) && (var6.isValidFacing((byte) 0))) {
+ var6.setFrontFacing((byte) 0);
+ } else {
+ switch (var7) {
+ case 0:
+ var6.setFrontFacing((byte) 2);
+ break;
+ case 1:
+ var6.setFrontFacing((byte) 5);
+ break;
+ case 2:
+ var6.setFrontFacing((byte) 3);
+ break;
+ case 3:
+ var6.setFrontFacing((byte) 4);
+ }
+ }
+ }
+ }
+ }
+
+ public ArrayList<String> getDebugInfo(EntityPlayer aPlayer, int aX, int aY, int aZ, int aLogLevel) {
+ TileEntity tTileEntity = aPlayer.worldObj.getTileEntity(aX, aY, aZ);
+ if ((tTileEntity instanceof BaseMetaTileEntity)) {
+ return ((BaseMetaTileEntity) tTileEntity).getDebugInfo(aPlayer, aLogLevel);
+ }
+ if ((tTileEntity instanceof BaseMetaPipeEntity)) {
+ return ((BaseMetaPipeEntity) tTileEntity).getDebugInfo(aPlayer, aLogLevel);
+ }
+ return null;
+ }
+
+ public boolean recolourBlock(World aWorld, int aX, int aY, int aZ, ForgeDirection aSide, int aColor) {
+ TileEntity tTileEntity = aWorld.getTileEntity(aX, aY, aZ);
+ if ((tTileEntity instanceof IGregTechTileEntity)) {
+ if (((IGregTechTileEntity) tTileEntity).getColorization() == (byte) ((aColor ^ 0xFFFFFFFF) & 0xF)) {
+ return false;
+ }
+ ((IGregTechTileEntity) tTileEntity).setColorization((byte) ((aColor ^ 0xFFFFFFFF) & 0xF));
+ return true;
+ }
+ return false;
+ }
+}
diff --git a/src/main/java/gregtech/common/blocks/GT_Block_Metal.java b/src/main/java/gregtech/common/blocks/GT_Block_Metal.java
index eb248dd95d..abcc92a795 100644
--- a/src/main/java/gregtech/common/blocks/GT_Block_Metal.java
+++ b/src/main/java/gregtech/common/blocks/GT_Block_Metal.java
@@ -1,43 +1,43 @@
-package gregtech.common.blocks;
-
-import cpw.mods.fml.common.Loader;
-import gregtech.api.enums.Materials;
-import gregtech.api.enums.OrePrefixes;
-import gregtech.api.interfaces.IIconContainer;
-import gregtech.api.util.GT_LanguageManager;
-import gregtech.api.util.GT_OreDictUnificator;
-import net.minecraft.block.material.Material;
-import net.minecraft.item.ItemStack;
-import net.minecraft.util.IIcon;
-
-public class GT_Block_Metal extends GT_Block_Storage {
- public Materials[] mMats;
- public OrePrefixes mPrefix;
- public IIconContainer[] mBlockIcons;
- public boolean mHideBlocks;
-
- public GT_Block_Metal(String aName, Materials[] aMats, OrePrefixes aPrefix, IIconContainer[] aBlockIcons) {
- super(GT_Item_Storage.class, aName, Material.iron);
- mMats = aMats;
- mPrefix = aPrefix;
- mBlockIcons = aBlockIcons;
- mHideBlocks = Loader.isModLoaded("NotEnoughItems");
-
- for (int i = 0; i < aMats.length; i++) {
- if (aMats[i].mMetaItemSubID > 0 && aMats[i].mHasParentMod) {
- GT_LanguageManager.addStringLocalization(getUnlocalizedName() + "." + i + ".name", "Block of " + (GT_LanguageManager.i18nPlaceholder ? "%material" : aMats[i].mDefaultLocalName));
- GT_OreDictUnificator.registerOre(aPrefix, aMats[i], new ItemStack(this, 1, i));
- }
- }
- if (aMats.length<16 && Loader.isModLoaded("NotEnoughItems")) {
- for (int i = aMats.length; i < 16; i++) codechicken.nei.api.API.hideItem(new ItemStack(this, 1, i));
- }
- }
-
- public IIcon getIcon(int aSide, int aMeta) {
- if ((aMeta >= 0) && (aMeta < 16) && aMeta < mMats.length) {
- return mBlockIcons[aMeta].getIcon();
- }
- return null;
- }
-}
+package gregtech.common.blocks;
+
+import cpw.mods.fml.common.Loader;
+import gregtech.api.enums.Materials;
+import gregtech.api.enums.OrePrefixes;
+import gregtech.api.interfaces.IIconContainer;
+import gregtech.api.util.GT_LanguageManager;
+import gregtech.api.util.GT_OreDictUnificator;
+import net.minecraft.block.material.Material;
+import net.minecraft.item.ItemStack;
+import net.minecraft.util.IIcon;
+
+public class GT_Block_Metal extends GT_Block_Storage {
+ public Materials[] mMats;
+ public OrePrefixes mPrefix;
+ public IIconContainer[] mBlockIcons;
+ public boolean mHideBlocks;
+
+ public GT_Block_Metal(String aName, Materials[] aMats, OrePrefixes aPrefix, IIconContainer[] aBlockIcons) {
+ super(GT_Item_Storage.class, aName, Material.iron);
+ mMats = aMats;
+ mPrefix = aPrefix;
+ mBlockIcons = aBlockIcons;
+ mHideBlocks = Loader.isModLoaded("NotEnoughItems");
+
+ for (int i = 0; i < aMats.length; i++) {
+ if (aMats[i].mMetaItemSubID > 0 && aMats[i].mHasParentMod) {
+ GT_LanguageManager.addStringLocalization(getUnlocalizedName() + "." + i + ".name", "Block of " + (GT_LanguageManager.i18nPlaceholder ? "%material" : aMats[i].mDefaultLocalName));
+ GT_OreDictUnificator.registerOre(aPrefix, aMats[i], new ItemStack(this, 1, i));
+ }
+ }
+ if (aMats.length<16 && Loader.isModLoaded("NotEnoughItems")) {
+ for (int i = aMats.length; i < 16; i++) codechicken.nei.api.API.hideItem(new ItemStack(this, 1, i));
+ }
+ }
+
+ public IIcon getIcon(int aSide, int aMeta) {
+ if ((aMeta >= 0) && (aMeta < 16) && aMeta < mMats.length) {
+ return mBlockIcons[aMeta].getIcon();
+ }
+ return null;
+ }
+}
diff --git a/src/main/java/gregtech/common/blocks/GT_Block_Ores_Abstract.java b/src/main/java/gregtech/common/blocks/GT_Block_Ores_Abstract.java
index 01749197a5..512136f1f8 100644
--- a/src/main/java/gregtech/common/blocks/GT_Block_Ores_Abstract.java
+++ b/src/main/java/gregtech/common/blocks/GT_Block_Ores_Abstract.java
@@ -1,277 +1,277 @@
-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.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.HashSet;
-import java.util.List;
-import java.util.Set;
-
-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;
- private final String aTextName = ".name";
- private final String aTextSmall = "Small ";
- public static Set aBlockedOres = new HashSet<Materials>();
-
- protected GT_Block_Ores_Abstract(String aUnlocalizedName, int aOreMetaCount, boolean aHideFirstMeta, 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;
- if(aOreMetaCount > 8 || aOreMetaCount < 0) aOreMetaCount = 8;
-
- 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) {
- for (int j = 0; j < aOreMetaCount; j++) {
- if (!this.getEnabledMetas()[j]) continue;
- GT_LanguageManager.addStringLocalization(getUnlocalizedName() + "." + (i + (j * 1000)) + aTextName, GT_LanguageManager.i18nPlaceholder ? getLocalizedNameFormat(GregTech_API.sGeneratedMaterials[i]) : getLocalizedName(GregTech_API.sGeneratedMaterials[i]));
- GT_LanguageManager.addStringLocalization(getUnlocalizedName() + "." + ((i + 16000) + (j * 1000)) + aTextName, aTextSmall + (GT_LanguageManager.i18nPlaceholder ? getLocalizedNameFormat(GregTech_API.sGeneratedMaterials[i]) : getLocalizedName(GregTech_API.sGeneratedMaterials[i])));
- if ((GregTech_API.sGeneratedMaterials[i].mTypes & 0x8) != 0 && !aBlockedOres.contains(GregTech_API.sGeneratedMaterials[i])) {
- GT_OreDictUnificator.registerOre(this.getProcessingPrefix()[j] != null ? this.getProcessingPrefix()[j].get(GregTech_API.sGeneratedMaterials[i]) : "", new ItemStack(this, 1, i + (j * 1000)));
- if (tHideOres) {
- if (!(j == 0 && !aHideFirstMeta)) {
- codechicken.nei.api.API.hideItem(new ItemStack(this, 1, i + (j * 1000)));
- }
- codechicken.nei.api.API.hideItem(new ItemStack(this, 1, (i + 16000) + (j * 1000)));
- }
- }
- }
- }
- }
- }
-
- public int getBaseBlockHarvestLevel(int aMeta) {
- return 0;
- }
-
- 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 getLocalizedNameFormat(Materials aMaterial) {
- switch (aMaterial.mName) {
- case "InfusedAir":
- case "InfusedDull":
- case "InfusedEarth":
- case "InfusedEntropy":
- case "InfusedFire":
- case "InfusedOrder":
- case "InfusedVis":
- case "InfusedWater":
- return "%material 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 "%material";
- default:
- return "%material" + OrePrefixes.ore.mLocalizedMaterialPost;
- }
- }
-
- public String getLocalizedName(Materials aMaterial) {
- return aMaterial.getDefaultLocalizedNameForItem(getLocalizedNameFormat(aMaterial));
- }
-
- 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 == 5 || aMeta == 6 ? 2 : 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() + aTextName);
- }
-
- 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 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 abstract OrePrefixes[] getProcessingPrefix(); //Must have 8 entries; an entry can be null to disable automatic recipes.
-
- public abstract boolean[] getEnabledMetas(); //Must have 8 entries.
-
- public abstract Block getDroppedBlock();
-
- public abstract Materials[] getDroppedDusts(); //Must have 8 entries; can be null.
-
- 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(getDroppedBlock(), aFortune);
- }
- return mTemporaryTileEntity.get() == null ? new ArrayList() : ((GT_TileEntity_Ores) mTemporaryTileEntity.get()).getDrops(getDroppedBlock(), aFortune);
- }
-
- public TileEntity createTileEntity(World aWorld, int aMeta) {
- return new GT_TileEntity_Ores();
- }
-
- public abstract ITexture[] getTextureSet(); //Must have 16 entries.
-
- @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];
- if ((tMaterial != null) && ((tMaterial.mTypes & 0x8) != 0)&& !aBlockedOres.contains(tMaterial)) {
- if (!(new ItemStack(aItem, 1, i).getDisplayName().contains(aTextName))) aList.add(new ItemStack(aItem, 1, i));
- if (!(new ItemStack(aItem, 1, i + 1000).getDisplayName().contains(aTextName))) aList.add(new ItemStack(aItem, 1, i + 1000));
- if (!(new ItemStack(aItem, 1, i + 2000).getDisplayName().contains(aTextName))) aList.add(new ItemStack(aItem, 1, i + 2000));
- if (!(new ItemStack(aItem, 1, i + 3000).getDisplayName().contains(aTextName))) aList.add(new ItemStack(aItem, 1, i + 3000));
- if (!(new ItemStack(aItem, 1, i + 4000).getDisplayName().contains(aTextName))) aList.add(new ItemStack(aItem, 1, i + 4000));
- if (!(new ItemStack(aItem, 1, i + 5000).getDisplayName().contains(aTextName))) aList.add(new ItemStack(aItem, 1, i + 5000));
- if (!(new ItemStack(aItem, 1, i + 6000).getDisplayName().contains(aTextName))) aList.add(new ItemStack(aItem, 1, i + 6000));
- if (!(new ItemStack(aItem, 1, i + 7000).getDisplayName().contains(aTextName))) aList.add(new ItemStack(aItem, 1, i + 7000));
- if (!(new ItemStack(aItem, 1, i + 16000).getDisplayName().contains(aTextName))) aList.add(new ItemStack(aItem, 1, i + 16000));
- if (!(new ItemStack(aItem, 1, i + 17000).getDisplayName().contains(aTextName))) aList.add(new ItemStack(aItem, 1, i + 17000));
- if (!(new ItemStack(aItem, 1, i + 18000).getDisplayName().contains(aTextName))) aList.add(new ItemStack(aItem, 1, i + 18000));
- if (!(new ItemStack(aItem, 1, i + 19000).getDisplayName().contains(aTextName))) aList.add(new ItemStack(aItem, 1, i + 19000));
- if (!(new ItemStack(aItem, 1, i + 20000).getDisplayName().contains(aTextName))) aList.add(new ItemStack(aItem, 1, i + 20000));
- if (!(new ItemStack(aItem, 1, i + 21000).getDisplayName().contains(aTextName))) aList.add(new ItemStack(aItem, 1, i + 21000));
- if (!(new ItemStack(aItem, 1, i + 22000).getDisplayName().contains(aTextName))) aList.add(new ItemStack(aItem, 1, i + 22000));
- if (!(new ItemStack(aItem, 1, i + 23000).getDisplayName().contains(aTextName))) aList.add(new ItemStack(aItem, 1, i + 23000));
- }
- }
- }
+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.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.HashSet;
+import java.util.List;
+import java.util.Set;
+
+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;
+ private final String aTextName = ".name";
+ private final String aTextSmall = "Small ";
+ public static Set aBlockedOres = new HashSet<Materials>();
+
+ protected GT_Block_Ores_Abstract(String aUnlocalizedName, int aOreMetaCount, boolean aHideFirstMeta, 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;
+ if(aOreMetaCount > 8 || aOreMetaCount < 0) aOreMetaCount = 8;
+
+ 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) {
+ for (int j = 0; j < aOreMetaCount; j++) {
+ if (!this.getEnabledMetas()[j]) continue;
+ GT_LanguageManager.addStringLocalization(getUnlocalizedName() + "." + (i + (j * 1000)) + aTextName, GT_LanguageManager.i18nPlaceholder ? getLocalizedNameFormat(GregTech_API.sGeneratedMaterials[i]) : getLocalizedName(GregTech_API.sGeneratedMaterials[i]));
+ GT_LanguageManager.addStringLocalization(getUnlocalizedName() + "." + ((i + 16000) + (j * 1000)) + aTextName, aTextSmall + (GT_LanguageManager.i18nPlaceholder ? getLocalizedNameFormat(GregTech_API.sGeneratedMaterials[i]) : getLocalizedName(GregTech_API.sGeneratedMaterials[i])));
+ if ((GregTech_API.sGeneratedMaterials[i].mTypes & 0x8) != 0 && !aBlockedOres.contains(GregTech_API.sGeneratedMaterials[i])) {
+ GT_OreDictUnificator.registerOre(this.getProcessingPrefix()[j] != null ? this.getProcessingPrefix()[j].get(GregTech_API.sGeneratedMaterials[i]) : "", new ItemStack(this, 1, i + (j * 1000)));
+ if (tHideOres) {
+ if (!(j == 0 && !aHideFirstMeta)) {
+ codechicken.nei.api.API.hideItem(new ItemStack(this, 1, i + (j * 1000)));
+ }
+ codechicken.nei.api.API.hideItem(new ItemStack(this, 1, (i + 16000) + (j * 1000)));
+ }
+ }
+ }
+ }
+ }
+ }
+
+ public int getBaseBlockHarvestLevel(int aMeta) {
+ return 0;
+ }
+
+ 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 getLocalizedNameFormat(Materials aMaterial) {
+ switch (aMaterial.mName) {
+ case "InfusedAir":
+ case "InfusedDull":
+ case "InfusedEarth":
+ case "InfusedEntropy":
+ case "InfusedFire":
+ case "InfusedOrder":
+ case "InfusedVis":
+ case "InfusedWater":
+ return "%material 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 "%material";
+ default:
+ return "%material" + OrePrefixes.ore.mLocalizedMaterialPost;
+ }
+ }
+
+ public String getLocalizedName(Materials aMaterial) {
+ return aMaterial.getDefaultLocalizedNameForItem(getLocalizedNameFormat(aMaterial));
+ }
+
+ 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 == 5 || aMeta == 6 ? 2 : 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() + aTextName);
+ }
+
+ 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 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 abstract OrePrefixes[] getProcessingPrefix(); //Must have 8 entries; an entry can be null to disable automatic recipes.
+
+ public abstract boolean[] getEnabledMetas(); //Must have 8 entries.
+
+ public abstract Block getDroppedBlock();
+
+ public abstract Materials[] getDroppedDusts(); //Must have 8 entries; can be null.
+
+ 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(getDroppedBlock(), aFortune);
+ }
+ return mTemporaryTileEntity.get() == null ? new ArrayList() : ((GT_TileEntity_Ores) mTemporaryTileEntity.get()).getDrops(getDroppedBlock(), aFortune);
+ }
+
+ public TileEntity createTileEntity(World aWorld, int aMeta) {
+ return new GT_TileEntity_Ores();
+ }
+
+ public abstract ITexture[] getTextureSet(); //Must have 16 entries.
+
+ @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];
+ if ((tMaterial != null) && ((tMaterial.mTypes & 0x8) != 0)&& !aBlockedOres.contains(tMaterial)) {
+ if (!(new ItemStack(aItem, 1, i).getDisplayName().contains(aTextName))) aList.add(new ItemStack(aItem, 1, i));
+ if (!(new ItemStack(aItem, 1, i + 1000).getDisplayName().contains(aTextName))) aList.add(new ItemStack(aItem, 1, i + 1000));
+ if (!(new ItemStack(aItem, 1, i + 2000).getDisplayName().contains(aTextName))) aList.add(new ItemStack(aItem, 1, i + 2000));
+ if (!(new ItemStack(aItem, 1, i + 3000).getDisplayName().contains(aTextName))) aList.add(new ItemStack(aItem, 1, i + 3000));
+ if (!(new ItemStack(aItem, 1, i + 4000).getDisplayName().contains(aTextName))) aList.add(new ItemStack(aItem, 1, i + 4000));
+ if (!(new ItemStack(aItem, 1, i + 5000).getDisplayName().contains(aTextName))) aList.add(new ItemStack(aItem, 1, i + 5000));
+ if (!(new ItemStack(aItem, 1, i + 6000).getDisplayName().contains(aTextName))) aList.add(new ItemStack(aItem, 1, i + 6000));
+ if (!(new ItemStack(aItem, 1, i + 7000).getDisplayName().contains(aTextName))) aList.add(new ItemStack(aItem, 1, i + 7000));
+ if (!(new ItemStack(aItem, 1, i + 16000).getDisplayName().contains(aTextName))) aList.add(new ItemStack(aItem, 1, i + 16000));
+ if (!(new ItemStack(aItem, 1, i + 17000).getDisplayName().contains(aTextName))) aList.add(new ItemStack(aItem, 1, i + 17000));
+ if (!(new ItemStack(aItem, 1, i + 18000).getDisplayName().contains(aTextName))) aList.add(new ItemStack(aItem, 1, i + 18000));
+ if (!(new ItemStack(aItem, 1, i + 19000).getDisplayName().contains(aTextName))) aList.add(new ItemStack(aItem, 1, i + 19000));
+ if (!(new ItemStack(aItem, 1, i + 20000).getDisplayName().contains(aTextName))) aList.add(new ItemStack(aItem, 1, i + 20000));
+ if (!(new ItemStack(aItem, 1, i + 21000).getDisplayName().contains(aTextName))) aList.add(new ItemStack(aItem, 1, i + 21000));
+ if (!(new ItemStack(aItem, 1, i + 22000).getDisplayName().contains(aTextName))) aList.add(new ItemStack(aItem, 1, i + 22000));
+ if (!(new ItemStack(aItem, 1, i + 23000).getDisplayName().contains(aTextName))) aList.add(new ItemStack(aItem, 1, i + 23000));
+ }
+ }
+ }
} \ No newline at end of file
diff --git a/src/main/java/gregtech/common/blocks/GT_Block_Stones_Abstract.java b/src/main/java/gregtech/common/blocks/GT_Block_Stones_Abstract.java
index 064f684168..c9c31dae54 100644
--- a/src/main/java/gregtech/common/blocks/GT_Block_Stones_Abstract.java
+++ b/src/main/java/gregtech/common/blocks/GT_Block_Stones_Abstract.java
@@ -1,150 +1,150 @@
-package gregtech.common.blocks;
-
-import cpw.mods.fml.relauncher.Side;
-import cpw.mods.fml.relauncher.SideOnly;
-import gregtech.api.GregTech_API;
-import gregtech.api.enums.*;
-import gregtech.api.interfaces.IOreRecipeRegistrator;
-import gregtech.api.items.GT_Generic_Block;
-import gregtech.api.util.GT_ModHandler;
-import gregtech.api.util.GT_Utility;
-import net.minecraft.block.material.Material;
-import net.minecraft.client.renderer.texture.IIconRegister;
-import net.minecraft.creativetab.CreativeTabs;
-import net.minecraft.entity.EnumCreatureType;
-import net.minecraft.init.Blocks;
-import net.minecraft.item.Item;
-import net.minecraft.item.ItemBlock;
-import net.minecraft.item.ItemStack;
-import net.minecraft.util.IIcon;
-import net.minecraft.util.StatCollector;
-import net.minecraft.world.IBlockAccess;
-import net.minecraft.world.World;
-
-import java.util.List;
-import java.util.Random;
-
-public class GT_Block_Stones_Abstract
- extends GT_Generic_Block
- implements IOreRecipeRegistrator {
- public GT_Block_Stones_Abstract(Class<? extends ItemBlock> aItemClass, String aName) {
- super(aItemClass, aName, Material.rock);
- OrePrefixes.crafting.add(this);
- setStepSound(soundTypeStone);
- setCreativeTab(GregTech_API.TAB_GREGTECH_MATERIALS);
- GT_ModHandler.addSmeltingRecipe(new ItemStack(this, 1, 0), new ItemStack(this, 1, 7));
- GT_ModHandler.addSmeltingRecipe(new ItemStack(this, 1, 1), new ItemStack(this, 1, 0));
- GT_ModHandler.addSmeltingRecipe(new ItemStack(this, 1, 2), new ItemStack(this, 1, 0));
- GT_ModHandler.addSmeltingRecipe(new ItemStack(this, 1, 3), new ItemStack(this, 1, 0));
- GT_ModHandler.addSmeltingRecipe(new ItemStack(this, 1, 4), new ItemStack(this, 1, 0));
- GT_ModHandler.addSmeltingRecipe(new ItemStack(this, 1, 5), new ItemStack(this, 1, 0));
- GT_ModHandler.addSmeltingRecipe(new ItemStack(this, 1, 6), new ItemStack(this, 1, 0));
- GT_ModHandler.addSmeltingRecipe(new ItemStack(this, 1, 7), new ItemStack(this, 1, 0));
- GT_ModHandler.addSmeltingRecipe(new ItemStack(this, 1, 8), new ItemStack(this, 1, 15));
- GT_ModHandler.addSmeltingRecipe(new ItemStack(this, 1, 9), new ItemStack(this, 1, 8));
- GT_ModHandler.addSmeltingRecipe(new ItemStack(this, 1, 10), new ItemStack(this, 1, 8));
- GT_ModHandler.addSmeltingRecipe(new ItemStack(this, 1, 11), new ItemStack(this, 1, 8));
- GT_ModHandler.addSmeltingRecipe(new ItemStack(this, 1, 12), new ItemStack(this, 1, 8));
- GT_ModHandler.addSmeltingRecipe(new ItemStack(this, 1, 13), new ItemStack(this, 1, 8));
- GT_ModHandler.addSmeltingRecipe(new ItemStack(this, 1, 14), new ItemStack(this, 1, 8));
- GT_ModHandler.addSmeltingRecipe(new ItemStack(this, 1, 15), new ItemStack(this, 1, 8));
- GT_Values.RA.addAssemblerRecipe(new ItemStack(this, 1, 0), ItemList.Circuit_Integrated.getWithDamage(0L, 4L, new Object[0]), new ItemStack(this, 1, 3), 50, 4);
- GT_Values.RA.addAssemblerRecipe(new ItemStack(this, 1, 8), ItemList.Circuit_Integrated.getWithDamage(0L, 4L, new Object[0]), new ItemStack(this, 1, 11), 50, 4);
- GT_ModHandler.addCraftingRecipe(new ItemStack(this, 1, 6), GT_ModHandler.RecipeBits.NOT_REMOVABLE, new Object[]{"f", "X", 'X', new ItemStack(this, 1, 7)});
- GT_ModHandler.addCraftingRecipe(new ItemStack(this, 1, 14), GT_ModHandler.RecipeBits.NOT_REMOVABLE, new Object[]{"f", "X", 'X', new ItemStack(this, 1, 15)});
- GT_ModHandler.addCraftingRecipe(new ItemStack(this, 1, 4), GT_ModHandler.RecipeBits.NOT_REMOVABLE, new Object[]{"h", "X", 'X', new ItemStack(this, 1, 3)});
- GT_ModHandler.addCraftingRecipe(new ItemStack(this, 1, 12), GT_ModHandler.RecipeBits.NOT_REMOVABLE, new Object[]{"h", "X", 'X', new ItemStack(this, 1, 11)});
- GT_ModHandler.addCraftingRecipe(new ItemStack(this, 1, 1), GT_ModHandler.RecipeBits.NOT_REMOVABLE, new Object[]{"h", "X", 'X', new ItemStack(this, 1, 0)});
- GT_ModHandler.addCraftingRecipe(new ItemStack(this, 1, 9), GT_ModHandler.RecipeBits.NOT_REMOVABLE, new Object[]{"h", "X", 'X', new ItemStack(this, 1, 8)});
- GT_Values.RA.addForgeHammerRecipe(new ItemStack(this, 1, 3), new ItemStack(this, 1, 4), 16, 10);
- GT_Values.RA.addForgeHammerRecipe(new ItemStack(this, 1, 11), new ItemStack(this, 1, 12), 16, 10);
- GT_Values.RA.addForgeHammerRecipe(new ItemStack(this, 1, 0), new ItemStack(this, 1, 1), 16, 10);
- GT_Values.RA.addForgeHammerRecipe(new ItemStack(this, 1, 8), new ItemStack(this, 1, 9), 16, 10);
- GT_ModHandler.addCraftingRecipe(new ItemStack(this, 4, 3), GT_ModHandler.RecipeBits.NOT_REMOVABLE, new Object[]{"XX", "XX", 'X', new ItemStack(this, 4, 0)});
- GT_ModHandler.addCraftingRecipe(new ItemStack(this, 4, 11), GT_ModHandler.RecipeBits.NOT_REMOVABLE, new Object[]{"XX", "XX", 'X', new ItemStack(this, 4, 8)});
- GT_ModHandler.addCraftingRecipe(new ItemStack(this, 4, 3), GT_ModHandler.RecipeBits.NOT_REMOVABLE, new Object[]{"XX", "XX", 'X', new ItemStack(this, 4, 7)});
- GT_ModHandler.addCraftingRecipe(new ItemStack(this, 4, 11), GT_ModHandler.RecipeBits.NOT_REMOVABLE, new Object[]{"XX", "XX", 'X', new ItemStack(this, 4, 15)});
- }
-
- public void registerOre(OrePrefixes aPrefix, Materials aMaterial, String aOreDictName, String aModName, ItemStack aStack) {
- if (aOreDictName.equals(OreDictNames.craftingLensWhite.toString())) {
- GT_Values.RA.addLaserEngraverRecipe(new ItemStack(this, 1, 7), GT_Utility.copyAmount(0L, new Object[]{aStack}), new ItemStack(this, 1, 6), 50, 16);
- GT_Values.RA.addLaserEngraverRecipe(new ItemStack(this, 1, 15), GT_Utility.copyAmount(0L, new Object[]{aStack}), new ItemStack(this, 1, 14), 50, 16);
- }
- }
- @Override
- public String getHarvestTool(int aMeta) {
- return "pickaxe";
- }
- @Override
- public int getHarvestLevel(int aMeta) {
- return 1;
- }
- @Override
- public float getBlockHardness(World aWorld, int aX, int aY, int aZ) {
- return this.blockHardness = Blocks.stone.getBlockHardness(aWorld, aX, aY, aZ) * 3.0F;
- }
- @Override
- public String getUnlocalizedName() {
- return this.mUnlocalizedName;
- }
- @Override
- public String getLocalizedName() {
- return StatCollector.translateToLocal(this.mUnlocalizedName + ".name");
- }
- @Override
- public boolean canBeReplacedByLeaves(IBlockAccess aWorld, int aX, int aY, int aZ) {
- return false;
- }
- @Override
- public boolean isNormalCube(IBlockAccess aWorld, int aX, int aY, int aZ) {
- return true;
- }
- @Override
- public boolean renderAsNormalBlock() {
- return true;
- }
- @Override
- public boolean isOpaqueCube() {
- return true;
- }
- @Override
- public IIcon getIcon(int aSide, int aMeta) {
- if ((aMeta >= 0) && (aMeta < 16)) {
- return gregtech.api.enums.Textures.BlockIcons.GRANITES[aMeta].getIcon();
- }
- return null;
- }
-
- @Override
- public boolean canCreatureSpawn(EnumCreatureType type, IBlockAccess world, int x, int y, int z) {
- return world.getBlockMetadata(x, y, z) % 8 < 3;
- }
- @Override
- public int damageDropped(int par1) {
- return par1 % 8 == 0 ? par1 + 1 : par1;
- }
- @Override
- public int getDamageValue(World par1World, int par2, int par3, int par4) {
- return par1World.getBlockMetadata(par2, par3, par4);
- }
- @Override
- public int quantityDropped(Random par1Random) {
- return 1;
- }
-
- public Item getItemDropped(int par1, Random par2Random, int par3) {
- return Item.getItemFromBlock(this);
- }
-
- @SideOnly(Side.CLIENT)
- public void registerBlockIcons(IIconRegister aIconRegister) {
- }
-
- @SideOnly(Side.CLIENT)
- public void getSubBlocks(Item aItem, CreativeTabs par2CreativeTabs, List aList) {
- for (int i = 0; i < 16; i++) {
- aList.add(new ItemStack(aItem, 1, i));
- }
- }
-}
+package gregtech.common.blocks;
+
+import cpw.mods.fml.relauncher.Side;
+import cpw.mods.fml.relauncher.SideOnly;
+import gregtech.api.GregTech_API;
+import gregtech.api.enums.*;
+import gregtech.api.interfaces.IOreRecipeRegistrator;
+import gregtech.api.items.GT_Generic_Block;
+import gregtech.api.util.GT_ModHandler;
+import gregtech.api.util.GT_Utility;
+import net.minecraft.block.material.Material;
+import net.minecraft.client.renderer.texture.IIconRegister;
+import net.minecraft.creativetab.CreativeTabs;
+import net.minecraft.entity.EnumCreatureType;
+import net.minecraft.init.Blocks;
+import net.minecraft.item.Item;
+import net.minecraft.item.ItemBlock;
+import net.minecraft.item.ItemStack;
+import net.minecraft.util.IIcon;
+import net.minecraft.util.StatCollector;
+import net.minecraft.world.IBlockAccess;
+import net.minecraft.world.World;
+
+import java.util.List;
+import java.util.Random;
+
+public class GT_Block_Stones_Abstract
+ extends GT_Generic_Block
+ implements IOreRecipeRegistrator {
+ public GT_Block_Stones_Abstract(Class<? extends ItemBlock> aItemClass, String aName) {
+ super(aItemClass, aName, Material.rock);
+ OrePrefixes.crafting.add(this);
+ setStepSound(soundTypeStone);
+ setCreativeTab(GregTech_API.TAB_GREGTECH_MATERIALS);
+ GT_ModHandler.addSmeltingRecipe(new ItemStack(this, 1, 0), new ItemStack(this, 1, 7));
+ GT_ModHandler.addSmeltingRecipe(new ItemStack(this, 1, 1), new ItemStack(this, 1, 0));
+ GT_ModHandler.addSmeltingRecipe(new ItemStack(this, 1, 2), new ItemStack(this, 1, 0));
+ GT_ModHandler.addSmeltingRecipe(new ItemStack(this, 1, 3), new ItemStack(this, 1, 0));
+ GT_ModHandler.addSmeltingRecipe(new ItemStack(this, 1, 4), new ItemStack(this, 1, 0));
+ GT_ModHandler.addSmeltingRecipe(new ItemStack(this, 1, 5), new ItemStack(this, 1, 0));
+ GT_ModHandler.addSmeltingRecipe(new ItemStack(this, 1, 6), new ItemStack(this, 1, 0));
+ GT_ModHandler.addSmeltingRecipe(new ItemStack(this, 1, 7), new ItemStack(this, 1, 0));
+ GT_ModHandler.addSmeltingRecipe(new ItemStack(this, 1, 8), new ItemStack(this, 1, 15));
+ GT_ModHandler.addSmeltingRecipe(new ItemStack(this, 1, 9), new ItemStack(this, 1, 8));
+ GT_ModHandler.addSmeltingRecipe(new ItemStack(this, 1, 10), new ItemStack(this, 1, 8));
+ GT_ModHandler.addSmeltingRecipe(new ItemStack(this, 1, 11), new ItemStack(this, 1, 8));
+ GT_ModHandler.addSmeltingRecipe(new ItemStack(this, 1, 12), new ItemStack(this, 1, 8));
+ GT_ModHandler.addSmeltingRecipe(new ItemStack(this, 1, 13), new ItemStack(this, 1, 8));
+ GT_ModHandler.addSmeltingRecipe(new ItemStack(this, 1, 14), new ItemStack(this, 1, 8));
+ GT_ModHandler.addSmeltingRecipe(new ItemStack(this, 1, 15), new ItemStack(this, 1, 8));
+ GT_Values.RA.addAssemblerRecipe(new ItemStack(this, 1, 0), ItemList.Circuit_Integrated.getWithDamage(0L, 4L, new Object[0]), new ItemStack(this, 1, 3), 50, 4);
+ GT_Values.RA.addAssemblerRecipe(new ItemStack(this, 1, 8), ItemList.Circuit_Integrated.getWithDamage(0L, 4L, new Object[0]), new ItemStack(this, 1, 11), 50, 4);
+ GT_ModHandler.addCraftingRecipe(new ItemStack(this, 1, 6), GT_ModHandler.RecipeBits.NOT_REMOVABLE, new Object[]{"f", "X", 'X', new ItemStack(this, 1, 7)});
+ GT_ModHandler.addCraftingRecipe(new ItemStack(this, 1, 14), GT_ModHandler.RecipeBits.NOT_REMOVABLE, new Object[]{"f", "X", 'X', new ItemStack(this, 1, 15)});
+ GT_ModHandler.addCraftingRecipe(new ItemStack(this, 1, 4), GT_ModHandler.RecipeBits.NOT_REMOVABLE, new Object[]{"h", "X", 'X', new ItemStack(this, 1, 3)});
+ GT_ModHandler.addCraftingRecipe(new ItemStack(this, 1, 12), GT_ModHandler.RecipeBits.NOT_REMOVABLE, new Object[]{"h", "X", 'X', new ItemStack(this, 1, 11)});
+ GT_ModHandler.addCraftingRecipe(new ItemStack(this, 1, 1), GT_ModHandler.RecipeBits.NOT_REMOVABLE, new Object[]{"h", "X", 'X', new ItemStack(this, 1, 0)});
+ GT_ModHandler.addCraftingRecipe(new ItemStack(this, 1, 9), GT_ModHandler.RecipeBits.NOT_REMOVABLE, new Object[]{"h", "X", 'X', new ItemStack(this, 1, 8)});
+ GT_Values.RA.addForgeHammerRecipe(new ItemStack(this, 1, 3), new ItemStack(this, 1, 4), 16, 10);
+ GT_Values.RA.addForgeHammerRecipe(new ItemStack(this, 1, 11), new ItemStack(this, 1, 12), 16, 10);
+ GT_Values.RA.addForgeHammerRecipe(new ItemStack(this, 1, 0), new ItemStack(this, 1, 1), 16, 10);
+ GT_Values.RA.addForgeHammerRecipe(new ItemStack(this, 1, 8), new ItemStack(this, 1, 9), 16, 10);
+ GT_ModHandler.addCraftingRecipe(new ItemStack(this, 4, 3), GT_ModHandler.RecipeBits.NOT_REMOVABLE, new Object[]{"XX", "XX", 'X', new ItemStack(this, 4, 0)});
+ GT_ModHandler.addCraftingRecipe(new ItemStack(this, 4, 11), GT_ModHandler.RecipeBits.NOT_REMOVABLE, new Object[]{"XX", "XX", 'X', new ItemStack(this, 4, 8)});
+ GT_ModHandler.addCraftingRecipe(new ItemStack(this, 4, 3), GT_ModHandler.RecipeBits.NOT_REMOVABLE, new Object[]{"XX", "XX", 'X', new ItemStack(this, 4, 7)});
+ GT_ModHandler.addCraftingRecipe(new ItemStack(this, 4, 11), GT_ModHandler.RecipeBits.NOT_REMOVABLE, new Object[]{"XX", "XX", 'X', new ItemStack(this, 4, 15)});
+ }
+
+ public void registerOre(OrePrefixes aPrefix, Materials aMaterial, String aOreDictName, String aModName, ItemStack aStack) {
+ if (aOreDictName.equals(OreDictNames.craftingLensWhite.toString())) {
+ GT_Values.RA.addLaserEngraverRecipe(new ItemStack(this, 1, 7), GT_Utility.copyAmount(0L, new Object[]{aStack}), new ItemStack(this, 1, 6), 50, 16);
+ GT_Values.RA.addLaserEngraverRecipe(new ItemStack(this, 1, 15), GT_Utility.copyAmount(0L, new Object[]{aStack}), new ItemStack(this, 1, 14), 50, 16);
+ }
+ }
+ @Override
+ public String getHarvestTool(int aMeta) {
+ return "pickaxe";
+ }
+ @Override
+ public int getHarvestLevel(int aMeta) {
+ return 1;
+ }
+ @Override
+ public float getBlockHardness(World aWorld, int aX, int aY, int aZ) {
+ return this.blockHardness = Blocks.stone.getBlockHardness(aWorld, aX, aY, aZ) * 3.0F;
+ }
+ @Override
+ public String getUnlocalizedName() {
+ return this.mUnlocalizedName;
+ }
+ @Override
+ public String getLocalizedName() {
+ return StatCollector.translateToLocal(this.mUnlocalizedName + ".name");
+ }
+ @Override
+ public boolean canBeReplacedByLeaves(IBlockAccess aWorld, int aX, int aY, int aZ) {
+ return false;
+ }
+ @Override
+ public boolean isNormalCube(IBlockAccess aWorld, int aX, int aY, int aZ) {
+ return true;
+ }
+ @Override
+ public boolean renderAsNormalBlock() {
+ return true;
+ }
+ @Override
+ public boolean isOpaqueCube() {
+ return true;
+ }
+ @Override
+ public IIcon getIcon(int aSide, int aMeta) {
+ if ((aMeta >= 0) && (aMeta < 16)) {
+ return gregtech.api.enums.Textures.BlockIcons.GRANITES[aMeta].getIcon();
+ }
+ return null;
+ }
+
+ @Override
+ public boolean canCreatureSpawn(EnumCreatureType type, IBlockAccess world, int x, int y, int z) {
+ return world.getBlockMetadata(x, y, z) % 8 < 3;
+ }
+ @Override
+ public int damageDropped(int par1) {
+ return par1 % 8 == 0 ? par1 + 1 : par1;
+ }
+ @Override
+ public int getDamageValue(World par1World, int par2, int par3, int par4) {
+ return par1World.getBlockMetadata(par2, par3, par4);
+ }
+ @Override
+ public int quantityDropped(Random par1Random) {
+ return 1;
+ }
+
+ public Item getItemDropped(int par1, Random par2Random, int par3) {
+ return Item.getItemFromBlock(this);
+ }
+
+ @SideOnly(Side.CLIENT)
+ public void registerBlockIcons(IIconRegister aIconRegister) {
+ }
+
+ @SideOnly(Side.CLIENT)
+ public void getSubBlocks(Item aItem, CreativeTabs par2CreativeTabs, List aList) {
+ for (int i = 0; i < 16; i++) {
+ aList.add(new ItemStack(aItem, 1, i));
+ }
+ }
+}
diff --git a/src/main/java/gregtech/common/blocks/GT_Item_Casings8.java b/src/main/java/gregtech/common/blocks/GT_Item_Casings8.java
index 66498a0481..f1609ef684 100644
--- a/src/main/java/gregtech/common/blocks/GT_Item_Casings8.java
+++ b/src/main/java/gregtech/common/blocks/GT_Item_Casings8.java
@@ -1,10 +1,10 @@
-package gregtech.common.blocks;
-
-import net.minecraft.block.Block;
-
-public class GT_Item_Casings8
- extends GT_Item_Casings_Abstract {
- public GT_Item_Casings8(Block par1) {
- super(par1);
- }
-}
+package gregtech.common.blocks;
+
+import net.minecraft.block.Block;
+
+public class GT_Item_Casings8
+ extends GT_Item_Casings_Abstract {
+ public GT_Item_Casings8(Block par1) {
+ super(par1);
+ }
+}
diff --git a/src/main/java/gregtech/common/blocks/GT_Item_Machines.java b/src/main/java/gregtech/common/blocks/GT_Item_Machines.java
index 1424a016e8..bf6b12b5cd 100644
--- a/src/main/java/gregtech/common/blocks/GT_Item_Machines.java
+++ b/src/main/java/gregtech/common/blocks/GT_Item_Machines.java
@@ -1,203 +1,203 @@
-package gregtech.common.blocks;
-
-import gregtech.api.GregTech_API;
-import gregtech.api.enums.GT_Values;
-import gregtech.api.enums.Materials;
-import gregtech.api.interfaces.metatileentity.IConnectable;
-import gregtech.api.interfaces.tileentity.IGregTechTileEntity;
-import gregtech.api.metatileentity.implementations.GT_MetaPipeEntity_Cable;
-import gregtech.api.metatileentity.implementations.GT_MetaPipeEntity_Fluid;
-import gregtech.api.metatileentity.implementations.GT_MetaPipeEntity_Frame;
-import gregtech.api.metatileentity.implementations.GT_MetaPipeEntity_Item;
-import gregtech.api.util.GT_ItsNotMyFaultException;
-import gregtech.api.util.GT_LanguageManager;
-import gregtech.api.util.GT_Log;
-import gregtech.api.util.GT_Utility;
-import net.minecraft.block.Block;
-import net.minecraft.entity.player.EntityPlayer;
-import net.minecraft.item.ItemBlock;
-import net.minecraft.item.ItemStack;
-import net.minecraft.nbt.NBTTagCompound;
-import net.minecraft.util.EnumChatFormatting;
-import net.minecraft.world.World;
-
-import java.util.List;
-
-public class GT_Item_Machines
- extends ItemBlock {
-
- private static final String[] directionNames = {"Bottom", "Top", "North", "South", "West", "East"};
-
- public GT_Item_Machines(Block par1) {
- super(par1);
- setMaxDamage(0);
- setHasSubtypes(true);
- setCreativeTab(GregTech_API.TAB_GREGTECH);
- }
-
- public void addInformation(ItemStack aStack, EntityPlayer aPlayer, List aList, boolean par4) {
- try {
- int tDamage = getDamage(aStack);
- if ((tDamage <= 0) || (tDamage >= GregTech_API.METATILEENTITIES.length)) {
- return;
- }
-
- if (GregTech_API.METATILEENTITIES[tDamage] != null) {
- IGregTechTileEntity tTileEntity = GregTech_API.METATILEENTITIES[tDamage].getBaseMetaTileEntity();
- if (tTileEntity.getDescription() != null) {
- int i = 0;
- for (String tDescription : tTileEntity.getDescription()) {
- if (GT_Utility.isStringValid(tDescription)) {
- if(tDescription.contains("%%%")){
- String[] tString = tDescription.split("%%%");
- if(tString.length>=2){
- StringBuffer tBuffer = new StringBuffer();
- Object tRep[] = new String[tString.length / 2];
- for (int j = 0; j < tString.length; j++)
- if (j % 2 == 0) tBuffer.append(tString[j]);
- else {tBuffer.append(" %s"); tRep[j / 2] = tString[j];}
- aList.add(String.format(GT_LanguageManager.addStringLocalization("TileEntity_DESCRIPTION_" + tDamage + "_Index_" + i++, tBuffer.toString(), !GregTech_API.sPostloadFinished), tRep));
- }
- }else{String tTranslated = GT_LanguageManager.addStringLocalization("TileEntity_DESCRIPTION_" + tDamage + "_Index_" + i++, tDescription, !GregTech_API.sPostloadFinished );
- aList.add(tTranslated.equals("") ? tDescription : tTranslated);}
- }else i++;
- }
- }
- if (tTileEntity.getEUCapacity() > 0L) {
- if (tTileEntity.getInputVoltage() > 0L) {
- aList.add(GT_LanguageManager.addStringLocalization("TileEntity_EUp_IN", "Voltage IN: ", !GregTech_API.sPostloadFinished ) + EnumChatFormatting.GREEN + tTileEntity.getInputVoltage() + " (" + GT_Values.VN[GT_Utility.getTier(tTileEntity.getInputVoltage())] + ")" + EnumChatFormatting.GRAY);
- }
- if (tTileEntity.getOutputVoltage() > 0L) {
- aList.add(GT_LanguageManager.addStringLocalization("TileEntity_EUp_OUT", "Voltage OUT: ", !GregTech_API.sPostloadFinished ) + EnumChatFormatting.GREEN + tTileEntity.getOutputVoltage() + " (" + GT_Values.VN[GT_Utility.getTier(tTileEntity.getOutputVoltage())] + ")" + EnumChatFormatting.GRAY);
- }
- if (tTileEntity.getOutputAmperage() > 1L) {
- aList.add(GT_LanguageManager.addStringLocalization("TileEntity_EUp_AMOUNT", "Amperage: ", !GregTech_API.sPostloadFinished ) + EnumChatFormatting.YELLOW + tTileEntity.getOutputAmperage() + EnumChatFormatting.GRAY);
- }
- aList.add(GT_LanguageManager.addStringLocalization("TileEntity_EUp_STORE", "Capacity: ", !GregTech_API.sPostloadFinished ) + EnumChatFormatting.BLUE + tTileEntity.getEUCapacity() + EnumChatFormatting.GRAY);
- }
- }
- NBTTagCompound aNBT = aStack.getTagCompound();
- if (aNBT != null) {
- if (aNBT.getBoolean("mMuffler")) {
- aList.add(GT_LanguageManager.addStringLocalization("GT_TileEntity_MUFFLER", "has Muffler Upgrade", !GregTech_API.sPostloadFinished ));
- }
- if (aNBT.getBoolean("mSteamConverter")) {
- aList.add(GT_LanguageManager.addStringLocalization("GT_TileEntity_STEAMCONVERTER", "has Steam Upgrade", !GregTech_API.sPostloadFinished ));
- }
- int tAmount = 0;
- if ((tAmount = aNBT.getByte("mSteamTanks")) > 0) {
- aList.add(tAmount + " " + GT_LanguageManager.addStringLocalization("GT_TileEntity_STEAMTANKS", "Steam Tank Upgrades", !GregTech_API.sPostloadFinished ));
- }
-
- addInstalledCoversInformation(aNBT, aList);
- }
- } catch (Throwable e) {
- e.printStackTrace(GT_Log.err);
- }
- }
-
- private void addInstalledCoversInformation(NBTTagCompound aNBT, List<String> aList) {
- if (aNBT.hasKey("mCoverSides")){
- int[] mCoverSides = aNBT.getIntArray("mCoverSides");
- if (mCoverSides != null && mCoverSides.length == 6) {
- for (byte i = 0; i < 6; i++) {
- int coverId = mCoverSides[i];
- ItemStack coverStack = GT_Utility.intToStack(coverId);
- if (coverStack != null) {
- aList.add(String.format("Cover on %s side: %s", directionNames[i], coverStack.getDisplayName()));
- }
- }
- }
- }
- }
-
- public boolean onItemUseFirst(ItemStack stack, EntityPlayer player, World world, int x, int y, int z, int side, float hitX, float hitY, float hitZ) {
- return false;
- }
-
- public String getUnlocalizedName(ItemStack aStack) {
- short tDamage = (short) getDamage(aStack);
- if ((tDamage < 0) || (tDamage >= GregTech_API.METATILEENTITIES.length)) {
- return "";
- }
- if (GregTech_API.METATILEENTITIES[tDamage] != null) {
- return getUnlocalizedName() + "." + GregTech_API.METATILEENTITIES[tDamage].getMetaName();
- }
- return "";
- }
-
- public String getItemStackDisplayName(ItemStack aStack) {
- String aName = super.getItemStackDisplayName(aStack);
- short aDamage = (short) getDamage(aStack);
- if (aDamage >= 0 && aDamage < GregTech_API.METATILEENTITIES.length && GregTech_API.METATILEENTITIES[aDamage] != null) {
- Materials aMaterial = null;
- if (GregTech_API.METATILEENTITIES[aDamage] instanceof GT_MetaPipeEntity_Item) {
- aMaterial = ((GT_MetaPipeEntity_Item) GregTech_API.METATILEENTITIES[aDamage]).mMaterial;
- } else if (GregTech_API.METATILEENTITIES[aDamage] instanceof GT_MetaPipeEntity_Fluid) {
- aMaterial = ((GT_MetaPipeEntity_Fluid) GregTech_API.METATILEENTITIES[aDamage]).mMaterial;
- } else if (GregTech_API.METATILEENTITIES[aDamage] instanceof GT_MetaPipeEntity_Cable) {
- aMaterial = ((GT_MetaPipeEntity_Cable) GregTech_API.METATILEENTITIES[aDamage]).mMaterial;
- } else if (GregTech_API.METATILEENTITIES[aDamage] instanceof GT_MetaPipeEntity_Frame) {
- aMaterial = ((GT_MetaPipeEntity_Frame) GregTech_API.METATILEENTITIES[aDamage]).mMaterial;
- }
- if (aMaterial != null) {
- aName = aMaterial.getLocalizedNameForItem(aName);
- }
- }
- return aName;
- }
-
- public void onCreated(ItemStack aStack, World aWorld, EntityPlayer aPlayer) {
- super.onCreated(aStack, aWorld, aPlayer);
- short tDamage = (short) getDamage(aStack);
- if ((tDamage < 0) || ((tDamage >= GregTech_API.METATILEENTITIES.length) && (GregTech_API.METATILEENTITIES[tDamage] != null))) {
- GregTech_API.METATILEENTITIES[tDamage].onCreated(aStack, aWorld, aPlayer);
- }
- }
-
- public boolean placeBlockAt(ItemStack aStack, EntityPlayer aPlayer, World aWorld, int aX, int aY, int aZ, int side, float hitX, float hitY, float hitZ, int aMeta) {
- short tDamage = (short) getDamage(aStack);
- if (tDamage > 0) {
- if (GregTech_API.METATILEENTITIES[tDamage] == null) {
- return false;
- }
- int tMetaData = GregTech_API.METATILEENTITIES[tDamage].getTileEntityBaseType();
- if (!aWorld.setBlock(aX, aY, aZ, this.field_150939_a, tMetaData, 3)) {
- return false;
- }
- if (aWorld.getBlock(aX, aY, aZ) != this.field_150939_a) {
- throw new GT_ItsNotMyFaultException("Failed to place Block even though World.setBlock returned true. It COULD be MCPC/Bukkit causing that. In case you really have that installed, don't report this Bug to me, I don't know how to fix it.");
- }
- if (aWorld.getBlockMetadata(aX, aY, aZ) != tMetaData) {
- throw new GT_ItsNotMyFaultException("Failed to set the MetaValue of the Block even though World.setBlock returned true. It COULD be MCPC/Bukkit causing that. In case you really have that installed, don't report this Bug to me, I don't know how to fix it.");
- }
- IGregTechTileEntity tTileEntity = (IGregTechTileEntity) aWorld.getTileEntity(aX, aY, aZ);
- if (tTileEntity != null) {
- tTileEntity.setInitialValuesAsNBT(tTileEntity.isServerSide() ? aStack.getTagCompound() : null, tDamage);
- if (aPlayer != null) {
- tTileEntity.setOwnerName(aPlayer.getDisplayName());
- tTileEntity.setOwnerUuid(aPlayer.getUniqueID());
- }
- tTileEntity.getMetaTileEntity().initDefaultModes(aStack.getTagCompound());
- final byte aSide = GT_Utility.getOppositeSide(side);
- if (tTileEntity.getMetaTileEntity() instanceof IConnectable) {
- // If we're connectable, try connecting to whatever we're up against
- ((IConnectable) tTileEntity.getMetaTileEntity()).connect(aSide);
- } else if (aPlayer != null && aPlayer.isSneaking()) {
- // If we're being placed against something that is connectable, try telling it to connect to us
- IGregTechTileEntity aTileEntity = tTileEntity.getIGregTechTileEntityAtSide(aSide);
- if (aTileEntity != null && aTileEntity.getMetaTileEntity() instanceof IConnectable) {
- ((IConnectable) aTileEntity.getMetaTileEntity()).connect((byte)side);
- }
- }
- }
- } else if (!aWorld.setBlock(aX, aY, aZ, this.field_150939_a, tDamage, 3)) {
- return false;
- }
- if (aWorld.getBlock(aX, aY, aZ) == this.field_150939_a) {
- this.field_150939_a.onBlockPlacedBy(aWorld, aX, aY, aZ, aPlayer, aStack);
- this.field_150939_a.onPostBlockPlaced(aWorld, aX, aY, aZ, tDamage);
- }
- return true;
- }
-}
+package gregtech.common.blocks;
+
+import gregtech.api.GregTech_API;
+import gregtech.api.enums.GT_Values;
+import gregtech.api.enums.Materials;
+import gregtech.api.interfaces.metatileentity.IConnectable;
+import gregtech.api.interfaces.tileentity.IGregTechTileEntity;
+import gregtech.api.metatileentity.implementations.GT_MetaPipeEntity_Cable;
+import gregtech.api.metatileentity.implementations.GT_MetaPipeEntity_Fluid;
+import gregtech.api.metatileentity.implementations.GT_MetaPipeEntity_Frame;
+import gregtech.api.metatileentity.implementations.GT_MetaPipeEntity_Item;
+import gregtech.api.util.GT_ItsNotMyFaultException;
+import gregtech.api.util.GT_LanguageManager;
+import gregtech.api.util.GT_Log;
+import gregtech.api.util.GT_Utility;
+import net.minecraft.block.Block;
+import net.minecraft.entity.player.EntityPlayer;
+import net.minecraft.item.ItemBlock;
+import net.minecraft.item.ItemStack;
+import net.minecraft.nbt.NBTTagCompound;
+import net.minecraft.util.EnumChatFormatting;
+import net.minecraft.world.World;
+
+import java.util.List;
+
+public class GT_Item_Machines
+ extends ItemBlock {
+
+ private static final String[] directionNames = {"Bottom", "Top", "North", "South", "West", "East"};
+
+ public GT_Item_Machines(Block par1) {
+ super(par1);
+ setMaxDamage(0);
+ setHasSubtypes(true);
+ setCreativeTab(GregTech_API.TAB_GREGTECH);
+ }
+
+ public void addInformation(ItemStack aStack, EntityPlayer aPlayer, List aList, boolean par4) {
+ try {
+ int tDamage = getDamage(aStack);
+ if ((tDamage <= 0) || (tDamage >= GregTech_API.METATILEENTITIES.length)) {
+ return;
+ }
+
+ if (GregTech_API.METATILEENTITIES[tDamage] != null) {
+ IGregTechTileEntity tTileEntity = GregTech_API.METATILEENTITIES[tDamage].getBaseMetaTileEntity();
+ if (tTileEntity.getDescription() != null) {
+ int i = 0;
+ for (String tDescription : tTileEntity.getDescription()) {
+ if (GT_Utility.isStringValid(tDescription)) {
+ if(tDescription.contains("%%%")){
+ String[] tString = tDescription.split("%%%");
+ if(tString.length>=2){
+ StringBuffer tBuffer = new StringBuffer();
+ Object tRep[] = new String[tString.length / 2];
+ for (int j = 0; j < tString.length; j++)
+ if (j % 2 == 0) tBuffer.append(tString[j]);
+ else {tBuffer.append(" %s"); tRep[j / 2] = tString[j];}
+ aList.add(String.format(GT_LanguageManager.addStringLocalization("TileEntity_DESCRIPTION_" + tDamage + "_Index_" + i++, tBuffer.toString(), !GregTech_API.sPostloadFinished), tRep));
+ }
+ }else{String tTranslated = GT_LanguageManager.addStringLocalization("TileEntity_DESCRIPTION_" + tDamage + "_Index_" + i++, tDescription, !GregTech_API.sPostloadFinished );
+ aList.add(tTranslated.equals("") ? tDescription : tTranslated);}
+ }else i++;
+ }
+ }
+ if (tTileEntity.getEUCapacity() > 0L) {
+ if (tTileEntity.getInputVoltage() > 0L) {
+ aList.add(GT_LanguageManager.addStringLocalization("TileEntity_EUp_IN", "Voltage IN: ", !GregTech_API.sPostloadFinished ) + EnumChatFormatting.GREEN + tTileEntity.getInputVoltage() + " (" + GT_Values.VN[GT_Utility.getTier(tTileEntity.getInputVoltage())] + ")" + EnumChatFormatting.GRAY);
+ }
+ if (tTileEntity.getOutputVoltage() > 0L) {
+ aList.add(GT_LanguageManager.addStringLocalization("TileEntity_EUp_OUT", "Voltage OUT: ", !GregTech_API.sPostloadFinished ) + EnumChatFormatting.GREEN + tTileEntity.getOutputVoltage() + " (" + GT_Values.VN[GT_Utility.getTier(tTileEntity.getOutputVoltage())] + ")" + EnumChatFormatting.GRAY);
+ }
+ if (tTileEntity.getOutputAmperage() > 1L) {
+ aList.add(GT_LanguageManager.addStringLocalization("TileEntity_EUp_AMOUNT", "Amperage: ", !GregTech_API.sPostloadFinished ) + EnumChatFormatting.YELLOW + tTileEntity.getOutputAmperage() + EnumChatFormatting.GRAY);
+ }
+ aList.add(GT_LanguageManager.addStringLocalization("TileEntity_EUp_STORE", "Capacity: ", !GregTech_API.sPostloadFinished ) + EnumChatFormatting.BLUE + tTileEntity.getEUCapacity() + EnumChatFormatting.GRAY);
+ }
+ }
+ NBTTagCompound aNBT = aStack.getTagCompound();
+ if (aNBT != null) {
+ if (aNBT.getBoolean("mMuffler")) {
+ aList.add(GT_LanguageManager.addStringLocalization("GT_TileEntity_MUFFLER", "has Muffler Upgrade", !GregTech_API.sPostloadFinished ));
+ }
+ if (aNBT.getBoolean("mSteamConverter")) {
+ aList.add(GT_LanguageManager.addStringLocalization("GT_TileEntity_STEAMCONVERTER", "has Steam Upgrade", !GregTech_API.sPostloadFinished ));
+ }
+ int tAmount = 0;
+ if ((tAmount = aNBT.getByte("mSteamTanks")) > 0) {
+ aList.add(tAmount + " " + GT_LanguageManager.addStringLocalization("GT_TileEntity_STEAMTANKS", "Steam Tank Upgrades", !GregTech_API.sPostloadFinished ));
+ }
+
+ addInstalledCoversInformation(aNBT, aList);
+ }
+ } catch (Throwable e) {
+ e.printStackTrace(GT_Log.err);
+ }
+ }
+
+ private void addInstalledCoversInformation(NBTTagCompound aNBT, List<String> aList) {
+ if (aNBT.hasKey("mCoverSides")){
+ int[] mCoverSides = aNBT.getIntArray("mCoverSides");
+ if (mCoverSides != null && mCoverSides.length == 6) {
+ for (byte i = 0; i < 6; i++) {
+ int coverId = mCoverSides[i];
+ ItemStack coverStack = GT_Utility.intToStack(coverId);
+ if (coverStack != null) {
+ aList.add(String.format("Cover on %s side: %s", directionNames[i], coverStack.getDisplayName()));
+ }
+ }
+ }
+ }
+ }
+
+ public boolean onItemUseFirst(ItemStack stack, EntityPlayer player, World world, int x, int y, int z, int side, float hitX, float hitY, float hitZ) {
+ return false;
+ }
+
+ public String getUnlocalizedName(ItemStack aStack) {
+ short tDamage = (short) getDamage(aStack);
+ if ((tDamage < 0) || (tDamage >= GregTech_API.METATILEENTITIES.length)) {
+ return "";
+ }
+ if (GregTech_API.METATILEENTITIES[tDamage] != null) {
+ return getUnlocalizedName() + "." + GregTech_API.METATILEENTITIES[tDamage].getMetaName();
+ }
+ return "";
+ }
+
+ public String getItemStackDisplayName(ItemStack aStack) {
+ String aName = super.getItemStackDisplayName(aStack);
+ short aDamage = (short) getDamage(aStack);
+ if (aDamage >= 0 && aDamage < GregTech_API.METATILEENTITIES.length && GregTech_API.METATILEENTITIES[aDamage] != null) {
+ Materials aMaterial = null;
+ if (GregTech_API.METATILEENTITIES[aDamage] instanceof GT_MetaPipeEntity_Item) {
+ aMaterial = ((GT_MetaPipeEntity_Item) GregTech_API.METATILEENTITIES[aDamage]).mMaterial;
+ } else if (GregTech_API.METATILEENTITIES[aDamage] instanceof GT_MetaPipeEntity_Fluid) {
+ aMaterial = ((GT_MetaPipeEntity_Fluid) GregTech_API.METATILEENTITIES[aDamage]).mMaterial;
+ } else if (GregTech_API.METATILEENTITIES[aDamage] instanceof GT_MetaPipeEntity_Cable) {
+ aMaterial = ((GT_MetaPipeEntity_Cable) GregTech_API.METATILEENTITIES[aDamage]).mMaterial;
+ } else if (GregTech_API.METATILEENTITIES[aDamage] instanceof GT_MetaPipeEntity_Frame) {
+ aMaterial = ((GT_MetaPipeEntity_Frame) GregTech_API.METATILEENTITIES[aDamage]).mMaterial;
+ }
+ if (aMaterial != null) {
+ aName = aMaterial.getLocalizedNameForItem(aName);
+ }
+ }
+ return aName;
+ }
+
+ public void onCreated(ItemStack aStack, World aWorld, EntityPlayer aPlayer) {
+ super.onCreated(aStack, aWorld, aPlayer);
+ short tDamage = (short) getDamage(aStack);
+ if ((tDamage < 0) || ((tDamage >= GregTech_API.METATILEENTITIES.length) && (GregTech_API.METATILEENTITIES[tDamage] != null))) {
+ GregTech_API.METATILEENTITIES[tDamage].onCreated(aStack, aWorld, aPlayer);
+ }
+ }
+
+ public boolean placeBlockAt(ItemStack aStack, EntityPlayer aPlayer, World aWorld, int aX, int aY, int aZ, int side, float hitX, float hitY, float hitZ, int aMeta) {
+ short tDamage = (short) getDamage(aStack);
+ if (tDamage > 0) {
+ if (GregTech_API.METATILEENTITIES[tDamage] == null) {
+ return false;
+ }
+ int tMetaData = GregTech_API.METATILEENTITIES[tDamage].getTileEntityBaseType();
+ if (!aWorld.setBlock(aX, aY, aZ, this.field_150939_a, tMetaData, 3)) {
+ return false;
+ }
+ if (aWorld.getBlock(aX, aY, aZ) != this.field_150939_a) {
+ throw new GT_ItsNotMyFaultException("Failed to place Block even though World.setBlock returned true. It COULD be MCPC/Bukkit causing that. In case you really have that installed, don't report this Bug to me, I don't know how to fix it.");
+ }
+ if (aWorld.getBlockMetadata(aX, aY, aZ) != tMetaData) {
+ throw new GT_ItsNotMyFaultException("Failed to set the MetaValue of the Block even though World.setBlock returned true. It COULD be MCPC/Bukkit causing that. In case you really have that installed, don't report this Bug to me, I don't know how to fix it.");
+ }
+ IGregTechTileEntity tTileEntity = (IGregTechTileEntity) aWorld.getTileEntity(aX, aY, aZ);
+ if (tTileEntity != null) {
+ tTileEntity.setInitialValuesAsNBT(tTileEntity.isServerSide() ? aStack.getTagCompound() : null, tDamage);
+ if (aPlayer != null) {
+ tTileEntity.setOwnerName(aPlayer.getDisplayName());
+ tTileEntity.setOwnerUuid(aPlayer.getUniqueID());
+ }
+ tTileEntity.getMetaTileEntity().initDefaultModes(aStack.getTagCompound());
+ final byte aSide = GT_Utility.getOppositeSide(side);
+ if (tTileEntity.getMetaTileEntity() instanceof IConnectable) {
+ // If we're connectable, try connecting to whatever we're up against
+ ((IConnectable) tTileEntity.getMetaTileEntity()).connect(aSide);
+ } else if (aPlayer != null && aPlayer.isSneaking()) {
+ // If we're being placed against something that is connectable, try telling it to connect to us
+ IGregTechTileEntity aTileEntity = tTileEntity.getIGregTechTileEntityAtSide(aSide);
+ if (aTileEntity != null && aTileEntity.getMetaTileEntity() instanceof IConnectable) {
+ ((IConnectable) aTileEntity.getMetaTileEntity()).connect((byte)side);
+ }
+ }
+ }
+ } else if (!aWorld.setBlock(aX, aY, aZ, this.field_150939_a, tDamage, 3)) {
+ return false;
+ }
+ if (aWorld.getBlock(aX, aY, aZ) == this.field_150939_a) {
+ this.field_150939_a.onBlockPlacedBy(aWorld, aX, aY, aZ, aPlayer, aStack);
+ this.field_150939_a.onPostBlockPlaced(aWorld, aX, aY, aZ, tDamage);
+ }
+ return true;
+ }
+}
diff --git a/src/main/java/gregtech/common/blocks/GT_Item_Ores.java b/src/main/java/gregtech/common/blocks/GT_Item_Ores.java
index 10d71bfcc9..8d53cfe513 100644
--- a/src/main/java/gregtech/common/blocks/GT_Item_Ores.java
+++ b/src/main/java/gregtech/common/blocks/GT_Item_Ores.java
@@ -1,54 +1,54 @@
-package gregtech.common.blocks;
-
-import gregtech.api.GregTech_API;
-import gregtech.api.enums.Materials;
-import net.minecraft.block.Block;
-import net.minecraft.entity.player.EntityPlayer;
-import net.minecraft.item.ItemBlock;
-import net.minecraft.item.ItemStack;
-import net.minecraft.world.World;
-
-public class GT_Item_Ores
- extends ItemBlock {
- public GT_Item_Ores(Block par1) {
- super(par1);
- setMaxDamage(0);
- setHasSubtypes(true);
- setCreativeTab(GregTech_API.TAB_GREGTECH_MATERIALS);
- }
-
- public boolean onItemUseFirst(ItemStack stack, EntityPlayer player, World world, int x, int y, int z, int side, float hitX, float hitY, float hitZ) {
- return false;
- }
-
- public String getUnlocalizedName(ItemStack aStack) {
- return this.field_150939_a.getUnlocalizedName() + "." + getDamage(aStack);
- }
-
- public String getItemStackDisplayName(ItemStack aStack) {
- String aName = super.getItemStackDisplayName(aStack);
- if (this.field_150939_a instanceof GT_Block_Ores_Abstract) {
- aName = Materials.getLocalizedNameForItem(aName, aStack.getItemDamage() % 1000);
- }
- return aName;
- }
-
- public boolean placeBlockAt(ItemStack aStack, EntityPlayer aPlayer, World aWorld, int aX, int aY, int aZ, int side, float hitX, float hitY, float hitZ, int aMeta) {
- short tDamage = (short) getDamage(aStack);
- if (tDamage > 0) {
- if (!aWorld.setBlock(aX, aY, aZ, this.field_150939_a, GT_TileEntity_Ores.getHarvestData(tDamage, ((GT_Block_Ores_Abstract) field_150939_a).getBaseBlockHarvestLevel(aMeta % 16000 / 1000)), 3)) {
- return false;
- }
- GT_TileEntity_Ores tTileEntity = (GT_TileEntity_Ores) aWorld.getTileEntity(aX, aY, aZ);
- tTileEntity.mMetaData = tDamage;
- tTileEntity.mNatural = false;
- } else if (!aWorld.setBlock(aX, aY, aZ, this.field_150939_a, 0, 3)) {
- return false;
- }
- if (aWorld.getBlock(aX, aY, aZ) == this.field_150939_a) {
- this.field_150939_a.onBlockPlacedBy(aWorld, aX, aY, aZ, aPlayer, aStack);
- this.field_150939_a.onPostBlockPlaced(aWorld, aX, aY, aZ, tDamage);
- }
- return true;
- }
-}
+package gregtech.common.blocks;
+
+import gregtech.api.GregTech_API;
+import gregtech.api.enums.Materials;
+import net.minecraft.block.Block;
+import net.minecraft.entity.player.EntityPlayer;
+import net.minecraft.item.ItemBlock;
+import net.minecraft.item.ItemStack;
+import net.minecraft.world.World;
+
+public class GT_Item_Ores
+ extends ItemBlock {
+ public GT_Item_Ores(Block par1) {
+ super(par1);
+ setMaxDamage(0);
+ setHasSubtypes(true);
+ setCreativeTab(GregTech_API.TAB_GREGTECH_MATERIALS);
+ }
+
+ public boolean onItemUseFirst(ItemStack stack, EntityPlayer player, World world, int x, int y, int z, int side, float hitX, float hitY, float hitZ) {
+ return false;
+ }
+
+ public String getUnlocalizedName(ItemStack aStack) {
+ return this.field_150939_a.getUnlocalizedName() + "." + getDamage(aStack);
+ }
+
+ public String getItemStackDisplayName(ItemStack aStack) {
+ String aName = super.getItemStackDisplayName(aStack);
+ if (this.field_150939_a instanceof GT_Block_Ores_Abstract) {
+ aName = Materials.getLocalizedNameForItem(aName, aStack.getItemDamage() % 1000);
+ }
+ return aName;
+ }
+
+ public boolean placeBlockAt(ItemStack aStack, EntityPlayer aPlayer, World aWorld, int aX, int aY, int aZ, int side, float hitX, float hitY, float hitZ, int aMeta) {
+ short tDamage = (short) getDamage(aStack);
+ if (tDamage > 0) {
+ if (!aWorld.setBlock(aX, aY, aZ, this.field_150939_a, GT_TileEntity_Ores.getHarvestData(tDamage, ((GT_Block_Ores_Abstract) field_150939_a).getBaseBlockHarvestLevel(aMeta % 16000 / 1000)), 3)) {
+ return false;
+ }
+ GT_TileEntity_Ores tTileEntity = (GT_TileEntity_Ores) aWorld.getTileEntity(aX, aY, aZ);
+ tTileEntity.mMetaData = tDamage;
+ tTileEntity.mNatural = false;
+ } else if (!aWorld.setBlock(aX, aY, aZ, this.field_150939_a, 0, 3)) {
+ return false;
+ }
+ if (aWorld.getBlock(aX, aY, aZ) == this.field_150939_a) {
+ this.field_150939_a.onBlockPlacedBy(aWorld, aX, aY, aZ, aPlayer, aStack);
+ this.field_150939_a.onPostBlockPlaced(aWorld, aX, aY, aZ, tDamage);
+ }
+ return true;
+ }
+}
diff --git a/src/main/java/gregtech/common/blocks/GT_Item_Storage.java b/src/main/java/gregtech/common/blocks/GT_Item_Storage.java
index 84cbcba6f1..8cf838f538 100644
--- a/src/main/java/gregtech/common/blocks/GT_Item_Storage.java
+++ b/src/main/java/gregtech/common/blocks/GT_Item_Storage.java
@@ -1,41 +1,41 @@
-package gregtech.common.blocks;
-
-import gregtech.api.GregTech_API;
-import net.minecraft.block.Block;
-import net.minecraft.entity.player.EntityPlayer;
-import net.minecraft.item.ItemBlock;
-import net.minecraft.item.ItemStack;
-
-import java.util.List;
-
-public class GT_Item_Storage extends ItemBlock {
- public GT_Item_Storage(Block par1) {
- super(par1);
- setMaxDamage(0);
- setHasSubtypes(true);
- setCreativeTab(GregTech_API.TAB_GREGTECH_MATERIALS);
- }
-
- public String getUnlocalizedName(ItemStack aStack) {
- return this.field_150939_a.getUnlocalizedName() + "." + getDamage(aStack);
- }
-
- public String getItemStackDisplayName(ItemStack aStack) {
- String aName = super.getItemStackDisplayName(aStack);
- if (this.field_150939_a instanceof GT_Block_Metal) {
- int aDamage = aStack.getItemDamage();
- if (aDamage >= 0 && aDamage < ((GT_Block_Metal) this.field_150939_a).mMats.length) {
- aName = ((GT_Block_Metal) this.field_150939_a).mMats[aDamage].getLocalizedNameForItem(aName);
- }
- }
- return aName;
- }
-
- public int getMetadata(int aMeta) {
- return aMeta;
- }
-
- public void addInformation(ItemStack aStack, EntityPlayer aPlayer, List aList, boolean aF3_H) {
- super.addInformation(aStack, aPlayer, aList, aF3_H);
- }
+package gregtech.common.blocks;
+
+import gregtech.api.GregTech_API;
+import net.minecraft.block.Block;
+import net.minecraft.entity.player.EntityPlayer;
+import net.minecraft.item.ItemBlock;
+import net.minecraft.item.ItemStack;
+
+import java.util.List;
+
+public class GT_Item_Storage extends ItemBlock {
+ public GT_Item_Storage(Block par1) {
+ super(par1);
+ setMaxDamage(0);
+ setHasSubtypes(true);
+ setCreativeTab(GregTech_API.TAB_GREGTECH_MATERIALS);
+ }
+
+ public String getUnlocalizedName(ItemStack aStack) {
+ return this.field_150939_a.getUnlocalizedName() + "." + getDamage(aStack);
+ }
+
+ public String getItemStackDisplayName(ItemStack aStack) {
+ String aName = super.getItemStackDisplayName(aStack);
+ if (this.field_150939_a instanceof GT_Block_Metal) {
+ int aDamage = aStack.getItemDamage();
+ if (aDamage >= 0 && aDamage < ((GT_Block_Metal) this.field_150939_a).mMats.length) {
+ aName = ((GT_Block_Metal) this.field_150939_a).mMats[aDamage].getLocalizedNameForItem(aName);
+ }
+ }
+ return aName;
+ }
+
+ public int getMetadata(int aMeta) {
+ return aMeta;
+ }
+
+ public void addInformation(ItemStack aStack, EntityPlayer aPlayer, List aList, boolean aF3_H) {
+ super.addInformation(aStack, aPlayer, aList, aF3_H);
+ }
} \ No newline at end of file