From 041a42e0e41dc17bbe27c8eca205397972d124bc Mon Sep 17 00:00:00 2001 From: Mariell Hoversholm Date: Fri, 11 Jun 2021 20:26:56 +0200 Subject: [PATCH] fix: closer to compilable Signed-off-by: Mariell Hoversholm --- patches/server/MC-Utils.patch | 38 +++------------------------------ patches/server/Timings-v2.patch | 16 +++++--------- 2 files changed, 8 insertions(+), 46 deletions(-) diff --git a/patches/server/MC-Utils.patch b/patches/server/MC-Utils.patch index 4cb5bcfdda..020ad029c6 100644 --- a/patches/server/MC-Utils.patch +++ b/patches/server/MC-Utils.patch @@ -2373,7 +2373,6 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000 + /** + * You must use {@link #hasUUID(String)} before or else it will throw an NPE. + */ -+ public UUID getUUID(String prefix) { return getUUID(prefix); } // Paper - OBFHELPER public UUID getUUID(String key) { return NbtUtils.loadUUID(this.get(key)); } @@ -2394,10 +2393,11 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000 --- a/src/main/java/net/minecraft/network/PacketEncoder.java +++ b/src/main/java/net/minecraft/network/PacketEncoder.java @@ -0,0 +0,0 @@ public class PacketEncoder extends MessageToByteEncoder> { + throw new IllegalArgumentException("Packet too big (is " + j + ", should be less than 2097152): " + packet); } } catch (Throwable var9) { - LOGGER.error(var9); -+ throwable.printStackTrace(); // Paper - WHAT WAS IT? WHO DID THIS TO YOU? WHAT DID YOU SEE? +- LOGGER.error(var9); ++ LOGGER.error("Packet encoding of packet ID {} threw (skippable? {})", integer, packet.isSkippable(), var9); // Paper - WHAT WAS IT? WHO DID THIS TO YOU? WHAT DID YOU SEE? if (packet.isSkippable()) { throw new SkipPacketException(var9); } else { @@ -2409,7 +2409,6 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000 @@ -0,0 +0,0 @@ +package net.minecraft.server; + -+import com.destroystokyo.paper.block.TargetBlockInfo; +import com.google.common.util.concurrent.ThreadFactoryBuilder; +import it.unimi.dsi.fastutil.objects.ObjectRBTreeSet; +import net.minecraft.core.BlockPos; @@ -2885,19 +2884,6 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000 + return getNMSWorld(entity.getWorld()); + } + -+ public static ClipContext.Fluid getNMSFluidCollisionOption(TargetBlockInfo.FluidMode fluidMode) { -+ if (fluidMode == TargetBlockInfo.FluidMode.NEVER) { -+ return ClipContext.Fluid.NONE; -+ } -+ if (fluidMode == TargetBlockInfo.FluidMode.SOURCE_ONLY) { -+ return ClipContext.Fluid.SOURCE_ONLY; -+ } -+ if (fluidMode == TargetBlockInfo.FluidMode.ALWAYS) { -+ return ClipContext.Fluid.ANY; -+ } -+ return null; -+ } -+ + public static BlockFace toBukkitBlockFace(Direction enumDirection) { + switch (enumDirection) { + case DOWN: @@ -4325,19 +4311,6 @@ diff --git a/src/main/java/net/minecraft/world/phys/AABB.java b/src/main/java/ne index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644 --- a/src/main/java/net/minecraft/world/phys/AABB.java +++ b/src/main/java/net/minecraft/world/phys/AABB.java -@@ -0,0 +0,0 @@ public class AABB { - return this.move(vec.x, vec.y, vec.z); - } - -+ public final boolean intersects(AABB axisalignedbb) { return this.intersects(axisalignedbb); } // Paper - OBFHELPER - public boolean intersects(AABB box) { - return this.intersects(box.minX, box.minY, box.minZ, box.maxX, box.maxY, box.maxZ); - } - -+ public final boolean intersects(double d0, double d1, double d2, double d3, double d4, double d5) { return intersects(d0, d1, d2, d3, d4, d5); } // Paper - OBFHELPER - public boolean intersects(double minX, double minY, double minZ, double maxX, double maxY, double maxZ) { - return this.minX < maxX && this.maxX > minX && this.minY < maxY && this.maxY > minY && this.minZ < maxZ && this.maxZ > minZ; - } @@ -0,0 +0,0 @@ public class AABB { return x >= this.minX && x < this.maxX && y >= this.minY && y < this.maxY && z >= this.minZ && z < this.maxZ; } @@ -4351,11 +4324,6 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000 --- a/src/main/java/net/minecraft/world/phys/shapes/Shapes.java +++ b/src/main/java/net/minecraft/world/phys/shapes/Shapes.java @@ -0,0 +0,0 @@ public final class Shapes { - public static final VoxelShape INFINITY = box(Double.NEGATIVE_INFINITY, Double.NEGATIVE_INFINITY, Double.NEGATIVE_INFINITY, Double.POSITIVE_INFINITY, Double.POSITIVE_INFINITY, Double.POSITIVE_INFINITY); - private static final VoxelShape EMPTY = new ArrayVoxelShape(new BitSetDiscreteVoxelShape(0, 0, 0), (DoubleList)(new DoubleArrayList(new double[]{0.0D})), (DoubleList)(new DoubleArrayList(new double[]{0.0D})), (DoubleList)(new DoubleArrayList(new double[]{0.0D}))); - -+ public static final VoxelShape empty() {return empty();} // Paper - OBFHELPER - public static VoxelShape empty() { return EMPTY; } diff --git a/patches/server/Timings-v2.patch b/patches/server/Timings-v2.patch index 41da88f772..0fc9d3574b 100644 --- a/patches/server/Timings-v2.patch +++ b/patches/server/Timings-v2.patch @@ -12,7 +12,6 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000 @@ -0,0 +0,0 @@ +package co.aikar.timings; + -+import Timing; +import com.google.common.collect.MapMaker; +import net.minecraft.commands.CommandFunction; +import net.minecraft.network.protocol.Packet; @@ -230,9 +229,6 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000 +import static co.aikar.util.JSONUtil.toArrayMapper; +import static co.aikar.util.JSONUtil.toObjectMapper; + -+import TimingHistory; -+import TimingsReportListener; -+ +@SuppressWarnings({"rawtypes", "SuppressionAnnotation"}) +public class TimingsExport extends Thread { + @@ -282,9 +278,8 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000 + pair("end", System.currentTimeMillis() / 1000), + pair("online-mode", Bukkit.getServer().getOnlineMode()), + pair("sampletime", (System.currentTimeMillis() - TimingsManager.timingStart) / 1000), -+ pair("datapacks", toArrayMapper(MinecraftServer.getServer().getPackRepository().getSelectedIds(), pack -> { -+ // Don't feel like obf helper'ing these, non fatal if its temp missed. -+ return ChatColor.stripColor(CraftChatMessage.fromComponent(pack.a(true))); ++ pair("datapacks", toArrayMapper(MinecraftServer.getServer().getPackRepository().getSelectedPacks(), pack -> { ++ return ChatColor.stripColor(CraftChatMessage.fromComponent(pack.getChatLink(true))); + })) + ); + if (!TimingsManager.privacy) { @@ -321,12 +316,12 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000 + ); + + parent.put("worlds", toObjectMapper(MinecraftServer.getServer().getAllLevels(), world -> { -+ if (world.getWorldData().getName().equals("worldeditregentempworld")) return null; -+ return pair(world.getWorldData().getName(), createObject( ++ if (world.serverLevelData.getLevelName().equals("worldeditregentempworld")) return null; ++ return pair(world.serverLevelData.getLevelName(), createObject( + pair("gamerules", toObjectMapper(world.getWorld().getGameRules(), rule -> { + return pair(rule, world.getWorld().getGameRuleValue(rule)); + })), -+ pair("ticking-distance", world.getChunkProvider().playerChunkMap.getEffectiveViewDistance()) ++ pair("ticking-distance", world.getChunkSource().chunkMap.getEffectiveViewDistance()) + )); + })); + @@ -556,7 +551,6 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000 @@ -0,0 +0,0 @@ +package co.aikar.timings; + -+import Timing; +import net.minecraft.server.level.ServerLevel; +import net.minecraft.world.level.Level; +import net.minecraft.world.level.storage.PrimaryLevelData;