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

@@ -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;
}