From 3a26886e65db47ab036d12268daac1e5d49cb716 Mon Sep 17 00:00:00 2001 From: MiniDigger | Martin Date: Wed, 8 Jun 2022 17:43:25 +0200 Subject: [PATCH] fix reobf issues around randomsource impls prolly should be fixed in a mapping patch instead but I don't wanna --- .../Optimise-random-block-ticking.patch | 31 ++++++++++++++++ .../Use-a-Shared-Random-for-Entities.patch | 36 +++++++++++++++++++ 2 files changed, 67 insertions(+) diff --git a/patches/server/Optimise-random-block-ticking.patch b/patches/server/Optimise-random-block-ticking.patch index 82b499f22b..31795e1abb 100644 --- a/patches/server/Optimise-random-block-ticking.patch +++ b/patches/server/Optimise-random-block-ticking.patch @@ -87,6 +87,37 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000 + // however there's nothing that uses this class that relies on it + return fastRandomBounded(this.next(32) & 0xFFFFFFFFL, bound); + } ++ ++ // these below are added to fix reobf issues that I don't wanna deal with right now ++ @Override ++ public long nextLong() { ++ return super.nextInt(); ++ } ++ ++ @Override ++ public int nextInt() { ++ return super.nextInt(); ++ } ++ ++ @Override ++ public boolean nextBoolean() { ++ return super.nextBoolean(); ++ } ++ ++ @Override ++ public float nextFloat() { ++ return super.nextFloat(); ++ } ++ ++ @Override ++ public double nextDouble() { ++ return super.nextDouble(); ++ } ++ ++ @Override ++ public double nextGaussian() { ++ return super.nextGaussian(); ++ } +} diff --git a/src/main/java/net/minecraft/server/level/ServerLevel.java b/src/main/java/net/minecraft/server/level/ServerLevel.java index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644 diff --git a/patches/server/Use-a-Shared-Random-for-Entities.patch b/patches/server/Use-a-Shared-Random-for-Entities.patch index 1ecfbbddb9..117a2d15b7 100644 --- a/patches/server/Use-a-Shared-Random-for-Entities.patch +++ b/patches/server/Use-a-Shared-Random-for-Entities.patch @@ -42,6 +42,42 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000 + public int nextInt(int origin, int bound) { + return RandomSource.super.nextInt(origin, bound); + } ++ ++ // these below are added to fix reobf issues that I don't wanna deal with right now ++ @Override ++ public long nextLong() { ++ return super.nextInt(); ++ } ++ ++ @Override ++ public int nextInt() { ++ return super.nextInt(); ++ } ++ ++ @Override ++ public int nextInt(int bound) { ++ return super.nextInt(bound); ++ } ++ ++ @Override ++ public boolean nextBoolean() { ++ return super.nextBoolean(); ++ } ++ ++ @Override ++ public float nextFloat() { ++ return super.nextFloat(); ++ } ++ ++ @Override ++ public double nextDouble() { ++ return super.nextDouble(); ++ } ++ ++ @Override ++ public double nextGaussian() { ++ return super.nextGaussian(); ++ } + } + // Paper end +