fix runtime errors

This commit is contained in:
granny
2025-01-12 23:54:16 -08:00
committed by granny
parent 5f36af52aa
commit 85b64e1d47
3 changed files with 17 additions and 14 deletions

View File

@@ -30,7 +30,7 @@ index 6a8aa33bbfbf1cd5afcd40abede3176975e8fae9..2bd5a295be2500f198230a62f48900b5
/* Drop global time updates /* Drop global time updates
if (this.tickCount % 20 == 0) { if (this.tickCount % 20 == 0) {
diff --git a/net/minecraft/server/level/ServerLevel.java b/net/minecraft/server/level/ServerLevel.java diff --git a/net/minecraft/server/level/ServerLevel.java b/net/minecraft/server/level/ServerLevel.java
index 6f1cb7b9c01111eca0e0e253dddc1ad84b2aac15..8ad8e9879ada5f7b96a2600cd7a6692fa661c67c 100644 index 345e5c7aff07544e24f2e91d71585b06392d9927..fd84a5aac26bbf2de2c2fa8bb5bc76bcbd09c3e4 100644
--- a/net/minecraft/server/level/ServerLevel.java --- a/net/minecraft/server/level/ServerLevel.java
+++ b/net/minecraft/server/level/ServerLevel.java +++ b/net/minecraft/server/level/ServerLevel.java
@@ -217,6 +217,7 @@ public class ServerLevel extends Level implements ServerEntityGetter, WorldGenLe @@ -217,6 +217,7 @@ public class ServerLevel extends Level implements ServerEntityGetter, WorldGenLe
@@ -75,10 +75,10 @@ index 4b1c9dc3f14973f9a1403d6cc407a31017f9a468..4dc6531bca6bd91d4f04e0559d21ce6b
if ((target instanceof Bucketable && target instanceof LivingEntity && origItem != null && origItem.asItem() == Items.WATER_BUCKET) && (event.isCancelled() || ServerGamePacketListenerImpl.this.player.getInventory().getSelected() == null || ServerGamePacketListenerImpl.this.player.getInventory().getSelected().getItem() != origItem)) { if ((target instanceof Bucketable && target instanceof LivingEntity && origItem != null && origItem.asItem() == Items.WATER_BUCKET) && (event.isCancelled() || ServerGamePacketListenerImpl.this.player.getInventory().getSelected() == null || ServerGamePacketListenerImpl.this.player.getInventory().getSelected().getItem() != origItem)) {
target.resendPossiblyDesyncedEntityData(ServerGamePacketListenerImpl.this.player); // Paper - The entire mob gets deleted, so resend it target.resendPossiblyDesyncedEntityData(ServerGamePacketListenerImpl.this.player); // Paper - The entire mob gets deleted, so resend it
diff --git a/net/minecraft/world/entity/Entity.java b/net/minecraft/world/entity/Entity.java diff --git a/net/minecraft/world/entity/Entity.java b/net/minecraft/world/entity/Entity.java
index 51d240167f1079239cdc99a7262fc6bc0051f0b3..250676c904f6083edd06a2284307569cd76f0694 100644 index a6fdb8bca6e8973392dc4faaed1124fc5f19e762..bc89d1401343d98381603684d5610a3b7344dcf3 100644
--- a/net/minecraft/world/entity/Entity.java --- a/net/minecraft/world/entity/Entity.java
+++ b/net/minecraft/world/entity/Entity.java +++ b/net/minecraft/world/entity/Entity.java
@@ -3156,6 +3156,13 @@ public abstract class Entity implements SyncedDataHolder, Nameable, EntityAccess @@ -3157,6 +3157,13 @@ public abstract class Entity implements SyncedDataHolder, Nameable, EntityAccess
this.passengers = ImmutableList.copyOf(list); this.passengers = ImmutableList.copyOf(list);
} }
@@ -92,7 +92,7 @@ index 51d240167f1079239cdc99a7262fc6bc0051f0b3..250676c904f6083edd06a2284307569c
this.gameEvent(GameEvent.ENTITY_MOUNT, passenger); this.gameEvent(GameEvent.ENTITY_MOUNT, passenger);
} }
} }
@@ -3197,6 +3204,14 @@ public abstract class Entity implements SyncedDataHolder, Nameable, EntityAccess @@ -3198,6 +3205,14 @@ public abstract class Entity implements SyncedDataHolder, Nameable, EntityAccess
return false; return false;
} }
// CraftBukkit end // CraftBukkit end
@@ -107,7 +107,7 @@ index 51d240167f1079239cdc99a7262fc6bc0051f0b3..250676c904f6083edd06a2284307569c
if (this.passengers.size() == 1 && this.passengers.get(0) == passenger) { if (this.passengers.size() == 1 && this.passengers.get(0) == passenger) {
this.passengers = ImmutableList.of(); this.passengers = ImmutableList.of();
} else { } else {
@@ -5120,4 +5135,44 @@ public abstract class Entity implements SyncedDataHolder, Nameable, EntityAccess @@ -5121,4 +5136,44 @@ public abstract class Entity implements SyncedDataHolder, Nameable, EntityAccess
return ((ServerLevel) this.level).isPositionEntityTicking(this.blockPosition()); return ((ServerLevel) this.level).isPositionEntityTicking(this.blockPosition());
} }
// Paper end - Expose entity id counter // Paper end - Expose entity id counter

View File

@@ -15,21 +15,21 @@
this.server = server; this.server = server;
- this.customSpawners = customSpawners; - this.customSpawners = customSpawners;
+ // Purpur start - Allow toggling special MobSpawners per world + // Purpur start - Allow toggling special MobSpawners per world
+ this.customSpawners = Lists.newArrayList(); + this.customSpawners = new ArrayList<>();
+ if (purpurConfig.phantomSpawning) { + if (purpurConfig.phantomSpawning) {
+ customSpawners.add(new net.minecraft.world.level.levelgen.PhantomSpawner()); + this.customSpawners.add(new net.minecraft.world.level.levelgen.PhantomSpawner());
+ } + }
+ if (purpurConfig.patrolSpawning) { + if (purpurConfig.patrolSpawning) {
+ customSpawners.add(new net.minecraft.world.level.levelgen.PatrolSpawner()); + this.customSpawners.add(new net.minecraft.world.level.levelgen.PatrolSpawner());
+ } + }
+ if (purpurConfig.catSpawning) { + if (purpurConfig.catSpawning) {
+ customSpawners.add(new net.minecraft.world.entity.npc.CatSpawner()); + this.customSpawners.add(new net.minecraft.world.entity.npc.CatSpawner());
+ } + }
+ if (purpurConfig.villageSiegeSpawning) { + if (purpurConfig.villageSiegeSpawning) {
+ customSpawners.add(new net.minecraft.world.entity.ai.village.VillageSiege()); + this.customSpawners.add(new net.minecraft.world.entity.ai.village.VillageSiege());
+ } + }
+ if (purpurConfig.villagerTraderSpawning) { + if (purpurConfig.villagerTraderSpawning) {
+ customSpawners.add(new net.minecraft.world.entity.npc.WanderingTraderSpawner(serverLevelData)); + this.customSpawners.add(new net.minecraft.world.entity.npc.WanderingTraderSpawner(serverLevelData));
+ } + }
+ // Purpur end - Allow toggling special MobSpawners per world + // Purpur end - Allow toggling special MobSpawners per world
this.serverLevelData = serverLevelData; this.serverLevelData = serverLevelData;

View File

@@ -21,15 +21,17 @@
public int tickCount; public int tickCount;
private int remainingFireTicks = -this.getFireImmuneTicks(); private int remainingFireTicks = -this.getFireImmuneTicks();
public boolean wasTouchingWater; public boolean wasTouchingWater;
@@ -289,7 +_,7 @@ @@ -289,8 +_,8 @@
public PortalProcessor portalProcess; public PortalProcessor portalProcess;
public int portalCooldown; public int portalCooldown;
private boolean invulnerable; private boolean invulnerable;
- protected UUID uuid = Mth.createInsecureUUID(this.random); - protected UUID uuid = Mth.createInsecureUUID(this.random);
- protected String stringUUID = this.uuid.toString();
+ protected UUID uuid; // Purpur - Add toggle for RNG manipulation + protected UUID uuid; // Purpur - Add toggle for RNG manipulation
protected String stringUUID = this.uuid.toString(); + protected String stringUUID; // Purpur - Add toggle for RNG manipulation
private boolean hasGlowingTag; private boolean hasGlowingTag;
private final Set<String> tags = new io.papermc.paper.util.SizeLimitedSet<>(new it.unimi.dsi.fastutil.objects.ObjectOpenHashSet<>(), MAX_ENTITY_TAG_COUNT); // Paper - fully limit tag size - replace set impl private final Set<String> tags = new io.papermc.paper.util.SizeLimitedSet<>(new it.unimi.dsi.fastutil.objects.ObjectOpenHashSet<>(), MAX_ENTITY_TAG_COUNT); // Paper - fully limit tag size - replace set impl
private final double[] pistonDeltas = new double[]{0.0, 0.0, 0.0};
@@ -342,6 +_,7 @@ @@ -342,6 +_,7 @@
public long activatedTick = Integer.MIN_VALUE; public long activatedTick = Integer.MIN_VALUE;
public boolean isTemporarilyActive; public boolean isTemporarilyActive;
@@ -38,7 +40,7 @@
public void inactiveTick() { public void inactiveTick() {
} }
@@ -526,10 +_,20 @@ @@ -526,10 +_,21 @@
} }
// Paper end - optimise entity tracker // Paper end - optimise entity tracker
@@ -55,6 +57,7 @@
+ // Purpur start - Add toggle for RNG manipulation + // Purpur start - Add toggle for RNG manipulation
+ this.random = level == null || level.purpurConfig.entitySharedRandom ? SHARED_RANDOM : RandomSource.create(); + this.random = level == null || level.purpurConfig.entitySharedRandom ? SHARED_RANDOM : RandomSource.create();
+ this.uuid = Mth.createInsecureUUID(this.random); + this.uuid = Mth.createInsecureUUID(this.random);
+ this.stringUUID = this.uuid.toString();
+ // Purpur end - Add toggle for RNG manipulation + // Purpur end - Add toggle for RNG manipulation
this.position = Vec3.ZERO; this.position = Vec3.ZERO;
this.blockPosition = BlockPos.ZERO; this.blockPosition = BlockPos.ZERO;