mirror of
https://github.com/AtlasMediaGroup/Scissors.git
synced 2025-06-27 16:06:40 +00:00
tests are broken for some reason
This commit is contained in:
@ -0,0 +1,32 @@
|
||||
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
|
||||
From: Video <videogamesm12@gmail.com>
|
||||
Date: Sun, 13 Mar 2022 06:10:22 -0600
|
||||
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
|
||||
index 41c9f074203915c31c1ae7a160ce509c13383f84..8b4989593da43fc2fd661ac66bfe5ae1eb5e2780 100644
|
||||
--- 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;
|
||||
+import net.minecraft.resources.ResourceLocation; // Scissors
|
||||
import net.minecraft.sounds.SoundEvents;
|
||||
import net.minecraft.sounds.SoundSource;
|
||||
import net.minecraft.tags.BlockTags;
|
||||
@@ -370,6 +371,13 @@ public class BeehiveBlockEntity extends BlockEntity {
|
||||
|
||||
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
|
||||
+
|
||||
BeehiveBlockEntity.BeeData tileentitybeehive_hivebee = new BeehiveBlockEntity.BeeData(nbttagcompound1.getCompound("EntityData"), nbttagcompound1.getInt("TicksInHive"), nbttagcompound1.getInt("MinOccupationTicks"));
|
||||
|
||||
this.stored.add(tileentitybeehive_hivebee);
|
@ -0,0 +1,20 @@
|
||||
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
|
||||
From: Video <videogamesm12@gmail.com>
|
||||
Date: Sun, 13 Mar 2022 07:47:20 -0600
|
||||
Subject: [PATCH] Removes useless spammy error logging
|
||||
|
||||
|
||||
diff --git a/src/main/java/org/bukkit/craftbukkit/inventory/CraftMetaItem.java b/src/main/java/org/bukkit/craftbukkit/inventory/CraftMetaItem.java
|
||||
index aeca803cc0434d9de9434987d6e43b70353e305b..5bd581c1a82236359c810037333590d0d9741587 100644
|
||||
--- a/src/main/java/org/bukkit/craftbukkit/inventory/CraftMetaItem.java
|
||||
+++ b/src/main/java/org/bukkit/craftbukkit/inventory/CraftMetaItem.java
|
||||
@@ -1814,8 +1814,7 @@ class CraftMetaItem implements ItemMeta, Damageable, Repairable, BlockDataMeta {
|
||||
resource = CraftNamespacedKey.fromMinecraft(key);
|
||||
}
|
||||
} catch (IllegalArgumentException ex) {
|
||||
- org.bukkit.Bukkit.getLogger().warning("Namespaced resource does not validate: " + key.toString());
|
||||
- ex.printStackTrace();
|
||||
+ // Scissors - Don't log errors thrown by invalid namespaces when an error is thrown
|
||||
}
|
||||
|
||||
return resource;
|
@ -0,0 +1,24 @@
|
||||
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
|
||||
From: Video <videogamesm12@gmail.com>
|
||||
Date: Sun, 13 Mar 2022 08:14:44 -0600
|
||||
Subject: [PATCH] Ignore errors thrown when trying to remove minecart entities
|
||||
with content in them
|
||||
|
||||
|
||||
diff --git a/src/main/java/net/minecraft/world/entity/vehicle/AbstractMinecartContainer.java b/src/main/java/net/minecraft/world/entity/vehicle/AbstractMinecartContainer.java
|
||||
index 272095d7a09ab41227d741172735f66fd2798ce1..757ae1773ba35c2348483dddbb231060afafc602 100644
|
||||
--- a/src/main/java/net/minecraft/world/entity/vehicle/AbstractMinecartContainer.java
|
||||
+++ b/src/main/java/net/minecraft/world/entity/vehicle/AbstractMinecartContainer.java
|
||||
@@ -139,7 +139,11 @@ public abstract class AbstractMinecartContainer extends AbstractMinecart impleme
|
||||
@Override
|
||||
public void remove(Entity.RemovalReason reason) {
|
||||
if (!this.level().isClientSide && reason.shouldDestroy()) {
|
||||
- Containers.dropContents(this.level(), (Entity) this, (Container) this);
|
||||
+ // Scissors start - Ignore errors thrown when trying to remove minecart entities with content in them
|
||||
+ try {
|
||||
+ Containers.dropContents(this.level(), (Entity) this, (Container) this);
|
||||
+ } catch (Exception ignored) {}
|
||||
+ // Scissors end
|
||||
}
|
||||
|
||||
super.remove(reason);
|
@ -0,0 +1,28 @@
|
||||
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
|
||||
From: Luna <lunahatesgogle@gmail.com>
|
||||
Date: Sun, 13 Mar 2022 14:38:38 -0300
|
||||
Subject: [PATCH] ItemEntity - Check if items are air before calling setItem
|
||||
|
||||
|
||||
diff --git a/src/main/java/net/minecraft/world/entity/item/ItemEntity.java b/src/main/java/net/minecraft/world/entity/item/ItemEntity.java
|
||||
index eb0351aa12eebcefab1d1d14641fc3c60cbbcab8..cf944848cdebbb6f04f5211e00c876329e86d9cc 100644
|
||||
--- a/src/main/java/net/minecraft/world/entity/item/ItemEntity.java
|
||||
+++ b/src/main/java/net/minecraft/world/entity/item/ItemEntity.java
|
||||
@@ -425,11 +425,15 @@ public class ItemEntity extends Entity implements TraceableEntity {
|
||||
|
||||
CompoundTag nbttagcompound1 = nbt.getCompound("Item");
|
||||
|
||||
- this.setItem(ItemStack.of(nbttagcompound1));
|
||||
- if (this.getItem().isEmpty()) {
|
||||
+ // Scissors start
|
||||
+ ItemStack item = ItemStack.of(nbttagcompound1);
|
||||
+ if (item.isEmpty()) {
|
||||
this.discard();
|
||||
+ return;
|
||||
}
|
||||
|
||||
+ this.setItem(item);
|
||||
+ // Scissors end
|
||||
}
|
||||
|
||||
@Override
|
@ -0,0 +1,49 @@
|
||||
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
|
||||
From: Video <videogamesm12@gmail.com>
|
||||
Date: Sun, 13 Mar 2022 18:42:07 -0600
|
||||
Subject: [PATCH] Fixes Knowledge Books causing log spam when invalid data is
|
||||
provided
|
||||
|
||||
|
||||
diff --git a/src/main/java/net/minecraft/world/item/KnowledgeBookItem.java b/src/main/java/net/minecraft/world/item/KnowledgeBookItem.java
|
||||
index 37f37be56bab171df442b980ff46ff325daae283..deade19d16a7d6870171b9a60806a8cadb437db4 100644
|
||||
--- a/src/main/java/net/minecraft/world/item/KnowledgeBookItem.java
|
||||
+++ b/src/main/java/net/minecraft/world/item/KnowledgeBookItem.java
|
||||
@@ -40,9 +40,9 @@ public class KnowledgeBookItem extends Item {
|
||||
|
||||
for(int i = 0; i < listTag.size(); ++i) {
|
||||
String string = listTag.getString(i);
|
||||
- Optional<RecipeHolder<?>> optional = recipeManager.byKey(new ResourceLocation(string));
|
||||
+ Optional<RecipeHolder<?>> optional = recipeManager.byKey(ResourceLocation.tryParse(string)); // Scissors - Validate resource locations
|
||||
if (!optional.isPresent()) {
|
||||
- LOGGER.error("Invalid recipe: {}", (Object)string);
|
||||
+ // Scissors - Don't log errors caused by invalid recipes being provided
|
||||
return InteractionResultHolder.fail(itemStack);
|
||||
}
|
||||
|
||||
@@ -55,7 +55,7 @@ public class KnowledgeBookItem extends Item {
|
||||
|
||||
return InteractionResultHolder.sidedSuccess(itemStack, world.isClientSide());
|
||||
} else {
|
||||
- LOGGER.error("Tag not valid: {}", (Object)compoundTag);
|
||||
+ // Scissors - Don't throw errors into the logs if an NBT compound isn't present or is missing the Recipes tag.
|
||||
return InteractionResultHolder.fail(itemStack);
|
||||
}
|
||||
}
|
||||
diff --git a/src/main/java/org/bukkit/craftbukkit/inventory/CraftMetaKnowledgeBook.java b/src/main/java/org/bukkit/craftbukkit/inventory/CraftMetaKnowledgeBook.java
|
||||
index 50fdb086ffec84edc5138737c95f08ed4757a6f3..da312b4670fc0ac07e4ab798d4793025e362783e 100644
|
||||
--- a/src/main/java/org/bukkit/craftbukkit/inventory/CraftMetaKnowledgeBook.java
|
||||
+++ b/src/main/java/org/bukkit/craftbukkit/inventory/CraftMetaKnowledgeBook.java
|
||||
@@ -41,7 +41,11 @@ public class CraftMetaKnowledgeBook extends CraftMetaItem implements KnowledgeBo
|
||||
for (int i = 0; i < pages.size(); i++) {
|
||||
String recipe = pages.getString(i);
|
||||
|
||||
- this.addRecipe(CraftNamespacedKey.fromString(recipe));
|
||||
+ // Scissors start - Don't add recipes with invalid namespaces
|
||||
+ try {
|
||||
+ this.addRecipe(CraftNamespacedKey.fromString(recipe));
|
||||
+ } catch (Exception ignored) {}
|
||||
+ // Scissors end
|
||||
}
|
||||
}
|
||||
}
|
Reference in New Issue
Block a user