Jump to content

[1.8.9] Throwable Entity ... (all entitys get the same model?)


terraya

Recommended Posts

Hello Dear Forum,

 

im working on "Throwable Entitys" , well they work actualy but i want to change the "LivingEntity" which get throwen in the air,

 

the problem is here that i tryed to figure out how it works ... i mean there is no "Custom Throwable  .. . . ." thing which i can find on the internet,

 

so well , i workt this out :

 

@SideOnly(Side.CLIENT)
public class RenderType01 extends Render<IceBall> {

private static final ResourceLocation arrowTextures = new ResourceLocation("textures/entity/arrow.png");

public RenderType01(RenderManager renderManager) {
	super(renderManager);

}

private ModelBall ball = new ModelBall();

@Override
public void doRender(IceBall entity, double x, double y, double z, float entityYaw, float partialTicks) {



	  this.bindEntityTexture(entity);
        GlStateManager.color(1.0F, 1.0F, 1.0F, 1.0F);
        GlStateManager.pushMatrix();
        GlStateManager.translate((float)x, (float)y, (float)z);
        GlStateManager.rotate(entity.prevRotationYaw + (entity.rotationYaw - entity.prevRotationYaw) * partialTicks - 90.0F, 0.0F, 1.0F, 0.0F);
        GlStateManager.rotate(entity.prevRotationPitch + (entity.rotationPitch - entity.prevRotationPitch) * partialTicks, 0.0F, 0.0F, 1.0F);
        Tessellator tessellator = Tessellator.getInstance();
        WorldRenderer worldrenderer = tessellator.getWorldRenderer();
        int i = 0;
        float f = 0.0F;
        float f1 = 0.5F;
        float f2 = (float)(0 + i * 10) / 32.0F;
        float f3 = (float)(5 + i * 10) / 32.0F;
        float f4 = 0.0F;
        float f5 = 0.15625F;
        float f6 = (float)(5 + i * 10) / 32.0F;
        float f7 = (float)(10 + i * 10) / 32.0F;
        float f8 = 0.05625F;
        GlStateManager.enableRescaleNormal();
        float f9 = (float)1 - partialTicks;

        if (f9 > 0.0F)
        {
            float f10 = -MathHelper.sin(f9 * 3.0F) * f9;
            GlStateManager.rotate(f10, 0.0F, 0.0F, 1.0F);
        }

        GlStateManager.rotate(45.0F, 1.0F, 0.0F, 0.0F);
        GlStateManager.scale(f8, f8, f8);
        GlStateManager.translate(-4.0F, 0.0F, 0.0F);
        GL11.glNormal3f(f8, 0.0F, 0.0F);
        worldrenderer.begin(7, DefaultVertexFormats.POSITION_TEX);
        worldrenderer.pos(-7.0D, -2.0D, -2.0D).tex((double)f4, (double)f6).endVertex();
        worldrenderer.pos(-7.0D, -2.0D, 2.0D).tex((double)f5, (double)f6).endVertex();
        worldrenderer.pos(-7.0D, 2.0D, 2.0D).tex((double)f5, (double)f7).endVertex();
        worldrenderer.pos(-7.0D, 2.0D, -2.0D).tex((double)f4, (double)f7).endVertex();
        tessellator.draw();
        GL11.glNormal3f(-f8, 0.0F, 0.0F);
        worldrenderer.begin(7, DefaultVertexFormats.POSITION_TEX);
        worldrenderer.pos(-7.0D, 2.0D, -2.0D).tex((double)f4, (double)f6).endVertex();
        worldrenderer.pos(-7.0D, 2.0D, 2.0D).tex((double)f5, (double)f6).endVertex();
        worldrenderer.pos(-7.0D, -2.0D, 2.0D).tex((double)f5, (double)f7).endVertex();
        worldrenderer.pos(-7.0D, -2.0D, -2.0D).tex((double)f4, (double)f7).endVertex();
        tessellator.draw();

        for (int j = 0; j < 4; ++j)
        {
            GlStateManager.rotate(90.0F, 1.0F, 0.0F, 0.0F);
            GL11.glNormal3f(0.0F, 0.0F, f8);
            worldrenderer.begin(7, DefaultVertexFormats.POSITION_TEX);
            worldrenderer.pos(-8.0D, -2.0D, 0.0D).tex((double)f, (double)f2).endVertex();
            worldrenderer.pos(8.0D, -2.0D, 0.0D).tex((double)f1, (double)f2).endVertex();
            worldrenderer.pos(8.0D, 2.0D, 0.0D).tex((double)f1, (double)f3).endVertex();
            worldrenderer.pos(-8.0D, 2.0D, 0.0D).tex((double)f, (double)f3).endVertex();
            tessellator.draw();
        }

        GlStateManager.disableRescaleNormal();
        GlStateManager.popMatrix();
        super.doRender(entity, x, y, z, entityYaw, partialTicks);

//		ball.render(entity,  0.0F, 0.0F, -0.1F, 0.0F, 0.0F, 0.0625F);
//		super.doRender(entity, x, y, z, entityYaw, partialTicks);
}

protected ResourceLocation getEntityTexture(IceBall entity) {
	return arrowTextures;
}
}

 

this is the "Arrow" Model from "Minecraft" , i register it like this:

 

@Mod(modid = "BlockUpdate", name="BlockUpdate Mod", version="2.1", acceptedMinecraftVersions="[1.8.9]")
public class BlocksUpdate
{

  @SidedProxy(clientSide="ArturFarid.BlockUpdate.proxy.ClientProxy", serverSide="ArturFarid.BlockUpdate.proxy.CommonProxy")
  public static CommonProxy proxy;
  
public static Item_Tab item_tab = new Item_Tab();
public static Sword_Tab sword_tab = new Sword_Tab();
public static Food_Tab food_tab = new Food_Tab();
public static Devil_Fruit_Tab devil_fruit_tab = new Devil_Fruit_Tab();

@Instance  
public static BlocksUpdate instance;
  
  @EventHandler
  public void preInit(FMLPreInitializationEvent event)
  {
ArturFarid.BlockUpdate.init.BlocksUpdate.init();
ArturFarid.BlockUpdate.init.BlocksUpdate.register();
    ItemsUpdate.init();
    ItemsUpdate.register();
  }
  
  @EventHandler
  public void Init(FMLInitializationEvent event)
  {
  proxy.registeRenders();	  
  EntityRegistry.registerModEntity(IceBall.class, "IceBall", 1, this, 80, 3, true);
  EntityRegistry.registerModEntity(IceWall.class, "IceWall", 1, this, 80, 3, true);
  EntityRegistry.registerModEntity(PawHit.class, "PawHit", 1, this, 80, 3, true);
  EntityRegistry.registerModEntity(UrsusShock.class, "UrsusShock", 1, this, 80, 3, true);
  EntityRegistry.registerModEntity(ChainLightningEntity.class, "TestThrowableItem", 1, this, 80, 3, true);
  //RenderingRegistry.registerEntityRenderingHandler(Test2Skill.class, new RenderType01("string", new ModelBall(), 7.0F));
  RenderingRegistry.registerEntityRenderingHandler(IceBall.class, new RenderType01(Minecraft.getMinecraft().getRenderManager()));
  }
  
  @EventHandler
  public void postInit(FMLPostInitializationEvent event) {}
}

 

and the problem is, the "EntityModel/Texture" work but i dont know the hell why on "ALL" my entitys ... i try to use it only on "1" throwable thing , and the problem is, it gets bind automatically to all my livingentitys which are throwable ... i dont know why ... everytime i try to use any different "LivingEntity" like "IceBall or IceWall,PawHit" ... doesnt matter which one, all of them have the same model/texture.

 

 

Link to comment
Share on other sites

You are using the same ID for all your entities...

Also, why are you still on 1.8.9? You should update to 1.10.2.

 

1. thank you

2. how can i be able to render then this Model for example:

 

public class ModelBall
  extends ModelBase
{
  ModelRenderer Shape1;
  ModelRenderer Shape2;
  ModelRenderer Shape3;
  ModelRenderer Shape4;
  ModelRenderer Shape5;
  ModelRenderer Shape6;
  ModelRenderer Shape7;
  
  public ModelBall()
  {
    this.textureWidth = 64;
    this.textureHeight = 64;
    
    this.Shape1 = new ModelRenderer(this, 0, 0);
    this.Shape1.addBox(0.0F, 0.0F, 0.0F, 4, 4, 4);
    this.Shape1.setRotationPoint(-1.0F, 0.0F, -3.0F);
    this.Shape1.setTextureSize(64, 64);
    this.Shape1.mirror = true;
    setRotation(this.Shape1, 0.0F, 0.0F, 0.0F);
    this.Shape2 = new ModelRenderer(this, 0, 0);
    this.Shape2.addBox(0.0F, 0.0F, 0.0F, 3, 1, 3);
    this.Shape2.setRotationPoint(-0.5F, -0.7F, -2.5F);
    this.Shape2.setTextureSize(64, 64);
    this.Shape2.mirror = true;
    setRotation(this.Shape2, 0.0F, 0.0F, 0.0F);
    this.Shape3 = new ModelRenderer(this, 0, 0);
    this.Shape3.addBox(0.0F, 0.0F, 0.0F, 3, 1, 3);
    this.Shape3.setRotationPoint(-0.5F, 3.7F, -2.5F);
    this.Shape3.setTextureSize(64, 64);
    this.Shape3.mirror = true;
    setRotation(this.Shape3, 0.0F, 0.0F, 0.0F);
    this.Shape4 = new ModelRenderer(this, 0, 0);
    this.Shape4.addBox(0.0F, 0.0F, 0.0F, 1, 3, 3);
    this.Shape4.setRotationPoint(-1.7F, 0.5F, -2.5F);
    this.Shape4.setTextureSize(64, 64);
    this.Shape4.mirror = true;
    setRotation(this.Shape4, 0.0F, 0.0F, 0.0F);
    this.Shape5 = new ModelRenderer(this, 0, 0);
    this.Shape5.addBox(0.0F, 0.0F, 0.0F, 1, 3, 3);
    this.Shape5.setRotationPoint(2.7F, 0.5F, -2.5F);
    this.Shape5.setTextureSize(64, 64);
    this.Shape5.mirror = true;
    setRotation(this.Shape5, 0.0F, 0.0F, 0.0F);
    this.Shape6 = new ModelRenderer(this, 0, 0);
    this.Shape6.addBox(0.0F, 0.0F, 0.0F, 3, 3, 1);
    this.Shape6.setRotationPoint(-0.5F, 0.5F, 0.7F);
    this.Shape6.setTextureSize(64, 64);
    this.Shape6.mirror = true;
    setRotation(this.Shape6, 0.0F, 0.0F, 0.0F);
    this.Shape7 = new ModelRenderer(this, 0, 0);
    this.Shape7.addBox(0.0F, 0.0F, 0.0F, 3, 3, 1);
    this.Shape7.setRotationPoint(-0.5F, 0.5F, -3.7F);
    this.Shape7.setTextureSize(64, 64);
    this.Shape7.mirror = true;
    setRotation(this.Shape7, 0.0F, 0.0F, 0.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);
    this.Shape1.render(f5);
    this.Shape2.render(f5);
    this.Shape3.render(f5);
    this.Shape4.render(f5);
    this.Shape5.render(f5);
    this.Shape6.render(f5);
    this.Shape7.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)
  {
    super.setRotationAngles(f, f1, f2, f3, f4, f5, null);
  }
}

 

i mean it looks so simple but i dont understand it ...

 

 

3. becouse im doing a big "MOD" and if i would have to upgrade higher i would have alot of trouble to upgrade x.x

i never learned realy "Java" just by testing and coding on Minecraft ...

 

4. becouse i use also "CustomNPCs" the mod is aviable to 1.8.9 ... its a big part of my Plan ...

im doing a big server where the storyline reaches from lv1-lv40(characterlevel [my own lvl sysmte]) ,

i did a bunch of skills etc... and ye .. idk, i cannot code such mod as "CustomNPCs" beside .. that would take way to long i think :/

Link to comment
Share on other sites

hmm well i never have tryed to update my "MOD" ...

 

i got a big project its like an "Morpg" , just in MM, and later when you get max lvl

you will be able to do many more things but if i upgrade the mod i wont be able to

use "customnpcs" :/ and i dont have that much time.

 

BUT after i code all in 1.8.9, i will try to update it OFC, but i think,  first finish it on 1.8.9 then update it with the

hope that "customnpcs" will get also updated.

Link to comment
Share on other sites

hmm well i never have tryed to update my "MOD" ...

 

Is your mod a mod or is it a MOD or only sort of a "MOD" but not really?

 

(Protip: quotes around things mean either speech or saying "it's not really this thing."  See: Air Quotes).

Apparently I'm a complete and utter jerk and come to this forum just like to make fun of people, be confrontational, and make your personal life miserable.  If you think this is the case, JUST REPORT ME.  Otherwise you're just going to get reported when you reply to my posts and point it out, because odds are, I was trying to be nice.

 

Exception: If you do not understand Java, I WILL NOT HELP YOU and your thread will get locked.

 

DO NOT PM ME WITH PROBLEMS. No help will be given.

Link to comment
Share on other sites

1. i fixed my problem thank you!

 

2. Hmm if its a "MOD" or not a real "MOD" is a question ,

but it will be a "MOD" with over

300new different block,

500 new different items, 24new armor types + some stylish ones,

around 150 new weapons (Swords with special abilitys/axes/bows/pistols etc...)

 

AND MY FAVORITE , "DevilFruits", like in the manga "Onepiece".(if you dont know it, just google it :D )

 

most of these things are already done, just skills are left and some sepcial abilitys for swords and many textures left to make ...

 

 

Link to comment
Share on other sites

It's spelled "mod" in lower case and without quotes (the quotes in this post are a legitimate use of the punctuation mark). It is not an acronym.

 

Minecraft mod.

CustomNPCs mod.

One Piece anime.

Apparently I'm a complete and utter jerk and come to this forum just like to make fun of people, be confrontational, and make your personal life miserable.  If you think this is the case, JUST REPORT ME.  Otherwise you're just going to get reported when you reply to my posts and point it out, because odds are, I was trying to be nice.

 

Exception: If you do not understand Java, I WILL NOT HELP YOU and your thread will get locked.

 

DO NOT PM ME WITH PROBLEMS. No help will be given.

Link to comment
Share on other sites

now the last problem is ...

 

i cannot render that model , idk why ... -_-

 

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

public class ModelBall
  extends ModelBase
{
  ModelRenderer Shape1;
  ModelRenderer Shape2;
  ModelRenderer Shape3;
  ModelRenderer Shape4;
  ModelRenderer Shape5;
  ModelRenderer Shape6;
  ModelRenderer Shape7;
  
  public ModelBall()
  {
    this.textureWidth = 64;
    this.textureHeight = 64;
    
    this.Shape1 = new ModelRenderer(this, 0, 0);
    this.Shape1.addBox(0.0F, 0.0F, 0.0F, 4, 4, 4);
    this.Shape1.setRotationPoint(-1.0F, 0.0F, -3.0F);
    this.Shape1.setTextureSize(64, 64);
    this.Shape1.mirror = true;
    setRotation(this.Shape1, 0.0F, 0.0F, 0.0F);
    this.Shape2 = new ModelRenderer(this, 0, 0);
    this.Shape2.addBox(0.0F, 0.0F, 0.0F, 3, 1, 3);
    this.Shape2.setRotationPoint(-0.5F, -0.7F, -2.5F);
    this.Shape2.setTextureSize(64, 64);
    this.Shape2.mirror = true;
    setRotation(this.Shape2, 0.0F, 0.0F, 0.0F);
    this.Shape3 = new ModelRenderer(this, 0, 0);
    this.Shape3.addBox(0.0F, 0.0F, 0.0F, 3, 1, 3);
    this.Shape3.setRotationPoint(-0.5F, 3.7F, -2.5F);
    this.Shape3.setTextureSize(64, 64);
    this.Shape3.mirror = true;
    setRotation(this.Shape3, 0.0F, 0.0F, 0.0F);
    this.Shape4 = new ModelRenderer(this, 0, 0);
    this.Shape4.addBox(0.0F, 0.0F, 0.0F, 1, 3, 3);
    this.Shape4.setRotationPoint(-1.7F, 0.5F, -2.5F);
    this.Shape4.setTextureSize(64, 64);
    this.Shape4.mirror = true;
    setRotation(this.Shape4, 0.0F, 0.0F, 0.0F);
    this.Shape5 = new ModelRenderer(this, 0, 0);
    this.Shape5.addBox(0.0F, 0.0F, 0.0F, 1, 3, 3);
    this.Shape5.setRotationPoint(2.7F, 0.5F, -2.5F);
    this.Shape5.setTextureSize(64, 64);
    this.Shape5.mirror = true;
    setRotation(this.Shape5, 0.0F, 0.0F, 0.0F);
    this.Shape6 = new ModelRenderer(this, 0, 0);
    this.Shape6.addBox(0.0F, 0.0F, 0.0F, 3, 3, 1);
    this.Shape6.setRotationPoint(-0.5F, 0.5F, 0.7F);
    this.Shape6.setTextureSize(64, 64);
    this.Shape6.mirror = true;
    setRotation(this.Shape6, 0.0F, 0.0F, 0.0F);
    this.Shape7 = new ModelRenderer(this, 0, 0);
    this.Shape7.addBox(0.0F, 0.0F, 0.0F, 3, 3, 1);
    this.Shape7.setRotationPoint(-0.5F, 0.5F, -3.7F);
    this.Shape7.setTextureSize(64, 64);
    this.Shape7.mirror = true;
    setRotation(this.Shape7, 0.0F, 0.0F, 0.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);
    this.Shape1.render(f5);
    this.Shape2.render(f5);
    this.Shape3.render(f5);
    this.Shape4.render(f5);
    this.Shape5.render(f5);
    this.Shape6.render(f5);
    this.Shape7.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)
  {
    super.setRotationAngles(f, f1, f2, f3, f4, f5, null);
  }
}

Link to comment
Share on other sites

now the last problem is ...

 

i cannot render that model , idk why ... -_-

 

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

public class ModelBall
  extends ModelBase
{
  ModelRenderer Shape1;
  ModelRenderer Shape2;
  ModelRenderer Shape3;
  ModelRenderer Shape4;
  ModelRenderer Shape5;
  ModelRenderer Shape6;
  ModelRenderer Shape7;
  
  public ModelBall()
  {
    this.textureWidth = 64;
    this.textureHeight = 64;
    
    this.Shape1 = new ModelRenderer(this, 0, 0);
    this.Shape1.addBox(0.0F, 0.0F, 0.0F, 4, 4, 4);
    this.Shape1.setRotationPoint(-1.0F, 0.0F, -3.0F);
    this.Shape1.setTextureSize(64, 64);
    this.Shape1.mirror = true;
    setRotation(this.Shape1, 0.0F, 0.0F, 0.0F);
    this.Shape2 = new ModelRenderer(this, 0, 0);
    this.Shape2.addBox(0.0F, 0.0F, 0.0F, 3, 1, 3);
    this.Shape2.setRotationPoint(-0.5F, -0.7F, -2.5F);
    this.Shape2.setTextureSize(64, 64);
    this.Shape2.mirror = true;
    setRotation(this.Shape2, 0.0F, 0.0F, 0.0F);
    this.Shape3 = new ModelRenderer(this, 0, 0);
    this.Shape3.addBox(0.0F, 0.0F, 0.0F, 3, 1, 3);
    this.Shape3.setRotationPoint(-0.5F, 3.7F, -2.5F);
    this.Shape3.setTextureSize(64, 64);
    this.Shape3.mirror = true;
    setRotation(this.Shape3, 0.0F, 0.0F, 0.0F);
    this.Shape4 = new ModelRenderer(this, 0, 0);
    this.Shape4.addBox(0.0F, 0.0F, 0.0F, 1, 3, 3);
    this.Shape4.setRotationPoint(-1.7F, 0.5F, -2.5F);
    this.Shape4.setTextureSize(64, 64);
    this.Shape4.mirror = true;
    setRotation(this.Shape4, 0.0F, 0.0F, 0.0F);
    this.Shape5 = new ModelRenderer(this, 0, 0);
    this.Shape5.addBox(0.0F, 0.0F, 0.0F, 1, 3, 3);
    this.Shape5.setRotationPoint(2.7F, 0.5F, -2.5F);
    this.Shape5.setTextureSize(64, 64);
    this.Shape5.mirror = true;
    setRotation(this.Shape5, 0.0F, 0.0F, 0.0F);
    this.Shape6 = new ModelRenderer(this, 0, 0);
    this.Shape6.addBox(0.0F, 0.0F, 0.0F, 3, 3, 1);
    this.Shape6.setRotationPoint(-0.5F, 0.5F, 0.7F);
    this.Shape6.setTextureSize(64, 64);
    this.Shape6.mirror = true;
    setRotation(this.Shape6, 0.0F, 0.0F, 0.0F);
    this.Shape7 = new ModelRenderer(this, 0, 0);
    this.Shape7.addBox(0.0F, 0.0F, 0.0F, 3, 3, 1);
    this.Shape7.setRotationPoint(-0.5F, 0.5F, -3.7F);
    this.Shape7.setTextureSize(64, 64);
    this.Shape7.mirror = true;
    setRotation(this.Shape7, 0.0F, 0.0F, 0.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);
    this.Shape1.render(f5);
    this.Shape2.render(f5);
    this.Shape3.render(f5);
    this.Shape4.render(f5);
    this.Shape5.render(f5);
    this.Shape6.render(f5);
    this.Shape7.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)
  {
    super.setRotationAngles(f, f1, f2, f3, f4, f5, null);
  }
}

In your renderer create an instance of your model and call render().

VANILLA MINECRAFT CLASSES ARE THE BEST RESOURCES WHEN MODDING

I will be posting 1.15.2 modding tutorials on this channel. If you want to be notified of it do the normal YouTube stuff like subscribing, ect.

Forge and vanilla BlockState generator.

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.



×
×
  • Create New...

Important Information

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