Simplify A LOT FastMath.round configuration
Thanks Jerry lol
This commit is contained in:
@@ -5,7 +5,7 @@ Subject: [PATCH] Configurable max bees in hive
|
||||
|
||||
|
||||
diff --git a/src/main/java/net/minecraft/world/level/block/entity/BeehiveBlockEntity.java b/src/main/java/net/minecraft/world/level/block/entity/BeehiveBlockEntity.java
|
||||
index 5c784e1155c16dbbe1b75bb5bcb3d73793d146a3..8eabe7113822d35ff53390e981ea69ad5f07d67d 100644
|
||||
index b05ac56823feaf062b1418c9e6dbe4268225f00f..2d981971497c3f06a3bae7a15679af462f489b6f 100644
|
||||
--- a/src/main/java/net/minecraft/world/level/block/entity/BeehiveBlockEntity.java
|
||||
+++ b/src/main/java/net/minecraft/world/level/block/entity/BeehiveBlockEntity.java
|
||||
@@ -43,7 +43,7 @@ public class BeehiveBlockEntity extends BlockEntity {
|
||||
@@ -18,10 +18,10 @@ index 5c784e1155c16dbbe1b75bb5bcb3d73793d146a3..8eabe7113822d35ff53390e981ea69ad
|
||||
public BeehiveBlockEntity(BlockPos pos, BlockState state) {
|
||||
super(BlockEntityType.BEEHIVE, pos, state);
|
||||
diff --git a/src/main/java/wtf/etil/mirai/MiraiConfig.java b/src/main/java/wtf/etil/mirai/MiraiConfig.java
|
||||
index 9f775115d5120d3fc514d9c0cea98272feecbb49..458d7aedfd8279f0e581415f350e867672718027 100644
|
||||
index 63d750d5858d20304b9608697ae618eb97cb6eb6..667eaabe95e9b44cad64dd5aba5ac693f4d726ed 100644
|
||||
--- a/src/main/java/wtf/etil/mirai/MiraiConfig.java
|
||||
+++ b/src/main/java/wtf/etil/mirai/MiraiConfig.java
|
||||
@@ -194,6 +194,9 @@ public class MiraiConfig {
|
||||
@@ -189,6 +189,9 @@ public class MiraiConfig {
|
||||
logPlayerLoginLoc = getBoolean("log-player-login-location", logPlayerLoginLoc);
|
||||
}
|
||||
|
||||
|
||||
@@ -7,7 +7,7 @@ Original code by PatinaMC, licensed under GNU General Public License v3.0
|
||||
You can find the original code on https://github.com/PatinaMC/Patina
|
||||
|
||||
diff --git a/src/main/java/net/minecraft/server/MinecraftServer.java b/src/main/java/net/minecraft/server/MinecraftServer.java
|
||||
index 98bebaab40390418681b2ee42af0dd4b14df6330..66b67c42d223dab3daf98e9088f1277b17342ac5 100644
|
||||
index 1e02e916815e14bce466bd02d9ffe664d456cfbc..ff048b48ab243513967572872220176d826659fe 100644
|
||||
--- a/src/main/java/net/minecraft/server/MinecraftServer.java
|
||||
+++ b/src/main/java/net/minecraft/server/MinecraftServer.java
|
||||
@@ -186,7 +186,7 @@ import org.bukkit.event.server.ServerLoadEvent;
|
||||
@@ -19,7 +19,7 @@ index 98bebaab40390418681b2ee42af0dd4b14df6330..66b67c42d223dab3daf98e9088f1277b
|
||||
|
||||
private static MinecraftServer SERVER; // Paper
|
||||
public static final Logger LOGGER = LogManager.getLogger();
|
||||
@@ -1368,19 +1368,21 @@ public abstract class MinecraftServer extends ReentrantBlockableEventLoop<TickTa
|
||||
@@ -1367,19 +1367,21 @@ public abstract class MinecraftServer extends ReentrantBlockableEventLoop<TickTa
|
||||
}
|
||||
|
||||
@Override
|
||||
@@ -43,7 +43,7 @@ index 98bebaab40390418681b2ee42af0dd4b14df6330..66b67c42d223dab3daf98e9088f1277b
|
||||
|
||||
@Override
|
||||
public boolean pollTask() {
|
||||
@@ -1411,10 +1413,12 @@ public abstract class MinecraftServer extends ReentrantBlockableEventLoop<TickTa
|
||||
@@ -1410,10 +1412,12 @@ public abstract class MinecraftServer extends ReentrantBlockableEventLoop<TickTa
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -58,7 +58,7 @@ index f99d189f461921d37581e2fc1382af60921b0660..c0f65d6c73773e4872b30126775e5b02
|
||||
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 41557a97b1bc1d4986efa9d4a5d7691ec250882f..1866d0a01cf921d306d4a3e251076f20b60463a1 100644
|
||||
index ff048b48ab243513967572872220176d826659fe..8ff419c0054fcb65257eb76b53323b318e303bc1 100644
|
||||
--- a/src/main/java/net/minecraft/server/MinecraftServer.java
|
||||
+++ b/src/main/java/net/minecraft/server/MinecraftServer.java
|
||||
@@ -372,6 +372,7 @@ public abstract class MinecraftServer extends ReentrantBlockableEventLoop<Runnab
|
||||
@@ -77,7 +77,7 @@ index 41557a97b1bc1d4986efa9d4a5d7691ec250882f..1866d0a01cf921d306d4a3e251076f20
|
||||
Util.shutdownExecutors(); // Paper
|
||||
LOGGER.info("Closing Server");
|
||||
try {
|
||||
@@ -1522,6 +1524,7 @@ public abstract class MinecraftServer extends ReentrantBlockableEventLoop<Runnab
|
||||
@@ -1521,6 +1523,7 @@ public abstract class MinecraftServer extends ReentrantBlockableEventLoop<Runnab
|
||||
io.papermc.paper.util.CachedLists.reset(); // Paper
|
||||
// Paper start - move executeAll() into full server tick timing
|
||||
try (co.aikar.timings.Timing ignored = MinecraftTimings.processTasksTimer.startTiming()) {
|
||||
@@ -86,7 +86,7 @@ index 41557a97b1bc1d4986efa9d4a5d7691ec250882f..1866d0a01cf921d306d4a3e251076f20
|
||||
}
|
||||
// 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 9dcae48cd94c411176368312adf9f44b11af5760..2128063800421e0710db8f73ae9b460796bc649f 100644
|
||||
index 1be5ae3162f2e2b5a48310c162edf8bdc8a08c2b..475f080d91c7f7cbb012ed5a28dabc0ccab5a22c 100644
|
||||
--- a/src/main/java/net/minecraft/server/network/ServerLoginPacketListenerImpl.java
|
||||
+++ b/src/main/java/net/minecraft/server/network/ServerLoginPacketListenerImpl.java
|
||||
@@ -46,6 +46,7 @@ import org.bukkit.event.player.AsyncPlayerPreLoginEvent;
|
||||
|
||||
@@ -7,7 +7,7 @@ Original code by YatopiaMC, licensed under MIT
|
||||
You can find the original code on https://github.com/YatopiaMC/Yatopia
|
||||
|
||||
diff --git a/src/main/java/net/minecraft/server/MinecraftServer.java b/src/main/java/net/minecraft/server/MinecraftServer.java
|
||||
index aa1d8f84772aa3b5d329f899900ecd4a13ca24a9..582da4061c930f84f10efc9b444c28f2bf1a08b1 100644
|
||||
index 4869e98d6c328ea4bf0c17bac15c4e5f613b8d59..322641da4c08dd71a73b75077b39f5ea65af815a 100644
|
||||
--- a/src/main/java/net/minecraft/server/MinecraftServer.java
|
||||
+++ b/src/main/java/net/minecraft/server/MinecraftServer.java
|
||||
@@ -1202,6 +1202,8 @@ public abstract class MinecraftServer extends ReentrantBlockableEventLoop<Runnab
|
||||
@@ -19,7 +19,7 @@ index aa1d8f84772aa3b5d329f899900ecd4a13ca24a9..582da4061c930f84f10efc9b444c28f2
|
||||
protected void runServer() {
|
||||
try {
|
||||
long serverStartTime = Util.getNanos(); // Paper
|
||||
@@ -1268,7 +1270,9 @@ public abstract class MinecraftServer extends ReentrantBlockableEventLoop<Runnab
|
||||
@@ -1267,7 +1269,9 @@ public abstract class MinecraftServer extends ReentrantBlockableEventLoop<Runnab
|
||||
this.nextTickTime += 50L;
|
||||
this.startMetricsRecordingTick();
|
||||
this.profiler.push("tick");
|
||||
@@ -30,7 +30,7 @@ index aa1d8f84772aa3b5d329f899900ecd4a13ca24a9..582da4061c930f84f10efc9b444c28f2
|
||||
this.mayHaveDelayedTasks = true;
|
||||
this.delayedTasksMaxNextTickTime = Math.max(Util.getMillis() + 50L, this.nextTickTime);
|
||||
diff --git a/src/main/java/org/bukkit/craftbukkit/CraftServer.java b/src/main/java/org/bukkit/craftbukkit/CraftServer.java
|
||||
index e9545ca9c043a366ad60b14b4318504b6e71bb5e..dc539316e95e3e10faa940d928f4e7d8f869a193 100644
|
||||
index 6f885434f0576d2738b9c74fa9cc202e66ede262..f6bb659c9099b5256ef563676936f466526f1765 100644
|
||||
--- a/src/main/java/org/bukkit/craftbukkit/CraftServer.java
|
||||
+++ b/src/main/java/org/bukkit/craftbukkit/CraftServer.java
|
||||
@@ -2822,4 +2822,6 @@ public final class CraftServer implements Server {
|
||||
|
||||
@@ -29,10 +29,10 @@ index 889a4804eaa128e2f79a4ea48b8aa796336576d1..c0ab6ad0bd58b03cae2662d21c9c8449
|
||||
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/wtf/etil/mirai/MiraiConfig.java b/src/main/java/wtf/etil/mirai/MiraiConfig.java
|
||||
index 458d7aedfd8279f0e581415f350e867672718027..d6bc7e52e01bc6877fc96f0948dcbc192e64e2b0 100644
|
||||
index 667eaabe95e9b44cad64dd5aba5ac693f4d726ed..a24a35f3ef2812d2951fb13439f856ee9495226b 100644
|
||||
--- a/src/main/java/wtf/etil/mirai/MiraiConfig.java
|
||||
+++ b/src/main/java/wtf/etil/mirai/MiraiConfig.java
|
||||
@@ -199,4 +199,13 @@ public class MiraiConfig {
|
||||
@@ -194,4 +194,13 @@ public class MiraiConfig {
|
||||
maxBees = getInt("max-bees-in-hive", maxBees);
|
||||
}
|
||||
|
||||
|
||||
@@ -42,10 +42,10 @@ index 4fa44b576404438d08085e1d8c82fa96206eae50..042985988d11ca9f1bf6a62ec0622392
|
||||
this.entity.stopSeenByPlayer(player);
|
||||
player.connection.send(new ClientboundRemoveEntitiesPacket(new int[]{this.entity.getId()}));
|
||||
diff --git a/src/main/java/wtf/etil/mirai/MiraiConfig.java b/src/main/java/wtf/etil/mirai/MiraiConfig.java
|
||||
index d6bc7e52e01bc6877fc96f0948dcbc192e64e2b0..01511376b5548468d63893bf8d69bae7f8f5f521 100644
|
||||
index a24a35f3ef2812d2951fb13439f856ee9495226b..8be485f3f68f42e09058fc543485137e03056266 100644
|
||||
--- a/src/main/java/wtf/etil/mirai/MiraiConfig.java
|
||||
+++ b/src/main/java/wtf/etil/mirai/MiraiConfig.java
|
||||
@@ -206,6 +206,11 @@ public class MiraiConfig {
|
||||
@@ -201,6 +201,11 @@ public class MiraiConfig {
|
||||
checkVehicleFlying = getBoolean("checks.vehicle-flight", checkVehicleFlying);
|
||||
}
|
||||
|
||||
|
||||
@@ -58,10 +58,10 @@ index feabd407ad8cf6da9b74a9ba755da0f0e6a0313b..5564118497f6c0c04e95602b7f567562
|
||||
if (this.keepAlivePending && packet.getId() == this.keepAliveChallenge) {
|
||||
int i = (int) (Util.getMillis() - this.keepAliveTime);
|
||||
diff --git a/src/main/java/wtf/etil/mirai/MiraiConfig.java b/src/main/java/wtf/etil/mirai/MiraiConfig.java
|
||||
index 01511376b5548468d63893bf8d69bae7f8f5f521..6b229fef229e136fff7598b9efab974997d48116 100644
|
||||
index 8be485f3f68f42e09058fc543485137e03056266..ee0b35e703b1930b32a01b5fa532fdbaf60127c4 100644
|
||||
--- a/src/main/java/wtf/etil/mirai/MiraiConfig.java
|
||||
+++ b/src/main/java/wtf/etil/mirai/MiraiConfig.java
|
||||
@@ -211,6 +211,11 @@ public class MiraiConfig {
|
||||
@@ -206,6 +206,11 @@ public class MiraiConfig {
|
||||
dontSendUselessEntityPackets = getBoolean("dont-send-useless-entity-packets", dontSendUselessEntityPackets);
|
||||
}
|
||||
|
||||
|
||||
@@ -43,10 +43,10 @@ index b2a15c986c7500a0ce227a54cb61ec3f5378f6f3..d243af83f3159d8a4d56d08dab022b31
|
||||
if (MinecraftServer.getServer() != null && MinecraftServer.getServer().isDebugging()) {
|
||||
new Exception().printStackTrace();
|
||||
diff --git a/src/main/java/wtf/etil/mirai/MiraiConfig.java b/src/main/java/wtf/etil/mirai/MiraiConfig.java
|
||||
index 6b229fef229e136fff7598b9efab974997d48116..d2a5547b58c09245214d9722a07e0164ba921ddc 100644
|
||||
index ee0b35e703b1930b32a01b5fa532fdbaf60127c4..ede41bc4ab49065cc06e66189610791cab01b39d 100644
|
||||
--- a/src/main/java/wtf/etil/mirai/MiraiConfig.java
|
||||
+++ b/src/main/java/wtf/etil/mirai/MiraiConfig.java
|
||||
@@ -216,6 +216,15 @@ public class MiraiConfig {
|
||||
@@ -211,6 +211,15 @@ public class MiraiConfig {
|
||||
useAlternateKeepAlive = getBoolean("use-alternate-keepalive", useAlternateKeepAlive);
|
||||
}
|
||||
|
||||
|
||||
@@ -29,7 +29,7 @@ index fa56cd09102a89692b42f1d14257990508c5c720..f9251183df72ddc56662fd3f02acf216
|
||||
setListData(vector);
|
||||
}
|
||||
diff --git a/src/main/java/net/minecraft/server/MinecraftServer.java b/src/main/java/net/minecraft/server/MinecraftServer.java
|
||||
index 582da4061c930f84f10efc9b444c28f2bf1a08b1..5b17832ffcf0f21ce8dcfd943df2915079a4e907 100644
|
||||
index 322641da4c08dd71a73b75077b39f5ea65af815a..744b39a86ab02350e36b16036cf3f82d0be1dd86 100644
|
||||
--- a/src/main/java/net/minecraft/server/MinecraftServer.java
|
||||
+++ b/src/main/java/net/minecraft/server/MinecraftServer.java
|
||||
@@ -303,7 +303,7 @@ public abstract class MinecraftServer extends ReentrantBlockableEventLoop<Runnab
|
||||
@@ -49,7 +49,7 @@ index 582da4061c930f84f10efc9b444c28f2bf1a08b1..5b17832ffcf0f21ce8dcfd943df29150
|
||||
public final RollingAverage tps1 = new RollingAverage(60);
|
||||
public final RollingAverage tps5 = new RollingAverage(60 * 5);
|
||||
public final RollingAverage tps15 = new RollingAverage(60 * 15);
|
||||
@@ -1248,13 +1249,17 @@ public abstract class MinecraftServer extends ReentrantBlockableEventLoop<Runnab
|
||||
@@ -1247,13 +1248,17 @@ public abstract class MinecraftServer extends ReentrantBlockableEventLoop<Runnab
|
||||
{
|
||||
final long diff = curTime - tickSection;
|
||||
java.math.BigDecimal currentTps = TPS_BASE.divide(new java.math.BigDecimal(diff), 30, java.math.RoundingMode.HALF_UP);
|
||||
@@ -71,7 +71,7 @@ index 582da4061c930f84f10efc9b444c28f2bf1a08b1..5b17832ffcf0f21ce8dcfd943df29150
|
||||
tickSection = curTime;
|
||||
}
|
||||
diff --git a/src/main/java/org/bukkit/craftbukkit/CraftServer.java b/src/main/java/org/bukkit/craftbukkit/CraftServer.java
|
||||
index dc539316e95e3e10faa940d928f4e7d8f869a193..d1089bc2e191f987ab432b9596664cb191888a1f 100644
|
||||
index f6bb659c9099b5256ef563676936f466526f1765..9d9d76c4f44a8c2421d560de9e3eac9ae26290cf 100644
|
||||
--- a/src/main/java/org/bukkit/craftbukkit/CraftServer.java
|
||||
+++ b/src/main/java/org/bukkit/craftbukkit/CraftServer.java
|
||||
@@ -2622,6 +2622,7 @@ public final class CraftServer implements Server {
|
||||
|
||||
@@ -19,7 +19,7 @@ index 0011192cdba6dcb7ca125ae4a49ca89a93cc40f2..ade6a3d0e90e8c82e3e90bd2d12369cc
|
||||
// CraftBukkit end
|
||||
this.setLevel(worldserver);
|
||||
diff --git a/src/main/java/net/minecraft/world/entity/Entity.java b/src/main/java/net/minecraft/world/entity/Entity.java
|
||||
index 6c48c882e297f74b507ac363507da3586dad1d81..e05b0c80150d5db8696d5bb78ef3eb70363cd61c 100644
|
||||
index b4b8d2abe29239968cc623f6438c0156659f14e9..18e024c625e39f1f9e2815a777b6c1d155274806 100644
|
||||
--- a/src/main/java/net/minecraft/world/entity/Entity.java
|
||||
+++ b/src/main/java/net/minecraft/world/entity/Entity.java
|
||||
@@ -2724,12 +2724,15 @@ public abstract class Entity implements Nameable, EntityAccess, CommandSource, i
|
||||
@@ -39,10 +39,10 @@ index 6c48c882e297f74b507ac363507da3586dad1d81..e05b0c80150d5db8696d5bb78ef3eb70
|
||||
|
||||
this.isInsidePortal = true;
|
||||
diff --git a/src/main/java/wtf/etil/mirai/MiraiConfig.java b/src/main/java/wtf/etil/mirai/MiraiConfig.java
|
||||
index d2a5547b58c09245214d9722a07e0164ba921ddc..0275dac37ec5864e7b1e0b5c9a3dd9d7aa10a97f 100644
|
||||
index ede41bc4ab49065cc06e66189610791cab01b39d..f05dac79dc5a2bfacbe209bb36e13c4f55cac311 100644
|
||||
--- a/src/main/java/wtf/etil/mirai/MiraiConfig.java
|
||||
+++ b/src/main/java/wtf/etil/mirai/MiraiConfig.java
|
||||
@@ -225,6 +225,11 @@ public class MiraiConfig {
|
||||
@@ -220,6 +220,11 @@ public class MiraiConfig {
|
||||
loggerSuppressUnrecognizedRecipeErrors = getBoolean("logger.suppress-unrecognized-recipe-errors", loggerSuppressUnrecognizedRecipeErrors);
|
||||
}
|
||||
|
||||
|
||||
@@ -7,7 +7,7 @@ Original code by PurpurMC, licensed under MIT
|
||||
You can find the original code on https://github.com/PurpurMC/Purpur
|
||||
|
||||
diff --git a/src/main/java/net/minecraft/world/entity/Entity.java b/src/main/java/net/minecraft/world/entity/Entity.java
|
||||
index e05b0c80150d5db8696d5bb78ef3eb70363cd61c..7ad3ac00dd1107cca3be8ed02bddc2b55be6dcca 100644
|
||||
index 18e024c625e39f1f9e2815a777b6c1d155274806..9da77bc090385becb60d72842f9d2f05f5608546 100644
|
||||
--- a/src/main/java/net/minecraft/world/entity/Entity.java
|
||||
+++ b/src/main/java/net/minecraft/world/entity/Entity.java
|
||||
@@ -2729,7 +2729,7 @@ public abstract class Entity implements Nameable, EntityAccess, CommandSource, i
|
||||
@@ -29,10 +29,10 @@ index e05b0c80150d5db8696d5bb78ef3eb70363cd61c..7ad3ac00dd1107cca3be8ed02bddc2b5
|
||||
|
||||
public float getBlockExplosionResistance(Explosion explosion, BlockGetter world, BlockPos pos, BlockState blockState, FluidState fluidState, float max) {
|
||||
diff --git a/src/main/java/wtf/etil/mirai/MiraiConfig.java b/src/main/java/wtf/etil/mirai/MiraiConfig.java
|
||||
index 0275dac37ec5864e7b1e0b5c9a3dd9d7aa10a97f..5605a084ff5a9d3c68fd1ad67bd6a0d07d239851 100644
|
||||
index f05dac79dc5a2bfacbe209bb36e13c4f55cac311..0e80ceca8f8188b8d0eb80e130699f6f6302a8fd 100644
|
||||
--- a/src/main/java/wtf/etil/mirai/MiraiConfig.java
|
||||
+++ b/src/main/java/wtf/etil/mirai/MiraiConfig.java
|
||||
@@ -230,6 +230,9 @@ public class MiraiConfig {
|
||||
@@ -225,6 +225,9 @@ public class MiraiConfig {
|
||||
playerFixStuckPortal = getBoolean("player-fix-stuck-in-portal", playerFixStuckPortal);
|
||||
}
|
||||
|
||||
|
||||
@@ -49,10 +49,10 @@ index ed3d78494735ceda14ad0ea23adeadc374f3b35e..88cc2da0e22c6449b260bc70b411926a
|
||||
} else {
|
||||
return InteractionResult.PASS;
|
||||
diff --git a/src/main/java/wtf/etil/mirai/MiraiConfig.java b/src/main/java/wtf/etil/mirai/MiraiConfig.java
|
||||
index 5605a084ff5a9d3c68fd1ad67bd6a0d07d239851..c105a9c58eacf9baf74c67f76fce2b4ef5879e0f 100644
|
||||
index 0e80ceca8f8188b8d0eb80e130699f6f6302a8fd..1f6c73f15b9a289754d6f8dacad9eda5ff3fd752 100644
|
||||
--- a/src/main/java/wtf/etil/mirai/MiraiConfig.java
|
||||
+++ b/src/main/java/wtf/etil/mirai/MiraiConfig.java
|
||||
@@ -235,4 +235,9 @@ public class MiraiConfig {
|
||||
@@ -230,4 +230,9 @@ public class MiraiConfig {
|
||||
entitiesCanUsePortals = getBoolean("entities-can-use-portals", entitiesCanUsePortals);
|
||||
}
|
||||
|
||||
|
||||
@@ -7,7 +7,7 @@ Original code by PurpurMC, licensed under MIT
|
||||
You can find the original code on https://github.com/PurpurMC/Purpur
|
||||
|
||||
diff --git a/src/main/java/net/minecraft/server/level/ServerPlayer.java b/src/main/java/net/minecraft/server/level/ServerPlayer.java
|
||||
index f5087576843b23f2b1537f2062db74a10778d4a4..04ea3dfacf2f6a133bd635326a7b818f8038fccb 100644
|
||||
index ade6a3d0e90e8c82e3e90bd2d12369ccd0760eca..c93c3c3f83a60aa1769607a26148f2eb754cbda6 100644
|
||||
--- a/src/main/java/net/minecraft/server/level/ServerPlayer.java
|
||||
+++ b/src/main/java/net/minecraft/server/level/ServerPlayer.java
|
||||
@@ -1460,6 +1460,7 @@ public class ServerPlayer extends Player {
|
||||
@@ -72,10 +72,10 @@ index 6371176fba41218a209ea59b4cafe5b2d4a685fd..7666bca74f4f68bb4e902ec2eb7c4895
|
||||
public CompoundTag getUpdateTag() {
|
||||
return this.saveWithoutMetadata();
|
||||
diff --git a/src/main/java/wtf/etil/mirai/MiraiConfig.java b/src/main/java/wtf/etil/mirai/MiraiConfig.java
|
||||
index c105a9c58eacf9baf74c67f76fce2b4ef5879e0f..58fedd73583f5c8d1c3d3971d994156f67ae082c 100644
|
||||
index 1f6c73f15b9a289754d6f8dacad9eda5ff3fd752..726c0fdb46619e0e0c57b7b5a65be4270acdd0eb 100644
|
||||
--- a/src/main/java/wtf/etil/mirai/MiraiConfig.java
|
||||
+++ b/src/main/java/wtf/etil/mirai/MiraiConfig.java
|
||||
@@ -236,8 +236,10 @@ public class MiraiConfig {
|
||||
@@ -231,8 +231,10 @@ public class MiraiConfig {
|
||||
}
|
||||
|
||||
public static boolean signRightClickEdit = false;
|
||||
|
||||
@@ -5,10 +5,10 @@ Subject: [PATCH] PaperPR Optimize despawn when no player is on range
|
||||
|
||||
|
||||
diff --git a/src/main/java/net/minecraft/world/entity/Mob.java b/src/main/java/net/minecraft/world/entity/Mob.java
|
||||
index 7e0d653eaf459430459a1c19dc86a787ef12bd63..66eea7efc285b127e9bf46cfeab83be8a869b71b 100644
|
||||
index def1aadb3002441b34bebb24cf727b1b91a688ba..d696bbb44994994af87ee0df5317ca94d20cb74c 100644
|
||||
--- a/src/main/java/net/minecraft/world/entity/Mob.java
|
||||
+++ b/src/main/java/net/minecraft/world/entity/Mob.java
|
||||
@@ -794,9 +794,6 @@ public abstract class Mob extends LivingEntity {
|
||||
@@ -796,9 +796,6 @@ public abstract class Mob extends LivingEntity {
|
||||
} else if (!this.isPersistenceRequired() && !this.requiresCustomPersistence()) {
|
||||
// Paper start - optimise checkDespawn
|
||||
Player entityhuman = this.level.findNearbyPlayer(this, level.paperConfig.hardDespawnDistances.getInt(this.getType().getCategory()) + 1, EntitySelector.affectsSpawning); // Paper
|
||||
@@ -18,7 +18,7 @@ index 7e0d653eaf459430459a1c19dc86a787ef12bd63..66eea7efc285b127e9bf46cfeab83be8
|
||||
// Paper end - optimise checkDespawn
|
||||
|
||||
if (entityhuman != null) {
|
||||
@@ -816,6 +813,8 @@ public abstract class Mob extends LivingEntity {
|
||||
@@ -818,6 +815,8 @@ public abstract class Mob extends LivingEntity {
|
||||
} else if (d0 < (double) l) {
|
||||
this.noActionTime = 0;
|
||||
}
|
||||
|
||||
@@ -2603,7 +2603,7 @@ index 184c70cd2954f4904518c3fee2a377d9c4e81cc3..cdc1ea044d5fa13af48f9b87e5e8a100
|
||||
super(settings, () -> {
|
||||
return BlockEntityType.TRAPPED_CHEST;
|
||||
diff --git a/src/main/java/net/minecraft/world/level/block/TripWireHookBlock.java b/src/main/java/net/minecraft/world/level/block/TripWireHookBlock.java
|
||||
index 02a3e1ced592784b9c66927c76376c7ab413367d..7070dabb09347b98570b7460da712a3b7e621bf7 100644
|
||||
index a4344bf2267112e3c1e31c07c9f6b8eae9666947..09159965c77dea23aa11bf5524ac7bffcebd7cc6 100644
|
||||
--- a/src/main/java/net/minecraft/world/level/block/TripWireHookBlock.java
|
||||
+++ b/src/main/java/net/minecraft/world/level/block/TripWireHookBlock.java
|
||||
@@ -26,8 +26,22 @@ import net.minecraft.world.level.gameevent.GameEvent;
|
||||
@@ -2631,10 +2631,10 @@ index 02a3e1ced592784b9c66927c76376c7ab413367d..7070dabb09347b98570b7460da712a3b
|
||||
public static final DirectionProperty FACING = HorizontalDirectionalBlock.FACING;
|
||||
public static final BooleanProperty POWERED = BlockStateProperties.POWERED;
|
||||
diff --git a/src/main/java/wtf/etil/mirai/MiraiConfig.java b/src/main/java/wtf/etil/mirai/MiraiConfig.java
|
||||
index 58fedd73583f5c8d1c3d3971d994156f67ae082c..b5e0254f043e2d25bcbb98885558c117e2c72c44 100644
|
||||
index 726c0fdb46619e0e0c57b7b5a65be4270acdd0eb..4a6ece60ec3084409577e50486dda9707c23e935 100644
|
||||
--- a/src/main/java/wtf/etil/mirai/MiraiConfig.java
|
||||
+++ b/src/main/java/wtf/etil/mirai/MiraiConfig.java
|
||||
@@ -242,4 +242,9 @@ public class MiraiConfig {
|
||||
@@ -237,4 +237,9 @@ public class MiraiConfig {
|
||||
signAllowColors = getBoolean("sign.allow-colors", signAllowColors);
|
||||
}
|
||||
|
||||
|
||||
@@ -19,10 +19,10 @@ index b03621ebd0a94ab2dceb9006aee43fd5320094e3..7afa4bd52d3816ffd5eba1afeec26abb
|
||||
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);
|
||||
diff --git a/src/main/java/wtf/etil/mirai/MiraiConfig.java b/src/main/java/wtf/etil/mirai/MiraiConfig.java
|
||||
index b5e0254f043e2d25bcbb98885558c117e2c72c44..55a16321d86d7b0c149f799d8f16404455bb30d5 100644
|
||||
index 4a6ece60ec3084409577e50486dda9707c23e935..c13fc3c014c6f558c0582aedb221c9236ad0031d 100644
|
||||
--- a/src/main/java/wtf/etil/mirai/MiraiConfig.java
|
||||
+++ b/src/main/java/wtf/etil/mirai/MiraiConfig.java
|
||||
@@ -247,4 +247,9 @@ public class MiraiConfig {
|
||||
@@ -242,4 +242,9 @@ public class MiraiConfig {
|
||||
alternateCurrent = getBoolean("enable-alternate-current", alternateCurrent);
|
||||
}
|
||||
|
||||
|
||||
@@ -18,10 +18,10 @@ index 2a19037d3ad734d1cf746d02b72926dd702fd23a..0297e176e2e4b29b4aeeaee30d43653b
|
||||
metricsStarted = true;
|
||||
}
|
||||
diff --git a/src/main/java/wtf/etil/mirai/MiraiConfig.java b/src/main/java/wtf/etil/mirai/MiraiConfig.java
|
||||
index 55a16321d86d7b0c149f799d8f16404455bb30d5..a41334314a731e8ec6dc3efa77aa564446d26ef8 100644
|
||||
index c13fc3c014c6f558c0582aedb221c9236ad0031d..a8d9ef7a7fcdfcab468594664d352702ee25406e 100644
|
||||
--- a/src/main/java/wtf/etil/mirai/MiraiConfig.java
|
||||
+++ b/src/main/java/wtf/etil/mirai/MiraiConfig.java
|
||||
@@ -252,4 +252,9 @@ public class MiraiConfig {
|
||||
@@ -247,4 +247,9 @@ public class MiraiConfig {
|
||||
shouldTickEnchantingTables = getBoolean("tick-enchanting-tables", shouldTickEnchantingTables);
|
||||
}
|
||||
|
||||
|
||||
@@ -8,10 +8,10 @@ You can find the original code on https://github.com/fxmorin/carpet-fixes
|
||||
|
||||
diff --git a/src/main/java/carpetfixes/helpers/FastMath.java b/src/main/java/carpetfixes/helpers/FastMath.java
|
||||
new file mode 100644
|
||||
index 0000000000000000000000000000000000000000..265bffa41a748c9d5684973af7309ed7fa37064c
|
||||
index 0000000000000000000000000000000000000000..da81a142d2b072f846f9905a0d5b8e293763284a
|
||||
--- /dev/null
|
||||
+++ b/src/main/java/carpetfixes/helpers/FastMath.java
|
||||
@@ -0,0 +1,20 @@
|
||||
@@ -0,0 +1,28 @@
|
||||
+package carpetfixes.helpers;
|
||||
+
|
||||
+public class FastMath {
|
||||
@@ -21,7 +21,11 @@ index 0000000000000000000000000000000000000000..265bffa41a748c9d5684973af7309ed7
|
||||
+ * ~1.25x faster than {@link Math#round(float)}
|
||||
+ */
|
||||
+ public static int round(float a) {
|
||||
+ return a > 0F ? (int)(a + .5F) : (int)(a - .5F);
|
||||
+ if (wtf.etil.mirai.MiraiConfig.riskyMathRoundOpt) {
|
||||
+ return a > 0F ? (int)(a + .5F) : (int)(a - .5F);
|
||||
+ } else {
|
||||
+ return Math.round(a);
|
||||
+ }
|
||||
+ }
|
||||
+
|
||||
+ /**
|
||||
@@ -29,366 +33,217 @@ index 0000000000000000000000000000000000000000..265bffa41a748c9d5684973af7309ed7
|
||||
+ * ~1.28x faster than {@link Math#round(double)}
|
||||
+ */
|
||||
+ public static long round(double a) {
|
||||
+ return a > 0D ? (long)(a + .5D) : (long)(a - .5D);
|
||||
+ if (wtf.etil.mirai.MiraiConfig.riskyMathRoundOpt) {
|
||||
+ return a > 0D ? (long)(a + .5D) : (long)(a - .5D);
|
||||
+ } else {
|
||||
+ return Math.round(a);
|
||||
+ }
|
||||
+ }
|
||||
+}
|
||||
\ No newline at end of file
|
||||
diff --git a/src/main/java/com/destroystokyo/paper/PaperCommand.java b/src/main/java/com/destroystokyo/paper/PaperCommand.java
|
||||
index 7764b1f86aca33dc227bf4357c20839b8820eb67..3f8860e456bd8b841dbe5f624dace4f7d48a235b 100644
|
||||
index 7764b1f86aca33dc227bf4357c20839b8820eb67..2e141e7b85ef54a084698b5a920b85212271fce8 100644
|
||||
--- a/src/main/java/com/destroystokyo/paper/PaperCommand.java
|
||||
+++ b/src/main/java/com/destroystokyo/paper/PaperCommand.java
|
||||
@@ -723,14 +723,30 @@ public class PaperCommand extends Command {
|
||||
lightengine.relight(chunks,
|
||||
(ChunkPos chunkPos) -> {
|
||||
@@ -725,12 +725,12 @@ public class PaperCommand extends Command {
|
||||
++relitChunks[0];
|
||||
- sender.getBukkitEntity().sendMessage(
|
||||
- ChatColor.BLUE + "Relit chunk " + ChatColor.DARK_AQUA + chunkPos + ChatColor.BLUE +
|
||||
sender.getBukkitEntity().sendMessage(
|
||||
ChatColor.BLUE + "Relit chunk " + ChatColor.DARK_AQUA + chunkPos + ChatColor.BLUE +
|
||||
- ", progress: " + ChatColor.DARK_AQUA + (int)(Math.round(100.0 * (double)(relitChunks[0])/(double)pending[0])) + "%"
|
||||
- );
|
||||
+ // Mirai start
|
||||
+ if (wtf.etil.mirai.MiraiConfig.riskyMathRoundOpt) {
|
||||
+ sender.getBukkitEntity().sendMessage(
|
||||
+ ChatColor.BLUE + "Relit chunk " + ChatColor.DARK_AQUA + chunkPos + ChatColor.BLUE +
|
||||
+ ", progress: " + ChatColor.DARK_AQUA + (int)(carpetfixes.helpers.FastMath.round(100.0 * (double)(relitChunks[0])/(double)pending[0])) + "%"
|
||||
+ );
|
||||
+ } else {
|
||||
+ sender.getBukkitEntity().sendMessage(
|
||||
+ ChatColor.BLUE + "Relit chunk " + ChatColor.DARK_AQUA + chunkPos + ChatColor.BLUE +
|
||||
+ ", progress: " + ChatColor.DARK_AQUA + (int)(Math.round(100.0 * (double)(relitChunks[0])/(double)pending[0])) + "%"
|
||||
+ );
|
||||
+ }
|
||||
+ // Mirai end
|
||||
+ ", progress: " + ChatColor.DARK_AQUA + (int)(carpetfixes.helpers.FastMath.round(100.0 * (double)(relitChunks[0])/(double)pending[0])) + "%"
|
||||
);
|
||||
},
|
||||
(int totalRelit) -> {
|
||||
final long end = System.nanoTime();
|
||||
- final long diff = Math.round(1.0e-6*(end - start));
|
||||
+ // Mirai start
|
||||
+ final long diff;
|
||||
+ if (wtf.etil.mirai.MiraiConfig.riskyMathRoundOpt) {
|
||||
+ diff = carpetfixes.helpers.FastMath.round(1.0e-6*(end - start));
|
||||
+ } else {
|
||||
+ diff = Math.round(1.0e-6*(end - start));
|
||||
+ }
|
||||
+ // Mirai end
|
||||
+ final long diff = carpetfixes.helpers.FastMath.round(1.0e-6*(end - start));
|
||||
sender.getBukkitEntity().sendMessage(
|
||||
ChatColor.BLUE + "Relit " + ChatColor.DARK_AQUA + totalRelit + ChatColor.BLUE + " chunks. Took " +
|
||||
ChatColor.DARK_AQUA + diff + "ms"
|
||||
diff --git a/src/main/java/com/destroystokyo/paper/gui/RAMDetails.java b/src/main/java/com/destroystokyo/paper/gui/RAMDetails.java
|
||||
index f9251183df72ddc56662fd3f02acf21641a2200c..d87ba2e05870ad9ebb7dd8374b7206bdb4c4e4cb 100644
|
||||
index f9251183df72ddc56662fd3f02acf21641a2200c..ea1bad145e529ac36bf335cf4d5339b2d88b282f 100644
|
||||
--- a/src/main/java/com/destroystokyo/paper/gui/RAMDetails.java
|
||||
+++ b/src/main/java/com/destroystokyo/paper/gui/RAMDetails.java
|
||||
@@ -81,6 +81,12 @@ public class RAMDetails extends JList<String> {
|
||||
@@ -81,6 +81,6 @@ public class RAMDetails extends JList<String> {
|
||||
}
|
||||
|
||||
private static String format(double tps) {
|
||||
- return ( ( tps > 21.0 ) ? "*" : "" ) + Math.min( Math.round( tps * 100.0 ) / 100.0, 20.0 );
|
||||
+ // Mirai start
|
||||
+ if (wtf.etil.mirai.MiraiConfig.riskyMathRoundOpt) {
|
||||
+ return ( ( tps > 21.0 ) ? "*" : "" ) + Math.min( carpetfixes.helpers.FastMath.round( tps * 100.0 ) / 100.0, 20.0 );
|
||||
+ } else {
|
||||
+ return ( ( tps > 21.0 ) ? "*" : "" ) + Math.min( Math.round( tps * 100.0 ) / 100.0, 20.0 );
|
||||
+ }
|
||||
+ // Mirai end
|
||||
+ return ( ( tps > 21.0 ) ? "*" : "" ) + Math.min( carpetfixes.helpers.FastMath.round( tps * 100.0 ) / 100.0, 20.0 );
|
||||
}
|
||||
}
|
||||
diff --git a/src/main/java/com/destroystokyo/paper/gui/RAMGraph.java b/src/main/java/com/destroystokyo/paper/gui/RAMGraph.java
|
||||
index c3e54da4ab6440811aab2f9dd1e218802ac13285..abaee3564a6187dd3ddb5fe63ae4689469474ae7 100644
|
||||
index c3e54da4ab6440811aab2f9dd1e218802ac13285..2a38ea32f2d4a01be556fdf11254d5910c54f997 100644
|
||||
--- a/src/main/java/com/destroystokyo/paper/gui/RAMGraph.java
|
||||
+++ b/src/main/java/com/destroystokyo/paper/gui/RAMGraph.java
|
||||
@@ -127,9 +127,17 @@ public class RAMGraph extends JComponent {
|
||||
graphics.drawOval(m.x - 2, 100 - used - 2, 5, 5);
|
||||
@@ -128,7 +128,7 @@ public class RAMGraph extends JComponent {
|
||||
graphics.setColor(data.getLineColor());
|
||||
graphics.fillOval(m.x - 2, 100 - used - 2, 5, 5);
|
||||
- setToolTipText(String.format("<html><body>Used: %s mb (%s%%)<br/>%s</body></html>",
|
||||
setToolTipText(String.format("<html><body>Used: %s mb (%s%%)<br/>%s</body></html>",
|
||||
- Math.round(data.getUsedMem() / 1024F / 1024F),
|
||||
- used, getTime(m.x)));
|
||||
+ // Mirai start
|
||||
+ if (wtf.etil.mirai.MiraiConfig.riskyMathRoundOpt) {
|
||||
+ setToolTipText(String.format("<html><body>Used: %s mb (%s%%)<br/>%s</body></html>",
|
||||
+ carpetfixes.helpers.FastMath.round(data.getUsedMem() / 1024F / 1024F),
|
||||
+ used, getTime(m.x)));
|
||||
+ } else {
|
||||
+ setToolTipText(String.format("<html><body>Used: %s mb (%s%%)<br/>%s</body></html>",
|
||||
+ Math.round(data.getUsedMem() / 1024F / 1024F),
|
||||
+ used, getTime(m.x)));
|
||||
+ }
|
||||
+ // Mirai end
|
||||
+ carpetfixes.helpers.FastMath.round(data.getUsedMem() / 1024F / 1024F),
|
||||
used, getTime(m.x)));
|
||||
}
|
||||
}
|
||||
|
||||
diff --git a/src/main/java/gg/pufferfish/pufferfish/flare/collectors/TPSCollector.java b/src/main/java/gg/pufferfish/pufferfish/flare/collectors/TPSCollector.java
|
||||
index 40447d00aefb5ffedb8a2ee87155a04088f0649f..c087b864ca193eb5ecf232b63da30349cf08d61d 100644
|
||||
index 40447d00aefb5ffedb8a2ee87155a04088f0649f..31cc0a29e89e79f616b3ee329a5528961edaa2de 100644
|
||||
--- a/src/main/java/gg/pufferfish/pufferfish/flare/collectors/TPSCollector.java
|
||||
+++ b/src/main/java/gg/pufferfish/pufferfish/flare/collectors/TPSCollector.java
|
||||
@@ -25,7 +25,14 @@ public class TPSCollector extends LiveCollector {
|
||||
@@ -25,7 +25,7 @@ public class TPSCollector extends LiveCollector {
|
||||
long[] times = MinecraftServer.getServer().tickTimes5s.getTimes();
|
||||
double mspt = ((double) Arrays.stream(times).sum() / (double) times.length) * 1.0E-6D;
|
||||
|
||||
- this.report(TPS, Math.min(20D, Math.round(Bukkit.getServer().getTPS()[0] * 100d) / 100d));
|
||||
- this.report(MSPT, (double) Math.round(mspt * 100d) / 100d);
|
||||
+ // Mirai start
|
||||
+ if (wtf.etil.mirai.MiraiConfig.riskyMathRoundOpt) {
|
||||
+ this.report(TPS, Math.min(20D, carpetfixes.helpers.FastMath.round(Bukkit.getServer().getTPS()[0] * 100d) / 100d));
|
||||
+ this.report(MSPT, (double) carpetfixes.helpers.FastMath.round(mspt * 100d) / 100d);
|
||||
+ } else {
|
||||
+ this.report(TPS, Math.min(20D, Math.round(Bukkit.getServer().getTPS()[0] * 100d) / 100d));
|
||||
+ this.report(MSPT, (double) Math.round(mspt * 100d) / 100d);
|
||||
+ }
|
||||
+ // Mirai end
|
||||
+ this.report(TPS, Math.min(20D, carpetfixes.helpers.FastMath.round(Bukkit.getServer().getTPS()[0] * 100d) / 100d));
|
||||
+ this.report(MSPT, (double) carpetfixes.helpers.FastMath.round(mspt * 100d) / 100d);
|
||||
}
|
||||
}
|
||||
diff --git a/src/main/java/net/minecraft/server/MinecraftServer.java b/src/main/java/net/minecraft/server/MinecraftServer.java
|
||||
index 0f69380a5c6d4a2ac1aed2185122ec11c2ed4720..cbed49b6bdc251388579cbdfe2d1c911283c3212 100644
|
||||
index 744b39a86ab02350e36b16036cf3f82d0be1dd86..4f8c0c69a7492ba183f436d4062df177d9c7a9ec 100644
|
||||
--- a/src/main/java/net/minecraft/server/MinecraftServer.java
|
||||
+++ b/src/main/java/net/minecraft/server/MinecraftServer.java
|
||||
@@ -393,7 +393,14 @@ public abstract class MinecraftServer extends ReentrantBlockableEventLoop<Runnab
|
||||
@@ -393,7 +393,7 @@ public abstract class MinecraftServer extends ReentrantBlockableEventLoop<Runnab
|
||||
}
|
||||
|
||||
double overuseCount = (double)overuse/(double)MAX_CHUNK_EXEC_TIME;
|
||||
- long extraSleep = (long)Math.round(overuseCount*CHUNK_TASK_QUEUE_BACKOFF_MIN_TIME);
|
||||
+ // Mirai start
|
||||
+ long extraSleep;
|
||||
+ if (wtf.etil.mirai.MiraiConfig.riskyMathRoundOpt) {
|
||||
+ extraSleep = (long)carpetfixes.helpers.FastMath.round(overuseCount*CHUNK_TASK_QUEUE_BACKOFF_MIN_TIME);
|
||||
+ } else {
|
||||
+ extraSleep = (long)Math.round(overuseCount*CHUNK_TASK_QUEUE_BACKOFF_MIN_TIME);
|
||||
+ }
|
||||
+ // Mirai end
|
||||
+ long extraSleep = (long)carpetfixes.helpers.FastMath.round(overuseCount*CHUNK_TASK_QUEUE_BACKOFF_MIN_TIME);
|
||||
|
||||
lastMidTickExecute = currTime + extraSleep;
|
||||
return;
|
||||
diff --git a/src/main/java/net/minecraft/server/gui/StatsComponent.java b/src/main/java/net/minecraft/server/gui/StatsComponent.java
|
||||
index 88f10d729aa1e0a01790521821d691a0ecd373a2..eb90e203ce2998edb2918170d4df1fab3f729a8e 100644
|
||||
index 88f10d729aa1e0a01790521821d691a0ecd373a2..df2c8dffd626eab0e03b1b62940a52fa83f6edaf 100644
|
||||
--- a/src/main/java/net/minecraft/server/gui/StatsComponent.java
|
||||
+++ b/src/main/java/net/minecraft/server/gui/StatsComponent.java
|
||||
@@ -88,7 +88,13 @@ public class StatsComponent extends JComponent {
|
||||
@@ -88,7 +88,7 @@ public class StatsComponent extends JComponent {
|
||||
|
||||
// Paper - start Add tps entry
|
||||
private static String format(double tps) {
|
||||
- return (( tps > 21.0 ) ? "*" : "") + Math.min(Math.round(tps * 100.0) / 100.0, 20.0); // only print * at 21, we commonly peak to 20.02 as the tick sleep is not accurate enough, stop the noise
|
||||
+ // Mirai start
|
||||
+ if (wtf.etil.mirai.MiraiConfig.riskyMathRoundOpt) {
|
||||
+ return (( tps > 21.0 ) ? "*" : "") + Math.min(carpetfixes.helpers.FastMath.round(tps * 100.0) / 100.0, 20.0); // only print * at 21, we commonly peak to 20.02 as the tick sleep is not accurate enough, stop the noise
|
||||
+ } else {
|
||||
+ return (( tps > 21.0 ) ? "*" : "") + Math.min(Math.round(tps * 100.0) / 100.0, 20.0); // only print * at 21, we commonly peak to 20.02 as the tick sleep is not accurate enough, stop the noise
|
||||
+ }
|
||||
+ // Mirai end
|
||||
+ return (( tps > 21.0 ) ? "*" : "") + Math.min(carpetfixes.helpers.FastMath.round(tps * 100.0) / 100.0, 20.0); // only print * at 21, we commonly peak to 20.02 as the tick sleep is not accurate enough, stop the noise
|
||||
}
|
||||
// Paper end
|
||||
}
|
||||
diff --git a/src/main/java/net/minecraft/world/entity/LivingEntity.java b/src/main/java/net/minecraft/world/entity/LivingEntity.java
|
||||
index fcf6606d7fde0a9f93a2bd1a8e20f8f6ddb9374b..9f33aeeedd03746cdc26709cd3593f9e4078aad8 100644
|
||||
index fcf6606d7fde0a9f93a2bd1a8e20f8f6ddb9374b..9373e4ce1061d5cb3a2d22272671c668614dd4a8 100644
|
||||
--- a/src/main/java/net/minecraft/world/entity/LivingEntity.java
|
||||
+++ b/src/main/java/net/minecraft/world/entity/LivingEntity.java
|
||||
@@ -1473,7 +1473,13 @@ public abstract class LivingEntity extends Entity {
|
||||
@@ -1473,7 +1473,7 @@ public abstract class LivingEntity extends Entity {
|
||||
if (this instanceof ServerPlayer) {
|
||||
CriteriaTriggers.ENTITY_HURT_PLAYER.trigger((ServerPlayer) this, source, f1, amount, flag);
|
||||
if (f2 > 0.0F && f2 < 3.4028235E37F) {
|
||||
- ((ServerPlayer) this).awardStat(Stats.DAMAGE_BLOCKED_BY_SHIELD, Math.round(f2 * 10.0F));
|
||||
+ // Mirai start
|
||||
+ if (wtf.etil.mirai.MiraiConfig.riskyMathRoundOpt) {
|
||||
+ ((ServerPlayer) this).awardStat(Stats.DAMAGE_BLOCKED_BY_SHIELD, carpetfixes.helpers.FastMath.round(f2 * 10.0F));
|
||||
+ } else {
|
||||
+ ((ServerPlayer) this).awardStat(Stats.DAMAGE_BLOCKED_BY_SHIELD, Math.round(f2 * 10.0F));
|
||||
+ }
|
||||
+ // Mirai end
|
||||
+ ((ServerPlayer) this).awardStat(Stats.DAMAGE_BLOCKED_BY_SHIELD, carpetfixes.helpers.FastMath.round(f2 * 10.0F));
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1985,11 +1991,21 @@ public abstract class LivingEntity extends Entity {
|
||||
float f3 = f2 - amount;
|
||||
@@ -1986,9 +1986,9 @@ public abstract class LivingEntity extends Entity {
|
||||
|
||||
if (f3 > 0.0F && f3 < 3.4028235E37F) {
|
||||
- if (this instanceof ServerPlayer) {
|
||||
if (this instanceof ServerPlayer) {
|
||||
- ((ServerPlayer) this).awardStat(Stats.DAMAGE_RESISTED, Math.round(f3 * 10.0F));
|
||||
- } else if (source.getEntity() instanceof ServerPlayer) {
|
||||
+ ((ServerPlayer) this).awardStat(Stats.DAMAGE_RESISTED, carpetfixes.helpers.FastMath.round(f3 * 10.0F));
|
||||
} else if (source.getEntity() instanceof ServerPlayer) {
|
||||
- ((ServerPlayer) source.getEntity()).awardStat(Stats.DAMAGE_DEALT_RESISTED, Math.round(f3 * 10.0F));
|
||||
+ // Mirai start
|
||||
+ if (wtf.etil.mirai.MiraiConfig.riskyMathRoundOpt) {
|
||||
+ if (this instanceof ServerPlayer) {
|
||||
+ ((ServerPlayer) this).awardStat(Stats.DAMAGE_RESISTED, carpetfixes.helpers.FastMath.round(f3 * 10.0F));
|
||||
+ } else if (source.getEntity() instanceof ServerPlayer) {
|
||||
+ ((ServerPlayer) source.getEntity()).awardStat(Stats.DAMAGE_DEALT_RESISTED, carpetfixes.helpers.FastMath.round(f3 * 10.0F));
|
||||
+ }
|
||||
+ } else {
|
||||
+ if (this instanceof ServerPlayer) {
|
||||
+ ((ServerPlayer) this).awardStat(Stats.DAMAGE_RESISTED, Math.round(f3 * 10.0F));
|
||||
+ } else if (source.getEntity() instanceof ServerPlayer) {
|
||||
+ ((ServerPlayer) source.getEntity()).awardStat(Stats.DAMAGE_DEALT_RESISTED, Math.round(f3 * 10.0F));
|
||||
+ }
|
||||
+ ((ServerPlayer) source.getEntity()).awardStat(Stats.DAMAGE_DEALT_RESISTED, carpetfixes.helpers.FastMath.round(f3 * 10.0F));
|
||||
}
|
||||
+ // Mirai end
|
||||
}
|
||||
}
|
||||
|
||||
@@ -2097,11 +2113,21 @@ public abstract class LivingEntity extends Entity {
|
||||
if (event.getDamage(DamageModifier.RESISTANCE) < 0) {
|
||||
@@ -2098,9 +2098,9 @@ public abstract class LivingEntity extends Entity {
|
||||
float f3 = (float) -event.getDamage(DamageModifier.RESISTANCE);
|
||||
if (f3 > 0.0F && f3 < 3.4028235E37F) {
|
||||
- if (this instanceof ServerPlayer) {
|
||||
if (this instanceof ServerPlayer) {
|
||||
- ((ServerPlayer) this).awardStat(Stats.DAMAGE_RESISTED, Math.round(f3 * 10.0F));
|
||||
- } else if (damagesource.getEntity() instanceof ServerPlayer) {
|
||||
+ ((ServerPlayer) this).awardStat(Stats.DAMAGE_RESISTED, carpetfixes.helpers.FastMath.round(f3 * 10.0F));
|
||||
} else if (damagesource.getEntity() instanceof ServerPlayer) {
|
||||
- ((ServerPlayer) damagesource.getEntity()).awardStat(Stats.DAMAGE_DEALT_RESISTED, Math.round(f3 * 10.0F));
|
||||
+ // Mirai start
|
||||
+ if (wtf.etil.mirai.MiraiConfig.riskyMathRoundOpt) {
|
||||
+ if (this instanceof ServerPlayer) {
|
||||
+ ((ServerPlayer) this).awardStat(Stats.DAMAGE_RESISTED, carpetfixes.helpers.FastMath.round(f3 * 10.0F));
|
||||
+ } else if (damagesource.getEntity() instanceof ServerPlayer) {
|
||||
+ ((ServerPlayer) damagesource.getEntity()).awardStat(Stats.DAMAGE_DEALT_RESISTED, carpetfixes.helpers.FastMath.round(f3 * 10.0F));
|
||||
+ }
|
||||
+ } else {
|
||||
+ if (this instanceof ServerPlayer) {
|
||||
+ ((ServerPlayer) this).awardStat(Stats.DAMAGE_RESISTED, Math.round(f3 * 10.0F));
|
||||
+ } else if (damagesource.getEntity() instanceof ServerPlayer) {
|
||||
+ ((ServerPlayer) damagesource.getEntity()).awardStat(Stats.DAMAGE_DEALT_RESISTED, Math.round(f3 * 10.0F));
|
||||
+ }
|
||||
+ ((ServerPlayer) damagesource.getEntity()).awardStat(Stats.DAMAGE_DEALT_RESISTED, carpetfixes.helpers.FastMath.round(f3 * 10.0F));
|
||||
}
|
||||
+ // Mirai end
|
||||
}
|
||||
}
|
||||
|
||||
@@ -2132,10 +2158,22 @@ public abstract class LivingEntity extends Entity {
|
||||
@@ -2132,10 +2132,10 @@ public abstract class LivingEntity extends Entity {
|
||||
float f2 = absorptionModifier;
|
||||
|
||||
if (f2 > 0.0F && f2 < 3.4028235E37F && this instanceof net.minecraft.world.entity.player.Player) {
|
||||
- ((net.minecraft.world.entity.player.Player) this).awardStat(Stats.DAMAGE_ABSORBED, Math.round(f2 * 10.0F));
|
||||
+ // Mirai start
|
||||
+ if (wtf.etil.mirai.MiraiConfig.riskyMathRoundOpt) {
|
||||
+ ((net.minecraft.world.entity.player.Player) this).awardStat(Stats.DAMAGE_ABSORBED, carpetfixes.helpers.FastMath.round(f2 * 10.0F));
|
||||
+ } else {
|
||||
+ ((net.minecraft.world.entity.player.Player) this).awardStat(Stats.DAMAGE_ABSORBED, Math.round(f2 * 10.0F));
|
||||
+ }
|
||||
+ // Mirai end
|
||||
+ ((net.minecraft.world.entity.player.Player) this).awardStat(Stats.DAMAGE_ABSORBED, carpetfixes.helpers.FastMath.round(f2 * 10.0F));
|
||||
}
|
||||
if (f2 > 0.0F && f2 < 3.4028235E37F && damagesource.getEntity() instanceof ServerPlayer) {
|
||||
- ((ServerPlayer) damagesource.getEntity()).awardStat(Stats.DAMAGE_DEALT_ABSORBED, Math.round(f2 * 10.0F));
|
||||
+ // Mirai start
|
||||
+ if (wtf.etil.mirai.MiraiConfig.riskyMathRoundOpt) {
|
||||
+ ((ServerPlayer) damagesource.getEntity()).awardStat(Stats.DAMAGE_DEALT_ABSORBED, carpetfixes.helpers.FastMath.round(f2 * 10.0F));
|
||||
+ } else {
|
||||
+ ((ServerPlayer) damagesource.getEntity()).awardStat(Stats.DAMAGE_DEALT_ABSORBED, Math.round(f2 * 10.0F));
|
||||
+ }
|
||||
+ // Mirai end
|
||||
+ ((ServerPlayer) damagesource.getEntity()).awardStat(Stats.DAMAGE_DEALT_ABSORBED, carpetfixes.helpers.FastMath.round(f2 * 10.0F));
|
||||
}
|
||||
|
||||
if (f > 0 || !human) {
|
||||
@@ -2143,7 +2181,13 @@ public abstract class LivingEntity extends Entity {
|
||||
@@ -2143,7 +2143,7 @@ public abstract class LivingEntity extends Entity {
|
||||
// PAIL: Be sure to drag all this code from the EntityHuman subclass each update.
|
||||
((net.minecraft.world.entity.player.Player) this).causeFoodExhaustion(damagesource.getFoodExhaustion(), org.bukkit.event.entity.EntityExhaustionEvent.ExhaustionReason.DAMAGED); // CraftBukkit - EntityExhaustionEvent
|
||||
if (f < 3.4028235E37F) {
|
||||
- ((net.minecraft.world.entity.player.Player) this).awardStat(Stats.DAMAGE_TAKEN, Math.round(f * 10.0F));
|
||||
+ // Mirai start
|
||||
+ if (wtf.etil.mirai.MiraiConfig.riskyMathRoundOpt) {
|
||||
+ ((net.minecraft.world.entity.player.Player) this).awardStat(Stats.DAMAGE_TAKEN, carpetfixes.helpers.FastMath.round(f * 10.0F));
|
||||
+ } else {
|
||||
+ ((net.minecraft.world.entity.player.Player) this).awardStat(Stats.DAMAGE_TAKEN, Math.round(f * 10.0F));
|
||||
+ }
|
||||
+ // Mirai end
|
||||
+ ((net.minecraft.world.entity.player.Player) this).awardStat(Stats.DAMAGE_TAKEN, carpetfixes.helpers.FastMath.round(f * 10.0F));
|
||||
}
|
||||
}
|
||||
// CraftBukkit end
|
||||
@@ -2165,7 +2209,13 @@ public abstract class LivingEntity extends Entity {
|
||||
@@ -2165,7 +2165,7 @@ public abstract class LivingEntity extends Entity {
|
||||
CriteriaTriggers.ENTITY_HURT_PLAYER.trigger((ServerPlayer) this, damagesource, f, originalDamage, true);
|
||||
f2 = (float) -event.getDamage(DamageModifier.BLOCKING);
|
||||
if (f2 > 0.0F && f2 < 3.4028235E37F) {
|
||||
- ((ServerPlayer) this).awardStat(Stats.DAMAGE_BLOCKED_BY_SHIELD, Math.round(originalDamage * 10.0F));
|
||||
+ // Mirai start
|
||||
+ if (wtf.etil.mirai.MiraiConfig.riskyMathRoundOpt) {
|
||||
+ ((ServerPlayer) this).awardStat(Stats.DAMAGE_BLOCKED_BY_SHIELD, carpetfixes.helpers.FastMath.round(originalDamage * 10.0F));
|
||||
+ } else {
|
||||
+ ((ServerPlayer) this).awardStat(Stats.DAMAGE_BLOCKED_BY_SHIELD, Math.round(originalDamage * 10.0F));
|
||||
+ }
|
||||
+ // Mirai end
|
||||
+ ((ServerPlayer) this).awardStat(Stats.DAMAGE_BLOCKED_BY_SHIELD, carpetfixes.helpers.FastMath.round(originalDamage * 10.0F));
|
||||
}
|
||||
}
|
||||
|
||||
diff --git a/src/main/java/net/minecraft/world/entity/player/Player.java b/src/main/java/net/minecraft/world/entity/player/Player.java
|
||||
index b871d89d16e0bb08cc8ce87e74ced974734be418..fda2f91ef20542cc11037c9bf74f71bd17061d49 100644
|
||||
index b871d89d16e0bb08cc8ce87e74ced974734be418..87689c468b8e4d2498584fca90738f82fa46d78a 100644
|
||||
--- a/src/main/java/net/minecraft/world/entity/player/Player.java
|
||||
+++ b/src/main/java/net/minecraft/world/entity/player/Player.java
|
||||
@@ -1026,7 +1026,13 @@ public abstract class Player extends LivingEntity {
|
||||
@@ -1026,7 +1026,7 @@ public abstract class Player extends LivingEntity {
|
||||
float f2 = f1 - f;
|
||||
|
||||
if (f2 > 0.0F && f2 < 3.4028235E37F) {
|
||||
- this.awardStat(Stats.DAMAGE_ABSORBED, Math.round(f2 * 10.0F));
|
||||
+ // Mirai start
|
||||
+ if (wtf.etil.mirai.MiraiConfig.riskyMathRoundOpt) {
|
||||
+ this.awardStat(Stats.DAMAGE_ABSORBED, carpetfixes.helpers.FastMath.round(f2 * 10.0F));
|
||||
+ } else {
|
||||
+ this.awardStat(Stats.DAMAGE_ABSORBED, Math.round(f2 * 10.0F));
|
||||
+ }
|
||||
+ // Mirai end
|
||||
+ this.awardStat(Stats.DAMAGE_ABSORBED, carpetfixes.helpers.FastMath.round(f2 * 10.0F));
|
||||
}
|
||||
|
||||
if (f != 0.0F) {
|
||||
@@ -1036,7 +1042,13 @@ public abstract class Player extends LivingEntity {
|
||||
@@ -1036,7 +1036,7 @@ public abstract class Player extends LivingEntity {
|
||||
this.setHealth(this.getHealth() - f);
|
||||
this.getCombatTracker().recordDamage(damagesource, f3, f);
|
||||
if (f < 3.4028235E37F) {
|
||||
- this.awardStat(Stats.DAMAGE_TAKEN, Math.round(f * 10.0F));
|
||||
+ // Mirai start
|
||||
+ if (wtf.etil.mirai.MiraiConfig.riskyMathRoundOpt) {
|
||||
+ this.awardStat(Stats.DAMAGE_TAKEN, carpetfixes.helpers.FastMath.round(f * 10.0F));
|
||||
+ } else {
|
||||
+ this.awardStat(Stats.DAMAGE_TAKEN, Math.round(f * 10.0F));
|
||||
+ }
|
||||
+ // Mirai end
|
||||
+ this.awardStat(Stats.DAMAGE_TAKEN, carpetfixes.helpers.FastMath.round(f * 10.0F));
|
||||
}
|
||||
|
||||
}
|
||||
@@ -1362,7 +1374,13 @@ public abstract class Player extends LivingEntity {
|
||||
@@ -1362,7 +1362,7 @@ public abstract class Player extends LivingEntity {
|
||||
if (target instanceof LivingEntity) {
|
||||
float f5 = f3 - ((LivingEntity) target).getHealth();
|
||||
|
||||
- this.awardStat(Stats.DAMAGE_DEALT, Math.round(f5 * 10.0F));
|
||||
+ // Mirai start
|
||||
+ if (wtf.etil.mirai.MiraiConfig.riskyMathRoundOpt) {
|
||||
+ this.awardStat(Stats.DAMAGE_DEALT, carpetfixes.helpers.FastMath.round(f5 * 10.0F));
|
||||
+ } else {
|
||||
+ this.awardStat(Stats.DAMAGE_DEALT, Math.round(f5 * 10.0F));
|
||||
+ }
|
||||
+ // Mirai end
|
||||
+ this.awardStat(Stats.DAMAGE_DEALT, carpetfixes.helpers.FastMath.round(f5 * 10.0F));
|
||||
if (j > 0) {
|
||||
// CraftBukkit start - Call a combust event when somebody hits with a fire enchanted item
|
||||
EntityCombustByEntityEvent combustEvent = new EntityCombustByEntityEvent(this.getBukkitEntity(), target.getBukkitEntity(), j * 4);
|
||||
@@ -1626,29 +1644,59 @@ public abstract class Player extends LivingEntity {
|
||||
@@ -1626,29 +1626,29 @@ public abstract class Player extends LivingEntity {
|
||||
int i;
|
||||
|
||||
if (this.isSwimming()) {
|
||||
- i = Math.round((float) Math.sqrt(dx * dx + dy * dy + dz * dz) * 100.0F);
|
||||
+ // Mirai start
|
||||
+ if (wtf.etil.mirai.MiraiConfig.riskyMathRoundOpt) {
|
||||
+ i = carpetfixes.helpers.FastMath.round((float) Math.sqrt(dx * dx + dy * dy + dz * dz) * 100.0F);
|
||||
+ } else {
|
||||
+ i = Math.round((float) Math.sqrt(dx * dx + dy * dy + dz * dz) * 100.0F);
|
||||
+ }
|
||||
+ // Mirai end
|
||||
+ i = carpetfixes.helpers.FastMath.round((float) Math.sqrt(dx * dx + dy * dy + dz * dz) * 100.0F);
|
||||
if (i > 0) {
|
||||
this.awardStat(Stats.SWIM_ONE_CM, i);
|
||||
this.causeFoodExhaustion(level.spigotConfig.swimMultiplier * (float) i * 0.01F, EntityExhaustionEvent.ExhaustionReason.SWIM); // CraftBukkit - EntityExhaustionEvent // Spigot
|
||||
}
|
||||
} else if (this.isEyeInFluid(FluidTags.WATER)) {
|
||||
- i = Math.round((float) Math.sqrt(dx * dx + dy * dy + dz * dz) * 100.0F);
|
||||
+ // Mirai start
|
||||
+ if (wtf.etil.mirai.MiraiConfig.riskyMathRoundOpt) {
|
||||
+ i = carpetfixes.helpers.FastMath.round((float) Math.sqrt(dx * dx + dy * dy + dz * dz) * 100.0F);
|
||||
+ } else {
|
||||
+ i = Math.round((float) Math.sqrt(dx * dx + dy * dy + dz * dz) * 100.0F);
|
||||
+ }
|
||||
+ // Mirai end
|
||||
+ i = carpetfixes.helpers.FastMath.round((float) Math.sqrt(dx * dx + dy * dy + dz * dz) * 100.0F);
|
||||
if (i > 0) {
|
||||
this.awardStat(Stats.WALK_UNDER_WATER_ONE_CM, i);
|
||||
this.causeFoodExhaustion(level.spigotConfig.swimMultiplier * (float) i * 0.01F, EntityExhaustionEvent.ExhaustionReason.WALK_UNDERWATER); // CraftBukkit - EntityExhaustionEvent // Spigot
|
||||
}
|
||||
} else if (this.isInWater()) {
|
||||
- i = Math.round((float) Math.sqrt(dx * dx + dz * dz) * 100.0F);
|
||||
+ // Mirai start
|
||||
+ if (wtf.etil.mirai.MiraiConfig.riskyMathRoundOpt) {
|
||||
+ i = carpetfixes.helpers.FastMath.round((float) Math.sqrt(dx * dx + dz * dz) * 100.0F);
|
||||
+ } else {
|
||||
+ i = Math.round((float) Math.sqrt(dx * dx + dz * dz) * 100.0F);
|
||||
+ }
|
||||
+ // Mirai end
|
||||
+ i = carpetfixes.helpers.FastMath.round((float) Math.sqrt(dx * dx + dz * dz) * 100.0F);
|
||||
if (i > 0) {
|
||||
this.awardStat(Stats.WALK_ON_WATER_ONE_CM, i);
|
||||
this.causeFoodExhaustion(level.spigotConfig.swimMultiplier * (float) i * 0.01F, EntityExhaustionEvent.ExhaustionReason.WALK_ON_WATER); // CraftBukkit - EntityExhaustionEvent // Spigot
|
||||
@@ -396,190 +251,118 @@ index b871d89d16e0bb08cc8ce87e74ced974734be418..fda2f91ef20542cc11037c9bf74f71bd
|
||||
} else if (this.onClimbable()) {
|
||||
if (dy > 0.0D) {
|
||||
- this.awardStat(Stats.CLIMB_ONE_CM, (int) Math.round(dy * 100.0D));
|
||||
+ // Mirai start
|
||||
+ if (wtf.etil.mirai.MiraiConfig.riskyMathRoundOpt) {
|
||||
+ this.awardStat(Stats.CLIMB_ONE_CM, (int) carpetfixes.helpers.FastMath.round(dy * 100.0D));
|
||||
+ } else {
|
||||
+ this.awardStat(Stats.CLIMB_ONE_CM, (int) Math.round(dy * 100.0D));
|
||||
+ }
|
||||
+ // Mirai end
|
||||
+ this.awardStat(Stats.CLIMB_ONE_CM, (int) carpetfixes.helpers.FastMath.round(dy * 100.0D));
|
||||
}
|
||||
} else if (this.onGround) {
|
||||
- i = Math.round((float) Math.sqrt(dx * dx + dz * dz) * 100.0F);
|
||||
+ // Mirai start
|
||||
+ if (wtf.etil.mirai.MiraiConfig.riskyMathRoundOpt) {
|
||||
+ i = carpetfixes.helpers.FastMath.round((float) Math.sqrt(dx * dx + dz * dz) * 100.0F);
|
||||
+ } else {
|
||||
+ i = Math.round((float) Math.sqrt(dx * dx + dz * dz) * 100.0F);
|
||||
+ }
|
||||
+ // Mirai end
|
||||
+ i = carpetfixes.helpers.FastMath.round((float) Math.sqrt(dx * dx + dz * dz) * 100.0F);
|
||||
if (i > 0) {
|
||||
if (this.isSprinting()) {
|
||||
this.awardStat(Stats.SPRINT_ONE_CM, i);
|
||||
@@ -1662,10 +1710,22 @@ public abstract class Player extends LivingEntity {
|
||||
@@ -1662,10 +1662,10 @@ public abstract class Player extends LivingEntity {
|
||||
}
|
||||
}
|
||||
} else if (this.isFallFlying()) {
|
||||
- i = Math.round((float) Math.sqrt(dx * dx + dy * dy + dz * dz) * 100.0F);
|
||||
+ // Mirai start
|
||||
+ if (wtf.etil.mirai.MiraiConfig.riskyMathRoundOpt) {
|
||||
+ i = carpetfixes.helpers.FastMath.round((float) Math.sqrt(dx * dx + dy * dy + dz * dz) * 100.0F);
|
||||
+ } else {
|
||||
+ i = Math.round((float) Math.sqrt(dx * dx + dy * dy + dz * dz) * 100.0F);
|
||||
+ }
|
||||
+ // Mirai end
|
||||
+ i = carpetfixes.helpers.FastMath.round((float) Math.sqrt(dx * dx + dy * dy + dz * dz) * 100.0F);
|
||||
this.awardStat(Stats.AVIATE_ONE_CM, i);
|
||||
} else {
|
||||
- i = Math.round((float) Math.sqrt(dx * dx + dz * dz) * 100.0F);
|
||||
+ // Mirai start
|
||||
+ if (wtf.etil.mirai.MiraiConfig.riskyMathRoundOpt) {
|
||||
+ i = carpetfixes.helpers.FastMath.round((float) Math.sqrt(dx * dx + dz * dz) * 100.0F);
|
||||
+ } else {
|
||||
+ i = Math.round((float) Math.sqrt(dx * dx + dz * dz) * 100.0F);
|
||||
+ }
|
||||
+ // Mirai end
|
||||
+ i = carpetfixes.helpers.FastMath.round((float) Math.sqrt(dx * dx + dz * dz) * 100.0F);
|
||||
if (i > 25) {
|
||||
this.awardStat(Stats.FLY_ONE_CM, i);
|
||||
}
|
||||
@@ -1676,7 +1736,14 @@ public abstract class Player extends LivingEntity {
|
||||
@@ -1676,7 +1676,7 @@ public abstract class Player extends LivingEntity {
|
||||
|
||||
public void checkRidingStatistics(double dx, double dy, double dz) {
|
||||
if (this.isPassenger()) {
|
||||
- int i = Math.round((float) Math.sqrt(dx * dx + dy * dy + dz * dz) * 100.0F);
|
||||
+ // Mirai start
|
||||
+ int i;
|
||||
+ if (wtf.etil.mirai.MiraiConfig.riskyMathRoundOpt) {
|
||||
+ i = carpetfixes.helpers.FastMath.round((float) Math.sqrt(dx * dx + dy * dy + dz * dz) * 100.0F);
|
||||
+ } else {
|
||||
+ i = Math.round((float) Math.sqrt(dx * dx + dy * dy + dz * dz) * 100.0F);
|
||||
+ }
|
||||
+ // Mirai end
|
||||
+ int i = carpetfixes.helpers.FastMath.round((float) Math.sqrt(dx * dx + dy * dy + dz * dz) * 100.0F);
|
||||
|
||||
if (i > 0) {
|
||||
Entity entity = this.getVehicle();
|
||||
@@ -1703,7 +1770,13 @@ public abstract class Player extends LivingEntity {
|
||||
@@ -1703,7 +1703,7 @@ public abstract class Player extends LivingEntity {
|
||||
return false;
|
||||
} else {
|
||||
if (fallDistance >= 2.0F) {
|
||||
- this.awardStat(Stats.FALL_ONE_CM, (int) Math.round((double) fallDistance * 100.0D));
|
||||
+ // Mirai start
|
||||
+ if (wtf.etil.mirai.MiraiConfig.riskyMathRoundOpt) {
|
||||
+ this.awardStat(Stats.FALL_ONE_CM, (int) carpetfixes.helpers.FastMath.round((double) fallDistance * 100.0D));
|
||||
+ } else {
|
||||
+ this.awardStat(Stats.FALL_ONE_CM, (int) Math.round((double) fallDistance * 100.0D));
|
||||
+ }
|
||||
+ // Mirai end
|
||||
+ this.awardStat(Stats.FALL_ONE_CM, (int) carpetfixes.helpers.FastMath.round((double) fallDistance * 100.0D));
|
||||
}
|
||||
|
||||
return super.causeFallDamage(fallDistance, damageMultiplier, damageSource);
|
||||
diff --git a/src/main/java/net/minecraft/world/item/enchantment/EnchantmentHelper.java b/src/main/java/net/minecraft/world/item/enchantment/EnchantmentHelper.java
|
||||
index 7bc5aa35b52de0027cf58a6127a9903464ccaf47..f34fe699ecfbe1531ba793a0baede5fc49591c48 100644
|
||||
index 7bc5aa35b52de0027cf58a6127a9903464ccaf47..eee325b78f92070acac95d40ce01e13383ba9fde 100644
|
||||
--- a/src/main/java/net/minecraft/world/item/enchantment/EnchantmentHelper.java
|
||||
+++ b/src/main/java/net/minecraft/world/item/enchantment/EnchantmentHelper.java
|
||||
@@ -345,7 +345,13 @@ public class EnchantmentHelper {
|
||||
@@ -345,7 +345,7 @@ public class EnchantmentHelper {
|
||||
} else {
|
||||
level += 1 + random.nextInt(i / 4 + 1) + random.nextInt(i / 4 + 1);
|
||||
float f = (random.nextFloat() + random.nextFloat() - 1.0F) * 0.15F;
|
||||
- level = Mth.clamp(Math.round((float)level + (float)level * f), 1, Integer.MAX_VALUE);
|
||||
+ // Mirai start
|
||||
+ if (wtf.etil.mirai.MiraiConfig.riskyMathRoundOpt) {
|
||||
+ level = Mth.clamp(carpetfixes.helpers.FastMath.round((float)level + (float)level * f), 1, Integer.MAX_VALUE);
|
||||
+ } else {
|
||||
+ level = Mth.clamp(Math.round((float)level + (float)level * f), 1, Integer.MAX_VALUE);
|
||||
+ }
|
||||
+ // Mirai end
|
||||
+ level = Mth.clamp(carpetfixes.helpers.FastMath.round((float)level + (float)level * f), 1, Integer.MAX_VALUE);
|
||||
List<EnchantmentInstance> list2 = getAvailableEnchantmentResults(level, stack, treasureAllowed);
|
||||
if (!list2.isEmpty()) {
|
||||
WeightedRandom.getRandomItem(random, list2).ifPresent(list::add);
|
||||
diff --git a/src/main/java/net/minecraft/world/level/block/DaylightDetectorBlock.java b/src/main/java/net/minecraft/world/level/block/DaylightDetectorBlock.java
|
||||
index d212774a4e7c578683394fb4a6c90ce5ce875711..89288c924fd1a024e2eab5119ce7888f6693dc25 100644
|
||||
index d212774a4e7c578683394fb4a6c90ce5ce875711..9d2c7ee01d73f54fc24bd7c2b8dc7629c417c3e5 100644
|
||||
--- a/src/main/java/net/minecraft/world/level/block/DaylightDetectorBlock.java
|
||||
+++ b/src/main/java/net/minecraft/world/level/block/DaylightDetectorBlock.java
|
||||
@@ -69,7 +69,13 @@ public class DaylightDetectorBlock extends BaseEntityBlock implements IBlock {
|
||||
@@ -69,7 +69,7 @@ public class DaylightDetectorBlock extends BaseEntityBlock implements IBlock {
|
||||
float f1 = f < 3.1415927F ? 0.0F : 6.2831855F;
|
||||
|
||||
f += (f1 - f) * 0.2F;
|
||||
- i = Math.round((float) i * Mth.cos(f));
|
||||
+ // Mirai start
|
||||
+ if (wtf.etil.mirai.MiraiConfig.riskyMathRoundOpt) {
|
||||
+ i = carpetfixes.helpers.FastMath.round((float) i * Mth.cos(f));
|
||||
+ } else {
|
||||
+ i = Math.round((float) i * Mth.cos(f));
|
||||
+ }
|
||||
+ // Mirai end
|
||||
+ i = carpetfixes.helpers.FastMath.round((float) i * Mth.cos(f));
|
||||
}
|
||||
|
||||
i = Mth.clamp(i, (int) 0, (int) 15);
|
||||
diff --git a/src/main/java/net/minecraft/world/level/storage/loot/functions/LootingEnchantFunction.java b/src/main/java/net/minecraft/world/level/storage/loot/functions/LootingEnchantFunction.java
|
||||
index 31918fa2eb38e42a5ea5366e559f25ea9d7d59ae..58ca673fb7b9c87ccea67631e3b808da9718330e 100644
|
||||
index 31918fa2eb38e42a5ea5366e559f25ea9d7d59ae..f512f1e0c46b96f831fdea3073e57c6bfd9c69eb 100644
|
||||
--- a/src/main/java/net/minecraft/world/level/storage/loot/functions/LootingEnchantFunction.java
|
||||
+++ b/src/main/java/net/minecraft/world/level/storage/loot/functions/LootingEnchantFunction.java
|
||||
@@ -61,7 +61,13 @@ public class LootingEnchantFunction extends LootItemConditionalFunction {
|
||||
@@ -61,7 +61,7 @@ public class LootingEnchantFunction extends LootItemConditionalFunction {
|
||||
|
||||
float f = (float) i * this.value.getFloat(context);
|
||||
|
||||
- stack.grow(Math.round(f));
|
||||
+ // Mirai start
|
||||
+ if (wtf.etil.mirai.MiraiConfig.riskyMathRoundOpt) {
|
||||
+ stack.grow(carpetfixes.helpers.FastMath.round(f));
|
||||
+ } else {
|
||||
+ stack.grow(Math.round(f));
|
||||
+ }
|
||||
+ // Mirai end
|
||||
+ stack.grow(carpetfixes.helpers.FastMath.round(f));
|
||||
if (this.hasLimit() && stack.getCount() > this.limit) {
|
||||
stack.setCount(this.limit);
|
||||
}
|
||||
diff --git a/src/main/java/net/minecraft/world/phys/shapes/Shapes.java b/src/main/java/net/minecraft/world/phys/shapes/Shapes.java
|
||||
index 731c7dd15f131dc124be6af8f342b122cb89491b..7a44d9905523d21bb13ebd2edf177175b66a7e52 100644
|
||||
index 731c7dd15f131dc124be6af8f342b122cb89491b..3ca1a2599a211374cb95e73fdc8c8b3069496660 100644
|
||||
--- a/src/main/java/net/minecraft/world/phys/shapes/Shapes.java
|
||||
+++ b/src/main/java/net/minecraft/world/phys/shapes/Shapes.java
|
||||
@@ -59,8 +59,17 @@ public final class Shapes {
|
||||
@@ -59,8 +59,8 @@ public final class Shapes {
|
||||
int j = 1 << i;
|
||||
double d = min * (double)j;
|
||||
double e = max * (double)j;
|
||||
- boolean bl = Math.abs(d - (double)Math.round(d)) < 1.0E-7D * (double)j;
|
||||
- boolean bl2 = Math.abs(e - (double)Math.round(e)) < 1.0E-7D * (double)j;
|
||||
+ // Mirai start
|
||||
+ boolean bl;
|
||||
+ boolean bl2;
|
||||
+ if (wtf.etil.mirai.MiraiConfig.riskyMathRoundOpt) {
|
||||
+ bl = Math.abs(d - (double)carpetfixes.helpers.FastMath.round(d)) < 1.0E-7D * (double)j;
|
||||
+ bl2 = Math.abs(e - (double)carpetfixes.helpers.FastMath.round(e)) < 1.0E-7D * (double)j;
|
||||
+ } else {
|
||||
+ bl = Math.abs(d - (double)Math.round(d)) < 1.0E-7D * (double)j;
|
||||
+ bl2 = Math.abs(e - (double)Math.round(e)) < 1.0E-7D * (double)j;
|
||||
+ }
|
||||
+ // Mirai end
|
||||
+ boolean bl = Math.abs(d - (double)carpetfixes.helpers.FastMath.round(d)) < 1.0E-7D * (double)j;
|
||||
+ boolean bl2 = Math.abs(e - (double)carpetfixes.helpers.FastMath.round(e)) < 1.0E-7D * (double)j;
|
||||
if (bl && bl2) {
|
||||
return i;
|
||||
}
|
||||
diff --git a/src/main/java/org/spigotmc/TicksPerSecondCommand.java b/src/main/java/org/spigotmc/TicksPerSecondCommand.java
|
||||
index 0ecac76577eb440a0c3104ef4603acec826c474d..4ca3e92765426e9d80796c97d1af7c14fbe1f1c3 100644
|
||||
index 0ecac76577eb440a0c3104ef4603acec826c474d..4813bd6de894d0566e8631d8c71915c38c1da0f8 100644
|
||||
--- a/src/main/java/org/spigotmc/TicksPerSecondCommand.java
|
||||
+++ b/src/main/java/org/spigotmc/TicksPerSecondCommand.java
|
||||
@@ -51,8 +51,15 @@ public class TicksPerSecondCommand extends Command
|
||||
private boolean hasShownMemoryWarning; // Paper
|
||||
@@ -52,7 +52,7 @@ public class TicksPerSecondCommand extends Command
|
||||
private static String format(double tps) // Paper - Made static
|
||||
{
|
||||
- return ( ( tps > 18.0 ) ? ChatColor.GREEN : ( tps > 16.0 ) ? ChatColor.YELLOW : ChatColor.RED ).toString()
|
||||
return ( ( tps > 18.0 ) ? ChatColor.GREEN : ( tps > 16.0 ) ? ChatColor.YELLOW : ChatColor.RED ).toString()
|
||||
- + ( ( tps > 21.0 ) ? "*" : "" ) + Math.min( Math.round( tps * 100.0 ) / 100.0, 20.0 ); // Paper - only print * at 21, we commonly peak to 20.02 as the tick sleep is not accurate enough, stop the noise
|
||||
+ // Mirai start
|
||||
+ if (wtf.etil.mirai.MiraiConfig.riskyMathRoundOpt) {
|
||||
+ return ( ( tps > 18.0 ) ? ChatColor.GREEN : ( tps > 16.0 ) ? ChatColor.YELLOW : ChatColor.RED ).toString()
|
||||
+ + ( ( tps > 21.0 ) ? "*" : "" ) + Math.min( carpetfixes.helpers.FastMath.round( tps * 100.0 ) / 100.0, 20.0 ); // Paper - only print * at 21, we commonly peak to 20.02 as the tick sleep is not accurate enough, stop the noise
|
||||
+ } else {
|
||||
+ return ( ( tps > 18.0 ) ? ChatColor.GREEN : ( tps > 16.0 ) ? ChatColor.YELLOW : ChatColor.RED ).toString()
|
||||
+ + ( ( tps > 21.0 ) ? "*" : "" ) + Math.min( Math.round( tps * 100.0 ) / 100.0, 20.0 ); // Paper - only print * at 21, we commonly peak to 20.02 as the tick sleep is not accurate enough, stop the noise
|
||||
+ }
|
||||
+ // Mirai end
|
||||
+ + ( ( tps > 21.0 ) ? "*" : "" ) + Math.min( carpetfixes.helpers.FastMath.round( tps * 100.0 ) / 100.0, 20.0 ); // Paper - only print * at 21, we commonly peak to 20.02 as the tick sleep is not accurate enough, stop the noise
|
||||
}
|
||||
|
||||
// Yatopia start - Last tick time API
|
||||
|
||||
diff --git a/src/main/java/wtf/etil/mirai/MiraiConfig.java b/src/main/java/wtf/etil/mirai/MiraiConfig.java
|
||||
index a41334314a731e8ec6dc3efa77aa564446d26ef8..f4e4ace7dbad9fcbda2537dc024377d1f0770ebc 100644
|
||||
index a8d9ef7a7fcdfcab468594664d352702ee25406e..3da87aeb0ea91096a00c9acd19ca8cbb4c209d53 100644
|
||||
--- a/src/main/java/wtf/etil/mirai/MiraiConfig.java
|
||||
+++ b/src/main/java/wtf/etil/mirai/MiraiConfig.java
|
||||
@@ -257,4 +257,9 @@ public class MiraiConfig {
|
||||
@@ -252,4 +252,9 @@ public class MiraiConfig {
|
||||
serverMetrics = getBoolean("enable-server-metrics", serverMetrics);
|
||||
}
|
||||
|
||||
|
||||
@@ -1,37 +0,0 @@
|
||||
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
|
||||
From: JellySquid <jellysquid+atwork@protonmail.com>
|
||||
Date: Wed, 23 Sep 2020 16:33:58 +0200
|
||||
Subject: [PATCH] lithium: tag
|
||||
|
||||
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)
|
||||
|
||||
diff --git a/src/main/java/net/minecraft/tags/SetTag.java b/src/main/java/net/minecraft/tags/SetTag.java
|
||||
index d0c4a1dd2b11cfdbd3972dec5b5622e2f013ab48..9444e3dcdf3fa307c93adb2f790876fcd9ad88e7 100644
|
||||
--- a/src/main/java/net/minecraft/tags/SetTag.java
|
||||
+++ b/src/main/java/net/minecraft/tags/SetTag.java
|
||||
@@ -3,6 +3,8 @@ package net.minecraft.tags;
|
||||
import com.google.common.annotations.VisibleForTesting;
|
||||
import com.google.common.collect.ImmutableList;
|
||||
import com.google.common.collect.ImmutableSet;
|
||||
+import it.unimi.dsi.fastutil.objects.ReferenceArraySet; // Mirai
|
||||
+import it.unimi.dsi.fastutil.objects.ReferenceOpenHashSet; // Mirai
|
||||
import java.util.List;
|
||||
import java.util.Set;
|
||||
|
||||
@@ -14,8 +16,14 @@ public class SetTag<T> implements Tag<T> {
|
||||
|
||||
protected SetTag(Set<T> values, Class<?> type) {
|
||||
this.closestCommonSuperType = type;
|
||||
- this.values = values;
|
||||
this.valuesList = ImmutableList.copyOf(values);
|
||||
+ // Mirai start
|
||||
+ if (values.size() <= 3) {
|
||||
+ this.values = new ReferenceArraySet<>(values);
|
||||
+ } else {
|
||||
+ this.values = new ReferenceOpenHashSet<>(values);
|
||||
+ }
|
||||
+ // Mirai end
|
||||
}
|
||||
|
||||
public static <T> SetTag<T> empty() {
|
||||
Reference in New Issue
Block a user