These work

I have no idea how to get stuff from net.minecraft.* in so I can edit them
This commit is contained in:
Telesphoreo 2022-06-11 00:53:02 -05:00
parent c00bd362d6
commit 15d8cdc7b3
3 changed files with 60 additions and 1 deletions

View File

@ -2,7 +2,7 @@ group=me.totalfreedom.scissors
version=1.19-R0.1-SNAPSHOT
mcVersion=1.19
paperRef=76f81aec25f04056c1f681482cf31071a75ea748
paperRef=ee7d16111dea48b3e244343031649639a8e218a5
org.gradle.caching=true
org.gradle.parallel=true

View File

@ -0,0 +1,18 @@
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
From: Luna <lunahatesgogle@gmail.com>
Date: Fri, 8 Apr 2022 23:38:12 -0300
Subject: [PATCH] Limit ListTags to 1024 elements
diff --git a/src/main/java/net/minecraft/nbt/ListTag.java b/src/main/java/net/minecraft/nbt/ListTag.java
index ea68b26e506e48d8238b7ee4266e61b211d52bd2..10d3a1b31233f884823ee9a4bb27d70eac3914df 100644
--- a/src/main/java/net/minecraft/nbt/ListTag.java
+++ b/src/main/java/net/minecraft/nbt/ListTag.java
@@ -33,6 +33,7 @@ public class ListTag extends CollectionTag<Tag> {
list.add(tagType.load(dataInput, i + 1, nbtAccounter));
}
+ if(j > 1024) return new ListTag(Lists.newArrayListWithCapacity(0), b);
return new ListTag(list, b);
}
}

View File

@ -0,0 +1,41 @@
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
From: Telesphoreo <me@telesphoreo.me>
Date: Fri, 22 Apr 2022 01:24:05 -0500
Subject: [PATCH] Validate coordinates before attempting to get block entities
when handling Creative Inventory packets
diff --git a/src/main/java/net/minecraft/server/network/ServerGamePacketListenerImpl.java b/src/main/java/net/minecraft/server/network/ServerGamePacketListenerImpl.java
index 901fa17d0f0a3f66923f68f13f183bc4c17f7748..dc9199c0b1fa9b8779afc51d7af4c516d217ddb3 100644
--- a/src/main/java/net/minecraft/server/network/ServerGamePacketListenerImpl.java
+++ b/src/main/java/net/minecraft/server/network/ServerGamePacketListenerImpl.java
@@ -2991,20 +2991,25 @@ public class ServerGamePacketListenerImpl implements ServerPlayerConnection, Ser
if (this.player.gameMode.isCreative()) {
boolean flag = packet.getSlotNum() < 0;
ItemStack itemstack = packet.getItem();
- CompoundTag nbttagcompound = BlockItem.getBlockEntityData(itemstack);
+ CompoundTag nbttagcompound = BlockItem.getBlockEntityData(itemstack);
if (!itemstack.isEmpty() && nbttagcompound != null && nbttagcompound.contains("x") && nbttagcompound.contains("y") && nbttagcompound.contains("z") && this.player.getBukkitEntity().hasPermission("minecraft.nbt.copy")) { // Spigot
BlockPos blockposition = BlockEntity.getPosFromTag(nbttagcompound);
// Paper start
- BlockEntity tileentity = null;
+ // Scissors start - Validate coordinates and whether or not the player can reach them
+ if (Level.isInSpawnableBounds(blockposition) && !isOutsideOfReach(blockposition.getX(), blockposition.getY(), blockposition.getZ())) {
+ BlockEntity tileentity = null;
if (this.player.distanceToSqr(blockposition.getX(), blockposition.getY(), blockposition.getZ()) < 32 * 32 && this.player.getLevel().isLoadedAndInBounds(blockposition)) {
tileentity = this.player.level.getBlockEntity(blockposition);
}
// Paper end
- if (tileentity != null) {
- tileentity.saveToItem(itemstack);
+ if (tileentity != null) {
+ tileentity.saveToItem(
+ itemstack);
+ }
}
+ // Scissors end
}
boolean flag1 = packet.getSlotNum() >= 1 && packet.getSlotNum() <= 45;