Merge branch 'master' into hardcore-fix

This commit is contained in:
LetsGoAway 2024-12-22 20:22:13 +08:00 committed by GitHub
commit e161703db3
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
10 changed files with 402 additions and 297 deletions

View file

@ -35,22 +35,22 @@ import lombok.Getter;
public enum GeyserAttributeType {
// Universal Attributes
FOLLOW_RANGE("minecraft:generic.follow_range", "minecraft:follow_range", 0f, 2048f, 32f),
KNOCKBACK_RESISTANCE("minecraft:generic.knockback_resistance", "minecraft:knockback_resistance", 0f, 1f, 0f),
MOVEMENT_SPEED("minecraft:generic.movement_speed", "minecraft:movement", 0f, 1024f, 0.1f),
FLYING_SPEED("minecraft:generic.flying_speed", "minecraft:movement", 0.0f, 1024.0f, 0.4000000059604645f),
ATTACK_DAMAGE("minecraft:generic.attack_damage", "minecraft:attack_damage", 0f, 2048f, 1f),
HORSE_JUMP_STRENGTH("minecraft:horse.jump_strength", "minecraft:horse.jump_strength", 0.0f, 2.0f, 0.7f),
LUCK("minecraft:generic.luck", "minecraft:luck", -1024f, 1024f, 0f),
FOLLOW_RANGE("minecraft:follow_range", "minecraft:follow_range", 0f, 2048f, 32f),
KNOCKBACK_RESISTANCE("minecraft:knockback_resistance", "minecraft:knockback_resistance", 0f, 1f, 0f),
MOVEMENT_SPEED("minecraft:movement_speed", "minecraft:movement", 0f, 1024f, 0.1f),
FLYING_SPEED("minecraft:flying_speed", "minecraft:movement", 0.0f, 1024.0f, 0.4000000059604645f),
ATTACK_DAMAGE("minecraft:attack_damage", "minecraft:attack_damage", 0f, 2048f, 1f),
HORSE_JUMP_STRENGTH("minecraft:jump_strength", "minecraft:horse.jump_strength", 0.0f, 2.0f, 0.7f),
LUCK("minecraft:luck", "minecraft:luck", -1024f, 1024f, 0f),
// Java Attributes
ARMOR("minecraft:generic.armor", null, 0f, 30f, 0f),
ARMOR_TOUGHNESS("minecraft:generic.armor_toughness", null, 0F, 20f, 0f),
ATTACK_KNOCKBACK("minecraft:generic.attack_knockback", null, 1.5f, Float.MAX_VALUE, 0f),
ATTACK_SPEED("minecraft:generic.attack_speed", null, 0f, 1024f, 4f),
MAX_HEALTH("minecraft:generic.max_health", null, 0f, 1024f, 20f),
SCALE("minecraft:generic.scale", null, 0.0625f, 16f, 1f),
BLOCK_INTERACTION_RANGE("minecraft:player.block_interaction_range", null, 0.0f, 64f, 4.5f),
ARMOR("minecraft:armor", null, 0f, 30f, 0f),
ARMOR_TOUGHNESS("minecraft:armor_toughness", null, 0F, 20f, 0f),
ATTACK_KNOCKBACK("minecraft:attack_knockback", null, 1.5f, Float.MAX_VALUE, 0f),
ATTACK_SPEED("minecraft:attack_speed", null, 0f, 1024f, 4f),
MAX_HEALTH("minecraft:max_health", null, 0f, 1024f, 20f),
SCALE("minecraft:scale", null, 0.0625f, 16f, 1f),
BLOCK_INTERACTION_RANGE("minecraft:block_interaction_range", null, 0.0f, 64f, 4.5f),
MINING_EFFICIENCY("minecraft:mining_efficiency", null, 0f, 1024f, 0f),
BLOCK_BREAK_SPEED("minecraft:block_break_speed", null, 0f, 1024f, 1f),
SUBMERGED_MINING_SPEED("minecraft:submerged_mining_speed", null, 0f, 20f, 0.2f),

View file

@ -32,8 +32,6 @@ import org.cloudburstmc.protocol.bedrock.packet.AnimatePacket;
import org.cloudburstmc.protocol.bedrock.packet.MoveEntityAbsolutePacket;
import org.geysermc.geyser.entity.EntityDefinition;
import org.geysermc.geyser.entity.EntityDefinitions;
import org.geysermc.geyser.item.Items;
import org.geysermc.geyser.item.type.Item;
import org.geysermc.geyser.network.GameProtocol;
import org.geysermc.geyser.session.GeyserSession;
import org.geysermc.geyser.util.InteractionResult;
@ -220,10 +218,6 @@ public class BoatEntity extends Entity implements Leashable, Tickable {
return leashHolderBedrockId;
}
public Item getPickItem() {
return variant.pickItem;
}
private void sendAnimationPacket(GeyserSession session, Entity rower, AnimatePacket.Action action, float rowTime) {
AnimatePacket packet = new AnimatePacket();
packet.setRuntimeEntityId(rower.getGeyserId());
@ -236,23 +230,17 @@ public class BoatEntity extends Entity implements Leashable, Tickable {
* Ordered by Bedrock ordinal
*/
public enum BoatVariant {
OAK(Items.OAK_BOAT, Items.OAK_CHEST_BOAT),
SPRUCE(Items.SPRUCE_BOAT, Items.SPRUCE_CHEST_BOAT),
BIRCH(Items.BIRCH_BOAT, Items.BIRCH_CHEST_BOAT),
JUNGLE(Items.JUNGLE_BOAT, Items.JUNGLE_CHEST_BOAT),
ACACIA(Items.ACACIA_BOAT, Items.ACACIA_CHEST_BOAT),
DARK_OAK(Items.DARK_OAK_BOAT, Items.DARK_OAK_CHEST_BOAT),
MANGROVE(Items.MANGROVE_BOAT, Items.MANGROVE_CHEST_BOAT),
BAMBOO(Items.BAMBOO_RAFT, Items.BAMBOO_CHEST_RAFT),
CHERRY(Items.CHERRY_BOAT, Items.CHERRY_CHEST_BOAT),
PALE_OAK(Items.PALE_OAK_BOAT, Items.PALE_OAK_CHEST_BOAT);
OAK,
SPRUCE,
BIRCH,
JUNGLE,
ACACIA,
DARK_OAK,
MANGROVE,
BAMBOO,
CHERRY,
PALE_OAK;
private final Item pickItem;
final Item chestPickItem;
BoatVariant(Item pickItem, Item chestPickItem) {
this.pickItem = pickItem;
this.chestPickItem = chestPickItem;
}
BoatVariant() {}
}
}

View file

@ -27,7 +27,6 @@ package org.geysermc.geyser.entity.type;
import org.cloudburstmc.math.vector.Vector3f;
import org.geysermc.geyser.entity.EntityDefinition;
import org.geysermc.geyser.item.type.Item;
import org.geysermc.geyser.session.GeyserSession;
import org.geysermc.geyser.util.InteractionResult;
import org.geysermc.geyser.util.InteractiveTag;
@ -49,9 +48,4 @@ public class ChestBoatEntity extends BoatEntity {
public InteractionResult interact(Hand hand) {
return passengers.isEmpty() && !session.isSneaking() ? super.interact(hand) : InteractionResult.SUCCESS;
}
@Override
public Item getPickItem() {
return this.variant.chestPickItem;
}
}

View file

@ -25,18 +25,25 @@
package org.geysermc.geyser.entity.type;
import lombok.Getter;
import net.kyori.adventure.text.Component;
import net.kyori.adventure.text.serializer.plain.PlainTextComponentSerializer;
import org.cloudburstmc.math.vector.Vector3f;
import org.cloudburstmc.protocol.bedrock.data.entity.EntityDataTypes;
import org.geysermc.geyser.entity.EntityDefinition;
import org.geysermc.geyser.session.GeyserSession;
import org.geysermc.geyser.translator.text.MessageTranslator;
import org.geysermc.mcprotocollib.protocol.data.game.entity.metadata.EntityMetadata;
import org.jetbrains.annotations.Nullable;
import java.util.UUID;
// Note: 1.19.4 requires that the billboard is set to something in order to show, on Java Edition
@Getter
public class TextDisplayEntity extends DisplayBaseEntity {
private int lineCount;
public TextDisplayEntity(GeyserSession session, int entityId, long geyserId, UUID uuid, EntityDefinition<?> definition, Vector3f position, Vector3f motion, float yaw, float pitch, float headYaw) {
super(session, entityId, geyserId, uuid, definition, position.add(0, definition.offset(), 0), motion, yaw, pitch, headYaw);
}
@ -61,5 +68,14 @@ public class TextDisplayEntity extends DisplayBaseEntity {
public void setText(EntityMetadata<Component, ?> entityMetadata) {
this.dirtyMetadata.put(EntityDataTypes.NAME, MessageTranslator.convertMessage(entityMetadata.getValue()));
calculateLineCount(entityMetadata.getValue());
}
private void calculateLineCount(@Nullable Component text) {
if (text == null) {
lineCount = 0;
return;
}
lineCount = PlainTextComponentSerializer.plainText().serialize(text).split("\n").length;
}
}

View file

@ -31,6 +31,7 @@ import lombok.RequiredArgsConstructor;
import org.checkerframework.checker.nullness.qual.NonNull;
import org.geysermc.api.util.ApiVersion;
import org.geysermc.geyser.GeyserImpl;
import org.geysermc.geyser.GeyserLogger;
import org.geysermc.geyser.api.GeyserApi;
import org.geysermc.geyser.api.event.ExtensionEventBus;
import org.geysermc.geyser.api.extension.Extension;
@ -42,6 +43,7 @@ import org.geysermc.geyser.api.extension.exception.InvalidDescriptionException;
import org.geysermc.geyser.api.extension.exception.InvalidExtensionException;
import org.geysermc.geyser.extension.event.GeyserExtensionEventBus;
import org.geysermc.geyser.text.GeyserLocale;
import org.geysermc.geyser.util.ThrowingBiConsumer;
import java.io.IOException;
import java.io.Reader;
@ -51,10 +53,12 @@ import java.nio.file.Files;
import java.nio.file.NoSuchFileException;
import java.nio.file.Path;
import java.nio.file.StandardCopyOption;
import java.util.ArrayList;
import java.util.HashMap;
import java.util.LinkedHashMap;
import java.util.List;
import java.util.Map;
import java.util.function.BiConsumer;
import java.util.regex.Pattern;
@RequiredArgsConstructor
@ -155,6 +159,7 @@ public class GeyserExtensionLoader extends ExtensionLoader {
@Override
protected void loadAllExtensions(@NonNull ExtensionManager extensionManager) {
GeyserLogger logger = GeyserImpl.getInstance().getLogger();
try {
if (Files.notExists(extensionsDirectory)) {
Files.createDirectory(extensionsDirectory);
@ -163,26 +168,39 @@ public class GeyserExtensionLoader extends ExtensionLoader {
Map<String, Path> extensions = new LinkedHashMap<>();
Map<String, GeyserExtensionContainer> loadedExtensions = new LinkedHashMap<>();
Pattern[] extensionFilters = this.extensionFilters();
List<Path> extensionPaths = Files.walk(extensionsDirectory).toList();
extensionPaths.forEach(path -> {
if (Files.isDirectory(path)) {
return;
}
Path updateDirectory = extensionsDirectory.resolve("update");
if (Files.isDirectory(updateDirectory)) {
// Step 1: Collect the extension files that currently exist so they can be replaced
Map<String, List<Path>> extensionFiles = new HashMap<>();
this.processExtensionsFolder(extensionsDirectory, (path, description) -> {
extensionFiles.computeIfAbsent(description.id(), k -> new ArrayList<>()).add(path);
}, (path, e) -> {
// this file will throw again when we actually try to load extensions, and it will be handled there
});
for (Pattern filter : extensionFilters) {
if (!filter.matcher(path.getFileName().toString()).matches()) {
return;
// Step 2: Move the updated/new extensions
this.processExtensionsFolder(updateDirectory, (path, description) -> {
// Remove the old extension files with the same ID if it exists
List<Path> oldExtensionFiles = extensionFiles.get(description.id());
if (oldExtensionFiles != null) {
for (Path oldExtensionFile : oldExtensionFiles) {
Files.delete(oldExtensionFile);
}
}
try {
GeyserExtensionDescription description = this.extensionDescription(path);
// Overwrite the extension with the new jar
Files.move(path, extensionsDirectory.resolve(path.getFileName()), StandardCopyOption.REPLACE_EXISTING);
}, (path, e) -> {
logger.error(GeyserLocale.getLocaleStringLog("geyser.extensions.update.failed", path.getFileName()), e);
});
}
// Step 3: Load the extensions
this.processExtensionsFolder(extensionsDirectory, (path, description) -> {
String name = description.name();
String id = description.id();
if (extensions.containsKey(id) || extensionManager.extension(id) != null) {
GeyserImpl.getInstance().getLogger().warning(GeyserLocale.getLocaleStringLog("geyser.extensions.load.duplicate", name, path.toString()));
logger.warning(GeyserLocale.getLocaleStringLog("geyser.extensions.load.duplicate", name, path.toString()));
return;
}
@ -196,10 +214,10 @@ public class GeyserExtensionLoader extends ExtensionLoader {
if (compatibility != ApiVersion.Compatibility.COMPATIBLE) {
// Workaround for the switch to the Geyser API version instead of the Base API version in extensions
if (compatibility == ApiVersion.Compatibility.HUMAN_DIFFER && description.humanApiVersion() == 1) {
GeyserImpl.getInstance().getLogger().warning("The extension %s requested the Base API version %s, which is deprecated in favor of specifying the Geyser API version. Please update the extension, or contact its developer."
logger.warning("The extension %s requested the Base API version %s, which is deprecated in favor of specifying the Geyser API version. Please update the extension, or contact its developer."
.formatted(name, description.apiVersion()));
} else {
GeyserImpl.getInstance().getLogger().error(GeyserLocale.getLocaleStringLog("geyser.extensions.load.failed_api_version", name, description.apiVersion()));
logger.error(GeyserLocale.getLocaleStringLog("geyser.extensions.load.failed_api_version", name, description.apiVersion()));
return;
}
}
@ -207,11 +225,11 @@ public class GeyserExtensionLoader extends ExtensionLoader {
GeyserExtensionContainer container = this.loadExtension(path, description);
extensions.put(id, path);
loadedExtensions.put(id, container);
} catch (Throwable e) {
GeyserImpl.getInstance().getLogger().error(GeyserLocale.getLocaleStringLog("geyser.extensions.load.failed_with_name", path.getFileName(), path.toAbsolutePath()), e);
}
}, (path, e) -> {
logger.error(GeyserLocale.getLocaleStringLog("geyser.extensions.load.failed_with_name", path.getFileName(), path.toAbsolutePath()), e);
});
// Step 4: Register the extensions
for (GeyserExtensionContainer container : loadedExtensions.values()) {
this.extensionContainers.put(container.extension(), container);
this.register(container.extension(), extensionManager);
@ -221,6 +239,40 @@ public class GeyserExtensionLoader extends ExtensionLoader {
}
}
/**
* Process extension jars in a folder and call the accept or reject consumer based on the result
*
* @param directory the directory to process
* @param accept the consumer to call when an extension is accepted
* @param reject the consumer to call when an extension is rejected
* @throws IOException if an I/O error occurs
*/
private void processExtensionsFolder(Path directory, ThrowingBiConsumer<Path, GeyserExtensionDescription> accept, BiConsumer<Path, Throwable> reject) throws IOException {
List<Path> extensionPaths = Files.list(directory).toList();
Pattern[] extensionFilters = this.extensionFilters();
extensionPaths.forEach(path -> {
if (Files.isDirectory(path)) {
return;
}
// Only look at files that meet the extension filter
for (Pattern filter : extensionFilters) {
if (!filter.matcher(path.getFileName().toString()).matches()) {
return;
}
}
try {
// Try load the description, so we know it's a valid extension
GeyserExtensionDescription description = this.extensionDescription(path);
accept.acceptThrows(path, description);
} catch (Throwable e) {
reject.accept(path, e);
}
});
}
@Override
protected boolean isEnabled(@NonNull Extension extension) {
return this.extensionContainers.get(extension).enabled;

View file

@ -30,26 +30,26 @@ public enum MapColor {
COLOR_1(-1, -1, -1),
COLOR_2(-1, -1, -1),
COLOR_3(-1, -1, -1),
COLOR_4(89, 125, 39),
COLOR_5(109, 153, 48),
COLOR_6(127, 178, 56),
COLOR_7(67, 94, 29),
COLOR_8(174, 164, 115),
COLOR_9(213, 201, 140),
COLOR_10(247, 233, 163),
COLOR_11(130, 123, 86),
COLOR_4(39, 125, 89),
COLOR_5(48, 153, 109),
COLOR_6(56, 178, 127),
COLOR_7(29, 94, 67),
COLOR_8(115, 164, 174),
COLOR_9(140, 201, 213),
COLOR_10(163, 233, 247),
COLOR_11(86, 123, 130),
COLOR_12(140, 140, 140),
COLOR_13(171, 171, 171),
COLOR_14(199, 199, 199),
COLOR_15(105, 105, 105),
COLOR_16(180, 0, 0),
COLOR_17(220, 0, 0),
COLOR_18(255, 0, 0),
COLOR_19(135, 0, 0),
COLOR_20(112, 112, 180),
COLOR_21(138, 138, 220),
COLOR_22(160, 160, 255),
COLOR_23(84, 84, 135),
COLOR_16(0, 0, 180),
COLOR_17(0, 0, 220),
COLOR_18(0, 0, 255),
COLOR_19(0, 0, 135),
COLOR_20(180, 112, 112),
COLOR_21(220, 138, 138),
COLOR_22(255, 160, 160),
COLOR_23(135, 84, 84),
COLOR_24(117, 117, 117),
COLOR_25(144, 144, 144),
COLOR_26(167, 167, 167),
@ -62,54 +62,54 @@ public enum MapColor {
COLOR_33(220, 220, 220),
COLOR_34(255, 255, 255),
COLOR_35(135, 135, 135),
COLOR_36(115, 118, 129),
COLOR_37(141, 144, 158),
COLOR_38(164, 168, 184),
COLOR_39(86, 88, 97),
COLOR_40(106, 76, 54),
COLOR_41(130, 94, 66),
COLOR_42(151, 109, 77),
COLOR_43(79, 57, 40),
COLOR_36(129, 118, 115),
COLOR_37(158, 144, 141),
COLOR_38(184, 168, 164),
COLOR_39(97, 88, 86),
COLOR_40(54, 76, 106),
COLOR_41(66, 94, 130),
COLOR_42(77, 109, 151),
COLOR_43(40, 57, 79),
COLOR_44(79, 79, 79),
COLOR_45(96, 96, 96),
COLOR_46(112, 112, 112),
COLOR_47(59, 59, 59),
COLOR_48(45, 45, 180),
COLOR_49(55, 55, 220),
COLOR_50(64, 64, 255),
COLOR_51(33, 33, 135),
COLOR_52(100, 84, 50),
COLOR_53(123, 102, 62),
COLOR_54(143, 119, 72),
COLOR_55(75, 63, 38),
COLOR_56(180, 177, 172),
COLOR_57(220, 217, 211),
COLOR_58(255, 252, 245),
COLOR_59(135, 133, 129),
COLOR_60(152, 89, 36),
COLOR_61(186, 109, 44),
COLOR_62(216, 127, 51),
COLOR_63(114, 67, 27),
COLOR_64(125, 53, 152),
COLOR_65(153, 65, 186),
COLOR_66(178, 76, 216),
COLOR_67(94, 40, 114),
COLOR_68(72, 108, 152),
COLOR_69(88, 132, 186),
COLOR_70(102, 153, 216),
COLOR_71(54, 81, 114),
COLOR_72(161, 161, 36),
COLOR_73(197, 197, 44),
COLOR_74(229, 229, 51),
COLOR_75(121, 121, 27),
COLOR_76(89, 144, 17),
COLOR_77(109, 176, 21),
COLOR_78(127, 204, 25),
COLOR_79(67, 108, 13),
COLOR_80(170, 89, 116),
COLOR_81(208, 109, 142),
COLOR_82(242, 127, 165),
COLOR_83(128, 67, 87),
COLOR_48(180, 45, 45),
COLOR_49(220, 55, 55),
COLOR_50(255, 64, 64),
COLOR_51(135, 33, 33),
COLOR_52(50, 84, 100),
COLOR_53(62, 102, 123),
COLOR_54(72, 119, 143),
COLOR_55(38, 63, 75),
COLOR_56(172, 177, 180),
COLOR_57(211, 217, 220),
COLOR_58(245, 252, 255),
COLOR_59(129, 133, 135),
COLOR_60(36, 89, 152),
COLOR_61(44, 109, 186),
COLOR_62(51, 127, 216),
COLOR_63(27, 67, 114),
COLOR_64(152, 53, 125),
COLOR_65(186, 65, 153),
COLOR_66(216, 76, 178),
COLOR_67(114, 40, 94),
COLOR_68(152, 108, 72),
COLOR_69(186, 132, 88),
COLOR_70(216, 153, 102),
COLOR_71(114, 81, 54),
COLOR_72(36, 161, 161),
COLOR_73(44, 197, 197),
COLOR_74(51, 229, 229),
COLOR_75(27, 121, 121),
COLOR_76(17, 144, 89),
COLOR_77(21, 176, 109),
COLOR_78(25, 204, 127),
COLOR_79(13, 108, 67),
COLOR_80(116, 89, 170),
COLOR_81(142, 109, 208),
COLOR_82(165, 127, 242),
COLOR_83(87, 67, 128),
COLOR_84(53, 53, 53),
COLOR_85(65, 65, 65),
COLOR_86(76, 76, 76),
@ -118,162 +118,162 @@ public enum MapColor {
COLOR_89(132, 132, 132),
COLOR_90(153, 153, 153),
COLOR_91(81, 81, 81),
COLOR_92(53, 89, 108),
COLOR_93(65, 109, 132),
COLOR_94(76, 127, 153),
COLOR_95(40, 67, 81),
COLOR_96(89, 44, 125),
COLOR_97(109, 54, 153),
COLOR_98(127, 63, 178),
COLOR_99(67, 33, 94),
COLOR_100(36, 53, 125),
COLOR_101(44, 65, 153),
COLOR_102(51, 76, 178),
COLOR_103(27, 40, 94),
COLOR_104(72, 53, 36),
COLOR_105(88, 65, 44),
COLOR_106(102, 76, 51),
COLOR_107(54, 40, 27),
COLOR_108(72, 89, 36),
COLOR_109(88, 109, 44),
COLOR_110(102, 127, 51),
COLOR_111(54, 67, 27),
COLOR_112(108, 36, 36),
COLOR_113(132, 44, 44),
COLOR_114(153, 51, 51),
COLOR_115(81, 27, 27),
COLOR_92(108, 89, 53),
COLOR_93(132, 109, 65),
COLOR_94(153, 127, 76),
COLOR_95(81, 67, 40),
COLOR_96(125, 44, 89),
COLOR_97(153, 54, 109),
COLOR_98(178, 63, 127),
COLOR_99(94, 33, 67),
COLOR_100(125, 53, 36),
COLOR_101(153, 65, 44),
COLOR_102(178, 76, 51),
COLOR_103(94, 40, 27),
COLOR_104(36, 53, 72),
COLOR_105(44, 65, 88),
COLOR_106(51, 76, 102),
COLOR_107(27, 40, 54),
COLOR_108(36, 89, 72),
COLOR_109(44, 109, 88),
COLOR_110(51, 127, 102),
COLOR_111(27, 67, 54),
COLOR_112(36, 36, 108),
COLOR_113(44, 44, 132),
COLOR_114(51, 51, 153),
COLOR_115(27, 27, 81),
COLOR_116(17, 17, 17),
COLOR_117(21, 21, 21),
COLOR_118(25, 25, 25),
COLOR_119(13, 13, 13),
COLOR_120(176, 168, 54),
COLOR_121(215, 205, 66),
COLOR_122(250, 238, 77),
COLOR_123(132, 126, 40),
COLOR_124(64, 154, 150),
COLOR_125(79, 188, 183),
COLOR_126(92, 219, 213),
COLOR_127(48, 115, 112),
COLOR_128(52, 90, 180),
COLOR_129(63, 110, 220),
COLOR_130(74, 128, 255),
COLOR_131(39, 67, 135),
COLOR_132(0, 153, 40),
COLOR_133(0, 187, 50),
COLOR_134(0, 217, 58),
COLOR_135(0, 114, 30),
COLOR_136(91, 60, 34),
COLOR_137(111, 74, 42),
COLOR_138(129, 86, 49),
COLOR_139(68, 45, 25),
COLOR_140(79, 1, 0),
COLOR_141(96, 1, 0),
COLOR_142(112, 2, 0),
COLOR_143(59, 1, 0),
COLOR_144(147, 124, 113),
COLOR_145(180, 152, 138),
COLOR_146(209, 177, 161),
COLOR_147(110, 93, 85),
COLOR_148(112, 57, 25),
COLOR_149(137, 70, 31),
COLOR_150(159, 82, 36),
COLOR_151(84, 43, 19),
COLOR_152(105, 61, 76),
COLOR_153(128, 75, 93),
COLOR_154(149, 87, 108),
COLOR_155(78, 46, 57),
COLOR_156(79, 76, 97),
COLOR_157(96, 93, 119),
COLOR_158(112, 108, 138),
COLOR_159(59, 57, 73),
COLOR_160(131, 93, 25),
COLOR_161(160, 114, 31),
COLOR_162(186, 133, 36),
COLOR_163(98, 70, 19),
COLOR_164(72, 82, 37),
COLOR_165(88, 100, 45),
COLOR_166(103, 117, 53),
COLOR_167(54, 61, 28),
COLOR_168(112, 54, 55),
COLOR_169(138, 66, 67),
COLOR_170(160, 77, 78),
COLOR_171(84, 40, 41),
COLOR_172(40, 28, 24),
COLOR_173(49, 35, 30),
COLOR_174(57, 41, 35),
COLOR_175(30, 21, 18),
COLOR_176(95, 75, 69),
COLOR_177(116, 92, 84),
COLOR_178(135, 107, 98),
COLOR_179(71, 56, 51),
COLOR_180(61, 64, 64),
COLOR_181(75, 79, 79),
COLOR_182(87, 92, 92),
COLOR_183(46, 48, 48),
COLOR_184(86, 51, 62),
COLOR_185(105, 62, 75),
COLOR_186(122, 73, 88),
COLOR_187(64, 38, 46),
COLOR_188(53, 43, 64),
COLOR_189(65, 53, 79),
COLOR_190(76, 62, 92),
COLOR_191(40, 32, 48),
COLOR_192(53, 35, 24),
COLOR_193(65, 43, 30),
COLOR_194(76, 50, 35),
COLOR_195(40, 26, 18),
COLOR_196(53, 57, 29),
COLOR_197(65, 70, 36),
COLOR_198(76, 82, 42),
COLOR_199(40, 43, 22),
COLOR_200(100, 42, 32),
COLOR_201(122, 51, 39),
COLOR_202(142, 60, 46),
COLOR_203(75, 31, 24),
COLOR_204(26, 15, 11),
COLOR_205(31, 18, 13),
COLOR_206(37, 22, 16),
COLOR_207(19, 11, 8),
COLOR_208(133, 33, 34),
COLOR_209(163, 41, 42),
COLOR_210(189, 48, 49),
COLOR_211(100, 25, 25),
COLOR_212(104, 44, 68),
COLOR_213(127, 54, 83),
COLOR_214(148, 63, 97),
COLOR_215(78, 33, 51),
COLOR_216(64, 17, 20),
COLOR_217(79, 21, 25),
COLOR_218(92, 25, 29),
COLOR_219(48, 13, 15),
COLOR_220(15, 88, 94),
COLOR_221(18, 108, 115),
COLOR_222(22, 126, 134),
COLOR_223(11, 66, 70),
COLOR_224(40, 100, 98),
COLOR_225(50, 122, 120),
COLOR_226(58, 142, 140),
COLOR_227(30, 75, 74),
COLOR_228(60, 31, 43),
COLOR_229(74, 37, 53),
COLOR_230(86, 44, 62),
COLOR_231(45, 23, 32),
COLOR_232(14, 127, 93),
COLOR_233(17, 155, 114),
COLOR_234(20, 180, 133),
COLOR_235(10, 95, 70),
COLOR_120(54, 168, 176),
COLOR_121(66, 205, 215),
COLOR_122(77, 238, 250),
COLOR_123(40, 126, 132),
COLOR_124(150, 154, 64),
COLOR_125(183, 188, 79),
COLOR_126(213, 219, 92),
COLOR_127(112, 115, 48),
COLOR_128(180, 90, 52),
COLOR_129(220, 110, 63),
COLOR_130(255, 128, 74),
COLOR_131(135, 67, 39),
COLOR_132(40, 153, 0),
COLOR_133(50, 187, 0),
COLOR_134(58, 217, 0),
COLOR_135(30, 114, 0),
COLOR_136(34, 60, 91),
COLOR_137(42, 74, 111),
COLOR_138(49, 86, 129),
COLOR_139(25, 45, 68),
COLOR_140(0, 1, 79),
COLOR_141(0, 1, 96),
COLOR_142(0, 2, 112),
COLOR_143(0, 1, 59),
COLOR_144(113, 124, 147),
COLOR_145(138, 152, 180),
COLOR_146(161, 177, 209),
COLOR_147(85, 93, 110),
COLOR_148(25, 57, 112),
COLOR_149(31, 70, 137),
COLOR_150(36, 82, 159),
COLOR_151(19, 43, 84),
COLOR_152(76, 61, 105),
COLOR_153(93, 75, 128),
COLOR_154(108, 87, 149),
COLOR_155(57, 46, 78),
COLOR_156(97, 76, 79),
COLOR_157(119, 93, 96),
COLOR_158(138, 108, 112),
COLOR_159(73, 57, 59),
COLOR_160(25, 93, 131),
COLOR_161(31, 114, 160),
COLOR_162(36, 133, 186),
COLOR_163(19, 70, 98),
COLOR_164(37, 82, 72),
COLOR_165(45, 100, 88),
COLOR_166(53, 117, 103),
COLOR_167(28, 61, 54),
COLOR_168(55, 54, 112),
COLOR_169(67, 66, 138),
COLOR_170(78, 77, 160),
COLOR_171(41, 40, 84),
COLOR_172(24, 28, 40),
COLOR_173(30, 35, 49),
COLOR_174(35, 41, 57),
COLOR_175(18, 21, 30),
COLOR_176(69, 75, 95),
COLOR_177(84, 92, 116),
COLOR_178(98, 107, 135),
COLOR_179(51, 56, 71),
COLOR_180(64, 64, 61),
COLOR_181(79, 79, 75),
COLOR_182(92, 92, 87),
COLOR_183(48, 48, 46),
COLOR_184(62, 51, 86),
COLOR_185(75, 62, 105),
COLOR_186(88, 73, 122),
COLOR_187(46, 38, 64),
COLOR_188(64, 43, 53),
COLOR_189(79, 53, 65),
COLOR_190(92, 62, 76),
COLOR_191(48, 32, 40),
COLOR_192(24, 35, 53),
COLOR_193(30, 43, 65),
COLOR_194(35, 50, 76),
COLOR_195(18, 26, 40),
COLOR_196(29, 57, 53),
COLOR_197(36, 70, 65),
COLOR_198(42, 82, 76),
COLOR_199(22, 43, 40),
COLOR_200(32, 42, 100),
COLOR_201(39, 51, 122),
COLOR_202(46, 60, 142),
COLOR_203(24, 31, 75),
COLOR_204(11, 15, 26),
COLOR_205(13, 18, 31),
COLOR_206(16, 22, 37),
COLOR_207(8, 11, 19),
COLOR_208(34, 33, 133),
COLOR_209(42, 41, 163),
COLOR_210(49, 48, 189),
COLOR_211(25, 25, 100),
COLOR_212(68, 44, 104),
COLOR_213(83, 54, 127),
COLOR_214(97, 63, 148),
COLOR_215(51, 33, 78),
COLOR_216(20, 17, 64),
COLOR_217(25, 21, 79),
COLOR_218(29, 25, 92),
COLOR_219(15, 13, 48),
COLOR_220(94, 88, 15),
COLOR_221(115, 108, 18),
COLOR_222(134, 126, 22),
COLOR_223(70, 66, 11),
COLOR_224(98, 100, 40),
COLOR_225(120, 122, 50),
COLOR_226(140, 142, 58),
COLOR_227(74, 75, 30),
COLOR_228(43, 31, 60),
COLOR_229(53, 37, 74),
COLOR_230(62, 44, 86),
COLOR_231(32, 23, 45),
COLOR_232(93, 127, 14),
COLOR_233(114, 155, 17),
COLOR_234(133, 180, 20),
COLOR_235(70, 95, 10),
COLOR_236(70, 70, 70),
COLOR_237(86, 86, 86),
COLOR_238(100, 100, 100),
COLOR_239(52, 52, 52),
COLOR_240(152, 123, 103),
COLOR_241(186, 150, 126),
COLOR_242(216, 175, 147),
COLOR_243(114, 92, 77),
COLOR_244(89, 117, 105),
COLOR_245(109, 144, 129),
COLOR_246(127, 167, 150),
COLOR_247(67, 88, 79);
COLOR_240(103, 123, 152),
COLOR_241(126, 150, 186),
COLOR_242(147, 175, 216),
COLOR_243(77, 92, 114),
COLOR_244(105, 117, 89),
COLOR_245(129, 144, 109),
COLOR_246(150, 167, 127),
COLOR_247(79, 88, 67);
private static final MapColor[] VALUES = values();

View file

@ -55,7 +55,8 @@ public final class DataComponentRegistryPopulator {
GeyserBootstrap bootstrap = GeyserImpl.getInstance().getBootstrap();
List<DataComponents> defaultComponents;
try (InputStream stream = bootstrap.getResourceOrThrow("java/item_data_components.json")) {
JsonElement rootElement = JsonParser.parseReader(new InputStreamReader(stream));
//noinspection deprecation - 1.16.5 breaks otherwise
JsonElement rootElement = new JsonParser().parse(new InputStreamReader(stream));
JsonArray jsonArray = rootElement.getAsJsonArray();
defaultComponents = new ObjectArrayList<>(jsonArray.size());

View file

@ -209,6 +209,18 @@ public final class EntityUtils {
zOffset = displayTranslation.getZ();
}
}
case PLAYER -> {
if (passenger instanceof TextDisplayEntity textDisplay) {
Vector3f displayTranslation = textDisplay.getTranslation();
int lines = textDisplay.getLineCount();
if (displayTranslation != null && lines != 0) {
float multiplier = .1414f;
xOffset = displayTranslation.getX();
yOffset += displayTranslation.getY() + multiplier * lines;
zOffset = displayTranslation.getZ();
}
}
}
}
if (mount instanceof ChestBoatEntity) {
xOffset = 0.15F;

View file

@ -0,0 +1,42 @@
/*
* Copyright (c) 2024 GeyserMC. http://geysermc.org
*
* Permission is hereby granted, free of charge, to any person obtaining a copy
* of this software and associated documentation files (the "Software"), to deal
* in the Software without restriction, including without limitation the rights
* to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
* copies of the Software, and to permit persons to whom the Software is
* furnished to do so, subject to the following conditions:
*
* The above copyright notice and this permission notice shall be included in
* all copies or substantial portions of the Software.
*
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
* AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
* THE SOFTWARE.
*
* @author GeyserMC
* @link https://github.com/GeyserMC/Geyser
*/
package org.geysermc.geyser.util;
import java.util.function.BiConsumer;
@FunctionalInterface
public interface ThrowingBiConsumer<T, U> extends BiConsumer<T, U> {
@Override
default void accept(T t, U u) {
try {
acceptThrows(t, u);
} catch (Throwable e) {
throw new RuntimeException(e);
}
}
void acceptThrows(T t, U u) throws Throwable;
}

View file

@ -10,9 +10,9 @@ netty-io-uring = "0.0.25.Final-SNAPSHOT"
guava = "29.0-jre"
gson = "2.3.1" # Provided by Spigot 1.8.8
websocket = "1.5.1"
protocol-connection = "3.0.0.Beta5-20241203.200249-19"
protocol-common = "3.0.0.Beta5-20241203.200249-19"
protocol-codec = "3.0.0.Beta5-20241203.200249-19"
protocol-connection = "3.0.0.Beta5-20241213.160944-20"
protocol-common = "3.0.0.Beta5-20241213.160944-20"
protocol-codec = "3.0.0.Beta5-20241213.160944-20"
raknet = "1.0.0.CR3-20240416.144209-1"
minecraftauth = "4.1.1"
mcprotocollib = "1.21.4-SNAPSHOT"