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

@@ -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;

View File

@@ -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;
@@ -38,7 +40,7 @@
public void inactiveTick() {
}
@@ -526,10 +_,20 @@
@@ -526,10 +_,21 @@
}
// Paper end - optimise entity tracker
@@ -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;