Jump to content

DonKresenko

Members
  • Posts

    64
  • Joined

  • Last visited

Converted

  • Personal Text
    #SSHN

Recent Profile Visitors

The recent visitors block is disabled and is not being shown to other users.

DonKresenko's Achievements

Stone Miner

Stone Miner (3/8)

0

Reputation

  1. Supplier is just a function that produces a value of type T (in your case ItemStack). You can use lambda here () -> new ItemStack(Blocks.ANVIL)
  2. Got it now Thank you for your help I removed this if (enumfacing.getAxis() == EnumFacing.Axis.Y) { enumfacing = EnumFacing.NORTH; }
  3. Alright I almost got it. The problem now is this image code: public IBlockState getStateFromMeta(int meta) { int lvl = meta>>2; int face = meta & 0b11; EnumFacing enumfacing = EnumFacing.getHorizontal(face); if (enumfacing.getAxis() == EnumFacing.Axis.Y) { enumfacing = EnumFacing.NORTH; } return this.getDefaultState().withProperty(LEVEL, Integer.valueOf(lvl)).withProperty(FACING, enumfacing); }
  4. Ok. public IBlockState getStateFromMeta(int meta) { int lvl = meta>>2; int face = meta & 0b11; EnumFacing enumfacing = EnumFacing.getFront(face); if (enumfacing.getAxis() == EnumFacing.Axis.Y) { enumfacing = EnumFacing.NORTH; } return this.getDefaultState().withProperty(LEVEL, Integer.valueOf(lvl)).withProperty(FACING, enumfacing); } This works for NORTH and SOUTH but not for the EAST and WEST This is my problem now (note that directional block is working, this is after reloading the world)
  5. sorry I read getMetaFromState public IBlockState getStateFromMeta(int meta) { EnumFacing enumfacing = EnumFacing.getFront(meta); if (enumfacing.getAxis() == EnumFacing.Axis.Y) { enumfacing = EnumFacing.NORTH; } return this.getDefaultState().withProperty(LEVEL, Integer.valueOf(meta)).withProperty(FACING, enumfacing); }
  6. That is getStateFromMeta method I get this exception
  7. I now decreased my property LEVEL to 2 bits (0-3) I tried this code but it seems not to be working public int getMetaFromState(IBlockState state) { int lvl = ((Integer)state.getValue(LEVEL)).intValue(); lvl <<= 2; int i = ((EnumFacing)state.getValue(FACING)).getHorizontalIndex(); // System.out.println(lvl+" | "+i+" = "+(lvl |= i)); lvl |= i; return lvl; } What am I doing wrong?
  8. Thank you for the information. I have LEVEL property (0,6) that takes 3 bits and FACING (n, s, e, w) which takes 2 bits. So I cannot do this cause I need 5 bits?
  9. I found this in BlockEndPortalFrame, but I am not quite familiar with this public int getMetaFromState(IBlockState state) { int i = 0; i = i | ((EnumFacing)state.getValue(FACING)).getHorizontalIndex(); if (((Boolean)state.getValue(EYE)).booleanValue()) { i |= 4; } return i; }
  10. Or even if I have 3 properties, then I would probably need TileEntity class
  11. I have two properties in my block, LEVEL and FACING. I need to store the meta in order to save the properties. I have this code public int getMetaFromState(IBlockState state) { return ((Integer)state.getValue(LEVEL)).intValue(); } which saves LEVEL property. I need a way to save FACING property too.
  12. Ok, I'll have a look. Thank you
  13. The thing is that you did not understood what I asked. I want to be able to place more than one liquid in the cauldron but I don't want to "mix" them. In other words, only one liquid can be in the cauldron at the time Here is the onBlockActivated method in my block With this code, I can add lava in my cauldron and take it out from the cauldron. Now I want to add the ability to store water, but not if there is lava already in the cauldron. Thank you for the reply
×
×
  • Create New...

Important Information

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