add back random populator seed

This commit is contained in:
Ben Kerllenevich
2021-06-25 18:46:30 -04:00
parent 6d5a686a1d
commit 44e4acda63
151 changed files with 601 additions and 890 deletions

View File

@@ -1,104 +0,0 @@
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
From: Spottedleaf <Spottedleaf@users.noreply.github.com>
Date: Sat, 18 Jul 2020 11:27:43 -0500
Subject: [PATCH] Populator seed controls
1.17: add back with tuinity
diff --git a/src/main/java/co/aikar/timings/TimingsExport.java b/src/main/java/co/aikar/timings/TimingsExport.java
index 5e672a0660d0aceffcdb26d185590ca18aa4f023..4b171a2a60e24947e884f8988920f335bd99a471 100644
--- a/src/main/java/co/aikar/timings/TimingsExport.java
+++ b/src/main/java/co/aikar/timings/TimingsExport.java
@@ -293,7 +293,7 @@ public class TimingsExport extends Thread {
JSONObject object = new JSONObject();
for (String key : config.getKeys(false)) {
String fullKey = (parentKey != null ? parentKey + "." + key : key);
- if (fullKey.equals("database") || fullKey.equals("settings.bungeecord-addresses") || TimingsManager.hiddenConfigs.contains(fullKey) || key.startsWith("seed-") || key.equals("worldeditregentempworld")) {
+ if (fullKey.equals("database") || fullKey.equals("settings.bungeecord-addresses") || TimingsManager.hiddenConfigs.contains(fullKey) || key.startsWith("seed-") || key.equals("worldeditregentempworld") || fullKey.contains("worldgen.seeds.populator")) { // Tuinity
continue;
}
final Object val = config.get(key);
diff --git a/src/main/java/com/tuinity/tuinity/config/TuinityConfig.java b/src/main/java/com/tuinity/tuinity/config/TuinityConfig.java
index 6736b6c29a1b4c8eac7ca0d012b73b501fd99042..1938b780d20c1d29d63aefeed7ba42fcd2495986 100644
--- a/src/main/java/com/tuinity/tuinity/config/TuinityConfig.java
+++ b/src/main/java/com/tuinity/tuinity/config/TuinityConfig.java
@@ -1,5 +1,6 @@
package com.tuinity.tuinity.config;
+import co.aikar.timings.TimingsManager;
import com.destroystokyo.paper.util.SneakyThrow;
import net.minecraft.server.MinecraftServer;
import net.minecraft.server.level.TicketType;
@@ -449,6 +450,20 @@ public final class TuinityConfig {
final int threads = this.getInt("tick-threads", -1);
this.threads = threads == -1 ? TuinityConfig.tickThreads : threads;
}*/
+
+ public Long populatorSeed;
+ public boolean useRandomPopulatorSeed;
+
+ private void populatorSeed() {
+ final String seedString = this.getString("worldgen.seeds.populator", "default");
+ if (seedString.equalsIgnoreCase("random")) {
+ this.useRandomPopulatorSeed = true;
+ } else if (!seedString.equalsIgnoreCase("default")) {
+ this.populatorSeed = Long.parseLong(seedString);
+ }
+ if (!TimingsManager.hiddenConfigs.contains("worldgen.seeds.populator")) TimingsManager.hiddenConfigs.add("worldgen.seeds.populator");
+ }
+
}
}
\ No newline at end of file
diff --git a/src/main/java/net/minecraft/world/level/biome/BiomeBase.java b/src/main/java/net/minecraft/world/level/biome/BiomeBase.java
index 9bbd175f7e20591bbefdbddcb5e998e7098c5adb..c4fb051739c1c186c1574185e0653f513755987d 100644
--- a/src/main/java/net/minecraft/world/level/biome/BiomeBase.java
+++ b/src/main/java/net/minecraft/world/level/biome/BiomeBase.java
@@ -23,7 +23,9 @@ import net.minecraft.core.SectionPosition;
import net.minecraft.data.RegistryGeneration;
import net.minecraft.resources.MinecraftKey;
import net.minecraft.resources.RegistryFileCodec;
+import net.minecraft.server.level.ChunkProviderServer;
import net.minecraft.server.level.RegionLimitedWorldAccess;
+import net.minecraft.server.level.WorldServer;
import net.minecraft.util.INamable;
import net.minecraft.world.level.ChunkCoordIntPair;
import net.minecraft.world.level.EnumSkyBlock;
@@ -257,6 +259,10 @@ public final class BiomeBase {
return this.k;
}
+ // Tuinity start - populator seed control
+ private static final java.security.SecureRandom SECURE_RANDOM = new java.security.SecureRandom();
+ // Tuinity end - populator seed control
+
public void a(StructureManager structuremanager, ChunkGenerator chunkgenerator, RegionLimitedWorldAccess regionlimitedworldaccess, long i, SeededRandom seededrandom, BlockPosition blockposition) {
List<List<Supplier<WorldGenFeatureConfigured<?, ?>>>> list = this.k.c();
int j = WorldGenStage.Decoration.values().length;
@@ -293,12 +299,24 @@ public final class BiomeBase {
}
}
+ // Tuinity start - populator seed control
+ long populatorSeed;
+ WorldServer world = (WorldServer)((ChunkProviderServer)regionlimitedworldaccess.getChunkProvider()).getWorld();
+ if (world.tuinityConfig.useRandomPopulatorSeed) {
+ populatorSeed = SECURE_RANDOM.nextLong();
+ } else if (world.tuinityConfig.populatorSeed != null) {
+ populatorSeed = world.tuinityConfig.populatorSeed.longValue();
+ } else {
+ populatorSeed = i;
+ }
+ // Tuinity end - populator seed control
+
if (list.size() > k) {
for (Iterator iterator1 = ((List) list.get(k)).iterator(); iterator1.hasNext(); ++l) {
Supplier<WorldGenFeatureConfigured<?, ?>> supplier = (Supplier) iterator1.next();
WorldGenFeatureConfigured<?, ?> worldgenfeatureconfigured = (WorldGenFeatureConfigured) supplier.get();
- seededrandom.b(i, l, k);
+ seededrandom.b(populatorSeed, l, k); // Tuinity - populator seed control - move i up into default branch
try {
worldgenfeatureconfigured.a(regionlimitedworldaccess, chunkgenerator, seededrandom, blockposition);

View File

@@ -1,66 +0,0 @@
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
From: Phoenix616 <max@themoep.de>
Date: Mon, 19 Oct 2020 17:20:53 +0100
Subject: [PATCH] Origami - Fix ProtocolLib issues on Java 15
1.17: add back with tuinity
diff --git a/src/main/java/net/minecraft/network/NetworkManager.java b/src/main/java/net/minecraft/network/NetworkManager.java
index b6c0ef0df93f0350fa70e857e06d79ae34d7d4b1..1dce5d3b1e994a060067de4901912dd5a9be7e15 100644
--- a/src/main/java/net/minecraft/network/NetworkManager.java
+++ b/src/main/java/net/minecraft/network/NetworkManager.java
@@ -435,9 +435,9 @@ public class NetworkManager extends SimpleChannelInboundHandler<Packet<?>> {
// note: since the type is not dynamic here, we need to actually copy the old executor code
// into two branches. On conflict, just re-copy - no changes were made inside the executor code.
if (flush) {
- choice1 = () -> {
+ choice1 = new Runnable() { public void run() { // Origami - flatten lambda
if (enumprotocol != enumprotocol1) {
- this.setProtocol(enumprotocol);
+ NetworkManager.this.setProtocol(enumprotocol); // Origami - flatten lambda
}
// Paper start
@@ -447,7 +447,7 @@ public class NetworkManager extends SimpleChannelInboundHandler<Packet<?>> {
}
try {
// Paper end
- ChannelFuture channelfuture1 = (flush) ? this.channel.writeAndFlush(packet) : this.channel.write(packet); // Tuinity - add flush parameter
+ ChannelFuture channelfuture1 = (flush) ? NetworkManager.this.channel.writeAndFlush(packet) : NetworkManager.this.channel.write(packet); // Tuinity - add flush parameter // Origami - flatten lambda
if (genericfuturelistener != null) {
@@ -467,12 +467,12 @@ public class NetworkManager extends SimpleChannelInboundHandler<Packet<?>> {
packet.onPacketDispatchFinish(player, null);
}
// Paper end
- };
+ }}; // Origami - flatten lambda
} else {
// explicitly declare a variable to make the lambda use the type
- choice2 = () -> {
+ choice2 = new AbstractEventExecutor.LazyRunnable() { public void run() { // Origami - flatten lambda
if (enumprotocol != enumprotocol1) {
- this.setProtocol(enumprotocol);
+ NetworkManager.this.setProtocol(enumprotocol); // Origami - flatten lambda
}
// Paper start
@@ -482,7 +482,7 @@ public class NetworkManager extends SimpleChannelInboundHandler<Packet<?>> {
}
try {
// Paper end
- ChannelFuture channelfuture1 = (flush) ? this.channel.writeAndFlush(packet) : this.channel.write(packet); // Tuinity - add flush parameter
+ ChannelFuture channelfuture1 = (flush) ? NetworkManager.this.channel.writeAndFlush(packet) : NetworkManager.this.channel.write(packet); // Tuinity - add flush parameter // Origami - flatten lambda
if (genericfuturelistener != null) {
@@ -502,7 +502,7 @@ public class NetworkManager extends SimpleChannelInboundHandler<Packet<?>> {
packet.onPacketDispatchFinish(player, null);
}
// Paper end
- };
+ }}; // Origami - flatten lambda
}
this.channel.eventLoop().execute(choice1 != null ? choice1 : choice2);
// Tuinity end - optimise packets that are not flushed

View File

@@ -1,53 +0,0 @@
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
From: Jason Penilla <11360596+jpenilla@users.noreply.github.com>
Date: Wed, 2 Dec 2020 14:49:10 -0800
Subject: [PATCH] Config migration: climbing should not bypass cramming
gamerule
This migration isnt needed anymore. It's served its purpose. People running super old builds will
just have to deal with the migration themselves if they care.
diff --git a/src/main/java/net/pl3x/purpur/PurpurConfig.java b/src/main/java/net/pl3x/purpur/PurpurConfig.java
index f4fab86ed176aea7d5fca3836e76f53e6101575f..36cfcd57fa3c3d33d46be5e3f70f4cf9a84f8b77 100644
--- a/src/main/java/net/pl3x/purpur/PurpurConfig.java
+++ b/src/main/java/net/pl3x/purpur/PurpurConfig.java
@@ -145,6 +145,17 @@ public class PurpurConfig {
}
}
+ private static void migrateClimbingCrammingFix() {
+ if (PurpurConfig.version < 7) {
+ final boolean climbingCrammingFix = getBoolean("world-settings.default.gameplay-mechanics.fix-climbing-bypassing-cramming-rule", false);
+ set("world-settings.default.gameplay-mechanics.fix-climbing-bypassing-cramming-rule", null);
+ if (climbingCrammingFix) {
+ PaperConfig.config.set("world-settings.default.fix-climbing-bypassing-cramming-rule", true);
+ PaperConfig.saveConfig();
+ }
+ }
+ }
+
public static String afkBroadcastAway = "§e§o%s is now AFK";
public static String afkBroadcastBack = "§e§o%s is no longer AFK";
public static String afkTabListPrefix = "[AFK] ";
diff --git a/src/main/java/net/pl3x/purpur/PurpurWorldConfig.java b/src/main/java/net/pl3x/purpur/PurpurWorldConfig.java
index ed2b682b3717e58eb18ef12c18f362a75174f069..3e2898e3582efc00764885739e1df3a2ab5d5f6e 100644
--- a/src/main/java/net/pl3x/purpur/PurpurWorldConfig.java
+++ b/src/main/java/net/pl3x/purpur/PurpurWorldConfig.java
@@ -96,6 +96,17 @@ public class PurpurWorldConfig {
}
}
+ private void migrateClimbingCrammingFix() {
+ if (PurpurConfig.version < 7) {
+ final boolean climbingCrammingFix = PurpurConfig.config.getBoolean("world-settings." + worldName + ".gameplay-mechanics.fix-climbing-bypassing-cramming-rule", false);
+ PurpurConfig.config.set("world-settings." + worldName + ".gameplay-mechanics.fix-climbing-bypassing-cramming-rule", null);
+ if (climbingCrammingFix) {
+ PaperConfig.config.set("world-settings." + worldName + ".fix-climbing-bypassing-cramming-rule", true);
+ PaperConfig.saveConfig();
+ }
+ }
+ }
+
public boolean armorstandSetNameVisible = false;
public boolean armorstandFixNametags = false;
public float armorstandStepHeight = 0.0F;

View File

@@ -1,60 +0,0 @@
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
From: William Blake Galbreath <Blake.Galbreath@GMail.com>
Date: Sat, 13 Feb 2021 14:02:43 -0600
Subject: [PATCH] Add ghast allow-griefing option
fireball griefing is already covered by another patch
diff --git a/src/main/java/net/minecraft/world/entity/monster/EntityGhast.java b/src/main/java/net/minecraft/world/entity/monster/EntityGhast.java
index e83d9aae4a04fc67587d40cec1f24ba5ebb58e10..5834b38ab206a9db6d3e336074095ce85bdbcc50 100644
--- a/src/main/java/net/minecraft/world/entity/monster/EntityGhast.java
+++ b/src/main/java/net/minecraft/world/entity/monster/EntityGhast.java
@@ -230,6 +230,7 @@ public class EntityGhast extends EntityFlying implements IMonster {
}
EntityLargeFireball entitylargefireball = new EntityLargeFireball(world, this.ghast, d2, d3, d4);
+ entitylargefireball.canCauseGrief = world.purpurConfig.ghastAllowGriefing; // Purpur
// CraftBukkit - set bukkitYield when setting explosionpower
entitylargefireball.bukkitYield = entitylargefireball.yield = this.ghast.getPower();
diff --git a/src/main/java/net/minecraft/world/entity/projectile/EntityLargeFireball.java b/src/main/java/net/minecraft/world/entity/projectile/EntityLargeFireball.java
index 61f06eacb4ea4ef869b60c9014cc23b25583eead..627915ee205fdcc93c5424ad7d7ea05783bc07ad 100644
--- a/src/main/java/net/minecraft/world/entity/projectile/EntityLargeFireball.java
+++ b/src/main/java/net/minecraft/world/entity/projectile/EntityLargeFireball.java
@@ -16,6 +16,7 @@ import org.bukkit.event.entity.ExplosionPrimeEvent; // CraftBukkit
public class EntityLargeFireball extends EntityFireballFireball {
public int yield = 1;
+ public boolean canCauseGrief = true; // Purpur
public EntityLargeFireball(EntityTypes<? extends EntityLargeFireball> entitytypes, World world) {
super(entitytypes, world);
@@ -31,7 +32,7 @@ public class EntityLargeFireball extends EntityFireballFireball {
protected void a(MovingObjectPosition movingobjectposition) {
super.a(movingobjectposition);
if (!this.world.isClientSide) {
- boolean flag = this.world.purpurConfig.fireballsBypassMobGriefing || this.world.getGameRules().getBoolean(GameRules.MOB_GRIEFING); // Purpur
+ boolean flag = isIncendiary = canCauseGrief && (this.world.purpurConfig.fireballsBypassMobGriefing || this.world.getGameRules().getBoolean(GameRules.MOB_GRIEFING)); // Purpur
// CraftBukkit start - fire ExplosionPrimeEvent
ExplosionPrimeEvent event = new ExplosionPrimeEvent((org.bukkit.entity.Explosive) this.getBukkitEntity());
diff --git a/src/main/java/net/pl3x/purpur/PurpurWorldConfig.java b/src/main/java/net/pl3x/purpur/PurpurWorldConfig.java
index 266b64abb949fca2cc667395d175c962c55435db..23f7a3af8f92fd6e89601b0e1b4b2d1635dfe0b0 100644
--- a/src/main/java/net/pl3x/purpur/PurpurWorldConfig.java
+++ b/src/main/java/net/pl3x/purpur/PurpurWorldConfig.java
@@ -926,6 +926,7 @@ public class PurpurWorldConfig {
public boolean ghastRidable = false;
public boolean ghastRidableInWater = false;
public double ghastMaxY = 256D;
+ public boolean ghastAllowGriefing = true;
public double ghastMaxHealth = 10.0D;
private void ghastSettings() {
ghastRidable = getBoolean("mobs.ghast.ridable", ghastRidable);
@@ -936,6 +937,7 @@ public class PurpurWorldConfig {
set("mobs.ghast.attributes.max-health", null);
set("mobs.ghast.attributes.max_health", oldValue);
}
+ ghastAllowGriefing = getBoolean("mobs.ghast.allow-griefing", ghastAllowGriefing);
ghastMaxHealth = getDouble("mobs.ghast.attributes.max_health", ghastMaxHealth);
}

View File

@@ -1,80 +0,0 @@
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
From: DoctaEnkoda <bierquejason@gmail.com>
Date: Tue, 11 May 2021 00:28:13 +0200
Subject: [PATCH] Optimize collisions
1.17: add back with tuinity
diff --git a/src/main/java/net/minecraft/server/level/WorldServer.java b/src/main/java/net/minecraft/server/level/WorldServer.java
index 7d0c5d28597c51d332146a82df06ba519711f836..fbc7f3e489be0ac5939af29a9aef75a56c38eb4a 100644
--- a/src/main/java/net/minecraft/server/level/WorldServer.java
+++ b/src/main/java/net/minecraft/server/level/WorldServer.java
@@ -678,16 +678,10 @@ public class WorldServer extends World implements GeneratorAccessSeed {
}
}
- int minBlockX = MathHelper.floor(axisalignedbb.minX - MCUtil.COLLISION_EPSILON) - 1;
- int maxBlockX = MathHelper.floor(axisalignedbb.maxX + MCUtil.COLLISION_EPSILON) + 1;
-
+ // Purpur Start Rebase - Calculate when needed only
int minBlockY = MathHelper.floor(axisalignedbb.minY - MCUtil.COLLISION_EPSILON) - 1;
int maxBlockY = MathHelper.floor(axisalignedbb.maxY + MCUtil.COLLISION_EPSILON) + 1;
- int minBlockZ = MathHelper.floor(axisalignedbb.minZ - MCUtil.COLLISION_EPSILON) - 1;
- int maxBlockZ = MathHelper.floor(axisalignedbb.maxZ + MCUtil.COLLISION_EPSILON) + 1;
-
-
BlockPosition.MutableBlockPosition mutablePos = new BlockPosition.MutableBlockPosition();
net.minecraft.world.phys.shapes.VoxelShapeCollision collisionShape = null;
@@ -697,6 +691,13 @@ public class WorldServer extends World implements GeneratorAccessSeed {
return ret;
}
+ int minBlockX = MathHelper.floor(axisalignedbb.minX - MCUtil.COLLISION_EPSILON) - 1;
+ int maxBlockX = MathHelper.floor(axisalignedbb.maxX + MCUtil.COLLISION_EPSILON) + 1;
+
+ int minBlockZ = MathHelper.floor(axisalignedbb.minZ - MCUtil.COLLISION_EPSILON) - 1;
+ int maxBlockZ = MathHelper.floor(axisalignedbb.maxZ + MCUtil.COLLISION_EPSILON) + 1;
+ // Purpur End
+
int minYIterate = Math.max(0, minBlockY);
int maxYIterate = Math.min(255, maxBlockY);
diff --git a/src/main/java/net/minecraft/world/level/ChunkCache.java b/src/main/java/net/minecraft/world/level/ChunkCache.java
index b547eb352f90f68cf36ffb82e43ad7acb1892f6a..456ef170f8885ad42c3c2bd2a54c5bc46bfe30cd 100644
--- a/src/main/java/net/minecraft/world/level/ChunkCache.java
+++ b/src/main/java/net/minecraft/world/level/ChunkCache.java
@@ -60,16 +60,10 @@ public class ChunkCache implements IBlockAccess, ICollisionAccess {
}
}
- int minBlockX = net.minecraft.util.MathHelper.floor(axisalignedbb.minX - net.minecraft.server.MCUtil.COLLISION_EPSILON) - 1;
- int maxBlockX = net.minecraft.util.MathHelper.floor(axisalignedbb.maxX + net.minecraft.server.MCUtil.COLLISION_EPSILON) + 1;
-
+ // Purpur Rebase - Calculate when needed only
int minBlockY = net.minecraft.util.MathHelper.floor(axisalignedbb.minY - net.minecraft.server.MCUtil.COLLISION_EPSILON) - 1;
int maxBlockY = net.minecraft.util.MathHelper.floor(axisalignedbb.maxY + net.minecraft.server.MCUtil.COLLISION_EPSILON) + 1;
-
- int minBlockZ = net.minecraft.util.MathHelper.floor(axisalignedbb.minZ - net.minecraft.server.MCUtil.COLLISION_EPSILON) - 1;
- int maxBlockZ = net.minecraft.util.MathHelper.floor(axisalignedbb.maxZ + net.minecraft.server.MCUtil.COLLISION_EPSILON) + 1;
-
-
+
BlockPosition.MutableBlockPosition mutablePos = new BlockPosition.MutableBlockPosition();
net.minecraft.world.phys.shapes.VoxelShapeCollision collisionShape = null;
@@ -79,6 +73,13 @@ public class ChunkCache implements IBlockAccess, ICollisionAccess {
return ret;
}
+ int minBlockX = net.minecraft.util.MathHelper.floor(axisalignedbb.minX - net.minecraft.server.MCUtil.COLLISION_EPSILON) - 1;
+ int maxBlockX = net.minecraft.util.MathHelper.floor(axisalignedbb.maxX + net.minecraft.server.MCUtil.COLLISION_EPSILON) + 1;
+
+ int minBlockZ = net.minecraft.util.MathHelper.floor(axisalignedbb.minZ - net.minecraft.server.MCUtil.COLLISION_EPSILON) - 1;
+ int maxBlockZ = net.minecraft.util.MathHelper.floor(axisalignedbb.maxZ + net.minecraft.server.MCUtil.COLLISION_EPSILON) + 1;
+ // Purpur End
+
int minYIterate = Math.max(0, minBlockY);
int maxYIterate = Math.min(255, maxBlockY);