Jump to content

Recommended Posts

Posted

So let me preface this by saying that I'm a bit new to modding in Minecraft and I've been slowly learning Java on the side. I'm currently working on a mod that goes through just about everything there is to do with coding a mod (bit by bit!) and I've become stuck with custom entity models. I followed several tutorials and tried to use all the info I found to get this right but I keep getting the same error and I'm not entirely sure why. I'm sorry I don't have a github repository but if anyone could help me figure out what's going on it'd be greatly appreciated!

 

The error pops up as soon as I spawn my custom entity, the renderer has an issue stating that it can't find the entity texture.

 

at com.blowuptheocean.rpgworld.entities.RenderRpgGoblin.getEntityTexture(RenderRpgGoblin.java:22)

 

followed by:

 

Stacktrace:
at net.minecraft.client.renderer.entity.RenderManager.func_147939_a(RenderManager.java:339)
at net.minecraft.client.renderer.entity.RenderManager.renderEntityStatic(RenderManager.java:278)
at net.minecraft.client.renderer.entity.RenderManager.renderEntitySimple(RenderManager.java:251)
at net.minecraft.client.renderer.RenderGlobal.renderEntities(RenderGlobal.java:527)
at net.minecraft.client.renderer.EntityRenderer.renderWorld(EntityRenderer.java:1300)
at net.minecraft.client.renderer.EntityRenderer.updateCameraAndRender(EntityRenderer.java:1087)
at net.minecraft.client.Minecraft.runGameLoop(Minecraft.java:1056)
at net.minecraft.client.Minecraft.run(Minecraft.java:951)
at net.minecraft.client.main.Main.main(Main.java:164)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(Unknown Source)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source)
at java.lang.reflect.Method.invoke(Unknown Source)
at net.minecraft.launchwrapper.Launch.launch(Launch.java:135)
at net.minecraft.launchwrapper.Launch.main(Launch.java:28)
at net.minecraftforge.gradle.GradleStartCommon.launch(GradleStartCommon.java:78)
at GradleStart.main(GradleStart.java:45)

 

Now, I've placed the texture where it should be and with the correct name I believe. I've tried changing things around a bunch with no luck...Here are my files if anyone has a second to look over them!

 

Client Proxy:

package com.blowuptheocean.rpgworld;

import net.minecraft.client.Minecraft;

import com.blowuptheocean.rpgworld.entities.EntityRpgGoblin;
import com.blowuptheocean.rpgworld.entities.RenderRpgGoblin;
import com.blowuptheocean.rpgworld.entities.RpgGoblin;

import cpw.mods.fml.client.registry.RenderingRegistry;
import cpw.mods.fml.common.FMLCommonHandler;

public class ClientProxy extends ServerProxy{

public void registerRenderThings(){

	RenderingRegistry.registerEntityRenderingHandler(EntityRpgGoblin.class, new RenderRpgGoblin(new RpgGoblin(), 0));

	FMLCommonHandler.instance().bus().register(new ServerTickHandler(Minecraft.getMinecraft()));

}
}

 

Main File:

package com.blowuptheocean.rpgworld;

import net.minecraft.creativetab.CreativeTabs;
import net.minecraft.item.Item;

import com.blowuptheocean.rpgworld.blocks.RpgBlocks;
import com.blowuptheocean.rpgworld.entities.RpgEntity;
import com.blowuptheocean.rpgworld.handler.EventManager;
import com.blowuptheocean.rpgworld.handler.RpgRecipes;
import com.blowuptheocean.rpgworld.help.Reference;
import com.blowuptheocean.rpgworld.items.RpgItems;

import cpw.mods.fml.common.Mod;
import cpw.mods.fml.common.Mod.EventHandler;
import cpw.mods.fml.common.SidedProxy;
import cpw.mods.fml.common.event.FMLPreInitializationEvent;
import cpw.mods.fml.common.registry.GameRegistry;
import cpw.mods.fml.relauncher.Side;
import cpw.mods.fml.relauncher.SideOnly;


@Mod(modid = Reference.MODID, version = Reference.VERSION)


public class RPGWorld 
{

//Establish Proxies//
@SidedProxy(clientSide = "com.blowuptheocean.rpgworld.ClientProxy", serverSide = "com.blowuptheocean.rpgworld.ServerProxy")
public static ServerProxy proxy;

//Establish Entities//

//Establish World Generators//
public static EventManager rpgcopperGen = new EventManager();


//Establish Creative Tabs//
    public static CreativeTabs rpgItemTab = new CreativeTabs(CreativeTabs.getNextID(), "rpg_items")
    {
        @SideOnly(Side.CLIENT)
        public Item getTabIconItem() {
            return RpgItems.copperIngot;
        }
};
    public static final CreativeTabs rpgBlockTab = new CreativeTabs(CreativeTabs.getNextID(), "rpg_blocks")
    {
    	        @SideOnly(Side.CLIENT)
    	        public Item getTabIconItem() {
    	            return RpgItems.copperDust;
    	        }
    };
    public static final CreativeTabs rpgGearTab = new CreativeTabs(CreativeTabs.getNextID(), "rpg_gear")
    {
    	        @SideOnly(Side.CLIENT)
    	        public Item getTabIconItem() {
    	            return RpgItems.copperPickaxe;
    	        }
    };

    
    //EVENT HANDLERS//
@EventHandler
public void preInit(FMLPreInitializationEvent event)
{

	//Register Renderer//
	proxy.registerRenderThings();
	//Register Entities? //
	RpgEntity.loadEntities();
        //Block handlers, handles all blocks
	RpgBlocks.loadBlocks();
        //Item handlers, handles all items
	RpgItems.loadItems();

        //Register handler, adds all the recipes
	RpgRecipes.addRecipes();

	//World Gen Registry //
	GameRegistry.registerWorldGenerator(rpgcopperGen, 1);

}
}

 

 

My EntityGoblin code:

 

package com.blowuptheocean.rpgworld.entities;

import net.minecraft.entity.EntityAgeable;
import net.minecraft.entity.SharedMonsterAttributes;
import net.minecraft.entity.ai.EntityAIPanic;
import net.minecraft.entity.ai.EntityAITempt;
import net.minecraft.entity.ai.EntityAIWander;
import net.minecraft.entity.monster.EntityMob;
import net.minecraft.entity.passive.EntityAnimal;
import net.minecraft.init.Items;
import net.minecraft.world.World;

public class EntityRpgGoblin extends EntityMob{

public EntityRpgGoblin(World par1World) {
	super(par1World);
	this.setSize(0.7F, 0.4F);
	this.tasks.addTask(0,  new EntityAIWander(this, 0.5D));
	this.tasks.addTask(1, new EntityAIPanic(this, 1.D));
	this.tasks.addTask(2, new EntityAITempt(this, 0.8D, Items.apple, false));
}

public boolean isAIEnabled(){
	return true;
}

protected void applyEntityAttributes(){
	super.applyEntityAttributes();
	this.getEntityAttribute(SharedMonsterAttributes.maxHealth).setBaseValue(26);
	this.getEntityAttribute(SharedMonsterAttributes.movementSpeed).setBaseValue(0.5D);
}



}

 

RenderGoblin code:

 

package com.blowuptheocean.rpgworld.entities;
import com.blowuptheocean.rpgworld.help.Reference;
import net.minecraft.client.model.ModelBase;
import net.minecraft.client.renderer.entity.RenderLiving;
import net.minecraft.entity.Entity;
import net.minecraft.util.ResourceLocation;

public class RenderRpgGoblin extends RenderLiving{


private static final ResourceLocation mobTextures = new ResourceLocation(Reference.MODID + "textures/entity/EntityRpgGoblin.png");

public RenderRpgGoblin(ModelBase par1ModelBase, float parShadowSize) {
	super(par1ModelBase, parShadowSize);

}
	protected ResourceLocation getEntityTextures(EntityRpgGoblin entity){
		return mobTextures;
	}

	protected ResourceLocation getEntityTexture(Entity entity){
		return this.getEntityTexture((EntityRpgGoblin)entity);
	}
}

 

Entity Registration code:

 

package com.blowuptheocean.rpgworld.entities;

import java.util.Random;
import net.minecraft.entity.EntityList;
import net.minecraft.entity.EnumCreatureType;
import net.minecraft.world.biome.BiomeGenBase;
import com.blowuptheocean.rpgworld.help.Reference;
import com.blowuptheocean.rpgworld.help.RegisterHelper;
import cpw.mods.fml.common.Mod.Instance;
import cpw.mods.fml.common.registry.EntityRegistry;

public class RpgEntity
{

public static void loadEntities(){
	registerEntity();
}


public static void registerEntity(){
	createEntity(EntityRpgGoblin.class, "Goblin", 0x91C4FF, 0xFFCC91);
}

public static void createEntity(Class entityClass, String entityName, int solidColor, int spotColor){
	int randomId = EntityRegistry.findGlobalUniqueEntityId();
	EntityRegistry.registerGlobalEntityID(entityClass, entityName, randomId);
	EntityRegistry.registerModEntity(entityClass, entityName, randomId, Reference.MODID, 64, 1, true);
	EntityRegistry.addSpawn(entityClass, 2, 0, 1, EnumCreatureType.monster, BiomeGenBase.forest);

	createEgg(randomId, solidColor, spotColor);
}

private static void createEgg(int randomId, int solidColor, int spotColor){
	EntityList.entityEggs.put(Integer.valueOf(randomId), new EntityList.EntityEggInfo(randomId, solidColor,spotColor));
}

}

 

And then I have the actually goblin java model code from Techne! The texture is located in main/resources/assets/rpgworld/textures/entity/    and I've changed the name of the file around just to make sure it's not something weird with the name, though it could be part of the issue. (right now it's set to EntityRpgGoblin.png)

 

Sorry for the lengthy post, just hoping someone can help me out! Also if there is a better way to organize a post like this, feel free to let me know!

Posted

seems as if its not loading the texture

possible problem is in this line

private static final ResourceLocation mobTextures = new ResourceLocation(Reference.MODID + "textures/entity/EntityRpgGoblin.png");

try changing it to

private static final ResourceLocation mobTextures = new ResourceLocation(Reference.MODID + ":textures/entity/entityrpggoblin.png");

and rename the image to lowercase

 

note i added ":" before texture

 

always use lowercase for filenames, saves lots of issues as it is case sensitive

also make sure Reference.MODID is lowercase too as having uppercase also causes lots of issues

 

you image should be in resources in a package called "assets.mod.textures.entity"  where "mod" is replaces with Reference.MODID

 

 

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 want to create block with entity, that will have height of 3 or more(configurable) and I tried to change first VoxelShape by increasing collision box on height I want and for changing block height on visual side i tried to configure BlockModelBuilder:  base.element() .from(0, 0, 0) .to(16f, 48f, 16f) .face(Direction.UP).texture("#top").end() .face(Direction.DOWN).texture("#bottom").end() .face(Direction.NORTH).texture("#side").end() .face(Direction.SOUTH).texture("#side").end() .face(Direction.WEST).texture("#side").end() .face(Direction.EAST).texture("#side").end() .end(); but, getting crash with next error: Position y out of range, must be within [-16, 32]. Found: %d [48.0]; Looks like game wont to block height modified by more than 32. Is there any way to fix that problem?
    • As long as the packets you are sending aren't lost, there's nothing wrong with what you're currently doing. Although, this sounds like something that would benefit from you making your own datapack registry instead of trying to arbitrarily sync static maps. Check out `DataPackRegistryEvent.NewRegistry`.
    • Hey all, I've been working a lot with datapacks lately, and I'm wondering what the most efficient way to get said data from server to client is.  I'm currently using packets, but given that a lot of the data I'm storing involves maps along the lines of Map<ResourceLocation, CustomDataType>, it can easily start to get messy if I need to transmit a lot of that data all at once. Recently I started looking into the ReloadableServerResources class, which is where Minecraft stores its built-ins.  I see you can access it via the server from the server's resources.managers, and it seems like this can be done even from the client to appropriately retrieve data from the server, unless I'm misunderstanding.  However, from what I can tell, this only works via built-in methods such as getRecipeManager() or getLootTables(), etc.  These are all SimpleJsonResourceReloadListeners, just like my datapack entries are, so it seems like it could be possible for me to access my datapack entries similarly?  But I don't see anywhere in ReloadableServerResources that stores loaded modded entries, so either I'm looking in the wrong place or it doesn't seem to be a thing. Are packets really the best way of doing this, or am I missing a method that would let me use ReloadableServerResources or something similar?
    • Hi, everyone! I'm new to minecraft modding stuff and want ask you some questions. 1. I checked forge references and saw there com.mojang and net.minecraft (not net.minecraftforge) and as I understand it's original game packages with all minecraft logic inside including renderers and so on, right? 2. Does it mean that forge has a limited set of instruments which doesn't cover all the aspects of the game? If make my question more specific then does forge provide such instruments that allow me totally change minecraft itself, like base mechanics and etc.? Or I have to use "original game packages" to implement such things? 3. I actively learning basic concepts with forge documentation and tutorials. So in my plans make different inventory system like in diabloids. Is that possible with forge? 4. It is last question related to the second one. So how deeply I can change minecraft with forge? I guess all my questions above because of that I haven't globally understanding what forge is and how it works inside and how it works with minecraft. It would be great if you provide some links or topics about it or explain it by yourself but I guess it's to big to be explained in that post at once. Anyway, thank you all for any help!
    • Im trying add to block a hole in center, just a usual block and in center of it on up side, there is should be a hole. I tried to add it via BlockModelBuilder, but its not working. Problem is that it only can change block size outside. I tried it to do with VoxelShape and its working, but its has been on server side and looks like its just changed collision shape, but for client, there is a texture covering this hole. I tried to use: base.renderType("cutout"); and removed some pixels from texture. I thought its should work, but game optimization makes block inside looks transparent. So, only custom model?
  • Topics

×
×
  • Create New...

Important Information

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