Posted December 19, 20159 yr Anybody know how to make a block placeable on any surface? I currently have the block rendering, and it appears on the top-side of a block when I place it down. I want to be able to place it on walls/ceiling/etc., like a lever. How do I do this?
December 19, 20159 yr Have you tried looking at BlockLever ? It uses its own enum to describe the possible facings and sets the facing from Block#onBlockPlaced when it's placed. 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.
December 19, 20159 yr Author Ya, but vanilla classes don't use the optimized JSON stuff that forge has set up right?
December 19, 20159 yr You will need a way to rotate your block model. Probably the easiest way is via the forge extensions to blockstate files. However you do it, you'll then need to override your block's onBlockPlaced method and check the axis to return the appropriate block state. It will need to have code that does something like this: switch (facing.getAxis()) { case X: return blockX.getStateFromMeta(meta); case Y: return blockY.getStateFromMeta(meta); case Z: return blockZ.getStateFromMeta(meta);
December 19, 20159 yr Ya, but vanilla classes don't use the optimized JSON stuff that forge has set up right? No, but you can use the vanilla lever's blockstates file as an example, just split the model and the rotation: define the model as either a default (single model) or based on the appropriate property (multiple models like the lever) and then define the rotation based on the facing property. 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.
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.