2020-10-27 20:15:13 +01:00
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
From: Mykyta Komarnytskyy <nkomarn@hotmail.com>
Date: Sat, 24 Oct 2020 21:08:17 -0500
Subject: [PATCH] Configurable criterion triggers
This patch adds toggles for three criterion triggers that are called every tick. These can be very unnecessary, and especially in the case of CriterionTriggerEnterBlock, quite heavy.
diff --git a/src/main/java/net/minecraft/server/EntityPlayer.java b/src/main/java/net/minecraft/server/EntityPlayer.java
2021-01-21 11:58:52 +01:00
index 7596eaf605bf73dd44c06b66bcc0e5a36242fe7a..46813a0a65977233acdabb225552e8cfc5d06ab9 100644
2020-10-27 20:15:13 +01:00
--- a/src/main/java/net/minecraft/server/EntityPlayer.java
+++ b/src/main/java/net/minecraft/server/EntityPlayer.java
2021-01-21 11:58:52 +01:00
@@ -435,6 +435,7 @@ public class EntityPlayer extends EntityHuman implements ICrafting {
2020-10-27 20:15:13 +01:00
@Override
protected void a(IBlockData iblockdata) {
2020-12-02 07:35:11 +01:00
+ if (org.yatopiamc.yatopia.server.YatopiaConfig.criterionTriggerEnterBlock) // Yatopia
2020-10-27 20:15:13 +01:00
CriterionTriggers.d.a(this, iblockdata);
}
2021-01-21 11:58:52 +01:00
@@ -765,7 +766,7 @@ public class EntityPlayer extends EntityHuman implements ICrafting {
2020-10-27 20:15:13 +01:00
this.playerConnection.sendPacket(new PacketPlayOutExperience(this.exp, this.expTotal, this.expLevel));
}
- if (this.ticksLived % 20 == 0) {
2020-12-02 07:35:11 +01:00
+ if (org.yatopiamc.yatopia.server.YatopiaConfig.criterionTriggerLocation && this.ticksLived % 20 == 0) { // Yatopia
2020-10-27 20:15:13 +01:00
CriterionTriggers.p.a(this);
}
2020-12-02 07:35:11 +01:00
diff --git a/src/main/java/org/yatopiamc/yatopia/server/YatopiaConfig.java b/src/main/java/org/yatopiamc/yatopia/server/YatopiaConfig.java
2021-01-24 16:52:19 +01:00
index 045ace1444b4db8fa5fab09f970de7a696c56ab8..2100ac9c1f4d0df75347579cc5d58255b77ec252 100644
2020-12-02 07:35:11 +01:00
--- a/src/main/java/org/yatopiamc/yatopia/server/YatopiaConfig.java
+++ b/src/main/java/org/yatopiamc/yatopia/server/YatopiaConfig.java
2021-01-24 16:52:19 +01:00
@@ -235,4 +235,14 @@ public class YatopiaConfig {
2020-10-27 20:15:13 +01:00
private static void intervals() {
playerTimeStatisticsInterval = Math.max(1, getInt("settings.intervals.player-time-statistics", 1));
}
+
+ public static boolean criterionTriggerLocation = true;
+ public static boolean criterionTriggerEnterBlock = true;
+ public static boolean criterionTriggerTick = true;
+ private static void criterionTriggers() {
+ criterionTriggerLocation = getBoolean("settings.criterion-triggers.location", true);
+ criterionTriggerEnterBlock = getBoolean("settings.criterion-triggers.enter-block", true);
+ criterionTriggerTick = getBoolean("settings.criterion-triggers.tick", true);
+ }
+
}