Upstream has released updates that appears to apply and compile correctly Tuinity Changes: 18fdc0c Updated Upstream (Paper) 9a6fb96 Change paper target branch to ver/1.15.2 067a82a Updated Upstream (Paper) db8a861 Updated Upstream (Paper)
2904 lines
146 KiB
Diff
2904 lines
146 KiB
Diff
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
|
|
From: =?UTF-8?q?=E3=84=97=E3=84=A0=CB=8B=20=E3=84=91=E3=84=A7=CB=8A?=
|
|
<tsao-chi@the-lingo.org>
|
|
Date: Fri, 19 Jun 2020 19:56:08 +0800
|
|
Subject: [PATCH] Remove Streams using IntelliJ IDEA
|
|
|
|
|
|
diff --git a/src/main/java/com/destroystokyo/paper/PaperCommand.java b/src/main/java/com/destroystokyo/paper/PaperCommand.java
|
|
index 10b72083322b7f8e3e14525b3e834f5374ec369d..c48f05815f7b5166b522107d576eb70058444333 100644
|
|
--- a/src/main/java/com/destroystokyo/paper/PaperCommand.java
|
|
+++ b/src/main/java/com/destroystokyo/paper/PaperCommand.java
|
|
@@ -51,8 +51,15 @@ public class PaperCommand extends Command {
|
|
case "entity":
|
|
if (args.length == 2)
|
|
return getListMatchingLast(args, "help", "list");
|
|
- if (args.length == 3)
|
|
- return getListMatchingLast(args, EntityTypes.getEntityNameList().stream().map(MinecraftKey::toString).sorted().toArray(String[]::new));
|
|
+ if (args.length == 3) {
|
|
+ List<String> list = new ArrayList<>();
|
|
+ for (MinecraftKey minecraftKey : EntityTypes.getEntityNameList()) {
|
|
+ String toString = minecraftKey.toString();
|
|
+ list.add(toString);
|
|
+ }
|
|
+ list.sort(null);
|
|
+ return getListMatchingLast(args, list.toArray(new String[0]));
|
|
+ }
|
|
break;
|
|
case "debug":
|
|
if (args.length == 2) {
|
|
@@ -377,9 +384,12 @@ public class PaperCommand extends Command {
|
|
filter = args[2];
|
|
}
|
|
final String cleanfilter = filter.replace("?", ".?").replace("*", ".*?");
|
|
- Set<MinecraftKey> names = EntityTypes.getEntityNameList().stream()
|
|
- .filter(n -> n.toString().matches(cleanfilter))
|
|
- .collect(Collectors.toSet());
|
|
+ Set<MinecraftKey> names = new HashSet<>();
|
|
+ for (MinecraftKey n : EntityTypes.getEntityNameList()) {
|
|
+ if (n.toString().matches(cleanfilter)) {
|
|
+ names.add(n);
|
|
+ }
|
|
+ }
|
|
|
|
if (names.isEmpty()) {
|
|
sender.sendMessage(ChatColor.RED + "Invalid filter, does not match any entities. Use /paper entity list for a proper list");
|
|
@@ -409,18 +419,18 @@ public class PaperCommand extends Command {
|
|
ChunkProviderServer chunkProviderServer = world.getChunkProvider();
|
|
|
|
Collection<Entity> entities = world.entitiesById.values();
|
|
- entities.forEach(e -> {
|
|
- MinecraftKey key = e.getMinecraftKey();
|
|
- if (e.shouldBeRemoved) return; // Paper
|
|
+ for (Entity entity : entities) {
|
|
+ MinecraftKey key = entity.getMinecraftKey();
|
|
+ if (entity.shouldBeRemoved) continue;
|
|
|
|
MutablePair<Integer, Map<ChunkCoordIntPair, Integer>> info = list.computeIfAbsent(key, k -> MutablePair.of(0, Maps.newHashMap()));
|
|
- ChunkCoordIntPair chunk = new ChunkCoordIntPair(e.getChunkX(), e.getChunkZ());
|
|
+ ChunkCoordIntPair chunk = new ChunkCoordIntPair(entity.getChunkX(), entity.getChunkZ());
|
|
info.left++;
|
|
info.right.put(chunk, info.right.getOrDefault(chunk, 0) + 1);
|
|
- if (!chunkProviderServer.isInEntityTickingChunk(e)) {
|
|
+ if (!chunkProviderServer.isInEntityTickingChunk(entity)) {
|
|
nonEntityTicking.merge(key, Integer.valueOf(1), Integer::sum);
|
|
}
|
|
- });
|
|
+ }
|
|
|
|
if (names.size() == 1) {
|
|
MinecraftKey name = names.iterator().next();
|
|
@@ -431,28 +441,46 @@ public class PaperCommand extends Command {
|
|
return;
|
|
}
|
|
sender.sendMessage("Entity: " + name + " Total Ticking: " + (info.getLeft() - nonTicking) + ", Total Non-Ticking: " + nonTicking);
|
|
- info.getRight().entrySet().stream()
|
|
- .sorted((a, b) -> !a.getValue().equals(b.getValue()) ? b.getValue() - a.getValue() : a.getKey().toString().compareTo(b.getKey().toString()))
|
|
- .limit(10).forEach(e -> sender.sendMessage(" " + e.getValue() + ": " + e.getKey().x + ", " + e.getKey().z + (chunkProviderServer.isEntityTickingChunk(e.getKey()) ? " (Ticking)" : " (Non-Ticking)")));
|
|
+ List<Map.Entry<ChunkCoordIntPair, Integer>> toSort = new ArrayList<>();
|
|
+ for (Map.Entry<ChunkCoordIntPair, Integer> e : info.getRight().entrySet()) {
|
|
+ toSort.add(e);
|
|
+ }
|
|
+ toSort.sort((a, b) -> !a.getValue().equals(b.getValue()) ? b.getValue() - a.getValue() : a.getKey().toString().compareTo(b.getKey().toString()));
|
|
+ long limit = 10;
|
|
+ for (Map.Entry<ChunkCoordIntPair, Integer> e : toSort) {
|
|
+ if (limit-- == 0) break;
|
|
+ sender.sendMessage(" " + e.getValue() + ": " + e.getKey().x + ", " + e.getKey().z + (chunkProviderServer.isEntityTickingChunk(e.getKey()) ? " (Ticking)" : " (Non-Ticking)"));
|
|
+ }
|
|
} else {
|
|
- List<Pair<MinecraftKey, Integer>> info = list.entrySet().stream()
|
|
- .filter(e -> names.contains(e.getKey()))
|
|
- .map(e -> Pair.of(e.getKey(), e.getValue().left))
|
|
- .sorted((a, b) -> !a.getRight().equals(b.getRight()) ? b.getRight() - a.getRight() : a.getKey().toString().compareTo(b.getKey().toString()))
|
|
- .collect(Collectors.toList());
|
|
+ List<Pair<MinecraftKey, Integer>> info = new ArrayList<>();
|
|
+ for (Map.Entry<MinecraftKey, MutablePair<Integer, Map<ChunkCoordIntPair, Integer>>> minecraftKeyMutablePairEntry : list.entrySet()) {
|
|
+ if (names.contains(minecraftKeyMutablePairEntry.getKey())) {
|
|
+ Pair<MinecraftKey, Integer> of = Pair.of(minecraftKeyMutablePairEntry.getKey(), minecraftKeyMutablePairEntry.getValue().left);
|
|
+ info.add(of);
|
|
+ }
|
|
+ }
|
|
+ info.sort((a, b) -> !a.getRight().equals(b.getRight()) ? b.getRight() - a.getRight() : a.getKey().toString().compareTo(b.getKey().toString()));
|
|
|
|
if (info == null || info.size() == 0) {
|
|
sender.sendMessage(ChatColor.RED + "No entities found.");
|
|
return;
|
|
}
|
|
|
|
- int count = info.stream().mapToInt(Pair::getRight).sum();
|
|
- int nonTickingCount = nonEntityTicking.values().stream().mapToInt(Integer::intValue).sum();
|
|
+ int count = 0;
|
|
+ for (Pair<MinecraftKey, Integer> minecraftKeyIntegerPair : info) {
|
|
+ int right = minecraftKeyIntegerPair.getRight();
|
|
+ count += right;
|
|
+ }
|
|
+ int nonTickingCount = 0;
|
|
+ for (Integer integer : nonEntityTicking.values()) {
|
|
+ int intValue = integer.intValue();
|
|
+ nonTickingCount += intValue;
|
|
+ }
|
|
sender.sendMessage("Total Ticking: " + (count - nonTickingCount) + ", Total Non-Ticking: " + nonTickingCount);
|
|
- info.forEach(e -> {
|
|
+ for (Pair<MinecraftKey, Integer> e : info) {
|
|
int nonTicking = nonEntityTicking.getOrDefault(e.getKey(), Integer.valueOf(0)).intValue();
|
|
sender.sendMessage(" " + (e.getValue() - nonTicking) + " (" + nonTicking + ") " + ": " + e.getKey());
|
|
- });
|
|
+ }
|
|
sender.sendMessage("* First number is ticking entities, second number is non-ticking entities");
|
|
}
|
|
break;
|
|
diff --git a/src/main/java/com/destroystokyo/paper/io/SyncLoadFinder.java b/src/main/java/com/destroystokyo/paper/io/SyncLoadFinder.java
|
|
index 59aec103295f747793fdc0a52eb45f4121aba921..cee2cc4c5ec3dd0627b28bfb19f38127ba8e4576 100644
|
|
--- a/src/main/java/com/destroystokyo/paper/io/SyncLoadFinder.java
|
|
+++ b/src/main/java/com/destroystokyo/paper/io/SyncLoadFinder.java
|
|
@@ -71,9 +71,11 @@ public class SyncLoadFinder {
|
|
|
|
final List<Pair<ThrowableWithEquals, SyncLoadInformation>> data = new ArrayList<>();
|
|
|
|
- entry.getValue().forEach((ThrowableWithEquals stacktrace, SyncLoadInformation times) -> {
|
|
- data.add(new Pair<>(stacktrace, times));
|
|
- });
|
|
+ for (Map.Entry<ThrowableWithEquals, SyncLoadInformation> e : entry.getValue().entrySet()) {
|
|
+ ThrowableWithEquals k = e.getKey();
|
|
+ SyncLoadInformation value = e.getValue();
|
|
+ data.add(new Pair<>(k, value));
|
|
+ }
|
|
|
|
data.sort((Pair<ThrowableWithEquals, SyncLoadInformation> pair1, Pair<ThrowableWithEquals, SyncLoadInformation> pair2) -> {
|
|
return Integer.compare(pair2.getSecond().times, pair1.getSecond().times); // reverse order
|
|
diff --git a/src/main/java/com/destroystokyo/paper/profile/CraftPlayerProfile.java b/src/main/java/com/destroystokyo/paper/profile/CraftPlayerProfile.java
|
|
index 293b73f4747f48dbf8b6a8453d3fc777de11588d..8a18dfcda3c785e9c8bd134f88515e077dbef7dc 100644
|
|
--- a/src/main/java/com/destroystokyo/paper/profile/CraftPlayerProfile.java
|
|
+++ b/src/main/java/com/destroystokyo/paper/profile/CraftPlayerProfile.java
|
|
@@ -91,7 +91,9 @@ public class CraftPlayerProfile implements PlayerProfile {
|
|
|
|
@Override
|
|
public void setProperties(Collection<ProfileProperty> properties) {
|
|
- properties.forEach(this::setProperty);
|
|
+ for (ProfileProperty property : properties) {
|
|
+ setProperty(property);
|
|
+ }
|
|
}
|
|
|
|
@Override
|
|
diff --git a/src/main/java/net/minecraft/server/AdvancementDataWorld.java b/src/main/java/net/minecraft/server/AdvancementDataWorld.java
|
|
index a395b111c882485b92840081ca4d8742019bd2ee..f916144bb7fb2891d8a3d423503edd4324cf503a 100644
|
|
--- a/src/main/java/net/minecraft/server/AdvancementDataWorld.java
|
|
+++ b/src/main/java/net/minecraft/server/AdvancementDataWorld.java
|
|
@@ -14,6 +14,7 @@ import java.util.Map;
|
|
import javax.annotation.Nullable;
|
|
import org.apache.logging.log4j.LogManager;
|
|
import org.apache.logging.log4j.Logger;
|
|
+import org.spigotmc.SpigotConfig;
|
|
|
|
public class AdvancementDataWorld extends ResourceDataJson {
|
|
|
|
@@ -32,22 +33,24 @@ public class AdvancementDataWorld extends ResourceDataJson {
|
|
protected void a(Map<MinecraftKey, JsonObject> map, IResourceManager iresourcemanager, GameProfilerFiller gameprofilerfiller) {
|
|
Map<MinecraftKey, Advancement.SerializedAdvancement> map1 = Maps.newHashMap();
|
|
|
|
- map.forEach((minecraftkey, jsonobject) -> {
|
|
- // Spigot start
|
|
- if (org.spigotmc.SpigotConfig.disabledAdvancements != null && (org.spigotmc.SpigotConfig.disabledAdvancements.contains("*") || org.spigotmc.SpigotConfig.disabledAdvancements.contains(minecraftkey.toString()))) {
|
|
- return;
|
|
+ for (Map.Entry<MinecraftKey, JsonObject> entry : map.entrySet()) {
|
|
+ MinecraftKey minecraftkey = entry.getKey();
|
|
+ JsonObject jsonobject = entry.getValue();
|
|
+// Spigot start
|
|
+ if (SpigotConfig.disabledAdvancements != null && (SpigotConfig.disabledAdvancements.contains("*") || SpigotConfig.disabledAdvancements.contains(minecraftkey.toString()))) {
|
|
+ continue;
|
|
}
|
|
// Spigot end
|
|
|
|
try {
|
|
- Advancement.SerializedAdvancement advancement_serializedadvancement = (Advancement.SerializedAdvancement) AdvancementDataWorld.DESERIALIZER.fromJson(jsonobject, Advancement.SerializedAdvancement.class);
|
|
+ Advancement.SerializedAdvancement advancement_serializedadvancement = AdvancementDataWorld.DESERIALIZER.fromJson(jsonobject, Advancement.SerializedAdvancement.class);
|
|
|
|
map1.put(minecraftkey, advancement_serializedadvancement);
|
|
} catch (IllegalArgumentException | JsonParseException jsonparseexception) {
|
|
AdvancementDataWorld.LOGGER.error("Parsing error loading custom advancement {}: {}", minecraftkey, jsonparseexception.getMessage());
|
|
}
|
|
|
|
- });
|
|
+ }
|
|
Advancements advancements = new Advancements();
|
|
|
|
advancements.a((Map) map1);
|
|
diff --git a/src/main/java/net/minecraft/server/BehaviorController.java b/src/main/java/net/minecraft/server/BehaviorController.java
|
|
index 396b64ea0fc8a04d9e0aac289033d3d82385b86e..80b418b126015658daac56a1ab7376df62e3c527 100644
|
|
--- a/src/main/java/net/minecraft/server/BehaviorController.java
|
|
+++ b/src/main/java/net/minecraft/server/BehaviorController.java
|
|
@@ -8,11 +8,8 @@ import com.google.common.collect.Sets;
|
|
import com.mojang.datafixers.Dynamic;
|
|
import com.mojang.datafixers.types.DynamicOps;
|
|
import com.mojang.datafixers.util.Pair;
|
|
-import java.util.Collection;
|
|
-import java.util.Iterator;
|
|
-import java.util.Map;
|
|
-import java.util.Optional;
|
|
-import java.util.Set;
|
|
+
|
|
+import java.util.*;
|
|
import java.util.Map.Entry;
|
|
import java.util.function.Function;
|
|
import java.util.stream.Collectors;
|
|
@@ -152,13 +149,13 @@ public class BehaviorController<E extends EntityLiving> implements MinecraftSeri
|
|
|
|
public void a(Activity activity, ImmutableList<Pair<Integer, ? extends Behavior<? super E>>> immutablelist, Set<Pair<MemoryModuleType<?>, MemoryStatus>> set) {
|
|
this.e.put(activity, set);
|
|
- immutablelist.forEach((pair) -> {
|
|
+ for (Pair<Integer, ? extends Behavior<? super E>> pair : immutablelist) {
|
|
((Set) ((Map) this.c.computeIfAbsent(pair.getFirst(), (integer) -> {
|
|
return Maps.newHashMap();
|
|
})).computeIfAbsent(activity, (activity1) -> {
|
|
return Sets.newLinkedHashSet();
|
|
})).add(pair.getSecond());
|
|
- });
|
|
+ }
|
|
}
|
|
|
|
public boolean hasActivity(Activity activity) { return c(activity); } // Paper - OBFHELPER
|
|
@@ -195,19 +192,25 @@ public class BehaviorController<E extends EntityLiving> implements MinecraftSeri
|
|
|
|
@Override
|
|
public <T> T a(DynamicOps<T> dynamicops) {
|
|
- T t0 = dynamicops.createMap(this.memories.entrySet().stream().filter((entry) -> { // Paper - decompile fix
|
|
- return ((MemoryModuleType) entry.getKey()).getSerializer().isPresent() && ((Optional) entry.getValue()).isPresent();
|
|
- }).map((entry) -> {
|
|
- return Pair.of(dynamicops.createString(IRegistry.MEMORY_MODULE_TYPE.getKey(entry.getKey()).toString()), ((MinecraftSerializable) ((Optional) entry.getValue()).get()).a(dynamicops));
|
|
- }).collect(Collectors.toMap(Pair::getFirst, Pair::getSecond)));
|
|
+ // Paper - decompile fix
|
|
+ Map<T, T> map = new HashMap<>();
|
|
+ for (Entry<MemoryModuleType<?>, Optional<?>> entry : this.memories.entrySet()) {
|
|
+ if (((MemoryModuleType) entry.getKey()).getSerializer().isPresent() && entry.getValue().isPresent()) {
|
|
+ Pair<T, T> of = Pair.of(dynamicops.createString(IRegistry.MEMORY_MODULE_TYPE.getKey(entry.getKey()).toString()), ((MinecraftSerializable) ((Optional) entry.getValue()).get()).a(dynamicops));
|
|
+ if (map.put(of.getFirst(), of.getSecond()) != null) {
|
|
+ throw new IllegalStateException("Duplicate key");
|
|
+ }
|
|
+ }
|
|
+ }
|
|
+ T t0 = dynamicops.createMap(map);
|
|
|
|
return dynamicops.createMap(ImmutableMap.of(dynamicops.createString("memories"), t0));
|
|
}
|
|
|
|
private void c(WorldServer worldserver, E e0) {
|
|
- this.sensors.values().forEach((sensor) -> {
|
|
+ for (Sensor<? super E> sensor : this.sensors.values()) {
|
|
sensor.b(worldserver, e0);
|
|
- });
|
|
+ }
|
|
}
|
|
|
|
private void d(WorldServer worldserver, E e0) {
|
|
diff --git a/src/main/java/net/minecraft/server/BehaviorInteractDoor.java b/src/main/java/net/minecraft/server/BehaviorInteractDoor.java
|
|
index 3db22c5f4df6fe68474839c3889ffbe5440f54dc..28f5782bfe720a9f4c021f279ff4b56d9339ff9d 100644
|
|
--- a/src/main/java/net/minecraft/server/BehaviorInteractDoor.java
|
|
+++ b/src/main/java/net/minecraft/server/BehaviorInteractDoor.java
|
|
@@ -4,6 +4,9 @@ import com.google.common.collect.ImmutableMap;
|
|
import com.google.common.collect.Lists;
|
|
import com.google.common.collect.Sets;
|
|
import io.akarin.server.IndexedBlockPosition;
|
|
+import org.bukkit.craftbukkit.block.CraftBlock;
|
|
+import org.bukkit.event.entity.EntityInteractEvent;
|
|
+
|
|
import java.util.Iterator;
|
|
import java.util.List;
|
|
import java.util.Set;
|
|
@@ -70,7 +73,7 @@ public class BehaviorInteractDoor extends Behavior<EntityLiving> {
|
|
}
|
|
|
|
private void a(WorldServer worldserver, java.util.Map<BlockPosition, Integer> list, Set<io.akarin.server.IndexedBlockPosition> set, int i, EntityLiving entityliving, BehaviorController<?> behaviorcontroller) { // Akarin - List -> Map, IndexedBlockPosition
|
|
- set.forEach((indexedblockposition) -> { // Akarin - IndexedBlockPosition
|
|
+ for (IndexedBlockPosition indexedblockposition : set) {// Akarin - IndexedBlockPosition
|
|
BlockPosition blockposition = indexedblockposition.get(); // Akarin - IndexedBlockPosition
|
|
// int j = list.indexOf(blockposition); // Akarin - IndexedBlockPosition
|
|
IBlockData iblockdata = worldserver.getType(blockposition);
|
|
@@ -80,10 +83,10 @@ public class BehaviorInteractDoor extends Behavior<EntityLiving> {
|
|
boolean flag = indexedblockposition.index() >= i; // Akarin - IndexedBlockPosition
|
|
|
|
// CraftBukkit start - entities opening doors
|
|
- org.bukkit.event.entity.EntityInteractEvent event = new org.bukkit.event.entity.EntityInteractEvent(entityliving.getBukkitEntity(), org.bukkit.craftbukkit.block.CraftBlock.at(entityliving.world, blockposition));
|
|
+ EntityInteractEvent event = new EntityInteractEvent(entityliving.getBukkitEntity(), CraftBlock.at(entityliving.world, blockposition));
|
|
entityliving.world.getServer().getPluginManager().callEvent(event);
|
|
if (event.isCancelled()) {
|
|
- return;
|
|
+ continue;
|
|
}
|
|
// CaftBukkit end
|
|
((BlockDoor) block).setDoor(worldserver, blockposition, flag);
|
|
@@ -103,7 +106,7 @@ public class BehaviorInteractDoor extends Behavior<EntityLiving> {
|
|
}
|
|
}
|
|
|
|
- });
|
|
+ }
|
|
a(worldserver, list, i, entityliving, behaviorcontroller);
|
|
}
|
|
|
|
diff --git a/src/main/java/net/minecraft/server/BiomeBase.java b/src/main/java/net/minecraft/server/BiomeBase.java
|
|
index ef6c85557c217f1cb7f78ffbd87c094a7fd77482..a071a1da72fba6efb5684149774404555c821c6e 100644
|
|
--- a/src/main/java/net/minecraft/server/BiomeBase.java
|
|
+++ b/src/main/java/net/minecraft/server/BiomeBase.java
|
|
@@ -4,12 +4,8 @@ import com.google.common.collect.Lists;
|
|
import com.google.common.collect.Maps;
|
|
import com.google.common.collect.Sets;
|
|
import it.unimi.dsi.fastutil.longs.Long2FloatLinkedOpenHashMap;
|
|
-import java.util.Arrays;
|
|
-import java.util.Iterator;
|
|
-import java.util.List;
|
|
-import java.util.Map;
|
|
-import java.util.Random;
|
|
-import java.util.Set;
|
|
+
|
|
+import java.util.*;
|
|
import java.util.stream.Collectors;
|
|
import javax.annotation.Nullable;
|
|
import org.apache.logging.log4j.LogManager;
|
|
@@ -478,9 +474,18 @@ public abstract class BiomeBase {
|
|
|
|
NONE("none"), RAIN("rain"), SNOW("snow");
|
|
|
|
- private static final Map<String, BiomeBase.Precipitation> d = (Map) Arrays.stream(values()).collect(Collectors.toMap(BiomeBase.Precipitation::a, (biomebase_precipitation) -> {
|
|
- return biomebase_precipitation;
|
|
- }));
|
|
+ private static final Map<String, BiomeBase.Precipitation> d;
|
|
+
|
|
+ static {
|
|
+ Map<String, Precipitation> map = new HashMap<>();
|
|
+ for (Precipitation biomebase_precipitation : values()) {
|
|
+ if (map.put(biomebase_precipitation.a(), biomebase_precipitation) != null) {
|
|
+ throw new IllegalStateException("Duplicate key");
|
|
+ }
|
|
+ }
|
|
+ d = (Map) map;
|
|
+ }
|
|
+
|
|
private final String e;
|
|
|
|
private Precipitation(String s) {
|
|
@@ -496,9 +501,18 @@ public abstract class BiomeBase {
|
|
|
|
NONE("none"), TAIGA("taiga"), EXTREME_HILLS("extreme_hills"), JUNGLE("jungle"), MESA("mesa"), PLAINS("plains"), SAVANNA("savanna"), ICY("icy"), THEEND("the_end"), BEACH("beach"), FOREST("forest"), OCEAN("ocean"), DESERT("desert"), RIVER("river"), SWAMP("swamp"), MUSHROOM("mushroom"), NETHER("nether");
|
|
|
|
- private static final Map<String, BiomeBase.Geography> r = (Map) Arrays.stream(values()).collect(Collectors.toMap(BiomeBase.Geography::a, (biomebase_geography) -> {
|
|
- return biomebase_geography;
|
|
- }));
|
|
+ private static final Map<String, BiomeBase.Geography> r;
|
|
+
|
|
+ static {
|
|
+ Map<String, Geography> map = new HashMap<>();
|
|
+ for (Geography biomebase_geography : values()) {
|
|
+ if (map.put(biomebase_geography.a(), biomebase_geography) != null) {
|
|
+ throw new IllegalStateException("Duplicate key");
|
|
+ }
|
|
+ }
|
|
+ r = (Map) map;
|
|
+ }
|
|
+
|
|
private final String s;
|
|
|
|
private Geography(String s) {
|
|
@@ -514,9 +528,18 @@ public abstract class BiomeBase {
|
|
|
|
OCEAN("ocean"), COLD("cold"), MEDIUM("medium"), WARM("warm");
|
|
|
|
- private static final Map<String, BiomeBase.EnumTemperature> e = (Map) Arrays.stream(values()).collect(Collectors.toMap(BiomeBase.EnumTemperature::a, (biomebase_enumtemperature) -> {
|
|
- return biomebase_enumtemperature;
|
|
- }));
|
|
+ private static final Map<String, BiomeBase.EnumTemperature> e;
|
|
+
|
|
+ static {
|
|
+ Map<String, EnumTemperature> map = new HashMap<>();
|
|
+ for (EnumTemperature biomebase_enumtemperature : values()) {
|
|
+ if (map.put(biomebase_enumtemperature.a(), biomebase_enumtemperature) != null) {
|
|
+ throw new IllegalStateException("Duplicate key");
|
|
+ }
|
|
+ }
|
|
+ e = (Map) map;
|
|
+ }
|
|
+
|
|
private final String f;
|
|
|
|
private EnumTemperature(String s) {
|
|
diff --git a/src/main/java/net/minecraft/server/Block.java b/src/main/java/net/minecraft/server/Block.java
|
|
index 66244a9d0e253b3709df4ae2adcd21e44ebbfc90..c8109cef9db68230ee6aab3e1caaf3c95ca3044f 100644
|
|
--- a/src/main/java/net/minecraft/server/Block.java
|
|
+++ b/src/main/java/net/minecraft/server/Block.java
|
|
@@ -474,9 +474,9 @@ public class Block implements IMaterial {
|
|
|
|
public static void c(IBlockData iblockdata, World world, BlockPosition blockposition) {
|
|
if (world instanceof WorldServer) {
|
|
- a(iblockdata, (WorldServer) world, blockposition, (TileEntity) null).forEach((itemstack) -> {
|
|
+ for (ItemStack itemstack : a(iblockdata, (WorldServer) world, blockposition, (TileEntity) null)) {
|
|
a(world, blockposition, itemstack);
|
|
- });
|
|
+ }
|
|
}
|
|
|
|
iblockdata.dropNaturally(world, blockposition, ItemStack.a);
|
|
@@ -484,9 +484,9 @@ public class Block implements IMaterial {
|
|
public static void dropNaturally(IBlockData iblockdata, World world, BlockPosition blockposition, @Nullable TileEntity tileentity) { a(iblockdata, world, blockposition, tileentity); }
|
|
public static void a(IBlockData iblockdata, World world, BlockPosition blockposition, @Nullable TileEntity tileentity) {
|
|
if (world instanceof WorldServer) {
|
|
- a(iblockdata, (WorldServer) world, blockposition, tileentity).forEach((itemstack) -> {
|
|
+ for (ItemStack itemstack : a(iblockdata, (WorldServer) world, blockposition, tileentity)) {
|
|
a(world, blockposition, itemstack);
|
|
- });
|
|
+ }
|
|
}
|
|
|
|
iblockdata.dropNaturally(world, blockposition, ItemStack.a);
|
|
@@ -494,9 +494,9 @@ public class Block implements IMaterial {
|
|
|
|
public static void dropItems(IBlockData iblockdata, World world, BlockPosition blockposition, @Nullable TileEntity tileentity, Entity entity, ItemStack itemstack) {
|
|
if (world instanceof WorldServer) {
|
|
- getDrops(iblockdata, (WorldServer) world, blockposition, tileentity, entity, itemstack).forEach((itemstack1) -> {
|
|
+ for (ItemStack itemstack1 : getDrops(iblockdata, (WorldServer) world, blockposition, tileentity, entity, itemstack)) {
|
|
a(world, blockposition, itemstack1);
|
|
- });
|
|
+ }
|
|
}
|
|
|
|
iblockdata.dropNaturally(world, blockposition, itemstack);
|
|
diff --git a/src/main/java/net/minecraft/server/BlockDataAbstract.java b/src/main/java/net/minecraft/server/BlockDataAbstract.java
|
|
index 2040f183490d515b913df048ae8ab07bbecaa9a4..cf0d7be22678de8866e160588e34071a769cc599 100644
|
|
--- a/src/main/java/net/minecraft/server/BlockDataAbstract.java
|
|
+++ b/src/main/java/net/minecraft/server/BlockDataAbstract.java
|
|
@@ -6,10 +6,8 @@ import com.google.common.collect.ImmutableMap;
|
|
import com.google.common.collect.Maps;
|
|
import com.google.common.collect.Table;
|
|
import com.google.common.collect.UnmodifiableIterator;
|
|
-import java.util.Collection;
|
|
-import java.util.Collections;
|
|
-import java.util.Iterator;
|
|
-import java.util.Map;
|
|
+
|
|
+import java.util.*;
|
|
import java.util.Map.Entry;
|
|
import java.util.function.Function;
|
|
import java.util.stream.Collectors;
|
|
@@ -67,7 +65,12 @@ public abstract class BlockDataAbstract<O, S> implements IBlockDataHolder<S> {
|
|
stringbuilder.append(this.a);
|
|
if (!this.getStateMap().isEmpty()) {
|
|
stringbuilder.append('[');
|
|
- stringbuilder.append((String) this.getStateMap().entrySet().stream().map(BlockDataAbstract.STATE_TO_VALUE).collect(Collectors.joining(",")));
|
|
+ StringJoiner joiner = new StringJoiner(",");
|
|
+ for (Entry<IBlockState<?>, Comparable<?>> iBlockStateComparableEntry : this.getStateMap().entrySet()) {
|
|
+ String s = BlockDataAbstract.STATE_TO_VALUE.apply(iBlockStateComparableEntry);
|
|
+ joiner.add(s);
|
|
+ }
|
|
+ stringbuilder.append((String) joiner.toString());
|
|
stringbuilder.append(']');
|
|
}
|
|
|
|
diff --git a/src/main/java/net/minecraft/server/BlockStateEnum.java b/src/main/java/net/minecraft/server/BlockStateEnum.java
|
|
index 7cdadc6b6abd069f9a1bc000a8f116f73b90e029..fc5f6e064fb6bb766d6f693f5e4bd7859abb15a8 100644
|
|
--- a/src/main/java/net/minecraft/server/BlockStateEnum.java
|
|
+++ b/src/main/java/net/minecraft/server/BlockStateEnum.java
|
|
@@ -4,11 +4,8 @@ import com.google.common.base.Predicates;
|
|
import com.google.common.collect.ImmutableSet;
|
|
import com.google.common.collect.Lists;
|
|
import com.google.common.collect.Maps;
|
|
-import java.util.Arrays;
|
|
-import java.util.Collection;
|
|
-import java.util.Iterator;
|
|
-import java.util.Map;
|
|
-import java.util.Optional;
|
|
+
|
|
+import java.util.*;
|
|
import java.util.function.Predicate;
|
|
import java.util.stream.Collectors;
|
|
|
|
@@ -75,7 +72,13 @@ public class BlockStateEnum<T extends Enum<T> & INamable> extends BlockState<T>
|
|
}
|
|
|
|
public static <T extends Enum<T> & INamable> BlockStateEnum<T> a(String s, Class<T> oclass, Predicate<T> predicate) {
|
|
- return a(s, oclass, (Collection) Arrays.stream(oclass.getEnumConstants()).filter(predicate).collect(Collectors.toList()));
|
|
+ List<T> list = new ArrayList<>();
|
|
+ for (T t : oclass.getEnumConstants()) {
|
|
+ if (predicate.test(t)) {
|
|
+ list.add(t);
|
|
+ }
|
|
+ }
|
|
+ return a(s, oclass, (Collection) list);
|
|
}
|
|
|
|
public static <T extends Enum<T> & INamable> BlockStateEnum<T> of(String s, Class<T> oclass, T... at) {
|
|
diff --git a/src/main/java/net/minecraft/server/ChunkMapDistance.java b/src/main/java/net/minecraft/server/ChunkMapDistance.java
|
|
index e70f4928f81a06d3c15862fc7bdc43dc5fba928e..a26989ecca7c56a23e5cede45abb48c5af489d48 100644
|
|
--- a/src/main/java/net/minecraft/server/ChunkMapDistance.java
|
|
+++ b/src/main/java/net/minecraft/server/ChunkMapDistance.java
|
|
@@ -296,18 +296,18 @@ public abstract class ChunkMapDistance {
|
|
delayDistanceManagerTick = true;
|
|
priority = Math.min(URGENT_PRIORITY - 1, Math.max(1, priority));
|
|
int finalPriority = priority;
|
|
- MCUtil.getSpiralOutChunks(center.asPosition(), radius).forEach(coords -> {
|
|
+ for (ChunkCoordIntPair coords : MCUtil.getSpiralOutChunks(center.asPosition(), radius)) {
|
|
addPriorityTicket(coords, TicketType.PRIORITY, finalPriority);
|
|
- });
|
|
+ }
|
|
delayDistanceManagerTick = false;
|
|
chunkMap.world.getChunkProvider().tickDistanceManager();
|
|
}
|
|
|
|
public void clearAreaPriorityTickets(ChunkCoordIntPair center, int radius) {
|
|
delayDistanceManagerTick = true;
|
|
- MCUtil.getSpiralOutChunks(center.asPosition(), radius).forEach(coords -> {
|
|
- this.removeTicket(coords.pair(), new Ticket<ChunkCoordIntPair>(TicketType.PRIORITY, PRIORITY_TICKET_LEVEL, coords));
|
|
- });
|
|
+ for (ChunkCoordIntPair coords : MCUtil.getSpiralOutChunks(center.asPosition(), radius)) {
|
|
+ this.removeTicket(coords.pair(), new Ticket<>(TicketType.PRIORITY, PRIORITY_TICKET_LEVEL, coords));
|
|
+ }
|
|
delayDistanceManagerTick = false;
|
|
chunkMap.world.getChunkProvider().tickDistanceManager();
|
|
}
|
|
diff --git a/src/main/java/net/minecraft/server/ChunkRegionLoader.java b/src/main/java/net/minecraft/server/ChunkRegionLoader.java
|
|
index 20b6b58bdee872a4aaa18e3507aef2c8afd5d26e..5afbd870b2388249565659c5e759026ae5138a4b 100644
|
|
--- a/src/main/java/net/minecraft/server/ChunkRegionLoader.java
|
|
+++ b/src/main/java/net/minecraft/server/ChunkRegionLoader.java
|
|
@@ -54,7 +54,9 @@ public class ChunkRegionLoader {
|
|
|
|
public static ProtoChunk loadChunk(WorldServer worldserver, DefinedStructureManager definedstructuremanager, VillagePlace villageplace, ChunkCoordIntPair chunkcoordintpair, NBTTagCompound nbttagcompound) {
|
|
InProgressChunkHolder holder = loadChunk(worldserver, definedstructuremanager, villageplace, chunkcoordintpair, nbttagcompound, true);
|
|
- holder.tasks.forEach(Runnable::run);
|
|
+ for (Runnable task : holder.tasks) {
|
|
+ task.run();
|
|
+ }
|
|
return holder.protoChunk;
|
|
}
|
|
|
|
@@ -404,9 +406,14 @@ public class ChunkRegionLoader {
|
|
|
|
for (int i = -1; i < 17; ++i) { // Paper - conflict on loop parameter change
|
|
int finalI = i;
|
|
- ChunkSection chunksection = (ChunkSection) Arrays.stream(achunksection).filter((chunksection1) -> {
|
|
- return chunksection1 != null && chunksection1.getYPosition() >> 4 == finalI;
|
|
- }).findFirst().orElse(Chunk.a);
|
|
+ ChunkSection found = Chunk.a;
|
|
+ for (ChunkSection chunksection1 : achunksection) {
|
|
+ if (chunksection1 != null && chunksection1.getYPosition() >> 4 == finalI) {
|
|
+ found = chunksection1;
|
|
+ break;
|
|
+ }
|
|
+ }
|
|
+ ChunkSection chunksection = (ChunkSection) found;
|
|
// Paper start - async chunk save for unload
|
|
NibbleArray nibblearray; // block light
|
|
NibbleArray nibblearray1; // sky light
|
|
diff --git a/src/main/java/net/minecraft/server/ContainerGrindstone.java b/src/main/java/net/minecraft/server/ContainerGrindstone.java
|
|
index 83cb0cd64c81eb35fa49eecff93b40f08e0a5606..4b0ac9ba44a4e09f8d3f8cdd3597d036fc2263ee 100644
|
|
--- a/src/main/java/net/minecraft/server/ContainerGrindstone.java
|
|
+++ b/src/main/java/net/minecraft/server/ContainerGrindstone.java
|
|
@@ -1,5 +1,6 @@
|
|
package net.minecraft.server;
|
|
|
|
+import java.util.HashMap;
|
|
import java.util.Iterator;
|
|
import java.util.Map;
|
|
import java.util.Map.Entry;
|
|
@@ -243,9 +244,15 @@ public class ContainerGrindstone extends Container {
|
|
}
|
|
|
|
itemstack1.setCount(j);
|
|
- Map<Enchantment, Integer> map = (Map) EnchantmentManager.a(itemstack).entrySet().stream().filter((entry) -> {
|
|
- return ((Enchantment) entry.getKey()).c();
|
|
- }).collect(Collectors.toMap(Entry::getKey, Entry::getValue));
|
|
+ Map<Enchantment, Integer> result = new HashMap<>();
|
|
+ for (Entry<Enchantment, Integer> entry : EnchantmentManager.a(itemstack).entrySet()) {
|
|
+ if (entry.getKey().c()) {
|
|
+ if (result.put(entry.getKey(), entry.getValue()) != null) {
|
|
+ throw new IllegalStateException("Duplicate key");
|
|
+ }
|
|
+ }
|
|
+ }
|
|
+ Map<Enchantment, Integer> map = (Map) result;
|
|
|
|
EnchantmentManager.a(map, itemstack1);
|
|
itemstack1.setRepairCost(0);
|
|
diff --git a/src/main/java/net/minecraft/server/CraftingManager.java b/src/main/java/net/minecraft/server/CraftingManager.java
|
|
index f0d7a91fa06632d5731e277a9199aa9804d3a96a..784cc2bb837df4585992679e877bbb4dac897a8b 100644
|
|
--- a/src/main/java/net/minecraft/server/CraftingManager.java
|
|
+++ b/src/main/java/net/minecraft/server/CraftingManager.java
|
|
@@ -8,14 +8,8 @@ import com.google.gson.GsonBuilder;
|
|
import com.google.gson.JsonObject;
|
|
import com.google.gson.JsonParseException;
|
|
import com.google.gson.JsonSyntaxException;
|
|
-import java.util.Collection;
|
|
-import java.util.Collections;
|
|
-import java.util.Comparator;
|
|
-import java.util.Iterator;
|
|
-import java.util.List;
|
|
-import java.util.Map;
|
|
-import java.util.Objects;
|
|
-import java.util.Optional;
|
|
+
|
|
+import java.util.*;
|
|
import java.util.Map.Entry;
|
|
import java.util.stream.Collectors;
|
|
import java.util.stream.Stream;
|
|
@@ -120,15 +114,24 @@ public class CraftingManager extends ResourceDataJson {
|
|
}
|
|
|
|
public Optional<? extends IRecipe<?>> a(MinecraftKey minecraftkey) {
|
|
- return this.recipes.values().stream().map((map) -> {
|
|
- return map.get(minecraftkey); // CraftBukkit - decompile error
|
|
- }).filter(Objects::nonNull).findFirst();
|
|
+ // CraftBukkit - decompile error
|
|
+ for (Object2ObjectLinkedOpenHashMap<MinecraftKey, IRecipe<?>> map : this.recipes.values()) {
|
|
+ IRecipe<?> iRecipe = map.get(minecraftkey);
|
|
+ if (iRecipe != null) {
|
|
+ return Optional.<IRecipe<?>>of(iRecipe);
|
|
+ }
|
|
+ }
|
|
+ return Optional.empty();
|
|
}
|
|
|
|
public Collection<IRecipe<?>> b() {
|
|
- return (Collection) this.recipes.values().stream().flatMap((map) -> {
|
|
- return map.values().stream();
|
|
- }).collect(Collectors.toSet());
|
|
+ Set<IRecipe<?>> set = new HashSet<>();
|
|
+ for (Object2ObjectLinkedOpenHashMap<MinecraftKey, IRecipe<?>> map : this.recipes.values()) {
|
|
+ for (IRecipe<?> iRecipe : map.values()) {
|
|
+ set.add(iRecipe);
|
|
+ }
|
|
+ }
|
|
+ return (Collection) set;
|
|
}
|
|
|
|
public Stream<MinecraftKey> c() {
|
|
diff --git a/src/main/java/net/minecraft/server/CrashReport.java b/src/main/java/net/minecraft/server/CrashReport.java
|
|
index c7dc8787cc3456c5540d6a00a6ff051533edc25a..78b758a11c1b7f1b132bd13604c18f171312fcea 100644
|
|
--- a/src/main/java/net/minecraft/server/CrashReport.java
|
|
+++ b/src/main/java/net/minecraft/server/CrashReport.java
|
|
@@ -11,6 +11,7 @@ import java.text.SimpleDateFormat;
|
|
import java.util.Date;
|
|
import java.util.Iterator;
|
|
import java.util.List;
|
|
+import java.util.StringJoiner;
|
|
import java.util.concurrent.CompletionException;
|
|
import java.util.stream.Collectors;
|
|
import org.apache.commons.io.IOUtils;
|
|
@@ -66,7 +67,11 @@ public class CrashReport {
|
|
this.d.a("JVM Flags", () -> {
|
|
List<String> list = (List) SystemUtils.h().collect(Collectors.toList());
|
|
|
|
- return String.format("%d total; %s", list.size(), list.stream().collect(Collectors.joining(" ")));
|
|
+ StringJoiner joiner = new StringJoiner(" ");
|
|
+ for (String s : list) {
|
|
+ joiner.add(s);
|
|
+ }
|
|
+ return String.format("%d total; %s", list.size(), joiner.toString());
|
|
});
|
|
this.d.a("CraftBukkit Information", (CrashReportCallable) new org.bukkit.craftbukkit.CraftCrashReport()); // CraftBukkit
|
|
}
|
|
diff --git a/src/main/java/net/minecraft/server/DataConverterFlatten.java b/src/main/java/net/minecraft/server/DataConverterFlatten.java
|
|
index 548df54075a2b13787f2254cbf1d544afa3f4984..fefbe22401e86f113be5d1b691516ff5cea0af2a 100644
|
|
--- a/src/main/java/net/minecraft/server/DataConverterFlatten.java
|
|
+++ b/src/main/java/net/minecraft/server/DataConverterFlatten.java
|
|
@@ -12,10 +12,8 @@ import com.mojang.datafixers.Typed;
|
|
import com.mojang.datafixers.schemas.Schema;
|
|
import com.mojang.datafixers.types.Type;
|
|
import com.mojang.datafixers.util.Pair;
|
|
-import java.util.HashMap;
|
|
-import java.util.Map;
|
|
-import java.util.Optional;
|
|
-import java.util.Set;
|
|
+
|
|
+import java.util.*;
|
|
import java.util.stream.Collectors;
|
|
import javax.annotation.Nullable;
|
|
|
|
@@ -343,9 +341,17 @@ public class DataConverterFlatten extends DataFix {
|
|
hashmap.put("minecraft:record_wait.0", "minecraft:music_disc_wait");
|
|
hashmap.put("minecraft:record_ward.0", "minecraft:music_disc_ward");
|
|
});
|
|
- private static final Set<String> b = (Set) DataConverterFlatten.a.keySet().stream().map((s) -> {
|
|
- return s.substring(0, s.indexOf(46));
|
|
- }).collect(Collectors.toSet());
|
|
+ private static final Set<String> b;
|
|
+
|
|
+ static {
|
|
+ Set<String> set = new HashSet<>();
|
|
+ for (String s : DataConverterFlatten.a.keySet()) {
|
|
+ String substring = s.substring(0, s.indexOf(46));
|
|
+ set.add(substring);
|
|
+ }
|
|
+ b = (Set) set;
|
|
+ }
|
|
+
|
|
private static final Set<String> c = Sets.newHashSet(new String[]{"minecraft:bow", "minecraft:carrot_on_a_stick", "minecraft:chainmail_boots", "minecraft:chainmail_chestplate", "minecraft:chainmail_helmet", "minecraft:chainmail_leggings", "minecraft:diamond_axe", "minecraft:diamond_boots", "minecraft:diamond_chestplate", "minecraft:diamond_helmet", "minecraft:diamond_hoe", "minecraft:diamond_leggings", "minecraft:diamond_pickaxe", "minecraft:diamond_shovel", "minecraft:diamond_sword", "minecraft:elytra", "minecraft:fishing_rod", "minecraft:flint_and_steel", "minecraft:golden_axe", "minecraft:golden_boots", "minecraft:golden_chestplate", "minecraft:golden_helmet", "minecraft:golden_hoe", "minecraft:golden_leggings", "minecraft:golden_pickaxe", "minecraft:golden_shovel", "minecraft:golden_sword", "minecraft:iron_axe", "minecraft:iron_boots", "minecraft:iron_chestplate", "minecraft:iron_helmet", "minecraft:iron_hoe", "minecraft:iron_leggings", "minecraft:iron_pickaxe", "minecraft:iron_shovel", "minecraft:iron_sword", "minecraft:leather_boots", "minecraft:leather_chestplate", "minecraft:leather_helmet", "minecraft:leather_leggings", "minecraft:shears", "minecraft:shield", "minecraft:stone_axe", "minecraft:stone_hoe", "minecraft:stone_pickaxe", "minecraft:stone_shovel", "minecraft:stone_sword", "minecraft:wooden_axe", "minecraft:wooden_hoe", "minecraft:wooden_pickaxe", "minecraft:wooden_shovel", "minecraft:wooden_sword"});
|
|
|
|
public DataConverterFlatten(Schema schema, boolean flag) {
|
|
diff --git a/src/main/java/net/minecraft/server/DataPaletteBlock.java b/src/main/java/net/minecraft/server/DataPaletteBlock.java
|
|
index 599ce8062a68041bd874f80cb40d71db6fd509c5..cf3e0fdfa832819e9fd22b3e404cd39f2fabd209 100644
|
|
--- a/src/main/java/net/minecraft/server/DataPaletteBlock.java
|
|
+++ b/src/main/java/net/minecraft/server/DataPaletteBlock.java
|
|
@@ -274,9 +274,9 @@ public class DataPaletteBlock<T> implements DataPaletteExpandable<T> {
|
|
this.a.a((i) -> {
|
|
int2intopenhashmap.put(i, int2intopenhashmap.get(i) + 1);
|
|
});
|
|
- int2intopenhashmap.int2IntEntrySet().forEach((entry) -> {
|
|
+ for (Entry entry : int2intopenhashmap.int2IntEntrySet()) {
|
|
datapaletteblock_a.accept(this.h.a(entry.getIntKey()), entry.getIntValue());
|
|
- });
|
|
+ }
|
|
}
|
|
|
|
// Paper start
|
|
diff --git a/src/main/java/net/minecraft/server/DispenserRegistry.java b/src/main/java/net/minecraft/server/DispenserRegistry.java
|
|
index 6bdd9eba98d44320e35a211fddc1d77c9dab20d2..821f03ac74ab6b262a926373e7a1b3052760c790 100644
|
|
--- a/src/main/java/net/minecraft/server/DispenserRegistry.java
|
|
+++ b/src/main/java/net/minecraft/server/DispenserRegistry.java
|
|
@@ -140,9 +140,9 @@ public class DispenserRegistry {
|
|
throw new IllegalArgumentException("Not bootstrapped");
|
|
} else {
|
|
if (SharedConstants.b) {
|
|
- b().forEach((s) -> {
|
|
+ for (String s : b()) {
|
|
DispenserRegistry.LOGGER.error("Missing translations: " + s);
|
|
- });
|
|
+ }
|
|
}
|
|
|
|
}
|
|
diff --git a/src/main/java/net/minecraft/server/Entity.java b/src/main/java/net/minecraft/server/Entity.java
|
|
index 33b456d4348c503cc94557d623c537a8aed8f9ec..e8ec27ad54e1540ea97841d1b598428e37944ebc 100644
|
|
--- a/src/main/java/net/minecraft/server/Entity.java
|
|
+++ b/src/main/java/net/minecraft/server/Entity.java
|
|
@@ -2756,9 +2756,11 @@ public abstract class Entity implements INamableTileEntity, ICommandListener, Ke
|
|
}
|
|
|
|
private static void c(IChatBaseComponent ichatbasecomponent) {
|
|
- ichatbasecomponent.a((chatmodifier) -> {
|
|
- chatmodifier.setChatClickable((ChatClickable) null);
|
|
- }).getSiblings().forEach(Entity::c);
|
|
+ for (IChatBaseComponent iChatBaseComponent : ichatbasecomponent.a((chatmodifier) -> {
|
|
+ chatmodifier.setChatClickable(null);
|
|
+ }).getSiblings()) {
|
|
+ c(iChatBaseComponent);
|
|
+ }
|
|
}
|
|
|
|
@Override
|
|
@@ -3092,11 +3094,11 @@ public abstract class Entity implements INamableTileEntity, ICommandListener, Ke
|
|
WorldServer worldserver = (WorldServer) this.world;
|
|
|
|
this.setPositionRotation(d0, d1, d2, this.yaw, this.pitch);
|
|
- this.collectPassengers().forEach((entity) -> { // Akarin - remove stream
|
|
+ for (Entity entity : this.collectPassengers()) {// Akarin - remove stream
|
|
worldserver.chunkCheck(entity);
|
|
entity.aF = true;
|
|
entity.a(Entity::teleportAndSync);
|
|
- });
|
|
+ }
|
|
}
|
|
}
|
|
|
|
diff --git a/src/main/java/net/minecraft/server/EntityDragonFireball.java b/src/main/java/net/minecraft/server/EntityDragonFireball.java
|
|
index db43ac1cc4ae959a432eedd3efee891b4e141c7f..480c930714328c2789a3641d947611070711cff0 100644
|
|
--- a/src/main/java/net/minecraft/server/EntityDragonFireball.java
|
|
+++ b/src/main/java/net/minecraft/server/EntityDragonFireball.java
|
|
@@ -1,5 +1,9 @@
|
|
package net.minecraft.server;
|
|
|
|
+import org.bukkit.craftbukkit.entity.CraftLivingEntity;
|
|
+import org.bukkit.entity.LivingEntity;
|
|
+
|
|
+import java.util.ArrayList;
|
|
import java.util.Iterator;
|
|
import java.util.List;
|
|
|
|
@@ -41,7 +45,12 @@ public class EntityDragonFireball extends EntityFireball {
|
|
}
|
|
}
|
|
|
|
- if (new com.destroystokyo.paper.event.entity.EnderDragonFireballHitEvent((org.bukkit.entity.DragonFireball) this.getBukkitEntity(), list.stream().map(EntityLiving::getBukkitLivingEntity).collect(java.util.stream.Collectors.toList()), (org.bukkit.entity.AreaEffectCloud) entityareaeffectcloud.getBukkitEntity()).callEvent()) { // Paper
|
|
+ List<LivingEntity> result = new ArrayList<>();
|
|
+ for (EntityLiving entityLiving : list) {
|
|
+ CraftLivingEntity bukkitLivingEntity = entityLiving.getBukkitLivingEntity();
|
|
+ result.add(bukkitLivingEntity);
|
|
+ }
|
|
+ if (new com.destroystokyo.paper.event.entity.EnderDragonFireballHitEvent((org.bukkit.entity.DragonFireball) this.getBukkitEntity(), result, (org.bukkit.entity.AreaEffectCloud) entityareaeffectcloud.getBukkitEntity()).callEvent()) { // Paper
|
|
this.world.triggerEffect(2006, new BlockPosition(this), 0);
|
|
this.world.addEntity(entityareaeffectcloud);
|
|
} else entityareaeffectcloud.die(); // Paper
|
|
diff --git a/src/main/java/net/minecraft/server/EntityEnderDragon.java b/src/main/java/net/minecraft/server/EntityEnderDragon.java
|
|
index 7daebfdab5c6e258d3e426643c0dbd374774ff5d..e87f9d6f27835635dd9307a1661af2aceef0f4c6 100644
|
|
--- a/src/main/java/net/minecraft/server/EntityEnderDragon.java
|
|
+++ b/src/main/java/net/minecraft/server/EntityEnderDragon.java
|
|
@@ -464,9 +464,9 @@ public class EntityEnderDragon extends EntityInsentient implements IMonster {
|
|
TileEntity tileentity = nmsBlock.isTileEntity() ? this.world.getTileEntity(blockposition) : null;
|
|
LootTableInfo.Builder loottableinfo_builder = (new LootTableInfo.Builder((WorldServer) this.world)).a(this.world.random).set(LootContextParameters.POSITION, blockposition).set(LootContextParameters.TOOL, ItemStack.a).set(LootContextParameters.EXPLOSION_RADIUS, 1.0F / event.getYield()).setOptional(LootContextParameters.BLOCK_ENTITY, tileentity);
|
|
|
|
- craftBlock.getNMS().a(loottableinfo_builder).forEach((itemstack) -> {
|
|
+ for (ItemStack itemstack : craftBlock.getNMS().a(loottableinfo_builder)) {
|
|
Block.a(world, blockposition, itemstack);
|
|
- });
|
|
+ }
|
|
craftBlock.getNMS().dropNaturally(world, blockposition, ItemStack.a);
|
|
}
|
|
// Paper start - TNTPrimeEvent
|
|
diff --git a/src/main/java/net/minecraft/server/EntityFox.java b/src/main/java/net/minecraft/server/EntityFox.java
|
|
index 82a32d5dbf162b8c67c701d0c9647ddca103ddef..6058335a9a698b80215fa45dfe3c9646245ef9aa 100644
|
|
--- a/src/main/java/net/minecraft/server/EntityFox.java
|
|
+++ b/src/main/java/net/minecraft/server/EntityFox.java
|
|
@@ -1,14 +1,8 @@
|
|
package net.minecraft.server;
|
|
|
|
import com.google.common.collect.Lists;
|
|
-import java.util.Arrays;
|
|
-import java.util.Comparator;
|
|
-import java.util.EnumSet;
|
|
-import java.util.Iterator;
|
|
-import java.util.List;
|
|
-import java.util.Map;
|
|
-import java.util.Optional;
|
|
-import java.util.UUID;
|
|
+
|
|
+import java.util.*;
|
|
import java.util.function.Predicate;
|
|
import java.util.stream.Collectors;
|
|
import javax.annotation.Nullable;
|
|
@@ -1401,12 +1395,29 @@ public class EntityFox extends EntityAnimal {
|
|
|
|
RED(0, "red", new BiomeBase[]{Biomes.TAIGA, Biomes.TAIGA_HILLS, Biomes.TAIGA_MOUNTAINS, Biomes.GIANT_TREE_TAIGA, Biomes.GIANT_SPRUCE_TAIGA, Biomes.GIANT_TREE_TAIGA_HILLS, Biomes.GIANT_SPRUCE_TAIGA_HILLS}), SNOW(1, "snow", new BiomeBase[]{Biomes.SNOWY_TAIGA, Biomes.SNOWY_TAIGA_HILLS, Biomes.SNOWY_TAIGA_MOUNTAINS});
|
|
|
|
- private static final EntityFox.Type[] c = (EntityFox.Type[]) Arrays.stream(values()).sorted(Comparator.comparingInt(EntityFox.Type::c)).toArray((i) -> {
|
|
- return new EntityFox.Type[i];
|
|
- });
|
|
- private static final Map<String, EntityFox.Type> d = (Map) Arrays.stream(values()).collect(Collectors.toMap(EntityFox.Type::a, (entityfox_type) -> {
|
|
- return entityfox_type;
|
|
- }));
|
|
+ private static final EntityFox.Type[] c;
|
|
+
|
|
+ static {
|
|
+ List<Type> list = new ArrayList<>();
|
|
+ for (Type type : values()) {
|
|
+ list.add(type);
|
|
+ }
|
|
+ list.sort(Comparator.comparingInt(Type::c));
|
|
+ c = (Type[]) list.toArray(new Type[0]);
|
|
+ }
|
|
+
|
|
+ private static final Map<String, EntityFox.Type> d;
|
|
+
|
|
+ static {
|
|
+ Map<String, Type> map = new HashMap<>();
|
|
+ for (Type entityfox_type : values()) {
|
|
+ if (map.put(entityfox_type.a(), entityfox_type) != null) {
|
|
+ throw new IllegalStateException("Duplicate key");
|
|
+ }
|
|
+ }
|
|
+ d = (Map) map;
|
|
+ }
|
|
+
|
|
private final int e;
|
|
private final String f;
|
|
private final List<BiomeBase> g;
|
|
diff --git a/src/main/java/net/minecraft/server/EntityPanda.java b/src/main/java/net/minecraft/server/EntityPanda.java
|
|
index f50ed19080257b9199bf1b8b846877a2ba1cafbb..bf21ec155e564f845f342de82fb2f6b5b786039c 100644
|
|
--- a/src/main/java/net/minecraft/server/EntityPanda.java
|
|
+++ b/src/main/java/net/minecraft/server/EntityPanda.java
|
|
@@ -1,11 +1,6 @@
|
|
package net.minecraft.server;
|
|
|
|
-import java.util.Arrays;
|
|
-import java.util.Comparator;
|
|
-import java.util.EnumSet;
|
|
-import java.util.Iterator;
|
|
-import java.util.List;
|
|
-import java.util.Random;
|
|
+import java.util.*;
|
|
import java.util.function.Predicate;
|
|
import javax.annotation.Nullable;
|
|
|
|
@@ -1002,9 +997,17 @@ public class EntityPanda extends EntityAnimal {
|
|
|
|
NORMAL(0, "normal", false), LAZY(1, "lazy", false), WORRIED(2, "worried", false), PLAYFUL(3, "playful", false), BROWN(4, "brown", true), WEAK(5, "weak", true), AGGRESSIVE(6, "aggressive", false);
|
|
|
|
- private static final EntityPanda.Gene[] h = (EntityPanda.Gene[]) Arrays.stream(values()).sorted(Comparator.comparingInt(EntityPanda.Gene::a)).toArray((i) -> {
|
|
- return new EntityPanda.Gene[i];
|
|
- });
|
|
+ private static final EntityPanda.Gene[] h;
|
|
+
|
|
+ static {
|
|
+ List<Gene> list = new ArrayList<>();
|
|
+ for (Gene gene : values()) {
|
|
+ list.add(gene);
|
|
+ }
|
|
+ list.sort(Comparator.comparingInt(Gene::a));
|
|
+ h = (Gene[]) list.toArray(new Gene[0]);
|
|
+ }
|
|
+
|
|
private final int i;
|
|
private final String j;
|
|
private final boolean k;
|
|
diff --git a/src/main/java/net/minecraft/server/EntitySheep.java b/src/main/java/net/minecraft/server/EntitySheep.java
|
|
index bb46247f2f1bba51d25c70584f29d34c31b7d39c..ca4272c71de8f00b2cd7abb0867137514c750974 100644
|
|
--- a/src/main/java/net/minecraft/server/EntitySheep.java
|
|
+++ b/src/main/java/net/minecraft/server/EntitySheep.java
|
|
@@ -1,11 +1,8 @@
|
|
package net.minecraft.server;
|
|
|
|
import com.google.common.collect.Maps;
|
|
-import java.util.Arrays;
|
|
-import java.util.EnumMap;
|
|
-import java.util.Map;
|
|
-import java.util.Optional;
|
|
-import java.util.Random;
|
|
+
|
|
+import java.util.*;
|
|
import java.util.stream.Collectors;
|
|
import javax.annotation.Nullable;
|
|
|
|
@@ -36,9 +33,18 @@ public class EntitySheep extends EntityAnimal {
|
|
enummap.put(EnumColor.RED, Blocks.RED_WOOL);
|
|
enummap.put(EnumColor.BLACK, Blocks.BLACK_WOOL);
|
|
});
|
|
- private static final Map<EnumColor, float[]> by = Maps.newEnumMap((Map) Arrays.stream(EnumColor.values()).collect(Collectors.toMap((enumcolor) -> {
|
|
- return enumcolor;
|
|
- }, EntitySheep::c)));
|
|
+ private static final Map<EnumColor, float[]> by;
|
|
+
|
|
+ static {
|
|
+ Map<EnumColor, float[]> map = new HashMap<>();
|
|
+ for (EnumColor enumcolor : EnumColor.values()) {
|
|
+ if (map.put(enumcolor, c(enumcolor)) != null) {
|
|
+ throw new IllegalStateException("Duplicate key");
|
|
+ }
|
|
+ }
|
|
+ by = Maps.newEnumMap((Map) map);
|
|
+ }
|
|
+
|
|
private int bz;
|
|
private PathfinderGoalEatTile bA;
|
|
|
|
diff --git a/src/main/java/net/minecraft/server/EntityVillager.java b/src/main/java/net/minecraft/server/EntityVillager.java
|
|
index a904434211ac6c4645b996294e5018945d266a1f..7a3bea7462071634edcba43c54ef9ac2ca612793 100644
|
|
--- a/src/main/java/net/minecraft/server/EntityVillager.java
|
|
+++ b/src/main/java/net/minecraft/server/EntityVillager.java
|
|
@@ -7,11 +7,8 @@ import com.mojang.datafixers.Dynamic;
|
|
import com.mojang.datafixers.types.DynamicOps;
|
|
import com.mojang.datafixers.util.Pair;
|
|
import it.unimi.dsi.fastutil.ints.Int2ObjectMap;
|
|
-import java.util.Iterator;
|
|
-import java.util.List;
|
|
-import java.util.Map;
|
|
-import java.util.Optional;
|
|
-import java.util.Set;
|
|
+
|
|
+import java.util.*;
|
|
import java.util.Map.Entry;
|
|
import java.util.function.BiPredicate;
|
|
import java.util.stream.Collectors;
|
|
@@ -788,9 +785,12 @@ public class EntityVillager extends EntityVillagerAbstract implements Reputation
|
|
private int eY() {
|
|
InventorySubcontainer inventorysubcontainer = this.getInventory();
|
|
|
|
- return EntityVillager.bx.entrySet().stream().mapToInt((entry) -> {
|
|
- return inventorysubcontainer.a((Item) entry.getKey()) * (Integer) entry.getValue();
|
|
- }).sum();
|
|
+ int sum = 0;
|
|
+ for (Entry<Item, Integer> entry : EntityVillager.bx.entrySet()) {
|
|
+ int i1 = inventorysubcontainer.a(entry.getKey()) * entry.getValue();
|
|
+ sum += i1;
|
|
+ }
|
|
+ return sum;
|
|
}
|
|
|
|
private void eZ() {
|
|
@@ -858,17 +858,23 @@ public class EntityVillager extends EntityVillagerAbstract implements Reputation
|
|
if (this.a(i)) {
|
|
AxisAlignedBB axisalignedbb = this.getBoundingBox().grow(10.0D, 10.0D, 10.0D);
|
|
List<EntityVillager> list = this.world.a(EntityVillager.class, axisalignedbb);
|
|
- List<EntityVillager> list1 = (List) list.stream().filter((entityvillager) -> {
|
|
- return entityvillager.a(i);
|
|
- }).limit(5L).collect(Collectors.toList());
|
|
+ List<EntityVillager> result = new ArrayList<>();
|
|
+ long limit = 5L;
|
|
+ for (EntityVillager entityVillager : list) {
|
|
+ if (entityVillager.a(i)) {
|
|
+ if (limit-- == 0) break;
|
|
+ result.add(entityVillager);
|
|
+ }
|
|
+ }
|
|
+ List<EntityVillager> list1 = (List) result;
|
|
|
|
if (list1.size() >= j) {
|
|
EntityIronGolem entityirongolem = this.fb();
|
|
|
|
if (entityirongolem != null) {
|
|
- list.forEach((entityvillager) -> {
|
|
+ for (EntityVillager entityvillager : list) {
|
|
entityvillager.b(i);
|
|
- });
|
|
+ }
|
|
}
|
|
}
|
|
}
|
|
diff --git a/src/main/java/net/minecraft/server/Explosion.java b/src/main/java/net/minecraft/server/Explosion.java
|
|
index 00b70d7447e0db11c09f3b751e089ea0b73710fc..85c6ffed60bd116efc836875ce5856bfe394f934 100644
|
|
--- a/src/main/java/net/minecraft/server/Explosion.java
|
|
+++ b/src/main/java/net/minecraft/server/Explosion.java
|
|
@@ -295,9 +295,9 @@ public class Explosion {
|
|
loottableinfo_builder.set(LootContextParameters.EXPLOSION_RADIUS, 1.0F / yield); // CraftBukkit - add yield
|
|
}
|
|
|
|
- iblockdata.a(loottableinfo_builder).forEach((itemstack) -> {
|
|
+ for (ItemStack itemstack : iblockdata.a(loottableinfo_builder)) {
|
|
a(objectarraylist, itemstack, blockposition1);
|
|
- });
|
|
+ }
|
|
}
|
|
|
|
this.world.setTypeAndData(blockposition, Blocks.AIR.getBlockData(), 3);
|
|
diff --git a/src/main/java/net/minecraft/server/Fluid.java b/src/main/java/net/minecraft/server/Fluid.java
|
|
index 7c9ba128620f54c9cd691d350d1ee225d867fe70..c5721b013a05860b8f1e59783b01dd3e7b407726 100644
|
|
--- a/src/main/java/net/minecraft/server/Fluid.java
|
|
+++ b/src/main/java/net/minecraft/server/Fluid.java
|
|
@@ -4,10 +4,8 @@ import com.google.common.collect.ImmutableMap;
|
|
import com.mojang.datafixers.Dynamic;
|
|
import com.mojang.datafixers.types.DynamicOps;
|
|
import com.mojang.datafixers.util.Pair;
|
|
-import java.util.Iterator;
|
|
-import java.util.Map;
|
|
-import java.util.Optional;
|
|
-import java.util.Random;
|
|
+
|
|
+import java.util.*;
|
|
import java.util.Map.Entry;
|
|
import java.util.stream.Collectors;
|
|
|
|
@@ -74,9 +72,15 @@ public interface Fluid extends IBlockDataHolder<Fluid> {
|
|
if (immutablemap.isEmpty()) {
|
|
object = dynamicops.createMap(ImmutableMap.of(dynamicops.createString("Name"), dynamicops.createString(IRegistry.FLUID.getKey(fluid.getType()).toString())));
|
|
} else {
|
|
- object = dynamicops.createMap(ImmutableMap.of(dynamicops.createString("Name"), dynamicops.createString(IRegistry.FLUID.getKey(fluid.getType()).toString()), dynamicops.createString("Properties"), dynamicops.createMap(immutablemap.entrySet().stream().map((entry) -> { // Paper - decompile fix
|
|
- return Pair.of(dynamicops.createString(((IBlockState) entry.getKey()).a()), dynamicops.createString(IBlockDataHolder.b((IBlockState) entry.getKey(), (Comparable) entry.getValue())));
|
|
- }).collect(Collectors.toMap(Pair::getFirst, Pair::getSecond)))));
|
|
+ // Paper - decompile fix
|
|
+ Map<T, T> map = new HashMap<>();
|
|
+ for (Entry<IBlockState<?>, Comparable<?>> entry : immutablemap.entrySet()) {
|
|
+ Pair<T, T> of = Pair.of(dynamicops.createString(entry.getKey().a()), dynamicops.createString(IBlockDataHolder.b(entry.getKey(), entry.getValue())));
|
|
+ if (map.put(of.getFirst(), of.getSecond()) != null) {
|
|
+ throw new IllegalStateException("Duplicate key");
|
|
+ }
|
|
+ }
|
|
+ object = dynamicops.createMap(ImmutableMap.of(dynamicops.createString("Name"), dynamicops.createString(IRegistry.FLUID.getKey(fluid.getType()).toString()), dynamicops.createString("Properties"), dynamicops.createMap(map)));
|
|
}
|
|
|
|
return new Dynamic(dynamicops, object);
|
|
diff --git a/src/main/java/net/minecraft/server/GameRules.java b/src/main/java/net/minecraft/server/GameRules.java
|
|
index 9609387dbe18567a0e1b058409cded58e0ab0b04..c38894b87f4a3d65bb177aabfaaab8c6855458dc 100644
|
|
--- a/src/main/java/net/minecraft/server/GameRules.java
|
|
+++ b/src/main/java/net/minecraft/server/GameRules.java
|
|
@@ -100,25 +100,31 @@ public class GameRules {
|
|
public NBTTagCompound a() {
|
|
NBTTagCompound nbttagcompound = new NBTTagCompound();
|
|
|
|
- this.H.forEach((gamerules_gamerulekey, gamerules_gamerulevalue) -> {
|
|
+ for (Entry<GameRuleKey<?>, GameRuleValue<?>> entry : this.H.entrySet()) {
|
|
+ GameRuleKey<?> gamerules_gamerulekey = entry.getKey();
|
|
+ GameRuleValue<?> gamerules_gamerulevalue = entry.getValue();
|
|
nbttagcompound.setString(gamerules_gamerulekey.a, gamerules_gamerulevalue.getValue());
|
|
- });
|
|
+ }
|
|
return nbttagcompound;
|
|
}
|
|
|
|
public void a(NBTTagCompound nbttagcompound) {
|
|
- this.H.forEach((gamerules_gamerulekey, gamerules_gamerulevalue) -> {
|
|
+ for (Entry<GameRuleKey<?>, GameRuleValue<?>> entry : this.H.entrySet()) {
|
|
+ GameRuleKey<?> gamerules_gamerulekey = entry.getKey();
|
|
+ GameRuleValue<?> gamerules_gamerulevalue = entry.getValue();
|
|
if (nbttagcompound.hasKey(gamerules_gamerulekey.a)) {
|
|
gamerules_gamerulevalue.setValue(nbttagcompound.getString(gamerules_gamerulekey.a));
|
|
}
|
|
|
|
- });
|
|
+ }
|
|
}
|
|
|
|
public static void a(GameRules.GameRuleVisitor gamerules_gamerulevisitor) {
|
|
- GameRules.G.forEach((gamerules_gamerulekey, gamerules_gameruledefinition) -> {
|
|
+ for (Entry<GameRuleKey<?>, GameRuleDefinition<?>> entry : GameRules.G.entrySet()) {
|
|
+ GameRuleKey<?> gamerules_gamerulekey = entry.getKey();
|
|
+ GameRuleDefinition<?> gamerules_gameruledefinition = entry.getValue();
|
|
a(gamerules_gamerulevisitor, gamerules_gamerulekey, gamerules_gameruledefinition);
|
|
- });
|
|
+ }
|
|
}
|
|
|
|
private static <T extends GameRules.GameRuleValue<T>> void a(GameRules.GameRuleVisitor gamerules_gamerulevisitor, GameRules.GameRuleKey<?> gamerules_gamerulekey, GameRules.GameRuleDefinition<?> gamerules_gameruledefinition) {
|
|
diff --git a/src/main/java/net/minecraft/server/IBlockData.java b/src/main/java/net/minecraft/server/IBlockData.java
|
|
index 41cac274111efa5ba42ac9c4acb547295f7f4bb5..b2c05bcf559749e87d109f9e23e4243a134989d1 100644
|
|
--- a/src/main/java/net/minecraft/server/IBlockData.java
|
|
+++ b/src/main/java/net/minecraft/server/IBlockData.java
|
|
@@ -6,12 +6,7 @@ import com.mojang.datafixers.types.DynamicOps;
|
|
import com.mojang.datafixers.util.Pair;
|
|
import org.bukkit.craftbukkit.block.data.CraftBlockData;
|
|
|
|
-import java.util.Arrays;
|
|
-import java.util.Iterator;
|
|
-import java.util.List;
|
|
-import java.util.Map;
|
|
-import java.util.Optional;
|
|
-import java.util.Random;
|
|
+import java.util.*;
|
|
import java.util.Map.Entry;
|
|
import java.util.stream.Collectors;
|
|
import javax.annotation.Nullable;
|
|
@@ -330,9 +325,15 @@ public class IBlockData extends BlockDataAbstract<Block, IBlockData> implements
|
|
if (immutablemap.isEmpty()) {
|
|
object = dynamicops.createMap(ImmutableMap.of(dynamicops.createString("Name"), dynamicops.createString(IRegistry.BLOCK.getKey(iblockdata.getBlock()).toString())));
|
|
} else {
|
|
- object = dynamicops.createMap(ImmutableMap.of(dynamicops.createString("Name"), dynamicops.createString(IRegistry.BLOCK.getKey(iblockdata.getBlock()).toString()), dynamicops.createString("Properties"), dynamicops.createMap(immutablemap.entrySet().stream().map((entry) -> { // Paper - decompile fix
|
|
- return Pair.of(dynamicops.createString(((IBlockState) entry.getKey()).a()), dynamicops.createString(IBlockDataHolder.b((IBlockState) entry.getKey(), (Comparable) entry.getValue())));
|
|
- }).collect(Collectors.toMap(Pair::getFirst, Pair::getSecond)))));
|
|
+ // Paper - decompile fix
|
|
+ Map<T, T> map = new HashMap<>();
|
|
+ for (Entry<IBlockState<?>, Comparable<?>> entry : immutablemap.entrySet()) {
|
|
+ Pair<T, T> of = Pair.of(dynamicops.createString(entry.getKey().a()), dynamicops.createString(IBlockDataHolder.b(entry.getKey(), entry.getValue())));
|
|
+ if (map.put(of.getFirst(), of.getSecond()) != null) {
|
|
+ throw new IllegalStateException("Duplicate key");
|
|
+ }
|
|
+ }
|
|
+ object = dynamicops.createMap(ImmutableMap.of(dynamicops.createString("Name"), dynamicops.createString(IRegistry.BLOCK.getKey(iblockdata.getBlock()).toString()), dynamicops.createString("Properties"), dynamicops.createMap(map)));
|
|
}
|
|
|
|
return new Dynamic(dynamicops, object);
|
|
@@ -406,9 +407,14 @@ public class IBlockData extends BlockDataAbstract<Block, IBlockData> implements
|
|
}
|
|
|
|
this.g = block.b(iblockdata, (IBlockAccess) BlockAccessAir.INSTANCE, BlockPosition.ZERO, VoxelShapeCollision.a());
|
|
- this.h = Arrays.stream(EnumDirection.EnumAxis.values()).anyMatch((enumdirection_enumaxis) -> {
|
|
- return this.g.b(enumdirection_enumaxis) < 0.0D || this.g.c(enumdirection_enumaxis) > 1.0D;
|
|
- });
|
|
+ boolean result = false;
|
|
+ for (EnumDirection.EnumAxis enumdirection_enumaxis : EnumDirection.EnumAxis.values()) {
|
|
+ if (this.g.b(enumdirection_enumaxis) < 0.0D || this.g.c(enumdirection_enumaxis) > 1.0D) {
|
|
+ result = true;
|
|
+ break;
|
|
+ }
|
|
+ }
|
|
+ this.h = result;
|
|
this.i = new boolean[6];
|
|
EnumDirection[] aenumdirection1 = a; // Paper - decompile fix
|
|
int k = aenumdirection1.length;
|
|
diff --git a/src/main/java/net/minecraft/server/IEntityAccess.java b/src/main/java/net/minecraft/server/IEntityAccess.java
|
|
index 3bc57ef91d557383178533b0cc87a71a521d6b3e..c236d61062ce6e8f9ce817ac29ecb03afebbcd06 100644
|
|
--- a/src/main/java/net/minecraft/server/IEntityAccess.java
|
|
+++ b/src/main/java/net/minecraft/server/IEntityAccess.java
|
|
@@ -27,11 +27,18 @@ public interface IEntityAccess {
|
|
}
|
|
|
|
default boolean a(@Nullable Entity entity, VoxelShape voxelshape) {
|
|
- return voxelshape.isEmpty() ? true : this.getEntities(entity, voxelshape.getBoundingBox()).stream().filter((entity1) -> {
|
|
- return !entity1.dead && entity1.i && (entity == null || !entity1.isSameVehicle(entity));
|
|
- }).noneMatch((entity1) -> {
|
|
- return VoxelShapes.c(voxelshape, VoxelShapes.a(entity1.getBoundingBox()), OperatorBoolean.AND);
|
|
- });
|
|
+ if (voxelshape.isEmpty()) {
|
|
+ return true;
|
|
+ } else {
|
|
+ for (Entity entity1 : this.getEntities(entity, voxelshape.getBoundingBox())) {
|
|
+ if (!entity1.dead && entity1.i && (entity == null || !entity1.isSameVehicle(entity))) {
|
|
+ if (VoxelShapes.c(voxelshape, VoxelShapes.a(entity1.getBoundingBox()), OperatorBoolean.AND)) {
|
|
+ return false;
|
|
+ }
|
|
+ }
|
|
+ }
|
|
+ return true;
|
|
+ }
|
|
}
|
|
|
|
default <T extends Entity> List<T> a(Class<? extends T> oclass, AxisAlignedBB axisalignedbb) {
|
|
diff --git a/src/main/java/net/minecraft/server/IOWorker.java b/src/main/java/net/minecraft/server/IOWorker.java
|
|
index b90baef0f54bdb8f5ee51cdde149f64e39887ef5..1e6da55831d29bdead2ccf1522ea3e84183ff9ec 100644
|
|
--- a/src/main/java/net/minecraft/server/IOWorker.java
|
|
+++ b/src/main/java/net/minecraft/server/IOWorker.java
|
|
@@ -3,9 +3,7 @@ package net.minecraft.server;
|
|
import com.google.common.collect.Maps;
|
|
import com.google.common.collect.Queues;
|
|
import java.io.IOException;
|
|
-import java.util.Iterator;
|
|
-import java.util.Map;
|
|
-import java.util.Queue;
|
|
+import java.util.*;
|
|
import java.util.Map.Entry;
|
|
import java.util.concurrent.CompletableFuture;
|
|
import java.util.concurrent.CompletionException;
|
|
@@ -99,11 +97,12 @@ public class IOWorker implements AutoCloseable {
|
|
public CompletableFuture<Void> a() {
|
|
return this.a((completablefuture) -> {
|
|
return () -> {
|
|
- CompletableFuture<?> completablefuture1 = CompletableFuture.allOf((CompletableFuture[]) this.f.values().stream().map((ioworker_a) -> {
|
|
- return ioworker_a.b;
|
|
- }).toArray((i) -> {
|
|
- return new CompletableFuture[i];
|
|
- }));
|
|
+ List<CompletableFuture<Void>> list = new ArrayList<>();
|
|
+ for (a ioworker_a : this.f.values()) {
|
|
+ CompletableFuture<Void> voidCompletableFuture = ioworker_a.b;
|
|
+ list.add(voidCompletableFuture);
|
|
+ }
|
|
+ CompletableFuture<?> completablefuture1 = CompletableFuture.allOf((CompletableFuture[]) list.toArray(new CompletableFuture[0]));
|
|
|
|
completablefuture1.whenComplete((object, throwable) -> {
|
|
completablefuture.complete(null); // Paper - decompile fix
|
|
@@ -158,7 +157,11 @@ public class IOWorker implements AutoCloseable {
|
|
}
|
|
|
|
private void f() {
|
|
- this.f.forEach(this::a);
|
|
+ for (Entry<ChunkCoordIntPair, a> entry : this.f.entrySet()) {
|
|
+ ChunkCoordIntPair key = entry.getKey();
|
|
+ a value = entry.getValue();
|
|
+ a(key, value);
|
|
+ }
|
|
this.f.clear();
|
|
}
|
|
|
|
diff --git a/src/main/java/net/minecraft/server/InventorySubcontainer.java b/src/main/java/net/minecraft/server/InventorySubcontainer.java
|
|
index 28980aad6cfda81a64194304674fe21a94becbc9..6e14a2cb7b7d73bc45173537f8c6c62adcd0aeb3 100644
|
|
--- a/src/main/java/net/minecraft/server/InventorySubcontainer.java
|
|
+++ b/src/main/java/net/minecraft/server/InventorySubcontainer.java
|
|
@@ -1,6 +1,8 @@
|
|
package net.minecraft.server;
|
|
|
|
import com.google.common.collect.Lists;
|
|
+
|
|
+import java.util.ArrayList;
|
|
import java.util.Iterator;
|
|
import java.util.List;
|
|
import java.util.stream.Collectors;
|
|
@@ -218,9 +220,13 @@ public class InventorySubcontainer implements IInventory, AutoRecipeOutput {
|
|
}
|
|
|
|
public String toString() {
|
|
- return ((List) this.items.stream().filter((itemstack) -> {
|
|
- return !itemstack.isEmpty();
|
|
- }).collect(Collectors.toList())).toString();
|
|
+ List<ItemStack> list = new ArrayList<>();
|
|
+ for (ItemStack itemstack : this.items) {
|
|
+ if (!itemstack.isEmpty()) {
|
|
+ list.add(itemstack);
|
|
+ }
|
|
+ }
|
|
+ return ((List) list).toString();
|
|
}
|
|
|
|
private void b(ItemStack itemstack) {
|
|
diff --git a/src/main/java/net/minecraft/server/ItemCrossbow.java b/src/main/java/net/minecraft/server/ItemCrossbow.java
|
|
index 60a47bccca5bc77039c0bec94eb329b3f2f0937f..548fd7fab98fcebdcf706c334915b9c567241aba 100644
|
|
--- a/src/main/java/net/minecraft/server/ItemCrossbow.java
|
|
+++ b/src/main/java/net/minecraft/server/ItemCrossbow.java
|
|
@@ -187,9 +187,12 @@ public class ItemCrossbow extends ItemProjectileWeapon {
|
|
}
|
|
|
|
private static boolean a(ItemStack itemstack, Item item) {
|
|
- return j(itemstack).stream().anyMatch((itemstack1) -> {
|
|
- return itemstack1.getItem() == item;
|
|
- });
|
|
+ for (ItemStack itemstack1 : j(itemstack)) {
|
|
+ if (itemstack1.getItem() == item) {
|
|
+ return true;
|
|
+ }
|
|
+ }
|
|
+ return false;
|
|
}
|
|
|
|
private static void a(World world, EntityLiving entityliving, EnumHand enumhand, ItemStack itemstack, ItemStack itemstack1, float f, boolean flag, float f1, float f2, float f3) {
|
|
diff --git a/src/main/java/net/minecraft/server/ItemFireworks.java b/src/main/java/net/minecraft/server/ItemFireworks.java
|
|
index bd524a35bb11005adfed12f66465fa8466a155f0..d6a3a5dace76275ad034ea92072f533442686960 100644
|
|
--- a/src/main/java/net/minecraft/server/ItemFireworks.java
|
|
+++ b/src/main/java/net/minecraft/server/ItemFireworks.java
|
|
@@ -1,7 +1,9 @@
|
|
package net.minecraft.server;
|
|
|
|
+import java.util.ArrayList;
|
|
import java.util.Arrays;
|
|
import java.util.Comparator;
|
|
+import java.util.List;
|
|
|
|
public class ItemFireworks extends Item {
|
|
|
|
@@ -58,11 +60,19 @@ public class ItemFireworks extends Item {
|
|
|
|
SMALL_BALL(0, "small_ball"), LARGE_BALL(1, "large_ball"), STAR(2, "star"), CREEPER(3, "creeper"), BURST(4, "burst");
|
|
|
|
- private static final ItemFireworks.EffectType[] f = (ItemFireworks.EffectType[]) Arrays.stream(values()).sorted(Comparator.comparingInt((itemfireworks_effecttype) -> {
|
|
- return itemfireworks_effecttype.g;
|
|
- })).toArray((i) -> {
|
|
- return new ItemFireworks.EffectType[i];
|
|
- });
|
|
+ private static final ItemFireworks.EffectType[] f;
|
|
+
|
|
+ static {
|
|
+ List<EffectType> list = new ArrayList<>();
|
|
+ for (EffectType effectType : values()) {
|
|
+ list.add(effectType);
|
|
+ }
|
|
+ list.sort(Comparator.comparingInt((itemfireworks_effecttype) -> {
|
|
+ return itemfireworks_effecttype.g;
|
|
+ }));
|
|
+ f = (EffectType[]) list.toArray(new EffectType[0]);
|
|
+ }
|
|
+
|
|
private final int g;
|
|
private final String h;
|
|
|
|
diff --git a/src/main/java/net/minecraft/server/ItemStack.java b/src/main/java/net/minecraft/server/ItemStack.java
|
|
index ea60880c6f15b1a39579896d78cf641563621aa4..babe0537e10a131c8f2ea5636e8d0e996943ceb0 100644
|
|
--- a/src/main/java/net/minecraft/server/ItemStack.java
|
|
+++ b/src/main/java/net/minecraft/server/ItemStack.java
|
|
@@ -782,9 +782,10 @@ public final class ItemStack {
|
|
object = this.getItem().a(enumitemslot);
|
|
}
|
|
|
|
- ((Multimap<String, AttributeModifier>) object).values().forEach((attributemodifier1) -> { // CraftBukkit - decompile error
|
|
+ // CraftBukkit - decompile error
|
|
+ for (AttributeModifier attributemodifier1 : ((Multimap<String, AttributeModifier>) object).values()) {
|
|
attributemodifier1.a(false);
|
|
- });
|
|
+ }
|
|
return (Multimap) object;
|
|
}
|
|
|
|
diff --git a/src/main/java/net/minecraft/server/LightEngineThreaded.java b/src/main/java/net/minecraft/server/LightEngineThreaded.java
|
|
index 9ef39f1f51f9960865f6418115b08e8d7de86509..4a24ec468a98fe44ec5931a91881f73232bbb9a2 100644
|
|
--- a/src/main/java/net/minecraft/server/LightEngineThreaded.java
|
|
+++ b/src/main/java/net/minecraft/server/LightEngineThreaded.java
|
|
@@ -288,10 +288,14 @@ public class LightEngineThreaded extends LightEngine implements AutoCloseable {
|
|
int i = Math.min(queue.size(), 4);
|
|
boolean ran = false;
|
|
while (i-- > 0 && queue.poll(pre, post)) {
|
|
- pre.forEach(Runnable::run);
|
|
+ for (Runnable runnable1 : pre) {
|
|
+ runnable1.run();
|
|
+ }
|
|
pre.clear();
|
|
super.a(Integer.MAX_VALUE, true, true);
|
|
- post.forEach(Runnable::run);
|
|
+ for (Runnable runnable : post) {
|
|
+ runnable.run();
|
|
+ }
|
|
post.clear();
|
|
ran = true;
|
|
}
|
|
diff --git a/src/main/java/net/minecraft/server/LootTable.java b/src/main/java/net/minecraft/server/LootTable.java
|
|
index 666bd34eab4847cb698596b59e1c07569bcdb38c..e9ce7f4b26e72863ab92974e36b0f835f340c4c0 100644
|
|
--- a/src/main/java/net/minecraft/server/LootTable.java
|
|
+++ b/src/main/java/net/minecraft/server/LootTable.java
|
|
@@ -9,10 +9,7 @@ import com.google.gson.JsonParseException;
|
|
import com.google.gson.JsonSerializationContext;
|
|
import com.google.gson.JsonSerializer;
|
|
import java.lang.reflect.Type;
|
|
-import java.util.Collections;
|
|
-import java.util.Iterator;
|
|
-import java.util.List;
|
|
-import java.util.Random;
|
|
+import java.util.*;
|
|
import java.util.function.BiFunction;
|
|
import java.util.function.Consumer;
|
|
import org.apache.commons.lang3.ArrayUtils;
|
|
@@ -122,7 +119,12 @@ public class LootTable {
|
|
if (event.isCancelled()) {
|
|
return;
|
|
}
|
|
- list = event.getLoot().stream().map(CraftItemStack::asNMSCopy).collect(Collectors.toList());
|
|
+ List<ItemStack> result = new ArrayList<>();
|
|
+ for (org.bukkit.inventory.ItemStack itemStack : event.getLoot()) {
|
|
+ ItemStack stack = CraftItemStack.asNMSCopy(itemStack);
|
|
+ result.add(stack);
|
|
+ }
|
|
+ list = result;
|
|
// CraftBukkit end
|
|
List<Integer> list1 = this.a(iinventory, random);
|
|
|
|
diff --git a/src/main/java/net/minecraft/server/LootTableRegistry.java b/src/main/java/net/minecraft/server/LootTableRegistry.java
|
|
index 21e683eaa5c13192217d50e5b534494553856232..47a180810c15a9629cb616794aeab62c8173fa73 100644
|
|
--- a/src/main/java/net/minecraft/server/LootTableRegistry.java
|
|
+++ b/src/main/java/net/minecraft/server/LootTableRegistry.java
|
|
@@ -37,16 +37,18 @@ public class LootTableRegistry extends ResourceDataJson {
|
|
LootTableRegistry.LOGGER.warn("Datapack tried to redefine {} loot table, ignoring", LootTables.a);
|
|
}
|
|
|
|
- map.forEach((minecraftkey, jsonobject1) -> {
|
|
+ for (Map.Entry<MinecraftKey, JsonObject> mapEntry : map.entrySet()) {
|
|
+ MinecraftKey k = mapEntry.getKey();
|
|
+ JsonObject jsonobject1 = mapEntry.getValue();
|
|
try {
|
|
- LootTable loottable = (LootTable) LootTableRegistry.b.fromJson(jsonobject1, LootTable.class);
|
|
+ LootTable loottable = LootTableRegistry.b.fromJson(jsonobject1, LootTable.class);
|
|
|
|
- builder.put(minecraftkey, loottable);
|
|
+ builder.put(k, loottable);
|
|
} catch (Exception exception) {
|
|
- LootTableRegistry.LOGGER.error("Couldn't parse loot table {}", minecraftkey, exception);
|
|
+ LootTableRegistry.LOGGER.error("Couldn't parse loot table {}", k, exception);
|
|
}
|
|
|
|
- });
|
|
+ }
|
|
builder.put(LootTables.a, LootTable.EMPTY);
|
|
ImmutableMap<MinecraftKey, LootTable> immutablemap = builder.build();
|
|
LootContextParameterSet lootcontextparameterset = LootContextParameterSets.GENERIC;
|
|
@@ -58,16 +60,23 @@ public class LootTableRegistry extends ResourceDataJson {
|
|
immutablemap.getClass();
|
|
LootCollector lootcollector = new LootCollector(lootcontextparameterset, function, immutablemap::get);
|
|
|
|
- immutablemap.forEach((minecraftkey, loottable) -> {
|
|
+ for (Map.Entry<MinecraftKey, LootTable> e : immutablemap.entrySet()) {
|
|
+ MinecraftKey minecraftkey = e.getKey();
|
|
+ LootTable loottable = e.getValue();
|
|
a(lootcollector, minecraftkey, loottable);
|
|
- });
|
|
+ }
|
|
lootcollector.a().forEach((s, s1) -> {
|
|
LootTableRegistry.LOGGER.warn("Found validation problem in " + s + ": " + s1);
|
|
});
|
|
this.c = immutablemap;
|
|
// CraftBukkit start - build a reversed registry map
|
|
ImmutableMap.Builder<LootTable, MinecraftKey> lootTableToKeyBuilder = ImmutableMap.builder();
|
|
- this.c.forEach((lootTable, key) -> lootTableToKeyBuilder.put(key, lootTable)); // PAIL rename keyToLootTable
|
|
+ // PAIL rename keyToLootTable
|
|
+ for (Map.Entry<MinecraftKey, LootTable> entry : this.c.entrySet()) {
|
|
+ MinecraftKey lootTable = entry.getKey();
|
|
+ LootTable key = entry.getValue();
|
|
+ lootTableToKeyBuilder.put(key, lootTable);
|
|
+ }
|
|
this.lootTableToKey = lootTableToKeyBuilder.build();
|
|
// CraftBukkit end
|
|
}
|
|
diff --git a/src/main/java/net/minecraft/server/MCUtil.java b/src/main/java/net/minecraft/server/MCUtil.java
|
|
index 973bdd25ca45ee6a11803e3abb8c0ff22d658554..b20a4a0edb5f5958361cc4c12bee05849dc2b26c 100644
|
|
--- a/src/main/java/net/minecraft/server/MCUtil.java
|
|
+++ b/src/main/java/net/minecraft/server/MCUtil.java
|
|
@@ -76,7 +76,9 @@ public final class MCUtil {
|
|
|
|
public static <T> Runnable once(List<T> list, Consumer<T> cb) {
|
|
return once(() -> {
|
|
- list.forEach(cb);
|
|
+ for (T t : list) {
|
|
+ cb.accept(t);
|
|
+ }
|
|
});
|
|
}
|
|
|
|
@@ -107,7 +109,9 @@ public final class MCUtil {
|
|
*/
|
|
public static <T> Runnable registerListCleaner(Object obj, List<T> list, Consumer<T> cleaner) {
|
|
return registerCleaner(obj, () -> {
|
|
- list.forEach(cleaner);
|
|
+ for (T t : list) {
|
|
+ cleaner.accept(t);
|
|
+ }
|
|
list.clear();
|
|
});
|
|
}
|
|
@@ -243,7 +247,9 @@ public final class MCUtil {
|
|
all.addAll(set);
|
|
}
|
|
}
|
|
- all.forEach(consumer);
|
|
+ for (T t : all) {
|
|
+ consumer.accept(t);
|
|
+ }
|
|
}
|
|
|
|
private MCUtil() {}
|
|
diff --git a/src/main/java/net/minecraft/server/MinecraftServer.java b/src/main/java/net/minecraft/server/MinecraftServer.java
|
|
index 5b8092be7540362bc8c893f314ea230d333e46e7..eb47c17a50841d07eadb41eeb21b6bc23f143d18 100644
|
|
--- a/src/main/java/net/minecraft/server/MinecraftServer.java
|
|
+++ b/src/main/java/net/minecraft/server/MinecraftServer.java
|
|
@@ -473,7 +473,13 @@ public abstract class MinecraftServer extends IAsyncTaskHandlerReentrant<TickTas
|
|
|
|
// Paper start - Handle collideRule team for player collision toggle
|
|
final Scoreboard scoreboard = this.getScoreboard();
|
|
- final java.util.Collection<String> toRemove = scoreboard.getTeams().stream().filter(team -> team.getName().startsWith("collideRule_")).map(ScoreboardTeam::getName).collect(java.util.stream.Collectors.toList());
|
|
+ final Collection<String> toRemove = new ArrayList<>();
|
|
+ for (ScoreboardTeam team : scoreboard.getTeams()) {
|
|
+ if (team.getName().startsWith("collideRule_")) {
|
|
+ String name = team.getName();
|
|
+ toRemove.add(name);
|
|
+ }
|
|
+ }
|
|
for (String teamName : toRemove) {
|
|
scoreboard.removeTeam(scoreboard.getTeam(teamName)); // Clean up after ourselves
|
|
}
|
|
@@ -1735,7 +1741,9 @@ public abstract class MinecraftServer extends IAsyncTaskHandlerReentrant<TickTas
|
|
}
|
|
}
|
|
|
|
- this.getPlayerList().getPlayers().forEach(this::a);
|
|
+ for (EntityPlayer entityPlayer : this.getPlayerList().getPlayers()) {
|
|
+ a(entityPlayer);
|
|
+ }
|
|
}
|
|
|
|
public void d(boolean flag) {
|
|
@@ -1748,7 +1756,9 @@ public abstract class MinecraftServer extends IAsyncTaskHandlerReentrant<TickTas
|
|
worlddata.e(flag);
|
|
}
|
|
|
|
- this.getPlayerList().getPlayers().forEach(this::a);
|
|
+ for (EntityPlayer entityPlayer : this.getPlayerList().getPlayers()) {
|
|
+ a(entityPlayer);
|
|
+ }
|
|
}
|
|
|
|
private void a(EntityPlayer entityplayer) {
|
|
@@ -2055,9 +2065,9 @@ public abstract class MinecraftServer extends IAsyncTaskHandlerReentrant<TickTas
|
|
this.resourcePackRepository.a((Collection) list);
|
|
List<IResourcePack> list1 = Lists.newArrayList();
|
|
|
|
- this.resourcePackRepository.d().forEach((resourcepackloader1) -> {
|
|
- list1.add(resourcepackloader1.d());
|
|
- });
|
|
+ for (ResourcePackLoader packLoader : this.resourcePackRepository.d()) {
|
|
+ list1.add(packLoader.d());
|
|
+ }
|
|
CompletableFuture<Unit> completablefuture = this.ae.a(this.executorService, this, list1, MinecraftServer.i);
|
|
|
|
this.awaitTasks(completablefuture::isDone);
|
|
@@ -2070,15 +2080,15 @@ public abstract class MinecraftServer extends IAsyncTaskHandlerReentrant<TickTas
|
|
|
|
worlddata.O().clear();
|
|
worlddata.N().clear();
|
|
- this.resourcePackRepository.d().forEach((resourcepackloader1) -> {
|
|
- worlddata.O().add(resourcepackloader1.e());
|
|
- });
|
|
- this.resourcePackRepository.b().forEach((resourcepackloader1) -> {
|
|
+ for (ResourcePackLoader resourcePackLoader : this.resourcePackRepository.d()) {
|
|
+ worlddata.O().add(resourcePackLoader.e());
|
|
+ }
|
|
+ for (ResourcePackLoader resourcepackloader1 : this.resourcePackRepository.b()) {
|
|
if (!this.resourcePackRepository.d().contains(resourcepackloader1)) {
|
|
worlddata.N().add(resourcepackloader1.e());
|
|
}
|
|
|
|
- });
|
|
+ }
|
|
}
|
|
|
|
public void a(CommandListenerWrapper commandlistenerwrapper) {
|
|
@@ -2389,7 +2399,9 @@ public abstract class MinecraftServer extends IAsyncTaskHandlerReentrant<TickTas
|
|
}
|
|
|
|
private void bb() {
|
|
- Block.REGISTRY_ID.forEach(IBlockData::c);
|
|
+ for (IBlockData iBlockData : Block.REGISTRY_ID) {
|
|
+ iBlockData.c();
|
|
+ }
|
|
}
|
|
|
|
// CraftBukkit start
|
|
diff --git a/src/main/java/net/minecraft/server/NameReferencingFileConverter.java b/src/main/java/net/minecraft/server/NameReferencingFileConverter.java
|
|
index d3c2e1bedfde39c19fe293941036641ea72c1bcd..aacc2f0052629169be551e44c3ef474f2c11533c 100644
|
|
--- a/src/main/java/net/minecraft/server/NameReferencingFileConverter.java
|
|
+++ b/src/main/java/net/minecraft/server/NameReferencingFileConverter.java
|
|
@@ -52,11 +52,13 @@ public class NameReferencingFileConverter {
|
|
}
|
|
|
|
private static void a(MinecraftServer minecraftserver, Collection<String> collection, ProfileLookupCallback profilelookupcallback) {
|
|
- String[] astring = (String[]) collection.stream().filter((s) -> {
|
|
- return !UtilColor.b(s);
|
|
- }).toArray((i) -> {
|
|
- return new String[i];
|
|
- });
|
|
+ List<String> list = new ArrayList<>();
|
|
+ for (String s1 : collection) {
|
|
+ if (!UtilColor.b(s1)) {
|
|
+ list.add(s1);
|
|
+ }
|
|
+ }
|
|
+ String[] astring = (String[]) list.toArray(new String[0]);
|
|
|
|
if (minecraftserver.getOnlineMode()
|
|
|| (com.destroystokyo.paper.PaperConfig.isProxyOnlineMode())) { // Spigot: bungee = online mode, for now. // Paper - Handle via setting
|
|
diff --git a/src/main/java/net/minecraft/server/NetworkManager.java b/src/main/java/net/minecraft/server/NetworkManager.java
|
|
index 5b20eb32cbd70d3c2befd0fcaea5b9f3faf087d5..84e0ec2c194648da0a9c1e62f2e21d242ad2398b 100644
|
|
--- a/src/main/java/net/minecraft/server/NetworkManager.java
|
|
+++ b/src/main/java/net/minecraft/server/NetworkManager.java
|
|
@@ -442,12 +442,12 @@ public class NetworkManager extends SimpleChannelInboundHandler<Packet<?>> {
|
|
// Paper start
|
|
public void clearPacketQueue() {
|
|
EntityPlayer player = getPlayer();
|
|
- packetQueue.forEach(queuedPacket -> {
|
|
+ for (QueuedPacket queuedPacket : packetQueue) {
|
|
Packet<?> packet = queuedPacket.getPacket();
|
|
if (packet.hasFinishListener()) {
|
|
packet.onPacketDispatchFinish(player, null);
|
|
}
|
|
- });
|
|
+ }
|
|
packetQueue.clear();
|
|
} // Paper end
|
|
public void close(IChatBaseComponent ichatbasecomponent) {
|
|
diff --git a/src/main/java/net/minecraft/server/PathfinderGoalSelector.java b/src/main/java/net/minecraft/server/PathfinderGoalSelector.java
|
|
index f49fc9c8f24e0b1f0dc11a213605a3e91f4f66a9..8d525009dc80f43b032b57f194e57be25db2ec5e 100644
|
|
--- a/src/main/java/net/minecraft/server/PathfinderGoalSelector.java
|
|
+++ b/src/main/java/net/minecraft/server/PathfinderGoalSelector.java
|
|
@@ -91,12 +91,14 @@ public class PathfinderGoalSelector {
|
|
wrappedGoal.d();
|
|
}
|
|
// Paper end - remove streams from pathfindergoalselector
|
|
- this.c.forEach((pathfindergoal_type, pathfindergoalwrapped) -> {
|
|
+ for (Map.Entry<PathfinderGoal.Type, PathfinderGoalWrapped> entry : this.c.entrySet()) {
|
|
+ PathfinderGoal.Type pathfindergoal_type = entry.getKey();
|
|
+ PathfinderGoalWrapped pathfindergoalwrapped = entry.getValue();
|
|
if (!pathfindergoalwrapped.g()) {
|
|
this.c.remove(pathfindergoal_type);
|
|
}
|
|
|
|
- });
|
|
+ }
|
|
//this.e.exit(); // Akarin - remove caller
|
|
//this.e.enter("goalUpdate"); // Akarin - remove caller
|
|
// Paper start - remove streams from pathfindergoalselector
|
|
diff --git a/src/main/java/net/minecraft/server/PlayerChunk.java b/src/main/java/net/minecraft/server/PlayerChunk.java
|
|
index 44d6f2debc767cb0576b17ed3e0711baa4361001..e7bfefafb70df7cca594db433a83e73e743629e5 100644
|
|
--- a/src/main/java/net/minecraft/server/PlayerChunk.java
|
|
+++ b/src/main/java/net/minecraft/server/PlayerChunk.java
|
|
@@ -2,6 +2,7 @@ package net.minecraft.server;
|
|
|
|
import com.mojang.datafixers.util.Either;
|
|
import java.util.List;
|
|
+import java.util.Map;
|
|
import java.util.Optional;
|
|
import java.util.concurrent.CompletableFuture;
|
|
import java.util.concurrent.atomic.AtomicReferenceArray;
|
|
@@ -757,7 +758,11 @@ public class PlayerChunk {
|
|
if (getCurrentPriority() != priority) {
|
|
this.w.a(this.location, this::getCurrentPriority, priority, this::setPriority); // use preferred priority
|
|
int neighborsPriority = getNeighborsPriority();
|
|
- this.neighbors.forEach((neighbor, neighborDesired) -> neighbor.setNeighborPriority(this, neighborsPriority));
|
|
+ for (Map.Entry<PlayerChunk, ChunkStatus> entry : this.neighbors.entrySet()) {
|
|
+ PlayerChunk neighbor = entry.getKey();
|
|
+ ChunkStatus neighborDesired = entry.getValue();
|
|
+ neighbor.setNeighborPriority(this, neighborsPriority);
|
|
+ }
|
|
}
|
|
// Paper end
|
|
this.oldTicketLevel = this.ticketLevel;
|
|
diff --git a/src/main/java/net/minecraft/server/PlayerChunkMap.java b/src/main/java/net/minecraft/server/PlayerChunkMap.java
|
|
index 0b2209551ff369e8e189e0b017b4ac55091e87d8..3140ac452e7acda8a21fee9d000e43cbd19dd4a7 100644
|
|
--- a/src/main/java/net/minecraft/server/PlayerChunkMap.java
|
|
+++ b/src/main/java/net/minecraft/server/PlayerChunkMap.java
|
|
@@ -474,53 +474,53 @@ public class PlayerChunkMap extends IChunkLoader implements PlayerChunk.d {
|
|
double playerChunkZ = MathHelper.floor(player.locZ()) >> 4;
|
|
pos.setValues(player.locX(), 0, player.locZ());
|
|
double twoThirdModifier = 2D / 3D;
|
|
- MCUtil.getSpiralOutChunks(pos, Math.min(6, viewDistance)).forEach(coord -> {
|
|
- if (shouldSkipPrioritization(coord)) return;
|
|
+ for (ChunkCoordIntPair coordIntPair : MCUtil.getSpiralOutChunks(pos, Math.min(6, viewDistance))) {
|
|
+ if (shouldSkipPrioritization(coordIntPair)) continue;
|
|
|
|
- double dist = MCUtil.distance(playerChunkX, 0, playerChunkZ, coord.x, 0, coord.z);
|
|
+ double dist = MCUtil.distance(playerChunkX, 0, playerChunkZ, coordIntPair.x, 0, coordIntPair.z);
|
|
// Prioritize immediate
|
|
if (dist <= 4 * 4) {
|
|
- updateChunkPriorityMap(priorities, coord.pair(), (int) (27 - Math.sqrt(dist)));
|
|
- return;
|
|
+ updateChunkPriorityMap(priorities, coordIntPair.pair(), (int) (27 - Math.sqrt(dist)));
|
|
+ continue;
|
|
}
|
|
|
|
// Prioritize nearby chunks
|
|
- updateChunkPriorityMap(priorities, coord.pair(), (int) (20 - Math.sqrt(dist) * twoThirdModifier));
|
|
- });
|
|
+ updateChunkPriorityMap(priorities, coordIntPair.pair(), (int) (20 - Math.sqrt(dist) * twoThirdModifier));
|
|
+ }
|
|
|
|
// Prioritize Frustum near 3
|
|
ChunkCoordIntPair front3 = player.getChunkInFront(3);
|
|
pos.setValues(front3.x << 4, 0, front3.z << 4);
|
|
- MCUtil.getSpiralOutChunks(pos, Math.min(5, viewDistance)).forEach(coord -> {
|
|
- if (shouldSkipPrioritization(coord)) return;
|
|
+ for (ChunkCoordIntPair chunkCoordIntPair : MCUtil.getSpiralOutChunks(pos, Math.min(5, viewDistance))) {
|
|
+ if (shouldSkipPrioritization(chunkCoordIntPair)) continue;
|
|
|
|
- double dist = MCUtil.distance(playerChunkX, 0, playerChunkZ, coord.x, 0, coord.z);
|
|
- updateChunkPriorityMap(priorities, coord.pair(), (int) (25 - Math.sqrt(dist) * twoThirdModifier));
|
|
- });
|
|
+ double dist = MCUtil.distance(playerChunkX, 0, playerChunkZ, chunkCoordIntPair.x, 0, chunkCoordIntPair.z);
|
|
+ updateChunkPriorityMap(priorities, chunkCoordIntPair.pair(), (int) (25 - Math.sqrt(dist) * twoThirdModifier));
|
|
+ }
|
|
|
|
// Prioritize Frustum near 5
|
|
if (viewDistance > 4) {
|
|
ChunkCoordIntPair front5 = player.getChunkInFront(5);
|
|
pos.setValues(front5.x << 4, 0, front5.z << 4);
|
|
- MCUtil.getSpiralOutChunks(pos, 4).forEach(coord -> {
|
|
- if (shouldSkipPrioritization(coord)) return;
|
|
+ for (ChunkCoordIntPair coord : MCUtil.getSpiralOutChunks(pos, 4)) {
|
|
+ if (shouldSkipPrioritization(coord)) continue;
|
|
|
|
double dist = MCUtil.distance(playerChunkX, 0, playerChunkZ, coord.x, 0, coord.z);
|
|
updateChunkPriorityMap(priorities, coord.pair(), (int) (25 - Math.sqrt(dist) * twoThirdModifier));
|
|
- });
|
|
+ }
|
|
}
|
|
|
|
// Prioritize Frustum far 7
|
|
if (viewDistance > 6) {
|
|
ChunkCoordIntPair front7 = player.getChunkInFront(7);
|
|
pos.setValues(front7.x << 4, 0, front7.z << 4);
|
|
- MCUtil.getSpiralOutChunks(pos, 3).forEach(coord -> {
|
|
+ for (ChunkCoordIntPair coord : MCUtil.getSpiralOutChunks(pos, 3)) {
|
|
if (shouldSkipPrioritization(coord)) {
|
|
- return;
|
|
+ continue;
|
|
}
|
|
double dist = MCUtil.distance(playerChunkX, 0, playerChunkZ, coord.x, 0, coord.z);
|
|
updateChunkPriorityMap(priorities, coord.pair(), (int) (25 - Math.sqrt(dist) * twoThirdModifier));
|
|
- });
|
|
+ }
|
|
}
|
|
|
|
pos.close();
|
|
@@ -846,7 +846,14 @@ public class PlayerChunkMap extends IChunkLoader implements PlayerChunk.d {
|
|
protected void save(boolean flag) {
|
|
Long2ObjectLinkedOpenHashMap<PlayerChunk> visibleChunks = this.getVisibleChunks(); // Paper remove clone of visible Chunks unless saving off main thread (watchdog kill)
|
|
if (flag) {
|
|
- List<PlayerChunk> list = (List) visibleChunks.values().stream().filter(PlayerChunk::hasBeenLoaded).peek(PlayerChunk::m).collect(Collectors.toList()); // Paper - remove cloning of visible chunks
|
|
+ List<PlayerChunk> result = new ArrayList<>();
|
|
+ for (PlayerChunk playerChunk : visibleChunks.values()) {
|
|
+ if (playerChunk.hasBeenLoaded()) {
|
|
+ playerChunk.m();
|
|
+ result.add(playerChunk);
|
|
+ }
|
|
+ }
|
|
+ List<PlayerChunk> list = (List) result; // Paper - remove cloning of visible chunks
|
|
MutableBoolean mutableboolean = new MutableBoolean();
|
|
|
|
do {
|
|
@@ -875,15 +882,17 @@ public class PlayerChunkMap extends IChunkLoader implements PlayerChunk.d {
|
|
// this.i(); // Paper - nuke IOWorker
|
|
PlayerChunkMap.LOGGER.info("ThreadedAnvilChunkStorage ({}): All chunks are saved", this.w.getName());
|
|
} else {
|
|
- visibleChunks.values().stream().filter(PlayerChunk::hasBeenLoaded).forEach((playerchunk) -> {
|
|
- IChunkAccess ichunkaccess = (IChunkAccess) playerchunk.getChunkSave().getNow(null); // CraftBukkit - decompile error
|
|
+ for (PlayerChunk playerchunk : visibleChunks.values()) {
|
|
+ if (playerchunk.hasBeenLoaded()) {
|
|
+ IChunkAccess ichunkaccess = playerchunk.getChunkSave().getNow(null); // CraftBukkit - decompile error
|
|
|
|
- if (ichunkaccess instanceof ProtoChunkExtension || ichunkaccess instanceof Chunk) {
|
|
- this.saveChunk(ichunkaccess);
|
|
- playerchunk.m();
|
|
- }
|
|
+ if (ichunkaccess instanceof ProtoChunkExtension || ichunkaccess instanceof Chunk) {
|
|
+ this.saveChunk(ichunkaccess);
|
|
+ playerchunk.m();
|
|
+ }
|
|
|
|
- });
|
|
+ }
|
|
+ }
|
|
}
|
|
|
|
}
|
|
@@ -973,8 +982,17 @@ public class PlayerChunkMap extends IChunkLoader implements PlayerChunk.d {
|
|
return;
|
|
}
|
|
|
|
- if (chunkstatus == ChunkStatus.EMPTY && chunk.h().values().stream().noneMatch(StructureStart::e)) {
|
|
- return;
|
|
+ if (chunkstatus == ChunkStatus.EMPTY) {
|
|
+ boolean result = true;
|
|
+ for (StructureStart structureStart : chunk.h().values()) {
|
|
+ if (structureStart.e()) {
|
|
+ result = false;
|
|
+ break;
|
|
+ }
|
|
+ }
|
|
+ if (result) {
|
|
+ return;
|
|
+ }
|
|
}
|
|
} catch (IOException ex) {
|
|
ex.printStackTrace();
|
|
@@ -1123,7 +1141,9 @@ public class PlayerChunkMap extends IChunkLoader implements PlayerChunk.d {
|
|
}
|
|
|
|
this.getVillagePlace().loadInData(chunkcoordintpair, chunkHolder.poiData);
|
|
- chunkHolder.tasks.forEach(Runnable::run);
|
|
+ for (Runnable task : chunkHolder.tasks) {
|
|
+ task.run();
|
|
+ }
|
|
// Paper - async load completes this
|
|
// Paper end
|
|
|
|
@@ -1303,7 +1323,9 @@ public class PlayerChunkMap extends IChunkLoader implements PlayerChunk.d {
|
|
}
|
|
|
|
if (list != null) {
|
|
- list.forEach(chunk::b);
|
|
+ for (Entity entity : list) {
|
|
+ chunk.b(entity);
|
|
+ }
|
|
}
|
|
}
|
|
|
|
@@ -1427,8 +1449,17 @@ public class PlayerChunkMap extends IChunkLoader implements PlayerChunk.d {
|
|
return false;
|
|
}
|
|
|
|
- if (chunkstatus == ChunkStatus.EMPTY && ichunkaccess.h().values().stream().noneMatch(StructureStart::e)) {
|
|
- return false;
|
|
+ if (chunkstatus == ChunkStatus.EMPTY) {
|
|
+ boolean result = true;
|
|
+ for (StructureStart structureStart : ichunkaccess.h().values()) {
|
|
+ if (structureStart.e()) {
|
|
+ result = false;
|
|
+ break;
|
|
+ }
|
|
+ }
|
|
+ if (result) {
|
|
+ return false;
|
|
+ }
|
|
}
|
|
}
|
|
|
|
@@ -1536,7 +1567,12 @@ public class PlayerChunkMap extends IChunkLoader implements PlayerChunk.d {
|
|
|
|
// CraftBukkit - decompile error
|
|
csvwriter.a(chunkcoordintpair.x, chunkcoordintpair.z, playerchunk.getTicketLevel(), optional.isPresent(), optional.map(IChunkAccess::getChunkStatus).orElse(null), optional1.map(Chunk::getState).orElse(null), a(playerchunk.c()), a(playerchunk.a()), a(playerchunk.b()), this.chunkDistanceManager.c(entry.getLongKey()), !this.isOutsideOfRange(chunkcoordintpair), optional1.map((chunk) -> {
|
|
- return Stream.of(chunk.getEntitySlices()).mapToInt(List::size).sum(); // Spigot
|
|
+ int sum = 0;
|
|
+ for (List<Entity> entities : chunk.getEntitySlices()) {
|
|
+ int size = entities.size();
|
|
+ sum += size;
|
|
+ }
|
|
+ return sum; // Spigot
|
|
}).orElse(0), optional1.map((chunk) -> {
|
|
return chunk.getTileEntities().size();
|
|
}).orElse(0));
|
|
diff --git a/src/main/java/net/minecraft/server/PlayerConnection.java b/src/main/java/net/minecraft/server/PlayerConnection.java
|
|
index e9229a42d1c5a60f7cd40aa2233a7c55d9700670..24d31d95cefffc26f8e4d4d2793340a580fbebb5 100644
|
|
--- a/src/main/java/net/minecraft/server/PlayerConnection.java
|
|
+++ b/src/main/java/net/minecraft/server/PlayerConnection.java
|
|
@@ -603,7 +603,9 @@ public class PlayerConnection implements PacketListenerPlayIn {
|
|
com.mojang.brigadier.suggestion.SuggestionsBuilder builder = new com.mojang.brigadier.suggestion.SuggestionsBuilder(packetplayintabcomplete.c(), stringreader.getTotalLength());
|
|
|
|
builder = builder.createOffset(builder.getInput().lastIndexOf(' ') + 1);
|
|
- completions.forEach(builder::suggest);
|
|
+ for (String completion : completions) {
|
|
+ builder.suggest(completion);
|
|
+ }
|
|
Suggestions suggestions = builder.buildFuture().join();
|
|
com.destroystokyo.paper.event.brigadier.AsyncPlayerSendSuggestionsEvent suggestEvent = new com.destroystokyo.paper.event.brigadier.AsyncPlayerSendSuggestionsEvent(this.getPlayer(), suggestions, buffer);
|
|
suggestEvent.setCancelled(suggestions.isEmpty());
|
|
diff --git a/src/main/java/net/minecraft/server/PortalTravelAgent.java b/src/main/java/net/minecraft/server/PortalTravelAgent.java
|
|
index f84dd6d9bec4c0f2f741bab20a4f45884594da2d..3ee5d4023ecc37aaf8dfd3fc9cd8981f6a36abef 100644
|
|
--- a/src/main/java/net/minecraft/server/PortalTravelAgent.java
|
|
+++ b/src/main/java/net/minecraft/server/PortalTravelAgent.java
|
|
@@ -57,11 +57,20 @@ public class PortalTravelAgent {
|
|
List<VillagePlaceRecord> list = (List) villageplace.b((villageplacetype) -> {
|
|
return villageplacetype == VillagePlaceType.u;
|
|
}, blockposition, searchRadius, VillagePlace.Occupancy.ANY).collect(Collectors.toList()); // CraftBukkit - searchRadius
|
|
- Optional<VillagePlaceRecord> optional = list.stream().min(Comparator.<VillagePlaceRecord>comparingDouble((villageplacerecord) -> { // CraftBukkit - decompile error
|
|
+ boolean seen = false;
|
|
+ VillagePlaceRecord best = null;
|
|
+ Comparator<VillagePlaceRecord> comparator = Comparator.<VillagePlaceRecord>comparingDouble((villageplacerecord) -> { // CraftBukkit - decompile error
|
|
return villageplacerecord.f().m(blockposition);
|
|
}).thenComparingInt((villageplacerecord) -> {
|
|
return villageplacerecord.f().getY();
|
|
- }));
|
|
+ });
|
|
+ for (VillagePlaceRecord villagePlaceRecord : list) {
|
|
+ if (!seen || comparator.compare(villagePlaceRecord, best) < 0) {
|
|
+ seen = true;
|
|
+ best = villagePlaceRecord;
|
|
+ }
|
|
+ }
|
|
+ Optional<VillagePlaceRecord> optional = seen ? Optional.of(best) : Optional.empty();
|
|
|
|
return (ShapeDetector.Shape) optional.map((villageplacerecord) -> {
|
|
BlockPosition blockposition1 = villageplacerecord.f();
|
|
diff --git a/src/main/java/net/minecraft/server/Raid.java b/src/main/java/net/minecraft/server/Raid.java
|
|
index 85c22da5c893100c2fb580c1e96c32e1f7b6a0d6..af70fa87e731766963939d0c7f07e04a1ed2b3e3 100644
|
|
--- a/src/main/java/net/minecraft/server/Raid.java
|
|
+++ b/src/main/java/net/minecraft/server/Raid.java
|
|
@@ -569,7 +569,12 @@ public class Raid {
|
|
}
|
|
|
|
public int r() {
|
|
- return this.raiders.values().stream().mapToInt(Set::size).sum();
|
|
+ int sum = 0;
|
|
+ for (Set<EntityRaider> entityRaiders : this.raiders.values()) {
|
|
+ int size = entityRaiders.size();
|
|
+ sum += size;
|
|
+ }
|
|
+ return sum;
|
|
}
|
|
|
|
public void a(EntityRaider entityraider, boolean flag) {
|
|
@@ -785,7 +790,13 @@ public class Raid {
|
|
|
|
// CraftBukkit start - a method to get all raiders
|
|
public java.util.Collection<EntityRaider> getRaiders() {
|
|
- return this.raiders.values().stream().flatMap(Set::stream).collect(java.util.stream.Collectors.toSet());
|
|
+ Set<EntityRaider> set = new HashSet<>();
|
|
+ for (Set<EntityRaider> entityRaiders : this.raiders.values()) {
|
|
+ for (EntityRaider entityRaider : entityRaiders) {
|
|
+ set.add(entityRaider);
|
|
+ }
|
|
+ }
|
|
+ return set;
|
|
}
|
|
// CraftBukkit end
|
|
|
|
diff --git a/src/main/java/net/minecraft/server/RecipeItemStack.java b/src/main/java/net/minecraft/server/RecipeItemStack.java
|
|
index e339310dd19fd1502b1d8bc095b4aafd2ab0af43..dc90753f13663f1706787b949d0888ac1149d8c2 100644
|
|
--- a/src/main/java/net/minecraft/server/RecipeItemStack.java
|
|
+++ b/src/main/java/net/minecraft/server/RecipeItemStack.java
|
|
@@ -9,11 +9,8 @@ import com.google.gson.JsonSyntaxException;
|
|
import it.unimi.dsi.fastutil.ints.IntArrayList;
|
|
import it.unimi.dsi.fastutil.ints.IntComparators;
|
|
import it.unimi.dsi.fastutil.ints.IntList;
|
|
-import java.util.Arrays;
|
|
-import java.util.Collection;
|
|
-import java.util.Collections;
|
|
-import java.util.Iterator;
|
|
-import java.util.List;
|
|
+
|
|
+import java.util.*;
|
|
import java.util.function.Predicate;
|
|
import java.util.stream.Stream;
|
|
import java.util.stream.StreamSupport;
|
|
@@ -22,7 +19,12 @@ import javax.annotation.Nullable;
|
|
public final class RecipeItemStack implements Predicate<ItemStack> {
|
|
|
|
private static final Predicate<? super RecipeItemStack.Provider> b = (recipeitemstack_provider) -> {
|
|
- return !recipeitemstack_provider.a().stream().allMatch(ItemStack::isEmpty);
|
|
+ for (ItemStack itemStack : recipeitemstack_provider.a()) {
|
|
+ if (!itemStack.isEmpty()) {
|
|
+ return true;
|
|
+ }
|
|
+ }
|
|
+ return false;
|
|
};
|
|
public static final RecipeItemStack a = new RecipeItemStack(Stream.empty());
|
|
private final RecipeItemStack.Provider[] c;
|
|
@@ -38,11 +40,16 @@ public final class RecipeItemStack implements Predicate<ItemStack> {
|
|
|
|
public void buildChoices() {
|
|
if (this.choices == null) {
|
|
- this.choices = (ItemStack[]) Arrays.stream(this.c).flatMap((recipeitemstack_provider) -> {
|
|
- return recipeitemstack_provider.a().stream();
|
|
- }).distinct().toArray((i) -> {
|
|
- return new ItemStack[i];
|
|
- });
|
|
+ List<ItemStack> list = new ArrayList<>();
|
|
+ Set<ItemStack> uniqueValues = new HashSet<>();
|
|
+ for (Provider recipeitemstack_provider : this.c) {
|
|
+ for (ItemStack itemStack : recipeitemstack_provider.a()) {
|
|
+ if (uniqueValues.add(itemStack)) {
|
|
+ list.add(itemStack);
|
|
+ }
|
|
+ }
|
|
+ }
|
|
+ this.choices = (ItemStack[]) list.toArray(new ItemStack[0]);
|
|
}
|
|
|
|
}
|
|
diff --git a/src/main/java/net/minecraft/server/RemoteStatusListener.java b/src/main/java/net/minecraft/server/RemoteStatusListener.java
|
|
index d5025938473d3585e83994e890f742cf26c8061e..b67e5e2ef1964a7126a7b879e37f033f40f3f744 100644
|
|
--- a/src/main/java/net/minecraft/server/RemoteStatusListener.java
|
|
+++ b/src/main/java/net/minecraft/server/RemoteStatusListener.java
|
|
@@ -1,6 +1,9 @@
|
|
package net.minecraft.server;
|
|
|
|
+import com.destroystokyo.paper.event.server.GS4QueryEvent;
|
|
import com.google.common.collect.Maps;
|
|
+import org.bukkit.plugin.Plugin;
|
|
+
|
|
import java.io.IOException;
|
|
import java.net.DatagramPacket;
|
|
import java.net.DatagramSocket;
|
|
@@ -11,10 +14,7 @@ import java.net.SocketException;
|
|
import java.net.SocketTimeoutException;
|
|
import java.net.UnknownHostException;
|
|
import java.nio.charset.StandardCharsets;
|
|
-import java.util.Date;
|
|
-import java.util.Iterator;
|
|
-import java.util.Map;
|
|
-import java.util.Random;
|
|
+import java.util.*;
|
|
import java.util.Map.Entry;
|
|
|
|
public class RemoteStatusListener extends RemoteConnectionThread {
|
|
@@ -201,9 +201,12 @@ public class RemoteStatusListener extends RemoteConnectionThread {
|
|
java.util.List<com.destroystokyo.paper.event.server.GS4QueryEvent.QueryResponse.PluginInformation> plugins = java.util.Collections.emptyList();
|
|
org.bukkit.plugin.Plugin[] bukkitPlugins;
|
|
if(((DedicatedServer) this.getServer()).server.getQueryPlugins() && (bukkitPlugins = org.bukkit.Bukkit.getPluginManager().getPlugins()).length > 0) {
|
|
- plugins = java.util.stream.Stream.of(bukkitPlugins)
|
|
- .map(plugin -> com.destroystokyo.paper.event.server.GS4QueryEvent.QueryResponse.PluginInformation.of(plugin.getName(), plugin.getDescription().getVersion()))
|
|
- .collect(java.util.stream.Collectors.toList());
|
|
+ List<GS4QueryEvent.QueryResponse.PluginInformation> list = new ArrayList<>();
|
|
+ for (Plugin plugin : bukkitPlugins) {
|
|
+ GS4QueryEvent.QueryResponse.PluginInformation of = GS4QueryEvent.QueryResponse.PluginInformation.of(plugin.getName(), plugin.getDescription().getVersion());
|
|
+ list.add(of);
|
|
+ }
|
|
+ plugins = list;
|
|
}
|
|
|
|
com.destroystokyo.paper.event.server.GS4QueryEvent.QueryResponse queryResponse = com.destroystokyo.paper.event.server.GS4QueryEvent.QueryResponse.builder()
|
|
@@ -266,7 +269,10 @@ public class RemoteStatusListener extends RemoteConnectionThread {
|
|
this.getCachedFullResponse().writeString("player_");
|
|
this.getCachedFullResponse().writeInt(0);
|
|
// "Meaningless data" end
|
|
- queryResponse.getPlayers().forEach(this.getCachedFullResponse()::writeStringUnchecked);
|
|
+ RemoteStatusReply remoteStatusReply = this.getCachedFullResponse();
|
|
+ for (String s1 : queryResponse.getPlayers()) {
|
|
+ remoteStatusReply.writeStringUnchecked(s1);
|
|
+ }
|
|
this.getCachedFullResponse().writeInt(0);
|
|
// Paper end
|
|
return this.v.a();
|
|
diff --git a/src/main/java/net/minecraft/server/Reputation.java b/src/main/java/net/minecraft/server/Reputation.java
|
|
index 4ae31599664ee8478ca1acf68f7253eb02eb45ed..27091eb3aadbde4291d517491caf55fff6b48a1f 100644
|
|
--- a/src/main/java/net/minecraft/server/Reputation.java
|
|
+++ b/src/main/java/net/minecraft/server/Reputation.java
|
|
@@ -87,14 +87,14 @@ public class Reputation {
|
|
public void a(Reputation reputation, Random random, int i) {
|
|
Collection<Reputation.b> collection = reputation.a(random, i);
|
|
|
|
- collection.forEach((reputation_b) -> {
|
|
+ for (b reputation_b : collection) {
|
|
int j = reputation_b.c - reputation_b.b.j;
|
|
|
|
if (j >= 2) {
|
|
this.a(reputation_b.a).a.mergeInt(reputation_b.b, j, Reputation::a);
|
|
}
|
|
|
|
- });
|
|
+ }
|
|
}
|
|
|
|
public int a(UUID uuid, Predicate<ReputationType> predicate) {
|
|
@@ -147,11 +147,14 @@ public class Reputation {
|
|
}
|
|
|
|
public int a(Predicate<ReputationType> predicate) {
|
|
- return this.a.object2IntEntrySet().stream().filter((it_unimi_dsi_fastutil_objects_object2intmap_entry) -> {
|
|
- return predicate.test(it_unimi_dsi_fastutil_objects_object2intmap_entry.getKey());
|
|
- }).mapToInt((it_unimi_dsi_fastutil_objects_object2intmap_entry) -> {
|
|
- return it_unimi_dsi_fastutil_objects_object2intmap_entry.getIntValue() * ((ReputationType) it_unimi_dsi_fastutil_objects_object2intmap_entry.getKey()).g;
|
|
- }).sum();
|
|
+ int sum = 0;
|
|
+ for (Object2IntMap.Entry<ReputationType> it_unimi_dsi_fastutil_objects_object2intmap_entry : this.a.object2IntEntrySet()) {
|
|
+ if (predicate.test(it_unimi_dsi_fastutil_objects_object2intmap_entry.getKey())) {
|
|
+ int i = it_unimi_dsi_fastutil_objects_object2intmap_entry.getIntValue() * it_unimi_dsi_fastutil_objects_object2intmap_entry.getKey().g;
|
|
+ sum += i;
|
|
+ }
|
|
+ }
|
|
+ return sum;
|
|
}
|
|
|
|
public Stream<Reputation.b> a(UUID uuid) {
|
|
diff --git a/src/main/java/net/minecraft/server/ServerGUI.java b/src/main/java/net/minecraft/server/ServerGUI.java
|
|
index 470009fe4c46fdf3e31374ab576be823f6423193..9e40b07e28d992b7efccf9900997cc7e53663dd2 100644
|
|
--- a/src/main/java/net/minecraft/server/ServerGUI.java
|
|
+++ b/src/main/java/net/minecraft/server/ServerGUI.java
|
|
@@ -156,7 +156,9 @@ public class ServerGUI extends JComponent {
|
|
}
|
|
|
|
private void f() {
|
|
- this.e.forEach(Runnable::run);
|
|
+ for (Runnable runnable : this.e) {
|
|
+ runnable.run();
|
|
+ }
|
|
}
|
|
|
|
private static final java.util.regex.Pattern ANSI = java.util.regex.Pattern.compile("\\x1B\\[([0-9]{1,2}(;[0-9]{1,2})*)?[m|K]"); // CraftBukkit
|
|
diff --git a/src/main/java/net/minecraft/server/SystemUtils.java b/src/main/java/net/minecraft/server/SystemUtils.java
|
|
index aa399e7f6518ff70f2214161319170b1fc911751..a98a50923aae9c4f6c9c0f3d938e44d64f7cf77f 100644
|
|
--- a/src/main/java/net/minecraft/server/SystemUtils.java
|
|
+++ b/src/main/java/net/minecraft/server/SystemUtils.java
|
|
@@ -206,7 +206,7 @@ public class SystemUtils {
|
|
CompletableFuture<?>[] acompletablefuture = new CompletableFuture[list.size()];
|
|
CompletableFuture<Void> completablefuture = new CompletableFuture();
|
|
|
|
- list.forEach((completablefuture1) -> {
|
|
+ for (CompletableFuture<? extends V> completablefuture1 : list) {
|
|
int i = list1.size();
|
|
|
|
list1.add(null); // Paper - decompile fix
|
|
@@ -218,7 +218,7 @@ public class SystemUtils {
|
|
}
|
|
|
|
});
|
|
- });
|
|
+ }
|
|
return CompletableFuture.allOf(acompletablefuture).applyToEither(completablefuture, (ovoid) -> {
|
|
return list1;
|
|
});
|
|
diff --git a/src/main/java/net/minecraft/server/TileEntityBeacon.java b/src/main/java/net/minecraft/server/TileEntityBeacon.java
|
|
index 9780ee07b2b0eed0cab5057ca02a48b244e3767b..f8894ed686727ff4c729ef7fecf9889c87d255d2 100644
|
|
--- a/src/main/java/net/minecraft/server/TileEntityBeacon.java
|
|
+++ b/src/main/java/net/minecraft/server/TileEntityBeacon.java
|
|
@@ -1,10 +1,8 @@
|
|
package net.minecraft.server;
|
|
|
|
import com.google.common.collect.Lists;
|
|
-import java.util.Arrays;
|
|
-import java.util.Iterator;
|
|
-import java.util.List;
|
|
-import java.util.Set;
|
|
+
|
|
+import java.util.*;
|
|
import java.util.stream.Collectors;
|
|
import javax.annotation.Nullable;
|
|
|
|
@@ -23,7 +21,18 @@ import com.destroystokyo.paper.event.block.BeaconEffectEvent;
|
|
public class TileEntityBeacon extends TileEntity implements ITileInventory, ITickable {
|
|
|
|
public static final MobEffectList[][] a = new MobEffectList[][]{{MobEffects.FASTER_MOVEMENT, MobEffects.FASTER_DIG}, {MobEffects.RESISTANCE, MobEffects.JUMP}, {MobEffects.INCREASE_DAMAGE}, {MobEffects.REGENERATION}};
|
|
- private static final Set<MobEffectList> b = (Set) Arrays.stream(TileEntityBeacon.a).flatMap(Arrays::stream).collect(Collectors.toSet());
|
|
+ private static final Set<MobEffectList> b;
|
|
+
|
|
+ static {
|
|
+ Set<MobEffectList> set = new HashSet<>();
|
|
+ for (MobEffectList[] mobEffectLists : TileEntityBeacon.a) {
|
|
+ for (MobEffectList mobEffectList : mobEffectLists) {
|
|
+ set.add(mobEffectList);
|
|
+ }
|
|
+ }
|
|
+ b = (Set) set;
|
|
+ }
|
|
+
|
|
private List<TileEntityBeacon.BeaconColorTracker> c = Lists.newArrayList();
|
|
private List<TileEntityBeacon.BeaconColorTracker> g = Lists.newArrayList();
|
|
public int levels;
|
|
diff --git a/src/main/java/net/minecraft/server/TileEntityCampfire.java b/src/main/java/net/minecraft/server/TileEntityCampfire.java
|
|
index a1580b8c6dd9656f884839664440809ac98e67cd..252ff32e8c46c21682a5f140ba5a43f04984de07 100644
|
|
--- a/src/main/java/net/minecraft/server/TileEntityCampfire.java
|
|
+++ b/src/main/java/net/minecraft/server/TileEntityCampfire.java
|
|
@@ -165,7 +165,12 @@ public class TileEntityCampfire extends TileEntity implements Clearable, ITickab
|
|
}
|
|
|
|
public Optional<RecipeCampfire> a(ItemStack itemstack) {
|
|
- return this.items.stream().noneMatch(ItemStack::isEmpty) ? Optional.empty() : this.world.getCraftingManager().craft(Recipes.CAMPFIRE_COOKING, new InventorySubcontainer(new ItemStack[]{itemstack}), this.world);
|
|
+ for (ItemStack item : this.items) {
|
|
+ if (item.isEmpty()) {
|
|
+ return this.world.getCraftingManager().craft(Recipes.CAMPFIRE_COOKING, new InventorySubcontainer(new ItemStack[]{itemstack}), this.world);
|
|
+ }
|
|
+ }
|
|
+ return Optional.empty();
|
|
}
|
|
|
|
public boolean a(ItemStack itemstack, int i) {
|
|
diff --git a/src/main/java/net/minecraft/server/TileEntityShulkerBox.java b/src/main/java/net/minecraft/server/TileEntityShulkerBox.java
|
|
index 1a57ffe48fd99c7399b2bb40310b5bc88a092d00..0cdd6ea519568dbe7c832c761b4689e348c8e0cb 100644
|
|
--- a/src/main/java/net/minecraft/server/TileEntityShulkerBox.java
|
|
+++ b/src/main/java/net/minecraft/server/TileEntityShulkerBox.java
|
|
@@ -1,5 +1,6 @@
|
|
package net.minecraft.server;
|
|
|
|
+import java.util.Arrays;
|
|
import java.util.List;
|
|
import java.util.stream.IntStream;
|
|
import javax.annotation.Nullable;
|
|
@@ -10,7 +11,19 @@ import org.bukkit.entity.HumanEntity;
|
|
|
|
public class TileEntityShulkerBox extends TileEntityLootable implements IWorldInventory, ITickable {
|
|
|
|
- private static final int[] a = IntStream.range(0, 27).toArray();
|
|
+ private static final int[] a;
|
|
+
|
|
+ static {
|
|
+ int[] arr = new int[10];
|
|
+ int count = 0;
|
|
+ for (int i1 = 0; i1 < 27; i1++) {
|
|
+ if (arr.length == count) arr = Arrays.copyOf(arr, count * 2);
|
|
+ arr[count++] = i1;
|
|
+ }
|
|
+ arr = Arrays.copyOfRange(arr, 0, count);
|
|
+ a = arr;
|
|
+ }
|
|
+
|
|
private NonNullList<ItemStack> contents;
|
|
private int c;
|
|
private TileEntityShulkerBox.AnimationPhase i;
|
|
diff --git a/src/main/java/net/minecraft/server/VillagePlace.java b/src/main/java/net/minecraft/server/VillagePlace.java
|
|
index 5b52b380e22971ac81407f9ca501773743568745..3f20851e3122d737b68519f900c2c74c106eaaac 100644
|
|
--- a/src/main/java/net/minecraft/server/VillagePlace.java
|
|
+++ b/src/main/java/net/minecraft/server/VillagePlace.java
|
|
@@ -101,9 +101,12 @@ public class VillagePlace extends RegionFileSection<VillagePlaceSection> {
|
|
List<VillagePlaceRecord> list = (List) this.c(predicate, blockposition, i, villageplace_occupancy).collect(Collectors.toList());
|
|
|
|
Collections.shuffle(list, random);
|
|
- return list.stream().filter((villageplacerecord) -> {
|
|
- return predicate1.test(villageplacerecord.f());
|
|
- }).findFirst().map(VillagePlaceRecord::f);
|
|
+ for (VillagePlaceRecord villageplacerecord : list) {
|
|
+ if (predicate1.test(villageplacerecord.f())) {
|
|
+ return Optional.of(villageplacerecord).map(VillagePlaceRecord::f);
|
|
+ }
|
|
+ }
|
|
+ return Optional.<VillagePlaceRecord>empty().map(VillagePlaceRecord::f);
|
|
}
|
|
|
|
public boolean b(BlockPosition blockposition) {
|
|
diff --git a/src/main/java/net/minecraft/server/VillagePlaceType.java b/src/main/java/net/minecraft/server/VillagePlaceType.java
|
|
index c1f293fc98d3efb4665cfb9036f208b842fc8e36..e7fb8025739855f9028aa6104a5845f06422b17d 100644
|
|
--- a/src/main/java/net/minecraft/server/VillagePlaceType.java
|
|
+++ b/src/main/java/net/minecraft/server/VillagePlaceType.java
|
|
@@ -103,13 +103,13 @@ public class VillagePlaceType {
|
|
}
|
|
|
|
private static VillagePlaceType a(VillagePlaceType villageplacetype) {
|
|
- villageplacetype.z.forEach((iblockdata) -> {
|
|
- VillagePlaceType villageplacetype1 = (VillagePlaceType) VillagePlaceType.x.put(iblockdata, villageplacetype);
|
|
+ for (IBlockData iblockdata : villageplacetype.z) {
|
|
+ VillagePlaceType villageplacetype1 = VillagePlaceType.x.put(iblockdata, villageplacetype);
|
|
|
|
if (villageplacetype1 != null) {
|
|
- throw (IllegalStateException) SystemUtils.c(new IllegalStateException(String.format("%s is defined in too many tags", iblockdata)));
|
|
+ throw SystemUtils.c(new IllegalStateException(String.format("%s is defined in too many tags", iblockdata)));
|
|
}
|
|
- });
|
|
+ }
|
|
return villageplacetype;
|
|
}
|
|
|
|
diff --git a/src/main/java/net/minecraft/server/VoxelShapes.java b/src/main/java/net/minecraft/server/VoxelShapes.java
|
|
index 5e24ce485ad40628906886d0acfaf5cfa6ec6dd6..d45fe00b3e4e8e6876b0e83576c08cf92a515446 100644
|
|
--- a/src/main/java/net/minecraft/server/VoxelShapes.java
|
|
+++ b/src/main/java/net/minecraft/server/VoxelShapes.java
|
|
@@ -162,7 +162,11 @@ public final class VoxelShapes {
|
|
}
|
|
|
|
public static VoxelShape a(VoxelShape voxelshape, VoxelShape... avoxelshape) {
|
|
- return (VoxelShape) Arrays.stream(avoxelshape).reduce(voxelshape, VoxelShapes::a);
|
|
+ VoxelShape acc = voxelshape;
|
|
+ for (VoxelShape voxelShape : avoxelshape) {
|
|
+ acc = a(acc, voxelShape);
|
|
+ }
|
|
+ return (VoxelShape) acc;
|
|
}
|
|
|
|
public static VoxelShape a(VoxelShape voxelshape, VoxelShape voxelshape1, OperatorBoolean operatorboolean) {
|
|
diff --git a/src/main/java/net/minecraft/server/WorldData.java b/src/main/java/net/minecraft/server/WorldData.java
|
|
index 95518e54d1fd7ada51df1cdc3562affccd48bfcb..e914ce414e553932b1f1b4c13c8ff4b8df692b8e 100644
|
|
--- a/src/main/java/net/minecraft/server/WorldData.java
|
|
+++ b/src/main/java/net/minecraft/server/WorldData.java
|
|
@@ -340,7 +340,10 @@ public class WorldData {
|
|
private void a(NBTTagCompound nbttagcompound, NBTTagCompound nbttagcompound1) {
|
|
NBTTagList nbttaglist = new NBTTagList();
|
|
|
|
- this.X.stream().map(NBTTagString::a).forEach(nbttaglist::add);
|
|
+ for (String s2 : this.X) {
|
|
+ NBTTagString nbtTagString = NBTTagString.a(s2);
|
|
+ nbttaglist.add(nbtTagString);
|
|
+ }
|
|
nbttagcompound.set("ServerBrands", nbttaglist);
|
|
nbttagcompound.setBoolean("WasModded", this.Y);
|
|
NBTTagCompound nbttagcompound2 = new NBTTagCompound();
|
|
diff --git a/src/main/java/net/minecraft/server/WorldGenFeatureOceanRuin.java b/src/main/java/net/minecraft/server/WorldGenFeatureOceanRuin.java
|
|
index d8fe49462b4ce4848647c70f8eb7d6e9e9360240..d183a2fd65e24dd78ba6e8fe122690d884999d26 100644
|
|
--- a/src/main/java/net/minecraft/server/WorldGenFeatureOceanRuin.java
|
|
+++ b/src/main/java/net/minecraft/server/WorldGenFeatureOceanRuin.java
|
|
@@ -2,6 +2,7 @@ package net.minecraft.server;
|
|
|
|
import com.mojang.datafixers.Dynamic;
|
|
import java.util.Arrays;
|
|
+import java.util.HashMap;
|
|
import java.util.Map;
|
|
import java.util.Random;
|
|
import java.util.function.Function;
|
|
@@ -49,9 +50,18 @@ public class WorldGenFeatureOceanRuin extends WorldGenFeatureRandomScattered<Wor
|
|
|
|
WARM("warm"), COLD("cold");
|
|
|
|
- private static final Map<String, WorldGenFeatureOceanRuin.Temperature> c = (Map) Arrays.stream(values()).collect(Collectors.toMap(WorldGenFeatureOceanRuin.Temperature::a, (worldgenfeatureoceanruin_temperature) -> {
|
|
- return worldgenfeatureoceanruin_temperature;
|
|
- }));
|
|
+ private static final Map<String, WorldGenFeatureOceanRuin.Temperature> c;
|
|
+
|
|
+ static {
|
|
+ Map<String, Temperature> map = new HashMap<>();
|
|
+ for (Temperature worldgenfeatureoceanruin_temperature : values()) {
|
|
+ if (map.put(worldgenfeatureoceanruin_temperature.a(), worldgenfeatureoceanruin_temperature) != null) {
|
|
+ throw new IllegalStateException("Duplicate key");
|
|
+ }
|
|
+ }
|
|
+ c = (Map) map;
|
|
+ }
|
|
+
|
|
private final String d;
|
|
|
|
private Temperature(String s) {
|
|
diff --git a/src/main/java/net/minecraft/server/WorldMap.java b/src/main/java/net/minecraft/server/WorldMap.java
|
|
index 2f1be1995d1a188da5be792abd7ac6f126332f49..bae3f216d056cb64fde49e4ca592631ea2800f59 100644
|
|
--- a/src/main/java/net/minecraft/server/WorldMap.java
|
|
+++ b/src/main/java/net/minecraft/server/WorldMap.java
|
|
@@ -10,10 +10,12 @@ import javax.annotation.Nullable;
|
|
// CraftBukkit start
|
|
import java.util.UUID;
|
|
|
|
+import org.bukkit.Bukkit;
|
|
import org.bukkit.craftbukkit.CraftServer;
|
|
import org.bukkit.craftbukkit.CraftWorld;
|
|
import org.bukkit.craftbukkit.map.CraftMapView;
|
|
import org.bukkit.craftbukkit.util.CraftChatMessage;
|
|
+import org.bukkit.entity.Player;
|
|
// CraftBukkit end
|
|
|
|
public class WorldMap extends PersistentBase {
|
|
@@ -432,13 +434,15 @@ public class WorldMap extends PersistentBase {
|
|
// Paper start
|
|
private void addSeenPlayers(java.util.Collection<MapIcon> icons) {
|
|
org.bukkit.entity.Player player = (org.bukkit.entity.Player) trackee.getBukkitEntity();
|
|
- WorldMap.this.decorations.forEach((name, mapIcon) -> {
|
|
- // If this cursor is for a player check visibility with vanish system
|
|
- org.bukkit.entity.Player other = org.bukkit.Bukkit.getPlayerExact(name); // Spigot
|
|
+ for (Map.Entry<String, MapIcon> entry : WorldMap.this.decorations.entrySet()) {
|
|
+ String name = entry.getKey();
|
|
+ MapIcon mapIcon = entry.getValue();
|
|
+// If this cursor is for a player check visibility with vanish system
|
|
+ Player other = Bukkit.getPlayerExact(name); // Spigot
|
|
if (other == null || player.canSee(other)) {
|
|
icons.add(mapIcon);
|
|
}
|
|
- });
|
|
+ }
|
|
}
|
|
private boolean shouldUseVanillaMap() {
|
|
return mapView.getRenderers().size() == 1 && mapView.getRenderers().get(0).getClass() == org.bukkit.craftbukkit.map.CraftMapRenderer.class;
|
|
diff --git a/src/main/java/net/minecraft/server/WorldServer.java b/src/main/java/net/minecraft/server/WorldServer.java
|
|
index 9b4c77eff1e0a98c709591f45a24fc02837cf9bd..096590141fe3f162c9d5fe53b71ec53abff1d4e6 100644
|
|
--- a/src/main/java/net/minecraft/server/WorldServer.java
|
|
+++ b/src/main/java/net/minecraft/server/WorldServer.java
|
|
@@ -22,15 +22,7 @@ import java.io.BufferedWriter;
|
|
import java.io.IOException;
|
|
import java.io.Writer;
|
|
import java.nio.file.Files;
|
|
-import java.util.Iterator;
|
|
-import java.util.List;
|
|
-import java.util.Map;
|
|
-import java.util.Objects;
|
|
-import java.util.Optional;
|
|
-import java.util.Queue;
|
|
-import java.util.Random;
|
|
-import java.util.Set;
|
|
-import java.util.UUID;
|
|
+import java.util.*;
|
|
import java.util.concurrent.Executor;
|
|
import java.util.function.BooleanSupplier;
|
|
import java.util.function.Predicate;
|
|
@@ -845,27 +837,35 @@ public class WorldServer extends World {
|
|
this.getWorldData().setDifficulty(EnumDifficulty.HARD);
|
|
}
|
|
|
|
- if (this.everyoneSleeping && this.players.stream().noneMatch((entityplayer) -> {
|
|
- return !entityplayer.isSpectator() && !entityplayer.isDeeplySleeping() && !entityplayer.fauxSleeping; // CraftBukkit
|
|
- })) {
|
|
- // CraftBukkit start
|
|
- long l = this.worldData.getDayTime() + 24000L;
|
|
- TimeSkipEvent event = new TimeSkipEvent(this.getWorld(), TimeSkipEvent.SkipReason.NIGHT_SKIP, (l - l % 24000L) - this.getDayTime());
|
|
- if (this.getGameRules().getBoolean(GameRules.DO_DAYLIGHT_CYCLE)) {
|
|
- getServer().getPluginManager().callEvent(event);
|
|
- if (!event.isCancelled()) {
|
|
- this.setDayTime(this.getDayTime() + event.getSkipAmount());
|
|
+ if (this.everyoneSleeping) {
|
|
+ // CraftBukkit
|
|
+ boolean b = true;
|
|
+ for (EntityPlayer entityplayer : this.players) {
|
|
+ if (!entityplayer.isSpectator() && !entityplayer.isDeeplySleeping() && !entityplayer.fauxSleeping) {
|
|
+ b = false;
|
|
+ break;
|
|
}
|
|
-
|
|
}
|
|
+ if (b) {
|
|
+ // CraftBukkit start
|
|
+ long l = this.worldData.getDayTime() + 24000L;
|
|
+ TimeSkipEvent event = new TimeSkipEvent(this.getWorld(), TimeSkipEvent.SkipReason.NIGHT_SKIP, (l - l % 24000L) - this.getDayTime());
|
|
+ if (this.getGameRules().getBoolean(GameRules.DO_DAYLIGHT_CYCLE)) {
|
|
+ getServer().getPluginManager().callEvent(event);
|
|
+ if (!event.isCancelled()) {
|
|
+ this.setDayTime(this.getDayTime() + event.getSkipAmount());
|
|
+ }
|
|
|
|
- if (!event.isCancelled()) {
|
|
- this.everyoneSleeping = false;
|
|
- this.wakeupPlayers();
|
|
- }
|
|
- // CraftBukkit end
|
|
- if (this.getGameRules().getBoolean(GameRules.DO_WEATHER_CYCLE)) {
|
|
- this.clearWeather();
|
|
+ }
|
|
+
|
|
+ if (!event.isCancelled()) {
|
|
+ this.everyoneSleeping = false;
|
|
+ this.wakeupPlayers();
|
|
+ }
|
|
+ // CraftBukkit end
|
|
+ if (this.getGameRules().getBoolean(GameRules.DO_WEATHER_CYCLE)) {
|
|
+ this.clearWeather();
|
|
+ }
|
|
}
|
|
}
|
|
|
|
@@ -1011,9 +1011,15 @@ public class WorldServer extends World {
|
|
}
|
|
|
|
private void wakeupPlayers() {
|
|
- (this.players.stream().filter(EntityLiving::isSleeping).collect(Collectors.toList())).forEach((entityplayer) -> { // CraftBukkit - decompile error
|
|
+ List<EntityPlayer> list = new ArrayList<>();
|
|
+ for (EntityPlayer player : this.players) {
|
|
+ if (player.isSleeping()) {
|
|
+ list.add(player);
|
|
+ }
|
|
+ }// CraftBukkit - decompile error
|
|
+ for (EntityPlayer entityplayer : (list)) {
|
|
entityplayer.wakeup(false, false);
|
|
- });
|
|
+ }
|
|
}
|
|
|
|
// Paper start - optimise random block ticking
|
|
@@ -1846,25 +1852,21 @@ public class WorldServer extends World {
|
|
// Spigot start
|
|
if ( entity instanceof EntityHuman )
|
|
{
|
|
- this.getMinecraftServer().worldServer.values().stream().map( WorldServer::getWorldPersistentData ).forEach( (worldData) ->
|
|
- {
|
|
- for (Object o : worldData.data.values() )
|
|
- {
|
|
- if ( o instanceof WorldMap )
|
|
- {
|
|
+ for (WorldServer worldServer : this.getMinecraftServer().worldServer.values()) {
|
|
+ WorldPersistentData worldPersistentData = worldServer.getWorldPersistentData();
|
|
+ for (Object o : worldPersistentData.data.values()) {
|
|
+ if (o instanceof WorldMap) {
|
|
WorldMap map = (WorldMap) o;
|
|
- map.humans.remove( (EntityHuman) entity );
|
|
- for ( Iterator<WorldMap.WorldMapHumanTracker> iter = (Iterator<WorldMap.WorldMapHumanTracker>) map.i.iterator(); iter.hasNext(); )
|
|
- {
|
|
- if ( iter.next().trackee == entity )
|
|
- {
|
|
+ map.humans.remove(entity);
|
|
+ for (Iterator<WorldMap.WorldMapHumanTracker> iter = map.i.iterator(); iter.hasNext(); ) {
|
|
+ if (iter.next().trackee == entity) {
|
|
map.decorations.remove(entity.getDisplayName().getString()); // Paper
|
|
iter.remove();
|
|
}
|
|
}
|
|
}
|
|
}
|
|
- } );
|
|
+ }
|
|
}
|
|
// Spigot end
|
|
// Spigot Start
|
|
@@ -2356,12 +2358,12 @@ public class WorldServer extends World {
|
|
chunkproviderserver.addTicket(TicketType.START, new ChunkCoordIntPair(spawn.add(-radiusInBlocks, 0, z)), 1, Unit.INSTANCE); // level 32
|
|
}
|
|
|
|
- MCUtil.getSpiralOutChunks(spawn, radiusInBlocks >> 4).forEach(pair -> {
|
|
+ for (ChunkCoordIntPair pair : MCUtil.getSpiralOutChunks(spawn, radiusInBlocks >> 4)) {
|
|
getChunkProvider().getChunkAtAsynchronously(pair.x, pair.z, true, false).exceptionally((ex) -> {
|
|
ex.printStackTrace();
|
|
return null;
|
|
});
|
|
- });
|
|
+ }
|
|
}
|
|
public void removeTicketsForSpawn(int radiusInBlocks, BlockPosition spawn) {
|
|
// In order to respect vanilla behavior, which is ensuring everything but the spawn border can tick, we added tickets
|
|
diff --git a/src/main/java/org/bukkit/craftbukkit/CraftServer.java b/src/main/java/org/bukkit/craftbukkit/CraftServer.java
|
|
index 7f952a860c524aafea7094048a102478d8c2beec..2d7a4c88f18cd655cbe15e25819ca43debecd0a9 100644
|
|
--- a/src/main/java/org/bukkit/craftbukkit/CraftServer.java
|
|
+++ b/src/main/java/org/bukkit/craftbukkit/CraftServer.java
|
|
@@ -26,18 +26,7 @@ import java.io.IOException;
|
|
import java.io.InputStreamReader;
|
|
import java.nio.ByteBuffer;
|
|
import java.nio.charset.StandardCharsets;
|
|
-import java.util.ArrayList;
|
|
-import java.util.Arrays;
|
|
-import java.util.Base64;
|
|
-import java.util.Collections;
|
|
-import java.util.HashSet;
|
|
-import java.util.Iterator;
|
|
-import java.util.LinkedHashMap;
|
|
-import java.util.LinkedHashSet;
|
|
-import java.util.List;
|
|
-import java.util.Map;
|
|
-import java.util.Set;
|
|
-import java.util.UUID;
|
|
+import java.util.*;
|
|
import java.util.function.Consumer;
|
|
import java.util.logging.Level;
|
|
import java.util.logging.Logger;
|
|
@@ -2232,9 +2221,11 @@ public final class CraftServer implements Server {
|
|
|
|
@Override
|
|
public boolean reloadCommandAliases() {
|
|
- Set<String> removals = getCommandAliases().keySet().stream()
|
|
- .map(key -> key.toLowerCase(java.util.Locale.ENGLISH))
|
|
- .collect(java.util.stream.Collectors.toSet());
|
|
+ Set<String> removals = new HashSet<>();
|
|
+ for (String key : getCommandAliases().keySet()) {
|
|
+ String s = key.toLowerCase(Locale.ENGLISH);
|
|
+ removals.add(s);
|
|
+ }
|
|
getCommandMap().getKnownCommands().keySet().removeIf(removals::contains);
|
|
File file = getCommandsConfigFile();
|
|
try {
|
|
diff --git a/src/main/java/org/bukkit/craftbukkit/CraftWorld.java b/src/main/java/org/bukkit/craftbukkit/CraftWorld.java
|
|
index 32d4aa0f470e6b005fd96f3bea1bcb0cf6711966..e8f9f677a706c5c8ff6cd6b946bbb4bc508b4162 100644
|
|
--- a/src/main/java/org/bukkit/craftbukkit/CraftWorld.java
|
|
+++ b/src/main/java/org/bukkit/craftbukkit/CraftWorld.java
|
|
@@ -456,12 +456,28 @@ public class CraftWorld implements World {
|
|
if (Thread.currentThread() != world.getMinecraftWorld().serverThread) {
|
|
synchronized (world.getChunkProvider().playerChunkMap.visibleChunks) {
|
|
Long2ObjectLinkedOpenHashMap<PlayerChunk> chunks = world.getChunkProvider().playerChunkMap.visibleChunks;
|
|
- return chunks.values().stream().map(PlayerChunk::getFullChunk).filter(Objects::nonNull).map(net.minecraft.server.Chunk::getBukkitChunk).toArray(Chunk[]::new);
|
|
+ List<Chunk> list = new ArrayList<>();
|
|
+ for (PlayerChunk playerChunk : chunks.values()) {
|
|
+ net.minecraft.server.Chunk fullChunk = playerChunk.getFullChunk();
|
|
+ if (fullChunk != null) {
|
|
+ Chunk bukkitChunk = fullChunk.getBukkitChunk();
|
|
+ list.add(bukkitChunk);
|
|
+ }
|
|
+ }
|
|
+ return list.toArray(new Chunk[0]);
|
|
}
|
|
}
|
|
// Paper end
|
|
Long2ObjectLinkedOpenHashMap<PlayerChunk> chunks = world.getChunkProvider().playerChunkMap.visibleChunks;
|
|
- return chunks.values().stream().map(PlayerChunk::getFullChunk).filter(Objects::nonNull).map(net.minecraft.server.Chunk::getBukkitChunk).toArray(Chunk[]::new);
|
|
+ List<Chunk> list = new ArrayList<>();
|
|
+ for (PlayerChunk playerChunk : chunks.values()) {
|
|
+ net.minecraft.server.Chunk fullChunk = playerChunk.getFullChunk();
|
|
+ if (fullChunk != null) {
|
|
+ Chunk bukkitChunk = fullChunk.getBukkitChunk();
|
|
+ list.add(bukkitChunk);
|
|
+ }
|
|
+ }
|
|
+ return list.toArray(new Chunk[0]);
|
|
}
|
|
|
|
@Override
|
|
@@ -2465,7 +2481,12 @@ public class CraftWorld implements World {
|
|
@Override
|
|
public List<Raid> getRaids() {
|
|
PersistentRaid persistentRaid = world.getPersistentRaid();
|
|
- return persistentRaid.raids.values().stream().map(CraftRaid::new).collect(Collectors.toList());
|
|
+ List<Raid> list = new ArrayList<>();
|
|
+ for (net.minecraft.server.Raid raid : persistentRaid.raids.values()) {
|
|
+ CraftRaid craftRaid = new CraftRaid(raid);
|
|
+ list.add(craftRaid);
|
|
+ }
|
|
+ return list;
|
|
}
|
|
|
|
@Override
|
|
diff --git a/src/main/java/org/bukkit/craftbukkit/block/CraftBlock.java b/src/main/java/org/bukkit/craftbukkit/block/CraftBlock.java
|
|
index 0ba3d963c5d434f58ff26d68f28177ca2a326fcc..74766fcf3770a7757b12826838a366807ffc72bd 100644
|
|
--- a/src/main/java/org/bukkit/craftbukkit/block/CraftBlock.java
|
|
+++ b/src/main/java/org/bukkit/craftbukkit/block/CraftBlock.java
|
|
@@ -1,6 +1,8 @@
|
|
package org.bukkit.craftbukkit.block;
|
|
|
|
import com.google.common.base.Preconditions;
|
|
+
|
|
+import java.util.ArrayList;
|
|
import java.util.Collection;
|
|
import java.util.Collections;
|
|
import java.util.List;
|
|
@@ -661,8 +663,12 @@ public class CraftBlock implements Block {
|
|
|
|
// Modelled off EntityHuman#hasBlock
|
|
if (item == null || iblockdata.getMaterial().isAlwaysDestroyable() || nms.canDestroySpecialBlock(iblockdata)) {
|
|
- return net.minecraft.server.Block.getDrops(iblockdata, (WorldServer) world.getMinecraftWorld(), position, world.getTileEntity(position), entity == null ? null : ((CraftEntity) entity).getHandle(), nms)
|
|
- .stream().map(CraftItemStack::asBukkitCopy).collect(Collectors.toList());
|
|
+ List<ItemStack> list = new ArrayList<>();
|
|
+ for (net.minecraft.server.ItemStack itemStack : net.minecraft.server.Block.getDrops(iblockdata, (WorldServer) world.getMinecraftWorld(), position, world.getTileEntity(position), entity == null ? null : ((CraftEntity) entity).getHandle(), nms)) {
|
|
+ ItemStack stack = CraftItemStack.asBukkitCopy(itemStack);
|
|
+ list.add(stack);
|
|
+ }
|
|
+ return list;
|
|
} else {
|
|
return Collections.emptyList();
|
|
}
|
|
diff --git a/src/main/java/org/bukkit/craftbukkit/block/data/CraftBlockData.java b/src/main/java/org/bukkit/craftbukkit/block/data/CraftBlockData.java
|
|
index adba4a8a2f4dd22fd3b6090661cf3598cc30c5a4..07b3f148f61948f9628a98aab74e37cc6a0e173d 100644
|
|
--- a/src/main/java/org/bukkit/craftbukkit/block/data/CraftBlockData.java
|
|
+++ b/src/main/java/org/bukkit/craftbukkit/block/data/CraftBlockData.java
|
|
@@ -10,6 +10,7 @@ import com.mojang.brigadier.exceptions.CommandSyntaxException;
|
|
import java.util.HashMap;
|
|
import java.util.Map;
|
|
import java.util.Set;
|
|
+import java.util.StringJoiner;
|
|
import java.util.stream.Collectors;
|
|
import net.minecraft.server.ArgumentBlock;
|
|
import net.minecraft.server.Block;
|
|
@@ -269,7 +270,12 @@ public class CraftBlockData implements BlockData {
|
|
|
|
if (!states.isEmpty()) {
|
|
stateString.append('[');
|
|
- stateString.append(states.entrySet().stream().map(BlockDataAbstract.STATE_TO_VALUE).collect(Collectors.joining(",")));
|
|
+ StringJoiner joiner = new StringJoiner(",");
|
|
+ for (Map.Entry<IBlockState<?>, Comparable<?>> iBlockStateComparableEntry : states.entrySet()) {
|
|
+ String s = BlockDataAbstract.STATE_TO_VALUE.apply(iBlockStateComparableEntry);
|
|
+ joiner.add(s);
|
|
+ }
|
|
+ stateString.append(joiner.toString());
|
|
stateString.append(']');
|
|
}
|
|
|
|
diff --git a/src/main/java/org/bukkit/craftbukkit/command/ConsoleCommandCompleter.java b/src/main/java/org/bukkit/craftbukkit/command/ConsoleCommandCompleter.java
|
|
index a51202ed53d8ba99b364e8797fe32fa8aeb4fc87..f276cdcaacc2fd2650a2ddccbbf190421a20c2bd 100644
|
|
--- a/src/main/java/org/bukkit/craftbukkit/command/ConsoleCommandCompleter.java
|
|
+++ b/src/main/java/org/bukkit/craftbukkit/command/ConsoleCommandCompleter.java
|
|
@@ -1,5 +1,6 @@
|
|
package org.bukkit.craftbukkit.command;
|
|
|
|
+import java.util.ArrayList;
|
|
import java.util.Collections;
|
|
import java.util.List;
|
|
import java.util.concurrent.ExecutionException;
|
|
@@ -56,7 +57,12 @@ public class ConsoleCommandCompleter implements Completer {
|
|
}
|
|
|
|
if (!completions.isEmpty()) {
|
|
- candidates.addAll(completions.stream().map(Candidate::new).collect(java.util.stream.Collectors.toList()));
|
|
+ List<Candidate> list = new ArrayList<>();
|
|
+ for (String completion : completions) {
|
|
+ Candidate candidate = new Candidate(completion);
|
|
+ list.add(candidate);
|
|
+ }
|
|
+ candidates.addAll(list);
|
|
}
|
|
return;
|
|
}
|
|
diff --git a/src/main/java/org/bukkit/craftbukkit/command/VanillaCommandWrapper.java b/src/main/java/org/bukkit/craftbukkit/command/VanillaCommandWrapper.java
|
|
index f34461460049a80c5ff57805927053a36a4db426..3c610a889f371f54b0f456266d14538fc3ff03ac 100644
|
|
--- a/src/main/java/org/bukkit/craftbukkit/command/VanillaCommandWrapper.java
|
|
+++ b/src/main/java/org/bukkit/craftbukkit/command/VanillaCommandWrapper.java
|
|
@@ -2,6 +2,7 @@ package org.bukkit.craftbukkit.command;
|
|
|
|
import com.google.common.base.Joiner;
|
|
import com.mojang.brigadier.ParseResults;
|
|
+import com.mojang.brigadier.suggestion.Suggestion;
|
|
import com.mojang.brigadier.tree.CommandNode;
|
|
import java.util.ArrayList;
|
|
import java.util.Collections;
|
|
@@ -57,7 +58,9 @@ public final class VanillaCommandWrapper extends BukkitCommand {
|
|
|
|
List<String> results = new ArrayList<>();
|
|
dispatcher.a().getCompletionSuggestions(parsed).thenAccept((suggestions) -> {
|
|
- suggestions.getList().forEach((s) -> results.add(s.getText()));
|
|
+ for (Suggestion s : suggestions.getList()) {
|
|
+ results.add(s.getText());
|
|
+ }
|
|
});
|
|
|
|
return results;
|
|
diff --git a/src/main/java/org/bukkit/craftbukkit/entity/CraftVillager.java b/src/main/java/org/bukkit/craftbukkit/entity/CraftVillager.java
|
|
index d24a892c498d7ee58741c9358748a117f01d8a8d..85a7406048a5d44b8e26d7949feacb7ec12c575c 100644
|
|
--- a/src/main/java/org/bukkit/craftbukkit/entity/CraftVillager.java
|
|
+++ b/src/main/java/org/bukkit/craftbukkit/entity/CraftVillager.java
|
|
@@ -3,6 +3,8 @@ package org.bukkit.craftbukkit.entity;
|
|
import com.destroystokyo.paper.entity.villager.Reputation; // Paper
|
|
import com.google.common.base.Preconditions;
|
|
import com.google.common.collect.Maps; // Paper
|
|
+
|
|
+import java.util.HashMap;
|
|
import java.util.Locale;
|
|
import net.minecraft.server.BlockBed;
|
|
import net.minecraft.server.BlockPosition;
|
|
@@ -142,9 +144,13 @@ public class CraftVillager extends CraftAbstractVillager implements Villager {
|
|
|
|
@Override
|
|
public Map<UUID, Reputation> getReputations() {
|
|
- return getHandle().getReputation().getReputations().entrySet()
|
|
- .stream()
|
|
- .collect(java.util.stream.Collectors.toMap(Map.Entry::getKey, entry -> entry.getValue().getPaperReputation()));
|
|
+ Map<UUID, Reputation> map = new HashMap<>();
|
|
+ for (Map.Entry<UUID, net.minecraft.server.Reputation.a> entry : getHandle().getReputation().getReputations().entrySet()) {
|
|
+ if (map.put(entry.getKey(), entry.getValue().getPaperReputation()) != null) {
|
|
+ throw new IllegalStateException("Duplicate key");
|
|
+ }
|
|
+ }
|
|
+ return map;
|
|
}
|
|
|
|
@Override
|
|
diff --git a/src/main/java/org/bukkit/craftbukkit/event/CraftEventFactory.java b/src/main/java/org/bukkit/craftbukkit/event/CraftEventFactory.java
|
|
index a4cd6c404c2a8d526c4673695aadd001f2b4516f..10341846f022cce626e4b9446dbd488942fa0d01 100644
|
|
--- a/src/main/java/org/bukkit/craftbukkit/event/CraftEventFactory.java
|
|
+++ b/src/main/java/org/bukkit/craftbukkit/event/CraftEventFactory.java
|
|
@@ -1711,7 +1711,11 @@ public class CraftEventFactory {
|
|
Entity entity = lootInfo.getContextParameter(LootContextParameters.THIS_ENTITY);
|
|
NamespacedKey key = CraftNamespacedKey.fromMinecraft(world.getHandle().getMinecraftServer().getLootTableRegistry().lootTableToKey.get(lootTable));
|
|
CraftLootTable craftLootTable = new CraftLootTable(key, lootTable);
|
|
- List<org.bukkit.inventory.ItemStack> bukkitLoot = loot.stream().map(CraftItemStack::asCraftMirror).collect(Collectors.toCollection(ArrayList::new));
|
|
+ List<org.bukkit.inventory.ItemStack> bukkitLoot = new ArrayList<>();
|
|
+ for (ItemStack itemStack : loot) {
|
|
+ CraftItemStack craftItemStack = CraftItemStack.asCraftMirror(itemStack);
|
|
+ bukkitLoot.add(craftItemStack);
|
|
+ }
|
|
|
|
LootGenerateEvent event = new LootGenerateEvent(world, (entity != null ? entity.getBukkitEntity() : null), inventory.getOwner(), craftLootTable, CraftLootTable.convertContext(lootInfo), bukkitLoot, plugin);
|
|
Bukkit.getPluginManager().callEvent(event);
|
|
diff --git a/src/main/java/org/bukkit/craftbukkit/inventory/CraftMetaItem.java b/src/main/java/org/bukkit/craftbukkit/inventory/CraftMetaItem.java
|
|
index 706f1bd66c79dddc26794cad818679473e20382f..318365a4108c7d6ebd7f78145f0ee57098d48936 100644
|
|
--- a/src/main/java/org/bukkit/craftbukkit/inventory/CraftMetaItem.java
|
|
+++ b/src/main/java/org/bukkit/craftbukkit/inventory/CraftMetaItem.java
|
|
@@ -21,20 +21,7 @@ import java.lang.annotation.RetentionPolicy;
|
|
import java.lang.annotation.Target;
|
|
import java.lang.reflect.Constructor;
|
|
import java.lang.reflect.InvocationTargetException;
|
|
-import java.util.ArrayList;
|
|
-import java.util.Arrays;
|
|
-import java.util.Collection;
|
|
-import java.util.Comparator; // Paper
|
|
-import java.util.EnumSet;
|
|
-import java.util.HashMap;
|
|
-import java.util.Iterator;
|
|
-import java.util.LinkedHashMap;
|
|
-import java.util.List;
|
|
-import java.util.Locale;
|
|
-import java.util.Map;
|
|
-import java.util.NoSuchElementException;
|
|
-import java.util.Set;
|
|
-import java.util.TreeMap; // Paper
|
|
+import java.util.*;
|
|
import java.util.logging.Level;
|
|
import java.util.logging.Logger;
|
|
import javax.annotation.Nonnull;
|
|
@@ -53,6 +40,7 @@ import org.apache.commons.codec.binary.Base64;
|
|
import org.apache.commons.lang.Validate;
|
|
import org.apache.commons.lang3.EnumUtils;
|
|
import org.bukkit.Material;
|
|
+import org.bukkit.NamespacedKey;
|
|
import org.bukkit.attribute.Attribute;
|
|
import org.bukkit.attribute.AttributeModifier;
|
|
import org.bukkit.block.data.BlockData;
|
|
@@ -89,7 +77,6 @@ import static org.spigotmc.ValidateUtils.*;
|
|
// Paper start
|
|
import com.destroystokyo.paper.Namespaced;
|
|
import com.destroystokyo.paper.NamespacedTag;
|
|
-import java.util.Collections;
|
|
// Paper end
|
|
|
|
/**
|
|
@@ -735,17 +722,21 @@ class CraftMetaItem implements ItemMeta, Damageable, Repairable, BlockDataMeta {
|
|
}
|
|
// Paper start - Implement an API for CanPlaceOn and CanDestroy NBT values
|
|
if (hasPlaceableKeys()) {
|
|
- List<String> items = this.placeableKeys.stream()
|
|
- .map(this::serializeNamespaced)
|
|
- .collect(java.util.stream.Collectors.toList());
|
|
+ List<String> items = new ArrayList<>();
|
|
+ for (Namespaced placeableKey : this.placeableKeys) {
|
|
+ String s = serializeNamespaced(placeableKey);
|
|
+ items.add(s);
|
|
+ }
|
|
|
|
itemTag.set(CAN_PLACE_ON.NBT, createNonComponentStringList(items));
|
|
}
|
|
|
|
if (hasDestroyableKeys()) {
|
|
- List<String> items = this.destroyableKeys.stream()
|
|
- .map(this::serializeNamespaced)
|
|
- .collect(java.util.stream.Collectors.toList());
|
|
+ List<String> items = new ArrayList<>();
|
|
+ for (Namespaced destroyableKey : this.destroyableKeys) {
|
|
+ String s = serializeNamespaced(destroyableKey);
|
|
+ items.add(s);
|
|
+ }
|
|
|
|
itemTag.set(CAN_DESTROY.NBT, createNonComponentStringList(items));
|
|
}
|
|
@@ -1398,17 +1389,21 @@ class CraftMetaItem implements ItemMeta, Damageable, Repairable, BlockDataMeta {
|
|
|
|
// Paper start - Implement an API for CanPlaceOn and CanDestroy NBT values
|
|
if (hasPlaceableKeys()) {
|
|
- List<String> cerealPlaceable = this.placeableKeys.stream()
|
|
- .map(this::serializeNamespaced)
|
|
- .collect(java.util.stream.Collectors.toList());
|
|
+ List<String> cerealPlaceable = new ArrayList<>();
|
|
+ for (Namespaced placeableKey : this.placeableKeys) {
|
|
+ String s = serializeNamespaced(placeableKey);
|
|
+ cerealPlaceable.add(s);
|
|
+ }
|
|
|
|
builder.put(CAN_PLACE_ON.BUKKIT, cerealPlaceable);
|
|
}
|
|
|
|
if (hasDestroyableKeys()) {
|
|
- List<String> cerealDestroyable = this.destroyableKeys.stream()
|
|
- .map(this::serializeNamespaced)
|
|
- .collect(java.util.stream.Collectors.toList());
|
|
+ List<String> cerealDestroyable = new ArrayList<>();
|
|
+ for (Namespaced destroyableKey : this.destroyableKeys) {
|
|
+ String s = serializeNamespaced(destroyableKey);
|
|
+ cerealDestroyable.add(s);
|
|
+ }
|
|
|
|
builder.put(CAN_DESTROY.BUKKIT, cerealDestroyable);
|
|
}
|
|
@@ -1669,12 +1664,19 @@ class CraftMetaItem implements ItemMeta, Damageable, Repairable, BlockDataMeta {
|
|
|
|
@Deprecated
|
|
private void legacyClearAndReplaceKeys(Collection<Namespaced> toUpdate, Collection<Material> beingSet) {
|
|
- if (beingSet.stream().anyMatch(Material::isLegacy)) {
|
|
- throw new IllegalArgumentException("Set must not contain any legacy materials!");
|
|
+ for (Material material1 : beingSet) {
|
|
+ if (material1.isLegacy()) {
|
|
+ throw new IllegalArgumentException("Set must not contain any legacy materials!");
|
|
+ }
|
|
}
|
|
|
|
toUpdate.clear();
|
|
- toUpdate.addAll(beingSet.stream().map(Material::getKey).collect(java.util.stream.Collectors.toSet()));
|
|
+ Set<NamespacedKey> set = new HashSet<>();
|
|
+ for (Material material : beingSet) {
|
|
+ NamespacedKey key = material.getKey();
|
|
+ set.add(key);
|
|
+ }
|
|
+ toUpdate.addAll(set);
|
|
}
|
|
|
|
@Deprecated
|
|
diff --git a/src/main/java/org/bukkit/craftbukkit/tag/CraftBlockTag.java b/src/main/java/org/bukkit/craftbukkit/tag/CraftBlockTag.java
|
|
index 2fe308d91b3ae4274269b0c6001eead824db9d32..f52c6513588716940bcf72970c381c0e87e3be28 100644
|
|
--- a/src/main/java/org/bukkit/craftbukkit/tag/CraftBlockTag.java
|
|
+++ b/src/main/java/org/bukkit/craftbukkit/tag/CraftBlockTag.java
|
|
@@ -1,6 +1,7 @@
|
|
package org.bukkit.craftbukkit.tag;
|
|
|
|
import java.util.Collections;
|
|
+import java.util.HashSet;
|
|
import java.util.Set;
|
|
import java.util.stream.Collectors;
|
|
import net.minecraft.server.Block;
|
|
@@ -22,6 +23,11 @@ public class CraftBlockTag extends CraftTag<Block, Material> {
|
|
|
|
@Override
|
|
public Set<Material> getValues() {
|
|
- return Collections.unmodifiableSet(getHandle().a().stream().map((block) -> CraftMagicNumbers.getMaterial(block)).collect(Collectors.toSet()));
|
|
+ Set<Material> set = new HashSet<>();
|
|
+ for (Block block : getHandle().a()) {
|
|
+ Material material = CraftMagicNumbers.getMaterial(block);
|
|
+ set.add(material);
|
|
+ }
|
|
+ return Collections.unmodifiableSet(set);
|
|
}
|
|
}
|
|
diff --git a/src/main/java/org/bukkit/craftbukkit/tag/CraftItemTag.java b/src/main/java/org/bukkit/craftbukkit/tag/CraftItemTag.java
|
|
index 4a1a45257f069e1b746a1e78a584c7648ef0d3d4..b6c61b2b971e527b5a573f588be583177e50286c 100644
|
|
--- a/src/main/java/org/bukkit/craftbukkit/tag/CraftItemTag.java
|
|
+++ b/src/main/java/org/bukkit/craftbukkit/tag/CraftItemTag.java
|
|
@@ -1,6 +1,7 @@
|
|
package org.bukkit.craftbukkit.tag;
|
|
|
|
import java.util.Collections;
|
|
+import java.util.HashSet;
|
|
import java.util.Set;
|
|
import java.util.stream.Collectors;
|
|
import net.minecraft.server.Item;
|
|
@@ -22,6 +23,11 @@ public class CraftItemTag extends CraftTag<Item, Material> {
|
|
|
|
@Override
|
|
public Set<Material> getValues() {
|
|
- return Collections.unmodifiableSet(getHandle().a().stream().map((item) -> CraftMagicNumbers.getMaterial(item)).collect(Collectors.toSet()));
|
|
+ Set<Material> set = new HashSet<>();
|
|
+ for (Item item : getHandle().a()) {
|
|
+ Material material = CraftMagicNumbers.getMaterial(item);
|
|
+ set.add(material);
|
|
+ }
|
|
+ return Collections.unmodifiableSet(set);
|
|
}
|
|
}
|