DonKresenko
Members-
Posts
63 -
Joined
-
Last visited
Converted
-
Gender
Male
-
Location
Serbia
-
Personal Text
#SSHN
DonKresenko's Achievements
Stone Miner (3/8)
0
Reputation
-
[1.12.2][solved] Block getMetaFromState for multiple properties
DonKresenko replied to DonKresenko's topic in Modder Support
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
DonKresenko replied to DonKresenko's topic in Modder Support
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
DonKresenko replied to DonKresenko's topic in Modder Support
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
DonKresenko replied to DonKresenko's topic in Modder Support
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
DonKresenko replied to DonKresenko's topic in Modder Support
That is getStateFromMeta method I get this exception -
[1.12.2][solved] Block getMetaFromState for multiple properties
DonKresenko replied to DonKresenko's topic in Modder Support
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
DonKresenko replied to DonKresenko's topic in Modder Support
Alright. Thank you -
[1.12.2][solved] Block getMetaFromState for multiple properties
DonKresenko replied to DonKresenko's topic in Modder Support
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
DonKresenko replied to DonKresenko's topic in Modder Support
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
DonKresenko replied to DonKresenko's topic in Modder Support
Or even if I have 3 properties, then I would probably need TileEntity class -
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 (?)
DonKresenko replied to DonKresenko's topic in Modder Support
Alright. Thank you -
[1.12.2] Custom cauldron liquid storing detection (?)
DonKresenko replied to DonKresenko's topic in Modder Support
Ok, I'll have a look. Thank you -
[1.12.2] Custom cauldron liquid storing detection (?)
DonKresenko replied to DonKresenko's topic in Modder Support
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 -
I am creating a custom cauldron. It functions almost the same way as vanilla cauldron except it can store multiple liquids. My problem is that I don't know how to detect which liquid I am storing and preventing the player to "mix" liquids in same cauldron (in other words, only one type of liquid can be in cauldron). Any ideas how to do that?