Jump to content
View in the app

A better way to browse. Learn more.

Forge Forums

A full-screen app on your home screen with push notifications, badges and more.

To install this app on iOS and iPadOS
  1. Tap the Share icon in Safari
  2. Scroll the menu and tap Add to Home Screen.
  3. Tap Add in the top-right corner.
To install this app on Android
  1. Tap the 3-dot menu (⋮) in the top-right corner of the browser.
  2. Tap Add to Home screen or Install app.
  3. Confirm by tapping Install.

[1.15.2] How should I use a blockstate or variants ?

Featured Replies

Posted

I can't use a blockstate well
the only thing that I can do a bit is to make variants which generate random blocks and when we destroy it they remain the same and rotate them a bit too

but the thing where I have the most difficulty understanding and where I have a lot of error is (true false) or more

for example, I tested something with snow and I often have errors like this

the result obviously gives me the block without texture

3:20.41 [Server-Worker-6/WARN] [minecraft/ModelBakery]: Unable to load model: 'testnt:block/bloc_1' referenced from: testnt:bloc_2#: java.io.FileNotFoundException: testnt:models/block/bloc_1.json 
33:20.41 [Server-Worker-6/WARN] [minecraft/ModelBakery]: Exception loading blockstate definition: 'testnt:blockstates/bfinale.json' in resourcepack: 'Mod Resources' for variant: 'snowy=false': Unknown blockstate property: 'snowy' 
33:20.41 [Server-Worker-6/WARN] [minecraft/ModelBakery]: Exception loading blockstate definition: 'testnt:blockstates/bfinale.json' in resourcepack: 'Mod Resources' for variant: 'snowy=true': Unknown blockstate property: 'snowy' 
33:20.41 [Server-Worker-6/WARN] [minecraft/ModelBakery]: Exception loading blockstate definition: 'testnt:blockstates/bfinale.json' missing model for variant: 'testnt:bfinale#'
{
  "variants": {
    "snowy=false": {"model": "testnt:block/b_middle"},
    "snowy=true": {"model": "testnt:block/b_top"}
  }
}

I tested with many others as the direction still true and false

 

I would like to know if he has someone who knows about it who could know how to use better

 

in detail I use Mcreator to code this

I know but it's also to learn a little more modding

Edited by LicaSkelecario

  • Author

this block conect 2 block

name:BFinale

package net.mcreator.testnt.block;

import net.minecraftforge.registries.ObjectHolder;
import net.minecraftforge.fml.event.lifecycle.FMLClientSetupEvent;
import net.minecraftforge.api.distmarker.OnlyIn;
import net.minecraftforge.api.distmarker.Dist;

import net.minecraft.world.storage.loot.LootContext;
import net.minecraft.world.IBlockReader;
import net.minecraft.util.math.BlockPos;
import net.minecraft.item.ItemStack;
import net.minecraft.item.ItemGroup;
import net.minecraft.item.Item;
import net.minecraft.item.BlockItem;
import net.minecraft.client.renderer.RenderTypeLookup;
import net.minecraft.client.renderer.RenderType;
import net.minecraft.block.material.Material;
import net.minecraft.block.SoundType;
import net.minecraft.block.BlockState;
import net.minecraft.block.Block;

import net.mcreator.testnt.TestntModElements;

import java.util.List;
import java.util.Collections;

@TestntModElements.ModElement.Tag
public class BfinaleBlock extends TestntModElements.ModElement {
	@ObjectHolder("testnt:bfinale")
	public static final Block block = null;
	public BfinaleBlock(TestntModElements instance) {
		super(instance, 17);
	}

	@Override
	public void initElements() {
		elements.blocks.add(() -> new CustomBlock());
		elements.items
				.add(() -> new BlockItem(block, new Item.Properties().group(ItemGroup.BUILDING_BLOCKS)).setRegistryName(block.getRegistryName()));
	}

	@Override
	@OnlyIn(Dist.CLIENT)
	public void clientLoad(FMLClientSetupEvent event) {
		RenderTypeLookup.setRenderLayer(block, RenderType.getCutout());
	}
	public static class CustomBlock extends Block {
		public CustomBlock() {
			super(Block.Properties.create(Material.ROCK).sound(SoundType.GROUND).hardnessAndResistance(1f, 10f).lightValue(0).notSolid());
			setRegistryName("bfinale");
		}

		@Override
		public boolean isNormalCube(BlockState state, IBlockReader worldIn, BlockPos pos) {
			return false;
		}

		@Override
		public boolean propagatesSkylightDown(BlockState state, IBlockReader reader, BlockPos pos) {
			return true;
		}

		@Override
		public List<ItemStack> getDrops(BlockState state, LootContext.Builder builder) {
			List<ItemStack> dropsOriginal = super.getDrops(state, builder);
			if (!dropsOriginal.isEmpty())
				return dropsOriginal;
			return Collections.singletonList(new ItemStack(this, 1));
		}
	}
}

 

  • Guest locked this topic
Guest
This topic is now closed to further replies.

Important Information

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

Configure browser push notifications

Chrome (Android)
  1. Tap the lock icon next to the address bar.
  2. Tap Permissions → Notifications.
  3. Adjust your preference.
Chrome (Desktop)
  1. Click the padlock icon in the address bar.
  2. Select Site settings.
  3. Find Notifications and adjust your preference.