From 0da6d1d498e3940daa067ecf87630c76b2720743 Mon Sep 17 00:00:00 2001 From: Nassim Jahnke Date: Wed, 8 Jun 2022 15:59:48 +0200 Subject: [PATCH] Compilation error fixes --- ...dd-missing-block-data-mins-and-maxes.patch | 21 +++++++++++++++++++ .../Add-support-for-Proxy-Protocol.patch | 12 +++++++++++ .../Implement-enchantWithLevels-API.patch | 2 +- .../Optimise-random-block-ticking.patch | 20 +++++++++++++++++- .../Replace-ticket-level-propagator.patch | 9 ++++++++ 5 files changed, 62 insertions(+), 2 deletions(-) diff --git a/patches/server/Add-missing-block-data-mins-and-maxes.patch b/patches/server/Add-missing-block-data-mins-and-maxes.patch index 4e2a3cf92d..7a882ecb17 100644 --- a/patches/server/Add-missing-block-data-mins-and-maxes.patch +++ b/patches/server/Add-missing-block-data-mins-and-maxes.patch @@ -108,6 +108,27 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000 // org.bukkit.craftbukkit.block.data.CraftWaterlogged private static final net.minecraft.world.level.block.state.properties.BooleanProperty WATERLOGGED = getBoolean(net.minecraft.world.level.block.LightBlock.class, "waterlogged"); +diff --git a/src/main/java/org/bukkit/craftbukkit/block/impl/CraftMangroveLeaves.java b/src/main/java/org/bukkit/craftbukkit/block/impl/CraftMangroveLeaves.java +index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644 +--- a/src/main/java/org/bukkit/craftbukkit/block/impl/CraftMangroveLeaves.java ++++ b/src/main/java/org/bukkit/craftbukkit/block/impl/CraftMangroveLeaves.java +@@ -0,0 +0,0 @@ public final class CraftMangroveLeaves extends org.bukkit.craftbukkit.block.data + public void setWaterlogged(boolean waterlogged) { + set(CraftMangroveLeaves.WATERLOGGED, waterlogged); + } ++ ++ // Paper start ++ @Override ++ public int getMinimumDistance() { ++ return getMin(CraftMangroveLeaves.DISTANCE); ++ } ++ ++ @Override ++ public int getMaximumDistance() { ++ return getMax(CraftMangroveLeaves.DISTANCE); ++ } ++ // Paper end + } diff --git a/src/main/java/org/bukkit/craftbukkit/block/impl/CraftPowderSnowCauldron.java b/src/main/java/org/bukkit/craftbukkit/block/impl/CraftPowderSnowCauldron.java index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644 --- a/src/main/java/org/bukkit/craftbukkit/block/impl/CraftPowderSnowCauldron.java diff --git a/patches/server/Add-support-for-Proxy-Protocol.patch b/patches/server/Add-support-for-Proxy-Protocol.patch index 0a95a7c771..f1383f2048 100644 --- a/patches/server/Add-support-for-Proxy-Protocol.patch +++ b/patches/server/Add-support-for-Proxy-Protocol.patch @@ -4,6 +4,18 @@ Date: Thu, 7 Apr 2022 16:13:39 +0200 Subject: [PATCH] Add support for Proxy Protocol +diff --git a/build.gradle.kts b/build.gradle.kts +index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644 +--- a/build.gradle.kts ++++ b/build.gradle.kts +@@ -0,0 +0,0 @@ dependencies { + */ + implementation("org.apache.logging.log4j:log4j-core:2.17.1") // Paper - implementation + annotationProcessor("org.apache.logging.log4j:log4j-core:2.17.1") // Paper - Needed to generate meta for our Log4j plugins ++ implementation("io.netty:netty-codec-haproxy:4.1.76.Final") + // Paper end + implementation("org.apache.logging.log4j:log4j-iostreams:2.17.1") // Paper + implementation("org.apache.logging.log4j:log4j-slf4j18-impl:2.17.1") // Paper diff --git a/src/main/java/com/destroystokyo/paper/PaperConfig.java b/src/main/java/com/destroystokyo/paper/PaperConfig.java index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644 --- a/src/main/java/com/destroystokyo/paper/PaperConfig.java diff --git a/patches/server/Implement-enchantWithLevels-API.patch b/patches/server/Implement-enchantWithLevels-API.patch index 8984131443..46f5460753 100644 --- a/patches/server/Implement-enchantWithLevels-API.patch +++ b/patches/server/Implement-enchantWithLevels-API.patch @@ -23,7 +23,7 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000 + if (internalStack.tag != null) { + internalStack.tag.remove(net.minecraft.world.item.ItemStack.TAG_ENCH); + } -+ final net.minecraft.world.item.ItemStack enchanted = net.minecraft.world.item.enchantment.EnchantmentHelper.enchantItem(random, internalStack, levels, allowTreasure); ++ final net.minecraft.world.item.ItemStack enchanted = net.minecraft.world.item.enchantment.EnchantmentHelper.enchantItem(new org.bukkit.craftbukkit.util.RandomSourceWrapper(random), internalStack, levels, allowTreasure); + return CraftItemStack.asCraftMirror(enchanted); + } + diff --git a/patches/server/Optimise-random-block-ticking.patch b/patches/server/Optimise-random-block-ticking.patch index 15f6bb66e8..82b499f22b 100644 --- a/patches/server/Optimise-random-block-ticking.patch +++ b/patches/server/Optimise-random-block-ticking.patch @@ -26,9 +26,12 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000 @@ -0,0 +0,0 @@ +package io.papermc.paper.util.math; + ++import net.minecraft.util.RandomSource; ++import net.minecraft.world.level.levelgen.PositionalRandomFactory; ++ +import java.util.Random; + -+public final class ThreadUnsafeRandom extends Random { ++public final class ThreadUnsafeRandom extends Random implements RandomSource { + + // See javadoc and internal comments for java.util.Random where these values come from, how they are used, and the author for them. + private static final long multiplier = 0x5DEECE66DL; @@ -42,6 +45,21 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000 + private long seed; + + @Override ++ public RandomSource fork() { ++ return new ThreadUnsafeRandom(); ++ } ++ ++ @Override ++ public PositionalRandomFactory forkPositional() { ++ throw new UnsupportedOperationException(); ++ } ++ ++ @Override ++ public int nextInt(int origin, int bound) { ++ return RandomSource.super.nextInt(origin, bound); ++ } ++ ++ @Override + public void setSeed(long seed) { + // note: called by Random constructor + this.seed = initialScramble(seed); diff --git a/patches/server/Replace-ticket-level-propagator.patch b/patches/server/Replace-ticket-level-propagator.patch index 64859ac881..18144e1df4 100644 --- a/patches/server/Replace-ticket-level-propagator.patch +++ b/patches/server/Replace-ticket-level-propagator.patch @@ -238,6 +238,15 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000 } // Paper end return removed; // CraftBukkit +@@ -0,0 +0,0 @@ public abstract class DistanceManager { + } + + if (flag) { +- this.ticketTracker.update(entry.getLongKey(), DistanceManager.getTicketLevelAt((SortedArraySet) entry.getValue()), false); ++ this.updateTicketLevel(entry.getLongKey(), DistanceManager.getTicketLevelAt((SortedArraySet) entry.getValue())); // Paper - replace ticket level propagator + } + + if (((SortedArraySet) entry.getValue()).isEmpty()) { @@ -0,0 +0,0 @@ public abstract class DistanceManager { SortedArraySet> tickets = entry.getValue(); if (tickets.remove(target)) {