forked from GeyserMC/Geyser
Update bedrock protocol lib and remove trove
This commit is contained in:
parent
51050e3868
commit
62b183a387
9 changed files with 55 additions and 20 deletions
|
@ -39,13 +39,37 @@
|
|||
<dependency>
|
||||
<groupId>com.nukkitx.protocol</groupId>
|
||||
<artifactId>bedrock-v389</artifactId>
|
||||
<version>2.5.1</version>
|
||||
<version>2.5.4</version>
|
||||
<scope>compile</scope>
|
||||
<exclusions>
|
||||
<exclusion>
|
||||
<groupId>net.sf.trove4j</groupId>
|
||||
<artifactId>trove</artifactId>
|
||||
</exclusion>
|
||||
</exclusions>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>com.nukkitx.fastutil</groupId>
|
||||
<artifactId>fastutil-int-int-maps</artifactId>
|
||||
<version>8.3.1</version>
|
||||
<scope>compile</scope>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>com.nukkitx</groupId>
|
||||
<artifactId>fastutil-lite</artifactId>
|
||||
<version>8.1.1</version>
|
||||
<groupId>com.nukkitx.fastutil</groupId>
|
||||
<artifactId>fastutil-int-float-maps</artifactId>
|
||||
<version>8.3.1</version>
|
||||
<scope>compile</scope>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>com.nukkitx.fastutil</groupId>
|
||||
<artifactId>fastutil-long-long-maps</artifactId>
|
||||
<version>8.3.1</version>
|
||||
<scope>compile</scope>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>com.nukkitx.fastutil</groupId>
|
||||
<artifactId>fastutil-object-long-maps</artifactId>
|
||||
<version>8.3.1</version>
|
||||
<scope>compile</scope>
|
||||
</dependency>
|
||||
<dependency>
|
||||
|
|
|
@ -26,6 +26,9 @@
|
|||
package org.geysermc.connector.network.session.cache;
|
||||
|
||||
import it.unimi.dsi.fastutil.longs.*;
|
||||
import it.unimi.dsi.fastutil.objects.Object2LongMap;
|
||||
import it.unimi.dsi.fastutil.objects.Object2LongOpenHashMap;
|
||||
import it.unimi.dsi.fastutil.objects.ObjectOpenHashSet;
|
||||
import lombok.Getter;
|
||||
import org.geysermc.connector.entity.Entity;
|
||||
import org.geysermc.connector.entity.PlayerEntity;
|
||||
|
@ -45,7 +48,7 @@ public class EntityCache {
|
|||
private Long2ObjectMap<Entity> entities = Long2ObjectMaps.synchronize(new Long2ObjectOpenHashMap<>());
|
||||
private Long2LongMap entityIdTranslations = Long2LongMaps.synchronize(new Long2LongOpenHashMap());
|
||||
private Map<UUID, PlayerEntity> playerEntities = Collections.synchronizedMap(new HashMap<>());
|
||||
private Map<UUID, Long> bossbars = new HashMap<>();
|
||||
private Object2LongMap<UUID> bossbars = new Object2LongOpenHashMap<>();
|
||||
|
||||
@Getter
|
||||
private AtomicLong nextEntityId = new AtomicLong(2L);
|
||||
|
@ -92,7 +95,7 @@ public class EntityCache {
|
|||
}
|
||||
|
||||
public <T extends Entity> Set<T> getEntitiesByType(Class<T> entityType) {
|
||||
Set<T> entitiesOfType = new HashSet<>();
|
||||
Set<T> entitiesOfType = new ObjectOpenHashSet<>();
|
||||
for (Entity entity : (entityType == PlayerEntity.class ? playerEntities : entities).values()) {
|
||||
if (entity.is(entityType)) {
|
||||
entitiesOfType.add(entity.as(entityType));
|
||||
|
|
|
@ -32,9 +32,14 @@ import com.nukkitx.nbt.NbtUtils;
|
|||
import com.nukkitx.nbt.stream.NBTInputStream;
|
||||
import com.nukkitx.nbt.tag.CompoundTag;
|
||||
import com.nukkitx.nbt.tag.ListTag;
|
||||
import gnu.trove.map.TObjectIntMap;
|
||||
import gnu.trove.map.hash.TObjectIntHashMap;
|
||||
import it.unimi.dsi.fastutil.ints.*;
|
||||
import it.unimi.dsi.fastutil.ints.Int2IntMap;
|
||||
import it.unimi.dsi.fastutil.ints.Int2IntOpenHashMap;
|
||||
import it.unimi.dsi.fastutil.ints.Int2ObjectMap;
|
||||
import it.unimi.dsi.fastutil.ints.Int2ObjectOpenHashMap;
|
||||
import it.unimi.dsi.fastutil.ints.IntOpenHashSet;
|
||||
import it.unimi.dsi.fastutil.ints.IntSet;
|
||||
import it.unimi.dsi.fastutil.objects.Object2IntMap;
|
||||
import it.unimi.dsi.fastutil.objects.Object2IntOpenHashMap;
|
||||
import org.geysermc.connector.GeyserConnector;
|
||||
import org.geysermc.connector.utils.Toolbox;
|
||||
|
||||
|
@ -78,7 +83,8 @@ public class BlockTranslator {
|
|||
} catch (Exception e) {
|
||||
throw new AssertionError("Unable to load Java block mappings", e);
|
||||
}
|
||||
TObjectIntMap<CompoundTag> addedStatesMap = new TObjectIntHashMap<>(512, 0.5f, -1);
|
||||
Object2IntMap<CompoundTag> addedStatesMap = new Object2IntOpenHashMap<>();
|
||||
addedStatesMap.defaultReturnValue(-1);
|
||||
List<CompoundTag> paletteList = new ArrayList<>();
|
||||
|
||||
int waterRuntimeId = -1;
|
||||
|
|
|
@ -31,11 +31,11 @@ import com.nukkitx.protocol.bedrock.data.EntityFlag;
|
|||
import com.nukkitx.protocol.bedrock.data.PlayerPermission;
|
||||
import com.nukkitx.protocol.bedrock.packet.AdventureSettingsPacket;
|
||||
import com.nukkitx.protocol.bedrock.packet.SetEntityDataPacket;
|
||||
import it.unimi.dsi.fastutil.objects.ObjectOpenHashSet;
|
||||
import org.geysermc.connector.entity.Entity;
|
||||
import org.geysermc.connector.network.session.GeyserSession;
|
||||
import org.geysermc.connector.network.translators.PacketTranslator;
|
||||
|
||||
import java.util.HashSet;
|
||||
import java.util.Set;
|
||||
|
||||
public class JavaPlayerAbilitiesTranslator extends PacketTranslator<ServerPlayerAbilitiesPacket> {
|
||||
|
@ -54,7 +54,7 @@ public class JavaPlayerAbilitiesTranslator extends PacketTranslator<ServerPlayer
|
|||
entityDataPacket.getMetadata().putAll(metadata);
|
||||
session.getUpstream().sendPacket(entityDataPacket);
|
||||
|
||||
Set<AdventureSettingsPacket.Flag> playerFlags = new HashSet<>();
|
||||
Set<AdventureSettingsPacket.Flag> playerFlags = new ObjectOpenHashSet<>();
|
||||
playerFlags.add(AdventureSettingsPacket.Flag.AUTO_JUMP);
|
||||
if (packet.isCanFly())
|
||||
playerFlags.add(AdventureSettingsPacket.Flag.MAY_FLY);
|
||||
|
|
|
@ -27,6 +27,7 @@ package org.geysermc.connector.network.translators.java.scoreboard;
|
|||
|
||||
import com.github.steveice10.mc.protocol.packet.ingame.server.scoreboard.ServerTeamPacket;
|
||||
|
||||
import it.unimi.dsi.fastutil.objects.ObjectOpenHashSet;
|
||||
import org.geysermc.connector.GeyserConnector;
|
||||
import org.geysermc.connector.network.session.GeyserSession;
|
||||
import org.geysermc.connector.network.translators.PacketTranslator;
|
||||
|
@ -73,6 +74,6 @@ public class JavaTeamTranslator extends PacketTranslator<ServerTeamPacket> {
|
|||
}
|
||||
|
||||
private Set<String> toPlayerSet(String[] players) {
|
||||
return new HashSet<>(Arrays.asList(players));
|
||||
return new ObjectOpenHashSet<>(Arrays.asList(players));
|
||||
}
|
||||
}
|
||||
|
|
|
@ -36,11 +36,11 @@ import com.nukkitx.protocol.bedrock.data.EntityFlag;
|
|||
import com.nukkitx.protocol.bedrock.data.LevelEventType;
|
||||
import com.nukkitx.protocol.bedrock.data.PlayerPermission;
|
||||
import com.nukkitx.protocol.bedrock.packet.*;
|
||||
import it.unimi.dsi.fastutil.objects.ObjectOpenHashSet;
|
||||
import org.geysermc.connector.entity.Entity;
|
||||
import org.geysermc.connector.network.session.GeyserSession;
|
||||
import org.geysermc.connector.network.translators.PacketTranslator;
|
||||
|
||||
import java.util.HashSet;
|
||||
import java.util.Set;
|
||||
import java.util.concurrent.ThreadLocalRandom;
|
||||
|
||||
|
@ -68,7 +68,7 @@ public class JavaNotifyClientTranslator extends PacketTranslator<ServerNotifyCli
|
|||
session.getUpstream().sendPacket(stopRainPacket);
|
||||
break;
|
||||
case CHANGE_GAMEMODE:
|
||||
Set<AdventureSettingsPacket.Flag> playerFlags = new HashSet<>();
|
||||
Set<AdventureSettingsPacket.Flag> playerFlags = new ObjectOpenHashSet<>();
|
||||
GameMode gameMode = (GameMode) packet.getValue();
|
||||
if (gameMode == GameMode.ADVENTURE)
|
||||
playerFlags.add(AdventureSettingsPacket.Flag.IMMUTABLE_WORLD);
|
||||
|
|
|
@ -30,6 +30,7 @@ import com.nukkitx.protocol.bedrock.data.ScoreInfo;
|
|||
import com.nukkitx.protocol.bedrock.packet.RemoveObjectivePacket;
|
||||
import com.nukkitx.protocol.bedrock.packet.SetDisplayObjectivePacket;
|
||||
import com.nukkitx.protocol.bedrock.packet.SetScorePacket;
|
||||
import it.unimi.dsi.fastutil.objects.ObjectOpenHashSet;
|
||||
import lombok.Getter;
|
||||
|
||||
import org.geysermc.connector.network.session.GeyserSession;
|
||||
|
@ -113,7 +114,7 @@ public class Scoreboard {
|
|||
}
|
||||
|
||||
public void onUpdate() {
|
||||
Set<Objective> changedObjectives = new HashSet<>();
|
||||
Set<Objective> changedObjectives = new ObjectOpenHashSet<>();
|
||||
List<ScoreInfo> addScores = new ArrayList<>();
|
||||
List<ScoreInfo> removeScores = new ArrayList<>();
|
||||
|
||||
|
@ -133,7 +134,7 @@ public class Scoreboard {
|
|||
boolean hasUpdate = globalUpdate;
|
||||
|
||||
List<Score> handledScores = new ArrayList<>();
|
||||
for (String identifier : new HashSet<>(objective.getScores().keySet())) {
|
||||
for (String identifier : new ObjectOpenHashSet<>(objective.getScores().keySet())) {
|
||||
Score score = objective.getScores().get(identifier);
|
||||
Team team = score.getTeam();
|
||||
|
||||
|
|
|
@ -25,12 +25,12 @@
|
|||
|
||||
package org.geysermc.connector.scoreboard;
|
||||
|
||||
import it.unimi.dsi.fastutil.objects.ObjectOpenHashSet;
|
||||
import lombok.Getter;
|
||||
import lombok.Setter;
|
||||
import lombok.experimental.Accessors;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.HashSet;
|
||||
import java.util.List;
|
||||
import java.util.Set;
|
||||
|
||||
|
@ -45,7 +45,7 @@ public class Team {
|
|||
private String name;
|
||||
private String prefix;
|
||||
private String suffix;
|
||||
private Set<String> entities = new HashSet<>();
|
||||
private Set<String> entities = new ObjectOpenHashSet<>();
|
||||
|
||||
|
||||
public Team(Scoreboard scoreboard, String id) {
|
||||
|
|
|
@ -48,7 +48,7 @@ public class Toolbox {
|
|||
public static final ObjectMapper JSON_MAPPER = new ObjectMapper().disable(DeserializationFeature.FAIL_ON_IGNORED_PROPERTIES);
|
||||
public static final CompoundTag BIOMES;
|
||||
|
||||
public static final Collection<StartGamePacket.ItemEntry> ITEMS = new ArrayList<>();
|
||||
public static final List<StartGamePacket.ItemEntry> ITEMS = new ArrayList<>();
|
||||
|
||||
public static final Int2ObjectMap<ItemEntry> ITEM_ENTRIES = new Int2ObjectOpenHashMap<>();
|
||||
|
||||
|
|
Loading…
Reference in a new issue