Jump to content

Recommended Posts

Posted

package  com.OlympiansMod.entity;



import org.lwjgl.opengl.GL11;

import net.minecraft.client.model.ModelBase;
import net.minecraft.client.model.ModelRenderer;
import net.minecraft.entity.Entity;
import net.minecraft.entity.EntityLivingBase;
import net.minecraft.util.MathHelper;

public class ZeusModel extends ModelBase
{
    protected ModelRenderer head;
    protected ModelRenderer body;
    protected ModelRenderer rightarm;
    protected ModelRenderer leftarm;
    protected ModelRenderer rightleg;
    protected ModelRenderer leftleg;
private int heldItemLeft;
private int heldItemRight;


    public ZeusModel()
    {
    	 this.textureWidth = 64;
    	    this.textureHeight = 128;
    	    
    	      this.head = new ModelRenderer(this, 0, 0);
    	      this.head.mirror = true;
    	      this.head.addBox(-4F, -8F, -4F, 10, 10, 10);
    	      this.head.setRotationPoint(-1F, -10F, 0F);
    	      this.head.setTextureSize(64, 128);

    	      this.body = new ModelRenderer(this, 2, 20);
    	      this.body.mirror = true;
    	      this.body.addBox(-4F, 0F, -2F, 12, 16, 6);
    	      this.body.setRotationPoint(-2F, -8F, 0F);
    	      this.body.setTextureSize(64, 128);

    	      this.rightarm = new ModelRenderer(this, 40, 0);
    	      this.rightarm.mirror = true;
    	      this.rightarm.addBox(-3F, -2F, -2F, 6, 16, 6);
    	      this.rightarm.setRotationPoint(-9F, -6F, 0F);
    	      this.rightarm.setTextureSize(64, 128);

    	      this.leftarm = new ModelRenderer(this, 40, 22);
    	      this.leftarm.mirror = true;
    	      this.leftarm.addBox(-1F, -2F, -2F, 6, 16, 6);
    	      this.leftarm.setRotationPoint(7F, -6F, 0F);
    	      this.leftarm.setTextureSize(64, 128);

    	      this.rightleg = new ModelRenderer(this, 40, 44);
    	      this.rightleg.mirror = true;
    	      this.rightleg.addBox(-2F, 0F, -2F, 6, 16, 6);
    	      this.rightleg.setRotationPoint(-4F, 8F, 0F);
    	      this.rightleg.setTextureSize(64, 128);

    	      this.leftleg = new ModelRenderer(this, 40, 66);
    	      this.leftleg.mirror = true;
    	      this.leftleg.addBox(-2F, 0F, -2F, 6, 16, 6);
    	      this.leftleg.setRotationPoint(2F, 8F, 0F);
    	      this.leftleg.setTextureSize(64, 128);
    }

  
  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);
    this.head.render(f5);
    this.body.render(f5);
    this.rightarm.render(f5);
    this.leftarm.render(f5);
    this.rightleg.render(f5);
    this.leftleg.render(f5);
  }
  
  public static 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);
    this.head.rotateAngleY = f3 / (180F / (float)Math.PI);
    this.head.rotateAngleX = f4 / (180F / (float)Math.PI);
rightleg.rotateAngleX = MathHelper.cos(f * 0.6662F) * 1.4F * f1;
    leftleg.rotateAngleX = MathHelper.cos(f * 0.6662F + (float)Math.PI) * 1.4F * f1;
    rightarm.rotateAngleX = MathHelper.cos(f * 0.6662F) * 1.4F * f1;
    leftarm.rotateAngleX = MathHelper.cos(f * 0.6662F + (float)Math.PI) * 1.4F * f1;

    if (this.heldItemRight != 0)
    {
        this.rightarm.rotateAngleX = this.rightarm.rotateAngleX * 0.5F - ((float)Math.PI / 10F) * (float)this.heldItemRight;
    }
    Zeus zeus = (Zeus)entity;
    int i = zeus.getattackTimer(); 

    if (i > 0)
    {
    	 float f6 = 0.0F;
         float f7 = 0.0F;
         this.rightarm.rotateAngleZ = 0.0F;
       
         this.rightarm.rotateAngleY = -(0.1F - f6 * 0.6F);

         this.rightarm.rotateAngleX = -((float)Math.PI / 2F);
  
         this.rightarm.rotateAngleX -= f6 * 1.2F - f7 * 0.4F;

         this.rightarm.rotateAngleZ += MathHelper.cos(f2 * 0.09F) * 0.05F + 0.05F;

         this.rightarm.rotateAngleX += MathHelper.sin(f2 * 0.067F) * 0.05F;
    }else{
    	
    }
    int j = zeus.getattackTimer2();
    if (j > 0)
    {
    	
    	 float f6 = 1.0F - this.onGround;
         f6 *= f6;
         f6 *= f6;
         f6 = 1.0F - f6;
         float f7 = MathHelper.sin(f6 * (float)Math.PI);
         float f8 = MathHelper.sin(this.onGround * (float)Math.PI) * -(this.head.rotateAngleX - 0.7F) * 0.75F;
    	 this.leftarm.rotateAngleX = (float)((double)this.leftarm.rotateAngleX - ((double)f7 * 1.2D + (double)f8));
         this.leftarm.rotateAngleY += this.body.rotateAngleY * 2.0F;
         this.leftarm.rotateAngleZ = MathHelper.sin(this.onGround * (float)Math.PI) * -0.4F;
    
    }
}



  private float func_78172_a(float p_78172_1_, float p_78172_2_) 
  {
      return (Math.abs(p_78172_1_ % p_78172_2_ - p_78172_2_ * 0.5F) - p_78172_2_ * 0.25F) / (p_78172_2_ * 0.25F);
  }



  }
  


 

how this model cant hold an item? ingame it doesn't render..

Im serious don't look at it!!

Posted

    if (this.heldItemRight != 0)

        {

            this.rightarm.rotateAngleX = this.rightarm.rotateAngleX * 0.5F - ((float)Math.PI / 10F) * (float)this.heldItemRight;

        }

wait, shouldn't this render the item just fine?  it seems as though it should work..

Im serious don't look at it!!

Posted

Slow down and be more clear.

 

If 1.8, do what Dies said and use the layer.  Look at renderplayer for an example.  You just add the layer.

 

If 1.7.10, what render are you using?  If you extend renderbiped, it will handle it for you unless you do something really odd.

Long time Bukkit & Forge Programmer

Happy to try and help

Posted

sorry yeah , im working in 1.7.10. except I don't think that I can extend off renderbiped unless my model extends biped, which was my problem in the first place, extending the model of biped made the model super weird, although I did make it techne.. anyways, since I thought that was the problem(techne model), I extended the model of biped, and copied the measurements, or dimensions of the model and pasted them in place of the biped dimensions.(like the skeleton does, extends off the biped model and makes the arms skinnier) but yeah im not sure what to do from here, if nothing works out properly in the end, I will have to code the model, so yeah it would be really nice to get the render biped to work.

Im serious don't look at it!!

Posted

ok, now describe a bit more.

 

What is your entity?  What did you extend?  Livingbase, ect?  There should be no issues other than some animation for legs/arms that can be fixed easily.

 

For your render and model, you can extend modelbiped in most cases. 

Long time Bukkit & Forge Programmer

Happy to try and help

Posted

Render Class

package com.OlympiansMod.entity;

import com.OlympiansMod.lib.Refstrings;

import net.minecraft.client.model.ModelBase;
import net.minecraft.client.model.ModelBiped;
import net.minecraft.client.renderer.entity.RenderBiped;
import net.minecraft.client.renderer.entity.RenderLiving;
import net.minecraft.entity.Entity;
import net.minecraft.entity.EntityLiving;
import net.minecraft.util.ResourceLocation;
import net.minecraft.world.World;

public class RenderZeus extends RenderLiving{
private static final ResourceLocation mobTextures = new ResourceLocation(Refstrings.MODID + ":textures/entity/Zeus.png");

public RenderZeus(ZeusModel model, float par2) {
	super(model, par2);

}
protected ResourceLocation getEntityTexture(Zeus entity){
	return mobTextures;
}
protected ResourceLocation getEntityTexture(Entity entity){
	return this.getEntityTexture((Zeus)entity); 
}


}

 

ModelClass:

package  com.OlympiansMod.entity;



import org.lwjgl.opengl.GL11;

import net.minecraft.client.model.ModelBase;
import net.minecraft.client.model.ModelRenderer;
import net.minecraft.entity.Entity;
import net.minecraft.entity.EntityLivingBase;
import net.minecraft.item.ItemStack;
import net.minecraft.util.MathHelper;

public class ZeusModel extends ModelBase
{
    protected ModelRenderer head;
    protected ModelRenderer body;
    protected ModelRenderer rightarm;
    protected ModelRenderer leftarm;
    protected ModelRenderer rightleg;
    protected ModelRenderer leftleg;
    public int heldItemLeft;
    public int heldItemRight;


    public ZeusModel()
    {
    	 this.textureWidth = 64;
    	    this.textureHeight = 128;
    	    
    	      this.head = new ModelRenderer(this, 0, 0);
    	      this.head.mirror = true;
    	      this.head.addBox(-4F, -8F, -4F, 10, 10, 10);
    	      this.head.setRotationPoint(-1F, -10F, 0F);
    	      this.head.setTextureSize(64, 128);

    	      this.body = new ModelRenderer(this, 2, 20);
    	      this.body.mirror = true;
    	      this.body.addBox(-4F, 0F, -2F, 12, 16, 6);
    	      this.body.setRotationPoint(-2F, -8F, 0F);
    	      this.body.setTextureSize(64, 128);

    	      this.rightarm = new ModelRenderer(this, 40, 0);
    	      this.rightarm.mirror = true;
    	      this.rightarm.addBox(-3F, -2F, -2F, 6, 16, 6);
    	      this.rightarm.setRotationPoint(-9F, -6F, 0F);
    	      this.rightarm.setTextureSize(64, 128);

    	      this.leftarm = new ModelRenderer(this, 40, 22);
    	      this.leftarm.mirror = true;
    	      this.leftarm.addBox(-1F, -2F, -2F, 6, 16, 6);
    	      this.leftarm.setRotationPoint(7F, -6F, 0F);
    	      this.leftarm.setTextureSize(64, 128);

    	      this.rightleg = new ModelRenderer(this, 40, 44);
    	      this.rightleg.mirror = true;
    	      this.rightleg.addBox(-2F, 0F, -2F, 6, 16, 6);
    	      this.rightleg.setRotationPoint(-4F, 8F, 0F);
    	      this.rightleg.setTextureSize(64, 128);

    	      this.leftleg = new ModelRenderer(this, 40, 66);
    	      this.leftleg.mirror = true;
    	      this.leftleg.addBox(-2F, 0F, -2F, 6, 16, 6);
    	      this.leftleg.setRotationPoint(2F, 8F, 0F);
    	      this.leftleg.setTextureSize(64, 128);
    }

  
  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);
    this.head.render(f5);
    this.body.render(f5);
    this.rightarm.render(f5);
    this.leftarm.render(f5);
    this.rightleg.render(f5);
    this.leftleg.render(f5);
  }
  
  public static 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)
  {
    Zeus zeus = (Zeus)entity;

    int i = zeus.getattackTimer(); 
    super.setRotationAngles(f, f1, f2, f3, f4, f5, entity);
    this.head.rotateAngleY = f3 / (180F / (float)Math.PI);
    this.head.rotateAngleX = f4 / (180F / (float)Math.PI);
rightleg.rotateAngleX = MathHelper.cos(f * 0.6662F) * 1.4F * f1;
    leftleg.rotateAngleX = MathHelper.cos(f * 0.6662F + (float)Math.PI) * 1.4F * f1;
    rightarm.rotateAngleX = MathHelper.cos(f * 0.6662F) * 1.4F * f1;
    leftarm.rotateAngleX = MathHelper.cos(f * 0.6662F + (float)Math.PI) * 1.4F * f1;

    if (this.heldItemRight != 0)
    {
    	
        this.rightarm.rotateAngleX = this.rightarm.rotateAngleX * 0.5F - ((float)Math.PI / 10F) * (float)this.heldItemRight;
    }


    if (i > 0)
    {
    	 float f6 = 0.0F;
         float f7 = 0.0F;
         this.rightarm.rotateAngleZ = 0.0F;
       
         this.rightarm.rotateAngleY = -(0.1F - f6 * 0.6F);

         this.rightarm.rotateAngleX = -((float)Math.PI / 2F);
  
         this.rightarm.rotateAngleX -= f6 * 1.2F - f7 * 0.4F;

         this.rightarm.rotateAngleZ += MathHelper.cos(f2 * 0.09F) * 0.05F + 0.05F;

         this.rightarm.rotateAngleX += MathHelper.sin(f2 * 0.067F) * 0.05F;
    }else{
    	
    }
    int j = zeus.getattackTimer2();
    if (j > 0)
    {
    	
    	 float f6 = 1.0F - this.onGround;
         f6 *= f6;
         f6 *= f6;
         f6 = 1.0F - f6;
         float f7 = MathHelper.sin(f6 * (float)Math.PI);
         float f8 = MathHelper.sin(this.onGround * (float)Math.PI) * -(this.head.rotateAngleX - 0.7F) * 0.75F;
    	 this.leftarm.rotateAngleX = (float)((double)this.leftarm.rotateAngleX - ((double)f7 * 1.2D + (double)f8));
         this.leftarm.rotateAngleY += this.body.rotateAngleY * 2.0F;
         this.leftarm.rotateAngleZ = MathHelper.sin(this.onGround * (float)Math.PI) * -0.4F;
    
    }
}



  private float func_78172_a(float p_78172_1_, float p_78172_2_) 
  {
      return (Math.abs(p_78172_1_ % p_78172_2_ - p_78172_2_ * 0.5F) - p_78172_2_ * 0.25F) / (p_78172_2_ * 0.25F);
  }



  }
  


 

Client proxy:

package com.OlympiansMod.Main;

import java.util.EnumSet;

import javax.swing.plaf.basic.BasicComboBoxUI.KeyHandler;

















import org.lwjgl.input.Keyboard;

import net.minecraft.client.entity.EntityClientPlayerMP;
import net.minecraft.client.renderer.entity.RenderSnowball;
import net.minecraft.client.settings.KeyBinding;
import net.minecraft.entity.player.EntityPlayer;
import net.minecraft.init.Items;
import net.minecraft.world.World;

import com.OlympiansMod.Item.ModItems;
import com.OlympiansMod.PlayerInventory.DNAContainer;
import com.OlympiansMod.PlayerInventory.SlotGui;
import com.OlympiansMod.Potionstuff.WizardsFatigue;
import com.OlympiansMod.entity.Arachne;
import com.OlympiansMod.entity.ArachneModel;
import com.OlympiansMod.entity.Dioceltian;
import com.OlympiansMod.entity.EntityBullet;
import com.OlympiansMod.entity.EntityGreekFire;
import com.OlympiansMod.entity.EntityMasterBolt;
import com.OlympiansMod.entity.EntitySGolem;
import com.OlympiansMod.entity.EntitySGuardian;
import com.OlympiansMod.entity.EntityThunderBolt;
import com.OlympiansMod.entity.EntityUndead;
import com.OlympiansMod.entity.GreekUndead;
import com.OlympiansMod.entity.MasterBoltModel;
import com.OlympiansMod.entity.ModelDioclectian;
import com.OlympiansMod.entity.ModelPosiedon;
import com.OlympiansMod.entity.ModelUndeadGreek;
import com.OlympiansMod.entity.Poseidon;
import com.OlympiansMod.entity.RenderArachne;
import com.OlympiansMod.entity.RenderDioclectian;
import com.OlympiansMod.entity.RenderMasterBolt;
import com.OlympiansMod.entity.RenderPoseidon;
import com.OlympiansMod.entity.RenderSGolem;
import com.OlympiansMod.entity.RenderSGuardian;
import com.OlympiansMod.entity.RenderThunderBolt;
import com.OlympiansMod.entity.RenderUndead;
import com.OlympiansMod.entity.RenderUndeadGreek;
import com.OlympiansMod.entity.RenderZeus;
import com.OlympiansMod.entity.RenderZeusExtended;
import com.OlympiansMod.entity.SGolemModel;
import com.OlympiansMod.entity.SGuardianModel;
import com.OlympiansMod.entity.SlownessSpell;
import com.OlympiansMod.entity.SpellBombardo;
import com.OlympiansMod.entity.SpellChicken;
import com.OlympiansMod.entity.SpellIncendio;
import com.OlympiansMod.entity.Undead;
import com.OlympiansMod.entity.Zeus;
import com.OlympiansMod.entity.ZeusExtended;
import com.OlympiansMod.entity.ZeusExtendedModel;
import com.OlympiansMod.entity.ZeusModel;

import cpw.mods.fml.client.FMLClientHandler;
import cpw.mods.fml.client.registry.RenderingRegistry;
import cpw.mods.fml.common.FMLCommonHandler;
import cpw.mods.fml.common.Mod.EventHandler;
import cpw.mods.fml.common.event.FMLInitializationEvent;
import cpw.mods.fml.common.registry.LanguageRegistry;
import cpw.mods.fml.relauncher.Side;
import cpw.mods.fml.relauncher.SideOnly;


public class ClientProxy extends ServerProxy{
public void registerRenderInfo(){
	RenderingRegistry.registerEntityRenderingHandler(Zeus.class, new RenderZeus(new ZeusModel(), 0));
	                       
}
}


i get an error on renderzeus ect. when extending the render off biped. but that hardly matters because the real problem is with the model, when extending from biped, and changing all of the parts of the model to biped parts, and keeping the model dimensions some how my model gets extremely messed up. the head and legs ect. get scrambled.

Im serious don't look at it!!

Posted

 

Why???

protected ResourceLocation getEntityTexture(Zeus entity){
	return mobTextures;
}
protected ResourceLocation getEntityTexture(Entity entity){
	return this.getEntityTexture((Zeus)entity); 
}
[\code]

just
[code]
         protected ResourceLocation getEntityTexture(Entity entity){
	return mobTextures; 
}
[\code]

The following needs to extend ModelBiped.
public class ZeusModel extends ModelBase

I don't remember the vanilla dimensions but are you resizing the entity at all?  If not, don't even have your own model, just send a new modelbiped in your render.

Even if you do want to resize your entity, i would do what I said above first and get that working.

Long time Bukkit & Forge Programmer

Happy to try and help

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

    • Without Network protocol fix mod, I get kicked with a Network Protocol error when on LAN. Also, both of these issues are caused by a Null Pointer Exception/Screen cannot be null in a "Client Bound Player Combat Kill Packet".
    • You need a new "items" folder at  resources/assets/yourmodid/ there you add for every item model a .json file with the exact item/block name and fill it like this if it's an item: { "model": { "type": "minecraft:model", "model": "yourmodid:item/youritem" } } and so if its a block: { "model": { "type": "minecraft:model", "model": "yourmodid:block/youritem" } } There is also a generator for it you can do namy crazy things with it which replaces the previous hard coded Item Properties implementaion method (Bow pulling animation for example). https://misode.github.io/assets/item/
    • Hello! I'm playing a modpack (custom made) with some friends, and we have the server running on BisectHosting. We encountered a bug with an entity from The Box Of Horrors mod, that would crash the game whenever someone nearby it would log in. We tried to fix it by: 1) Editing the player.dat files to change the location of the affected players (something I had done successfully previously) 2) Updating the version of the mod we had (0.0.8.2) to the latest alpha version (0.0.8.3 However, after doing both of those, none of us are able to join the server, and we get the following errors: Server side: https://pastebin.com/J5sc3VQN Client side: Internal Server Error (that's basically all I've gotten) Please help! I've tried restoring the player data to how it was before I made the changes (Bisect allows you to restore deleted files) and deleting all of my player data files and I still get the same error. Deleting Box Of Horrors causes the error: Failed to load datapacks, cannot continue with server load.
    • Hey there! I'm trying to create a simple mod for Forge 1.21.1 that adds a few custom banner patterns that don't require any banner pattern items. To be completely honest, this is my first time modding for Minecraft, so after setting up the project in Intellij, I copied the parts of the source code from this mod on CurseForge that dealt with adding and registering banner patterns, including the lang and banner_pattern .json files. From what I understand, to add a banner pattern that doesn't require a banner pattern item, I only needed to create the registries for each pattern like in here and then register it in the main java class like here on Line 54. Additionally, in the lang/en_us.json file, add in the names for each respective banner color, and in the data/minecraft/tags/banner_pattern/no_items_required.json file, add each banner pattern that does not require a banner pattern item to make a banner. The project is able to compile when loading in Forge which makes me assume that the file structure I have is correct, but on loading a Minecraft world, this error appears in console and the loom is subsequently blank. [Worker-Main-1/ERROR] [minecraft/TagLoader]: Couldn't load tag minecraft:no_item_required as it is missing following references: *lists every added entry in no_item_required.json* The message clearly states something went wrong regarding when trying to load in the registries from the mod, but I have no clue what could be wrong with the code I have. Attached below are screenshots of what I currently have. Java Main Class Banner Registry Class File Structure Error in Console upon loading a Minecraft world What the loom shows without minecraft:no_item_required    The original mod I copied still functions completely, so if anyone can figure out why the registries for the mod I'm making isn't working, that would be greatly appreciated!    
    • Please someone help me to know how can I fix this generation error in the trees! I already uninstalled and reinstalled several mods in my modpack and can't figure out what is causing it.    
  • Topics

×
×
  • Create New...

Important Information

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