chars, ...

This commit is contained in:
Sen 2025-04-06 00:12:39 +02:00
parent eea23233f4
commit 3515fb1792
53 changed files with 688 additions and 543 deletions

View file

@ -52,6 +52,7 @@ import game.inventory.IInventory;
import game.inventory.InventoryPlayer;
import game.inventory.Slot;
import game.inventory.SlotCrafting;
import game.item.ItemArmor;
import game.item.ItemControl;
import game.item.ItemStack;
import game.log.Log;
@ -2500,7 +2501,7 @@ public class Player extends NetHandler implements ICrafting, Executor
NetHandler.checkThread(packetIn, this, this.server);
CPacketAction.Action action = packetIn.getAction();
if(this.charEditor != (action == Action.SET_ALIGN || action == Action.SET_SPECIES || action == Action.SET_HEIGHT || action == Action.CLOSE_EDITOR)) // {
if(this.charEditor != (action == Action.SET_ALIGN || action == Action.SET_SPECIES || action == Action.SET_CLASS || action == Action.SET_HEIGHT || action == Action.CLOSE_EDITOR)) // {
// if(this.local && action == Action.CLOSE_EDITOR)
// this.server.setDone();
return;
@ -2630,7 +2631,7 @@ public class Player extends NetHandler implements ICrafting, Executor
// break;
case SET_HEIGHT:
this.entity.setHeight(((float)ExtMath.clampi(packetIn.getAuxData(), this.entity.getMinSize(), this.entity.getMaxSize()) * 0.01f) / this.entity.getSpecies().renderer.height);
this.entity.setHeight(((float)ExtMath.clampi(packetIn.getAuxData(), this.entity.getMinSize(), this.entity.getMaxSize()) * 0.01f));
// Log.CONSOLE.info("" + this.entity.height + "(" + this.entity.getHeight() + ")");
break;
@ -2854,6 +2855,14 @@ public class Player extends NetHandler implements ICrafting, Executor
this.server.swapPlayer(this, null, (Class<? extends EntityNPC>)clazz);
// Log.CONSOLE.info("" + this.entity.height + "(" + this.entity.getHeight() + ")");
break;
case SET_CLASS:
if(this.entity.getSpecies().classEnum != null) {
Enum<?>[] classes = this.entity.getSpecies().classEnum.getEnumConstants();
if(packetIn.getAuxData() >= 0 && packetIn.getAuxData() < classes.length)
this.entity.setNpcClass(classes[packetIn.getAuxData()]);
}
break;
default:
throw new IllegalArgumentException("Ungültige Aktion!");
@ -2977,7 +2986,7 @@ public class Player extends NetHandler implements ICrafting, Executor
this.entity.inventory.addItemStackToInventory(itemstack);
amount -= itemstack.stackSize;
}
else if(packetIn.getSlot() >= 0 && packetIn.getSlot() < 9) {
else if(packetIn.getSlot() >= 0 && packetIn.getSlot() < this.entity.inventory.getSizeInventory() && (packetIn.getSlot() < this.entity.inventory.mainInventory.length || (itemstack.getItem() instanceof ItemArmor && ((ItemArmor)itemstack.getItem()).armorType == packetIn.getSlot() - this.entity.inventory.mainInventory.length))) {
ItemStack old = this.entity.inventory.getStackInSlot(packetIn.getSlot());
if(old != null) {
if(ItemStack.areItemsEqual(itemstack, old) && ItemStack.areItemStackTagsEqual(itemstack, old)) {
@ -3079,6 +3088,8 @@ public class Player extends NetHandler implements ICrafting, Executor
// }
// this.entity.setModel(packetIn.getModel());
this.entity.setSkin(packetIn.getCompressed());
if(packetIn.getCharacter() != null)
this.entity.setChar(packetIn.getCharacter());
this.server.sendPacket(new SPacketSkin(this.entity.getId(), packetIn.getCompressed())); // , packetIn.getModel()));
// if(/* this.lastSkinUpdate != 0L && */ Config.sendSkinChange && !this.netManager.isLocalChannel()) {
// String comp = "Dein Skin wurde geändert";