Add Pufferfish patches
It includes async mob spawning (up to 15% improvement)
This commit is contained in:
@@ -1,7 +1,7 @@
|
||||
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
|
||||
From: Etil <81570777+etil2jz@users.noreply.github.com>
|
||||
Date: Tue, 2 Nov 2021 11:58:49 +0100
|
||||
Subject: [PATCH] (Patina) Patches
|
||||
Date: Fri, 12 Nov 2021 17:21:07 +0100
|
||||
Subject: [PATCH] Patina Patches
|
||||
|
||||
|
||||
diff --git a/build.gradle.kts b/build.gradle.kts
|
||||
|
||||
@@ -1,14 +1,8 @@
|
||||
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
|
||||
From: Etil <81570777+etil2jz@users.noreply.github.com>
|
||||
Date: Tue, 2 Nov 2021 12:07:24 +0100
|
||||
Subject: [PATCH] (Sugarcane) Patches
|
||||
Date: Fri, 12 Nov 2021 17:29:23 +0100
|
||||
Subject: [PATCH] Sugarcane Patches
|
||||
|
||||
Original code by YatopiaMC, licensed under MIT
|
||||
You can find the original code on https://github.com/YatopiaMC/Yatopia
|
||||
|
||||
(Sugarcane) Fix Javadoc generation
|
||||
(Sugarcane) Add GameProfileLookupEvent
|
||||
(Sugarcane) Disable reload command
|
||||
|
||||
diff --git a/build.gradle.kts b/build.gradle.kts
|
||||
index fdc94c58570d7eaf430e9c6023abf91a4df61397..d262538316c403f8166e66c3c512de226d8fa9c7 100644
|
||||
|
||||
@@ -1,11 +1,11 @@
|
||||
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
|
||||
From: Etil <81570777+etil2jz@users.noreply.github.com>
|
||||
Date: Sat, 23 Oct 2021 19:54:59 +0200
|
||||
Subject: [PATCH] (Yatopia) Patches
|
||||
Date: Fri, 12 Nov 2021 17:46:58 +0100
|
||||
Subject: [PATCH] Yatopia Patches
|
||||
|
||||
|
||||
diff --git a/src/main/java/org/bukkit/plugin/SimplePluginManager.java b/src/main/java/org/bukkit/plugin/SimplePluginManager.java
|
||||
index 1366496271c4c7f72d1e5f990e51775b1c371f99..1b166ee9a965b2ce014c9161f7ba56ff06b6bfc4 100644
|
||||
index 1366496271c4c7f72d1e5f990e51775b1c371f99..5563bf335308ae939f1769eb662fb07e179bbda2 100644
|
||||
--- a/src/main/java/org/bukkit/plugin/SimplePluginManager.java
|
||||
+++ b/src/main/java/org/bukkit/plugin/SimplePluginManager.java
|
||||
@@ -581,7 +581,11 @@ public final class SimplePluginManager implements PluginManager {
|
||||
@@ -34,10 +34,12 @@ index 1366496271c4c7f72d1e5f990e51775b1c371f99..1b166ee9a965b2ce014c9161f7ba56ff
|
||||
if (!(event instanceof ServerExceptionEvent)) { // We don't want to cause an endless event loop
|
||||
callEvent(new ServerExceptionEvent(new ServerEventException(msg, ex, registration.getPlugin(), registration.getListener(), event)));
|
||||
}
|
||||
@@ -927,4 +935,10 @@ public final class SimplePluginManager implements PluginManager {
|
||||
@@ -926,5 +934,11 @@ public final class SimplePluginManager implements PluginManager {
|
||||
defaultPerms.get(false).clear();
|
||||
}
|
||||
// Paper end
|
||||
|
||||
-
|
||||
+
|
||||
+ // Yatopia start - Accessor
|
||||
+ @NotNull
|
||||
+ public Collection<PluginLoader> getPluginLoaders() {
|
||||
|
||||
@@ -1,10 +1,8 @@
|
||||
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
|
||||
From: Etil <81570777+etil2jz@users.noreply.github.com>
|
||||
Date: Tue, 26 Oct 2021 20:01:57 +0200
|
||||
Subject: [PATCH] (Slice) Patches
|
||||
Date: Fri, 12 Nov 2021 17:53:59 +0100
|
||||
Subject: [PATCH] Slice Patches
|
||||
|
||||
(Slice) Multiple Entries with Scoreboards
|
||||
(Slice) World Instance Flag
|
||||
|
||||
diff --git a/src/main/java/org/bukkit/World.java b/src/main/java/org/bukkit/World.java
|
||||
index 4f673e9123145dc78564dc3eef0edf75795dafc2..13a387086bb30b316eb4e761dd4383cdd500e363 100644
|
||||
@@ -23,13 +21,13 @@ index 4f673e9123145dc78564dc3eef0edf75795dafc2..13a387086bb30b316eb4e761dd4383cd
|
||||
/**
|
||||
* Sets the Difficulty of the world.
|
||||
diff --git a/src/main/java/org/bukkit/scoreboard/Team.java b/src/main/java/org/bukkit/scoreboard/Team.java
|
||||
index d5b39fb4fc16a342b5661e08df1506858168d20d..e6245053023ef0a6bc374d50edfc5d30c7cf9bf6 100644
|
||||
index d5b39fb4fc16a342b5661e08df1506858168d20d..7e7a22aeacf007d08b691c3f5e0101df08d22002 100644
|
||||
--- a/src/main/java/org/bukkit/scoreboard/Team.java
|
||||
+++ b/src/main/java/org/bukkit/scoreboard/Team.java
|
||||
@@ -1,5 +1,6 @@
|
||||
package org.bukkit.scoreboard;
|
||||
|
||||
+import java.util.Collection; // Paper
|
||||
+import java.util.Collection; // Slice
|
||||
import java.util.Set;
|
||||
import org.bukkit.ChatColor;
|
||||
import org.bukkit.OfflinePlayer;
|
||||
|
||||
@@ -1,16 +1,11 @@
|
||||
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
|
||||
From: Etil <81570777+etil2jz@users.noreply.github.com>
|
||||
Date: Sat, 23 Oct 2021 16:22:26 +0200
|
||||
Subject: [PATCH] (Akarin) Patches
|
||||
Date: Fri, 12 Nov 2021 15:41:31 +0100
|
||||
Subject: [PATCH] Akarin Patches
|
||||
|
||||
Original code by Akarin-project, licensed under GNU General Public License v3.0
|
||||
You can find the original code on https://github.com/Akarin-project/Akarin
|
||||
|
||||
(Akarin) Swap the predicate order of collision
|
||||
(Akarin) Avoid double I/O operation on load player file
|
||||
|
||||
diff --git a/src/main/java/net/minecraft/world/entity/Entity.java b/src/main/java/net/minecraft/world/entity/Entity.java
|
||||
index d35cdcf2ee7568ad5caf52588db54e9c6f607d4b..c77b9348cc313ccb0fa7d5fbd2d80a3381cc565d 100644
|
||||
index aac9dd19237d0708990960d03328e7530cd7bc8e..9b714d156878a82e853403be870d8d1fd67cb967 100644
|
||||
--- a/src/main/java/net/minecraft/world/entity/Entity.java
|
||||
+++ b/src/main/java/net/minecraft/world/entity/Entity.java
|
||||
@@ -1859,8 +1859,7 @@ public abstract class Entity implements Nameable, EntityAccess, CommandSource, n
|
||||
|
||||
@@ -1,29 +1,20 @@
|
||||
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
|
||||
From: Etil <81570777+etil2jz@users.noreply.github.com>
|
||||
Date: Sat, 23 Oct 2021 17:31:25 +0200
|
||||
Subject: [PATCH] (Lithium) Patches
|
||||
Date: Fri, 12 Nov 2021 17:03:47 +0100
|
||||
Subject: [PATCH] Lithium Patches
|
||||
|
||||
Original code by CaffeineMC, licensed under GNU Lesser General Public License v3.0
|
||||
You can find the original code on https://github.com/CaffeineMC/lithium-fabric (Yarn mappings)
|
||||
|
||||
(Lithium) MixinDirection
|
||||
(Lithium) HashedList
|
||||
(Lithium) entity.fast_retrieval
|
||||
(Lithium) ai.task.goat_jump
|
||||
(Lithium) Reduce allocations
|
||||
(Lithium) CompactSineLUT
|
||||
|
||||
diff --git a/src/main/java/me/jellysquid/mods/lithium/common/util/Constants.java b/src/main/java/me/jellysquid/mods/lithium/common/util/Constants.java
|
||||
diff --git a/src/main/java/me/jellysquid/mods/lithium/common/util/ArrayConstants.java b/src/main/java/me/jellysquid/mods/lithium/common/util/ArrayConstants.java
|
||||
new file mode 100644
|
||||
index 0000000000000000000000000000000000000000..99c4b66f8ff251c82d199f6e10961ad161564a81
|
||||
index 0000000000000000000000000000000000000000..8f25942818346b5bfc800cf7bbbe4b52233ce1ef
|
||||
--- /dev/null
|
||||
+++ b/src/main/java/me/jellysquid/mods/lithium/common/util/Constants.java
|
||||
+++ b/src/main/java/me/jellysquid/mods/lithium/common/util/ArrayConstants.java
|
||||
@@ -0,0 +1,6 @@
|
||||
+package me.jellysquid.mods.lithium.common.util;
|
||||
+
|
||||
+public class Constants {
|
||||
+ public static final int[] EMPTY_ARRAY = new int[0];
|
||||
+ public static final int[] ZERO_ARRAY = new int[]{0};
|
||||
+public class ArrayConstants {
|
||||
+ public static final int[] EMPTY = new int[0];
|
||||
+ public static final int[] ZERO = new int[]{0};
|
||||
+}
|
||||
\ No newline at end of file
|
||||
diff --git a/src/main/java/me/jellysquid/mods/lithium/common/util/collections/HashedList.java b/src/main/java/me/jellysquid/mods/lithium/common/util/collections/HashedList.java
|
||||
@@ -419,33 +410,35 @@ index 0000000000000000000000000000000000000000..4bf72802d7b19b31226f357bad9e3e24
|
||||
+}
|
||||
\ No newline at end of file
|
||||
diff --git a/src/main/java/net/minecraft/core/Direction.java b/src/main/java/net/minecraft/core/Direction.java
|
||||
index 593d6251c75ec337175d08b85000239ba7da1af2..9fd0ce0ebe622732a476a0ce8ee8447202610b27 100644
|
||||
index 593d6251c75ec337175d08b85000239ba7da1af2..f7a6c68cb2c6da475a750b677a5a587d2faa04ba 100644
|
||||
--- a/src/main/java/net/minecraft/core/Direction.java
|
||||
+++ b/src/main/java/net/minecraft/core/Direction.java
|
||||
@@ -171,8 +171,13 @@ public enum Direction implements StringRepresentable {
|
||||
@@ -170,9 +170,14 @@ public enum Direction implements StringRepresentable {
|
||||
return entity.getViewXRot(1.0F) < 0.0F ? UP : DOWN;
|
||||
}
|
||||
}
|
||||
|
||||
+
|
||||
+ /**
|
||||
+ * @reason Avoid the modulo/abs operations
|
||||
+ * @author JellySquid
|
||||
+ */
|
||||
+
|
||||
|
||||
public Direction getOpposite() {
|
||||
- return from3DDataValue(this.oppositeIndex);
|
||||
+ return VALUES[this.oppositeIndex];
|
||||
}
|
||||
|
||||
public Direction getClockWise(Direction.Axis axis) {
|
||||
@@ -386,8 +391,13 @@ public enum Direction implements StringRepresentable {
|
||||
@@ -385,9 +390,14 @@ public enum Direction implements StringRepresentable {
|
||||
public float toYRot() {
|
||||
return (float)((this.data2d & 3) * 90);
|
||||
}
|
||||
|
||||
+
|
||||
+ /**
|
||||
+ * @reason Do not allocate an excessive number of Direction arrays
|
||||
+ * @author JellySquid
|
||||
+ */
|
||||
+
|
||||
|
||||
public static Direction getRandom(Random random) {
|
||||
- return Util.getRandom(VALUES, random);
|
||||
+ return VALUES[random.nextInt(VALUES.length)];
|
||||
@@ -488,8 +481,27 @@ index 4f55fdbdfea42834d2b664c6ecef6406d77b1259..2bc7c351b2bf113ff8fa33949691c19a
|
||||
}
|
||||
|
||||
public static float sqrt(float value) {
|
||||
diff --git a/src/main/java/net/minecraft/world/entity/LivingEntity.java b/src/main/java/net/minecraft/world/entity/LivingEntity.java
|
||||
index df12ba04df24e1c70c43e00283ea2a78ae2ca422..546f3f33c3f3d00a00bf0c6ff23b5e02888b8dda 100644
|
||||
--- a/src/main/java/net/minecraft/world/entity/LivingEntity.java
|
||||
+++ b/src/main/java/net/minecraft/world/entity/LivingEntity.java
|
||||
@@ -2996,11 +2996,13 @@ public abstract class LivingEntity extends Entity {
|
||||
}
|
||||
|
||||
}
|
||||
+
|
||||
+ private static final EquipmentSlot[] SLOTS = EquipmentSlot.values();
|
||||
|
||||
@Nullable
|
||||
private Map<EquipmentSlot, ItemStack> collectEquipmentChanges() {
|
||||
Map<EquipmentSlot, ItemStack> map = null;
|
||||
- EquipmentSlot[] aenumitemslot = EquipmentSlot.values();
|
||||
+ EquipmentSlot[] aenumitemslot = SLOTS;
|
||||
int i = aenumitemslot.length;
|
||||
|
||||
for (int j = 0; j < i; ++j) {
|
||||
diff --git a/src/main/java/net/minecraft/world/entity/ai/behavior/LongJumpToRandomPos.java b/src/main/java/net/minecraft/world/entity/ai/behavior/LongJumpToRandomPos.java
|
||||
index d28dd4cf6b6042fcb0a79da1427861d5d3ef10f8..bb6cc00fa95e6f15f125e35bc5bb58b44e6e93d9 100644
|
||||
index d28dd4cf6b6042fcb0a79da1427861d5d3ef10f8..4afe0c4db087042c661fec5619600d82917c6196 100644
|
||||
--- a/src/main/java/net/minecraft/world/entity/ai/behavior/LongJumpToRandomPos.java
|
||||
+++ b/src/main/java/net/minecraft/world/entity/ai/behavior/LongJumpToRandomPos.java
|
||||
@@ -1,6 +1,8 @@
|
||||
@@ -509,37 +521,37 @@ index d28dd4cf6b6042fcb0a79da1427861d5d3ef10f8..bb6cc00fa95e6f15f125e35bc5bb58b4
|
||||
+ private final ShortArrayList potentialWeights = new ShortArrayList();
|
||||
|
||||
- public LongJumpToRandomPos(UniformInt cooldownRange, int verticalRange, int horizontalRange, float maxRange, Function<E, SoundEvent> function) {
|
||||
+ private static int findIndex(ShortArrayList weights, int weightedIndex) {
|
||||
+ for (int i = 0; i < weights.size(); i++) {
|
||||
+ weightedIndex -= weights.getShort(i);
|
||||
+ if (weightedIndex < 0) {
|
||||
+ return i;
|
||||
+ }
|
||||
+ }
|
||||
+ return -1;
|
||||
+ }
|
||||
+
|
||||
+ public LongJumpToRandomPos(UniformInt cooldownRange, int maxLongJumpHeight, int maxLongJumpWidth, float maxRange, Function<E, SoundEvent> function) {
|
||||
+ private static int findIndex(ShortArrayList weights, int weightedIndex) {
|
||||
+ for (int i = 0; i < weights.size(); i++) {
|
||||
+ weightedIndex -= weights.getShort(i);
|
||||
+ if (weightedIndex < 0) {
|
||||
+ return i;
|
||||
+ }
|
||||
+ }
|
||||
+ return -1;
|
||||
+ }
|
||||
+
|
||||
+ public LongJumpToRandomPos(UniformInt cooldownRange, int maxLongJumpHeight, int maxLongJumpWidth, float maxRange, Function<E, SoundEvent> function) {
|
||||
super(ImmutableMap.of(MemoryModuleType.LOOK_TARGET, MemoryStatus.REGISTERED, MemoryModuleType.LONG_JUMP_COOLDOWN_TICKS, MemoryStatus.VALUE_ABSENT, MemoryModuleType.LONG_JUMP_MID_JUMP, MemoryStatus.VALUE_ABSENT), 200);
|
||||
this.timeBetweenLongJumps = cooldownRange;
|
||||
- this.maxLongJumpHeight = verticalRange;
|
||||
- this.maxLongJumpWidth = horizontalRange;
|
||||
+ this.maxLongJumpHeight = maxLongJumpHeight;
|
||||
+ this.maxLongJumpWidth = maxLongJumpWidth;
|
||||
+ this.maxLongJumpHeight = maxLongJumpHeight;
|
||||
+ this.maxLongJumpWidth = maxLongJumpWidth;
|
||||
this.maxJumpVelocity = maxRange;
|
||||
this.getJumpSound = function;
|
||||
}
|
||||
@@ -64,30 +78,63 @@ public class LongJumpToRandomPos<E extends Mob> extends Behavior<E> {
|
||||
@@ -64,30 +78,64 @@ public class LongJumpToRandomPos<E extends Mob> extends Behavior<E> {
|
||||
|
||||
return bl;
|
||||
}
|
||||
-
|
||||
+
|
||||
+ /**
|
||||
+ * @author 2No2Name
|
||||
+ * @reason only evaluate 20+ instead of ~100 possible jumps without affecting behavior
|
||||
+ * [VanillaCopy] the whole method, commented changes
|
||||
+ */
|
||||
|
||||
@Override
|
||||
protected void start(ServerLevel serverLevel, Mob mob, long l) {
|
||||
+ this.potentialTargets.clear();
|
||||
@@ -610,7 +622,7 @@ index d28dd4cf6b6042fcb0a79da1427861d5d3ef10f8..bb6cc00fa95e6f15f125e35bc5bb58b4
|
||||
}
|
||||
|
||||
@Override
|
||||
@@ -105,7 +152,12 @@ public class LongJumpToRandomPos<E extends Mob> extends Behavior<E> {
|
||||
@@ -105,7 +153,12 @@ public class LongJumpToRandomPos<E extends Mob> extends Behavior<E> {
|
||||
}
|
||||
} else {
|
||||
--this.findJumpTries;
|
||||
@@ -624,39 +636,87 @@ index d28dd4cf6b6042fcb0a79da1427861d5d3ef10f8..bb6cc00fa95e6f15f125e35bc5bb58b4
|
||||
if (optional.isPresent()) {
|
||||
this.jumpCandidates.remove(optional.get());
|
||||
mob.getBrain().setMemory(MemoryModuleType.LOOK_TARGET, new BlockPosTracker(optional.get().getJumpTarget()));
|
||||
diff --git a/src/main/java/net/minecraft/world/level/EntityBasedExplosionDamageCalculator.java b/src/main/java/net/minecraft/world/level/EntityBasedExplosionDamageCalculator.java
|
||||
index 02dddc66a1b2859f24ea22993de61ef336f6a162..67d463b5dbf9a09919f431647bcb00aef8235d99 100644
|
||||
--- a/src/main/java/net/minecraft/world/level/EntityBasedExplosionDamageCalculator.java
|
||||
+++ b/src/main/java/net/minecraft/world/level/EntityBasedExplosionDamageCalculator.java
|
||||
@@ -15,9 +15,15 @@ public class EntityBasedExplosionDamageCalculator extends ExplosionDamageCalcula
|
||||
|
||||
@Override
|
||||
public Optional<Float> getBlockExplosionResistance(Explosion explosion, BlockGetter world, BlockPos pos, BlockState blockState, FluidState fluidState) {
|
||||
- return super.getBlockExplosionResistance(explosion, world, pos, blockState, fluidState).map((float_) -> {
|
||||
- return this.source.getBlockExplosionResistance(explosion, world, pos, blockState, fluidState, float_);
|
||||
- });
|
||||
+ Optional<Float> optionalBlastResistance = super.getBlockExplosionResistance(explosion, world, pos, blockState, fluidState);
|
||||
+ if (optionalBlastResistance.isPresent()) {
|
||||
+ float blastResistance = optionalBlastResistance.get();
|
||||
+ float effectiveExplosionResistance = this.source.getBlockExplosionResistance(explosion, world, pos, blockState, fluidState, blastResistance);
|
||||
+ if (effectiveExplosionResistance != blastResistance) {
|
||||
+ return Optional.of(effectiveExplosionResistance);
|
||||
+ }
|
||||
+ }
|
||||
+ return optionalBlastResistance;
|
||||
}
|
||||
|
||||
@Override
|
||||
diff --git a/src/main/java/net/minecraft/world/level/block/ComposterBlock.java b/src/main/java/net/minecraft/world/level/block/ComposterBlock.java
|
||||
index 4c9ae6bdb2f0358798f84928271a2d783dcba7b4..6bf94e8825beab04724c111123de6a6f0aead77a 100644
|
||||
index 4c9ae6bdb2f0358798f84928271a2d783dcba7b4..62df788ce650c34f9197b201c932071dd96eddc8 100644
|
||||
--- a/src/main/java/net/minecraft/world/level/block/ComposterBlock.java
|
||||
+++ b/src/main/java/net/minecraft/world/level/block/ComposterBlock.java
|
||||
@@ -374,7 +374,7 @@ public class ComposterBlock extends Block implements WorldlyContainerHolder {
|
||||
@@ -42,6 +42,7 @@ import net.minecraft.world.entity.player.Player;
|
||||
import org.bukkit.craftbukkit.inventory.CraftBlockInventoryHolder;
|
||||
import org.bukkit.craftbukkit.util.DummyGeneratorAccess;
|
||||
// CraftBukkit end
|
||||
+import me.jellysquid.mods.lithium.common.util.ArrayConstants;
|
||||
|
||||
public class ComposterBlock extends Block implements WorldlyContainerHolder {
|
||||
|
||||
@@ -374,7 +375,7 @@ public class ComposterBlock extends Block implements WorldlyContainerHolder {
|
||||
|
||||
@Override
|
||||
public int[] getSlotsForFace(Direction side) {
|
||||
- return side == Direction.DOWN ? new int[]{0} : new int[0];
|
||||
+ return side == Direction.DOWN ? me.jellysquid.mods.lithium.common.util.Constants.ZERO_ARRAY : me.jellysquid.mods.lithium.common.util.Constants.ZERO_ARRAY; // Yatopia - avoid array allocation
|
||||
+ return side == Direction.DOWN ? ArrayConstants.ZERO : ArrayConstants.EMPTY;
|
||||
}
|
||||
|
||||
@Override
|
||||
@@ -423,7 +423,7 @@ public class ComposterBlock extends Block implements WorldlyContainerHolder {
|
||||
@@ -423,7 +424,7 @@ public class ComposterBlock extends Block implements WorldlyContainerHolder {
|
||||
|
||||
@Override
|
||||
public int[] getSlotsForFace(Direction side) {
|
||||
- return side == Direction.UP ? new int[]{0} : new int[0];
|
||||
+ return side == Direction.UP ? me.jellysquid.mods.lithium.common.util.Constants.ZERO_ARRAY : me.jellysquid.mods.lithium.common.util.Constants.ZERO_ARRAY; // Yatopia - avoid array allocation
|
||||
+ return side == Direction.UP ? ArrayConstants.ZERO : ArrayConstants.EMPTY;
|
||||
}
|
||||
|
||||
@Override
|
||||
@@ -460,7 +460,7 @@ public class ComposterBlock extends Block implements WorldlyContainerHolder {
|
||||
@@ -460,7 +461,7 @@ public class ComposterBlock extends Block implements WorldlyContainerHolder {
|
||||
|
||||
@Override
|
||||
public int[] getSlotsForFace(Direction side) {
|
||||
- return new int[0];
|
||||
+ return me.jellysquid.mods.lithium.common.util.Constants.EMPTY_ARRAY; // Yatopia - avoid array allocation
|
||||
+ return ArrayConstants.EMPTY;
|
||||
}
|
||||
|
||||
@Override
|
||||
diff --git a/src/main/java/net/minecraft/world/level/block/piston/PistonBaseBlock.java b/src/main/java/net/minecraft/world/level/block/piston/PistonBaseBlock.java
|
||||
index d770649a9e9e9bb28b52d00cd082b87de5814593..4d5f68ce1b3fe1181a8555b101969cee8234a700 100644
|
||||
--- a/src/main/java/net/minecraft/world/level/block/piston/PistonBaseBlock.java
|
||||
+++ b/src/main/java/net/minecraft/world/level/block/piston/PistonBaseBlock.java
|
||||
@@ -162,9 +162,11 @@ public class PistonBaseBlock extends DirectionalBlock {
|
||||
}
|
||||
|
||||
}
|
||||
+
|
||||
+ private static final Direction[] DIRECTIONS = Direction.values();
|
||||
|
||||
private boolean getNeighborSignal(Level world, BlockPos pos, Direction pistonFace) {
|
||||
- Direction[] aenumdirection = Direction.values();
|
||||
+ Direction[] aenumdirection = DIRECTIONS;
|
||||
int i = aenumdirection.length;
|
||||
|
||||
int j;
|
||||
diff --git a/src/main/java/net/minecraft/world/level/entity/EntitySectionStorage.java b/src/main/java/net/minecraft/world/level/entity/EntitySectionStorage.java
|
||||
index 24552500307c42f9f3dc5c4d9ba73a84a787423a..89adf2e3d28f995567282f1c9a5eff7136b59c15 100644
|
||||
index 24552500307c42f9f3dc5c4d9ba73a84a787423a..122728aef47547bf765f80a816cea5beb6352285 100644
|
||||
--- a/src/main/java/net/minecraft/world/level/entity/EntitySectionStorage.java
|
||||
+++ b/src/main/java/net/minecraft/world/level/entity/EntitySectionStorage.java
|
||||
@@ -34,31 +34,50 @@ public class EntitySectionStorage<T extends EntityAccess> {
|
||||
@@ -712,7 +772,7 @@ index 24552500307c42f9f3dc5c4d9ba73a84a787423a..89adf2e3d28f995567282f1c9a5eff71
|
||||
}
|
||||
}
|
||||
-
|
||||
+ }
|
||||
+ }
|
||||
+
|
||||
+ private void forEachInColumn(int x, int minY, int maxY, int z, Consumer<EntitySection<T>> action) {
|
||||
+ //y from negative to positive, but y is treated as unsigned
|
||||
|
||||
@@ -1,23 +1,14 @@
|
||||
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
|
||||
From: Etil <81570777+etil2jz@users.noreply.github.com>
|
||||
Date: Sat, 23 Oct 2021 18:27:31 +0200
|
||||
Subject: [PATCH] (Yatopia) Patches
|
||||
Date: Fri, 12 Nov 2021 18:33:14 +0100
|
||||
Subject: [PATCH] Yatopia Patches
|
||||
|
||||
Original code by YatopiaMC, licensed under MIT
|
||||
You can find the original code on https://github.com/YatopiaMC/Yatopia
|
||||
|
||||
(Yatopia) Utilities
|
||||
(Yatopia) Preload ProtocolLib EnumWrappers
|
||||
(Yatopia) add config for logging login location
|
||||
(Yatopia) Optimize TileEntity load/unload
|
||||
(Yatopia) Global Eula file
|
||||
(Yatopia) Use faster random implementation
|
||||
|
||||
diff --git a/build.gradle.kts b/build.gradle.kts
|
||||
index 5d31aecd7290ad30de745acc01252582adb64428..f19273b511a1f9c2930104e6d39f22646b2808e7 100644
|
||||
index 5fde6b03fcccef4f9cc5c84c3701e45b27bc4471..4d83a464bf40d5aab9b7e3f2bafba47434c1a945 100644
|
||||
--- a/build.gradle.kts
|
||||
+++ b/build.gradle.kts
|
||||
@@ -43,6 +43,7 @@ dependencies {
|
||||
@@ -40,6 +40,7 @@ dependencies {
|
||||
implementation("org.apache.logging.log4j:log4j-api:2.14.1") // Paper
|
||||
implementation("org.ow2.asm:asm:9.2")
|
||||
implementation("org.ow2.asm:asm-commons:9.2") // Paper - ASM event executor generation
|
||||
@@ -73,7 +64,7 @@ index a1d5c0f8fe2adb2ee56f3217e089211ec7c61eb0..ae2335e030599062a2a4b562506bb28f
|
||||
boolean var3;
|
||||
try {
|
||||
diff --git a/src/main/java/net/minecraft/server/MinecraftServer.java b/src/main/java/net/minecraft/server/MinecraftServer.java
|
||||
index afff56c48b54d4cade1460d7e153f1581938e049..018fc89f2eabef86d5d5d5175940f1af931f9429 100644
|
||||
index b36a7c71664f289f1328de5381c2ec359426d657..c302012df0b2bbd6cf13ff28ba102f4ddb71a3dc 100644
|
||||
--- a/src/main/java/net/minecraft/server/MinecraftServer.java
|
||||
+++ b/src/main/java/net/minecraft/server/MinecraftServer.java
|
||||
@@ -411,7 +411,7 @@ public abstract class MinecraftServer extends ReentrantBlockableEventLoop<TickTa
|
||||
@@ -134,7 +125,7 @@ index a7ea776f5f8dad3dd9475de41209d8704c0886d3..141d0143d3fd71a8e9e26c46af41df87
|
||||
double d1 = (double) (center.y - maxRange);
|
||||
double d2 = (double) (center.x + maxRange);
|
||||
diff --git a/src/main/java/net/minecraft/server/level/ServerPlayer.java b/src/main/java/net/minecraft/server/level/ServerPlayer.java
|
||||
index 11f46c1b8f4c8414e0667d1873542c17d6e01f2a..3c1e1957418903d8d505817736a633d85167f817 100644
|
||||
index 78fda0c982810b8b881a87099f355247566e513a..6e61028079d29fbb13c146b595c49cf2f7da2f20 100644
|
||||
--- a/src/main/java/net/minecraft/server/level/ServerPlayer.java
|
||||
+++ b/src/main/java/net/minecraft/server/level/ServerPlayer.java
|
||||
@@ -372,7 +372,7 @@ public class ServerPlayer extends Player {
|
||||
@@ -169,7 +160,7 @@ index 494ca8fa8c742d4eac9fb11878d3b3170d850265..5dd89126a7529277a89c6a9e914bb290
|
||||
final MinecraftServer server;
|
||||
public final Connection connection;
|
||||
diff --git a/src/main/java/net/minecraft/server/players/PlayerList.java b/src/main/java/net/minecraft/server/players/PlayerList.java
|
||||
index eaa005c1c9b4386bcdbe1d6eb28c3eca7635066c..335bd288ddf965870b7ed6f189593ccd30ccec0c 100644
|
||||
index eaa005c1c9b4386bcdbe1d6eb28c3eca7635066c..4df81adf0f0ffc93f9fe812681b04e2240008cf6 100644
|
||||
--- a/src/main/java/net/minecraft/server/players/PlayerList.java
|
||||
+++ b/src/main/java/net/minecraft/server/players/PlayerList.java
|
||||
@@ -269,7 +269,7 @@ public abstract class PlayerList {
|
||||
@@ -232,7 +223,7 @@ index 2bc7c351b2bf113ff8fa33949691c19a95cac3aa..8823d793f331c159a2b65e8b7528131f
|
||||
|
||||
public static int roundToward(int value, int divisor) {
|
||||
diff --git a/src/main/java/net/minecraft/world/entity/Entity.java b/src/main/java/net/minecraft/world/entity/Entity.java
|
||||
index c77b9348cc313ccb0fa7d5fbd2d80a3381cc565d..9f1bf26f72011bc22c2851e73da48837be354295 100644
|
||||
index 9b714d156878a82e853403be870d8d1fd67cb967..ddf71f9903f9a2030fe9bc0e97bfe03d374cb131 100644
|
||||
--- a/src/main/java/net/minecraft/world/entity/Entity.java
|
||||
+++ b/src/main/java/net/minecraft/world/entity/Entity.java
|
||||
@@ -159,7 +159,7 @@ public abstract class Entity implements Nameable, EntityAccess, CommandSource, n
|
||||
@@ -245,7 +236,7 @@ index c77b9348cc313ccb0fa7d5fbd2d80a3381cc565d..9f1bf26f72011bc22c2851e73da48837
|
||||
@Override
|
||||
public synchronized void setSeed(long seed) {
|
||||
diff --git a/src/main/java/net/minecraft/world/entity/LivingEntity.java b/src/main/java/net/minecraft/world/entity/LivingEntity.java
|
||||
index 71fefe3956c1e4458dd4b441f90902a3ed0cdf24..46d75cd28fbf6f5768bb115a02a2d377a2c181b7 100644
|
||||
index 546f3f33c3f3d00a00bf0c6ff23b5e02888b8dda..926204633911f68c8437f11404b90de1c446fda7 100644
|
||||
--- a/src/main/java/net/minecraft/world/entity/LivingEntity.java
|
||||
+++ b/src/main/java/net/minecraft/world/entity/LivingEntity.java
|
||||
@@ -392,17 +392,19 @@ public abstract class LivingEntity extends Entity {
|
||||
@@ -306,7 +297,7 @@ index 87f804e35e2f124f5ee73d9d9a4fd4b3069b00d0..bbc76d73e00e2629ff9193d690e42973
|
||||
protected static final int TARGETING_RANGE = 16;
|
||||
private static final TargetingConditions TARGET_CONDITIONS = TargetingConditions.forNonCombat().range(16.0D);
|
||||
diff --git a/src/main/java/net/minecraft/world/entity/monster/piglin/PiglinAi.java b/src/main/java/net/minecraft/world/entity/monster/piglin/PiglinAi.java
|
||||
index 7fa5cde9c26c21d4d800f720f373a8b702f4fcb5..0e14e48473ef7bd8d05a793b0f94ed1d1407cb9c 100644
|
||||
index 7fa5cde9c26c21d4d800f720f373a8b702f4fcb5..4806ef08ff9374cc7c04d8b0bfec8fc6ca982882 100644
|
||||
--- a/src/main/java/net/minecraft/world/entity/monster/piglin/PiglinAi.java
|
||||
+++ b/src/main/java/net/minecraft/world/entity/monster/piglin/PiglinAi.java
|
||||
@@ -378,7 +378,7 @@ public class PiglinAi {
|
||||
@@ -380,7 +371,7 @@ index 717b101bd2492037a9ca1d65d8cb3cebb7d6d4fe..0e49ded124da9487937b35f612e8b5a7
|
||||
this.costs = new int[3];
|
||||
this.enchantClue = new int[]{-1, -1, -1};
|
||||
diff --git a/src/main/java/net/minecraft/world/level/BaseSpawner.java b/src/main/java/net/minecraft/world/level/BaseSpawner.java
|
||||
index c601b8b12756682a4cb300be8ebed4319902c5b5..4e19580281f3df1c125ba29f57faba0c94d5395d 100644
|
||||
index 56d3867f748d92a55976820215d9b8316989677b..7bf38137fa3f799a0bc5b22fea057078a5343f66 100644
|
||||
--- a/src/main/java/net/minecraft/world/level/BaseSpawner.java
|
||||
+++ b/src/main/java/net/minecraft/world/level/BaseSpawner.java
|
||||
@@ -57,7 +57,7 @@ public abstract class BaseSpawner {
|
||||
@@ -603,7 +594,7 @@ index 39e941a6a315e2a9fc0f47eb39ef9d2b58069f90..7adfd7d03a57e1b55a8fbf77ef53c9a6
|
||||
|
||||
MinecraftServer minecraftServer = this.level.getServer();
|
||||
diff --git a/src/main/java/org/bukkit/craftbukkit/CraftServer.java b/src/main/java/org/bukkit/craftbukkit/CraftServer.java
|
||||
index 06b410e43ecfe20d25d50346d76a3d58fe19a058..d5cc4eec126a865a655820d6e96ce754e1cb79c2 100644
|
||||
index 2e2aff40f5a8205f804fa264a469be1dcfee163b..1ba8d7c9a99ffde69fe6a86e3faa97c9196ce2ef 100644
|
||||
--- a/src/main/java/org/bukkit/craftbukkit/CraftServer.java
|
||||
+++ b/src/main/java/org/bukkit/craftbukkit/CraftServer.java
|
||||
@@ -1211,7 +1211,7 @@ public final class CraftServer implements Server {
|
||||
@@ -795,7 +786,7 @@ index 0000000000000000000000000000000000000000..f7c7122b871fee50f55dbd6ec663d416
|
||||
+}
|
||||
\ No newline at end of file
|
||||
diff --git a/src/main/java/wtf/etil/mirai/MiraiConfig.java b/src/main/java/wtf/etil/mirai/MiraiConfig.java
|
||||
index 4c92005a52589b9056d76c435d60fe1581dd9c48..35646ca1c13b30a40bec09b9ef1aa7ab75616e38 100644
|
||||
index e65b1d300df06cb7f08caea3e08b196656223e7b..9fa663198ddb793f1aa8fe4e1991b6e794a270a6 100644
|
||||
--- a/src/main/java/wtf/etil/mirai/MiraiConfig.java
|
||||
+++ b/src/main/java/wtf/etil/mirai/MiraiConfig.java
|
||||
@@ -113,18 +113,11 @@ public class MiraiConfig {
|
||||
|
||||
@@ -1,26 +1,15 @@
|
||||
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
|
||||
From: Etil <81570777+etil2jz@users.noreply.github.com>
|
||||
Date: Sun, 24 Oct 2021 10:57:49 +0200
|
||||
Subject: [PATCH] (Patina) Patches
|
||||
Date: Fri, 12 Nov 2021 18:52:51 +0100
|
||||
Subject: [PATCH] Patina Patches
|
||||
|
||||
Original code by PatinaMC, licensed under GNU General Public License v3.0
|
||||
You can find the original code on https://github.com/PatinaMC/Patina
|
||||
|
||||
(Patina) completely remove snooper
|
||||
(Patina) remove TickTask
|
||||
(Patina) completely remove Metrics
|
||||
(Patina) Remove VersionFetcher
|
||||
(Patina) Remove unnecessary `LogManager.getLogger()`
|
||||
(Patina) make a field final
|
||||
(Patina) don't create new random instance
|
||||
(Patina) completely remove bootstrapExecutor
|
||||
|
||||
diff --git a/src/main/java/com/destroystokyo/paper/Metrics.java b/src/main/java/com/destroystokyo/paper/Metrics.java
|
||||
deleted file mode 100644
|
||||
index ea34cb63a624f70f48ec9012999607fe88af8166..0000000000000000000000000000000000000000
|
||||
index d6e94f28e1accb15749ba1aea21e7c5ac27a83a2..0000000000000000000000000000000000000000
|
||||
--- a/src/main/java/com/destroystokyo/paper/Metrics.java
|
||||
+++ /dev/null
|
||||
@@ -1,675 +0,0 @@
|
||||
@@ -1,677 +0,0 @@
|
||||
-package com.destroystokyo.paper;
|
||||
-
|
||||
-import net.minecraft.server.MinecraftServer;
|
||||
@@ -616,7 +605,8 @@ index ea34cb63a624f70f48ec9012999607fe88af8166..00000000000000000000000000000000
|
||||
- boolean logFailedRequests = config.getBoolean("logFailedRequests", false);
|
||||
- // Only start Metrics, if it's enabled in the config
|
||||
- if (config.getBoolean("enabled", true)) {
|
||||
- Metrics metrics = new Metrics("Paper", serverUUID, logFailedRequests, Bukkit.getLogger()); // Mirai - add Paper metrics system back (so we can disable it after >:D)
|
||||
- //Metrics metrics = new Metrics("Airplane", serverUUID, logFailedRequests, Bukkit.getLogger()); // Tuinity - we have our own bstats page // Airplane
|
||||
- Metrics metrics = new Metrics("Paper", serverUUID, logFailedRequests, Bukkit.getLogger()); // Mirai - add Paper metrics system back (so we can disable it after >:D)
|
||||
-
|
||||
- metrics.addCustomChart(new Metrics.SimplePie("minecraft_version", () -> {
|
||||
- String minecraftVersion = Bukkit.getVersion();
|
||||
@@ -626,7 +616,8 @@ index ea34cb63a624f70f48ec9012999607fe88af8166..00000000000000000000000000000000
|
||||
-
|
||||
- metrics.addCustomChart(new Metrics.SingleLineChart("players", () -> Bukkit.getOnlinePlayers().size()));
|
||||
- metrics.addCustomChart(new Metrics.SimplePie("online_mode", () -> Bukkit.getOnlineMode() ? "online" : "offline"));
|
||||
- metrics.addCustomChart(new Metrics.SimplePie("paper_version", () -> (Metrics.class.getPackage().getImplementationVersion() != null) ? Metrics.class.getPackage().getImplementationVersion() : "unknown")); // Mirai - add Paper metrics system back (so we can disable it after >:D)
|
||||
- //metrics.addCustomChart(new Metrics.SimplePie("airplane_version", () -> (Metrics.class.getPackage().getImplementationVersion() != null) ? Metrics.class.getPackage().getImplementationVersion() : "unknown")); // Tuinity - we have our own bstats page // Airplane
|
||||
- metrics.addCustomChart(new Metrics.SimplePie("paper_version", () -> (Metrics.class.getPackage().getImplementationVersion() != null) ? Metrics.class.getPackage().getImplementationVersion() : "unknown")); // Mirai - add Paper metrics system back (so we can disable it after >:D)
|
||||
-
|
||||
- metrics.addCustomChart(new Metrics.DrilldownPie("java_version", () -> {
|
||||
- Map<String, Map<String, Integer>> map = new HashMap<>();
|
||||
@@ -879,7 +870,7 @@ index ece77f5ea4b14bbed7c070131b3251ea86764538..00000000000000000000000000000000
|
||||
- }
|
||||
-}
|
||||
diff --git a/src/main/java/net/minecraft/Util.java b/src/main/java/net/minecraft/Util.java
|
||||
index 5c7b9ad379f3c272e15648dd16f4df9245d927da..af598369e5aeae700d7d9da049f173fc51b7a370 100644
|
||||
index 5c7b9ad379f3c272e15648dd16f4df9245d927da..eedbbc74b25bcde01a1e6faba4b4d7a50464eaf0 100644
|
||||
--- a/src/main/java/net/minecraft/Util.java
|
||||
+++ b/src/main/java/net/minecraft/Util.java
|
||||
@@ -65,7 +65,7 @@ import org.apache.logging.log4j.Logger;
|
||||
@@ -887,7 +878,7 @@ index 5c7b9ad379f3c272e15648dd16f4df9245d927da..af598369e5aeae700d7d9da049f173fc
|
||||
public class Util {
|
||||
private static final AtomicInteger WORKER_COUNT = new AtomicInteger(1);
|
||||
- private static final ExecutorService BOOTSTRAP_EXECUTOR = makeExecutor("Bootstrap", -2); // Paper - add -2 priority
|
||||
+ //private static final ExecutorService BOOTSTRAP_EXECUTOR = makeExecutor("Bootstrap", -2); // Paper - add -2 priority // Patina
|
||||
+ //private static final ExecutorService BOOTSTRAP_EXECUTOR = makeExecutor("Bootstrap", -2); // Paper - add -2 priority
|
||||
private static final ExecutorService BACKGROUND_EXECUTOR = makeExecutor("Main", -1); // Paper - add -1 priority
|
||||
// Paper start - don't submit BLOCKING PROFILE LOOKUPS to the world gen thread
|
||||
public static final ExecutorService PROFILE_EXECUTOR = Executors.newFixedThreadPool(2, new java.util.concurrent.ThreadFactory() {
|
||||
@@ -905,7 +896,7 @@ index 5c7b9ad379f3c272e15648dd16f4df9245d927da..af598369e5aeae700d7d9da049f173fc
|
||||
public static Executor backgroundExecutor() {
|
||||
return BACKGROUND_EXECUTOR;
|
||||
diff --git a/src/main/java/net/minecraft/commands/CommandSourceStack.java b/src/main/java/net/minecraft/commands/CommandSourceStack.java
|
||||
index 71e29d29ed5c2d61832e2f124967bb223708406f..8025b87e8f99e305e5c2e4d3b9f6d831d5f752d1 100644
|
||||
index 71e29d29ed5c2d61832e2f124967bb223708406f..6332ecc3daab9395512b4e2eaafe3e2f0c7c723c 100644
|
||||
--- a/src/main/java/net/minecraft/commands/CommandSourceStack.java
|
||||
+++ b/src/main/java/net/minecraft/commands/CommandSourceStack.java
|
||||
@@ -56,7 +56,7 @@ public class CommandSourceStack implements SharedSuggestionProvider, com.destroy
|
||||
@@ -913,12 +904,12 @@ index 71e29d29ed5c2d61832e2f124967bb223708406f..8025b87e8f99e305e5c2e4d3b9f6d831
|
||||
private final EntityAnchorArgument.Anchor anchor;
|
||||
private final Vec2 rotation;
|
||||
- public Map<Thread, CommandNode> currentCommand = new ConcurrentHashMap<>(); // CraftBukkit // Paper
|
||||
+ public final Map<Thread, CommandNode> currentCommand = new ConcurrentHashMap<>(); // CraftBukkit // Paper
|
||||
+ public final Map<Thread, CommandNode> currentCommand = new ConcurrentHashMap<>(); // CraftBukkit // Paper // Patina
|
||||
|
||||
public CommandSourceStack(CommandSource output, Vec3 pos, Vec2 rot, ServerLevel world, int level, String name, Component displayName, MinecraftServer server, @Nullable Entity entity) {
|
||||
this(output, pos, rot, world, level, name, displayName, server, entity, false, (commandcontext, flag, j) -> {
|
||||
diff --git a/src/main/java/net/minecraft/server/MinecraftServer.java b/src/main/java/net/minecraft/server/MinecraftServer.java
|
||||
index 018fc89f2eabef86d5d5d5175940f1af931f9429..31916c18ca01b6a47e1914d016e032587b55fd88 100644
|
||||
index c302012df0b2bbd6cf13ff28ba102f4ddb71a3dc..5192a1d5d0a823b670992b5ee166261d21a625c9 100644
|
||||
--- a/src/main/java/net/minecraft/server/MinecraftServer.java
|
||||
+++ b/src/main/java/net/minecraft/server/MinecraftServer.java
|
||||
@@ -120,8 +120,8 @@ import net.minecraft.util.profiling.metrics.profiling.ServerMetricsSamplersProvi
|
||||
@@ -1072,7 +1063,7 @@ index 018fc89f2eabef86d5d5d5175940f1af931f9429..31916c18ca01b6a47e1914d016e03258
|
||||
public int getSpawnProtectionRadius() {
|
||||
return 16;
|
||||
diff --git a/src/main/java/net/minecraft/server/dedicated/DedicatedServer.java b/src/main/java/net/minecraft/server/dedicated/DedicatedServer.java
|
||||
index 53308e50aad07b1486ade34284baf72a0e8d7eca..664261aaa61ee12215d34d54be8b737b0069f776 100644
|
||||
index 46db063cda90b83805b45fbe6348e32ee4b3b929..870a9afb4e98d0988c470e64b0b21cdf453b7664 100644
|
||||
--- a/src/main/java/net/minecraft/server/dedicated/DedicatedServer.java
|
||||
+++ b/src/main/java/net/minecraft/server/dedicated/DedicatedServer.java
|
||||
@@ -508,7 +508,8 @@ public class DedicatedServer extends MinecraftServer implements ServerInterface
|
||||
@@ -1140,7 +1131,7 @@ index 35f27e9a7c82eaec5b4a1a71696dac8485b2cd6d..14cf1956ef31f49684195292bed2d891
|
||||
@Override
|
||||
protected boolean scheduleExecutables() {
|
||||
diff --git a/src/main/java/net/minecraft/server/level/ServerPlayer.java b/src/main/java/net/minecraft/server/level/ServerPlayer.java
|
||||
index 3c1e1957418903d8d505817736a633d85167f817..2bc5bb4fbfb8b354c08e00059727d96426bcdaac 100644
|
||||
index 6e61028079d29fbb13c146b595c49cf2f7da2f20..5635b7fbfbc27e2042eaf4af1fe139bde514e7ab 100644
|
||||
--- a/src/main/java/net/minecraft/server/level/ServerPlayer.java
|
||||
+++ b/src/main/java/net/minecraft/server/level/ServerPlayer.java
|
||||
@@ -372,7 +372,7 @@ public class ServerPlayer extends Player {
|
||||
@@ -1220,7 +1211,7 @@ index dcce05d2f4ab16424db4ab103a12188e207a457b..540aa5e12bb6b44d510c701f2867f541
|
||||
} else {
|
||||
this.doRunTask(this.pendingRunnables.remove());
|
||||
diff --git a/src/main/java/net/minecraft/world/entity/Entity.java b/src/main/java/net/minecraft/world/entity/Entity.java
|
||||
index 9f1bf26f72011bc22c2851e73da48837be354295..1463e0f028c450d550d7e7cc0c165470a655f430 100644
|
||||
index ddf71f9903f9a2030fe9bc0e97bfe03d374cb131..8572412803738bb9ff31d07c470cd19b7ccd085f 100644
|
||||
--- a/src/main/java/net/minecraft/world/entity/Entity.java
|
||||
+++ b/src/main/java/net/minecraft/world/entity/Entity.java
|
||||
@@ -164,7 +164,7 @@ public abstract class Entity implements Nameable, EntityAccess, CommandSource, n
|
||||
@@ -1284,7 +1275,7 @@ index 67fbfe5da8e7aea591f6cda52da881b7f6a30c53..75b00ee813da7447f33ba2a334e96892
|
||||
if (!s1.isEmpty()) {
|
||||
try {
|
||||
diff --git a/src/main/java/org/bukkit/craftbukkit/CraftServer.java b/src/main/java/org/bukkit/craftbukkit/CraftServer.java
|
||||
index d5cc4eec126a865a655820d6e96ce754e1cb79c2..42d227aa8496c3a00584ccef02958793279c4e93 100644
|
||||
index 1ba8d7c9a99ffde69fe6a86e3faa97c9196ce2ef..e6d72a63ed0290f73f2808cbf45d4eaa04f8966a 100644
|
||||
--- a/src/main/java/org/bukkit/craftbukkit/CraftServer.java
|
||||
+++ b/src/main/java/org/bukkit/craftbukkit/CraftServer.java
|
||||
@@ -1211,7 +1211,7 @@ public final class CraftServer implements Server {
|
||||
@@ -1297,7 +1288,7 @@ index d5cc4eec126a865a655820d6e96ce754e1cb79c2..42d227aa8496c3a00584ccef02958793
|
||||
dimensionmanager = worlddimension.type();
|
||||
chunkgenerator = worlddimension.generator();
|
||||
diff --git a/src/main/java/org/bukkit/craftbukkit/util/CraftMagicNumbers.java b/src/main/java/org/bukkit/craftbukkit/util/CraftMagicNumbers.java
|
||||
index 60855b993e712354af68578b58933ca1e5f7875e..7b014567928d10d0d734341c7c3bebe0c30bdb09 100644
|
||||
index 01122f754477044c2a7a04b2cd2a400ce94e5c9f..6c8a50d08f732c77de77075fdeaa9b00ce8d8ec8 100644
|
||||
--- a/src/main/java/org/bukkit/craftbukkit/util/CraftMagicNumbers.java
|
||||
+++ b/src/main/java/org/bukkit/craftbukkit/util/CraftMagicNumbers.java
|
||||
@@ -392,10 +392,12 @@ public final class CraftMagicNumbers implements UnsafeValues {
|
||||
|
||||
@@ -1,20 +1,14 @@
|
||||
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
|
||||
From: Etil <81570777+etil2jz@users.noreply.github.com>
|
||||
Date: Sun, 24 Oct 2021 11:20:09 +0200
|
||||
Subject: [PATCH] (Jettpack) Patches
|
||||
Date: Fri, 12 Nov 2021 19:16:20 +0100
|
||||
Subject: [PATCH] Jettpack Patches
|
||||
|
||||
Original code by Titaniumtown, licensed under GNU General Public License v3.0
|
||||
You can find the original code on https://gitlab.com/Titaniumtown/JettPack
|
||||
|
||||
(Jettpack) Use LinkedBlockingDeque in IAsyncTaskHandler
|
||||
(Jettpack) Better handling of async tasks
|
||||
(Jettpack) Use MCUtil.asyncExecutor for MAIN_WORKER_EXECUTOR in SystemUtils
|
||||
|
||||
diff --git a/src/main/java/net/minecraft/Util.java b/src/main/java/net/minecraft/Util.java
|
||||
index af598369e5aeae700d7d9da049f173fc51b7a370..850edad60a6677904487039d2977170d1a5fb11c 100644
|
||||
index eedbbc74b25bcde01a1e6faba4b4d7a50464eaf0..e314b6cf093f88da218068ef1f2b238a0b23d1c6 100644
|
||||
--- a/src/main/java/net/minecraft/Util.java
|
||||
+++ b/src/main/java/net/minecraft/Util.java
|
||||
@@ -62,6 +62,11 @@ import net.minecraft.world.level.block.state.properties.Property;
|
||||
@@ -62,6 +62,10 @@ import net.minecraft.world.level.block.state.properties.Property;
|
||||
import org.apache.commons.io.IOUtils;
|
||||
import org.apache.logging.log4j.LogManager;
|
||||
import org.apache.logging.log4j.Logger;
|
||||
@@ -22,11 +16,10 @@ index af598369e5aeae700d7d9da049f173fc51b7a370..850edad60a6677904487039d2977170d
|
||||
+import wtf.etil.mirai.server.util.ServerWorkerWrapper;
|
||||
+import net.minecraft.server.MCUtil;
|
||||
+import java.util.Collections;
|
||||
+
|
||||
|
||||
public class Util {
|
||||
private static final AtomicInteger WORKER_COUNT = new AtomicInteger(1);
|
||||
@@ -139,7 +144,44 @@ public class Util {
|
||||
@@ -139,7 +143,44 @@ public class Util {
|
||||
if (i <= 0) {
|
||||
executorService = MoreExecutors.newDirectExecutorService();
|
||||
} else {
|
||||
@@ -93,10 +86,10 @@ index b7c24a7ff4dc50d03f74b21a0b353d0ce559b4d4..065bd28349982bb7af97182c6cecff43
|
||||
|
||||
private void sendAsync(ServerPlayer player) {
|
||||
diff --git a/src/main/java/net/minecraft/server/MCUtil.java b/src/main/java/net/minecraft/server/MCUtil.java
|
||||
index f9701ef4162868894a81f0d1ac9b58d00d9a2d65..3a81e1c901326abf15c7c000e8b0a03ffa722cb2 100644
|
||||
index b5be0486d1cffe60808948b4b0bfd709664b2ae4..f12181bf8a97c458149ae92b8ff443bb923ba82f 100644
|
||||
--- a/src/main/java/net/minecraft/server/MCUtil.java
|
||||
+++ b/src/main/java/net/minecraft/server/MCUtil.java
|
||||
@@ -52,11 +52,14 @@ import java.util.concurrent.atomic.AtomicBoolean;
|
||||
@@ -53,11 +53,14 @@ import java.util.concurrent.atomic.AtomicBoolean;
|
||||
import java.util.function.BiConsumer;
|
||||
import java.util.function.Consumer;
|
||||
import java.util.function.Supplier;
|
||||
@@ -113,7 +106,7 @@ index f9701ef4162868894a81f0d1ac9b58d00d9a2d65..3a81e1c901326abf15c7c000e8b0a03f
|
||||
new ThreadFactoryBuilder().setNameFormat("Paper Async Task Handler Thread - %1$d").build()
|
||||
);
|
||||
public static final ThreadPoolExecutor cleanerExecutor = new ThreadPoolExecutor(
|
||||
@@ -67,6 +70,30 @@ public final class MCUtil {
|
||||
@@ -68,6 +71,30 @@ public final class MCUtil {
|
||||
|
||||
public static final long INVALID_CHUNK_KEY = getCoordinateKey(Integer.MAX_VALUE, Integer.MAX_VALUE);
|
||||
|
||||
@@ -145,7 +138,7 @@ index f9701ef4162868894a81f0d1ac9b58d00d9a2d65..3a81e1c901326abf15c7c000e8b0a03f
|
||||
public static Runnable once(Runnable run) {
|
||||
AtomicBoolean ran = new AtomicBoolean(false);
|
||||
diff --git a/src/main/java/net/minecraft/server/MinecraftServer.java b/src/main/java/net/minecraft/server/MinecraftServer.java
|
||||
index 31916c18ca01b6a47e1914d016e032587b55fd88..e5bc37ec44ba0225fa1a0cba6a62a7d22fd1e892 100644
|
||||
index 5192a1d5d0a823b670992b5ee166261d21a625c9..7544dbd0c9303a822f11b6f9db126058a67e07e8 100644
|
||||
--- a/src/main/java/net/minecraft/server/MinecraftServer.java
|
||||
+++ b/src/main/java/net/minecraft/server/MinecraftServer.java
|
||||
@@ -368,7 +368,8 @@ public abstract class MinecraftServer extends ReentrantBlockableEventLoop<Runnab
|
||||
@@ -166,14 +159,16 @@ index 31916c18ca01b6a47e1914d016e032587b55fd88..e5bc37ec44ba0225fa1a0cba6a62a7d2
|
||||
Util.shutdownExecutors(); // Paper
|
||||
LOGGER.info("Closing Server");
|
||||
try {
|
||||
@@ -1539,6 +1541,7 @@ public abstract class MinecraftServer extends ReentrantBlockableEventLoop<Runnab
|
||||
@@ -1539,7 +1541,8 @@ public abstract class MinecraftServer extends ReentrantBlockableEventLoop<Runnab
|
||||
|
||||
// Paper start - move executeAll() into full server tick timing
|
||||
try (co.aikar.timings.Timing ignored = MinecraftTimings.processTasksTimer.startTiming()) {
|
||||
+ MCUtil.flushAsyncTasks();
|
||||
this.runAllTasks();
|
||||
- this.runAllTasks();
|
||||
+ MCUtil.flushAsyncTasks();
|
||||
+ this.runAllTasks();
|
||||
}
|
||||
// Paper end
|
||||
|
||||
diff --git a/src/main/java/net/minecraft/server/network/ServerLoginPacketListenerImpl.java b/src/main/java/net/minecraft/server/network/ServerLoginPacketListenerImpl.java
|
||||
index 5dd89126a7529277a89c6a9e914bb29032f709ff..0282b1082c104f18b548abd47e1745467874ad4c 100644
|
||||
--- a/src/main/java/net/minecraft/server/network/ServerLoginPacketListenerImpl.java
|
||||
@@ -383,7 +378,7 @@ index bee38307494188800886a1622fed229b88dbd8f1..b3db65c1088888a8d6ae2395273239e8
|
||||
Logger log = Bukkit.getServer().getLogger();
|
||||
diff --git a/src/main/java/wtf/etil/mirai/server/util/ServerWorkerWrapper.java b/src/main/java/wtf/etil/mirai/server/util/ServerWorkerWrapper.java
|
||||
new file mode 100644
|
||||
index 0000000000000000000000000000000000000000..f13ed35d4a808667e6a3a58c285f5a1d9006d6bf
|
||||
index 0000000000000000000000000000000000000000..4633764f3d806c7e29cbda6e85db5a3432ad0c29
|
||||
--- /dev/null
|
||||
+++ b/src/main/java/wtf/etil/mirai/server/util/ServerWorkerWrapper.java
|
||||
@@ -0,0 +1,24 @@
|
||||
@@ -411,3 +406,4 @@ index 0000000000000000000000000000000000000000..f13ed35d4a808667e6a3a58c285f5a1d
|
||||
+ }
|
||||
+ }
|
||||
+}
|
||||
\ No newline at end of file
|
||||
|
||||
@@ -1,22 +1,14 @@
|
||||
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
|
||||
From: Etil <81570777+etil2jz@users.noreply.github.com>
|
||||
Date: Sun, 24 Oct 2021 11:48:02 +0200
|
||||
Subject: [PATCH] (Sugarcane) Patches
|
||||
Date: Fri, 12 Nov 2021 22:51:41 +0100
|
||||
Subject: [PATCH] Sugarcane Patches
|
||||
|
||||
Original code by YatopiaMC, licensed under MIT
|
||||
You can find the original code on https://github.com/YatopiaMC/Yatopia
|
||||
|
||||
(Sugarcane) Add NBT API as a first-class lib
|
||||
(Sugarcane) Add GameProfileLookupEvent
|
||||
(Sugarcane) Stop wasting resources on JsonList#get
|
||||
(Sugarcane) New nbt cache
|
||||
(Sugarcane) Configurable flight checks
|
||||
|
||||
diff --git a/build.gradle.kts b/build.gradle.kts
|
||||
index f19273b511a1f9c2930104e6d39f22646b2808e7..e0077c83202e9b092bdd76c9dfbeb6f0b1c85947 100644
|
||||
index 4d83a464bf40d5aab9b7e3f2bafba47434c1a945..c76ddc77c09e39d2476a91de39ca55a1e737379c 100644
|
||||
--- a/build.gradle.kts
|
||||
+++ b/build.gradle.kts
|
||||
@@ -117,6 +117,7 @@ relocation {
|
||||
@@ -113,6 +113,7 @@ relocation {
|
||||
relocate("org.bukkit.craftbukkit" to "org.bukkit.craftbukkit.v$packageVersion") {
|
||||
exclude("org.bukkit.craftbukkit.Main*")
|
||||
}
|
||||
@@ -50,7 +42,7 @@ index 84551164b76bc8f064a3a0c030c3a1b47f567b6f..b0f8b11ea071fa96beefcc28cab6a552
|
||||
if (this.profile.isComplete()) {
|
||||
server.getProfileCache().add(this.profile);
|
||||
diff --git a/src/main/java/net/minecraft/server/MinecraftServer.java b/src/main/java/net/minecraft/server/MinecraftServer.java
|
||||
index e5bc37ec44ba0225fa1a0cba6a62a7d22fd1e892..87466f40c837bba4a1a2bc52de07897226cf145a 100644
|
||||
index 7544dbd0c9303a822f11b6f9db126058a67e07e8..3d23dc1bebe66ceb00dd2937befdd2a015dacaa5 100644
|
||||
--- a/src/main/java/net/minecraft/server/MinecraftServer.java
|
||||
+++ b/src/main/java/net/minecraft/server/MinecraftServer.java
|
||||
@@ -1103,7 +1103,9 @@ public abstract class MinecraftServer extends ReentrantBlockableEventLoop<Runnab
|
||||
@@ -64,7 +56,7 @@ index e5bc37ec44ba0225fa1a0cba6a62a7d22fd1e892..87466f40c837bba4a1a2bc52de078972
|
||||
if (org.spigotmc.SpigotConfig.saveUserCacheOnStopOnly) {
|
||||
MinecraftServer.LOGGER.info("Saving usercache.json");
|
||||
diff --git a/src/main/java/net/minecraft/server/network/ServerGamePacketListenerImpl.java b/src/main/java/net/minecraft/server/network/ServerGamePacketListenerImpl.java
|
||||
index 029c21d9416520469548293f9a2ec0c056507d05..0352d1b1a016eb1d3426e8c0abbd960b428d6f98 100644
|
||||
index 744f7b717f14a070d5a4be0b35e7f422694fb407..d268068bf4ac977250f428d17a2bec2393cb7dad 100644
|
||||
--- a/src/main/java/net/minecraft/server/network/ServerGamePacketListenerImpl.java
|
||||
+++ b/src/main/java/net/minecraft/server/network/ServerGamePacketListenerImpl.java
|
||||
@@ -318,7 +318,7 @@ public class ServerGamePacketListenerImpl implements ServerPlayerConnection, Ser
|
||||
@@ -86,7 +78,7 @@ index 029c21d9416520469548293f9a2ec0c056507d05..0352d1b1a016eb1d3426e8c0abbd960b
|
||||
this.disconnect(com.destroystokyo.paper.PaperConfig.flyingKickVehicleMessage, org.bukkit.event.player.PlayerKickEvent.Cause.FLYING_VEHICLE); // Paper - use configurable kick message & kick event cause
|
||||
return;
|
||||
diff --git a/src/main/java/net/minecraft/server/players/PlayerList.java b/src/main/java/net/minecraft/server/players/PlayerList.java
|
||||
index 335bd288ddf965870b7ed6f189593ccd30ccec0c..adf3efb2c884fc1c738a0494471a2a12fae74d8a 100644
|
||||
index 4df81adf0f0ffc93f9fe812681b04e2240008cf6..6e8581a42074e159d09320f4a0a941775160f2f5 100644
|
||||
--- a/src/main/java/net/minecraft/server/players/PlayerList.java
|
||||
+++ b/src/main/java/net/minecraft/server/players/PlayerList.java
|
||||
@@ -745,13 +745,19 @@ public abstract class PlayerList {
|
||||
@@ -94,24 +86,30 @@ index 335bd288ddf965870b7ed6f189593ccd30ccec0c..adf3efb2c884fc1c738a0494471a2a12
|
||||
// Paper end
|
||||
|
||||
- chatmessage = new TranslatableComponent("multiplayer.disconnect.banned.reason", new Object[]{gameprofilebanentry.getReason()});
|
||||
- if (gameprofilebanentry.getExpires() != null) {
|
||||
- chatmessage.append(new TranslatableComponent("multiplayer.disconnect.banned.expiration", new Object[]{PlayerList.BAN_DATE_FORMAT.format(gameprofilebanentry.getExpires())}));
|
||||
- }
|
||||
-
|
||||
- // return chatmessage;
|
||||
- event.disallow(PlayerLoginEvent.Result.KICK_BANNED, PaperAdventure.asAdventure(chatmessage)); // Paper - Adventure
|
||||
+ if (!gameprofilebanentry.hasExpired()) { // Sugarcane - Stop wasting resources on JsonList#get
|
||||
+ chatmessage = new TranslatableComponent("multiplayer.disconnect.banned.reason", new Object[]{gameprofilebanentry.getReason()});
|
||||
if (gameprofilebanentry.getExpires() != null) {
|
||||
chatmessage.append(new TranslatableComponent("multiplayer.disconnect.banned.expiration", new Object[]{PlayerList.BAN_DATE_FORMAT.format(gameprofilebanentry.getExpires())}));
|
||||
}
|
||||
|
||||
// return chatmessage;
|
||||
+ // Sugarcane start - Stop wasting resources on JsonList#get
|
||||
event.disallow(PlayerLoginEvent.Result.KICK_BANNED, PaperAdventure.asAdventure(chatmessage)); // Paper - Adventure
|
||||
+ chatmessage = new TranslatableComponent("multiplayer.disconnect.banned.reason", new Object[]{gameprofilebanentry.getReason()});
|
||||
+ if (gameprofilebanentry.getExpires() != null) {
|
||||
+ chatmessage.append(new TranslatableComponent("multiplayer.disconnect.banned.expiration", new Object[]{PlayerList.BAN_DATE_FORMAT.format(gameprofilebanentry.getExpires())}));
|
||||
+ }
|
||||
+
|
||||
+ // return chatmessage;
|
||||
+ // Sugarcane start - Stop wasting resources on JsonList#get
|
||||
+ event.disallow(PlayerLoginEvent.Result.KICK_BANNED, PaperAdventure.asAdventure(chatmessage)); // Paper - Adventure
|
||||
+ } else {
|
||||
+ getBans().remove(gameprofile);
|
||||
+ }
|
||||
+ // Sugarcane end
|
||||
+ }
|
||||
+ // Sugarcane end
|
||||
} else if (!this.isWhitelisted(gameprofile, event)) { // Paper
|
||||
//chatmessage = new ChatMessage("multiplayer.disconnect.not_whitelisted"); // Paper
|
||||
//event.disallow(PlayerLoginEvent.Result.KICK_WHITELIST, org.spigotmc.SpigotConfig.whitelistMessage); // Spigot // Paper - moved to isWhitelisted
|
||||
diff --git a/src/main/java/net/minecraft/server/players/StoredUserList.java b/src/main/java/net/minecraft/server/players/StoredUserList.java
|
||||
index 9152c6c9e7e5c8fdb9183c2b4f088a810621b333..2d44cbce364c77a153ee885e6b64f0d64bad05c2 100644
|
||||
index 9152c6c9e7e5c8fdb9183c2b4f088a810621b333..51e1588fb1f89db2e5d787893718631e569108b0 100644
|
||||
--- a/src/main/java/net/minecraft/server/players/StoredUserList.java
|
||||
+++ b/src/main/java/net/minecraft/server/players/StoredUserList.java
|
||||
@@ -73,9 +73,14 @@ public abstract class StoredUserList<K, V extends StoredUserEntry<K>> {
|
||||
@@ -119,8 +117,8 @@ index 9152c6c9e7e5c8fdb9183c2b4f088a810621b333..2d44cbce364c77a153ee885e6b64f0d6
|
||||
// this.g();
|
||||
// return (V) this.d.get(this.a(k0)); // CraftBukkit - fix decompile error
|
||||
+ // Sugarcane start - only remove if it expires and has been requested (Stop wasting resources on JsonList#get)
|
||||
+ return this.map.get(this.getKeyForUser(key));
|
||||
+ /*
|
||||
+ return this.map.get(this.getKeyForUser(key));
|
||||
+ /*
|
||||
return (V) this.map.computeIfPresent(this.getKeyForUser(key), (k, v) -> {
|
||||
return v.hasExpired() ? null : v;
|
||||
});
|
||||
@@ -174,7 +172,7 @@ index f61c313195c3d16d996721b2f8cd0d9a10ce1aaf..affd0619e89a93a5bed94ef2b4c236bd
|
||||
|
||||
GameProfile gameProfile = profilex;
|
||||
diff --git a/src/main/java/net/minecraft/world/level/storage/PlayerDataStorage.java b/src/main/java/net/minecraft/world/level/storage/PlayerDataStorage.java
|
||||
index 8ce6d386a67687207966a9c577cff9046f45193e..3ed57331ba6f6f2ade08fc8950c5dc83f84c2545 100644
|
||||
index 8ce6d386a67687207966a9c577cff9046f45193e..e89f73bf7863ea1bd458a470a82147593989f18c 100644
|
||||
--- a/src/main/java/net/minecraft/world/level/storage/PlayerDataStorage.java
|
||||
+++ b/src/main/java/net/minecraft/world/level/storage/PlayerDataStorage.java
|
||||
@@ -24,6 +24,10 @@ public class PlayerDataStorage {
|
||||
@@ -209,7 +207,7 @@ index 8ce6d386a67687207966a9c577cff9046f45193e..3ed57331ba6f6f2ade08fc8950c5dc83
|
||||
+ } catch (Exception exception) {
|
||||
+ PlayerDataStorage.LOGGER.error("Failed to save player data for {}", player.getScoreboardName(), exception); // Paper
|
||||
+ }
|
||||
+ };
|
||||
+ };
|
||||
+ synchronized (this.dataCache){
|
||||
+ this.dataCache.put(file, nbttagcompound);
|
||||
+ }
|
||||
@@ -295,7 +293,7 @@ index 0000000000000000000000000000000000000000..a0098ad1716ed8821d4b30dafdaac0ac
|
||||
+}
|
||||
\ No newline at end of file
|
||||
diff --git a/src/main/java/wtf/etil/mirai/MiraiConfig.java b/src/main/java/wtf/etil/mirai/MiraiConfig.java
|
||||
index 35646ca1c13b30a40bec09b9ef1aa7ab75616e38..452de6f89f12ceddd3afa57c3eb1412bedd05272 100644
|
||||
index 9fa663198ddb793f1aa8fe4e1991b6e794a270a6..8a90c513687651846758d846cae7f3386f462e70 100644
|
||||
--- a/src/main/java/wtf/etil/mirai/MiraiConfig.java
|
||||
+++ b/src/main/java/wtf/etil/mirai/MiraiConfig.java
|
||||
@@ -197,4 +197,11 @@ public class MiraiConfig {
|
||||
|
||||
@@ -1,20 +1,8 @@
|
||||
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
|
||||
From: Etil <81570777+etil2jz@users.noreply.github.com>
|
||||
Date: Sun, 24 Oct 2021 12:14:52 +0200
|
||||
Subject: [PATCH] (EMC) Patches
|
||||
Date: Fri, 12 Nov 2021 19:45:40 +0100
|
||||
Subject: [PATCH] EMC Patches
|
||||
|
||||
Original code by Starlis LLC, licensed under MIT
|
||||
You can find the original code on https://github.com/starlis/empirecraft
|
||||
|
||||
(EMC) Don't save Fireworks
|
||||
(EMC) Fix Give command
|
||||
(EMC) Don't use force unload for keep spawn setting change
|
||||
(EMC) Don't trigger Lootable Refresh for non player interaction
|
||||
(EMC) Don't load chunks for physics
|
||||
(EMC) Do not process chat/commands before player has joined
|
||||
(EMC) Always convert Lore/Name of an item to ensure consistency
|
||||
(EMC) Bound villager trade maxUses by 16
|
||||
(EMC) Tweak explosions
|
||||
|
||||
diff --git a/src/main/java/net/minecraft/server/commands/GiveCommand.java b/src/main/java/net/minecraft/server/commands/GiveCommand.java
|
||||
index a0dc380e90415de9068ea408d62a1605c82631df..b4d42c9e270fa1fedf76eeda4d3c4a5896fd642e 100644
|
||||
@@ -29,7 +17,7 @@ index a0dc380e90415de9068ea408d62a1605c82631df..b4d42c9e270fa1fedf76eeda4d3c4a58
|
||||
itemStack.setCount(1);
|
||||
ItemEntity itemEntity2 = serverPlayer.drop(itemStack, false, false, true); // Paper - Fix duplicating /give items on item drop cancel
|
||||
diff --git a/src/main/java/net/minecraft/server/network/ServerGamePacketListenerImpl.java b/src/main/java/net/minecraft/server/network/ServerGamePacketListenerImpl.java
|
||||
index 0352d1b1a016eb1d3426e8c0abbd960b428d6f98..b199663866f1c2344da4fadb75e7f469ca1d0451 100644
|
||||
index d268068bf4ac977250f428d17a2bec2393cb7dad..209509622e9b19538627a11a7a205a35d6cc41b1 100644
|
||||
--- a/src/main/java/net/minecraft/server/network/ServerGamePacketListenerImpl.java
|
||||
+++ b/src/main/java/net/minecraft/server/network/ServerGamePacketListenerImpl.java
|
||||
@@ -2061,6 +2061,7 @@ public class ServerGamePacketListenerImpl implements ServerPlayerConnection, Ser
|
||||
@@ -272,7 +260,7 @@ index ac564148956beb984650341c5c0994573f4f7225..a192495cf8c97ec4ec7c224b7b0d654f
|
||||
LootTable lootTable = this.level.getServer().getLootTables().get(this.lootTable);
|
||||
if (player instanceof ServerPlayer) {
|
||||
diff --git a/src/main/java/net/minecraft/world/level/block/state/BlockBehaviour.java b/src/main/java/net/minecraft/world/level/block/state/BlockBehaviour.java
|
||||
index d87f8d106834678364f8720447d671de60c2454e..e0ca3a33aa1a053ce5597ee386006fe9d2957a47 100644
|
||||
index 83d813025efca5846538e36508a5d4fe38b02108..e14ad16a506a253ed19724580de6dafe26820648 100644
|
||||
--- a/src/main/java/net/minecraft/world/level/block/state/BlockBehaviour.java
|
||||
+++ b/src/main/java/net/minecraft/world/level/block/state/BlockBehaviour.java
|
||||
@@ -889,7 +889,8 @@ public abstract class BlockBehaviour {
|
||||
|
||||
@@ -1,28 +1,8 @@
|
||||
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
|
||||
From: Etil <81570777+etil2jz@users.noreply.github.com>
|
||||
Date: Tue, 26 Oct 2021 17:39:56 +0200
|
||||
Subject: [PATCH] (Purpur) Patches
|
||||
Date: Fri, 12 Nov 2021 20:27:06 +0100
|
||||
Subject: [PATCH] Purpur Patches
|
||||
|
||||
Original code by pl3xgaming, licensed under MIT
|
||||
You can find the original code on https://github.com/pl3xgaming/Purpur
|
||||
|
||||
(Purpur) Fix cow rotation when shearing mooshroom
|
||||
(Purpur) End gateway should check if entity can use portal
|
||||
(Purpur) Arrows should not reset despawn counter
|
||||
(Purpur) Spread out and optimise player list ticksSpread out and optimise player list ticks
|
||||
(Purpur) Fix SPIGOT-6278
|
||||
(Purpur) Fix vanilla command permission handler
|
||||
(Purpur) Disable outdated build check
|
||||
(Purpur) Fix `outdated server` showing in ping before server fully boots
|
||||
(Purpur) Don't send useless entity packets
|
||||
(Purpur) Skip events if there's no listeners
|
||||
(Purpur) Fix the dead lagging the server
|
||||
(Purpur) Alternative Keepalive Handling
|
||||
(Purpur) Logger settings (suppressing pointless logs)
|
||||
(Purpur) Add 5 second tps average in /tps
|
||||
(Purpur) Fix stuck in portals
|
||||
(Purpur) Stop squids floating on top of water
|
||||
(Purpur) Entities can use portals configuration
|
||||
|
||||
diff --git a/src/main/java/com/destroystokyo/paper/gui/RAMDetails.java b/src/main/java/com/destroystokyo/paper/gui/RAMDetails.java
|
||||
index fa56cd09102a89692b42f1d14257990508c5c720..f9251183df72ddc56662fd3f02acf21641a2200c 100644
|
||||
@@ -59,7 +39,7 @@ index f64aa22ed6fcb4af67317b99f459ee5296392548..63af2216c383aef0809dd381b69493ec
|
||||
public void removeCommand(String name) {
|
||||
this.children.remove(name);
|
||||
diff --git a/src/main/java/net/minecraft/commands/Commands.java b/src/main/java/net/minecraft/commands/Commands.java
|
||||
index 065bd28349982bb7af97182c6cecff43c714bf65..2cbd1ee2757728c37e486768dc35c278f3382043 100644
|
||||
index 065bd28349982bb7af97182c6cecff43c714bf65..5770e7694791b223c19674143b21e096fc024401 100644
|
||||
--- a/src/main/java/net/minecraft/commands/Commands.java
|
||||
+++ b/src/main/java/net/minecraft/commands/Commands.java
|
||||
@@ -386,18 +386,20 @@ public class Commands {
|
||||
@@ -78,7 +58,7 @@ index 065bd28349982bb7af97182c6cecff43c714bf65..2cbd1ee2757728c37e486768dc35c278
|
||||
- }
|
||||
- }
|
||||
- // CraftBukkit end
|
||||
+ if (PlayerCommandSendEvent.getHandlerList().getRegisteredListeners().length > 0) { // Purpur - skip all this crap if there's nothing listening
|
||||
+ if (PlayerCommandSendEvent.getHandlerList().getRegisteredListeners().length > 0) { // Purpur - skip all this crap if there's nothing listening
|
||||
+ // Paper end - Async command map building
|
||||
+ new com.destroystokyo.paper.event.brigadier.AsyncPlayerSendCommandsEvent<CommandSourceStack>(player.getBukkitEntity(), (RootCommandNode) rootcommandnode, false).callEvent(); // Paper
|
||||
+ PlayerCommandSendEvent event = new PlayerCommandSendEvent(player.getBukkitEntity(), new LinkedHashSet<>(bukkit));
|
||||
@@ -96,7 +76,7 @@ index 065bd28349982bb7af97182c6cecff43c714bf65..2cbd1ee2757728c37e486768dc35c278
|
||||
}
|
||||
|
||||
diff --git a/src/main/java/net/minecraft/server/MinecraftServer.java b/src/main/java/net/minecraft/server/MinecraftServer.java
|
||||
index 87466f40c837bba4a1a2bc52de07897226cf145a..ea9539c111f20fa97bed00d1158a64e5c5884816 100644
|
||||
index 3d23dc1bebe66ceb00dd2937befdd2a015dacaa5..90a89a686dbba6ffad1733dade0b8bc45091a69f 100644
|
||||
--- a/src/main/java/net/minecraft/server/MinecraftServer.java
|
||||
+++ b/src/main/java/net/minecraft/server/MinecraftServer.java
|
||||
@@ -305,7 +305,7 @@ public abstract class MinecraftServer extends ReentrantBlockableEventLoop<Runnab
|
||||
@@ -138,7 +118,7 @@ index 87466f40c837bba4a1a2bc52de07897226cf145a..ea9539c111f20fa97bed00d1158a64e5
|
||||
tickSection = curTime;
|
||||
}
|
||||
diff --git a/src/main/java/net/minecraft/server/PlayerAdvancements.java b/src/main/java/net/minecraft/server/PlayerAdvancements.java
|
||||
index 7d6dc0a8ee35274052b122bbc446bc54750de0a6..506b139a1d26dc6ec82896ce83c1b0e16f62a28e 100644
|
||||
index f7959fe8d5247504dd79a18010470d98781c7cfe..351bf7fcd607046e31488f3ae55cc32fc7df780b 100644
|
||||
--- a/src/main/java/net/minecraft/server/PlayerAdvancements.java
|
||||
+++ b/src/main/java/net/minecraft/server/PlayerAdvancements.java
|
||||
@@ -186,6 +186,7 @@ public class PlayerAdvancements {
|
||||
@@ -150,7 +130,7 @@ index 7d6dc0a8ee35274052b122bbc446bc54750de0a6..506b139a1d26dc6ec82896ce83c1b0e1
|
||||
}
|
||||
// CraftBukkit end
|
||||
diff --git a/src/main/java/net/minecraft/server/level/ServerEntity.java b/src/main/java/net/minecraft/server/level/ServerEntity.java
|
||||
index c71bc00973899feec0ec5530bf3d237928810cf4..d175a41fd8c24813904019e25432c4a796db0b7b 100644
|
||||
index a453aac607f9b38f0bf90038ff2d8071687c4bae..96b11907d99e058041e81a29f8727465e3fa6723 100644
|
||||
--- a/src/main/java/net/minecraft/server/level/ServerEntity.java
|
||||
+++ b/src/main/java/net/minecraft/server/level/ServerEntity.java
|
||||
@@ -190,6 +190,7 @@ public class ServerEntity {
|
||||
@@ -185,7 +165,7 @@ index c71bc00973899feec0ec5530bf3d237928810cf4..d175a41fd8c24813904019e25432c4a7
|
||||
public void removePairing(ServerPlayer player) {
|
||||
this.entity.stopSeenByPlayer(player);
|
||||
diff --git a/src/main/java/net/minecraft/server/level/ServerPlayer.java b/src/main/java/net/minecraft/server/level/ServerPlayer.java
|
||||
index 2bc5bb4fbfb8b354c08e00059727d96426bcdaac..71d7fb64181f626a773865f1d57f567686aaa7c0 100644
|
||||
index 5635b7fbfbc27e2042eaf4af1fe139bde514e7ab..24a8c047b717c26b6efb4cd67c061527bc6c9cd4 100644
|
||||
--- a/src/main/java/net/minecraft/server/level/ServerPlayer.java
|
||||
+++ b/src/main/java/net/minecraft/server/level/ServerPlayer.java
|
||||
@@ -1111,6 +1111,7 @@ public class ServerPlayer extends Player {
|
||||
@@ -197,7 +177,7 @@ index 2bc5bb4fbfb8b354c08e00059727d96426bcdaac..71d7fb64181f626a773865f1d57f5676
|
||||
// CraftBukkit end
|
||||
this.setLevel(worldserver);
|
||||
diff --git a/src/main/java/net/minecraft/server/network/ServerGamePacketListenerImpl.java b/src/main/java/net/minecraft/server/network/ServerGamePacketListenerImpl.java
|
||||
index b199663866f1c2344da4fadb75e7f469ca1d0451..9dce6408c20574795b3b41851a0a35d4e15e14b0 100644
|
||||
index 209509622e9b19538627a11a7a205a35d6cc41b1..21903a06334a9f7a25fddf838e67df1d2c4cd27a 100644
|
||||
--- a/src/main/java/net/minecraft/server/network/ServerGamePacketListenerImpl.java
|
||||
+++ b/src/main/java/net/minecraft/server/network/ServerGamePacketListenerImpl.java
|
||||
@@ -228,6 +228,7 @@ public class ServerGamePacketListenerImpl implements ServerPlayerConnection, Ser
|
||||
@@ -260,7 +240,7 @@ index d65191a50349ec86fe35df4ac1070f94fbb77b4c..84344527d2141b227f8881ea95ed545a
|
||||
// Paper end
|
||||
}
|
||||
diff --git a/src/main/java/net/minecraft/server/players/PlayerList.java b/src/main/java/net/minecraft/server/players/PlayerList.java
|
||||
index adf3efb2c884fc1c738a0494471a2a12fae74d8a..ea1536aa368a87f946191716eee4dac04e2f2a81 100644
|
||||
index 7a864ead3864886064f53f285b33af8ae0369e88..4caef00726f3e421cec2ef955c3db8d074348c49 100644
|
||||
--- a/src/main/java/net/minecraft/server/players/PlayerList.java
|
||||
+++ b/src/main/java/net/minecraft/server/players/PlayerList.java
|
||||
@@ -1022,22 +1022,21 @@ public abstract class PlayerList {
|
||||
@@ -299,7 +279,7 @@ index adf3efb2c884fc1c738a0494471a2a12fae74d8a..ea1536aa368a87f946191716eee4dac0
|
||||
|
||||
public void broadcastAll(Packet<?> packet) {
|
||||
diff --git a/src/main/java/net/minecraft/stats/ServerRecipeBook.java b/src/main/java/net/minecraft/stats/ServerRecipeBook.java
|
||||
index 63a4fa2408edf84b490ca39e824977135d78eff0..1054bbedb323244a2b5749f7526a8495cddf4c50 100644
|
||||
index 63a4fa2408edf84b490ca39e824977135d78eff0..fc0f4055cc8f681e6040c64396c847d8802fb1ac 100644
|
||||
--- a/src/main/java/net/minecraft/stats/ServerRecipeBook.java
|
||||
+++ b/src/main/java/net/minecraft/stats/ServerRecipeBook.java
|
||||
@@ -122,6 +122,7 @@ public class ServerRecipeBook extends RecipeBook {
|
||||
@@ -311,7 +291,7 @@ index 63a4fa2408edf84b490ca39e824977135d78eff0..1054bbedb323244a2b5749f7526a8495
|
||||
} else {
|
||||
handler.accept((Recipe) optional.get());
|
||||
diff --git a/src/main/java/net/minecraft/world/entity/Entity.java b/src/main/java/net/minecraft/world/entity/Entity.java
|
||||
index 1463e0f028c450d550d7e7cc0c165470a655f430..6a3c5cb6c96f3ec7dd3c7df0b6fbd5cd131db901 100644
|
||||
index 8572412803738bb9ff31d07c470cd19b7ccd085f..4e5a8be29816b96ce1738e6cedffd99b00909036 100644
|
||||
--- a/src/main/java/net/minecraft/world/entity/Entity.java
|
||||
+++ b/src/main/java/net/minecraft/world/entity/Entity.java
|
||||
@@ -1772,6 +1772,7 @@ public abstract class Entity implements Nameable, EntityAccess, CommandSource, n
|
||||
@@ -350,16 +330,17 @@ index 1463e0f028c450d550d7e7cc0c165470a655f430..6a3c5cb6c96f3ec7dd3c7df0b6fbd5cd
|
||||
}
|
||||
|
||||
public float getBlockExplosionResistance(Explosion explosion, BlockGetter world, BlockPos pos, BlockState blockState, FluidState fluidState, float max) {
|
||||
@@ -3854,11 +3858,17 @@ public abstract class Entity implements Nameable, EntityAccess, CommandSource, n
|
||||
@@ -3853,12 +3857,18 @@ public abstract class Entity implements Nameable, EntityAccess, CommandSource, n
|
||||
this.xRotO = this.getXRot();
|
||||
this.yRotO = this.getYRot();
|
||||
}
|
||||
|
||||
+
|
||||
+ // Purpur start
|
||||
+ public AABB getAxisForFluidCheck() {
|
||||
+ return this.getBoundingBox().deflate(0.001D);
|
||||
+ }
|
||||
+ // Purpur end
|
||||
+
|
||||
|
||||
public boolean updateFluidHeightAndDoFluidPushing(Tag<Fluid> tag, double d0) {
|
||||
if (false && this.touchingUnloadedChunk()) { // Airplane - cost of a lookup here is the same cost as below, so skip
|
||||
return false;
|
||||
@@ -370,7 +351,7 @@ index 1463e0f028c450d550d7e7cc0c165470a655f430..6a3c5cb6c96f3ec7dd3c7df0b6fbd5cd
|
||||
int minBlockX = Mth.floor(axisalignedbb.minX);
|
||||
int maxBlockX = Mth.ceil(axisalignedbb.maxX);
|
||||
diff --git a/src/main/java/net/minecraft/world/entity/LivingEntity.java b/src/main/java/net/minecraft/world/entity/LivingEntity.java
|
||||
index 46d75cd28fbf6f5768bb115a02a2d377a2c181b7..92fc1c12e45761b5f7718e2795596c899a31b096 100644
|
||||
index 926204633911f68c8437f11404b90de1c446fda7..8576d7f4acba258a9d42218e7d50cc3067236b52 100644
|
||||
--- a/src/main/java/net/minecraft/world/entity/LivingEntity.java
|
||||
+++ b/src/main/java/net/minecraft/world/entity/LivingEntity.java
|
||||
@@ -2905,7 +2905,7 @@ public abstract class LivingEntity extends Entity {
|
||||
@@ -402,7 +383,7 @@ index b2765fba362e5f6d641abcc9ee7ccc177db08eb5..a9f5d9f3ce379bb8519a6114c4962859
|
||||
entitycow.setCustomName(this.getCustomName());
|
||||
entitycow.setCustomNameVisible(this.isCustomNameVisible());
|
||||
diff --git a/src/main/java/net/minecraft/world/entity/animal/Squid.java b/src/main/java/net/minecraft/world/entity/animal/Squid.java
|
||||
index 4da560f6e4da0750bda78b900b2d916d58adfccb..67f0001ec6a75d9245f04086721d3316e1550772 100644
|
||||
index 4da560f6e4da0750bda78b900b2d916d58adfccb..c3aed0f2aceadc22376c537c599453536bc0fa7d 100644
|
||||
--- a/src/main/java/net/minecraft/world/entity/animal/Squid.java
|
||||
+++ b/src/main/java/net/minecraft/world/entity/animal/Squid.java
|
||||
@@ -327,4 +327,11 @@ public class Squid extends WaterAnimal {
|
||||
@@ -472,7 +453,7 @@ index 68cc6f2a78a06293a29317fda72ab3ee79b3533a..22019fa6cdc7882c4d34116548fc567c
|
||||
+
|
||||
}
|
||||
diff --git a/src/main/java/org/bukkit/craftbukkit/CraftServer.java b/src/main/java/org/bukkit/craftbukkit/CraftServer.java
|
||||
index 42d227aa8496c3a00584ccef02958793279c4e93..6e96c2f4c9886339ba4db32d18c177996c9b8f3d 100644
|
||||
index e6d72a63ed0290f73f2808cbf45d4eaa04f8966a..56a1a9fe2f3089738c5293c35704dd007f2174ca 100644
|
||||
--- a/src/main/java/org/bukkit/craftbukkit/CraftServer.java
|
||||
+++ b/src/main/java/org/bukkit/craftbukkit/CraftServer.java
|
||||
@@ -2526,6 +2526,7 @@ public final class CraftServer implements Server {
|
||||
@@ -509,10 +490,10 @@ index 4aa1dc543950b5de64345b3403a6d0bc41c521df..23adb3b18a0fbe6b6c7cbc40d9f25649
|
||||
final String commandName;
|
||||
if (vanillaCommand.getRedirect() == null) {
|
||||
diff --git a/src/main/java/org/bukkit/craftbukkit/entity/CraftPlayer.java b/src/main/java/org/bukkit/craftbukkit/entity/CraftPlayer.java
|
||||
index c64911651f3d736c83cc83996de04920b091cc57..24c435ab908e12b558e5895348e4bb691c6063b2 100644
|
||||
index 755e3bcc4d620d5550cbfd7ba56e83816d270498..2176269aa602049d69ec65bb1c1629a6680ccfa2 100644
|
||||
--- a/src/main/java/org/bukkit/craftbukkit/entity/CraftPlayer.java
|
||||
+++ b/src/main/java/org/bukkit/craftbukkit/entity/CraftPlayer.java
|
||||
@@ -1565,8 +1565,14 @@ public class CraftPlayer extends CraftHumanEntity implements Player {
|
||||
@@ -1572,8 +1572,14 @@ public class CraftPlayer extends CraftHumanEntity implements Player {
|
||||
|
||||
@Override
|
||||
public boolean canSee(Player player) {
|
||||
@@ -530,7 +511,7 @@ index c64911651f3d736c83cc83996de04920b091cc57..24c435ab908e12b558e5895348e4bb69
|
||||
@Override
|
||||
public Map<String, Object> serialize() {
|
||||
diff --git a/src/main/java/org/bukkit/craftbukkit/legacy/CraftLegacy.java b/src/main/java/org/bukkit/craftbukkit/legacy/CraftLegacy.java
|
||||
index b2a15c986c7500a0ce227a54cb61ec3f5378f6f3..db010b5c9a9b457020dbe4b64a8fc9b402999687 100644
|
||||
index b2a15c986c7500a0ce227a54cb61ec3f5378f6f3..513ee5e1129302e40b558f9ad4c4a7b5b30dc04c 100644
|
||||
--- a/src/main/java/org/bukkit/craftbukkit/legacy/CraftLegacy.java
|
||||
+++ b/src/main/java/org/bukkit/craftbukkit/legacy/CraftLegacy.java
|
||||
@@ -255,6 +255,7 @@ public final class CraftLegacy {
|
||||
@@ -555,7 +536,7 @@ index 9bede6a26c08ede063c7a38f1149c811df14b258..088239d17aa8178cf8af09ec23cfd4de
|
||||
sender.sendMessage(ChatColor.GOLD + "Current Memory Usage: " + ChatColor.GREEN + ((Runtime.getRuntime().totalMemory() - Runtime.getRuntime().freeMemory()) / (1024 * 1024)) + "/" + (Runtime.getRuntime().totalMemory() / (1024 * 1024)) + " mb (Max: " + (Runtime.getRuntime().maxMemory() / (1024 * 1024)) + " mb)");
|
||||
if (!hasShownMemoryWarning) {
|
||||
diff --git a/src/main/java/wtf/etil/mirai/MiraiConfig.java b/src/main/java/wtf/etil/mirai/MiraiConfig.java
|
||||
index 452de6f89f12ceddd3afa57c3eb1412bedd05272..6b75316279246f26ed76bed0aa096802fda04da8 100644
|
||||
index 8a90c513687651846758d846cae7f3386f462e70..ca61a8b5621f6e5d925bcab997950029e56a6813 100644
|
||||
--- a/src/main/java/wtf/etil/mirai/MiraiConfig.java
|
||||
+++ b/src/main/java/wtf/etil/mirai/MiraiConfig.java
|
||||
@@ -1,10 +1,15 @@
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
|
||||
From: Etil <81570777+etil2jz@users.noreply.github.com>
|
||||
Date: Tue, 26 Oct 2021 18:40:00 +0200
|
||||
Date: Fri, 12 Nov 2021 20:31:50 +0100
|
||||
Subject: [PATCH] Improve EntityTransformEvent cancellation handling
|
||||
|
||||
|
||||
@@ -1,19 +0,0 @@
|
||||
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
|
||||
From: DoctaEnkoda <bierquejason@gmail.com>
|
||||
Date: Sun, 18 Jul 2021 12:28:04 +0200
|
||||
Subject: [PATCH] (PaperPR) Fix Paper#6028
|
||||
|
||||
|
||||
diff --git a/src/main/java/net/minecraft/world/level/levelgen/feature/TreeFeature.java b/src/main/java/net/minecraft/world/level/levelgen/feature/TreeFeature.java
|
||||
index 0be9ce0734e3ba72893a7349bb9f83a94f4af30c..ad21bb745bc817c5f7a1284a493b54778f07a913 100644
|
||||
--- a/src/main/java/net/minecraft/world/level/levelgen/feature/TreeFeature.java
|
||||
+++ b/src/main/java/net/minecraft/world/level/levelgen/feature/TreeFeature.java
|
||||
@@ -147,7 +147,7 @@ public class TreeFeature extends Feature<TreeConfiguration> {
|
||||
worldGenLevel.setBlock(pos, state, 19);
|
||||
};
|
||||
boolean bl = this.doPlace(worldGenLevel, random, blockPos, biConsumer, biConsumer2, treeConfiguration);
|
||||
- if (bl && (!set.isEmpty() || !set2.isEmpty())) {
|
||||
+ if (bl && !set.isEmpty() && !set2.isEmpty()) { // Paper - Fix Paper#6028
|
||||
if (!treeConfiguration.decorators.isEmpty()) {
|
||||
List<BlockPos> list = Lists.newArrayList(set);
|
||||
List<BlockPos> list2 = Lists.newArrayList(set2);
|
||||
@@ -1,10 +1,8 @@
|
||||
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
|
||||
From: Phoenix616 <mail@moep.tv>
|
||||
Date: Sun, 24 Nov 2019 23:00:58 +0100
|
||||
Subject: [PATCH] (Origami) Optimize inventory API item handling
|
||||
From: Etil <81570777+etil2jz@users.noreply.github.com>
|
||||
Date: Fri, 12 Nov 2021 20:52:54 +0100
|
||||
Subject: [PATCH] Optimize inventory API item handling
|
||||
|
||||
Original code by Minebench, licensed under GNU General Public License v3.0
|
||||
You can find the original code on https://github.com/Minebench/Origami
|
||||
|
||||
diff --git a/src/main/java/org/bukkit/craftbukkit/inventory/CraftInventory.java b/src/main/java/org/bukkit/craftbukkit/inventory/CraftInventory.java
|
||||
index 396a4ae3d5a829eda78ef98561333aea300aa722..97b1c48979075ee8a04262c654c6b2130511db79 100644
|
||||
@@ -1,6 +1,6 @@
|
||||
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
|
||||
From: Etil <81570777+etil2jz@users.noreply.github.com>
|
||||
Date: Tue, 26 Oct 2021 18:46:57 +0200
|
||||
Date: Fri, 12 Nov 2021 20:55:46 +0100
|
||||
Subject: [PATCH] Fix bees aging inside hives
|
||||
|
||||
|
||||
@@ -1,14 +1,14 @@
|
||||
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
|
||||
From: Etil <81570777+etil2jz@users.noreply.github.com>
|
||||
Date: Thu, 11 Nov 2021 11:57:52 +0100
|
||||
Date: Fri, 12 Nov 2021 20:57:20 +0100
|
||||
Subject: [PATCH] Bump Netty version to 4.1.70.Final
|
||||
|
||||
|
||||
diff --git a/build.gradle.kts b/build.gradle.kts
|
||||
index 5fde6b03fcccef4f9cc5c84c3701e45b27bc4471..d48b6a9c7816ba5f18a63e247aa814f986456465 100644
|
||||
index c76ddc77c09e39d2476a91de39ca55a1e737379c..ba1c53958a3892bbd73b68c98820be8e3ef6dae3 100644
|
||||
--- a/build.gradle.kts
|
||||
+++ b/build.gradle.kts
|
||||
@@ -52,7 +52,7 @@ dependencies {
|
||||
@@ -53,7 +53,7 @@ dependencies {
|
||||
runtimeOnly("org.apache.maven.resolver:maven-resolver-connector-basic:1.7.0")
|
||||
runtimeOnly("org.apache.maven.resolver:maven-resolver-transport-http:1.7.0")
|
||||
|
||||
@@ -1,15 +1,8 @@
|
||||
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
|
||||
From: Etil <81570777+etil2jz@users.noreply.github.com>
|
||||
Date: Fri, 29 Oct 2021 20:03:15 +0200
|
||||
Subject: [PATCH] (Slice) Patches
|
||||
Date: Fri, 12 Nov 2021 21:43:06 +0100
|
||||
Subject: [PATCH] Slice Patches
|
||||
|
||||
(Slice) Multiple Entries with Scoreboards
|
||||
(Slice) Don't send equipment updates if only durability changed
|
||||
(Slice) Don't send fire packets if player has Fire Resistance
|
||||
(Slice) Packet obfuscation and reduction
|
||||
(Slice) Smooth World Teleports
|
||||
(Slice) World Instance Flag
|
||||
(Slice) Block Mob Spawns globally by EntityType
|
||||
|
||||
diff --git a/src/main/java/net/minecraft/network/protocol/game/ClientboundSetEntityDataPacket.java b/src/main/java/net/minecraft/network/protocol/game/ClientboundSetEntityDataPacket.java
|
||||
index 3e17f6131bf590d7c4a16b79c1c145cb4f565bc9..6029102a2e3631d563b5f1846bc2eab8268c9ac6 100644
|
||||
@@ -209,7 +202,7 @@ index 130a928f156961bae9ca184b3ca31004dbba1012..063e4f9f140a39c519b1d4892bfa331d
|
||||
@Override
|
||||
public void onObjectiveAdded(Objective objective) {
|
||||
diff --git a/src/main/java/net/minecraft/server/level/ServerEntity.java b/src/main/java/net/minecraft/server/level/ServerEntity.java
|
||||
index d175a41fd8c24813904019e25432c4a796db0b7b..fb785c2581c5f1548a2e10d48cc5d3340c74c9fd 100644
|
||||
index 96b11907d99e058041e81a29f8727465e3fa6723..0a3edd5c6a3ef8341855d138dadf24e6db09e54d 100644
|
||||
--- a/src/main/java/net/minecraft/server/level/ServerEntity.java
|
||||
+++ b/src/main/java/net/minecraft/server/level/ServerEntity.java
|
||||
@@ -387,7 +387,19 @@ public class ServerEntity {
|
||||
@@ -246,7 +239,7 @@ index 1ae7a10df7460f223413c38ac6bd85dba15fb347..e9fb961f20486f522a679e35d1fe4c58
|
||||
return new Throwable(entity + " Added to world at " + new java.util.Date());
|
||||
}
|
||||
diff --git a/src/main/java/net/minecraft/server/level/ServerPlayer.java b/src/main/java/net/minecraft/server/level/ServerPlayer.java
|
||||
index 71d7fb64181f626a773865f1d57f567686aaa7c0..2025d5bef46cafbbd4534df8cb2ee06dbc93d856 100644
|
||||
index 24a8c047b717c26b6efb4cd67c061527bc6c9cd4..def69c8b959f859952d7f1d1443f1e4c17843bfb 100644
|
||||
--- a/src/main/java/net/minecraft/server/level/ServerPlayer.java
|
||||
+++ b/src/main/java/net/minecraft/server/level/ServerPlayer.java
|
||||
@@ -263,6 +263,7 @@ public class ServerPlayer extends Player {
|
||||
@@ -258,7 +251,7 @@ index 71d7fb64181f626a773865f1d57f567686aaa7c0..2025d5bef46cafbbd4534df8cb2ee06d
|
||||
public ServerPlayer(MinecraftServer server, ServerLevel world, GameProfile profile) {
|
||||
super(world, world.getSharedSpawnPos(), world.getSharedSpawnAngle(), profile);
|
||||
diff --git a/src/main/java/net/minecraft/server/players/PlayerList.java b/src/main/java/net/minecraft/server/players/PlayerList.java
|
||||
index ea1536aa368a87f946191716eee4dac04e2f2a81..5964a1a75d95dbef3c5aae96c60b5b64e5a86bb1 100644
|
||||
index 4caef00726f3e421cec2ef955c3db8d074348c49..370af31206bb1cd9fa50541a95baa7a12aec8cd0 100644
|
||||
--- a/src/main/java/net/minecraft/server/players/PlayerList.java
|
||||
+++ b/src/main/java/net/minecraft/server/players/PlayerList.java
|
||||
@@ -952,11 +952,11 @@ public abstract class PlayerList {
|
||||
@@ -276,7 +269,7 @@ index ea1536aa368a87f946191716eee4dac04e2f2a81..5964a1a75d95dbef3c5aae96c60b5b64
|
||||
|
||||
// entityplayer1.connection.b(entityplayer1.locX(), entityplayer1.locY(), entityplayer1.locZ(), entityplayer1.getYRot(), entityplayer1.getXRot());
|
||||
diff --git a/src/main/java/net/minecraft/world/entity/Entity.java b/src/main/java/net/minecraft/world/entity/Entity.java
|
||||
index 6a3c5cb6c96f3ec7dd3c7df0b6fbd5cd131db901..1baa208924e13bc1df723ce2be36fe72b8f4108f 100644
|
||||
index 4e5a8be29816b96ce1738e6cedffd99b00909036..2c0ca9194e8ad3b53776455db54cca16dc1095e4 100644
|
||||
--- a/src/main/java/net/minecraft/world/entity/Entity.java
|
||||
+++ b/src/main/java/net/minecraft/world/entity/Entity.java
|
||||
@@ -787,7 +787,11 @@ public abstract class Entity implements Nameable, EntityAccess, CommandSource, n
|
||||
@@ -302,10 +295,10 @@ index 6a3c5cb6c96f3ec7dd3c7df0b6fbd5cd131db901..1baa208924e13bc1df723ce2be36fe72
|
||||
}
|
||||
|
||||
diff --git a/src/main/java/net/minecraft/world/entity/LivingEntity.java b/src/main/java/net/minecraft/world/entity/LivingEntity.java
|
||||
index 92fc1c12e45761b5f7718e2795596c899a31b096..6395585f36228550fc160197012087b410979560 100644
|
||||
index 8576d7f4acba258a9d42218e7d50cc3067236b52..82678fd59a4a49cca6e5a90b850197d93d5fa18f 100644
|
||||
--- a/src/main/java/net/minecraft/world/entity/LivingEntity.java
|
||||
+++ b/src/main/java/net/minecraft/world/entity/LivingEntity.java
|
||||
@@ -3022,7 +3022,7 @@ public abstract class LivingEntity extends Entity {
|
||||
@@ -3024,7 +3024,7 @@ public abstract class LivingEntity extends Entity {
|
||||
|
||||
ItemStack itemstack1 = this.getItemBySlot(enumitemslot);
|
||||
|
||||
@@ -328,7 +321,7 @@ index 94e76e295dbd0f3bac4b30a3e7338cd56a971207..4484c6dc092f5fc8e1a33b0e7096f618
|
||||
|
||||
@Override
|
||||
diff --git a/src/main/java/net/minecraft/world/level/biome/MobSpawnSettings.java b/src/main/java/net/minecraft/world/level/biome/MobSpawnSettings.java
|
||||
index 86528ff031014e788d72a8bf7c1c9443512096bb..96d0f5cd9f1f10df033c881d4dec1782570a1659 100644
|
||||
index 86528ff031014e788d72a8bf7c1c9443512096bb..51d3557db8caa9852ec2627ab53d802be2b59745 100644
|
||||
--- a/src/main/java/net/minecraft/world/level/biome/MobSpawnSettings.java
|
||||
+++ b/src/main/java/net/minecraft/world/level/biome/MobSpawnSettings.java
|
||||
@@ -41,9 +41,10 @@ public class MobSpawnSettings {
|
||||
@@ -477,10 +470,10 @@ index 3b386ecc7630ab50cac1ae6fcb3141d444a74434..c7a33c379b29a39db8cfcfd4c6298b26
|
||||
@Override
|
||||
public void setDifficulty(Difficulty difficulty) {
|
||||
diff --git a/src/main/java/org/bukkit/craftbukkit/entity/CraftPlayer.java b/src/main/java/org/bukkit/craftbukkit/entity/CraftPlayer.java
|
||||
index 24c435ab908e12b558e5895348e4bb691c6063b2..8263bcd9e17600e13751f611384475cf0dd773fb 100644
|
||||
index 2176269aa602049d69ec65bb1c1629a6680ccfa2..9c69d26ccdf6bf2b5f2128328ac792c175047b2c 100644
|
||||
--- a/src/main/java/org/bukkit/craftbukkit/entity/CraftPlayer.java
|
||||
+++ b/src/main/java/org/bukkit/craftbukkit/entity/CraftPlayer.java
|
||||
@@ -2003,7 +2003,7 @@ public class CraftPlayer extends CraftHumanEntity implements Player {
|
||||
@@ -2010,7 +2010,7 @@ public class CraftPlayer extends CraftHumanEntity implements Player {
|
||||
this.sendHealthUpdate();
|
||||
}
|
||||
}
|
||||
@@ -545,14 +538,14 @@ index 2b87a652798cb632fe76bf20e9e7f8cb8bfb3b7b..1b10b3628e09b6c831e4907bf79e87a5
|
||||
@Override
|
||||
public boolean hasPlayer(OfflinePlayer player) throws IllegalArgumentException, IllegalStateException {
|
||||
diff --git a/src/main/java/wtf/etil/mirai/MiraiConfig.java b/src/main/java/wtf/etil/mirai/MiraiConfig.java
|
||||
index 6b75316279246f26ed76bed0aa096802fda04da8..1d844dd248ebd62261a83b3d353a82390c14f0c9 100644
|
||||
index ca61a8b5621f6e5d925bcab997950029e56a6813..a0389406b9e2ff343d926581e05361bc9edaac4e 100644
|
||||
--- a/src/main/java/wtf/etil/mirai/MiraiConfig.java
|
||||
+++ b/src/main/java/wtf/etil/mirai/MiraiConfig.java
|
||||
@@ -243,4 +243,13 @@ public class MiraiConfig {
|
||||
entitiesCanUsePortals = getBoolean("settings.entities-can-use-portals", entitiesCanUsePortals);
|
||||
}
|
||||
|
||||
+ public static java.util.Set<net.minecraft.world.entity.EntityType<?>> globalBlockedMobSpawnTypes = new java.util.HashSet<>();
|
||||
+ public static java.util.Set<net.minecraft.world.entity.EntityType<?>> globalBlockedMobSpawnTypes = new java.util.HashSet<>();
|
||||
+ private static void globalBlockedMobSpawnTypes() {
|
||||
+ java.util.List<String> list = getList("settings.global-blocked-mobspawn-types", java.util.Collections.emptyList());
|
||||
+ for (String type : list) {
|
||||
353
patches/server/0016-Pufferfish-Patches.patch
Normal file
353
patches/server/0016-Pufferfish-Patches.patch
Normal file
@@ -0,0 +1,353 @@
|
||||
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
|
||||
From: Etil <81570777+etil2jz@users.noreply.github.com>
|
||||
Date: Fri, 12 Nov 2021 22:13:53 +0100
|
||||
Subject: [PATCH] Pufferfish Patches
|
||||
|
||||
|
||||
diff --git a/src/main/java/com/destroystokyo/paper/util/PlayerMobDistanceMap.java b/src/main/java/com/destroystokyo/paper/util/PlayerMobDistanceMap.java
|
||||
index 72063ba7fb0d04594043cb07034590d597c3d77e..e4f84112f125673916824fdd7c68e0c1f7d954eb 100644
|
||||
--- a/src/main/java/com/destroystokyo/paper/util/PlayerMobDistanceMap.java
|
||||
+++ b/src/main/java/com/destroystokyo/paper/util/PlayerMobDistanceMap.java
|
||||
@@ -18,7 +18,7 @@ public final class PlayerMobDistanceMap {
|
||||
|
||||
private final Map<ServerPlayer, SectionPos> players = new HashMap<>();
|
||||
// we use linked for better iteration.
|
||||
- private final Long2ObjectOpenHashMap<PooledHashSets.PooledObjectLinkedOpenHashSet<ServerPlayer>> playerMap = new Long2ObjectOpenHashMap<>(32, 0.5f);
|
||||
+ private final java.util.concurrent.ConcurrentHashMap<Long, PooledHashSets.PooledObjectLinkedOpenHashSet<ServerPlayer>> playerMap = new java.util.concurrent.ConcurrentHashMap<>(32, 0.5f); // Pufferfish
|
||||
private int viewDistance;
|
||||
|
||||
private final PooledHashSets<ServerPlayer> pooledHashSets = new PooledHashSets<>();
|
||||
@@ -75,8 +75,8 @@ public final class PlayerMobDistanceMap {
|
||||
final int centerX = currPosition.getX();
|
||||
final int centerZ = currPosition.getZ();
|
||||
|
||||
- for (final Long2ObjectLinkedOpenHashMap.Entry<PooledHashSets.PooledObjectLinkedOpenHashSet<ServerPlayer>> entry : this.playerMap.long2ObjectEntrySet()) {
|
||||
- final long key = entry.getLongKey();
|
||||
+ for (final Map.Entry<Long, PooledHashSets.PooledObjectLinkedOpenHashSet<ServerPlayer>> entry : this.playerMap.entrySet()) { // Pufferfish
|
||||
+ final long key = entry.getKey(); // Pufferfish
|
||||
final PooledHashSets.PooledObjectLinkedOpenHashSet<ServerPlayer> map = entry.getValue();
|
||||
|
||||
if (map.referenceCount == 0) {
|
||||
diff --git a/src/main/java/gg/pufferfish/pufferfish/PufferfishLogger.java b/src/main/java/gg/pufferfish/pufferfish/PufferfishLogger.java
|
||||
new file mode 100644
|
||||
index 0000000000000000000000000000000000000000..1370a08f8c518ff3b324138cbed38316ac3368f2
|
||||
--- /dev/null
|
||||
+++ b/src/main/java/gg/pufferfish/pufferfish/PufferfishLogger.java
|
||||
@@ -0,0 +1,16 @@
|
||||
+package gg.pufferfish.pufferfish;
|
||||
+
|
||||
+import java.util.logging.Level;
|
||||
+import java.util.logging.Logger;
|
||||
+import org.bukkit.Bukkit;
|
||||
+
|
||||
+public class PufferfishLogger extends Logger {
|
||||
+ public static final PufferfishLogger LOGGER = new PufferfishLogger();
|
||||
+
|
||||
+ private PufferfishLogger() {
|
||||
+ super("Pufferfish", null);
|
||||
+
|
||||
+ setParent(Bukkit.getLogger());
|
||||
+ setLevel(Level.ALL);
|
||||
+ }
|
||||
+}
|
||||
\ No newline at end of file
|
||||
diff --git a/src/main/java/gg/pufferfish/pufferfish/util/AsyncExecutor.java b/src/main/java/gg/pufferfish/pufferfish/util/AsyncExecutor.java
|
||||
new file mode 100644
|
||||
index 0000000000000000000000000000000000000000..2e49bd0db28b25f8e94d2d3c6b81e6e4e94584be
|
||||
--- /dev/null
|
||||
+++ b/src/main/java/gg/pufferfish/pufferfish/util/AsyncExecutor.java
|
||||
@@ -0,0 +1,51 @@
|
||||
+package gg.pufferfish.pufferfish.util;
|
||||
+
|
||||
+import com.google.common.collect.Queues;
|
||||
+import gg.pufferfish.pufferfish.PufferfishLogger;
|
||||
+import java.util.Queue;
|
||||
+import java.util.concurrent.locks.LockSupport;
|
||||
+import java.util.function.BooleanSupplier;
|
||||
+import java.util.logging.Level;
|
||||
+
|
||||
+public class AsyncExecutor implements Runnable {
|
||||
+
|
||||
+ private Queue<Runnable> jobs = Queues.newConcurrentLinkedQueue();
|
||||
+ private final Thread thread;
|
||||
+ private final BooleanSupplier shouldRun;
|
||||
+ private volatile boolean killswitch = false;
|
||||
+
|
||||
+ public AsyncExecutor(String threadName, BooleanSupplier shouldRun) {
|
||||
+ this.thread = new Thread(this, threadName);
|
||||
+ this.shouldRun = shouldRun;
|
||||
+ }
|
||||
+
|
||||
+ public void start() {
|
||||
+ thread.start();
|
||||
+ }
|
||||
+
|
||||
+ public void kill() {
|
||||
+ killswitch = true;
|
||||
+ }
|
||||
+
|
||||
+ public void submit(Runnable runnable) {
|
||||
+ jobs.offer(runnable);
|
||||
+ }
|
||||
+
|
||||
+ @Override
|
||||
+ public void run() {
|
||||
+ while (!killswitch) {
|
||||
+ if (shouldRun.getAsBoolean()) {
|
||||
+ try {
|
||||
+ Runnable runnable;
|
||||
+ while ((runnable = jobs.poll()) != null) {
|
||||
+ runnable.run();
|
||||
+ }
|
||||
+ } catch (Exception e) {
|
||||
+ PufferfishLogger.LOGGER.log(Level.SEVERE, e, () -> "Failed to execute async job for thread " + thread.getName());
|
||||
+ }
|
||||
+ }
|
||||
+ LockSupport.parkNanos("executing tasks", 1000L);
|
||||
+ }
|
||||
+ }
|
||||
+
|
||||
+}
|
||||
\ No newline at end of file
|
||||
diff --git a/src/main/java/gg/pufferfish/pufferfish/util/IterableWrapper.java b/src/main/java/gg/pufferfish/pufferfish/util/IterableWrapper.java
|
||||
new file mode 100644
|
||||
index 0000000000000000000000000000000000000000..e405aacb46e8c5e0105fbe34c6f7071660542223
|
||||
--- /dev/null
|
||||
+++ b/src/main/java/gg/pufferfish/pufferfish/util/IterableWrapper.java
|
||||
@@ -0,0 +1,20 @@
|
||||
+package gg.pufferfish.pufferfish.util;
|
||||
+
|
||||
+import java.util.Iterator;
|
||||
+import org.jetbrains.annotations.NotNull;
|
||||
+
|
||||
+public class IterableWrapper<T> implements Iterable<T> {
|
||||
+
|
||||
+ private final Iterator<T> iterator;
|
||||
+
|
||||
+ public IterableWrapper(Iterator<T> iterator) {
|
||||
+ this.iterator = iterator;
|
||||
+ }
|
||||
+
|
||||
+ @NotNull
|
||||
+ @Override
|
||||
+ public Iterator<T> iterator() {
|
||||
+ return iterator;
|
||||
+ }
|
||||
+
|
||||
+}
|
||||
\ No newline at end of file
|
||||
diff --git a/src/main/java/net/minecraft/server/MCUtil.java b/src/main/java/net/minecraft/server/MCUtil.java
|
||||
index f12181bf8a97c458149ae92b8ff443bb923ba82f..c89135d05e27a0f2084e8348ebd158c48ee340dd 100644
|
||||
--- a/src/main/java/net/minecraft/server/MCUtil.java
|
||||
+++ b/src/main/java/net/minecraft/server/MCUtil.java
|
||||
@@ -230,7 +230,7 @@ public final class MCUtil {
|
||||
}
|
||||
|
||||
public static long getCoordinateKey(final Entity entity) {
|
||||
- return ((long)(MCUtil.fastFloor(entity.getZ()) >> 4) << 32) | ((MCUtil.fastFloor(entity.getX()) >> 4) & 0xFFFFFFFFL);
|
||||
+ return ((long)(entity.blockPosition.getZ() >> 4) << 32) | ((entity.blockPosition.getX() >> 4) & 0xFFFFFFFFL); // Pufferfish - eliminate double->long cast in hotpath
|
||||
}
|
||||
|
||||
public static long getCoordinateKey(final ChunkPos pair) {
|
||||
diff --git a/src/main/java/net/minecraft/server/MinecraftServer.java b/src/main/java/net/minecraft/server/MinecraftServer.java
|
||||
index 90a89a686dbba6ffad1733dade0b8bc45091a69f..5f72911031b08d80d94fcd99421a7c4b9b19cfbb 100644
|
||||
--- a/src/main/java/net/minecraft/server/MinecraftServer.java
|
||||
+++ b/src/main/java/net/minecraft/server/MinecraftServer.java
|
||||
@@ -312,6 +312,8 @@ public abstract class MinecraftServer extends ReentrantBlockableEventLoop<Runnab
|
||||
|
||||
public volatile Thread shutdownThread; // Paper
|
||||
public volatile boolean abnormalExit = false; // Paper
|
||||
+
|
||||
+ public gg.pufferfish.pufferfish.util.AsyncExecutor mobSpawnExecutor = new gg.pufferfish.pufferfish.util.AsyncExecutor("MobSpawning", () -> true); // Pufferfish - optimize mob spawning
|
||||
|
||||
public static <S extends MinecraftServer> S spin(Function<Thread, S> serverFactory) {
|
||||
AtomicReference<S> atomicreference = new AtomicReference();
|
||||
diff --git a/src/main/java/net/minecraft/server/dedicated/DedicatedServer.java b/src/main/java/net/minecraft/server/dedicated/DedicatedServer.java
|
||||
index 870a9afb4e98d0988c470e64b0b21cdf453b7664..566bf57dbf1ed8b4d892e8025a44b3400c9457cc 100644
|
||||
--- a/src/main/java/net/minecraft/server/dedicated/DedicatedServer.java
|
||||
+++ b/src/main/java/net/minecraft/server/dedicated/DedicatedServer.java
|
||||
@@ -361,6 +361,7 @@ public class DedicatedServer extends MinecraftServer implements ServerInterface
|
||||
DedicatedServer.LOGGER.info("JMX monitoring enabled");
|
||||
}
|
||||
|
||||
+ if (wtf.etil.mirai.MiraiConfig.enableAsyncMobSpawning) mobSpawnExecutor.start(); // Pufferfish
|
||||
return true;
|
||||
}
|
||||
}
|
||||
diff --git a/src/main/java/net/minecraft/server/level/ServerChunkCache.java b/src/main/java/net/minecraft/server/level/ServerChunkCache.java
|
||||
index 14cf1956ef31f49684195292bed2d8916231a514..e0fb2537302ff9aab719064d5d59fbd5802531c4 100644
|
||||
--- a/src/main/java/net/minecraft/server/level/ServerChunkCache.java
|
||||
+++ b/src/main/java/net/minecraft/server/level/ServerChunkCache.java
|
||||
@@ -73,6 +73,9 @@ public class ServerChunkCache extends ChunkSource {
|
||||
final Long2ObjectOpenHashMap<LevelChunk> loadedChunkMap = new Long2ObjectOpenHashMap<>(8192, 0.5f);
|
||||
|
||||
private final LevelChunk[] lastLoadedChunks = new LevelChunk[4 * 4];
|
||||
+
|
||||
+ public boolean firstRunSpawnCounts = true; // Pufferfish
|
||||
+ public final java.util.concurrent.atomic.AtomicBoolean _pufferfish_spawnCountsReady = new java.util.concurrent.atomic.AtomicBoolean(false); // Pufferfish - optimize countmobs
|
||||
|
||||
private static int getChunkCacheKey(int x, int z) {
|
||||
return x & 3 | ((z & 3) << 2);
|
||||
@@ -997,18 +1000,25 @@ public class ServerChunkCache extends ChunkSource {
|
||||
this.level.timings.playerMobDistanceMapUpdate.startTiming();
|
||||
this.chunkMap.playerMobDistanceMap.update(this.level.players, this.chunkMap.viewDistance);
|
||||
this.level.timings.playerMobDistanceMapUpdate.stopTiming();
|
||||
- // re-set mob counts
|
||||
- for (ServerPlayer player : this.level.players) {
|
||||
- Arrays.fill(player.mobCounts, 0);
|
||||
+ // Pufferfish start - moved down when async processing
|
||||
+ if (!wtf.etil.mirai.MiraiConfig.enableAsyncMobSpawning) {
|
||||
+ // re-set mob counts
|
||||
+ for (ServerPlayer player : this.level.players) {
|
||||
+ Arrays.fill(player.mobCounts, 0);
|
||||
+ }
|
||||
+ lastSpawnState = NaturalSpawner.createState(l, this.level.getAllEntities(), this::getFullChunk, true);
|
||||
}
|
||||
- spawnercreature_d = NaturalSpawner.createState(l, this.level.getAllEntities(), this::getFullChunk, true);
|
||||
+ // Pufferfish end
|
||||
} else {
|
||||
- spawnercreature_d = NaturalSpawner.createState(l, this.level.getAllEntities(), this::getFullChunk, false);
|
||||
+ // Pufferfish start - this is only implemented for per-player mob spawning so this makes everything work if this setting is disabled.
|
||||
+ lastSpawnState = NaturalSpawner.createState(l, this.level.getAllEntities(), this::getFullChunk, false);
|
||||
+ _pufferfish_spawnCountsReady.set(true);
|
||||
+ // Pufferfish end
|
||||
}
|
||||
// Paper end
|
||||
this.level.timings.countNaturalMobs.stopTiming(); // Paper - timings
|
||||
|
||||
- this.lastSpawnState = spawnercreature_d;
|
||||
+ //this.lastSpawnState = spawnercreature_d; // Pufferfish - this is managed asynchronously
|
||||
this.level.getProfiler().pop();
|
||||
// Paper - moved down, enabled if per-player = false
|
||||
// Paper - moved natural spawn event up
|
||||
@@ -1041,8 +1051,8 @@ public class ServerChunkCache extends ChunkSource {
|
||||
|
||||
if ((true || this.level.isPositionEntityTicking(chunkcoordintpair)) && !this.chunkMap.isOutsideOfRange(playerchunk, chunkcoordintpair, false)) { // Paper - optimise isOutsideOfRange // Paper - we only iterate entity ticking chunks
|
||||
chunk.setInhabitedTime(chunk.getInhabitedTime() + j);
|
||||
- if (flag1 && (this.spawnEnemies || this.spawnFriendlies) && this.level.getWorldBorder().isWithinBounds(chunk.getPos()) && !this.chunkMap.isOutsideOfRange(playerchunk, chunkcoordintpair, true)) { // Spigot // Paper - optimise isOutsideOfRange
|
||||
- NaturalSpawner.spawnForChunk(this.level, chunk, spawnercreature_d, this.spawnFriendlies, this.spawnEnemies, flag2);
|
||||
+ if (flag1 && (!wtf.etil.mirai.MiraiConfig.enableAsyncMobSpawning || _pufferfish_spawnCountsReady.get()) && (this.spawnEnemies || this.spawnFriendlies) && this.level.getWorldBorder().isWithinBounds(chunk.getPos()) && !this.chunkMap.isOutsideOfRange(playerchunk, chunkcoordintpair, true)) { // Spigot // Paper - optimise isOutsideOfRange // Pufferfish
|
||||
+ NaturalSpawner.spawnForChunk(this.level, chunk, lastSpawnState, this.spawnFriendlies, this.spawnEnemies, flag2); // Pufferfish
|
||||
}
|
||||
|
||||
// this.level.timings.doTickTiles.startTiming(); // Spigot // Paper
|
||||
@@ -1088,6 +1098,30 @@ public class ServerChunkCache extends ChunkSource {
|
||||
}
|
||||
}
|
||||
// Paper end - controlled flush for entity tracker packets
|
||||
+
|
||||
+ // Pufferfish start - optimize mob spawning
|
||||
+ if (wtf.etil.mirai.MiraiConfig.enableAsyncMobSpawning) {
|
||||
+ for (ServerPlayer player : this.level.players) {
|
||||
+ Arrays.fill(player.mobCounts, 0);
|
||||
+ }
|
||||
+ if (firstRunSpawnCounts) {
|
||||
+ firstRunSpawnCounts = false;
|
||||
+ _pufferfish_spawnCountsReady.set(true);
|
||||
+ }
|
||||
+ if (chunkMap.playerMobDistanceMap != null && _pufferfish_spawnCountsReady.getAndSet(false)) {
|
||||
+ net.minecraft.server.MinecraftServer.getServer().mobSpawnExecutor.submit(() -> {
|
||||
+ int mapped = distanceManager.getNaturalSpawnChunkCount();
|
||||
+ io.papermc.paper.util.maplist.IteratorSafeOrderedReferenceSet.Iterator<Entity> objectiterator =
|
||||
+ level.entityTickList.entities.iterator(io.papermc.paper.util.maplist.IteratorSafeOrderedReferenceSet.ITERATOR_FLAG_SEE_ADDITIONS);
|
||||
+ gg.pufferfish.pufferfish.util.IterableWrapper<Entity> wrappedIterator =
|
||||
+ new gg.pufferfish.pufferfish.util.IterableWrapper<>(objectiterator);
|
||||
+ lastSpawnState = NaturalSpawner.createState(mapped, wrappedIterator, this::getFullChunk, true);
|
||||
+ objectiterator.finishedIterating();
|
||||
+ _pufferfish_spawnCountsReady.set(true);
|
||||
+ });
|
||||
+ }
|
||||
+ }
|
||||
+ // Pufferfish end
|
||||
}
|
||||
|
||||
private void getFullChunk(long pos, Consumer<LevelChunk> chunkConsumer) {
|
||||
diff --git a/src/main/java/net/minecraft/world/entity/Entity.java b/src/main/java/net/minecraft/world/entity/Entity.java
|
||||
index 2c0ca9194e8ad3b53776455db54cca16dc1095e4..a2a5d1d02a68a94f6ae972e4242667809d7997b5 100644
|
||||
--- a/src/main/java/net/minecraft/world/entity/Entity.java
|
||||
+++ b/src/main/java/net/minecraft/world/entity/Entity.java
|
||||
@@ -223,7 +223,7 @@ public abstract class Entity implements Nameable, EntityAccess, CommandSource, n
|
||||
public double yo;
|
||||
public double zo;
|
||||
private Vec3 position;
|
||||
- private BlockPos blockPosition;
|
||||
+ public BlockPos blockPosition; // Pufferfish - private->public
|
||||
private Vec3 deltaMovement;
|
||||
public float yRot; // Paper - private->public
|
||||
private float xRot;
|
||||
diff --git a/src/main/java/net/minecraft/world/entity/LivingEntity.java b/src/main/java/net/minecraft/world/entity/LivingEntity.java
|
||||
index 82678fd59a4a49cca6e5a90b850197d93d5fa18f..6b271550bad3c28a0fa57c189633cfdf8270b400 100644
|
||||
--- a/src/main/java/net/minecraft/world/entity/LivingEntity.java
|
||||
+++ b/src/main/java/net/minecraft/world/entity/LivingEntity.java
|
||||
@@ -394,7 +394,7 @@ public abstract class LivingEntity extends Entity {
|
||||
|
||||
if (!wtf.etil.mirai.MiraiConfig.disableEntityStuckChecks) { // Yatopia
|
||||
if (this.isAlive()) {
|
||||
- if (this.isInWall()) {
|
||||
+ if (tickCount % 20 == 0 && couldPossiblyBeHurt(1.0F) && this.isInWall()) { // Pufferfish - optimize suffocation
|
||||
this.hurt(DamageSource.IN_WALL, 1.0F);
|
||||
} else if (flag && !this.level.getWorldBorder().isWithinBounds(this.getBoundingBox())) {
|
||||
double d0 = this.level.getWorldBorder().getDistanceToBorder((Entity) this) + this.level.getWorldBorder().getDamageSafeZone();
|
||||
@@ -1293,6 +1293,15 @@ public abstract class LivingEntity extends Entity {
|
||||
public boolean isDeadOrDying() {
|
||||
return this.getHealth() <= 0.0F;
|
||||
}
|
||||
+
|
||||
+ // Pufferfish start - optimize suffocation
|
||||
+ public boolean couldPossiblyBeHurt(float amount) {
|
||||
+ if ((float) this.invulnerableTime > (float) this.invulnerableDuration / 2.0F && amount <= this.lastHurt) {
|
||||
+ return false;
|
||||
+ }
|
||||
+ return true;
|
||||
+ }
|
||||
+ // Pufferfish end
|
||||
|
||||
@Override
|
||||
public boolean hurt(DamageSource source, float amount) {
|
||||
diff --git a/src/main/java/net/minecraft/world/level/NaturalSpawner.java b/src/main/java/net/minecraft/world/level/NaturalSpawner.java
|
||||
index dc613142603fca4cf5c8e47c084e1439d0450424..9b8fc5a8eda1079b23c6da4e8ab17912fbe72c90 100644
|
||||
--- a/src/main/java/net/minecraft/world/level/NaturalSpawner.java
|
||||
+++ b/src/main/java/net/minecraft/world/level/NaturalSpawner.java
|
||||
@@ -167,7 +167,7 @@ public final class NaturalSpawner {
|
||||
int difference = k1 - currEntityCount;
|
||||
|
||||
if (world.paperConfig.perPlayerMobSpawns) {
|
||||
- int minDiff = Integer.MAX_VALUE;
|
||||
+ int minDiff = wtf.etil.mirai.MiraiConfig.enableAsyncMobSpawning ? difference : Integer.MAX_VALUE; // Pufferfish - optimize mob spawning
|
||||
for (ServerPlayer entityplayer : world.getChunkSource().chunkMap.playerMobDistanceMap.getPlayersInRange(chunk.getPos())) {
|
||||
minDiff = Math.min(limit - world.getChunkSource().chunkMap.getMobCountNear(entityplayer, enumcreaturetype), minDiff);
|
||||
}
|
||||
diff --git a/src/main/java/net/minecraft/world/level/entity/EntityTickList.java b/src/main/java/net/minecraft/world/level/entity/EntityTickList.java
|
||||
index 4814e719e0b898464692075170889fdb2729a26a..ffcd18fa852af3f24bdf5398f481b839d2dcfe6c 100644
|
||||
--- a/src/main/java/net/minecraft/world/level/entity/EntityTickList.java
|
||||
+++ b/src/main/java/net/minecraft/world/level/entity/EntityTickList.java
|
||||
@@ -9,7 +9,7 @@ import javax.annotation.Nullable;
|
||||
import net.minecraft.world.entity.Entity;
|
||||
|
||||
public class EntityTickList {
|
||||
- private final io.papermc.paper.util.maplist.IteratorSafeOrderedReferenceSet<Entity> entities = new io.papermc.paper.util.maplist.IteratorSafeOrderedReferenceSet<>(true); // Paper - rewrite this, always keep this updated - why would we EVER tick an entity that's not ticking?
|
||||
+ public final io.papermc.paper.util.maplist.IteratorSafeOrderedReferenceSet<Entity> entities = new io.papermc.paper.util.maplist.IteratorSafeOrderedReferenceSet<>(true); // Paper - rewrite this, always keep this updated - why would we EVER tick an entity that's not ticking? // Pufferfish - private->public
|
||||
|
||||
private void ensureActiveIsNotIterated() {
|
||||
// Paper - replace with better logic, do not delay removals
|
||||
diff --git a/src/main/java/wtf/etil/mirai/MiraiConfig.java b/src/main/java/wtf/etil/mirai/MiraiConfig.java
|
||||
index a0389406b9e2ff343d926581e05361bc9edaac4e..810e4914e0c0c0246302f503c5fc10ff59be0ac3 100644
|
||||
--- a/src/main/java/wtf/etil/mirai/MiraiConfig.java
|
||||
+++ b/src/main/java/wtf/etil/mirai/MiraiConfig.java
|
||||
@@ -252,4 +252,15 @@ public class MiraiConfig {
|
||||
}
|
||||
}
|
||||
|
||||
+ public static boolean enableAsyncMobSpawning;
|
||||
+ public static boolean asyncMobSpawningInitialized;
|
||||
+ private static void asyncMobSpawning() {
|
||||
+ boolean temp = getBoolean("settings.mobs.enable-async-mob-spawning", true);
|
||||
+ // This prevents us from changing the value during a reload.
|
||||
+ if (!asyncMobSpawningInitialized) {
|
||||
+ asyncMobSpawningInitialized = true;
|
||||
+ enableAsyncMobSpawning = temp;
|
||||
+ }
|
||||
+ }
|
||||
+
|
||||
}
|
||||
\ No newline at end of file
|
||||
Reference in New Issue
Block a user