mirror of
https://github.com/KAMKEEL/CustomNPC-Plus.git
synced 2026-11-22 15:29:54 +00:00
More Core Class Conversion
This commit is contained in:
1 parent
43a52ad407
commit
89f81f96bc
51 files changed
+744
-189
No files matched your search
@@ -1,130 +0,0 @@
|
||||
package noppes.npcs.controllers.data;
|
||||
|
||||
import net.minecraft.nbt.NBTTagCompound;
|
||||
import net.minecraft.util.EnumChatFormatting;
|
||||
import noppes.npcs.constants.EnumAuctionSort;
|
||||
|
||||
/**
|
||||
* Filter for auction listings.
|
||||
* Supports search by item name or seller name and sorting options.
|
||||
*/
|
||||
public class AuctionFilter {
|
||||
private String searchText;
|
||||
public EnumAuctionSort sortBy;
|
||||
|
||||
// Cached normalized search for efficiency
|
||||
private String normalizedSearch;
|
||||
|
||||
public AuctionFilter() {
|
||||
this.searchText = "";
|
||||
this.sortBy = EnumAuctionSort.NEWEST;
|
||||
this.normalizedSearch = "";
|
||||
}
|
||||
|
||||
public boolean hasSearchText() {
|
||||
return searchText != null && !searchText.trim().isEmpty();
|
||||
}
|
||||
|
||||
/**
|
||||
* Normalize string for search (strip colors, lowercase, trim)
|
||||
*/
|
||||
public static String normalizeForSearch(String input) {
|
||||
if (input == null || input.isEmpty()) return "";
|
||||
String stripped = EnumChatFormatting.getTextWithoutFormattingCodes(input);
|
||||
return stripped != null ? stripped.toLowerCase().trim() : input.toLowerCase().trim();
|
||||
}
|
||||
|
||||
/**
|
||||
* Check if item name or seller name matches search text
|
||||
*/
|
||||
public boolean matchesSearch(String itemName, String sellerName) {
|
||||
if (!hasSearchText()) return true;
|
||||
String normalizedItem = normalizeForSearch(itemName);
|
||||
String normalizedSeller = normalizeForSearch(sellerName);
|
||||
// Match if search text is found in either item name or seller name
|
||||
return normalizedItem.contains(normalizedSearch) || normalizedSeller.contains(normalizedSearch);
|
||||
}
|
||||
|
||||
/**
|
||||
* Legacy method - only checks item name
|
||||
*/
|
||||
public boolean matchesSearch(String itemName) {
|
||||
return matchesSearch(itemName, "");
|
||||
}
|
||||
|
||||
/**
|
||||
* Advanced search - all words must be present in item name OR seller name
|
||||
*/
|
||||
public boolean matchesSearchAdvanced(String itemName, String sellerName) {
|
||||
if (!hasSearchText()) return true;
|
||||
String normalizedItem = normalizeForSearch(itemName);
|
||||
String normalizedSeller = normalizeForSearch(sellerName);
|
||||
String[] words = normalizedSearch.split("\\s+");
|
||||
for (String word : words) {
|
||||
if (!word.isEmpty()) {
|
||||
// Word must be in item name OR seller name
|
||||
if (!normalizedItem.contains(word) && !normalizedSeller.contains(word)) {
|
||||
return false;
|
||||
}
|
||||
}
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
||||
/**
|
||||
* Legacy method - only checks item name
|
||||
*/
|
||||
public boolean matchesSearchAdvanced(String itemName) {
|
||||
return matchesSearchAdvanced(itemName, "");
|
||||
}
|
||||
|
||||
public void reset() {
|
||||
searchText = "";
|
||||
sortBy = EnumAuctionSort.NEWEST;
|
||||
normalizedSearch = "";
|
||||
}
|
||||
|
||||
public NBTTagCompound writeToNBT(NBTTagCompound compound) {
|
||||
compound.setString("SearchText", searchText != null ? searchText : "");
|
||||
compound.setInteger("SortBy", sortBy.ordinal());
|
||||
return compound;
|
||||
}
|
||||
|
||||
public void readFromNBT(NBTTagCompound compound) {
|
||||
searchText = compound.getString("SearchText");
|
||||
normalizedSearch = normalizeForSearch(searchText);
|
||||
sortBy = EnumAuctionSort.fromOrdinal(compound.getInteger("SortBy"));
|
||||
}
|
||||
|
||||
public static AuctionFilter fromNBT(NBTTagCompound compound) {
|
||||
AuctionFilter filter = new AuctionFilter();
|
||||
filter.readFromNBT(compound);
|
||||
return filter;
|
||||
}
|
||||
|
||||
public AuctionFilter copy() {
|
||||
AuctionFilter copy = new AuctionFilter();
|
||||
copy.searchText = this.searchText;
|
||||
copy.normalizedSearch = this.normalizedSearch;
|
||||
copy.sortBy = this.sortBy;
|
||||
return copy;
|
||||
}
|
||||
|
||||
// Getters and setters
|
||||
public String getSearchText() {
|
||||
return searchText;
|
||||
}
|
||||
|
||||
public void setSearchText(String searchText) {
|
||||
this.searchText = searchText;
|
||||
this.normalizedSearch = normalizeForSearch(searchText);
|
||||
}
|
||||
|
||||
public EnumAuctionSort getSortBy() {
|
||||
return sortBy;
|
||||
}
|
||||
|
||||
public void setSortBy(EnumAuctionSort sortBy) {
|
||||
this.sortBy = sortBy;
|
||||
}
|
||||
}
|
||||
@@ -1,63 +0,0 @@
|
||||
package noppes.npcs.controllers.data;
|
||||
|
||||
import net.minecraft.nbt.NBTTagCompound;
|
||||
import noppes.npcs.api.entity.data.IHitboxData;
|
||||
import noppes.npcs.config.ConfigMain;
|
||||
|
||||
public class HitboxData implements IHitboxData {
|
||||
|
||||
private float widthScale = 1f;
|
||||
private float heightScale = 1f;
|
||||
private boolean hitboxEnabled = false;
|
||||
|
||||
public NBTTagCompound writeToNBT(NBTTagCompound nbttagcompound) {
|
||||
nbttagcompound.setBoolean("HitboxEnabled", hitboxEnabled);
|
||||
if (hitboxEnabled) {
|
||||
if (widthScale > ConfigMain.HitBoxScaleMax)
|
||||
widthScale = ConfigMain.HitBoxScaleMax;
|
||||
nbttagcompound.setFloat("HitboxWidthScale", widthScale);
|
||||
|
||||
if (heightScale > ConfigMain.HitBoxScaleMax)
|
||||
heightScale = ConfigMain.HitBoxScaleMax;
|
||||
nbttagcompound.setFloat("HitboxHeightScale", heightScale);
|
||||
}
|
||||
return nbttagcompound;
|
||||
}
|
||||
|
||||
public void readFromNBT(NBTTagCompound nbttagcompound) {
|
||||
hitboxEnabled = nbttagcompound.getBoolean("HitboxEnabled");
|
||||
if (hitboxEnabled) {
|
||||
widthScale = nbttagcompound.getFloat("HitboxWidthScale");
|
||||
if (widthScale > ConfigMain.HitBoxScaleMax)
|
||||
widthScale = ConfigMain.HitBoxScaleMax;
|
||||
|
||||
heightScale = nbttagcompound.getFloat("HitboxHeightScale");
|
||||
if (heightScale > ConfigMain.HitBoxScaleMax)
|
||||
heightScale = ConfigMain.HitBoxScaleMax;
|
||||
}
|
||||
}
|
||||
|
||||
public float getWidthScale() {
|
||||
return widthScale;
|
||||
}
|
||||
|
||||
public void setWidthScale(float widthScale) {
|
||||
this.widthScale = widthScale;
|
||||
}
|
||||
|
||||
public float getHeightScale() {
|
||||
return heightScale;
|
||||
}
|
||||
|
||||
public void setHeightScale(float heightScale) {
|
||||
this.heightScale = heightScale;
|
||||
}
|
||||
|
||||
public boolean isHitboxEnabled() {
|
||||
return hitboxEnabled;
|
||||
}
|
||||
|
||||
public void setHitboxEnabled(boolean hitboxEnabled) {
|
||||
this.hitboxEnabled = hitboxEnabled;
|
||||
}
|
||||
}
|
||||
@@ -1,74 +0,0 @@
|
||||
package noppes.npcs.controllers.data;
|
||||
|
||||
import net.minecraft.entity.EntityLivingBase;
|
||||
import net.minecraft.entity.player.EntityPlayer;
|
||||
import noppes.npcs.api.entity.IEntityLivingBase;
|
||||
import noppes.npcs.api.handler.data.ILine;
|
||||
|
||||
|
||||
public class Line implements ILine {
|
||||
|
||||
public Line() {
|
||||
|
||||
}
|
||||
|
||||
public Line(String text) {
|
||||
this.text = text;
|
||||
}
|
||||
|
||||
public String text = "";
|
||||
public String sound = "";
|
||||
public boolean hideText = false;
|
||||
|
||||
public ILine copy() {
|
||||
Line line = new Line(text);
|
||||
line.sound = sound;
|
||||
line.hideText = hideText;
|
||||
return line;
|
||||
}
|
||||
|
||||
public ILine formatTarget(EntityLivingBase entity) {
|
||||
if (entity == null)
|
||||
return this;
|
||||
Line line = (Line) copy();
|
||||
if (entity instanceof EntityPlayer)
|
||||
line.text = line.text.replace("@target", ((EntityPlayer) entity).getDisplayName());
|
||||
else
|
||||
line.text = line.text.replace("@target", entity.getCommandSenderName());
|
||||
return line;
|
||||
}
|
||||
|
||||
public ILine formatTarget(IEntityLivingBase entityLivingBase) {
|
||||
return this.formatTarget(entityLivingBase.getMCEntity());
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getText() {
|
||||
return this.text;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void setText(String text) {
|
||||
this.text = text;
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getSound() {
|
||||
return this.sound;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void setSound(String sound) {
|
||||
this.sound = sound;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void hideText(boolean hide) {
|
||||
this.hideText = hide;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean hideText() {
|
||||
return this.hideText;
|
||||
}
|
||||
}
|
||||
@@ -1,96 +0,0 @@
|
||||
package noppes.npcs.controllers.data;
|
||||
|
||||
import net.minecraft.nbt.NBTTagCompound;
|
||||
import net.minecraft.nbt.NBTTagList;
|
||||
import noppes.npcs.api.handler.data.ILine;
|
||||
import noppes.npcs.api.handler.data.ILines;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.HashMap;
|
||||
import java.util.List;
|
||||
import java.util.Random;
|
||||
|
||||
public class Lines implements ILines {
|
||||
private static final Random random = new Random();
|
||||
private int lastLine = -1;
|
||||
|
||||
public HashMap<Integer, Line> lines = new HashMap<Integer, Line>();
|
||||
|
||||
public NBTTagCompound writeToNBT() {
|
||||
NBTTagCompound compound = new NBTTagCompound();
|
||||
|
||||
NBTTagList nbttaglist = new NBTTagList();
|
||||
for (int slot : lines.keySet()) {
|
||||
Line line = lines.get(slot);
|
||||
NBTTagCompound nbttagcompound = new NBTTagCompound();
|
||||
nbttagcompound.setInteger("Slot", slot);
|
||||
nbttagcompound.setString("Line", line.text);
|
||||
nbttagcompound.setString("Song", line.sound);
|
||||
|
||||
nbttaglist.appendTag(nbttagcompound);
|
||||
}
|
||||
|
||||
compound.setTag("Lines", nbttaglist);
|
||||
return compound;
|
||||
}
|
||||
|
||||
public void readNBT(NBTTagCompound compound) {
|
||||
NBTTagList nbttaglist = compound.getTagList("Lines", 10);
|
||||
|
||||
HashMap<Integer, Line> map = new HashMap<Integer, Line>();
|
||||
for (int i = 0; i < nbttaglist.tagCount(); i++) {
|
||||
NBTTagCompound nbttagcompound = nbttaglist.getCompoundTagAt(i);
|
||||
Line line = new Line();
|
||||
line.text = nbttagcompound.getString("Line");
|
||||
line.sound = nbttagcompound.getString("Song");
|
||||
|
||||
map.put(nbttagcompound.getInteger("Slot"), line);
|
||||
}
|
||||
lines = map;
|
||||
}
|
||||
|
||||
public ILine createLine(String text) {
|
||||
return new Line(text);
|
||||
}
|
||||
|
||||
public ILine getLine(boolean isRandom) {
|
||||
if (lines.isEmpty())
|
||||
return null;
|
||||
if (isRandom) {
|
||||
List<Line> lines = new ArrayList<Line>(this.lines.values());
|
||||
return lines.get(random.nextInt(lines.size()));
|
||||
}
|
||||
lastLine++;
|
||||
while (true) {
|
||||
lastLine %= 8;
|
||||
Line line = lines.get(lastLine);
|
||||
if (line != null)
|
||||
return line.copy();
|
||||
lastLine++;
|
||||
}
|
||||
}
|
||||
|
||||
public ILine getLine(int lineIndex) {
|
||||
return lines.get(lineIndex);
|
||||
}
|
||||
|
||||
public void setLine(int lineIndex, ILine line) {
|
||||
lines.put(lineIndex, (Line) line);
|
||||
}
|
||||
|
||||
public void removeLine(int lineIndex) {
|
||||
lines.remove(lineIndex);
|
||||
}
|
||||
|
||||
public void clear() {
|
||||
lines.clear();
|
||||
}
|
||||
|
||||
public boolean isEmpty() {
|
||||
return lines.isEmpty();
|
||||
}
|
||||
|
||||
public Integer[] getKeys() {
|
||||
return lines.keySet().toArray(new Integer[0]);
|
||||
}
|
||||
}
|
||||
@@ -1,245 +0,0 @@
|
||||
package noppes.npcs.controllers.data;
|
||||
|
||||
import net.minecraft.nbt.NBTTagCompound;
|
||||
import noppes.npcs.api.handler.data.IPartyOptions;
|
||||
import noppes.npcs.config.ConfigMain;
|
||||
import noppes.npcs.constants.EnumPartyExchange;
|
||||
import noppes.npcs.constants.EnumPartyObjectives;
|
||||
import noppes.npcs.constants.EnumPartyRequirements;
|
||||
|
||||
import java.util.Vector;
|
||||
|
||||
public class PartyOptions implements IPartyOptions {
|
||||
public boolean allowParty = false;
|
||||
public boolean onlyParty = false;
|
||||
|
||||
public EnumPartyRequirements partyRequirements = EnumPartyRequirements.Leader;
|
||||
|
||||
public EnumPartyExchange rewardControl = EnumPartyExchange.Leader;
|
||||
public EnumPartyExchange completeFor = EnumPartyExchange.Leader;
|
||||
public EnumPartyExchange executeCommand = EnumPartyExchange.Leader;
|
||||
|
||||
public EnumPartyObjectives objectiveRequirement = EnumPartyObjectives.Shared;
|
||||
|
||||
public int minPartySize = ConfigMain.DefaultMinPartySize;
|
||||
public int maxPartySize = ConfigMain.DefaultMaxPartySize;
|
||||
|
||||
public void readFromNBT(NBTTagCompound compound) {
|
||||
// Party Management
|
||||
allowParty = compound.getBoolean("AllowParty");
|
||||
if (allowParty) {
|
||||
onlyParty = compound.getBoolean("OnlyParty");
|
||||
partyRequirements = EnumPartyRequirements.values()[compound.getInteger("PartyRequirements")];
|
||||
rewardControl = EnumPartyExchange.values()[compound.getInteger("RewardControl")];
|
||||
completeFor = EnumPartyExchange.values()[compound.getInteger("CompleteFor")];
|
||||
executeCommand = EnumPartyExchange.values()[compound.getInteger("ExecuteCommand")];
|
||||
minPartySize = compound.getInteger("MinPartySize");
|
||||
maxPartySize = compound.getInteger("MaxPartySize");
|
||||
objectiveRequirement = EnumPartyObjectives.values()[compound.getInteger("ObjectiveRequirement")];
|
||||
} else {
|
||||
if (compound.hasKey("OnlyParty")) {
|
||||
compound.removeTag("OnlyParty");
|
||||
}
|
||||
if (compound.hasKey("PartyRequirements")) {
|
||||
compound.removeTag("PartyRequirements");
|
||||
}
|
||||
if (compound.hasKey("RewardControl")) {
|
||||
compound.removeTag("RewardControl");
|
||||
}
|
||||
if (compound.hasKey("CompleteFor")) {
|
||||
compound.removeTag("CompleteFor");
|
||||
}
|
||||
if (compound.hasKey("ExecuteCommand")) {
|
||||
compound.removeTag("ExecuteCommand");
|
||||
}
|
||||
if (compound.hasKey("MinPartySize")) {
|
||||
compound.removeTag("MinPartySize");
|
||||
}
|
||||
if (compound.hasKey("MaxPartySize")) {
|
||||
compound.removeTag("MaxPartySize");
|
||||
}
|
||||
if (compound.hasKey("ObjectiveRequirement")) {
|
||||
compound.removeTag("ObjectiveRequirement");
|
||||
}
|
||||
|
||||
onlyParty = false;
|
||||
partyRequirements = EnumPartyRequirements.Leader;
|
||||
rewardControl = EnumPartyExchange.Leader;
|
||||
completeFor = EnumPartyExchange.Leader;
|
||||
executeCommand = EnumPartyExchange.Leader;
|
||||
minPartySize = ConfigMain.DefaultMinPartySize;
|
||||
maxPartySize = ConfigMain.DefaultMaxPartySize;
|
||||
objectiveRequirement = EnumPartyObjectives.Shared;
|
||||
}
|
||||
}
|
||||
|
||||
public NBTTagCompound writeToNBT() {
|
||||
NBTTagCompound compound = new NBTTagCompound();
|
||||
compound.setBoolean("AllowParty", allowParty);
|
||||
if (allowParty) {
|
||||
compound.setBoolean("OnlyParty", onlyParty);
|
||||
compound.setInteger("PartyRequirements", partyRequirements.ordinal());
|
||||
compound.setInteger("RewardControl", rewardControl.ordinal());
|
||||
compound.setInteger("CompleteFor", completeFor.ordinal());
|
||||
compound.setInteger("ExecuteCommand", executeCommand.ordinal());
|
||||
compound.setInteger("MinPartySize", minPartySize);
|
||||
compound.setInteger("MaxPartySize", maxPartySize);
|
||||
compound.setInteger("ObjectiveRequirement", objectiveRequirement.ordinal());
|
||||
} else {
|
||||
if (compound.hasKey("OnlyParty")) {
|
||||
compound.removeTag("OnlyParty");
|
||||
}
|
||||
if (compound.hasKey("PartyRequirements")) {
|
||||
compound.removeTag("PartyRequirements");
|
||||
}
|
||||
if (compound.hasKey("RewardControl")) {
|
||||
compound.removeTag("RewardControl");
|
||||
}
|
||||
if (compound.hasKey("CompleteFor")) {
|
||||
compound.removeTag("CompleteFor");
|
||||
}
|
||||
if (compound.hasKey("ExecuteCommand")) {
|
||||
compound.removeTag("ExecuteCommand");
|
||||
}
|
||||
if (compound.hasKey("MinPartySize")) {
|
||||
compound.removeTag("MinPartySize");
|
||||
}
|
||||
if (compound.hasKey("MaxPartySize")) {
|
||||
compound.removeTag("MaxPartySize");
|
||||
}
|
||||
if (compound.hasKey("ObjectiveRequirement")) {
|
||||
compound.removeTag("ObjectiveRequirement");
|
||||
}
|
||||
}
|
||||
|
||||
return compound;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean isAllowParty() {
|
||||
return allowParty;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void setAllowParty(boolean allowParty) {
|
||||
this.allowParty = allowParty;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean isOnlyParty() {
|
||||
return onlyParty;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void setOnlyParty(boolean onlyParty) {
|
||||
this.onlyParty = onlyParty;
|
||||
}
|
||||
|
||||
@Override
|
||||
public int getPartyRequirements() {
|
||||
return partyRequirements.ordinal();
|
||||
}
|
||||
|
||||
@Override
|
||||
public void setPartyRequirements(int partyReq) {
|
||||
if (partyReq < 0 || partyReq >= EnumPartyRequirements.values().length) {
|
||||
return;
|
||||
}
|
||||
this.partyRequirements = EnumPartyRequirements.values()[partyReq];
|
||||
}
|
||||
|
||||
@Override
|
||||
public int getRewardControl() {
|
||||
return rewardControl.ordinal();
|
||||
}
|
||||
|
||||
@Override
|
||||
public void setRewardControl(int rewardCon) {
|
||||
if (rewardCon < 0 || rewardCon >= EnumPartyExchange.values().length) {
|
||||
return;
|
||||
}
|
||||
this.rewardControl = EnumPartyExchange.values()[rewardCon];
|
||||
}
|
||||
|
||||
@Override
|
||||
public int getCompleteFor() {
|
||||
return completeFor.ordinal();
|
||||
}
|
||||
|
||||
@Override
|
||||
public void setCompleteFor(int compFor) {
|
||||
if (compFor < 0 || compFor >= EnumPartyExchange.values().length) {
|
||||
return;
|
||||
}
|
||||
this.completeFor = EnumPartyExchange.values()[compFor];
|
||||
}
|
||||
|
||||
@Override
|
||||
public int getExecuteCommandFor() {
|
||||
return executeCommand.ordinal();
|
||||
}
|
||||
|
||||
@Override
|
||||
public void setExecuteCommandFor(int commandFor) {
|
||||
if (commandFor < 0 || commandFor >= EnumPartyExchange.values().length) {
|
||||
return;
|
||||
}
|
||||
this.executeCommand = EnumPartyExchange.values()[commandFor];
|
||||
}
|
||||
|
||||
@Override
|
||||
public int getObjectiveRequirement() {
|
||||
return objectiveRequirement.ordinal();
|
||||
}
|
||||
|
||||
@Override
|
||||
public void setObjectiveRequirement(int requirement) {
|
||||
if (requirement < 0 || requirement >= EnumPartyObjectives.values().length) {
|
||||
return;
|
||||
}
|
||||
this.objectiveRequirement = EnumPartyObjectives.values()[requirement];
|
||||
}
|
||||
|
||||
@Override
|
||||
public int getMinPartySize() {
|
||||
return minPartySize;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void setMinPartySize(int newSize) {
|
||||
if (newSize < 1)
|
||||
newSize = 1;
|
||||
|
||||
if (newSize > maxPartySize)
|
||||
newSize = maxPartySize;
|
||||
|
||||
minPartySize = newSize;
|
||||
}
|
||||
|
||||
@Override
|
||||
public int getMaxPartySize() {
|
||||
return maxPartySize;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void setMaxPartySize(int newSize) {
|
||||
if (newSize < minPartySize)
|
||||
newSize = minPartySize;
|
||||
|
||||
maxPartySize = newSize;
|
||||
}
|
||||
|
||||
public Vector<String> getPartyOptionsList() {
|
||||
Vector<String> vec = new Vector<String>();
|
||||
if (onlyParty) {
|
||||
vec.add("party.only" + ":" + "gui.yes");
|
||||
}
|
||||
vec.add("party.partyRequirements" + ":" + partyRequirements.name);
|
||||
vec.add("quest.objectives" + ":" + objectiveRequirement.name);
|
||||
vec.add("party.completeFor" + ":" + completeFor.name);
|
||||
vec.add("quest.reward" + ":" + rewardControl.name);
|
||||
vec.add("party.minPartySize" + ":" + minPartySize);
|
||||
vec.add("party.maxPartySize" + ":" + maxPartySize);
|
||||
return vec;
|
||||
}
|
||||
}
|
||||
@@ -93,7 +93,7 @@ public class Quest implements ICompatibilty, IQuest {
|
||||
questInterface.readEntityFromNBT(compound);
|
||||
|
||||
factionOptions.readFromNBT(compound.getCompoundTag("QuestFactionPoints"));
|
||||
partyOptions.readFromNBT(compound.getCompoundTag("PartyOptions"));
|
||||
partyOptions.readFromNBT(new MC1710NBTCompound(compound.getCompoundTag("PartyOptions")));
|
||||
profileOptions.readFromNBT(new MC1710NBTCompound(compound.getCompoundTag("ProfileOptions")));
|
||||
|
||||
mail.readNBT(compound.getCompoundTag("QuestMail"));
|
||||
@@ -141,7 +141,7 @@ public class Quest implements ICompatibilty, IQuest {
|
||||
|
||||
this.questInterface.writeEntityToNBT(compound);
|
||||
compound.setTag("QuestFactionPoints", factionOptions.writeToNBT(new NBTTagCompound()));
|
||||
compound.setTag("PartyOptions", partyOptions.writeToNBT());
|
||||
compound.setTag("PartyOptions", ((MC1710NBTCompound) partyOptions.writeToNBT()).getMCTag());
|
||||
compound.setTag("ProfileOptions", ((MC1710NBTCompound) profileOptions.writeToNBT()).getMCTag());
|
||||
compound.setTag("QuestMail", mail.writeNBT());
|
||||
|
||||
|
||||
@@ -1,189 +0,0 @@
|
||||
package noppes.npcs.controllers.data;
|
||||
|
||||
import net.minecraft.nbt.NBTTagCompound;
|
||||
import noppes.npcs.api.ISkinOverlay;
|
||||
import noppes.npcs.entity.data.DataSkinOverlays;
|
||||
|
||||
public class SkinOverlay implements ISkinOverlay {
|
||||
public DataSkinOverlays parent;
|
||||
public String texture;
|
||||
|
||||
public boolean glow = true;
|
||||
public boolean blend = true;
|
||||
|
||||
public float alpha = 1.0F;
|
||||
public float size = 1.0F;
|
||||
public int color = 0xFFFFFF;
|
||||
|
||||
public float speedX = 0.0F;
|
||||
public float speedY = 0.0F;
|
||||
|
||||
public float scaleX = 1.0F;
|
||||
public float scaleY = 1.0F;
|
||||
|
||||
public float offsetX = 0.0F;
|
||||
public float offsetY = 0.0F;
|
||||
public float offsetZ = 0.0F;
|
||||
|
||||
//Client-sided
|
||||
public long ticks = 0;
|
||||
|
||||
public SkinOverlay() {
|
||||
}
|
||||
|
||||
public SkinOverlay(String texture) {
|
||||
this.texture = texture;
|
||||
}
|
||||
|
||||
public void setTexture(String texture) {
|
||||
this.texture = texture;
|
||||
this.updateClient();
|
||||
}
|
||||
|
||||
public String getTexture() {
|
||||
return this.texture;
|
||||
}
|
||||
|
||||
public void setGlow(boolean glow) {
|
||||
this.glow = glow;
|
||||
this.updateClient();
|
||||
}
|
||||
|
||||
public boolean getGlow() {
|
||||
return glow;
|
||||
}
|
||||
|
||||
public void setBlend(boolean blend) {
|
||||
this.blend = blend;
|
||||
this.updateClient();
|
||||
}
|
||||
|
||||
public boolean getBlend() {
|
||||
return blend;
|
||||
}
|
||||
|
||||
public void setAlpha(float alpha) {
|
||||
this.alpha = alpha;
|
||||
this.updateClient();
|
||||
}
|
||||
|
||||
public float getAlpha() {
|
||||
return alpha;
|
||||
}
|
||||
|
||||
public void setSize(float size) {
|
||||
this.size = size;
|
||||
this.updateClient();
|
||||
}
|
||||
|
||||
public float getSize() {
|
||||
return size;
|
||||
}
|
||||
|
||||
public void setColor(int color) {
|
||||
this.color = Math.max(0, color);
|
||||
this.updateClient();
|
||||
}
|
||||
|
||||
public int getColor() {
|
||||
return color;
|
||||
}
|
||||
|
||||
public void setTextureScale(float scaleX, float scaleY) {
|
||||
this.scaleX = scaleX;
|
||||
this.scaleY = scaleY;
|
||||
this.updateClient();
|
||||
}
|
||||
|
||||
public float getTextureScaleX() {
|
||||
return scaleX;
|
||||
}
|
||||
|
||||
public float getTextureScaleY() {
|
||||
return scaleY;
|
||||
}
|
||||
|
||||
public void setSpeed(float speedX, float speedY) {
|
||||
this.speedX = speedX;
|
||||
this.speedY = speedY;
|
||||
this.updateClient();
|
||||
}
|
||||
|
||||
public float getSpeedX() {
|
||||
return speedX;
|
||||
}
|
||||
|
||||
public float getSpeedY() {
|
||||
return speedY;
|
||||
}
|
||||
|
||||
public void setOffset(float offsetX, float offsetY, float offsetZ) {
|
||||
this.offsetX = offsetX;
|
||||
this.offsetY = offsetY;
|
||||
this.offsetZ = offsetZ;
|
||||
this.updateClient();
|
||||
}
|
||||
|
||||
public float getOffsetX() {
|
||||
return offsetX;
|
||||
}
|
||||
|
||||
public float getOffsetY() {
|
||||
return offsetY;
|
||||
}
|
||||
|
||||
public float getOffsetZ() {
|
||||
return offsetZ;
|
||||
}
|
||||
|
||||
public void readFromNBT(NBTTagCompound compound) {
|
||||
this.texture = compound.getString("SkinOverlayTexture");
|
||||
this.glow = compound.getBoolean("SkinOverlayGlow");
|
||||
this.blend = compound.getBoolean("SkinOverlayBlend");
|
||||
this.alpha = compound.getFloat("SkinOverlayAlpha");
|
||||
this.size = compound.getFloat("SkinOverlaySize");
|
||||
if(compound.hasKey("SkinOverlayColor")){
|
||||
this.color = compound.getInteger("SkinOverlayColor");
|
||||
} else {
|
||||
this.color = 0xFFFFFF;
|
||||
}
|
||||
this.speedX = compound.getFloat("SkinOverlaySpeedX");
|
||||
this.speedY = compound.getFloat("SkinOverlaySpeedY");
|
||||
this.scaleX = compound.getFloat("SkinOverlayScaleX");
|
||||
this.scaleY = compound.getFloat("SkinOverlayScaleY");
|
||||
this.offsetX = compound.getFloat("SkinOverlayOffsetX");
|
||||
this.offsetY = compound.getFloat("SkinOverlayOffsetY");
|
||||
this.offsetZ = compound.getFloat("SkinOverlayOffsetZ");
|
||||
}
|
||||
|
||||
public NBTTagCompound writeToNBT(NBTTagCompound compound) {
|
||||
compound.setString("SkinOverlayTexture", this.getTexture());
|
||||
compound.setBoolean("SkinOverlayGlow", this.getGlow());
|
||||
compound.setBoolean("SkinOverlayBlend", this.getBlend());
|
||||
compound.setFloat("SkinOverlayAlpha", this.getAlpha());
|
||||
compound.setFloat("SkinOverlaySize", this.getSize());
|
||||
compound.setInteger("SkinOverlayColor", this.getColor());
|
||||
compound.setFloat("SkinOverlaySpeedX", this.getSpeedX());
|
||||
compound.setFloat("SkinOverlaySpeedY", this.getSpeedY());
|
||||
compound.setFloat("SkinOverlayScaleX", this.getTextureScaleX());
|
||||
compound.setFloat("SkinOverlayScaleY", this.getTextureScaleY());
|
||||
compound.setFloat("SkinOverlayOffsetX", this.getOffsetX());
|
||||
compound.setFloat("SkinOverlayOffsetY", this.getOffsetY());
|
||||
compound.setFloat("SkinOverlayOffsetZ", this.getOffsetZ());
|
||||
|
||||
return compound;
|
||||
}
|
||||
|
||||
public static ISkinOverlay overlayFromNBT(NBTTagCompound compound) {
|
||||
SkinOverlay overlay = new SkinOverlay();
|
||||
overlay.readFromNBT(compound);
|
||||
return overlay;
|
||||
}
|
||||
|
||||
private void updateClient() {
|
||||
if (this.parent != null) {
|
||||
this.parent.updateClient();
|
||||
this.parent.save();
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -1,93 +0,0 @@
|
||||
package noppes.npcs.controllers.data;
|
||||
|
||||
import net.minecraft.nbt.NBTTagCompound;
|
||||
import noppes.npcs.api.handler.data.ITag;
|
||||
import noppes.npcs.controllers.TagController;
|
||||
|
||||
import java.util.UUID;
|
||||
|
||||
import static java.util.UUID.randomUUID;
|
||||
|
||||
public class Tag implements ITag {
|
||||
public String name = "";
|
||||
public int color = Integer.parseInt("FF00", 16);
|
||||
public int id = -1;
|
||||
public UUID uuid = randomUUID();
|
||||
public boolean hideTag = false;
|
||||
|
||||
public Tag() {
|
||||
}
|
||||
|
||||
public Tag(int id, String name, int color) {
|
||||
this.name = name;
|
||||
this.color = color;
|
||||
this.id = id;
|
||||
}
|
||||
|
||||
public static String formatName(String name) {
|
||||
name = name.toLowerCase().trim();
|
||||
return name.substring(0, 1).toUpperCase() + name.substring(1);
|
||||
}
|
||||
|
||||
public void readNBT(NBTTagCompound compound) {
|
||||
name = compound.getString("Name");
|
||||
color = compound.getInteger("Color");
|
||||
id = compound.getInteger("Slot");
|
||||
hideTag = compound.getBoolean("HideTag");
|
||||
uuid = UUID.fromString(compound.getString("Uuid"));
|
||||
}
|
||||
|
||||
public void writeNBT(NBTTagCompound compound) {
|
||||
compound.setInteger("Slot", id);
|
||||
compound.setString("Name", name);
|
||||
compound.setInteger("Color", color);
|
||||
compound.setString("Uuid", uuid.toString());
|
||||
compound.setBoolean("HideTag", hideTag);
|
||||
}
|
||||
|
||||
public void readShortNBT(NBTTagCompound compound) {
|
||||
name = compound.getString("Name");
|
||||
uuid = UUID.fromString(compound.getString("Uuid"));
|
||||
}
|
||||
|
||||
public void writeShortNBT(NBTTagCompound compound) {
|
||||
compound.setString("Name", name);
|
||||
compound.setString("Uuid", uuid.toString());
|
||||
}
|
||||
|
||||
public int getId() {
|
||||
return this.id;
|
||||
}
|
||||
|
||||
public String getUuid() {
|
||||
return this.uuid.toString();
|
||||
}
|
||||
|
||||
public String getName() {
|
||||
return this.name;
|
||||
}
|
||||
|
||||
public void setName(String name) {
|
||||
this.name = name;
|
||||
}
|
||||
|
||||
public void setColor(int color) {
|
||||
this.color = color;
|
||||
}
|
||||
|
||||
public int getColor() {
|
||||
return this.color;
|
||||
}
|
||||
|
||||
public boolean getIsHidden() {
|
||||
return this.hideTag;
|
||||
}
|
||||
|
||||
public void setIsHidden(boolean bo) {
|
||||
this.hideTag = bo;
|
||||
}
|
||||
|
||||
public void save() {
|
||||
TagController.getInstance().saveTag(this);
|
||||
}
|
||||
}
|
||||
@@ -1,105 +0,0 @@
|
||||
package noppes.npcs.controllers.data;
|
||||
|
||||
import net.minecraft.nbt.NBTTagCompound;
|
||||
import net.minecraft.nbt.NBTTagList;
|
||||
import noppes.npcs.api.handler.data.ITransportCategory;
|
||||
import noppes.npcs.api.handler.data.ITransportLocation;
|
||||
import noppes.npcs.controllers.TransportController;
|
||||
|
||||
import java.util.HashMap;
|
||||
import java.util.Map;
|
||||
import java.util.Vector;
|
||||
|
||||
public class TransportCategory implements ITransportCategory {
|
||||
public int id = -1;
|
||||
public String title = "";
|
||||
public HashMap<Integer, TransportLocation> locations;
|
||||
|
||||
public TransportCategory() {
|
||||
locations = new HashMap<Integer, TransportLocation>();
|
||||
}
|
||||
|
||||
public Vector<TransportLocation> getDefaultLocations() {
|
||||
Vector<TransportLocation> list = new Vector<TransportLocation>();
|
||||
for (TransportLocation loc : locations.values())
|
||||
if (loc.isDefault())
|
||||
list.add(loc);
|
||||
return list;
|
||||
}
|
||||
|
||||
public void readNBT(NBTTagCompound compound) {
|
||||
id = compound.getInteger("CategoryId");
|
||||
title = compound.getString("CategoryTitle");
|
||||
|
||||
NBTTagList locs = compound.getTagList("CategoryLocations", 10);
|
||||
if (locs == null || locs.tagCount() == 0)
|
||||
return;
|
||||
|
||||
for (int ii = 0; ii < locs.tagCount(); ii++) {
|
||||
TransportLocation location = new TransportLocation();
|
||||
location.readNBT(locs.getCompoundTagAt(ii));
|
||||
location.category = this;
|
||||
locations.put(location.id, location);
|
||||
}
|
||||
}
|
||||
|
||||
public void writeNBT(NBTTagCompound compound) {
|
||||
compound.setInteger("CategoryId", id);
|
||||
compound.setString("CategoryTitle", title);
|
||||
NBTTagList locs = new NBTTagList();
|
||||
for (TransportLocation location : locations.values()) {
|
||||
locs.appendTag(location.writeNBT());
|
||||
}
|
||||
compound.setTag("CategoryLocations", locs);
|
||||
}
|
||||
|
||||
public int getId() {
|
||||
return id;
|
||||
}
|
||||
|
||||
public void setTitle(String title) {
|
||||
this.title = title;
|
||||
}
|
||||
|
||||
public String getTitle() {
|
||||
return title;
|
||||
}
|
||||
|
||||
public void addLocation(String name) {
|
||||
int id = TransportController.getInstance().getUniqueIdLocation();
|
||||
TransportLocation location = new TransportLocation();
|
||||
location.id = id;
|
||||
location.name = name;
|
||||
location.category = this;
|
||||
|
||||
TransportController.getInstance().setLocation(location);
|
||||
}
|
||||
|
||||
public ITransportLocation getLocation(String name) {
|
||||
TransportLocation location = null;
|
||||
for (TransportLocation l : locations.values()) {
|
||||
if (l.getName().equals(name)) {
|
||||
location = l;
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
return location;
|
||||
}
|
||||
|
||||
public void removeLocation(String name) {
|
||||
int id = -1;
|
||||
for (Map.Entry<Integer, TransportLocation> entry : locations.entrySet()) {
|
||||
if (entry.getValue().getName().equals(name)) {
|
||||
id = entry.getKey();
|
||||
;
|
||||
locations.remove(entry.getKey());
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
if (id >= 0) {
|
||||
TransportController.getInstance().removeLocation(id);
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -1,108 +0,0 @@
|
||||
package noppes.npcs.controllers.data;
|
||||
|
||||
import net.minecraft.nbt.NBTTagCompound;
|
||||
import noppes.npcs.api.IPos;
|
||||
import noppes.npcs.api.handler.data.ITransportLocation;
|
||||
import noppes.npcs.controllers.TransportController;
|
||||
import noppes.npcs.scripted.NpcAPI;
|
||||
|
||||
public class TransportLocation implements ITransportLocation {
|
||||
public int id = -1;
|
||||
public String name = "default name";
|
||||
public double posX;
|
||||
public double posY;
|
||||
public double posZ;
|
||||
|
||||
public int type = 0;
|
||||
public int dimension = 0;
|
||||
|
||||
public TransportCategory category;
|
||||
|
||||
public void readNBT(NBTTagCompound compound) {
|
||||
if (compound == null)
|
||||
return;
|
||||
id = compound.getInteger("Id");
|
||||
posX = compound.getDouble("PosX");
|
||||
posY = compound.getDouble("PosY");
|
||||
posZ = compound.getDouble("PosZ");
|
||||
type = compound.getInteger("Type");
|
||||
dimension = compound.getInteger("Dimension");
|
||||
name = compound.getString("Name");
|
||||
}
|
||||
|
||||
public NBTTagCompound writeNBT() {
|
||||
NBTTagCompound compound = new NBTTagCompound();
|
||||
compound.setInteger("Id", id);
|
||||
compound.setDouble("PosX", posX);
|
||||
compound.setDouble("PosY", posY);
|
||||
compound.setDouble("PosZ", posZ);
|
||||
compound.setInteger("Type", type);
|
||||
compound.setInteger("Dimension", dimension);
|
||||
compound.setString("Name", name);
|
||||
return compound;
|
||||
}
|
||||
|
||||
public boolean isDefault() {
|
||||
return type == 1;
|
||||
}
|
||||
|
||||
public int getId() {
|
||||
return id;
|
||||
}
|
||||
|
||||
public void setName(String name) {
|
||||
this.name = name;
|
||||
}
|
||||
|
||||
public String getName() {
|
||||
return name;
|
||||
}
|
||||
|
||||
public void setDimension(int dimension) {
|
||||
this.dimension = dimension;
|
||||
}
|
||||
|
||||
public int getDimension() {
|
||||
return dimension;
|
||||
}
|
||||
|
||||
public void setType(int type) {
|
||||
this.type = type;
|
||||
}
|
||||
|
||||
public int getType() {
|
||||
return type;
|
||||
}
|
||||
|
||||
public void setPosition(int x, int y, int z) {
|
||||
this.posX = x;
|
||||
this.posY = y;
|
||||
this.posZ = z;
|
||||
}
|
||||
|
||||
public void setPosition(IPos pos) {
|
||||
this.posX = pos.getX();
|
||||
this.posY = pos.getY();
|
||||
this.posZ = pos.getZ();
|
||||
}
|
||||
|
||||
public IPos getPos() {
|
||||
return NpcAPI.Instance().getIPos(this.posX, this.posY, this.posZ);
|
||||
}
|
||||
|
||||
public double getX() {
|
||||
return posX;
|
||||
}
|
||||
|
||||
public double getY() {
|
||||
return posY;
|
||||
}
|
||||
|
||||
public double getZ() {
|
||||
return posZ;
|
||||
}
|
||||
|
||||
public void save() {
|
||||
TransportController.getInstance().saveLocation(this.category.id, this);
|
||||
}
|
||||
}
|
||||
Reference in new issue
Block a user