From 3b1bb3e08a5c4758b2706959761ce77a2f4f480a Mon Sep 17 00:00:00 2001 From: riking Date: Fri, 6 Dec 2013 23:55:26 -0800 Subject: [PATCH] Minor changes to Tree Feller - use a HashSet, move comment LinkedHashSet doesn't actually do anything for us - we were never using the consistent ordering it promises, and openjdk-7 doesn't even provide that consistent ordering. Better to just not use it. --- .../com/gmail/nossr50/skills/woodcutting/Woodcutting.java | 4 ++-- .../gmail/nossr50/skills/woodcutting/WoodcuttingManager.java | 4 ++-- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/src/main/java/com/gmail/nossr50/skills/woodcutting/Woodcutting.java b/src/main/java/com/gmail/nossr50/skills/woodcutting/Woodcutting.java index e00afda7f..a4f66c431 100644 --- a/src/main/java/com/gmail/nossr50/skills/woodcutting/Woodcutting.java +++ b/src/main/java/com/gmail/nossr50/skills/woodcutting/Woodcutting.java @@ -163,7 +163,7 @@ public final class Woodcutting { * once the JIT has optimized the function (use the ability about 4 times * before taking measurements). */ - protected static void processTree(BlockState blockState, LinkedHashSet treeFellerBlocks) { + protected static void processTree(BlockState blockState, Set treeFellerBlocks) { List futureCenterBlocks = new ArrayList(); // Check the block up and take different behavior (smaller search) if it's a log @@ -239,11 +239,11 @@ public final class Woodcutting { return false; } + // Without this check Tree Feller propagates through leaves until the threshold is hit if (treeFellerBlocks.size() > treeFellerThreshold) { treeFellerReachedThreshold = true; } - // Without this check Tree Feller propagates through leaves until the threshold is hit if (BlockUtils.isLog(blockState)) { treeFellerBlocks.add(blockState); futureCenterBlocks.add(blockState); diff --git a/src/main/java/com/gmail/nossr50/skills/woodcutting/WoodcuttingManager.java b/src/main/java/com/gmail/nossr50/skills/woodcutting/WoodcuttingManager.java index 01dbc9047..fea4573dd 100644 --- a/src/main/java/com/gmail/nossr50/skills/woodcutting/WoodcuttingManager.java +++ b/src/main/java/com/gmail/nossr50/skills/woodcutting/WoodcuttingManager.java @@ -1,6 +1,6 @@ package com.gmail.nossr50.skills.woodcutting; -import java.util.LinkedHashSet; +import java.util.HashSet; import java.util.Set; import org.bukkit.Material; @@ -73,7 +73,7 @@ public class WoodcuttingManager extends SkillManager { */ public void processTreeFeller(BlockState blockState) { Player player = getPlayer(); - LinkedHashSet treeFellerBlocks = new LinkedHashSet(); + Set treeFellerBlocks = new HashSet(); Woodcutting.treeFellerReachedThreshold = false;