mirror of
https://github.com/KAMKEEL/CustomNPC-Plus.git
synced 2026-11-20 04:09:57 +00:00
PHASE 0B & 0C: mc1710/src/api → platform-api Merge
PHASE 0D: Complete Existing Core TODOs (mc1710 shadow files) PHASE 0E: Exhaustive file-by-file comparison of all 100 core/ classes against their mc1710 counterparts. ALL COMPLETE!
This commit is contained in:
1 parent
7a656420ca
commit
f58aed7b57
215 files changed
+19066
-73
No files matched your search
@@ -7,7 +7,9 @@ import noppes.npcs.api.INbt;
|
||||
import noppes.npcs.api.INbtList;
|
||||
|
||||
import java.io.File;
|
||||
import java.util.ArrayList;
|
||||
import java.util.HashMap;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
|
||||
public class FactionController {
|
||||
@@ -22,7 +24,6 @@ public class FactionController {
|
||||
// OLD: public List<IFaction> list()
|
||||
// OLD: public IFaction delete(int id) — also calls SyncController.syncRemove(EnumSyncType.FACTION, id)
|
||||
// OLD: public IFaction create(String name, int defaultPoints)
|
||||
|
||||
public FactionController() {
|
||||
instance = this;
|
||||
factions = new HashMap<Integer, Faction>();
|
||||
@@ -133,6 +134,10 @@ public class FactionController {
|
||||
return factions.get(faction);
|
||||
}
|
||||
|
||||
public List<Faction> list() {
|
||||
return new ArrayList<Faction>(this.factions.values());
|
||||
}
|
||||
|
||||
public void saveFaction(Faction faction) {
|
||||
|
||||
if (faction.id < 0) {
|
||||
@@ -178,15 +183,21 @@ public class FactionController {
|
||||
return lastUsedID;
|
||||
}
|
||||
|
||||
public void delete(int id) {
|
||||
public Faction delete(int id) {
|
||||
if (id >= 0 && this.factions.size() > 1) {
|
||||
Faction faction = this.factions.remove(id);
|
||||
if (faction != null) {
|
||||
saveFactions();
|
||||
if (faction == null) {
|
||||
return null;
|
||||
} else {
|
||||
this.saveFactions();
|
||||
faction.id = -1;
|
||||
// TODO: mc1710 version also calls:
|
||||
// OLD: SyncController.syncRemove(EnumSyncType.FACTION, id);
|
||||
return faction;
|
||||
}
|
||||
} else {
|
||||
return null;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -29,7 +29,6 @@ public class MagicController {
|
||||
// OLD: public MagicCycle getCycle(int cycleID) — @Override from IMagicHandler
|
||||
// OLD: public void addMagicToCycle(int magicId, int cycleId, int index, int priority) — @Override
|
||||
// OLD: public void removeMagicFromCycle(int magicId, int cycleId) — @Override
|
||||
|
||||
public MagicController() {
|
||||
instance = this;
|
||||
}
|
||||
@@ -88,7 +87,6 @@ public class MagicController {
|
||||
// OLD: holy.setItem(new ItemStack(CustomItems.spellHoly));
|
||||
// OLD: nature.setItem(new ItemStack(CustomItems.spellNature));
|
||||
// OLD: arcane.setItem(new ItemStack(CustomItems.spellArcane));
|
||||
|
||||
Magic earth = new Magic(getUnusedId(), "Earth", 0x00DD00);
|
||||
Magic water = new Magic(getUnusedId(), "Water", 0xF2DD00);
|
||||
Magic fire = new Magic(getUnusedId(), "Fire", 0xDD0000);
|
||||
@@ -274,7 +272,6 @@ public class MagicController {
|
||||
// OLD: NBTTagCompound magicCompound = new NBTTagCompound();
|
||||
// OLD: mag.writeNBT(magicCompound);
|
||||
// OLD: SyncController.syncUpdate(EnumSyncType.MAGIC, -1, magicCompound);
|
||||
|
||||
saveMagicData();
|
||||
}
|
||||
|
||||
@@ -343,7 +340,6 @@ public class MagicController {
|
||||
// OLD: NBTTagCompound cycleCompound = new NBTTagCompound();
|
||||
// OLD: cycle.writeNBT(new NBTWrapper(cycleCompound));
|
||||
// OLD: SyncController.syncUpdate(EnumSyncType.MAGIC_CYCLE, -1, cycleCompound);
|
||||
|
||||
saveMagicData();
|
||||
}
|
||||
|
||||
|
||||
@@ -7,8 +7,10 @@ import noppes.npcs.api.INbt;
|
||||
import noppes.npcs.api.INbtList;
|
||||
|
||||
import java.io.File;
|
||||
import java.util.ArrayList;
|
||||
import java.util.HashMap;
|
||||
import java.util.HashSet;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
import java.util.UUID;
|
||||
|
||||
@@ -22,7 +24,6 @@ public class TagController {
|
||||
// OLD: public List<ITag> list()
|
||||
// OLD: public ITag delete(int id)
|
||||
// OLD: public static void sendCategoryTagMap(EntityPlayerMP player, HashMap<String, HashSet<UUID>> itemTags) — uses GuiDataPacket
|
||||
|
||||
public TagController() {
|
||||
instance = this;
|
||||
tags = new HashMap<Integer, Tag>();
|
||||
@@ -124,6 +125,10 @@ public class TagController {
|
||||
return tags.get(tagSlot);
|
||||
}
|
||||
|
||||
public List<Tag> list() {
|
||||
return new ArrayList<Tag>(this.tags.values());
|
||||
}
|
||||
|
||||
public void saveTag(Tag tag) {
|
||||
|
||||
if (tag.id < 0) {
|
||||
@@ -164,13 +169,19 @@ public class TagController {
|
||||
return lastUsedID;
|
||||
}
|
||||
|
||||
public void delete(int id) {
|
||||
public Tag delete(int id) {
|
||||
if (id >= 0 && this.tags.size() > 1) {
|
||||
Tag tag = this.tags.remove(id);
|
||||
if (tag != null) {
|
||||
saveTags();
|
||||
if (tag == null) {
|
||||
return null;
|
||||
} else {
|
||||
this.saveTags();
|
||||
tag.id = -1;
|
||||
return tag;
|
||||
}
|
||||
} else {
|
||||
return null;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -8,7 +8,9 @@ import noppes.npcs.api.INbt;
|
||||
import noppes.npcs.api.INbtList;
|
||||
|
||||
import java.io.File;
|
||||
import java.util.ArrayList;
|
||||
import java.util.HashMap;
|
||||
import java.util.Map;
|
||||
|
||||
public class TransportController {
|
||||
private HashMap<Integer, TransportLocation> locations = new HashMap<Integer, TransportLocation>();
|
||||
@@ -23,7 +25,6 @@ public class TransportController {
|
||||
// OLD: public void createCategory(String title)
|
||||
// OLD: public ITransportCategory getCategory(String title)
|
||||
// OLD: public void removeCategory(String title)
|
||||
|
||||
private static TransportController instance;
|
||||
|
||||
public TransportController() {
|
||||
@@ -253,4 +254,30 @@ public class TransportController {
|
||||
|
||||
return location;
|
||||
}
|
||||
|
||||
public TransportCategory[] categories() {
|
||||
return new ArrayList<>(categories.values()).toArray(new TransportCategory[0]);
|
||||
}
|
||||
|
||||
public void createCategory(String title) {
|
||||
this.saveCategory(title, -1);
|
||||
}
|
||||
|
||||
public TransportCategory getCategory(String title) {
|
||||
for (TransportCategory c : categories.values()) {
|
||||
if (c.title.equals(title)) {
|
||||
return c;
|
||||
}
|
||||
}
|
||||
return null;
|
||||
}
|
||||
|
||||
public void removeCategory(String title) {
|
||||
for (Map.Entry<Integer, TransportCategory> entry : categories.entrySet()) {
|
||||
if (entry.getValue().title.equals(title)) {
|
||||
categories.remove(entry.getKey());
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -3,7 +3,13 @@ package noppes.npcs.controllers.data;
|
||||
import noppes.npcs.NBTTags;
|
||||
import noppes.npcs.api.INbt;
|
||||
import noppes.npcs.api.INbtList;
|
||||
import noppes.npcs.api.entity.ICustomNpc;
|
||||
import noppes.npcs.api.entity.IPlayer;
|
||||
import noppes.npcs.api.handler.IPlayerFactionData;
|
||||
import noppes.npcs.api.handler.data.IFaction;
|
||||
import noppes.npcs.controllers.FactionController;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.HashSet;
|
||||
|
||||
public class Faction {
|
||||
@@ -81,7 +87,6 @@ public class Faction {
|
||||
// OLD: public boolean isFriendlyToPlayer(IPlayer player) — delegates to EntityPlayer overload
|
||||
// OLD: public boolean isNeutralToPlayer(IPlayer player) — delegates to EntityPlayer overload
|
||||
// OLD: public boolean isAggressiveToPlayer(IPlayer player) — delegates to EntityPlayer overload
|
||||
|
||||
public int getId() {
|
||||
return this.id;
|
||||
}
|
||||
@@ -126,18 +131,52 @@ public class Faction {
|
||||
return this.color;
|
||||
}
|
||||
|
||||
public int playerStatus(IPlayer player) {
|
||||
IPlayerFactionData data = player.getData().getFactionData();
|
||||
int points = data.getPoints(this.id);
|
||||
if (points >= this.friendlyPoints) {
|
||||
return 1;
|
||||
} else {
|
||||
return points < this.neutralPoints ? -1 : 0;
|
||||
}
|
||||
}
|
||||
|
||||
public boolean isAggressiveToNpc(ICustomNpc npc) {
|
||||
return this.attackFactions.contains(npc.getFaction().getId());
|
||||
}
|
||||
|
||||
public boolean isEnemyFaction(int factionId) {
|
||||
return this.attackFactions.contains(factionId);
|
||||
}
|
||||
|
||||
public boolean isEnemyFaction(IFaction faction) {
|
||||
return this.attackFactions.contains(faction.getId());
|
||||
}
|
||||
|
||||
public Faction[] getEnemyFactions() {
|
||||
ArrayList<Faction> enemyFactions = new ArrayList<>();
|
||||
for (int id : this.attackFactions) {
|
||||
enemyFactions.add(FactionController.getInstance().get(id));
|
||||
}
|
||||
return enemyFactions.toArray(new Faction[]{});
|
||||
}
|
||||
|
||||
public void addEnemyFaction(int factionId) {
|
||||
this.attackFactions.add(factionId);
|
||||
}
|
||||
|
||||
public void addEnemyFaction(IFaction faction) {
|
||||
this.attackFactions.add(faction.getId());
|
||||
}
|
||||
|
||||
public void removeEnemyFaction(int factionId) {
|
||||
this.attackFactions.remove(factionId);
|
||||
}
|
||||
|
||||
public void removeEnemyFaction(IFaction faction) {
|
||||
this.attackFactions.remove(faction.getId());
|
||||
}
|
||||
|
||||
public boolean getIsHidden() {
|
||||
return this.hideFaction;
|
||||
}
|
||||
@@ -161,4 +200,8 @@ public class Faction {
|
||||
public void setAttackedByMobs(boolean bo) {
|
||||
this.getsAttacked = bo;
|
||||
}
|
||||
|
||||
public void save() {
|
||||
FactionController.getInstance().saveFaction(this);
|
||||
}
|
||||
}
|
||||
@@ -17,7 +17,6 @@ public class Magic {
|
||||
|
||||
// TODO: mc1710 version has: public ItemStack item = null;
|
||||
// OLD: import net.minecraft.item.ItemStack;
|
||||
|
||||
public EnumTextureType type = EnumTextureType.BASE;
|
||||
public String iconTexture = "";
|
||||
public Map<Integer, Float> interactions = new HashMap<>();
|
||||
@@ -79,14 +78,12 @@ public class Magic {
|
||||
interactionsList.addCompound(interactionTag);
|
||||
}
|
||||
compound.setTagList("Interactions", interactionsList);
|
||||
|
||||
// TODO: mc1710 version resolves ItemStack from GameRegistry here:
|
||||
// OLD: if (type == EnumTextureType.ITEM && !iconTexture.isEmpty()) {
|
||||
// OLD: Item item = GameRegistry.findItem(parts[0], parts[1]);
|
||||
// OLD: this.item = (item != null) ? new ItemStack(item) : null;
|
||||
// OLD: }
|
||||
}
|
||||
|
||||
// TODO: mc1710 version implements IMagic and adds:
|
||||
// OLD: public void setItem(ItemStack item) — uses GameRegistry.findUniqueIdentifierFor
|
||||
// OLD: public ItemStack getItem()
|
||||
|
||||
@@ -1,5 +1,6 @@
|
||||
package noppes.npcs.controllers.data;
|
||||
|
||||
import noppes.npcs.api.entity.IPlayer;
|
||||
import noppes.npcs.api.handler.data.IPlayerEffect;
|
||||
|
||||
public class PlayerEffect implements IPlayerEffect {
|
||||
@@ -61,7 +62,10 @@ public class PlayerEffect implements IPlayerEffect {
|
||||
* it depends on IPlayer which has MC entity dependencies.
|
||||
* Override in mc1710 to restore original behavior.
|
||||
*/
|
||||
public void performEffect(Object player) {
|
||||
public void performEffect(IPlayer player) {
|
||||
// Base implementation is a no-op. mc1710 shadow overrides to use
|
||||
// CustomEffectController for effect tick logic.
|
||||
|
||||
// TODO: Requires CustomEffectController + IPlayer - implement in mc1710 override
|
||||
// OLD CODE:
|
||||
// if (player != null && player.getMCEntity() != null && player.getMCEntity() instanceof EntityPlayer) {
|
||||
|
||||
Reference in new issue
Block a user