Mirror von
https://github.com/GeyserMC/Geyser.git
synchronisiert 2024-09-08 20:43:04 +02:00
Add some comments and fix book editing in creative
Dieser Commit ist enthalten in:
Ursprung
2304c1375e
Commit
ca620d6dd8
@ -26,7 +26,6 @@
|
||||
package org.geysermc.connector.network.translators.bedrock;
|
||||
|
||||
import com.github.steveice10.mc.protocol.data.game.entity.metadata.ItemStack;
|
||||
import com.github.steveice10.mc.protocol.data.game.entity.player.GameMode;
|
||||
import com.github.steveice10.mc.protocol.packet.ingame.client.window.ClientEditBookPacket;
|
||||
import com.github.steveice10.opennbt.tag.builtin.CompoundTag;
|
||||
import com.github.steveice10.opennbt.tag.builtin.ListTag;
|
||||
@ -54,8 +53,6 @@ public class BedrockBookEditTranslator extends PacketTranslator<BookEditPacket>
|
||||
List<Tag> pages = tag.contains("pages") ? new LinkedList<>(((ListTag) tag.get("pages")).getValue()) : new LinkedList<>();
|
||||
|
||||
int page = packet.getPageNumber();
|
||||
// Creative edits the NBT for us
|
||||
if (session.getGameMode() != GameMode.CREATIVE) {
|
||||
switch (packet.getAction()) {
|
||||
case ADD_PAGE: {
|
||||
// Add empty pages in between
|
||||
@ -99,7 +96,6 @@ public class BedrockBookEditTranslator extends PacketTranslator<BookEditPacket>
|
||||
default:
|
||||
return;
|
||||
}
|
||||
}
|
||||
// Remove empty pages at the end
|
||||
while (pages.size() > 0) {
|
||||
StringTag currentPage = (StringTag) pages.get(pages.size() - 1);
|
||||
|
@ -32,6 +32,9 @@ import org.geysermc.connector.network.translators.PacketTranslator;
|
||||
import org.geysermc.connector.network.translators.Translator;
|
||||
import org.geysermc.connector.network.translators.inventory.InventoryTranslator;
|
||||
|
||||
/**
|
||||
* The packet sent for server-authoritative-style inventory transactions.
|
||||
*/
|
||||
@Translator(packet = ItemStackRequestPacket.class)
|
||||
public class BedrockItemStackRequestTranslator extends PacketTranslator<ItemStackRequestPacket> {
|
||||
|
||||
|
@ -196,6 +196,12 @@ public class JavaDeclareRecipesTranslator extends PacketTranslator<ServerDeclare
|
||||
}
|
||||
|
||||
//TODO: rewrite
|
||||
/**
|
||||
* The Java server sends an array of items for each ingredient you can use per slot in the crafting grid.
|
||||
* Bedrock recipes take only one ingredient per crafting grid slot.
|
||||
*
|
||||
* @return the Java ingredient list as an array that Bedrock can understand
|
||||
*/
|
||||
private ItemData[][] combinations(GeyserSession session, Ingredient[] ingredients) {
|
||||
Map<Set<ItemData>, IntSet> squashedOptions = new HashMap<>();
|
||||
for (int i = 0; i < ingredients.length; i++) {
|
||||
|
Laden…
In neuem Issue referenzieren
Einen Benutzer sperren