Jump to content

What is the error of texture json


KitKit

Recommended Posts

{
  "variants": {
    "normal": { "model": "examplemod:exampleblock" },
    "facing=up": { "model": "examplemod:exampleblock" },
    "facing=east": { "model": "examplemod:exampleblock" },
    "facing=south": { "model": "examplemod:exampleblock", "y": 90 },
    "facing=west": { "model": "examplemod:exampleblock", "y": 180 },
    "facing=north": { "model": "examplemod:exampleblock", "y": 270 }
  }
}

This is a blockstate.

 

{
  "textures": {
    "cbf": "examplemod:blocks/exampleblock"
  },
  "elements": [
    {
      "from": [0, 0, 0],
      "to": [16, 2, 16],
      "faces": {
        "down": { "uv": [ 0, 0, 16, 16 ], "texture": "#cbf" },
        "up": { "uv": [ 0, 0, 16, 16 ], "texture": "#cbf" },
        "east": { "uv": [ 0, 0, 16, 16 ], "texture": "#cbf" },
        "west": { "uv": [ 0, 0, 16, 16 ], "texture": "#cbf" },
        "north": { "uv": [ 0, 0, 16, 16 ], "texture": "#cbf" },
        "south": { "uv": [ 0, 0, 16, 16 ], "texture": "#cbf" }
      }
    }
  ]
}

This is a simple model.

 

{
  "textures": {
    "cbf": "examplemod:blocks/exampleblock"
  },
  "elements": [
    {
      "from": [0, 0, 0],
      "to": [2, 16, 16],
      "faces": {
        "down": { "uv": [ 16, 0, 0, 16 ], "texture": "#cbf" },
        "up": { "uv": [ 16, 0, 0, 16 ], "texture": "#cbf" },
        "east": { "uv": [ 16, 0, 0, 16 ], "texture": "#cbf" },
        "west": { "uv": [ 16, 0, 0, 16 ], "texture": "#cbf" },
        "north": { "uv": [ 16, 0, 0, 16 ], "texture": "#cbf" },
        "south": { "uv": [ 16, 0, 0, 16 ], "texture": "#cbf" }
      }
    }
  ]
}

This is the model to be applied when the object is on the wall.

The model should be on the surface (like a vine or a torch), but in the end it is always the same. Why?

Edited by KitKit
Link to comment
Share on other sites

3 minutes ago, Luis_ST said:

show the block class, and the facing "normal" dosen't exist, there are only up, down, north, south, east, west

If I remove "normal" from my blockstate, an exception is thrown that the "normal" variant was not found

Link to comment
Share on other sites

6 minutes ago, Luis_ST said:

show the block class, and the facing "normal" dosen't exist, there are only up, down, north, south, east, west

package com.example.examplemod.objects;

import com.example.examplemod.init.BlockInit;
import com.example.examplemod.init.ItemInit;
import net.minecraft.block.Block;
import net.minecraft.block.SoundType;
import net.minecraft.block.material.Material;
import net.minecraft.creativetab.CreativeTabs;
import net.minecraft.item.ItemBlock;

public class BaseBlock extends Block
{
    public BaseBlock(String name, Material material, float hardness, String toolClass, int harvestLevel, SoundType soundType, CreativeTabs creativeTab)
    {
        super(material);
        setRegistryName(name);
        setUnlocalizedName(name);
        setHardness(hardness);
        setHarvestLevel(toolClass, harvestLevel);
        setSoundType(soundType);
        setCreativeTab(creativeTab);

        BlockInit.BLOCKS.add(this);
        ItemInit.ITEMS.add(new ItemBlock(this).setRegistryName(this.getRegistryName()));
    }
}

I think there are no problems in the block class, because ordinary blocks were successfully created using it.

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.

Announcements



  • Recently Browsing

    • No registered users viewing this page.
  • Posts

    • Hello everyone, I'm making this post to seek help for my modded block, It's a special block called FrozenBlock supposed to take the place of an old block, then after a set amount of ticks, it's supposed to revert its Block State, Entity, data... to the old block like this :  The problem I have is that the system breaks when handling multi blocks (I tried some fix but none of them worked) :  The bug I have identified is that the function "setOldBlockFields" in the item's "setFrozenBlock" function gets called once for the 1st block of multiblock getting frozen (as it should), but gets called a second time BEFORE creating the first FrozenBlock with the data of the 1st block, hence giving the same data to the two FrozenBlock :   Old Block Fields set BlockState : Block{minecraft:black_bed}[facing=east,occupied=false,part=head] BlockEntity : net.minecraft.world.level.block.entity.BedBlockEntity@73681674 BlockEntityData : id:"minecraft:bed",x:3,y:-60,z:-6} Old Block Fields set BlockState : Block{minecraft:black_bed}[facing=east,occupied=false,part=foot] BlockEntity : net.minecraft.world.level.block.entity.BedBlockEntity@6d1aa3da BlockEntityData : {id:"minecraft:bed",x:2,y:-60,z:-6} Frozen Block Entity set BlockState : Block{minecraft:black_bed}[facing=east,occupied=false,part=foot] BlockPos{x=3, y=-60, z=-6} BlockEntity : net.minecraft.world.level.block.entity.BedBlockEntity@6d1aa3da BlockEntityData : {id:"minecraft:bed",x:2,y:-60,z:-6} Frozen Block Entity set BlockState : Block{minecraft:black_bed}[facing=east,occupied=false,part=foot] BlockPos{x=2, y=-60, z=-6} BlockEntity : net.minecraft.world.level.block.entity.BedBlockEntity@6d1aa3da BlockEntityData : {id:"minecraft:bed",x:2,y:-60,z:-6} here is the code inside my custom "freeze" item :    @Override     public @NotNull InteractionResult useOn(@NotNull UseOnContext pContext) {         if (!pContext.getLevel().isClientSide() && pContext.getHand() == InteractionHand.MAIN_HAND) {             BlockPos blockPos = pContext.getClickedPos();             BlockPos secondBlockPos = getMultiblockPos(blockPos, pContext.getLevel().getBlockState(blockPos));             if (secondBlockPos != null) {                 createFrozenBlock(pContext, secondBlockPos);             }             createFrozenBlock(pContext, blockPos);             return InteractionResult.SUCCESS;         }         return super.useOn(pContext);     }     public static void createFrozenBlock(UseOnContext pContext, BlockPos blockPos) {         BlockState oldState = pContext.getLevel().getBlockState(blockPos);         BlockEntity oldBlockEntity = oldState.hasBlockEntity() ? pContext.getLevel().getBlockEntity(blockPos) : null;         CompoundTag oldBlockEntityData = oldState.hasBlockEntity() ? oldBlockEntity.serializeNBT() : null;         if (oldBlockEntity != null) {             pContext.getLevel().removeBlockEntity(blockPos);         }         BlockState FrozenBlock = setFrozenBlock(oldState, oldBlockEntity, oldBlockEntityData);         pContext.getLevel().setBlockAndUpdate(blockPos, FrozenBlock);     }     public static BlockState setFrozenBlock(BlockState blockState, @Nullable BlockEntity blockEntity, @Nullable CompoundTag blockEntityData) {         BlockState FrozenBlock = BlockRegister.FROZEN_BLOCK.get().defaultBlockState();         ((FrozenBlock) FrozenBlock.getBlock()).setOldBlockFields(blockState, blockEntity, blockEntityData);         return FrozenBlock;     }  
    • It is an issue with quark - update it to this build: https://www.curseforge.com/minecraft/mc-mods/quark/files/3642325
    • Remove Instant Massive Structures Mod from your server     Add new crash-reports with sites like https://paste.ee/  
    • Update your drivers: https://www.amd.com/en/support/graphics/amd-radeon-r9-series/amd-radeon-r9-200-series/amd-radeon-r9-280x
  • Topics

×
×
  • Create New...

Important Information

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