Jump to content

Recommended Posts

Posted

i just started modding and im trying to make a new entity

i looked up some tutorials but what ever i do i cant seem to load the mod or render the entity model

so im kinda lost right now so i hope somebody can help me out here

 

 

 

 

here is the crash code

 

---- Minecraft Crash Report ----

// I blame Dinnerbone.

 

Time: 4-5-14 0:38Description: Initializing gamejava.lang.NullPointerException

 

at stider.pony.client.model.ModelPony.<init>(ModelPony.java:45) 

at stider.pony.core.proxy.ClientProxy.registerRenderThings(ClientProxy.java:17) 

at stider.pony.pony.load(pony.java:71) 

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 cpw.mods.fml.common.FMLModContainer.handleModStateEvent(FMLModContainer.java:545)  at sun.reflect.GeneratedMethodAccessor1.invoke(Unknown Source) 

at sun.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source) 

at java.lang.reflect.Method.invoke(Unknown Source) 

at com.google.common.eventbus.EventHandler.handleEvent(EventHandler.java:74)  at com.google.common.eventbus.SynchronizedEventHandler.handleEvent(SynchronizedEventHandler.java:45) 

at com.google.common.eventbus.EventBus.dispatch(EventBus.java:313) 

at com.google.common.eventbus.EventBus.dispatchQueuedEvents(EventBus.java:296)  at com.google.common.eventbus.EventBus.post(EventBus.java:267) 

at cpw.mods.fml.common.LoadController.sendEventToModContainer(LoadController.java:201) 

at cpw.mods.fml.common.LoadController.propogateStateMessage(LoadController.java:181) 

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 com.google.common.eventbus.EventHandler.handleEvent(EventHandler.java:74)  at com.google.common.eventbus.SynchronizedEventHandler.handleEvent(SynchronizedEventHandler.java:45) 

at com.google.common.eventbus.EventBus.dispatch(EventBus.java:313) 

at com.google.common.eventbus.EventBus.dispatchQueuedEvents(EventBus.java:296)  at com.google.common.eventbus.EventBus.post(EventBus.java:267) 

at cpw.mods.fml.common.LoadController.distributeStateMessage(LoadController.java:112)  at cpw.mods.fml.common.Loader.initializeMods(Loader.java:699) 

at cpw.mods.fml.client.FMLClientHandler.finishMinecraftLoading(FMLClientHandler.java:249)  at net.minecraft.client.Minecraft.startGame(Minecraft.java:509) 

at net.minecraft.client.Minecraft.run(Minecraft.java:808) 

at net.minecraft.client.main.Main.main(Main.java:93) 

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:131) 

at net.minecraft.launchwrapper.Launch.main(Launch.java:27)A detailed walkthrough

 

of the error, its code path and all known details is as follows:----------------------------------------------------------------------------------------- Head --Stacktrace: 

at stider.pony.client.model.ModelPony.<init>(ModelPony.java:45) 

at stider.pony.core.proxy.ClientProxy.registerRenderThings(ClientProxy.java:17) 

at stider.pony.pony.load(pony.java:71) 

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 cpw.mods.fml.common.FMLModContainer.handleModStateEvent(FMLModContainer.java:545)  at sun.reflect.GeneratedMethodAccessor1.invoke(Unknown Source) 

at sun.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source) 

at java.lang.reflect.Method.invoke(Unknown Source) 

at com.google.common.eventbus.EventHandler.handleEvent(EventHandler.java:74)  at com.google.common.eventbus.SynchronizedEventHandler.handleEvent(SynchronizedEventHandler.java:45) 

at com.google.common.eventbus.EventBus.dispatch(EventBus.java:313) 

at com.google.common.eventbus.EventBus.dispatchQueuedEvents(EventBus.java:296)  at com.google.common.eventbus.EventBus.post(EventBus.java:267) 

at cpw.mods.fml.common.LoadController.sendEventToModContainer(LoadController.java:201) 

at cpw.mods.fml.common.LoadController.propogateStateMessage(LoadController.java:181)  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 com.google.common.eventbus.EventHandler.handleEvent(EventHandler.java:74)  at com.google.common.eventbus.SynchronizedEventHandler.handleEvent(SynchronizedEventHandler.java:45) 

at com.google.common.eventbus.EventBus.dispatch(EventBus.java:313) 

at com.google.common.eventbus.EventBus.dispatchQueuedEvents(EventBus.java:296)  at com.google.common.eventbus.EventBus.post(EventBus.java:267) 

at cpw.mods.fml.common.LoadController.distributeStateMessage(LoadController.java:112)  at cpw.mods.fml.common.Loader.initializeMods(Loader.java:699) 

at cpw.mods.fml.client.FMLClientHandler.finishMinecraftLoading(FMLClientHandler.java:249) 

at net.minecraft.client.Minecraft.startGame(Minecraft.java:509)-- Initialization --Details:Stacktrace: 

at net.minecraft.client.Minecraft.run(Minecraft.java:808) 

at net.minecraft.client.main.Main.main(Main.java:93) 

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:131) 

at net.minecraft.launchwrapper.Launch.main(Launch.java:27)

 

-- System Details --

Details:  Minecraft Version: 1.6.4 

Operating System: Windows 8 (amd64) version 6.2 

Java Version: 1.7.0_45, Oracle Corporation 

Java VM Version: Java HotSpot 64-Bit Server VM (mixed mode), Oracle Corporation 

Memory: 401493360 bytes (382 MB) / 518979584 bytes (494 MB) up to 2077753344 bytes (1981 MB) 

JVM Flags: 3 total; -Xincgc -Xmx2048M -Xms512M  AABB Pool Size: 0 (0 bytes; 0 MB) allocated, 0 (0 bytes; 0 MB) used 

Suspicious classes: FML and Forge are installed  IntCache: cache: 0, tcache: 0, allocated: 0, tallocated: 0 

FML: MCP v8.11 FML v6.4.49.965 Minecraft Forge 9.11.1.965 13

mods loaded, 13 mods active  mcp{8.09} [Minecraft Coder Pack] (minecraft.jar) Unloaded->Constructed->Pre-initialized->Initialized  FML{6.4.49.965} [Forge Mod Loader] (bin) Unloaded->Constructed->Pre-initialized->Initialized  Forge{9.11.1.965} [Minecraft Forge] (bin) Unloaded->Constructed->Pre-initialized->Initialized  BuildCraft|Core{@VERSION@} [buildCraft] (bin) Unloaded->Constructed->Pre-initialized->Initialized  BuildCraft|Builders{@VERSION@} [bC Builders] (bin) Unloaded->Constructed->Pre-initialized->Initialized  BuildCraft|Energy{@VERSION@} [bC Energy] (bin) Unloaded->Constructed->Pre-initialized->Initialized  BuildCraft|Factory{@VERSION@} [bC Factory] (bin) Unloaded->Constructed->Pre-initialized->Initialized  BuildCraft|Transport{@VERSION@} [bC Transport] (bin) Unloaded->Constructed->Pre-initialized->Initialized  BuildCraft|Silicon{@VERSION@} [bC Silicon] (bin) Unloaded->Constructed->Pre-initialized->Initialized  EE3{@VERSION@ (build @BUILD_NUMBER@)} [Equivalent Exchange 3] (bin) Unloaded->Constructed->Pre-initialized->Initialized  IronChest{1.0} [iron Chests] (bin) Unloaded->Constructed->Pre-initialized->Initialized  Riftcraft{testing} [Riftcraft] (bin) Unloaded->Constructed->Pre-initialized->Initialized  pony{1} [pony entitys] (bin) Unloaded->Constructed->Pre-initialized->Errored  Launched Version: 1.6  LWJGL: 2.9.0  OpenGL: GeForce 610M/PCIe/SSE2 GL version 4.4.0, NVIDIA Corporation  Is Modded: Definitely; Client brand changed to 'fml,forge'  Type: Client (map_client.txt)  Resource Pack: Default  Current Language: English (US)  Profiler Position: N/A (disabled)  Vec3 Pool Size: ~~ERROR~~ NullPointerException: null#@!@# Game crashed!

Crash report saved to: #@!@# D:\java\minecraft Dev\forge\mcp\jars\.\crash-reports\crash-2014-05-04_00.38.37-client.txt

 

 

 

 

 

my main class

package stider.pony;


import net.minecraft.creativetab.CreativeTabs;
import stider.pony.block.ModBlocks;
import stider.pony.core.proxy.CommonProxy;
import stider.pony.creativetab.CreativeTabPONY;
import stider.pony.entity.ModEntity;
import stider.pony.item.ModItems;
import stider.pony.lib.Reference;
import cpw.mods.fml.common.Mod;
import cpw.mods.fml.common.Mod.EventHandler;
import cpw.mods.fml.common.Mod.Instance;
import cpw.mods.fml.common.SidedProxy;
import cpw.mods.fml.common.event.FMLInitializationEvent;
import cpw.mods.fml.common.event.FMLPostInitializationEvent;
import cpw.mods.fml.common.event.FMLPreInitializationEvent;




@Mod(modid = Reference.MOD_ID, name = Reference.MOD_NAME, version = Reference.VERSION_NUMBER)
public class pony {
   
   @Instance(Reference.MOD_ID)
   public static pony instance;
   
   @SidedProxy(clientSide = Reference.CLIENT_PROXY_CLASS, serverSide = Reference.SERVER_PROXY_CLASS)
   public static CommonProxy proxy;
   
   public static CreativeTabs tabsPony= new CreativeTabPONY(CreativeTabs.getNextID(), Reference.MOD_ID);




    @EventHandler
    public void preInit(FMLPreInitializationEvent event) {
       


       ModEntity.init();


      
    }


    @EventHandler
    public void load(FMLInitializationEvent event) {
  
       proxy.registerRenderThings();
       
    }
    
    @EventHandler
    public void postInit(FMLPostInitializationEvent event) {
        
    }


}


 

 

my model

package stider.pony.client.model;

import net.minecraft.client.model.ModelBase;
import net.minecraft.client.model.ModelRenderer;
import net.minecraft.entity.Entity;

public class ModelPony extends ModelBase
{
  //fields
    ModelRenderer body;
    ModelRenderer backlegright;
    ModelRenderer frontlegleft;
    ModelRenderer backlegleft;
    ModelRenderer frontlegright;
    ModelRenderer muzzle;
    ModelRenderer neck;
    ModelRenderer earleft;
    ModelRenderer earright;
    ModelRenderer tail2;
    ModelRenderer tail1;
    ModelRenderer rightwing1;
    ModelRenderer rightwing2;
    ModelRenderer leftwing1;
    ModelRenderer leftwing2;
    ModelRenderer horn;
    ModelRenderer head;
  
  public ModelPony()
  {
    textureWidth = 128;
    textureHeight = 64;
    
      body = new ModelRenderer(this, 0, 0);
      body.addBox(0F, 0F, 0F, 8, 8, 16);
      body.setRotationPoint(-4F, 4F, -7F);
      body.setTextureSize(128, 64);
      body.mirror = true;
      setRotation(body, 0F, 0F, 0F);
      backlegright = new ModelRenderer(this, 32, 0);
      backlegright.addBox(0F, 0F, 0F, 4, 12, 4);
      backlegright.setRotationPoint(-4F, 12F, 5F);
      backlegright.setTextureSize(128, 64);
      backlegright.mirror = true;
      setRotation(backlegright, 0F, 0F, 0F);
      frontlegleft.mirror = true;
      frontlegleft = new ModelRenderer(this, 32, 0);
      frontlegleft.addBox(0F, 0F, 0F, 4, 12, 4);
      frontlegleft.setRotationPoint(0F, 12F, -7F);
      frontlegleft.setTextureSize(128, 64);
      frontlegleft.mirror = true;
      setRotation(frontlegleft, 0F, 0F, 0F);
      frontlegleft.mirror = false;
      backlegleft.mirror = true;
      backlegleft = new ModelRenderer(this, 32, 0);
      backlegleft.addBox(0F, 0F, 0F, 4, 12, 4);
      backlegleft.setRotationPoint(0F, 12F, 5F);
      backlegleft.setTextureSize(128, 64);
      backlegleft.mirror = true;
      setRotation(backlegleft, 0F, 0F, 0F);
      backlegleft.mirror = false;
      frontlegright = new ModelRenderer(this, 32, 0);
      frontlegright.addBox(0F, 0F, 0F, 4, 12, 4);
      frontlegright.setRotationPoint(-4F, 12F, -7F);
      frontlegright.setTextureSize(128, 64);
      frontlegright.mirror = true;
      setRotation(frontlegright, 0F, 0F, 0F);
      muzzle = new ModelRenderer(this, 0, 24);
      muzzle.addBox(0F, 0F, 0F, 4, 3, 2);
      muzzle.setRotationPoint(-2F, -1F, -13F);
      muzzle.setTextureSize(128, 64);
      muzzle.mirror = true;
      setRotation(muzzle, 0F, 0F, 0F);
      neck = new ModelRenderer(this, 32, 24);
      neck.addBox(0F, 0F, 0F, 4, 5, 4);
      neck.setRotationPoint(-2F, 1F, -8F);
      neck.setTextureSize(128, 64);
      neck.mirror = true;
      setRotation(neck, 0.2792527F, 0F, 0F);
      earleft = new ModelRenderer(this, 66, 0);
      earleft.addBox(0F, 0F, 0F, 2, 2, 2);
      earleft.setRotationPoint(-4F, -8F, -6F);
      earleft.setTextureSize(128, 64);
      earleft.mirror = true;
      setRotation(earleft, 0F, 0F, 0F);
      earright = new ModelRenderer(this, 66, 0);
      earright.addBox(0F, 0F, 0F, 2, 2, 2);
      earright.setRotationPoint(2F, -8F, -6F);
      earright.setTextureSize(128, 64);
      earright.mirror = true;
      setRotation(earright, 0F, 0F, 0F);
      tail2 = new ModelRenderer(this, 48, 9);
      tail2.addBox(0F, -1F, 0F, 4, 11, 4);
      tail2.setRotationPoint(-2F, 1F, 11F);
      tail2.setTextureSize(128, 64);
      tail2.mirror = true;
      setRotation(tail2, 0F, 0F, 0F);
      tail1 = new ModelRenderer(this, 48, 0);
      tail1.addBox(0F, 0F, 0F, 2, 2, 7);
      tail1.setRotationPoint(-1F, 5F, 7F);
      tail1.setTextureSize(128, 64);
      tail1.mirror = true;
      setRotation(tail1, 0.7853982F, 0F, 0F);
      rightwing1 = new ModelRenderer(this, 16, 24);
      rightwing1.addBox(0F, 0F, 0F, 2, 6, 6);
      rightwing1.setRotationPoint(4F, 5F, -3F);
      rightwing1.setTextureSize(128, 64);
      rightwing1.mirror = true;
      setRotation(rightwing1, 0F, 0F, 0F);
      rightwing2 = new ModelRenderer(this, 0, 29);
      rightwing2.addBox(0F, 0F, 0F, 2, 2, 2);
      rightwing2.setRotationPoint(4F, 7F, 3F);
      rightwing2.setTextureSize(128, 64);
      rightwing2.mirror = true;
      setRotation(rightwing2, 0F, 0F, 0F);
      leftwing1 = new ModelRenderer(this, 16, 24);
      leftwing1.addBox(0F, 0F, 0F, 2, 6, 6);
      leftwing1.setRotationPoint(-6F, 5F, -3F);
      leftwing1.setTextureSize(128, 64);
      leftwing1.mirror = true;
      setRotation(leftwing1, 0F, 0F, 0F);
      leftwing2 = new ModelRenderer(this, 0, 29);
      leftwing2.addBox(0F, 0F, 0F, 2, 2, 2);
      leftwing2.setRotationPoint(-6F, 7F, 3F);
      leftwing2.setTextureSize(128, 64);
      leftwing2.mirror = true;
      setRotation(leftwing2, 0F, 0F, 0F);
      horn = new ModelRenderer(this, 12, 24);
      horn.addBox(-0.5F, -4F, -0.5F, 1, 4, 1);
      horn.setRotationPoint(0F, -5F, -11.5F);
      horn.setTextureSize(128, 64);
      horn.mirror = true;
      setRotation(horn, 0F, 1.570796F, 0.4833219F);
      head = new ModelRenderer(this, 74, 0);
      head.addBox(0F, 0F, 0F, 8, 8, ;
      head.setRotationPoint(-4F, -6F, -12F);
      head.setTextureSize(128, 64);
      head.mirror = true;
      setRotation(head, 0F, 0F, 0F);
  }
  
  public void render(Entity entity, float f, float f1, float f2, float f3, float f4, float f5)
  {
    super.render(entity, f, f1, f2, f3, f4, f5);
    setRotationAngles(f, f1, f2, f3, f4, f5, entity);
    body.render(f5);
    backlegright.render(f5);
    frontlegleft.render(f5);
    backlegleft.render(f5);
    frontlegright.render(f5);
    muzzle.render(f5);
    neck.render(f5);
    earleft.render(f5);
    earright.render(f5);
    tail2.render(f5);
    tail1.render(f5);
    rightwing1.render(f5);
    rightwing2.render(f5);
    leftwing1.render(f5);
    leftwing2.render(f5);
    horn.render(f5);
    head.render(f5);
  }
  
  private void setRotation(ModelRenderer model, float x, float y, float z)
  {
    model.rotateAngleX = x;
    model.rotateAngleY = y;
    model.rotateAngleZ = z;
  }
  
  public void setRotationAngles(float f, float f1, float f2, float f3, float f4, float f5, Entity entity)
  {

  }
}

 

ModEntity [/font]

package stider.pony.entity;


import stider.pony.pony;
import net.minecraft.entity.EntityEggInfo;
import net.minecraft.entity.EntityList;
import cpw.mods.fml.common.registry.EntityRegistry;


public class ModEntity {
   
   
   public static void init()
   {
      createEntity(EntityPony.class, "Pony", 0xFF0000, 0xFFCC00);      
   }
   


   
    public static void createEntity(Class<EntityPony> entityClass, String entityName, int solidColor, int spotColor) {
        int randomId = EntityRegistry.findGlobalUniqueEntityId();


        EntityRegistry.registerGlobalEntityID(entityClass, entityName, randomId);
        EntityRegistry.registerModEntity(entityClass, entityName, randomId, pony.instance, 32, 1, true);
        EntityList.entityEggs.put(Integer.valueOf(randomId), new EntityEggInfo(randomId, solidColor, spotColor));
        
        
    }
    
} 

 

EntityPony

 package stider.pony.entity;


import net.minecraft.entity.EntityAgeable;
import net.minecraft.entity.SharedMonsterAttributes;
import net.minecraft.entity.ai.EntityAIFollowParent;
import net.minecraft.entity.ai.EntityAILookIdle;
import net.minecraft.entity.ai.EntityAIMate;
import net.minecraft.entity.ai.EntityAIPanic;
import net.minecraft.entity.ai.EntityAISwimming;
import net.minecraft.entity.ai.EntityAITempt;
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.item.ItemStack;
import net.minecraft.world.World;


public class EntityPony extends EntityAnimal
{
    public EntityPony(World par1World)
    {
        super(par1World);
        this.setSize(0.9F, 1.3F);
        this.getNavigator().setAvoidsWater(true);
        this.tasks.addTask(0, new EntityAISwimming(this));
        this.tasks.addTask(1, new EntityAIPanic(this, 2.0D));
        this.tasks.addTask(2, new EntityAIMate(this, 1.0D));
        this.tasks.addTask(3, new EntityAITempt(this, 1.25D, Item.wheat.itemID, false));
        this.tasks.addTask(4, new EntityAIFollowParent(this, 1.25D));
        this.tasks.addTask(5, new EntityAIWander(this, 1.0D));
        this.tasks.addTask(6, new EntityAIWatchClosest(this, EntityPlayer.class, 6.0F));
        this.tasks.addTask(7, new EntityAILookIdle(this));
    }


    /**
     * Returns true if the newer Entity AI code should be run
     */
    public boolean isAIEnabled()
    {
        return true;
    }


    protected void applyEntityAttributes()
    {
        super.applyEntityAttributes();
        this.getEntityAttribute(SharedMonsterAttributes.maxHealth).setAttribute(10.0D);
        this.getEntityAttribute(SharedMonsterAttributes.movementSpeed).setAttribute(0.20000000298023224D);
    }


    /**
     * Returns the item ID for the item the mob drops on death.
     */
    protected int getDropItemId()
    {
        return Item.leather.itemID;
    }


    /**
     * Drop 0-2 items of this living's type. @param par1 - Whether this entity has recently been hit by a player. @param
     * par2 - Level of Looting used to kill this mob.
     */
    protected void dropFewItems(boolean par1, int par2)
    {
        int j = this.rand.nextInt(3) + this.rand.nextInt(1 + par2);
        int k;


        for (k = 0; k < j; ++k)
        {
            this.dropItem(Item.leather.itemID, 1);
        }


        j = this.rand.nextInt(3) + 1 + this.rand.nextInt(1 + par2);


        for (k = 0; k < j; ++k)
        {
            if (this.isBurning())
            {
                this.dropItem(Item.beefCooked.itemID, 1);
            }
            else
            {
                this.dropItem(Item.beefRaw.itemID, 1);
            }
        }
    }


    /**
     * Called when a player interacts with a mob. e.g. gets milk from a cow, gets into the saddle on a pig.
     */
    public boolean interact(EntityPlayer par1EntityPlayer)
    {
        ItemStack itemstack = par1EntityPlayer.inventory.getCurrentItem();


        if (itemstack != null && itemstack.itemID == Item.bucketEmpty.itemID && !par1EntityPlayer.capabilities.isCreativeMode)
        {
            if (itemstack.stackSize-- == 1)
            {
                par1EntityPlayer.inventory.setInventorySlotContents(par1EntityPlayer.inventory.currentItem, new ItemStack(Item.bucketMilk));
            }
            else if (!par1EntityPlayer.inventory.addItemStackToInventory(new ItemStack(Item.bucketMilk)))
            {
                par1EntityPlayer.dropPlayerItem(new ItemStack(Item.bucketMilk.itemID, 1, 0));
            }


            return true;
        }
        else
        {
            return super.interact(par1EntityPlayer);
        }
    }


    /**
     * This function is used when two same-species animals in 'love mode' breed to generate the new baby animal.
     */
    public EntityPony spawnBabyAnimal(EntityAgeable par1EntityAgeable)
    {
        return new EntityPony(this.worldObj);
    }


    public EntityAgeable createChild(EntityAgeable par1EntityAgeable)
    {
        return this.spawnBabyAnimal(par1EntityAgeable);
    }
}

 

RenderPony

package stider.pony.client.render.entity;


import net.minecraft.client.renderer.entity.RenderLiving;
import net.minecraft.entity.Entity;
import net.minecraft.util.ResourceLocation;
import stider.pony.client.model.ModelPony;
import stider.pony.entity.EntityPony;
import stider.pony.lib.Textures;
import cpw.mods.fml.relauncher.Side;
import cpw.mods.fml.relauncher.SideOnly;


@SideOnly(Side.CLIENT)
public class RenderPony extends RenderLiving
{
    private static final ResourceLocation PonyTextures = new ResourceLocation(Textures.MODEL_SHEET_LOCATION + "pony.png");


    public RenderPony(ModelPony par1ModelBase, float par2)
    {
        super(par1ModelBase, par2);
    }


    protected ResourceLocation getPonyTextures(EntityPony par1EntityPony)
    {
        return PonyTextures;
    }


    /**
     * Returns the location of an entity's texture. Doesn't seem to be called unless you call Render.bindEntityTexture.
     */
    protected ResourceLocation getEntityTexture(Entity par1Entity)
    {
        return this.getPonyTextures((EntityPony)par1Entity);
    }
}

 

the clientproxy

package stider.pony.core.proxy;


import stider.pony.client.model.ModelPony;
import stider.pony.client.render.entity.RenderPony;
import stider.pony.entity.EntityPony;
import cpw.mods.fml.client.registry.RenderingRegistry;
import cpw.mods.fml.relauncher.Side;
import cpw.mods.fml.relauncher.SideOnly;




public class ClientProxy extends CommonProxy {
   
    @SideOnly(Side.CLIENT)
    @Override
    public void registerRenderThings() {
       
       RenderingRegistry.registerEntityRenderingHandler(EntityPony.class, new RenderPony(new ModelPony(), 1.5F));
       
       
        
    }
   
}

 

 

 

 

it think this is all the classes that are needed for the mod if not that is where the problem can lay

i realy hope someone can help my becaus i get kinda frustraded by now

thanks already for helping

 

 

(p.s. yea i know its a pony )

 

the github: https://github.com/stiderspace/MLPmobs

 

 

Posted

There's a NPE in your model class. I can't help you since you posted your main class twice. :P

 

oeps i dident notice that so much text in the editor

 

i changed it thanks for the heads up

Posted

 backlegleft.mirror = true;
      backlegleft = new ModelRenderer(this, 32, 0);
      backlegleft.addBox(0F, 0F, 0F, 4, 12, 4);
      

When setting backlegleft.mirro, backlegleft is still null, so you need to put the backlegleft.irror line underneath the declaration.

Don't PM me with questions. They will be ignored! Make a thread on the appropriate board for support.

 

1.12 -> 1.13 primer by williewillus.

 

1.7.10 and older versions of Minecraft are no longer supported due to it's age! Update to the latest version for support.

 

http://www.howoldisminecraft1710.today/

Posted

 backlegleft.mirror = true;
      backlegleft = new ModelRenderer(this, 32, 0);
      backlegleft.addBox(0F, 0F, 0F, 4, 12, 4);
      

When setting backlegleft.mirro, backlegleft is still null, so you need to put the backlegleft.irror line underneath the declaration.

 

???

what is that

Posted

 backlegleft.mirror = true;
      backlegleft = new ModelRenderer(this, 32, 0);
      backlegleft.addBox(0F, 0F, 0F, 4, 12, 4);
      

When setting backlegleft.mirro, backlegleft is still null, so you need to put the backlegleft.irror line underneath the declaration.

 

???

what is that

 

i managed to fix it thanks everyone who helped

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

    • Version 1.19 - Forge 41.0.63 I want to create a wolf entity that I can ride, so far it seems to be working, but the problem is that when I get on the wolf, I can’t control it. I then discovered that the issue is that the server doesn’t detect that I’m riding the wolf, so I’m struggling with synchronization. However, it seems to not be working properly. As I understand it, the server receives the packet but doesn’t register it correctly. I’m a bit new to Java, and I’ll try to provide all the relevant code and prints *The comments and prints are translated by chatgpt since they were originally in Spanish* Thank you very much in advance No player is mounted, or the passenger is not a player. No player is mounted, or the passenger is not a player. No player is mounted, or the passenger is not a player. No player is mounted, or the passenger is not a player. No player is mounted, or the passenger is not a player. MountableWolfEntity package com.vals.valscraft.entity; import com.vals.valscraft.network.MountSyncPacket; import com.vals.valscraft.network.NetworkHandler; import net.minecraft.client.Minecraft; import net.minecraft.network.syncher.EntityDataAccessor; import net.minecraft.network.syncher.EntityDataSerializers; import net.minecraft.network.syncher.SynchedEntityData; import net.minecraft.server.MinecraftServer; import net.minecraft.server.level.ServerPlayer; import net.minecraft.world.entity.EntityType; import net.minecraft.world.entity.Mob; import net.minecraft.world.entity.ai.attributes.AttributeSupplier; import net.minecraft.world.entity.ai.attributes.Attributes; import net.minecraft.world.entity.animal.Wolf; import net.minecraft.world.entity.player.Player; import net.minecraft.world.entity.Entity; import net.minecraft.world.InteractionHand; import net.minecraft.world.InteractionResult; import net.minecraft.world.item.ItemStack; import net.minecraft.world.item.Items; import net.minecraft.world.level.Level; import net.minecraft.world.phys.Vec3; import net.minecraftforge.event.TickEvent; import net.minecraftforge.eventbus.api.SubscribeEvent; import net.minecraftforge.network.PacketDistributor; public class MountableWolfEntity extends Wolf { private boolean hasSaddle; private static final EntityDataAccessor<Byte> DATA_ID_FLAGS = SynchedEntityData.defineId(MountableWolfEntity.class, EntityDataSerializers.BYTE); public MountableWolfEntity(EntityType<? extends Wolf> type, Level level) { super(type, level); this.hasSaddle = false; } @Override protected void defineSynchedData() { super.defineSynchedData(); this.entityData.define(DATA_ID_FLAGS, (byte)0); } public static AttributeSupplier.Builder createAttributes() { return Wolf.createAttributes() .add(Attributes.MAX_HEALTH, 20.0) .add(Attributes.MOVEMENT_SPEED, 0.3); } @Override public InteractionResult mobInteract(Player player, InteractionHand hand) { ItemStack itemstack = player.getItemInHand(hand); if (itemstack.getItem() == Items.SADDLE && !this.hasSaddle()) { if (!player.isCreative()) { itemstack.shrink(1); } this.setSaddle(true); return InteractionResult.SUCCESS; } else if (!level.isClientSide && this.hasSaddle()) { player.startRiding(this); MountSyncPacket packet = new MountSyncPacket(true); // 'true' means the player is mounted NetworkHandler.CHANNEL.sendToServer(packet); // Ensure the server handles the packet return InteractionResult.SUCCESS; } return InteractionResult.PASS; } @Override public void travel(Vec3 travelVector) { if (this.isVehicle() && this.getControllingPassenger() instanceof Player) { System.out.println("The wolf has a passenger."); System.out.println("The passenger is a player."); Player player = (Player) this.getControllingPassenger(); // Ensure the player is the controller this.setYRot(player.getYRot()); this.yRotO = this.getYRot(); this.setXRot(player.getXRot() * 0.5F); this.setRot(this.getYRot(), this.getXRot()); this.yBodyRot = this.getYRot(); this.yHeadRot = this.yBodyRot; float forward = player.zza; float strafe = player.xxa; if (forward <= 0.0F) { forward *= 0.25F; } this.flyingSpeed = this.getSpeed() * 0.1F; this.setSpeed((float) this.getAttributeValue(Attributes.MOVEMENT_SPEED) * 1.5F); this.setDeltaMovement(new Vec3(strafe, travelVector.y, forward).scale(this.getSpeed())); this.calculateEntityAnimation(this, false); } else { // The wolf does not have a passenger or the passenger is not a player System.out.println("No player is mounted, or the passenger is not a player."); super.travel(travelVector); } } public boolean hasSaddle() { return this.hasSaddle; } public void setSaddle(boolean hasSaddle) { this.hasSaddle = hasSaddle; } @Override protected void dropEquipment() { super.dropEquipment(); if (this.hasSaddle()) { this.spawnAtLocation(Items.SADDLE); this.setSaddle(false); } } @SubscribeEvent public static void onServerTick(TickEvent.ServerTickEvent event) { if (event.phase == TickEvent.Phase.START) { MinecraftServer server = net.minecraftforge.server.ServerLifecycleHooks.getCurrentServer(); if (server != null) { for (ServerPlayer player : server.getPlayerList().getPlayers()) { if (player.isPassenger() && player.getVehicle() instanceof MountableWolfEntity) { MountableWolfEntity wolf = (MountableWolfEntity) player.getVehicle(); System.out.println("Tick: " + player.getName().getString() + " is correctly mounted on " + wolf); } } } } } private boolean lastMountedState = false; @Override public void tick() { super.tick(); if (!this.level.isClientSide) { // Only on the server boolean isMounted = this.isVehicle() && this.getControllingPassenger() instanceof Player; // Only print if the state changed if (isMounted != lastMountedState) { if (isMounted) { Player player = (Player) this.getControllingPassenger(); // Verify the passenger is a player System.out.println("Server: Player " + player.getName().getString() + " is now mounted."); } else { System.out.println("Server: The wolf no longer has a passenger."); } lastMountedState = isMounted; } } } @Override public void addPassenger(Entity passenger) { super.addPassenger(passenger); if (passenger instanceof Player) { Player player = (Player) passenger; if (!this.level.isClientSide && player instanceof ServerPlayer) { // Send the packet to the server to indicate the player is mounted NetworkHandler.CHANNEL.send(PacketDistributor.PLAYER.with(() -> (ServerPlayer) player), new MountSyncPacket(true)); } } } @Override public void removePassenger(Entity passenger) { super.removePassenger(passenger); if (passenger instanceof Player) { Player player = (Player) passenger; if (!this.level.isClientSide && player instanceof ServerPlayer) { // Send the packet to the server to indicate the player is no longer mounted NetworkHandler.CHANNEL.send(PacketDistributor.PLAYER.with(() -> (ServerPlayer) player), new MountSyncPacket(false)); } } } @Override public boolean isControlledByLocalInstance() { Entity entity = this.getControllingPassenger(); return entity instanceof Player; } @Override public void positionRider(Entity passenger) { if (this.hasPassenger(passenger)) { double xOffset = Math.cos(Math.toRadians(this.getYRot() + 90)) * 0.4; double zOffset = Math.sin(Math.toRadians(this.getYRot() + 90)) * 0.4; passenger.setPos(this.getX() + xOffset, this.getY() + this.getPassengersRidingOffset() + passenger.getMyRidingOffset(), this.getZ() + zOffset); } } } MountSyncPacket package com.vals.valscraft.network; import com.vals.valscraft.entity.MountableWolfEntity; import net.minecraft.network.FriendlyByteBuf; import net.minecraft.server.level.ServerLevel; import net.minecraft.server.level.ServerPlayer; import net.minecraft.world.entity.Entity; import net.minecraft.world.entity.player.Player; import net.minecraftforge.network.NetworkEvent; import java.util.function.Supplier; public class MountSyncPacket { private final boolean isMounted; public MountSyncPacket(boolean isMounted) { this.isMounted = isMounted; } public void encode(FriendlyByteBuf buffer) { buffer.writeBoolean(isMounted); } public static MountSyncPacket decode(FriendlyByteBuf buffer) { return new MountSyncPacket(buffer.readBoolean()); } public void handle(NetworkEvent.Context context) { context.enqueueWork(() -> { ServerPlayer player = context.getSender(); // Get the player from the context if (player != null) { // Verifies if the player has dismounted if (!isMounted) { Entity vehicle = player.getVehicle(); if (vehicle instanceof MountableWolfEntity wolf) { // Logic to remove the player as a passenger wolf.removePassenger(player); System.out.println("Server: Player " + player.getName().getString() + " is no longer mounted."); } } } }); context.setPacketHandled(true); // Marks the packet as handled } } networkHandler package com.vals.valscraft.network; import com.vals.valscraft.valscraft; import net.minecraft.resources.ResourceLocation; import net.minecraftforge.network.NetworkRegistry; import net.minecraftforge.network.simple.SimpleChannel; import net.minecraftforge.network.NetworkEvent; import java.util.function.Supplier; public class NetworkHandler { private static final String PROTOCOL_VERSION = "1"; public static final SimpleChannel CHANNEL = NetworkRegistry.newSimpleChannel( new ResourceLocation(valscraft.MODID, "main"), () -> PROTOCOL_VERSION, PROTOCOL_VERSION::equals, PROTOCOL_VERSION::equals ); public static void init() { int packetId = 0; // Register the mount synchronization packet CHANNEL.registerMessage( packetId++, MountSyncPacket.class, MountSyncPacket::encode, MountSyncPacket::decode, (msg, context) -> msg.handle(context.get()) // Get the context with context.get() ); } }  
    • Do you use features of inventory profiles next (ipnext) or is there a change without it?
    • Remove rubidium - you are already using embeddium, which is a fork of rubidium
  • Topics

×
×
  • Create New...

Important Information

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