Posted January 15, 201510 yr I'm using a static boolean that says to the model class when the entity shot, this because into the model class I can set "aimedBow" only when the entity is shooting. Now when I setted "not static" the variable "isShooting" the model class cant recognizes the value even if changed.... also using the "get" function: Entity.class private static boolean isShooting = false; protected void updateAITasks() { super.updateAITasks(); if (this.getHeldItem() != null && !this.isSitting()) { if (this.getAttackTarget() != null) { this.isShooting = true; } else { this.isShooting = false; } } } protected boolean getShooting() { return this.isShooting; } Model.class public void setLivingAnimations(EntityLivingBase p_78086_1_, float p_78086_2_, float p_78086_3_, float p_78086_4_) { this.aimedBow = (((EntityWizard)p_78086_1_).getShooting()); super.setLivingAnimations(p_78086_1_, p_78086_2_, p_78086_3_, p_78086_4_); } Render.class public class RenderWizard extends RenderBiped { private static final ResourceLocation relaxWizardTexture = new ResourceLocation("mymod:textures/families/wizard.png"); private static final ResourceLocation tamedWizardTexture = new ResourceLocation("mymod:textures/families/wizard_tamed.png"); public RenderWizard(ModelBiped wizard, float par2) { super(wizard, par2); } protected ResourceLocation getEntityTexture(EntityWizard p_110775_1_) { //return p_110775_1_.isTamed() ? tamedWizardTexture : (p_110775_1_.isAngry() ? tamedWizardTexture : relaxWizardTexture); return p_110775_1_.isTamed() ? relaxWizardTexture : relaxWizardTexture; } protected ResourceLocation getEntityTexture(Entity entity) { return this.getEntityTexture((EntityWizard)entity); } protected ResourceLocation getEntityTexture(EntityLiving entity) { return this.getEntityTexture((EntityWizard)entity); } } If the variable "isShooting" is "not static" the model.class get "isShooting" always = false even if changed ... If the variable "isShooting" is "static" ALL entities instance are "aimedBow" synchronized ...
January 15, 201510 yr It's always false because you only set its value on the server side (or possibly getAttackTarget is always null on the client). Anyway, you don't want to use static as you already discovered; instead, you need to send a packet to the client with the current state of the 'isShooting' field for the given entity. Alternatively, you can store the boolean value in DataWatcher instead, which will handle the packet bit for you. http://i.imgur.com/NdrFdld.png[/img]
January 15, 201510 yr If the variable "isShooting" is "static" ALL entities instance are "aimedBow" synchronized ... http://lmgtfy.com/?q=java+static Follow my mod(s) here: http://www.minecraftforum.net/topic/1969694-
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.