fixes, cmds

This commit is contained in:
Sen 2025-03-19 02:08:41 +01:00
parent 868a5ed9ea
commit c906760bd4
13 changed files with 295 additions and 134 deletions

View file

@ -57,6 +57,8 @@ import game.item.ItemStack;
import game.log.Log;
import game.material.Material;
import game.nbt.NBTTagCompound;
import game.nbt.NBTTagDouble;
import game.nbt.NBTTagFloat;
import game.nbt.NBTTagList;
import game.nbt.NBTTagString;
import game.packet.CPacketAction;
@ -1480,6 +1482,13 @@ public class NetHandlerPlayServer extends NetHandler implements ICrafting, Scrip
public List<NBTTagCompound> getCharacters() {
return this.characters;
}
public NBTTagCompound addCharacter(String id) {
NBTTagCompound tag = new NBTTagCompound();
this.characters.add(tag);
tag.setString("id", id);
return tag;
}
public NBTTagCompound getSelectedCharacter(boolean create) {
NBTTagCompound tag = this.characters.isEmpty() || this.selected < 0 ? null : this.characters.get(this.selected);
@ -2800,6 +2809,27 @@ public class NetHandlerPlayServer extends NetHandler implements ICrafting, Scrip
}
}
break;
case SET_SPECIES:
Class<? extends Entity> clazz = EntityRegistry.getEntityClass(packetIn.getAuxData());
if(EntityNPC.class.isAssignableFrom(clazz)) {
NBTTagCompound tag = this.addCharacter(EntityRegistry.getEntityString(clazz));
tag.setInteger("Dimension", this.entity.worldObj.dimension.getDimensionId());
NBTTagList pos = new NBTTagList();
pos.appendTag(new NBTTagDouble(this.entity.posX));
pos.appendTag(new NBTTagDouble(this.entity.posY));
pos.appendTag(new NBTTagDouble(this.entity.posZ));
tag.setTag("Pos", pos);
NBTTagList rot = new NBTTagList();
rot.appendTag(new NBTTagFloat(this.entity.rotYaw));
rot.appendTag(new NBTTagFloat(this.entity.rotPitch));
tag.setTag("Rotation", rot);
tag.setString("CustomName", this.entity.getCustomNameTag());
tag.setString("Align", this.entity.getAlignment().name);
tag.setFloat("Height", this.entity.getHeight());
this.server.swapPlayer(this, tag);
}
break;
default:
throw new IllegalArgumentException("Ungültige Aktion!");