-
How can i convert ItemStack to Supplier<ItemStack>???
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)
-
[1.12.2][solved] Block getMetaFromState for multiple properties
Got it now Thank you for your help I removed this if (enumfacing.getAxis() == EnumFacing.Axis.Y) { enumfacing = EnumFacing.NORTH; }
-
[1.12.2][solved] Block getMetaFromState for multiple properties
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); }
-
[1.12.2][solved] Block getMetaFromState for multiple properties
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)
-
[1.12.2][solved] Block getMetaFromState for multiple properties
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); }
-
[1.12.2][solved] Block getMetaFromState for multiple properties
That is getStateFromMeta method I get this exception
-
[1.12.2][solved] Block getMetaFromState for multiple properties
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?
-
[1.12.2][solved] Block getMetaFromState for multiple properties
Alright. Thank you
-
[1.12.2][solved] Block getMetaFromState for multiple properties
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?
-
[1.12.2][solved] Block getMetaFromState for multiple properties
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; }
-
[1.12.2][solved] Block getMetaFromState for multiple properties
Or even if I have 3 properties, then I would probably need TileEntity class
-
[1.12.2][solved] Block getMetaFromState for multiple properties
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.
-
[1.12.2] Custom cauldron liquid storing detection (?)
Alright. Thank you
-
[1.12.2] Custom cauldron liquid storing detection (?)
Ok, I'll have a look. Thank you
-
[1.12.2] Custom cauldron liquid storing detection (?)
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
IPS spam blocked by CleanTalk.