Support 1.17-pre3 and Bedrock 1.17.0.58

This commit is contained in:
Camotoy 2021-06-01 21:12:58 -04:00
parent f09a32babc
commit f5c5d0cd39
No known key found for this signature in database
GPG key ID: 7EEFB66FE798081F
17 changed files with 1577 additions and 1189 deletions

View file

@ -18,7 +18,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 v1.16.220.52 and Minecraft Java 21w20a.
### Currently supporting Minecraft Bedrock v1.17.0.58 and Minecraft Java 1.17-pre3.
## Setting Up
Take a look [here](https://github.com/GeyserMC/Geyser/wiki#Setup) for how to set up Geyser.

View file

@ -31,8 +31,8 @@
</dependency>
<dependency>
<groupId>com.github.CloudburstMC.Protocol</groupId>
<artifactId>bedrock-v431</artifactId>
<version>530a0e3</version>
<artifactId>bedrock-v440</artifactId>
<version>a8f4e93</version>
<scope>compile</scope>
<exclusions>
<exclusion>
@ -120,9 +120,9 @@
<scope>compile</scope>
</dependency>
<dependency>
<groupId>com.github.steveice10</groupId>
<artifactId>mcprotocollib</artifactId>
<version>1.17-pre1-SNAPSHOT</version>
<groupId>com.github.GeyserMC</groupId>
<artifactId>MCProtocolLib</artifactId>
<version>9ba9d7e</version>
<scope>compile</scope>
<exclusions>
<exclusion>

View file

@ -26,7 +26,7 @@
package org.geysermc.connector.network;
import com.nukkitx.protocol.bedrock.BedrockPacketCodec;
import com.nukkitx.protocol.bedrock.v431.Bedrock_v431;
import com.nukkitx.protocol.bedrock.v440.Bedrock_v440;
import java.util.ArrayList;
import java.util.List;
@ -39,7 +39,7 @@ public class BedrockProtocol {
* Default Bedrock codec that should act as a fallback. Should represent the latest available
* release of the game that Geyser supports.
*/
public static final BedrockPacketCodec DEFAULT_BEDROCK_CODEC = Bedrock_v431.V431_CODEC;
public static final BedrockPacketCodec DEFAULT_BEDROCK_CODEC = Bedrock_v440.V440_CODEC;
/**
* A list of all supported Bedrock versions that can join Geyser
*/

View file

@ -37,7 +37,7 @@ import org.geysermc.connector.network.session.GeyserSession;
import org.geysermc.connector.network.session.cache.AdvancementsCache;
import org.geysermc.connector.network.translators.PacketTranslatorRegistry;
import org.geysermc.connector.network.translators.item.ItemRegistry;
import org.geysermc.connector.network.translators.world.block.BlockTranslator1_16_210;
import org.geysermc.connector.network.translators.world.block.BlockTranslator1_17_0;
import org.geysermc.connector.utils.*;
import java.io.FileInputStream;
@ -72,7 +72,7 @@ public class UpstreamPacketHandler extends LoggingPacketHandler {
session.getUpstream().getSession().setPacketCodec(packetCodec);
// Set the block translation based off of version
session.setBlockTranslator(BlockTranslator1_16_210.INSTANCE);
session.setBlockTranslator(BlockTranslator1_17_0.INSTANCE);
LoginEncryptionUtils.encryptPlayerConnection(connector, session, loginPacket);
@ -137,8 +137,6 @@ public class UpstreamPacketHandler extends LoggingPacketHandler {
stackPacket.getExperiments().add(new ExperimentData("data_driven_items", true));
}
stackPacket.getExperiments().add(new ExperimentData("caves_and_cliffs", true));
session.sendUpstreamPacket(stackPacket);
break;

View file

@ -512,12 +512,7 @@ public class GeyserSession implements CommandSender {
upstream.sendPacket(entityPacket);
CreativeContentPacket creativePacket = new CreativeContentPacket();
if (upstream.getSession().getPacketCodec().getProtocolVersion() < Bedrock_v431.V431_CODEC.getProtocolVersion()) {
creativePacket.setContents(ItemRegistry.getPre1_16_220CreativeContents());
} else {
// No additional work required
creativePacket.setContents(ItemRegistry.CREATIVE_ITEMS);
}
creativePacket.setContents(ItemRegistry.CREATIVE_ITEMS);
upstream.sendPacket(creativePacket);
PlayStatusPacket playStatusPacket = new PlayStatusPacket();
@ -1048,14 +1043,13 @@ public class GeyserSession implements CommandSender {
startGamePacket.setItemEntries(ItemRegistry.ITEMS);
startGamePacket.setVanillaVersion("*");
startGamePacket.setInventoriesServerAuthoritative(true);
startGamePacket.setServerEngine(""); // Do we want to fill this in?
SyncedPlayerMovementSettings settings = new SyncedPlayerMovementSettings();
settings.setMovementMode(AuthoritativeMovementMode.CLIENT);
settings.setRewindHistorySize(0);
settings.setServerAuthoritativeBlockBreaking(false);
startGamePacket.setPlayerMovementSettings(settings);
startGamePacket.getExperiments().add(new ExperimentData("caves_and_cliffs", true));
upstream.sendPacket(startGamePacket);
}

View file

@ -28,7 +28,7 @@ package org.geysermc.connector.network.translators.item;
import lombok.AllArgsConstructor;
import lombok.Getter;
import lombok.ToString;
import org.geysermc.connector.network.translators.world.block.BlockTranslator1_16_210;
import org.geysermc.connector.network.translators.world.block.BlockTranslator1_17_0;
@Getter
@AllArgsConstructor
@ -36,7 +36,7 @@ import org.geysermc.connector.network.translators.world.block.BlockTranslator1_1
public class ItemEntry {
public static ItemEntry AIR = new ItemEntry("minecraft:air", "minecraft:air", 0, 0, 0,
BlockTranslator1_16_210.INSTANCE.getBedrockAirId(), 64);
BlockTranslator1_17_0.INSTANCE.getBedrockAirId(), 64);
private final String javaIdentifier;
private final String bedrockIdentifier;

View file

@ -45,7 +45,7 @@ import it.unimi.dsi.fastutil.objects.Object2IntOpenHashMap;
import it.unimi.dsi.fastutil.objects.ObjectOpenHashSet;
import org.geysermc.connector.GeyserConnector;
import org.geysermc.connector.network.translators.world.block.BlockTranslator;
import org.geysermc.connector.network.translators.world.block.BlockTranslator1_16_210;
import org.geysermc.connector.network.translators.world.block.BlockTranslator1_17_0;
import org.geysermc.connector.utils.FileUtils;
import org.geysermc.connector.utils.LanguageUtils;
@ -250,7 +250,7 @@ public class ItemRegistry {
throw new AssertionError(LanguageUtils.getLocaleStringLog("geyser.toolbox.fail.runtime_java"), e);
}
BlockTranslator blockTranslator = BlockTranslator1_16_210.INSTANCE;
BlockTranslator blockTranslator = BlockTranslator1_17_0.INSTANCE;
int itemIndex = 0;
int javaFurnaceMinecartId = 0;
@ -537,37 +537,6 @@ public class ItemRegistry {
JAVA_ONLY_ITEMS = ImmutableSet.copyOf(javaOnlyItems);
}
/* pre-1.16.220 support start */
private static ItemData[] LEGACY_CREATIVE_CONTENTS = null;
/**
* Built on the fly so extra memory isn't used if there are no 1.16.210-or-below clients joining.
*
* @return a list of creative items built for versions before 1.16.220.
*/
public static ItemData[] getPre1_16_220CreativeContents() {
if (LEGACY_CREATIVE_CONTENTS != null) {
return LEGACY_CREATIVE_CONTENTS;
}
// Pre-1.16.220 relies on item damage values that the creative content packet drops
ItemData[] creativeContents = new ItemData[CREATIVE_ITEMS.length];
for (int i = 0; i < CREATIVE_ITEMS.length; i++) {
ItemData item = CREATIVE_ITEMS[i];
if (item.getBlockRuntimeId() != 0) {
creativeContents[i] = item.toBuilder().damage(getItem(item).getBedrockData()).build();
} else {
// No block runtime ID means that this item is backwards-compatible
creativeContents[i] = item;
}
}
LEGACY_CREATIVE_CONTENTS = creativeContents;
return creativeContents;
}
/* pre-1.16.220 support end */
/**
* Gets an {@link ItemEntry} from the given {@link ItemStack}.
*

View file

@ -43,9 +43,7 @@ import org.geysermc.connector.utils.FileUtils;
import java.io.DataInputStream;
import java.io.InputStream;
import java.util.HashMap;
import java.util.Iterator;
import java.util.Map;
import java.util.*;
import java.util.zip.GZIPInputStream;
public abstract class BlockTranslator {
@ -221,7 +219,7 @@ public abstract class BlockTranslator {
BlockMapping.AIR = JAVA_RUNTIME_ID_TO_BLOCK_MAPPING.get(JAVA_AIR_ID);
BlockTranslator1_16_210.init();
BlockTranslator1_17_0.init();
BLOCKS_JSON = null; // We no longer require this so let it garbage collect away
}

View file

@ -25,11 +25,11 @@
package org.geysermc.connector.network.translators.world.block;
public class BlockTranslator1_16_210 extends BlockTranslator {
public static final BlockTranslator1_16_210 INSTANCE = new BlockTranslator1_16_210();
public class BlockTranslator1_17_0 extends BlockTranslator {
public static final BlockTranslator1_17_0 INSTANCE = new BlockTranslator1_17_0();
public BlockTranslator1_16_210() {
super("bedrock/blockpalette.1_16_210.nbt");
public BlockTranslator1_17_0() {
super("bedrock/block_palette.1_17_0.nbt");
}
@Override

View file

@ -74,17 +74,7 @@ public class ChunkUtils {
public static ChunkData translateToBedrock(GeyserSession session, Column column) {
Chunk[] javaSections = column.getChunks();
//FIXME TEMPORARY UNTIL THE CAVES AND CLIFFS EXPERIMENTAL DATA IS REMOVED UNLESS IT'S NOT REMOVED THEN HMMMM
int sectionYOffset;
if (session.getDimension().equals(DimensionUtils.OVERWORLD)) {
sectionYOffset = 4;
} else {
sectionYOffset = 0;
}
//FIXME END
ChunkSection[] sections = new ChunkSection[javaSections.length + sectionYOffset];
ChunkSection[] sections = new ChunkSection[javaSections.length];
// Temporarily stores compound tags of Bedrock-only block entities
List<NbtMap> bedrockOnlyBlockEntities = new ArrayList<>();
@ -197,7 +187,7 @@ public class ChunkUtils {
layers = new BlockStorage[]{ layer0, new BlockStorage(BitArrayVersion.V1.createArray(BlockStorage.SIZE, layer1Data), layer1Palette) };
}
sections[sectionY + sectionYOffset] = new ChunkSection(layers);
sections[sectionY] = new ChunkSection(layers);
}
CompoundTag[] blockEntities = column.getTileEntities();

File diff suppressed because it is too large Load diff

File diff suppressed because it is too large Load diff

@ -1 +1 @@
Subproject commit c5925b01cf8e7d8b284cf359e927145b9b4694aa
Subproject commit 07bd1db239492e22214abd911696b8cb99b0fe28