本文整理汇总了Java中net.minecraft.entity.ai.attributes.RangedAttribute类的典型用法代码示例。如果您正苦于以下问题:Java RangedAttribute类的具体用法?Java RangedAttribute怎么用?Java RangedAttribute使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。
RangedAttribute类属于net.minecraft.entity.ai.attributes包,在下文中一共展示了RangedAttribute类的9个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: handleEntityProperties
import net.minecraft.entity.ai.attributes.RangedAttribute; //导入依赖的package包/类
/**
* Updates en entity's attributes and their respective modifiers, which are used for speed bonusses (player
* sprinting, animals fleeing, baby speed), weapon/tool attackDamage, hostiles followRange randomization, zombie
* maxHealth and knockback resistance as well as reinforcement spawning chance.
*/
public void handleEntityProperties(S20PacketEntityProperties packetIn)
{
PacketThreadUtil.checkThreadAndEnqueue(packetIn, this, this.gameController);
Entity entity = this.clientWorldController.getEntityByID(packetIn.getEntityId());
if (entity != null)
{
if (!(entity instanceof EntityLivingBase))
{
throw new IllegalStateException("Server tried to update attributes of a non-living entity (actually: " + entity + ")");
}
else
{
BaseAttributeMap baseattributemap = ((EntityLivingBase)entity).getAttributeMap();
for (S20PacketEntityProperties.Snapshot s20packetentityproperties$snapshot : packetIn.func_149441_d())
{
IAttributeInstance iattributeinstance = baseattributemap.getAttributeInstanceByName(s20packetentityproperties$snapshot.func_151409_a());
if (iattributeinstance == null)
{
iattributeinstance = baseattributemap.registerAttribute(new RangedAttribute((IAttribute)null, s20packetentityproperties$snapshot.func_151409_a(), 0.0D, 2.2250738585072014E-308D, Double.MAX_VALUE));
}
iattributeinstance.setBaseValue(s20packetentityproperties$snapshot.func_151410_b());
iattributeinstance.removeAllModifiers();
for (AttributeModifier attributemodifier : s20packetentityproperties$snapshot.func_151408_c())
{
iattributeinstance.applyModifier(attributemodifier);
}
}
}
}
}
示例2: handleEntityProperties
import net.minecraft.entity.ai.attributes.RangedAttribute; //导入依赖的package包/类
/**
* Updates en entity's attributes and their respective modifiers, which are used
* for speed bonusses (player sprinting, animals fleeing, baby speed),
* weapon/tool attackDamage, hostiles followRange randomization, zombie
* maxHealth and knockback resistance as well as reinforcement spawning chance.
*/
public void handleEntityProperties(S20PacketEntityProperties packetIn) {
PacketThreadUtil.checkThreadAndEnqueue(packetIn, this, this.gameController);
Entity entity = this.clientWorldController.getEntityByID(packetIn.getEntityId());
if (entity != null) {
if (!(entity instanceof EntityLivingBase)) {
throw new IllegalStateException(
"Server tried to update attributes of a non-living entity (actually: " + entity + ")");
} else {
BaseAttributeMap baseattributemap = ((EntityLivingBase) entity).getAttributeMap();
for (S20PacketEntityProperties.Snapshot s20packetentityproperties$snapshot : packetIn.func_149441_d()) {
IAttributeInstance iattributeinstance = baseattributemap
.getAttributeInstanceByName(s20packetentityproperties$snapshot.func_151409_a());
if (iattributeinstance == null) {
iattributeinstance = baseattributemap.registerAttribute(new RangedAttribute((IAttribute) null,
s20packetentityproperties$snapshot.func_151409_a(), 0.0D, 2.2250738585072014E-308D,
Double.MAX_VALUE));
}
iattributeinstance.setBaseValue(s20packetentityproperties$snapshot.func_151410_b());
iattributeinstance.removeAllModifiers();
for (AttributeModifier attributemodifier : s20packetentityproperties$snapshot.func_151408_c()) {
iattributeinstance.applyModifier(attributemodifier);
}
}
}
}
}
示例3: handleEntityProperties
import net.minecraft.entity.ai.attributes.RangedAttribute; //导入依赖的package包/类
/**
* Updates en entity's attributes and their respective modifiers, which are used for speed bonusses (player
* sprinting, animals fleeing, baby speed), weapon/tool attackDamage, hostiles followRange randomization, zombie
* maxHealth and knockback resistance as well as reinforcement spawning chance.
*/
public void handleEntityProperties(SPacketEntityProperties packetIn)
{
PacketThreadUtil.checkThreadAndEnqueue(packetIn, this, this.gameController);
Entity entity = this.clientWorldController.getEntityByID(packetIn.getEntityId());
if (entity != null)
{
if (!(entity instanceof EntityLivingBase))
{
throw new IllegalStateException("Server tried to update attributes of a non-living entity (actually: " + entity + ")");
}
else
{
AbstractAttributeMap abstractattributemap = ((EntityLivingBase)entity).getAttributeMap();
for (SPacketEntityProperties.Snapshot spacketentityproperties$snapshot : packetIn.getSnapshots())
{
IAttributeInstance iattributeinstance = abstractattributemap.getAttributeInstanceByName(spacketentityproperties$snapshot.getName());
if (iattributeinstance == null)
{
iattributeinstance = abstractattributemap.registerAttribute(new RangedAttribute((IAttribute)null, spacketentityproperties$snapshot.getName(), 0.0D, 2.2250738585072014E-308D, Double.MAX_VALUE));
}
iattributeinstance.setBaseValue(spacketentityproperties$snapshot.getBaseValue());
iattributeinstance.removeAllModifiers();
for (AttributeModifier attributemodifier : spacketentityproperties$snapshot.getModifiers())
{
iattributeinstance.applyModifier(attributemodifier);
}
}
}
}
}
示例4: handleEntityProperties
import net.minecraft.entity.ai.attributes.RangedAttribute; //导入依赖的package包/类
/**
* Updates en entity's attributes and their respective modifiers, which are used for speed bonusses (player
* sprinting, animals fleeing, baby speed), weapon/tool attackDamage, hostiles followRange randomization, zombie
* maxHealth and knockback resistance as well as reinforcement spawning chance.
*/
public void handleEntityProperties(S20PacketEntityProperties p_147290_1_)
{
Entity var2 = this.clientWorldController.getEntityByID(p_147290_1_.func_149442_c());
if (var2 != null)
{
if (!(var2 instanceof EntityLivingBase))
{
throw new IllegalStateException("Server tried to update attributes of a non-living entity (actually: " + var2 + ")");
}
else
{
BaseAttributeMap var3 = ((EntityLivingBase)var2).getAttributeMap();
Iterator var4 = p_147290_1_.func_149441_d().iterator();
while (var4.hasNext())
{
S20PacketEntityProperties.Snapshot var5 = (S20PacketEntityProperties.Snapshot)var4.next();
IAttributeInstance var6 = var3.getAttributeInstanceByName(var5.func_151409_a());
if (var6 == null)
{
var6 = var3.registerAttribute(new RangedAttribute(var5.func_151409_a(), 0.0D, 2.2250738585072014E-308D, Double.MAX_VALUE));
}
var6.setBaseValue(var5.func_151410_b());
var6.removeAllModifiers();
Iterator var7 = var5.func_151408_c().iterator();
while (var7.hasNext())
{
AttributeModifier var8 = (AttributeModifier)var7.next();
var6.applyModifier(var8);
}
}
}
}
}
示例5: handleEntityProperties
import net.minecraft.entity.ai.attributes.RangedAttribute; //导入依赖的package包/类
public void handleEntityProperties(S20PacketEntityProperties p_147290_1_)
{
Entity entity = this.clientWorldController.getEntityByID(p_147290_1_.func_149442_c());
if (entity != null)
{
if (!(entity instanceof EntityLivingBase))
{
throw new IllegalStateException("Server tried to update attributes of a non-living entity (actually: " + entity + ")");
}
else
{
BaseAttributeMap baseattributemap = ((EntityLivingBase)entity).getAttributeMap();
Iterator iterator = p_147290_1_.func_149441_d().iterator();
while (iterator.hasNext())
{
S20PacketEntityProperties.Snapshot snapshot = (S20PacketEntityProperties.Snapshot)iterator.next();
IAttributeInstance iattributeinstance = baseattributemap.getAttributeInstanceByName(snapshot.func_151409_a());
if (iattributeinstance == null)
{
iattributeinstance = baseattributemap.registerAttribute(new RangedAttribute(snapshot.func_151409_a(), 0.0D, 2.2250738585072014E-308D, Double.MAX_VALUE));
}
iattributeinstance.setBaseValue(snapshot.func_151410_b());
iattributeinstance.removeAllModifiers();
Iterator iterator1 = snapshot.func_151408_c().iterator();
while (iterator1.hasNext())
{
AttributeModifier attributemodifier = (AttributeModifier)iterator1.next();
iattributeinstance.applyModifier(attributemodifier);
}
}
}
}
}
示例6: func_111150_b
import net.minecraft.entity.ai.attributes.RangedAttribute; //导入依赖的package包/类
public AttributeInstance func_111150_b(Attribute p_111150_1_) {
if(this.field_111153_b.containsKey(p_111150_1_.func_111108_a())) {
throw new IllegalArgumentException("Attribute is already registered!");
} else {
ModifiableAttributeInstance var2 = new ModifiableAttributeInstance(this, p_111150_1_);
this.field_111153_b.put(p_111150_1_.func_111108_a(), var2);
if(p_111150_1_ instanceof RangedAttribute && ((RangedAttribute)p_111150_1_).func_111116_f() != null) {
this.field_111163_c.put(((RangedAttribute)p_111150_1_).func_111116_f(), var2);
}
this.field_111154_a.put(p_111150_1_, var2);
return var2;
}
}
示例7: func_110773_a
import net.minecraft.entity.ai.attributes.RangedAttribute; //导入依赖的package包/类
public void func_110773_a(Packet44UpdateAttributes p_110773_1_) {
Entity var2 = this.func_72545_a(p_110773_1_.func_111002_d());
if(var2 != null) {
if(!(var2 instanceof EntityLivingBase)) {
throw new IllegalStateException("Server tried to update attributes of a non-living entity (actually: " + var2 + ")");
} else {
BaseAttributeMap var3 = ((EntityLivingBase)var2).func_110140_aT();
Iterator var4 = p_110773_1_.func_111003_f().iterator();
while(var4.hasNext()) {
Packet44UpdateAttributesSnapshot var5 = (Packet44UpdateAttributesSnapshot)var4.next();
AttributeInstance var6 = var3.func_111152_a(var5.func_142040_a());
if(var6 == null) {
var6 = var3.func_111150_b(new RangedAttribute(var5.func_142040_a(), 0.0D, 2.2250738585072014E-308D, Double.MAX_VALUE));
}
var6.func_111128_a(var5.func_142041_b());
var6.func_142049_d();
Iterator var7 = var5.func_142039_c().iterator();
while(var7.hasNext()) {
AttributeModifier var8 = (AttributeModifier)var7.next();
var6.func_111121_a(var8);
}
}
}
}
}
示例8: func_110773_a
import net.minecraft.entity.ai.attributes.RangedAttribute; //导入依赖的package包/类
public void func_110773_a(Packet44UpdateAttributes par1Packet44UpdateAttributes)
{
Entity entity = this.getEntityByID(par1Packet44UpdateAttributes.func_111002_d());
if (entity != null)
{
if (!(entity instanceof EntityLivingBase))
{
throw new IllegalStateException("Server tried to update attributes of a non-living entity (actually: " + entity + ")");
}
else
{
BaseAttributeMap baseattributemap = ((EntityLivingBase)entity).getAttributeMap();
Iterator iterator = par1Packet44UpdateAttributes.func_111003_f().iterator();
while (iterator.hasNext())
{
Packet44UpdateAttributesSnapshot packet44updateattributessnapshot = (Packet44UpdateAttributesSnapshot)iterator.next();
AttributeInstance attributeinstance = baseattributemap.getAttributeInstanceByName(packet44updateattributessnapshot.func_142040_a());
if (attributeinstance == null)
{
attributeinstance = baseattributemap.func_111150_b(new RangedAttribute(packet44updateattributessnapshot.func_142040_a(), 0.0D, 2.2250738585072014E-308D, Double.MAX_VALUE));
}
attributeinstance.setAttribute(packet44updateattributessnapshot.func_142041_b());
attributeinstance.func_142049_d();
Iterator iterator1 = packet44updateattributessnapshot.func_142039_c().iterator();
while (iterator1.hasNext())
{
AttributeModifier attributemodifier = (AttributeModifier)iterator1.next();
attributeinstance.applyModifier(attributemodifier);
}
}
}
}
}
示例9: preInit
import net.minecraft.entity.ai.attributes.RangedAttribute; //导入依赖的package包/类
@NModuleTrigger(trigger = "PRE_INITIALIZATION")
public void preInit() {
ReflectiveModifier.modifyFieldValue(RangedAttribute.class, (RangedAttribute) SharedMonsterAttributes.MAX_HEALTH, "field_111118_b", Double.MAX_VALUE);
}