Jump to content
Search In
  • More options...
Find results that contain...
Find results in...

BlockEntity is invisible


Gulg
 Share

Recommended Posts

Here's my Block code:

package com.gulgdev.mechanism.block.custom;

import com.gulgdev.mechanism.block.ModBlocks;
import net.minecraft.core.BlockPos;
import net.minecraft.world.level.Level;
import net.minecraft.world.level.block.BaseEntityBlock;
import net.minecraft.world.level.block.entity.BlockEntity;
import net.minecraft.world.level.block.entity.BlockEntityTicker;
import net.minecraft.world.level.block.entity.BlockEntityType;
import net.minecraft.world.level.block.state.BlockState;

import javax.annotation.Nullable;

public class Motor extends BaseEntityBlock {
    public Motor(Properties properties) {
        super(properties);
    }

    @Override
    public BlockEntity newBlockEntity(BlockPos pos, BlockState state) {
        return new MotorBlockEntity(pos, state);
    }

    @Nullable
    @Override
    public <T extends BlockEntity> BlockEntityTicker<T> getTicker(Level level, BlockState state, BlockEntityType<T> type) {
        return type == ModBlocks.MOTOR_BLOCK_ENTITY.get() ? (pLevel, pPos, pState, pBlockEntity) -> MotorBlockEntity.tick(pLevel, pPos, pState, pLevel.getBlockEntity(pPos)) : null;
    }
}

blockstates/motor.json:

{
  "variants" : {
    "": { "model": "mechanism:block/motor" }
  }
}

models/block/motor.json:

{
	"textures": {
		"0": "mechanism:block/motor_south",
		"1": "mechanism:block/motor_north",
		"2": "mechanism:block/motor_pipe",
		"3": "mechanism:block/motor_east",
		"4": "mechanism:block/motor_pipe_back",
		"5": "mechanism:block/motor_bottom",
		"6": "mechanism:block/motor_pipe_bottom",
		"particle": "mechanism:block/motor_south"
	},
	"elements": [
		{
			"from": [1, 3, 1],
			"to": [15, 14, 15],
			"faces": {
				"north": {"uv": [0, 0, 16, 16], "texture": "#1"},
				"east": {"uv": [16, 0, 0, 16], "texture": "#3"},
				"south": {"uv": [16, 0, 0, 16], "texture": "#0"},
				"west": {"uv": [0, 0, 16, 16], "texture": "#5"},
				"up": {"uv": [16, 16, 0, 0], "texture": "#5"},
				"down": {"uv": [16, 0, 0, 16], "texture": "#5"}
			}
		},
		{
			"from": [13.25, 1, 1],
			"to": [15, 3, 2.75],
			"faces": {
				"north": {"uv": [0, 0, 16, 16], "texture": "#2"},
				"east": {"uv": [0, 0, 16, 16], "texture": "#4"},
				"south": {"uv": [0, 0, 16, 16], "texture": "#4"},
				"west": {"uv": [0, 0, 16, 16], "texture": "#4"},
				"up": {"uv": [0, 0, 0.5, 0.5], "texture": "#missing"},
				"down": {"uv": [0, 0, 16, 16], "texture": "#6"}
			}
		}
	]
}

In inventory the block renders correct, but when I place it it's invisible.

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
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.

 Share



×
×
  • Create New...

Important Information

By using this site, you agree to our Privacy Policy.