geforkt von Mirrors/Paper
patches
Dieser Commit ist enthalten in:
Ursprung
25eea26621
Commit
961d6d7dac
@ -1,28 +0,0 @@
|
||||
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
|
||||
From: Aikar <aikar@aikar.co>
|
||||
Date: Wed, 13 Apr 2016 00:30:10 -0400
|
||||
Subject: [PATCH] Don't tick Skulls - unused code
|
||||
|
||||
|
||||
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 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644
|
||||
--- a/src/main/java/net/minecraft/world/level/block/entity/SkullBlockEntity.java
|
||||
+++ b/src/main/java/net/minecraft/world/level/block/entity/SkullBlockEntity.java
|
||||
@@ -0,0 +0,0 @@ import net.minecraft.server.MinecraftServer;
|
||||
import net.minecraft.server.players.GameProfileCache;
|
||||
import net.minecraft.util.StringUtil;
|
||||
|
||||
-public class SkullBlockEntity extends BlockEntity implements TickableBlockEntity {
|
||||
+public class SkullBlockEntity extends BlockEntity /*implements ITickable*/ { // Paper - remove tickable
|
||||
|
||||
@Nullable
|
||||
private static GameProfileCache profileCache;
|
||||
@@ -0,0 +0,0 @@ public class SkullBlockEntity extends BlockEntity implements TickableBlockEntity
|
||||
|
||||
}
|
||||
|
||||
- @Override
|
||||
+ // Paper - remove override
|
||||
public void tick() {
|
||||
BlockState iblockdata = this.getBlockState();
|
||||
|
@ -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 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644
|
||||
--- a/src/main/java/net/minecraft/util/BitStorage.java
|
||||
+++ b/src/main/java/net/minecraft/util/BitStorage.java
|
||||
@@ -0,0 +0,0 @@ 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) {
|
||||
@@ -0,0 +0,0 @@ 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;
|
||||
|
||||
@@ -0,0 +0,0 @@ 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;
|
||||
@@ -0,0 +0,0 @@ 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;
|
||||
@@ -0,0 +0,0 @@ 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;
|
@ -1,90 +0,0 @@
|
||||
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
|
||||
From: Aikar <aikar@aikar.co>
|
||||
Date: Wed, 13 Apr 2016 00:25:28 -0400
|
||||
Subject: [PATCH] Remove unused World Tile Entity List
|
||||
|
||||
Massive hit to performance and it is completely unnecessary.
|
||||
|
||||
diff --git a/src/main/java/net/minecraft/server/level/ServerLevel.java b/src/main/java/net/minecraft/server/level/ServerLevel.java
|
||||
index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644
|
||||
--- a/src/main/java/net/minecraft/server/level/ServerLevel.java
|
||||
+++ b/src/main/java/net/minecraft/server/level/ServerLevel.java
|
||||
@@ -0,0 +0,0 @@ public class ServerLevel extends net.minecraft.world.level.Level implements Worl
|
||||
}
|
||||
|
||||
bufferedwriter.write(String.format("entities: %d\n", this.entitiesById.size()));
|
||||
- bufferedwriter.write(String.format("block_entities: %d\n", this.blockEntityList.size()));
|
||||
+ bufferedwriter.write(String.format("block_entities: %d\n", this.tickableBlockEntities.size())); // Paper - remove unused list
|
||||
bufferedwriter.write(String.format("block_ticks: %d\n", this.getBlockTicks().size()));
|
||||
bufferedwriter.write(String.format("fluid_ticks: %d\n", this.getLiquidTicks().size()));
|
||||
bufferedwriter.write("distance_manager: " + playerchunkmap.getDistanceManager().getDebugStatus() + "\n");
|
||||
@@ -0,0 +0,0 @@ public class ServerLevel extends net.minecraft.world.level.Level implements Worl
|
||||
|
||||
private void dumpBlockEntities(Writer writer) throws IOException {
|
||||
CsvOutput csvwriter = CsvOutput.builder().addColumn("x").addColumn("y").addColumn("z").addColumn("type").build(writer);
|
||||
- Iterator iterator = this.blockEntityList.iterator();
|
||||
+ Iterator iterator = this.tickableBlockEntities.iterator(); // Paper - remove unused list
|
||||
|
||||
while (iterator.hasNext()) {
|
||||
BlockEntity tileentity = (BlockEntity) iterator.next();
|
||||
diff --git a/src/main/java/net/minecraft/world/level/Level.java b/src/main/java/net/minecraft/world/level/Level.java
|
||||
index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644
|
||||
--- a/src/main/java/net/minecraft/world/level/Level.java
|
||||
+++ b/src/main/java/net/minecraft/world/level/Level.java
|
||||
@@ -0,0 +0,0 @@ public abstract class Level implements LevelAccessor, AutoCloseable {
|
||||
public static final ResourceKey<Level> NETHER = ResourceKey.create(Registry.DIMENSION_REGISTRY, new ResourceLocation("the_nether"));
|
||||
public static final ResourceKey<Level> END = ResourceKey.create(Registry.DIMENSION_REGISTRY, new ResourceLocation("the_end"));
|
||||
private static final Direction[] DIRECTIONS = Direction.values();
|
||||
- public final List<BlockEntity> blockEntityList = Lists.newArrayList();
|
||||
+ //public final List<TileEntity> tileEntityList = Lists.newArrayList(); // Paper - remove unused list
|
||||
public final List<BlockEntity> tickableBlockEntities = Lists.newArrayList();
|
||||
protected final List<BlockEntity> pendingBlockEntities = Lists.newArrayList();
|
||||
protected final java.util.Set<BlockEntity> tileEntityListUnload = com.google.common.collect.Sets.newHashSet();
|
||||
@@ -0,0 +0,0 @@ public abstract class Level implements LevelAccessor, AutoCloseable {
|
||||
}, blockEntity::getBlockPos});
|
||||
}
|
||||
|
||||
- boolean flag = this.blockEntityList.add(blockEntity);
|
||||
+ boolean flag = true; // Paper - remove unused list
|
||||
|
||||
- if (flag && blockEntity instanceof TickableBlockEntity) {
|
||||
+ if (flag && blockEntity instanceof TickableBlockEntity && !this.tickableBlockEntities.contains(blockEntity)) { // Paper
|
||||
this.tickableBlockEntities.add(blockEntity);
|
||||
}
|
||||
|
||||
@@ -0,0 +0,0 @@ public abstract class Level implements LevelAccessor, AutoCloseable {
|
||||
timings.tileEntityTick.startTiming(); // Spigot
|
||||
if (!this.tileEntityListUnload.isEmpty()) {
|
||||
this.tickableBlockEntities.removeAll(this.tileEntityListUnload);
|
||||
- this.blockEntityList.removeAll(this.tileEntityListUnload);
|
||||
+ //this.tileEntityList.removeAll(this.tileEntityListUnload); // Paper - remove unused list
|
||||
this.tileEntityListUnload.clear();
|
||||
}
|
||||
|
||||
@@ -0,0 +0,0 @@ public abstract class Level implements LevelAccessor, AutoCloseable {
|
||||
tilesThisCycle--;
|
||||
this.tickableBlockEntities.remove(tileTickPosition--);
|
||||
// Spigot end
|
||||
- this.blockEntityList.remove(tileentity);
|
||||
+ //this.tileEntityList.remove(tileentity); // Paper - remove unused list
|
||||
if (this.hasChunkAt(tileentity.getBlockPos())) {
|
||||
this.getChunkAt(tileentity.getBlockPos()).removeBlockEntity(tileentity.getBlockPos());
|
||||
}
|
||||
@@ -0,0 +0,0 @@ public abstract class Level implements LevelAccessor, AutoCloseable {
|
||||
this.sendBlockUpdated(tileentity1.getBlockPos(), iblockdata, iblockdata, 3);
|
||||
// CraftBukkit start
|
||||
// From above, don't screw this up - SPIGOT-1746
|
||||
- if (!this.blockEntityList.contains(tileentity1)) {
|
||||
+ if (true) { // Paper - remove unused list
|
||||
this.addBlockEntity(tileentity1);
|
||||
}
|
||||
// CraftBukkit end
|
||||
@@ -0,0 +0,0 @@ public abstract class Level implements LevelAccessor, AutoCloseable {
|
||||
} else {
|
||||
if (tileentity != null) {
|
||||
this.pendingBlockEntities.remove(tileentity);
|
||||
- this.blockEntityList.remove(tileentity);
|
||||
+ //this.tileEntityList.remove(tileentity); // Paper - remove unused list
|
||||
this.tickableBlockEntities.remove(tileentity);
|
||||
}
|
||||
|
@ -8,20 +8,20 @@ diff --git a/src/main/java/net/minecraft/network/protocol/game/ServerboundIntera
|
||||
index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644
|
||||
--- a/src/main/java/net/minecraft/network/protocol/game/ServerboundInteractPacket.java
|
||||
+++ b/src/main/java/net/minecraft/network/protocol/game/ServerboundInteractPacket.java
|
||||
@@ -0,0 +0,0 @@ import net.minecraft.world.phys.Vec3;
|
||||
@@ -0,0 +0,0 @@ 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 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644
|
||||
--- a/src/main/java/net/minecraft/server/network/ServerGamePacketListenerImpl.java
|
||||
+++ b/src/main/java/net/minecraft/server/network/ServerGamePacketListenerImpl.java
|
||||
@@ -0,0 +0,0 @@ public class ServerGamePacketListenerImpl implements ServerGamePacketListener {
|
||||
@@ -0,0 +0,0 @@ public class ServerGamePacketListenerImpl implements ServerPlayerConnection, Ser
|
||||
}
|
||||
}
|
||||
}
|
@ -36,6 +36,6 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
|
||||
@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()) {
|
@ -9,9 +9,9 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
|
||||
--- a/src/main/java/net/minecraft/server/players/PlayerList.java
|
||||
+++ b/src/main/java/net/minecraft/server/players/PlayerList.java
|
||||
@@ -0,0 +0,0 @@ public abstract class PlayerList {
|
||||
playerconnection.send(new ClientboundSetCarriedItemPacket(player.inventory.selected));
|
||||
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();
|
82
patches/server/Optimize-DataBits.patch
Normale Datei
82
patches/server/Optimize-DataBits.patch
Normale Datei
@ -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 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644
|
||||
--- a/src/main/java/net/minecraft/util/BitStorage.java
|
||||
+++ b/src/main/java/net/minecraft/util/BitStorage.java
|
||||
@@ -0,0 +0,0 @@ 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) {
|
||||
@@ -0,0 +0,0 @@ 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) {
|
||||
@@ -0,0 +0,0 @@ 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;
|
||||
@@ -0,0 +0,0 @@ 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;
|
@ -26,4 +26,4 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
|
||||
+
|
||||
@Override
|
||||
public void setSneaking(boolean sneak) {
|
||||
getHandle().setShiftKeyDown(sneak);
|
||||
this.getHandle().setShiftKeyDown(sneak);
|
Laden…
In neuem Issue referenzieren
Einen Benutzer sperren