lethinh Posted April 3, 2017 Posted April 3, 2017 Here is my written code: https://gist.github.com/anonymous/07469e8949863a712c21d1c512accb13 And I'm stuck on that I have created a block that have meta but facing hasn't. Please help me... Quote
Choonster Posted April 3, 2017 Posted April 3, 2017 (edited) You're not storing the facing in the metadata in getMetaFromState and you're treating the raw metadata value as both the facing and the variant in getStateFromMeta, which won't work. In getMetaFromState, you need to combine the facing and variant into a single metadata value using bitwise operators and then return it. In getStateFromMeta, you need to extract the facing and variant from the metadata using bitwise operators and then return the IBlockState with these values set. If your block can't have vertical facings, use EnumFacing.getHorizontal instead of EnumFacing.getFront to get the EnumFacing from its index. Use EnumFacing#getHorizontalIndex to get the horizontal index of an EnumFacing. Keep in mind that metadata is limited to 4 bits (16 possible values). If you have 4 possible facings (north, south, east, west), that only leaves room for 4 possible variants (because 4 * 4 = 16). Look at BlockAnvil for an example of a Block with two properties (facing and damage). Edited April 3, 2017 by Choonster Quote Please don't PM me to ask for help. Asking your question in a public thread preserves it for people who are having the same problem in the future.
blinky000 Posted April 4, 2017 Posted April 4, 2017 Also check out this thread "1.10 Blocks with multiple properties" in this forum Quote
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.