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

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


LicaSkelecario
 Share

Recommended Posts

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
Link to comment
Share on other sites

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));
		}
	}
}

 

Link to comment
Share on other sites

Guest
This topic is now closed to further replies.
 Share



  • Recently Browsing

    No registered users viewing this page.

  • Posts

    • I have my structure in .nbt format. When I click with my custom item on the ground it should place the structure. However, it only places one block from the bottom corner of the structure. When I try to walk, the player moves very slowly, like the wall structure is there. For some reason it's just not visible. After reopening the world, the structure is visible. My code:  if (world instanceof ServerLevel _serverworld) { StructureTemplate template = _serverworld.getStructureManager().getOrCreate(new ResourceLocation(TransportMod.MOD_ID, name)); if (template != null) { template.placeInWorld(_serverworld, new BlockPos((int) x, (int) y, (int) z), new BlockPos((int) x, (int) y, (int) z), new StructurePlaceSettings().setRotation(Rotation.NONE).setMirror(Mirror.NONE).setIgnoreEntities(true), _serverworld.random, 3); } } How make the structure visible right after placing? Or am I doing something wrong? Thanks in advance!
    • Hey im trying to make server side mod with some basic server commands currently im stuck getting text colored after loading it from a txt file i got the text show up fine but how would i go about getting it recognize color codes like §b or \u00A7b
    • do you mean going to java 7 or java 8 update 320?
    • I downloaded the server files for a 1.16.5 forge server server (forge-1.16.5-36.2.20) but when i run the .jar file it doesn't start up.   I also tried running it with the following .bat script : "C:\Program Files\Java\jre1.8.0_321\bin\javaw.exe" -Xmx4096M -Xms4096M -jar forgeserver.jar pause when I run the server it gives this log: [25jan2022 14:41:46.874] [main/INFO] [cpw.mods.modlauncher.Launcher/MODLAUNCHER]: ModLauncher running: args [--gameDir, ., --launchTarget, fmlserver, --fml.forgeVersion, 36.2.20, --fml.mcpVersion, 20210115.111550, --fml.mcVersion, 1.16.5, --fml.forgeGroup, net.minecraftforge] [25jan2022 14:41:46.876] [main/INFO] [cpw.mods.modlauncher.Launcher/MODLAUNCHER]: ModLauncher 8.0.9+86+master.3cf110c starting: java version 1.8.0_321 by Oracle Corporation [25jan2022 14:41:47.215] [main/INFO] [net.minecraftforge.fml.loading.FixSSL/CORE]: Added Lets Encrypt root certificates as additional trust [25jan2022 14:41:47.248] [main/INFO] [mixin/]: SpongePowered MIXIN Subsystem Version=0.8.4 Source=file:/C:/Users/USER/Desktop/folder%20folder/servers/servers/lege%20folder/libraries/org/spongepowered/mixin/0.8.4/mixin-0.8.4.jar Service=ModLauncher Env=SERVER [25jan2022 14:41:48.005] [main/INFO] [cpw.mods.modlauncher.LaunchServiceHandler/MODLAUNCHER]: Launching target 'fmlserver' with arguments [--gameDir, .] [25jan2022 14:41:48.063] [main/INFO] [STDERR/]: [java.lang.ThreadGroup:uncaughtException:-1]: java.lang.NoSuchMethodError: sun.security.util.ManifestEntryVerifier.<init>(Ljava/util/jar/Manifest;)V [25jan2022 14:41:48.064] [main/INFO] [STDERR/]: [java.lang.ThreadGroup:uncaughtException:-1]:     at cpw.mods.modlauncher.SecureJarHandler.createCodeSource(SecureJarHandler.java:66) [25jan2022 14:41:48.064] [main/INFO] [STDERR/]: [java.lang.ThreadGroup:uncaughtException:-1]:     at cpw.mods.modlauncher.TransformingClassLoader$DelegatedClassLoader.findClass(TransformingClassLoader.java:275) [25jan2022 14:41:48.065] [main/INFO] [STDERR/]: [java.lang.ThreadGroup:uncaughtException:-1]:     at cpw.mods.modlauncher.TransformingClassLoader.loadClass(TransformingClassLoader.java:136) [25jan2022 14:41:48.065] [main/INFO] [STDERR/]: [java.lang.ThreadGroup:uncaughtException:-1]:     at cpw.mods.modlauncher.TransformingClassLoader.loadClass(TransformingClassLoader.java:98) [25jan2022 14:41:48.065] [main/INFO] [STDERR/]: [java.lang.ThreadGroup:uncaughtException:-1]:     at java.lang.ClassLoader.loadClass(Unknown Source) [25jan2022 14:41:48.066] [main/INFO] [STDERR/]: [java.lang.ThreadGroup:uncaughtException:-1]:     at java.lang.Class.forName0(Native Method) [25jan2022 14:41:48.066] [main/INFO] [STDERR/]: [java.lang.ThreadGroup:uncaughtException:-1]:     at java.lang.Class.forName(Unknown Source) [25jan2022 14:41:48.066] [main/INFO] [STDERR/]: [java.lang.ThreadGroup:uncaughtException:-1]:     at net.minecraftforge.fml.loading.FMLServerLaunchProvider.lambda$launchService$0(FMLServerLaunchProvider.java:51) [25jan2022 14:41:48.067] [main/INFO] [STDERR/]: [java.lang.ThreadGroup:uncaughtException:-1]:     at cpw.mods.modlauncher.LaunchServiceHandlerDecorator.launch(LaunchServiceHandlerDecorator.java:37) [25jan2022 14:41:48.067] [main/INFO] [STDERR/]: [java.lang.ThreadGroup:uncaughtException:-1]:     at cpw.mods.modlauncher.LaunchServiceHandler.launch(LaunchServiceHandler.java:54) [25jan2022 14:41:48.067] [main/INFO] [STDERR/]: [java.lang.ThreadGroup:uncaughtException:-1]:     at cpw.mods.modlauncher.LaunchServiceHandler.launch(LaunchServiceHandler.java:72) [25jan2022 14:41:48.068] [main/INFO] [STDERR/]: [java.lang.ThreadGroup:uncaughtException:-1]:     at cpw.mods.modlauncher.Launcher.run(Launcher.java:82) [25jan2022 14:41:48.068] [main/INFO] [STDERR/]: [java.lang.ThreadGroup:uncaughtException:-1]:     at cpw.mods.modlauncher.Launcher.main(Launcher.java:66) [25jan2022 14:41:48.068] [main/INFO] [STDERR/]: [java.lang.ThreadGroup:uncaughtException:-1]:     at net.minecraftforge.server.ServerMain$Runner.runLauncher(ServerMain.java:63) [25jan2022 14:41:48.068] [main/INFO] [STDERR/]: [java.lang.ThreadGroup:uncaughtException:-1]:     at net.minecraftforge.server.ServerMain$Runner.access$100(ServerMain.java:60) [25jan2022 14:41:48.069] [main/INFO] [STDERR/]: [java.lang.ThreadGroup:uncaughtException:-1]:     at net.minecraftforge.server.ServerMain.main(ServerMain.java:57)    
  • Topics

  • Who's Online (See full list)

×
×
  • Create New...

Important Information

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