mirror of
https://github.com/GeyserMC/Geyser.git
synced 2025-12-19 14:59:27 +00:00
Merge remote-tracking branch 'upstream/master' into feature/1.21.9
This commit is contained in:
@@ -86,7 +86,7 @@ public final class GameProtocol {
|
||||
register(Bedrock_v818.CODEC, "1.21.90", "1.21.91", "1.21.92");
|
||||
register(Bedrock_v819.CODEC, "1.21.93", "1.21.94");
|
||||
register(Bedrock_v827.CODEC, "1.21.100", "1.21.101");
|
||||
register(Bedrock_v844.CODEC, "1.21.110");
|
||||
register(Bedrock_v844.CODEC, "1.21.111");
|
||||
|
||||
MinecraftVersion latestBedrock = SUPPORTED_BEDROCK_VERSIONS.get(SUPPORTED_BEDROCK_VERSIONS.size() - 1);
|
||||
DEFAULT_BEDROCK_VERSION = latestBedrock.versionString();
|
||||
@@ -143,7 +143,11 @@ public final class GameProtocol {
|
||||
}
|
||||
|
||||
public static boolean is1_21_110orHigher(GeyserSession session) {
|
||||
return session.protocolVersion() >= Bedrock_v844.CODEC.getProtocolVersion();
|
||||
return is1_21_110orHigher(session.protocolVersion());
|
||||
}
|
||||
|
||||
public static boolean is1_21_110orHigher(int protocolVersion) {
|
||||
return protocolVersion >= Bedrock_v844.CODEC.getProtocolVersion();
|
||||
}
|
||||
|
||||
/**
|
||||
|
||||
@@ -35,6 +35,7 @@ import org.cloudburstmc.nbt.NbtMap;
|
||||
import org.cloudburstmc.nbt.NbtMapBuilder;
|
||||
import org.cloudburstmc.nbt.NbtType;
|
||||
import org.cloudburstmc.protocol.bedrock.codec.v594.Bedrock_v594;
|
||||
import org.cloudburstmc.protocol.bedrock.codec.v844.Bedrock_v844;
|
||||
import org.cloudburstmc.protocol.bedrock.data.BlockPropertyData;
|
||||
import org.geysermc.geyser.GeyserImpl;
|
||||
import org.geysermc.geyser.api.block.custom.CustomBlockData;
|
||||
@@ -61,6 +62,7 @@ import org.geysermc.geyser.level.block.type.Block;
|
||||
import org.geysermc.geyser.level.block.type.BlockState;
|
||||
import org.geysermc.geyser.level.physics.BoundingBox;
|
||||
import org.geysermc.geyser.level.physics.PistonBehavior;
|
||||
import org.geysermc.geyser.network.GameProtocol;
|
||||
import org.geysermc.geyser.registry.BlockRegistries;
|
||||
import org.geysermc.geyser.registry.Registries;
|
||||
import org.geysermc.geyser.registry.mappings.MappingsConfigReader;
|
||||
@@ -466,8 +468,14 @@ public class CustomBlockRegistryPopulator {
|
||||
MaterialInstance materialInstance = entry.getValue();
|
||||
NbtMapBuilder materialBuilder = NbtMap.builder()
|
||||
.putString("render_method", materialInstance.renderMethod())
|
||||
.putBoolean("face_dimming", materialInstance.faceDimming())
|
||||
.putBoolean("ambient_occlusion", materialInstance.faceDimming());
|
||||
.putBoolean("ambient_occlusion", materialInstance.ambientOcclusion());
|
||||
|
||||
if (GameProtocol.is1_21_110orHigher(protocolVersion)) {
|
||||
materialBuilder.putBoolean("packed_bools", materialInstance.faceDimming());
|
||||
} else {
|
||||
materialBuilder.putBoolean("face_dimming", materialInstance.faceDimming());
|
||||
}
|
||||
|
||||
// Texture can be unspecified when blocks.json is used in RP (https://wiki.bedrock.dev/blocks/blocks-stable.html#minecraft-material-instances)
|
||||
if (materialInstance.texture() != null) {
|
||||
materialBuilder.putString("texture", materialInstance.texture());
|
||||
|
||||
@@ -49,7 +49,6 @@ import org.geysermc.geyser.registry.type.GeyserMappingItem;
|
||||
import org.geysermc.geyser.registry.type.ItemMapping;
|
||||
import org.geysermc.geyser.registry.type.NonVanillaItemRegistration;
|
||||
import org.geysermc.mcprotocollib.protocol.data.game.item.component.DataComponentTypes;
|
||||
import org.geysermc.mcprotocollib.protocol.data.game.item.component.DataComponentTypes;
|
||||
import org.geysermc.mcprotocollib.protocol.data.game.item.component.DataComponents;
|
||||
|
||||
import java.util.ArrayList;
|
||||
@@ -346,7 +345,7 @@ public class CustomItemRegistryPopulator {
|
||||
.putString("event", "tool_durability")
|
||||
.putString("target", "self")
|
||||
.build())
|
||||
.putBoolean("use_efficiency", true)
|
||||
.putBoolean("use_efficiency", false)
|
||||
.build()
|
||||
);
|
||||
|
||||
|
||||
@@ -53,7 +53,7 @@ import java.util.regex.Pattern;
|
||||
|
||||
public class CustomSkullRegistryPopulator {
|
||||
|
||||
private static final Pattern SKULL_HASH_PATTERN = Pattern.compile("^[a-fA-F0-9]{64}$");
|
||||
private static final Pattern SKULL_HASH_PATTERN = Pattern.compile("^[a-fA-F0-9]+$");
|
||||
|
||||
public static void populate() {
|
||||
SkullResourcePackManager.SKULL_SKINS.clear(); // Remove skins after reloading
|
||||
@@ -122,7 +122,7 @@ public class CustomSkullRegistryPopulator {
|
||||
|
||||
skinHashes.forEach((skinHash) -> {
|
||||
if (!SKULL_HASH_PATTERN.matcher(skinHash).matches()) {
|
||||
GeyserImpl.getInstance().getLogger().error("Skin hash " + skinHash + " does not match required format ^[a-fA-F0-9]{64}$ and will not be added as a custom block.");
|
||||
GeyserImpl.getInstance().getLogger().error("Skin hash " + skinHash + " does not match required format ^[a-fA-F0-9]+$ and will not be added as a custom block.");
|
||||
return;
|
||||
}
|
||||
|
||||
|
||||
@@ -1682,17 +1682,21 @@ public class GeyserSession implements GeyserConnection, GeyserCommandSource {
|
||||
dialogManager.close();
|
||||
// Also close current inventories, otherwise the form will not show
|
||||
if (inventoryHolder != null) {
|
||||
// We'll open the form when the client confirms current inventory being closed
|
||||
formCache.addForm(form);
|
||||
InventoryUtils.sendJavaContainerClose(inventoryHolder);
|
||||
InventoryUtils.closeInventory(this, inventoryHolder, true);
|
||||
}
|
||||
return true;
|
||||
} else {
|
||||
return doSendForm(form);
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Sends a form without first closing any open dialog. This should only be used by {@link org.geysermc.geyser.session.dialog.Dialog}s.
|
||||
*/
|
||||
public boolean sendDialogForm(@NonNull Form form) {
|
||||
return doSendForm(form);
|
||||
public void sendDialogForm(@NonNull Form form) {
|
||||
doSendForm(form);
|
||||
}
|
||||
|
||||
private boolean doSendForm(@NonNull Form form) {
|
||||
@@ -1730,7 +1734,7 @@ public class GeyserSession implements GeyserConnection, GeyserCommandSource {
|
||||
|
||||
@Override
|
||||
public boolean sendForm(@NonNull FormBuilder<?, ?, ?> formBuilder) {
|
||||
formCache.showForm(formBuilder.build());
|
||||
sendForm(formBuilder.build());
|
||||
return true;
|
||||
}
|
||||
|
||||
|
||||
@@ -96,6 +96,10 @@ public class BedrockContainerCloseTranslator extends PacketTranslator<ContainerC
|
||||
|
||||
// Try open a pending inventory
|
||||
InventoryUtils.openPendingInventory(session);
|
||||
} else {
|
||||
// We must wait until current inventory is closed to ensure the form displays
|
||||
// and is not immediately closed by the client
|
||||
session.getFormCache().resendAllForms();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -68,6 +68,10 @@ public class JavaOpenBookTranslator extends PacketTranslator<ClientboundOpenBook
|
||||
InventoryUtils.closeInventory(session, openInventory, true);
|
||||
}
|
||||
|
||||
if (session.hasFormOpen()) {
|
||||
session.closeForm();
|
||||
}
|
||||
|
||||
//noinspection unchecked
|
||||
InventoryTranslator<LecternContainer> translator = (InventoryTranslator<LecternContainer>) InventoryTranslator.inventoryTranslator(ContainerType.LECTERN);
|
||||
Objects.requireNonNull(translator, "could not find lectern inventory translator!");
|
||||
|
||||
@@ -63,6 +63,10 @@ public class JavaOpenScreenTranslator extends PacketTranslator<ClientboundOpenSc
|
||||
newTranslator = InventoryTranslator.inventoryTranslator(packet.getType());
|
||||
}
|
||||
|
||||
if (session.hasFormOpen()) {
|
||||
session.closeForm();
|
||||
}
|
||||
|
||||
// No translator exists for this window type. Close all windows and return.
|
||||
if (newTranslator == null) {
|
||||
if (currentInventory != null) {
|
||||
|
||||
Reference in New Issue
Block a user