13
0
geforkt von Mirrors/Paper
Paper/patches/server/0984-Respect-randomizeData-on-more-entities-when-spawning.patch
Nassim Jahnke 9df2066642
Updated Upstream (Bukkit/CraftBukkit)
Upstream has released updates that appear to apply and compile correctly.
This update has not been tested by PaperMC and as with ANY update, please do your own testing

Bukkit Changes:
dfe1fb48 PR-906: Add missing MinecraftExperimental annotation to Bundles
825ab30d PR-905: Add missing MapCursor.Type and update documentation
e03d10e6 PR-903: Make BARRIER Waterlogged
1961ead6 PR-898: Use Java Consumer instead of Bukkit Consumer

CraftBukkit Changes:
f71a799f0 Make BARRIER Waterlogged
172f76a45 Upgrade specialsource-maven-plugin
f0702775c SPIGOT-7486: Alternate approach to null profile names
069495671 SPIGOT-7485: Allow air entity items since required for Vanilla logic
5dfd33dc2 SPIGOT-7484: Cancelling PlayerEditBookEvent does not update client's book contents
02d490788 PR-1250: Standardize and centralize Bukkit / Minecraft registry conversion
9024a09b9 PR-1251: Use Java Consumer instead of Bukkit Consumer
6d4b25bf1 Increase diff stability
2023-09-23 12:21:59 +10:00

62 Zeilen
3.5 KiB
Diff

From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
From: Jake Potrebic <jake.m.potrebic@gmail.com>
Date: Thu, 13 Jul 2023 16:10:07 -0700
Subject: [PATCH] Respect randomizeData on more entities when spawning
* ItemEntity
* PrimedTNT
* FireworkRocketEntity
* ExperienceOrb
diff --git a/src/main/java/org/bukkit/craftbukkit/CraftRegionAccessor.java b/src/main/java/org/bukkit/craftbukkit/CraftRegionAccessor.java
index 7673e6c8a16455366d46a64df00c97663089c2ce..1a17875426468b287c8ea3f559ea516d0218f7a0 100644
--- a/src/main/java/org/bukkit/craftbukkit/CraftRegionAccessor.java
+++ b/src/main/java/org/bukkit/craftbukkit/CraftRegionAccessor.java
@@ -604,6 +604,11 @@ public abstract class CraftRegionAccessor implements RegionAccessor {
} else if (org.bukkit.entity.Item.class.isAssignableFrom(clazz)) {
entity = new net.minecraft.world.entity.item.ItemEntity(world, x, y, z, new net.minecraft.world.item.ItemStack(net.minecraft.world.item.Items.DIRT));
// Paper end
+ // Paper start - respect randomizeData
+ if (!randomizeData) {
+ entity.setDeltaMovement(net.minecraft.world.phys.Vec3.ZERO);
+ }
+ // Paper end - respect randomizeData
} else if (FallingBlock.class.isAssignableFrom(clazz)) {
BlockPos pos = BlockPos.containing(x, y, z);
entity = new FallingBlockEntity(world, x, y, z, this.getHandle().getBlockState(pos)); // Paper
@@ -659,6 +664,14 @@ public abstract class CraftRegionAccessor implements RegionAccessor {
entity.moveTo(x, y, z, yaw, pitch);
} else if (Firework.class.isAssignableFrom(clazz)) {
entity = new FireworkRocketEntity(world, x, y, z, net.minecraft.world.item.ItemStack.EMPTY);
+ // Paper start - respect randomizeData
+ if (!randomizeData) {
+ // logic below was taken from FireworkRocketEntity constructor
+ entity.setDeltaMovement(0, 0.05, 0);
+ //noinspection PointlessArithmeticExpression
+ ((FireworkRocketEntity) entity).lifetime = 10 * 1 + 6;
+ }
+ // Paper end - respect randomizeData
}
} else if (Minecart.class.isAssignableFrom(clazz)) {
if (PoweredMinecart.class.isAssignableFrom(clazz)) {
@@ -960,8 +973,19 @@ public abstract class CraftRegionAccessor implements RegionAccessor {
}
} else if (TNTPrimed.class.isAssignableFrom(clazz)) {
entity = new PrimedTnt(world, x, y, z, null);
+ // Paper start - respect randomizeData
+ if (!randomizeData) {
+ entity.setDeltaMovement(net.minecraft.world.phys.Vec3.ZERO);
+ }
+ // Paper end - respect randomizeData
} else if (ExperienceOrb.class.isAssignableFrom(clazz)) {
entity = new net.minecraft.world.entity.ExperienceOrb(world, x, y, z, 0, org.bukkit.entity.ExperienceOrb.SpawnReason.CUSTOM, null, null); // Paper
+ // Paper start - respect randomizeData
+ if (!randomizeData) {
+ entity.setDeltaMovement(net.minecraft.world.phys.Vec3.ZERO);
+ entity.setYRot(0);
+ }
+ // Paper end - respect randomizeData
} else if (LightningStrike.class.isAssignableFrom(clazz)) {
entity = net.minecraft.world.entity.EntityType.LIGHTNING_BOLT.create(world);
entity.moveTo(location.getX(), location.getY(), location.getZ());