That's pretty much it. Blocks and Items, however, have changed a lot as far as rendering goes. Best look up a tutorial devoted to that topic if you have questions.
public class MEntity {
public static void mainRegistry(){
}
public static void registerEntity(){
createEntity(EntityKunai.class, "Kunai", 0x008521, 0x80FF0800);
}
public static void createEntity(Class entityClass, String entityName, int solidColour, int spotColour){
int randomId = EntityRegistry.findGlobalUniqueEntityId();
int modEntityID = 0;
EntityRegistry.registerGlobalEntityID(entityClass, entityName, randomId);
EntityRegistry.registerModEntity(EntityKunai.class, "Kunai", ++modEntityID, MainRegistry.modInstance, 64, 10, true);
createEgg(randomId, solidColour, spotColour);
}
private static void createEgg(int randomId, int solidColour, int spotColour){
EntityList.entityEggs.put(Integer.valueOf(randomId), new EntityList.EntityEggInfo(randomId, solidColour, spotColour));
}
public class MEntity {
public static void mainRegistry(){
}
public static void registerEntity(){
createEntity(EntityKunai.class, "Kunai", 0x008521, 0x80FF0800);
}
public static void createEntity(Class entityClass, String entityName, int solidColour, int spotColour){
int randomId = EntityRegistry.findGlobalUniqueEntityId();
int modEntityID = 0;
EntityRegistry.registerGlobalEntityID(entityClass, entityName, randomId);
EntityRegistry.registerModEntity(EntityKunai.class, "Kunai", ++modEntityID, MainRegistry.modInstance, 64, 10, true);
createEgg(randomId, solidColour, spotColour);
}
private static void createEgg(int randomId, int solidColour, int spotColour){
EntityList.entityEggs.put(Integer.valueOf(randomId), new EntityList.EntityEggInfo(randomId, solidColour, spotColour));
}
}
Oh my, that's a mess. Not to mention that is NOT the code that spawns the entity - that's just the registration.
Several things:
1. ONLY use EntityRegistry.registerModEntity - get rid of everything to do with global entity ID (that's for vanilla only)
2. Forge for 1.8 has some methods that allow you to add eggs for your entity, if you want
3. Why the heck are you adding an egg for a throwable entity?! That makes no sense.
Code to spawn your entity would look something like this:
if (!world.isRemote) {
world.spawnEntityInWorld(new EntityKunai(world, player)); // just an example
}
public class Kunai extends Item{
public ItemStack onItemRightClick(ItemStack itemstack, World world, EntityPlayer player){
if(!player.capabilities.isCreativeMode){
--itemstack.stackSize;
}
world.playSoundAtEntity(player, "random.bow", 0.7f, 0.8f);
... you do realize that when isRemote returns true, that it is only on the client side, right? You should NEVER spawn an entity on the client side - server side only. See code in my last reply.
Ok now I'm confused I told you I showed the wrong thing and your telling me about when the isRemote returns true then it won't work?
I'm telling you that your current code, the last stuff you showed me, is spawning the entity on the CLIENT, which is not what you want to do. Put a '!' in your if statement and you should be fine.
The Meaning of Life, the Universe, and Everything.
Join Date:
8/5/2015
Posts:
42
Member Details
Now it does damage so thank you for your help but do you know how to stop it from crashing cause when I try shooting it from a certain blocks away it crashes lol
Hmm, I have a wand that can shoot spells, but when I try to change the texture of the thrown spell entity in the getEntityTexture() method it just shows up as a purple square instead of my custom texture, do you know how to fix this?
Here's my code:
package com.misterbander.bandermod.render;
import org.lwjgl.opengl.GL11;
import org.lwjgl.opengl.GL12;
import cpw.mods.fml.relauncher.Side;
import cpw.mods.fml.relauncher.SideOnly;
import net.minecraft.client.renderer.Tessellator;
import net.minecraft.client.renderer.entity.Render;
import net.minecraft.client.renderer.texture.TextureMap;
import net.minecraft.entity.Entity;
import net.minecraft.entity.projectile.EntityPotion;
import net.minecraft.item.Item;
import net.minecraft.item.ItemPotion;
import net.minecraft.potion.PotionHelper;
import net.minecraft.util.IIcon;
import net.minecraft.util.ResourceLocation;
@SideOnly(Side.CLIENT)
public class RenderBanderSpell extends Render
{
private Item field_94151_a;
private int field_94150_f;
private static final String __OBFID ="CL_00001008";
private static final ResourceLocation textureLocation = new ResourceLocation("bandermod:textures/entity/entitybanderspell.png");
public RenderBanderSpell(Item p_i1259_1_, int p_i1259_2_)
{
this.field_94151_a = p_i1259_1_;
this.field_94150_f = p_i1259_2_;
}
public RenderBanderSpell(Item p_i1260_1_)
{
this(p_i1260_1_, 0);
}
/**
* Actually renders the given argument. This is a synthetic bridge method, always casting down its argument and then
* handing it off to a worker function which does the actual work. In all probability, the class Render is generic
* (Render<T extends Entity) and this method has signature public void func_76986_a(T entity, double d, double d1,
* double d2, float f, float f1). But JAD is pre 1.5 so doesn't do that.
*/
@Override
public void doRender(Entity entity, double x, double y, double z, float yaw, float partialTick)
{
IIcon iicon = this.field_94151_a.getIconFromDamage(this.field_94150_f);
GL11.glPushMatrix();
GL11.glTranslatef((float)x, (float)y, (float)z);
GL11.glEnable(GL12.GL_RESCALE_NORMAL);
GL11.glScalef(0.5F, 0.5F, 0.5F);
this.bindEntityTexture(entity);
Tessellator tessellator = Tessellator.instance;
this.func_77026_a(tessellator, iicon);
GL11.glDisable(GL12.GL_RESCALE_NORMAL);
GL11.glPopMatrix();
}
/**
* Returns the location of an entity's texture. Doesn't seem to be called unless you call Render.bindEntityTexture.
*/
@Override
protected ResourceLocation getEntityTexture(Entity entity)
{
return textureLocation;
}
private void func_77026_a(Tessellator p_77026_1_, IIcon p_77026_2_)
{
float f = p_77026_2_.getMinU();
float f1 = p_77026_2_.getMaxU();
float f2 = p_77026_2_.getMinV();
float f3 = p_77026_2_.getMaxV();
float f4 = 1.0F;
float f5 = 0.5F;
float f6 = 0.25F;
GL11.glRotatef(180.0F - this.renderManager.playerViewY, 0.0F, 1.0F, 0.0F);
GL11.glRotatef(-this.renderManager.playerViewX, 1.0F, 0.0F, 0.0F);
p_77026_1_.startDrawingQuads();
p_77026_1_.setNormal(0.0F, 1.0F, 0.0F);
p_77026_1_.addVertexWithUV((double)(0.0F - f5), (double)(0.0F - f6), 0.0D, (double)f, (double)f3);
p_77026_1_.addVertexWithUV((double)(f4 - f5), (double)(0.0F - f6), 0.0D, (double)f1, (double)f3);
p_77026_1_.addVertexWithUV((double)(f4 - f5), (double)(f4 - f6), 0.0D, (double)f1, (double)f2);
p_77026_1_.addVertexWithUV((double)(0.0F - f5), (double)(f4 - f6), 0.0D, (double)f, (double)f2);
p_77026_1_.draw();
}
}
Hmm, I have a wand that can shoot spells, but when I try to change the texture of the thrown spell entity in the getEntityTexture() method it just shows up as a purple square instead of my custom texture, do you know how to fix this?
1. You just copied RenderSnowball... don't do that unless you are actually rendering the projectile using an Item as the base, and then you may as well just use the actual RenderSnowball class instead of making your own.
2. RenderSnowball renders an Item icon; as such, it must use the entire Item icon texture sheet, which it then uses the Item#getIconFromDamage to find the correct texture to draw out of all those stitched together on the sheet. If you change the texture location to something else, the Item will be unable to find its icon.
3. If you have a texture that you just want to render without an Item / Icon, you can do so using the Tessellator. For a normal 16x16 texture, the following should work pretty well (it's basically identical to the RenderSnowball Icon rendering, but hard-coding the vertex parameters since there is no Icon to get the values from):
// do any GL transformations you want to do first, e.g. scale, rotate, translate, etc.
bindTexture(texture);
Tessellator tessellator = Tessellator.instance;
tessellator.startDrawingQuads();
tessellator.setNormal(0.0F, 1.0F, 0.0F);
tessellator.addVertexWithUV(-0.5D, -0.25D, 0.0D, 0, 1);
tessellator.addVertexWithUV(0.5D, -0.25D, 0.0D, 1, 1);
tessellator.addVertexWithUV(0.5D, 0.75D, 0.0D, 1, 0);
tessellator.addVertexWithUV(-0.5D, 0.75D, 0.0D, 0, 0);
tessellator.draw();
// pop the matrix if you pushed it earlier
1. You just copied RenderSnowball... don't do that unless you are actually rendering the projectile using an Item as the base, and then you may as well just use the actual RenderSnowball class instead of making your own.
2. RenderSnowball renders an Item icon; as such, it must use the entire Item icon texture sheet, which it then uses the Item#getIconFromDamage to find the correct texture to draw out of all those stitched together on the sheet. If you change the texture location to something else, the Item will be unable to find its icon.
3. If you have a texture that you just want to render without an Item / Icon, you can do so using the Tessellator. For a normal 16x16 texture, the following should work pretty well (it's basically identical to the RenderSnowball Icon rendering, but hard-coding the vertex parameters since there is no Icon to get the values from):
// do any GL transformations you want to do first, e.g. scale, rotate, translate, etc.
bindTexture(texture);
Tessellator tessellator = Tessellator.instance;
tessellator.startDrawingQuads();
tessellator.setNormal(0.0F, 1.0F, 0.0F);
tessellator.addVertexWithUV(-0.5D, -0.25D, 0.0D, 0, 1);
tessellator.addVertexWithUV(0.5D, -0.25D, 0.0D, 1, 1);
tessellator.addVertexWithUV(0.5D, 0.75D, 0.0D, 1, 0);
tessellator.addVertexWithUV(-0.5D, 0.75D, 0.0D, 0, 0);
tessellator.draw();
// pop the matrix if you pushed it earlier
Thanks for your help and information! I got it working now.
I'm just using RenderSnowball, so I honestly don't know what the problem is. Btw, some of the ninja star stuff was commented out when i pastebinned this, so ignore that; it was just for my mod's update without ninja stars included.
I'm just using RenderSnowball, so I honestly don't know what the problem is.
~snip~
upon right clicking with the Ninja Star, there is a client crash.
I have no idea why this is happening!
RenderingRegistry.registerEntityRenderingHandler(EntityNinjaStar.class,
new RenderSnowball(Minecraft.getMinecraft().getRenderManager(),
NinjaModItems.ninjaStar,
null)); // you're crashing? you don't say...
What do you expect to happen when you pass NULL to the renderer's constructor?!?! O.o
The 3rd parameter needs to be a RenderItem instance, which you can retrieve from Minecraft.getMinecraft().getRenderItem().
@SideOnly(Side.CLIENT)
public class RenderFireBall extends Render
{
// ResourceLocations are typically static and final, but that is not an absolute requirement
private static final ResourceLocation texture = new ResourceLocation("yourmodid", "textures/entity/yourtexture.png");
// if you want a model, be sure to add it here:
private ModelBase model;
public RenderFireBall() {
// we could have initialized it above, but here is fine as well:
model = new ModelCustomEntity();
}
@Override
protected ResourceLocation getEntityTexture(Entity entity) {
// this method should return your texture, which may be different based
// on certain characteristics of your custom entity; if that is the case,
// you may want to make a second method that takes your class:
return getCustomTexture((EntityFireball) entity);
}
private ResourceLocation getCustomTexture(EntityFireball entity) {
// now you have access to your custom entity fields and methods, if any,
// and can base the texture to return upon those
return texture;
}
// in whatever render method you are using; this one is from Render class:
@Override
public void doRender(Entity entity, double x, double y, double z, float yaw, float partialTick) {
// again, if you need some information from your custom entity class, you can cast to your
// custom class, either passing off to another method, or just doing it here
// in this example, it is not necessary
// if you are going to do any openGL matrix transformations, be sure to always Push and Pop
GL11.glPushMatrix();
// bind your texture:
bindTexture(texture);
// do whatever transformations you need, then render
// typically you will at least want to translate for x/y/z position:
GL11.glTranslated(x, y, z);
// if you are using a model, you can do so like this:
model.render(entity, 0.0F, 0.0F, 0.0F, 0.0F, 0.0F, 0.0625F);
// note all the values are 0 except the final argument, which is scale
// vanilla Minecraft almost excusively uses 0.0625F, but you can change it to whatever works
It's not the Model class, it's the Render class: in 1.8, the constructor for a Render class expects a RenderManager instance, which you can get from Minecraft.getMinecraft().getRenderManager().
Rollback Post to RevisionRollBack
To post a comment, please login or register a new account.
-
View User Profile
-
View Posts
-
Send Message
Curse PremiumAs far as entity rendering? Not really.
For RenderSnowball, you will need two additional parameters when registering it: That's pretty much it. Blocks and Items, however, have changed a lot as far as rendering goes. Best look up a tutorial devoted to that topic if you have questions.
For some reason it doesn't work for me here is the code cause it won't do the damage
package com.ninjapiggaming.entity;
import net.minecraft.entity.EntityLivingBase;
import net.minecraft.entity.projectile.EntityThrowable;
import net.minecraft.util.DamageSource;
import net.minecraft.util.MovingObjectPosition;
import net.minecraft.world.World;
public class EntityKunai extends EntityThrowable {
public EntityKunai(World world) {
super(world);
}
public EntityKunai(World world, EntityLivingBase entity) {
super(world, entity);
}
public EntityKunai(World world, double x, double y, double z) {
super(world, x, y, z);
}
@Override
protected void onImpact(MovingObjectPosition mop) {
if (mop.entityHit != null) {
float kunaiDamage = 2;
mop.entityHit.attackEntityFrom(DamageSource.causeThrownDamage(this, this.getThrower()), kunaiDamage);
}
for (int l = 0; l < 4; ++l) {
this.worldObj.spawnParticle("crit", this.posX, this.posY, this.posZ, 0.0D, 0.0D, 0.0D);
}
if (!worldObj.isRemote) {
setDead();
}
}
}
-
View User Profile
-
View Posts
-
Send Message
Curse PremiumThat's just your entity code (which looks fine, btw) - how about the code that spawns the entity?
Here is the code that spawns the entity
package com.ninjapiggaming.entity;
import net.minecraft.entity.EntityList;
import com.ninjapiggaming.Main.MainRegistry;
import cpw.mods.fml.common.registry.EntityRegistry;
public class MEntity {
public static void mainRegistry(){
}
public static void registerEntity(){
createEntity(EntityKunai.class, "Kunai", 0x008521, 0x80FF0800);
}
public static void createEntity(Class entityClass, String entityName, int solidColour, int spotColour){
int randomId = EntityRegistry.findGlobalUniqueEntityId();
int modEntityID = 0;
EntityRegistry.registerGlobalEntityID(entityClass, entityName, randomId);
EntityRegistry.registerModEntity(EntityKunai.class, "Kunai", ++modEntityID, MainRegistry.modInstance, 64, 10, true);
createEgg(randomId, solidColour, spotColour);
}
private static void createEgg(int randomId, int solidColour, int spotColour){
EntityList.entityEggs.put(Integer.valueOf(randomId), new EntityList.EntityEggInfo(randomId, solidColour, spotColour));
}
}
-
View User Profile
-
View Posts
-
Send Message
Curse PremiumOh my, that's a mess. Not to mention that is NOT the code that spawns the entity - that's just the registration.
Several things:
1. ONLY use EntityRegistry.registerModEntity - get rid of everything to do with global entity ID (that's for vanilla only)
2. Forge for 1.8 has some methods that allow you to add eggs for your entity, if you want
3. Why the heck are you adding an egg for a throwable entity?! That makes no sense.
Code to spawn your entity would look something like this:
if (!world.isRemote) {world.spawnEntityInWorld(new EntityKunai(world, player)); // just an example
}
Sorry I put in the wrong code on accident this is the code I meant to put in
package com.ninjapiggaming.item;
import com.ninjapiggaming.entity.EntityKunai;
import net.minecraft.entity.player.EntityPlayer;
import net.minecraft.item.Item;
import net.minecraft.item.ItemStack;
import net.minecraft.world.World;
public class Kunai extends Item{
public ItemStack onItemRightClick(ItemStack itemstack, World world, EntityPlayer player){
if(!player.capabilities.isCreativeMode){
--itemstack.stackSize;
}
world.playSoundAtEntity(player, "random.bow", 0.7f, 0.8f);
if(world.isRemote){
world.spawnEntityInWorld(new EntityKunai (world, player));
}
return itemstack;
}
}
-
View User Profile
-
View Posts
-
Send Message
Curse Premium... you do realize that when isRemote returns true, that it is only on the client side, right? You should NEVER spawn an entity on the client side - server side only. See code in my last reply.
Ok now I'm confused I told you I showed the wrong thing and your telling me about when the isRemote returns true then it won't work?
-
View User Profile
-
View Posts
-
Send Message
Curse PremiumI'm telling you that your current code, the last stuff you showed me, is spawning the entity on the CLIENT, which is not what you want to do. Put a '!' in your if statement and you should be fine.
Now it does damage so thank you for your help but do you know how to stop it from crashing cause when I try shooting it from a certain blocks away it crashes lol
Nvm I fixed it thanks!
Hmm, I have a wand that can shoot spells, but when I try to change the texture of the thrown spell entity in the getEntityTexture() method it just shows up as a purple square instead of my custom texture, do you know how to fix this?
Here's my code:
package com.misterbander.bandermod.render; import org.lwjgl.opengl.GL11; import org.lwjgl.opengl.GL12; import cpw.mods.fml.relauncher.Side; import cpw.mods.fml.relauncher.SideOnly; import net.minecraft.client.renderer.Tessellator; import net.minecraft.client.renderer.entity.Render; import net.minecraft.client.renderer.texture.TextureMap; import net.minecraft.entity.Entity; import net.minecraft.entity.projectile.EntityPotion; import net.minecraft.item.Item; import net.minecraft.item.ItemPotion; import net.minecraft.potion.PotionHelper; import net.minecraft.util.IIcon; import net.minecraft.util.ResourceLocation; @SideOnly(Side.CLIENT) public class RenderBanderSpell extends Render { private Item field_94151_a; private int field_94150_f; private static final String __OBFID ="CL_00001008"; private static final ResourceLocation textureLocation = new ResourceLocation("bandermod:textures/entity/entitybanderspell.png"); public RenderBanderSpell(Item p_i1259_1_, int p_i1259_2_) { this.field_94151_a = p_i1259_1_; this.field_94150_f = p_i1259_2_; } public RenderBanderSpell(Item p_i1260_1_) { this(p_i1260_1_, 0); } /** * Actually renders the given argument. This is a synthetic bridge method, always casting down its argument and then * handing it off to a worker function which does the actual work. In all probability, the class Render is generic * (Render<T extends Entity) and this method has signature public void func_76986_a(T entity, double d, double d1, * double d2, float f, float f1). But JAD is pre 1.5 so doesn't do that. */ @Override public void doRender(Entity entity, double x, double y, double z, float yaw, float partialTick) { IIcon iicon = this.field_94151_a.getIconFromDamage(this.field_94150_f); GL11.glPushMatrix(); GL11.glTranslatef((float)x, (float)y, (float)z); GL11.glEnable(GL12.GL_RESCALE_NORMAL); GL11.glScalef(0.5F, 0.5F, 0.5F); this.bindEntityTexture(entity); Tessellator tessellator = Tessellator.instance; this.func_77026_a(tessellator, iicon); GL11.glDisable(GL12.GL_RESCALE_NORMAL); GL11.glPopMatrix(); } /** * Returns the location of an entity's texture. Doesn't seem to be called unless you call Render.bindEntityTexture. */ @Override protected ResourceLocation getEntityTexture(Entity entity) { return textureLocation; } private void func_77026_a(Tessellator p_77026_1_, IIcon p_77026_2_) { float f = p_77026_2_.getMinU(); float f1 = p_77026_2_.getMaxU(); float f2 = p_77026_2_.getMinV(); float f3 = p_77026_2_.getMaxV(); float f4 = 1.0F; float f5 = 0.5F; float f6 = 0.25F; GL11.glRotatef(180.0F - this.renderManager.playerViewY, 0.0F, 1.0F, 0.0F); GL11.glRotatef(-this.renderManager.playerViewX, 1.0F, 0.0F, 0.0F); p_77026_1_.startDrawingQuads(); p_77026_1_.setNormal(0.0F, 1.0F, 0.0F); p_77026_1_.addVertexWithUV((double)(0.0F - f5), (double)(0.0F - f6), 0.0D, (double)f, (double)f3); p_77026_1_.addVertexWithUV((double)(f4 - f5), (double)(0.0F - f6), 0.0D, (double)f1, (double)f3); p_77026_1_.addVertexWithUV((double)(f4 - f5), (double)(f4 - f6), 0.0D, (double)f1, (double)f2); p_77026_1_.addVertexWithUV((double)(0.0F - f5), (double)(f4 - f6), 0.0D, (double)f, (double)f2); p_77026_1_.draw(); } }-
View User Profile
-
View Posts
-
Send Message
Curse Premium1. You just copied RenderSnowball... don't do that unless you are actually rendering the projectile using an Item as the base, and then you may as well just use the actual RenderSnowball class instead of making your own.
2. RenderSnowball renders an Item icon; as such, it must use the entire Item icon texture sheet, which it then uses the Item#getIconFromDamage to find the correct texture to draw out of all those stitched together on the sheet. If you change the texture location to something else, the Item will be unable to find its icon.
3. If you have a texture that you just want to render without an Item / Icon, you can do so using the Tessellator. For a normal 16x16 texture, the following should work pretty well (it's basically identical to the RenderSnowball Icon rendering, but hard-coding the vertex parameters since there is no Icon to get the values from):
Thanks for your help and information! I got it working now.
Hey man, my throwing star isn't working for 1.8.1. Has anything changed?
Here are my classes:
Main:
http://pastebin.com/ZD6gC9XA
Items:
http://pastebin.com/ySnxHHQb
Ninja Star:
http://pastebin.com/Vn3NWFrL
Client Proxy:
http://pastebin.com/nfpEedpq
Entity Ninja Star:
http://pastebin.com/dCcnRD5Y
I'm just using RenderSnowball, so I honestly don't know what the problem is. Btw, some of the ninja star stuff was commented out when i pastebinned this, so ignore that; it was just for my mod's update without ninja stars included.
Oh wait, I forgot to include that upon right clicking with the Ninja Star, there is a client crash.
I have no idea why this is happening!! Please help!!
Here is the stacktrace:
-
View User Profile
-
View Posts
-
Send Message
Curse PremiumRenderingRegistry.registerEntityRenderingHandler(EntityNinjaStar.class, new RenderSnowball(Minecraft.getMinecraft().getRenderManager(), NinjaModItems.ninjaStar, null)); // you're crashing? you don't say...
What do you expect to happen when you pass NULL to the renderer's constructor?!?! O.oThe 3rd parameter needs to be a RenderItem instance, which you can retrieve from Minecraft.getMinecraft().getRenderItem().
Thank you!! I don't know why I made that mistake!!!
does the custom model code work on MC 1.8?
if so, can you spot what i'm doing wrong?, and that it cant find
it says that implicit super constructer render() is undefined and ModelCustomEntity cant be found in the prect.
package com.kookyboy9.wheeloftimemod.EntityRender;
import org.lwjgl.opengl.GL11;
import com.kookyboy9.wheeloftimemod.entities.EntityFireball;
import net.minecraft.client.model.ModelBase;
import net.minecraft.client.renderer.entity.Render;
import net.minecraft.entity.Entity;
import net.minecraft.util.ResourceLocation;
import net.minecraftforge.fml.relauncher.Side;
import net.minecraftforge.fml.relauncher.SideOnly;
@SideOnly(Side.CLIENT)
public class RenderFireBall extends Render
{
// ResourceLocations are typically static and final, but that is not an absolute requirement
private static final ResourceLocation texture = new ResourceLocation("yourmodid", "textures/entity/yourtexture.png");
// if you want a model, be sure to add it here:
private ModelBase model;
public RenderFireBall() {
// we could have initialized it above, but here is fine as well:
model = new ModelCustomEntity();
}
@Override
protected ResourceLocation getEntityTexture(Entity entity) {
// this method should return your texture, which may be different based
// on certain characteristics of your custom entity; if that is the case,
// you may want to make a second method that takes your class:
return getCustomTexture((EntityFireball) entity);
}
private ResourceLocation getCustomTexture(EntityFireball entity) {
// now you have access to your custom entity fields and methods, if any,
// and can base the texture to return upon those
return texture;
}
// in whatever render method you are using; this one is from Render class:
@Override
public void doRender(Entity entity, double x, double y, double z, float yaw, float partialTick) {
// again, if you need some information from your custom entity class, you can cast to your
// custom class, either passing off to another method, or just doing it here
// in this example, it is not necessary
// if you are going to do any openGL matrix transformations, be sure to always Push and Pop
GL11.glPushMatrix();
// bind your texture:
bindTexture(texture);
// do whatever transformations you need, then render
// typically you will at least want to translate for x/y/z position:
GL11.glTranslated(x, y, z);
// if you are using a model, you can do so like this:
model.render(entity, 0.0F, 0.0F, 0.0F, 0.0F, 0.0F, 0.0625F);
// note all the values are 0 except the final argument, which is scale
// vanilla Minecraft almost excusively uses 0.0625F, but you can change it to whatever works
GL11.glPopMatrix();
}
}
-
View User Profile
-
View Posts
-
Send Message
Curse PremiumIt's not the Model class, it's the Render class: in 1.8, the constructor for a Render class expects a RenderManager instance, which you can get from Minecraft.getMinecraft().getRenderManager().