* work * work * more work * complete configuration base * More work * more work * Configurable cave lava sea level, Fix MC-237017 * more more more work * Updated Upstream (Paper, Pufferfish, Purpur) * Rework, again * Cleanup workflows, fix build * typo * more work * more work - Updated Upstream (Paper) - [CI-Skip] Update Upstream CacheData (Pufferfish, Purpur) - Update Dependencies (Paperweight) - Fix build - Update Wrapper * more works * more more works * Fix build * Fix test * Implemented FixMySpawnR, Added more config optimize * Fix build
334 lines
24 KiB
Diff
334 lines
24 KiB
Diff
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
|
|
From: AlphaKR93 <dev@alpha93.kr>
|
|
Date: Wed, 27 Sep 2023 21:18:22 +0900
|
|
Subject: [PATCH] Reduce create random instance
|
|
|
|
|
|
diff --git a/src/main/java/net/minecraft/server/MinecraftServer.java b/src/main/java/net/minecraft/server/MinecraftServer.java
|
|
index 6ca87960654becdc7fd7d9b8465a140c0db2b8b9..cda99102949ae9d722c347e0dd610dfff625b5b8 100644
|
|
--- a/src/main/java/net/minecraft/server/MinecraftServer.java
|
|
+++ b/src/main/java/net/minecraft/server/MinecraftServer.java
|
|
@@ -228,7 +228,7 @@ public abstract class MinecraftServer extends ReentrantBlockableEventLoop<TickTa
|
|
private ServerStatus status;
|
|
@Nullable
|
|
private ServerStatus.Favicon statusIcon;
|
|
- private final RandomSource random;
|
|
+ private final RandomSource random; public RandomSource random() { return this.random; } // Plazma - expose random
|
|
public final DataFixer fixerUpper;
|
|
private String localIp;
|
|
private int port;
|
|
diff --git a/src/main/java/net/minecraft/server/commands/SpreadPlayersCommand.java b/src/main/java/net/minecraft/server/commands/SpreadPlayersCommand.java
|
|
index f5bc3497831877e0c2b7dc1cbd8abe3a67d7695b..e27867a95d49531507de63be09604d476a0e43e5 100644
|
|
--- a/src/main/java/net/minecraft/server/commands/SpreadPlayersCommand.java
|
|
+++ b/src/main/java/net/minecraft/server/commands/SpreadPlayersCommand.java
|
|
@@ -65,7 +65,7 @@ public class SpreadPlayersCommand {
|
|
if (maxY < j) {
|
|
throw SpreadPlayersCommand.ERROR_INVALID_MAX_HEIGHT.create(maxY, j);
|
|
} else {
|
|
- RandomSource randomsource = RandomSource.create();
|
|
+ RandomSource randomsource = worldserver.plazmaConfig().misc.reduceRandom ? worldserver.getRandom() : RandomSource.create(); // Plazma - Reduce create random instance
|
|
double d0 = (double) (center.x - maxRange);
|
|
double d1 = (double) (center.y - maxRange);
|
|
double d2 = (double) (center.x + maxRange);
|
|
diff --git a/src/main/java/net/minecraft/server/level/ServerPlayer.java b/src/main/java/net/minecraft/server/level/ServerPlayer.java
|
|
index 7b72be8dcaf3fc5c7151c847faa2dfc75ef9eeb7..9a818c8f1450d31d29fd72cda45a14eec9034615 100644
|
|
--- a/src/main/java/net/minecraft/server/level/ServerPlayer.java
|
|
+++ b/src/main/java/net/minecraft/server/level/ServerPlayer.java
|
|
@@ -449,7 +449,7 @@ public class ServerPlayer extends Player {
|
|
long l = k * k;
|
|
int i1 = l > 2147483647L ? Integer.MAX_VALUE : (int) l;
|
|
int j1 = this.getCoprime(i1);
|
|
- int k1 = RandomSource.create().nextInt(i1);
|
|
+ int k1 = (worldserver.plazmaConfig().misc.reduceRandom ? worldserver.getRandom() : RandomSource.create()).nextInt(i1); // Plazma - Reduce create random instance
|
|
|
|
for (int l1 = 0; l1 < i1; ++l1) {
|
|
int i2 = (k1 + j1 * l1) % i1;
|
|
@@ -486,7 +486,7 @@ public class ServerPlayer extends Player {
|
|
long l = k * k;
|
|
int i1 = l > 2147483647L ? Integer.MAX_VALUE : (int) l;
|
|
int j1 = this.getCoprime(i1);
|
|
- int k1 = RandomSource.create().nextInt(i1);
|
|
+ int k1 = (world.plazmaConfig().misc.reduceRandom ? world.getRandom() : RandomSource.create()).nextInt(i1); // Plazma - Reduce create random instance
|
|
|
|
for (int l1 = 0; l1 < i1; ++l1) {
|
|
int i2 = (k1 + j1 * l1) % i1;
|
|
diff --git a/src/main/java/net/minecraft/server/network/ServerLoginPacketListenerImpl.java b/src/main/java/net/minecraft/server/network/ServerLoginPacketListenerImpl.java
|
|
index dd707019fb9b2c46d706311862fea91b84793ff9..05ef30ecdb68d1d254246431e7d5cecf9a38427e 100644
|
|
--- a/src/main/java/net/minecraft/server/network/ServerLoginPacketListenerImpl.java
|
|
+++ b/src/main/java/net/minecraft/server/network/ServerLoginPacketListenerImpl.java
|
|
@@ -70,7 +70,7 @@ public class ServerLoginPacketListenerImpl implements ServerLoginPacketListener,
|
|
this.serverId = "";
|
|
this.server = server;
|
|
this.connection = connection;
|
|
- this.challenge = Ints.toByteArray(RandomSource.create().nextInt());
|
|
+ this.challenge = Ints.toByteArray((org.plazmamc.plazma.configurations.GlobalConfiguration.get().misc.reduceRandom ? server.random() : RandomSource.create()).nextInt()); // Plazma - Reduce create random instance
|
|
}
|
|
|
|
@Override
|
|
diff --git a/src/main/java/net/minecraft/server/rcon/thread/QueryThreadGs4.java b/src/main/java/net/minecraft/server/rcon/thread/QueryThreadGs4.java
|
|
index 1ef089dbf83de35d875c00efdf468c397be56978..832c3fa9f6f6706c48d5744e15d3c748edafe8a4 100644
|
|
--- a/src/main/java/net/minecraft/server/rcon/thread/QueryThreadGs4.java
|
|
+++ b/src/main/java/net/minecraft/server/rcon/thread/QueryThreadGs4.java
|
|
@@ -349,7 +349,7 @@ public class QueryThreadGs4 extends GenericThread {
|
|
this.identBytes[2] = bs[5];
|
|
this.identBytes[3] = bs[6];
|
|
this.ident = new String(this.identBytes, StandardCharsets.UTF_8);
|
|
- this.challenge = RandomSource.create().nextInt(16777216);
|
|
+ this.challenge = (org.plazmamc.plazma.configurations.GlobalConfiguration.get().misc.reduceRandom ? net.minecraft.server.MinecraftServer.getServer().random() : RandomSource.create()).nextInt(16777216); // Plazma - Reduce create random instance
|
|
this.challengeBytes = String.format(Locale.ROOT, "\t%s%d\u0000", this.ident, this.challenge).getBytes(StandardCharsets.UTF_8);
|
|
}
|
|
|
|
diff --git a/src/main/java/net/minecraft/world/entity/ai/behavior/ShufflingList.java b/src/main/java/net/minecraft/world/entity/ai/behavior/ShufflingList.java
|
|
index fe3ab3d388f0481fb0db06b7f730f868dbf8e8a5..57d4eec19146f2ec36c8f99a4c77f2a20aa7cd09 100644
|
|
--- a/src/main/java/net/minecraft/world/entity/ai/behavior/ShufflingList.java
|
|
+++ b/src/main/java/net/minecraft/world/entity/ai/behavior/ShufflingList.java
|
|
@@ -15,7 +15,7 @@ import net.minecraft.util.RandomSource;
|
|
|
|
public class ShufflingList<U> implements Iterable<U> {
|
|
public final List<ShufflingList.WeightedEntry<U>> entries; // Paper - public
|
|
- private final RandomSource random = RandomSource.create();
|
|
+ private final RandomSource random = org.plazmamc.plazma.configurations.GlobalConfiguration.get().misc.reduceRandom ? net.minecraft.server.MinecraftServer.getServer().random() : RandomSource.create(); // Plazma
|
|
private final boolean isUnsafe; // Paper
|
|
|
|
public ShufflingList() {
|
|
diff --git a/src/main/java/net/minecraft/world/entity/ai/sensing/Sensor.java b/src/main/java/net/minecraft/world/entity/ai/sensing/Sensor.java
|
|
index 7094701d213c73ba47ace806962244c10fdf4dda..590c26307374edd65a2e22de18d12f34addcef64 100644
|
|
--- a/src/main/java/net/minecraft/world/entity/ai/sensing/Sensor.java
|
|
+++ b/src/main/java/net/minecraft/world/entity/ai/sensing/Sensor.java
|
|
@@ -8,7 +8,7 @@ import net.minecraft.world.entity.ai.memory.MemoryModuleType;
|
|
import net.minecraft.world.entity.ai.targeting.TargetingConditions;
|
|
|
|
public abstract class Sensor<E extends LivingEntity> {
|
|
- private static final RandomSource RANDOM = RandomSource.createThreadSafe();
|
|
+ private static final RandomSource RANDOM = org.plazmamc.plazma.configurations.GlobalConfiguration.get().misc.reduceRandom && org.plazmamc.plazma.configurations.GlobalConfiguration.get().misc.ignoreThreadSafeRandom ? net.minecraft.server.MinecraftServer.getServer().random() : RandomSource.createThreadSafe(); // Plazma - Reduce create random instance
|
|
private static final int DEFAULT_SCAN_RATE = 20;
|
|
protected static final int TARGETING_RANGE = 16;
|
|
private static final TargetingConditions TARGET_CONDITIONS = TargetingConditions.forNonCombat().range(16.0D);
|
|
diff --git a/src/main/java/net/minecraft/world/entity/monster/warden/AngerManagement.java b/src/main/java/net/minecraft/world/entity/monster/warden/AngerManagement.java
|
|
index ece82743df21f0b776382821ad75dee96d0a0748..44db438185d1ffb1adea09ba5f1cf4515a113700 100644
|
|
--- a/src/main/java/net/minecraft/world/entity/monster/warden/AngerManagement.java
|
|
+++ b/src/main/java/net/minecraft/world/entity/monster/warden/AngerManagement.java
|
|
@@ -32,7 +32,7 @@ public class AngerManagement {
|
|
@VisibleForTesting
|
|
protected static final int MAX_ANGER = 150;
|
|
private static final int DEFAULT_ANGER_DECREASE = 1;
|
|
- private int conversionDelay = Mth.randomBetweenInclusive(RandomSource.create(), 0, 2);
|
|
+ private int conversionDelay = Mth.randomBetweenInclusive((org.plazmamc.plazma.configurations.GlobalConfiguration.get().misc.reduceRandom ? net.minecraft.server.MinecraftServer.getServer().random() : RandomSource.create()), 0, 2); // Plazma - Reduce create random instance
|
|
int highestAnger;
|
|
private static final Codec<Pair<UUID, Integer>> SUSPECT_ANGER_PAIR = RecordCodecBuilder.create((instance) -> {
|
|
return instance.group(UUIDUtil.CODEC.fieldOf("uuid").forGetter(Pair::getFirst), ExtraCodecs.NON_NEGATIVE_INT.fieldOf("anger").forGetter(Pair::getSecond)).apply(instance, Pair::of);
|
|
diff --git a/src/main/java/net/minecraft/world/entity/npc/WanderingTraderSpawner.java b/src/main/java/net/minecraft/world/entity/npc/WanderingTraderSpawner.java
|
|
index a5443f92786427c42092aec8350e7ab37704db7a..0383c9e75a12c5832cf69daf14b8037365c43cfb 100644
|
|
--- a/src/main/java/net/minecraft/world/entity/npc/WanderingTraderSpawner.java
|
|
+++ b/src/main/java/net/minecraft/world/entity/npc/WanderingTraderSpawner.java
|
|
@@ -32,7 +32,7 @@ public class WanderingTraderSpawner implements CustomSpawner {
|
|
private static final int SPAWN_CHANCE_INCREASE = 25;
|
|
private static final int SPAWN_ONE_IN_X_CHANCE = 10;
|
|
private static final int NUMBER_OF_SPAWN_ATTEMPTS = 10;
|
|
- private final RandomSource random = RandomSource.create();
|
|
+ private final RandomSource random = org.plazmamc.plazma.configurations.GlobalConfiguration.get().misc.reduceRandom ? net.minecraft.server.MinecraftServer.getServer().random() : RandomSource.create(); // Plazma - reduce create random instace
|
|
private final ServerLevelData serverLevelData;
|
|
private int tickDelay;
|
|
private int spawnDelay;
|
|
diff --git a/src/main/java/net/minecraft/world/entity/projectile/FishingHook.java b/src/main/java/net/minecraft/world/entity/projectile/FishingHook.java
|
|
index a2093158e57d5f43c4afa66386481b82b3c4c3c4..2b75115caf82b9c4ccdd813b98af569e80ac2629 100644
|
|
--- a/src/main/java/net/minecraft/world/entity/projectile/FishingHook.java
|
|
+++ b/src/main/java/net/minecraft/world/entity/projectile/FishingHook.java
|
|
@@ -86,7 +86,7 @@ public class FishingHook extends Projectile {
|
|
|
|
private FishingHook(EntityType<? extends FishingHook> type, Level world, int luckOfTheSeaLevel, int lureLevel) {
|
|
super(type, world);
|
|
- this.syncronizedRandom = RandomSource.create();
|
|
+ this.syncronizedRandom = world.plazmaConfig().misc.reduceRandom ? world.getRandom() : RandomSource.create(); // Plazma - Reduce create random instance
|
|
this.openWater = true;
|
|
this.currentState = FishingHook.FishHookState.FLYING;
|
|
this.noCulling = true;
|
|
diff --git a/src/main/java/net/minecraft/world/entity/raid/Raid.java b/src/main/java/net/minecraft/world/entity/raid/Raid.java
|
|
index eaa2943b667967f93f28d9d794d702fdaeb670ec..689a4ee7b3f136b14e8e56709cac7d2da89c8efd 100644
|
|
--- a/src/main/java/net/minecraft/world/entity/raid/Raid.java
|
|
+++ b/src/main/java/net/minecraft/world/entity/raid/Raid.java
|
|
@@ -109,7 +109,7 @@ public class Raid {
|
|
|
|
public Raid(int id, ServerLevel world, BlockPos pos) {
|
|
this.raidEvent = new ServerBossEvent(Raid.RAID_NAME_COMPONENT, BossEvent.BossBarColor.RED, BossEvent.BossBarOverlay.NOTCHED_10);
|
|
- this.random = RandomSource.create();
|
|
+ this.random = world.plazmaConfig().misc.reduceRandom ? world.getRandom() : RandomSource.create(); // Plazma - Reduce create random instace
|
|
this.waveSpawnPos = Optional.empty();
|
|
this.id = id;
|
|
this.level = world;
|
|
@@ -123,7 +123,7 @@ public class Raid {
|
|
|
|
public Raid(ServerLevel world, CompoundTag nbt) {
|
|
this.raidEvent = new ServerBossEvent(Raid.RAID_NAME_COMPONENT, BossEvent.BossBarColor.RED, BossEvent.BossBarOverlay.NOTCHED_10);
|
|
- this.random = RandomSource.create();
|
|
+ this.random = world.plazmaConfig().misc.reduceRandom ? world.getRandom() : RandomSource.create(); // Plazma - Reduce create random instace
|
|
this.waveSpawnPos = Optional.empty();
|
|
this.level = world;
|
|
this.id = nbt.getInt("Id");
|
|
diff --git a/src/main/java/net/minecraft/world/inventory/EnchantmentMenu.java b/src/main/java/net/minecraft/world/inventory/EnchantmentMenu.java
|
|
index d604b7ec46f08993647979ed220a84842e3fe325..b0b6580a08b15dbfc542ee1fd9e5b6737f8af004 100644
|
|
--- a/src/main/java/net/minecraft/world/inventory/EnchantmentMenu.java
|
|
+++ b/src/main/java/net/minecraft/world/inventory/EnchantmentMenu.java
|
|
@@ -97,7 +97,7 @@ public class EnchantmentMenu extends AbstractContainerMenu {
|
|
}
|
|
// Purpur end
|
|
};
|
|
- this.random = RandomSource.create();
|
|
+ this.random = playerInventory.player.level().plazmaConfig().misc.reduceRandom ? playerInventory.player.level().random : RandomSource.create(); // Plazma - Reduce create random instace
|
|
this.enchantmentSeed = DataSlot.standalone();
|
|
this.costs = new int[3];
|
|
this.enchantClue = new int[]{-1, -1, -1};
|
|
diff --git a/src/main/java/net/minecraft/world/level/Explosion.java b/src/main/java/net/minecraft/world/level/Explosion.java
|
|
index ef9b1687dd2dfda5398523140aecc678b4690642..130a41387a2546b31019ad918849b2c283ed09d9 100644
|
|
--- a/src/main/java/net/minecraft/world/level/Explosion.java
|
|
+++ b/src/main/java/net/minecraft/world/level/Explosion.java
|
|
@@ -82,7 +82,7 @@ public class Explosion {
|
|
}
|
|
|
|
public Explosion(Level world, @Nullable Entity entity, @Nullable DamageSource damageSource, @Nullable ExplosionDamageCalculator behavior, double x, double y, double z, float power, boolean createFire, Explosion.BlockInteraction destructionType) {
|
|
- this.random = RandomSource.create();
|
|
+ this.random = world.plazmaConfig().misc.reduceRandom ? world.getRandom() : RandomSource.create(); // Plazma - Reduce create random instace
|
|
this.toBlow = new ObjectArrayList();
|
|
this.hitPlayers = Maps.newHashMap();
|
|
this.level = world;
|
|
diff --git a/src/main/java/net/minecraft/world/level/Level.java b/src/main/java/net/minecraft/world/level/Level.java
|
|
index 412dd103bad498c3c93b7a3ab98f834944d514eb..7a7f417c2a0af73a35297274b8ddd6ac581901ae 100644
|
|
--- a/src/main/java/net/minecraft/world/level/Level.java
|
|
+++ b/src/main/java/net/minecraft/world/level/Level.java
|
|
@@ -124,16 +124,16 @@ public abstract class Level implements LevelAccessor, AutoCloseable {
|
|
public final Thread thread;
|
|
private final boolean isDebug;
|
|
private int skyDarken;
|
|
- protected int randValue = RandomSource.create().nextInt();
|
|
protected final int addend = 1013904223;
|
|
protected float oRainLevel;
|
|
public float rainLevel;
|
|
protected float oThunderLevel;
|
|
public float thunderLevel;
|
|
public final RandomSource random = RandomSource.create();
|
|
+ protected int randValue = org.plazmamc.plazma.configurations.GlobalConfiguration.get().misc.reduceRandom ? random.nextInt() : RandomSource.create().nextInt(); // Plazma - Reduce create random instace
|
|
/** @deprecated */
|
|
@Deprecated
|
|
- private final RandomSource threadSafeRandom = RandomSource.createThreadSafe();
|
|
+ private final RandomSource threadSafeRandom = org.plazmamc.plazma.configurations.GlobalConfiguration.get().misc.ignoreThreadSafeRandom ? random : RandomSource.createThreadSafe(); // Plazma - Reduce create random instace
|
|
private final ResourceKey<DimensionType> dimensionTypeId;
|
|
private final Holder<DimensionType> dimensionTypeRegistration;
|
|
public final WritableLevelData levelData;
|
|
diff --git a/src/main/java/net/minecraft/world/level/block/entity/EnchantmentTableBlockEntity.java b/src/main/java/net/minecraft/world/level/block/entity/EnchantmentTableBlockEntity.java
|
|
index b7370e64fd0d50e8725d7d5afc30af2e8bc8455d..9ec2a60c8240f7a3e4cd7944d070156dbf55ac2c 100644
|
|
--- a/src/main/java/net/minecraft/world/level/block/entity/EnchantmentTableBlockEntity.java
|
|
+++ b/src/main/java/net/minecraft/world/level/block/entity/EnchantmentTableBlockEntity.java
|
|
@@ -22,7 +22,7 @@ public class EnchantmentTableBlockEntity extends BlockEntity implements Nameable
|
|
public float rot;
|
|
public float oRot;
|
|
public float tRot;
|
|
- private static final RandomSource RANDOM = RandomSource.create();
|
|
+ private static final RandomSource RANDOM = org.plazmamc.plazma.configurations.GlobalConfiguration.get().misc.reduceRandom ? net.minecraft.server.MinecraftServer.getServer().random() : RandomSource.create(); // Plazma - Reduce create random instace
|
|
private Component name;
|
|
private int lapis = 0; // Purpur
|
|
|
|
diff --git a/src/main/java/net/minecraft/world/level/block/entity/TheEndGatewayBlockEntity.java b/src/main/java/net/minecraft/world/level/block/entity/TheEndGatewayBlockEntity.java
|
|
index 7291e4056b8e46ab59b71818388ac55fbb12993f..b847f59c5d3e0d7ccb22eaa5d9068082db5ba9a4 100644
|
|
--- a/src/main/java/net/minecraft/world/level/block/entity/TheEndGatewayBlockEntity.java
|
|
+++ b/src/main/java/net/minecraft/world/level/block/entity/TheEndGatewayBlockEntity.java
|
|
@@ -368,7 +368,7 @@ public class TheEndGatewayBlockEntity extends TheEndPortalBlockEntity {
|
|
}
|
|
|
|
private static void spawnGatewayPortal(ServerLevel world, BlockPos pos, EndGatewayConfiguration config) {
|
|
- Feature.END_GATEWAY.place(config, world, world.getChunkSource().getGenerator(), RandomSource.create(), pos);
|
|
+ Feature.END_GATEWAY.place(config, world, world.getChunkSource().getGenerator(), (world.plazmaConfig().misc.reduceRandom ? world.getRandom() : RandomSource.create()), pos); // Plazma - Reduce create random instance
|
|
}
|
|
|
|
@Override
|
|
diff --git a/src/main/java/net/minecraft/world/level/chunk/ChunkGeneratorStructureState.java b/src/main/java/net/minecraft/world/level/chunk/ChunkGeneratorStructureState.java
|
|
index f8cd23fb6ea7909b8f30bd21d3f2c7bcc483ef21..3a4044271e23faf4c5271237aba700103f6df830 100644
|
|
--- a/src/main/java/net/minecraft/world/level/chunk/ChunkGeneratorStructureState.java
|
|
+++ b/src/main/java/net/minecraft/world/level/chunk/ChunkGeneratorStructureState.java
|
|
@@ -221,7 +221,7 @@ public class ChunkGeneratorStructureState {
|
|
List<CompletableFuture<ChunkPos>> list = new ArrayList(j);
|
|
int k = placement.spread();
|
|
HolderSet<Biome> holderset = placement.preferredBiomes();
|
|
- RandomSource randomsource = RandomSource.create();
|
|
+ RandomSource randomsource = org.plazmamc.plazma.configurations.GlobalConfiguration.get().misc.reduceRandom ? net.minecraft.server.MinecraftServer.getServer().random() : RandomSource.create(); // Plazma - Reduce create random instace
|
|
|
|
// Paper start
|
|
if (this.conf.strongholdSeed != null && structureSetEntry.is(net.minecraft.world.level.levelgen.structure.BuiltinStructureSets.STRONGHOLDS)) {
|
|
diff --git a/src/main/java/net/minecraft/world/level/dimension/end/DragonRespawnAnimation.java b/src/main/java/net/minecraft/world/level/dimension/end/DragonRespawnAnimation.java
|
|
index 18fce94f0d4b9d28e3afec61c7578f672973a71f..c98d65c146213bdf530916b8ec371e0b0b8f23e7 100644
|
|
--- a/src/main/java/net/minecraft/world/level/dimension/end/DragonRespawnAnimation.java
|
|
+++ b/src/main/java/net/minecraft/world/level/dimension/end/DragonRespawnAnimation.java
|
|
@@ -62,7 +62,7 @@ public enum DragonRespawnAnimation {
|
|
|
|
world.explode((Entity)null, (double)((float)endSpike.getCenterX() + 0.5F), (double)endSpike.getHeight(), (double)((float)endSpike.getCenterZ() + 0.5F), 5.0F, Level.ExplosionInteraction.BLOCK);
|
|
SpikeConfiguration spikeConfiguration = new SpikeConfiguration(true, ImmutableList.of(endSpike), new BlockPos(0, 128, 0));
|
|
- Feature.END_SPIKE.place(spikeConfiguration, world, world.getChunkSource().getGenerator(), RandomSource.create(), new BlockPos(endSpike.getCenterX(), 45, endSpike.getCenterZ()));
|
|
+ Feature.END_SPIKE.place(spikeConfiguration, world, world.getChunkSource().getGenerator(), (world.plazmaConfig().misc.reduceRandom ? world.getRandom() : RandomSource.create()), new BlockPos(endSpike.getCenterX(), 45, endSpike.getCenterZ())); // Plazma - Reduce create random instance
|
|
}
|
|
} else if (bl) {
|
|
fight.setRespawnStage(SUMMONING_DRAGON);
|
|
diff --git a/src/main/java/net/minecraft/world/level/dimension/end/EndDragonFight.java b/src/main/java/net/minecraft/world/level/dimension/end/EndDragonFight.java
|
|
index c1ff2e15bc5da1a642872ac0fdcdc457e8abb063..c8b29f79725bb9ccec5b48476e242609a452402c 100644
|
|
--- a/src/main/java/net/minecraft/world/level/dimension/end/EndDragonFight.java
|
|
+++ b/src/main/java/net/minecraft/world/level/dimension/end/EndDragonFight.java
|
|
@@ -472,7 +472,7 @@ public class EndDragonFight {
|
|
this.level.registryAccess().registry(Registries.CONFIGURED_FEATURE).flatMap((iregistry) -> {
|
|
return iregistry.getHolder(EndFeatures.END_GATEWAY_DELAYED);
|
|
}).ifPresent((holder_c) -> {
|
|
- ((ConfiguredFeature) holder_c.value()).place(this.level, this.level.getChunkSource().getGenerator(), RandomSource.create(), pos);
|
|
+ ((ConfiguredFeature) holder_c.value()).place(this.level, this.level.getChunkSource().getGenerator(), (this.level.plazmaConfig().misc.reduceRandom ? this.level.getRandom() : RandomSource.create()), pos); // Plazma - Reduce create random instace
|
|
});
|
|
}
|
|
|
|
@@ -490,7 +490,7 @@ public class EndDragonFight {
|
|
this.portalLocation = this.portalLocation.atY(this.level.getMinBuildHeight() + 1);
|
|
}
|
|
// Paper end
|
|
- if (worldgenendtrophy.place(FeatureConfiguration.NONE, this.level, this.level.getChunkSource().getGenerator(), RandomSource.create(), this.portalLocation)) {
|
|
+ if (worldgenendtrophy.place(FeatureConfiguration.NONE, this.level, this.level.getChunkSource().getGenerator(), (this.level.plazmaConfig().misc.reduceRandom ? this.level.getRandom() : RandomSource.create()), this.portalLocation)) { // Plazma - Reduce create random instace
|
|
int i = Mth.positiveCeilDiv(4, 16);
|
|
|
|
this.level.getChunkSource().chunkMap.waitForLightBeforeSending(new ChunkPos(this.portalLocation), i);
|
|
diff --git a/src/main/java/org/bukkit/craftbukkit/entity/CraftFirework.java b/src/main/java/org/bukkit/craftbukkit/entity/CraftFirework.java
|
|
index c13cdbaf7abdf120a3969f8e887b4c3b78989c9c..5bb9bfbad85a115bf32955c2abc89edc2e7a6e43 100644
|
|
--- a/src/main/java/org/bukkit/craftbukkit/entity/CraftFirework.java
|
|
+++ b/src/main/java/org/bukkit/craftbukkit/entity/CraftFirework.java
|
|
@@ -14,11 +14,12 @@ import org.bukkit.inventory.meta.FireworkMeta;
|
|
|
|
public class CraftFirework extends CraftProjectile implements Firework {
|
|
|
|
- private final Random random = new Random();
|
|
+ private final net.minecraft.util.RandomSource random; // Plazma - Reduce create random instance
|
|
//private CraftItemStack item; // Paper - Remove usage, not accurate representation of current item.
|
|
|
|
public CraftFirework(CraftServer server, FireworkRocketEntity entity) {
|
|
super(server, entity);
|
|
+ this.random = this.getHandle().level().plazmaConfig().misc.reduceRandom ? this.getHandle().level().getRandom() : net.minecraft.util.RandomSource.create(); // Plazma - Reduce create random instance
|
|
|
|
// Paper Start - Expose firework item directly
|
|
// ItemStack item = this.getHandle().getEntityData().get(FireworkRocketEntity.DATA_ID_FIREWORKS_ITEM);
|
|
diff --git a/src/main/java/org/plazmamc/plazma/configurations/GlobalConfiguration.java b/src/main/java/org/plazmamc/plazma/configurations/GlobalConfiguration.java
|
|
index c85f1a01c951f85c2347eba18a896e87c4c8b368..d88208cb454d1042440803c817d99c5dcb775330 100644
|
|
--- a/src/main/java/org/plazmamc/plazma/configurations/GlobalConfiguration.java
|
|
+++ b/src/main/java/org/plazmamc/plazma/configurations/GlobalConfiguration.java
|
|
@@ -40,6 +40,8 @@ public class GlobalConfiguration extends ConfigurationPart {
|
|
public Miscellaneous misc;
|
|
public class Miscellaneous extends ConfigurationPart {
|
|
|
|
+ public boolean reduceRandom = OPTIMIZE;
|
|
+ public boolean ignoreThreadSafeRandom = false;
|
|
|
|
}
|
|
|
|
diff --git a/src/main/java/org/plazmamc/plazma/configurations/WorldConfigurations.java b/src/main/java/org/plazmamc/plazma/configurations/WorldConfigurations.java
|
|
index d79410cc8b6054e5d3297b3e768fb232f97062e4..e9850b634c4e9bbebea6534690632b067b69b0b6 100644
|
|
--- a/src/main/java/org/plazmamc/plazma/configurations/WorldConfigurations.java
|
|
+++ b/src/main/java/org/plazmamc/plazma/configurations/WorldConfigurations.java
|
|
@@ -22,6 +22,7 @@ public class WorldConfigurations extends ConfigurationPart {
|
|
public Miscellaneous misc;
|
|
public class Miscellaneous extends ConfigurationPart {
|
|
|
|
+ public boolean reduceRandom = OPTIMIZE;
|
|
|
|
}
|
|
|