mirror of
https://github.com/KAMKEEL/CustomNPC-Plus.git
synced 2026-11-12 21:17:32 +00:00
Merge branch 'dev' into syntax-highlighter-unified
This commit is contained in:
commit
24532cea79
7 files changed
+44
-6
No files matched your search
@@ -3,6 +3,7 @@ package noppes.npcs.controllers.data;
|
||||
import kamkeel.npcs.network.packets.request.script.EffectScriptPacket;
|
||||
import net.minecraft.nbt.NBTTagCompound;
|
||||
import noppes.npcs.constants.ScriptContext;
|
||||
import noppes.npcs.janino.EventJaninoScript;
|
||||
|
||||
/**
|
||||
* Script handler for CustomEffect scripts.
|
||||
@@ -35,6 +36,11 @@ public class EffectScript extends SingleScriptHandler implements IScriptHandlerP
|
||||
return ScriptContext.EFFECT;
|
||||
}
|
||||
|
||||
@Override
|
||||
public IScriptUnit createJaninoScriptUnit() {
|
||||
return new EventJaninoScript(ScriptContext.EFFECT);
|
||||
}
|
||||
|
||||
@Override
|
||||
public String noticeString() {
|
||||
return effectId >= 0 ? "CustomEffect[" + effectId + "]" : "CustomEffect";
|
||||
|
||||
@@ -3,6 +3,7 @@ package noppes.npcs.controllers.data;
|
||||
import kamkeel.npcs.network.packets.request.script.item.LinkedItemScriptPacket;
|
||||
import net.minecraft.nbt.NBTTagCompound;
|
||||
import noppes.npcs.constants.ScriptContext;
|
||||
import noppes.npcs.janino.EventJaninoScript;
|
||||
|
||||
/**
|
||||
* Script handler for LinkedItem scripts.
|
||||
@@ -35,6 +36,11 @@ public class LinkedItemScript extends SingleScriptHandler implements IScriptHand
|
||||
return ScriptContext.LINKED_ITEM;
|
||||
}
|
||||
|
||||
@Override
|
||||
public IScriptUnit createJaninoScriptUnit() {
|
||||
return new EventJaninoScript(ScriptContext.LINKED_ITEM);
|
||||
}
|
||||
|
||||
@Override
|
||||
public String noticeString() {
|
||||
return "LinkedItem";
|
||||
|
||||
@@ -3,6 +3,7 @@ package noppes.npcs.controllers.data;
|
||||
import kamkeel.npcs.network.packets.request.script.RecipeScriptPacket;
|
||||
import net.minecraft.nbt.NBTTagCompound;
|
||||
import noppes.npcs.constants.ScriptContext;
|
||||
import noppes.npcs.janino.EventJaninoScript;
|
||||
|
||||
/**
|
||||
* Script handler for Recipe scripts (both carpentry and anvil).
|
||||
@@ -42,6 +43,11 @@ public class RecipeScript extends SingleScriptHandler implements IScriptHandlerP
|
||||
return ScriptContext.RECIPE;
|
||||
}
|
||||
|
||||
@Override
|
||||
public IScriptUnit createJaninoScriptUnit() {
|
||||
return new EventJaninoScript(ScriptContext.RECIPE);
|
||||
}
|
||||
|
||||
@Override
|
||||
public String noticeString() {
|
||||
return "RecipeScript";
|
||||
|
||||
@@ -183,6 +183,7 @@ public class SkinOverlay implements ISkinOverlay {
|
||||
private void updateClient() {
|
||||
if (this.parent != null) {
|
||||
this.parent.updateClient();
|
||||
this.parent.save();
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -49,6 +49,12 @@ public class DataSkinOverlays implements IOverlayHandler {
|
||||
return nbttagcompound;
|
||||
}
|
||||
|
||||
public void save() {
|
||||
if (parent instanceof PlayerData) {
|
||||
((PlayerData) parent).save();
|
||||
}
|
||||
}
|
||||
|
||||
public void updateClient() {
|
||||
if (parent != null) {
|
||||
if (parent instanceof PlayerData && ((PlayerData) parent).player != null) {
|
||||
@@ -69,6 +75,7 @@ public class DataSkinOverlays implements IOverlayHandler {
|
||||
((SkinOverlay) data).parent = this;
|
||||
this.overlayList.put(id, data);
|
||||
updateClient();
|
||||
save();
|
||||
}
|
||||
|
||||
public ISkinOverlay get(int id) {
|
||||
@@ -82,6 +89,7 @@ public class DataSkinOverlays implements IOverlayHandler {
|
||||
public boolean remove(int id) {
|
||||
boolean removed = this.overlayList.remove(id) != null;
|
||||
updateClient();
|
||||
save();
|
||||
return removed;
|
||||
}
|
||||
|
||||
@@ -92,5 +100,6 @@ public class DataSkinOverlays implements IOverlayHandler {
|
||||
public void clear() {
|
||||
this.overlayList.clear();
|
||||
updateClient();
|
||||
save();
|
||||
}
|
||||
}
|
||||
@@ -47,6 +47,7 @@ public class JobSpawner extends JobInterface {
|
||||
|
||||
private EntityLivingBase target;
|
||||
|
||||
private boolean isResetting = false;
|
||||
|
||||
public JobSpawner(EntityNPCInterface npc) {
|
||||
super(npc);
|
||||
@@ -314,16 +315,25 @@ public class JobSpawner extends JobInterface {
|
||||
|
||||
@Override
|
||||
public void reset() {
|
||||
number = 0;
|
||||
if (spawned.isEmpty())
|
||||
spawned = getNearbySpawned();
|
||||
if (isResetting)
|
||||
return;
|
||||
isResetting = true;
|
||||
try {
|
||||
number = 0;
|
||||
if (spawned.isEmpty())
|
||||
spawned = getNearbySpawned();
|
||||
|
||||
target = null;
|
||||
checkSpawns();
|
||||
target = null;
|
||||
checkSpawns();
|
||||
} finally {
|
||||
isResetting = false;
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void delete() {
|
||||
if (isResetting)
|
||||
return;
|
||||
if (spawnType == 3 && npc.stats.spawnCycle == 3) {
|
||||
spawnEntity(compound1);
|
||||
spawnEntity(compound2);
|
||||
|
||||
Reference in new issue
Block a user