mirror of
https://github.com/mcMMO-Dev/mcMMO.git
synced 2024-11-22 21:26:46 +01:00
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.
This commit is contained in:
parent
07cafd4866
commit
3b1bb3e08a
@ -163,7 +163,7 @@ public final class Woodcutting {
|
|||||||
* once the JIT has optimized the function (use the ability about 4 times
|
* once the JIT has optimized the function (use the ability about 4 times
|
||||||
* before taking measurements).
|
* before taking measurements).
|
||||||
*/
|
*/
|
||||||
protected static void processTree(BlockState blockState, LinkedHashSet<BlockState> treeFellerBlocks) {
|
protected static void processTree(BlockState blockState, Set<BlockState> treeFellerBlocks) {
|
||||||
List<BlockState> futureCenterBlocks = new ArrayList<BlockState>();
|
List<BlockState> futureCenterBlocks = new ArrayList<BlockState>();
|
||||||
|
|
||||||
// Check the block up and take different behavior (smaller search) if it's a log
|
// 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;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// Without this check Tree Feller propagates through leaves until the threshold is hit
|
||||||
if (treeFellerBlocks.size() > treeFellerThreshold) {
|
if (treeFellerBlocks.size() > treeFellerThreshold) {
|
||||||
treeFellerReachedThreshold = true;
|
treeFellerReachedThreshold = true;
|
||||||
}
|
}
|
||||||
|
|
||||||
// Without this check Tree Feller propagates through leaves until the threshold is hit
|
|
||||||
if (BlockUtils.isLog(blockState)) {
|
if (BlockUtils.isLog(blockState)) {
|
||||||
treeFellerBlocks.add(blockState);
|
treeFellerBlocks.add(blockState);
|
||||||
futureCenterBlocks.add(blockState);
|
futureCenterBlocks.add(blockState);
|
||||||
|
@ -1,6 +1,6 @@
|
|||||||
package com.gmail.nossr50.skills.woodcutting;
|
package com.gmail.nossr50.skills.woodcutting;
|
||||||
|
|
||||||
import java.util.LinkedHashSet;
|
import java.util.HashSet;
|
||||||
import java.util.Set;
|
import java.util.Set;
|
||||||
|
|
||||||
import org.bukkit.Material;
|
import org.bukkit.Material;
|
||||||
@ -73,7 +73,7 @@ public class WoodcuttingManager extends SkillManager {
|
|||||||
*/
|
*/
|
||||||
public void processTreeFeller(BlockState blockState) {
|
public void processTreeFeller(BlockState blockState) {
|
||||||
Player player = getPlayer();
|
Player player = getPlayer();
|
||||||
LinkedHashSet<BlockState> treeFellerBlocks = new LinkedHashSet<BlockState>();
|
Set<BlockState> treeFellerBlocks = new HashSet<BlockState>();
|
||||||
|
|
||||||
Woodcutting.treeFellerReachedThreshold = false;
|
Woodcutting.treeFellerReachedThreshold = false;
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user