mirror of
https://github.com/KAMKEEL/CustomNPC-Plus.git
synced 2026-11-22 10:49:47 +00:00
HUGE CORE MIGRATION (WIP, WONT BUILD)
This commit is contained in:
1 parent
f4aa04dcb6
commit
2e2b52252d
335 files changed
+64280
-454
No files matched your search
@@ -0,0 +1,16 @@
|
||||
package common.minecraft.command;
|
||||
|
||||
import common.minecraft.util.ITextComponent;
|
||||
import noppes.npcs.api.IWorld;
|
||||
|
||||
/**
|
||||
* Platform abstraction for Minecraft's command sender.
|
||||
* MC 1.7.10: net.minecraft.command.ICommandSender
|
||||
* MC 1.12+: ICommandSender / CommandSource (1.13+)
|
||||
*/
|
||||
public interface ICommandSender {
|
||||
String getCommandSenderName();
|
||||
IWorld getEntityWorld();
|
||||
void addChatMessage(ITextComponent component);
|
||||
boolean canCommandSenderUseCommand(int permLevel, String commandName);
|
||||
}
|
||||
@@ -0,0 +1,12 @@
|
||||
package common.minecraft.nbt;
|
||||
|
||||
/**
|
||||
* Platform abstraction for Minecraft's NBT base tag type.
|
||||
* MC 1.7.10: NBTBase
|
||||
* MC 1.12+: NBTBase / INBT (1.16+)
|
||||
*/
|
||||
public interface INbtBase {
|
||||
byte getId();
|
||||
INbtBase copy();
|
||||
String toString();
|
||||
}
|
||||
@@ -0,0 +1,13 @@
|
||||
package common.minecraft.potion;
|
||||
|
||||
/**
|
||||
* Platform abstraction for Minecraft's active potion effect instance.
|
||||
* MC 1.7.10: PotionEffect
|
||||
* MC 1.12+: PotionEffect / EffectInstance (1.14+)
|
||||
*/
|
||||
public interface IPotionEffect {
|
||||
int getPotionID();
|
||||
int getDuration();
|
||||
int getAmplifier();
|
||||
boolean getIsAmbient();
|
||||
}
|
||||
@@ -0,0 +1,12 @@
|
||||
package common.minecraft.potion;
|
||||
|
||||
/**
|
||||
* Platform abstraction for Minecraft's potion type (the potion definition, not the effect instance).
|
||||
* MC 1.7.10: Potion
|
||||
* MC 1.12+: Potion (registry-based)
|
||||
*/
|
||||
public interface IPotionType {
|
||||
int getId();
|
||||
String getName();
|
||||
boolean isBadEffect();
|
||||
}
|
||||
@@ -0,0 +1,18 @@
|
||||
package common.minecraft.util;
|
||||
|
||||
/**
|
||||
* Platform abstraction for Minecraft's axis-aligned bounding box.
|
||||
* MC 1.7.10: AxisAlignedBB
|
||||
* MC 1.12+: AxisAlignedBB
|
||||
*/
|
||||
public interface IBoundingBox {
|
||||
double getMinX();
|
||||
double getMinY();
|
||||
double getMinZ();
|
||||
double getMaxX();
|
||||
double getMaxY();
|
||||
double getMaxZ();
|
||||
IBoundingBox expand(double x, double y, double z);
|
||||
IBoundingBox offset(double x, double y, double z);
|
||||
boolean isVecInside(double x, double y, double z);
|
||||
}
|
||||
@@ -0,0 +1,19 @@
|
||||
package common.minecraft.util;
|
||||
|
||||
import noppes.npcs.api.entity.IEntity;
|
||||
|
||||
/**
|
||||
* Platform abstraction for Minecraft's ray trace / moving object position.
|
||||
* MC 1.7.10: MovingObjectPosition
|
||||
* MC 1.12+: RayTraceResult
|
||||
*/
|
||||
public interface IRayTraceResult {
|
||||
/** 0=MISS, 1=BLOCK, 2=ENTITY */
|
||||
int getTypeOfHit();
|
||||
int getBlockX();
|
||||
int getBlockY();
|
||||
int getBlockZ();
|
||||
int getSideHit();
|
||||
IEntity getEntityHit();
|
||||
IVector3 getHitVec();
|
||||
}
|
||||
@@ -0,0 +1,12 @@
|
||||
package common.minecraft.util;
|
||||
|
||||
/**
|
||||
* Platform abstraction for Minecraft's ResourceLocation.
|
||||
* MC 1.7.10: net.minecraft.util.ResourceLocation
|
||||
* MC 1.12+: net.minecraft.util.ResourceLocation
|
||||
*/
|
||||
public interface IResourceLocation {
|
||||
String getResourceDomain();
|
||||
String getResourcePath();
|
||||
String toString();
|
||||
}
|
||||
@@ -0,0 +1,13 @@
|
||||
package common.minecraft.util;
|
||||
|
||||
/**
|
||||
* Platform abstraction for Minecraft's chat component hierarchy.
|
||||
* MC 1.7.10: ChatComponentText, ChatComponentTranslation, IChatComponent
|
||||
* MC 1.12+: ITextComponent, TextComponentString, TextComponentTranslation
|
||||
*/
|
||||
public interface ITextComponent {
|
||||
String getUnformattedText();
|
||||
String getFormattedText();
|
||||
ITextComponent appendText(String text);
|
||||
ITextComponent appendSibling(ITextComponent sibling);
|
||||
}
|
||||
@@ -0,0 +1,15 @@
|
||||
package common.minecraft.util;
|
||||
|
||||
/**
|
||||
* Platform abstraction for Minecraft's chat formatting style.
|
||||
* MC 1.7.10: ChatStyle
|
||||
* MC 1.12+: Style
|
||||
*/
|
||||
public interface ITextStyle {
|
||||
boolean getBold();
|
||||
boolean getItalic();
|
||||
boolean getUnderlined();
|
||||
boolean getStrikethrough();
|
||||
boolean getObfuscated();
|
||||
String getColor();
|
||||
}
|
||||
@@ -0,0 +1,19 @@
|
||||
package common.minecraft.util;
|
||||
|
||||
/**
|
||||
* Platform abstraction for Minecraft's 3D vector.
|
||||
* MC 1.7.10: Vec3
|
||||
* MC 1.12+: Vec3d
|
||||
*/
|
||||
public interface IVector3 {
|
||||
double getX();
|
||||
double getY();
|
||||
double getZ();
|
||||
IVector3 normalize();
|
||||
double lengthVector();
|
||||
double distanceTo(IVector3 other);
|
||||
IVector3 addVector(double x, double y, double z);
|
||||
IVector3 subtract(IVector3 other);
|
||||
double dotProduct(IVector3 other);
|
||||
IVector3 crossProduct(IVector3 other);
|
||||
}
|
||||
@@ -0,0 +1,13 @@
|
||||
package common.minecraft.world;
|
||||
|
||||
/**
|
||||
* Platform abstraction for Minecraft's explosion.
|
||||
* MC 1.7.10: Explosion
|
||||
* MC 1.12+: Explosion
|
||||
*/
|
||||
public interface IExplosion {
|
||||
double getX();
|
||||
double getY();
|
||||
double getZ();
|
||||
float getSize();
|
||||
}
|
||||
@@ -0,0 +1,21 @@
|
||||
package common.minecraftforge.common.config;
|
||||
|
||||
/**
|
||||
* Platform abstraction for Forge's Configuration property.
|
||||
* MC 1.7.10: net.minecraftforge.common.config.Property
|
||||
* MC 1.12+: net.minecraftforge.common.config.Property
|
||||
* MC 1.14+: ForgeConfigSpec.ConfigValue (adapter needed)
|
||||
*/
|
||||
public interface IConfigProperty {
|
||||
String getString();
|
||||
int getInt();
|
||||
boolean getBoolean();
|
||||
double getDouble();
|
||||
String[] getStringList();
|
||||
void set(String value);
|
||||
void set(int value);
|
||||
void set(boolean value);
|
||||
void set(double value);
|
||||
String getComment();
|
||||
String getName();
|
||||
}
|
||||
@@ -0,0 +1,22 @@
|
||||
package common.minecraftforge.common.config;
|
||||
|
||||
/**
|
||||
* Platform abstraction for Forge's Configuration file handler.
|
||||
* MC 1.7.10: net.minecraftforge.common.config.Configuration
|
||||
* MC 1.12+: net.minecraftforge.common.config.Configuration
|
||||
* MC 1.14+: ForgeConfigSpec (different pattern, adapter needed)
|
||||
*/
|
||||
public interface IConfiguration {
|
||||
IConfigProperty get(String category, String key, String defaultValue, String comment);
|
||||
IConfigProperty get(String category, String key, int defaultValue, String comment);
|
||||
IConfigProperty get(String category, String key, boolean defaultValue, String comment);
|
||||
IConfigProperty get(String category, String key, double defaultValue, String comment);
|
||||
IConfigProperty get(String category, String key, String defaultValue, String comment, String[] validValues);
|
||||
IConfigProperty get(String category, String key, int defaultValue, String comment, int minValue, int maxValue);
|
||||
IConfigProperty get(String category, String key, double defaultValue, String comment, double minValue, double maxValue);
|
||||
void save();
|
||||
void load();
|
||||
boolean hasKey(String category, String key);
|
||||
boolean hasCategory(String category);
|
||||
boolean hasChanged();
|
||||
}
|
||||
@@ -1,5 +1,7 @@
|
||||
package kamkeel.npcs.platform;
|
||||
|
||||
import common.minecraft.util.IResourceLocation;
|
||||
import common.minecraft.util.ITextComponent;
|
||||
import noppes.npcs.api.IDamageSource;
|
||||
import noppes.npcs.api.INbt;
|
||||
import noppes.npcs.api.IWorld;
|
||||
@@ -11,6 +13,10 @@ import noppes.npcs.platform.nbt.NBTFactory;
|
||||
|
||||
import java.io.File;
|
||||
import java.io.IOException;
|
||||
import java.io.InputStream;
|
||||
import java.io.OutputStream;
|
||||
import java.util.List;
|
||||
import java.util.UUID;
|
||||
|
||||
/**
|
||||
* Central platform abstraction that bridges CORE logic with MC-version-specific code.
|
||||
@@ -93,4 +99,54 @@ public interface PlatformService {
|
||||
// --- Scheduling ---
|
||||
|
||||
void runOnMainThread(Runnable task);
|
||||
|
||||
// --- Translation ---
|
||||
|
||||
String translateToLocal(String key);
|
||||
|
||||
String translateToLocalFormatted(String key, Object... args);
|
||||
|
||||
// --- Server ---
|
||||
|
||||
boolean isLogicalClient();
|
||||
|
||||
boolean isModLoaded(String modId);
|
||||
|
||||
boolean isDedicatedServer();
|
||||
|
||||
List<IPlayer> getOnlinePlayers();
|
||||
|
||||
IPlayer getPlayerByName(String name);
|
||||
|
||||
IPlayer getPlayerByUUID(UUID uuid);
|
||||
|
||||
IWorld getWorldForDimension(int dimensionId);
|
||||
|
||||
// --- Entity Registry ---
|
||||
|
||||
String getEntityRegistryName(IEntity entity);
|
||||
|
||||
// --- Item Registry ---
|
||||
|
||||
IItemStack getItemById(int id);
|
||||
|
||||
int getIdFromItem(IItemStack item);
|
||||
|
||||
// --- Text Components ---
|
||||
|
||||
ITextComponent createTextComponent(String text);
|
||||
|
||||
ITextComponent createTranslatedComponent(String key, Object... args);
|
||||
|
||||
// --- Resource ---
|
||||
|
||||
IResourceLocation createResourceLocation(String resourceName);
|
||||
|
||||
IResourceLocation createResourceLocation(String domain, String path);
|
||||
|
||||
// --- NBT Stream I/O ---
|
||||
|
||||
INbt readCompressedNBT(InputStream stream) throws IOException;
|
||||
|
||||
void writeCompressedNBT(INbt compound, OutputStream stream) throws IOException;
|
||||
}
|
||||
Reference in new issue
Block a user