Yatopia/patches/server/0050-Configurable-enchanting-table-tick.patch
Simon Gardling 38e7312ecd fix
2021-06-10 16:13:42 -04:00

47 lines
2.9 KiB
Diff

From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
From: Ivan Pekov <ivan@mrivanplays.com>
Date: Wed, 23 Dec 2020 08:42:18 +0200
Subject: [PATCH] Configurable enchanting table tick
Also don't tick blockentity beehive if there are no bees in it.
This patch is a leftover from the original tile entity optimisations, which was majorly flawed.
diff --git a/src/main/java/net/minecraft/world/level/block/entity/TileEntityBeehive.java b/src/main/java/net/minecraft/world/level/block/entity/TileEntityBeehive.java
index 80083a6666a28372946cf0e68ded44d075357f7d..cacef4349a8dba02c2faee77e30f7c938f3d31af 100644
--- a/src/main/java/net/minecraft/world/level/block/entity/TileEntityBeehive.java
+++ b/src/main/java/net/minecraft/world/level/block/entity/TileEntityBeehive.java
@@ -309,6 +309,7 @@ public class TileEntityBeehive extends TileEntity implements ITickable {
@Override
public void tick() {
+ if (this.bees.size() == 0) { return; } // Yatopia - TE optimizations
if (!this.world.isClientSide) {
this.y();
BlockPosition blockposition = this.getPosition();
diff --git a/src/main/java/net/minecraft/world/level/block/entity/TileEntityEnchantTable.java b/src/main/java/net/minecraft/world/level/block/entity/TileEntityEnchantTable.java
index 7d81c45f8b514df1a9dafd3b1294a9ad852251f8..4b1cb089355b455c6210f2df1af797cc363997cf 100644
--- a/src/main/java/net/minecraft/world/level/block/entity/TileEntityEnchantTable.java
+++ b/src/main/java/net/minecraft/world/level/block/entity/TileEntityEnchantTable.java
@@ -50,6 +50,7 @@ public class TileEntityEnchantTable extends TileEntity implements INamableTileEn
@Override
public void tick() {
+ if (!org.yatopiamc.yatopia.server.YatopiaConfig.shouldTickEnchantingTables) { return; } // Yatopia - TE optimizations
this.j = this.i;
this.l = this.k;
EntityHuman entityhuman = this.world.a((double) this.position.getX() + 0.5D, (double) this.position.getY() + 0.5D, (double) this.position.getZ() + 0.5D, 3.0D, false);
diff --git a/src/main/java/org/yatopiamc/yatopia/server/YatopiaConfig.java b/src/main/java/org/yatopiamc/yatopia/server/YatopiaConfig.java
index 2329a3d4c3aaa660a0c824bb44be0b563949b917..99e6998782b28b2955005b3333e4c2fe7b3fb2bc 100644
--- a/src/main/java/org/yatopiamc/yatopia/server/YatopiaConfig.java
+++ b/src/main/java/org/yatopiamc/yatopia/server/YatopiaConfig.java
@@ -258,4 +258,9 @@ public class YatopiaConfig {
checkVehicleMovedQuickly = getBoolean("settings.checks.vehicle-moved-quickly", checkVehicleMovedQuickly);
checkVehicleMovedWrongly = getBoolean("settings.checks.vehicle-moved-wrongly", checkVehicleMovedWrongly);
}
+
+ public static boolean shouldTickEnchantingTables = false;
+ private static void tickEnchantingTables() {
+ shouldTickEnchantingTables = getBoolean("settings.tick.enchanting-tables", shouldTickEnchantingTables);
+ }
}