The game now runs, did some initial work with block states
This commit is contained in:
parent
3f64271252
commit
5e482716cd
|
@ -149,4 +149,7 @@ field_177960_b - y
|
|||
field_177961_c - z
|
||||
|
||||
—BlockPos—
|
||||
field_177992_a - ORIGIN
|
||||
field_177992_a - ORIGIN
|
||||
|
||||
—IStringSerializable—
|
||||
func_176610_l - getID
|
|
@ -10,41 +10,28 @@
|
|||
******************************************************************************/
|
||||
package cpw.mods.ironchest;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
import java.util.Random;
|
||||
|
||||
import net.minecraft.block.Block;
|
||||
import net.minecraft.block.BlockContainer;
|
||||
import net.minecraft.block.material.Material;
|
||||
import net.minecraft.block.properties.IProperty;
|
||||
import net.minecraft.block.properties.PropertyEnum;
|
||||
import net.minecraft.block.state.BlockState;
|
||||
import net.minecraft.block.state.IBlockState;
|
||||
import net.minecraft.creativetab.CreativeTabs;
|
||||
import net.minecraft.entity.Entity;
|
||||
import net.minecraft.entity.EntityLivingBase;
|
||||
import net.minecraft.entity.item.EntityItem;
|
||||
import net.minecraft.entity.player.EntityPlayer;
|
||||
import net.minecraft.inventory.Container;
|
||||
import net.minecraft.inventory.IInventory;
|
||||
import net.minecraft.item.Item;
|
||||
import net.minecraft.item.ItemStack;
|
||||
import net.minecraft.nbt.NBTTagCompound;
|
||||
import net.minecraft.tileentity.TileEntity;
|
||||
import net.minecraft.util.BlockPos;
|
||||
import net.minecraft.util.EnumFacing;
|
||||
import net.minecraft.util.MathHelper;
|
||||
import net.minecraft.world.World;
|
||||
import net.minecraftforge.fml.relauncher.Side;
|
||||
import net.minecraftforge.fml.relauncher.SideOnly;
|
||||
|
||||
import com.google.common.collect.Lists;
|
||||
|
||||
public class BlockIronChest extends BlockContainer {
|
||||
|
||||
public class BlockIronChest extends /*BlockContainer*/Block
|
||||
{
|
||||
public static final PropertyEnum VARIANT_PROP = PropertyEnum.func_177709_a("variant", IronChestType.class);
|
||||
|
||||
private Random random;
|
||||
|
||||
public BlockIronChest()
|
||||
{
|
||||
super(Material.iron);
|
||||
|
||||
this.setDefaultBlockState(this.blockState.getBaseState().setProperty(VARIANT_PROP, IronChestType.IRON));
|
||||
|
||||
setUnlocalizedName("IronChest");
|
||||
setHardness(3.0F);
|
||||
setBlockBounds(0.0625F, 0F, 0.0625F, 0.9375F, 0.875F, 0.9375F);
|
||||
|
@ -63,18 +50,36 @@ public class BlockIronChest extends BlockContainer {
|
|||
{
|
||||
return false;
|
||||
}
|
||||
|
||||
@Override
|
||||
public IBlockState getBlockStateFromMeta(int meta)
|
||||
{
|
||||
return this.getDefaultBlockState().setProperty(VARIANT_PROP, IronChestType.values()[IronChestType.validateMeta(meta)]);
|
||||
}
|
||||
|
||||
@Override
|
||||
public int getMetaFromBlockState(IBlockState blockState)
|
||||
{
|
||||
return IronChestType.validateMeta(((IronChestType)blockState.getValue(VARIANT_PROP)).ordinal());
|
||||
}
|
||||
|
||||
@Override
|
||||
protected BlockState createBlockState()
|
||||
{
|
||||
return new BlockState(this, new IProperty[] { VARIANT_PROP });
|
||||
}
|
||||
|
||||
/*@Override
|
||||
public int getRenderType()
|
||||
{
|
||||
return 22;
|
||||
}
|
||||
}*/
|
||||
|
||||
@Override
|
||||
/*@Override
|
||||
public TileEntity createNewTileEntity(World world, int metadata)
|
||||
{
|
||||
return IronChestType.makeEntity(metadata);
|
||||
}
|
||||
}*/
|
||||
|
||||
/*@Override
|
||||
public ArrayList<ItemStack> getDrops(World world, int x, int y, int z, int metadata, int fortune)
|
||||
|
@ -86,7 +91,7 @@ public class BlockIronChest extends BlockContainer {
|
|||
return items;
|
||||
}*/
|
||||
|
||||
@Override
|
||||
/*@Override
|
||||
public boolean onBlockActivated(World world, BlockPos pos, IBlockState blockState, EntityPlayer player, EnumFacing direction, float p_180639_6_, float p_180639_7_, float p_180639_8_)
|
||||
{
|
||||
TileEntity te = world.getTileEntity(pos);
|
||||
|
@ -101,23 +106,23 @@ public class BlockIronChest extends BlockContainer {
|
|||
return true;
|
||||
}*/
|
||||
|
||||
if (world.isRemote)
|
||||
/*if (world.isRemote)
|
||||
{
|
||||
return true;
|
||||
}
|
||||
|
||||
player.openGui(IronChest.instance, ((TileEntityIronChest) te).getType().ordinal(), world, pos.getX(), pos.getY(), pos.getZ());
|
||||
return true;
|
||||
}
|
||||
}*/
|
||||
|
||||
@Override
|
||||
/*@Override
|
||||
public void onBlockAdded(World world, BlockPos pos, IBlockState blockState)
|
||||
{
|
||||
super.onBlockAdded(world, pos, blockState);
|
||||
world.markBlockForUpdate(pos);
|
||||
}
|
||||
}*/
|
||||
|
||||
@Override
|
||||
/*@Override
|
||||
public void onBlockPlacedBy(World world, BlockPos pos, IBlockState blockState, EntityLivingBase entityliving, ItemStack itemStack)
|
||||
{
|
||||
byte chestFacing = 0;
|
||||
|
@ -146,7 +151,7 @@ public class BlockIronChest extends BlockContainer {
|
|||
teic.setFacing(chestFacing);
|
||||
world.markBlockForUpdate(pos);
|
||||
}
|
||||
}
|
||||
}*/
|
||||
|
||||
/*@Override
|
||||
public int damageDropped(int i)
|
||||
|
@ -154,7 +159,7 @@ public class BlockIronChest extends BlockContainer {
|
|||
return i;
|
||||
}*/
|
||||
|
||||
@Override
|
||||
/*@Override
|
||||
public void breakBlock(World world, BlockPos pos, IBlockState blockState)
|
||||
{
|
||||
TileEntityIronChest tileentitychest = (TileEntityIronChest) world.getTileEntity(pos);
|
||||
|
@ -199,9 +204,9 @@ public class BlockIronChest extends BlockContainer {
|
|||
world.spawnEntityInWorld(entityitem);
|
||||
}
|
||||
}
|
||||
}
|
||||
}*/
|
||||
|
||||
@Override
|
||||
/*@Override
|
||||
@SuppressWarnings({ "rawtypes", "unchecked" })
|
||||
@SideOnly(Side.CLIENT)
|
||||
public void getSubBlocks(Item par1, CreativeTabs par2CreativeTabs, List par3List)
|
||||
|
@ -213,7 +218,7 @@ public class BlockIronChest extends BlockContainer {
|
|||
par3List.add(new ItemStack(this, 1, type.ordinal()));
|
||||
}
|
||||
}
|
||||
}
|
||||
}*/
|
||||
|
||||
/*@Override
|
||||
public float getExplosionResistance(Entity par1Entity, World world, int x, int y, int z, double explosionX, double explosionY, double explosionZ)
|
||||
|
@ -230,12 +235,12 @@ public class BlockIronChest extends BlockContainer {
|
|||
return super.getExplosionResistance(par1Entity, world, x, y, z, explosionX, explosionY, explosionZ);
|
||||
}*/
|
||||
|
||||
@Override
|
||||
/*@Override
|
||||
public boolean hasComparatorInputOverride() {
|
||||
return true;
|
||||
}
|
||||
}*/
|
||||
|
||||
@Override
|
||||
/*@Override
|
||||
public int getComparatorInputOverride(World world, BlockPos pos)
|
||||
{
|
||||
TileEntity te = world.getTileEntity(pos);
|
||||
|
@ -244,7 +249,7 @@ public class BlockIronChest extends BlockContainer {
|
|||
return Container.calcRedstoneFromInventory((IInventory)te);
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
}*/
|
||||
|
||||
/*private static final ForgeDirection[] validRotationAxes = new ForgeDirection[] { UP, DOWN };
|
||||
@Override
|
||||
|
|
|
@ -20,7 +20,7 @@ import net.minecraftforge.fml.common.event.FMLPreInitializationEvent;
|
|||
import net.minecraftforge.fml.common.network.NetworkRegistry;
|
||||
import net.minecraftforge.fml.common.registry.GameRegistry;
|
||||
|
||||
@Mod(modid = "IronChest", name = "Iron Chests", dependencies = "required-after:Forge@[10.10,);required-after:FML@[7.2,)")
|
||||
@Mod(modid = "IronChest", name = "Iron Chests", dependencies = "required-after:FML@[7.2,)")
|
||||
public class IronChest {
|
||||
public static BlockIronChest ironChestBlock;
|
||||
@SidedProxy(clientSide = "cpw.mods.ironchest.client.ClientProxy", serverSide = "cpw.mods.ironchest.CommonProxy")
|
||||
|
@ -53,11 +53,11 @@ public class IronChest {
|
|||
cfg.save();
|
||||
}*/
|
||||
ironChestBlock = new BlockIronChest();
|
||||
GameRegistry.registerBlock(ironChestBlock, ItemIronChest.class, "BlockIronChest");
|
||||
PacketHandler.INSTANCE.ordinal();
|
||||
GameRegistry.registerBlock(ironChestBlock,/* ItemIronChest.class,*/ "BlockIronChest");
|
||||
//PacketHandler.INSTANCE.ordinal();
|
||||
}
|
||||
|
||||
@EventHandler
|
||||
/*@EventHandler
|
||||
public void load(FMLInitializationEvent evt)
|
||||
{
|
||||
for (IronChestType typ : IronChestType.values())
|
||||
|
@ -74,5 +74,5 @@ public class IronChest {
|
|||
// {
|
||||
// MinecraftForge.EVENT_BUS.register(new OcelotsSitOnChestsHandler());
|
||||
// }
|
||||
}
|
||||
}*/
|
||||
}
|
||||
|
|
|
@ -20,9 +20,11 @@ import net.minecraft.inventory.Slot;
|
|||
import net.minecraft.item.Item;
|
||||
import net.minecraft.item.ItemStack;
|
||||
import net.minecraft.nbt.NBTTagByte;
|
||||
import net.minecraft.util.IStringSerializable;
|
||||
import net.minecraftforge.fml.common.registry.GameRegistry;
|
||||
|
||||
public enum IronChestType {
|
||||
public enum IronChestType implements IStringSerializable
|
||||
{
|
||||
IRON(54, 9, true, "Iron Chest", "ironchest.png", 0, Arrays.asList("ingotIron", "ingotRefinedIron"), TileEntityIronChest.class, "mmmmPmmmm", "mGmG3GmGm"),
|
||||
GOLD(81, 9, true, "Gold Chest", "goldchest.png", 1, Arrays.asList("ingotGold"), TileEntityGoldChest.class, "mmmmPmmmm", "mGmG4GmGm"),
|
||||
DIAMOND(108, 12, true, "Diamond Chest", "diamondchest.png", 2, Arrays.asList("gemDiamond"), TileEntityDiamondChest.class, "GGGmPmGGG", "GGGG4Gmmm"),
|
||||
|
@ -63,6 +65,12 @@ public enum IronChestType {
|
|||
this.matList = new ArrayList<String>();
|
||||
matList.addAll(mats);
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getID()
|
||||
{
|
||||
return name().toLowerCase();
|
||||
}
|
||||
|
||||
public String getModelTexture()
|
||||
{
|
||||
|
|
|
@ -387,7 +387,7 @@ public class TileEntityIronChest extends TileEntity implements IUpdatePlayerList
|
|||
int newSize = newEntity.chestContents.length;
|
||||
System.arraycopy(chestContents, 0, newEntity.chestContents, 0, Math.min(newSize, chestContents.length));
|
||||
BlockIronChest block = IronChest.ironChestBlock;
|
||||
block.dropContent(newSize, this, this.worldObj, pos);
|
||||
//block.dropContent(newSize, this, this.worldObj, pos);
|
||||
newEntity.setFacing(facing);
|
||||
newEntity.sortTopStacks();
|
||||
newEntity.ticksSinceSync = -1;
|
||||
|
|
Loading…
Reference in New Issue