Jump to content

Recommended Posts

Posted

So i'm making an entity which uses a similar model to that of a horse (so I copied everything from ModelHorse into a class which will be used by my entity and renamed everything so it would work), and I made a render class along with an entity class. In the main class I registered it and made the spawn egg, but whenever I try to spawn it into the world I just get an error message in the console.

 

Error message:

 

2013-09-08 18:19:48 [iNFO] [sTDERR] java.lang.InstantiationException
2013-09-08 18:19:48 [iNFO] [sTDERR] 	at sun.reflect.InstantiationExceptionConstructorAccessorImpl.newInstance(Unknown Source)
2013-09-08 18:19:48 [iNFO] [sTDERR] 	at java.lang.reflect.Constructor.newInstance(Unknown Source)
2013-09-08 18:19:48 [iNFO] [sTDERR] 	at net.minecraft.entity.EntityList.createEntityByID(EntityList.java:205)
2013-09-08 18:19:48 [iNFO] [sTDERR] 	at net.minecraft.item.ItemMonsterPlacer.spawnCreature(ItemMonsterPlacer.java:175)
2013-09-08 18:19:48 [iNFO] [sTDERR] 	at net.minecraft.item.ItemMonsterPlacer.onItemUse(ItemMonsterPlacer.java:81)
2013-09-08 18:19:48 [iNFO] [sTDERR] 	at net.minecraft.item.ItemStack.tryPlaceItemIntoWorld(ItemStack.java:152)
2013-09-08 18:19:48 [iNFO] [sTDERR] 	at net.minecraft.item.ItemInWorldManager.activateBlockOrUseItem(ItemInWorldManager.java:429)
2013-09-08 18:19:48 [iNFO] [sTDERR] 	at net.minecraft.network.NetServerHandler.handlePlace(NetServerHandler.java:554)
2013-09-08 18:19:48 [iNFO] [sTDERR] 	at net.minecraft.network.packet.Packet15Place.processPacket(Packet15Place.java:79)
2013-09-08 18:19:48 [iNFO] [sTDERR] 	at net.minecraft.network.MemoryConnection.processReadPackets(MemoryConnection.java:89)
2013-09-08 18:19:48 [iNFO] [sTDERR] 	at net.minecraft.network.NetServerHandler.networkTick(NetServerHandler.java:141)
2013-09-08 18:19:48 [iNFO] [sTDERR] 	at net.minecraft.network.NetworkListenThread.networkTick(NetworkListenThread.java:54)
2013-09-08 18:19:48 [iNFO] [sTDERR] 	at net.minecraft.server.integrated.IntegratedServerListenThread.networkTick(IntegratedServerListenThread.java:109)
2013-09-08 18:19:48 [iNFO] [sTDERR] 	at net.minecraft.server.MinecraftServer.updateTimeLightAndEntities(MinecraftServer.java:689)
2013-09-08 18:19:48 [iNFO] [sTDERR] 	at net.minecraft.server.MinecraftServer.tick(MinecraftServer.java:585)
2013-09-08 18:19:48 [iNFO] [sTDERR] 	at net.minecraft.server.integrated.IntegratedServer.tick(IntegratedServer.java:129)
2013-09-08 18:19:48 [iNFO] [sTDERR] 	at net.minecraft.server.MinecraftServer.run(MinecraftServer.java:482)
2013-09-08 18:19:48 [iNFO] [sTDERR] 	at net.minecraft.server.ThreadMinecraftServer.run(ThreadMinecraftServer.java:16)
2013-09-08 18:19:48 [WARNING] [Minecraft-Server] Skipping Entity with id 301

 

Could it be that i'm calling it wrong, or do you think it's something else?

Posted

(so I copied everything from ModelHorse

*facepalm*

Why not use ModelHorse directly ?  :'(

 

Your error comes from your entity constructors. It is expected to have a constructor with (World) as only argument.

Posted

I didn't use ModelHorse as I was going to make a new, similar model at a later date. I did this to get it setup for when I decided to do that.

 

As for the constructors, do you think you could perhaps give a little hint as to what I need to do, as I thought that it was correct  :-[

Posted

Ok, this is what I have in the EntityPegasus class.

 

package RosarioMokaChan.RandomCraft;

import RosarioMokaChan.RandomCraft.lib.ModBlocks;
import net.minecraft.block.Block;
import net.minecraft.block.StepSound;
import net.minecraft.entity.EnumCreatureAttribute;
import net.minecraft.entity.SharedMonsterAttributes;
import net.minecraft.entity.ai.EntityAILookIdle;
import net.minecraft.entity.ai.EntityAIPanic;
import net.minecraft.entity.ai.EntityAISwimming;
import net.minecraft.entity.ai.EntityAIWander;
import net.minecraft.entity.ai.EntityAIWatchClosest;
import net.minecraft.entity.passive.EntityAnimal;
import net.minecraft.entity.player.EntityPlayer;
import net.minecraft.item.Item;
import net.minecraft.util.StatCollector;
import net.minecraft.world.World;

public abstract class EntityPegasus extends EntityAnimal
{
    public EntityPegasus(World par1World)
    {
        super(par1World);
        this.setSize(1.4F, 1.6F);
        this.isImmuneToFire = true;
        this.getNavigator().setAvoidsWater(true);
        this.tasks.addTask(0, new EntityAISwimming(this));
        this.tasks.addTask(1, new EntityAIPanic(this, 0.8D));
        this.tasks.addTask(6, new EntityAIWander(this, 0.7D));
        this.tasks.addTask(7, new EntityAIWatchClosest(this, EntityPlayer.class, 6.0F));
        this.tasks.addTask(8, new EntityAILookIdle(this));
    }
    
    protected boolean isAIEnabled(){
    	return true;
    }
    
    public int getMaxHealth() {
    	return 15;
    	}
    

    @Override
    protected String getLivingSound()
    {
        return "mob.horse.idle";
    }

    @Override
    protected String getHurtSound()
    {
        return "mob.horse.hit";
    }

    @Override
    protected String getDeathSound()
    {
        return "mob.horse.death";
    }

    @Override
    protected float getSoundVolume()
    {
        return 0.4F;
    }
    
    protected int getDropItemId()
    {
        return Item.leather.itemID;
    }
    
    protected void playStepSound(int par1, int par2, int par3, int par4)
    {
        this.playSound("mob.horse.gallop", 0.15F, 1.0F);
        
    }
    
    protected void dropRareDrop(int par1){
    	switch (this.rand.nextInt(3)){
    	case 0:
    		this.dropItem(ModBlocks.dragonWings.itemID, 1);
    	break;
    	}
    }
    
    public EnumCreatureAttribute getCreatureAttribute(){
    	return EnumCreatureAttribute.UNDEFINED;
    }
    
    

    
}

Posted

Before I started anything to do with modding, I made sure to read a few java documents and do some exercises to learn some of the stuff needed, it's just abstract classes and a few other things weren't covered. Also making the class abstract was an alternative to importing net.minecraft.entity.EntityAgeable, which I was trying to avoid doing as I was trying to cut down on the amount of unnecessary imports.

Posted

Well, abstract classes can't be instanciated.

It is their main property.

 

making the class abstract was an alternative to importing net.minecraft.entity.EntityAgeable

This doesn't make any sense. You can also do both or neither.

 

I was trying to cut down on the amount of unnecessary imports.

One of my personal rules is: "Optimize a working code, not the other way around"

Posted

Right, so now my entity spawns in the world and has a shadow, hitbox and sounds. However it's invisible. The console is saying that my entity can't be cast to EntityHorse, and i'm sure that I must be missing something in my RenderPegasus class.

 

2013-09-09 10:08:30 [iNFO] [sTDERR] java.lang.ClassCastException: RosarioMokaChan.RandomCraft.EntityPegasus cannot be cast to net.minecraft.entity.passive.EntityHorse
2013-09-09 10:08:30 [iNFO] [sTDERR] 	at RosarioMokaChan.RandomCraft.Pegasus.setLivingAnimations(Pegasus.java:362)
2013-09-09 10:08:30 [iNFO] [sTDERR] 	at net.minecraft.client.renderer.entity.RendererLivingEntity.func_130000_a(RendererLivingEntity.java:153)
2013-09-09 10:08:30 [iNFO] [sTDERR] 	at net.minecraft.client.renderer.entity.RenderLiving.doRenderLiving(RenderLiving.java:28)
2013-09-09 10:08:30 [iNFO] [sTDERR] 	at RosarioMokaChan.RandomCraft.RenderPegasus.renderPegasus(RenderPegasus.java:21)
2013-09-09 10:08:30 [iNFO] [sTDERR] 	at RosarioMokaChan.RandomCraft.RenderPegasus.doRender(RenderPegasus.java:31)
2013-09-09 10:08:30 [iNFO] [sTDERR] 	at net.minecraft.client.renderer.entity.RenderManager.renderEntityWithPosYaw(RenderManager.java:312)
2013-09-09 10:08:30 [iNFO] [sTDERR] 	at net.minecraft.client.renderer.entity.RenderManager.renderEntity(RenderManager.java:281)
2013-09-09 10:08:30 [iNFO] [sTDERR] 	at net.minecraft.client.renderer.RenderGlobal.renderEntities(RenderGlobal.java:524)
2013-09-09 10:08:30 [iNFO] [sTDERR] 	at net.minecraft.client.renderer.EntityRenderer.renderWorld(EntityRenderer.java:1160)
2013-09-09 10:08:30 [iNFO] [sTDERR] 	at net.minecraft.client.renderer.EntityRenderer.updateCameraAndRender(EntityRenderer.java:1006)
2013-09-09 10:08:30 [iNFO] [sTDERR] 	at net.minecraft.client.Minecraft.runGameLoop(Minecraft.java:934)
2013-09-09 10:08:30 [iNFO] [sTDERR] 	at net.minecraft.client.Minecraft.func_99999_d(Minecraft.java:826)
2013-09-09 10:08:30 [iNFO] [sTDERR] 	at net.minecraft.client.main.Main.main(Main.java:93)
2013-09-09 10:08:30 [iNFO] [sTDERR] 	at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
2013-09-09 10:08:30 [iNFO] [sTDERR] 	at sun.reflect.NativeMethodAccessorImpl.invoke(Unknown Source)
2013-09-09 10:08:30 [iNFO] [sTDERR] 	at sun.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source)
2013-09-09 10:08:30 [iNFO] [sTDERR] 	at java.lang.reflect.Method.invoke(Unknown Source)
2013-09-09 10:08:30 [iNFO] [sTDERR] 	at net.minecraft.launchwrapper.Launch.launch(Launch.java:57)
2013-09-09 10:08:30 [iNFO] [sTDERR] 	at net.minecraft.launchwrapper.Launch.main(Launch.java:18)

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, the forums are a back burner thing. Not many people use it. Best option is discord. I know that I haven't looked at the forums for more then admin tasks in quite a while. You're also best off not following tutorials which give you code. Knowing programming and reading the MC/Forge code yourself would be the best way to go.
    • on my last computer, i had a similar problem with forge/ neoforge mods but instead them launcher screen was black
    • I am trying to make a mod, all it is, a config folder that tells another mod to not require a dependency, pretty simple right.. well, I dont want whoever downloads my mod to have to download 4 other mods and then decide if they want 2 more that they kinda really need.. i want to make my mod basically implement all of these mods, i really dont care how it does it, ive tried putting them in every file location you can think of, ive downloaded intellij, mcreator, and tried vmware but thats eh (had it from school). I downloaded them in hopes theyd create the correct file i needed but honestly im only more lost now. I have gotten my config file to work, if i put all these mods into my own mods folder and the config file into the config and it works (unvbelievably) but i want to share this to everyone else, lets just say this mod will legitimately get 7M downloads.  I tried putting them in a run folder then having it create all the contents in that for a game (mods,config..etc) then i drop the mods in and all the sudden i cant even open the game, like it literally works with my own world i play on, but i cant get it to work on any coding platform, they all have like built in java versions you cant switch, its a nightmare. I am on 1.20.1 I need Java 17 (i dont think the specific versions of 17 matter) I have even tried recreating the mods i want to implement and deleting import things like net.adamsandler.themodsname and replacing it with what mine is. that only creates other problems, where im at right now is i got the thing to start opening then it crashes, closest ive gotten it, then it just says this  exception in thread "main" cpw.mods.niofs.union.unionfilesystem$uncheckedioexception: java.util.zip.zipexception: zip end header not found caused by: java.util.zip.zipexception: zip end header not found basically saying theres something wrong with my java.exe file, so i tried downloading so many different versions of java and putting them all in so many different spots, nothing, someone online says its just a mod that isnt built right so i put the mod into an editor and bunch of errors came up, id post it but i deleted it on accident, i just need help integrating mods
    • Vanilla 1.16.5 Crash Report [#L2KYKaK] - mclo.gs  
    • Hello, probably the last update, if anyone has the same problem or this can be of any help, the answer was pretty simple, textures started rendering just using a Tesselator instead of a VertexConsumer given by a MultibufferSource and a RenderType, pretty simple
  • Topics

×
×
  • Create New...

Important Information

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