Files

46 lines
2.1 KiB
Markdown
Raw Permalink Normal View History

# platform-api/ — Interface Definitions
MC-free interfaces consumed by `core/`. Each MC version module provides implementations.
2026-03-15 08:57:42 +02:00
The scripting API interfaces (`noppes.npcs.api.*`) are being merged into this module.
## Structure
```
2026-03-15 08:57:42 +02:00
kamkeel/npcs/platform/ → PlatformService, PlatformServiceHolder, annotations
kamkeel/npcs/platform/config/ → IConfigProvider
noppes/npcs/api/ → Entity, item, handler, ability, NBT interfaces (from scripting API)
noppes/npcs/platform/nbt/ → NBTFactory, NBTIO abstractions
```
## Naming Conventions
2026-03-15 08:57:42 +02:00
- **Use the existing scripting API names as-is**: `IPlayer`, `IEntity`, `IItemStack`, `IWorld`, `ICustomNpc`, `INbt`, etc.
- **NEVER create semantically duplicate interfaces** — no `IUser`, `IStack`, `IGameWorld`, `IMob`. These don't exist and never should.
- **No `Platform` prefix** on interfaces — only `PlatformService` itself uses it
2026-03-15 08:57:42 +02:00
- **MC1710 wrappers**: `[Thing]Wrapper` — `PlayerWrapper`, not `MC1710PlayerWrapper`
2026-03-15 08:57:42 +02:00
## Key Interfaces (actual, from noppes.npcs.api.*)
2026-03-15 08:57:42 +02:00
| Interface | Wraps | Package |
|---|---|---|
2026-03-15 08:57:42 +02:00
| `IPlayer` | EntityPlayerMP | `noppes.npcs.api.entity` |
| `IEntity` | Entity | `noppes.npcs.api.entity` |
| `IEntityLivingBase` | EntityLivingBase | `noppes.npcs.api.entity` |
| `IEntityLiving` | EntityLiving | `noppes.npcs.api.entity` |
| `ICustomNpc` | EntityCustomNpc | `noppes.npcs.api.entity` |
| `IItemStack` | ItemStack | `noppes.npcs.api.item` |
| `IWorld` | World | `noppes.npcs.api` |
| `INbt` | NBTTagCompound | `noppes.npcs.api` |
| `INbtList` | NBTTagList | `noppes.npcs.api` |
| `IPos` | BlockPos | `noppes.npcs.api` |
| `IDamageSource` | DamageSource | `noppes.npcs.api` |
## PlatformService
Central SPI (`kamkeel.npcs.platform.PlatformService`): NBT factory + I/O, file paths, entity/item/world wrapping, logging, environment queries, scheduling. Access: `PlatformServiceHolder.get()`.
## Rules
- **Interfaces only** — no MC imports allowed
- `@ClientOnly` / `@ServerOnly` annotations for side-specific contracts
2026-03-15 08:57:42 +02:00
- New interfaces use existing API names — check `src/api/java/` before creating anything new