properly remove tuinity

This commit is contained in:
Ben Kerllenevich
2021-06-14 17:32:55 -04:00
parent 6c12392439
commit 23b935c3a2
183 changed files with 413 additions and 1110 deletions

View File

@@ -1 +0,0 @@
this is where we will put patches that are no longer needed in 1.17 or have to many merge conflicts and will be dealt with later

View File

@@ -0,0 +1,104 @@
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

@@ -0,0 +1,66 @@
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

@@ -0,0 +1,80 @@
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);