Fix tests

This commit is contained in:
Nassim Jahnke 2024-12-16 11:54:00 +01:00
parent 520ab93fbf
commit 6a0c3c3efc
No known key found for this signature in database
GPG key ID: EF6771C01F6EF02F
4 changed files with 36 additions and 0 deletions

View file

@ -0,0 +1,11 @@
--- a/net/minecraft/gametest/framework/GameTestInfo.java
+++ b/net/minecraft/gametest/framework/GameTestInfo.java
@@ -241,7 +_,7 @@
AABB structureBounds = this.getStructureBounds();
List<Entity> entitiesOfClass = this.getLevel()
.getEntitiesOfClass(Entity.class, structureBounds.inflate(1.0), entity -> !(entity instanceof Player));
- entitiesOfClass.forEach(entity -> entity.remove(Entity.RemovalReason.DISCARDED));
+ entitiesOfClass.forEach(entity -> entity.remove(Entity.RemovalReason.DISCARDED, org.bukkit.event.entity.EntityRemoveEvent.Cause.DISCARD)); // Paper
}
}

View file

@ -0,0 +1,11 @@
--- a/net/minecraft/gametest/framework/StructureUtils.java
+++ b/net/minecraft/gametest/framework/StructureUtils.java
@@ -187,7 +_,7 @@
level.clearBlockEvents(boundingBox1);
AABB aabb = AABB.of(boundingBox1);
List<Entity> entitiesOfClass = level.getEntitiesOfClass(Entity.class, aabb, entity -> !(entity instanceof Player));
- entitiesOfClass.forEach(Entity::discard);
+ entitiesOfClass.forEach(entity -> entity.discard(org.bukkit.event.entity.EntityRemoveEvent.Cause.DISCARD)); // Paper
}
public static BlockPos getTransformedFarCorner(BlockPos pos, Vec3i offset, Rotation rotation) {

View file

@ -0,0 +1,11 @@
--- a/net/minecraft/gametest/framework/TestCommand.java
+++ b/net/minecraft/gametest/framework/TestCommand.java
@@ -278,7 +_,7 @@
}
private static int resetGameTestInfo(GameTestInfo gameTestInfo) {
- gameTestInfo.getLevel().getEntities(null, gameTestInfo.getStructureBounds()).stream().forEach(entity -> entity.remove(Entity.RemovalReason.DISCARDED));
+ gameTestInfo.getLevel().getEntities(null, gameTestInfo.getStructureBounds()).stream().forEach(entity -> entity.remove(Entity.RemovalReason.DISCARDED, org.bukkit.event.entity.EntityRemoveEvent.Cause.DISCARD)); // Paper
gameTestInfo.getStructureBlockEntity().placeStructure(gameTestInfo.getLevel());
StructureUtils.removeBarriers(gameTestInfo.getStructureBounds(), gameTestInfo.getLevel());
say(gameTestInfo.getLevel(), "Reset succeded for: " + gameTestInfo.getTestName(), ChatFormatting.GREEN);

View file

@ -103,6 +103,9 @@ public class EntityRemoveEventTest {
} }
Class<?> ownerClass = Class.forName(owner.replace('/', '.'), false, this.getClass().getClassLoader()); Class<?> ownerClass = Class.forName(owner.replace('/', '.'), false, this.getClass().getClassLoader());
if (ownerClass == EntityAccess.class) {
return false;
}
// Found missing discard, remove or setRemoved method call // Found missing discard, remove or setRemoved method call
return EntityAccess.class.isAssignableFrom(ownerClass); return EntityAccess.class.isAssignableFrom(ownerClass);