Mirror von
https://github.com/GeyserMC/Geyser.git
synchronisiert 2024-12-25 15:50:14 +01:00
Support Bedrock 1.20.70 (#4477)
* Support 1.20.70 Signed-off-by: Joshua Castle <26531652+Kas-tle@users.noreply.github.com> * Update readme Signed-off-by: Joshua Castle <26531652+Kas-tle@users.noreply.github.com> * Use 1.20.70 mappings Signed-off-by: Joshua Castle <26531652+Kas-tle@users.noreply.github.com> * Creative lectern drops work but not survival yet Signed-off-by: Joshua Castle <26531652+Kas-tle@users.noreply.github.com> * Fix lectern book pickup in survival Signed-off-by: Joshua Castle <26531652+Kas-tle@users.noreply.github.com> * Add copyright notices to new files Signed-off-by: Joshua Castle <26531652+Kas-tle@users.noreply.github.com> * Temp fix for incorrect creative_items from Cloudburst/Data Signed-off-by: Joshua Castle <26531652+Kas-tle@users.noreply.github.com> * Fix item frame breaking in creative Signed-off-by: Joshua Castle <26531652+Kas-tle@users.noreply.github.com> * Clarify what to remove when 1.20.60 support is dropped Signed-off-by: Joshua Castle <26531652+Kas-tle@users.noreply.github.com> * Don't use dim change enum pre 1.20.70 Signed-off-by: Joshua Castle <26531652+Kas-tle@users.noreply.github.com> --------- Signed-off-by: Joshua Castle <26531652+Kas-tle@users.noreply.github.com>
Dieser Commit ist enthalten in:
Ursprung
a0fd720e7c
Commit
1df63c6de8
@ -14,7 +14,7 @@ The ultimate goal of this project is to allow Minecraft: Bedrock Edition users t
|
||||
|
||||
Special thanks to the DragonProxy project for being a trailblazer in protocol translation and for all the team members who have joined us here!
|
||||
|
||||
### Currently supporting Minecraft Bedrock 1.20.40 - 1.20.61 and Minecraft Java 1.20.4
|
||||
### Currently supporting Minecraft Bedrock 1.20.40 - 1.20.70 and Minecraft Java 1.20.4
|
||||
|
||||
## Setting Up
|
||||
Take a look [here](https://wiki.geysermc.org/geyser/setup/) for how to set up Geyser.
|
||||
|
@ -24,11 +24,17 @@
|
||||
*/
|
||||
|
||||
import com.github.jengelman.gradle.plugins.shadow.tasks.ShadowJar
|
||||
import org.gradle.api.DefaultTask
|
||||
import org.gradle.api.Project
|
||||
import org.gradle.api.artifacts.MinimalExternalModuleDependency
|
||||
import org.gradle.api.artifacts.ProjectDependency
|
||||
import org.gradle.api.provider.Provider
|
||||
import org.gradle.api.tasks.Input
|
||||
import org.gradle.api.tasks.options.Option
|
||||
import org.gradle.api.tasks.TaskAction
|
||||
import org.gradle.kotlin.dsl.named
|
||||
import java.io.File
|
||||
import java.net.URL
|
||||
|
||||
fun Project.relocate(pattern: String) {
|
||||
tasks.named<ShadowJar>("shadowJar") {
|
||||
@ -69,5 +75,45 @@ fun Project.provided(dependency: MinimalExternalModuleDependency) =
|
||||
fun Project.provided(provider: Provider<MinimalExternalModuleDependency>) =
|
||||
provided(provider.get())
|
||||
|
||||
open class DownloadFilesTask : DefaultTask() {
|
||||
@Input
|
||||
var urls: List<String> = listOf()
|
||||
|
||||
@Input
|
||||
var destinationDir: String = ""
|
||||
|
||||
@Option(option="suffix", description="suffix")
|
||||
@Input
|
||||
var suffix: String = ""
|
||||
|
||||
@Input
|
||||
var suffixedFiles: List<String> = listOf()
|
||||
|
||||
@TaskAction
|
||||
fun downloadAndAddSuffix() {
|
||||
urls.forEach { fileUrl ->
|
||||
val fileName = fileUrl.substringAfterLast("/")
|
||||
val baseName = fileName.substringBeforeLast(".")
|
||||
val extension = fileName.substringAfterLast(".", "")
|
||||
val shouldSuffix = fileName in suffixedFiles
|
||||
val suffixedFileName = if (shouldSuffix && extension.isNotEmpty()) "$baseName.$suffix.$extension" else fileName
|
||||
val outputFile = File(destinationDir, suffixedFileName)
|
||||
|
||||
if (!outputFile.parentFile.exists()) {
|
||||
outputFile.parentFile.mkdirs()
|
||||
}
|
||||
|
||||
URL(fileUrl).openStream().use { input ->
|
||||
outputFile.outputStream().use { output ->
|
||||
input.copyTo(output)
|
||||
}
|
||||
}
|
||||
|
||||
println("Downloaded: $suffixedFileName")
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
private fun calcExclusion(section: String, bit: Int, excludedOn: Int): String =
|
||||
if (excludedOn and bit > 0) section else ""
|
||||
if (excludedOn and bit > 0) section else ""
|
||||
|
||||
|
@ -132,3 +132,19 @@ inner class GitInfo {
|
||||
|
||||
// todo remove this when we're not using Jenkins anymore
|
||||
fun jenkinsBuildNumber(): String? = System.getenv("BUILD_NUMBER")
|
||||
|
||||
// Manual task to download the bedrock data files from the CloudburstMC/Data repository
|
||||
// Invoke with ./gradlew :core:downloadBedrockData --suffix=1_20_70
|
||||
// Set suffix to the current Bedrock version
|
||||
tasks.register<DownloadFilesTask>("downloadBedrockData") {
|
||||
urls = listOf(
|
||||
"https://raw.githubusercontent.com/CloudburstMC/Data/master/entity_identifiers.dat",
|
||||
"https://raw.githubusercontent.com/CloudburstMC/Data/master/biome_definitions.dat",
|
||||
"https://raw.githubusercontent.com/CloudburstMC/Data/master/block_palette.nbt",
|
||||
"https://raw.githubusercontent.com/CloudburstMC/Data/master/creative_items.json",
|
||||
"https://raw.githubusercontent.com/CloudburstMC/Data/master/runtime_item_states.json"
|
||||
)
|
||||
suffixedFiles = listOf("block_palette.nbt", "creative_items.json", "runtime_item_states.json")
|
||||
|
||||
destinationDir = "$projectDir/src/main/resources/bedrock"
|
||||
}
|
@ -32,6 +32,7 @@ import org.cloudburstmc.protocol.bedrock.codec.BedrockCodec;
|
||||
import org.cloudburstmc.protocol.bedrock.codec.v622.Bedrock_v622;
|
||||
import org.cloudburstmc.protocol.bedrock.codec.v630.Bedrock_v630;
|
||||
import org.cloudburstmc.protocol.bedrock.codec.v649.Bedrock_v649;
|
||||
import org.cloudburstmc.protocol.bedrock.codec.v662.Bedrock_v662;
|
||||
import org.cloudburstmc.protocol.bedrock.netty.codec.packet.BedrockPacketCodec;
|
||||
import org.geysermc.geyser.session.GeyserSession;
|
||||
|
||||
@ -47,7 +48,7 @@ public final class GameProtocol {
|
||||
* Default Bedrock codec that should act as a fallback. Should represent the latest available
|
||||
* release of the game that Geyser supports.
|
||||
*/
|
||||
public static final BedrockCodec DEFAULT_BEDROCK_CODEC = Bedrock_v649.CODEC;
|
||||
public static final BedrockCodec DEFAULT_BEDROCK_CODEC = Bedrock_v662.CODEC;
|
||||
|
||||
/**
|
||||
* A list of all supported Bedrock versions that can join Geyser
|
||||
@ -67,8 +68,11 @@ public final class GameProtocol {
|
||||
SUPPORTED_BEDROCK_CODECS.add(Bedrock_v630.CODEC.toBuilder()
|
||||
.minecraftVersion("1.20.50/1.20.51")
|
||||
.build());
|
||||
SUPPORTED_BEDROCK_CODECS.add(Bedrock_v649.CODEC.toBuilder()
|
||||
.minecraftVersion("1.20.60/1.20.62")
|
||||
.build());
|
||||
SUPPORTED_BEDROCK_CODECS.add(DEFAULT_BEDROCK_CODEC.toBuilder()
|
||||
.minecraftVersion("1.20.60/1.20.61")
|
||||
.minecraftVersion("1.20.70")
|
||||
.build());
|
||||
}
|
||||
|
||||
@ -92,6 +96,10 @@ public final class GameProtocol {
|
||||
return session.getUpstream().getProtocolVersion() < Bedrock_v630.CODEC.getProtocolVersion();
|
||||
}
|
||||
|
||||
public static boolean isPre1_20_70(GeyserSession session) {
|
||||
return session.getUpstream().getProtocolVersion() < Bedrock_v662.CODEC.getProtocolVersion();
|
||||
}
|
||||
|
||||
public static boolean is1_20_60orHigher(int protocolVersion) {
|
||||
return protocolVersion >= Bedrock_v649.CODEC.getProtocolVersion();
|
||||
}
|
||||
|
@ -42,6 +42,7 @@ import org.cloudburstmc.nbt.NbtType;
|
||||
import org.cloudburstmc.protocol.bedrock.codec.v622.Bedrock_v622;
|
||||
import org.cloudburstmc.protocol.bedrock.codec.v630.Bedrock_v630;
|
||||
import org.cloudburstmc.protocol.bedrock.codec.v649.Bedrock_v649;
|
||||
import org.cloudburstmc.protocol.bedrock.codec.v662.Bedrock_v662;
|
||||
import org.cloudburstmc.protocol.bedrock.data.BlockPropertyData;
|
||||
import org.cloudburstmc.protocol.bedrock.data.definitions.BlockDefinition;
|
||||
import org.geysermc.geyser.GeyserImpl;
|
||||
@ -118,9 +119,10 @@ public final class BlockRegistryPopulator {
|
||||
private static void registerBedrockBlocks() {
|
||||
var blockMappers = ImmutableMap.<ObjectIntPair<String>, Remapper>builder()
|
||||
.put(ObjectIntPair.of("1_20_40", Bedrock_v622.CODEC.getProtocolVersion()), Conversion630_622::remapBlock)
|
||||
.put(ObjectIntPair.of("1_20_50", Bedrock_v630.CODEC.getProtocolVersion()), tag -> tag)
|
||||
.put(ObjectIntPair.of("1_20_50", Bedrock_v630.CODEC.getProtocolVersion()), Conversion649_630::remapBlock)
|
||||
// Only changes in 1.20.60 are hard_stained_glass (an EDU only block)
|
||||
.put(ObjectIntPair.of("1_20_60", Bedrock_v649.CODEC.getProtocolVersion()), tag -> tag)
|
||||
.put(ObjectIntPair.of("1_20_60", Bedrock_v649.CODEC.getProtocolVersion()), Conversion662_649::remapBlock)
|
||||
.put(ObjectIntPair.of("1_20_70", Bedrock_v662.CODEC.getProtocolVersion()), tag -> tag)
|
||||
.build();
|
||||
|
||||
// We can keep this strong as nothing should be garbage collected
|
||||
@ -133,7 +135,7 @@ public final class BlockRegistryPopulator {
|
||||
List<NbtMap> vanillaBlockStates;
|
||||
List<NbtMap> blockStates;
|
||||
try (InputStream stream = GeyserImpl.getInstance().getBootstrap().getResourceOrThrow(String.format("bedrock/block_palette.%s.nbt", palette.key()));
|
||||
NBTInputStream nbtInputStream = new NBTInputStream(new DataInputStream(new GZIPInputStream(stream)), true, true)) {
|
||||
NBTInputStream nbtInputStream = new NBTInputStream(new DataInputStream(new GZIPInputStream(stream)), true, true)) {
|
||||
NbtMap blockPalette = (NbtMap) nbtInputStream.readTag();
|
||||
|
||||
vanillaBlockStates = new ArrayList<>(blockPalette.getList("blocks", NbtType.COMPOUND));
|
||||
|
@ -121,6 +121,8 @@ class Conversion630_622 {
|
||||
}
|
||||
|
||||
static GeyserMappingItem remapItem(@SuppressWarnings("unused") Item item, GeyserMappingItem mapping) {
|
||||
mapping = Conversion649_630.remapItem(item, mapping);
|
||||
|
||||
String replacement = ITEMS.get(mapping.getBedrockIdentifier());
|
||||
if (replacement == null) {
|
||||
return mapping;
|
||||
@ -130,6 +132,8 @@ class Conversion630_622 {
|
||||
}
|
||||
|
||||
static NbtMap remapBlock(NbtMap tag) {
|
||||
tag = Conversion649_630.remapBlock(tag);
|
||||
|
||||
final String name = tag.getString("name");
|
||||
|
||||
String replacement;
|
||||
|
@ -22,19 +22,41 @@
|
||||
* @author GeyserMC
|
||||
* @link https://github.com/GeyserMC/Geyser
|
||||
*/
|
||||
|
||||
package org.geysermc.geyser.registry.populator;
|
||||
|
||||
import org.cloudburstmc.nbt.NbtMap;
|
||||
import org.cloudburstmc.nbt.NbtMapBuilder;
|
||||
import org.geysermc.geyser.item.type.Item;
|
||||
import org.geysermc.geyser.registry.type.GeyserMappingItem;
|
||||
|
||||
public class Conversion649_630 {
|
||||
|
||||
static GeyserMappingItem remapItem(@SuppressWarnings("unused") Item item, GeyserMappingItem mapping) {
|
||||
mapping = Conversion662_649.remapItem(item, mapping);
|
||||
|
||||
public class Conversion630_649 {
|
||||
String identifer = mapping.getBedrockIdentifier();
|
||||
|
||||
static GeyserMappingItem remapItem(@SuppressWarnings("unused") Item item, GeyserMappingItem mapping) {
|
||||
if (mapping.getBedrockIdentifier().equalsIgnoreCase("minecraft:scute")) {
|
||||
return mapping.withBedrockIdentifier("minecraft:turtle_scute");
|
||||
switch (identifer) {
|
||||
case "minecraft:turtle_scute" -> { return mapping.withBedrockIdentifier("minecraft:scute"); }
|
||||
case "minecraft:trial_spawner" -> { return mapping.withBedrockIdentifier("minecraft:mob_spawner"); }
|
||||
case "minecraft:trial_key" -> { return mapping.withBedrockIdentifier("minecraft:echo_shard"); }
|
||||
default -> { return mapping; }
|
||||
}
|
||||
}
|
||||
|
||||
static NbtMap remapBlock(NbtMap tag) {
|
||||
tag = Conversion662_649.remapBlock(tag);
|
||||
|
||||
final String name = tag.getString("name");
|
||||
|
||||
if (name.equals("minecraft:trial_spawner")) {
|
||||
NbtMapBuilder builder = tag.toBuilder()
|
||||
.putString("name", "minecraft:mob_spawner")
|
||||
.putCompound("states", NbtMap.EMPTY);
|
||||
|
||||
return builder.build();
|
||||
}
|
||||
|
||||
return tag;
|
||||
}
|
||||
return mapping;
|
||||
}
|
||||
}
|
@ -0,0 +1,156 @@
|
||||
/*
|
||||
* Copyright (c) 2019-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.registry.populator;
|
||||
|
||||
import org.cloudburstmc.nbt.NbtMap;
|
||||
import org.cloudburstmc.nbt.NbtMapBuilder;
|
||||
import org.geysermc.geyser.item.type.Item;
|
||||
import org.geysermc.geyser.registry.type.GeyserMappingItem;
|
||||
|
||||
import java.util.List;
|
||||
import java.util.stream.Stream;
|
||||
|
||||
public class Conversion662_649 {
|
||||
|
||||
private static final List<String> NEW_MISC = List.of("minecraft:grass_block", "minecraft:trial_spawner");
|
||||
private static final List<String> NEW_WOODS = List.of("minecraft:oak_wood", "minecraft:spruce_wood", "minecraft:birch_wood", "minecraft:jungle_wood", "minecraft:acacia_wood", "minecraft:dark_oak_wood", "minecraft:stripped_oak_wood", "minecraft:stripped_spruce_wood", "minecraft:stripped_birch_wood", "minecraft:stripped_jungle_wood", "minecraft:stripped_acacia_wood", "minecraft:stripped_dark_oak_wood");
|
||||
private static final List<String> NEW_LEAVES = List.of("minecraft:oak_leaves", "minecraft:spruce_leaves", "minecraft:birch_leaves", "minecraft:jungle_leaves");
|
||||
private static final List<String> NEW_LEAVES2 = List.of("minecraft:acacia_leaves", "minecraft:dark_oak_leaves");
|
||||
private static final List<String> NEW_SLABS = List.of("minecraft:oak_slab", "minecraft:spruce_slab", "minecraft:birch_slab", "minecraft:jungle_slab", "minecraft:acacia_slab", "minecraft:dark_oak_slab", "minecraft:oak_double_slab", "minecraft:spruce_double_slab", "minecraft:birch_double_slab", "minecraft:jungle_double_slab", "minecraft:acacia_double_slab", "minecraft:dark_oak_double_slab");
|
||||
private static final List<String> NEW_BLOCKS = Stream.of(NEW_WOODS, NEW_LEAVES, NEW_LEAVES2, NEW_SLABS, NEW_MISC).flatMap(List::stream).toList();
|
||||
|
||||
|
||||
static GeyserMappingItem remapItem(@SuppressWarnings("unused") Item item, GeyserMappingItem mapping) {
|
||||
String identifer = mapping.getBedrockIdentifier();
|
||||
|
||||
if (identifer.equals("minecraft:grass_block")) {
|
||||
return mapping.withBedrockIdentifier("minecraft:grass");
|
||||
}
|
||||
|
||||
if (NEW_WOODS.contains(identifer)) {
|
||||
switch (identifer) {
|
||||
case "minecraft:oak_wood" -> { return mapping.withBedrockIdentifier("minecraft:wood").withBedrockData(0); }
|
||||
case "minecraft:spruce_wood" -> { return mapping.withBedrockIdentifier("minecraft:wood").withBedrockData(1); }
|
||||
case "minecraft:birch_wood" -> { return mapping.withBedrockIdentifier("minecraft:wood").withBedrockData(2); }
|
||||
case "minecraft:jungle_wood" -> { return mapping.withBedrockIdentifier("minecraft:wood").withBedrockData(3); }
|
||||
case "minecraft:acacia_wood" -> { return mapping.withBedrockIdentifier("minecraft:wood").withBedrockData(4); }
|
||||
case "minecraft:dark_oak_wood" -> { return mapping.withBedrockIdentifier("minecraft:wood").withBedrockData(5); }
|
||||
case "minecraft:stripped_oak_wood" -> { return mapping.withBedrockIdentifier("minecraft:wood").withBedrockData(8); }
|
||||
case "minecraft:stripped_spruce_wood" -> { return mapping.withBedrockIdentifier("minecraft:wood").withBedrockData(9); }
|
||||
case "minecraft:stripped_birch_wood" -> { return mapping.withBedrockIdentifier("minecraft:wood").withBedrockData(10); }
|
||||
case "minecraft:stripped_jungle_wood" -> { return mapping.withBedrockIdentifier("minecraft:wood").withBedrockData(11); }
|
||||
case "minecraft:stripped_acacia_wood" -> { return mapping.withBedrockIdentifier("minecraft:wood").withBedrockData(12); }
|
||||
case "minecraft:stripped_dark_oak_wood" -> { return mapping.withBedrockIdentifier("minecraft:wood").withBedrockData(13); }
|
||||
}
|
||||
}
|
||||
|
||||
if (NEW_LEAVES.contains(identifer) || NEW_LEAVES2.contains(identifer)) {
|
||||
switch (identifer) {
|
||||
case "minecraft:oak_leaves" -> { return mapping.withBedrockIdentifier("minecraft:leaves").withBedrockData(0); }
|
||||
case "minecraft:spruce_leaves" -> { return mapping.withBedrockIdentifier("minecraft:leaves").withBedrockData(1); }
|
||||
case "minecraft:birch_leaves" -> { return mapping.withBedrockIdentifier("minecraft:leaves").withBedrockData(2); }
|
||||
case "minecraft:jungle_leaves" -> { return mapping.withBedrockIdentifier("minecraft:leaves").withBedrockData(3); }
|
||||
case "minecraft:acacia_leaves" -> { return mapping.withBedrockIdentifier("minecraft:leaves2").withBedrockData(0); }
|
||||
case "minecraft:dark_oak_leaves" -> { return mapping.withBedrockIdentifier("minecraft:leaves2").withBedrockData(1); }
|
||||
}
|
||||
}
|
||||
|
||||
return mapping;
|
||||
}
|
||||
|
||||
static NbtMap remapBlock(NbtMap tag) {
|
||||
final String name = tag.getString("name");
|
||||
|
||||
if (!NEW_BLOCKS.contains(name)) {
|
||||
return tag;
|
||||
}
|
||||
|
||||
String replacement;
|
||||
|
||||
if (name.equals("minecraft:grass_block")) {
|
||||
replacement = "minecraft:grass";
|
||||
|
||||
NbtMapBuilder builder = tag.toBuilder();
|
||||
builder.putString("name", replacement);
|
||||
|
||||
return builder.build();
|
||||
}
|
||||
|
||||
if (NEW_WOODS.contains(name)) {
|
||||
replacement = "minecraft:wood";
|
||||
|
||||
NbtMap states = tag.getCompound("states");
|
||||
boolean stripped = name.startsWith("minecraft:stripped_");
|
||||
String woodType = name.replaceAll("minecraft:|_wood|stripped_", "");
|
||||
|
||||
NbtMapBuilder statesBuilder = states.toBuilder()
|
||||
.putString("wood_type", woodType)
|
||||
.putBoolean("stripped_bit", stripped);
|
||||
|
||||
NbtMapBuilder builder = tag.toBuilder()
|
||||
.putString("name", replacement)
|
||||
.putCompound("states", statesBuilder.build());
|
||||
|
||||
return builder.build();
|
||||
}
|
||||
|
||||
if (NEW_LEAVES.contains(name) || NEW_LEAVES2.contains(name)) {
|
||||
boolean leaves2 = NEW_LEAVES2.contains(name);
|
||||
replacement = leaves2 ? "minecraft:leaves2" : "minecraft:leaves";
|
||||
|
||||
NbtMap states = tag.getCompound("states");
|
||||
String leafType = name.replaceAll("minecraft:|_leaves", "");
|
||||
|
||||
NbtMapBuilder statesBuilder = states.toBuilder()
|
||||
.putString(leaves2 ? "new_leaf_type" : "old_leaf_type", leafType);
|
||||
|
||||
NbtMapBuilder builder = tag.toBuilder()
|
||||
.putString("name", replacement)
|
||||
.putCompound("states", statesBuilder.build());
|
||||
|
||||
return builder.build();
|
||||
}
|
||||
|
||||
|
||||
if (NEW_SLABS.contains(name)) {
|
||||
replacement = name.contains("double") ? "minecraft:double_wooden_slab" : "minecraft:wooden_slab";
|
||||
|
||||
NbtMap states = tag.getCompound("states");
|
||||
String woodType = name.replaceAll("minecraft:|_double|_slab", "");
|
||||
|
||||
NbtMapBuilder statesBuilder = states.toBuilder()
|
||||
.putString("wood_type", woodType);
|
||||
|
||||
NbtMapBuilder builder = tag.toBuilder()
|
||||
.putString("name", replacement)
|
||||
.putCompound("states", statesBuilder.build());
|
||||
|
||||
return builder.build();
|
||||
}
|
||||
|
||||
return tag;
|
||||
}
|
||||
}
|
@ -41,6 +41,7 @@ import org.cloudburstmc.nbt.NbtType;
|
||||
import org.cloudburstmc.protocol.bedrock.codec.v622.Bedrock_v622;
|
||||
import org.cloudburstmc.protocol.bedrock.codec.v630.Bedrock_v630;
|
||||
import org.cloudburstmc.protocol.bedrock.codec.v649.Bedrock_v649;
|
||||
import org.cloudburstmc.protocol.bedrock.codec.v662.Bedrock_v662;
|
||||
import org.cloudburstmc.protocol.bedrock.data.SoundEvent;
|
||||
import org.cloudburstmc.protocol.bedrock.data.definitions.BlockDefinition;
|
||||
import org.cloudburstmc.protocol.bedrock.data.definitions.ItemDefinition;
|
||||
@ -90,8 +91,9 @@ public class ItemRegistryPopulator {
|
||||
public static void populate() {
|
||||
List<PaletteVersion> paletteVersions = new ArrayList<>(3);
|
||||
paletteVersions.add(new PaletteVersion("1_20_40", Bedrock_v622.CODEC.getProtocolVersion(), Collections.emptyMap(), Conversion630_622::remapItem));
|
||||
paletteVersions.add(new PaletteVersion("1_20_50", Bedrock_v630.CODEC.getProtocolVersion()));
|
||||
paletteVersions.add(new PaletteVersion("1_20_60", Bedrock_v649.CODEC.getProtocolVersion(), Collections.emptyMap(), Conversion630_649::remapItem));
|
||||
paletteVersions.add(new PaletteVersion("1_20_50", Bedrock_v630.CODEC.getProtocolVersion(), Collections.emptyMap(), Conversion649_630::remapItem));
|
||||
paletteVersions.add(new PaletteVersion("1_20_60", Bedrock_v649.CODEC.getProtocolVersion(), Collections.emptyMap(), Conversion662_649::remapItem));
|
||||
paletteVersions.add(new PaletteVersion("1_20_70", Bedrock_v662.CODEC.getProtocolVersion()));
|
||||
|
||||
GeyserBootstrap bootstrap = GeyserImpl.getInstance().getBootstrap();
|
||||
|
||||
|
@ -39,10 +39,12 @@ import org.geysermc.geyser.translator.protocol.Translator;
|
||||
* Pre-1.16.210: used for both survival and creative item frame item removal
|
||||
* <p>
|
||||
* 1.16.210: only used in creative.
|
||||
* 1.20.70: no longer used.
|
||||
*/
|
||||
@Translator(packet = ItemFrameDropItemPacket.class)
|
||||
public class BedrockItemFrameDropItemTranslator extends PacketTranslator<ItemFrameDropItemPacket> {
|
||||
|
||||
// TODO: Remove when 1.20.60 is no longer supported
|
||||
@Override
|
||||
public void translate(GeyserSession session, ItemFrameDropItemPacket packet) {
|
||||
Entity entity = ItemFrameEntity.getItemFrameEntity(session, packet.getBlockPosition());
|
||||
|
@ -47,6 +47,7 @@ public class BedrockLecternUpdateTranslator extends PacketTranslator<LecternUpda
|
||||
|
||||
@Override
|
||||
public void translate(GeyserSession session, LecternUpdatePacket packet) {
|
||||
// TODO: Remove dropping book check here when 1.20.60 is no longer supported
|
||||
if (packet.isDroppingBook()) {
|
||||
// Bedrock drops the book outside of the GUI. Java drops it in the GUI
|
||||
// So, we enter the GUI and then drop it! :)
|
||||
|
@ -46,6 +46,7 @@ import org.geysermc.geyser.entity.type.ItemFrameEntity;
|
||||
import org.geysermc.geyser.entity.type.player.SessionPlayerEntity;
|
||||
import org.geysermc.geyser.inventory.GeyserItemStack;
|
||||
import org.geysermc.geyser.level.block.BlockStateValues;
|
||||
import org.geysermc.geyser.network.GameProtocol;
|
||||
import org.geysermc.geyser.registry.BlockRegistries;
|
||||
import org.geysermc.geyser.registry.type.BlockMapping;
|
||||
import org.geysermc.geyser.registry.type.ItemMapping;
|
||||
@ -299,39 +300,70 @@ public class BedrockActionTranslator extends PacketTranslator<PlayerActionPacket
|
||||
}
|
||||
break;
|
||||
case START_FLYING: // Since 1.20.30
|
||||
if (session.isCanFly()) {
|
||||
if (session.getGameMode() == GameMode.SPECTATOR) {
|
||||
if (session.isCanFly()) {
|
||||
if (session.getGameMode() == GameMode.SPECTATOR) {
|
||||
// should already be flying
|
||||
session.sendAdventureSettings();
|
||||
break;
|
||||
}
|
||||
session.sendAdventureSettings();
|
||||
break;
|
||||
}
|
||||
|
||||
if (session.getPlayerEntity().getFlag(EntityFlag.SWIMMING) && session.getCollisionManager().isPlayerInWater()) {
|
||||
if (session.getPlayerEntity().getFlag(EntityFlag.SWIMMING) && session.getCollisionManager().isPlayerInWater()) {
|
||||
// As of 1.18.1, Java Edition cannot fly while in water, but it can fly while crawling
|
||||
// If this isn't present, swimming on a 1.13.2 server and then attempting to fly will put you into a flying/swimming state that is invalid on JE
|
||||
session.sendAdventureSettings();
|
||||
break;
|
||||
}
|
||||
session.sendAdventureSettings();
|
||||
break;
|
||||
}
|
||||
|
||||
session.setFlying(true);
|
||||
session.sendDownstreamGamePacket(new ServerboundPlayerAbilitiesPacket(true));
|
||||
} else {
|
||||
session.setFlying(true);
|
||||
session.sendDownstreamGamePacket(new ServerboundPlayerAbilitiesPacket(true));
|
||||
} else {
|
||||
// update whether we can fly
|
||||
session.sendAdventureSettings();
|
||||
session.sendAdventureSettings();
|
||||
// stop flying
|
||||
PlayerActionPacket stopFlyingPacket = new PlayerActionPacket();
|
||||
stopFlyingPacket.setRuntimeEntityId(session.getPlayerEntity().getGeyserId());
|
||||
stopFlyingPacket.setAction(PlayerActionType.STOP_FLYING);
|
||||
stopFlyingPacket.setBlockPosition(Vector3i.ZERO);
|
||||
stopFlyingPacket.setResultPosition(Vector3i.ZERO);
|
||||
stopFlyingPacket.setFace(0);
|
||||
session.sendUpstreamPacket(stopFlyingPacket);
|
||||
}
|
||||
break;
|
||||
PlayerActionPacket stopFlyingPacket = new PlayerActionPacket();
|
||||
stopFlyingPacket.setRuntimeEntityId(session.getPlayerEntity().getGeyserId());
|
||||
stopFlyingPacket.setAction(PlayerActionType.STOP_FLYING);
|
||||
stopFlyingPacket.setBlockPosition(Vector3i.ZERO);
|
||||
stopFlyingPacket.setResultPosition(Vector3i.ZERO);
|
||||
stopFlyingPacket.setFace(0);
|
||||
session.sendUpstreamPacket(stopFlyingPacket);
|
||||
}
|
||||
break;
|
||||
case STOP_FLYING:
|
||||
session.setFlying(false);
|
||||
session.sendDownstreamGamePacket(new ServerboundPlayerAbilitiesPacket(false));
|
||||
break;
|
||||
case DIMENSION_CHANGE_REQUEST_OR_CREATIVE_DESTROY_BLOCK: // Used by client to get book from lecterns and items from item frame in creative mode since 1.20.70
|
||||
if (GameProtocol.isPre1_20_70(session)) {
|
||||
break;
|
||||
}
|
||||
|
||||
int interactedBlock = session.getGeyser().getWorldManager().getBlockAt(session, vector);
|
||||
|
||||
if (BlockStateValues.getLecternBookStates().getOrDefault(interactedBlock, false)) {
|
||||
session.setDroppingLecternBook(true);
|
||||
|
||||
ServerboundUseItemOnPacket blockPacket = new ServerboundUseItemOnPacket(
|
||||
vector,
|
||||
Direction.DOWN,
|
||||
Hand.MAIN_HAND,
|
||||
0, 0, 0,
|
||||
false,
|
||||
session.getWorldCache().nextPredictionSequence());
|
||||
session.sendDownstreamGamePacket(blockPacket);
|
||||
break;
|
||||
}
|
||||
|
||||
if (session.getItemFrameCache().containsKey(vector)) {
|
||||
Entity itemFrame = ItemFrameEntity.getItemFrameEntity(session, packet.getBlockPosition());
|
||||
|
||||
if (itemFrame != null) {
|
||||
ServerboundInteractPacket interactPacket = new ServerboundInteractPacket(itemFrame.getEntityId(),
|
||||
InteractAction.ATTACK, Hand.MAIN_HAND, session.isSneaking());
|
||||
session.sendDownstreamGamePacket(interactPacket);
|
||||
}
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -25,11 +25,16 @@
|
||||
|
||||
package org.geysermc.geyser.translator.protocol.bedrock.world;
|
||||
|
||||
import com.github.steveice10.mc.protocol.data.game.entity.object.Direction;
|
||||
import com.github.steveice10.mc.protocol.data.game.entity.player.Hand;
|
||||
import com.github.steveice10.mc.protocol.packet.ingame.serverbound.player.ServerboundSwingPacket;
|
||||
import com.github.steveice10.mc.protocol.packet.ingame.serverbound.player.ServerboundUseItemOnPacket;
|
||||
import org.cloudburstmc.math.vector.Vector3f;
|
||||
import org.cloudburstmc.math.vector.Vector3i;
|
||||
import org.cloudburstmc.protocol.bedrock.data.SoundEvent;
|
||||
import org.cloudburstmc.protocol.bedrock.packet.AnimatePacket;
|
||||
import org.cloudburstmc.protocol.bedrock.packet.LevelSoundEventPacket;
|
||||
import org.geysermc.geyser.level.block.BlockStateValues;
|
||||
import org.geysermc.geyser.session.GeyserSession;
|
||||
import org.geysermc.geyser.translator.protocol.PacketTranslator;
|
||||
import org.geysermc.geyser.translator.protocol.Translator;
|
||||
@ -66,5 +71,26 @@ public class BedrockLevelSoundEventTranslator extends PacketTranslator<LevelSoun
|
||||
animatePacket.setAction(AnimatePacket.Action.SWING_ARM);
|
||||
session.sendUpstreamPacket(animatePacket);
|
||||
}
|
||||
|
||||
// Used by client to get book from lecterns in survial mode since 1.20.70
|
||||
if (packet.getSound() == SoundEvent.HIT) {
|
||||
Vector3f position = packet.getPosition();
|
||||
Vector3i blockPosition = Vector3i.from(position.getX(), position.getY(), position.getZ());
|
||||
|
||||
int potentialLectern = session.getGeyser().getWorldManager().getBlockAt(session, blockPosition);
|
||||
|
||||
if (BlockStateValues.getLecternBookStates().getOrDefault(potentialLectern, false)) {
|
||||
session.setDroppingLecternBook(true);
|
||||
|
||||
ServerboundUseItemOnPacket blockPacket = new ServerboundUseItemOnPacket(
|
||||
blockPosition,
|
||||
Direction.DOWN,
|
||||
Hand.MAIN_HAND,
|
||||
0, 0, 0,
|
||||
false,
|
||||
session.getWorldCache().nextPredictionSequence());
|
||||
session.sendDownstreamGamePacket(blockPacket);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
Binäre Datei nicht angezeigt.
BIN
core/src/main/resources/bedrock/block_palette.1_20_70.nbt
Normale Datei
BIN
core/src/main/resources/bedrock/block_palette.1_20_70.nbt
Normale Datei
Binäre Datei nicht angezeigt.
5803
core/src/main/resources/bedrock/creative_items.1_20_70.json
Normale Datei
5803
core/src/main/resources/bedrock/creative_items.1_20_70.json
Normale Datei
Datei-Diff unterdrückt, da er zu groß ist
Diff laden
Binäre Datei nicht angezeigt.
6126
core/src/main/resources/bedrock/runtime_item_states.1_20_70.json
Normale Datei
6126
core/src/main/resources/bedrock/runtime_item_states.1_20_70.json
Normale Datei
Datei-Diff unterdrückt, da er zu groß ist
Diff laden
@ -1 +1 @@
|
||||
Subproject commit 522967d6ee76972994ad05a992dc9d7bb4e889ba
|
||||
Subproject commit c96c53850b720a0238e1a398a49b24b0a0887da7
|
@ -9,10 +9,10 @@ netty = "4.1.103.Final"
|
||||
guava = "29.0-jre"
|
||||
gson = "2.3.1" # Provided by Spigot 1.8.8
|
||||
websocket = "1.5.1"
|
||||
protocol = "3.0.0.Beta1-20240204.134050-120"
|
||||
protocol-connection = "3.0.0.Beta1-20240204.134050-119"
|
||||
protocol = "3.0.0.Beta1-20240226.201527-125"
|
||||
protocol-connection = "3.0.0.Beta1-20240226.201527-124"
|
||||
raknet = "1.0.0.CR1-20231206.145325-12"
|
||||
blockstateupdater="1.20.60-20240129.140535-1"
|
||||
blockstateupdater="1.20.70-20240303.125052-2"
|
||||
mcauthlib = "d9d773e"
|
||||
mcprotocollib = "1.20.4-2-20240116.220521-7"
|
||||
adventure = "4.14.0"
|
||||
|
Laden…
In neuem Issue referenzieren
Einen Benutzer sperren