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



  • Recently Browsing

    • No registered users viewing this page.
  • Posts

    • Hello everyone, i'm new with programing Mods, and will need a lot of your help if possible,  Im trying to make a new GUI interface responsible to control the Droprate of game, it will control de loot drop and loot table for mobs and even blocks, but i try to make a simple Gui Screen, and wenever i try to use it, the game crash's with the error message in the subject, here is the code im using to:  IDE: IntelliJ Comunity - latest version Forge: 47.3.0 Minecraft version: 1.20.1 mapping_channel: parchment mapping_version=2023.09.03-1.20.1   Code im using is:    package createchronical.droprateconfig; import com.mojang.blaze3d.systems.RenderSystem; import net.minecraft.client.gui.GuiGraphics; import net.minecraft.client.gui.components.Button; import net.minecraft.client.gui.screens.Screen; import net.minecraft.network.chat.Component; import net.minecraft.resources.ResourceLocation; import java.util.HashMap; import java.util.Map; public class ConfigScreen extends Screen { private static final ResourceLocation BACKGROUND_TEXTURE = new ResourceLocation("droprateconfig", "textures/gui/config_background.png"); // Mapa de mobs e itens com seus respectivos drop rates private final Map<String, Integer> dropRates = new HashMap<>(); public ConfigScreen() { super(Component.literal("Configurações de Drop Rate")); // Inicializa com valores de drop rate padrão dropRates.put("Zombie", 10); // Exemplo de mob dropRates.put("Creeper", 5); // Exemplo de mob dropRates.put("Iron Ore", 50); // Exemplo de item dropRates.put("Diamond", 2); // Exemplo de item } @Override protected void init() { // Cria um botão para cada mob/item e adiciona na tela int yOffset = this.height / 2 - 100; // Posicionamento inicial for (Map.Entry<String, Integer> entry : dropRates.entrySet()) { String itemName = entry.getKey(); int dropRate = entry.getValue(); // Cria um botão para cada mob/item this.addRenderableWidget(Button.builder( Component.literal(itemName + ": " + dropRate + "%"), button -> onDropRateButtonPressed(itemName) ).bounds(this.width / 2 - 100, yOffset, 200, 20).build()); yOffset += 25; // Incrementa a posição Y para o próximo botão } // Adiciona o botão de "Salvar Configurações" this.addRenderableWidget(Button.builder(Component.literal("Salvar Configurações"), button -> onSavePressed()) .bounds(this.width / 2 - 100, yOffset, 200, 20) .build()); } private void onDropRateButtonPressed(String itemName) { // Lógica para alterar o drop rate do item/mob selecionado // Aqui, vamos apenas incrementar o valor como exemplo int currentRate = dropRates.get(itemName); dropRates.put(itemName, currentRate + 5); // Aumenta o drop rate em 5% } private void onSavePressed() { // Lógica para salvar as configurações (temporariamente apenas na memória) // Vamos apenas imprimir para verificar dropRates.forEach((item, rate) -> { System.out.println("Item: " + item + " | Novo Drop Rate: " + rate + "%"); }); // Fecha a tela após salvar Screen pGuiScreen = null; assert this.minecraft != null; this.minecraft.setScreen(pGuiScreen); } @Override public void render(GuiGraphics guiGraphics, int mouseX, int mouseY, float partialTicks) { this.renderBackground(guiGraphics); guiGraphics.blit(BACKGROUND_TEXTURE, this.width / 2 - 128, this.height / 2 - 128, 0, 0, 256, 256, 256, 256); super.render(guiGraphics, mouseX, mouseY, partialTicks); } }  
    • Also add the latest.log from /logs/
    • I was hoping I could get some help with this weird crash. I've hosted many servers before and never had this issue. Now and then the server crashed with "Exception ticking world". Everywhere I looked I rarely found any info on it (usually found ticking entity instead). Any advice I did get (mostly from the modpack owner's discord) was "We don't know and it's near impossible to find out what it is". Here is the crash report:   Description: Exception ticking world java.util.ConcurrentModificationException     at java.util.HashMap$HashIterator.nextNode(Unknown Source)     at java.util.HashMap$KeyIterator.next(Unknown Source)     at net.minecraft.entity.EntityTracker.sendLeashedEntitiesInChunk(EntityTracker.java:386)     at net.minecraft.server.management.PlayerChunkMapEntry.sendToPlayers(PlayerChunkMapEntry.java:162)     at net.minecraft.server.management.PlayerChunkMap.tick(SourceFile:165)     at net.minecraft.world.WorldServer.tick(WorldServer.java:227)     at net.minecraft.server.MinecraftServer.updateTimeLightAndEntities(MinecraftServer.java:756)     at net.minecraft.server.dedicated.DedicatedServer.updateTimeLightAndEntities(DedicatedServer.java:397)     at net.minecraft.server.MinecraftServer.tick(MinecraftServer.java:668)     at net.minecraft.server.MinecraftServer.run(MinecraftServer.java:526)     at java.lang.Thread.run(Unknown Source)   If you want the full version, I can link a pastebin if needed. Modpack link: https://www.curseforge.com/minecraft/modpacks/multiblock-madness Some helpful information is that: It seems to only happen when I leave my void world to enter the overworld. Only happens 5-10% of the time. Only happens when leaving the void world, and only the void world. I know it's a slim chance someone could help, but it'd be greatly appreciated.
    • thanks a lot bro i knew i shouldve gone on the actual website instead of the discord
    • Minecraft Version? Reinstall Java 17 and/or Java 21 If this is still not working, run jarfix https://johann.loefflmann.net/de/software/jarfix/index.html
  • Topics

×
×
  • Create New...

Important Information

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