Make NPCBase.java compliant with updated NPC.java
Makes NPCBase compliant with net.jitse.npclib.api.NPC. Implements NPC#getText() to return List<String> and NPC#getSlot(NPCSlot slot) to return ItemStack.
This commit is contained in:
parent
d7144e445e
commit
b97361516c
|
@ -263,6 +263,29 @@ public abstract class NPCBase implements NPC, NPCPacketHandler {
|
|||
return this;
|
||||
}
|
||||
|
||||
@Override
|
||||
public ItemStack getItem(NPCSlot slot) {
|
||||
if (slot == null) {
|
||||
throw new NullPointerException("Slot cannot be null");
|
||||
}
|
||||
switch (slot) {
|
||||
case HELMET:
|
||||
return this.helmet;
|
||||
case CHESTPLATE:
|
||||
return this.chestplate;
|
||||
case LEGGINGS:
|
||||
return this.leggings;
|
||||
case BOOTS:
|
||||
return this.boots;
|
||||
case MAINHAND:
|
||||
return this.inHand;
|
||||
case OFFHAND:
|
||||
return this.offHand;
|
||||
default:
|
||||
throw new IllegalArgumentException("Entered an invalid inventory slot");
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public NPC setItem(NPCSlot slot, ItemStack item) {
|
||||
if (slot == null) {
|
||||
|
@ -315,4 +338,9 @@ public abstract class NPCBase implements NPC, NPCPacketHandler {
|
|||
this.text = text;
|
||||
return this;
|
||||
}
|
||||
|
||||
@Override
|
||||
public List<String> getText() {
|
||||
return text;
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue