Jump to content

Recommended Posts

Posted (edited)

Hi, I'm having an issue with my block entities (it's currently two) where the model isn't rendering correctly. Not only is there no texture, but the custom model also isn't there; it appears as the standard Minecraft square. I'm not sure why this is happening, because I used the exact same method for another block entity and the model works perfectly fine. I checked the .json file and it's referencing everything correctly. Even weirder, the item model is completely fine; it's just an issue when I place it. Below I'll send the .json and the Block class of one of the block entities. If you need any more files, I'd be glad to send them!

.json file:

{
	"credit": "Made with Blockbench",
	"texture_size": [128, 128],
	"textures": {
		"0": "darkcollective:block/fabricatormk1",
		"particle": "darkcollective:block/fabricatormk1"

	},
	"elements": [
		{
			"name": "fabricator",
			"from": [1, 8, -6],
			"to": [2, 16, -5],
			"rotation": {"angle": 45, "axis": "x", "origin": [8, 0, 8]},
			"faces": {
				"north": {"uv": [0.875, 0.125, 1, 1.125], "texture": "#0"},
				"east": {"uv": [0.75, 0.125, 0.875, 1.125], "texture": "#0"},
				"south": {"uv": [1.125, 0.125, 1.25, 1.125], "texture": "#0"},
				"west": {"uv": [1, 0.125, 1.125, 1.125], "texture": "#0"},
				"up": {"uv": [1, 0.125, 0.875, 0], "texture": "#0"},
				"down": {"uv": [1.125, 0, 1, 0.125], "texture": "#0"}
			}
		},
		{
			"name": "fabricator",
			"from": [0, 8, 0],
			"to": [16, 16, 16],
			"rotation": {"angle": 0, "axis": "y", "origin": [8, 0, 8]},
			"faces": {
				"north": {"uv": [2, 2, 4, 3], "texture": "#0"},
				"east": {"uv": [0, 2, 2, 3], "texture": "#0"},
				"south": {"uv": [6, 2, 8, 3], "texture": "#0"},
				"west": {"uv": [4, 2, 6, 3], "texture": "#0"},
				"up": {"uv": [4, 2, 2, 0], "texture": "#0"},
				"down": {"uv": [6, 0, 4, 2], "texture": "#0"}
			}
		},
		{
			"name": "fabricator",
			"from": [1, 0, 0],
			"to": [15, 8, 16],
			"rotation": {"angle": 0, "axis": "y", "origin": [8, 0, 8]},
			"faces": {
				"north": {"uv": [2, 5, 3.75, 6], "texture": "#0"},
				"east": {"uv": [0, 5, 2, 6], "texture": "#0"},
				"south": {"uv": [5.75, 5, 7.5, 6], "texture": "#0"},
				"west": {"uv": [3.75, 5, 5.75, 6], "texture": "#0"},
				"up": {"uv": [3.75, 5, 2, 3], "texture": "#0"},
				"down": {"uv": [5.5, 3, 3.75, 5], "texture": "#0"}
			}
		},
		{
			"name": "fabricator",
			"from": [15, 0, 4],
			"to": [16, 7, 12],
			"rotation": {"angle": 0, "axis": "y", "origin": [8, 0, 8]},
			"faces": {
				"north": {"uv": [4.25, 8.875, 4.375, 9.75], "texture": "#0"},
				"east": {"uv": [3.25, 8.875, 4.25, 9.75], "texture": "#0"},
				"south": {"uv": [5.375, 8.875, 5.5, 9.75], "texture": "#0"},
				"west": {"uv": [4.375, 8.875, 5.375, 9.75], "texture": "#0"},
				"up": {"uv": [4.375, 8.875, 4.25, 7.875], "texture": "#0"},
				"down": {"uv": [4.5, 7.875, 4.375, 8.875], "texture": "#0"}
			}
		},
		{
			"name": "fabricator",
			"from": [0, 0, 4],
			"to": [1, 7, 12],
			"rotation": {"angle": 0, "axis": "y", "origin": [8, 0, 8]},
			"faces": {
				"north": {"uv": [6.75, 8.5, 6.875, 9.375], "texture": "#0"},
				"east": {"uv": [5.75, 8.5, 6.75, 9.375], "texture": "#0"},
				"south": {"uv": [7.875, 8.5, 8, 9.375], "texture": "#0"},
				"west": {"uv": [6.875, 8.5, 7.875, 9.375], "texture": "#0"},
				"up": {"uv": [6.875, 8.5, 6.75, 7.5], "texture": "#0"},
				"down": {"uv": [7, 7.5, 6.875, 8.5], "texture": "#0"}
			}
		},
		{
			"name": "fabricator",
			"from": [1, 16, -14],
			"to": [2, 17, 2],
			"rotation": {"angle": 45, "axis": "x", "origin": [8, 0, 8]},
			"faces": {
				"north": {"uv": [8, 3, 8.125, 3.125], "texture": "#0"},
				"east": {"uv": [6, 3, 8, 3.125], "texture": "#0"},
				"south": {"uv": [10.125, 3, 10.25, 3.125], "texture": "#0"},
				"west": {"uv": [8.125, 3, 10.125, 3.125], "texture": "#0"},
				"up": {"uv": [8.125, 3, 8, 1], "texture": "#0"},
				"down": {"uv": [8.25, 1, 8.125, 3], "texture": "#0"}
			}
		},
		{
			"name": "fabricator",
			"from": [0, 16, 3],
			"to": [16, 28, 5],
			"rotation": {"angle": 0, "axis": "y", "origin": [8, 0, 8]},
			"faces": {
				"north": {"uv": [2.5, 6.375, 4.5, 7.875], "texture": "#0"},
				"east": {"uv": [2.25, 6.375, 2.5, 7.875], "texture": "#0"},
				"south": {"uv": [4.75, 6.375, 6.75, 7.875], "texture": "#0"},
				"west": {"uv": [4.5, 6.375, 4.75, 7.875], "texture": "#0"},
				"up": {"uv": [4.5, 6.375, 2.5, 6.125], "texture": "#0"},
				"down": {"uv": [6.5, 6.125, 4.5, 6.375], "texture": "#0"}
			}
		},
		{
			"name": "fabricator",
			"from": [3, 17, 2],
			"to": [13, 27, 3],
			"rotation": {"angle": 0, "axis": "y", "origin": [8, 0, 8]},
			"faces": {
				"north": {"uv": [6.875, 6.25, 8.125, 7.5], "texture": "#0"},
				"east": {"uv": [6.75, 6.25, 6.875, 7.5], "texture": "#0"},
				"south": {"uv": [8.25, 6.25, 9.5, 7.5], "texture": "#0"},
				"west": {"uv": [8.125, 6.25, 8.25, 7.5], "texture": "#0"},
				"up": {"uv": [8.125, 6.25, 6.875, 6.125], "texture": "#0"},
				"down": {"uv": [9.375, 6.125, 8.125, 6.25], "texture": "#0"}
			}
		},
		{
			"name": "fabricator",
			"from": [14, 16, -14],
			"to": [15, 17, 2],
			"rotation": {"angle": 45, "axis": "x", "origin": [8, 0, 8]},
			"faces": {
				"north": {"uv": [2, 8, 2.125, 8.125], "texture": "#0"},
				"east": {"uv": [0, 8, 2, 8.125], "texture": "#0"},
				"south": {"uv": [4.125, 8, 4.25, 8.125], "texture": "#0"},
				"west": {"uv": [2.125, 8, 4.125, 8.125], "texture": "#0"},
				"up": {"uv": [2.125, 8, 2, 6], "texture": "#0"},
				"down": {"uv": [2.25, 6, 2.125, 8], "texture": "#0"}
			}
		},
		{
			"name": "fabricator",
			"from": [14, 8, -6],
			"to": [15, 16, -5],
			"rotation": {"angle": 45, "axis": "x", "origin": [8, 0, 8]},
			"faces": {
				"north": {"uv": [1.375, 0.125, 1.5, 1.125], "texture": "#0"},
				"east": {"uv": [1.25, 0.125, 1.375, 1.125], "texture": "#0"},
				"south": {"uv": [1.625, 0.125, 1.75, 1.125], "texture": "#0"},
				"west": {"uv": [1.5, 0.125, 1.625, 1.125], "texture": "#0"},
				"up": {"uv": [1.5, 0.125, 1.375, 0], "texture": "#0"},
				"down": {"uv": [1.625, 0, 1.5, 0.125], "texture": "#0"}
			}
		},
		{
			"name": "fabricator",
			"from": [7, 16, -14],
			"to": [9, 17, 2],
			"rotation": {"angle": 45, "axis": "x", "origin": [8, 0, 8]},
			"faces": {
				"north": {"uv": [7.5, 6, 7.75, 6.125], "texture": "#0"},
				"east": {"uv": [5.5, 6, 7.5, 6.125], "texture": "#0"},
				"south": {"uv": [9.75, 6, 10, 6.125], "texture": "#0"},
				"west": {"uv": [7.75, 6, 9.75, 6.125], "texture": "#0"},
				"up": {"uv": [7.75, 6, 7.5, 4], "texture": "#0"},
				"down": {"uv": [8, 4, 7.75, 6], "texture": "#0"}
			}
		},
		{
			"name": "fabricator",
			"from": [7, 8, -6],
			"to": [9, 16, -5],
			"rotation": {"angle": 45, "axis": "x", "origin": [8, 0, 8]},
			"faces": {
				"north": {"uv": [0.125, 0.125, 0.375, 1.125], "texture": "#0"},
				"east": {"uv": [0, 0.125, 0.125, 1.125], "texture": "#0"},
				"south": {"uv": [0.5, 0.125, 0.75, 1.125], "texture": "#0"},
				"west": {"uv": [0.375, 0.125, 0.5, 1.125], "texture": "#0"},
				"up": {"uv": [0.375, 0.125, 0.125, 0], "texture": "#0"},
				"down": {"uv": [0.625, 0, 0.375, 0.125], "texture": "#0"}
			}
		}
	],
	"display": {
		"thirdperson_righthand": {
			"rotation": [70, 0, 0],
			"translation": [0, 1, 0.25],
			"scale": [0.25, 0.25, 0.25]
		},
		"thirdperson_lefthand": {
			"rotation": [70, 0, 0],
			"scale": [0.25, 0.25, 0.25]
		},
		"firstperson_righthand": {
			"scale": [0.4, 0.4, 0.4]
		},
		"firstperson_lefthand": {
			"scale": [0.4, 0.4, 0.4]
		},
		"ground": {
			"scale": [0.4, 0.4, 0.4]
		},
		"gui": {
			"rotation": [0, 126, 0],
			"translation": [0, -2.75, 0],
			"scale": [0.5, 0.5, 0.5]
		},
		"fixed": {
			"translation": [0, -1.5, 0],
			"scale": [0.4, 0.4, 0.4]
		}
	},
	"groups": [
		{
			"name": "fabricator",
			"origin": [8, 0, 8],
			"color": 0,
			"children": [0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11]
		}
	]
}

Block class:

private static final VoxelShape SHAPE = makeShape();

    public FabricatorMK1(BlockBehaviour.Properties properties) {
        super(properties);
    }

    @Override
    public VoxelShape getShape(BlockState state, BlockGetter level, BlockPos pos, CollisionContext ctx) {
        return SHAPE;
    }

    @Nullable
    @Override
    public BlockEntity newBlockEntity(BlockPos pos, BlockState state) {
        return BlockEntityInit.FABRICATORMK1_ENTITY.get().create(pos, state);
    }

    @Override
    public void onRemove(BlockState state, Level level, BlockPos pos, BlockState newState, boolean isMoving) {
        if(state.getBlock() != newState.getBlock()){
            BlockEntity blockEntity = level.getBlockEntity(pos);
            if (blockEntity instanceof FabricatorMK1Entity){
                ((FabricatorMK1Entity) blockEntity).drops();
            }
        }
    }

    @Override
    public RenderShape getRenderShape(BlockState state) {
        return RenderShape.MODEL;
    }

    @Override
    protected void createBlockStateDefinition(StateDefinition.Builder<Block, BlockState> builder) {
        super.createBlockStateDefinition(builder);
        builder.add(HorizontalDirectionalBlock.FACING);
    }

    @Nullable
    @Override
    public BlockState getStateForPlacement(BlockPlaceContext ctx) {
        return defaultBlockState().setValue(HorizontalDirectionalBlock.FACING, ctx.getHorizontalDirection().getOpposite());
    }

    @Override
    public InteractionResult use(BlockState state, Level level, BlockPos pos, Player player, InteractionHand interactionHand, BlockHitResult result) {
        if(!level.isClientSide())
        {
            BlockEntity entity = level.getBlockEntity(pos);
            if (entity instanceof FabricatorMK1Entity)
            {
                NetworkHooks.openScreen(((ServerPlayer)player), (FabricatorMK1Entity)entity, pos);
            } else {
                throw new IllegalStateException("Our Container provider is missing!");
            }
        }

        return InteractionResult.sidedSuccess(level.isClientSide());
    }

    @Nullable
    @Override
    public <T extends BlockEntity> BlockEntityTicker<T> getTicker(Level level, BlockState state, BlockEntityType<T> type) {
        if(level.isClientSide()) {
            return null;
        }


        return createTickerHelper(type, BlockEntityInit.FABRICATORMK1_ENTITY.get(), (level1, pos, state1, blockEntity) -> blockEntity.tick(level1, pos, state1));
    }

    public static VoxelShape makeShape(){
        VoxelShape SHAPE = Shapes.empty();
        SHAPE = Shapes.join(SHAPE, Shapes.box(0.0625, 0.5, -0.375, 0.125, 1, -0.3125), BooleanOp.OR);
        SHAPE = Shapes.join(SHAPE, Shapes.box(0, 0.5, 0, 1, 1, 1), BooleanOp.OR);
        SHAPE = Shapes.join(SHAPE, Shapes.box(0.0625, 0, 0, 0.9375, 0.5, 1), BooleanOp.OR);
        SHAPE = Shapes.join(SHAPE, Shapes.box(0.9375, 0, 0.25, 1, 0.4375, 0.75), BooleanOp.OR);
        SHAPE = Shapes.join(SHAPE, Shapes.box(0, 0, 0.25, 0.0625, 0.4375, 0.75), BooleanOp.OR);
        SHAPE = Shapes.join(SHAPE, Shapes.box(0.0625, 1, -0.875, 0.125, 1.0625, 0.125), BooleanOp.OR);
        SHAPE = Shapes.join(SHAPE, Shapes.box(0, 1, 0.1875, 1, 1.75, 0.3125), BooleanOp.OR);
        SHAPE = Shapes.join(SHAPE, Shapes.box(0.1875, 1.0625, 0.125, 0.8125, 1.6875, 0.1875), BooleanOp.OR);
        SHAPE = Shapes.join(SHAPE, Shapes.box(0.875, 1, -0.875, 0.9375, 1.0625, 0.125), BooleanOp.OR);
        SHAPE = Shapes.join(SHAPE, Shapes.box(0.875, 0.5, -0.375, 0.9375, 1, -0.3125), BooleanOp.OR);
        SHAPE = Shapes.join(SHAPE, Shapes.box(0.4375, 1, -0.875, 0.5625, 1.0625, 0.125), BooleanOp.OR);
        SHAPE = Shapes.join(SHAPE, Shapes.box(0.4375, 0.5, -0.375, 0.5625, 1, -0.3125), BooleanOp.OR);

        return SHAPE;
    }

I also have a GitHub where you can find the necessary files for the Fabricator (Block entity in question):https://github.com/giornoggiovanna/DarkCollectiveGit

Thanks for the help!

Edited by BlueFFlame
Added Tags
Posted
5 hours ago, BlueFFlame said:

Hi, I'm having an issue with my block entities (it's currently two) where the model isn't rendering correctly.

Looks like you are missing the blockstate json file for the fabricatormk1.

Posted
3 hours ago, vemerion said:

Looks like you are missing the blockstate json file for the fabricatormk1.

Ah yes, it worked. Thank you for the help!

I do have another issue, but I may make another post for that as it's related to recipes rather than models. Thank you again!

  • Like 1

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.

Announcements



×
×
  • Create New...

Important Information

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