Jump to content

Phonixe

Members
  • Posts

    34
  • Joined

  • Last visited

Everything posted by Phonixe

  1. I'm setting the UUID Field inside the TE, It is now no longer static but it seems like there is still the same issue, so i'm guessing i'm doing something wrong with setting the UUID field. Here is one of the interractions with the entity : @Override public void onBlockPlacedBy(World worldIn, BlockPos pos, IBlockState state, EntityLivingBase placer, ItemStack stack) { if (!worldIn.isRemote) { TileEntityChair id = new TileEntityChair(); WorldServer worldserver = (WorldServer) worldIn; worldIn.spawnEntityInWorld(worldserver.getEntityFromUuid(id.ChairUUID)); } super.onBlockPlacedBy(worldIn, pos, state, placer, stack); } And this is the TE : public class TileEntityChair extends TileEntity { public UUID ChairUUID; public void TileEntityChairID(UUID id) { id = new EntityChair(worldObj).getPersistentID(); ChairUUID = id; } }
  2. Thanks again! But there still seems to be an issue... None of the interractions with the entity work. Here is the current chair block code : public class Phoerite_Chair extends Block { public static PropertyDirection FACING = PropertyDirection.create("facing", EnumFacing.Plane.HORIZONTAL); public Phoerite_Chair(Material materialIn) { super(materialIn); this.setDefaultState(this.blockState.getBaseState().withProperty(FACING, EnumFacing.NORTH)); super.setBlockBounds( 0.0F, 0F, 0.0F, 1.0F, 1.35F, 1.0F); } @Override public boolean isOpaqueCube() { return false; } @Override public EnumWorldBlockLayer getBlockLayer() { return EnumWorldBlockLayer.CUTOUT; } @Override public void onBlockPlacedBy(World worldIn, BlockPos pos, IBlockState state, EntityLivingBase placer, ItemStack stack) { if (!worldIn.isRemote) { WorldServer worldserver = (WorldServer) worldIn; worldIn.spawnEntityInWorld(worldserver.getEntityFromUuid(TileEntityChair.ChairUUID)); } super.onBlockPlacedBy(worldIn, pos, state, placer, stack); } @Override public boolean onBlockActivated(World worldIn, BlockPos pos, IBlockState state, EntityPlayer playerIn,EnumFacing side, float hitX, float hitY, float hitZ) { if (!worldIn.isRemote) { WorldServer worldserver = (WorldServer) worldIn; playerIn.mountEntity(worldserver.getEntityFromUuid(TileEntityChair.ChairUUID)); } return super.onBlockActivated(worldIn, pos, state, playerIn, side, hitX, hitY, hitZ); } @Override public void onBlockDestroyedByPlayer(World worldIn, BlockPos pos, IBlockState state) { if (!worldIn.isRemote) { WorldServer worldserver = (WorldServer) worldIn; worldserver.getEntityFromUuid(TileEntityChair.ChairUUID).setDead(); } super.onBlockDestroyedByPlayer(worldIn, pos, state); } @Override public IBlockState onBlockPlaced(World worldIn, BlockPos pos, EnumFacing facing, float hitX, float hitY, float hitZ, int meta, EntityLivingBase placer) { IBlockState state = super.onBlockPlaced(worldIn, pos, facing, hitX, hitY, hitZ, meta, placer); return state.withProperty(FACING, placer.getHorizontalFacing()); } @Override public int getMetaFromState(IBlockState state) { return ((EnumFacing) state.getValue(FACING)).getHorizontalIndex(); } @Override public IBlockState getStateFromMeta(int meta) { return this.getDefaultState().withProperty(FACING, EnumFacing.getHorizontal(meta)); } @Override protected BlockState createBlockState() { return new BlockState(this, new IProperty[] {FACING}); } }
  3. Alright thanks! But how do I use this UUID to interact with the entity?
  4. Sorry, but how could I store the entity UUID? I'm not quite sure how to do this as i'm still a newbie..
  5. Hello, so i've been trying to create a custom chair that i can sit on, after many attempts I created it but there seems to be an issue when I try to sit on it. Whenever i right click the chair, it teleports me into it and then pushes me out and nothing happens afterwards. However if I log off and log back in I find myself sitting on the chair. Here's the code for the chair block
×
×
  • Create New...

Important Information

By using this site, you agree to our Terms of Use.