Merge pull request #4 from LunaWasFlaggedAgain/main

ItemEntity - Check if items are air before calling setItem
This commit is contained in:
Video 2022-03-13 18:28:17 -06:00 committed by GitHub
commit ac6b6f77ee
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 26 additions and 0 deletions

View File

@ -0,0 +1,26 @@
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 063f3e4c67e6716c9a03dbe4b72eafd32e4f0d53..03b8cc0ae12f17cf3a1c57958cf10ca23750b92a 100644
--- a/src/main/java/net/minecraft/world/entity/item/ItemEntity.java
+++ b/src/main/java/net/minecraft/world/entity/item/ItemEntity.java
@@ -377,11 +377,14 @@ public class ItemEntity extends Entity {
CompoundTag nbttagcompound1 = nbt.getCompound("Item");
- this.setItem(ItemStack.of(nbttagcompound1));
+ // Scissors start
if (this.getItem().isEmpty()) {
this.discard();
+ return;
}
+ this.setItem(ItemStack.of(nbttagcompound1));
+ // Scissors end
}
@Override