Use more enhanced switches

Signed-off-by: TheMode <themode@outlook.fr>
This commit is contained in:
TheMode 2021-10-22 02:14:12 +02:00
parent b308ce5baa
commit 5030664ff9
13 changed files with 112 additions and 247 deletions

View File

@ -79,18 +79,10 @@ public enum EntitySpawnType {
0 0
); );
switch (paintingMeta.getDirection()) { switch (paintingMeta.getDirection()) {
case SOUTH: case SOUTH -> packet.direction = 0;
packet.direction = 0; case WEST -> packet.direction = 1;
break; case NORTH -> packet.direction = 2;
case WEST: case EAST -> packet.direction = 3;
packet.direction = 1;
break;
case NORTH:
packet.direction = 2;
break;
case EAST:
packet.direction = 3;
break;
} }
} else { } else {
packet.position = Vec.ZERO; packet.position = Vec.ZERO;

View File

@ -24,15 +24,9 @@ public class PufferfishMeta extends AbstractFishMeta {
private void updateBoundingBox(State state) { private void updateBoundingBox(State state) {
switch (state) { switch (state) {
case UNPUFFED: case UNPUFFED -> setBoundingBox(.35D, .35D);
setBoundingBox(.35D, .35D); case SEMI_PUFFED -> setBoundingBox(.5D, .5D);
break; default -> setBoundingBox(.7D, .7D);
case SEMI_PUFFED:
setBoundingBox(.5D, .5D);
break;
default:
setBoundingBox(.7D, .7D);
break;
} }
} }

View File

@ -40,15 +40,9 @@ public class EnchantmentTableInventory extends Inventory {
*/ */
public void setLevelRequirement(EnchantmentSlot enchantmentSlot, short level) { public void setLevelRequirement(EnchantmentSlot enchantmentSlot, short level) {
switch (enchantmentSlot) { switch (enchantmentSlot) {
case TOP: case TOP -> sendProperty(InventoryProperty.ENCHANTMENT_TABLE_LEVEL_REQUIREMENT_TOP, level);
sendProperty(InventoryProperty.ENCHANTMENT_TABLE_LEVEL_REQUIREMENT_TOP, level); case MIDDLE -> sendProperty(InventoryProperty.ENCHANTMENT_TABLE_LEVEL_REQUIREMENT_MIDDLE, level);
break; case BOTTOM -> sendProperty(InventoryProperty.ENCHANTMENT_TABLE_LEVEL_REQUIREMENT_BOTTOM, level);
case MIDDLE:
sendProperty(InventoryProperty.ENCHANTMENT_TABLE_LEVEL_REQUIREMENT_MIDDLE, level);
break;
case BOTTOM:
sendProperty(InventoryProperty.ENCHANTMENT_TABLE_LEVEL_REQUIREMENT_BOTTOM, level);
break;
} }
this.levelRequirements[enchantmentSlot.ordinal()] = level; this.levelRequirements[enchantmentSlot.ordinal()] = level;
} }
@ -96,15 +90,9 @@ public class EnchantmentTableInventory extends Inventory {
public void setEnchantmentShown(EnchantmentSlot enchantmentSlot, Enchantment enchantment) { public void setEnchantmentShown(EnchantmentSlot enchantmentSlot, Enchantment enchantment) {
final short id = enchantment == null ? -1 : (short) enchantment.id(); final short id = enchantment == null ? -1 : (short) enchantment.id();
switch (enchantmentSlot) { switch (enchantmentSlot) {
case TOP: case TOP -> sendProperty(InventoryProperty.ENCHANTMENT_TABLE_ENCH_ID_TOP, id);
sendProperty(InventoryProperty.ENCHANTMENT_TABLE_ENCH_ID_TOP, id); case MIDDLE -> sendProperty(InventoryProperty.ENCHANTMENT_TABLE_ENCH_ID_MIDDLE, id);
break; case BOTTOM -> sendProperty(InventoryProperty.ENCHANTMENT_TABLE_ENCH_ID_BOTTOM, id);
case MIDDLE:
sendProperty(InventoryProperty.ENCHANTMENT_TABLE_ENCH_ID_MIDDLE, id);
break;
case BOTTOM:
sendProperty(InventoryProperty.ENCHANTMENT_TABLE_ENCH_ID_BOTTOM, id);
break;
} }
this.enchantmentShown[enchantmentSlot.ordinal()] = id; this.enchantmentShown[enchantmentSlot.ordinal()] = id;
} }
@ -129,15 +117,9 @@ public class EnchantmentTableInventory extends Inventory {
*/ */
public void setEnchantmentLevel(EnchantmentSlot enchantmentSlot, short level) { public void setEnchantmentLevel(EnchantmentSlot enchantmentSlot, short level) {
switch (enchantmentSlot) { switch (enchantmentSlot) {
case TOP: case TOP -> sendProperty(InventoryProperty.ENCHANTMENT_TABLE_ENCH_LEVEL_TOP, level);
sendProperty(InventoryProperty.ENCHANTMENT_TABLE_ENCH_LEVEL_TOP, level); case MIDDLE -> sendProperty(InventoryProperty.ENCHANTMENT_TABLE_ENCH_LEVEL_MIDDLE, level);
break; case BOTTOM -> sendProperty(InventoryProperty.ENCHANTMENT_TABLE_ENCH_LEVEL_BOTTOM, level);
case MIDDLE:
sendProperty(InventoryProperty.ENCHANTMENT_TABLE_ENCH_LEVEL_MIDDLE, level);
break;
case BOTTOM:
sendProperty(InventoryProperty.ENCHANTMENT_TABLE_ENCH_LEVEL_BOTTOM, level);
break;
} }
this.enchantmentLevel[enchantmentSlot.ordinal()] = level; this.enchantmentLevel[enchantmentSlot.ordinal()] = level;
} }

View File

@ -10,21 +10,12 @@ public class EntityActionListener {
public static void listener(ClientEntityActionPacket packet, Player player) { public static void listener(ClientEntityActionPacket packet, Player player) {
ClientEntityActionPacket.Action action = packet.action; ClientEntityActionPacket.Action action = packet.action;
switch (action) { switch (action) {
case START_SNEAKING: case START_SNEAKING -> EntityActionListener.setSneaking(player, true);
EntityActionListener.setSneaking(player, true); case STOP_SNEAKING -> EntityActionListener.setSneaking(player, false);
break; case START_SPRINTING -> EntityActionListener.setSprinting(player, true);
case STOP_SNEAKING: case STOP_SPRINTING -> EntityActionListener.setSprinting(player, false);
EntityActionListener.setSneaking(player, false); case START_FLYING_ELYTRA -> EntityActionListener.startFlyingElytra(player);
break;
case START_SPRINTING:
EntityActionListener.setSprinting(player, true);
break;
case STOP_SPRINTING:
EntityActionListener.setSprinting(player, false);
break;
case START_FLYING_ELYTRA:
EntityActionListener.startFlyingElytra(player);
break;
// TODO do remaining actions // TODO do remaining actions
} }
} }

View File

@ -13,13 +13,10 @@ public class StatusListener {
public static void listener(ClientStatusPacket packet, Player player) { public static void listener(ClientStatusPacket packet, Player player) {
switch (packet.action) { switch (packet.action) {
case PERFORM_RESPAWN: case PERFORM_RESPAWN -> player.respawn();
player.respawn(); case REQUEST_STATS -> {
break;
case REQUEST_STATS:
List<StatisticsPacket.Statistic> statisticList = new ArrayList<>(); List<StatisticsPacket.Statistic> statisticList = new ArrayList<>();
StatisticsPacket statisticsPacket = new StatisticsPacket(); StatisticsPacket statisticsPacket = new StatisticsPacket();
final Map<PlayerStatistic, Integer> playerStatisticValueMap = player.getStatisticValueMap(); final Map<PlayerStatistic, Integer> playerStatisticValueMap = player.getStatisticValueMap();
for (var entry : playerStatisticValueMap.entrySet()) { for (var entry : playerStatisticValueMap.entrySet()) {
final PlayerStatistic playerStatistic = entry.getKey(); final PlayerStatistic playerStatistic = entry.getKey();
@ -32,11 +29,9 @@ public class StatusListener {
statisticList.add(statistic); statisticList.add(statistic);
} }
statisticsPacket.statistics = statisticList.toArray(new StatisticsPacket.Statistic[0]); statisticsPacket.statistics = statisticList.toArray(new StatisticsPacket.Statistic[0]);
player.getPlayerConnection().sendPacket(statisticsPacket); player.getPlayerConnection().sendPacket(statisticsPacket);
break; }
} }
} }

View File

@ -8,8 +8,8 @@ import net.minestom.server.network.packet.client.handler.ClientLoginPacketsHandl
import net.minestom.server.network.packet.client.handler.ClientPlayPacketsHandler; import net.minestom.server.network.packet.client.handler.ClientPlayPacketsHandler;
import net.minestom.server.network.packet.client.handler.ClientStatusPacketsHandler; import net.minestom.server.network.packet.client.handler.ClientStatusPacketsHandler;
import net.minestom.server.network.packet.client.handshake.HandshakePacket; import net.minestom.server.network.packet.client.handshake.HandshakePacket;
import net.minestom.server.network.player.PlayerSocketConnection;
import net.minestom.server.network.player.PlayerConnection; import net.minestom.server.network.player.PlayerConnection;
import net.minestom.server.network.player.PlayerSocketConnection;
import net.minestom.server.utils.binary.BinaryReader; import net.minestom.server.utils.binary.BinaryReader;
import net.minestom.server.utils.binary.Readable; import net.minestom.server.utils.binary.Readable;
import org.jetbrains.annotations.NotNull; import org.jetbrains.annotations.NotNull;
@ -59,23 +59,23 @@ public final class PacketProcessor {
return; return;
} }
switch (connectionState) { switch (connectionState) {
case PLAY: case PLAY -> {
final Player player = playerConnection.getPlayer(); final Player player = playerConnection.getPlayer();
ClientPlayPacket playPacket = (ClientPlayPacket) playPacketsHandler.getPacketInstance(packetId); ClientPlayPacket playPacket = (ClientPlayPacket) playPacketsHandler.getPacketInstance(packetId);
safeRead(playerConnection, playPacket, binaryReader); safeRead(playerConnection, playPacket, binaryReader);
assert player != null; assert player != null;
player.addPacketToQueue(playPacket); player.addPacketToQueue(playPacket);
break; }
case LOGIN: case LOGIN -> {
final ClientPreplayPacket loginPacket = (ClientPreplayPacket) loginPacketsHandler.getPacketInstance(packetId); final ClientPreplayPacket loginPacket = (ClientPreplayPacket) loginPacketsHandler.getPacketInstance(packetId);
safeRead(playerConnection, loginPacket, binaryReader); safeRead(playerConnection, loginPacket, binaryReader);
loginPacket.process(playerConnection); loginPacket.process(playerConnection);
break; }
case STATUS: case STATUS -> {
final ClientPreplayPacket statusPacket = (ClientPreplayPacket) statusPacketsHandler.getPacketInstance(packetId); final ClientPreplayPacket statusPacket = (ClientPreplayPacket) statusPacketsHandler.getPacketInstance(packetId);
safeRead(playerConnection, statusPacket, binaryReader); safeRead(playerConnection, statusPacket, binaryReader);
statusPacket.process(playerConnection); statusPacket.process(playerConnection);
break; }
} }
} }

View File

@ -100,42 +100,30 @@ public class DeclareCommandsPacket implements ServerPacket {
} }
private byte[] getProperties(BinaryReader reader, String parser) { private byte[] getProperties(BinaryReader reader, String parser) {
switch (parser) { return switch (parser) {
case "brigadier:double": case "brigadier:double" -> reader.extractBytes(() -> {
return reader.extractBytes(() -> { byte flags = reader.readByte();
byte flags = reader.readByte(); if ((flags & 0x01) == 0x01) {
if ((flags & 0x01) == 0x01) { reader.readDouble(); // min
reader.readDouble(); // min }
} if ((flags & 0x02) == 0x02) {
if ((flags & 0x02) == 0x02) { reader.readDouble(); // max
reader.readDouble(); // max }
} });
}); case "brigadier:integer" -> reader.extractBytes(() -> {
byte flags = reader.readByte();
case "brigadier:integer": if ((flags & 0x01) == 0x01) {
return reader.extractBytes(() -> { reader.readInt(); // min
byte flags = reader.readByte(); }
if ((flags & 0x01) == 0x01) { if ((flags & 0x02) == 0x02) {
reader.readInt(); // min reader.readInt(); // max
} }
if ((flags & 0x02) == 0x02) { });
reader.readInt(); // max case "brigadier:string" -> reader.extractBytes(reader::readVarInt);
} case "brigadier:entity", "brigadier:score_holder" -> reader.extractBytes(reader::readByte);
}); case "brigadier:range" -> reader.extractBytes(reader::readBoolean); // https://wiki.vg/Command_Data#minecraft:range, looks fishy
default -> new byte[0]; // unknown
case "brigadier:string": };
return reader.extractBytes(reader::readVarInt);
case "brigadier:entity":
case "brigadier:score_holder":
return reader.extractBytes(reader::readByte);
case "brigadier:range":
return reader.extractBytes(reader::readBoolean); // https://wiki.vg/Command_Data#minecraft:range, looks fishy
default:
return new byte[0]; // unknown
}
} }
private boolean isLiteral() { private boolean isLiteral() {

View File

@ -36,40 +36,15 @@ public class DeclareRecipesPacket implements ServerPacket {
String id = reader.readSizedString(); String id = reader.readSizedString();
switch (type) { switch (type) {
case "crafting_shapeless": case "crafting_shapeless" -> recipes[i] = new DeclaredShapelessCraftingRecipe(id, reader);
recipes[i] = new DeclaredShapelessCraftingRecipe(id, reader); case "crafting_shaped" -> recipes[i] = new DeclaredShapedCraftingRecipe(id, reader);
break; case "smelting" -> recipes[i] = new DeclaredSmeltingRecipe(id, reader);
case "blasting" -> recipes[i] = new DeclaredBlastingRecipe(id, reader);
case "crafting_shaped": case "smoking" -> recipes[i] = new DeclaredSmokingRecipe(id, reader);
recipes[i] = new DeclaredShapedCraftingRecipe(id, reader); case "campfire_cooking" -> recipes[i] = new DeclaredCampfireCookingRecipe(id, reader);
break; case "stonecutter" -> recipes[i] = new DeclaredStonecutterRecipe(id, reader);
case "smithing" -> recipes[i] = new DeclaredSmithingRecipe(id, reader);
case "smelting": default -> throw new UnsupportedOperationException("Unrecognized type: " + type + " (id is " + id + ")");
recipes[i] = new DeclaredSmeltingRecipe(id, reader);
break;
case "blasting":
recipes[i] = new DeclaredBlastingRecipe(id, reader);
break;
case "smoking":
recipes[i] = new DeclaredSmokingRecipe(id, reader);
break;
case "campfire_cooking":
recipes[i] = new DeclaredCampfireCookingRecipe(id, reader);
break;
case "stonecutter":
recipes[i] = new DeclaredStonecutterRecipe(id, reader);
break;
case "smithing":
recipes[i] = new DeclaredSmithingRecipe(id, reader);
break;
default:
throw new UnsupportedOperationException("Unrecognized type: " + type + " (id is " + id + ")");
} }
} }
} }

View File

@ -49,28 +49,13 @@ public class PlayerInfoPacket implements ComponentHoldingServerPacket {
for (int i = 0; i < playerInfoCount; i++) { for (int i = 0; i < playerInfoCount; i++) {
UUID uuid = reader.readUuid(); UUID uuid = reader.readUuid();
PlayerInfo info; PlayerInfo info = switch (action) {
switch (action) { case ADD_PLAYER -> new AddPlayer(uuid, reader);
case ADD_PLAYER: case UPDATE_GAMEMODE -> new UpdateGamemode(uuid, reader);
info = new AddPlayer(uuid, reader); case UPDATE_LATENCY -> new UpdateLatency(uuid, reader);
break; case UPDATE_DISPLAY_NAME -> new UpdateDisplayName(uuid, reader);
case UPDATE_GAMEMODE: case REMOVE_PLAYER -> new RemovePlayer(uuid);
info = new UpdateGamemode(uuid, reader); };
break;
case UPDATE_LATENCY:
info = new UpdateLatency(uuid, reader);
break;
case UPDATE_DISPLAY_NAME:
info = new UpdateDisplayName(uuid, reader);
break;
case REMOVE_PLAYER:
info = new RemovePlayer(uuid);
break;
default:
throw new IllegalArgumentException("Unsupported action encountered: " + action.name());
}
playerInfos.set(i, info); playerInfos.set(i, info);
} }
} }

View File

@ -42,7 +42,7 @@ public class RecipeManager {
List<DeclareRecipesPacket.DeclaredRecipe> recipesCache = new ArrayList<>(); List<DeclareRecipesPacket.DeclaredRecipe> recipesCache = new ArrayList<>();
for (Recipe recipe : recipes) { for (Recipe recipe : recipes) {
switch (recipe.recipeType) { switch (recipe.recipeType) {
case SHAPELESS: { case SHAPELESS -> {
ShapelessRecipe shapelessRecipe = (ShapelessRecipe) recipe; ShapelessRecipe shapelessRecipe = (ShapelessRecipe) recipe;
recipesCache.add( recipesCache.add(
new DeclareRecipesPacket.DeclaredShapelessCraftingRecipe( new DeclareRecipesPacket.DeclaredShapelessCraftingRecipe(
@ -52,9 +52,8 @@ public class RecipeManager {
shapelessRecipe.getResult() shapelessRecipe.getResult()
) )
); );
break;
} }
case SHAPED: { case SHAPED -> {
ShapedRecipe shapedRecipe = (ShapedRecipe) recipe; ShapedRecipe shapedRecipe = (ShapedRecipe) recipe;
recipesCache.add( recipesCache.add(
new DeclareRecipesPacket.DeclaredShapedCraftingRecipe( new DeclareRecipesPacket.DeclaredShapedCraftingRecipe(
@ -66,9 +65,8 @@ public class RecipeManager {
shapedRecipe.getResult() shapedRecipe.getResult()
) )
); );
break;
} }
case SMELTING: { case SMELTING -> {
SmeltingRecipe smeltingRecipe = (SmeltingRecipe) recipe; SmeltingRecipe smeltingRecipe = (SmeltingRecipe) recipe;
recipesCache.add( recipesCache.add(
new DeclareRecipesPacket.DeclaredSmeltingRecipe( new DeclareRecipesPacket.DeclaredSmeltingRecipe(
@ -80,9 +78,8 @@ public class RecipeManager {
smeltingRecipe.getCookingTime() smeltingRecipe.getCookingTime()
) )
); );
break;
} }
case BLASTING: { case BLASTING -> {
BlastingRecipe blastingRecipe = (BlastingRecipe) recipe; BlastingRecipe blastingRecipe = (BlastingRecipe) recipe;
recipesCache.add( recipesCache.add(
new DeclareRecipesPacket.DeclaredBlastingRecipe( new DeclareRecipesPacket.DeclaredBlastingRecipe(
@ -94,9 +91,8 @@ public class RecipeManager {
blastingRecipe.getCookingTime() blastingRecipe.getCookingTime()
) )
); );
break;
} }
case SMOKING: { case SMOKING -> {
SmokingRecipe smokingRecipe = (SmokingRecipe) recipe; SmokingRecipe smokingRecipe = (SmokingRecipe) recipe;
recipesCache.add( recipesCache.add(
new DeclareRecipesPacket.DeclaredSmokingRecipe( new DeclareRecipesPacket.DeclaredSmokingRecipe(
@ -108,9 +104,8 @@ public class RecipeManager {
smokingRecipe.getCookingTime() smokingRecipe.getCookingTime()
) )
); );
break;
} }
case CAMPFIRE_COOKING: { case CAMPFIRE_COOKING -> {
CampfireCookingRecipe campfireCookingRecipe = (CampfireCookingRecipe) recipe; CampfireCookingRecipe campfireCookingRecipe = (CampfireCookingRecipe) recipe;
recipesCache.add( recipesCache.add(
new DeclareRecipesPacket.DeclaredCampfireCookingRecipe( new DeclareRecipesPacket.DeclaredCampfireCookingRecipe(
@ -122,9 +117,8 @@ public class RecipeManager {
campfireCookingRecipe.getCookingTime() campfireCookingRecipe.getCookingTime()
) )
); );
break;
} }
case STONECUTTING: { case STONECUTTING -> {
StonecutterRecipe stonecuttingRecipe = (StonecutterRecipe) recipe; StonecutterRecipe stonecuttingRecipe = (StonecutterRecipe) recipe;
recipesCache.add( recipesCache.add(
new DeclareRecipesPacket.DeclaredStonecutterRecipe( new DeclareRecipesPacket.DeclaredStonecutterRecipe(
@ -134,9 +128,8 @@ public class RecipeManager {
stonecuttingRecipe.getResult() stonecuttingRecipe.getResult()
) )
); );
break;
} }
case SMITHING: { case SMITHING -> {
SmithingRecipe smithingRecipe = (SmithingRecipe) recipe; SmithingRecipe smithingRecipe = (SmithingRecipe) recipe;
recipesCache.add( recipesCache.add(
new DeclareRecipesPacket.DeclaredSmithingRecipe( new DeclareRecipesPacket.DeclaredSmithingRecipe(
@ -146,7 +139,6 @@ public class RecipeManager {
smithingRecipe.getResult() smithingRecipe.getResult()
) )
); );
break;
} }
} }
} }

View File

@ -115,32 +115,17 @@ public class StringUtils {
continue; continue;
} }
switch (nextChar) { switch (nextChar) {
case '\\': case '\\' -> ch = '\\';
ch = '\\'; case 'b' -> ch = '\b';
break; case 'f' -> ch = '\f';
case 'b': case 'n' -> ch = '\n';
ch = '\b'; case 'r' -> ch = '\r';
break; case 't' -> ch = '\t';
case 'f': case '\"' -> ch = '\"';
ch = '\f'; case '\'' -> ch = '\'';
break;
case 'n':
ch = '\n';
break;
case 'r':
ch = '\r';
break;
case 't':
ch = '\t';
break;
case '\"':
ch = '\"';
break;
case '\'':
ch = '\'';
break;
// Hex Unicode: u???? // Hex Unicode: u????
case 'u': case 'u' -> {
if (i >= st.length() - 5) { if (i >= st.length() - 5) {
ch = 'u'; ch = 'u';
break; break;
@ -151,6 +136,7 @@ public class StringUtils {
sb.append(Character.toChars(code)); sb.append(Character.toChars(code));
i += 5; i += 5;
continue; continue;
}
} }
i++; i++;
} }

View File

@ -220,22 +220,16 @@ public class EntityFinder {
// Sort & limit // Sort & limit
if (entitySort != EntitySort.ARBITRARY || limit != null) { if (entitySort != EntitySort.ARBITRARY || limit != null) {
result = result.stream() result = result.stream()
.sorted((ent1, ent2) -> { .sorted((ent1, ent2) -> switch (entitySort) {
switch (entitySort) { case ARBITRARY, RANDOM ->
case ARBITRARY:
case RANDOM:
// RANDOM is handled below // RANDOM is handled below
return 1; 1;
case FURTHEST: case FURTHEST -> pos.distance(ent1.getPosition()) >
return pos.distance(ent1.getPosition()) > pos.distance(ent2.getPosition()) ?
pos.distance(ent2.getPosition()) ? 1 : 0;
1 : 0; case NEAREST -> pos.distance(ent1.getPosition()) <
case NEAREST: pos.distance(ent2.getPosition()) ?
return pos.distance(ent1.getPosition()) < 1 : 0;
pos.distance(ent2.getPosition()) ?
1 : 0;
}
return 1;
}) })
.limit(limit != null ? limit : Integer.MAX_VALUE) .limit(limit != null ? limit : Integer.MAX_VALUE)
.collect(Collectors.toList()); .collect(Collectors.toList());

View File

@ -29,28 +29,19 @@ public final class PlayerInventoryUtils {
* @return a packet which can be use internally with Minestom * @return a packet which can be use internally with Minestom
*/ */
public static int convertPlayerInventorySlot(int slot, int offset) { public static int convertPlayerInventorySlot(int slot, int offset) {
switch (slot) { return switch (slot) {
case 0: case 0 -> CRAFT_RESULT;
return CRAFT_RESULT; case 1 -> CRAFT_SLOT_1;
case 1: case 2 -> CRAFT_SLOT_2;
return CRAFT_SLOT_1; case 3 -> CRAFT_SLOT_3;
case 2: case 4 -> CRAFT_SLOT_4;
return CRAFT_SLOT_2; case 5 -> HELMET_SLOT;
case 3: case 6 -> CHESTPLATE_SLOT;
return CRAFT_SLOT_3; case 7 -> LEGGINGS_SLOT;
case 4: case 8 -> BOOTS_SLOT;
return CRAFT_SLOT_4; default -> convertSlot(slot, offset);
case 5: };
return HELMET_SLOT;
case 6:
return CHESTPLATE_SLOT;
case 7:
return LEGGINGS_SLOT;
case 8:
return BOOTS_SLOT;
}
return convertSlot(slot, offset);
} }
public static int convertSlot(int slot, int offset) { public static int convertSlot(int slot, int offset) {