You managed to decompile and continue without me giving source code? O_O Bro, you are a god. Of course do whatever the [REDACTED] you want!!!! Good luck on it
The Meaning of Life, the Universe, and Everything.
Location:
Earth
Join Date:
11/6/2012
Posts:
51
Minecraft:
Brian_Entei
Xbox:
br45entei
Member Details
Using MCP and minecraft 1.7.10, I couldn't figure out how to set move speed, knockback, attack damage or max health, so I tried the way as described in this thread but to no avail(I was getting many IllegalArgumentException errors and null pointers), so I came up with a way around it:
The following code goes in the EntityPlayer class and the function applyEntityAttributes() is overridden here:
protected void func_110147_ax() { super.func_110147_ax(); // Max Health - default 20.0D - min 0.0D - max Double.MAX_VALUE this.func_110148_a(SharedMonsterAttributes.field_111267_a).func_111128_a(20.0D); // Follow Range - default 32.0D - min 0.0D - max 2048.0D this.func_110148_a(SharedMonsterAttributes.field_111265_B).func_111128_a(32.0D); // Knockback Resistance - default 0.0D - min 0.0D - max 1.0D this.func_110148_a(SharedMonsterAttributes.field_111266_c).func_111128_a(0.0D); // Movement Speed - default 0.699D - min 0.0D - max Double.MAX_VALUE this.func_110148_a(SharedMonsterAttributes.field_111263_d).func_111128_a(0.699D); // Attack Damage - default 2.0D - min 0.0D - max Doubt.MAX_VALUE this.func_110148_a(SharedMonsterAttributes.field_111264_e).func_111128_a(2.0D); }-
View User Profile
-
View Posts
-
Send Message
Curse Premium-
View User Profile
-
View Posts
-
Send Message
Curse Premium-
View User Profile
-
View Posts
-
Send Message
Curse PremiumPatreon
-
View User Profile
-
View Posts
-
Send Message
Curse Premiumprotected void applyEntityAttributes() { super.applyEntityAttributes(); // Max Health - default 20.0D - min 0.0D - max Double.MAX_VALUE this.getEntityAttribute(SharedMonsterAttributes.maxHealth).setAttribute(20.0D); // Follow Range - default 32.0D - min 0.0D - max 2048.0D this.getEntityAttribute(SharedMonsterAttributes.followRange).setAttribute(32.0D); // Knockback Resistance - default 0.0D - min 0.0D - max 1.0D this.getEntityAttribute(SharedMonsterAttributes.knockbackResistance).setAttribute(0.0D); // Movement Speed - default 0.699D - min 0.0D - max Double.MAX_VALUE this.getEntityAttribute(SharedMonsterAttributes.movementSpeed).setAttribute(0.699D); // Attack Damage - default 2.0D - min 0.0D - max Doubt.MAX_VALUE this.getEntityAttribute(SharedMonsterAttributes.attackDamage).setAttribute(2.0D); }教えて教えてよその仕組みを。
-
View User Profile
-
View Posts
-
Send Message
Curse PremiumThe following code goes in the EntityPlayer class and the function applyEntityAttributes() is overridden here:
protected void ensureEntityAttributesAreRegistered() {
if(this.getAttributeMap().getAttributeInstance(SharedMonsterAttributes.maxHealth) == null) {
this.getAttributeMap().registerAttribute(SharedMonsterAttributes.maxHealth).setBaseValue(20.0D);
}
if(this.getAttributeMap().getAttributeInstance(SharedMonsterAttributes.followRange) == null) {
this.getAttributeMap().registerAttribute(SharedMonsterAttributes.followRange).setBaseValue(32.0D);
}
if(this.getAttributeMap().getAttributeInstance(SharedMonsterAttributes.knockbackResistance) == null) {
this.getAttributeMap().registerAttribute(SharedMonsterAttributes.knockbackResistance).setBaseValue(0.0D);
}
if(this.getAttributeMap().getAttributeInstance(SharedMonsterAttributes.movementSpeed) == null) {
this.getAttributeMap().registerAttribute(SharedMonsterAttributes.movementSpeed).setBaseValue(0.699D);
}
if(this.getAttributeMap().getAttributeInstance(SharedMonsterAttributes.attackDamage) == null) {
this.getAttributeMap().registerAttribute(SharedMonsterAttributes.attackDamage).setBaseValue(1.0D);
}
}
@Override
protected void applyEntityAttributes()
{
//super.applyEntityAttributes(); <--Old vanilla code
//this.getAttributeMap().registerAttribute(SharedMonsterAttributes.attackDamage).setBaseValue(1.0D); <--Old vanilla code
this.ensureEntityAttributesAreRegistered(); <--New and improved code, prevents IllegalArgumentException errors
}
public EntityPlayer setMaxHealth(double newMaxHealth) {
this.ensureEntityAttributesAreRegistered();
this.getAttributeMap().getAttributeInstance(SharedMonsterAttributes.maxHealth).setBaseValue(newMaxHealth);
return this;
}
public EntityPlayer setFollowRange(double newFollowRange) {
this.ensureEntityAttributesAreRegistered();
this.getAttributeMap().getAttributeInstance(SharedMonsterAttributes.followRange).setBaseValue(newFollowRange);
return this;
}
public EntityPlayer setKnockbackResistance(double newKnockbackResistance) {
this.ensureEntityAttributesAreRegistered();
this.getAttributeMap().getAttributeInstance(SharedMonsterAttributes.knockbackResistance).setBaseValue(newKnockbackResistance);
return this;
}
public EntityPlayer setMovementSpeed(double newMovementSpeed) {
this.ensureEntityAttributesAreRegistered();
this.getAttributeMap().getAttributeInstance(SharedMonsterAttributes.movementSpeed).setBaseValue(newMovementSpeed);
return this;
}
public EntityPlayer setAttackDamage(double newAttackDamage) {
this.ensureEntityAttributesAreRegistered();
this.getAttributeMap().getAttributeInstance(SharedMonsterAttributes.attackDamage).setBaseValue(newAttackDamage);
return this;
}
-Brian_Entei