mirror of
https://github.com/KAMKEEL/CustomNPC-Plus.git
synced 2026-11-18 02:15:11 +00:00
Slight Changes
This commit is contained in:
1 parent
8e70e958f3
commit
79fc173e3b
7 files changed
+14
-34
No files matched your search
@@ -405,6 +405,7 @@ public class SyncController {
|
||||
|
||||
CustomEffectController.getInstance().customEffects = CustomEffectController.getInstance().customEffectsSync;
|
||||
CustomEffectController.getInstance().customEffectsSync = new HashMap<>();
|
||||
CustomEffectController.getInstance().registerEffectMap(0, CustomEffectController.getInstance().customEffects);
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -13,6 +13,7 @@ import noppes.npcs.controllers.CustomEffectController;
|
||||
import noppes.npcs.controllers.data.CustomEffect;
|
||||
|
||||
import java.io.IOException;
|
||||
import java.util.HashMap;
|
||||
|
||||
public final class EffectGetPacket extends AbstractPacket {
|
||||
public static final String packetName = "NPC|GetEffect";
|
||||
@@ -48,7 +49,6 @@ public final class EffectGetPacket extends AbstractPacket {
|
||||
CustomEffect Effect = (CustomEffect) CustomEffectController.getInstance().get(effectID);
|
||||
if (Effect != null) {
|
||||
compound = Effect.writeToNBT(false);
|
||||
compound.setString("Type", "ViewEffect");
|
||||
}
|
||||
}
|
||||
GuiDataPacket.sendGuiData((EntityPlayerMP) player, compound);
|
||||
|
||||
@@ -210,6 +210,9 @@ public class CustomNpcs {
|
||||
new LinkedNpcController();
|
||||
new AnimationController();
|
||||
|
||||
// Custom Effects
|
||||
CustomEffectController.getInstance().load();
|
||||
|
||||
// Profile Controller
|
||||
new ProfileController();
|
||||
ProfileController.registerProfileType(new CNPCData());
|
||||
|
||||
@@ -32,7 +32,7 @@ public class GuiMagicMap extends GuiDiagram {
|
||||
for (Magic magic : MagicController.getInstance().magics.values()) {
|
||||
magics.add(magic);
|
||||
}
|
||||
setLayout(DiagramLayout.CHART);
|
||||
setLayout(DiagramLayout.CIRCULAR_MANUAL);
|
||||
this.setCurvedArrows(true);
|
||||
this.setCurveAngle(-20);
|
||||
}
|
||||
|
||||
@@ -42,7 +42,7 @@ public class CustomEffectController implements ICustomEffectHandler {
|
||||
private int lastUsedID = 0;
|
||||
public ConcurrentHashMap<UUID, ConcurrentHashMap<EffectKey, PlayerEffect>> playerEffects = new ConcurrentHashMap<>();
|
||||
|
||||
public CustomEffectController() {}
|
||||
public CustomEffectController(){}
|
||||
|
||||
public static CustomEffectController getInstance() {
|
||||
return Instance;
|
||||
@@ -377,7 +377,7 @@ public class CustomEffectController implements ICustomEffectHandler {
|
||||
Map<EffectKey, PlayerEffect> currentEffects = getPlayerEffects(player);
|
||||
CustomEffect parent = get(id, index);
|
||||
if (parent != null) {
|
||||
PlayerEffect playerEffect = new PlayerEffect(id, duration, level);
|
||||
PlayerEffect playerEffect = new PlayerEffect(id, duration, level, index);
|
||||
playerEffect.index = index;
|
||||
currentEffects.put(new EffectKey(id, index), playerEffect);
|
||||
parent.onAdded(player, playerEffect);
|
||||
@@ -472,7 +472,7 @@ public class CustomEffectController implements ICustomEffectHandler {
|
||||
}
|
||||
}
|
||||
}
|
||||
registerEffectMap(0, customEffects);
|
||||
this.registerEffectMap(0, customEffects);
|
||||
saveEffectLoadMap();
|
||||
}
|
||||
|
||||
|
||||
@@ -12,34 +12,11 @@ public class PlayerEffect implements IPlayerEffect {
|
||||
public byte level;
|
||||
public int index;
|
||||
|
||||
public PlayerEffect(int id, int duration, byte level) {
|
||||
public PlayerEffect(int id, int duration, byte level, int index) {
|
||||
this.id = id;
|
||||
this.duration = duration;
|
||||
this.level = level;
|
||||
}
|
||||
|
||||
public static PlayerEffect readEffectData(NBTTagCompound nbt) {
|
||||
int id = nbt.getInteger("Id");
|
||||
int index = nbt.getInteger("Index");
|
||||
if (id > 0) {
|
||||
CustomEffectController controller = CustomEffectController.getInstance();
|
||||
boolean found = controller.has(id);
|
||||
// StatusEffectController.getInstance().customEffects.containsKey(id);
|
||||
if (found) {
|
||||
byte level = nbt.getByte("Level");
|
||||
int dur = nbt.getInteger("Dur");
|
||||
return new PlayerEffect(id, dur, level);
|
||||
}
|
||||
}
|
||||
return null;
|
||||
}
|
||||
|
||||
public NBTTagCompound writeEffectData(NBTTagCompound nbt) {
|
||||
nbt.setInteger("Id", this.id);
|
||||
nbt.setByte("Level", this.level);
|
||||
nbt.setInteger("Dur", this.duration);
|
||||
nbt.setInteger("Index", this.index);
|
||||
return nbt;
|
||||
this.index = index;
|
||||
}
|
||||
|
||||
@Override
|
||||
@@ -74,7 +51,7 @@ public class PlayerEffect implements IPlayerEffect {
|
||||
|
||||
@Override
|
||||
public String getName() {
|
||||
CustomEffect effect = CustomEffectController.getInstance().get(this.id);
|
||||
CustomEffect effect = CustomEffectController.getInstance().get(this.id, this.index);
|
||||
if(effect != null)
|
||||
return effect.getName();
|
||||
|
||||
@@ -84,7 +61,7 @@ public class PlayerEffect implements IPlayerEffect {
|
||||
@Override
|
||||
public void performEffect(IPlayer player) {
|
||||
if (player != null && player.getMCEntity() != null && player.getMCEntity() instanceof EntityPlayer) {
|
||||
CustomEffect effect = CustomEffectController.getInstance().get(this.id);
|
||||
CustomEffect effect = CustomEffectController.getInstance().get(this.id, this.index);
|
||||
if(effect != null)
|
||||
effect.onTick((EntityPlayer) player.getMCEntity(), this);
|
||||
}
|
||||
|
||||
@@ -46,8 +46,7 @@ public class PlayerEffectData {
|
||||
effect.duration = duration;
|
||||
effect.level = level;
|
||||
} else {
|
||||
effect = new PlayerEffect(id, duration, level);
|
||||
effect.index = index;
|
||||
effect = new PlayerEffect(id, duration, level, index);
|
||||
effects.put(key, effect);
|
||||
}
|
||||
}
|
||||
|
||||
Reference in new issue
Block a user