Jump to content

Recommended Posts

Posted

I created a custom model and texture for a mob, and everything works fine, except for ingame, the mob is just purple and black checkerboard patterns. Here are the classes I used:

 

ClientProxy.java (proxy class is registered in main class already)

 

 

package bloopers.novelties.proxy;

 

import bloopers.novelties.entity.EntityWraithMob;

import bloopers.novelties.entity.RenderWraithMob;

import bloopers.novelties.entity.Wraith;

import bloopers.novelties.init.NoveltiesBlocks;

import bloopers.novelties.init.NoveltiesItems;

import net.minecraft.client.Minecraft;

import net.minecraftforge.fml.client.registry.RenderingRegistry;

 

public class ClientProxy extends CommonProxy {

 

public void registerRenders() {

 

RenderingRegistry.registerEntityRenderingHandler(EntityWraithMob.class, new RenderWraithMob(Minecraft.getMinecraft().getRenderManager(), new Wraith(), 0));

 

 

NoveltiesBlocks.registerRenders();

NoveltiesItems.registerRenders();

}

}

 

 

 

EntityWraithMob.java (ai class)

 

 

package bloopers.novelties.entity;

 

import net.minecraft.entity.EntityAgeable;

import net.minecraft.entity.EntityCreature;

import net.minecraft.entity.EntityFlying;

import net.minecraft.entity.SharedMonsterAttributes;

import net.minecraft.entity.ai.EntityAIAttackMelee;

import net.minecraft.entity.ai.EntityAINearestAttackableTarget;

import net.minecraft.entity.ai.EntityAIPanic;

import net.minecraft.entity.ai.EntityAIWander;

import net.minecraft.entity.passive.EntityAnimal;

import net.minecraft.entity.player.EntityPlayer;

import net.minecraft.world.World;

 

public class EntityWraithMob extends EntityCreature {

 

public EntityWraithMob(World worldIn) {

super(worldIn);

this.setSize(0.7F, 0.4F);

this.tasks.addTask(0, new EntityAIWander(this, 0.5D));

        this.tasks.addTask(1, new EntityAIPanic(this, 1.0D));

}

 

public boolean isAIEnabled() {

return true;

}

 

protected void applyEntityAttributes() {

super.applyEntityAttributes();

this.getEntityAttribute(SharedMonsterAttributes.MAX_HEALTH).setBaseValue(16.0D);

this.getEntityAttribute(SharedMonsterAttributes.MOVEMENT_SPEED).setBaseValue(0.6D);

}

 

}

 

 

 

 

Wraith.java(model class)

 

 

// Date: 5/17/2016 1:24:45 PM

// Template version 1.1

// Java generated by Techne

// Keep in mind that you still need to fill in some blanks

// - ZeuX

 

 

 

 

 

 

package bloopers.novelties.entity;

 

import net.minecraft.client.model.ModelBase;

import net.minecraft.client.model.ModelRenderer;

import net.minecraft.entity.Entity;

 

public class Wraith extends ModelBase

{

  //fields

    ModelRenderer head;

    ModelRenderer body;

    ModelRenderer rightarm;

    ModelRenderer leftarm;

    ModelRenderer dot;

 

  public Wraith()

  {

    textureWidth = 64;

    textureHeight = 64;

   

      head = new ModelRenderer(this, 0, 0);

      head.addBox(-4F, -8F, -4F, 11, 11, 11);

      head.setRotationPoint(-1F, 0F, 0F);

      head.setTextureSize(64, 64);

      head.mirror = true;

      setRotation(head, 0F, 0F, 0F);

      body = new ModelRenderer(this, 1, 27);

      body.addBox(-4F, 0F, -2F, 9, 13, 6);

      body.setRotationPoint(0F, 2F, 0F);

      body.setTextureSize(64, 64);

      body.mirror = true;

      setRotation(body, 0.5948578F, 0F, 0F);

      rightarm = new ModelRenderer(this, 40, 46);

      rightarm.addBox(-3F, -2F, -2F, 5, 12, 5);

      rightarm.setRotationPoint(-6F, 3F, 0F);

      rightarm.setTextureSize(64, 64);

      rightarm.mirror = true;

      setRotation(rightarm, -1.301248F, 0F, 0F);

      leftarm = new ModelRenderer(this, 40, 46);

      leftarm.addBox(-1F, -2F, -2F, 5, 12, 5);

      leftarm.setRotationPoint(6F, 3F, 0F);

      leftarm.setTextureSize(64, 64);

      leftarm.mirror = true;

      setRotation(leftarm, -1.301248F, 0F, 0F);

      dot = new ModelRenderer(this, 1, 52);

      dot.addBox(0F, 0F, 0F, 8, 10, 1);

      dot.setRotationPoint(-3.5F, -7F, 0F);

      dot.setTextureSize(64, 64);

      dot.mirror = true;

      setRotation(dot, 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);

    head.render(f5);

    body.render(f5);

    rightarm.render(f5);

    leftarm.render(f5);

    dot.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)

  {

    super.setRotationAngles(f, f1, f2, f3, f4, f5, entity);

  }

 

}

 

 

 

 

RenderWraithMob.java(render class - yes, the directory for the texture is correct.)

 

 

package bloopers.novelties.entity;

 

import bloopers.novelties.Reference;

import net.minecraft.client.model.ModelBase;

import net.minecraft.client.renderer.entity.RenderLiving;

import net.minecraft.client.renderer.entity.RenderManager;

import net.minecraft.entity.Entity;

import net.minecraft.util.ResourceLocation;

 

public class RenderWraithMob extends RenderLiving {

 

private static final ResourceLocation WraithTextures = new ResourceLocation("novelties:textures/entity/wraith/Wraith.png");

 

public RenderWraithMob(RenderManager rendermanagerIn, ModelBase modelbaseIn, float shadowsizeIn) {

super(rendermanagerIn, modelbaseIn, shadowsizeIn);

}

 

protected ResourceLocation getEntityTexture(EntityWraithMob entity) {

return WraithTextures;

}

 

protected ResourceLocation getEntityTexture(Entity entity) {

return this.getEntityTexture((EntityWraithMob)entity);

}

 

}

 

 

 

 

 

EntityCreate.java (my initialization thing for entity)

 

 

package bloopers.novelties.entity;

 

import bloopers.novelties.NoveltiesMod;

import net.minecraft.entity.EntityList;

import net.minecraft.entity.EnumCreatureType;

import net.minecraft.init.Biomes;

import net.minecraftforge.fml.common.registry.EntityRegistry;

 

public class EntityCreate {

 

public static void mainRegistry() {

registerEntity();

}

 

public static void registerEntity() {

 

createEntity(EntityWraithMob.class, "Wraith");

}

 

public static void createEntity(Class entityClass, String entityName) {

int randomId = EntityRegistry.findGlobalUniqueEntityId();

EntityRegistry.registerGlobalEntityID(entityClass, entityName, randomId);

EntityRegistry.registerModEntity(entityClass, entityName, randomId, NoveltiesMod.modInstance, 64, 1, true);

EntityRegistry.addSpawn(entityClass, 2, 0, 1, EnumCreatureType.MONSTER, Biomes.roofedForest);

 

}

 

 

}

 

 

 

 

 

 

 

Posted

What should I use instead?

 

Update as in update my MDK?

 

Found my texture problem - I'm just an idiot.

First two questions I still need help with

 

Posted

What should I use instead?

Nothing. Just
registerModEntity

.

Update as in update my MDK?

No, update as in change your code to use the new version.

 

When removing the two lines saying "registerGlobalEntityID" and "findGlobalUniqueEntityIdD" how am I supposed to set the Entity ID now? When loading up the game the entity simply doesn't exist anymore - This is my EntityCreate class now:

 

 

 

 

package bloopers.novelties.entity;

 

import bloopers.novelties.NoveltiesMod;

import net.minecraft.entity.EntityList;

import net.minecraft.entity.EnumCreatureType;

import net.minecraft.init.Biomes;

import net.minecraftforge.fml.common.registry.EntityRegistry;

 

public class EntityCreate {

 

public static void mainRegistry() {

registerEntity();

}

 

public static void registerEntity() {

 

createEntity(EntityWraithMob.class, "Wraith");

}

 

public static void createEntity(Class entityClass, String entityName) {

EntityRegistry.registerModEntity(entityClass, entityName, 1, NoveltiesMod.modInstance, 64, 1, true);

EntityRegistry.addSpawn(entityClass, 2, 0, 1, EnumCreatureType.MONSTER, Biomes.roofedForest);

 

}

 

 

}

 

 

 

 

Posted

When removing the two lines saying "registerGlobalEntityID" and "findGlobalUniqueEntityIdD" how am I supposed to set the Entity ID now?
IDs for
registerModEntity

are local to your mod. Start at 0 and increment for every new entity.

When loading up the game the entity simply doesn't exist anymore
What exactly do you mean by "it doesn't exist anymore"?

 

The mob doesn't show up in /summon (i never created a spawn egg for it in the first place) and all of them that existed in the world before are now gone.

Posted

Well, the mod has a different internal ID now since you were using the deprecated methods before.

The new ID has your ModID prefixed.

Oh! Thanks a ton.

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 tried do download the essential mod to my mod pack but i didnt work. I paly on 1.21 and it should work. I use neoforge for my modding. The weird things is my friend somehow added the mod to his modpack and many others that I somehow can´t. Is there anything i can do? 
    • Thanks, I've now installed a slightly newer version and the server is at least starting up now.
    • i have the same issue. Found 1 Create mod class dependency(ies) in createdeco-1.3.3-1.19.2.jar, which are missing from the current create-1.19.2-0.5.1.i.jar Found 11 Create mod class dependency(ies) in createaddition-fabric+1.19.2-20230723a.jar, which are missing from the current create-1.19.2-0.5.1.i.jar Detailed walkthrough of mods which rely on missing Create mod classes: Mod: createaddition-fabric+1.19.2-20230723a.jar Missing classes of create: com/simibubi/create/compat/jei/category/sequencedAssembly/JeiSequencedAssemblySubCategory com/simibubi/create/compat/recipeViewerCommon/SequencedAssemblySubCategoryType com/simibubi/create/compat/rei/CreateREI com/simibubi/create/compat/rei/EmptyBackground com/simibubi/create/compat/rei/ItemIcon com/simibubi/create/compat/rei/category/CreateRecipeCategory com/simibubi/create/compat/rei/category/WidgetUtil com/simibubi/create/compat/rei/category/animations/AnimatedBlazeBurner com/simibubi/create/compat/rei/category/animations/AnimatedKinetics com/simibubi/create/compat/rei/category/sequencedAssembly/ReiSequencedAssemblySubCategory com/simibubi/create/compat/rei/display/CreateDisplay Mod: createdeco-1.3.3-1.19.2.jar Missing classes of create: com/simibubi/create/content/kinetics/fan/SplashingRecipe
    • The crash points to moonlight lib - try other builds or make a test without this mod and the mods requiring it
    • Do you have shaders enabled? There is an issue with the mod simpleclouds - remove this mod or disable shaders, if enabled  
  • Topics

  • Who's Online (See full list)

    • There are no registered users currently online
×
×
  • Create New...

Important Information

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