perromercenary00
Members-
Posts
849 -
Joined
-
Last visited
-
Days Won
5
Everything posted by perromercenary00
-
good nigths i been working in some zombies and i want this two zombies to spawn in same amount and same places than vainilla zombies but du not know the rigth values , i now its some where in references library but dont find it can someone tell what the values for the vainilla zombie are values im currently using but the spawn is less than espected if (this.zombie){ EntityRegistry.addSpawn(mercenarymod.entidades.hostiles.zombieMercenario.class, 60, 1, 10, EnumCreatureType.MONSTER, allBiomes); } if (this.zombieR){ EntityRegistry.addSpawn(mercenarymod.entidades.hostiles.zombieMercenarioE.class, 80, 1, 10, EnumCreatureType.MONSTER, allBiomes); }
-
well i never before play whith iterators and this seem to be not working coz i dont have any output in the console even there is any errors public zombieMercenario_render(RenderManager rm) { //, ModelBipedMercenary model, float shadowSize //super( rm , new ModelBipedGreen(), 0.5F ); super( rm , new ModelBipedWoman(), 0.5F ); Iterator iterator = this.layerRenderers.iterator(); System.out.println("### iterator="+iterator.toString() ); while (iterator.hasNext()) { LayerRenderer layerrenderer = (LayerRenderer)iterator.next(); System.out.println("### LS="+layerrenderer.toString() ); } List lista = this.layerRenderers; int ls = lista.size(); System.out.println("### ls ="+ls); //this.addLayer(new LayerHeldItemM(this)); //this.addLayer(new LayerBipedArmor(this) ); //this.addLayer(new LayerHeldItem(this)); //this.addLayer(new LayerArrow(this)); } anyway soo there is another this.addLayer(new LayerHeldItem(this)) was not aware of i founded in one of the RenderBiped constructors, so i create an custome RenderBipedM whithout this ands done there is no more two guns render only the mine well it gona take me some time to make all the changes to send the values i need in every case to this custome LayerHeldItemM soo thanks is fixed
-
good days this little thing puzless me coz i alredy solve some thing more complex and now im stuck here dont see where to go anyway i create a customeModel for mi female entityes extending model biped, way i could set the size of the entity soo i could create little people or big, thets works but armor and weapons/items dont mach the size of the entity, so i create a custom LayerHeldItemM.class but i been having troubles seting the rigth hand item position. http://s27.postimg.org/o33sa9phv/Pantallazo_27.png http://s27.postimg.org/o33sa9phv/Pantallazo_27.png[/img] to ovious step would be to change the translation values in the line 55 of mi layerItem to match the model but this generates a second gun in the right position, but the first gun remains in the default position http://s27.postimg.org/sh32umlar/Pantallazo_28.png http://s27.postimg.org/sh32umlar/Pantallazo_28.png[/img] can tell mi where is this first gun coming how i delete it or at least move it to mach the other position once i done whith this one i gona make a custome LayerBipedArmor(this) thanks for reading package mercenarymod.entidades; import net.minecraft.block.Block; import net.minecraft.client.Minecraft; import net.minecraft.client.model.ModelBiped; import net.minecraft.client.renderer.GlStateManager; import net.minecraft.client.renderer.block.model.ItemCameraTransforms; import net.minecraft.client.renderer.entity.RendererLivingEntity; import net.minecraft.client.renderer.entity.layers.LayerRenderer; import net.minecraft.entity.EntityLivingBase; import net.minecraft.entity.player.EntityPlayer; import net.minecraft.init.Items; import net.minecraft.item.Item; import net.minecraft.item.ItemBlock; import net.minecraft.item.ItemStack; import net.minecraftforge.fml.relauncher.Side; import net.minecraftforge.fml.relauncher.SideOnly; @SideOnly(Side.CLIENT) public class LayerHeldItemM implements LayerRenderer { private final RendererLivingEntity field_177206_a; private static final String __OBFID = "CL_00002416"; private float alt = 0.0F; public LayerHeldItemM(RendererLivingEntity p_i46115_1_) { this.field_177206_a = p_i46115_1_; } public void doRenderLayer(EntityLivingBase p_177141_1_, float p_177141_2_, float p_177141_3_, float p_177141_4_, float p_177141_5_, float p_177141_6_, float p_177141_7_, float p_177141_8_) { ItemStack itemstack = p_177141_1_.getHeldItem(); alt = 0.5F; if (itemstack != null) { GlStateManager.pushMatrix(); if (this.field_177206_a.getMainModel().isChild) { float f7 = 0.5F; GlStateManager.translate(0.0F, 0.625F, 0.0F); GlStateManager.rotate(-20.0F, -1.0F, 0.0F, 0.0F); GlStateManager.scale(f7, f7, f7); } ((ModelBipedWoman)this.field_177206_a.getMainModel()).postRenderArm(0.0625F); GlStateManager.translate(-0.0625F + (alt / 4) , 0.4375F, 0.0625F + alt );//<<< linea 55 >>> //GlStateManager.translate(-0.0625F, 0.4375F, 0.0625F );//<<< if (p_177141_1_ instanceof EntityPlayer && ((EntityPlayer)p_177141_1_).fishEntity != null) { itemstack = new ItemStack(Items.fishing_rod, 0); } Item item = itemstack.getItem(); Minecraft minecraft = Minecraft.getMinecraft(); if (item instanceof ItemBlock && Block.getBlockFromItem(item).getRenderType() == 2) { GlStateManager.translate(0.0F, 0.1875F, -0.3125F); GlStateManager.rotate(20.0F, 1.0F, 0.0F, 0.0F); GlStateManager.rotate(45.0F, 0.0F, 1.0F, 0.0F); float f8 = 0.375F; GlStateManager.scale(-f8, -f8, f8); } minecraft.getItemRenderer().renderItem(p_177141_1_, itemstack, ItemCameraTransforms.TransformType.THIRD_PERSON); GlStateManager.popMatrix(); } //GlStateManager.translate(0, 0, 0.0 + 0.5F ); } public boolean shouldCombineTextures() { return false; } } package mercenarymod.entidades; import mercenarymod.entidades.hostiles.zombieMercenario; import net.minecraft.client.model.ModelBase; import net.minecraft.client.model.ModelBiped; import net.minecraft.client.model.ModelRenderer; import net.minecraft.client.renderer.GlStateManager; import net.minecraft.entity.DataWatcher; import net.minecraft.entity.Entity; import net.minecraft.util.MathHelper; import net.minecraftforge.fml.relauncher.Side; import net.minecraftforge.fml.relauncher.SideOnly; @SideOnly(Side.CLIENT) public class ModelBipedWoman extends ModelBiped { //tenctacles public ModelRenderer biPhalous_A00; public ModelRenderer biPhalous_A01; public ModelRenderer biPhalous_A02; public ModelRenderer biPhalous_B00; public ModelRenderer biPhalous_B01; public ModelRenderer biPhalous_B02; public ModelRenderer biPhalous_C00; public ModelRenderer biPhalous_C01; public ModelRenderer biPhalous_C02; public ModelRenderer biPhalous_D00; public ModelRenderer biPhalous_D01; public ModelRenderer biPhalous_D02; public ModelRenderer bipedHead; /** The Biped's Headwear. Used for the outer layer of player skins. */ public ModelRenderer bipedHeadwear; public ModelRenderer bipedBody; //public ModelRenderer bipedBoobs; /** The Biped's Right Arm */ public ModelRenderer bipedRightArm; /** The Biped's Left Arm */ public ModelRenderer bipedLeftArm; /** The arms of the VillagerModel */ public ModelRenderer villagerArms; /** The arms of the el simbolo de exclamacion */ public ModelRenderer exclamacion; /** The Biped's Right Leg */ public ModelRenderer bipedRightLeg; /** The Biped's Left Leg */ public ModelRenderer bipedLeftLeg; /** Records whether the model should be rendered holding an item in the left hand, and if that item is a block. */ public int heldItemLeft = 0; /** Records whether the model should be rendered holding an item in the right hand, and if that item is a block. */ public int heldItemRight = 0; public int offset = 0; public boolean isSneak; /** Records whether the model should be rendered aiming a bow. */ public boolean aimedBow; public boolean isVillagin = false; //villagerArms public boolean isZombye = false; //zombyeArms public boolean isRiding = false; public boolean hasTentacules = false; public boolean exclamacionIcono = true; private int tamaño = 4; private float alt = 0.0F; // private float swingProgress = -10000.0F; private float swingProgress = -10000.0F; private final String __OBFID = "CL_00000840"; public ModelBipedWoman() { this(0.0F); } public ModelBipedWoman(float p_i1148_1_) { this(p_i1148_1_, 0.0F, 64, 32); } public ModelBipedWoman(float p_i1149_1_, float p_i1149_2_, int p_i1149_3_, int p_i1149_4_) { this.textureWidth = 64;//p_i1149_3_ this.textureHeight = 64;//p_i1149_4_ this.bipedHead = new ModelRenderer(this, 0, 0); this.bipedHead.setTextureOffset(0, 0).addBox(-4.0F, -8.0F, -4.0F, 8, 8, 8, p_i1149_1_); this.bipedHead.setRotationPoint(0.0F, 0.0F + p_i1149_2_, 0.0F); this.bipedHeadwear = new ModelRenderer(this, 32, 0); this.bipedHeadwear.addBox(-4.0F, -8.0F, -4.0F, 8, 8, 8, p_i1149_1_ + 0.5F); this.bipedHeadwear.setRotationPoint(0.0F, 0.0F + p_i1149_2_, 0.0F); this.bipedBody = new ModelRenderer(this, 16, 16); this.bipedBody.addBox(-4.0F, 0.0F, -2.0F, 8, 12, 4, p_i1149_1_); this.bipedBody.setTextureOffset(44, 58).addBox(-3.5F, 1.0F, -3.0F, 7, 3, 3, p_i1149_1_); this.bipedBody.setTextureOffset( 0, 32).addBox(-4.5F, 10.0F, -2.5F, 9, 10, 5, p_i1149_1_); this.bipedBody.setRotationPoint(0.0F, 0.0F + p_i1149_2_, 0.0F); this.bipedRightArm = new ModelRenderer(this, 40, 16); this.bipedRightArm.addBox(-2.0F, -2.0F, -2.0F, 3, 12, 4, p_i1149_1_); this.bipedRightArm.setRotationPoint(-5.0F, 2.0F + p_i1149_2_, 0.0F); this.bipedLeftArm = new ModelRenderer(this, 40, 16); this.bipedLeftArm.mirror = true; this.bipedLeftArm.addBox(-1.0F, -2.0F, -2.0F, 3, 12, 4, p_i1149_1_); this.bipedLeftArm.setRotationPoint(5.0F, 2.0F + p_i1149_2_, 0.0F); this.villagerArms = new ModelRenderer(this, 0, 0); this.villagerArms.setRotationPoint(0.0F, 0.0F + p_i1149_2_ + 2.0F, 0.0F); this.villagerArms.setTextureOffset(40, 16).addBox(-7.0F, -2.0F, -2.0F, 3, 8, 4, p_i1149_1_); this.villagerArms.setTextureOffset(40, 16).addBox( 4.0F, -2.0F, -2.0F, 3, 8, 4, p_i1149_1_); this.villagerArms.setTextureOffset( 0, 56).addBox(-4.0F, 3.0F, -2.0F, 8, 3, 4, p_i1149_1_); this.exclamacion = new ModelRenderer(this, 0, 0); this.exclamacion.setTextureOffset(32, 34).addBox(-4.0F, -18.0F, 0.0F, 8, 8, 1, p_i1149_1_); this.exclamacion.setRotationPoint(0.0F, 0.0F, 0.0F); //this.bipedHead.addChild(exclamacion); //########## tentaculos //(40, 16) this.biPhalous_A00 = new ModelRenderer(this, 0, 0); this.biPhalous_A00.setTextureOffset(56, 16).addBox(-0.5F, -15.0F, 0.5F, 1, 16, 1, p_i1149_1_); this.biPhalous_A00.setRotationPoint(0.0F, 0.0F + p_i1149_2_, 0.0F); this.biPhalous_A01 = new ModelRenderer(this, 0, 0); this.biPhalous_A01.setTextureOffset(56, 16).addBox(-0.5F, -15.0F, 0.5F, 1, 16, 1, p_i1149_1_); this.biPhalous_A01.setRotationPoint(0.0F, -15.0F , 0.0F); this.biPhalous_A02 = new ModelRenderer(this, 0, 0); this.biPhalous_A02.setTextureOffset(56, 16).addBox(-0.5F, -15.0F, 0.5F, 1, 16, 1, p_i1149_1_); this.biPhalous_A02.setRotationPoint(0.0F, -15.0F, 0.0F); this.bipedHead.addChild(biPhalous_A00); this.biPhalous_A00.addChild(biPhalous_A01); this.biPhalous_A01.addChild(biPhalous_A02); this.biPhalous_B00 = new ModelRenderer(this, 0, 0); this.biPhalous_B00.setTextureOffset(56, 16).addBox(-2.5F, -15.0F, 0.0F, 1, 16, 1, p_i1149_1_); this.biPhalous_B00.setRotationPoint(0.0F, 0.0F + p_i1149_2_, 0.0F); this.biPhalous_B01 = new ModelRenderer(this, 0, 0); this.biPhalous_B01.setTextureOffset(56, 16).addBox(-2.5F, -15.0F, 0.0F, 1, 16, 1, p_i1149_1_); this.biPhalous_B01.setRotationPoint(0.0F, -15.0F , 0.0F); this.biPhalous_B02 = new ModelRenderer(this, 0, 0); this.biPhalous_B02.setTextureOffset(56, 16).addBox(-2.5F, -15.0F, 0.0F, 1, 16, 1, p_i1149_1_); this.biPhalous_B02.setRotationPoint(0.0F, -15.0F, 0.0F); this.bipedHead.addChild(biPhalous_B00); this.biPhalous_B00.addChild(biPhalous_B01); this.biPhalous_B01.addChild(biPhalous_B02); this.biPhalous_C00 = new ModelRenderer(this, 0, 0); this.biPhalous_C00.setTextureOffset(56, 16).addBox(2.0F, -15.0F, 0.0F, 1, 16, 1, p_i1149_1_); this.biPhalous_C00.setRotationPoint(0.0F, 0.0F + p_i1149_2_, 0.0F); this.biPhalous_C01 = new ModelRenderer(this, 0, 0); this.biPhalous_C01.setTextureOffset(56, 16).addBox(2.0F, -15.0F, 0.0F, 1, 16, 1, p_i1149_1_); this.biPhalous_C01.setRotationPoint(0.0F, -15.0F , 0.0F); this.biPhalous_C02 = new ModelRenderer(this, 0, 0); this.biPhalous_C02.setTextureOffset(56, 16).addBox(2.0F, -15.0F, 0.0F, 1, 16, 1, p_i1149_1_); this.biPhalous_C02.setRotationPoint(0.0F, -15.0F, 0.0F); this.bipedHead.addChild(biPhalous_C00); this.biPhalous_C00.addChild(biPhalous_C01); this.biPhalous_C01.addChild(biPhalous_C02); this.biPhalous_D00 = new ModelRenderer(this, 0, 0); this.biPhalous_D00.setTextureOffset(56, 16).addBox( 0.5F, -15.0F, -0.5F, 1, 16, 1, p_i1149_1_); this.biPhalous_D00.setRotationPoint(0.0F, 0.0F + p_i1149_2_, 0.0F); this.biPhalous_D01 = new ModelRenderer(this, 0, 0); this.biPhalous_D01.setTextureOffset(56, 16).addBox( 0.5F, -15.0F, -0.5F, 1, 16, 1, p_i1149_1_); this.biPhalous_D01.setRotationPoint(0.0F, -15.0F , 0.0F); this.biPhalous_D02 = new ModelRenderer(this, 0, 0); this.biPhalous_D02.setTextureOffset(56, 16).addBox( 0.5F, -15.0F, -0.5F, 1, 16, 1, p_i1149_1_); this.biPhalous_D02.setRotationPoint(0.0F, -15.0F, 0.0F); this.bipedHead.addChild(biPhalous_D00); this.biPhalous_D00.addChild(biPhalous_D01); this.biPhalous_D01.addChild(biPhalous_D02); this.bipedRightLeg = new ModelRenderer(this, 0, 16); this.bipedRightLeg.addBox(-2.0F, 0.0F, -2.0F, 4, 12, 4, p_i1149_1_); this.bipedRightLeg.setRotationPoint(-1.9F, 12.0F + p_i1149_2_, 0.0F); this.bipedLeftLeg = new ModelRenderer(this, 0, 16); this.bipedLeftLeg.mirror = true; this.bipedLeftLeg.addBox(-2.0F, 0.0F, -2.0F, 4, 12, 4, p_i1149_1_); this.bipedLeftLeg.setRotationPoint(1.9F, 12.0F + p_i1149_2_, 0.0F); } /** * Sets the models various rotation angles then renders the model. */ @Override public void render(Entity merEntity, float p_78088_2_, float p_78088_3_, float p_78088_4_, float p_78088_5_, float p_78088_6_, float p_78088_7_) { //System.out.println("render()"); this.setRotationAngles(p_78088_2_, p_78088_3_, p_78088_4_, p_78088_5_, p_78088_6_, p_78088_7_, merEntity); GlStateManager.pushMatrix(); if (this.isChild) { float f6 = 2.0F; GlStateManager.scale(1.5F / f6, 1.5F / f6, 1.5F / f6); GlStateManager.translate(0.0F, 16.0F * p_78088_7_, 0.0F); this.bipedHead.render(p_78088_7_); GlStateManager.popMatrix(); GlStateManager.pushMatrix(); GlStateManager.scale(1.0F / f6, 1.0F / f6, 1.0F / f6); GlStateManager.translate(0.0F, 24.0F * p_78088_7_, 0.0F); this.exclamacion.render(p_78088_7_); this.bipedBody.render(p_78088_7_); this.bipedRightArm.render(p_78088_7_); this.bipedLeftArm.render(p_78088_7_); this.bipedRightLeg.render(p_78088_7_); this.bipedLeftLeg.render(p_78088_7_); this.bipedHeadwear.render(p_78088_7_); this.biPhalous_A00.render(p_78088_7_); this.biPhalous_B00.render(p_78088_7_); this.biPhalous_C00.render(p_78088_7_); this.biPhalous_D00.render(p_78088_7_); } else { if (merEntity instanceof mobMercenario ){ mobMercenario merc = (mobMercenario) merEntity; this.aimedBow = merc.getAimedBow(); //this.tamaño = merc.getTamaño(); } if (merEntity instanceof zombieMercenario ){ zombieMercenario merc = (zombieMercenario) merEntity; this.isRiding = merc.getIsRiding(); this.tamaño = merc.getTamaño(); } float f6 = 0.0F ;//tamaño/10 ; alt = 0.0F; switch(tamaño) { //1.5M case 1:{ f6 = 0.75F ; alt = 0.5F ; };break; //1.624M case 2:{ f6 = 0.812F ; alt = 0.4F ; };break; //1.75M case 3:{ f6 = 0.875F ; alt = 0.2F ; };break; //1.87M case 4:{ f6 = 0.9375F; alt = 0.05F ; };break; //2.00M default:{ f6 = 1.0F ; alt = 0.00F ; };break; //2.25M case 6:{ f6 = 1.125F ; alt = -0.15F; };break; //2.5M case 7:{ f6 = 1.25F ; alt = -0.3F ; };break; //3.0M case 8:{ f6 = 1.5F ; alt = -0.5F ; };break; //4.M case 9:{ f6 = 2.00F ; alt = -0.75F; };break; //7M case 10:{ f6 = 3.5F ; alt = -1.00F; };break; } GlStateManager.scale(1.0F * f6, 1.0F * f6, 1.0F * f6); GlStateManager.translate(0.0F, alt , 0.0F); if (merEntity.isSneaking()) { GlStateManager.translate(0.0F, alt + 0.2F, 0.0F); } this.exclamacion.render(p_78088_7_); this.bipedHead.render(p_78088_7_); this.bipedBody.render(p_78088_7_); //this.bipedBoobs.render(p_78088_7_); this.bipedRightArm.render(p_78088_7_); this.bipedLeftArm.render(p_78088_7_); this.villagerArms.render(p_78088_7_); this.bipedRightLeg.render(p_78088_7_); this.bipedLeftLeg.render(p_78088_7_); this.bipedHeadwear.render(p_78088_7_); this.biPhalous_A00.render(p_78088_7_); this.biPhalous_B00.render(p_78088_7_); this.biPhalous_C00.render(p_78088_7_); this.biPhalous_D00.render(p_78088_7_); } GlStateManager.popMatrix(); } /** * Sets the model's various rotation angles. For bipeds, par1 and par2 are used for animating the movement of arms * and legs, where par1 represents the time(so that arms and legs swing back and forth) and par2 represents how * "far" arms and legs can swing at most. */ public void setRotationAngles(float p_78087_1_, float p_78087_2_, float p_78087_3_, float p_78087_4_, float p_78087_5_, float p_78087_6_, Entity merEntity) { if (merEntity instanceof mobMercenario ){ mobMercenario merc = (mobMercenario) merEntity; this.aimedBow = merc.getAimedBow(); this.isSneak = merc.getIsSneak(); this.isVillagin = merc.getIsVillagin(); this.isZombye = merc.getIsZombye(); this.heldItemRight = merc.getHeldItemRight(); this.heldItemLeft = merc.getHeldItemLeft(); this.swingProgress = merc.getSwingProgress(); this.isRiding = merc.getIsRiding(); this.hasTentacules = merc.hasTentacules(); } if (merEntity instanceof zombieMercenario ){ zombieMercenario merc = (zombieMercenario) merEntity; this.aimedBow = merc.getAimedBow(); this.isSneak = merc.getIsSneak(); this.isVillagin = merc.getIsVillagin(); this.isZombye = merc.getIsZombye(); this.heldItemRight = merc.getHeldItemRight(); this.heldItemLeft = merc.getHeldItemLeft(); this.swingProgress = merc.getSwingProgress(); this.isRiding = merc.getIsRiding(); this.hasTentacules = merc.hasTentacules(); this.exclamacionIcono = merc.getExclamacion() ; } if (this.exclamacionIcono){ this.exclamacion.showModel = true; float g1 = (( (p_78087_3_ % 20) / 3) ) ; this.exclamacion.rotateAngleX = 0.0F; this.exclamacion.rotateAngleY = g1 ; this.exclamacion.rotateAngleZ = 0.0F; } else { this.exclamacion.showModel = false; } //Villager Arms if (this.isVillagin){ //this.bipedHead.showModel = invisible; //this.bipedHeadwear.showModel = invisible; this.bipedRightArm.showModel = false; this.bipedLeftArm.showModel = false; this.villagerArms.showModel = true; } else { this.bipedRightArm.showModel = true; this.bipedLeftArm.showModel = true; this.villagerArms.showModel = false; } this.villagerArms.rotationPointY = 3.0F; this.villagerArms.rotationPointZ = -1.0F; this.villagerArms.rotateAngleX = -0.75F; this.bipedHead.rotateAngleY = p_78087_4_ / (180F / (float)Math.PI); this.bipedHead.rotateAngleX = p_78087_5_ / (180F / (float)Math.PI); this.bipedRightLeg.rotateAngleX = MathHelper.cos(p_78087_1_ * 0.6662F) * 1.4F * p_78087_2_; this.bipedLeftLeg.rotateAngleX = MathHelper.cos(p_78087_1_ * 0.6662F + (float)Math.PI) * 1.4F * p_78087_2_; this.bipedRightLeg.rotateAngleY = 0.0F; this.bipedLeftLeg.rotateAngleY = 0.0F; // tentaculos if (this.hasTentacules){ this.heldItemLeft = 0; this.heldItemRight = 0; float g1 = 0.0F; float g2 = 0.0F; float g3 = 0.0F; float x = 0.0F; float cx = 0.0F; float z = 0.0F; float amplitud = 0.75F; g1 = (( (p_78087_3_ % 20) ) ) ; /* g1 = g1 + offset; if (g1 > 20) { g1 = g1 - 20; } */ g3 = (( (p_78087_3_ % 60) / 10 ) - 3.0F ) ; if ((p_78087_3_ % 20) == 0) { ////System.out.println( "Cos="+ MathHelper.cos(g1) ); } if (g1 < 11) { g1 = ((g1 - 5) * 2) / 10; } else { g1 = ((g1 - 15) * -2) / 10; } if (this.swingProgress > -1) { g2 =( this.swingProgress * 10); } ////System.out.println( "g1="+g1 ); x = g1 * (amplitud); cx = MathHelper.cos(g1) * (amplitud); z = (g1 * (amplitud)) / 2; this.bipedHead.showModel = false; this.bipedHeadwear.showModel = false; //this.villagerArms.showModel = false; this.biPhalous_A00.showModel = true; //this.biPhalous_A01.showModel = true; //this.biPhalous_A02.showModel = true; this.biPhalous_B00.showModel = true; //this.biPhalous_B01.showModel = true; //this.biPhalous_B02.showModel = true; this.biPhalous_C00.showModel = true; //this.biPhalous_C01.showModel = true; //this.biPhalous_C02.showModel = true; this.biPhalous_D00.showModel = true; //this.biPhalous_D01.showModel = true; //this.biPhalous_D02.showModel = true; this.biPhalous_A00.rotateAngleX = x; this.biPhalous_A00.rotateAngleY = g3 ; this.biPhalous_A00.rotateAngleZ = z; this.biPhalous_A01.rotateAngleX = x; this.biPhalous_A01.rotateAngleY = 0.0F; this.biPhalous_A01.rotateAngleZ = z; this.biPhalous_A02.rotateAngleX = x; this.biPhalous_A02.rotateAngleY = 0.0F; this.biPhalous_A02.rotateAngleZ = z; this.biPhalous_B00.rotateAngleX = x - 0.2F; this.biPhalous_B00.rotateAngleY = g3 + 0.33F; this.biPhalous_B00.rotateAngleZ = z - 0.2F; this.biPhalous_B01.rotateAngleX = x - 0.2F; this.biPhalous_B01.rotateAngleY = 0.0F; this.biPhalous_B01.rotateAngleZ = z - 0.2F; this.biPhalous_B02.rotateAngleX = x - 0.2F; this.biPhalous_B02.rotateAngleY = 0.0F; this.biPhalous_B02.rotateAngleZ = z - 0.2F; this.biPhalous_C00.rotateAngleX = cx + 0.1F; this.biPhalous_C00.rotateAngleY = g3 - 0.33F; this.biPhalous_C00.rotateAngleZ = z + 0.1F; this.biPhalous_C01.rotateAngleX = cx + 0.1F; this.biPhalous_C01.rotateAngleY = 0.0F; this.biPhalous_C01.rotateAngleZ = z + 0.1F; this.biPhalous_C02.rotateAngleX = cx + 0.1F; this.biPhalous_C02.rotateAngleY = 0.0F; this.biPhalous_C02.rotateAngleZ = z + 0.1F; this.biPhalous_D00.rotateAngleX = cx * -1; this.biPhalous_D00.rotateAngleY = g3 * 2; this.biPhalous_D00.rotateAngleZ = z * -1; this.biPhalous_D01.rotateAngleX = cx * -1; this.biPhalous_D01.rotateAngleY = 0.0F; this.biPhalous_D01.rotateAngleZ = z * -1; this.biPhalous_D02.rotateAngleX = cx * -1; this.biPhalous_D02.rotateAngleY = 0.0F; this.biPhalous_D02.rotateAngleZ = z * -1; if (this.swingProgress > -1) { g2 =( this.swingProgress + 1); this.biPhalous_A00.rotateAngleX = x + g2; this.biPhalous_A00.rotateAngleY = g3 / 10; this.biPhalous_A00.rotateAngleZ = z; this.biPhalous_B00.rotateAngleX = (x - 0.2F) + g2; this.biPhalous_B00.rotateAngleY = ( g3 + 0.33F ) / 10; this.biPhalous_B00.rotateAngleZ = z - 0.2F; this.biPhalous_C00.rotateAngleX = (cx + 0.1F) + g2; this.biPhalous_C00.rotateAngleY = ( g3 - 0.33F ) / 10; this.biPhalous_C00.rotateAngleZ = z + 0.1F; this.biPhalous_D00.rotateAngleX = (cx * -1) + g2; this.biPhalous_D00.rotateAngleY = ( g3 * 2 ) / 10; this.biPhalous_D00.rotateAngleZ = z * -1; } //////System.out.println("\n\n"); //////System.out.println("X="+this.bipedHead.rotateAngleX); //////System.out.println("Y="+this.bipedHead.rotateAngleY); //////System.out.println("\n\n"); } else { this.biPhalous_A00.showModel = false; this.biPhalous_B00.showModel = false; this.biPhalous_C00.showModel = false; this.biPhalous_D00.showModel = false; this.bipedHead.showModel = true; this.bipedHeadwear.showModel = true; } //Zombye arms if (this.isZombye){ this.heldItemLeft = 0; this.heldItemRight = 0; float f6 = MathHelper.sin(this.swingProgress * (float)Math.PI); float f7 = MathHelper.sin((1.0F - (1.0F - this.swingProgress) * (1.0F - this.swingProgress)) * (float)Math.PI); this.bipedRightArm.rotateAngleZ = 0.0F; this.bipedLeftArm.rotateAngleZ = 0.0F; this.bipedRightArm.rotateAngleY = -(0.1F - f6 * 0.6F); this.bipedLeftArm.rotateAngleY = 0.1F - f6 * 0.6F; this.bipedRightArm.rotateAngleX = -((float)Math.PI / 2F); this.bipedLeftArm.rotateAngleX = -((float)Math.PI / 2F); this.bipedRightArm.rotateAngleX -= f6 * 1.2F - f7 * 0.4F; this.bipedLeftArm.rotateAngleX -= f6 * 1.2F - f7 * 0.4F; this.bipedRightArm.rotateAngleZ += MathHelper.cos(p_78087_3_ * 0.09F) * 0.05F + 0.05F; this.bipedLeftArm.rotateAngleZ -= MathHelper.cos(p_78087_3_ * 0.09F) * 0.05F + 0.05F; this.bipedRightArm.rotateAngleX += MathHelper.sin(p_78087_3_ * 0.067F) * 0.05F; this.bipedLeftArm.rotateAngleX -= MathHelper.sin(p_78087_3_ * 0.067F) * 0.05F; } else { this.bipedRightArm.rotateAngleX = MathHelper.cos(p_78087_1_ * 0.6662F + (float)Math.PI) * 2.0F * p_78087_2_ * 0.5F; this.bipedLeftArm.rotateAngleX = MathHelper.cos(p_78087_1_ * 0.6662F) * 2.0F * p_78087_2_ * 0.5F; this.bipedRightArm.rotateAngleZ = 0.0F; this.bipedLeftArm.rotateAngleZ = 0.0F; } if (this.isRiding) { this.bipedRightArm.rotateAngleX += -((float)Math.PI / 5F); this.bipedLeftArm.rotateAngleX += -((float)Math.PI / 5F); this.bipedRightLeg.rotateAngleX = -((float)Math.PI * 2F / 5F); this.bipedLeftLeg.rotateAngleX = -((float)Math.PI * 2F / 5F); this.bipedRightLeg.rotateAngleY = ((float)Math.PI / 10F); this.bipedLeftLeg.rotateAngleY = -((float)Math.PI / 10F); } if (this.heldItemLeft != 0) { this.bipedLeftArm.rotateAngleX = this.bipedLeftArm.rotateAngleX * 0.5F - ((float)Math.PI / 10F) * (float)this.heldItemLeft; } this.bipedRightArm.rotateAngleY = 0.0F; this.bipedRightArm.rotateAngleZ = 0.0F; switch (this.heldItemRight) { case 0: case 2: default: break; case 1: this.bipedRightArm.rotateAngleX = this.bipedRightArm.rotateAngleX * 0.5F - ((float)Math.PI / 10F) * (float)this.heldItemRight; break; case 3: this.bipedRightArm.rotateAngleX = this.bipedRightArm.rotateAngleX * 0.5F - ((float)Math.PI / 10F) * (float)this.heldItemRight; this.bipedRightArm.rotateAngleY = -0.5235988F; } this.bipedLeftArm.rotateAngleY = 0.0F; float f6; float f7; if (this.swingProgress > -9990.0F & (!this.hasTentacules) ) { f6 = this.swingProgress; this.bipedBody.rotateAngleY = MathHelper.sin(MathHelper.sqrt_float(f6) * (float)Math.PI * 2.0F) * 0.2F; this.bipedRightArm.rotationPointZ = MathHelper.sin(this.bipedBody.rotateAngleY) * 5.0F; this.bipedRightArm.rotationPointX = -MathHelper.cos(this.bipedBody.rotateAngleY) * 5.0F; this.bipedLeftArm.rotationPointZ = -MathHelper.sin(this.bipedBody.rotateAngleY) * 5.0F; this.bipedLeftArm.rotationPointX = MathHelper.cos(this.bipedBody.rotateAngleY) * 5.0F; this.bipedRightArm.rotateAngleY += this.bipedBody.rotateAngleY; this.bipedLeftArm.rotateAngleY += this.bipedBody.rotateAngleY; this.bipedLeftArm.rotateAngleX += this.bipedBody.rotateAngleY; f6 = 1.0F - this.swingProgress; f6 *= f6; f6 *= f6; f6 = 1.0F - f6; f7 = MathHelper.sin(f6 * (float)Math.PI); float f8 = MathHelper.sin(this.swingProgress * (float)Math.PI) * -(this.bipedHead.rotateAngleX - 0.7F) * 0.75F; this.bipedRightArm.rotateAngleX = (float)((double)this.bipedRightArm.rotateAngleX - ((double)f7 * 1.2D + (double)f8)); this.bipedRightArm.rotateAngleY += this.bipedBody.rotateAngleY * 2.0F; this.bipedRightArm.rotateAngleZ += MathHelper.sin(this.swingProgress * (float)Math.PI) * -0.4F; } if (this.isSneak) { this.bipedBody.rotateAngleX = 0.5F; this.bipedRightArm.rotateAngleX += 0.4F; this.bipedLeftArm.rotateAngleX += 0.4F; this.bipedRightLeg.rotationPointZ = 4.0F; this.bipedLeftLeg.rotationPointZ = 4.0F; this.bipedRightLeg.rotationPointY = 9.0F; this.bipedLeftLeg.rotationPointY = 9.0F; this.bipedHead.rotationPointY = 1.0F; } else { this.bipedBody.rotateAngleX = 0.0F; this.bipedRightLeg.rotationPointZ = 0.1F; this.bipedLeftLeg.rotationPointZ = 0.1F; this.bipedRightLeg.rotationPointY = 12.0F; this.bipedLeftLeg.rotationPointY = 12.0F; this.bipedHead.rotationPointY = 0.0F; } this.bipedRightArm.rotateAngleZ += MathHelper.cos(p_78087_3_ * 0.09F) * 0.05F + 0.05F; this.bipedLeftArm.rotateAngleZ -= MathHelper.cos(p_78087_3_ * 0.09F) * 0.05F + 0.05F; this.bipedRightArm.rotateAngleX += MathHelper.sin(p_78087_3_ * 0.067F) * 0.05F; this.bipedLeftArm.rotateAngleX -= MathHelper.sin(p_78087_3_ * 0.067F) * 0.05F; if (this.aimedBow) { f6 = 0.0F; f7 = 0.0F; this.bipedRightArm.rotateAngleZ = 0.0F; this.bipedLeftArm.rotateAngleZ = 0.0F; this.bipedRightArm.rotateAngleY = -(0.1F - f6 * 0.6F) + this.bipedHead.rotateAngleY; this.bipedLeftArm.rotateAngleY = 0.1F - f6 * 0.6F + this.bipedHead.rotateAngleY + 0.4F; this.bipedRightArm.rotateAngleX = -((float)Math.PI / 2F) + this.bipedHead.rotateAngleX; this.bipedLeftArm.rotateAngleX = -((float)Math.PI / 2F) + this.bipedHead.rotateAngleX; this.bipedRightArm.rotateAngleX -= f6 * 1.2F - f7 * 0.4F; this.bipedLeftArm.rotateAngleX -= f6 * 1.2F - f7 * 0.4F; this.bipedRightArm.rotateAngleZ += MathHelper.cos(p_78087_3_ * 0.09F) * 0.05F + 0.05F; this.bipedLeftArm.rotateAngleZ -= MathHelper.cos(p_78087_3_ * 0.09F) * 0.05F + 0.05F; this.bipedRightArm.rotateAngleX += MathHelper.sin(p_78087_3_ * 0.067F) * 0.05F; this.bipedLeftArm.rotateAngleX -= MathHelper.sin(p_78087_3_ * 0.067F) * 0.05F; } copyModelAngles(this.bipedHead, this.bipedHeadwear); } public void setModelAttributes(ModelBase p_178686_1_) { super.setModelAttributes(p_178686_1_); if (p_178686_1_ instanceof ModelBipedWoman) { ModelBipedWoman modelbiped = (ModelBipedWoman)p_178686_1_; this.heldItemLeft = modelbiped.heldItemLeft; this.heldItemRight = modelbiped.heldItemRight; this.isSneak = modelbiped.isSneak; this.aimedBow = modelbiped.aimedBow; } } public void setInvisible(boolean invisible) { this.biPhalous_A00.showModel = invisible; this.biPhalous_A01.showModel = invisible; this.biPhalous_A02.showModel = invisible; this.bipedHead.showModel = invisible; this.bipedHeadwear.showModel = invisible; this.bipedBody.showModel = invisible; this.bipedRightArm.showModel = invisible; this.bipedLeftArm.showModel = invisible; this.bipedRightLeg.showModel = invisible; this.bipedLeftLeg.showModel = invisible; this.villagerArms.showModel = invisible; } @Override public void postRenderArm(float p_178718_1_) { this.bipedRightArm.postRender(p_178718_1_); } public float getAlt(){ return alt; } }
-
[1.8] set custom zombie Max health whithout crash it??
perromercenary00 replied to perromercenary00's topic in Modder Support
ñaaa magically it fix by itself and its working whithout displaying any error du not know what happen but hink i must leave this as solved Thanks for reading -
well actually not i set System.outs there and there soo i could see the values all the time, for thet is io make the other gui whith buttons and whith that gui i get the values i post before here is some trick needed or may the gui for the guns is wrong made or is missing something actually i think i need tu up something whith a super() to the gui class so it return me the right values of width and heigth
-
Good nigths lately i been doing this thi zombie is supoused to have 40F of healt the double of the normal zombie, and the change must happen wen remain betwin 75% and %50 of zombie health but whenever i try to set this value like i would duid whith any other mob the mob crash, whithout close the game only the zombie dont spawns i dont get way normaly i just set the health in the applyEntityAttributes method() but // ################################################################################################################# @Override protected void applyEntityAttributes() { super.applyEntityAttributes(); //health 40F this.getEntityAttribute(SharedMonsterAttributes.maxHealth).setBaseValue(40.0D); } it crash i dont spawn the mob
-
ohh ya coji la idea i just remember reading something about a custome EntityItem whith this i could just catch the EntityItem if is hotIron, store the values from the position the moving direction and the quantity of items in the stack then create a custom EntityItem just copy paste extend from original but whith code to check if in water kill the original and set the values to the custom and is done whiout trouble of overpopulating the chunk //########################################################################################################################3 // replace toss item @SubscribeEvent public void onPlayerToss(ItemTossEvent event) { if (event.entity instanceof EntityItem) { System.out.println("# Someone drops something"); EntityItem itm = (EntityItem) event.entity; ItemStack stack = itm.getEntityItem(); if (stack != null) { System.out.println("#1 is a"+stack.getUnlocalizedName()); if (stack.getItem() == MercenaryModItems.hierroAlrojo )// if stack is equal to my hot iron item { int amount = stack.stackSize; //create a custom EntityItem that checks if its in watter } } } } [16:39:53] [server thread/INFO] [sTDOUT]: [mercenarymod.items.armasdefuego.tickHandlerArmas:onEntityReplace:183]: # Someone drops something [16:39:53] [server thread/INFO] [sTDOUT]: [mercenarymod.items.armasdefuego.tickHandlerArmas:onEntityReplace:191]: #1 is afusilM4A1 [16:40:02] [server thread/INFO] [sTDOUT]: [mercenarymod.items.armasdefuego.tickHandlerArmas:onEntityReplace:183]: # Someone drops something [16:40:02] [server thread/INFO] [sTDOUT]: [mercenarymod.items.armasdefuego.tickHandlerArmas:onEntityReplace:191]: #1 is afusilM4A1 [16:40:04] [server thread/INFO] [sTDOUT]: [mercenarymod.items.armasdefuego.tickHandlerArmas:onEntityReplace:183]: # Someone drops something [16:40:04] [server thread/INFO] [sTDOUT]: [mercenarymod.items.armasdefuego.tickHandlerArmas:onEntityReplace:191]: #1 is aradioMercenaria [16:40:06] [server thread/INFO] [sTDOUT]: [mercenarymod.items.armasdefuego.tickHandlerArmas:onEntityReplace:183]: # Someone drops something [16:40:06] [server thread/INFO] [sTDOUT]: [mercenarymod.items.armasdefuego.tickHandlerArmas:onEntityReplace:191]: #1 is aitem.modmercenario_cuchillomercenario [16:40:08] [server thread/INFO] [sTDOUT]: [mercenarymod.items.armasdefuego.tickHandlerArmas:onEntityReplace:183]: # Someone drops something [16:40:08] [server thread/INFO] [sTDOUT]: [mercenarymod.items.armasdefuego.tickHandlerArmas:onEntityReplace:191]: #1 is aitem.monsterPlacer [16:40:09] [server thread/INFO] [sTDOUT]: [mercenarymod.items.armasdefuego.tickHandlerArmas:onEntityReplace:183]: # Someone drops something [16:40:09] [server thread/INFO] [sTDOUT]: [mercenarymod.items.armasdefuego.tickHandlerArmas:onEntityReplace:191]: #1 is aitem.monsterPlacer [16:40:10] [server thread/INFO] [sTDOUT]: [mercenarymod.items.armasdefuego.tickHandlerArmas:onEntityReplace:183]: # Someone drops something [16:40:10] [server thread/INFO] [sTDOUT]: [mercenarymod.items.armasdefuego.tickHandlerArmas:onEntityReplace:191]: #1 is aitem.monsterPlacer [16:40:13] [server thread/INFO] [sTDOUT]: [mercenarymod.items.armasdefuego.tickHandlerArmas:onEntityReplace:183]: # Someone drops something [16:40:13] [server thread/INFO] [sTDOUT]: [mercenarymod.items.armasdefuego.tickHandlerArmas:onEntityReplace:191]: #1 is aitem.monsterPlacer
-
uuu well sounds legit soo when the event onEntityConstructing(EntityConstructing event) trigers the EntityItem has not alredy been droped in the world and dont'n has yet the itemStack value defined thus always is a stone tile when i try to read it jummmm thas not good i can thing in something diferent to create an invisible entity to wacht over the dropped item wait a few ticks check if its hotIron check if its in water the kill it an create an aceroMercenario Item this entity solution dont's like me, much over having in count that i have create some tools that break masively blocks droping their contens so this cause to duply the amount of entityes in a place, and alredy only the droped blocks causes lag
-
well i have some mobs done based in the vainilla classes yesterday i set to fix a mising feature , mi mods dont'n make the swing animation when atack i fix that and becomes aware of a bug i wass not notice before in this video i set two subjets from the same class aldeanoMercenario00 that extends mobMercenario at the left subjet B has a knife as weapon, and to the right subjet A has an m4a1 rifle in the middle a wall to prevent the entityes to see eachother target -i set a target in way it only could be targeted by subjet A the one whith the fire gun subjet A only some of the times render the gun up aiming to target, as a bow but subjet B is raising his arms whith knife like he was the one shoothing the gun , subjet B must not do nothing cos he is not targetering the enemy much less whith the bow animation -now i set a target inside the fence of subjet B just to see him do the swing animation whith the knife, but he only shakes while atack, and the weird part is Subjet A the one whith rifle is doing the swing animation every time subjet B atack the target, i make this animation slow on the propourse of the video the animation instruccion get mixed in some part of the code and are reaching to the wrong entityes in the first i set as pulcrip static fields but actualy there is no static fields, i set the variables whith gets and sets soo idont see trouble here, i been using the datawach to sync the entityes from the server side whith the local side rater than using packets but dont think this could be the trouble, and now im testing using also the datawacher to pass the values from the entitye to the render class but is the same whith the wrong entity executing the animation someone please can point me to the error Thanks for reading render class package mercenarymod.entidades; import mercenarymod.Mercenary; import mercenarymod.entidades.hostiles.creeperModelAK; import net.minecraft.client.Minecraft; import net.minecraft.client.model.ModelBiped; import net.minecraft.client.model.ModelPlayer; import net.minecraft.client.renderer.entity.RenderBiped; import net.minecraft.client.renderer.entity.RenderLiving; import net.minecraft.client.renderer.entity.RenderManager; import net.minecraft.client.renderer.entity.layers.LayerArrow; import net.minecraft.client.renderer.entity.layers.LayerBipedArmor; import net.minecraft.client.renderer.entity.layers.LayerCape; import net.minecraft.client.renderer.entity.layers.LayerCustomHead; import net.minecraft.client.renderer.entity.layers.LayerDeadmau5Head; import net.minecraft.client.renderer.entity.layers.LayerHeldItem; import net.minecraft.entity.Entity; import net.minecraft.util.ResourceLocation; public class aldeanoMercenario00_render extends RenderBiped { //RenderBiped //RenderLiving private static final ResourceLocation textureLocation = new ResourceLocation("modmercenario:textures/entity/mobs/aldeanom00.png"); private boolean smallArms = false; public aldeanoMercenario00_render(RenderManager rm) { //, ModelBipedMercenary model, float shadowSize super( rm , new ModelBipedMercenary(), 0.5F ); this.addLayer(new LayerHeldItem(this)); this.addLayer(new LayerBipedArmor(this)); //this.addLayer(new LayerHeldItem(this)); this.addLayer(new LayerArrow(this)); } @Override protected ResourceLocation getEntityTexture(Entity par1Entity) { return textureLocation; } ModelBipedMercenary() class package mercenarymod.entidades; import net.minecraft.client.model.ModelBase; import net.minecraft.client.model.ModelBiped; import net.minecraft.client.model.ModelRenderer; import net.minecraft.client.renderer.GlStateManager; import net.minecraft.entity.DataWatcher; import net.minecraft.entity.Entity; import net.minecraft.util.MathHelper; import net.minecraftforge.fml.relauncher.Side; import net.minecraftforge.fml.relauncher.SideOnly; @SideOnly(Side.CLIENT) public class ModelBipedMercenary extends ModelBiped { public ModelRenderer bipedHead; /** The Biped's Headwear. Used for the outer layer of player skins. */ public ModelRenderer bipedHeadwear; public ModelRenderer bipedBody; /** The Biped's Right Arm */ public ModelRenderer bipedRightArm; /** The Biped's Left Arm */ public ModelRenderer bipedLeftArm; /** The Biped's Right Leg */ public ModelRenderer bipedRightLeg; /** The Biped's Left Leg */ public ModelRenderer bipedLeftLeg; /** Records whether the model should be rendered holding an item in the left hand, and if that item is a block. */ public int heldItemLeft = 0; /** Records whether the model should be rendered holding an item in the right hand, and if that item is a block. */ public int heldItemRight = 0; public boolean isSneak; /** Records whether the model should be rendered aiming a bow. */ public boolean aimedBow; // private float swingProgress = -10000.0F; private float swingProgress = -10000.0F; private final String __OBFID = "CL_00000840"; public ModelBipedMercenary() { this(0.0F); } public ModelBipedMercenary(float p_i1148_1_) { this(p_i1148_1_, 0.0F, 64, 32); } public ModelBipedMercenary(float p_i1149_1_, float p_i1149_2_, int p_i1149_3_, int p_i1149_4_) { this.textureWidth = p_i1149_3_; this.textureHeight = p_i1149_4_; this.bipedHead = new ModelRenderer(this, 0, 0); this.bipedHead.addBox(-4.0F, -8.0F, -4.0F, 8, 8, 8, p_i1149_1_); this.bipedHead.setRotationPoint(0.0F, 0.0F + p_i1149_2_, 0.0F); this.bipedHeadwear = new ModelRenderer(this, 32, 0); this.bipedHeadwear.addBox(-4.0F, -8.0F, -4.0F, 8, 8, 8, p_i1149_1_ + 0.5F); this.bipedHeadwear.setRotationPoint(0.0F, 0.0F + p_i1149_2_, 0.0F); this.bipedBody = new ModelRenderer(this, 16, 16); this.bipedBody.addBox(-4.0F, 0.0F, -2.0F, 8, 12, 4, p_i1149_1_); this.bipedBody.setRotationPoint(0.0F, 0.0F + p_i1149_2_, 0.0F); this.bipedRightArm = new ModelRenderer(this, 40, 16); this.bipedRightArm.addBox(-3.0F, -2.0F, -2.0F, 4, 12, 4, p_i1149_1_); this.bipedRightArm.setRotationPoint(-5.0F, 2.0F + p_i1149_2_, 0.0F); this.bipedLeftArm = new ModelRenderer(this, 40, 16); this.bipedLeftArm.mirror = true; this.bipedLeftArm.addBox(-1.0F, -2.0F, -2.0F, 4, 12, 4, p_i1149_1_); this.bipedLeftArm.setRotationPoint(5.0F, 2.0F + p_i1149_2_, 0.0F); this.bipedRightLeg = new ModelRenderer(this, 0, 16); this.bipedRightLeg.addBox(-2.0F, 0.0F, -2.0F, 4, 12, 4, p_i1149_1_); this.bipedRightLeg.setRotationPoint(-1.9F, 12.0F + p_i1149_2_, 0.0F); this.bipedLeftLeg = new ModelRenderer(this, 0, 16); this.bipedLeftLeg.mirror = true; this.bipedLeftLeg.addBox(-2.0F, 0.0F, -2.0F, 4, 12, 4, p_i1149_1_); this.bipedLeftLeg.setRotationPoint(1.9F, 12.0F + p_i1149_2_, 0.0F); } /** * Sets the models various rotation angles then renders the model. */ @Override public void render(Entity merEntity, float p_78088_2_, float p_78088_3_, float p_78088_4_, float p_78088_5_, float p_78088_6_, float p_78088_7_) { this.setRotationAngles(p_78088_2_, p_78088_3_, p_78088_4_, p_78088_5_, p_78088_6_, p_78088_7_, merEntity); GlStateManager.pushMatrix(); if (this.isChild) { float f6 = 2.0F; GlStateManager.scale(1.5F / f6, 1.5F / f6, 1.5F / f6); GlStateManager.translate(0.0F, 16.0F * p_78088_7_, 0.0F); this.bipedHead.render(p_78088_7_); GlStateManager.popMatrix(); GlStateManager.pushMatrix(); GlStateManager.scale(1.0F / f6, 1.0F / f6, 1.0F / f6); GlStateManager.translate(0.0F, 24.0F * p_78088_7_, 0.0F); this.bipedBody.render(p_78088_7_); this.bipedRightArm.render(p_78088_7_); this.bipedLeftArm.render(p_78088_7_); this.bipedRightLeg.render(p_78088_7_); this.bipedLeftLeg.render(p_78088_7_); this.bipedHeadwear.render(p_78088_7_); } else { if (merEntity.isSneaking()) { GlStateManager.translate(0.0F, 0.2F, 0.0F); } this.bipedHead.render(p_78088_7_); this.bipedBody.render(p_78088_7_); this.bipedRightArm.render(p_78088_7_); this.bipedLeftArm.render(p_78088_7_); this.bipedRightLeg.render(p_78088_7_); this.bipedLeftLeg.render(p_78088_7_); this.bipedHeadwear.render(p_78088_7_); } GlStateManager.popMatrix(); if (merEntity instanceof mobMercenario){ mobMercenario merc = (mobMercenario) merEntity; DataWatcher dt = merEntity.getDataWatcher(); { int lrsa = dt.getWatchableObjectInt(21); ////System.out.println("\nswing="+swing); aimedBow = false; if ((lrsa % 10) > 0) { aimedBow = true; } isSneak = false; if (((lrsa % 100) / 10) > 0) { isSneak = true; } heldItemRight = ((lrsa % 1000) / 100); heldItemLeft = ((lrsa % 10000) / 1000); boolean swing = false; if (((lrsa / 10000) ) > 0) { swing = true; } if (swing) { this.swingProgress = merc.getSwingProgress(); //this.swingProgress = dt.getWatchableObjectInt(22); } else { this.swingProgress = -10000; } } /* this.aimedBow = merc.getAimedBow(); this.isSneak = merc.getisSneak(); this.heldItemRight = merc.getHeldItemRight(); this.heldItemLeft = merc.getHeldItemLeft(); this.swingProgress = merc.getSwingProgress(); */ } } /** * Sets the model's various rotation angles. For bipeds, par1 and par2 are used for animating the movement of arms * and legs, where par1 represents the time(so that arms and legs swing back and forth) and par2 represents how * "far" arms and legs can swing at most. */ public void setRotationAngles(float p_78087_1_, float p_78087_2_, float p_78087_3_, float p_78087_4_, float p_78087_5_, float p_78087_6_, Entity p_78087_7_) { this.bipedHead.rotateAngleY = p_78087_4_ / (180F / (float)Math.PI); this.bipedHead.rotateAngleX = p_78087_5_ / (180F / (float)Math.PI); this.bipedRightArm.rotateAngleX = MathHelper.cos(p_78087_1_ * 0.6662F + (float)Math.PI) * 2.0F * p_78087_2_ * 0.5F; this.bipedLeftArm.rotateAngleX = MathHelper.cos(p_78087_1_ * 0.6662F) * 2.0F * p_78087_2_ * 0.5F; this.bipedRightArm.rotateAngleZ = 0.0F; this.bipedLeftArm.rotateAngleZ = 0.0F; this.bipedRightLeg.rotateAngleX = MathHelper.cos(p_78087_1_ * 0.6662F) * 1.4F * p_78087_2_; this.bipedLeftLeg.rotateAngleX = MathHelper.cos(p_78087_1_ * 0.6662F + (float)Math.PI) * 1.4F * p_78087_2_; this.bipedRightLeg.rotateAngleY = 0.0F; this.bipedLeftLeg.rotateAngleY = 0.0F; if (this.isRiding) { this.bipedRightArm.rotateAngleX += -((float)Math.PI / 5F); this.bipedLeftArm.rotateAngleX += -((float)Math.PI / 5F); this.bipedRightLeg.rotateAngleX = -((float)Math.PI * 2F / 5F); this.bipedLeftLeg.rotateAngleX = -((float)Math.PI * 2F / 5F); this.bipedRightLeg.rotateAngleY = ((float)Math.PI / 10F); this.bipedLeftLeg.rotateAngleY = -((float)Math.PI / 10F); } if (this.heldItemLeft != 0) { this.bipedLeftArm.rotateAngleX = this.bipedLeftArm.rotateAngleX * 0.5F - ((float)Math.PI / 10F) * (float)this.heldItemLeft; } this.bipedRightArm.rotateAngleY = 0.0F; this.bipedRightArm.rotateAngleZ = 0.0F; switch (this.heldItemRight) { case 0: case 2: default: break; case 1: this.bipedRightArm.rotateAngleX = this.bipedRightArm.rotateAngleX * 0.5F - ((float)Math.PI / 10F) * (float)this.heldItemRight; break; case 3: this.bipedRightArm.rotateAngleX = this.bipedRightArm.rotateAngleX * 0.5F - ((float)Math.PI / 10F) * (float)this.heldItemRight; this.bipedRightArm.rotateAngleY = -0.5235988F; } this.bipedLeftArm.rotateAngleY = 0.0F; float f6; float f7; if (this.swingProgress > -9990.0F) { f6 = this.swingProgress; this.bipedBody.rotateAngleY = MathHelper.sin(MathHelper.sqrt_float(f6) * (float)Math.PI * 2.0F) * 0.2F; this.bipedRightArm.rotationPointZ = MathHelper.sin(this.bipedBody.rotateAngleY) * 5.0F; this.bipedRightArm.rotationPointX = -MathHelper.cos(this.bipedBody.rotateAngleY) * 5.0F; this.bipedLeftArm.rotationPointZ = -MathHelper.sin(this.bipedBody.rotateAngleY) * 5.0F; this.bipedLeftArm.rotationPointX = MathHelper.cos(this.bipedBody.rotateAngleY) * 5.0F; this.bipedRightArm.rotateAngleY += this.bipedBody.rotateAngleY; this.bipedLeftArm.rotateAngleY += this.bipedBody.rotateAngleY; this.bipedLeftArm.rotateAngleX += this.bipedBody.rotateAngleY; f6 = 1.0F - this.swingProgress; f6 *= f6; f6 *= f6; f6 = 1.0F - f6; f7 = MathHelper.sin(f6 * (float)Math.PI); float f8 = MathHelper.sin(this.swingProgress * (float)Math.PI) * -(this.bipedHead.rotateAngleX - 0.7F) * 0.75F; this.bipedRightArm.rotateAngleX = (float)((double)this.bipedRightArm.rotateAngleX - ((double)f7 * 1.2D + (double)f8)); this.bipedRightArm.rotateAngleY += this.bipedBody.rotateAngleY * 2.0F; this.bipedRightArm.rotateAngleZ += MathHelper.sin(this.swingProgress * (float)Math.PI) * -0.4F; } if (this.isSneak) { this.bipedBody.rotateAngleX = 0.5F; this.bipedRightArm.rotateAngleX += 0.4F; this.bipedLeftArm.rotateAngleX += 0.4F; this.bipedRightLeg.rotationPointZ = 4.0F; this.bipedLeftLeg.rotationPointZ = 4.0F; this.bipedRightLeg.rotationPointY = 9.0F; this.bipedLeftLeg.rotationPointY = 9.0F; this.bipedHead.rotationPointY = 1.0F; } else { this.bipedBody.rotateAngleX = 0.0F; this.bipedRightLeg.rotationPointZ = 0.1F; this.bipedLeftLeg.rotationPointZ = 0.1F; this.bipedRightLeg.rotationPointY = 12.0F; this.bipedLeftLeg.rotationPointY = 12.0F; this.bipedHead.rotationPointY = 0.0F; } this.bipedRightArm.rotateAngleZ += MathHelper.cos(p_78087_3_ * 0.09F) * 0.05F + 0.05F; this.bipedLeftArm.rotateAngleZ -= MathHelper.cos(p_78087_3_ * 0.09F) * 0.05F + 0.05F; this.bipedRightArm.rotateAngleX += MathHelper.sin(p_78087_3_ * 0.067F) * 0.05F; this.bipedLeftArm.rotateAngleX -= MathHelper.sin(p_78087_3_ * 0.067F) * 0.05F; if (this.aimedBow) { f6 = 0.0F; f7 = 0.0F; this.bipedRightArm.rotateAngleZ = 0.0F; this.bipedLeftArm.rotateAngleZ = 0.0F; this.bipedRightArm.rotateAngleY = -(0.1F - f6 * 0.6F) + this.bipedHead.rotateAngleY; this.bipedLeftArm.rotateAngleY = 0.1F - f6 * 0.6F + this.bipedHead.rotateAngleY + 0.4F; this.bipedRightArm.rotateAngleX = -((float)Math.PI / 2F) + this.bipedHead.rotateAngleX; this.bipedLeftArm.rotateAngleX = -((float)Math.PI / 2F) + this.bipedHead.rotateAngleX; this.bipedRightArm.rotateAngleX -= f6 * 1.2F - f7 * 0.4F; this.bipedLeftArm.rotateAngleX -= f6 * 1.2F - f7 * 0.4F; this.bipedRightArm.rotateAngleZ += MathHelper.cos(p_78087_3_ * 0.09F) * 0.05F + 0.05F; this.bipedLeftArm.rotateAngleZ -= MathHelper.cos(p_78087_3_ * 0.09F) * 0.05F + 0.05F; this.bipedRightArm.rotateAngleX += MathHelper.sin(p_78087_3_ * 0.067F) * 0.05F; this.bipedLeftArm.rotateAngleX -= MathHelper.sin(p_78087_3_ * 0.067F) * 0.05F; } copyModelAngles(this.bipedHead, this.bipedHeadwear); } public void setModelAttributes(ModelBase p_178686_1_) { super.setModelAttributes(p_178686_1_); if (p_178686_1_ instanceof ModelBipedMercenary) { ModelBipedMercenary modelbiped = (ModelBipedMercenary)p_178686_1_; this.heldItemLeft = modelbiped.heldItemLeft; this.heldItemRight = modelbiped.heldItemRight; this.isSneak = modelbiped.isSneak; this.aimedBow = modelbiped.aimedBow; } } public void setInvisible(boolean invisible) { this.bipedHead.showModel = invisible; this.bipedHeadwear.showModel = invisible; this.bipedBody.showModel = invisible; this.bipedRightArm.showModel = invisible; this.bipedLeftArm.showModel = invisible; this.bipedRightLeg.showModel = invisible; this.bipedLeftLeg.showModel = invisible; } public void postRenderArm(float p_178718_1_) { this.bipedRightArm.postRender(p_178718_1_); } } entity class package mercenarymod.entidades; import java.util.UUID; import com.google.common.base.Predicate; import mercenarymod.items.MercenaryModItems; import mercenarymod.utilidades.util; import net.minecraft.enchantment.Enchantment; import net.minecraft.enchantment.EnchantmentHelper; import net.minecraft.entity.Entity; import net.minecraft.entity.EntityAgeable; import net.minecraft.entity.EntityCreature; import net.minecraft.entity.EntityLivingBase; import net.minecraft.entity.IRangedAttackMob; import net.minecraft.entity.SharedMonsterAttributes; import net.minecraft.entity.ai.EntityAIArrowAttack; import net.minecraft.entity.ai.EntityAIAttackOnCollide; import net.minecraft.entity.ai.EntityAIAvoidEntity; import net.minecraft.entity.ai.EntityAIFleeSun; import net.minecraft.entity.ai.EntityAIFollowOwner; import net.minecraft.entity.ai.EntityAIHurtByTarget; import net.minecraft.entity.ai.EntityAILookIdle; import net.minecraft.entity.ai.EntityAINearestAttackableTarget; import net.minecraft.entity.ai.EntityAIRestrictSun; import net.minecraft.entity.ai.EntityAISwimming; import net.minecraft.entity.ai.EntityAIWander; import net.minecraft.entity.ai.EntityAIWatchClosest; import net.minecraft.entity.monster.EntityIronGolem; import net.minecraft.entity.monster.EntityMob; import net.minecraft.entity.monster.EntitySkeleton; import net.minecraft.entity.monster.EntityZombie; import net.minecraft.entity.passive.EntityTameable; import net.minecraft.entity.passive.EntityVillager; import net.minecraft.entity.passive.EntityWolf; import net.minecraft.entity.player.EntityPlayer; import net.minecraft.entity.projectile.EntityArrow; import net.minecraft.init.Items; import net.minecraft.item.EnumDyeColor; import net.minecraft.item.Item; import net.minecraft.item.ItemFood; import net.minecraft.item.ItemStack; import net.minecraft.nbt.NBTTagCompound; import net.minecraft.world.DifficultyInstance; import net.minecraft.world.World; public class aldeanoMercenario00 extends mobMercenario { //EntityMob private EntityAIArrowAttack aiArrowAttack = new EntityAIArrowAttack(this, 1.0D, 20, 60, 15.0F); private EntityAIAttackOnCollide aiAttackOnCollide = new EntityAIAttackOnCollide(this, EntityPlayer.class, 1.2D, false); private boolean canPickUpLoot=true; /** Float used to smooth the rotation of the wolf head */ private float headRotationCourse; private float headRotationCourseOld; /** true is the wolf is wet else false */ private boolean isWet; /** True if the wolf is shaking else False */ private boolean isShaking; private boolean isTamed; public aldeanoMercenario00(World worldIn) { super(worldIn); ItemStack armadura = new ItemStack(MercenaryModItems.chalecoTacticoS, 1, 0); ItemStack inventario [] = demeUn.maletinInventario(19); //cargador CC + 256 * 5.56 util.writeToNBTitem(armadura, inventario); ItemStack arma = demeUn.arma(21, 30, 1, 1); // fusilM4A1 CC 30 balas this.setCurrentItemOrArmor(0, arma); this.setCurrentItemOrArmor(3, armadura); } @Override protected void applyEntityAttributes() { super.applyEntityAttributes(); this.getEntityAttribute(SharedMonsterAttributes.maxHealth).setBaseValue(20.0D); this.getEntityAttribute(SharedMonsterAttributes.followRange).setBaseValue(32.0D); this.getEntityAttribute(SharedMonsterAttributes.knockbackResistance).setBaseValue(0.50D); this.getEntityAttribute(SharedMonsterAttributes.movementSpeed).setBaseValue(0.25D); this.getEntityAttribute(SharedMonsterAttributes.attackDamage).setBaseValue(2.0D); } public boolean isAIEnabled() { return true; } } main mobMercenario entity class package mercenarymod.entidades; import java.util.ArrayList; import java.util.List; import java.util.UUID; import com.google.common.base.Predicate; import mercenarymod.items.MercenaryModItems; import mercenarymod.utilidades.chat; import mercenarymod.utilidades.util; import net.minecraft.block.Block; import net.minecraft.block.state.BlockState; import net.minecraft.block.state.IBlockState; import net.minecraft.enchantment.Enchantment; import net.minecraft.enchantment.EnchantmentHelper; import net.minecraft.entity.Entity; import net.minecraft.entity.EntityAgeable; import net.minecraft.entity.EntityCreature; import net.minecraft.entity.EntityLivingBase; import net.minecraft.entity.IRangedAttackMob; import net.minecraft.entity.SharedMonsterAttributes; import net.minecraft.entity.ai.EntityAIArrowAttack; import net.minecraft.entity.ai.EntityAIAttackOnCollide; import net.minecraft.entity.ai.EntityAIAvoidEntity; import net.minecraft.entity.ai.EntityAIBeg; import net.minecraft.entity.ai.EntityAIFollowOwner; import net.minecraft.entity.ai.EntityAIHurtByTarget; import net.minecraft.entity.ai.EntityAILeapAtTarget; import net.minecraft.entity.ai.EntityAILookIdle; import net.minecraft.entity.ai.EntityAIMate; import net.minecraft.entity.ai.EntityAINearestAttackableTarget; import net.minecraft.entity.ai.EntityAIOwnerHurtByTarget; import net.minecraft.entity.ai.EntityAIOwnerHurtTarget; import net.minecraft.entity.ai.EntityAISwimming; import net.minecraft.entity.ai.EntityAITargetNonTamed; import net.minecraft.entity.ai.EntityAIWander; import net.minecraft.entity.ai.EntityAIWatchClosest; import net.minecraft.entity.item.EntityItem; import net.minecraft.entity.monster.EntityCreeper; import net.minecraft.entity.monster.EntityGhast; import net.minecraft.entity.monster.EntityIronGolem; import net.minecraft.entity.monster.EntityMob; import net.minecraft.entity.monster.EntityPigZombie; import net.minecraft.entity.monster.EntitySkeleton; import net.minecraft.entity.passive.EntityAnimal; import net.minecraft.entity.passive.EntityHorse; import net.minecraft.entity.passive.EntityRabbit; import net.minecraft.entity.passive.EntitySheep; import net.minecraft.entity.passive.EntityTameable; import net.minecraft.entity.passive.EntityWolf; import net.minecraft.entity.player.EntityPlayer; import net.minecraft.entity.projectile.EntityArrow; import net.minecraft.init.Blocks; import net.minecraft.init.Items; import net.minecraft.inventory.InventoryBasic; import net.minecraft.item.EnumDyeColor; import net.minecraft.item.Item; import net.minecraft.item.ItemFood; import net.minecraft.item.ItemStack; import net.minecraft.nbt.NBTTagCompound; import net.minecraft.nbt.NBTTagList; import net.minecraft.pathfinding.PathNavigateGround; import net.minecraft.util.AxisAlignedBB; import net.minecraft.util.BlockPos; import net.minecraft.util.DamageSource; import net.minecraft.util.EnumParticleTypes; import net.minecraft.util.MathHelper; import net.minecraft.util.MovingObjectPosition; import net.minecraft.util.Vec3; import net.minecraft.world.World; import net.minecraftforge.fml.relauncher.Side; import net.minecraftforge.fml.relauncher.SideOnly; public class mobMercenario extends EntityTameable implements IRangedAttackMob { /** Float used to smooth the rotation of the wolf head */ private float headRotationCourse; private float headRotationCourseOld; /** true is the wolf is wet else false */ private boolean isWet; /** True if the wolf is shaking else False */ private boolean isShaking; /** * This time increases while wolf is shaking and emitting water particles. */ private float timeWolfIsShaking; private float prevTimeWolfIsShaking; private final String __OBFID = "CL_00001654"; public float height = 1.8F; private int heldItemLeft = 1; /** * Records whether the model should be rendered holding an item in the right * hand, and if that item is a block. */ private int heldItemRight = 0; public boolean isSneak = false; /** Records whether the model should be rendered aiming a bow. */ private boolean aimedBow = false; private int aimedBowTick = 0; private int onUpdateTick = 0; private InventoryBasic mercenaryInventory; private EntityLivingBase OwnerEntity; private int OwnerID = 0; private EntityLivingBase shootingEntity; private int shootingEntityId = 0; private Entity targetEntity; private int targetEntityId = 0; private boolean swing = false; private float swingProgress = 0.0F;//-10000.0F; private int[] ignorar = { 0 }; // inventario de la shootingEntity private int mainInventorySize = 5; private ItemStack[] mainInventory = new ItemStack[mainInventorySize]; private EntityAIArrowAttack aiArrowAttack = new EntityAIArrowAttack(this, 1.0D, 20, 10, 20.0F); private EntityAIAttackOnCollide aiAttackOnCollide = new EntityAIAttackOnCollide(this, EntityMob.class, 1.2D, false); // ################################################################################################################# public mobMercenario(World worldIn) { super(worldIn); this.setSize(0.6F, 1.8F); ((PathNavigateGround) this.getNavigator()).func_179690_a(true); this.tasks.addTask(1, new EntityAISwimming(this)); this.tasks.addTask(2, this.aiSit); // this.tasks.addTask(3, new EntityAILeapAtTarget(this, 0.4F)); // this.tasks.addTask(4, new EntityAIAttackOnCollide(this, 1.0D, true)); this.tasks.addTask(5, new EntityAIFollowOwner(this, 1.0D, 10.0F, 2.0F)); this.tasks.addTask(6, new EntityAIMate(this, 1.0D)); this.tasks.addTask(7, new EntityAIWander(this, 1.0D)); // this.tasks.addTask(8, new EntityAIBeg(this, 8.0F)); this.tasks.addTask(9, new EntityAIWatchClosest(this, EntityPlayer.class, 8.0F)); this.tasks.addTask(9, new EntityAILookIdle(this)); this.targetTasks.addTask(1, new EntityAIOwnerHurtByTarget(this)); this.targetTasks.addTask(2, new EntityAIOwnerHurtTarget(this)); this.targetTasks.addTask(3, new EntityAIHurtByTarget(this, true, new Class[0])); this.targetTasks.addTask(1, new EntityAINearestAttackableTarget(this, EntityMob.class, true)); // this.targetTasks.addTask(5, new EntityAINearestAttackableTarget(this, // EntitySkeleton.class, false)); this.targetTasks.addTask(2, new EntityAINearestAttackableTarget(this, EntityPigZombie.class, true)); // this.targetTasks.addTask(3, new EntityAINearestAttackableTarget(this, // EntityIronGolem.class, true)); this.setTamed(false); this.targetTasks.addTask(4, new EntityAITargetNonTamed(this, EntityAnimal.class, false, new Predicate() { private final String __OBFID = "CL_00002229"; public boolean func_180094_a(Entity p_180094_1_) { return p_180094_1_ instanceof EntitySheep || p_180094_1_ instanceof EntityRabbit; } public boolean apply(Object p_apply_1_) { return this.func_180094_a((Entity) p_apply_1_); } })); this.tasks.addTask(3, new EntityAIAvoidEntity(this, new Predicate() { private final String __OBFID = "CL_00002203"; public boolean func_179945_a(Entity p_179945_1_) { return p_179945_1_ instanceof EntityCreeper; } public boolean apply(Object p_apply_1_) { return this.func_179945_a((Entity) p_apply_1_); } }, 6.0F, 1.0D, 1.2D)); //this.setCurrentItemOrArmor(0, new ItemStack(Items.bow)); // this.setCurrentItemOrArmor(0, new // ItemStack(MercenaryModItems.fusilSCARH,1,1)); //this.setCurrentItemOrArmor(0, new ItemStack(MercenaryModItems.subfusil90PNF, 1, 14)); this.setCurrentItemOrArmor(0, new ItemStack(MercenaryModItems.subfusilMP5T5, 1, ); // this.setCurrentItemOrArmor(0, new // ItemStack(MercenaryModItems.maid_P90,1,3)); // this.setCurrentItemOrArmor(0, new // ItemStack(MercenaryModItems.subfusil90PNF,1,14)); if (worldIn != null && !worldIn.isRemote) { this.setCombatTask(); } } // ################################################################################################################# @Override protected void applyEntityAttributes() { super.applyEntityAttributes(); this.getEntityAttribute(SharedMonsterAttributes.movementSpeed).setBaseValue(0.30000001192092896D); if (this.isTamed()) { this.getEntityAttribute(SharedMonsterAttributes.maxHealth).setBaseValue(20.0D); } else { this.getEntityAttribute(SharedMonsterAttributes.maxHealth).setBaseValue(8.0D); } this.getAttributeMap().registerAttribute(SharedMonsterAttributes.attackDamage); this.getEntityAttribute(SharedMonsterAttributes.attackDamage).setBaseValue(2.0D); } // ################################################################################################################# @Override /** * Sets the active target the Task system uses for tracking */ public void setAttackTarget(EntityLivingBase p_70624_1_) { super.setAttackTarget(p_70624_1_); if (p_70624_1_ == null) { this.setAngry(false); } else if (!this.isTamed()) { this.setAngry(true); } } // ################################################################################################################# @Override protected void updateAITasks() { this.dataWatcher.updateObject(18, Float.valueOf(this.getHealth())); } // ################################################################################################################# @Override protected void entityInit() { super.entityInit(); this.dataWatcher.addObject(18, new Float(this.getHealth())); this.dataWatcher.addObject(19, new Byte((byte) 0)); this.dataWatcher.addObject(20, new Byte((byte) EnumDyeColor.RED.getMetadata())); // variables del render // a aimedBow boolean // s isSneak boolean // r heldItemRight int 0~4 // l heldItemLeft int 0~1 int lrsa = 0; this.dataWatcher.addObject(21, lrsa); this.dataWatcher.addObject(22, 0.0F); } // ################################################################################################################# @Override protected void playStepSound(BlockPos p_180429_1_, Block p_180429_2_) { //this.playSound("mob.wolf.step", 0.15F, 1.0F); } // ################################################################################################################# @Override /** * Handles updating while being ridden by an entity */ public void updateRidden() { super.updateRidden(); if (this.ridingEntity instanceof EntityCreature) { EntityCreature entitycreature = (EntityCreature) this.ridingEntity; this.renderYawOffset = entitycreature.renderYawOffset; } } // ################################################################################################################# @Override /** * Called when the mob's health reaches 0. */ public void onDeath(DamageSource cause) { //dropear contenidos ItemStack gun = this.getHeldItem(); if (gun != null & !this.worldObj.isRemote) { double dx = this.posX; double dy = this.posY + 2; double dz = this.posZ; // leer slots del arma NBTTagCompound tagCompund = gun.getTagCompound(); if (tagCompund != null) { NBTTagList nbttaglist = tagCompund.getTagList("Inventory", 10); for (int i = 0; i < nbttaglist.tagCount(); ++i) { ItemStack itemstack = ItemStack.loadItemStackFromNBT(nbttaglist.getCompoundTagAt(i)); if (itemstack != null) { this.worldObj.spawnEntityInWorld(new EntityItem(this.worldObj, dx , dy , dz , itemstack )); } } nbttaglist = new NBTTagList(); tagCompund.setTag("Inventory", nbttaglist); gun.setTagCompound(tagCompund); } this.worldObj.spawnEntityInWorld(new EntityItem(this.worldObj, dx , dy , dz , gun )); } } // ################################################################################################################# //@Override /** * (abstract) Protected helper method to write subclass entity data to NBT. */ /** * (abstract) Protected helper method to read subclass entity data from NBT. */ public void readEntityFromNBT(NBTTagCompound tagCompund) { super.readEntityFromNBT(tagCompund); tagCompund.setBoolean("Angry", this.isAngry()); tagCompund.setByte("CollarColor", (byte) this.getCollarColor().getDyeDamage()); this.setCombatTask(); } /** * (abstract) Protected helper method to write subclass entity data to NBT. */ public void writeEntityToNBT(NBTTagCompound tagCompound) { super.writeEntityToNBT(tagCompound); } /** * Sets the held item, or an armor slot. Slot 0 is held item. Slot 1-4 is armor. Params: Item, slot */ public void setCurrentItemOrArmor(int slotIn, ItemStack stack) { super.setCurrentItemOrArmor(slotIn, stack); if (!this.worldObj.isRemote && slotIn == 0) { this.setCombatTask(); } } // ################################################################################################################# //@Override /** * (abstract) Protected helper method to read subclass entity data from NBT. *//* public void readEntityFromNBT(NBTTagCompound tagCompund) { super.readEntityFromNBT(tagCompund); this.setAngry(tagCompund.getBoolean("Angry")); if (tagCompund.hasKey("CollarColor", 99)) { this.setCollarColor(EnumDyeColor.byDyeDamage(tagCompund.getByte("CollarColor"))); } NBTTagList nbttaglist3 = tagCompund.getTagList("Inventory", 10); for (int i = 0; i < nbttaglist3.tagCount(); ++i) { NBTTagCompound nbttagcompound3 = nbttaglist3.getCompoundTagAt(i); int j = nbttagcompound3.getByte("Slot") & 255; if (j >= 0 && j < mainInventorySize) { mainInventory[j] = ItemStack.loadItemStackFromNBT(nbttagcompound3); if (mainInventory[j] != null) { ////System.out.println("mainInventory[" + j + "]" + mainInventory[j].getUnlocalizedName()); // chat.chatga(shootingEntity, "mainInventory[" // + j + "]" + // mainInventory[j].getUnlocalizedName()); } } this.setCurrentItemOrArmor(0, mainInventory[0]); this.setCurrentItemOrArmor(1, mainInventory[1]); this.setCurrentItemOrArmor(2, mainInventory[2]); this.setCurrentItemOrArmor(3, mainInventory[3]); this.setCurrentItemOrArmor(4, mainInventory[4]); } this.setCombatTask(); this.setCanPickUpLoot(true); // this.func_175552_ct(); }*/ // ################################################################################################################# //@Override /** * Sets the held item, or an armor slot. Slot 0 is held item. Slot 1-4 is armor. Params: Item, slot */ /* public void setCurrentItemOrArmor(int slotIn, ItemStack stack) { super.setCurrentItemOrArmor(slotIn, stack); if (!this.worldObj.isRemote && slotIn == 0) { this.setCombatTask(); } } */ // ################################################################################################################# @Override /** * Returns the sound this mob makes while it's alive. */ protected String getLivingSound() { //return this.isAngry() ? "mob.wolf.growl" : (this.rand.nextInt(3) == 0 ? (this.isTamed() && this.dataWatcher.getWatchableObjectFloat(18) < 10.0F ? "mob.wolf.whine" : "mob.wolf.panting") : "mob.wolf.bark"); return this.isAngry() ? "mob.villager.haggle" : "mob.villager.idle"; } // ################################################################################################################# @Override /** * Returns the sound this mob makes when it is hurt. */ protected String getHurtSound() { return "mob.villager.hit";//"mob.wolf.hurt"; } // ################################################################################################################# @Override /** * Returns the sound this mob makes on death. */ protected String getDeathSound() { return "mob.villager.death"; //"mob.wolf.death"; } // ################################################################################################################# @Override /** * Returns the volume for the sounds this mob makes. */ protected float getSoundVolume() { return 0.4F; } // ################################################################################################################# @Override protected Item getDropItem() { return Item.getItemById(-1); } // ################################################################################################################# @Override /** * Called frequently so the entity can update its state every tick as * required. For example, zombies and skeletons use this to react to * sunlight and start to burn. */ public void onLivingUpdate() { super.onLivingUpdate(); if (!this.worldObj.isRemote && this.isWet && !this.isShaking && !this.hasPath() && this.onGround) { this.isShaking = true; this.timeWolfIsShaking = 0.0F; this.prevTimeWolfIsShaking = 0.0F; this.worldObj.setEntityState(this, (byte) ; } if (!this.worldObj.isRemote && this.getAttackTarget() == null && this.isAngry()) { this.setAngry(false); } } // ################################################################################################################# /** * sets this entity's combat AI. */ public void setCombatTask() { this.tasks.removeTask(this.aiAttackOnCollide); this.tasks.removeTask(this.aiArrowAttack); ItemStack itemstack = this.getHeldItem(); if (armasDisparables.esDisparable(itemstack)) { this.tasks.addTask(4, this.aiArrowAttack); } else { this.tasks.addTask(4, this.aiAttackOnCollide); } } // ################################################################################################################# /** * Attack the specified entity using a ranged attack. */ @Override public void attackEntityWithRangedAttack(EntityLivingBase target, float p_82196_2_) { ItemStack itemstack = this.getHeldItem(); targetEntityId = target.getEntityId(); if(itemstack != null){ Item cosa = itemstack.getItem(); if (cosa == Items.bow) { EntityArrow entityarrow = new EntityArrow(this.worldObj, this, target, 1.6F, (float) (14 - this.worldObj.getDifficulty().getDifficultyId() * 4)); int i = EnchantmentHelper.getEnchantmentLevel(Enchantment.power.effectId, this.getHeldItem()); int j = EnchantmentHelper.getEnchantmentLevel(Enchantment.punch.effectId, this.getHeldItem()); entityarrow.setDamage((double) (p_82196_2_ * 2.0F) + this.rand.nextGaussian() * 0.25D + (double) ((float) this.worldObj.getDifficulty().getDifficultyId() * 0.11F)); if (i > 0) { entityarrow.setDamage(entityarrow.getDamage() + (double) i * 0.5D + 0.5D); } if (j > 0) { entityarrow.setKnockbackStrength(j); } this.worldObj.spawnEntityInWorld(entityarrow); } } this.targetEntity = target; //noEstaMuyLejosNiEstaObstruido(this, target, 30.0F); this.swingItem(); //this.swing = true; } // ################################################################################################################# boolean noEstaMuyLejosNiEstaObstruido(Entity ea, Entity eb, float limite) { boolean salida = true; float distancia = ea.getDistanceToEntity(eb); if (distancia > limite) { salida = false; } //System.out.println("distancia="+distancia+"/"+limite); //System.out.println("salida="+salida); if (salida) { Vec3 vec31 = new Vec3(ea.posX, ea.posY + ea.getEyeHeight(), ea.posZ); Vec3 vec3 = new Vec3(eb.posX, eb.posY + eb.getEyeHeight(), eb.posZ); //System.out.println("0"); MovingObjectPosition movingobjectposition = this.worldObj.rayTraceBlocks(vec31, vec3, false, true, false); //System.out.println("1"); vec31 = new Vec3(ea.posX, ea.posY + ea.getEyeHeight(), ea.posZ); vec3 = new Vec3(eb.posX, eb.posY + eb.getEyeHeight(), eb.posZ); if (movingobjectposition != null) { vec3 = new Vec3(movingobjectposition.hitVec.xCoord, movingobjectposition.hitVec.yCoord, movingobjectposition.hitVec.zCoord); //System.out.println("hitvector="+vec3); //System.out.println("Blocke="+this.worldObj.getBlockState(new BlockPos(vec3) ).getBlock().getUnlocalizedName() ); } //System.out.println("2"); // ### Aqui estoy modificando para obtener la segunda entidad Entity entity = null; ArrayList<Entity> entidades = new ArrayList<Entity>(); entidades.clear(); List list = this.worldObj.getEntitiesWithinAABBExcludingEntity(this, this.getEntityBoundingBox().addCoord(this.motionX, this.motionY, this.motionZ).expand(1.0D, 1.0D, 1.0D)); double d0 = 0.0D; ArrayList<Double> distancias = new ArrayList<Double>(); distancias.clear(); int i; float f1; for (i = 0; i < list.size(); ++i) { Entity entity1 = (Entity) list.get(i); if (!excepciones(entity1)) // if false { //System.out.println("exepcion = "+entity1.getName()); //salida = false; } } //System.out.println("3"); int distanciab = (int)distancia; // rotacion Horizontal en radianes double rotacionYaw = ea.rotationYaw; // rotacion Vertical en radianes double rotacionPitch = ea.rotationPitch; double eax = ea.posX; double eay = (ea.posY + ea.getEyeHeight()); double eaz = ea.posZ; double nposX = 0; double nposY = 0; double nposZ = 0; BlockPos bpos = new BlockPos(nposX,nposY,nposZ); IBlockState ibx = Blocks.web.getDefaultState(); //float distancia=1.0F; rotacionYaw = ((this.rotationYaw / 180.0F) * 3.1415926 ); //rotacion Horizontal en radianes rotacionPitch = ((this.rotationPitch / 180.0F) * 3.1415926 ); //rotacion Vertical en radianes if (rotacionYaw < 0) { rotacionYaw = (2 * 6.2831852) + rotacionYaw; } rotacionYaw = rotacionYaw - 1.5707963; //correccion de -90 grados if (rotacionYaw < 0) { rotacionYaw = (2 * 6.2831852) + rotacionYaw; } ////System.out.println("rotacionPitch ="+ (rotacionPitch) ); ////System.out.println("rotacionYawn ="+ (rotacionYaw) ); for (int d = 1; d < distanciab ; d ++ ) { nposX = eax - (double)( Math.cos( rotacionYaw ) ) * (Math.cos(rotacionPitch) * d ) ; nposY = eay - ( Math.sin(rotacionPitch) * d ) ;//0.10000000149011612D + nposZ = eaz - (double)( Math.sin( rotacionYaw ) ) * (Math.cos(rotacionPitch) * d ) ; ////System.out.println(" "+); ////System.out.println("\n\n"); ////System.out.println(" d="+d); ////System.out.println("posX = "+nposX); ////System.out.println("posY = "+nposY); ////System.out.println("posZ = "+nposZ); bpos = new BlockPos(nposX,nposY,nposZ); //this.worldObj.setBlockState(bpos, ibx); } //###### } //System.out.println("4"); return salida; } // #########################################################################################################################3 boolean excepciones(Entity ent) { int entId = ent.getEntityId(); //// //System.out.println("\n\n\n"); //// //System.out.println("mundo="+this.worldObj.isRemote); //// //System.out.println("entidad="+entId); //// //System.out.println("thisId="+thisId); //// //System.out.println("shId="+shootingEntityId); if (entId == shootingEntityId) { return false; } int ignLength = ignorar.length; for (int ig = 0; ig < ignLength; ig++) { //// //System.out.println(" array["+ig+"]ignorar="+ignorar[ig]); if (entId == ignorar[ig]) { return false; } } return true; } // ################################################################################################################# @Override /** * Called to update the entity's position/logic. */ public void onUpdate() { super.onUpdate(); //siwn code //"\nmundo="+this.worldObj.isRemote+ if (this.worldObj.isRemote){ ////System.out.println("\nswing="+swingProgress+"\nswing"+swing+"\n\n"); } if (this.swing) { this.swingProgress += 0.025F; //swingProgress = swingProgresst / 100; if (this.swingProgress < 0.0F) { this.swingProgress = 0.0F; } if (this.swingProgress > 1.0F) { this.swingProgress = 0.0F; this.swing = false; } this.dataWatcher.updateObject(22, this.swingProgress); } else { this.swingProgress = -10000.0F; } if (onUpdateTick < 2 & !this.worldObj.isRemote) { isMasterAlive(this); } this.headRotationCourseOld = this.headRotationCourse; if (this.func_70922_bv()) { this.headRotationCourse += (1.0F - this.headRotationCourse) * 0.4F; } else { this.headRotationCourse += (0.0F - this.headRotationCourse) * 0.4F; } // actualizar variables del render atravez del dataWacher // variables del render // a aimedBow boolean // s isSneak boolean // r heldItemRight int 0~4 // l heldItemLeft int 0~1 if ((onUpdateTick % 30)==0){ ////System.out.println("\nswing="+swing+"\nMundo="+this.worldObj.isRemote+"\nswingp="+swingProgress+"\n\n"); int lrsa = 0; if (!this.worldObj.isRemote) { ////System.out.println("\nswing="+swing); if (aimedBow) { lrsa = lrsa + 1; } if (isSneak) { lrsa = lrsa + 10; } if (heldItemRight > 0) { lrsa = lrsa + (heldItemRight * 100); } if (heldItemLeft > 0) { lrsa = lrsa + (heldItemLeft * 1000); } if (this.swing) { lrsa = lrsa + (10000); } this.dataWatcher.updateObject(21, lrsa); } else { lrsa = this.dataWatcher.getWatchableObjectInt(21); ////System.out.println("\nswing="+swing); aimedBow = false; if ((lrsa % 10) > 0) { aimedBow = true; } isSneak = false; if (((lrsa % 100) / 10) > 0) { isSneak = true; } heldItemRight = ((lrsa % 1000) / 100); heldItemLeft = ((lrsa % 10000) / 1000); if (!swing) { swing = false; if (((lrsa / 10000) ) > 0) { swing = true; } } } } // ################################## // corregir altura del disparo if (targetEntity != null) { shootingEntity = this; aimedBowTick = 10; /* * //System.out.println("\n\n\n"); * * //System.out.println("#sh="+shootingEntity.getName() ); * //System.out.println("#tg="+targetEntity.getName() ); * * //System.out.println("tg height="+targetEntity.height); * //System.out.println("tg eye="+targetEntity.getEyeHeight()); */ double x = shootingEntity.posX; double y = shootingEntity.posY; double z = shootingEntity.posZ; float yaw = shootingEntity.getRotationYawHead(); // shootingEntity.rotationYaw; float pitch = shootingEntity.rotationPitch; // //System.out.println("pitch1 = "+pitch); // shootingEntity.height; this.posY = shootingEntity.posY + (double) shootingEntity.getEyeHeight() - 0.10000000149011612D; double d0 = targetEntity.posX - shootingEntity.posX; double d1 = (targetEntity.posY + targetEntity.getEyeHeight()) - (shootingEntity.posY); /// 3.0F /// targetEntity.getEntityBoundingBox().minY /// + /// (double) /// //+ /// shootingEntity.getEyeHeight() double d2 = targetEntity.posZ - shootingEntity.posZ; double d3 = (double) MathHelper.sqrt_double(d0 * d0 + d2 * d2); if (d3 >= 1.0E-7D) { float f2 = (float) (Math.atan2(d2, d0) * 180.0D / Math.PI) - 90.0F; // float f3 = (float) (-(Math.atan2(d1, d3) * 180.0D / // Math.PI)); //- float f3 = (float) ((Math.tan(d1 / d3)) * 180.0D / Math.PI); // - float f4 = (float) ((Math.atan(d1 / d3) * -1) * 180.0D / Math.PI); // - // * // 180.0D // / // Math.PI1 /* * //System.out.println("altura = "+d1); //System.out.println( * "distancia = "+d3); * * //System.out.println("f3 = "+f3); //System.out.println("f4 = " * +f4); */ pitch = f4; // pitch - // //System.out.println("pitch2 = "+pitch); } shootingEntity.setPositionAndRotation(x, y, z, yaw, pitch); // terminar una vez este muerto el objetivo if (!targetEntity.isEntityAlive()) { targetEntity = null; } } // ################################## if (this.isWet()) { this.isWet = true; this.isShaking = false; this.timeWolfIsShaking = 0.0F; this.prevTimeWolfIsShaking = 0.0F; } else if ((this.isWet || this.isShaking) && this.isShaking) { if (this.timeWolfIsShaking == 0.0F) { this.playSound("mob.wolf.shake", this.getSoundVolume(), (this.rand.nextFloat() - this.rand.nextFloat()) * 0.2F + 1.0F); } this.prevTimeWolfIsShaking = this.timeWolfIsShaking; this.timeWolfIsShaking += 0.05F; if (this.prevTimeWolfIsShaking >= 2.0F) { this.isWet = false; this.isShaking = false; this.prevTimeWolfIsShaking = 0.0F; this.timeWolfIsShaking = 0.0F; } if (this.timeWolfIsShaking > 0.4F) { float f = (float) this.getEntityBoundingBox().minY; int i = (int) (MathHelper.sin((this.timeWolfIsShaking - 0.4F) * (float) Math.PI) * 7.0F); for (int j = 0; j < i; ++j) { float f1 = (this.rand.nextFloat() * 2.0F - 1.0F) * this.width * 0.5F; float f2 = (this.rand.nextFloat() * 2.0F - 1.0F) * this.width * 0.5F; this.worldObj.spawnParticle(EnumParticleTypes.WATER_SPLASH, this.posX + (double) f1, (double) (f + 0.8F), this.posZ + (double) f2, this.motionX, this.motionY, this.motionZ, new int[0]); } } } // ### AimedBow ticks if (targetEntity != null) { aimedBow = true; } else if (!this.worldObj.isRemote) { if (aimedBowTick > 0 | aimedBow ) { aimedBow = true; if (aimedBowTick < 2) { aimedBow = false; } aimedBowTick--; } } onUpdateTick++; } // ################################################################################################################# private boolean isMasterAlive(mobMercenario mercenario) { this.getEntityData().setInteger("OwnerID", 0); OwnerID = util.getEntityOwnerID(this); //System.out.println("isMasterAlive("+OwnerID+")"); if ( (OwnerID == -1) | (OwnerID == 0) ) { NBTTagCompound data = this.getEntityData(); OwnerID = 2; //grupo Aldeanos cualquiera le dispara data.setInteger("OwnerID", OwnerID); //this.setTamed(false); } else { //master must be alive Entity master = this.worldObj.getEntityByID(OwnerID); if (master != null) { if (master instanceof EntityPlayer) { //System.out.println("isMasterAlive(True)"); NBTTagCompound masterCompound = master.getEntityData(); //mercenario theEntitycompound.getBoolean("hasStS"); int listaMercenariaTemp [] = masterCompound.getIntArray("listaMercenaria"); int lsize = listaMercenariaTemp.length; int listaMercenaria [] = new int[lsize + 1]; for (int m = 0 ; m < lsize ; m++) { listaMercenaria[m] = listaMercenariaTemp[m]; } listaMercenaria[listaMercenaria.length - 1] = mercenario.getEntityId(); masterCompound.setIntArray("listaMercenaria", listaMercenaria); //System.out.println("isMasterAlive("+listaMercenaria.length+")"); } } //int radioSerial = theEntitycompound.getInteger("radioSerial"); //int radioDialN = theEntitycompound.getInteger("radioDialN"); } return false; } // ################################################################################################################# /** * True if the wolf is wet */ @SideOnly(Side.CLIENT) public boolean isWolfWet() { return this.isWet; } // ################################################################################################################# /** * Used when calculating the amount of shading to apply while the wolf is * wet. */ @SideOnly(Side.CLIENT) public float getShadingWhileWet(float p_70915_1_) { return 0.75F + (this.prevTimeWolfIsShaking + (this.timeWolfIsShaking - this.prevTimeWolfIsShaking) * p_70915_1_) / 2.0F * 0.25F; } // ################################################################################################################# @SideOnly(Side.CLIENT) public float getShakeAngle(float p_70923_1_, float p_70923_2_) { float f2 = (this.prevTimeWolfIsShaking + (this.timeWolfIsShaking - this.prevTimeWolfIsShaking) * p_70923_1_ + p_70923_2_) / 1.8F; if (f2 < 0.0F) { f2 = 0.0F; } else if (f2 > 1.0F) { f2 = 1.0F; } return MathHelper.sin(f2 * (float) Math.PI) * MathHelper.sin(f2 * (float) Math.PI * 11.0F) * 0.15F * (float) Math.PI; } // ################################################################################################################# @SideOnly(Side.CLIENT) public float getInterestedAngle(float p_70917_1_) { return (this.headRotationCourseOld + (this.headRotationCourse - this.headRotationCourseOld) * p_70917_1_) * 0.15F * (float) Math.PI; } // ################################################################################################################# @Override public float getEyeHeight() { return 1.74F; } // ################################################################################################################# @Override /** * The speed it takes to move the entityliving's rotationPitch through the * faceEntity method. This is only currently use in wolves. */ public int getVerticalFaceSpeed() { return this.isSitting() ? 20 : super.getVerticalFaceSpeed(); } // ################################################################################################################# @Override /** * Called when the entity is attacked. */ public boolean attackEntityFrom(DamageSource source, float amount) { if (this.isEntityInvulnerable(source)) { return false; } else { Entity entity = source.getEntity(); this.aiSit.setSitting(false); if (entity != null && !(entity instanceof EntityPlayer) && !(entity instanceof EntityArrow)) { amount = (amount + 1.0F) / 2.0F; } return super.attackEntityFrom(source, amount); } } // ################################################################################################################# // se ejecuta cuando hace ataque fisico normal auna criatura @Override public boolean attackEntityAsMob(Entity p_70652_1_) { boolean flag = p_70652_1_.attackEntityFrom(DamageSource.causeMobDamage(this), (float) ((int) this.getEntityAttribute(SharedMonsterAttributes.attackDamage).getAttributeValue())); if (flag) { this.func_174815_a(this, p_70652_1_); } //p_70652_1_.setFire(10); this.swingItem(); this.swing = true; return flag; } // ################################################################################################################# @Override public void setTamed(boolean tamed) { super.setTamed(tamed); if (tamed) { this.getEntityAttribute(SharedMonsterAttributes.maxHealth).setBaseValue(20.0D); } else { this.getEntityAttribute(SharedMonsterAttributes.maxHealth).setBaseValue(8.0D); } this.getEntityAttribute(SharedMonsterAttributes.attackDamage).setBaseValue(4.0D); } // ################################################################################################################# @Override /** * Called when a player interacts with a mob. e.g. gets milk from a cow, * gets into the saddle on a pig. */ public boolean interact(EntityPlayer player) { ItemStack itemstack = player.inventory.getCurrentItem(); if (itemstack == null & !this.worldObj.isRemote) { if (this.swing) { this.swing = false; } else { this.swing = true; } } if (this.isTamed()) { if (!this.isOwner(player)) { String ow = "gente Muerta"; if (this.getOwner() != null) { ow = this.getOwner().getName(); } chat.chatda(player, "esta Entidad esta bajo el Mando de "+ow ); } if (itemstack != null) { if (itemstack.getItem() instanceof ItemFood) { ItemFood itemfood = (ItemFood) itemstack.getItem(); if (itemfood.isWolfsFavoriteMeat() && this.dataWatcher.getWatchableObjectFloat(18) < 20.0F) { if (!player.capabilities.isCreativeMode) { --itemstack.stackSize; } this.heal((float) itemfood.getHealAmount(itemstack)); if (itemstack.stackSize <= 0) { player.inventory.setInventorySlotContents(player.inventory.currentItem, (ItemStack) null); } return true; } } else if (itemstack.getItem() == Items.dye) { EnumDyeColor enumdyecolor = EnumDyeColor.byDyeDamage(itemstack.getMetadata()); if (enumdyecolor != this.getCollarColor()) { this.setCollarColor(enumdyecolor); if (!player.capabilities.isCreativeMode && --itemstack.stackSize <= 0) { player.inventory.setInventorySlotContents(player.inventory.currentItem, (ItemStack) null); } return true; } } } if (this.isOwner(player) && !this.worldObj.isRemote && (itemstack == null) ) { //!this.isBreedingItem(itemstack) if (player instanceof EntityPlayer) { chat.chatda(player, this.getName()+" is Waiting "+ !this.isSitting() ); } this.aiSit.setSitting(!this.isSitting()); this.isJumping = false; this.navigator.clearPathEntity(); this.setAttackTarget((EntityLivingBase) null); } } else { chat.chatda(player, "esta Entidad no tiene jefe " ); } boolean tamear = false; if ( itemstack != null && !this.isAngry() && !this.isTamed() & !this.worldObj.isRemote ) { if ( itemstack.getItem() == Items.diamond ) { if (!player.capabilities.isCreativeMode) { --itemstack.stackSize; } if (itemstack.stackSize <= 0) { player.inventory.setInventorySlotContents(player.inventory.currentItem, (ItemStack) null); } tamear = true; } else if ( itemstack.getItem() == Items.gold_ingot ) { if (itemstack.stackSize > 2){ if (!player.capabilities.isCreativeMode) { itemstack.stackSize -= 3; } if (itemstack.stackSize <= 0) { player.inventory.setInventorySlotContents(player.inventory.currentItem, (ItemStack) null); } tamear = true; } } if (tamear) { chat.chatda(player, this.getName()+" ha sido contratado por "+ player.getName() ); chat.chatda(player, " Esperando por Ordenes "+ this.isSitting() ); } } if (tamear) { if (!this.worldObj.isRemote) { //if (this.rand.nextInt(3) == 0) { //UUID uuid = player.getUniqueID(); String Suuid = player.getUniqueID().toString(); int OwnerID = player.getEntityId(); NBTTagCompound targetNBT = this.getEntityData(); targetNBT.setString("OwnerUUID", Suuid); // targetNBT.setInteger("OwnerID", OwnerID); NBTTagCompound playerNBT = player.getEntityData(); playerNBT.setString("OwnerUUID", Suuid); // isMasterAlive(this); this.navigator.clearPathEntity(); this.setAttackTarget((EntityLivingBase) null); this.aiSit.setSitting(true); this.setHealth(20.0F); this.setOwnerId(player.getUniqueID().toString()); this.playTameEffect(true); this.worldObj.setEntityState(this, (byte) 7); this.setTamed(true); } } return true; } return super.interact(player); } // ################################################################################################################# @Override @SideOnly(Side.CLIENT) public void handleHealthUpdate(byte p_70103_1_) { if (p_70103_1_ == { this.isShaking = true; this.timeWolfIsShaking = 0.0F; this.prevTimeWolfIsShaking = 0.0F; } else { super.handleHealthUpdate(p_70103_1_); } } // ################################################################################################################# @SideOnly(Side.CLIENT) public float getTailRotation() { return this.isAngry() ? 1.5393804F : (this.isTamed() ? (0.55F - (20.0F - this.dataWatcher.getWatchableObjectFloat(18)) * 0.02F) * (float) Math.PI : ((float) Math.PI / 5F)); } // ################################################################################################################# @Override /** * Checks if the parameter is an item which this animal can be fed to breed * it (wheat, carrots or seeds depending on the animal type) */ public boolean isBreedingItem(ItemStack stack) { return stack == null ? false : (!(stack.getItem() instanceof ItemFood) ? false : ((ItemFood) stack.getItem()).isWolfsFavoriteMeat()); } // ################################################################################################################# @Override /** * Will return how many at most can spawn in a chunk at once. */ public int getMaxSpawnedInChunk() { return 8; } // ################################################################################################################# /** * Determines whether this wolf is angry or not. */ public boolean isAngry() { return (this.dataWatcher.getWatchableObjectByte(16) & 2) != 0; } // ################################################################################################################# /** * Sets whether this wolf is angry or not. */ public void setAngry(boolean angry) { byte b0 = this.dataWatcher.getWatchableObjectByte(16); if (angry) { this.dataWatcher.updateObject(16, Byte.valueOf((byte) (b0 | 2))); } else { this.dataWatcher.updateObject(16, Byte.valueOf((byte) (b0 & -3))); } } // ################################################################################################################# public EnumDyeColor getCollarColor() { return EnumDyeColor.byDyeDamage(this.dataWatcher.getWatchableObjectByte(20) & 15); } // ################################################################################################################# public void setCollarColor(EnumDyeColor collarcolor) { this.dataWatcher.updateObject(20, Byte.valueOf((byte) (collarcolor.getDyeDamage() & 15))); } // ################################################################################################################# @Override public mobMercenario createChild(EntityAgeable ageable) { mobMercenario mobMercenario = new mobMercenario(this.worldObj); String s = this.getOwnerId(); if (s != null && s.trim().length() > 0) { mobMercenario.setOwnerId(s); mobMercenario.setTamed(true); } return mobMercenario; } // ################################################################################################################# public void func_70918_i(boolean p_70918_1_) { if (p_70918_1_) { this.dataWatcher.updateObject(19, Byte.valueOf((byte) 1)); } else { this.dataWatcher.updateObject(19, Byte.valueOf((byte) 0)); } } // ################################################################################################################# @Override /** * Returns true if the mob is currently able to mate with the specified mob. */ public boolean canMateWith(EntityAnimal otherAnimal) { if (otherAnimal == this) { return false; } else if (!this.isTamed()) { return false; } else if (!(otherAnimal instanceof mobMercenario)) { return false; } else { mobMercenario mobMercenario = (mobMercenario) otherAnimal; return !mobMercenario.isTamed() ? false : (mobMercenario.isSitting() ? false : this.isInLove() && mobMercenario.isInLove()); } } // ################################################################################################################# public boolean func_70922_bv() { return this.dataWatcher.getWatchableObjectByte(19) == 1; } // ################################################################################################################# @Override /** * Determines if an entity can be despawned, used on idle far away entities */ protected boolean canDespawn() { return !this.isTamed() && this.ticksExisted > 2400; } // ################################################################################################################# @Override public boolean func_142018_a(EntityLivingBase p_142018_1_, EntityLivingBase p_142018_2_) { if (!(p_142018_1_ instanceof EntityCreeper) && !(p_142018_1_ instanceof EntityGhast)) { if (p_142018_1_ instanceof mobMercenario) { mobMercenario mobMercenario = (mobMercenario) p_142018_1_; if (mobMercenario.isTamed() && mobMercenario.getOwnerEntity() == p_142018_2_) { return false; } } return p_142018_1_ instanceof EntityPlayer && p_142018_2_ instanceof EntityPlayer && !((EntityPlayer) p_142018_2_).canAttackPlayer((EntityPlayer) p_142018_1_) ? false : !(p_142018_1_ instanceof EntityHorse) || !((EntityHorse) p_142018_1_).isTame(); } else { return false; } } // ################################################################################################################# @Override public boolean allowLeashing() { return !this.isAngry() && super.allowLeashing(); } // ################################################################################################################# public boolean getAimedBow() { return aimedBow; } // ################################################################################################################# public void setAimedBow(boolean a) { aimedBow = a; } // ################################################################################################################# public boolean getisSneak() { return isSneak; } // ################################################################################################################# public void setisSneak(boolean s) { isSneak = s; } // ################################################################################################################# public int getHeldItemRight() { return heldItemRight; } // ################################################################################################################# public void setHeldItemRight(int r) { heldItemRight = r; } // ################################################################################################################# public int getHeldItemLeft() { return heldItemLeft; } // ################################################################################################################# public void setHeldItemLeft(int r) { heldItemLeft = r; } // ################################################################################################################# public boolean getItsSwing() { return swing; } // ################################################################################################################# public void setSwing(boolean s) { swing = s; } // ################################################################################################################# public float getSwingProgress() { return this.swingProgress; } // ################################################################################################################# public void setSwingProgress(float f) { this.swingProgress = f; } }
-
u oooo well long ago idont remenber exactly what i wass using but now im using MinecraftForge.EVENT_BUS.register(new mercenarymod.items.armasdefuego.tickHandlerArmas()); // Main event Handler and the event is //########################################################################################################################3 @SubscribeEvent public void onEntityConstructing(EntityConstructing event) { // Register extended entity properties // Herd animals if (event.entity instanceof EntityItem) { System.out.println("# Someone drops something"); EntityItem itm = (EntityItem) event.entity; ItemStack stack = itm.getEntityItem(); if (stack != null) { System.out.println("# is a"+stack.getUnlocalizedName()); } } /* if (event.entity instanceof fantasmaMercenario) { // DEBUG // System.out.println(("OnEntityConstructing register // FantasmaMercenario extended properties"); event.entity.registerExtendedProperties("ExtendedPropertiesFantasmaMercenario", new ExtendedPropertiesFantasmaMercenario()); } */ if (event.entity instanceof EntityLivingBase) { // DEBUG // System.out.println(("OnEntityConstructing register EntityLiving // extended properties"); event.entity.registerExtendedProperties("ExtendedPropertiesMercenary", new ExtendedPropertiesMercenary() ); } } //########################################################################################################################3 i alredy read that inth entityItem class /** * Returns the ItemStack corresponding to the Entity (Note: if no item exists, will log an error but still return an * ItemStack containing Block.stone) */ public ItemStack getEntityItem() but why this entity has no item por example if i throw and apple from mi inventory, is an apple has the apple texture if i pickup back still and apple or this values needs some ticks before load ?
-
long ago i try a diferent aproach in mi mod i make steel bi heating and iron ingot in the furnace and later to cold down convined it whit a water bucket in the workbench mi original idea wass to toos the hot iron item into water a shhhhh sound and the item becomes an aceromercenario Ingot i think you are triying to make the same i make and event to wach whenever the player throws something if this someting is hotIron create a invisible entity to wach over it for 20 ticks then die, if the Item is inside a water block whith 20 tics kill it and drop mi aceroMercenario ingot mi fail was i could get the item from the entityItem so i could not know what the player has droped, i redoo the code some minutes ago still have the trouble if (event.entity instanceof EntityItem) { EntityItem itm = (EntityItem) event.entity; System.out.println("# Someone drops something"); ItemStack stack = itm.getEntityItem(); if (stack != null) { System.out.println("# is a "+stack.getUnlocalizedName()); } } this is always returning System.out.println("# is a"+stack.getUnlocalizedName()); is allways returning [13:26:06] [server thread/INFO] [sTDOUT]: [mercenarymod.items.armasdefuego.tickHandlerArmas:onEntityConstructing:76]: # Someone drops something [13:26:06] [server thread/ERROR]: Item entity 244798 has no item?! [13:26:06] [server thread/INFO] [sTDOUT]: [mercenarymod.items.armasdefuego.tickHandlerArmas:onEntityConstructing:85]: # is a tile.stone.stone has no item?! and # is atile.stone.stone wtf allways say the same no mather what i drop i just get tired and leave this this way and made code on mi hotIron item class to make steel when rigthClick a filled Cauldrom
-
goo days I been having some troubles whit texture atlas for quite long and i question is way to dump this texture atlas to a nonfisical file.png in the harddrive ??
-
hey wait there is alot of little troubles when i try to do that before. - first of all the entityes continued existence is just an illusion, when you close the game everything dieded and disapear, when you reopen the minecraft it just create new entityes whith the data stored but this entityes has diferents uuid and id's values so you can'not just save entity uuid or id to the players data it will point to other entityes of to nothing at all - second i can take note of the vainilla entityes classes and save their data soo if i have a sheep i can save this entity asigning a nunmber to the classes per example sheep is number 2 wolf is number 3 so if i wana save a sheep int entiType = 2; float entiHeal = 10f; BlockPos entiPos = wever; so later in the load i can say is entiType 2 so this must be a sheep and create a new sheep whith this healt and pos values but moded entityes clases how i could save a moded entity class to later recreate it ##### Or there is and absolutly diferent an easy way to do this, an i not aware ?? for now this is mi actual IEEP saving some data and here is where sava and recreate the fantasmaMercenario Entity package mercenarymod.entidades; import java.util.UUID; import mercenarymod.utilidades.util; import net.minecraft.entity.Entity; import net.minecraft.entity.EntityLivingBase; import net.minecraft.entity.monster.EntityGolem; import net.minecraft.entity.passive.EntityVillager; import net.minecraft.item.ItemStack; import net.minecraft.nbt.NBTTagCompound; import net.minecraft.world.World; import net.minecraftforge.common.IExtendedEntityProperties; import net.minecraftforge.event.entity.living.LivingSpawnEvent; import net.minecraftforge.fml.common.eventhandler.SubscribeEvent; public class ExtendedPropertiesMercenary implements IExtendedEntityProperties { public final static String extendedPropertiesName = "extendedFantasmaMercenario"; protected EntityLivingBase theEntity; protected World theWorld; @Override public void saveNBTData(NBTTagCompound parCompound) { // DEBUG //System.out.println(("ExtendedProperties EntityLivingBase saveNBTData()")); // good idea to keep your extended properties in a sub-compound to // avoid conflicts with other possible extended properties, // even from other mods (like if a mod extends all EntityAnimal) if ( (theEntity instanceof EntityLivingBase) & !(theEntity instanceof fantasmaMercenario) ) { EntityLivingBase shootingEntity = (EntityLivingBase) theEntity; if (shootingEntity != null) { NBTTagCompound theEntitycompound = theEntity.getEntityData(); boolean hasStS = theEntitycompound.getBoolean("hasStS"); //has something to save if (hasStS) { System.out.println("hasStS=true"); boolean hasGHOST = theEntitycompound.getBoolean("hasGHOST"); boolean hasFULTON = theEntitycompound.getBoolean("hasFULTON"); boolean hasC4 = theEntitycompound.getBoolean("hasC4"); boolean hasRCbullet = theEntitycompound.getBoolean("hasRCbullet"); int OwnerID = theEntitycompound.getInteger("OwnerID"); String OwnerUUID = theEntitycompound.getString("OwnerUUID"); int radioSerial = theEntitycompound.getInteger("radioSerial"); int radioDialN = theEntitycompound.getInteger("radioDialN"); System.out.println("hasGHOST="+hasGHOST+ theEntity.getName()+" pos="+theEntity.getPosition()); NBTTagCompound compound = new NBTTagCompound(); // the entity has relevant data to save compound.setBoolean("hasStS", true); // the entity has a MercenaryGhost whatching over it compound.setBoolean("hasGHOST", hasGHOST); //the entity is atached to a fulton device WIP compound.setBoolean("hasFULTON", hasFULTON); //the entity has atached to c4 WIP compound.setBoolean("hasC4", hasC4); //the entity has been damage for redclub munition compound.setBoolean("hasRCbullet", hasRCbullet); //the owner id of this entity compound.setInteger("OwnerID", OwnerID); //the owner UUid of this entity compound.setString("OwnerUUID", OwnerUUID); parCompound.setTag(extendedPropertiesName, compound); // set as sub-compound } } } } @Override public void loadNBTData(NBTTagCompound parCompound) { // DEBUG //System.out.println(("ExtendedPropertiesH EntityLivingBase loadNBTData()")); // Get the sub-compound NBTTagCompound compound = (NBTTagCompound) parCompound.getTag(extendedPropertiesName); if (compound != null) { NBTTagCompound theEntitycompound = theEntity.getEntityData(); boolean hasStS = theEntitycompound.getBoolean("hasStS"); boolean hasGHOST = theEntitycompound.getBoolean("hasGHOST"); boolean hasFULTON = theEntitycompound.getBoolean("hasFULTON"); boolean hasC4 = theEntitycompound.getBoolean("hasC4"); boolean hasRCbullet = theEntitycompound.getBoolean("hasRCbullet"); int OwnerID = theEntitycompound.getInteger("OwnerID"); String OwnerUUID = theEntitycompound.getString("OwnerUUID"); if ( OwnerID != 0) //then this has a master, set the UUID { theEntitycompound.setString("OwnerUUID", OwnerUUID); theEntitycompound.setInteger("OwnerID", 0); //get the master ID for this this sesion and save it to entity util.getEntityOwnerID(theEntity); System.out.println("OwnerID set to="+util.getEntityOwnerID(theEntity)); } if (hasGHOST){ // i notice that loadNBTData() some times run 2 or 3 times over the same creature // so this check if the entity has already a ghost before conjuring a new one util.getFantasma(theEntity, null); System.out.println("hasGHOST=Conjured for"+ theEntity.getName()+" pos="+theEntity.getPosition() ); } } } // ########################################################################################################################3 // conjurar espirito // @SubscribeEvent // ########################################################################################################################3 @Override public void init(Entity entity, World world) { // DEBUG // System.out.println(("ExtendedProperties EntityLivingBase init()"); theEntity = (EntityLivingBase) entity; theWorld = world; } }
-
E pues Nop precisely the trouble is that the gui is not always at 10% de X and 10% de Y posX= ( (int) (displayWidth * 0.1F) ); posY= ( (int) (displayHeight * 0.1F) ); per example in this picture im playing whith the maximed, the window size is 1680x970 the gui position is set as 10% 10% of this values so posX=168 posY=97 are the same in all the four pictures but the gui end in diferents places the closes to 10% 10% is the one when guiscale=1 and the fartest is guiscale=0 looks more like a 22% 75% http://s7.postimg.org/ow0trlgmj/gui_1680x970.png dont press atention the ppx ppy i made that yesterday soo i could move the gui manually whithout restarting the game in this picture i keep that values at zero but in this video is whith the values aproximated to leftBotom corner not 10% 10% is just to show the other gui whith the buttons
-
e nop the entityes are smart enough to use guns but dumb to use the radio the radio is an item in the player inventory to manage the mercenaryes so it must be a list in the radio item of the mercenaries loyal to the player so it could call and teleport this entities next to the player even those to far or in a unloaded chunck in the world
-
I got this in mi head well not so in mi head alredy much of the code is done i been creating mercenary entityes, you buy their loyalty whith gold so they help you, follow you and, well at least not kill you soo i also make a radio item that is sopused (not finish yet) to be used to call the mercenaries, to set target entitys to kill, and to manage the mercernaries equipment well the trouble comes when you close the game, the radio has a Mercenarys List this entity list i can'not save it as nbt ad if where posible the entityes are just references dont gonna works when reload the world ArrayList<aldeanoMercenario00> mercenaryList = new ArrayList<aldeanoMercenario00>(); if the radio dont'n have the entitye list the it could not recall my mercenaryes i made an ExtendedPropertieEntityLiving the mercenaryes save the value of "OwnerUUID" String OwnerUUID = theEntitycompound.getString("OwnerUUID"); soo they are still loyal to me but the radio dont works when reopen minecraft i need a way to save the entityes to the radio item an was tinking in the pokeball mod from grim3212 this pockeball item is capable of save not only vainilla but also moded entityes i wanna know the idea of how this pockeball works, to see if i can adapt it to mi mercenary radio some one knows how goes the pockeball code ?? thanks for reading is a little hard to espress complex ideas in english
-
well i actually leave this in a (deje así) state and work arounded using the things i learn whith the questions in this other post http://www.minecraftforge.net/forum/index.php/topic,35931.0.html ##### Have you tried writing the positions to the log along with the screen width values? What does it say when the position appears wrong on the screen for: 1. The position of your gui element 2. The width of the screen ##### yes but i want the gui to keep aligned whith corner all the time, when windowed when maximaxed or when full screen hand coded the closest values to what i want are the ones from switch(guiscale) { case 0: { posX=10; posY= 200; //x=30; } ;break; case 3: { posX=10;//( (int) (displayWidth * 0.025F) ); //30 controls the gui size posY=( (int) (displayHeight * 0.30F) ); //x=40; //gui size } ;break; case 2: { posX=10;//( (int) (displayWidth * 0.025F) ); //30 controls the gui size posY=( (int) (displayHeight * 0.45F) ); //x=40; //gui size } ;break; case 1: { posX=10;//( (int) (displayWidth * 0.05F) ); //16; //controls the gui size posY=( (int)(displayHeight * 0.92F)); //x=40; //gui size } ;break; } but if you changes whindows mode or size the gui some times to ends to much up, some times half out of the botom for what i learn scavenguin the code from other moders i theorized than for this case and only this gui type, minecraft internally is using his own values to set the elements in the window totally ignoring the values from displayWidth and displayHeight a bether try to explain this i put some buttons in another gui to manually move the guns gui position and whit this buttons move the gui to the upper right corner soo i could know the trully values of height and width and looks like http://s11.postimg.org/65jvxnedv/Pantallazo_25.png[/img] defaults windowed at 854x480 when: guiscale=0 displayWidth=854 displayHeight=480 posX=415 posY=238 the truly window size is like 420 x 240 set guiscale to 1 the gui is now in middle so manully set it again to upper right when: guiscale=1 displayWidth=854 displayHeight=480 posX=845 posY=458 when: guiscale=1 the true size is like 460 x 480 but the real windows size has not change still at 854x480 now whithout changing nothing i maximaxed the window and mi gui goes to the center again and whoa the numbers change again guiscale=1 displayWidth=1680 displayHeight=970 posX=928 //i supouse thiis diferent coz the posX= ( (int) (displayWidth * 0.1F) ); posY=507 so i manually move the gui to bottom right again posX=1668 posY=957 and now looks like the real value is the same as displayWidth and displayHeight ### Well the is no patron here the real internal size width height values are diferent from the one i get from displayWidth displayHeight and values are afected by the guiscale value and the real window size and mode in the other type of gui the one we use to make the chest like guis take this values from the gui class /** The width of the screen object. */ public int width; /** The height of the screen object. */ public int height; but when i call this values from mi gun gui this returns allways zeros and mi gui class is extending GuiScreen and that one is extends Gui public class NotificationMercenaria extends GuiScreen // Gui System.out.println("this.width ="+this.width); System.out.println("this.height="+this.height); returns [10:44:12][mercenarymod.gui.NotificationMercenaria:onRender:1963]: this.width =0 [10:44:12][mercenarymod.gui.NotificationMercenaria:onRender:1964]: this.height=0 well i also change mi class to extends Gui but no look it still returns zeroes public class NotificationMercenaria extends Gui jummmmm well i alredy leave this issue in (deje así) state I just set some buttons for the user to manually set gui position to wherever he/her/it wants but it would be nine to know how to get the internal windows size values are ############ well this has become to long this is testing code in mi gui class displayWidth=mc.displayWidth; displayHeight=mc.displayHeight; guiscale=mc.gameSettings.guiScale; System.out.println("guiscale="+guiscale); System.out.println("displayWidth="+displayWidth); System.out.println("displayHeight="+displayHeight); posX= ( (int) (displayWidth * 0.1F) ); posY= ( (int) (displayHeight * 0.1F) ); //Offset added for the gui whit the buttons posX = posX + ppx; posY = posY + ppy; System.out.println("posX="+posX ); System.out.println("posY="+posY ); System.out.println("\n\n\n" ); console output [10:12:05] [Client thread/INFO] [sTDOUT]: [mercenarymod.gui.NotificationMercenaria:onRender:1952]: guiscale=0 [10:12:05] [Client thread/INFO] [sTDOUT]: [mercenarymod.gui.NotificationMercenaria:onRender:1953]: displayWidth=854 [10:12:05] [Client thread/INFO] [sTDOUT]: [mercenarymod.gui.NotificationMercenaria:onRender:1954]: displayHeight=480 [10:12:05] [Client thread/INFO] [sTDOUT]: [mercenarymod.gui.NotificationMercenaria:onRender:2006]: posX=415 [10:12:05] [Client thread/INFO] [sTDOUT]: [mercenarymod.gui.NotificationMercenaria:onRender:2007]: posY=238 and this is the full guns gui class thanks fro reading ther is other things in this class but relevant code come from the 1890 line package mercenarymod.gui; import mercenarymod.Mercenary; import mercenarymod.items.MercenaryModItems; import mercenarymod.utilidades.chat; import mercenarymod.utilidades.util; import net.minecraft.client.Minecraft; import net.minecraft.client.gui.Gui; import net.minecraft.client.gui.GuiScreen; import net.minecraft.client.gui.ScaledResolution; import net.minecraft.client.renderer.GlStateManager; import net.minecraft.client.renderer.entity.RenderItem; import net.minecraft.client.resources.model.ModelManager; import net.minecraft.entity.EntityLivingBase; import net.minecraft.entity.player.EntityPlayer; import net.minecraft.item.Item; import net.minecraft.item.ItemStack; import net.minecraft.nbt.NBTTagCompound; import net.minecraft.util.MovingObjectPosition; import net.minecraft.util.ResourceLocation; import net.minecraft.util.Vec3; import net.minecraftforge.client.event.RenderGameOverlayEvent; import net.minecraftforge.client.event.GuiScreenEvent.InitGuiEvent; import net.minecraftforge.common.MinecraftForge; import net.minecraftforge.common.config.Configuration; import net.minecraftforge.common.config.Property; import net.minecraftforge.fml.common.eventhandler.EventPriority; import net.minecraftforge.fml.common.eventhandler.SubscribeEvent; import org.lwjgl.input.Mouse; import org.lwjgl.opengl.GL11; import org.lwjgl.util.Color; import org.lwjgl.util.ReadableColor; public class NotificationMercenaria extends GuiScreen // Gui { private static Minecraft mc; private static int posX=0; private static int posY=0; private int mulY=-1; private int displayWidth=0; private int displayHeight=0; public static int ppx=0; public static int ppy=0; private static int guiTick = 0; private int guiscale=0; public static int x=30; //gui size private static float xf=x+0.0F; private float balas=0; private int tipoBalas=0; private static long systemTime=0; private static int graficaltick=0; //conteo para sincronizar las animaciones con el mundo local private static int conteo=0; //conteo para llevar los tiempos en que se actualiza la gui private static int conteo100=0; //conteo para ciclar las texturas en los items private static int conteo200=0; //conteo para ciclar las texturas en los items private static int vlmunicion=0; //conteo para llevar la cuenta del consumo de redstone private static boolean permitirVlmunicion=true; //conteo para evitar que vlmunicion cuente mas de una vez por tick private static int lconteo=0; //conteo para llevar el tiempo que se presion click izquierdo private static int rconteo=0; //conteo para llevar el tiempo que se presion click izquierdo private static int mensage00=0; private static boolean permitirLdisparo2s =true; //conteo para evitar que se dispare mas de una granada en 2 seg private int permitirLdisparo2sConteo=0;//conteo para la variable anterior private static boolean permitirSonido=true; //conteo para evitar que el mismo sonido se ejecute mas de una vez por tick private static boolean permitirMensaje=true; private String icono0="modmercenario:textures/items/gui/transparencia.png";//transparencia private String icono1="modmercenario:textures/items/gui/transparencia.png";//transparencia private String icono2="modmercenario:textures/items/gui/transparencia.png";//transparencia private String icono3="modmercenario:textures/items/gui/transparencia.png";//transparencia private String icono4="modmercenario:textures/items/gui/transparencia.png";//transparencia private String icono5="modmercenario:textures/items/gui/transparencia.png";//transparencia boolean transparencia=true; private int metadata=0; private int municion =0; private int municionmaxima =0; private int municiondisponible=0; private int tipomunicion=0; private int tipomunicionDisplay=0; private int tipocargador=0; private int tipocargadormax=0; private int tipodisparo=0; private int tipodisparomax=0; private boolean habilitado=false; private boolean recargando=false; private boolean descargar=false; private boolean descargando=false; private boolean remplazando=false; private boolean reload=false; private boolean cargar=false; private boolean shoot=false; private boolean unload=false; private float strength=0.0F; private boolean enable=false; private static int texturajson = 0; private static int accion = 0; private String text0 = ""; private static Configuration configFile; public NotificationMercenaria(Minecraft mc) { super(); this.mc = mc; this.configFile = Mercenary.getConfigFile(); if (configFile != null){ Property cfg_guiX = configFile.get("Gui", "Gui pos X", 0, "posicion x de la gui"); Property cfg_guiY = configFile.get("Gui", "Gui pos Y", 0, "posicion y de la gui"); Property cfg_guiSize = configFile.get("Gui", "Gui Size", 30, "Tamaño de la gui"); // saving the configuration to its file //configFile.save(); ppx = cfg_guiX.getInt(0); ppy = cfg_guiY.getInt(0); x = cfg_guiSize.getInt(30); } } //####################################################################################################################3 @SubscribeEvent(priority = EventPriority.NORMAL) public void onRender(RenderGameOverlayEvent event) { //Render above the chat if(event.isCancelable() || event.type != RenderGameOverlayEvent.ElementType.ALL) return; //Render only if there's a new notification //if (step == -1) return; conteo++; if ( (conteo % 30)==0 ) { permitirMensaje = true; } if ( (conteo%4)==0 )//systemTime { conteo100 ++; graficaltick ++; permitirSonido=true; permitirVlmunicion=true; if (Mouse.isButtonDown(0) & (Minecraft.getMinecraft().currentScreen == null) ) { lconteo +=4; } else { lconteo= 0 ; } if (Mouse.isButtonDown(1) & (Minecraft.getMinecraft().currentScreen == null) ) { rconteo +=4; } else { rconteo= 0 ; } } if(!permitirLdisparo2s){ permitirLdisparo2sConteo ++; if (permitirLdisparo2sConteo > 10 ){ permitirLdisparo2sConteo=0; permitirLdisparo2s=true; } } if ( (conteo%20)==0 & Mercenary.getGuiOn() ) { int modo=0; if (conteo > 20000) { conteo=0; } if (guiTick > 0) { guiTick--; } //tckin para controlar las animaciones if (conteo100 > 20000) { conteo100=0; } EntityPlayer playerIn=mc.thePlayer; int hand = playerIn.inventory.currentItem; ItemStack stack0 = playerIn.inventory.getCurrentItem(); icono0="modmercenario:textures/items/gui/transparencia.png"; icono1="modmercenario:textures/items/gui/transparencia.png"; icono2="modmercenario:textures/items/gui/transparencia.png"; icono3="modmercenario:textures/items/gui/transparencia.png"; icono4="modmercenario:textures/items/gui/transparencia.png"; icono5="modmercenario:textures/items/gui/transparencia.png"; text0=""; tipomunicionDisplay=0; if (stack0 != null ) { Item item0 = stack0.getItem(); boolean transparencia=true; NBTTagCompound etiquetas = stack0.getTagCompound(); if (etiquetas != null) { metadata = stack0.getMetadata(); municion = getInttag(stack0, "municion"); municionmaxima =getInttag(stack0, "municionmaxima"); municiondisponible=getInttag(stack0, "municiondisponible"); tipomunicion=getInttag(stack0, "tipomunicion"); tipocargador=getInttag(stack0, "tipocargador"); tipocargadormax=getInttag(stack0, "tipocargadormax"); tipodisparo=getInttag(stack0, "tipodisparo"); tipodisparomax=getInttag(stack0, "tipodisparomax"); reload= getBooleantag(stack0, "reload"); cargar= getBooleantag(stack0, "cargar"); shoot= getBooleantag(stack0, "shoot"); unload= getBooleantag(stack0, "unload"); strength=getFloattag(stack0, "strength"); enable= getBooleantag(stack0, "enable"); habilitado= getBooleantag(stack0, "habilitado"); recargando= getBooleantag(stack0, "recargando"); descargar= getBooleantag(stack0, "descargar"); descargando= getBooleantag(stack0, "descargando"); remplazando= getBooleantag(stack0, "remplazando"); int lmunicion = getInttag(stack0, "lmunicion"); int ltipomunicion=getInttag(stack0, "ltipomunicion"); if (unload) {modo=1;} if (tipocargador<=0) {modo=2;} //######################## if ( item0.equals(MercenaryModItems.fusilSCARH) | item0.equals(MercenaryModItems.fusilSCARHB) | item0.equals(MercenaryModItems.fusilSCARHG) ) { switch (tipomunicion) { case 0: icono5="modmercenario:textures/items/gui/transparencia.png";break; case 1: icono5="modmercenario:textures/items/gui/A.png";break; case 2: icono5="modmercenario:textures/items/gui/R.png";break; case 3: icono5="modmercenario:textures/items/gui/O.png";break; } icono0="modmercenario:textures/items/armasdefuego/fusilscar/scarh_icono.png"; if (recargando | descargando | remplazando) { icono0="modmercenario:textures/items/armasdefuego/fusilscar/scarh_iconoInv.png"; icono4="modmercenario:textures/items/gui/transparencia.png"; icono5="modmercenario:textures/items/gui/transparencia.png"; } switch(tipodisparo) { case 2: icono1="modmercenario:textures/items/gui/auto.png";break; case 0: icono1="modmercenario:textures/items/gui/manual.png";break; case 1: icono1="modmercenario:textures/items/gui/semiAuto.png";break; } transparencia=false; text0=""+municion+"/"+municionmaxima; icono3="modmercenario:textures/items/gui/botones.png"; switch (tipomunicion) { case 1: tipomunicionDisplay=20;break; case 2: tipomunicionDisplay=21;break; case 3: tipomunicionDisplay=22;break; } if (item0.equals(MercenaryModItems.fusilSCARHG)){ if (lmunicion > 0) { switch (ltipomunicion) { case 0: icono4="modmercenario:textures/items/gui/transparencia.png";break; case 1: icono4="modmercenario:textures/items/gui/GA.png";break; case 2: icono4="modmercenario:textures/items/gui/GR.png";break; case 3: icono4="modmercenario:textures/items/gui/GO.png";break; } } else { switch (ltipomunicion) { case 0: icono4="modmercenario:textures/items/gui/transparencia.png";break; case 1: icono4="modmercenario:textures/items/gui/dA.png";break; case 2: icono4="modmercenario:textures/items/gui/dR.png";break; case 3: icono4="modmercenario:textures/items/gui/dO.png";break; } } } } //######################## if ( item0.equals(MercenaryModItems.fusil47AK) | item0.equals(MercenaryModItems.fusil47AKB) | item0.equals(MercenaryModItems.fusil47AKG) ) { switch (tipomunicion) { case 0: icono5="modmercenario:textures/items/gui/transparencia.png";break; case 1: icono5="modmercenario:textures/items/gui/A.png";break; case 2: icono5="modmercenario:textures/items/gui/R.png";break; case 3: icono5="modmercenario:textures/items/gui/O.png";break; } icono0="modmercenario:textures/items/armasdefuego/fusil200ak/fusil47ak_icono.png"; if (recargando | descargando | remplazando) { icono0="modmercenario:textures/items/armasdefuego/fusil200ak/fusil47ak_iconoInv.png"; icono4="modmercenario:textures/items/gui/transparencia.png"; icono5="modmercenario:textures/items/gui/transparencia.png"; } switch(tipodisparo) { case 2: icono1="modmercenario:textures/items/gui/auto.png";break; case 0: icono1="modmercenario:textures/items/gui/manual.png";break; case 1: icono1="modmercenario:textures/items/gui/semiAuto.png";break; } transparencia=false; text0=""+municion+"/"+municionmaxima; icono3="modmercenario:textures/items/gui/botones.png"; switch (tipomunicion) { case 1: tipomunicionDisplay=20;break; case 2: tipomunicionDisplay=21;break; case 3: tipomunicionDisplay=22;break; } if (item0.equals(MercenaryModItems.fusil47AKG)){ if (lmunicion > 0) { switch (ltipomunicion) { case 0: icono4="modmercenario:textures/items/gui/transparencia.png";break; case 1: icono4="modmercenario:textures/items/gui/GA.png";break; case 2: icono4="modmercenario:textures/items/gui/GR.png";break; case 3: icono4="modmercenario:textures/items/gui/GO.png";break; } } else { switch (ltipomunicion) { case 0: icono4="modmercenario:textures/items/gui/transparencia.png";break; case 1: icono4="modmercenario:textures/items/gui/dA.png";break; case 2: icono4="modmercenario:textures/items/gui/dR.png";break; case 3: icono4="modmercenario:textures/items/gui/dO.png";break; } } } } //######################## if (item0.equals(MercenaryModItems.cargador76239)) { switch (tipomunicion) { case 0: icono5="modmercenario:textures/items/gui/transparencia.png";break; case 1: icono5="modmercenario:textures/items/gui/A.png";break; case 2: icono5="modmercenario:textures/items/gui/R.png";break; case 3: icono5="modmercenario:textures/items/gui/O.png";break; } switch (tipocargador) { case 1: icono0="modmercenario:textures/items/armasdefuego/cargador76239/cargador76239_CC_icono.png";break; case 2: icono0="modmercenario:textures/items/armasdefuego/cargador76239/cargador76239_CL_icono.png";break; case 3: icono0="modmercenario:textures/items/armasdefuego/cargador76239/cargador55645_CG_icono.png";break; } if (descargar | descargando ) { switch (tipocargador) { case 1: icono0="modmercenario:textures/items/armasdefuego/cargador76239/cargador76239_CC_iconoInv.png";break; case 2: icono0="modmercenario:textures/items/armasdefuego/cargador76239/cargador76239_CL_iconoInv.png";break; case 3: icono0="modmercenario:textures/items/armasdefuego/cargador76239/cargador76239_CG_iconoInv.png";break; } //icono4="modmercenario:textures/items/gui/transparencia.png"; //icono5="modmercenario:textures/items/gui/transparencia.png"; } switch (tipomunicion) { case 1: tipomunicionDisplay=20;break; case 2: tipomunicionDisplay=21;break; case 3: tipomunicionDisplay=22;break; } text0=""+municion+" / "+municionmaxima ; transparencia=false; switch (tipomunicion) { case 1:icono1="modmercenario:textures/items/gui/botones_ARO_A.png";break; case 2:icono1="modmercenario:textures/items/gui/botones_ARO_R.png";break; case 3:icono1="modmercenario:textures/items/gui/botones_ARO_O.png";break; } icono3="modmercenario:textures/items/gui/botones.png"; } //######################## if ( item0.equals(MercenaryModItems.fusil200AK) | item0.equals(MercenaryModItems.fusil200AKB) | item0.equals(MercenaryModItems.fusil200AKG) ) { switch (tipomunicion) { case 0: icono5="modmercenario:textures/items/gui/transparencia.png";break; case 1: icono5="modmercenario:textures/items/gui/A.png";break; case 2: icono5="modmercenario:textures/items/gui/R.png";break; case 3: icono5="modmercenario:textures/items/gui/O.png";break; } icono0="modmercenario:textures/items/armasdefuego/fusil200ak/fusil200ak_icono.png"; if ( recargando | descargando | remplazando) { icono0="modmercenario:textures/items/armasdefuego/fusil200ak/fusil200ak_iconoInv.png"; icono4="modmercenario:textures/items/gui/transparencia.png"; icono5="modmercenario:textures/items/gui/transparencia.png"; } switch(tipodisparo) { case 2: icono1="modmercenario:textures/items/gui/auto.png";break; case 0: icono1="modmercenario:textures/items/gui/manual.png";break; case 1: icono1="modmercenario:textures/items/gui/semiAuto.png";break; } transparencia=false; text0=""+municion+"/"+municionmaxima; icono3="modmercenario:textures/items/gui/botones.png"; switch (tipomunicion) { case 1: tipomunicionDisplay=14;break; case 2: tipomunicionDisplay=15;break; case 3: tipomunicionDisplay=16;break; } if (item0.equals(MercenaryModItems.fusil200AKG)){ if (lmunicion > 0) { switch (ltipomunicion) { case 0: icono4="modmercenario:textures/items/gui/transparencia.png";break; case 1: icono4="modmercenario:textures/items/gui/GA.png";break; case 2: icono4="modmercenario:textures/items/gui/GR.png";break; case 3: icono4="modmercenario:textures/items/gui/GO.png";break; } } else { switch (ltipomunicion) { case 0: icono4="modmercenario:textures/items/gui/transparencia.png";break; case 1: icono4="modmercenario:textures/items/gui/dA.png";break; case 2: icono4="modmercenario:textures/items/gui/dR.png";break; case 3: icono4="modmercenario:textures/items/gui/dO.png";break; } } } } //######################## if ( item0.equals(MercenaryModItems.fusilM4A1) | item0.equals(MercenaryModItems.fusilM4A1B) | item0.equals(MercenaryModItems.fusilM4A1G) ) { switch (tipomunicion) { case 0: icono5="modmercenario:textures/items/gui/transparencia.png";break; case 1: icono5="modmercenario:textures/items/gui/A.png";break; case 2: icono5="modmercenario:textures/items/gui/R.png";break; case 3: icono5="modmercenario:textures/items/gui/O.png";break; } icono0="modmercenario:textures/items/armasdefuego/fusilm4a1/fusilm4a1_icono.png"; if ( recargando | descargando | remplazando) { icono0="modmercenario:textures/items/armasdefuego/fusilm4a1/fusilm4a1_iconoInv.png"; icono4="modmercenario:textures/items/gui/transparencia.png"; icono5="modmercenario:textures/items/gui/transparencia.png"; } switch(tipodisparo) { case 2: icono1="modmercenario:textures/items/gui/auto.png";break; case 0: icono1="modmercenario:textures/items/gui/manual.png";break; case 1: icono1="modmercenario:textures/items/gui/semiAuto.png";break; } transparencia=false; text0=""+municion+"/"+municionmaxima; icono3="modmercenario:textures/items/gui/botones.png"; switch (tipomunicion) { case 1: tipomunicionDisplay=14;break; case 2: tipomunicionDisplay=15;break; case 3: tipomunicionDisplay=16;break; } if (item0.equals(MercenaryModItems.fusilM4A1G)){ if (lmunicion > 0) { switch (ltipomunicion) { case 0: icono4="modmercenario:textures/items/gui/transparencia.png";break; case 1: icono4="modmercenario:textures/items/gui/GA.png";break; case 2: icono4="modmercenario:textures/items/gui/GR.png";break; case 3: icono4="modmercenario:textures/items/gui/GO.png";break; } } else { switch (ltipomunicion) { case 0: icono4="modmercenario:textures/items/gui/transparencia.png";break; case 1: icono4="modmercenario:textures/items/gui/dA.png";break; case 2: icono4="modmercenario:textures/items/gui/dR.png";break; case 3: icono4="modmercenario:textures/items/gui/dO.png";break; } } } } //######################## if (item0.equals(MercenaryModItems.cargador5728)) { switch (tipomunicion) { case 0: icono5="modmercenario:textures/items/gui/transparencia.png";break; case 1: icono5="modmercenario:textures/items/gui/A.png";break; case 2: icono5="modmercenario:textures/items/gui/R.png";break; case 3: icono5="modmercenario:textures/items/gui/O.png";break; } switch (tipocargador) { case 1: icono0="modmercenario:textures/items/armasdefuego/cargador5728/cargador5728_CC_icono.png";break; case 2: icono0="modmercenario:textures/items/armasdefuego/cargador5728/cargador5728_CL_icono.png";break; case 3: icono0="modmercenario:textures/items/armasdefuego/cargador5728/cargador5728_CG_icono.png";break; } if (descargar | descargando ) { switch (tipocargador) { case 1: icono0="modmercenario:textures/items/armasdefuego/cargador5728/cargador5728_CC_iconoInv.png";break; case 2: icono0="modmercenario:textures/items/armasdefuego/cargador5728/cargador5728_CL_iconoInv.png";break; case 3: icono0="modmercenario:textures/items/armasdefuego/cargador5728/cargador5728_CG_iconoInv.png";break; } } switch (tipomunicion) { case 1: tipomunicionDisplay=5;break; case 2: tipomunicionDisplay=6;break; case 3: tipomunicionDisplay=7;break; } text0=""+municion+" / "+municionmaxima ; transparencia=false; switch (tipomunicion) { case 1:icono1="modmercenario:textures/items/gui/botones_ARO_A.png";break; case 2:icono1="modmercenario:textures/items/gui/botones_ARO_R.png";break; case 3:icono1="modmercenario:textures/items/gui/botones_ARO_O.png";break; } icono3="modmercenario:textures/items/gui/botones.png"; } //######################## if (item0.equals(MercenaryModItems.pistola57NF)) { switch (tipomunicion) { case 0: icono5="modmercenario:textures/items/gui/transparencia.png";break; case 1: icono5="modmercenario:textures/items/gui/A.png";break; case 2: icono5="modmercenario:textures/items/gui/R.png";break; case 3: icono5="modmercenario:textures/items/gui/O.png";break; } icono0="modmercenario:textures/items/armasdefuego/pistola75nf/75NF_icono.png"; if ( recargando | descargando | remplazando) { icono0="modmercenario:textures/items/armasdefuego/pistola75nf/75NF_iconoInv.png"; icono4="modmercenario:textures/items/gui/transparencia.png"; icono5="modmercenario:textures/items/gui/transparencia.png"; } transparencia=false; text0=""+municion+"/"+municionmaxima; icono1="modmercenario:textures/items/gui/manualO.png"; icono3="modmercenario:textures/items/gui/botonesAsterisco.png"; switch (tipomunicion) { case 1: tipomunicionDisplay=5;break; case 2: tipomunicionDisplay=6;break; case 3: tipomunicionDisplay=7;break; } } //######################## if (item0.equals(MercenaryModItems.subfusil90PNF)) { switch (tipomunicion) { case 0: icono5="modmercenario:textures/items/gui/transparencia.png";break; case 1: icono5="modmercenario:textures/items/gui/A.png";break; case 2: icono5="modmercenario:textures/items/gui/R.png";break; case 3: icono5="modmercenario:textures/items/gui/O.png";break; } icono0="modmercenario:textures/items/armasdefuego/subfusil90pnf/90PNF_icono.png"; if ( recargando | descargando | remplazando) { icono0="modmercenario:textures/items/armasdefuego/subfusil90pnf/90PNF_iconoInv.png"; icono4="modmercenario:textures/items/gui/transparencia.png"; icono5="modmercenario:textures/items/gui/transparencia.png"; } transparencia=false; text0=""+municion+"/"+municionmaxima; icono1="modmercenario:textures/items/gui/manualO.png"; icono3="modmercenario:textures/items/gui/botonesAsterisco.png"; switch(tipodisparo) { case 2: icono1="modmercenario:textures/items/gui/auto.png";break; case 0: icono1="modmercenario:textures/items/gui/manual.png";break; case 1: icono1="modmercenario:textures/items/gui/semiAuto.png";break; } switch (tipomunicion) { case 1: tipomunicionDisplay=5;break; case 2: tipomunicionDisplay=6;break; case 3: tipomunicionDisplay=7;break; } } //######################## if (item0.equals(MercenaryModItems.subfusil57ar)) { switch (tipomunicion) { case 0: icono5="modmercenario:textures/items/gui/transparencia.png";break; case 1: icono5="modmercenario:textures/items/gui/A.png";break; case 2: icono5="modmercenario:textures/items/gui/R.png";break; case 3: icono5="modmercenario:textures/items/gui/O.png";break; } icono0="modmercenario:textures/items/armasdefuego/subfusil75ar/75ar_icono.png"; if ( recargando | descargando | remplazando) { icono0="modmercenario:textures/items/armasdefuego/subfusil75ar/75ar_iconoInv.png"; icono4="modmercenario:textures/items/gui/transparencia.png"; icono5="modmercenario:textures/items/gui/transparencia.png"; } transparencia=false; text0=""+municion+"/"+municionmaxima; icono1="modmercenario:textures/items/gui/manualO.png"; icono3="modmercenario:textures/items/gui/botonesAsterisco.png"; switch(tipodisparo) { case 2: icono1="modmercenario:textures/items/gui/auto.png";break; case 0: icono1="modmercenario:textures/items/gui/manual.png";break; case 1: icono1="modmercenario:textures/items/gui/semiAuto.png";break; } switch (tipomunicion) { case 1: tipomunicionDisplay=5;break; case 2: tipomunicionDisplay=6;break; case 3: tipomunicionDisplay=7;break; } } //######################## if ( (item0.equals(MercenaryModItems.cargadorFM9X)) ) { switch (tipomunicion) { case 0: icono5="modmercenario:textures/items/gui/transparencia.png";break; case 1: icono5="modmercenario:textures/items/gui/H.png";break; case 2: icono5="modmercenario:textures/items/gui/R.png";break; case 3: icono5="modmercenario:textures/items/gui/O.png";break; } switch (tipocargador) { case 1: icono0="modmercenario:textures/items/armasdefuego/cargadorfm9x/mf9x_CC_icono.png";break; case 2: icono0="modmercenario:textures/items/armasdefuego/cargadorfm9x/mf9x_CL_icono.png";break; case 3: icono0="modmercenario:textures/items/armasdefuego/cargadorfm9x/mf9x_CG_icono.png";break; } if (descargar | descargando ) { switch (tipocargador) { case 1: icono0="modmercenario:textures/items/armasdefuego/cargadorfm9x/mf9x_CC_iconoInv.png";break; case 2: icono0="modmercenario:textures/items/armasdefuego/cargadorfm9x/mf9x_CL_iconoInv.png";break; case 3: icono0="modmercenario:textures/items/armasdefuego/cargadorfm9x/mf9x_CG_iconoInv.png";break; } } switch (tipomunicion) { case 1: tipomunicionDisplay=2;break; case 2: tipomunicionDisplay=3;break; case 3: tipomunicionDisplay=4;break; } text0=""+municion+" / "+municionmaxima ; transparencia=false; switch (tipomunicion) { case 1:icono1="modmercenario:textures/items/gui/botones_ARO_A.png";break; case 2:icono1="modmercenario:textures/items/gui/botones_ARO_R.png";break; case 3:icono1="modmercenario:textures/items/gui/botones_ARO_O.png";break; } icono3="modmercenario:textures/items/gui/botones.png"; } //######################## if (item0.equals(MercenaryModItems.pistolaFM92)) { switch (tipomunicion) { case 0: icono5="modmercenario:textures/items/gui/transparencia.png";break; case 1: icono5="modmercenario:textures/items/gui/H.png";break; case 2: icono5="modmercenario:textures/items/gui/R.png";break; case 3: icono5="modmercenario:textures/items/gui/O.png";break; } icono0="modmercenario:textures/items/armasdefuego/armas9mm/92_icono.png"; if ( recargando | descargando | remplazando) { icono0="modmercenario:textures/items/armasdefuego/armas9mm/92_iconoInv.png"; icono4="modmercenario:textures/items/gui/transparencia.png"; icono5="modmercenario:textures/items/gui/transparencia.png"; } transparencia=false; text0=""+municion+"/"+municionmaxima; icono1="modmercenario:textures/items/gui/manualO.png"; icono3="modmercenario:textures/items/gui/botonesAsterisco.png"; switch (tipomunicion) { case 1: tipomunicionDisplay=2;break; case 2: tipomunicionDisplay=3;break; case 3: tipomunicionDisplay=4;break; } } //######################## if (item0.equals(MercenaryModItems.pistolaFM93R)) { switch (tipomunicion) { case 0: icono5="modmercenario:textures/items/gui/transparencia.png";break; case 1: icono5="modmercenario:textures/items/gui/H.png";break; case 2: icono5="modmercenario:textures/items/gui/R.png";break; case 3: icono5="modmercenario:textures/items/gui/O.png";break; } icono0="modmercenario:textures/items/armasdefuego/armas9mm/93r_icono.png"; if ( recargando | descargando | remplazando) { icono0="modmercenario:textures/items/armasdefuego/armas9mm/93r_iconoInv.png"; icono4="modmercenario:textures/items/gui/transparencia.png"; icono5="modmercenario:textures/items/gui/transparencia.png"; } transparencia=false; text0=""+municion+"/"+municionmaxima; switch(tipodisparo) { case 2: icono1="modmercenario:textures/items/gui/auto.png";break; case 0: icono1="modmercenario:textures/items/gui/manual.png";break; case 1: icono1="modmercenario:textures/items/gui/semiAuto.png";break; } icono3="modmercenario:textures/items/gui/botonesAsterisco.png"; switch (tipomunicion) { case 1: tipomunicionDisplay=2;break; case 2: tipomunicionDisplay=3;break; case 3: tipomunicionDisplay=4;break; } } //######################## if (item0.equals(MercenaryModItems.subfusilMP5T5)) { switch (tipomunicion) { case 0: icono5="modmercenario:textures/items/gui/transparencia.png";break; case 1: icono5="modmercenario:textures/items/gui/H.png";break; case 2: icono5="modmercenario:textures/items/gui/R.png";break; case 3: icono5="modmercenario:textures/items/gui/O.png";break; } icono0="modmercenario:textures/items/armasdefuego/armas9mm/mp5t5_icono.png"; if ( recargando | descargando | remplazando) { icono0="modmercenario:textures/items/armasdefuego/armas9mm/mp5t5_iconoInv.png"; icono4="modmercenario:textures/items/gui/transparencia.png"; icono5="modmercenario:textures/items/gui/transparencia.png"; } transparencia=false; text0=""+municion+"/"+municionmaxima; switch(tipodisparo) { case 2: icono1="modmercenario:textures/items/gui/auto.png";break; case 0: icono1="modmercenario:textures/items/gui/manual.png";break; case 1: icono1="modmercenario:textures/items/gui/semiAuto.png";break; } icono3="modmercenario:textures/items/gui/botonesAsterisco.png"; switch (tipomunicion) { case 1: tipomunicionDisplay=2;break; case 2: tipomunicionDisplay=3;break; case 3: tipomunicionDisplay=4;break; } } //######################## if (item0.equals(MercenaryModItems.subfusilAresFMG)) { switch (tipomunicion) { case 0: icono5="modmercenario:textures/items/gui/transparencia.png";break; case 1: icono5="modmercenario:textures/items/gui/H.png";break; case 2: icono5="modmercenario:textures/items/gui/R.png";break; case 3: icono5="modmercenario:textures/items/gui/O.png";break; } icono0="modmercenario:textures/items/armasdefuego/armas9mm/ares_icono.png"; if ( recargando | descargando | remplazando) { icono0="modmercenario:textures/items/armasdefuego/armas9mm/ares_iconoInv.png"; icono4="modmercenario:textures/items/gui/transparencia.png"; icono5="modmercenario:textures/items/gui/transparencia.png"; } transparencia=false; text0=""+municion+"/"+municionmaxima; switch(tipodisparo) { case 2: icono1="modmercenario:textures/items/gui/auto.png";break; case 0: icono1="modmercenario:textures/items/gui/manual.png";break; case 1: icono1="modmercenario:textures/items/gui/semiAuto.png";break; } icono3="modmercenario:textures/items/gui/botonesAsterisco.png"; switch (tipomunicion) { case 1: tipomunicionDisplay=2;break; case 2: tipomunicionDisplay=3;break; case 3: tipomunicionDisplay=4;break; } } //######################## if (item0.equals(MercenaryModItems.pistolaMauserC92)) { switch (tipomunicion) { case 0: icono5="modmercenario:textures/items/gui/transparencia.png";break; case 1: icono5="modmercenario:textures/items/gui/H.png";break; case 2: icono5="modmercenario:textures/items/gui/R.png";break; case 3: icono5="modmercenario:textures/items/gui/O.png";break; } icono0="modmercenario:textures/items/armasdefuego/armas9mm/mauser_icono.png"; if ( recargando | descargando | remplazando) { icono0="modmercenario:textures/items/armasdefuego/armas9mm/mauser_iconoInv.png"; icono4="modmercenario:textures/items/gui/transparencia.png"; icono5="modmercenario:textures/items/gui/transparencia.png"; } transparencia=false; text0=""+municion+"/"+municionmaxima; switch(tipodisparo) { case 2: icono1="modmercenario:textures/items/gui/auto.png";break; case 0: icono1="modmercenario:textures/items/gui/manual.png";break; case 1: icono1="modmercenario:textures/items/gui/semiAuto.png";break; } icono3="modmercenario:textures/items/gui/botonesAsterisco.png"; switch (tipomunicion) { case 1: tipomunicionDisplay=2;break; case 2: tipomunicionDisplay=3;break; case 3: tipomunicionDisplay=4;break; } } //######################## if (item0.equals(MercenaryModItems.cargador45acp)) { switch (tipomunicion) { case 0: icono5="modmercenario:textures/items/gui/transparencia.png";break; case 1: icono5="modmercenario:textures/items/gui/A.png";break; case 2: icono5="modmercenario:textures/items/gui/R.png";break; case 3: icono5="modmercenario:textures/items/gui/O.png";break; } switch (tipocargador) { case 1: icono0="modmercenario:textures/items/armasdefuego/cargador45acp/cargador45acp_CC_icono.png";break; case 2: icono0="modmercenario:textures/items/armasdefuego/cargador45acp/cargador45acp_CL_icono.png";break; case 3: icono0="modmercenario:textures/items/armasdefuego/cargador45acp/cargador45acp_CG_icono.png";break; } if (descargar | descargando ) { switch (tipocargador) { case 1: icono0="modmercenario:textures/items/armasdefuego/cargador45acp/cargador45acp_CC_iconoInv.png";break; case 2: icono0="modmercenario:textures/items/armasdefuego/cargador45acp/cargador45acp_CL_iconoInv.png";break; case 3: icono0="modmercenario:textures/items/armasdefuego/cargador45acp/cargador45acp_CG_iconoInv.png";break; } } switch (tipomunicion) { case 1: tipomunicionDisplay=8;break; case 2: tipomunicionDisplay=9;break; case 3: tipomunicionDisplay=10;break; } text0=""+municion+" / "+municionmaxima ; transparencia=false; switch (tipomunicion) { case 1:icono1="modmercenario:textures/items/gui/botones_ARO_A.png";break; case 2:icono1="modmercenario:textures/items/gui/botones_ARO_R.png";break; case 3:icono1="modmercenario:textures/items/gui/botones_ARO_O.png";break; } icono3="modmercenario:textures/items/gui/botones.png"; } //######################## if (item0.equals(MercenaryModItems.pistola1911colt)) { switch (tipomunicion) { case 0: icono5="modmercenario:textures/items/gui/transparencia.png";break; case 1: icono5="modmercenario:textures/items/gui/A.png";break; case 2: icono5="modmercenario:textures/items/gui/R.png";break; case 3: icono5="modmercenario:textures/items/gui/O.png";break; } icono0="modmercenario:textures/items/armasdefuego/armas45cal/1911colt_icono.png"; if ( recargando | descargando | remplazando) { icono0="modmercenario:textures/items/armasdefuego/armas45cal/1911colt_iconoInv.png"; icono4="modmercenario:textures/items/gui/transparencia.png"; icono5="modmercenario:textures/items/gui/transparencia.png"; } transparencia=false; text0=""+municion+"/"+municionmaxima; icono1="modmercenario:textures/items/gui/manualO.png"; icono3="modmercenario:textures/items/gui/botonesAsterisco.png"; switch (tipomunicion) { case 1: tipomunicionDisplay=8;break; case 2: tipomunicionDisplay=9;break; case 3: tipomunicionDisplay=10;break; } } //######################## if (item0.equals(MercenaryModItems.pistolaDesertEagle)) { switch (tipomunicion) { case 0: icono5="modmercenario:textures/items/gui/transparencia.png";break; case 1: icono5="modmercenario:textures/items/gui/A.png";break; case 2: icono5="modmercenario:textures/items/gui/R.png";break; case 3: icono5="modmercenario:textures/items/gui/O.png";break; } icono0="modmercenario:textures/items/armasdefuego/armas45cal/deserteagle_icono.png"; if ( recargando | descargando | remplazando) { icono0="modmercenario:textures/items/armasdefuego/armas45cal/deserteagle_iconoInv.png"; icono4="modmercenario:textures/items/gui/transparencia.png"; icono5="modmercenario:textures/items/gui/transparencia.png"; } transparencia=false; text0=""+municion+"/"+municionmaxima; icono1="modmercenario:textures/items/gui/manualO.png"; icono3="modmercenario:textures/items/gui/botonesAsterisco.png"; switch (tipomunicion) { case 1: tipomunicionDisplay=8;break; case 2: tipomunicionDisplay=9;break; case 3: tipomunicionDisplay=10;break; } } //######################## if ( (item0.equals(MercenaryModItems.pistolaSocom)) | (item0.equals(MercenaryModItems.pistolaSocomS)) ) { switch (tipomunicion) { case 0: icono5="modmercenario:textures/items/gui/transparencia.png";break; case 1: icono5="modmercenario:textures/items/gui/A.png";break; case 2: icono5="modmercenario:textures/items/gui/R.png";break; case 3: icono5="modmercenario:textures/items/gui/O.png";break; } icono0="modmercenario:textures/items/armasdefuego/armas45cal/socom_icono.png"; if ( recargando | descargando | remplazando) { icono0="modmercenario:textures/items/armasdefuego/armas45cal/socom_iconoInv.png"; icono4="modmercenario:textures/items/gui/transparencia.png"; icono5="modmercenario:textures/items/gui/transparencia.png"; } transparencia=false; text0=""+municion+"/"+municionmaxima; switch(tipodisparo) { case 2: icono1="modmercenario:textures/items/gui/auto.png";break; case 0: icono1="modmercenario:textures/items/gui/manual.png";break; case 1: icono1="modmercenario:textures/items/gui/semiAuto.png";break; } //icono1="modmercenario:textures/items/gui/manualO.png"; icono3="modmercenario:textures/items/gui/botonesAsterisco.png"; switch (tipomunicion) { case 1: tipomunicionDisplay=8;break; case 2: tipomunicionDisplay=9;break; case 3: tipomunicionDisplay=10;break; } } //######################## if ( (item0.equals(MercenaryModItems.arcoMercenarioDeMadera)) | (item0.equals(MercenaryModItems.arcoMercenario)) | (item0.equals(MercenaryModItems.vallestaMercenaria)) | (item0.equals(MercenaryModItems.vallestaMercenariaDeMadera)) ) { switch(tipomunicion) { case 1: icono0="modmercenario:textures/items/arcos/flechas/flechaV_icono.png";break; case 2: icono0="modmercenario:textures/items/arcos/flechas/flechaMercenariaA_icono.png";break; case 3: icono0="modmercenario:textures/items/arcos/flechas/flechaMercenariaR_icono.png";break; case 4: icono0="modmercenario:textures/items/arcos/flechas/flechaMercenariaO_icono.png";break; case 5: icono0="modmercenario:textures/items/arcos/flechas/flechaMercenariaE_icono.png";break; } text0=""+municiondisponible; transparencia=false; tipomunicionDisplay=0; icono3="modmercenario:textures/items/gui/botonesDivRes.png"; if ( mensage00 > 0 ) { icono4 = "modmercenario:textures/items/gui/headS.png"; mensage00 --; } } //####################### if (item0.equals(MercenaryModItems.revolverMagnum)) { switch(modo) { case 0: icono0="modmercenario:textures/items/armasdefuego/revolvermagnum/magnum_icono.png";break; case 1: icono0="modmercenario:textures/items/armasdefuego/revolvermagnum/magnum_iconoInv.png";break; case 2: icono0="modmercenario:textures/items/armasdefuego/revolvermagnum/magnum_icono.png";break; } text0=""+municion+" / "+municionmaxima ; transparencia=false; switch (tipomunicion) { case 1: tipomunicionDisplay=8;icono1="modmercenario:textures/items/gui/botones_ARO_A.png";break; case 2: tipomunicionDisplay=9;icono1="modmercenario:textures/items/gui/botones_ARO_R.png";break; case 3: tipomunicionDisplay=10;icono1="modmercenario:textures/items/gui/botones_ARO_O.png";break; } icono3="modmercenario:textures/items/gui/botonesAsterisco.png"; } //######################## if (item0.equals(MercenaryModItems.cargadorRedClub)) { switch (tipomunicion) { case 0: icono5="modmercenario:textures/items/gui/transparencia.png";break; case 1: icono5="modmercenario:textures/items/gui/O.png";break; case 2: icono5="modmercenario:textures/items/gui/O.png";break; case 3: icono5="modmercenario:textures/items/gui/O.png";break; } switch (tipocargador) { case 1: icono0="modmercenario:textures/items/armasdefuego/cargadorredclub/cargadorredclub_icono.png";break; case 2: icono0="modmercenario:textures/items/armasdefuego/cargadorredclub/cargadorredclub_icono.png";break; case 3: icono0="modmercenario:textures/items/armasdefuego/cargadorredclub/cargadorredclub_icono.png";break; } if (descargar | descargando ) { switch (tipocargador) { case 1: icono0="modmercenario:textures/items/armasdefuego/cargadorredclub/cargadorredclub_iconoInv.png";break; case 2: icono0="modmercenario:textures/items/armasdefuego/cargadorredclub/cargadorredclub_iconoInv.png";break; case 3: icono0="modmercenario:textures/items/armasdefuego/cargadorredclub/cargadorredclub_iconoInv.png";break; } } text0=""+municion+" / "+municionmaxima ; transparencia=false; switch (tipomunicion) { case 1: tipomunicionDisplay=10;icono1="modmercenario:textures/items/gui/redclub_ARO_O.png";break; case 2: tipomunicionDisplay=10;icono1="modmercenario:textures/items/gui/redclub_ARO_O.png";break; case 3: tipomunicionDisplay=10;icono1="modmercenario:textures/items/gui/redclub_ARO_O.png";break; } icono3="modmercenario:textures/items/gui/botones.png"; } //######################## if (item0.equals(MercenaryModItems.pistolaRedClub)) { switch (tipomunicion) { case 0: icono5="modmercenario:textures/items/gui/transparencia.png";break; case 1: icono5="modmercenario:textures/items/gui/O.png";break; case 2: icono5="modmercenario:textures/items/gui/O.png";break; case 3: icono5="modmercenario:textures/items/gui/O.png";break; } icono0="modmercenario:textures/items/armasdefuego/armas45cal/redclub_icono.png"; if ( recargando | descargando | remplazando) { icono0="modmercenario:textures/items/armasdefuego/armas45cal/redclub_iconoInv.png"; icono4="modmercenario:textures/items/gui/transparencia.png"; icono5="modmercenario:textures/items/gui/transparencia.png"; } switch(tipodisparo) { case 0: icono1="modmercenario:textures/items/gui/redclub_R.png";break; case 1: icono1="modmercenario:textures/items/gui/redclub_A.png";break; case 2: icono1="modmercenario:textures/items/gui/redclub_Z.png";break; } transparencia=false; text0=""+municion+"/"+municionmaxima; icono3="modmercenario:textures/items/gui/botonesAsterisco.png"; switch (tipomunicion) { case 1: tipomunicionDisplay=10;break; case 2: tipomunicionDisplay=10;break; case 3: tipomunicionDisplay=10;break; } switch(modo) { case 0: icono0="modmercenario:textures/items/armasdefuego/armas45cal/redclub_icono.png";break; case 1: icono0="modmercenario:textures/items/armasdefuego/armas45cal/redclub_iconoInv.png";break; case 2: icono0="modmercenario:textures/items/armasdefuego/armas45cal/redclub_icono.png";break; }//######################## } //######################## if (item0.equals(MercenaryModItems.subfusilAresFMG)) { icono0="modmercenario:textures/items/armasdefuego/armas9mm/ares_icono.png"; switch(tipodisparo) { case 2: icono1="modmercenario:textures/items/gui/auto.png";break; case 0: icono1="modmercenario:textures/items/gui/manual.png";break; case 1: icono1="modmercenario:textures/items/gui/semiAuto.png";break; } text0=""+municion+" / "+municionmaxima ; transparencia=false; switch (tipomunicion) { case 1: tipomunicionDisplay=2;break; case 2: tipomunicionDisplay=3;break; case 3: tipomunicionDisplay=4;break; } icono3="modmercenario:textures/items/gui/botones.png"; } //######################## if (item0.equals(MercenaryModItems.escopetaSPAS12)) { icono0="modmercenario:textures/items/armasdefuego/escopetaspas12/spas12_icono.png"; text0=""+municion+" / "+municionmaxima ; transparencia=false; switch (tipomunicion) { case 1: tipomunicionDisplay=11;break; case 2: tipomunicionDisplay=12;break; case 3: tipomunicionDisplay=13;break; } switch (tipomunicion) { case 1: icono1="modmercenario:textures/items/gui/cartuchosRojo.png";break; case 2: icono1="modmercenario:textures/items/gui/cartuchosVerde.png";break; case 3: icono1="modmercenario:textures/items/gui/cartuchosAzul.png";break; } icono3="modmercenario:textures/items/gui/botones.png"; } //####################### if (item0.equals(MercenaryModItems.escopetaWinchester1200)) { icono0="modmercenario:textures/items/armasdefuego/escopetawinchester1200/winchester1200_icono.png"; icono1="modmercenario:textures/items/gui/manual.png"; text0=""+municion+" / "+municionmaxima ; transparencia=false; switch (tipomunicion) { case 1: tipomunicionDisplay=11;break; case 2: tipomunicionDisplay=12;break; case 3: tipomunicionDisplay=13;break; } switch (tipomunicion) { case 1: icono1="modmercenario:textures/items/gui/cartuchosRojo.png";break; case 2: icono1="modmercenario:textures/items/gui/cartuchosVerde.png";break; case 3: icono1="modmercenario:textures/items/gui/cartuchosAzul.png";break; } icono3="modmercenario:textures/items/gui/botones.png"; } //####################### if (item0.equals(MercenaryModItems.lanzagranadas79M)) { icono0="modmercenario:textures/items/armasdefuego/lanzagrandas79m/M79_icono.png"; if (municion > 0) { switch (tipomunicion) { case 0: icono4="modmercenario:textures/items/gui/transparencia.png";break; case 1: icono4="modmercenario:textures/items/gui/GA.png";break; case 2: icono4="modmercenario:textures/items/gui/GR.png";break; case 3: icono4="modmercenario:textures/items/gui/GO.png";break; } } else { switch (tipomunicion) { case 0: icono4="modmercenario:textures/items/gui/transparencia.png";break; case 1: icono4="modmercenario:textures/items/gui/dA.png";break; case 2: icono4="modmercenario:textures/items/gui/dR.png";break; case 3: icono4="modmercenario:textures/items/gui/dO.png";break; } } text0=""+municion+" / "+municionmaxima ; transparencia=false; if (tipomunicion==1) {tipomunicionDisplay=17; icono1="modmercenario:textures/items/gui/granadas_A.png"; } if (tipomunicion==2) {tipomunicionDisplay=18; icono1="modmercenario:textures/items/gui/granadas_R.png"; } if (tipomunicion==3) {tipomunicionDisplay=19; icono1="modmercenario:textures/items/gui/granadas_O.png"; } icono3="modmercenario:textures/items/gui/botones.png"; } //######################## if ( item0.equals(MercenaryModItems.fusilMarkLancer) ) { boolean extraer = util.getBooleantag(stack0, "extraer"); switch(tipodisparo) { case 2: icono1="modmercenario:textures/items/gui/auto.png";break; case 0: icono1="modmercenario:textures/items/gui/manual.png";break; case 1: icono1="modmercenario:textures/items/gui/semiAuto.png";break; } switch (tipomunicion) { case 0: icono5="modmercenario:textures/items/gui/transparencia.png";break; case 1: icono5="modmercenario:textures/items/gui/A.png";break; case 2: icono5="modmercenario:textures/items/gui/R.png";break; case 3: icono5="modmercenario:textures/items/gui/O.png";break; } icono0="modmercenario:textures/items/armasdefuego/fusilmarklancer/mark1_icono.png"; if ( extraer ) { icono4="modmercenario:textures/items/gui/transparencia.png"; icono5="modmercenario:textures/items/gui/transparencia.png"; } icono3="modmercenario:textures/items/gui/botonesAsterisco.png"; int accion = util.getInttag(stack0, "accion"); if (accion == 5) { lmunicion = lmunicion - getLmunicion(); } transparencia=false; text0="B "+municion+"/"+municionmaxima+" R "+ lmunicion +"/"+" 5K"; switch (tipomunicion) { case 1: tipomunicionDisplay=14;break; case 2: tipomunicionDisplay=15;break; case 3: tipomunicionDisplay=16;break; } } //######################## //######################## if ( item0.equals(MercenaryModItems.fusilMark2Lancer) ) { boolean extraer = util.getBooleantag(stack0, "extraer"); switch(tipodisparo) { case 2: icono1="modmercenario:textures/items/gui/auto.png";break; case 0: icono1="modmercenario:textures/items/gui/manual.png";break; case 1: icono1="modmercenario:textures/items/gui/semiAuto.png";break; } switch (tipomunicion) { case 0: icono5="modmercenario:textures/items/gui/transparencia.png";break; case 1: icono5="modmercenario:textures/items/gui/A.png";break; case 2: icono5="modmercenario:textures/items/gui/R.png";break; case 3: icono5="modmercenario:textures/items/gui/O.png";break; } icono0="modmercenario:textures/items/armasdefuego/fusilmark2lancer/mark2_icono.png"; if ( extraer ) { icono4="modmercenario:textures/items/gui/transparencia.png"; icono5="modmercenario:textures/items/gui/transparencia.png"; } icono3="modmercenario:textures/items/gui/botonesAsterisco.png"; int accion = util.getInttag(stack0, "accion"); if (accion == 5) { lmunicion = lmunicion - getLmunicion(); } transparencia=false; text0="B "+municion+"/"+municionmaxima+" R "+ lmunicion +"/"+" 5K"; switch (tipomunicion) { case 1: tipomunicionDisplay=14;break; case 2: tipomunicionDisplay=15;break; case 3: tipomunicionDisplay=16;break; } } //######################## if (item0.equals(MercenaryModItems.cargador55645)) { switch (modo) { default:{ switch (tipocargador) { case 1: icono0="modmercenario:textures/items/armasdefuego/cargador55645/cargador55645_CC_icono.png";break; case 2: icono0="modmercenario:textures/items/armasdefuego/cargador55645/cargador55645_CL_icono.png";break; case 3: icono0="modmercenario:textures/items/armasdefuego/cargador55645/cargador55645_CG_icono.png";break; } }break; case 1:{ switch (tipocargador) { case 1: icono0="modmercenario:textures/items/armasdefuego/cargador55645/cargador55645_CC_iconoInv.png";break; case 2: icono0="modmercenario:textures/items/armasdefuego/cargador55645/cargador55645_CL_iconoInv.png";break; case 3: icono0="modmercenario:textures/items/armasdefuego/cargador55645/cargador55645_CG_iconoInv.png";break; } }break; } text0=""+municion+" / "+municionmaxima ; transparencia=false; switch (tipomunicion) { case 1: tipomunicionDisplay=14;icono1="modmercenario:textures/items/gui/botones_ARO_A.png";break; case 2: tipomunicionDisplay=15;icono1="modmercenario:textures/items/gui/botones_ARO_R.png";break; case 3: tipomunicionDisplay=16;icono1="modmercenario:textures/items/gui/botones_ARO_O.png";break; } icono3="modmercenario:textures/items/gui/botones.png"; } //######################## if (item0.equals(MercenaryModItems.cargador55645)) { switch (modo) { default:{ switch (tipocargador) { case 1: icono0="modmercenario:textures/items/armasdefuego/cargador55645/cargador55645_CC_icono.png";break; case 2: icono0="modmercenario:textures/items/armasdefuego/cargador55645/cargador55645_CL_icono.png";break; case 3: icono0="modmercenario:textures/items/armasdefuego/cargador55645/cargador55645_CG_icono.png";break; } }break; case 1:{ switch (tipocargador) { case 1: icono0="modmercenario:textures/items/armasdefuego/cargador55645/cargador55645_CC_iconoInv.png";break; case 2: icono0="modmercenario:textures/items/armasdefuego/cargador55645/cargador55645_CL_iconoInv.png";break; case 3: icono0="modmercenario:textures/items/armasdefuego/cargador55645/cargador55645_CG_iconoInv.png";break; } }break; } text0=""+municion+" / "+municionmaxima ; transparencia=false; switch (tipomunicion) { case 1: tipomunicionDisplay=14;icono1="modmercenario:textures/items/gui/botones_ARO_A.png";break; case 2: tipomunicionDisplay=15;icono1="modmercenario:textures/items/gui/botones_ARO_R.png";break; case 3: tipomunicionDisplay=16;icono1="modmercenario:textures/items/gui/botones_ARO_O.png";break; } icono3="modmercenario:textures/items/gui/botones.png"; } //######################## if (item0.equals(MercenaryModItems.taladroMercenario)) { switch(tipodisparo) { default: icono0="modmercenario:textures/items/herramientas/taladro/taladro00cam02.png";break; case 1: icono0="modmercenario:textures/items/herramientas/taladro/modo1.png";break; case 2: icono0="modmercenario:textures/items/herramientas/taladro/modo2.png";break; case 3: icono0="modmercenario:textures/items/herramientas/taladro/modo3.png";break; case 4: icono0="modmercenario:textures/items/herramientas/taladro/modo4.png";break; case 5: icono0="modmercenario:textures/items/herramientas/taladro/modo5.png";break; case 6: icono0="modmercenario:textures/items/herramientas/taladro/modo6.png";break; } text0=""+municion+" / "+municionmaxima; transparencia=false; tipomunicionDisplay=1; icono3="modmercenario:textures/items/gui/botones.png"; } //######################## if (item0.equals(MercenaryModItems.sierraMercenaria)) { switch(tipodisparo) { default: icono0="modmercenario:textures/items/herramientas/sierra/sierramercenaria0.png";break; } text0=""+municion+" / "+256; transparencia=false; tipomunicionDisplay=1; icono3="modmercenario:textures/items/gui/botones.png"; } //######################## if ( unload | reload ) {icono1="modmercenario:textures/items/gui/holdRigthClick.png";} }//nbttag }//(stack0 != null) //paint a default gun just to show the position //######################## if (guiTick > 0) { transparencia=false; icono5="modmercenario:textures/items/gui/H.png"; icono0="modmercenario:textures/items/armasdefuego/armas9mm/92_icono.png"; text0="00/00"; icono1="modmercenario:textures/items/gui/manualO.png"; icono3="modmercenario:textures/items/gui/botonesAsterisco.png"; tipomunicionDisplay=2; } displayWidth=mc.displayWidth; displayHeight=mc.displayHeight; guiscale=mc.gameSettings.guiScale; System.out.println("guiscale="+guiscale); System.out.println("displayWidth="+displayWidth); System.out.println("displayHeight="+displayHeight); //posX= ( (int) (displayWidth * 0.1F) ); // posY= ( (int) (displayHeight * 0.1F) ); System.out.println("this.width ="+this.width); System.out.println("this.height="+this.height); switch(guiscale) { case 0: { posX=10; //1 6; //controls the gui size posY= 200;//((displayHeight/2)-25); //x=30; //gui size } ;break; case 3: { posX=10;//( (int) (displayWidth * 0.025F) ); //30 controls the gui size posY=( (int) (displayHeight * 0.30F) ); //x=40; //gui size } ;break; case 2: { posX=10;//( (int) (displayWidth * 0.025F) ); //30 controls the gui size posY=( (int) (displayHeight * 0.45F) ); //x=40; //gui size } ;break; case 1: { posX=10;//( (int) (displayWidth * 0.05F) ); //16; //controls the gui size posY=( (int)(displayHeight * 0.92F)); //x=40; //gui size } ;break; } // posX = this.width / 2; // posY = this.height / 2; posX = posX + ppx;//( (int) (displayWidth * 0.05F) ); //16; //controls the gui size posY = posY + ppy; System.out.println("posX="+posX ); System.out.println("posY="+posY ); System.out.println("\n\n\n" ); // System.out.println("posX="+ppx ); // System.out.println("posY="+ppy ); // System.out.println("x="+x ); switch(tipomunicionDisplay) { case 0: icono2="modmercenario:textures/items/gui/transparencia.png"; break; case 1: icono2="modmercenario:textures/items/armasdefuego/balas/barraRedStone.png"; break; case 2: icono2="modmercenario:textures/items/armasdefuego/balas/barraBala9mmA.png"; break; case 3: icono2="modmercenario:textures/items/armasdefuego/balas/barraBala9mmR.png"; break; case 4: icono2="modmercenario:textures/items/armasdefuego/balas/barraBala9mmO.png"; break; case 5: icono2="modmercenario:textures/items/armasdefuego/balas/barraBala5728mm_acero.png"; break; case 6: icono2="modmercenario:textures/items/armasdefuego/balas/barraBala5728mm_redstone.png"; break; case 7: icono2="modmercenario:textures/items/armasdefuego/balas/barraBala5728mm_obsidiana.png"; break; case 8: icono2="modmercenario:textures/items/armasdefuego/balas/barraBalacal45acp_acero.png"; break; case 9: icono2="modmercenario:textures/items/armasdefuego/balas/barraBalacal45acp_redstone.png"; break; case 10: icono2="modmercenario:textures/items/armasdefuego/balas/barraBalacal45acp_obsidiana.png"; break; case 11: icono2="modmercenario:textures/items/armasdefuego/balas/barra12Grojo.png"; break; case 12: icono2="modmercenario:textures/items/armasdefuego/balas/barra12Gverde.png"; break; case 13: icono2="modmercenario:textures/items/armasdefuego/balas/barra12Gazul.png"; break; case 14: icono2="modmercenario:textures/items/armasdefuego/balas/barraBala55645mm_acero.png"; break; case 15: icono2="modmercenario:textures/items/armasdefuego/balas/barraBala55645mm_restone.png"; break; case 16: icono2="modmercenario:textures/items/armasdefuego/balas/barraBala55645mm_obsidiana.png"; break; case 17: icono2="modmercenario:textures/items/armasdefuego/balas/barraGranada_A.png"; break; case 18: icono2="modmercenario:textures/items/armasdefuego/balas/barraGranada_R.png"; break; case 19: icono2="modmercenario:textures/items/armasdefuego/balas/barraGranada_O.png"; break; case 20: icono2="modmercenario:textures/items/armasdefuego/balas/barraBala76239mm_acero.png"; break; case 21: icono2="modmercenario:textures/items/armasdefuego/balas/barraBala76239mm_redstone.png"; break; case 22: icono2="modmercenario:textures/items/armasdefuego/balas/barraBala76239mm_obsidiana.png"; break; } //el ancho de la barra al que equivale cada unidad de municion switch(tipomunicionDisplay) { default: balas=32.0F; break; case 1: balas=256.0F; break; case 8: case 9: case 10: case 11: case 12: case 13: case 17: case 18: case 19: balas=16.0F; break; } xf=x+0.0F; }//( (conteo%20)==0 ) //Prepare rendering GL11.glColor4f(1.0F, 1.0F, 1.0F, 1.0F); GL11.glDisable(GL11.GL_LIGHTING); if (municion<0) { municion=0; } if ( Mercenary.getGuiOn() ){ //drawModalRectWithCustomSizedtexture(int x, int y,float u,float v,int width,int height,float textureWidth,float textureHeight); this.mc.renderEngine.bindTexture(new ResourceLocation(icono0)); this.drawModalRectWithCustomSizedTexture( (posX - 5), (posY), 0.0F, 0.0F, x, x, xf, xf); //imagen al 60% //this.drawModalRectWithCustomSizedtexture(posX + 8, posY + 8, 0.0F, 0.0F, 200, 200 , 200.0F, 200.0F); this.mc.renderEngine.bindTexture(new ResourceLocation(icono1)); this.drawModalRectWithCustomSizedTexture( (posX + x ), (posY ), 0.0F, 0.0F, (int) (x * 1.5), (x / 3), (xf * 1.5F), (xf / 3) ); //imagen al 60% this.mc.renderEngine.bindTexture(new ResourceLocation(icono2)); this.drawModalRectWithCustomSizedTexture( (posX + x ), (posY + (x / 3) ), 0.0F, 0.0F, (int) (((x * 1.0) / balas ) * municion), (x / 3), (xf * 1.0F), (xf / 3) ); this.mc.renderEngine.bindTexture(new ResourceLocation(icono3)); this.drawModalRectWithCustomSizedTexture( (posX + x ), (posY + ((x / 3) * 2) ), 0.0F, 0.0F, (int) (x * 1.5), (x / 3), (xf * 1.5F), (xf / 3) ); this.mc.renderEngine.bindTexture(new ResourceLocation(icono4)); this.drawModalRectWithCustomSizedTexture( (posX - 5), (posY), 0.0F, 0.0F, x, x/2 , xf, xf/2 ); //imagen al 60% this.mc.renderEngine.bindTexture(new ResourceLocation(icono5)); this.drawModalRectWithCustomSizedTexture( (posX - 5), (posY + (x/2)), 0.0F, 0.0F, x, x/2 , xf, xf/2 ); //imagen al 60% this.mc.fontRendererObj.drawStringWithShadow(text0, posX, ((posY ) + x) , 0xffcccccc); //this.mc.fontRendererObj.drawStringWithShadow(text0, posX + 32 + 8, posX + 8, 0xffcccccc); } } //####################################################################################################################3 public static boolean getPermitirMensaje() { boolean p = permitirMensaje; permitirMensaje=false; return p; } public static int getlconteoAndSetToZero() { int l = lconteo; lconteo = 0; return l; } public static int getlconteo() { return lconteo; } public static int getrconteo() { return rconteo; } public static int getconteo100() { return conteo100; } public static void setconteo100(int c) { conteo100 = c; } public static void setconteo100Zero() { conteo100 = 0; } public static void addconteo100(int c) { conteo100 = conteo100 + c; } // conteo200 public static int getconteo200() { conteo200 ++; return (conteo200 / 3); } public static void setconteo200(int c) { conteo200 = c; } public static void setconteo200Zero() { conteo200 = 0; } public static boolean permitirSonido() { boolean p = permitirSonido; permitirSonido=false; return p; } public static boolean permitirLdisparo2s() { boolean s2 = permitirLdisparo2s; permitirLdisparo2s=false; return s2; } public static int getLmunicion() { return vlmunicion; } public static void setLmunicion(int c) { vlmunicion = c; } public static void addLmunicion() { if (permitirVlmunicion) { vlmunicion ++ ; permitirVlmunicion=false; } } public static void setHeadshoot(int t) { mensage00=t; } public static int getTexturajson() { return texturajson; } public static void setTexturajson(int t) { texturajson = t; } public static int getAccion() { return accion; } public static void setAccion(int t) { accion = t; } public static int getGraficaltick() { return graficaltick; } public static void setPpx(int px) { ppx = px; } public static int getPpx() { guiTick =2; return ppx; } public static void setPpy(int py) { ppy = py; } public static int getPpy() { guiTick =2; return ppy; } public static void setX(int p) { x = p; } public static int getX() { guiTick =2; return x; } public static float getXf() { return xf; } public static int getPosX() { return posX; } public static int getPosY() { return posY; } //####################################################################################################################3 public static void lineaRoja(Vec3 vectorA, Vec3 vectorB) { //MovingObjectPosition mov = Minecraft.getMinecraft().objectMouseOver; // System.out.println("vectorA="+vectorA); // System.out.println("vectorB="+vectorB); GL11.glPushMatrix(); GL11.glPushAttrib(GL11.GL_ENABLE_BIT); //because of the way 3D rendering is done, all coordinates are relative to the camera. This "resets" the "0,0,0" position to the location that is (0,0,0) in the world. EntityPlayer playerIn = mc.thePlayer; Vec3 pos0 = playerIn.getPositionVector(); GL11.glTranslated(-pos0.xCoord, -pos0.yCoord, -pos0.zCoord); GlStateManager.rotate(0.0F, 0.0F, 0.0F, 0.0F); GlStateManager.rotate(0.0F, 0.0F, 0.0F, 0.0F); GL11.glDisable(GL11.GL_LIGHTING); GL11.glDisable(GL11.GL_TEXTURE_2D); //you will need to supply your own position vectors //GL11.drawLineWithGL(pos, pos1); // int d = Math.round((float)blockA.distanceTo(blockB)+0.2f); GL11.glColor3f(1F, 0F, 0F); // float oz = (blockA.xCoord - blockB.xCoord == 0?0:-1f/16f); // float ox = (blockA.zCoord - blockB.zCoord == 0?0:1f/16f); GL11.glBegin(GL11.GL_LINE_STRIP); GL11.glVertex3d(vectorA.xCoord ,vectorA.yCoord ,vectorA.zCoord ); GL11.glVertex3d(vectorB.xCoord ,vectorB.yCoord ,vectorB.zCoord ); GL11.glEnd(); // drawLineWithGL(pos0, pos1); GL11.glPopAttrib(); GL11.glPopMatrix(); } ///##################################################################################################################3 public static void miraRoja(Vec3 vectorA, Vec3 vectorB, EntityLivingBase entidad) { GL11.glPushMatrix(); GL11.glPushAttrib(GL11.GL_ENABLE_BIT); //because of the way 3D rendering is done, all coordinates are relative to the camera. This "resets" the "0,0,0" position to the location that is (0,0,0) in the world. EntityPlayer playerIn = mc.thePlayer; Vec3 pos0 = entidad.getPositionVector(); //GL11.glTranslated(-pos0.xCoord, -pos0.yCoord, -pos0.zCoord); GL11.glDisable(GL11.GL_LIGHTING); GL11.glDisable(GL11.GL_TEXTURE_2D); MovingObjectPosition mov = Minecraft.getMinecraft().objectMouseOver; pos0 = new Vec3(pos0.xCoord, pos0.yCoord + entidad.getEyeHeight() - 0.2F , pos0.zCoord); //from the eye heigth Vec3 pos1 = mov.hitVec; //bala.shootingEntity.getLookVec(); //bala.getPositionVector();//new Vec3(-4, 5, -4); // mercenarymod.gui.NotificationMercenaria.lineaRoja(pos0, pos1 ); GL11.glColor3f(1F, 0F, 0F); GL11.glBegin(GL11.GL_LINE_STRIP); GL11.glVertex3d(pos0.xCoord ,pos0.yCoord ,pos0.zCoord ); GL11.glVertex3d(pos1.xCoord ,pos1.yCoord ,pos1.zCoord ); GL11.glEnd(); GL11.glPopAttrib(); GL11.glPopMatrix(); } //####################################################################################################################3 public static int[] getIntArraytag(ItemStack item, String tag) { int[] array = new int[5]; NBTTagCompound etiquetas = item.getTagCompound(); if (etiquetas == null) { etiquetas = new NBTTagCompound(); item.setTagCompound(etiquetas); array[0]=9999; return array; } array=etiquetas.getIntArray(tag); return array; } //####################################################################################################################3 public static void setIntArraytag(ItemStack item, String tag, int[] value) { NBTTagCompound etiquetas = item.getTagCompound(); if (etiquetas == null) { etiquetas = new NBTTagCompound(); } etiquetas.setIntArray(tag, value); item.setTagCompound(etiquetas); } //####################################################################################################################3 public static float getFloattag(ItemStack item, String tag) { NBTTagCompound etiquetas = item.getTagCompound(); if (etiquetas == null) { etiquetas = new NBTTagCompound(); item.setTagCompound(etiquetas); return 999.9F; } float ex=etiquetas.getFloat(tag); return ex; } //####################################################################################################################3 public static void setFloattag(ItemStack item, String tag, float value) { NBTTagCompound etiquetas = item.getTagCompound(); if (etiquetas == null) { etiquetas = new NBTTagCompound(); } etiquetas.setFloat(tag, value); item.setTagCompound(etiquetas); } //####################################################################################################################3 public static int getInttag(ItemStack item, String tag){ NBTTagCompound etiquetas = item.getTagCompound(); if (etiquetas == null) { etiquetas = new NBTTagCompound(); item.setTagCompound(etiquetas); return 9999; } int ex=etiquetas.getInteger(tag); return ex; } //####################################################################################################################3 public static void setInttag(ItemStack item, String tag, int value) { NBTTagCompound etiquetas = item.getTagCompound(); if (etiquetas == null) { etiquetas = new NBTTagCompound(); } etiquetas.setInteger(tag, value); item.setTagCompound(etiquetas); } //####################################################################################################################3 public static Boolean getBooleantag(ItemStack item, String tag) { NBTTagCompound etiquetas = item.getTagCompound(); if (etiquetas == null) { etiquetas = new NBTTagCompound(); item.setTagCompound(etiquetas); return false; } boolean ex=etiquetas.getBoolean(tag); return ex; } //####################################################################################################################3 public static void setBooleantag(ItemStack item, String tag, boolean value) { NBTTagCompound etiquetas = item.getTagCompound(); if (etiquetas == null) { etiquetas = item.getTagCompound(); } etiquetas.setBoolean(tag, value); item.setTagCompound(etiquetas); } //####################################################################################################################3 }//fin de la classe
-
jumm so the plan is to open battle gear and look how they dooid the armas thing in their code ?
-
well when the player legitimately changes items, in mi guns long ago i add serial number system soo when one of mi guns initialize for first time it add a 8 int number soo i could make // ######################################################################################3 @Override public boolean shouldCauseReequipAnimation(ItemStack oldStack, ItemStack newStack, boolean slotChanged) { int oldStackSN = util.getInttag(oldStack, "numerodeserie"); int newStackSN = util.getInttag(newStack, "numerodeserie"); if (oldStackSN == newStackSN) { return false; } return true; } // ######################################################################################3 and its works
-
this post give me hope may i could fix that anoying behaveours in mi fire guns mod and tools http://s9.postimg.org/s8zoopo7v/its_something.jpg[/img] so thanks for that long ago i make i lot of post trying to find a way to disable this betwin other animations efects that com by default whith the item class this one actualy cancel the molest animation of the item going down and up again every time you change something in the nbtTag can you tell me if its posible to also cancel the animation of the item going down and up hapening when the item enter in use coz this piece of code @Override public ItemStack onItemRightClick(ItemStack pistola, World worldIn, EntityPlayer playerIn) { //this causes the animation again playerIn.setItemInUse(pistola, this.getMaxItemUseDuration(pistola)); return pistola; } and the other i dont find how to disable is the bow thigthen animation the first view part https://drive.google.com/file/d/0B8sU_NyZQBd7NnNBRmtZbThkbHc/view?usp=sharing @Override public EnumAction getItemUseAction(ItemStack pistola) { return EnumAction.BOW; } but keeping this part https://drive.google.com/file/d/0B8sU_NyZQBd7RENUN21Lam1TNnM/view?usp=sharing i set EnumAction to BOW soo the player raise his arms and aim the pistol gun in the thirth view but this also play the bow animation in first view and is anoying and incongruend whith a pistol behaveour is posible to disable also this first view animation ?? and keeping the rise arms animation in thirth view
-
that is the answer "suers in spanish" i dont du that for begining coz i think i must write the property to the config file something like configFile.set( configFile.get("Gui", "Gui pos Y", ppy, "").setInt(99); ); for the other things scavenging code from the minions, ZyinsHUD and ClockHUD i now understand than in the chest based gui you align things based on the center of the screen rater than the top left like i supoust before so i fix the buttons positions now are where i want and keep that position but this is not valid for the other types of gui, like mi gun stats gui, the gui elemets end missplaced if i alignenm whit the ceter coz the center moves also when you change size or the guiscale well i actualy could forget that, just let the gui whith buttons to let the player set the guns stat gui position like he likes thats what they do in the zyins mod in ClockHUD they just let it in x0 y0 but i really like to know how to calculate the render position of the gui is this really posible or is this the result from a (bug o|r feature) thanks for reading now i gona back to work whi the other trouble of the textures size's crash
-
du not know if i write configFile.prop and let eclipse autoComplete the closest to setProperty is configFile.setCategoryPropertyOrder(category, propOrder) and looks not like.. usefull for what i want in this case i wanna change an integer value but if i writte configFile.int and let it autocomplete well it only returns .getMethods https://drive.google.com/file/d/0B8sU_NyZQBd7ZzJ2ZFNCaW5iVmM/view?usp=sharing https://drive.google.com/file/d/0B8sU_NyZQBd7Z0xfNm00X2lUbVE/view?usp=sharing looks like there is no tools to do this, but i been see mods doing it before so there must be a trick some workaround configFile.
-
good days im maken a little experiment to try to workaround another problem and found another and one more problem but first i put some buttons in one of mi gui class to change the relative position of another gui, mi guns gui on screen to solve the probem for the other post http://www.minecraftforge.net/forum/index.php/topic,35924.0.html the gui class whith buttons read pos X and pos Y values from mi config file gui { # you can disable gui if becomes a trouble B:"Gui Enable"=true # Gui size default 30 I:"Gui Size"=30 # fix the gui position I:"Gui pos X"=0 I:"Gui pos Y"=0 } and set the values based on what you press and send this values to the guns gui, this actually works the guns gui change in size and position, the thing is i dont get how writte this changes back to the config file the method i been using to writte values to the config Property cfg_guiSize = configFile.get("Gui", "Gui Size", 30, "Gui size"); is more of the type: if there is no value write this and set it to 30, but if it is a value du nothing the gui whith the buttons can change this 30 per 50 or something but this method dont let me writte the changes back to the config looking in the Configuration.class there seems to be not a .set("propertiname", int value) or something like, to allow to change from inside the game the values in the config file i du config file reading the "How to make an advanced configuration file" in http://www.minecraftforge.net/wiki/How_to_make_an_advanced_configuration_file#Loading_and_Saving_the_Configuration #### question 1 how do change the values in the config file from the game and written to config file #################### the other problem i run into is like the problem in the original post the butons in the gui whith butons are positionated based on the minecraft window sizes so if i set it where i want when the window is at 854x480 size this is rigth side of the gui aligned whit the first upper line of slots, if i change the windows size (maximaze or whatever) the buttons get out of place causing impact in the laligment layout of the gui https://drive.google.com/file/d/0B8sU_NyZQBd7TG1tMVp0YmxkcDA/view?usp=sharing #### quetion 2 how do make the buttons keep their aligment whith the rest of the gui #################### and last the forum has img tags to put images on the posts but seems not load mi images from google drive ¿is not compatible whith google thanks for reading