3
0
Mirror von https://github.com/GeyserMC/Geyser.git synchronisiert 2024-09-08 12:32:53 +02:00

Add message when you try to use creative crafting table (#422)

* Add message when you try to use creative crafting table

* Update message; set access level
Dieser Commit ist enthalten in:
Camotoy 2020-04-25 18:29:26 -04:00 committet von GitHub
Ursprung 74f869beb5
Commit 36708da1d6
Es konnte kein GPG-Schlüssel zu dieser Signatur gefunden werden
GPG-Schlüssel-ID: 4AEE18F83AFDEB23

Datei anzeigen

@ -31,6 +31,7 @@ import com.github.steveice10.mc.protocol.packet.ingame.client.window.ClientCreat
import com.nukkitx.protocol.bedrock.data.*;
import com.nukkitx.protocol.bedrock.packet.InventoryContentPacket;
import com.nukkitx.protocol.bedrock.packet.InventorySlotPacket;
import it.unimi.dsi.fastutil.longs.LongArraySet;
import org.geysermc.connector.inventory.Inventory;
import org.geysermc.connector.network.session.GeyserSession;
import org.geysermc.connector.network.translators.Translators;
@ -40,6 +41,9 @@ import org.geysermc.connector.utils.InventoryUtils;
import java.util.List;
public class PlayerInventoryTranslator extends InventoryTranslator {
private static final LongArraySet HAS_RECEIVED_MESSAGE = new LongArraySet();
public PlayerInventoryTranslator() {
super(46);
}
@ -164,6 +168,11 @@ public class PlayerInventoryTranslator extends InventoryTranslator {
//crafting grid is not visible in creative mode in java edition
for (InventoryActionData action : actions) {
if (action.getSource().getContainerId() == ContainerId.CURSOR && (action.getSlot() >= 28 && 31 >= action.getSlot())) {
if (!HAS_RECEIVED_MESSAGE.contains(session.getPlayerEntity().getEntityId())) {
// TODO: Allow the crafting table to be used with non-standalone versions
session.sendMessage("The creative crafting table cannot be used as it's incompatible with Minecraft: Java Edition.");
HAS_RECEIVED_MESSAGE.add(session.getPlayerEntity().getEntityId());
}
updateInventory(session, inventory);
InventoryUtils.updateCursor(session);
return;