mirror of
https://github.com/KAMKEEL/CustomNPC-Plus.git
synced 2026-11-17 06:25:11 +00:00
Remove all Legacy Ability Content, cleanup API.
- Add Script Tab to Abilities - Add Custom Ability - Add Icon Support for Abilities / Default Icon Support - Remove Icon Tab and throw it into Effects with allowed Override - Removed Deprecated API Sources
This commit is contained in:
1 parent
936dc7f0cc
commit
675c4ef4f9
50 files changed
+1488
-938
No files matched your search
@@ -17,8 +17,8 @@ import net.minecraft.nbt.NBTTagList;
|
||||
import net.minecraft.util.DamageSource;
|
||||
import noppes.npcs.controllers.data.Animation;
|
||||
import noppes.npcs.entity.EntityNPCInterface;
|
||||
import noppes.npcs.scripted.NpcAPI;
|
||||
import noppes.npcs.scripted.event.AbilityEvent;
|
||||
import noppes.npcs.EventHooks;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
@@ -124,51 +124,6 @@ public class DataAbilities extends AbstractDataAbilities {
|
||||
return npc.worldObj.getTotalWorldTime();
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void fireTickEvent(Ability ability, EntityLivingBase target) {
|
||||
AbilityEvent.TickEvent event = new AbilityEvent.TickEvent(
|
||||
npc.wrappedNPC, ability, target,
|
||||
ability.getPhase().ordinal(), ability.getCurrentTick());
|
||||
NpcAPI.EVENT_BUS.post(event);
|
||||
}
|
||||
|
||||
@Override
|
||||
protected boolean fireExecuteEvent(Ability ability, EntityLivingBase target) {
|
||||
AbilityEvent.ExecuteEvent executeEvent = new AbilityEvent.ExecuteEvent(
|
||||
npc.wrappedNPC, ability, target);
|
||||
return NpcAPI.EVENT_BUS.post(executeEvent);
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void fireCompleteEvent(Ability ability, EntityLivingBase target) {
|
||||
AbilityEvent.CompleteEvent completeEvent = new AbilityEvent.CompleteEvent(
|
||||
npc.wrappedNPC, ability, target);
|
||||
NpcAPI.EVENT_BUS.post(completeEvent);
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void fireInterruptEvent(Ability ability, EntityLivingBase target,
|
||||
DamageSource source, float damage) {
|
||||
AbilityEvent.InterruptEvent interruptEvent = new AbilityEvent.InterruptEvent(
|
||||
npc.wrappedNPC, ability, target, source, damage);
|
||||
NpcAPI.EVENT_BUS.post(interruptEvent);
|
||||
}
|
||||
|
||||
@Override
|
||||
protected boolean fireToggleEvent(Ability ability, int oldState, int newState) {
|
||||
AbilityEvent.ToggleEvent event = new AbilityEvent.ToggleEvent(
|
||||
npc.wrappedNPC, ability, oldState, newState);
|
||||
return NpcAPI.EVENT_BUS.post(event);
|
||||
}
|
||||
|
||||
@Override
|
||||
protected boolean fireToggleUpdateEvent(Ability ability, int tick, int state) {
|
||||
AbilityEvent.ToggleUpdateEvent event = new AbilityEvent.ToggleUpdateEvent(
|
||||
npc.wrappedNPC, ability, tick, state);
|
||||
NpcAPI.EVENT_BUS.post(event);
|
||||
return event.isEnabled();
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void spawnTelegraph(Ability ability, EntityLivingBase target) {
|
||||
List<TelegraphInstance> telegraphs = ability.createTelegraphs(npc, target);
|
||||
@@ -502,10 +457,7 @@ public class DataAbilities extends AbstractDataAbilities {
|
||||
*/
|
||||
private boolean startAbility(Ability ability, EntityLivingBase target) {
|
||||
// Fire start event (cancelable)
|
||||
AbilityEvent.StartEvent startEvent = new AbilityEvent.StartEvent(
|
||||
npc.wrappedNPC, ability, target);
|
||||
if (NpcAPI.EVENT_BUS.post(startEvent)) {
|
||||
// Event was cancelled - don't start the ability
|
||||
if (EventHooks.onAbilityStart(ability, npc, target)) {
|
||||
return false;
|
||||
}
|
||||
|
||||
@@ -705,20 +657,11 @@ public class DataAbilities extends AbstractDataAbilities {
|
||||
* @param ability The ability doing the hit
|
||||
* @param target The original target of the ability
|
||||
* @param hitEntity The entity being hit
|
||||
* @param damage The damage amount
|
||||
* @param knockback The horizontal knockback
|
||||
* @param knockbackUp The vertical knockback
|
||||
* @return The event (with possibly modified values), or null if cancelled
|
||||
* @param event The mutable hit event to fire
|
||||
* @return true if the event was cancelled
|
||||
*/
|
||||
public AbilityEvent.HitEvent fireHitEvent(Ability ability, EntityLivingBase target,
|
||||
EntityLivingBase hitEntity, float damage,
|
||||
float knockback, float knockbackUp) {
|
||||
AbilityEvent.HitEvent event = new AbilityEvent.HitEvent(
|
||||
npc.wrappedNPC, ability, target, hitEntity, damage, knockback, knockbackUp);
|
||||
if (NpcAPI.EVENT_BUS.post(event)) {
|
||||
return null; // Cancelled
|
||||
}
|
||||
return event;
|
||||
public boolean fireHitEvent(Ability ability, AbilityEvent.HitEvent event) {
|
||||
return EventHooks.onAbilityHit(ability, event);
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -1091,7 +1034,7 @@ public class DataAbilities extends AbstractDataAbilities {
|
||||
|
||||
NBTTagList actionList = new NBTTagList();
|
||||
for (AbilityAction slot : actionSlots) {
|
||||
actionList.appendTag(slot.writeNBT());
|
||||
actionList.appendTag(slot.writeNBT(true));
|
||||
}
|
||||
compound.setTag("AbilityActions", actionList);
|
||||
|
||||
@@ -1146,7 +1089,7 @@ public class DataAbilities extends AbstractDataAbilities {
|
||||
}
|
||||
}
|
||||
|
||||
// Active toggles - restore state directly (no onToggleOn callback during load)
|
||||
// Active toggles - restore state directly (no onToggle callback during load)
|
||||
activeToggles.clear();
|
||||
if (compound.hasKey("ActiveToggles")) {
|
||||
NBTTagList toggleNbt = compound.getTagList("ActiveToggles", 10); // 10 = TAG_COMPOUND
|
||||
|
||||
Reference in new issue
Block a user