Jump to content

[1.6.2] Solved Mob won't render correct


kmccmk9

Recommended Posts

Hello, I've been trying to add a mob to the game and have been able to get an egg that can spawn my new mob. However, it comes out like the picture below instead of what it should be, a bee. What is wrong with my code? Below I have posted everything I got for you.

 

P3PtNmh.png

 

Main Class:

package kmccmk9.witchcraft;

import java.awt.Color;

import net.minecraft.entity.Entity;
import net.minecraft.entity.EntityEggInfo;
import net.minecraft.entity.EntityList;
import net.minecraft.entity.EnumCreatureType;
import net.minecraft.src.ModLoader;
import net.minecraft.world.biome.BiomeGenBase;

import kmccmk9.witchcraft.CommonProxy;
import cpw.mods.fml.common.Mod;
import cpw.mods.fml.common.SidedProxy;
import cpw.mods.fml.common.Mod.EventHandler;
import cpw.mods.fml.common.Mod.Instance;
import cpw.mods.fml.common.event.FMLInitializationEvent;
import cpw.mods.fml.common.event.FMLPostInitializationEvent;
import cpw.mods.fml.common.event.FMLPreInitializationEvent;
import cpw.mods.fml.common.network.NetworkMod;
import cpw.mods.fml.common.registry.EntityRegistry;
import cpw.mods.fml.common.registry.LanguageRegistry;

@Mod(modid="witchcraft", name="WitchCraft", version="0.0.1")
@NetworkMod(clientSideRequired=true, serverSideRequired=false)

public class WitchCraft {
// The instance of your mod that Forge uses.
    @Instance("WitchCraft")
    public static WitchCraft instance;
    
    // Says where the client and server 'proxy' code is loaded.
    @SidedProxy(clientSide="kmccmk9.witchcraft.client.ClientProxy", serverSide="kmccmk9.witchcraft.CommonProxy")
    public static CommonProxy proxy;
    
    @EventHandler
    public void preInit(FMLPreInitializationEvent event) {
            // Stub Method
    }
    
    @EventHandler
    public void load(FMLInitializationEvent event) {
    	int background = (Color.YELLOW.getRed() << 16) + (Color.YELLOW.getGreen() <<  + Color.YELLOW.getBlue();
    	int foreground = (Color.BLACK.getRed() << 16) + (Color.BLACK.getGreen() <<  + Color.BLACK.getBlue();
    	int id = ModLoader.getUniqueEntityId();
    	EntityRegistry.registerModEntity(EntityBee.class, "Bee", 1, this, 80, 5, true);
    	ModLoader.registerEntityID(EntityBee.class, "Bee",  id, background, foreground);
    	EntityRegistry.addSpawn(EntityBee.class, 7, 1, 4, EnumCreatureType.monster, BiomeGenBase.beach, BiomeGenBase.forest, BiomeGenBase.jungle, BiomeGenBase.plains);
    	LanguageRegistry.instance().addStringLocalization("entity.witchcraft.Bee.name", "Bee");
    	
    	EntityList.IDtoClassMapping.put(id, EntityBee.class);
    	EntityList.entityEggs.put(id, new EntityEggInfo(id, background, foreground));
    	
    }
    
    @EventHandler
    public void postInit(FMLPostInitializationEvent event) {
            // Stub Method
    }
}

 

EntityClass:

package kmccmk9.witchcraft;

import net.minecraft.client.renderer.EntityRenderer;
import net.minecraft.entity.EntityLiving;
import net.minecraft.entity.ai.EntityAIWander;
import net.minecraft.item.Item;
import net.minecraft.world.World;
import net.minecraft.src.*;

public class EntityBee extends EntityLiving {

public EntityBee(World par1World) {
	super(par1World);
	this.getNavigator().setAvoidsWater(true);
	this.setSize(0.5F, 0.5F);
	this.setEntityHealth(15F);
	this.setAIMoveSpeed(3F);
}

protected int getDropItemId()
    {
        return Item.porkRaw.itemID;
    }

public String getTexture() {
	return "textures/bee.png";
}

}

 

ModelClass:

package kmccmk9.witchcraft.client;

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




public class ModelBee extends ModelBase
{
  //fields
    ModelRenderer BeeBody;
    ModelRenderer BeeHead;
    ModelRenderer ant1;
    ModelRenderer ant2;
    ModelRenderer wing2;
    ModelRenderer wing1;
  
  public ModelBee()
  {
//constructor:
ant1 = new ModelRenderer(this, 0, 0);
ant1.mirror = true;
ant1.addBox(2F, 4F, -1F, 1, 4, 1);
ant1.rotateAngleZ = 0.17453292519943295F;

ant2 = new ModelRenderer(this, 41, 5);
ant2.mirror = true;
ant2.addBox(2F, 3F, -1F, 1, 4, 1);
ant2.rotateAngleZ = 6.1086523819801535F;

BeeBody = new ModelRenderer(this, 0, 0);
BeeBody.mirror = true;
BeeBody.addBox(0F, 0F, 0F, 5, 4, ;

BeeHead = new ModelRenderer(this, 19, 2);
BeeHead.mirror = true;
BeeHead.addBox(0F, 0F, 0F, 3, 3, 2);
//BeeHead.setPosition(1F, 1F, -2F);

wing1 = new ModelRenderer(this, 31, 1);
wing1.mirror = true;
wing1.addBox(5F, 1F, 2F, 4, 1, 3);
wing1.rotateAngleZ = 6.126105674500097F;

wing2 = new ModelRenderer(this, 31, 5);
wing2.mirror = true;
wing2.addBox(-4F, 2F, 2F, 4, 1, 3);
wing2.rotateAngleZ = 0.15707963267948966F;
  }
  
  public void render(Entity entity, float f, float f1, float f2, float f3, float f4, float f5)
  {
    	//render:
ant1.render(f5);
ant2.render(f5);
BeeBody.render(f5);
BeeHead.render(f5);
wing1.render(f5);
wing2.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);
  }
}

 

RendererClass:

package kmccmk9.witchcraft;

import kmccmk9.witchcraft.client.ModelBee;
import net.minecraft.client.Minecraft;
import net.minecraft.client.model.ModelBase;
import net.minecraft.client.renderer.EntityRenderer;
import net.minecraft.client.renderer.entity.RenderLiving;
import net.minecraft.entity.Entity;
import net.minecraft.util.ResourceLocation;

public class RendererBee extends RenderLiving {
protected ModelBee model;
private static final ResourceLocation field_110775_a = new ResourceLocation("textures/bee.png");
public RendererBee(ModelBee par1ModelBase, float par2) {
	super(par1ModelBase, par2);
	model = (ModelBee)par1ModelBase;
}
@Override
protected ResourceLocation func_110775_a(Entity entity) {
	// TODO Auto-generated method stub
	return null;
}


}

 

Any help is greatly appreciated!

Link to comment
Share on other sites

private static final ResourceLocation field_110775_a = new ResourceLocation("textures/bee.png");
@Override
protected ResourceLocation func_110775_a(Entity entity) {
	// TODO Auto-generated method stub
	return null;
}

*facepalm*

Why do you think that should work ?

Link to comment
Share on other sites

private static final ResourceLocation field_110775_a = new ResourceLocation("textures/bee.png");
@Override
protected ResourceLocation func_110775_a(Entity entity) {
	// TODO Auto-generated method stub
	return null;
}

*facepalm*

Why do you think that should work ?

 

Ya I had a feeling it may be in that class. But I keep trying to follow different tutorials for different forge versions since no one seems to have one for 1.6.2 as of yet. Okay so what would I need to return then?

Link to comment
Share on other sites

I don't recall Minecraft having a bee texture.  :P

Look for "texture" threads, the proper use of ResourceLocation would be explained.

 

Ok I'll check it out cause the tutorials explained that the way I wrote it, would be the root of the mod folder, then textures and then bee.png.

Link to comment
Share on other sites

#RenderingRegistry

 

Great thanks. I was able to get the resuilt below. Okay, now the model seems to be upside down. The texture problem, I have to figure out still.

 

7IcEWbd.png

 

Is there something I can do with the mirror part of the model code? What I"m shooting for is like the below image.

 

0gzyQIl.png

Link to comment
Share on other sites

The way that resource locations are done is defaulted to the vanilla minecraft assets folder

you need to change it to so it's directed towards yours

 

for instance, with mine it's

    private static final ResourceLocation field_110890_f = new ResourceLocation("jnosh_advzelda", "textures/entity/chu.png");

 

as the folder structure goes

 

"assets" folder > "jnosh_advzelda" folder > "textures" folder > "entity" folder > "chu.png"

assets/jnosh_advzelda/textures/entity/chu

 

you need to do yours in a similar way, but using your own folders (obviously)

Link to comment
Share on other sites

The way that resource locations are done is defaulted to the vanilla minecraft assets folder

you need to change it to so it's directed towards yours

 

for instance, with mine it's

    private static final ResourceLocation field_110890_f = new ResourceLocation("jnosh_advzelda", "textures/entity/chu.png");

 

as the folder structure goes

 

"assets" folder > "jnosh_advzelda" folder > "textures" folder > "entity" folder > "chu.png"

assets/jnosh_advzelda/textures/entity/chu

 

you need to do yours in a similar way, but using your own folders (obviously)

 

So textures are no longer placed within your mod folder?

Link to comment
Share on other sites

no, if you're working in Eclipse, they're placed in forge/mcp/src/minecraft/assets

mine is

forge/mcp/src/minecraft/assets/jnosh_advzelda/textures/entity/chu.png

at least, that's the way that I've seen them all set up since 1.6.1 arrived

 

you might wanna invest some time into looking up how to update from 1.5.2 to 1.6.x if you've still got things set up the old way

Link to comment
Share on other sites

no, if you're working in Eclipse, they're placed in forge/mcp/src/minecraft/assets

mine is

forge/mcp/src/minecraft/assets/jnosh_advzelda/textures/entity/chu.png

at least, that's the way that I've seen them all set up since 1.6.1 arrived

 

you might wanna invest some time into looking up how to update from 1.5.2 to 1.6.x if you've still got things set up the old way

 

Okay thanks. Also, following another mod I explored, it was done like so kmccmk9/witchCraft/assets/minecraft/textures/entities/file

Link to comment
Share on other sites

no, if you're working in Eclipse, they're placed in forge/mcp/src/minecraft/assets

mine is

forge/mcp/src/minecraft/assets/jnosh_advzelda/textures/entity/chu.png

at least, that's the way that I've seen them all set up since 1.6.1 arrived

 

you might wanna invest some time into looking up how to update from 1.5.2 to 1.6.x if you've still got things set up the old way

 

OMG thank you I finally got it! Now do you have any idea what's wrong with my model?

Link to comment
Share on other sites

At a guess I'd say that it's because there isn't really alot in your render file atm, so it might not be connecting the render and entity to the model

 

erm... I'd suggest taking a look at the bat render file

it's probably the closest you're gunna get to a bee in vanilla

 

it could be this

 

    public void func_82443_a(EntityBat par1EntityBat, double par2, double par4, double par6, float par8, float par9)
    {
        int i = ((ModelBat)this.mainModel).getBatSize();

        if (i != this.renderedBatSize)
        {
            this.renderedBatSize = i;
            this.mainModel = new ModelBat();
        }

        super.doRenderLiving(par1EntityBat, par2, par4, par6, par8, par9);
    }

 

so try

 

    public void func_82443_a(EntityBee par1EntityBat, double par2, double par4, double par6, float par8, float par9)
    {
        int i = ((ModelBee)this.mainModel);

        this.mainModel = new ModelBee();

        super.doRenderLiving(par1EntityBat, par2, par4, par6, par8, par9);
    }

 

however, that is just a guess

exploring the render files would be a better option

and there are some 1.6.2 entity tutorials out there that may be a better help than me

Link to comment
Share on other sites

the correct texture calling would be for example ("foldername:textures/mob/bee.png")

 

what this means is that bee.png is located in    ("assets/foldername/textures/mob/bee.png")\

 

for a normal icon texture the calling would be different for example a normal icon texture would be ("foldername:icon")

which means the icon would be in ("assets/foldername/textures/[blocks][items]/icon.png")

 

I hope this helps

if (You.likescoding == false){
      You.goaway;
}

Link to comment
Share on other sites

At a guess I'd say that it's because there isn't really alot in your render file atm, so it might not be connecting the render and entity to the model

 

erm... I'd suggest taking a look at the bat render file

it's probably the closest you're gunna get to a bee in vanilla

 

it could be this

 

    public void func_82443_a(EntityBat par1EntityBat, double par2, double par4, double par6, float par8, float par9)
    {
        int i = ((ModelBat)this.mainModel).getBatSize();

        if (i != this.renderedBatSize)
        {
            this.renderedBatSize = i;
            this.mainModel = new ModelBat();
        }

        super.doRenderLiving(par1EntityBat, par2, par4, par6, par8, par9);
    }

 

so try

 

    public void func_82443_a(EntityBee par1EntityBat, double par2, double par4, double par6, float par8, float par9)
    {
        int i = ((ModelBee)this.mainModel);

        this.mainModel = new ModelBee();

        super.doRenderLiving(par1EntityBat, par2, par4, par6, par8, par9);
    }

 

however, that is just a guess

exploring the render files would be a better option

and there are some 1.6.2 entity tutorials out there that may be a better help than me

 

the correct texture calling would be for example ("foldername:textures/mob/bee.png")

 

what this means is that bee.png is located in    ("assets/foldername/textures/mob/bee.png")\

 

for a normal icon texture the calling would be different for example a normal icon texture would be ("foldername:icon")

which means the icon would be in ("assets/foldername/textures/[blocks][items]/icon.png")

 

I hope this helps

 

Ok well from what I gathered, what's messed up is the beehead. Nothing else. But if you look at my model class you 'll see I had to comment out a setPosition line. I think that is the problem. But setPosition is valid so I had to comment it. Otherwise everything is right, the head is just inside the body.

Link to comment
Share on other sites

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.



  • Recently Browsing

    • No registered users viewing this page.
  • Posts

    • rp.crazyheal.xyz mods  
    • I'm developing a dimension, but it's kinda resource intensive so some times during player teleporting it lags behind making the player phase down into the void, so im trying to implement some kind of pregeneration to force the game loading a small set of chunks in the are the player will teleport to. Some of the things i've tried like using ServerLevel and ServerChunkCache methods like getChunk() dont actually trigger chunk generation if the chunk isn't already on persistent storage (already generated) or placing tickets, but that doesn't work either. Ideally i should be able to check when the task has ended too. I've peeked around some pregen engines, but they're too complex for my current understanding of the system of which I have just a basic understanding (how ServerLevel ,ServerChunkCache  and ChunkMap work) of. Any tips or other classes I should be looking into to understand how to do this correctly?
    • https://mclo.gs/4UC49Ao
    • Way back in the Forge 1.17 days, work started for adding JPMS (Java Platform Module Support) to ModLauncher and ForgeModLoader. This has been used internally by Forge and some libraries for a while now, but mods (those with mods.toml specifically) have not been able to take advantage of it. As of Forge 1.21.1 and 1.21.3, this is now possible!   What is JPMS and what does it mean for modders? JPMS is the Java Platform Module System, introduced in Java 9. It allows you to define modules, which are collections of packages and resources that can be exported or hidden from other modules. This allows for much more fine-tuned control over visibility, cleaner syntax for service declarations and support for sealed types across packages. For example, you might have a mod with a module called `com.example.mod` that exports `com.example.mod.api` and `com.example.mod.impl` to other mods, but hides `com.example.mod.internal` from them. This would allow you to have a clean API for other mods to use, while keeping your internal implementation details hidden from IDE hints, helping prevent accidental usage of internals that might break without prior notice. This is particularly useful if you'd like to use public records with module-private constructors or partially module-private record components, as you can create a sealed interface that only your record implements, having the interface be exported and the record hidden. It's also nice for declaring and using services, as you'll get compile-time errors from the Java compiler for typos and the like, rather than deferring to runtime errors. In more advanced cases, you can also have public methods that are only accessible to specific other modules -- handy if you want internal interactions between multiple of your own mods.   How do I bypass it? We understand there may be drama in implementing a system that prevents mods from accessing each other's internals when necessary (like when a mod is abandoned or you need to fix a compat issue) -- after all, we are already modding a game that doesn't have explicit support for Java mods yet. We have already thought of this and are offering APIs from day one to selectively bypass module restrictions. Let me be clear: Forge mods are not required to use JPMS. If you don't want to use it, you don't have to. The default behaviour is to have fully open, fully exported automatic modules. In Java, you can use the `Add-Opens` and `Add-Exports` manifest attributes to selectively bypass module restrictions of other mods at launch time, and we've added explicit support for these when loading your Forge mods. At compile-time, you can use existing solutions such as the extra-java-module-info Gradle plugin to deal with non-modular dependencies and add extra opens and exports to other modules. Here's an example on how to make the internal package `com.example.examplemod.internal` open to your mod in your build.gradle: tasks.named('jar', Jar) { manifest { attributes([ 'Add-Opens' : 'com.example.examplemod/com.example.examplemod.internal' 'Specification-Title' : mod_id, 'Specification-Vendor' : mod_authors // (...) ]) } } With the above in your mod's jar manifest, you can now reflectively access the classes inside that internal package. Multiple entries are separated with a space, as per Java's official spec. You can also use Add-Exports to directly call without reflection, however you'd need to use the Gradle plugin mentioned earlier to be able to compile. The syntax for Add-Exports is the same as Add-Opens, and instructions for the compile-time step with the Gradle plugin are detailed later in this post. Remember to prefer the opens and exports keywords inside module-info.java for sources you control. The Add-Opens/Add-Exports attributes are only intended for forcing open other mods.   What else is new with module support? Previously, the runtime module name was always forced to the first mod ID in your `mods.toml` file and all packages were forced fully open and exported. Module names are now distinguished from mod IDs, meaning the module name in your module-info.java can be different from the mod ID in your `mods.toml`. This allows you to have a more descriptive module name that doesn't have to be the same as your mod ID, however we strongly recommend including your mod ID as part of your module name to aid troubleshooting. The `Automatic-Module-Name` manifest attribute is now also honoured, allowing you to specify a module name for your mod without needing to create a `module-info.java` file. This is particularly useful for mods that don't care about JPMS features but want to have a more descriptive module name and easier integration with other mods that do use JPMS.   How do I use it? The first step is to create a `module-info.java` file in your mod's source directory. This file should be in the same package as your main mod class, and should look something like this: open module com.example.examplemod { requires net.minecraftforge.eventbus; requires net.minecraftforge.fmlcore; requires net.minecraftforge.forge; requires net.minecraftforge.javafmlmod; requires net.minecraftforge.mergetool.api; requires org.slf4j; requires logging; } For now, we're leaving the whole module open to reflection, which is a good starting point. When we know we want to close something off, we can remove the open modifier from the module and open or export individual packages instead. Remember that you need to be open to Forge (module name net.minecraftforge.forge), otherwise it can't call your mod's constructor. Next is fixing modules in Gradle. While Forge and Java support modules properly, Gradle does not put automatic modules on the module path by default, meaning that the logging module (from com.mojang:logging) is not found. To fix this, add the Gradle plugin and add a compile-time module definition for that Mojang library: plugins { // (...) id 'org.gradlex.extra-java-module-info' version "1.9" } // (...) extraJavaModuleInfo { failOnMissingModuleInfo = false automaticModule("com.mojang:logging", "logging") } The automatic module override specified in your build.gradle should match the runtime one to avoid errors. You can do the same for any library or mod dependency that is missing either a module-info or explicit Automatic-Module-Name, however be aware that you may need to update your mod once said library adds one. That's all you need to get started with module support in your mods. You can learn more about modules and how to use them at dev.java.
    • Faire la mise à jour grâce à ce lien m'a aider personnellement, merci à @Paint_Ninja. https://www.amd.com/en/support 
  • Topics

×
×
  • Create New...

Important Information

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