Jump to content

BusyBeever

Members
  • Posts

    201
  • Joined

  • Last visited

Posts posted by BusyBeever

  1. Just made my armor estend ModelBiped and it works..

    But the armor is glitchy and not really following the player when he moves

    Any idea why?

     

    public class AdamantArmorModel extends ModelBiped {
    // fields
    ModelRenderer head;
    ModelRenderer body;
    ModelRenderer rightarm;
    ModelRenderer leftarm;
    ModelRenderer rightleg;
    ModelRenderer leftleg;
    ModelRenderer Shape1;
    ModelRenderer Shape2;
    ModelRenderer Shape3;
    ModelRenderer Shape4;
    
    public AdamantArmorModel() {
    	textureWidth = 76;
    	textureHeight = 32;
    
    	head = new ModelRenderer(this, 0, 0);
    	head.addBox(-4F, -8F, -4F, 8, 8, ;
    	head.setRotationPoint(0F, 0F, 0F);
    	head.setTextureSize(76, 32);
    	head.mirror = true;
    	setRotation(head, 0F, 0F, 0F);
    	body = new ModelRenderer(this, 16, 16);
    	body.addBox(-4F, 0F, -2F, 8, 12, 4);
    	body.setRotationPoint(0F, 0F, 0F);
    	body.setTextureSize(76, 32);
    	body.mirror = true;
    	setRotation(body, 0F, 0F, 0F);
    	rightarm = new ModelRenderer(this, 40, 16);
    	rightarm.addBox(-3F, -2F, -2F, 4, 12, 4);
    	rightarm.setRotationPoint(-5F, 2F, 0F);
    	rightarm.setTextureSize(76, 32);
    	rightarm.mirror = true;
    	setRotation(rightarm, 0F, 0F, 0F);
    	leftarm = new ModelRenderer(this, 40, 16);
    	leftarm.addBox(-1F, -2F, -2F, 4, 12, 4);
    	leftarm.setRotationPoint(5F, 2F, 0F);
    	leftarm.setTextureSize(76, 32);
    	leftarm.mirror = true;
    	setRotation(leftarm, 0F, 0F, 0F);
    	rightleg = new ModelRenderer(this, 0, 16);
    	rightleg.addBox(-2F, 0F, -2F, 4, 12, 4);
    	rightleg.setRotationPoint(-2F, 12F, 0F);
    	rightleg.setTextureSize(76, 32);
    	rightleg.mirror = true;
    	setRotation(rightleg, 0F, 0F, 0F);
    	leftleg = new ModelRenderer(this, 0, 16);
    	leftleg.addBox(-2F, 0F, -2F, 4, 12, 4);
    	leftleg.setRotationPoint(2F, 12F, 0F);
    	leftleg.setTextureSize(76, 32);
    	leftleg.mirror = true;
    	setRotation(leftleg, 0F, 0F, 0F);
    	Shape1 = new ModelRenderer(this, 44, 9);
    	Shape1.addBox(0F, 0F, 0F, 3, 6, 1);
    	Shape1.setRotationPoint(-4F, -8F, -5F);
    	Shape1.setTextureSize(76, 32);
    	Shape1.mirror = true;
    	setRotation(Shape1, 0F, 0F, 0F);
    	Shape2 = new ModelRenderer(this, 32, 1);
    	Shape2.addBox(0F, 0F, 0F, 1, 6, 4);
    	Shape2.setRotationPoint(-5F, -8F, -5F);
    	Shape2.setTextureSize(76, 32);
    	Shape2.mirror = true;
    	setRotation(Shape2, 0F, 0F, 0F);
    	Shape3 = new ModelRenderer(this, 40, 18);
    	Shape3.addBox(0F, 0F, 0F, 1, 1, 1);
    	Shape3.setRotationPoint(-2F, -4F, -6F);
    	Shape3.setTextureSize(76, 32);
    	Shape3.mirror = true;
    	setRotation(Shape3, 0F, 0F, 0F);
    	Shape3 = new ModelRenderer(this, 40, 18);
    	Shape3.addBox(0F, 0F, 0F, 1, 1, 1);
    	Shape3.setRotationPoint(-5F, -4F, -6F);
    	Shape3.setTextureSize(76, 32);
    	Shape3.mirror = true;
    	setRotation(Shape3, 0F, 0F, 0F);
    	Shape3 = new ModelRenderer(this, 52, 17);
    	Shape3.addBox(0F, 0F, 0F, 2, 2, 1);
    	Shape3.setRotationPoint(-4F, -7F, -6F);
    	Shape3.setTextureSize(76, 32);
    	Shape3.mirror = true;
    	setRotation(Shape3, 0F, 0F, 0F);
    	Shape4 = new ModelRenderer(this, 56, 21);
    	Shape4.addBox(0F, 0F, 0F, 4, 5, 6);
    	Shape4.setRotationPoint(-2F, 0F, -3F);
    	Shape4.setTextureSize(76, 32);
    	Shape4.mirror = true;
    	setRotation(Shape4, 0F, 0F, 0F);
    	Shape4 = new ModelRenderer(this, 60, 11);
    	Shape4.addBox(0F, 0F, 0F, 2, 4, 6);
    	Shape4.setRotationPoint(2F, 0F, -3F);
    	Shape4.setTextureSize(76, 32);
    	Shape4.mirror = true;
    	setRotation(Shape4, 0F, 0F, 0F);
    	Shape4 = new ModelRenderer(this, 60, 11);
    	Shape4.addBox(0F, 0F, 0F, 2, 4, 6);
    	Shape4.setRotationPoint(-4F, 0F, -3F);
    	Shape4.setTextureSize(76, 32);
    	Shape4.mirror = true;
    	setRotation(Shape4, 0F, 0F, 0F);
    	Shape4 = new ModelRenderer(this, 54, 1);
    	Shape4.addBox(0F, 0F, 0F, 5, 4, 6);
    	Shape4.setRotationPoint(-9F, -1F, -3F);
    	Shape4.setTextureSize(76, 32);
    	Shape4.mirror = true;
    	setRotation(Shape4, 0F, 0F, 0F);
    	Shape4.mirror = true;
    	Shape4 = new ModelRenderer(this, 54, 1);
    	Shape4.addBox(0F, 0F, 0F, 5, 4, 6);
    	Shape4.setRotationPoint(4F, -1F, -3F);
    	Shape4.setTextureSize(76, 32);
    	Shape4.mirror = true;
    	setRotation(Shape4, 0F, 0F, 0F);
    	Shape4.mirror = false;
    }
    
    @Override
    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);
    	rightleg.render(f5);
    	leftleg.render(f5);
    	Shape1.render(f5);
    	Shape2.render(f5);
    	Shape3.render(f5);
    	Shape3.render(f5);
    	Shape3.render(f5);
    	Shape4.render(f5);
    	Shape4.render(f5);
    	Shape4.render(f5);
    	Shape4.render(f5);
    	Shape4.render(f5);
    }
    
    private void setRotation(ModelRenderer model, float x, float y, float z) {
    	model.rotateAngleX = x;
    	model.rotateAngleY = y;
    	model.rotateAngleZ = z;
    }
    

     

     

  2. The method gets called if you register your event handler correct (try adding a sysout to be sure)

    yes you would use getCapability to get the caps.

    The varialbes get saved in the implementation of your Capability. If you want to get/set the values of the cap just add the methods you need to the inferface and implement them in the implementation

     

    public interface IManaHandler {
    int getMana();
    int getMaxMana();
    void setMana(int mana);
    void setMaxMana(int maxMana);
    boolean consumeMana(int mana);
    boolean regenerateMana(int mana);	
    }
    
    public class ManaHandler implements IManaHandler, INBTSerializable<NBTTagCompound>{
    
    private int mana, maxMana;
    
    public ManaHandler(int maxMana, int mana) {
    	this.mana = mana;
    	this.maxMana = maxMana;
    }
    
    public ManaHandler() {
    	this(100,100);
    }
    
    
    @Override
    public NBTTagCompound serializeNBT() {
    	NBTTagCompound compound = new NBTTagCompound();
    	compound.setInteger("mana", getMana());
        	compound.setInteger("maxmana", getMaxMana());
        	System.out.println("saving cap");
        	return compound;
       }
    
    @Override
    public void deserializeNBT(NBTTagCompound compound) {
    	setMana(compound.getInteger("mana"));
        	setMaxMana(compound.getInteger("maxmana"));
        
    }
    
    
    @Override
    public boolean consumeMana(int mana) {
    	if(this.mana<mana) return false;
    	this.mana-=mana;
    	return true;
    }
    
    
    
    @Override
    public boolean regenerateMana(int mana) {
    	if(this.mana==maxMana) return false;
    	else {
    		this.mana +=mana;
    		if(this.mana>maxMana)this.mana=maxMana;
    		return true;
    	}
    }
    
    
    
    
    
    
    @Override
    public int getMana() {
    	return mana;
    }
    
    @Override
    public int getMaxMana() {
    
    return maxMana;
    }
    
    @Override
    public void setMana(int mana) {
    	this.mana = mana;
    }
    
    @Override
    public void setMaxMana(int maxMana) {
    	this.maxMana =maxMana;
    }
    
    

  3. There is no crash log, but i take the advice

     

     

     

      @Override

      protected void onImpact(MovingObjectPosition movingobjectposition) {

              if (movingobjectposition.entityHit != null)

              {

                  if (movingobjectposition.entityHit instanceof EntityLivingBase) {

                  EntityLivingBase entity= (EntityLivingBase)movingobjectposition.entityHit;

                  entity.heal(4.0F);

                  }

              }

      }

     

     

    Remove it, I realized diesieben is right and I missed a part. If your mod is crashing in mp only your proxies are probbly broken

×
×
  • Create New...

Important Information

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