mirror of
https://github.com/KAMKEEL/CustomNPC-Plus.git
synced 2026-11-17 14:35:12 +00:00
Only Attributes + Resistances with DBC Addon
This commit is contained in:
1 parent
f30cbf78f3
commit
5ab2203a8a
3 files changed
+26
-15
No files matched your search
@@ -19,23 +19,32 @@ public class SubGuiNpcResistanceProperties extends SubGuiInterface implements IS
|
||||
public void initGui()
|
||||
{
|
||||
super.initGui();
|
||||
addLabel(new GuiNpcLabel(0,"enchantment.knockback", guiLeft + 4, guiTop + 15));
|
||||
addSlider(new GuiNpcSlider(this, 0, guiLeft + 94, guiTop + 10, (int)(resistances.knockback * 100 - 100) + "%", resistances.knockback / 2));
|
||||
int y = guiTop + 10;
|
||||
addLabel(new GuiNpcLabel(0,"enchantment.knockback", guiLeft + 4, y + 5));
|
||||
addSlider(new GuiNpcSlider(this, 0, guiLeft + 94, y, (int)(resistances.knockback * 100 - 100) + "%", resistances.knockback / 2));
|
||||
|
||||
addLabel(new GuiNpcLabel(1,"item.arrow.name", guiLeft + 4, guiTop + 37));
|
||||
addSlider(new GuiNpcSlider(this, 1, guiLeft + 94, guiTop + 32, (int)(resistances.arrow * 100 - 100) + "%", resistances.arrow / 2));
|
||||
y += 22;
|
||||
|
||||
addLabel(new GuiNpcLabel(1,"item.arrow.name", guiLeft + 4, y + 5));
|
||||
addSlider(new GuiNpcSlider(this, 1, guiLeft + 94, y, (int)(resistances.arrow * 100 - 100) + "%", resistances.arrow / 2));
|
||||
getSlider(1).enabled = !resistances.disableDamage;
|
||||
|
||||
addLabel(new GuiNpcLabel(2,"stats.melee", guiLeft + 4, guiTop + 59));
|
||||
addSlider(new GuiNpcSlider(this, 2, guiLeft + 94, guiTop + 54, (int)(resistances.playermelee * 100 - 100) + "%", resistances.playermelee / 2));
|
||||
y += 22;
|
||||
|
||||
addLabel(new GuiNpcLabel(2,"stats.melee", guiLeft + 4, y + 5));
|
||||
addSlider(new GuiNpcSlider(this, 2, guiLeft + 94, y, (int)(resistances.playermelee * 100 - 100) + "%", resistances.playermelee / 2));
|
||||
getSlider(2).enabled = !resistances.disableDamage;
|
||||
|
||||
addLabel(new GuiNpcLabel(3,"stats.explosion", guiLeft + 4, guiTop + 81));
|
||||
addSlider(new GuiNpcSlider(this, 3, guiLeft + 94, guiTop + 76, (int)(resistances.explosion * 100 - 100) + "%", resistances.explosion / 2));
|
||||
y += 22;
|
||||
|
||||
addLabel(new GuiNpcLabel(3,"stats.explosion", guiLeft + 4, y + 5));
|
||||
addSlider(new GuiNpcSlider(this, 3, guiLeft + 94, y, (int)(resistances.explosion * 100 - 100) + "%", resistances.explosion / 2));
|
||||
getSlider(3).enabled = !resistances.disableDamage;
|
||||
|
||||
addLabel(new GuiNpcLabel(21,"stats.disabledamage", guiLeft + 4, guiTop + 104));
|
||||
this.addButton(new GuiNpcButton(21, guiLeft + 94, guiTop + 99, 56, 20, new String[]{"gui.no","gui.yes"}, this.resistances.disableDamage? 1:0));
|
||||
y += 22;
|
||||
|
||||
addLabel(new GuiNpcLabel(21,"stats.disabledamage", guiLeft + 4, y + 5));
|
||||
this.addButton(new GuiNpcButton(21, guiLeft + 94, y, 56, 20, new String[]{"gui.no","gui.yes"}, this.resistances.disableDamage? 1:0));
|
||||
|
||||
addButton(new GuiNpcButton(66, guiLeft + 190, guiTop + 190, 60, 20, "gui.done"));
|
||||
}
|
||||
|
||||
@@ -565,11 +565,13 @@ public abstract class EntityNPCInterface extends EntityCreature implements IEnti
|
||||
} else if (attackingEntity instanceof EntityPlayer && faction.isFriendlyToPlayer((EntityPlayer) attackingEntity))
|
||||
return false;
|
||||
|
||||
// Magic / Attribute Damage
|
||||
if(attackingEntity instanceof EntityPlayer)
|
||||
i = AttributeAttackUtil.calculateDamagePlayerToNPC((EntityPlayer) attackingEntity, this, i);
|
||||
// Attribute + Resistances
|
||||
if(!DBCAddon.IsAvailable()){
|
||||
if(attackingEntity instanceof EntityPlayer)
|
||||
i = AttributeAttackUtil.calculateDamagePlayerToNPC((EntityPlayer) attackingEntity, this, i);
|
||||
|
||||
i = stats.resistances.applyResistance(damagesource, i);
|
||||
i = stats.resistances.applyResistance(damagesource, i);
|
||||
}
|
||||
|
||||
NpcEvent.DamagedEvent event = new NpcEvent.DamagedEvent(this.wrappedNPC, attackingEntity, i, damagesource);
|
||||
if (EventHooks.onNPCDamaged(this, event) || isKilled())
|
||||
|
||||
Reference in new issue
Block a user