36 lines
2.1 KiB
Diff
36 lines
2.1 KiB
Diff
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
|
|
From: etil2jz <81570777+etil2jz@users.noreply.github.com>
|
|
Date: Fri, 24 Jun 2022 20:10:19 +0200
|
|
Subject: [PATCH] Configurable enchantment table book animation tick
|
|
|
|
|
|
diff --git a/src/main/java/dev/etil/mirai/MiraiConfig.java b/src/main/java/dev/etil/mirai/MiraiConfig.java
|
|
index 8e720820a94cf5d39e59998700932bfbb5c15544..929ccc5cf475a5b3d19e44d8d6b324e1d647b5d1 100644
|
|
--- a/src/main/java/dev/etil/mirai/MiraiConfig.java
|
|
+++ b/src/main/java/dev/etil/mirai/MiraiConfig.java
|
|
@@ -202,4 +202,11 @@ public class MiraiConfig {
|
|
"Whether or not entities should be able to use portals.");
|
|
}
|
|
|
|
+ public static boolean bookAnimationTick;
|
|
+ private static void bookTicking() {
|
|
+ bookAnimationTick = getBoolean("enchantment-table-book-animation-tick", false,
|
|
+ "Whether or not server should animate enchantment table book.",
|
|
+ "Disabling it can save MSPT, especially with quite a lot of enchantment tables.");
|
|
+ }
|
|
+
|
|
}
|
|
\ No newline at end of file
|
|
diff --git a/src/main/java/net/minecraft/world/level/block/entity/EnchantmentTableBlockEntity.java b/src/main/java/net/minecraft/world/level/block/entity/EnchantmentTableBlockEntity.java
|
|
index 2341a5a249d455628165fc6ba508fc6d70c3dbfb..20e224ea5dbd96fd0d12ea5a1143fe0702cd6e77 100644
|
|
--- a/src/main/java/net/minecraft/world/level/block/entity/EnchantmentTableBlockEntity.java
|
|
+++ b/src/main/java/net/minecraft/world/level/block/entity/EnchantmentTableBlockEntity.java
|
|
@@ -48,6 +48,7 @@ public class EnchantmentTableBlockEntity extends BlockEntity implements Nameable
|
|
}
|
|
|
|
public static void bookAnimationTick(Level world, BlockPos pos, BlockState state, EnchantmentTableBlockEntity blockEntity) {
|
|
+ if (!dev.etil.mirai.MiraiConfig.bookAnimationTick) return; // Mirai - skip enchantment table book tick
|
|
blockEntity.oOpen = blockEntity.open;
|
|
blockEntity.oRot = blockEntity.rot;
|
|
Player player = world.getNearestPlayer((double)pos.getX() + 0.5D, (double)pos.getY() + 0.5D, (double)pos.getZ() + 0.5D, 3.0D, false);
|