13
0
geforkt von Mirrors/Paper
Dieser Commit ist enthalten in:
Jason Penilla 2021-06-11 20:07:57 -07:00
Ursprung c56800c6fb
Commit d43c31d141
Es konnte kein GPG-Schlüssel zu dieser Signatur gefunden werden
GPG-Schlüssel-ID: 0E75A301420E48F8
10 geänderte Dateien mit 106 neuen und 105 gelöschten Zeilen

Datei anzeigen

@ -5,6 +5,8 @@ Subject: [PATCH] Remove unused World Tile Entity List
Massive hit to performance and it is completely unnecessary.
Removed during 1.17 update - no longer logically applies
diff --git a/src/main/java/net/minecraft/server/level/ServerLevel.java b/src/main/java/net/minecraft/server/level/ServerLevel.java
index f7eddb39985072afeb79ec0cbfc084d7e84638e6..bb99d9fe5e274318d8480a6de2c45b0a57351f77 100644
--- a/src/main/java/net/minecraft/server/level/ServerLevel.java

Datei anzeigen

@ -3,6 +3,7 @@ From: Aikar <aikar@aikar.co>
Date: Wed, 13 Apr 2016 00:30:10 -0400
Subject: [PATCH] Don't tick Skulls - unused code
No longer needed in 1.17
diff --git a/src/main/java/net/minecraft/world/level/block/entity/SkullBlockEntity.java b/src/main/java/net/minecraft/world/level/block/entity/SkullBlockEntity.java
index 6a46517e4026971d8c050c685c710883b5976fa3..eebaeaccc3ba1a9ec089d84b8de6c9d36034868f 100644

Datei anzeigen

@ -1,84 +0,0 @@
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
From: Aikar <aikar@aikar.co>
Date: Tue, 5 Apr 2016 21:38:58 -0400
Subject: [PATCH] Optimize DataBits
Remove Debug checks as these are super hot and causing noticeable hits
Before: http://i.imgur.com/nQsMzAE.png
After: http://i.imgur.com/nJ46crB.png
Optimize redundant converting of static fields into an unsigned long each call by precomputing it in ctor
diff --git a/src/main/java/net/minecraft/util/BitStorage.java b/src/main/java/net/minecraft/util/BitStorage.java
index 97bde5f8402452e59b0da94edfe1b970cdb86748..dd84984f28484cf7129c294222696784e128221a 100644
--- a/src/main/java/net/minecraft/util/BitStorage.java
+++ b/src/main/java/net/minecraft/util/BitStorage.java
@@ -13,8 +13,8 @@ public class BitStorage {
private final long mask;
private final int size;
private final int valuesPerLong;
- private final int divideMul;
- private final int divideAdd;
+ private final int divideMul;private final long g_unsigned; // Paper - referenced in b(int) with 2 Integer.toUnsignedLong calls
+ private final int divideAdd;private final long h_unsigned; // Paper
private final int divideShift;
public BitStorage(int elementBits, int size) {
@@ -29,8 +29,8 @@ public class BitStorage {
this.valuesPerLong = (char) (64 / elementBits);
int k = 3 * (this.valuesPerLong - 1);
- this.divideMul = BitStorage.MAGIC[k + 0];
- this.divideAdd = BitStorage.MAGIC[k + 1];
+ this.divideMul = BitStorage.MAGIC[k + 0]; this.g_unsigned = Integer.toUnsignedLong(this.divideMul); // Paper
+ this.divideAdd = BitStorage.MAGIC[k + 1]; this.h_unsigned = Integer.toUnsignedLong(this.divideAdd); // Paper
this.divideShift = BitStorage.MAGIC[k + 2];
int l = (size + this.valuesPerLong - 1) / this.valuesPerLong;
@@ -47,15 +47,15 @@ public class BitStorage {
}
private int cellIndex(int i) {
- long j = Integer.toUnsignedLong(this.divideMul);
- long k = Integer.toUnsignedLong(this.divideAdd);
+ //long j = Integer.toUnsignedLong(this.g); // Paper
+ //long k = Integer.toUnsignedLong(this.h); // Paper
- return (int) ((long) i * j + k >> 32 >> this.divideShift);
+ return (int) ((long) i * this.g_unsigned + this.h_unsigned >> 32 >> this.divideShift); // Paper
}
- public int getAndSet(int index, int value) {
- Validate.inclusiveBetween(0L, (long) (this.size - 1), (long) index);
- Validate.inclusiveBetween(0L, this.mask, (long) value);
+ public final int getAndSet(int index, int value) { // Paper - make final for inline
+ //Validate.inclusiveBetween(0L, (long) (this.e - 1), (long) i); // Paper
+ //Validate.inclusiveBetween(0L, this.d, (long) j); // Paper
int k = this.cellIndex(index);
long l = this.data[k];
int i1 = (index - k * this.valuesPerLong) * this.bits;
@@ -65,9 +65,9 @@ public class BitStorage {
return j1;
}
- public void set(int index, int value) {
- Validate.inclusiveBetween(0L, (long) (this.size - 1), (long) index);
- Validate.inclusiveBetween(0L, this.mask, (long) value);
+ public final void set(int index, int value) { // Paper - make final for inline
+ //Validate.inclusiveBetween(0L, (long) (this.e - 1), (long) i); // Paper
+ //Validate.inclusiveBetween(0L, this.d, (long) j); // Paper
int k = this.cellIndex(index);
long l = this.data[k];
int i1 = (index - k * this.valuesPerLong) * this.bits;
@@ -75,8 +75,8 @@ public class BitStorage {
this.data[k] = l & ~(this.mask << i1) | ((long) value & this.mask) << i1;
}
- public int get(int index) {
- Validate.inclusiveBetween(0L, (long) (this.size - 1), (long) index);
+ public final int get(int index) { // Paper - make final for inline
+ //Validate.inclusiveBetween(0L, (long) (this.e - 1), (long) i); // Paper
int j = this.cellIndex(index);
long k = this.data[j];
int l = (index - j * this.valuesPerLong) * this.bits;

Datei anzeigen

@ -5,23 +5,23 @@ Subject: [PATCH] Add PlayerUseUnknownEntityEvent
diff --git a/src/main/java/net/minecraft/network/protocol/game/ServerboundInteractPacket.java b/src/main/java/net/minecraft/network/protocol/game/ServerboundInteractPacket.java
index 9ff5b938f97da5ca1f13fd2bcbf3d13e8b8f760c..e1d219550006d22b0a8e949e820488c6ed96dc58 100644
index 1b316ecf2d8725b9c91a4869e6c2362c1443160d..964101d314f182574efba09bfe3907fbbf97fb13 100644
--- a/src/main/java/net/minecraft/network/protocol/game/ServerboundInteractPacket.java
+++ b/src/main/java/net/minecraft/network/protocol/game/ServerboundInteractPacket.java
@@ -11,7 +11,7 @@ import net.minecraft.world.phys.Vec3;
@@ -10,7 +10,7 @@ import net.minecraft.world.entity.Entity;
import net.minecraft.world.phys.Vec3;
public class ServerboundInteractPacket implements Packet<ServerGamePacketListener> {
- private int entityId;
+ private int entityId; public int getEntityId() { return this.entityId; } // Paper - add accessor
private ServerboundInteractPacket.Action action;
private Vec3 location;
private InteractionHand hand;
- private final int entityId;
+ private final int entityId; public final int getEntityId() { return this.entityId; } // Paper - add accessor
private final ServerboundInteractPacket.Action action;
private final boolean usingSecondaryAction;
static final ServerboundInteractPacket.Action ATTACK_ACTION = new ServerboundInteractPacket.Action() {
diff --git a/src/main/java/net/minecraft/server/network/ServerGamePacketListenerImpl.java b/src/main/java/net/minecraft/server/network/ServerGamePacketListenerImpl.java
index 73683ba59d0aff3a61f555b4ae15753e9e4e6141..e2bfe8e916c9e59af81627ea0ee449970527034d 100644
index 714fb0d766b654ad05134dea9b1e1b628a939993..c8f17466fe4ccfd8fa727e15281d015c2de2aaee 100644
--- a/src/main/java/net/minecraft/server/network/ServerGamePacketListenerImpl.java
+++ b/src/main/java/net/minecraft/server/network/ServerGamePacketListenerImpl.java
@@ -2198,6 +2198,16 @@ public class ServerGamePacketListenerImpl implements ServerGamePacketListener {
@@ -1630,6 +1630,16 @@ public class ServerGamePacketListenerImpl implements ServerPlayerConnection, Ser
}
}
}

Datei anzeigen

@ -5,13 +5,13 @@ Subject: [PATCH] Fix reducedDebugInfo not initialized on client
diff --git a/src/main/java/net/minecraft/server/players/PlayerList.java b/src/main/java/net/minecraft/server/players/PlayerList.java
index a63babe123fad398b07685ec57cd88756435457c..aa440a6341a6d30aba8fd5f6bcd122bd5d8760cd 100644
index 8e9d0ca8aa2b1403fc65ed8d792525047a610a3a..ce72102870075fffd8be6f32230ceae269ea4f9c 100644
--- a/src/main/java/net/minecraft/server/players/PlayerList.java
+++ b/src/main/java/net/minecraft/server/players/PlayerList.java
@@ -242,6 +242,7 @@ public abstract class PlayerList {
playerconnection.send(new ClientboundSetCarriedItemPacket(player.inventory.selected));
@@ -246,6 +246,7 @@ public abstract class PlayerList {
playerconnection.send(new ClientboundSetCarriedItemPacket(player.getInventory().selected));
playerconnection.send(new ClientboundUpdateRecipesPacket(this.server.getRecipeManager().getRecipes()));
playerconnection.send(new ClientboundUpdateTagsPacket(this.server.getTags()));
playerconnection.send(new ClientboundUpdateTagsPacket(this.server.getTags().serializeToNetwork((RegistryAccess) this.registryHolder)));
+ playerconnection.send(new ClientboundEntityEventPacket(player, (byte) (worldserver1.getGameRules().getBoolean(GameRules.RULE_REDUCEDDEBUGINFO) ? 22 : 23))); // Paper - fix this rule not being initialized on the client
this.sendPlayerPermissionLevel(player);
player.getStats().markAllDirty();

Datei anzeigen

@ -20,7 +20,7 @@ index 74ba5dbb83c13ce1721619b755036a7864a1fb90..db2dddd12f54e6d15916c4cee6236765
+ }
}
diff --git a/src/main/java/net/minecraft/world/level/block/SpreadingSnowyDirtBlock.java b/src/main/java/net/minecraft/world/level/block/SpreadingSnowyDirtBlock.java
index d54f097afc455a01486d7f7459b0cfc4ab4f3970..813a5b0598eca28aa173cd6e34bc16381f313604 100644
index 4c6c91deacddc4f383ecb6986e8e265a4e8eb7e6..d8c29bc282365b68951a39b4b2590b19957d578b 100644
--- a/src/main/java/net/minecraft/world/level/block/SpreadingSnowyDirtBlock.java
+++ b/src/main/java/net/minecraft/world/level/block/SpreadingSnowyDirtBlock.java
@@ -3,6 +3,7 @@ package net.minecraft.world.level.block;
@ -36,6 +36,6 @@ index d54f097afc455a01486d7f7459b0cfc4ab4f3970..813a5b0598eca28aa173cd6e34bc1638
@Override
public void randomTick(BlockState state, ServerLevel world, BlockPos pos, Random random) {
+ if (this instanceof GrassBlock && world.paperConfig.grassUpdateRate != 1 && (world.paperConfig.grassUpdateRate < 1 || (MinecraftServer.currentTick + pos.hashCode()) % world.paperConfig.grassUpdateRate != 0)) { return; } // Paper
if (!canBeGrass(state, (LevelReader) world, pos)) {
if (!SpreadingSnowyDirtBlock.canBeGrass(state, (LevelReader) world, pos)) {
// CraftBukkit start
if (org.bukkit.craftbukkit.event.CraftEventFactory.callBlockFadeEvent(world, pos, Blocks.DIRT.defaultBlockState()).isCancelled()) {

Datei anzeigen

@ -5,10 +5,10 @@ Subject: [PATCH] Fix Cancelling BlockPlaceEvent triggering physics
diff --git a/src/main/java/net/minecraft/world/level/Level.java b/src/main/java/net/minecraft/world/level/Level.java
index d47ed15382f98aabd509e32a3c202a91088adf6b..89a6a0b4235cfcc1d3ad68ff59a21fa60df4508f 100644
index 81a8e314b5073a5888a3c04d53ff279c8142a7d4..fa567322ca3f09d81479826b0119ddc922c41d11 100644
--- a/src/main/java/net/minecraft/world/level/Level.java
+++ b/src/main/java/net/minecraft/world/level/Level.java
@@ -518,6 +518,7 @@ public abstract class Level implements LevelAccessor, AutoCloseable {
@@ -538,6 +538,7 @@ public abstract class Level implements LevelAccessor, AutoCloseable {
public void setBlocksDirty(BlockPos pos, BlockState old, BlockState updated) {}
public void updateNeighborsAt(BlockPos pos, Block block) {

Datei anzeigen

@ -0,0 +1,82 @@
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
From: Aikar <aikar@aikar.co>
Date: Tue, 5 Apr 2016 21:38:58 -0400
Subject: [PATCH] Optimize DataBits
Remove Debug checks as these are super hot and causing noticeable hits
Before: http://i.imgur.com/nQsMzAE.png
After: http://i.imgur.com/nJ46crB.png
Optimize redundant converting of static fields into an unsigned long each call by precomputing it in ctor
diff --git a/src/main/java/net/minecraft/util/BitStorage.java b/src/main/java/net/minecraft/util/BitStorage.java
index 3a2e8bdc215a6af604bfaad01b670a361eb8068d..9b955a027bd2c3cbcfa659a41a6687221c5fea63 100644
--- a/src/main/java/net/minecraft/util/BitStorage.java
+++ b/src/main/java/net/minecraft/util/BitStorage.java
@@ -12,8 +12,8 @@ public class BitStorage {
private final long mask;
private final int size;
private final int valuesPerLong;
- private final int divideMul;
- private final int divideAdd;
+ private final int divideMul; private final long divideMulUnsigned; // Paper - referenced in b(int) with 2 Integer.toUnsignedLong calls
+ private final int divideAdd; private final long divideAddUnsigned; // Paper
private final int divideShift;
public BitStorage(int elementBits, int size) {
@@ -27,8 +27,8 @@ public class BitStorage {
this.mask = (1L << elementBits) - 1L;
this.valuesPerLong = (char)(64 / elementBits);
int i = 3 * (this.valuesPerLong - 1);
- this.divideMul = MAGIC[i + 0];
- this.divideAdd = MAGIC[i + 1];
+ this.divideMul = BitStorage.MAGIC[i + 0]; this.divideMulUnsigned = Integer.toUnsignedLong(this.divideMul); // Paper
+ this.divideAdd = BitStorage.MAGIC[i + 1]; this.divideAddUnsigned = Integer.toUnsignedLong(this.divideAdd); // Paper
this.divideShift = MAGIC[i + 2];
int j = (size + this.valuesPerLong - 1) / this.valuesPerLong;
if (storage != null) {
@@ -44,14 +44,14 @@ public class BitStorage {
}
private int cellIndex(int index) {
- long l = Integer.toUnsignedLong(this.divideMul);
- long m = Integer.toUnsignedLong(this.divideAdd);
- return (int)((long)index * l + m >> 32 >> this.divideShift);
+ //long l = Integer.toUnsignedLong(this.divideMul); // Paper
+ //long m = Integer.toUnsignedLong(this.divideAdd); // Paper
+ return (int) ((long) index * this.divideMulUnsigned + this.divideAddUnsigned >> 32 >> this.divideShift); // Paper
}
- public int getAndSet(int index, int value) {
- Validate.inclusiveBetween(0L, (long)(this.size - 1), (long)index);
- Validate.inclusiveBetween(0L, this.mask, (long)value);
+ public final int getAndSet(int index, int value) { // Paper - make final for inline
+ //Validate.inclusiveBetween(0L, (long)(this.size - 1), (long)index); // Paper
+ //Validate.inclusiveBetween(0L, this.mask, (long)value); // Paper
int i = this.cellIndex(index);
long l = this.data[i];
int j = (index - i * this.valuesPerLong) * this.bits;
@@ -60,17 +60,17 @@ public class BitStorage {
return k;
}
- public void set(int index, int value) {
- Validate.inclusiveBetween(0L, (long)(this.size - 1), (long)index);
- Validate.inclusiveBetween(0L, this.mask, (long)value);
+ public final void set(int index, int value) { // Paper - make final for inline
+ //Validate.inclusiveBetween(0L, (long)(this.size - 1), (long)index); // Paper
+ //Validate.inclusiveBetween(0L, this.mask, (long)value); // Paper
int i = this.cellIndex(index);
long l = this.data[i];
int j = (index - i * this.valuesPerLong) * this.bits;
this.data[i] = l & ~(this.mask << j) | ((long)value & this.mask) << j;
}
- public int get(int index) {
- Validate.inclusiveBetween(0L, (long)(this.size - 1), (long)index);
+ public final int get(int index) { // Paper - make final for inline
+ //Validate.inclusiveBetween(0L, (long)(this.size - 1), (long)index);
int i = this.cellIndex(index);
long l = this.data[i];
int j = (index - i * this.valuesPerLong) * this.bits;

Datei anzeigen

@ -6,10 +6,10 @@ Subject: [PATCH] Workaround for setting passengers on players
SPIGOT-1915 & GH-114
diff --git a/src/main/java/org/bukkit/craftbukkit/entity/CraftPlayer.java b/src/main/java/org/bukkit/craftbukkit/entity/CraftPlayer.java
index b7d5a718375083a4162df4bb41de3acd57b297fb..b264cbe5f91da9e31c5fd00ee285735a19aaad35 100644
index 2f8bcf5290d02cfc41496fd3ae8a63c08d514af8..b93a02dce55952321874528016ea48e5a35bd772 100644
--- a/src/main/java/org/bukkit/craftbukkit/entity/CraftPlayer.java
+++ b/src/main/java/org/bukkit/craftbukkit/entity/CraftPlayer.java
@@ -870,6 +870,17 @@ public class CraftPlayer extends CraftHumanEntity implements Player {
@@ -873,6 +873,17 @@ public class CraftPlayer extends CraftHumanEntity implements Player {
return true;
}
@ -26,4 +26,4 @@ index b7d5a718375083a4162df4bb41de3acd57b297fb..b264cbe5f91da9e31c5fd00ee285735a
+
@Override
public void setSneaking(boolean sneak) {
getHandle().setShiftKeyDown(sneak);
this.getHandle().setShiftKeyDown(sneak);