Jump to content

[Solved][1.10.2]Get problem with block rendering.


bxzsj

Recommended Posts

I'm trying to define a block use vanilla cube model to render with 7 variant,but got some problem that block not be right render.

No error show in log(here).(block registry name is "energy_block")
Item renders well, but block got wrong.

block state in the following picture are correct.
no error "Exception loading model for variant" about this block(energy_block).

I'm sorry, I don't understand how json to model and connect with block state.


I'm not sure if I've done the wrong thing that use a wrong register Block State Mapper(here)
source code:

block(here)

Spoiler

package com.bxzmod.someusefulthings.blocks;

import com.bxzmod.someusefulthings.EnumIO;
import com.bxzmod.someusefulthings.UnlistedPropertyIO;
import com.bxzmod.someusefulthings.core.energy.IEnergySide;
import com.bxzmod.someusefulthings.tileentity.EnergyBlockTileEntity;
import com.google.common.collect.Lists;
import com.google.common.primitives.Booleans;

import net.minecraft.block.properties.IProperty;
import net.minecraft.block.properties.PropertyDirection;
import net.minecraft.block.properties.PropertyEnum;
import net.minecraft.block.state.BlockStateContainer;
import net.minecraft.block.state.IBlockState;
import net.minecraft.entity.EntityLivingBase;
import net.minecraft.item.ItemStack;
import net.minecraft.tileentity.TileEntity;
import net.minecraft.util.EnumFacing;
import net.minecraft.util.math.BlockPos;
import net.minecraft.world.IBlockAccess;
import net.minecraft.world.World;
import net.minecraftforge.common.property.ExtendedBlockState;
import net.minecraftforge.common.property.IExtendedBlockState;
import net.minecraftforge.common.property.IUnlistedProperty;

public class EnergyBlock extends BaseBlockContainer
{
	public static final PropertyDirection FACING = PropertyDirection.create("facing", Lists.newArrayList(EnumFacing.values()));
	public static final PropertyEnum<EnumIO> UP = PropertyEnum.create("up", EnumIO.class);
	public static final PropertyEnum<EnumIO> DOWN = PropertyEnum.create("down", EnumIO.class);
	public static final PropertyEnum<EnumIO> NORTH = PropertyEnum.create("north", EnumIO.class);
	public static final PropertyEnum<EnumIO> SOUTH = PropertyEnum.create("south", EnumIO.class);
	public static final PropertyEnum<EnumIO> EAST = PropertyEnum.create("east", EnumIO.class);
	public static final PropertyEnum<EnumIO> WEST = PropertyEnum.create("west", EnumIO.class);

	public EnergyBlock()
	{
		super();
		this.setRegistryName("energy_block");
		this.setUnlocalizedName("energyBlock");
		this.setDefaultState(this.createBlockState().getBaseState().withProperty(FACING, EnumFacing.NORTH));
	}

	@Override
	public TileEntity createNewTileEntity(World worldIn, int meta)
	{
		return new EnergyBlockTileEntity();
	}

	@Override
	public IBlockState getStateFromMeta(int meta)
	{
		int a;
		a = meta % 3;
		EnumFacing facing = EnumFacing.getHorizontal(a);
		return this.getDefaultState().withProperty(FACING, facing);
	}

	@Override
	public int getMetaFromState(IBlockState state)
	{
		int facing = state.getValue(FACING).getIndex();
		return facing;
	}
	
	@Override
	public IBlockState getStateForPlacement(World world, BlockPos pos, EnumFacing facing, float hitX, float hitY,
			float hitZ, int meta, EntityLivingBase placer, ItemStack stack)
	{
		IBlockState origin = super.getStateForPlacement(world, pos, facing, hitX, hitY, hitZ, meta, placer, stack);
		return origin.withProperty(FACING, placer.getHorizontalFacing().getOpposite());
	}

	@Override
	protected BlockStateContainer createBlockState()
	{
//		return new ExtendedBlockState(this, new IProperty[] { FACING, NORTH, SOUTH, WEST, EAST, UP, DOWN },
//				new IUnlistedProperty[] {});
		return new BlockStateContainer(this, FACING, NORTH, SOUTH, WEST, EAST, UP, DOWN);
	}

//	@Override
//	public IBlockState getExtendedState(IBlockState state, IBlockAccess world, BlockPos pos)
//	{
//		TileEntity te = world.getTileEntity(pos);
//		//IExtendedBlockState s = (IExtendedBlockState) state;
//		//state.withProperty(FACING, state.getValue(FACING));
//		if (te instanceof IEnergySide)
//		{
//			IEnergySide config = (IEnergySide) te;
//			System.out.println(Booleans.asList(config.getAllEnergySide()).toString());
//			for(EnumFacing side:EnumFacing.VALUES)
//				state.withProperty(this.getProperty(side), config.canReceive(side) ? EnumIO.INPUT : EnumIO.OUTPUT);
//		}
//		return super.getExtendedState(state, world, pos);
//	}
	
	@Override
	public IBlockState getActualState(IBlockState state, IBlockAccess worldIn, BlockPos pos)
	{
		TileEntity te = worldIn.getTileEntity(pos);
		if (te instanceof IEnergySide)
		{
			IEnergySide config = (IEnergySide) te;
			//System.out.println(Booleans.asList(config.getAllEnergySide()).toString());
			for(EnumFacing side:EnumFacing.VALUES)
				state.withProperty(this.getProperty(side), config.canReceive(side) ? EnumIO.INPUT : EnumIO.OUTPUT);
		}
		return state;
	}

	public PropertyEnum<EnumIO> getProperty(EnumFacing from)
	{
		switch (from)
		{
		case UP:
			return this.UP;
		case DOWN:
			return this.DOWN;
		case NORTH:
			return this.NORTH;
		case SOUTH:
			return this.SOUTH;
		case WEST:
			return this.WEST;
		case EAST:
			return this.EAST;
		default:
			return null;
		}

	}

}

 

blockstate json(here)

Spoiler

{
    "forge_marker": 1,
    "defaults": {
        "model": "cube",
        "textures": {
            "down": "someusefulthings:blocks/remove_enchantment_side",
            "up": "someusefulthings:blocks/remove_enchantment_side",
            "north": "someusefulthings:blocks/eye_generator_on",
            "south": "someusefulthings:blocks/remove_enchantment_side",
            "west": "someusefulthings:blocks/remove_enchantment_side",
            "east": "someusefulthings:blocks/remove_enchantment_side"
        }
    },
    "variants": {
        "inventory": [{
             "textures": { "down": "someusefulthings:blocks/remove_enchantment_side",
            "up": "someusefulthings:blocks/remove_enchantment_side",
            "north": "someusefulthings:blocks/eye_generator_on",
            "south": "someusefulthings:blocks/remove_enchantment_side",
            "west": "someusefulthings:blocks/remove_enchantment_side",
            "east": "someusefulthings:blocks/remove_enchantment_side" }
        }],
        "facing": {
            "east": { "y": 90, "uvlock": true },
            "north": {},
            "south": { "y": 180, "uvlock": true },
            "west": { "y": 270, "uvlock": true },
            "down": {},
            "up": {}
        },
        "up":{
        "input": { "textures": { "up": "someusefulthings:blocks/copy_enchantment_on" } },
        "output": { "textures": { "up": "someusefulthings:blocks/copy_enchantment_off" } },
        "all": { },
        "not": { }
        },
        "down":{
        "input": { "textures": { "down": "someusefulthings:blocks/copy_enchantment_on" } },
        "output": { "textures": { "down": "someusefulthings:blocks/copy_enchantment_off" } },
        "all": { },
        "not": { }
        },
        "north":{
        "input": { "textures": { "north": "someusefulthings:blocks/copy_enchantment_on" } },
        "output": { "textures": { "north": "someusefulthings:blocks/copy_enchantment_off" } },
        "all": { },
        "not": { }
        },
        "south":{
        "input": { "textures": { "south": "someusefulthings:blocks/copy_enchantment_on" } },
        "output": { "textures": { "south": "someusefulthings:blocks/copy_enchantment_off" } },
        "all": { },
        "not": { }
        },
        "west":{
        "input": { "textures": { "west": "someusefulthings:blocks/copy_enchantment_on" } },
        "output": { "textures": { "west": "someusefulthings:blocks/copy_enchantment_off" } },
        "all": { },
        "not": { }
        },
        "east":{
        "input": { "textures": { "east": "someusefulthings:blocks/copy_enchantment_on" } },
        "output": { "textures": { "east": "someusefulthings:blocks/copy_enchantment_off" } },
        "all": { },
        "not": { }
        }
    }
}

 

 

error_render.png

Edited by bxzsj
solved
Link to comment
Share on other sites

You should always check the log.

And then scroll down the log some more until you see something helpful.

If you still don't, then post here, and include the log.

 

Apparently I'm a complete and utter jerk and come to this forum just like to make fun of people, be confrontational, and make your personal life miserable.  If you think this is the case, JUST REPORT ME.  Otherwise you're just going to get reported when you reply to my posts and point it out, because odds are, I was trying to be nice.

 

Exception: If you do not understand Java, I WILL NOT HELP YOU and your thread will get locked.

 

DO NOT PM ME WITH PROBLEMS. No help will be given.

Link to comment
Share on other sites

Sorry, I missed that. It was a little buried.

Nothing in the log...
https://github.com/bxz2311196368/someusefulthings/blob/1.10.2/src/main/java/com/bxzmod/someusefulthings/blocks/BlockRenderLoader.java#L18

Why are you registering state mappers at all? You're using the default state mapper, you shouldn't need to do this.

 

Apparently I'm a complete and utter jerk and come to this forum just like to make fun of people, be confrontational, and make your personal life miserable.  If you think this is the case, JUST REPORT ME.  Otherwise you're just going to get reported when you reply to my posts and point it out, because odds are, I was trying to be nice.

 

Exception: If you do not understand Java, I WILL NOT HELP YOU and your thread will get locked.

 

DO NOT PM ME WITH PROBLEMS. No help will be given.

Link to comment
Share on other sites

15 minutes ago, Draco18s said:

Sorry, I missed that. It was a little buried.

Nothing in the log...
https://github.com/bxz2311196368/someusefulthings/blob/1.10.2/src/main/java/com/bxzmod/someusefulthings/blocks/BlockRenderLoader.java#L18

Why are you registering state mappers at all? You're using the default state mapper, you shouldn't need to do this.

 

Sorry, I don't know what is a right way to register block state mapper,can you give me some document or tutorials about it?

This is the only way I learned from a tutorial. I still haven't figured out how this part works.

Link to comment
Share on other sites

8 minutes ago, bxzsj said:

Sorry, I don't know what is a right way to register block state mapper,can you give me some document or tutorials about it?

This is the only way I learned from a tutorial. I still haven't figured out how this part works.

Its not about the proper way to register a block state mapper, my point is YOU DO NOT NEED TO DO THIS AT ALL EVER unless you are doing something like "I want to split my blockstate file into two files based on X property."1

 

How did I register my blocks in 1.10?

Like this:

https://github.com/Draco18s/ReasonableRealism/blob/master/src/main/java/com/draco18s/hardlib/client/ClientEasyRegistry.java#L33-L42

https://github.com/Draco18s/ReasonableRealism/blob/master/src/main/java/com/draco18s/hardlib/client/ClientEasyRegistry.java#L80-L83

Do you see anything about a custom block state mapper?

 

1 This being a thing I actually did.

Edited by Draco18s

Apparently I'm a complete and utter jerk and come to this forum just like to make fun of people, be confrontational, and make your personal life miserable.  If you think this is the case, JUST REPORT ME.  Otherwise you're just going to get reported when you reply to my posts and point it out, because odds are, I was trying to be nice.

 

Exception: If you do not understand Java, I WILL NOT HELP YOU and your thread will get locked.

 

DO NOT PM ME WITH PROBLEMS. No help will be given.

Link to comment
Share on other sites

13 hours ago, bxzsj said:

I understand, if I don't need to load blockstate json from separated files, it's no need to register block state mapper.

Now I removed register block state mapper, but it still don't work.

new log

3

You do not have any models/block folder and therefore none of your blocks will have a texture.

VANILLA MINECRAFT CLASSES ARE THE BEST RESOURCES WHEN MODDING

I will be posting 1.15.2 modding tutorials on this channel. If you want to be notified of it do the normal YouTube stuff like subscribing, ect.

Forge and vanilla BlockState generator.

Link to comment
Share on other sites

5 hours ago, Animefan8888 said:

You do not have any models/block folder and therefore none of your blocks will have a texture.

what you mean, I'm using vanilla "cube" model

Link to comment
Share on other sites

On 6/5/2018 at 2:40 AM, bxzsj said:

what you mean, I'm using vanilla "cube" model

Never mind I did not look into your blockstate json. Have you tried anything else since then?

VANILLA MINECRAFT CLASSES ARE THE BEST RESOURCES WHEN MODDING

I will be posting 1.15.2 modding tutorials on this channel. If you want to be notified of it do the normal YouTube stuff like subscribing, ect.

Forge and vanilla BlockState generator.

Link to comment
Share on other sites

I made a stupid mistake.

this.setDefaultState(this.createBlockState().getBaseState().withProperty(FACING, EnumFacing.NORTH));


That makes the state in game never equal state in 

BlockModelShapes.blockStateMapper


Sorry to waste your time.

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

    • Honestly i gave up on hiring a online hacker due to the bad experienced i always encounter with them but this time i was really in urgent need for a legit one cos i needed to be sure what my partners plan is as he is avoiding me and always hiding hen making calls couple with his late night movement. i was so scared so i got a helping hand from a friend Hyung who introduced me with this expert hacker, i was scared and lost trust in him at first but after giving him a try in couple of hours i got access to my partner phone and saw his call recordings, hidden text messages, social accounts , hidden photos and more. Thank you [ Hacker11tech @ gm ail . c om ] for been legit.
    • Hello I'm looking for help launching minecraft through curseforge. I've scoured the Internet and can't seem to find anyone with a solution to my specific situation/fix that I haven't tried. I'll post the Curseforge debug Logs below. But basically I'm on a Laptop (Lenovo Legion Slim 7 2021) And the people I've seen with the most similar scenario and found a fix they always had an AMD graphics card and were missing the correct drivers, Well i have the Nvidia geforce RTX 3060 Laptop version with all the most updated drivers, I've reinstalled the drivers so that doesn't seem to me the problem. Also, minecraft will launch in vanilla and through another modloader called modrinth. So it doesn't feel like a Java error either but I don't no how to read this debug page so I'm looking for advice. Please help?!  
    • Hello. Basically I made a custom standalone util library (https://github.com/lolhol/Pathfinder3D) and want to use it with my mod. Although I have done the normal jit pack stuff (basically the tutorial on their website) the Minecraft crashes the second it starts saying that it cannot find the name of a class inside of my library. (When I remove the implement(<my library link thingy>) mc launches normally and does not crash (if I comment out the code that uses the custom lib)). Now then, is there a quick fix for this because all of the other questions that I found on this topic were trying to load another mod (again, not what I’m trying to do). Am I doing something wrong? 
    • Fast Leaf Decay (by olafskiii) Rubidium (by Asek3) Artifacts (by ochotonida) Framework (by MrCrayfish) Max Health Fix (by DarkhaxDev) Embeddium/Rubidium Extras (by Txni) Essential Mod (by SparkUniverse_) Immersive Aircraft [Fabric/Forge] (by Conczin) Cherished Worlds (Fabric/Forge/NeoForge/Quilt) (by TheIllusiveC4) ExpandAbility (by florensie) Sophisticated Core (by P3pp3rF1y) Tinkers' Levelling Addon (by Pyre540) Better Advancements (by way2muchnoise) Immersive Melodies [Fabric/Forge] (by Conczin) Citadel (by sbom_xela) Vampirism - Become a vampire! (by maxanier) FerriteCore ((Neo)Forge) (by malte0811) CoroUtil (by Corosus) Create Big Cannons (by rbasamoyai) Controlling (by Jaredlll08) Cloth Config API (Fabric/Forge/NeoForge) (by shedaniel) Mekanism (by bradyaidanc) BetterF3 (by cominixo) Supplementaries (by MehVahdJukaar) Chest Cavity - Forge Port (by booneldanforever) ConnectedTexturesMod (by tterrag1098) NetherPortalFix (by BlayTheNinth) Spartan Weaponry (by ObliviousSpartan) Charm of Undying (Fabric/Forge/Quilt) (by TheIllusiveC4) Plushie Mod (by Link4real) JourneyMap (by techbrew) Farmer's Delight (by vectorwing) Connectivity[Forge/Fabric] (by someaddon) Create : Misc & Things (by To0pa) Create: Steam 'n' Rails (by IThundxr) Shutup Experimental Settings! (by Corgi_Taco) Alex's Mobs (by sbom_xela) Quark (by Vazkii) Tool Belt (by gigaherz) Just Enough Items (JEI) (by mezz) Bookshelf (by DarkhaxDev) FastWorkbench (by Shadows_of_Fire) Tinkers Construct (by mDiyo) Collective (by Serilum) Inventory HUD+ (by dmitrylovin) Explorer's Compass (by Chaosyr) playerAnimator (by KosmX) Size Devices (by DaFlame_rl) Jade 🔍 (by Snownee) Create Slice & Dice (by possible_triangle) Create Jetpack (by possible_triangle) Carry On (by Tschipp) Moonlight Lib (by MehVahdJukaar) Kotlin for Forge (by thedarkcolour) CraftTweaker (by Jaredlll08) Just Enough Resources (JER) (by way2muchnoise) AI Improvements (by QueenOfMissiles) Patchouli (by Vazkii) Catalogue (by MrCrayfish) Tool Stats (by DarkhaxDev) It Takes a Pillage (by izofar) JEITweaker (by Jaredlll08) Waystones (by BlayTheNinth) Vampires Need Umbrellas (by focamacho) Oculus (by Asek3) Mantle (by mDiyo) Mob Grinding Utils (by vadis365) Chiseled (by freepeopleworking) AutoRegLib (by Vazkii) Mystical Agriculture (by BlakeBr0) Embeddium/Rubidium Dynamic Lights (by Txni) Flywheel (Legacy) (by jozufozu) Builder's Delight (Forge) (by Tynoxs) Apotheosis (by Shadows_of_Fire) What Are They Up To (Watut) (by Corosus) Create: Interiors (by sudolev) FastFurnace (by Shadows_of_Fire) Balm (Forge Edition) (by BlayTheNinth) Clumps (by Jaredlll08) Iris & Oculus Flywheel Compat (by leon_mout) Configured (by MrCrayfish) Tinkers' Expansion (by Insane96) Crafting on a stick (by OfekN_) MrCrayfish's Gun Mod (by MrCrayfish) Create: Crystal Clear (by singularity_cyvack) FTB Library (Forge) (by FTB) AppleSkin (by squeek502) Curios API (Forge/NeoForge) (by TheIllusiveC4) Better Third Person (by Socolio) Caelus API (Forge/NeoForge) (by TheIllusiveC4) Sons Of Sins (by Furti_Two) SwingThroughGrass (by exidex) AttributeFix (by DarkhaxDev) Quests Additions (Forge) (by NaturaSpell) Building Gadgets (by Direwolf20) Enchantment Descriptions (by DarkhaxDev) Skin Layers 3D (Fabric/Forge) (by tr7zw) Bad Wither No Cookie - Reloaded (by Kreezxil) Placebo (by Shadows_of_Fire) FTB Teams (Forge) (by FTB) Mod Name Tooltip (by mezz) Enigmatic Graves (by Quarris) Sophisticated Backpacks (by P3pp3rF1y) GeckoLib (by Gecko) Builders Crafts & Additions (by MRHminer) Immersive Portals (for Forge) (by qouteall) Architectury API (Fabric/Forge/NeoForge) (by shedaniel) Lazy DataFixerUpper(LazyDFU) [FORGE] (by Corgi_Taco) Create Ore Excavation (by tom54541) Tinkers' Rapier (by sz0999312) Mowzie's Mobs (by bobmowzie) Better Combat [Fabric & Forge] (by daedelus_dev) Create Stuff & Additions (by Furti_Two) Cucumber Library (by BlakeBr0) FPS Reducer (by bre2el) Item Filters (by LatvianModder) FTB Quests (Forge) (by FTB) L_Ender 's Cataclysm (by mcl_ender) Starter Kit (by Serilum) Feature NBT Deadlock Be Gone (by telepathicgrunt) Materialis (by RCXcrafter) KleeSlabs (by BlayTheNinth) Pehkui (by Virtuoel) Grappling Hook Mod (by yyonne) Security Craft (by Geforce132) Ars Nouveau (by baileyholl2) Mouse Tweaks (by YaLTeR) Werewolves - Become a Beast! (by Cheaterpaul) Elytra Slot (Fabric/Forge/Quilt) (by TheIllusiveC4) Create (by simibubi) Budschie's Morph Mod (by budschie_) Ore Excavation (by Funwayguy) Create Confectionery (by Furti_Two)
    • Hello, im kind of a newbie on creating mods, and i been trying to make simples mods so far, Right now, i'm creating a mod which detect an specific type of mob and kill it if reach a certain number, by far the mod is detecting the mob and counting them but at the time it reach the limit number, it don't do anything. The Game don't tweak, don't crash, just i't don't run the method i call, which is kill().   public InteractionResultHolder<ItemStack> use(Level pLevel, Player pPlayer, InteractionHand pUsedHand) { final var TotalCows = pLevel.getNearbyEntities(Cow.class, TargetingConditions.forNonCombat(), pPlayer, pPlayer.getBoundingBox().inflate(5)); if(pLevel.isClientSide){ if(pPlayer.getItemInHand(InteractionHand.MAIN_HAND).getItem() == this.asItem()){ if(!TotalCows.isEmpty()){ if(TotalCows.get(0).isAlive()){ TotalCows.get(0).kill(); } }else{ pPlayer.sendSystemMessage(Component.literal("No hay vacas")); } } } The sendSystemMessage is get triggered, and when i change the method .kill() by any other like send a message it got called, can i get some tips, and a clue of what i'm missing
  • Topics

  • Who's Online (See full list)

×
×
  • Create New...

Important Information

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