mirror of
https://github.com/barkeser2002/CatServer.git
synced 2026-09-25 03:00:03 +03:00
74 lines
2.7 KiB
Diff
74 lines
2.7 KiB
Diff
--- ../src-base/minecraft/net/minecraft/network/PacketBuffer.java
|
|
+++ ../src-work/minecraft/net/minecraft/network/PacketBuffer.java
|
|
@@ -25,11 +25,13 @@
|
|
import net.minecraft.nbt.CompressedStreamTools;
|
|
import net.minecraft.nbt.NBTSizeTracker;
|
|
import net.minecraft.nbt.NBTTagCompound;
|
|
+import net.minecraft.network.play.client.CPacketCloseWindow;
|
|
import net.minecraft.util.ResourceLocation;
|
|
import net.minecraft.util.math.BlockPos;
|
|
import net.minecraft.util.text.ITextComponent;
|
|
import net.minecraftforge.fml.relauncher.Side;
|
|
import net.minecraftforge.fml.relauncher.SideOnly;
|
|
+import org.bukkit.craftbukkit.inventory.CraftItemStack;
|
|
|
|
public class PacketBuffer extends ByteBuf
|
|
{
|
|
@@ -287,9 +289,9 @@
|
|
{
|
|
CompressedStreamTools.write(nbt, new ByteBufOutputStream(this));
|
|
}
|
|
- catch (IOException ioexception)
|
|
+ catch (Exception exception) // CraftBukkit - IOException -> Exception
|
|
{
|
|
- throw new EncoderException(ioexception);
|
|
+ throw new EncoderException(exception);
|
|
}
|
|
}
|
|
|
|
@@ -323,7 +325,7 @@
|
|
|
|
public PacketBuffer writeItemStack(ItemStack stack)
|
|
{
|
|
- if (stack.isEmpty())
|
|
+ if (stack.isEmpty() || stack.getItem() == null) // CraftBukkit - NPE fix itemstack.getItem()
|
|
{
|
|
this.writeShort(-1);
|
|
}
|
|
@@ -336,7 +338,7 @@
|
|
|
|
if (stack.getItem().isDamageable() || stack.getItem().getShareTag())
|
|
{
|
|
- nbttagcompound = stack.getTagCompound();
|
|
+ nbttagcompound = stack.getItem().getNBTShareTag(stack);
|
|
}
|
|
|
|
this.writeCompoundTag(nbttagcompound);
|
|
@@ -358,7 +360,9 @@
|
|
int j = this.readByte();
|
|
int k = this.readShort();
|
|
ItemStack itemstack = new ItemStack(Item.getItemById(i), j, k);
|
|
- itemstack.setTagCompound(this.readCompoundTag());
|
|
+ itemstack.getItem().readNBTShareTag(itemstack, this.readCompoundTag());
|
|
+ if (itemstack.getTagCompound() != null)
|
|
+ CraftItemStack.setItemMeta(itemstack, CraftItemStack.getItemMeta(itemstack));
|
|
return itemstack;
|
|
}
|
|
}
|
|
@@ -386,6 +390,7 @@
|
|
}
|
|
else
|
|
{
|
|
+ catserver.server.utils.Log4j2_3201_Fixer.matchThrowException(s); // CatServer
|
|
return s;
|
|
}
|
|
}
|
|
@@ -393,6 +398,7 @@
|
|
|
|
public PacketBuffer writeString(String string)
|
|
{
|
|
+ if (catserver.server.utils.Log4j2_3201_Fixer.matchPrintException(string)) string = ""; // CatServer
|
|
byte[] abyte = string.getBytes(StandardCharsets.UTF_8);
|
|
|
|
if (abyte.length > 32767)
|