Skip to content

Commit

Permalink
fix runtime errors
Browse files Browse the repository at this point in the history
  • Loading branch information
granny committed Jan 13, 2025
1 parent dc0bf0c commit e547298
Show file tree
Hide file tree
Showing 3 changed files with 17 additions and 14 deletions.
10 changes: 5 additions & 5 deletions purpur-server/minecraft-patches/features/0001-Ridables.patch
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@ index 6a8aa33bbfbf1cd5afcd40abede3176975e8fae9..2bd5a295be2500f198230a62f48900b5
/* Drop global time updates
if (this.tickCount % 20 == 0) {
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
+++ b/net/minecraft/server/level/ServerLevel.java
@@ -217,6 +217,7 @@ public class ServerLevel extends Level implements ServerEntityGetter, WorldGenLe
Expand Down Expand Up @@ -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)) {
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
index 51d240167f1079239cdc99a7262fc6bc0051f0b3..250676c904f6083edd06a2284307569cd76f0694 100644
index a6fdb8bca6e8973392dc4faaed1124fc5f19e762..bc89d1401343d98381603684d5610a3b7344dcf3 100644
--- a/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);
}

Expand All @@ -92,7 +92,7 @@ index 51d240167f1079239cdc99a7262fc6bc0051f0b3..250676c904f6083edd06a2284307569c
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;
}
// CraftBukkit end
Expand All @@ -107,7 +107,7 @@ index 51d240167f1079239cdc99a7262fc6bc0051f0b3..250676c904f6083edd06a2284307569c
if (this.passengers.size() == 1 && this.passengers.get(0) == passenger) {
this.passengers = ImmutableList.of();
} 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());
}
// Paper end - Expose entity id counter
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -15,21 +15,21 @@
this.server = server;
- this.customSpawners = customSpawners;
+ // Purpur start - Allow toggling special MobSpawners per world
+ this.customSpawners = Lists.newArrayList();
+ this.customSpawners = new ArrayList<>();
+ 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) {
+ customSpawners.add(new net.minecraft.world.level.levelgen.PatrolSpawner());
+ this.customSpawners.add(new net.minecraft.world.level.levelgen.PatrolSpawner());
+ }
+ 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) {
+ customSpawners.add(new net.minecraft.world.entity.ai.village.VillageSiege());
+ this.customSpawners.add(new net.minecraft.world.entity.ai.village.VillageSiege());
+ }
+ 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
this.serverLevelData = serverLevelData;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -21,15 +21,17 @@
public int tickCount;
private int remainingFireTicks = -this.getFireImmuneTicks();
public boolean wasTouchingWater;
@@ -289,7 +_,7 @@
@@ -289,8 +_,8 @@
public PortalProcessor portalProcess;
public int portalCooldown;
private boolean invulnerable;
- protected UUID uuid = Mth.createInsecureUUID(this.random);
- protected String stringUUID = this.uuid.toString();
+ 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 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 @@
public long activatedTick = Integer.MIN_VALUE;
public boolean isTemporarilyActive;
Expand All @@ -38,7 +40,7 @@

public void inactiveTick() {
}
@@ -526,10 +_,20 @@
@@ -526,10 +_,21 @@
}
// Paper end - optimise entity tracker

Expand All @@ -55,6 +57,7 @@
+ // Purpur start - Add toggle for RNG manipulation
+ this.random = level == null || level.purpurConfig.entitySharedRandom ? SHARED_RANDOM : RandomSource.create();
+ this.uuid = Mth.createInsecureUUID(this.random);
+ this.stringUUID = this.uuid.toString();
+ // Purpur end - Add toggle for RNG manipulation
this.position = Vec3.ZERO;
this.blockPosition = BlockPos.ZERO;
Expand Down

0 comments on commit e547298

Please sign in to comment.