Scissors/patches/server/0003-Fixes-log-spam-caused-by-invalid-entities-in-beehive.patch

33 lines
1.8 KiB
Diff
Raw Normal View History

2022-07-28 03:57:50 +00:00
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
2024-02-13 21:52:00 +00:00
From: Video <videogamesm12@gmail.com>
2023-12-10 23:00:20 +00:00
Date: Sun, 10 Dec 2023 16:57:48 -0600
2022-07-28 03:57:50 +00:00
Subject: [PATCH] Fixes log spam caused by invalid entities in beehives
diff --git a/src/main/java/net/minecraft/world/level/block/entity/BeehiveBlockEntity.java b/src/main/java/net/minecraft/world/level/block/entity/BeehiveBlockEntity.java
2024-03-27 01:07:46 +00:00
index d445ed0895293dd45c36226051f5809be8587ebe..b9c8b70fb0bf47ffe62cf0d082156479d07da331 100644
2022-07-28 03:57:50 +00:00
--- a/src/main/java/net/minecraft/world/level/block/entity/BeehiveBlockEntity.java
+++ b/src/main/java/net/minecraft/world/level/block/entity/BeehiveBlockEntity.java
@@ -11,6 +11,7 @@ import net.minecraft.nbt.CompoundTag;
import net.minecraft.nbt.ListTag;
import net.minecraft.nbt.NbtUtils;
import net.minecraft.network.protocol.game.DebugPackets;
2023-12-10 23:00:20 +00:00
+import net.minecraft.resources.ResourceLocation;
2022-07-28 03:57:50 +00:00
import net.minecraft.sounds.SoundEvents;
import net.minecraft.sounds.SoundSource;
import net.minecraft.tags.BlockTags;
2024-03-27 01:07:46 +00:00
@@ -380,6 +381,13 @@ public class BeehiveBlockEntity extends BlockEntity {
2022-07-28 03:57:50 +00:00
for (int i = 0; i < nbttaglist.size(); ++i) {
CompoundTag nbttagcompound1 = nbttaglist.getCompound(i);
+
+ // Scissors start - Do not allow invalid entities from being used for bees
+ if (!nbttagcompound1.contains("id") || !ResourceLocation.isValidResourceLocation(nbttagcompound1.getString("id")) || EntityType.byString(nbttagcompound1.getString("id")).isEmpty()) {
+ continue;
+ }
+ // Scissors end
2022-07-28 03:57:50 +00:00
+
2023-12-10 23:00:20 +00:00
BeehiveBlockEntity.BeeData tileentitybeehive_hivebee = new BeehiveBlockEntity.BeeData(nbttagcompound1.getCompound("EntityData").copy(), nbttagcompound1.getInt("TicksInHive"), nbttagcompound1.getInt("MinOccupationTicks"));
2022-07-28 03:57:50 +00:00
this.stored.add(tileentitybeehive_hivebee);