Jump to content

(1.18.2) Creating a half-height block


badkraft

Recommended Posts

I have the block below (`clay oven`). It is supposed to be a half-height block.

219908140-2756cc45-a943-48f1-89da-f7ce2d

I'm looking for blocks in vanilla I can research that might give me a clue how to correct the rendering so the top renders where it's supposed to be and the top half of the block is transparent.

Another problem I'm having with this block is that when I place it, I get the back side facing me. How do I correct that?

Here is the current source (pretty basic at this point):

Spoiler
	private static class ClayOvenBlock extends CampfireBlock {

		public ClayOvenBlock() {
			super(true, 0, BlockBehaviour.Properties
					.of(Material.STONE)
					.strength(3.5F)
					.requiresCorrectToolForDrops()
					.lightLevel(litBlockEmission(8)));
		}

	}

I added the following to properly render the collision frame:

		protected static final VoxelShape SHAPE = Block.box(0.0D, 0.0D, 0.0D, 16.0D, 9.0D, 16.0D);

		//	...

		public VoxelShape getShape(BlockState state, BlockGetter getter, BlockPos pos, CollisionContext context) {
			return SHAPE;
		}

Side note: `getShape` is deprecated. What are we supposed to use? Campfire is using this method override.

Edited by badkraft
Link to comment
Share on other sites

11 hours ago, badkraft said:

I'm looking for blocks in vanilla I can research that might give me a clue how to correct the rendering so the top renders where it's supposed to be and the top half of the block is transparent.

The slab block?

11 hours ago, badkraft said:

Another problem I'm having with this block is that when I place it, I get the back side facing me. How do I correct that?

Look at how the FurnaceBlock specifies side using a property.

11 hours ago, badkraft said:

Side note: `getShape` is deprecated. What are we supposed to use? Campfire is using this method override.

#getShape. Mojang deprecates the method for usage, not overriding.

Link to comment
Share on other sites

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.

Guest
Unfortunately, your content contains terms that we do not allow. Please edit your content to remove the highlighted words below.
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.



×
×
  • Create New...

Important Information

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