mirror of
https://github.com/PaperMC/Paper.git
synced 2024-12-01 04:31:58 +01:00
5792c8626a
Upstream has released updates that appears to apply and compile correctly. This update has not been tested by PaperMC and as with ANY update, please do your own testing Bukkit Changes: 93e39ce1 Clarify documentation regarding getMaterial with legacyName = true c3aeaea0 Improve dependency tracker 14c9d275 Add support for transitive depends in load access warning c8afe560 SPIGOT-5526: Add EntityEnterBlockEvent 6bb6f07d SPIGOT-5548: Show error that hints towards plugins misusing reflection ed75537d SPIGOT-5546: Fix bad depend access using wrong provider in message 4e4c0ee9 Fix buggy classloader warning triggering for all classes 89586a4c Print warning when loading classes from depends that have not been specified d4fe9680 Fix bug where disablePlugin could remove ConfigurationSerializable classes from other plugins 85e683b7 Add additional checkstyle checks 612fd8e1 Correct max page count in BookMeta docs fa8a9781 Correct max title length in BookMeta docs CraftBukkit Changes:ab13a117
SPIGOT-5550: Cancelled ProjectileLaunchEvent still plays sound for eggs44016b1d
SPIGOT-5538: Using javaw to run GUI prints input errore653ae76
SPIGOT-5526: Call EntityEnterBlockEvent for bees trying to enter hives6515ea49
SPIGOT-5537: Bee nests generated by growing trees near flower have no beesd82b3149
Remove unused CraftWorld.getId method10763a88
Change some block == AIR checks to isAir to catch CAVE_AIR Spigot Changes: f2c1cd15 Rebuild patches bcd458ad Reformat patches
93 lines
4.5 KiB
Diff
93 lines
4.5 KiB
Diff
From 3d92fba8c3d4117c565260429c47727bb900de5d Mon Sep 17 00:00:00 2001
|
|
From: Martin Panzer <postremus1996@googlemail.com>
|
|
Date: Mon, 23 May 2016 12:12:37 +0200
|
|
Subject: [PATCH] Faster redstone torch rapid clock removal
|
|
|
|
Only resize the the redstone torch list once, since resizing arrays / lists is costly
|
|
|
|
diff --git a/src/main/java/net/minecraft/server/BlockRedstoneTorch.java b/src/main/java/net/minecraft/server/BlockRedstoneTorch.java
|
|
index 98a255ae57..4c3062ece9 100644
|
|
--- a/src/main/java/net/minecraft/server/BlockRedstoneTorch.java
|
|
+++ b/src/main/java/net/minecraft/server/BlockRedstoneTorch.java
|
|
@@ -11,7 +11,7 @@ import org.bukkit.event.block.BlockRedstoneEvent; // CraftBukkit
|
|
public class BlockRedstoneTorch extends BlockTorch {
|
|
|
|
public static final BlockStateBoolean LIT = BlockProperties.r;
|
|
- private static final Map<IBlockAccess, List<BlockRedstoneTorch.RedstoneUpdateInfo>> b = new WeakHashMap();
|
|
+ // Paper - Move the mapped list to World
|
|
|
|
protected BlockRedstoneTorch(Block.Info block_info) {
|
|
super(block_info);
|
|
@@ -66,11 +66,16 @@ public class BlockRedstoneTorch extends BlockTorch {
|
|
}
|
|
|
|
public static void a(IBlockData iblockdata, World world, BlockPosition blockposition, Random random, boolean flag) {
|
|
- List list = (List) BlockRedstoneTorch.b.get(world);
|
|
+ // Paper start
|
|
+ java.util.ArrayDeque<BlockRedstoneTorch.RedstoneUpdateInfo> redstoneUpdateInfos = world.redstoneUpdateInfos;
|
|
|
|
- while (list != null && !list.isEmpty() && world.getTime() - ((BlockRedstoneTorch.RedstoneUpdateInfo) list.get(0)).b > 60L) {
|
|
- list.remove(0);
|
|
+ if (redstoneUpdateInfos != null) {
|
|
+ BlockRedstoneTorch.RedstoneUpdateInfo curr;
|
|
+ while ((curr = redstoneUpdateInfos.peek()) != null && world.getTime() - curr.getTime() > 60L) {
|
|
+ redstoneUpdateInfos.poll();
|
|
+ }
|
|
}
|
|
+ // Paper end
|
|
|
|
// CraftBukkit start
|
|
org.bukkit.plugin.PluginManager manager = world.getServer().getPluginManager();
|
|
@@ -140,9 +145,12 @@ public class BlockRedstoneTorch extends BlockTorch {
|
|
}
|
|
|
|
private static boolean a(World world, BlockPosition blockposition, boolean flag) {
|
|
- List<BlockRedstoneTorch.RedstoneUpdateInfo> list = (List) BlockRedstoneTorch.b.computeIfAbsent(world, (iblockaccess) -> {
|
|
- return Lists.newArrayList();
|
|
- });
|
|
+ // Paper start
|
|
+ java.util.ArrayDeque<BlockRedstoneTorch.RedstoneUpdateInfo> list = world.redstoneUpdateInfos;
|
|
+ if (list == null) {
|
|
+ list = world.redstoneUpdateInfos = new java.util.ArrayDeque<>();
|
|
+ }
|
|
+
|
|
|
|
if (flag) {
|
|
list.add(new BlockRedstoneTorch.RedstoneUpdateInfo(blockposition.immutableCopy(), world.getTime()));
|
|
@@ -150,9 +158,9 @@ public class BlockRedstoneTorch extends BlockTorch {
|
|
|
|
int i = 0;
|
|
|
|
- for (int j = 0; j < list.size(); ++j) {
|
|
- BlockRedstoneTorch.RedstoneUpdateInfo blockredstonetorch_redstoneupdateinfo = (BlockRedstoneTorch.RedstoneUpdateInfo) list.get(j);
|
|
-
|
|
+ for (java.util.Iterator<BlockRedstoneTorch.RedstoneUpdateInfo> iterator = list.iterator(); iterator.hasNext();) {
|
|
+ BlockRedstoneTorch.RedstoneUpdateInfo blockredstonetorch_redstoneupdateinfo = iterator.next();
|
|
+ // Paper end
|
|
if (blockredstonetorch_redstoneupdateinfo.a.equals(blockposition)) {
|
|
++i;
|
|
if (i >= 8) {
|
|
@@ -167,7 +175,7 @@ public class BlockRedstoneTorch extends BlockTorch {
|
|
public static class RedstoneUpdateInfo {
|
|
|
|
private final BlockPosition a;
|
|
- private final long b;
|
|
+ private final long b; final long getTime() { return this.b; } // Paper - OBFHELPER
|
|
|
|
public RedstoneUpdateInfo(BlockPosition blockposition, long i) {
|
|
this.a = blockposition;
|
|
diff --git a/src/main/java/net/minecraft/server/World.java b/src/main/java/net/minecraft/server/World.java
|
|
index 5a80f35c91..3898010774 100644
|
|
--- a/src/main/java/net/minecraft/server/World.java
|
|
+++ b/src/main/java/net/minecraft/server/World.java
|
|
@@ -82,6 +82,7 @@ public abstract class World implements GeneratorAccess, AutoCloseable {
|
|
private org.spigotmc.TickLimiter tileLimiter;
|
|
private int tileTickPosition;
|
|
public final Map<Explosion.CacheKey, Float> explosionDensityCache = new HashMap<>(); // Paper - Optimize explosions
|
|
+ public java.util.ArrayDeque<BlockRedstoneTorch.RedstoneUpdateInfo> redstoneUpdateInfos; // Paper - Move from Map in BlockRedstoneTorch to here
|
|
|
|
public CraftWorld getWorld() {
|
|
return this.world;
|
|
--
|
|
2.25.0
|
|
|