cleanup, rename, nbt->cdt "compressed data tree"

This commit is contained in:
Sen 2025-05-28 01:11:46 +02:00
parent 753b4b8b5d
commit 6c55d59f1f
Signed by: sen
GPG key ID: 3AC50A6F47D1B722
181 changed files with 1254 additions and 1664 deletions

View file

@ -1380,7 +1380,7 @@ public class Client implements IThreadListener {
if (this.world.getState(blockpos).getBlock() != Blocks.air)
{
int i = itemstack != null ? itemstack.stackSize : 0;
int i = itemstack != null ? itemstack.size : 0;
if (this.controller.clickRight(this.player, this.world, itemstack, blockpos, this.pointed.side, this.pointed.vec))
{
@ -1393,11 +1393,11 @@ public class Client implements IThreadListener {
return;
}
if (itemstack.stackSize == 0)
if (itemstack.size == 0)
{
this.player.inventory.mainInventory[this.player.inventory.currentItem] = null;
}
else if (itemstack.stackSize != i) // || this.controller.isCreative())
else if (itemstack.size != i) // || this.controller.isCreative())
{
this.entityRenderer.itemRenderer.resetEquippedProgress();
}
@ -1426,12 +1426,9 @@ public class Client implements IThreadListener {
return;
}
// boolean flag = this.thePlayer.creative;
int meta = 0;
boolean flag1 = false;
// TileEntity tileentity = null;
Item item = null;
// NBTTagCompound tag = null;
if (this.pointed.type == HitPosition.ObjectType.BLOCK)
{
@ -1902,7 +1899,7 @@ public class Client implements IThreadListener {
: "Rüstung: n/a, Pfeile: n/a") + "\n" +
// ItemStack held = ((EntityLiving)entity).getHeldItem();
(held != null ?
"Gegens.: " + ItemRegistry.REGISTRY.getNameForObject(held.getItem()) + " x" + held.stackSize + " (" + held.getMetadata() + ")" : "Gegens.: n/a") + "\n" +
"Gegens.: " + ItemRegistry.REGISTRY.getNameForObject(held.getItem()) + " x" + held.size + " (" + held.getMetadata() + ")" : "Gegens.: n/a") + "\n" +
"Eigens.: " + (entity.dead ? "D" : " ") + (entity.noClip ? "N" : " ") + (entity.onGround ? "G" : " ")
+ (entity.canBeCollidedWith() ? "C" : " ") + (entity.canBePushed() ? "P" : " ")
+ (entity.isBurning() ? "B" : " ") // + (entity.isInvisible() ? "I" : " ") // + (entity.isSilent() ? "S" : " ")

View file

@ -374,20 +374,20 @@ public abstract class GuiContainer extends Gui
if (this.draggedStack != null && this.isRightMouseClick)
{
itemstack = itemstack.copy();
itemstack.stackSize = ExtMath.ceilf((float)itemstack.stackSize / 2.0F);
itemstack.size = ExtMath.ceilf((float)itemstack.size / 2.0F);
}
else if (this.dragSplitting && this.dragSplittingSlots.size() > 1)
{
itemstack = itemstack.copy();
itemstack.stackSize = this.dragSplittingRemnant;
itemstack.size = this.dragSplittingRemnant;
if (itemstack.stackSize == 0)
if (itemstack.size == 0)
{
s = "" + TextColor.YELLOW + "0";
}
}
else if(itemstack == this.cheatStack) {
s = TextColor.DGREEN + "+" + TextColor.GREEN + ItemStack.formatAmount(itemstack.stackSize);
s = TextColor.DGREEN + "+" + TextColor.GREEN + ItemStack.formatAmount(itemstack.size);
}
this.drawItemStack(itemstack, mouseX - j2, mouseY - k2, s);
@ -518,7 +518,7 @@ public abstract class GuiContainer extends Gui
if (slotIn == this.clickedSlot && this.draggedStack != null && this.isRightMouseClick && itemstack != null)
{
itemstack = itemstack.copy();
itemstack.stackSize /= 2;
itemstack.size /= 2;
}
else if (this.dragSplitting && this.dragSplittingSlots.contains(slotIn) && itemstack1 != null)
{
@ -531,18 +531,18 @@ public abstract class GuiContainer extends Gui
{
itemstack = itemstack1.copy();
flag = true;
Container.computeStackSize(this.dragSplittingSlots, this.dragSplittingLimit, itemstack, slotIn.getStack() == null ? 0 : slotIn.getStack().stackSize);
Container.computeStackSize(this.dragSplittingSlots, this.dragSplittingLimit, itemstack, slotIn.getStack() == null ? 0 : slotIn.getStack().size);
if (itemstack.stackSize > itemstack.getMaxStackSize())
if (itemstack.size > itemstack.getMaxStackSize())
{
s = TextColor.YELLOW + ItemStack.formatAmount(itemstack.getMaxStackSize());
itemstack.stackSize = itemstack.getMaxStackSize();
itemstack.size = itemstack.getMaxStackSize();
}
if (itemstack.stackSize > slotIn.getItemStackLimit(itemstack))
if (itemstack.size > slotIn.getItemStackLimit(itemstack))
{
s = TextColor.YELLOW + ItemStack.formatAmount(slotIn.getItemStackLimit(itemstack));
itemstack.stackSize = slotIn.getItemStackLimit(itemstack);
itemstack.size = slotIn.getItemStackLimit(itemstack);
}
}
else
@ -593,25 +593,25 @@ public abstract class GuiContainer extends Gui
if (itemstack != null && this.dragSplitting)
{
this.dragSplittingRemnant = itemstack.stackSize;
this.dragSplittingRemnant = itemstack.size;
for (Slot slot : this.dragSplittingSlots)
{
ItemStack itemstack1 = itemstack.copy();
int i = slot.getStack() == null ? 0 : slot.getStack().stackSize;
int i = slot.getStack() == null ? 0 : slot.getStack().size;
Container.computeStackSize(this.dragSplittingSlots, this.dragSplittingLimit, itemstack1, i);
if (itemstack1.stackSize > itemstack1.getMaxStackSize())
if (itemstack1.size > itemstack1.getMaxStackSize())
{
itemstack1.stackSize = itemstack1.getMaxStackSize();
itemstack1.size = itemstack1.getMaxStackSize();
}
if (itemstack1.stackSize > slot.getItemStackLimit(itemstack1))
if (itemstack1.size > slot.getItemStackLimit(itemstack1))
{
itemstack1.stackSize = slot.getItemStackLimit(itemstack1);
itemstack1.size = slot.getItemStackLimit(itemstack1);
}
this.dragSplittingRemnant -= itemstack1.stackSize - i;
this.dragSplittingRemnant -= itemstack1.size - i;
}
}
}
@ -644,7 +644,7 @@ public abstract class GuiContainer extends Gui
if(this.cheatStack != null) {
Slot slot = this.getSlotAtPosition(mouseX, mouseY);
if((mouseButton == 0 || mouseButton == 1) && slot != null && this.gm.player != null && slot.inventory == this.gm.player.inventory)
this.gm.player.client.addToSendQueue(new CPacketCheat(this.cheatStack, slot.getIndex(), mouseButton == 0 && this.cheatStack.stackSize > 1));
this.gm.player.client.addToSendQueue(new CPacketCheat(this.cheatStack, slot.getIndex(), mouseButton == 0 && this.cheatStack.size > 1));
if(mouseButton != 1 && !this.gm.ctrl())
this.cheatStack = null;
return;
@ -811,7 +811,7 @@ public abstract class GuiContainer extends Gui
// }
// }
// else
if (this.dragSplitting && slot != null && itemstack != null && itemstack.stackSize > this.dragSplittingSlots.size() && Container.canAddItemToSlot(slot, itemstack, true) && slot.isItemValid(itemstack) && this.inventorySlots.canDragIntoSlot(slot))
if (this.dragSplitting && slot != null && itemstack != null && itemstack.size > this.dragSplittingSlots.size() && Container.canAddItemToSlot(slot, itemstack, true) && slot.isItemValid(itemstack) && this.inventorySlots.canDragIntoSlot(slot))
{
this.dragSplittingSlots.add(slot);
this.updateDragSplitting();
@ -1090,13 +1090,13 @@ public abstract class GuiContainer extends Gui
{
if (stack != null)
{
if (stack.stackSize != 1 || text != null)
if (stack.size != 1 || text != null)
{
String s = text == null ? ItemStack.formatAmount(stack.stackSize) : text;
String s = text == null ? ItemStack.formatAmount(stack.size) : text;
if (text == null && stack.stackSize < 1)
if (text == null && stack.size < 1)
{
s = TextColor.RED + ItemStack.formatAmount(stack.stackSize);
s = TextColor.RED + ItemStack.formatAmount(stack.size);
}
// this.drawString(s, , );
// Vec2i size = Drawing.txt_size(0, 0, 0, 0, 65536, 65536, s);
@ -1201,7 +1201,7 @@ public abstract class GuiContainer extends Gui
}
else {
this.cheatStack = ITEM_LIST.get(i1).copy();
this.cheatStack.stackSize = full ? this.cheatStack.getMaxStackSize() : 1;
this.cheatStack.size = full ? this.cheatStack.getMaxStackSize() : 1;
}
return true;
}

View file

@ -1331,7 +1331,7 @@ public class ClientPlayer extends NetHandler implements IClientPlayer
}
/**
* Updates the NBTTagCompound metadata of instances of the following entitytypes: Mob spawners, command blocks,
* Updates the metadata of instances of the following entitytypes: Mob spawners, command blocks,
* beacons, skulls, flowerpot
*/
public void handleUpdateTileEntity(SPacketUpdateTileEntity packetIn)
@ -1345,7 +1345,7 @@ public class ClientPlayer extends NetHandler implements IClientPlayer
if (tileentity != null && packetIn.isTileEntityType(tileentity)) // i == 1 && tileentity instanceof TileEntityMobSpawner || /* i == 2 && tileentity instanceof TileEntityCommandBlock || */ i == 3 && tileentity instanceof TileEntityBeacon || i == 4 && tileentity instanceof TileEntitySkull || /* i == 5 && tileentity instanceof TileEntityFlowerPot || */ i == 6 && tileentity instanceof TileEntityBanner || i == 7 && tileentity instanceof TileEntityMachine)
{
tileentity.readTags(packetIn.getNbtCompound());
tileentity.readTags(packetIn.getTags());
}
}
}
@ -1714,14 +1714,14 @@ public class ClientPlayer extends NetHandler implements IClientPlayer
//// }
// }
public void handleEntityNBT(SPacketUpdateEntityTags packetIn)
public void handleEntityTags(SPacketUpdateEntityTags packetIn)
{
NetHandler.checkThread(packetIn, this, this.gameController, this.clientWorldController);
Entity entity = packetIn.getEntity(this.clientWorldController);
if (entity != null)
{
entity.clientUpdateEntityNBT(packetIn.getTagCompound());
entity.clientUpdateEntityTags(packetIn.getTagCompound());
}
}

View file

@ -66,19 +66,19 @@ public class RenderEntityItem extends Render<EntityItem>
{
int i = 1;
if (stack.stackSize > 48)
if (stack.size > 48)
{
i = 5;
}
else if (stack.stackSize > 32)
else if (stack.size > 32)
{
i = 4;
}
else if (stack.stackSize > 16)
else if (stack.size > 16)
{
i = 3;
}
else if (stack.stackSize > 1)
else if (stack.size > 1)
{
i = 2;
}

View file

@ -208,16 +208,16 @@ public class EntityFX extends Entity
}
/**
* (abstract) Protected helper method to write subclass entity data to NBT.
* (abstract) Protected helper method to write subclass entity data.
*/
public void writeEntityToNBT(TagObject tagCompound)
public void writeEntity(TagObject tag)
{
}
/**
* (abstract) Protected helper method to read subclass entity data from NBT.
* (abstract) Protected helper method to read subclass entity data.
*/
public void readEntityFromNBT(TagObject tagCompund)
public void readEntity(TagObject tag)
{
}

View file

@ -218,9 +218,9 @@ public class EntityFirework
for (int i = 0; i < this.fireworkExplosions.size(); ++i)
{
TagObject nbttagcompound = this.fireworkExplosions.get(i);
TagObject tag = this.fireworkExplosions.get(i);
if (nbttagcompound.getBool("Flicker"))
if (tag.getBool("Flicker"))
{
this.twinkle = true;
this.particleMaxAge += 15;
@ -250,9 +250,9 @@ public class EntityFirework
{
for (int i = 0; i < this.fireworkExplosions.size(); ++i)
{
TagObject nbttagcompound = this.fireworkExplosions.get(i);
TagObject tag = this.fireworkExplosions.get(i);
if (nbttagcompound.getByte("Type") == 1)
if (tag.getByte("Type") == 1)
{
flag1 = true;
break;
@ -268,12 +268,12 @@ public class EntityFirework
if (this.fireworkAge % 2 == 0 && this.fireworkExplosions != null && this.fireworkAge / 2 < this.fireworkExplosions.size())
{
int k = this.fireworkAge / 2;
TagObject nbttagcompound1 = this.fireworkExplosions.get(k);
int l = nbttagcompound1.getByte("Type");
boolean flag4 = nbttagcompound1.getBool("Trail");
boolean flag2 = nbttagcompound1.getBool("Flicker");
int[] aint = nbttagcompound1.getIntArray("Colors");
int[] aint1 = nbttagcompound1.getIntArray("FadeColors");
TagObject tag = this.fireworkExplosions.get(k);
int l = tag.getByte("Type");
boolean flag4 = tag.getBool("Trail");
boolean flag2 = tag.getBool("Flicker");
int[] aint = tag.getIntArray("Colors");
int[] aint1 = tag.getIntArray("FadeColors");
if (aint.length == 0)
{

View file

@ -30,18 +30,6 @@ public class TileEntityItemStackRenderer
}
else if (itemStackIn.getItem() == Items.skull)
{
// String user = null;
//
// if (itemStackIn.hasTagCompound())
// {
// NBTTagCompound nbttagcompound = itemStackIn.getTagCompound();
//
// if (nbttagcompound.hasString("SkullOwner") && nbttagcompound.getString("SkullOwner").length() > 0)
// {
// user = nbttagcompound.getString("SkullOwner");
// }
// }
if (TileEntitySkullRenderer.instance != null)
{
GL11.glPushMatrix();

View file

@ -64,7 +64,7 @@ public class PlayerController {
if(stack != null) {
stack.onBlockDestroyed(world, block, pos, this.gm.player);
if(stack.stackSize == 0) {
if(stack.size == 0) {
this.gm.player.destroyCurrentEquippedItem();
}
}
@ -256,13 +256,13 @@ public class PlayerController {
public boolean sendUseItem(EntityNPC player, World world, ItemStack stack) {
this.syncItem();
this.handler.addToSendQueue(new CPacketPlace(player.inventory.getCurrentItem()));
int size = stack.stackSize;
int size = stack.size;
ItemStack changed = stack.useItemRightClick(world, player);
if(changed != stack || changed != null && changed.stackSize != size) {
if(changed != stack || changed != null && changed.size != size) {
player.inventory.mainInventory[player.inventory.currentItem] = changed;
if(changed.stackSize == 0) {
if(changed.size == 0) {
player.inventory.mainInventory[player.inventory.currentItem] = null;
}