Skip to content

Commit 0d32bbe

Browse files
Merge remote-tracking branch 'upstream/feature/1.21.4' into custom-item-api-v2
2 parents 79bf4af + 92c7f98 commit 0d32bbe

File tree

145 files changed

+23632
-44445
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

145 files changed

+23632
-44445
lines changed

README.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@ The ultimate goal of this project is to allow Minecraft: Bedrock Edition users t
1515
Special thanks to the DragonProxy project for being a trailblazer in protocol translation and for all the team members who have joined us here!
1616

1717
## Supported Versions
18-
Geyser is currently supporting Minecraft Bedrock 1.20.80 - 1.21.44 and Minecraft Java 1.21.2/1.21.3. For more information, please see [here](https://geysermc.org/wiki/geyser/supported-versions/).
18+
Geyser is currently supporting Minecraft Bedrock 1.21.40 - 1.21.50 and Minecraft Java 1.21.2/1.21.3. For more information, please see [here](https://geysermc.org/wiki/geyser/supported-versions/).
1919

2020
## Setting Up
2121
Take a look [here](https://geysermc.org/wiki/geyser/setup/) for how to set up Geyser.

api/src/main/java/org/geysermc/geyser/api/entity/type/player/GeyserPlayerEntity.java

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -31,9 +31,9 @@
3131
public interface GeyserPlayerEntity extends GeyserEntity {
3232

3333
/**
34-
* Gets the position of the player.
34+
* Gets the position of the player, as it is known to the Java server.
3535
*
36-
* @return the position of the player.
36+
* @return the player's position
3737
*/
3838
Vector3f position();
3939
}

api/src/main/java/org/geysermc/geyser/api/item/custom/NonVanillaCustomItemData.java

Lines changed: 4 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -80,10 +80,9 @@ public interface NonVanillaCustomItemData extends CustomItemData {
8080
@Nullable String toolType();
8181

8282
/**
83-
* Gets the tool tier of the item.
84-
*
85-
* @return the tool tier of the item
83+
* @deprecated no longer used
8684
*/
85+
@Deprecated(forRemoval = true)
8786
@Nullable String toolTier();
8887

8988
/**
@@ -108,10 +107,9 @@ public interface NonVanillaCustomItemData extends CustomItemData {
108107
@Nullable String translationString();
109108

110109
/**
111-
* Gets the repair materials of the item.
112-
*
113-
* @return the repair materials of the item
110+
* @deprecated No longer used.
114111
*/
112+
@Deprecated(forRemoval = true)
115113
@Nullable Set<String> repairMaterials();
116114

117115
/**

bootstrap/mod/fabric/build.gradle.kts

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -38,6 +38,7 @@ dependencies {
3838

3939
modImplementation(libs.cloud.fabric)
4040
include(libs.cloud.fabric)
41+
include(libs.fabric.permissions.api)
4142
}
4243

4344
tasks.withType<Jar> {

bootstrap/mod/src/main/java/org/geysermc/geyser/platform/mod/world/GeyserModWorldManager.java

Lines changed: 0 additions & 72 deletions
Original file line numberDiff line numberDiff line change
@@ -28,37 +28,24 @@
2828
import net.kyori.adventure.text.serializer.gson.GsonComponentSerializer;
2929
import net.minecraft.SharedConstants;
3030
import net.minecraft.core.BlockPos;
31-
import net.minecraft.core.RegistryAccess;
32-
import net.minecraft.core.component.DataComponents;
3331
import net.minecraft.core.registries.BuiltInRegistries;
34-
import net.minecraft.network.chat.Component;
3532
import net.minecraft.server.MinecraftServer;
3633
import net.minecraft.server.level.ServerChunkCache;
3734
import net.minecraft.server.level.ServerPlayer;
38-
import net.minecraft.world.item.ItemStack;
3935
import net.minecraft.world.level.ChunkPos;
4036
import net.minecraft.world.level.Level;
4137
import net.minecraft.world.level.block.Block;
42-
import net.minecraft.world.level.block.entity.BannerBlockEntity;
43-
import net.minecraft.world.level.block.entity.BannerPatternLayers;
4438
import net.minecraft.world.level.block.entity.BlockEntity;
4539
import net.minecraft.world.level.block.entity.DecoratedPotBlockEntity;
4640
import net.minecraft.world.level.chunk.ChunkAccess;
4741
import net.minecraft.world.level.chunk.LevelChunkSection;
48-
import org.checkerframework.checker.nullness.qual.NonNull;
4942
import org.cloudburstmc.math.vector.Vector3i;
5043
import org.geysermc.geyser.level.GeyserWorldManager;
5144
import org.geysermc.geyser.network.GameProtocol;
5245
import org.geysermc.geyser.session.GeyserSession;
53-
import org.geysermc.geyser.util.MinecraftKey;
54-
import org.geysermc.mcprotocollib.protocol.data.game.Holder;
5546
import org.geysermc.mcprotocollib.protocol.data.game.entity.player.GameMode;
56-
import org.geysermc.mcprotocollib.protocol.data.game.item.component.BannerPatternLayer;
57-
import org.geysermc.mcprotocollib.protocol.data.game.item.component.DataComponentType;
5847

59-
import java.util.HashMap;
6048
import java.util.List;
61-
import java.util.concurrent.CompletableFuture;
6249
import java.util.function.Consumer;
6350

6451
public class GeyserModWorldManager extends GeyserWorldManager {
@@ -117,49 +104,6 @@ public GameMode getDefaultGameMode(GeyserSession session) {
117104
return GameMode.byId(server.getDefaultGameType().getId());
118105
}
119106

120-
@NonNull
121-
@Override
122-
public CompletableFuture<org.geysermc.mcprotocollib.protocol.data.game.item.component.DataComponents> getPickItemComponents(GeyserSession session, int x, int y, int z, boolean addNbtData) {
123-
CompletableFuture<org.geysermc.mcprotocollib.protocol.data.game.item.component.DataComponents> future = new CompletableFuture<>();
124-
server.execute(() -> {
125-
ServerPlayer player = getPlayer(session);
126-
if (player == null) {
127-
future.complete(null);
128-
return;
129-
}
130-
131-
BlockPos pos = new BlockPos(x, y, z);
132-
// Don't create a new block entity if invalid
133-
//noinspection resource - level() is just a getter
134-
BlockEntity blockEntity = player.level().getChunkAt(pos).getBlockEntity(pos);
135-
if (blockEntity instanceof BannerBlockEntity banner) {
136-
// Potentially exposes other NBT data? But we need to get the NBT data for the banner patterns *and*
137-
// the banner might have a custom name, both of which a Java client knows and caches
138-
ItemStack itemStack = banner.getItem();
139-
140-
org.geysermc.mcprotocollib.protocol.data.game.item.component.DataComponents components =
141-
new org.geysermc.mcprotocollib.protocol.data.game.item.component.DataComponents(new HashMap<>());
142-
143-
components.put(DataComponentType.DAMAGE, itemStack.getDamageValue());
144-
145-
Component customName = itemStack.getComponents().get(DataComponents.CUSTOM_NAME);
146-
if (customName != null) {
147-
components.put(DataComponentType.CUSTOM_NAME, toKyoriComponent(customName));
148-
}
149-
150-
BannerPatternLayers pattern = itemStack.get(DataComponents.BANNER_PATTERNS);
151-
if (pattern != null) {
152-
components.put(DataComponentType.BANNER_PATTERNS, toPatternList(pattern));
153-
}
154-
155-
future.complete(components);
156-
return;
157-
}
158-
future.complete(null);
159-
});
160-
return future;
161-
}
162-
163107
@Override
164108
public void getDecoratedPotData(GeyserSession session, Vector3i pos, Consumer<List<String>> apply) {
165109
server.execute(() -> {
@@ -184,20 +128,4 @@ public void getDecoratedPotData(GeyserSession session, Vector3i pos, Consumer<Li
184128
private ServerPlayer getPlayer(GeyserSession session) {
185129
return server.getPlayerList().getPlayer(session.getPlayerEntity().getUuid());
186130
}
187-
188-
private static net.kyori.adventure.text.Component toKyoriComponent(Component component) {
189-
String json = Component.Serializer.toJson(component, RegistryAccess.EMPTY);
190-
return GSON_SERIALIZER.deserializeOr(json, net.kyori.adventure.text.Component.empty());
191-
}
192-
193-
private static List<BannerPatternLayer> toPatternList(BannerPatternLayers patternLayers) {
194-
return patternLayers.layers().stream()
195-
.map(layer -> {
196-
BannerPatternLayer.BannerPattern pattern = new BannerPatternLayer.BannerPattern(
197-
MinecraftKey.key(layer.pattern().value().assetId().toString()), layer.pattern().value().translationKey()
198-
);
199-
return new BannerPatternLayer(Holder.ofCustom(pattern), layer.color().getId());
200-
})
201-
.toList();
202-
}
203131
}

bootstrap/spigot/src/main/java/org/geysermc/geyser/platform/spigot/GeyserSpigotInjector.java

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -178,9 +178,8 @@ private void workAroundWeirdBug(GeyserBootstrap bootstrap) {
178178
MinecraftProtocol protocol = new MinecraftProtocol();
179179
LocalSession session = new LocalSession(bootstrap.getGeyserConfig().getRemote().address(),
180180
bootstrap.getGeyserConfig().getRemote().port(), this.serverSocketAddress,
181-
InetAddress.getLoopbackAddress().getHostAddress(), protocol, protocol.createHelper());
181+
InetAddress.getLoopbackAddress().getHostAddress(), protocol, Runnable::run);
182182
session.connect();
183-
session.disconnect("");
184183
}
185184

186185
@Override

bootstrap/spigot/src/main/java/org/geysermc/geyser/platform/spigot/world/manager/GeyserSpigotNativeWorldManager.java

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -33,7 +33,6 @@
3333
import org.geysermc.geyser.adapters.WorldAdapter;
3434
import org.geysermc.geyser.adapters.paper.PaperAdapters;
3535
import org.geysermc.geyser.adapters.spigot.SpigotAdapters;
36-
import org.geysermc.geyser.level.block.BlockStateValues;
3736
import org.geysermc.geyser.level.block.type.Block;
3837
import org.geysermc.geyser.session.GeyserSession;
3938

bootstrap/spigot/src/main/java/org/geysermc/geyser/platform/spigot/world/manager/GeyserSpigotWorldManager.java

Lines changed: 0 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -25,26 +25,21 @@
2525

2626
package org.geysermc.geyser.platform.spigot.world.manager;
2727

28-
import it.unimi.dsi.fastutil.ints.Int2ObjectMap;
2928
import org.bukkit.Bukkit;
3029
import org.bukkit.World;
3130
import org.bukkit.block.Block;
3231
import org.bukkit.block.DecoratedPot;
3332
import org.bukkit.entity.Player;
3433
import org.bukkit.plugin.Plugin;
35-
import org.checkerframework.checker.nullness.qual.NonNull;
36-
import org.checkerframework.checker.nullness.qual.Nullable;
3734
import org.cloudburstmc.math.vector.Vector3i;
3835
import org.geysermc.erosion.bukkit.BukkitUtils;
39-
import org.geysermc.erosion.bukkit.PickBlockUtils;
4036
import org.geysermc.erosion.bukkit.SchedulerUtils;
4137
import org.geysermc.geyser.GeyserImpl;
4238
import org.geysermc.geyser.level.GameRule;
4339
import org.geysermc.geyser.level.WorldManager;
4440
import org.geysermc.geyser.registry.BlockRegistries;
4541
import org.geysermc.geyser.session.GeyserSession;
4642
import org.geysermc.mcprotocollib.protocol.data.game.entity.player.GameMode;
47-
import org.geysermc.mcprotocollib.protocol.data.game.item.component.DataComponents;
4843

4944
import java.util.List;
5045
import java.util.Objects;
@@ -128,20 +123,6 @@ public GameMode getDefaultGameMode(GeyserSession session) {
128123
return GameMode.byId(Bukkit.getDefaultGameMode().ordinal());
129124
}
130125

131-
@Override
132-
public @NonNull CompletableFuture<@Nullable DataComponents> getPickItemComponents(GeyserSession session, int x, int y, int z, boolean addNbtData) {
133-
Player bukkitPlayer;
134-
if ((bukkitPlayer = Bukkit.getPlayer(session.getPlayerEntity().getUuid())) == null) {
135-
return CompletableFuture.completedFuture(null);
136-
}
137-
CompletableFuture<Int2ObjectMap<byte[]>> future = new CompletableFuture<>();
138-
Block block = bukkitPlayer.getWorld().getBlockAt(x, y, z);
139-
// Paper 1.19.3 complains about async access otherwise.
140-
// java.lang.IllegalStateException: Tile is null, asynchronous access?
141-
SchedulerUtils.runTask(this.plugin, () -> future.complete(PickBlockUtils.pickBlock(block)), block);
142-
return future.thenApply(RAW_TRANSFORMER);
143-
}
144-
145126
public void getDecoratedPotData(GeyserSession session, Vector3i pos, Consumer<List<String>> apply) {
146127
Player bukkitPlayer;
147128
if ((bukkitPlayer = Bukkit.getPlayer(session.getPlayerEntity().getUuid())) == null) {

core/src/main/java/org/geysermc/geyser/GeyserImpl.java

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -414,9 +414,6 @@ private void startInstance() {
414414
}
415415
}
416416

417-
// Ensure that PacketLib does not create an event loop for handling packets; we'll do that ourselves
418-
TcpSession.USE_EVENT_LOOP_FOR_PACKETS = false;
419-
420417
pendingMicrosoftAuthentication = new PendingMicrosoftAuthentication(config.getPendingAuthenticationTimeout());
421418

422419
this.newsHandler = new NewsHandler(BRANCH, this.buildNumber());

core/src/main/java/org/geysermc/geyser/entity/EntityDefinitions.java

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -116,6 +116,7 @@
116116
import org.geysermc.geyser.entity.type.living.monster.BlazeEntity;
117117
import org.geysermc.geyser.entity.type.living.monster.BoggedEntity;
118118
import org.geysermc.geyser.entity.type.living.monster.BreezeEntity;
119+
import org.geysermc.geyser.entity.type.living.monster.CreakingEntity;
119120
import org.geysermc.geyser.entity.type.living.monster.CreeperEntity;
120121
import org.geysermc.geyser.entity.type.living.monster.ElderGuardianEntity;
121122
import org.geysermc.geyser.entity.type.living.monster.EnderDragonEntity;
@@ -179,6 +180,7 @@ public final class EntityDefinitions {
179180
public static final EntityDefinition<AbstractFishEntity> COD;
180181
public static final EntityDefinition<CommandBlockMinecartEntity> COMMAND_BLOCK_MINECART;
181182
public static final EntityDefinition<CowEntity> COW;
183+
public static final EntityDefinition<CreakingEntity> CREAKING;
182184
public static final EntityDefinition<CreeperEntity> CREEPER;
183185
public static final EntityDefinition<BoatEntity> DARK_OAK_BOAT;
184186
public static final EntityDefinition<ChestBoatEntity> DARK_OAK_CHEST_BOAT;
@@ -236,6 +238,8 @@ public final class EntityDefinitions {
236238
public static final EntityDefinition<ChestBoatEntity> OAK_CHEST_BOAT;
237239
public static final EntityDefinition<OcelotEntity> OCELOT;
238240
public static final EntityDefinition<PaintingEntity> PAINTING;
241+
public static final EntityDefinition<BoatEntity> PALE_OAK_BOAT;
242+
public static final EntityDefinition<ChestBoatEntity> PALE_OAK_CHEST_BOAT;
239243
public static final EntityDefinition<PandaEntity> PANDA;
240244
public static final EntityDefinition<ParrotEntity> PARROT;
241245
public static final EntityDefinition<PhantomEntity> PHANTOM;
@@ -591,6 +595,7 @@ public final class EntityDefinitions {
591595
MANGROVE_BOAT = buildBoat(boatBase, EntityType.MANGROVE_BOAT, BoatEntity.BoatVariant.MANGROVE);
592596
OAK_BOAT = buildBoat(boatBase, EntityType.OAK_BOAT, BoatEntity.BoatVariant.OAK);
593597
SPRUCE_BOAT = buildBoat(boatBase, EntityType.SPRUCE_BOAT, BoatEntity.BoatVariant.SPRUCE);
598+
PALE_OAK_BOAT = buildBoat(boatBase, EntityType.PALE_OAK_BOAT, BoatEntity.BoatVariant.PALE_OAK);
594599

595600
EntityDefinition<ChestBoatEntity> chestBoatBase = EntityDefinition.<ChestBoatEntity>inherited(null, boatBase)
596601
.build();
@@ -604,6 +609,7 @@ public final class EntityDefinitions {
604609
MANGROVE_CHEST_BOAT = buildChestBoat(chestBoatBase, EntityType.MANGROVE_CHEST_BOAT, BoatEntity.BoatVariant.MANGROVE);
605610
OAK_CHEST_BOAT = buildChestBoat(chestBoatBase, EntityType.OAK_CHEST_BOAT, BoatEntity.BoatVariant.OAK);
606611
SPRUCE_CHEST_BOAT = buildChestBoat(chestBoatBase, EntityType.SPRUCE_CHEST_BOAT, BoatEntity.BoatVariant.SPRUCE);
612+
PALE_OAK_CHEST_BOAT = buildChestBoat(chestBoatBase, EntityType.PALE_OAK_CHEST_BOAT, BoatEntity.BoatVariant.PALE_OAK);
607613
}
608614

609615
EntityDefinition<LivingEntity> livingEntityBase = EntityDefinition.inherited(LivingEntity::new, entityBase)
@@ -671,6 +677,14 @@ public final class EntityDefinitions {
671677
.type(EntityType.BREEZE)
672678
.height(1.77f).width(0.6f)
673679
.build();
680+
CREAKING = EntityDefinition.inherited(CreakingEntity::new, mobEntityBase)
681+
.type(EntityType.CREAKING)
682+
.height(2.7f).width(0.9f)
683+
.addTranslator(MetadataType.BOOLEAN, CreakingEntity::setCanMove)
684+
.addTranslator(MetadataType.BOOLEAN, CreakingEntity::setActive)
685+
.addTranslator(MetadataType.BOOLEAN, CreakingEntity::setIsTearingDown)
686+
.addTranslator(MetadataType.OPTIONAL_POSITION, CreakingEntity::setHomePos)
687+
.build();
674688
CREEPER = EntityDefinition.inherited(CreeperEntity::new, mobEntityBase)
675689
.type(EntityType.CREEPER)
676690
.height(1.7f).width(0.6f)

0 commit comments

Comments
 (0)