/** * Sends the entity metadata (DataWatcher) and attributes to all players tracking this entity, including the entity * itself if a player. */ private void sendMetadataToAllAssociatedPlayers() { DataWatcher datawatcher = this.trackedEntity.getDataWatcher(); if (datawatcher.hasObjectChanged()) { this.func_151261_b(new S1CPacketEntityMetadata(this.trackedEntity.getEntityId(), datawatcher, false)); } if (this.trackedEntity instanceof EntityLivingBase) { ServersideAttributeMap serversideattributemap = (ServersideAttributeMap)((EntityLivingBase)this.trackedEntity).getAttributeMap(); Set<IAttributeInstance> set = serversideattributemap.getAttributeInstanceSet(); if (!set.isEmpty()) { this.func_151261_b(new S20PacketEntityProperties(this.trackedEntity.getEntityId(), set)); } set.clear(); } }
public static double rateDamage(ItemStack is) { if (is == null) { return 0.0D; } Multimap attrs = is.getItem().getAttributeModifiers(is); if (attrs == null) { return 0.0D; } BaseAttributeMap test = new ServersideAttributeMap(); test.applyAttributeModifiers(attrs); IAttributeInstance attr = test.getAttributeInstance(SharedMonsterAttributes.attackDamage); if (attr == null) { return 0.0D; } return attr.getAttributeValue(); }
private void func_111190_b() { DataWatcher var1 = this.myEntity.getDataWatcher(); if (var1.hasChanges()) { this.func_151261_b(new S1CPacketEntityMetadata(this.myEntity.getEntityId(), var1, false)); } if (this.myEntity instanceof EntityLivingBase) { ServersideAttributeMap var2 = (ServersideAttributeMap)((EntityLivingBase)this.myEntity).getAttributeMap(); Set var3 = var2.getAttributeInstanceSet(); if (!var3.isEmpty()) { this.func_151261_b(new S20PacketEntityProperties(this.myEntity.getEntityId(), var3)); } var3.clear(); } }
private void sendMetadataToAllAssociatedPlayers() { DataWatcher datawatcher = this.myEntity.getDataWatcher(); if (datawatcher.hasChanges()) { this.func_151261_b(new S1CPacketEntityMetadata(this.myEntity.getEntityId(), datawatcher, false)); } if (this.myEntity instanceof EntityLivingBase) { ServersideAttributeMap serversideattributemap = (ServersideAttributeMap)((EntityLivingBase)this.myEntity).getAttributeMap(); Set set = serversideattributemap.getAttributeInstanceSet(); if (!set.isEmpty()) { this.func_151261_b(new S20PacketEntityProperties(this.myEntity.getEntityId(), set)); } set.clear(); } }
private void resetNBTList() { EntityLivingBase desiredEntity = (EntityLivingBase) EntityList.createEntityByName(creatureNameField.getText(), Minecraft.getMinecraft().theWorld); if (desiredEntity != null) { try { ObfuscationHelper.setCatchableFieldUsingReflection("field_110155_d", EntityLivingBase.class, desiredEntity, true, new ServersideAttributeMap()); } catch (Exception e) { ObfuscationHelper.setFieldUsingReflection("attributeMap", EntityLivingBase.class, desiredEntity, true, new ServersideAttributeMap()); } ObfuscationHelper.invokeMethod("applyEntityAttributes", "func_110147_ax", EntityLivingBase.class, desiredEntity); loadedNBT = new NBTTagCompound(); desiredEntity.writeToNBT(loadedNBT); nbtTree = new NBTTree(loadedNBT, "Properties"); nbtList = new GUINBTList(this, mc, nbtTree, 214, screenSize, backgroundSize); } }
private void func_111190_b() { DataWatcher var1 = this.field_73132_a.func_70096_w(); if(var1.func_75684_a()) { this.func_73116_b(new Packet40EntityMetadata(this.field_73132_a.field_70157_k, var1, false)); } if(this.field_73132_a instanceof EntityLivingBase) { ServersideAttributeMap var2 = (ServersideAttributeMap)((EntityLivingBase)this.field_73132_a).func_110140_aT(); Set var3 = var2.func_111161_b(); if(!var3.isEmpty()) { this.func_73116_b(new Packet44UpdateAttributes(this.field_73132_a.field_70157_k, var3)); } var3.clear(); } }
private void func_111190_b() { DataWatcher datawatcher = this.myEntity.getDataWatcher(); if (datawatcher.hasChanges()) { this.sendPacketToAllAssociatedPlayers(new Packet40EntityMetadata(this.myEntity.entityId, datawatcher, false)); } if (this.myEntity instanceof EntityLivingBase) { ServersideAttributeMap serversideattributemap = (ServersideAttributeMap)((EntityLivingBase)this.myEntity).getAttributeMap(); Set set = serversideattributemap.func_111161_b(); if (!set.isEmpty()) { this.sendPacketToAllAssociatedPlayers(new Packet44UpdateAttributes(this.myEntity.entityId, set)); } set.clear(); } }
public BaseAttributeMap getAttributeMap() { if (this.attributeMap == null) { this.attributeMap = new ServersideAttributeMap(); } return this.attributeMap; }
public static double rateDamage(ItemStack is) { if (is == null) return 0; Multimap<String, AttributeModifier> attrs = is.getItem().getAttributeModifiers(is); if (attrs == null) return 0; BaseAttributeMap test = new ServersideAttributeMap(); test.applyAttributeModifiers(attrs); IAttributeInstance attr = test.getAttributeInstance(SharedMonsterAttributes.attackDamage); if (attr == null) return 0; return attr.getAttributeValue(); }
private void sendMetadataToAllAssociatedPlayers() { DataWatcher datawatcher = this.myEntity.getDataWatcher(); if (datawatcher.hasChanges()) { this.func_151261_b(new S1CPacketEntityMetadata(this.myEntity.getEntityId(), datawatcher, false)); } if (this.myEntity instanceof EntityLivingBase) { ServersideAttributeMap serversideattributemap = (ServersideAttributeMap)((EntityLivingBase)this.myEntity).getAttributeMap(); Set set = serversideattributemap.getAttributeInstanceSet(); if (!set.isEmpty()) { // CraftBukkit start - Send scaled max health if (this.myEntity instanceof EntityPlayerMP) { ((EntityPlayerMP) this.myEntity).getBukkitEntity().injectScaledMaxHealth(set, false); } // CraftBukkit end this.func_151261_b(new S20PacketEntityProperties(this.myEntity.getEntityId(), set)); } set.clear(); } }
public BaseAttributeMap func_110140_aT() { if(this.field_110155_d == null) { this.field_110155_d = new ServersideAttributeMap(); } return this.field_110155_d; }
public void updateAttributes() { if(getBodyParts().length > 0) { attributeMap = new ServersideAttributeMap(); attributeMap.func_111150_b(SharedMonsterAttributes.field_111267_a); attributeMap.func_111150_b(SharedMonsterAttributes.field_111265_b); attributeMap.func_111150_b(SharedMonsterAttributes.field_111266_c); attributeMap.func_111150_b(SharedMonsterAttributes.field_111263_d); attributeMap.func_111150_b(SharedMonsterAttributes.field_111264_e); if(head != null && head.length > 0 && head[0] != null) { head[0].attributes = new ServersideAttributeMap(); head[0].entity.setAttributes(this, BodyPartLocation.Head); combineAttributes(head[0].attributes); } if(torso != null && torso.length > 0 && torso[0] != null) { torso[0].attributes = new ServersideAttributeMap(); torso[0].entity.setAttributes(this, BodyPartLocation.Torso); combineAttributes(torso[0].attributes); } if(armLeft != null && armLeft.length > 0 && armLeft[0] != null) { armLeft[0].attributes = new ServersideAttributeMap(); armLeft[0].entity.setAttributes(this, BodyPartLocation.ArmLeft); combineAttributes(armLeft[0].attributes); } if(armRight != null && armRight.length > 0 && armRight[0] != null) { armRight[0].attributes = new ServersideAttributeMap(); armRight[0].entity.setAttributes(this, BodyPartLocation.ArmRight); combineAttributes(armRight[0].attributes); } if(leg != null && leg.length > 0 && leg[0] != null) { leg[0].attributes = new ServersideAttributeMap(); leg[0].entity.setAttributes(this, BodyPartLocation.Legs); combineAttributes(leg[0].attributes); } setEntityHealth((float) (func_110143_aJ() > func_110148_a(SharedMonsterAttributes.field_111267_a).func_111125_b() ? func_110148_a(SharedMonsterAttributes.field_111267_a).func_111125_b() : func_110143_aJ())); } }
@Override public BaseAttributeMap func_110140_aT() { if (this.attributeMap == null) { this.attributeMap = new ServersideAttributeMap(); } return this.attributeMap; }
public void func_73117_b(EntityPlayerMP p_73117_1_) { if(p_73117_1_ != this.field_73132_a) { double var2 = p_73117_1_.field_70165_t - (double)(this.field_73128_d / 32); double var4 = p_73117_1_.field_70161_v - (double)(this.field_73126_f / 32); if(var2 >= (double)(-this.field_73130_b) && var2 <= (double)this.field_73130_b && var4 >= (double)(-this.field_73130_b) && var4 <= (double)this.field_73130_b) { if(!this.field_73134_o.contains(p_73117_1_) && (this.func_73121_d(p_73117_1_) || this.field_73132_a.field_98038_p)) { this.field_73134_o.add(p_73117_1_); Packet var6 = this.func_73124_b(); p_73117_1_.field_71135_a.func_72567_b(var6); if(!this.field_73132_a.func_70096_w().func_92085_d()) { p_73117_1_.field_71135_a.func_72567_b(new Packet40EntityMetadata(this.field_73132_a.field_70157_k, this.field_73132_a.func_70096_w(), true)); } if(this.field_73132_a instanceof EntityLivingBase) { ServersideAttributeMap var7 = (ServersideAttributeMap)((EntityLivingBase)this.field_73132_a).func_110140_aT(); Collection var8 = var7.func_111160_c(); if(!var8.isEmpty()) { p_73117_1_.field_71135_a.func_72567_b(new Packet44UpdateAttributes(this.field_73132_a.field_70157_k, var8)); } } this.field_73137_j = this.field_73132_a.field_70159_w; this.field_73138_k = this.field_73132_a.field_70181_x; this.field_73135_l = this.field_73132_a.field_70179_y; if(this.field_73143_t && !(var6 instanceof Packet24MobSpawn)) { p_73117_1_.field_71135_a.func_72567_b(new Packet28EntityVelocity(this.field_73132_a.field_70157_k, this.field_73132_a.field_70159_w, this.field_73132_a.field_70181_x, this.field_73132_a.field_70179_y)); } if(this.field_73132_a.field_70154_o != null) { p_73117_1_.field_71135_a.func_72567_b(new Packet39AttachEntity(0, this.field_73132_a, this.field_73132_a.field_70154_o)); } if(this.field_73132_a instanceof EntityLiving && ((EntityLiving)this.field_73132_a).func_110166_bE() != null) { p_73117_1_.field_71135_a.func_72567_b(new Packet39AttachEntity(1, this.field_73132_a, ((EntityLiving)this.field_73132_a).func_110166_bE())); } if(this.field_73132_a instanceof EntityLivingBase) { for(int var10 = 0; var10 < 5; ++var10) { ItemStack var13 = ((EntityLivingBase)this.field_73132_a).func_71124_b(var10); if(var13 != null) { p_73117_1_.field_71135_a.func_72567_b(new Packet5PlayerInventory(this.field_73132_a.field_70157_k, var10, var13)); } } } if(this.field_73132_a instanceof EntityPlayer) { EntityPlayer var11 = (EntityPlayer)this.field_73132_a; if(var11.func_70608_bn()) { p_73117_1_.field_71135_a.func_72567_b(new Packet17Sleep(this.field_73132_a, 0, MathHelper.func_76128_c(this.field_73132_a.field_70165_t), MathHelper.func_76128_c(this.field_73132_a.field_70163_u), MathHelper.func_76128_c(this.field_73132_a.field_70161_v))); } } if(this.field_73132_a instanceof EntityLivingBase) { EntityLivingBase var14 = (EntityLivingBase)this.field_73132_a; Iterator var12 = var14.func_70651_bq().iterator(); while(var12.hasNext()) { PotionEffect var9 = (PotionEffect)var12.next(); p_73117_1_.field_71135_a.func_72567_b(new Packet41EntityEffect(this.field_73132_a.field_70157_k, var9)); } } } } else if(this.field_73134_o.contains(p_73117_1_)) { this.field_73134_o.remove(p_73117_1_); p_73117_1_.field_71130_g.add(Integer.valueOf(this.field_73132_a.field_70157_k)); } } }