mirror of
https://github.com/PaperMC/Paper.git
synced 2024-12-02 21:17:00 +01:00
6fda3fd0ed
This makes it so entities that are passengers of other entities no longer count in the parents timings, as well as tracks them as a separate timers per their tick status. This lets you see how much time is spent in activated entities vs inactive (as inactive still has to do work) Passengers is also tracked separately so you can identify "Villagers in Minecarts" vs roaming villagers, as the lack of ability to move can impact their performance characteristics. This will likely break any plugin that was naughty and directly messed with our internal timings as this moves the timings to the EntityTypes object, speeding up creation of Entities to no longer store a timing handler object per entity. This will also change the output of the entities in timings to use internal ID's instead of class names. If a plugin is broken by this, shame them for doing bad things. Paper will not fix it, they will have to fix it.
61 lines
4.3 KiB
Diff
61 lines
4.3 KiB
Diff
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
|
|
From: Joseph Hirschfeld <joe@ibj.io>
|
|
Date: Thu, 3 Mar 2016 02:46:17 -0600
|
|
Subject: [PATCH] Add configurable portal search radius
|
|
|
|
|
|
diff --git a/src/main/java/com/destroystokyo/paper/PaperWorldConfig.java b/src/main/java/com/destroystokyo/paper/PaperWorldConfig.java
|
|
index 62e793b71b313146b86b466421e7a5f894bef9df..cd47a4ca069df26969de3051c2aac80540093818 100644
|
|
--- a/src/main/java/com/destroystokyo/paper/PaperWorldConfig.java
|
|
+++ b/src/main/java/com/destroystokyo/paper/PaperWorldConfig.java
|
|
@@ -191,4 +191,11 @@ public class PaperWorldConfig {
|
|
private void allChunksAreSlimeChunks() {
|
|
allChunksAreSlimeChunks = getBoolean("all-chunks-are-slime-chunks", false);
|
|
}
|
|
+
|
|
+ public int portalSearchRadius;
|
|
+ public int portalCreateRadius;
|
|
+ private void portalSearchRadius() {
|
|
+ portalSearchRadius = getInt("portal-search-radius", 128);
|
|
+ portalCreateRadius = getInt("portal-create-radius", 16);
|
|
+ }
|
|
}
|
|
diff --git a/src/main/java/net/minecraft/server/Entity.java b/src/main/java/net/minecraft/server/Entity.java
|
|
index ad372904a42978be83a8588dd24c22d15a7bf5b6..fc5cbf8cd9fa82e217084b50bd3db9458c9defbf 100644
|
|
--- a/src/main/java/net/minecraft/server/Entity.java
|
|
+++ b/src/main/java/net/minecraft/server/Entity.java
|
|
@@ -2514,7 +2514,7 @@ public abstract class Entity implements INamableTileEntity, ICommandListener, Ke
|
|
double d4 = DimensionManager.a(this.world.getDimensionManager(), worldserver.getDimensionManager());
|
|
BlockPosition blockposition = new BlockPosition(MathHelper.a(this.locX() * d4, d0, d2), this.locY(), MathHelper.a(this.locZ() * d4, d1, d3));
|
|
// CraftBukkit start
|
|
- CraftPortalEvent event = callPortalEvent(this, worldserver, blockposition, PlayerTeleportEvent.TeleportCause.NETHER_PORTAL, flag2 ? 16 : 128, 16);
|
|
+ CraftPortalEvent event = callPortalEvent(this, worldserver, blockposition, PlayerTeleportEvent.TeleportCause.NETHER_PORTAL, worldserver.paperConfig.portalSearchRadius, worldserver.paperConfig.portalCreateRadius); // Paper start - configurable portal radius
|
|
if (event == null) {
|
|
return null;
|
|
}
|
|
diff --git a/src/main/java/net/minecraft/server/EntityPlayer.java b/src/main/java/net/minecraft/server/EntityPlayer.java
|
|
index 9142f6294f3b6ca2488c146ffa568a2858d7650f..0355b18f1ba079fb0281a2deda80ef2e5c725c47 100644
|
|
--- a/src/main/java/net/minecraft/server/EntityPlayer.java
|
|
+++ b/src/main/java/net/minecraft/server/EntityPlayer.java
|
|
@@ -872,7 +872,7 @@ public class EntityPlayer extends EntityHuman implements ICrafting {
|
|
protected CraftPortalEvent callPortalEvent(Entity entity, WorldServer exitWorldServer, BlockPosition exitPosition, TeleportCause cause, int searchRadius, int creationRadius) {
|
|
Location enter = this.getBukkitEntity().getLocation();
|
|
Location exit = new Location(exitWorldServer.getWorld(), exitPosition.getX(), exitPosition.getY(), exitPosition.getZ(), yaw, pitch);
|
|
- PlayerPortalEvent event = new PlayerPortalEvent(this.getBukkitEntity(), enter, exit, cause, 128, true, creationRadius);
|
|
+ PlayerPortalEvent event = new PlayerPortalEvent(this.getBukkitEntity(), enter, exit, cause, searchRadius, true, creationRadius); // Paper - use searchRadius
|
|
Bukkit.getServer().getPluginManager().callEvent(event);
|
|
if (event.isCancelled() || event.getTo() == null || event.getTo().getWorld() == null) {
|
|
return null;
|
|
diff --git a/src/main/java/net/minecraft/server/PortalTravelAgent.java b/src/main/java/net/minecraft/server/PortalTravelAgent.java
|
|
index dc972bf0abc87c2b2fb84d8fffc368a947b2d9a3..205f3f697e9c31674a4ac8db38467bb2e61cfe6b 100644
|
|
--- a/src/main/java/net/minecraft/server/PortalTravelAgent.java
|
|
+++ b/src/main/java/net/minecraft/server/PortalTravelAgent.java
|
|
@@ -14,7 +14,7 @@ public class PortalTravelAgent {
|
|
|
|
public Optional<BlockUtil.Rectangle> findPortal(BlockPosition blockposition, boolean flag) {
|
|
// CraftBukkit start
|
|
- return findPortal(blockposition, flag ? 16 : 128); // Search Radius
|
|
+ return findPortal(blockposition, flag ? world.paperConfig.portalCreateRadius : world.paperConfig.portalSearchRadius); // Paper - search Radius
|
|
}
|
|
|
|
public Optional<BlockUtil.Rectangle> findPortal(BlockPosition blockposition, int i) {
|