Mirror von
https://github.com/GeyserMC/Geyser.git
synchronisiert 2024-12-27 08:30:12 +01: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:
Ursprung
74f869beb5
Commit
36708da1d6
@ -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.data.*;
|
||||||
import com.nukkitx.protocol.bedrock.packet.InventoryContentPacket;
|
import com.nukkitx.protocol.bedrock.packet.InventoryContentPacket;
|
||||||
import com.nukkitx.protocol.bedrock.packet.InventorySlotPacket;
|
import com.nukkitx.protocol.bedrock.packet.InventorySlotPacket;
|
||||||
|
import it.unimi.dsi.fastutil.longs.LongArraySet;
|
||||||
import org.geysermc.connector.inventory.Inventory;
|
import org.geysermc.connector.inventory.Inventory;
|
||||||
import org.geysermc.connector.network.session.GeyserSession;
|
import org.geysermc.connector.network.session.GeyserSession;
|
||||||
import org.geysermc.connector.network.translators.Translators;
|
import org.geysermc.connector.network.translators.Translators;
|
||||||
@ -40,6 +41,9 @@ import org.geysermc.connector.utils.InventoryUtils;
|
|||||||
import java.util.List;
|
import java.util.List;
|
||||||
|
|
||||||
public class PlayerInventoryTranslator extends InventoryTranslator {
|
public class PlayerInventoryTranslator extends InventoryTranslator {
|
||||||
|
|
||||||
|
private static final LongArraySet HAS_RECEIVED_MESSAGE = new LongArraySet();
|
||||||
|
|
||||||
public PlayerInventoryTranslator() {
|
public PlayerInventoryTranslator() {
|
||||||
super(46);
|
super(46);
|
||||||
}
|
}
|
||||||
@ -164,6 +168,11 @@ public class PlayerInventoryTranslator extends InventoryTranslator {
|
|||||||
//crafting grid is not visible in creative mode in java edition
|
//crafting grid is not visible in creative mode in java edition
|
||||||
for (InventoryActionData action : actions) {
|
for (InventoryActionData action : actions) {
|
||||||
if (action.getSource().getContainerId() == ContainerId.CURSOR && (action.getSlot() >= 28 && 31 >= action.getSlot())) {
|
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);
|
updateInventory(session, inventory);
|
||||||
InventoryUtils.updateCursor(session);
|
InventoryUtils.updateCursor(session);
|
||||||
return;
|
return;
|
||||||
|
Laden…
In neuem Issue referenzieren
Einen Benutzer sperren