Added more blocks
* Additional 16 blocks loading now
This commit is contained in:
parent
ff2e33bd49
commit
23937d3e9b
3 changed files with 35 additions and 36 deletions
|
@ -18,11 +18,13 @@ import gregtechmod.common.GT_OreDictHandler;
|
|||
import gregtechmod.common.GT_Proxy;
|
||||
import gregtechmod.common.GT_Worldgenerator;
|
||||
import gregtechmod.common.blocks.GT_BlockMetaID_Block;
|
||||
import gregtechmod.common.blocks.GT_BlockMetaID_Block2;
|
||||
import gregtechmod.common.blocks.GT_BlockMetaID_Machine;
|
||||
import gregtechmod.common.blocks.GT_BlockMetaID_Ore;
|
||||
import gregtechmod.common.covers.GT_Cover_Generic;
|
||||
import gregtechmod.common.covers.GT_Cover_None;
|
||||
import gregtechmod.common.covers.GT_Cover_Redstone;
|
||||
import gregtechmod.common.items.GT_MetaBlock2_Item;
|
||||
import gregtechmod.common.items.GT_MetaBlock_Item;
|
||||
import gregtechmod.common.items.GT_MetaMachine_Item;
|
||||
import gregtechmod.common.items.GT_MetaOre_Item;
|
||||
|
@ -467,7 +469,7 @@ public class GT_Mod implements IGT_Mod, IGT_RecipeAdder {
|
|||
GameRegistry.registerBlock(GregTech_API.sBlockList[0] = new GT_BlockMetaID_Block (), GT_MetaBlock_Item.class , "GT_Block");
|
||||
GameRegistry.registerBlock(GregTech_API.sBlockList[1] = new GT_BlockMetaID_Machine(), GT_MetaMachine_Item.class , GT_LanguageManager.mNameList1[0]);
|
||||
GameRegistry.registerBlock(GregTech_API.sBlockList[2] = new GT_BlockMetaID_Ore (), GT_MetaOre_Item.class , GT_LanguageManager.mNameList2[0]);
|
||||
// GameRegistry.registerBlock(GregTech_API.sBlockList[4] = new GT_BlockMetaID_Block2 (), GT_MetaBlock2_Item.class , GT_LanguageManager.mNameList3[0]);
|
||||
GameRegistry.registerBlock(GregTech_API.sBlockList[4] = new GT_BlockMetaID_Block2 (), GT_MetaBlock2_Item.class , GT_LanguageManager.mNameList3[0]);
|
||||
// GameRegistry.registerBlock(GregTech_API.sBlockList[3] = new GT_Block_LightSource (), ItemBlock.class , "GT_TransparentTileEntity" );
|
||||
// GameRegistry.registerBlock(GregTech_API.sBlockList[5] = new GT_BlockMetaID_Stone1 (), GT_MetaStone1_Item.class , GT_LanguageManager.mNameList4[0]);
|
||||
//
|
||||
|
|
|
@ -1,6 +1,7 @@
|
|||
package gregtechmod.common.blocks;
|
||||
|
||||
import gregtechmod.api.GregTech_API;
|
||||
import gregtechmod.api.util.GT_Config;
|
||||
import gregtechmod.api.util.GT_OreDictUnificator;
|
||||
|
||||
import java.util.List;
|
||||
|
@ -8,36 +9,36 @@ import java.util.Random;
|
|||
|
||||
import net.minecraft.block.Block;
|
||||
import net.minecraft.block.material.Material;
|
||||
import net.minecraft.client.renderer.texture.IconRegister;
|
||||
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.item.Item;
|
||||
import net.minecraft.item.ItemStack;
|
||||
import net.minecraft.util.Icon;
|
||||
import net.minecraft.util.IIcon;
|
||||
import net.minecraft.world.IBlockAccess;
|
||||
import net.minecraft.world.World;
|
||||
import net.minecraftforge.common.MinecraftForge;
|
||||
import cpw.mods.fml.relauncher.Side;
|
||||
import cpw.mods.fml.relauncher.SideOnly;
|
||||
|
||||
public class GT_BlockMetaID_Block2 extends Block {
|
||||
|
||||
public static Icon[] mIcons = new Icon[52];
|
||||
public static IIcon[] mIcons = new IIcon[52];
|
||||
|
||||
public GT_BlockMetaID_Block2(int aID) {
|
||||
super(aID, Material.iron);
|
||||
public GT_BlockMetaID_Block2() {
|
||||
super(Material.iron);
|
||||
setHardness(3.0F);
|
||||
setResistance(10.0F);
|
||||
setUnlocalizedName("BlockMetaID_Block2");
|
||||
setStepSound(Block.soundMetalFootstep);
|
||||
setBlockName("BlockMetaID_Block2");
|
||||
setStepSound(Block.soundTypeMetal);
|
||||
setCreativeTab(GregTech_API.TAB_GREGTECH);
|
||||
for (int i = 0; i < 16; i++) MinecraftForge.setBlockHarvestLevel(this, i, "pickaxe", 2);
|
||||
for (int i = 0; i < 16; i++) setHarvestLevel("pickaxe", 2, i);
|
||||
}
|
||||
|
||||
@Override
|
||||
@SideOnly(Side.CLIENT)
|
||||
public void registerIcons(IconRegister par1IconRegister) {
|
||||
for (int i = 0; i < mIcons.length; i++) mIcons[i] = par1IconRegister.registerIcon(GregTech_API.TEXTURE_PATH_BLOCK + (GregTech_API.sConfiguration.system?"troll":getUnlocalizedName() + "/" + i));
|
||||
public void registerBlockIcons(IIconRegister par1IconRegister) {
|
||||
for (int i = 0; i < mIcons.length; i++) mIcons[i] = par1IconRegister.registerIcon(GregTech_API.TEXTURE_PATH_BLOCK + (GT_Config.system ? "troll" : getUnlocalizedName() + "/" + i));
|
||||
GregTech_API.registerCover(GT_OreDictUnificator.getOres("plateLead") , mIcons[ 0]);
|
||||
GregTech_API.registerCover(GT_OreDictUnificator.getOres("plateElectrum") , mIcons[ 1]);
|
||||
GregTech_API.registerCover(GT_OreDictUnificator.getOres("plateZinc") , mIcons[ 2]);
|
||||
|
@ -57,26 +58,26 @@ public class GT_BlockMetaID_Block2 extends Block {
|
|||
}
|
||||
|
||||
@Override
|
||||
public boolean isBeaconBase(World aWorld, int aX, int aY, int aZ, int beaconX, int beaconY, int beaconZ) {
|
||||
return !GregTech_API.isMachineBlock(blockID, aWorld.getBlockMetadata(aX, aY, aZ));
|
||||
public boolean isBeaconBase(IBlockAccess aWorld, int aX, int aY, int aZ, int beaconX, int beaconY, int beaconZ) {
|
||||
return !GregTech_API.isMachineBlock(this, aWorld.getBlockMetadata(aX, aY, aZ));
|
||||
}
|
||||
|
||||
@Override
|
||||
public void breakBlock(World aWorld, int aX, int aY, int aZ, int par5, int par6) {
|
||||
if (GregTech_API.isMachineBlock(blockID, aWorld.getBlockMetadata(aX, aY, aZ))) {
|
||||
public void breakBlock(World aWorld, int aX, int aY, int aZ, Block par5, int par6) {
|
||||
if (GregTech_API.isMachineBlock(this, aWorld.getBlockMetadata(aX, aY, aZ))) {
|
||||
GregTech_API.causeMachineUpdate(aWorld, aX, aY, aZ);
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onBlockAdded(World aWorld, int aX, int aY, int aZ) {
|
||||
if (GregTech_API.isMachineBlock(blockID, aWorld.getBlockMetadata(aX, aY, aZ))) {
|
||||
if (GregTech_API.isMachineBlock(this, aWorld.getBlockMetadata(aX, aY, aZ))) {
|
||||
GregTech_API.causeMachineUpdate(aWorld, aX, aY, aZ);
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean canCreatureSpawn(EnumCreatureType type, World world, int x, int y, int z) {
|
||||
public boolean canCreatureSpawn(EnumCreatureType type, IBlockAccess world, int x, int y, int z) {
|
||||
return false;
|
||||
}
|
||||
|
||||
|
@ -84,7 +85,6 @@ public class GT_BlockMetaID_Block2 extends Block {
|
|||
public float getExplosionResistance(Entity par1Entity, World world, int x, int y, int z, double explosionX, double explosionY, double explosionZ) {
|
||||
if (world == null) return 0;
|
||||
Integer tMeta = world.getBlockMetadata(x, y, z);
|
||||
if (tMeta == null) tMeta = 0;
|
||||
if (tMeta == 0) return 60.0F;
|
||||
if (tMeta == 1) return 30.0F;
|
||||
if (tMeta == 2) return 30.0F;
|
||||
|
@ -108,7 +108,6 @@ public class GT_BlockMetaID_Block2 extends Block {
|
|||
public float getBlockHardness(World world, int x, int y, int z) {
|
||||
if (world == null) return 0;
|
||||
Integer tMeta = world.getBlockMetadata(x, y, z);
|
||||
if (tMeta == null) tMeta = 0;
|
||||
if (tMeta == 8) return 100.0F;
|
||||
if (tMeta == 9) return 200.0F;
|
||||
if (tMeta == 13) return 10.0F;
|
||||
|
@ -116,18 +115,18 @@ public class GT_BlockMetaID_Block2 extends Block {
|
|||
}
|
||||
|
||||
@Override
|
||||
public Icon getBlockTexture(IBlockAccess aWorld, int xCoord, int yCoord, int zCoord, int aSide) {
|
||||
public IIcon getIcon(IBlockAccess aWorld, int xCoord, int yCoord, int zCoord, int aSide) {
|
||||
int tMeta = aWorld.getBlockMetadata(xCoord, yCoord, zCoord);
|
||||
if ((tMeta != 8 && tMeta != 9 && tMeta != 13) || (xCoord == 0 && yCoord == 0 && zCoord == 0) || !GT_BlockMetaID_Block.mConnectedMachineTextures) return this.getIcon(aSide, tMeta);
|
||||
int tStartIndex=(tMeta==8?16:tMeta==9?28:40);
|
||||
|
||||
boolean[] tConnectedSides = {
|
||||
aWorld.getBlockId(xCoord, yCoord-1, zCoord) == blockID && aWorld.getBlockMetadata(xCoord, yCoord-1, zCoord) == tMeta,
|
||||
aWorld.getBlockId(xCoord, yCoord+1, zCoord) == blockID && aWorld.getBlockMetadata(xCoord, yCoord+1, zCoord) == tMeta,
|
||||
aWorld.getBlockId(xCoord+1, yCoord, zCoord) == blockID && aWorld.getBlockMetadata(xCoord+1, yCoord, zCoord) == tMeta,
|
||||
aWorld.getBlockId(xCoord, yCoord, zCoord+1) == blockID && aWorld.getBlockMetadata(xCoord, yCoord, zCoord+1) == tMeta,
|
||||
aWorld.getBlockId(xCoord-1, yCoord, zCoord) == blockID && aWorld.getBlockMetadata(xCoord-1, yCoord, zCoord) == tMeta,
|
||||
aWorld.getBlockId(xCoord, yCoord, zCoord-1) == blockID && aWorld.getBlockMetadata(xCoord, yCoord, zCoord-1) == tMeta
|
||||
aWorld.getBlock(xCoord, yCoord-1, zCoord) == this && aWorld.getBlockMetadata(xCoord, yCoord-1, zCoord) == tMeta,
|
||||
aWorld.getBlock(xCoord, yCoord+1, zCoord) == this && aWorld.getBlockMetadata(xCoord, yCoord+1, zCoord) == tMeta,
|
||||
aWorld.getBlock(xCoord+1, yCoord, zCoord) == this && aWorld.getBlockMetadata(xCoord+1, yCoord, zCoord) == tMeta,
|
||||
aWorld.getBlock(xCoord, yCoord, zCoord+1) == this && aWorld.getBlockMetadata(xCoord, yCoord, zCoord+1) == tMeta,
|
||||
aWorld.getBlock(xCoord-1, yCoord, zCoord) == this && aWorld.getBlockMetadata(xCoord-1, yCoord, zCoord) == tMeta,
|
||||
aWorld.getBlock(xCoord, yCoord, zCoord-1) == this && aWorld.getBlockMetadata(xCoord, yCoord, zCoord-1) == tMeta
|
||||
};
|
||||
|
||||
switch (aSide) {
|
||||
|
@ -246,7 +245,7 @@ public class GT_BlockMetaID_Block2 extends Block {
|
|||
}
|
||||
|
||||
@Override
|
||||
public Icon getIcon(int aSide, int aMeta) {
|
||||
public IIcon getIcon(int aSide, int aMeta) {
|
||||
if (aMeta < 0 || aMeta >= mIcons.length) return null;
|
||||
return mIcons[aMeta];
|
||||
}
|
||||
|
@ -265,14 +264,10 @@ public class GT_BlockMetaID_Block2 extends Block {
|
|||
public int quantityDropped(Random par1Random) {
|
||||
return 1;
|
||||
}
|
||||
|
||||
@Override
|
||||
public int idDropped(int par1, Random par2Random, int par3) {
|
||||
return blockID;
|
||||
}
|
||||
|
||||
@SuppressWarnings({ "rawtypes", "unchecked" })
|
||||
@Override @SideOnly(Side.CLIENT)
|
||||
public void getSubBlocks(int par1, CreativeTabs par2CreativeTabs, List par3List) {
|
||||
public void getSubBlocks(Item par1, CreativeTabs par2CreativeTabs, List par3List) {
|
||||
for (int i = 0; i < 16; ++i) {
|
||||
par3List.add(new ItemStack(par1, 1, i));
|
||||
}
|
||||
|
|
|
@ -5,12 +5,13 @@ import gregtechmod.api.util.GT_LanguageManager;
|
|||
|
||||
import java.util.List;
|
||||
|
||||
import net.minecraft.block.Block;
|
||||
import net.minecraft.entity.player.EntityPlayer;
|
||||
import net.minecraft.item.ItemBlock;
|
||||
import net.minecraft.item.ItemStack;
|
||||
|
||||
public class GT_MetaBlock2_Item extends ItemBlock {
|
||||
public GT_MetaBlock2_Item(int par1) {
|
||||
public GT_MetaBlock2_Item(Block par1) {
|
||||
super(par1);
|
||||
setMaxDamage(0);
|
||||
setHasSubtypes(true);
|
||||
|
@ -23,9 +24,10 @@ public class GT_MetaBlock2_Item extends ItemBlock {
|
|||
return par1;
|
||||
}
|
||||
|
||||
@SuppressWarnings({ "rawtypes", "unchecked" })
|
||||
@Override
|
||||
public void addInformation(ItemStack aStack, EntityPlayer aPlayer, List aList, boolean par4) {
|
||||
aList.add("Mobs can't spawn on this Block");
|
||||
aList.add("Mobs can't spawn on this Block"); // FIXME: lang
|
||||
}
|
||||
|
||||
@Override
|
||||
|
|
Loading…
Reference in a new issue