HUGE CORE COMMIT

This commit is contained in:
Kam committed 2026-03-13 15:18:13 -04:00
1 parent 57e6934fe5
commit 43a52ad407
125 files changed
+1801 -413

No files matched your search

+2
View File
@@ -47,4 +47,6 @@ tmp/
src/test
node_modules
.github/pages-dist
/core/build/
/platform-api/build/
Binary file not shown.
-214
View File
@@ -1,214 +0,0 @@
buildscript {
repositories {
mavenCentral()
maven {
name = "forge"
url = "https://maven.minecraftforge.net/"
}
maven {
name = "sonatype"
url = "https://oss.sonatype.org/content/repositories/snapshots/"
}
maven {
name = "jitpack"
url = "https://jitpack.io"
}
maven {
name = "gt"
url = "https://gregtech.mechaenetia.com/"
}
}
dependencies {
classpath 'com.github.GTNewHorizons:ForgeGradle:1.2.11'
}
}
task submodulesUpdate(type:Exec) {
description 'Updates (and inits) git submodules'
commandLine 'git', 'submodule', 'update', '--init', '--recursive'
group 'Build Setup'
}
configurations {
embed
compile.extendsFrom(embed)
shade
compile.extendsFrom(shade)
}
apply plugin: 'forge'
version = "1.9-beta6"
group= "com.kamkeel.customnpc-plus" // http://maven.apache.org/guides/mini/guide-naming-conventions.html
archivesBaseName = "CustomNPC-Plus"
minecraft {
version = "1.7.10-10.13.4.1614-1.7.10"
runDir = "eclipse"
sourceSets {
api {
java {
srcDir 'src/api/java'
}
}
}
}
sourceCompatibility = 1.8
targetCompatibility = 1.8
dependencies {
// you may put jars on which you depend on in ./libs
// or you may define them like so..
//compile "some.group:artifact:version:classifier"
//compile "some.group:artifact:version"
// real examples
//compile 'com.mod-buildcraft:buildcraft:6.0.8:dev' // adds buildcraft to the dev env
//compile 'com.googlecode.efficient-java-matrix-library:ejml:0.24' // adds ejml to the dev env
// for more info...
// http://www.gradle.org/docs/current/userguide/artifact_dependencies_tutorial.html
// http://www.gradle.org/docs/current/userguide/dependency_management.html
}
processResources
{
// this will ensure that this task is redone when the versions change.
inputs.property "version", project.version
inputs.property "mcversion", project.minecraft.version
// replace stuff in mcmod.info, nothing else
from(sourceSets.main.resources.srcDirs) {
include 'mcmod.info'
// replace version and mcversion
expand 'version':project.version, 'mcversion':project.minecraft.version
}
// copy everything else, thats not the mcmod.info
from(sourceSets.main.resources.srcDirs) {
exclude 'mcmod.info'
}
}
jar {
from sourceSets.api.output
manifest {
attributes(
'FMLAT': "customnpcs_at.cfg",
)
}
}
//##########################################################################################################
//######################################## Mixin Part ################################################
//##########################################################################################################
//Add
//--tweakClass org.spongepowered.asm.launch.MixinTweaker --mixin customnpcs.mixins.json
//to your client and server program arguments if working in a dev environment.
def embedMixin = !project.hasProperty("nomixin");
def yourMixinConfig = 'customnpcs.mixins.json'
def refMapForYourConfig = 'customnpcs.refmap.json'
def relativePathToMixinAP = 'tools/mixin-0.8-SNAPSHOT.jar'
if(!embedMixin){
version += "-nomixin"
}
repositories {
maven {
name = "sponge"
url = "https://repo.spongepowered.org/maven/"
}
}
dependencies {
if(embedMixin){
embed('org.spongepowered:mixin:0.7.11-SNAPSHOT') {
// Mixin includes a lot of dependencies that are too up-to-date
exclude module: 'launchwrapper'
exclude module: 'guava'
exclude module: 'gson'
exclude module: 'commons-io'
exclude module: 'log4j-core'
}
} else {
implementation('org.spongepowered:mixin:0.7.11-SNAPSHOT') {
// Mixin includes a lot of dependencies that are too up-to-date
exclude module: 'launchwrapper'
exclude module: 'guava'
exclude module: 'gson'
exclude module: 'commons-io'
exclude module: 'log4j-core'
}
}
}
def refMap = "${tasks.compileJava.temporaryDir}" + File.separator + refMapForYourConfig
def mixinSrg = "${tasks.reobf.temporaryDir}" + File.separator + "mixins.srg"
jar {
configurations.shade.each { dep ->
from(project.zipTree(dep)){
exclude 'META-INF', 'META-INF/**'
}
}
from refMap
manifest {
attributes.put("TweakClass", "org.spongepowered.asm.launch.MixinTweaker")
attributes.put("FMLCorePluginContainsFMLMod", true)
attributes.put("ForceLoadAsMod", true)
attributes.put("MixinConfigs", yourMixinConfig)
}
// embed libraries in jar
from configurations.embed.collect {
exclude '**/LICENSE.txt'
it.isDirectory() ? it : zipTree(it)
}
}
reobf {
addExtraSrgFile mixinSrg
}
afterEvaluate {
def fixedRelPathToAP = relativePathToMixinAP
if(fixedRelPathToAP.startsWith('./') || fixedRelPathToAP.startsWith('.\\')){
fixedRelPathToAP = fixedRelPathToAP.substring(2)
} else if(fixedRelPathToAP.startsWith('/') || fixedRelPathToAP.startsWith('\\')){
fixedRelPathToAP = fixedRelPathToAP.substring(1)
}
tasks.compileJava {
println "Path: " + projectDir.absolutePath
options.compilerArgs += [
// There's a bug in the AnnotationProcessor for 0.7.11 that will generate the annotations pointing to the parent class instead of subclass
// resulting in the mixin not being applied. This is fixed in 0.8, however 0.8 needs guava > 21.0, and minecraft ships with 17.0.
// So as a hacky workaround... ship with 0.7.11, but use the AP from 0.8 for compiling
"-processorpath", projectDir.absolutePath + '/' + fixedRelPathToAP,
"-processor", "org.spongepowered.tools.obfuscation.MixinObfuscationProcessorInjection,org.spongepowered.tools.obfuscation.MixinObfuscationProcessorTargets",
"-Xlint:-sunapi", "-XDenableSunApiLintControl", "-XDignore.symbol.file",
"-AreobfSrgFile=${tasks.reobf.srg}", "-AoutSrgFile=${mixinSrg}", "-AoutRefMapFile=${refMap}"
]
}
}
task deobfJar(type: Jar) {
classifier = 'dev'
from sourceSets.main.output
}
sourceSets {
main {
ext.refMap = refMapForYourConfig
}
}
// Enable Temporarily if Assets not loading
sourceSets {main { output.resourcesDir = output.classesDir }}
+18
View File
@@ -0,0 +1,18 @@
plugins {
id 'java-library'
}
group = 'noppes.npcs'
version = '1.0'
// Target Java 8 for compatibility with all MC versions (1.7.10 through 1.20.1)
sourceCompatibility = JavaVersion.VERSION_1_8
targetCompatibility = JavaVersion.VERSION_1_8
dependencies {
api project(':platform-api')
}
tasks.withType(JavaCompile).configureEach {
options.encoding = 'UTF-8'
}
@@ -0,0 +1,81 @@
package noppes.npcs.constants;
/**
* Stock reset types for Trader NPCs.
* Mirrors EnumQuestRepeat pattern for consistency.
*/
public enum EnumStockReset {
NONE("stock.reset.never"),
MCDAILY("stock.reset.mcdaily"),
MCWEEKLY("stock.reset.mcweekly"),
MCCUSTOM("stock.reset.mccustom"),
RLDAILY("stock.reset.rldaily"),
RLWEEKLY("stock.reset.rlweekly"),
RLCUSTOM("stock.reset.rlcustom");
private final String langKey;
EnumStockReset(String langKey) {
this.langKey = langKey;
}
/**
* Get the language key for localization.
*/
public String getLangKey() {
return langKey;
}
/**
* Get reset interval in milliseconds for real-time types
* or ticks for MC-time types
*/
public long getDefaultInterval() {
switch (this) {
case MCDAILY:
return 24000; // MC ticks
case MCWEEKLY:
return 168000; // MC ticks (7 days)
case RLDAILY:
return 86400000L; // 24 hours in ms
case RLWEEKLY:
return 604800000L; // 7 days in ms
default:
return 0;
}
}
/**
* Check if this reset type uses real-world time
*/
public boolean isRealTime() {
return this == RLDAILY || this == RLWEEKLY || this == RLCUSTOM;
}
/**
* Check if this reset type uses Minecraft time
*/
public boolean isMinecraftTime() {
return this == MCDAILY || this == MCWEEKLY || this == MCCUSTOM;
}
/**
* Get display name - returns the lang key for platform-specific translation.
*/
public String getDisplayName() {
return langKey;
}
/**
* Get all lang keys for dropdown menus.
* Platform code should translate these via the version-specific localization system.
*/
public static String[] getDisplayNames() {
EnumStockReset[] values = values();
String[] names = new String[values.length];
for (int i = 0; i < values.length; i++) {
names[i] = values[i].langKey;
}
return names;
}
}
@@ -0,0 +1,26 @@
package noppes.npcs.constants;
/**
* NBT type ID constants, matching Minecraft's internal NBT type numbering.
* These are stable across all MC versions.
*
* Use these instead of magic numbers when calling INBTCompound.hasKey(key, type)
* or INBTCompound.getList(key, type).
*/
public final class NBTTypes {
public static final int TAG_END = 0;
public static final int TAG_BYTE = 1;
public static final int TAG_SHORT = 2;
public static final int TAG_INT = 3;
public static final int TAG_LONG = 4;
public static final int TAG_FLOAT = 5;
public static final int TAG_DOUBLE = 6;
public static final int TAG_BYTE_ARRAY = 7;
public static final int TAG_STRING = 8;
public static final int TAG_LIST = 9;
public static final int TAG_COMPOUND = 10;
public static final int TAG_INT_ARRAY = 11;
private NBTTypes() {}
}
@@ -1,6 +1,7 @@
package noppes.npcs.controllers.data;
import net.minecraft.nbt.NBTTagCompound;
import noppes.npcs.platform.nbt.INBTCompound;
import noppes.npcs.core.NBT;
public class AbilityHotbarData {
public static final String CHAIN_PREFIX = "chain:";
@@ -25,15 +26,15 @@ public class AbilityHotbarData {
return abilityKey;
}
public NBTTagCompound writeToNBT(NBTTagCompound compound) {
NBTTagCompound tag = new NBTTagCompound();
public INBTCompound writeToNBT(INBTCompound compound) {
INBTCompound tag = NBT.compound();
tag.setInteger("slot", slot);
tag.setString("abilityKey", abilityKey != null ? abilityKey : "");
compound.setTag("AbilityHotbar" + slot, tag);
compound.setCompound("AbilityHotbar" + slot, tag);
return compound;
}
public void readFromNBT(NBTTagCompound compound) {
public void readFromNBT(INBTCompound compound) {
abilityKey = compound.getString("abilityKey");
}
@@ -1,6 +1,7 @@
package noppes.npcs.controllers.data;
import net.minecraft.nbt.NBTTagCompound;
import noppes.npcs.platform.nbt.INBTCompound;
import noppes.npcs.core.NBT;
/**
* Simple category data class for the generic category system.
@@ -18,12 +19,12 @@ public class Category {
this.title = title;
}
public void readNBT(NBTTagCompound compound) {
public void readNBT(INBTCompound compound) {
id = compound.getInteger("CatID");
title = compound.getString("CatTitle");
}
public NBTTagCompound writeNBT(NBTTagCompound compound) {
public INBTCompound writeNBT(INBTCompound compound) {
compound.setInteger("CatID", id);
compound.setString("CatTitle", title);
return compound;
@@ -1,6 +1,7 @@
package noppes.npcs.controllers.data;
import net.minecraft.nbt.NBTTagCompound;
import noppes.npcs.platform.nbt.INBTCompound;
import noppes.npcs.core.NBT;
public class CloneFolder {
public String name;
@@ -16,12 +17,12 @@ public class CloneFolder {
this.createdDate = System.currentTimeMillis();
}
public void readNBT(NBTTagCompound compound) {
public void readNBT(INBTCompound compound) {
name = compound.getString("Name");
createdDate = compound.getLong("Created");
}
public NBTTagCompound writeNBT(NBTTagCompound compound) {
public INBTCompound writeNBT(INBTCompound compound) {
compound.setString("Name", name);
compound.setLong("Created", createdDate);
return compound;
@@ -1,6 +1,7 @@
package noppes.npcs.controllers.data;
import net.minecraft.nbt.NBTTagCompound;
import noppes.npcs.platform.nbt.INBTCompound;
import noppes.npcs.core.NBT;
public class DialogColorData {
private boolean enableColorSettings = false;
@@ -11,7 +12,7 @@ public class DialogColorData {
private int buttonAcceptColor = 0xfff96605;
private int buttonRejectColor = 0xfff96605;
public NBTTagCompound writeToNBT(NBTTagCompound compound) {
public INBTCompound writeToNBT(INBTCompound compound) {
compound.setBoolean("ColorSettings", enableColorSettings);
if (enableColorSettings) {
compound.setInteger("LineColor1", lineColor1);
@@ -24,7 +25,7 @@ public class DialogColorData {
return compound;
}
public void readFromNBT(NBTTagCompound compound) {
public void readFromNBT(INBTCompound compound) {
this.enableColorSettings = compound.getBoolean("ColorSettings");
if (enableColorSettings) {
lineColor1 = compound.getInteger("LineColor1");
@@ -1,7 +1,7 @@
package noppes.npcs.controllers.data;
import net.minecraft.nbt.NBTTagCompound;
import noppes.npcs.api.handler.data.IDialogImage;
import noppes.npcs.platform.nbt.INBTCompound;
public class DialogImage implements IDialogImage {
public int id;
@@ -29,7 +29,7 @@ public class DialogImage implements IDialogImage {
this.id = id;
}
public NBTTagCompound writeToNBT(NBTTagCompound compound) {
public INBTCompound writeToNBT(INBTCompound compound) {
compound.setInteger("ID", id);
compound.setString("Texture", texture);
compound.setInteger("PosX", x);
@@ -49,7 +49,7 @@ public class DialogImage implements IDialogImage {
return compound;
}
public void readNBT(NBTTagCompound compound) {
public void readNBT(INBTCompound compound) {
id = compound.getInteger("ID");
texture = compound.getString("Texture");
x = compound.getInteger("PosX");
@@ -67,135 +67,109 @@ public class DialogImage implements IDialogImage {
alignment = compound.getInteger("Alignment");
}
@Override
public int getId() {
return id;
}
@Override
public void setTexture(String texture) {
this.texture = texture;
}
@Override
public String getTexture() {
return texture;
}
@Override
public void setPosition(int x, int y) {
this.x = x;
this.y = y;
}
@Override
public int getX() {
return x;
}
@Override
public int getY() {
return y;
}
@Override
public void setWidthHeight(int width, int height) {
this.width = width;
this.height = height;
}
@Override
public int getWidth() {
return width;
}
@Override
public int getHeight() {
return height;
}
@Override
public void setTextureOffset(int offsetX, int offsetY) {
this.textureX = offsetX;
this.textureY = offsetY;
}
@Override
public int getTextureX() {
return textureX;
}
@Override
public int getTextureY() {
return textureY;
}
@Override
public void setColor(int color) {
this.color = color;
}
@Override
public int getColor() {
return color;
}
@Override
public void setSelectedColor(int color) {
this.selectedColor = color;
}
@Override
public int getSelectedColor() {
return selectedColor;
}
@Override
public void setScale(float scale) {
this.scale = scale;
}
@Override
public float getScale() {
return scale;
}
@Override
public void setAlpha(float alpha) {
this.alpha = alpha;
}
@Override
public float getAlpha() {
return alpha;
}
@Override
public void setRotation(float rotation) {
this.rotation = rotation;
}
@Override
public float getRotation() {
return rotation;
}
@Override
public void setImageType(int imageType) {
this.imageType = imageType;
}
@Override
public int getImageType() {
return imageType;
}
@Override
public void setAlignment(int alignment) {
this.alignment = alignment;
}
@Override
public int getAlignment() {
return alignment;
}
@@ -1,6 +1,7 @@
package noppes.npcs.controllers.data;
import net.minecraft.nbt.NBTTagCompound;
import noppes.npcs.platform.nbt.INBTCompound;
import noppes.npcs.core.NBT;
public class ItemDisplayData {
public String texture = "minecraft:textures/items/iron_pickaxe.png";
@@ -17,13 +18,13 @@ public class ItemDisplayData {
public Integer frameCount = 1;
public Integer frametime = 2;
public NBTTagCompound writeToNBT() {
NBTTagCompound compound = new NBTTagCompound();
public INBTCompound writeToNBT() {
INBTCompound compound = NBT.compound();
this.writeToNBT(compound);
return compound;
}
public NBTTagCompound writeToNBT(NBTTagCompound compound) {
public INBTCompound writeToNBT(INBTCompound compound) {
this.setBoolean(compound, "DurabilityShow", this.durabilityShow);
this.setInteger(compound, "DurabilityColor", this.durabilityColor);
this.setInteger(compound, "ItemColor", this.itemColor);
@@ -54,7 +55,7 @@ public class ItemDisplayData {
return compound;
}
public void readFromNBT(NBTTagCompound compound) {
public void readFromNBT(INBTCompound compound) {
if (compound.hasKey("DurabilityShow")) {
this.durabilityShow = compound.getBoolean("DurabilityShow");
}
@@ -118,19 +119,19 @@ public class ItemDisplayData {
}
}
private void setBoolean(NBTTagCompound compound, String key, Boolean value) {
private void setBoolean(INBTCompound compound, String key, Boolean value) {
if (value != null) {
compound.setBoolean(key, value);
}
}
private void setInteger(NBTTagCompound compound, String key, Integer value) {
private void setInteger(INBTCompound compound, String key, Integer value) {
if (value != null) {
compound.setInteger(key, value);
}
}
private void setFloat(NBTTagCompound compound, String key, Float value) {
private void setFloat(INBTCompound compound, String key, Float value) {
if (value != null) {
compound.setFloat(key, value);
}
@@ -1,8 +1,9 @@
package noppes.npcs.controllers.data;
import net.minecraft.nbt.NBTTagCompound;
import net.minecraft.nbt.NBTTagList;
import noppes.npcs.api.handler.data.IMagicCycle;
import noppes.npcs.platform.nbt.INBTCompound;
import noppes.npcs.platform.nbt.INBTList;
import noppes.npcs.core.NBT;
import noppes.npcs.constants.EnumDiagramLayout;
import java.util.HashMap;
@@ -21,15 +22,15 @@ public class MagicCycle implements IMagicCycle {
public MagicCycle() {
}
public void readNBT(NBTTagCompound compound) {
public void readNBT(INBTCompound compound) {
id = compound.getInteger("ID");
name = compound.getString("Name");
displayName = compound.getString("DisplayName");
layout = EnumDiagramLayout.values()[compound.getInteger("Layout")];
associations.clear();
NBTTagList list = compound.getTagList("Associations", 10); // compound tags
for (int i = 0; i < list.tagCount(); i++) {
NBTTagCompound assocTag = list.getCompoundTagAt(i);
INBTList list = compound.getList("Associations", 10); // compound tags
for (int i = 0; i < list.size(); i++) {
INBTCompound assocTag = list.getCompound(i);
MagicAssociation assoc = new MagicAssociation();
assoc.magicId = assocTag.getInteger("MagicID");
assoc.index = assocTag.getInteger("Index");
@@ -38,43 +39,38 @@ public class MagicCycle implements IMagicCycle {
}
}
public void writeNBT(NBTTagCompound compound) {
public void writeNBT(INBTCompound compound) {
compound.setInteger("ID", id);
compound.setString("Name", name);
compound.setString("DisplayName", displayName);
compound.setInteger("Layout", layout.ordinal());
NBTTagList list = new NBTTagList();
INBTList list = NBT.list();
for (MagicAssociation assoc : associations.values()) {
NBTTagCompound assocTag = new NBTTagCompound();
INBTCompound assocTag = NBT.compound();
assocTag.setInteger("MagicID", assoc.magicId);
assocTag.setInteger("Index", assoc.index);
assocTag.setInteger("Priority", assoc.priority);
list.appendTag(assocTag);
list.addCompound(assocTag);
}
compound.setTag("Associations", list);
compound.setList("Associations", list);
}
@Override
public int getId() {
return id;
}
@Override
public String getName() {
return name;
}
@Override
public void setName(String name) {
this.name = name;
}
@Override
public String getDisplayName() {
return displayName;
}
@Override
public void setDisplayName(String displayName) {
this.displayName = displayName;
}
@@ -83,7 +79,6 @@ public class MagicCycle implements IMagicCycle {
return layout;
}
@Override
public int getLayoutType() {
return layout.ordinal();
}
@@ -92,7 +87,6 @@ public class MagicCycle implements IMagicCycle {
this.layout = layout;
}
@Override
public void setLayoutType(int layout) {
if (layout < 0 || layout > EnumDiagramLayout.values().length - 1)
return;
@@ -1,30 +1,31 @@
package noppes.npcs.controllers.data;
import net.minecraft.nbt.NBTTagCompound;
import noppes.npcs.api.handler.data.IMagicData;
import noppes.npcs.platform.nbt.INBTCompound;
import noppes.npcs.core.NBT;
import java.util.HashMap;
public class MagicData implements IMagicData {
private final HashMap<Integer, MagicEntry> magics = new HashMap<>();
public void writeToNBT(NBTTagCompound compound) {
NBTTagCompound magicData = new NBTTagCompound();
public void writeToNBT(INBTCompound compound) {
INBTCompound magicData = NBT.compound();
for (int key : magics.keySet()) {
magicData.setTag(String.valueOf(key), magics.get(key).writeToNBT());
magicData.setCompound(String.valueOf(key), magics.get(key).writeToNBT());
}
compound.setTag("MagicData", magicData);
compound.setCompound("MagicData", magicData);
}
public void readToNBT(NBTTagCompound compound) {
NBTTagCompound magicData = compound.getCompoundTag("MagicData");
public void readToNBT(INBTCompound compound) {
INBTCompound magicData = compound.getCompound("MagicData");
magics.clear();
if (magicData == null)
return;
for (Object key : magicData.func_150296_c()) {
int i = Integer.parseInt((String) key);
for (String key : magicData.getKeySet()) {
int i = Integer.parseInt(key);
MagicEntry entry = new MagicEntry();
entry.readToNBT(magicData.getCompoundTag((String) key));
entry.readToNBT(magicData.getCompound(key));
magics.put(i, entry);
}
}
@@ -33,12 +34,10 @@ public class MagicData implements IMagicData {
return magics.get(id);
}
@Override
public void removeMagic(int id) {
magics.remove(id);
}
@Override
public boolean hasMagic(int id) {
return magics.containsKey(id);
}
@@ -47,17 +46,14 @@ public class MagicData implements IMagicData {
return magics;
}
@Override
public void clear() {
magics.clear();
}
@Override
public boolean isEmpty() {
return magics.isEmpty();
}
@Override
public void addMagic(int id, float damage, float split) {
MagicEntry entry = new MagicEntry();
entry.damage = damage;
@@ -65,13 +61,11 @@ public class MagicData implements IMagicData {
magics.put(id, entry);
}
@Override
public float getMagicDamage(int id) {
MagicEntry entry = magics.get(id);
return entry == null ? 0 : entry.damage;
}
@Override
public float getMagicSplit(int id) {
MagicEntry entry = magics.get(id);
return entry == null ? 0 : entry.split;
@@ -1,19 +1,20 @@
package noppes.npcs.controllers.data;
import net.minecraft.nbt.NBTTagCompound;
import noppes.npcs.platform.nbt.INBTCompound;
import noppes.npcs.core.NBT;
public class MagicEntry {
public float damage;
public float split;
public NBTTagCompound writeToNBT() {
NBTTagCompound compound = new NBTTagCompound();
public INBTCompound writeToNBT() {
INBTCompound compound = NBT.compound();
compound.setFloat("Dmg", damage);
compound.setFloat("Split", split);
return compound;
}
public void readToNBT(NBTTagCompound compound) {
public void readToNBT(INBTCompound compound) {
damage = compound.getFloat("Dmg");
split = compound.getFloat("Split");
}
@@ -1,7 +1,8 @@
package noppes.npcs.controllers.data;
import net.minecraft.nbt.NBTTagCompound;
import noppes.npcs.api.handler.data.IProfileOptions;
import noppes.npcs.platform.nbt.INBTCompound;
import noppes.npcs.core.NBT;
import noppes.npcs.constants.EnumProfileSync;
public class ProfileOptions implements IProfileOptions {
@@ -10,7 +11,7 @@ public class ProfileOptions implements IProfileOptions {
public EnumProfileSync cooldownControl = EnumProfileSync.Individual;
public EnumProfileSync completeControl = EnumProfileSync.Individual;
public void readFromNBT(NBTTagCompound compound) {
public void readFromNBT(INBTCompound compound) {
// Party Management
enableOptions = compound.getBoolean("EnableProfiles");
if (enableOptions) {
@@ -29,8 +30,8 @@ public class ProfileOptions implements IProfileOptions {
}
}
public NBTTagCompound writeToNBT() {
NBTTagCompound compound = new NBTTagCompound();
public INBTCompound writeToNBT() {
INBTCompound compound = NBT.compound();
compound.setBoolean("EnableProfiles", enableOptions);
if (enableOptions) {
compound.setInteger("CooldownControl", cooldownControl.ordinal());
@@ -47,17 +48,14 @@ public class ProfileOptions implements IProfileOptions {
return compound;
}
@Override
public boolean hasProfileOptions() {
return enableOptions;
}
@Override
public void setProfileOptions(boolean enable) {
this.enableOptions = enable;
}
@Override
public void setCooldownControl(int profileType) {
if (profileType < 0 || profileType >= EnumProfileSync.values().length) {
return;
@@ -65,12 +63,10 @@ public class ProfileOptions implements IProfileOptions {
this.cooldownControl = EnumProfileSync.values()[profileType];
}
@Override
public int getCooldownControl() {
return this.cooldownControl.ordinal();
}
@Override
public void setCompleteControl(int profileType) {
if (profileType < 0 || profileType >= EnumProfileSync.values().length) {
return;
@@ -78,7 +74,6 @@ public class ProfileOptions implements IProfileOptions {
this.completeControl = EnumProfileSync.values()[profileType];
}
@Override
public int getCompleteControl() {
return this.completeControl.ordinal();
}
@@ -1,8 +1,8 @@
package noppes.npcs.controllers.data;
import net.minecraft.nbt.NBTTagCompound;
import net.minecraft.nbt.NBTTagList;
import net.minecraft.nbt.NBTTagString;
import noppes.npcs.platform.nbt.INBTCompound;
import noppes.npcs.platform.nbt.INBTList;
import noppes.npcs.core.NBT;
import java.util.ArrayList;
import java.util.Collections;
@@ -28,18 +28,18 @@ public class TagMap {
this.tagMap = new HashMap<String, HashSet<UUID>>();
}
public void readNBT(NBTTagCompound compound) {
public void readNBT(INBTCompound compound) {
this.tagMap = new HashMap<String, HashSet<UUID>>();
NBTTagList list = compound.getTagList("TagMap", 10);
INBTList list = compound.getList("TagMap", 10);
if (list != null) {
for (int i = 0; i < list.tagCount(); i++) {
NBTTagCompound nbttagcompound = list.getCompoundTagAt(i);
for (int i = 0; i < list.size(); i++) {
INBTCompound nbttagcompound = list.getCompound(i);
String cloneName = nbttagcompound.getString("Clone");
HashSet<UUID> uuids = new HashSet<UUID>();
NBTTagList nbtTagList = nbttagcompound.getTagList("TagUUIDs", 8);
for (int j = 0; j < nbtTagList.tagCount(); j++) {
String uuid = nbtTagList.getStringTagAt(j);
INBTList nbtTagList = nbttagcompound.getList("TagUUIDs", 8);
for (int j = 0; j < nbtTagList.size(); j++) {
String uuid = nbtTagList.getString(j);
if (!uuid.isEmpty()) {
uuids.add(UUID.fromString(uuid));
}
@@ -49,23 +49,23 @@ public class TagMap {
}
}
public NBTTagCompound writeNBT() {
NBTTagCompound nbt = new NBTTagCompound();
NBTTagList cloneList = new NBTTagList();
public INBTCompound writeNBT() {
INBTCompound nbt = NBT.compound();
INBTList cloneList = NBT.list();
for (String key : tagMap.keySet()) {
HashSet<UUID> uuidSet = tagMap.get(key);
if (uuidSet.size() > 0) {
NBTTagCompound cloneCompound = new NBTTagCompound();
INBTCompound cloneCompound = NBT.compound();
cloneCompound.setString("Clone", key);
NBTTagList nbtTagList = new NBTTagList();
INBTList nbtTagList = NBT.list();
for (UUID uuid : uuidSet) {
nbtTagList.appendTag(new NBTTagString(uuid.toString()));
nbtTagList.addString(uuid.toString());
}
cloneCompound.setTag("TagUUIDs", nbtTagList);
cloneList.appendTag(cloneCompound);
cloneCompound.setList("TagUUIDs", nbtTagList);
cloneList.addCompound(cloneCompound);
}
}
nbt.setTag("TagMap", cloneList);
nbt.setList("TagMap", cloneList);
return nbt;
}
@@ -1,7 +1,7 @@
package noppes.npcs.controllers.data;
import net.minecraft.nbt.NBTTagCompound;
import noppes.npcs.api.entity.data.ITintData;
import noppes.npcs.platform.nbt.INBTCompound;
public class TintData implements ITintData {
private boolean tintEnabled = false;
@@ -11,7 +11,7 @@ public class TintData implements ITintData {
private int generalTint = 0x000000;
private int generalAlpha = 40;
public NBTTagCompound writeToNBT(NBTTagCompound nbttagcompound) {
public INBTCompound writeToNBT(INBTCompound nbttagcompound) {
nbttagcompound.setBoolean("TintEnabled", tintEnabled);
if (tintEnabled) {
nbttagcompound.setBoolean("HurtTintEnabled", hurtTintEnabled);
@@ -23,7 +23,7 @@ public class TintData implements ITintData {
return nbttagcompound;
}
public void readFromNBT(NBTTagCompound nbttagcompound) {
public void readFromNBT(INBTCompound nbttagcompound) {
tintEnabled = nbttagcompound.getBoolean("TintEnabled");
if (tintEnabled) {
hurtTintEnabled = nbttagcompound.getBoolean("HurtTintEnabled");
@@ -1,7 +1,8 @@
package noppes.npcs.controllers.data;
import net.minecraft.nbt.NBTTagCompound;
import net.minecraft.nbt.NBTTagList;
import noppes.npcs.platform.nbt.INBTCompound;
import noppes.npcs.platform.nbt.INBTList;
import noppes.npcs.core.NBT;
import noppes.npcs.constants.EnumStockReset;
import java.util.HashMap;
@@ -265,7 +266,7 @@ public class TraderStock {
// ==================== NBT Serialization ====================
public NBTTagCompound writeToNBT(NBTTagCompound compound) {
public INBTCompound writeToNBT(INBTCompound compound) {
compound.setBoolean("EnableStock", enableStock);
compound.setBoolean("PerPlayer", perPlayer);
compound.setInteger("ResetType", resetType.ordinal());
@@ -275,19 +276,19 @@ public class TraderStock {
compound.setLong("LastResetTime", lastResetTime);
// Save per-player stock
NBTTagList playerList = new NBTTagList();
INBTList playerList = NBT.list();
for (Map.Entry<String, PlayerTraderStock> entry : playerStock.entrySet()) {
NBTTagCompound playerTag = new NBTTagCompound();
INBTCompound playerTag = NBT.compound();
playerTag.setString("Player", entry.getKey());
entry.getValue().writeToNBT(playerTag);
playerList.appendTag(playerTag);
playerList.addCompound(playerTag);
}
compound.setTag("PlayerStock", playerList);
compound.setList("PlayerStock", playerList);
return compound;
}
public void readFromNBT(NBTTagCompound compound) {
public void readFromNBT(INBTCompound compound) {
enableStock = compound.getBoolean("EnableStock");
perPlayer = compound.getBoolean("PerPlayer");
@@ -312,9 +313,9 @@ public class TraderStock {
// Load per-player stock
playerStock.clear();
NBTTagList playerList = compound.getTagList("PlayerStock", 10);
for (int i = 0; i < playerList.tagCount(); i++) {
NBTTagCompound playerTag = playerList.getCompoundTagAt(i);
INBTList playerList = compound.getList("PlayerStock", 10);
for (int i = 0; i < playerList.size(); i++) {
INBTCompound playerTag = playerList.getCompound(i);
String playerName = playerTag.getString("Player");
PlayerTraderStock pStock = new PlayerTraderStock();
pStock.readFromNBT(playerTag);
@@ -347,11 +348,11 @@ public class TraderStock {
return false;
}
public void writeToNBT(NBTTagCompound compound) {
public void writeToNBT(INBTCompound compound) {
compound.setIntArray("Purchased", purchasedAmounts);
}
public void readFromNBT(NBTTagCompound compound) {
public void readFromNBT(INBTCompound compound) {
int[] loaded = compound.getIntArray("Purchased");
if (loaded != null && loaded.length == 18) {
purchasedAmounts = loaded;
@@ -0,0 +1,28 @@
package noppes.npcs.core;
import noppes.npcs.platform.PlatformServiceHolder;
import noppes.npcs.platform.nbt.INBTCompound;
import noppes.npcs.platform.nbt.INBTList;
/**
* Convenience factory for creating NBT objects in CORE code.
* Shorthand for PlatformServiceHolder.get().nbt().createCompound(), etc.
*/
public final class NBT {
private NBT() {}
/**
* Creates a new, empty NBT compound.
*/
public static INBTCompound compound() {
return PlatformServiceHolder.get().nbt().createCompound();
}
/**
* Creates a new, empty NBT list.
*/
public static INBTList list() {
return PlatformServiceHolder.get().nbt().createList();
}
}
@@ -0,0 +1,12 @@
/**
* CustomNPC+ Core Module.
*
* This package contains version-independent game logic that is shared across
* all Minecraft versions (1.7.10, 1.12, 1.16, 1.20.1).
*
* Rules:
* - NO imports from net.minecraft.*, cpw.mods.*, net.minecraftforge.*, org.spongepowered.*
* - Only java.*, javax.*, noppes.npcs.core.*, noppes.npcs.platform.*, kamkeel.npcs.core.*
* - All MC-specific behavior is accessed through noppes.npcs.platform.PlatformServiceHolder
*/
package noppes.npcs.core;
+4
View File
@@ -35,6 +35,10 @@
*/
def embedMixin = !project.hasProperty("nomixin");
dependencies {
// CNPC+ Core: version-independent game logic (data classes, controllers, constants)
// Transitively includes platform-api (bridge interfaces for NBT, config, etc.)
implementation project(':core')
runtimeOnlyNonPublishable("com.github.GTNewHorizons:NotEnoughItems:2.8.44-GTNH:dev")
if (!project.hasProperty("noNashorn")) {
runtimeOnlyNonPublishable("curse.maven:Nashorn-374413:2924946")
+14
View File
@@ -0,0 +1,14 @@
plugins {
id 'java-library'
}
group = 'noppes.npcs'
version = '1.0'
// Target Java 8 for compatibility with all MC versions (1.7.10 through 1.20.1)
sourceCompatibility = JavaVersion.VERSION_1_8
targetCompatibility = JavaVersion.VERSION_1_8
tasks.withType(JavaCompile).configureEach {
options.encoding = 'UTF-8'
}
@@ -0,0 +1,94 @@
package noppes.npcs.api.entity.data;
/**
* Provides configuration data for an NPC's color tinting effects.
* <p>
* Controls both the hurt tint (flash color when damaged) and a persistent
* general tint overlay applied to the NPC's model.
*/
public interface ITintData {
/**
* Returns whether the tint system is enabled.
*
* @return true if tinting is enabled, false otherwise.
*/
boolean isTintEnabled();
/**
* Sets whether the tint system is enabled.
*
* @param enabled true to enable, false to disable.
*/
void setTintEnabled(boolean enabled);
/**
* Returns whether the hurt tint effect is enabled.
*
* @return true if hurt tint is enabled, false otherwise.
*/
boolean isHurtTintEnabled();
/**
* Sets whether the hurt tint effect is enabled.
*
* @param enabled true to enable, false to disable.
*/
void setHurtTintEnabled(boolean enabled);
/**
* Returns whether the general (persistent) tint is enabled.
*
* @return true if general tint is enabled, false otherwise.
*/
boolean isGeneralTintEnabled();
/**
* Sets whether the general (persistent) tint is enabled.
*
* @param enabled true to enable, false to disable.
*/
void setGeneralTintEnabled(boolean enabled);
/**
* Returns the hurt tint color as an RGB integer (e.g. 0xff0000 for red).
*
* @return the hurt tint color.
*/
int getHurtTint();
/**
* Sets the hurt tint color as an RGB integer.
*
* @param color the hurt tint color (e.g. 0xff0000 for red).
*/
void setHurtTint(int color);
/**
* Returns the general tint color as an RGB integer.
*
* @return the general tint color.
*/
int getGeneralTint();
/**
* Sets the general tint color as an RGB integer.
*
* @param color the general tint color.
*/
void setGeneralTint(int color);
/**
* Returns the alpha (opacity) of the general tint overlay (0-255).
*
* @return the general tint alpha value.
*/
int getGeneralAlpha();
/**
* Sets the alpha (opacity) of the general tint overlay (0-255).
*
* @param alpha the general tint alpha value.
*/
void setGeneralAlpha(int alpha);
}
@@ -0,0 +1,147 @@
package noppes.npcs.api.handler.data;
public interface IDialogImage {
/**
* @return The unique ID of this dialog image
*/
int getId();
/**
* Sets the texture resource location for this image.
* @param texture The resource location string
*/
void setTexture(String texture);
/**
* @return The texture resource location for this image
*/
String getTexture();
/**
* Sets the screen position of this image.
* @param x The X position in pixels
* @param y The Y position in pixels
*/
void setPosition(int x, int y);
/**
* @return The X position of this image in pixels
*/
int getX();
/**
* @return The Y position of this image in pixels
*/
int getY();
/**
* Sets the rendered width and height of this image.
* @param width The width in pixels
* @param height The height in pixels
*/
void setWidthHeight(int width, int height);
/**
* @return The rendered width of this image in pixels
*/
int getWidth();
/**
* @return The rendered height of this image in pixels
*/
int getHeight();
/**
* Sets the texture UV offset for this image.
* @param offsetX The horizontal texture offset in pixels
* @param offsetY The vertical texture offset in pixels
*/
void setTextureOffset(int offsetX, int offsetY);
/**
* @return The horizontal texture UV offset in pixels
*/
int getTextureX();
/**
* @return The vertical texture UV offset in pixels
*/
int getTextureY();
/**
* Sets the tint color of this image.
* @param color The color as an integer (e.g. 0xFFFFFF)
*/
void setColor(int color);
/**
* @return The tint color of this image
*/
int getColor();
/**
* Sets the tint color used when this image is selected/hovered.
* @param color The selected color as an integer (e.g. 0xFFFFFF)
*/
void setSelectedColor(int color);
/**
* @return The tint color used when this image is selected/hovered
*/
int getSelectedColor();
/**
* Sets the render scale of this image.
* @param scale The scale factor (default 1.0)
*/
void setScale(float scale);
/**
* @return The render scale of this image
*/
float getScale();
/**
* Sets the alpha transparency of this image.
* @param alpha The alpha value from 0.0 (transparent) to 1.0 (opaque)
*/
void setAlpha(float alpha);
/**
* @return The alpha transparency of this image (0.0 to 1.0)
*/
float getAlpha();
/**
* Sets the rotation angle of this image.
* @param rotation The rotation in degrees
*/
void setRotation(float rotation);
/**
* @return The rotation angle of this image in degrees
*/
float getRotation();
/**
* Sets the image type which determines where the image is rendered.
* @param imageType The image type: 0 = Default, 1 = Text, 2 = Option
*/
void setImageType(int imageType);
/**
* @return The image type: 0 = Default, 1 = Text, 2 = Option
*/
int getImageType();
/**
* Sets the alignment of this image.
* @param alignment The alignment value
*/
void setAlignment(int alignment);
/**
* @return The alignment value of this image
*/
int getAlignment();
}
@@ -0,0 +1,78 @@
package noppes.npcs.api.handler.data;
/**
* Represents a cycle (or category) grouping for magics.
* A magic cycle holds ordering and display information as well as associations
* to multiple magics.
*/
public interface IMagicCycle {
/**
* Gets the unique identifier of this magic cycle.
*
* @return the cycle ID
*/
int getId();
/**
* Gets the internal name of the magic cycle.
*
* @return the name of the cycle
*/
String getName();
/**
* Sets the internal name of the magic cycle.
*
* @param name the new name of the cycle
*/
void setName(String name);
/**
* Gets the display name of the magic cycle.
*
* @return the display name for the cycle
*/
String getDisplayName();
/**
* Sets the display name of the magic cycle.
*
* @param displayName the new display name of the cycle
*/
void setDisplayName(String displayName);
/**
* Gets the layout type for the cycle.
* This is typically an integer representation of the layout enum.
* <p>
* 0: CIRCULAR
* 1: SQUARE
* 2: TREE
* 3: GENERATED
* 4: CIRCULAR_MANUAL
* 5: SQUARE_MANUAL
* 6: TREE_MANUAL
* 7: CHART
*
* @return the layout type as an integer
*/
int getLayoutType();
/**
* Sets the layout type for the cycle.
* The provided integer should correspond to a valid layout type.
* <p>
* 0: CIRCULAR
* 1: SQUARE
* 2: TREE
* 3: GENERATED
* 4: CIRCULAR_MANUAL
* 5: SQUARE_MANUAL
* 6: TREE_MANUAL
* 7: CHART
*
* @param layout the layout type as an integer
*/
void setLayoutType(int layout);
}
@@ -0,0 +1,44 @@
package noppes.npcs.api.handler.data;
public interface IMagicData {
/**
* @param id The ID of the Magic
*/
void removeMagic(int id);
/**
* @param id The ID of the Magic
* @return If the Magic exists
*/
boolean hasMagic(int id);
/**
* Clears the Magics
*/
void clear();
/**
* @return If the Magics are empty
*/
boolean isEmpty();
/**
* @param id The ID of the Magic
* @param damage The bonus damage for the Magic
* @param split The split of the Magic
*/
void addMagic(int id, float damage, float split);
/**
* @param id The ID of the Magic
* @return The bonus damage for the Magic
*/
float getMagicDamage(int id);
/**
* @param id The ID of the Magic
* @return The split of the Magic
*/
float getMagicSplit(int id);
}
@@ -0,0 +1,28 @@
package noppes.npcs.api.handler.data;
public interface IProfileOptions {
boolean hasProfileOptions();
void setProfileOptions(boolean enable);
/**
* @param profileType 0:Individual, 1:Shared
*/
void setCooldownControl(int profileType);
/**
* @return 0:Individual, 1:Shared
*/
int getCooldownControl();
/**
* @param profileType 0:Individual, 1:Shared
*/
void setCompleteControl(int profileType);
/**
* @return 0:Individual, 1:Shared
*/
int getCompleteControl();
}
@@ -0,0 +1,96 @@
package noppes.npcs.platform;
import noppes.npcs.platform.nbt.INBTCompound;
import noppes.npcs.platform.nbt.INBTList;
import noppes.npcs.platform.nbt.NBTFactory;
import java.io.File;
import java.io.IOException;
/**
* Central platform abstraction that bridges CORE logic with MC-version-specific code.
*
* Each mc* module (mc1710, mc1122, mc1165, mc1201) provides an implementation
* that is registered during mod initialization via {@link PlatformServiceHolder#set(PlatformService)}.
*
* CORE code accesses this via {@link PlatformServiceHolder#get()}.
*/
public interface PlatformService {
// --- NBT ---
/**
* @return the NBT factory for creating and wrapping NBT objects
*/
NBTFactory nbt();
// --- NBT I/O ---
/**
* Reads a compressed NBT compound from a file.
* Maps to CompressedStreamTools.readCompressed() in MC.
*/
INBTCompound readCompressedNBT(File file) throws IOException;
/**
* Writes a compressed NBT compound to a file.
* Maps to CompressedStreamTools.writeCompressed() in MC.
*/
void writeCompressedNBT(INBTCompound compound, File file) throws IOException;
// --- Paths ---
/**
* @return the world save directory (server-side), e.g. "saves/MyWorld/customnpcs/"
*/
File getWorldSaveDirectory();
/**
* @return a subdirectory within the world save directory
*/
File getWorldSaveDirectory(String subdir);
/**
* @return the global config directory, e.g. ".minecraft/config/"
*/
File getConfigDirectory();
// --- Environment ---
/**
* @return true if running on the physical client (has a GUI)
*/
boolean isPhysicalClient();
/**
* @return the mod version string
*/
String getModVersion();
// --- Logging ---
/**
* Logs at INFO level.
*/
void logInfo(String message);
/**
* Logs at WARN level.
*/
void logWarn(String message);
/**
* Logs at ERROR level.
*/
void logError(String message);
/**
* Logs at ERROR level with a throwable.
*/
void logError(String message, Throwable t);
/**
* Logs at DEBUG level.
*/
void logDebug(String message);
}
@@ -0,0 +1,51 @@
package noppes.npcs.platform;
/**
* Static accessor for the active {@link PlatformService} implementation.
*
* The mc* module sets this once during mod initialization:
* <pre>
* PlatformServiceHolder.set(new MC1710PlatformService());
* </pre>
*
* CORE code retrieves it via:
* <pre>
* PlatformService platform = PlatformServiceHolder.get();
* </pre>
*/
public final class PlatformServiceHolder {
private static PlatformService instance;
private PlatformServiceHolder() {}
/**
* Sets the active platform service. Must be called exactly once during mod initialization.
*
* @throws IllegalStateException if already set
*/
public static void set(PlatformService service) {
if (instance != null) {
throw new IllegalStateException("PlatformService has already been initialized");
}
instance = service;
}
/**
* @return the active platform service
* @throws IllegalStateException if not yet initialized
*/
public static PlatformService get() {
if (instance == null) {
throw new IllegalStateException("PlatformService has not been initialized yet");
}
return instance;
}
/**
* @return true if the platform service has been initialized
*/
public static boolean isInitialized() {
return instance != null;
}
}
@@ -0,0 +1,39 @@
package noppes.npcs.platform.config;
/**
* Version-independent abstraction over Minecraft Forge's Configuration system.
*
* Maps to:
* - 1.7.10 / 1.12: net.minecraftforge.common.config.Configuration
* - 1.16+: net.minecraftforge.common.ForgeConfigSpec (different pattern)
*
* CORE config classes use this to load/save values without
* depending on Forge APIs.
*/
public interface IConfigProvider {
boolean getBoolean(String category, String key, boolean defaultValue, String comment);
int getInt(String category, String key, int defaultValue, String comment);
int getInt(String category, String key, int defaultValue, int min, int max, String comment);
double getDouble(String category, String key, double defaultValue, String comment);
String getString(String category, String key, String defaultValue, String comment);
/**
* Gets a string value from a set of valid values.
*/
String getString(String category, String key, String defaultValue, String comment, String[] validValues);
/**
* Checks if the config has been changed since last save.
*/
boolean hasChanged();
/**
* Saves the config file to disk.
*/
void save();
}
@@ -0,0 +1,125 @@
package noppes.npcs.platform.nbt;
/**
* Version-independent abstraction over Minecraft's NBT compound tag.
*
* Maps to:
* - 1.7.10 / 1.12: net.minecraft.nbt.NBTTagCompound
* - 1.16+: net.minecraft.nbt.CompoundNBT / CompoundTag
*
* Each mc* module provides a thin wrapper implementation that delegates
* to the real MC class. CORE code uses this interface exclusively.
*/
public interface INBTCompound {
// --- Setters ---
void setString(String key, String value);
void setInteger(String key, int value);
void setBoolean(String key, boolean value);
void setDouble(String key, double value);
void setFloat(String key, float value);
void setLong(String key, long value);
void setShort(String key, short value);
void setByte(String key, byte value);
void setByteArray(String key, byte[] value);
void setIntArray(String key, int[] value);
void setCompound(String key, INBTCompound compound);
void setTag(String key, INBTCompound compound);
void setList(String key, INBTList list);
// --- Getters ---
String getString(String key);
int getInteger(String key);
boolean getBoolean(String key);
double getDouble(String key);
float getFloat(String key);
long getLong(String key);
short getShort(String key);
byte getByte(String key);
byte[] getByteArray(String key);
int[] getIntArray(String key);
INBTCompound getCompound(String key);
/**
* Gets a tag list from this compound.
* @param key the key
* @param type the element type ID (e.g. 10 for compounds, 8 for strings)
* @return the list, or an empty list if the key doesn't exist
*/
INBTList getList(String key, int type);
// --- Query ---
boolean hasKey(String key);
/**
* Checks if this compound has a key of a specific NBT type.
* @param key the key
* @param type the NBT type ID
*/
boolean hasKey(String key, int type);
/**
* @return a set of all keys in this compound
*/
java.util.Set<String> getKeySet();
/**
* Removes a key from this compound.
*/
void removeTag(String key);
/**
* Returns the NBT type ID for the tag with the given key.
* @return the type ID (see {@link noppes.npcs.constants.NBTTypes}), or 0 if not present
*/
int getTagType(String key);
/**
* @return true if this compound has no keys
*/
boolean isEmpty();
// --- Interop ---
/**
* Merges all tags from the given compound into this one.
*/
void merge(INBTCompound other);
/**
* Creates a deep copy of this compound.
*/
INBTCompound copy();
/**
* Returns the underlying MC NBT object.
* Used at the boundary between CORE and version-specific code.
* CORE code should NEVER call this — only mc* modules should.
*/
Object getUnderlyingTag();
}
@@ -0,0 +1,88 @@
package noppes.npcs.platform.nbt;
/**
* Version-independent abstraction over Minecraft's NBT list tag.
*
* Maps to:
* - 1.7.10 / 1.12: net.minecraft.nbt.NBTTagList
* - 1.16+: net.minecraft.nbt.ListNBT / ListTag
*/
public interface INBTList {
/**
* @return the number of elements in this list
*/
int size();
/**
* Gets the compound tag at the given index.
* @throws ClassCastException if the element is not a compound
*/
INBTCompound getCompound(int index);
/**
* Gets the string value at the given index.
*/
String getString(int index);
/**
* Gets the integer value at the given index (from int array tags).
*/
int getInt(int index);
/**
* Gets the double value at the given index.
*/
double getDouble(int index);
/**
* Gets the float value at the given index.
*/
float getFloat(int index);
/**
* Gets an int array at the given index (for lists of int arrays).
*/
int[] getIntArray(int index);
/**
* @return the NBT type ID of elements in this list (see {@link noppes.npcs.constants.NBTTypes}),
* or 0 if the list is empty
*/
int getElementType();
// --- Mutators ---
/**
* Appends a compound tag to the end of this list.
*/
void addCompound(INBTCompound compound);
/**
* Appends a string to the end of this list.
*/
void addString(String value);
/**
* Appends an integer tag to the end of this list.
*/
void addInt(int value);
/**
* Appends a double tag to the end of this list.
*/
void addDouble(double value);
/**
* Removes and returns the element at the given index.
*/
void remove(int index);
// --- Interop ---
/**
* Returns the underlying MC NBT list object.
* CORE code should NEVER call this — only mc* modules should.
*/
Object getUnderlyingTag();
}
@@ -0,0 +1,37 @@
package noppes.npcs.platform.nbt;
/**
* Factory for creating new NBT instances.
* Each mc* module provides an implementation via PlatformService.
*/
public interface NBTFactory {
/**
* Creates a new, empty compound tag.
*/
INBTCompound createCompound();
/**
* Creates a new, empty list tag.
*/
INBTList createList();
/**
* Wraps a raw MC NBT compound object into an INBTCompound.
* Used at the boundary when receiving NBT from MC code.
*
* @param mcNBTTagCompound the raw MC NBTTagCompound / CompoundTag
* @return the wrapped interface
* @throws IllegalArgumentException if the object is not a valid MC NBT compound
*/
INBTCompound wrap(Object mcNBTTagCompound);
/**
* Wraps a raw MC NBT list object into an INBTList.
*
* @param mcNBTTagList the raw MC NBTTagList / ListTag
* @return the wrapped interface
* @throws IllegalArgumentException if the object is not a valid MC NBT list
*/
INBTList wrapList(Object mcNBTTagList);
}
@@ -0,0 +1,37 @@
package noppes.npcs.platform.nbt;
import java.io.File;
import java.io.IOException;
/**
* Abstraction for NBT file I/O operations.
*
* Maps to CompressedStreamTools in MC. Used by controllers for
* reading/writing world save data.
*/
public interface NBTIO {
/**
* Reads a compressed NBT compound from a file.
* Equivalent to CompressedStreamTools.readCompressed(FileInputStream).
*/
INBTCompound readCompressed(File file) throws IOException;
/**
* Writes a compressed NBT compound to a file.
* Equivalent to CompressedStreamTools.writeCompressed(NBTTagCompound, FileOutputStream).
*/
void writeCompressed(INBTCompound compound, File file) throws IOException;
/**
* Reads an uncompressed NBT compound from a file.
* Equivalent to CompressedStreamTools.read(File).
*/
INBTCompound read(File file) throws IOException;
/**
* Writes an uncompressed NBT compound to a file (safe write with temp file).
* Equivalent to CompressedStreamTools.safeWrite(NBTTagCompound, File).
*/
void safeWrite(INBTCompound compound, File file) throws IOException;
}
+6 -1
View File
@@ -29,4 +29,9 @@ plugins {
}
// Include the local gradle-plugins composite build so plugin is resolved locally
includeBuild 'gradle-plugins'
includeBuild 'gradle-plugins'
// CNPC+ Multi-Version Core Modules
// These are plain Java libraries with no Minecraft dependencies.
// They contain version-independent game logic shared across all MC versions.
include 'core', 'platform-api'
@@ -45,6 +45,7 @@ import noppes.npcs.controllers.data.Quest;
import noppes.npcs.controllers.data.QuestCategory;
import noppes.npcs.controllers.data.RecipeAnvil;
import noppes.npcs.controllers.data.RecipeCarpentry;
import noppes.npcs.wrapper.nbt.MC1710NBTCompound;
import java.io.IOException;
import java.util.EnumMap;
@@ -336,7 +337,7 @@ public class SyncController {
NBTTagCompound compound = new NBTTagCompound();
for (MagicCycle cycle : MagicController.getInstance().cycles.values()) {
NBTTagCompound cycleCompound = new NBTTagCompound();
cycle.writeNBT(cycleCompound);
cycle.writeNBT(new MC1710NBTCompound(cycleCompound));
list.appendTag(cycleCompound);
}
compound.setTag("Data", list);
@@ -585,7 +586,7 @@ public class SyncController {
mc.cyclesSync.clear();
for (int i = 0; i < list.tagCount(); i++) {
MagicCycle cycle = new MagicCycle();
cycle.readNBT(list.getCompoundTagAt(i));
cycle.readNBT(new MC1710NBTCompound(list.getCompoundTagAt(i)));
mc.cyclesSync.put(cycle.id, cycle);
}
@@ -757,7 +758,7 @@ public class SyncController {
}
case MAGIC_CYCLE: {
MagicCycle cycle = new MagicCycle();
cycle.readNBT(compound);
cycle.readNBT(new MC1710NBTCompound(compound));
MagicController.getInstance().cycles.put(cycle.id, cycle);
break;
}
@@ -57,6 +57,7 @@ import noppes.npcs.scripted.NpcAPI;
import noppes.npcs.controllers.MagicController;
import noppes.npcs.controllers.data.Magic;
import noppes.npcs.controllers.data.MagicData;
import noppes.npcs.wrapper.nbt.MC1710NBTCompound;
import noppes.npcs.controllers.data.MagicEntry;
import noppes.npcs.controllers.data.PlayerData;
import noppes.npcs.client.gui.advanced.SubGuiAbilityMagic;
@@ -1533,7 +1534,7 @@ public abstract class Ability implements IAbility, IAbilityAction {
nbt.setFloat("telegraphHeightOffset", telegraphHeightOffset);
nbt.setTag("customData", (NBTTagCompound) customData.copy());
TagController.writeTagUUIDs(nbt, "TagUUIDs", tagUUIDs);
magicData.writeToNBT(nbt);
magicData.writeToNBT(new MC1710NBTCompound(nbt));
nbt.setInteger("allowedBy", allowedBy.ordinal());
nbt.setBoolean("ignoreCooldown", ignoreCooldown);
nbt.setBoolean("perAbilityCooldown", perAbilityCooldown);
@@ -1633,7 +1634,7 @@ public abstract class Ability implements IAbility, IAbilityAction {
telegraphHeightOffset = nbt.getFloat("telegraphHeightOffset");
customData = (NBTTagCompound) nbt.getCompoundTag("customData").copy();
tagUUIDs = TagController.readTagUUIDs(nbt, "TagUUIDs");
magicData.readToNBT(nbt);
magicData.readToNBT(new MC1710NBTCompound(nbt));
allowedBy = UserType.fromOrdinal(nbt.getInteger("allowedBy"));
ignoreCooldown = nbt.getBoolean("ignoreCooldown");
perAbilityCooldown = nbt.getBoolean("perAbilityCooldown");
@@ -13,6 +13,7 @@ import net.minecraft.entity.EntityLivingBase;
import net.minecraft.nbt.NBTTagCompound;
import net.minecraft.world.World;
import noppes.npcs.controllers.data.MagicData;
import noppes.npcs.wrapper.nbt.MC1710NBTCompound;
/**
* Universal base class for all energy ability entities (Projectiles, Barriers, Sweeper).
@@ -358,7 +359,7 @@ public abstract class EntityEnergyAbility extends Entity implements IEntityAddit
if (customDamageData != null) {
nbt.setTag("CustomDamageData", customDamageData);
}
magicData.writeToNBT(nbt);
magicData.writeToNBT(new MC1710NBTCompound(nbt));
}
/**
@@ -373,7 +374,7 @@ public abstract class EntityEnergyAbility extends Entity implements IEntityAddit
if (nbt.hasKey("CustomDamageData")) {
this.customDamageData = nbt.getCompoundTag("CustomDamageData");
}
magicData.readToNBT(nbt);
magicData.readToNBT(new MC1710NBTCompound(nbt));
}
// ==================== WORLD NBT (INTENTIONALLY EMPTY) ====================
@@ -11,6 +11,7 @@ import net.minecraft.entity.player.EntityPlayer;
import net.minecraft.nbt.NBTTagCompound;
import noppes.npcs.client.NoppesUtil;
import noppes.npcs.controllers.data.MagicData;
import noppes.npcs.wrapper.nbt.MC1710NBTCompound;
import java.io.IOException;
import java.util.Map;
@@ -86,7 +87,7 @@ public final class PlayerDataInfoPacket extends LargeAbstractPacket {
writeMap(buffer, factionData);
NBTTagCompound compound = new NBTTagCompound();
playerMagicData.writeToNBT(compound);
playerMagicData.writeToNBT(new MC1710NBTCompound(compound));
ByteBufUtils.writeNBT(buffer, compound);
byte[] bytes = new byte[buffer.readableBytes()];
@@ -14,6 +14,7 @@ import net.minecraft.nbt.NBTTagCompound;
import noppes.npcs.controllers.PlayerDataController;
import noppes.npcs.controllers.data.AbilityHotbarData;
import noppes.npcs.controllers.data.PlayerData;
import noppes.npcs.wrapper.nbt.MC1710NBTCompound;
import java.io.IOException;
@@ -61,7 +62,7 @@ public final class AbilityHotbarSavePacket extends AbstractPacket {
AbilityHotbarData slotData = data.hotbarData.getSlot(slot);
if (slotData == null) return;
slotData.readFromNBT(compound.getCompoundTag("AbilityHotbar" + slot));
slotData.readFromNBT(new MC1710NBTCompound(compound.getCompoundTag("AbilityHotbar" + slot)));
// Validate the ability key
boolean valid = true;
@@ -17,6 +17,7 @@ import net.minecraft.nbt.NBTTagCompound;
import noppes.npcs.constants.EnumScrollData;
import noppes.npcs.controllers.MagicController;
import noppes.npcs.controllers.data.MagicCycle;
import noppes.npcs.wrapper.nbt.MC1710NBTCompound;
import java.io.IOException;
import java.util.HashMap;
@@ -71,7 +72,7 @@ public class MagicCyclesPacket extends AbstractPacket {
return;
NBTTagCompound compound = new NBTTagCompound();
NBTTagCompound magicCompound = new NBTTagCompound();
cycle.writeNBT(magicCompound);
cycle.writeNBT(new MC1710NBTCompound(magicCompound));
compound.setTag("MagicCycle", magicCompound);
GuiDataPacket.sendGuiData((EntityPlayerMP) player, compound);
}
@@ -22,6 +22,7 @@ import noppes.npcs.controllers.CategoryManager;
import noppes.npcs.controllers.CustomEffectController;
import noppes.npcs.controllers.LinkedItemController;
import noppes.npcs.controllers.data.Category;
import noppes.npcs.wrapper.nbt.MC1710NBTCompound;
import java.io.IOException;
@@ -72,7 +73,7 @@ public final class CategorySavePacket extends AbstractPacket {
return;
Category cat = new Category();
cat.readNBT(compound);
cat.readNBT(new MC1710NBTCompound(compound));
if (cat.id <= 0) {
cm.createCategory(cat.title);
@@ -18,6 +18,7 @@ import net.minecraft.nbt.NBTTagList;
import noppes.npcs.CustomNpcsPermissions;
import noppes.npcs.controllers.ServerCloneController;
import noppes.npcs.controllers.data.CloneFolder;
import noppes.npcs.wrapper.nbt.MC1710NBTCompound;
import java.io.IOException;
@@ -102,7 +103,7 @@ public final class CloneFolderCrudPacket extends AbstractPacket {
compound.setBoolean("Success", success);
NBTTagList folderList = new NBTTagList();
for (CloneFolder folder : ServerCloneController.Instance.getFolderList()) {
folderList.appendTag(folder.writeNBT(new NBTTagCompound()));
folderList.appendTag(((MC1710NBTCompound) folder.writeNBT(new MC1710NBTCompound(new NBTTagCompound()))).getMCTag());
}
compound.setTag("CloneFolders", folderList);
@@ -16,6 +16,7 @@ import net.minecraft.nbt.NBTTagCompound;
import net.minecraft.nbt.NBTTagList;
import noppes.npcs.controllers.ServerCloneController;
import noppes.npcs.controllers.data.CloneFolder;
import noppes.npcs.wrapper.nbt.MC1710NBTCompound;
import java.io.IOException;
@@ -50,7 +51,7 @@ public final class CloneFolderListPacket extends AbstractPacket {
NBTTagCompound compound = new NBTTagCompound();
NBTTagList folderList = new NBTTagList();
for (CloneFolder folder : ServerCloneController.Instance.getFolderList()) {
folderList.appendTag(folder.writeNBT(new NBTTagCompound()));
folderList.appendTag(((MC1710NBTCompound) folder.writeNBT(new MC1710NBTCompound(new NBTTagCompound()))).getMCTag());
}
compound.setTag("CloneFolders", folderList);
@@ -16,6 +16,7 @@ import net.minecraft.entity.player.EntityPlayerMP;
import net.minecraft.nbt.NBTTagCompound;
import noppes.npcs.controllers.ServerTagMapController;
import noppes.npcs.controllers.data.TagMap;
import noppes.npcs.wrapper.nbt.MC1710NBTCompound;
import java.io.IOException;
@@ -73,7 +74,7 @@ public final class CloneTagListPacket extends AbstractPacket {
tagMap = ServerTagMapController.Instance.getTagMap(tab);
}
NBTTagCompound compound = new NBTTagCompound();
compound.setTag("CloneTags", tagMap.writeNBT());
compound.setTag("CloneTags", ((MC1710NBTCompound) tagMap.writeNBT()).getMCTag());
GuiDataPacket.sendGuiData((EntityPlayerMP) player, compound);
}
}
@@ -15,6 +15,7 @@ import noppes.npcs.CustomNpcsPermissions;
import noppes.npcs.NoppesUtilServer;
import noppes.npcs.controllers.MagicController;
import noppes.npcs.controllers.data.MagicCycle;
import noppes.npcs.wrapper.nbt.MC1710NBTCompound;
import java.io.IOException;
@@ -58,7 +59,7 @@ public class MagicCycleSavePacket extends AbstractPacket {
return;
NBTTagCompound comp = ByteBufUtils.readNBT(in);
MagicCycle cycle = new MagicCycle();
cycle.readNBT(comp);
cycle.readNBT(new MC1710NBTCompound(comp));
MagicController.getInstance().saveCycle(cycle);
NoppesUtilServer.sendMagicInfo((EntityPlayerMP) player, true);
@@ -17,6 +17,7 @@ import net.minecraft.nbt.NBTTagCompound;
import noppes.npcs.controllers.MagicController;
import noppes.npcs.controllers.data.Magic;
import noppes.npcs.controllers.data.MagicCycle;
import noppes.npcs.wrapper.nbt.MC1710NBTCompound;
import java.io.IOException;
@@ -72,7 +73,7 @@ public final class MagicGetPacket extends AbstractPacket {
MagicCycle cycle = MagicController.getInstance().getCycle(id);
NBTTagCompound compound = new NBTTagCompound();
NBTTagCompound magicCompound = new NBTTagCompound();
cycle.writeNBT(magicCompound);
cycle.writeNBT(new MC1710NBTCompound(magicCompound));
compound.setTag("MagicCycle", magicCompound);
GuiDataPacket.sendGuiData((EntityPlayerMP) player, compound);
}
@@ -13,6 +13,7 @@ import kamkeel.npcs.network.packets.data.large.GuiDataPacket;
import net.minecraft.entity.player.EntityPlayer;
import net.minecraft.entity.player.EntityPlayerMP;
import net.minecraft.nbt.NBTTagCompound;
import noppes.npcs.wrapper.nbt.MC1710NBTCompound;
import java.io.IOException;
@@ -48,7 +49,7 @@ public final class MagicNpcGetPacket extends AbstractPacket {
return;
NBTTagCompound compound = new NBTTagCompound();
npc.stats.magicData.writeToNBT(compound);
npc.stats.magicData.writeToNBT(new MC1710NBTCompound(compound));
GuiDataPacket.sendGuiData((EntityPlayerMP) player, compound);
}
}
@@ -14,6 +14,7 @@ import net.minecraft.entity.player.EntityPlayer;
import net.minecraft.nbt.NBTTagCompound;
import noppes.npcs.CustomNpcsPermissions;
import noppes.npcs.controllers.data.MagicData;
import noppes.npcs.wrapper.nbt.MC1710NBTCompound;
import java.io.IOException;
@@ -54,7 +55,7 @@ public final class MagicNpcSavePacket extends AbstractPacket {
public void sendData(ByteBuf out) throws IOException {
NBTTagCompound compound = new NBTTagCompound();
if (magicData != null) {
magicData.writeToNBT(compound);
magicData.writeToNBT(new MC1710NBTCompound(compound));
}
ByteBufUtils.writeNBT(out, compound);
}
@@ -65,6 +66,6 @@ public final class MagicNpcSavePacket extends AbstractPacket {
return;
NBTTagCompound compound = ByteBufUtils.readNBT(in);
npc.stats.magicData.readToNBT(compound);
npc.stats.magicData.readToNBT(new MC1710NBTCompound(compound));
}
}
@@ -64,6 +64,8 @@ import nikedemos.markovnames.generators.MarkovSlavic;
import nikedemos.markovnames.generators.MarkovSpanish;
import nikedemos.markovnames.generators.MarkovWelsh;
import noppes.npcs.compat.PixelmonHelper;
import noppes.npcs.platform.PlatformServiceHolder;
import noppes.npcs.wrapper.MC1710PlatformService;
import noppes.npcs.config.ConfigMain;
import noppes.npcs.config.LoadConfiguration;
import noppes.npcs.config.legacy.LegacyConfig;
@@ -214,6 +216,11 @@ public class CustomNpcs {
@EventHandler
public void load(FMLPreInitializationEvent ev) {
// Initialize the platform service bridge for CORE module
if (!PlatformServiceHolder.isInitialized()) {
PlatformServiceHolder.set(new MC1710PlatformService());
}
PacketHandler.Instance = new PacketHandler();
MinecraftServer server = MinecraftServer.getServer();
+3 -2
View File
@@ -21,6 +21,7 @@ import noppes.npcs.controllers.data.AnimationData;
import noppes.npcs.controllers.data.HitboxData;
import noppes.npcs.controllers.data.SkinOverlay;
import noppes.npcs.controllers.data.TintData;
import noppes.npcs.wrapper.nbt.MC1710NBTCompound;
import noppes.npcs.entity.EntityNPCInterface;
import noppes.npcs.entity.data.DataSkinOverlays;
import noppes.npcs.util.ValueUtil;
@@ -102,7 +103,7 @@ public class DataDisplay {
nbttagcompound = animationData.writeToNBT(nbttagcompound);
nbttagcompound = hitboxData.writeToNBT(nbttagcompound);
nbttagcompound = tintData.writeToNBT(nbttagcompound);
nbttagcompound = ((MC1710NBTCompound) tintData.writeToNBT(new MC1710NBTCompound(nbttagcompound))).getMCTag();
if (this.playerProfile != null) {
NBTTagCompound nbttagcompound1 = new NBTTagCompound();
@@ -190,7 +191,7 @@ public class DataDisplay {
animationData.readFromNBT(nbttagcompound);
hitboxData.readFromNBT(nbttagcompound);
tintData.readFromNBT(nbttagcompound);
tintData.readFromNBT(new MC1710NBTCompound(nbttagcompound));
modelSize = ValueUtil.clamp(nbttagcompound.getInteger("Size"), 1, Integer.MAX_VALUE);
if (modelSize > ConfigMain.NpcSizeLimit)
+3 -2
View File
@@ -6,6 +6,7 @@ import net.minecraft.nbt.NBTTagCompound;
import noppes.npcs.constants.EnumParticleType;
import noppes.npcs.constants.EnumPotionType;
import noppes.npcs.controllers.data.MagicData;
import noppes.npcs.wrapper.nbt.MC1710NBTCompound;
import noppes.npcs.entity.EntityNPCInterface;
import noppes.npcs.scripted.ScriptParticle;
import noppes.npcs.util.ValueUtil;
@@ -139,7 +140,7 @@ public class DataStats {
compound.setBoolean("PlayerSetCanDespawn", playerSetCanDespawn);
compound.setInteger("CollidesWith", collidesWith);
magicData.writeToNBT(compound);
magicData.writeToNBT(new MC1710NBTCompound(compound));
return compound;
}
@@ -215,7 +216,7 @@ public class DataStats {
attackInvisible = compound.getBoolean("AttackInvisible");
canDespawn = compound.getBoolean("CanDespawn");
playerSetCanDespawn = compound.getBoolean("PlayerSetCanDespawn");
magicData.readToNBT(compound);
magicData.readToNBT(new MC1710NBTCompound(compound));
npc.setImmuneToFire(immuneToFire);
@@ -75,6 +75,7 @@ import noppes.npcs.controllers.data.LinkedItem;
import noppes.npcs.controllers.data.Magic;
import noppes.npcs.controllers.data.MagicCycle;
import noppes.npcs.controllers.data.MagicData;
import noppes.npcs.wrapper.nbt.MC1710NBTCompound;
import noppes.npcs.controllers.data.PlayerBankData;
import noppes.npcs.controllers.data.PlayerData;
import noppes.npcs.controllers.data.PlayerDialogData;
@@ -1256,7 +1257,7 @@ public class NoppesUtilServer {
playerdata = PlayerData.get(pl);
if (enumPlayerData == EnumPlayerData.Magic) { // Quest removal
playerdata.magicData.readToNBT(compound);
playerdata.magicData.readToNBT(new MC1710NBTCompound(compound));
}
playerdata.save();
@@ -28,6 +28,7 @@ import noppes.npcs.constants.EnumGuiType;
import noppes.npcs.constants.EnumScrollData;
import noppes.npcs.controllers.data.Dialog;
import noppes.npcs.controllers.data.MagicData;
import noppes.npcs.wrapper.nbt.MC1710NBTCompound;
import noppes.npcs.controllers.data.Quest;
import noppes.npcs.controllers.data.SkinOverlay;
import noppes.npcs.entity.EntityNPCInterface;
@@ -260,7 +261,7 @@ public class NoppesUtil {
Map<String, Integer> bankData = readMap(data);
Map<String, Integer> factionData = readMap(data);
MagicData magicData = new MagicData();
magicData.readToNBT(ByteBufUtils.readNBT(data));
magicData.readToNBT(new MC1710NBTCompound(ByteBufUtils.readNBT(data)));
GuiScreen gui = Minecraft.getMinecraft().currentScreen;
if (gui == null)
@@ -32,6 +32,7 @@ import noppes.npcs.client.gui.util.ICustomScrollListener;
import noppes.npcs.client.gui.util.IGuiData;
import noppes.npcs.controllers.data.Tag;
import noppes.npcs.controllers.data.TagMap;
import noppes.npcs.wrapper.nbt.MC1710NBTCompound;
import java.lang.reflect.Modifier;
import java.util.ArrayList;
@@ -596,7 +597,7 @@ public class GuiNpcMobSpawner extends GuiNPCInterface implements IGuiData, ICust
} else if (compound.hasKey("CloneTags")) {
this.tagMap = new TagMap(activeTab);
NBTTagCompound cloneTags = compound.getCompoundTag("CloneTags");
this.tagMap.readNBT(cloneTags);
this.tagMap.readNBT(new MC1710NBTCompound(cloneTags));
} else if (compound.hasKey("AllTags")) {
NBTTagList validTags = compound.getTagList("AllTags", 10);
if (validTags != null) {
@@ -25,6 +25,7 @@ import noppes.npcs.client.gui.util.ISubGuiListener;
import noppes.npcs.client.gui.util.SubGuiInterface;
import noppes.npcs.controllers.data.CloneFolder;
import noppes.npcs.controllers.data.Tag;
import noppes.npcs.wrapper.nbt.MC1710NBTCompound;
import noppes.npcs.entity.EntityNPCInterface;
import java.util.ArrayList;
@@ -302,7 +303,7 @@ public class GuiNpcMobSpawnerAdd extends GuiNPCInterface implements GuiYesNoCall
serverFolderNames.clear();
for (int i = 0; i < folderList.tagCount(); i++) {
CloneFolder f = new CloneFolder();
f.readNBT(folderList.getCompoundTagAt(i));
f.readNBT(new MC1710NBTCompound(folderList.getCompoundTagAt(i)));
serverFolderNames.add(f.name);
}
validateFolder();
@@ -34,6 +34,7 @@ import noppes.npcs.client.gui.util.SubGuiInterface;
import noppes.npcs.controllers.data.CloneFolder;
import noppes.npcs.controllers.data.Tag;
import noppes.npcs.controllers.data.TagMap;
import noppes.npcs.wrapper.nbt.MC1710NBTCompound;
import java.lang.reflect.Modifier;
import java.util.ArrayList;
@@ -992,7 +993,7 @@ public class GuiNpcMobSpawnerFullscreen extends GuiDirectory implements IGuiData
folderNames.clear();
for (int i = 0; i < folderList.tagCount(); i++) {
CloneFolder folder = new CloneFolder();
folder.readNBT(folderList.getCompoundTagAt(i));
folder.readNBT(new MC1710NBTCompound(folderList.getCompoundTagAt(i)));
folderNames.add(folder.name);
}
initGui();
@@ -1005,7 +1006,7 @@ public class GuiNpcMobSpawnerFullscreen extends GuiDirectory implements IGuiData
this.tagMap = new TagMap(GuiNpcMobSpawner.activeTab);
}
NBTTagCompound cloneTags = compound.getCompoundTag("CloneTags");
this.tagMap.readNBT(cloneTags);
this.tagMap.readNBT(new MC1710NBTCompound(cloneTags));
} else if (compound.hasKey("AllTags")) {
NBTTagList validTags = compound.getTagList("AllTags", 10);
if (validTags != null) {
Loaded 100 of 125 files, more files were not shown because too many files have changed in this diff. Show more