Jump to content

Recommended Posts

Posted

I've managed to get my metadata block into the game's creative tabs and it will go into the world with the game crashing. However, the game keeps giving me this message about my block model not being found. I've looked at some tutorials and tried troubleshooting the issue but I can't seem to get it to render in the game without the purple and black texture. I'm only trying to make the "undamaged" variant of the block right now and will work on the other variants once that one works. Here's the code:

 

Error message:

 

[12:13:34] [Client thread/ERROR] [FML]: Model definition for location xcom:alien_alloy_wall#damage_level=undamaged not found

 

Block Class

package com.littlepup.xcom.blocks;

import java.util.List;

import com.littlepup.xcom.XcomMain;
import net.minecraft.block.Block;
import net.minecraft.block.material.Material;
import net.minecraft.block.properties.IProperty;
import net.minecraft.block.properties.PropertyEnum;
import net.minecraft.block.state.BlockState;
import net.minecraft.block.state.IBlockState;
import net.minecraft.creativetab.CreativeTabs;
import net.minecraft.entity.EntityLivingBase;
import net.minecraft.item.Item;
import net.minecraft.item.ItemStack;
import net.minecraft.util.BlockPos;
import net.minecraft.util.EnumFacing;
import net.minecraft.util.IStringSerializable;
import net.minecraft.util.MovingObjectPosition;
import net.minecraft.world.Explosion;
import net.minecraft.world.World;

public class AlienAlloyWall extends Block implements IMetaBlockName
{
public AlienAlloyWall(Material material) 
{
	super(material);
	this.setUnlocalizedName("alien_alloy_wall");
	this.setCreativeTab(XcomMain.xcomTab);
	this.setHardness(2.0F);
	this.setResistance(250.0F);
	this.setDefaultState(this.blockState.getBaseState().withProperty(DAMAGE_LEVEL, AlienAlloyWallTypes.UNDAMAGED));
}

public static final PropertyEnum DAMAGE_LEVEL = PropertyEnum.create("damage_level", AlienAlloyWall.AlienAlloyWallTypes.class);

//Contains different types of alien alloy blocks
public enum AlienAlloyWallTypes implements IStringSerializable
{
	UNDAMAGED(0, "undamaged"),
	SLIGHTLY_DAMAGED(1, "slightly_damaged"),
	SOMEWHAT_DAMAGED(2, "somewhat_damaged"),
	MODERATELY_DAMAGED(3, "moderately_damaged"),
	VERY_DAMAGED(4, "very_damaged");

	private int ID;
	private String name;

	private AlienAlloyWallTypes(int ID, String name)
	{
		this.ID = ID;
		this.name = name;
	}

	@Override
	public String getName() 
	{
		return name;
	}

	@Override
	public String toString() 
	{
		return getName();
	}

	public int getID()
	{
		return ID;
	}			
}

@Override
protected BlockState createBlockState()
{
	return new BlockState(this, new IProperty[] {DAMAGE_LEVEL});
}

@Override
public IBlockState getStateFromMeta(int meta)
{
	AlienAlloyWallTypes type;

	switch(meta)
	{
		case 0: type = AlienAlloyWallTypes.UNDAMAGED;
			break;
		case 1: type = AlienAlloyWallTypes.SLIGHTLY_DAMAGED;
			break;
		case 2: type = AlienAlloyWallTypes.SOMEWHAT_DAMAGED;
			break;
		case 3: type = AlienAlloyWallTypes.MODERATELY_DAMAGED;
			break;
		case 4: type = AlienAlloyWallTypes.VERY_DAMAGED;
			break;
		default: type = null;
			System.out.println("AlienAlloyWall.getStateFromMeta() is having trouble.");
			break;
	}

	return getDefaultState().withProperty(DAMAGE_LEVEL, type);
}

@Override
public int getMetaFromState(IBlockState state)
{
	AlienAlloyWallTypes type = (AlienAlloyWallTypes) state.getValue(DAMAGE_LEVEL);
	return type.getID();
}

@Override
public int damageDropped(IBlockState state)
{
	return getMetaFromState(state);
}

public void getSubBlocks(Item item, CreativeTabs tab, List list)
{
	for(int i = 0; i < 5; i++ )
	{
		list.add(new ItemStack(item, 1, i));
	}
}

@Override
public String getSpecialName(ItemStack stack) 
{
	int meta = stack.getItemDamage();
	String type;

	switch(meta)
	{
		case 0: type = AlienAlloyWall.AlienAlloyWallTypes.UNDAMAGED.toString();
			break;
		case 1: type = AlienAlloyWall.AlienAlloyWallTypes.SLIGHTLY_DAMAGED.toString();
			break;
		case 2: type = AlienAlloyWall.AlienAlloyWallTypes.SOMEWHAT_DAMAGED.toString();
			break;
		case 3: type = AlienAlloyWall.AlienAlloyWallTypes.MODERATELY_DAMAGED.toString();
			break;
		case 4: type = AlienAlloyWall.AlienAlloyWallTypes.VERY_DAMAGED.toString();
			break;
		default: 
			type = null;
			System.out.println("Error in AlienAlloyWall enum types.");
		break;
	}

	return type;
}

@Override
public boolean isOpaqueCube()
{
	return false;
}

@Override
public IBlockState onBlockPlaced(World world, BlockPos pos, EnumFacing facing, float hitX, float hitY, float hitZ, int meta, EntityLivingBase placer)
{
	EnumFacing direction = placer.getHorizontalFacing().rotateY();
	AlienAlloyWallTypes type = (AlienAlloyWallTypes) getStateFromMeta(meta).getValue(DAMAGE_LEVEL);

	return super.onBlockPlaced(world, pos, direction, hitX, hitY, hitZ, meta, placer).withProperty(DAMAGE_LEVEL, type);
}

@Override
public ItemStack getPickBlock(MovingObjectPosition target, World world, BlockPos pos)
{
	return new ItemStack(Item.getItemFromBlock(this), 1, this.getMetaFromState(world.getBlockState(pos)));
}

@Override
public void onBlockDestroyedByExplosion(World world, BlockPos pos, Explosion explosion)

{
	IBlockState state = world.getBlockState(pos);
	int meta = getMetaFromState(state);
	IBlockState newType = state.cycleProperty(DAMAGE_LEVEL);

	if(meta <= 3)
	{
		world.setBlockState(pos, newType);
	}
	else
	{
		world.setBlockToAir(pos);
	}
}	
}

 

Blockstates json file

 

{
    "variants": 
    {
        "damage_level=undamaged,facing=up": { "model": "xcom:alien_alloy_wall_undamaged" },
        "damage_level=undamaged,facing=down": { "model": "xcom:alien_alloy_wall_undamaged", "x": 180},
        "damage_level=undamaged,facing=east": { "model": "xcom:alien_alloy_wall_undamaged", "x": 90 },
        "damage_level=undamaged,facing=west": { "model": "xcom:alien_alloy_wall_undamaged", "x": 270 },
        "damage_level=undamaged,facing=north": { "model": "xcom:alien_alloy_wall_undamaged", "y": 90 },
        "damage_level=undamaged,facing=south": { "model": "xcom:alien_alloy_wall_undamaged", "y": 270 }
    }
}

 

Registration

 

public final class BlocksMain 
{
public static Block alien_alloy_wall = new AlienAlloyWall(Material.iron);

public static void addMetadataBlocks()
{
	GameRegistry.registerBlock(alien_alloy_wall, MetaBlocks.class, "alien_alloy_wall");
}

public static void addMetadataBlockRenderers()
{
	//Meta-data-block model name variations
	ModelBakery.addVariantName(Item.getItemFromBlock(BlocksMain.alien_alloy_wall), "xcom:alien_alloy_wall_undamaged");

	//Registers the block renderer(s)
	Minecraft.getMinecraft().getRenderItem().getItemModelMesher().register(Item.getItemFromBlock(alien_alloy_wall), 0, new ModelResourceLocation(XcomMain.MODID + ":" +	"alien_ally_wall_undamaged", "inventory"));


}
}

 

Thanks to anyone who helps.

Posted

How are you encoding 30 stays in only 16 values of metadata? You have 5 damage states and 6 facing states.

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.

Posted

Sorry, I'm kind of new to this. If it's not possible to get more than 16 different states in a block, I'll try fixing that first. I'm really only trying to get a different texture to show based off of the meta data and it will form a different shape based off of the blocks around it. Should I be just using the metadata for the texture only and changing the shape based off of the blocks around it maybe?

 

Honestly, I'm really new to this.

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

    • I deleted delightful and all farmers delight addon (just in case) and still i have the error :'(, i need to check mod by mod?
    • I'm developing a Forge mod for Minecraft 1.16.5 to run on CatServer (version 1.16.5-1d8d6313, Forge 36.2.39). My mod needs to get the player's UUID from a ServerPlayerEntity object within a Forge ServerChatEvent handler. When I use serverPlayerEntity.getUUID(), my mod compiles fine, but I get a java.lang.NoSuchMethodError: net.minecraft.entity.player.ServerPlayerEntity.getUUID()Ljava/util/UUID; at runtime. I cannot use serverPlayerEntity.getUniqueID() as it causes a compile error (cannot find symbol). Is there a known issue with this on CatServer, or a recommended way for a Forge mod to reliably get a player's UUID from ServerPlayerEntity in this environment? My goal is to pass this UUID to the LuckPerms API (which is running as a Bukkit plugin and successfully connected via ServicesManager). erorr ChatMod: FMLServerStartedEvent received. Attempting to initialize LuckPerms connection... [22:45:20] [Server thread/INFO]: ⚙️ Початок ініціалізації LuckPerms API через Bukkit Services Manager... [22:45:20] [Server thread/INFO]: ✅ Bukkit ServicesManager успішно отримано. [22:45:20] [Server thread/INFO]: ✅ Реєстрацію сервісу LuckPerms знайдено. [22:45:20] [Server thread/INFO]: ✅ API LuckPerms успішно отримано від Bukkit plugin! [22:45:20] [Server thread/INFO]: Використовується реалізація: me.lucko.luckperms.common.api.LuckPermsApiProvider [22:45:20] [Server thread/INFO]: ✅ LuckPerms API схоже що успішно ініціалізовано через Bukkit Services Manager. [22:45:24] [User Authenticator #1/INFO]: UUID of player Hiklee is 92cd7721-2652-3867-896b-2ceba5b99306 [22:45:25] [Server thread/INFO]: Using new advancement loading for net.minecraft.advancements.PlayerAdvancements@24cb7a68 [22:45:26] [Server thread/INFO]: Hiklee[/127.0.0.1:41122] logged in with entity id 210 at (92.23203876864889, 95.6183020148442, 68.24087802017877) [22:45:28] [Async Chat Thread - #0/INFO]: ✅ Скасовано стандартне відправлення чату! [22:45:28] [Async Chat Thread - #0/ERROR]: Exception caught during firing event: net.minecraft.entity.player.ServerPlayerEntity.getUUID()Ljava/util/UUID; Index: 1 Listeners: 0: NORMAL 1: ASM: class com.example.chatmod.ChatEventHandler onPlayerChat(Lnet/minecraftforge/event/ServerChatEvent;)V java.lang.NoSuchMethodError: net.minecraft.entity.player.ServerPlayerEntity.getUUID()Ljava/util/UUID; at com.example.chatmod.ChatPacketHandler.getPlayerPrefix(ChatPacketHandler.java:46) at com.example.chatmod.ChatEventHandler.onPlayerChat(ChatEventHandler.java:32) at net.minecraftforge.eventbus.ASMEventHandler_1_ChatEventHandler_onPlayerChat_ServerChatEvent.invoke(.dynamic) at net.minecraftforge.eventbus.ASMEventHandler.invoke(ASMEventHandler.java:85) at net.minecraftforge.eventbus.EventBus.post(EventBus.java:303) at net.minecraftforge.eventbus.EventBus.post(EventBus.java:283) at net.minecraftforge.common.ForgeHooks.onServerChatEvent(ForgeHooks.java:493) at net.minecraft.network.play.ServerPlayNetHandler.chat(ServerPlayNetHandler.java:1717) at net.minecraft.network.play.ServerPlayNetHandler.func_244548_c(ServerPlayNetHandler.java:1666) at net.minecraft.network.play.ServerPlayNetHandler.func_147354_a(ServerPlayNetHandler.java:1605) at net.minecraft.network.play.client.CChatMessagePacket.lambda$handle$0(CChatMessagePacket.java:34) at java.util.concurrent.Executors$RunnableAdapter.call(Executors.java:511) at java.util.concurrent.FutureTask.run(FutureTask.java:266) at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1149) at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:624) at java.lang.Thread.run(Thread.java:750
    • Thank you so much for your help, I'll try it as soon as I can. I have a genuine question because I'm not familiar with the matter: Can a recipe error cause something as serious as the AMD error?
    • When i try to launch my modpack, the instance crashes and this is sent to the logs: Time: 2025-05-27 23:07:18 Description: Rendering overlay Below is the full log: https://mclo.gs/jP5G2EH
    • Make a test without delightful
  • Topics

×
×
  • Create New...

Important Information

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