mirror of
https://github.com/GeyserMC/Geyser.git
synced 2024-11-28 19:22:42 +01:00
Translate window properties
Furnace and brewing stand
This commit is contained in:
parent
211436c1e0
commit
cdab1ce5ec
2 changed files with 21 additions and 9 deletions
|
@ -36,22 +36,31 @@ public class BrewingStandInventoryTranslator extends BlockInventoryTranslator {
|
|||
super(5, 117 << 4, ContainerType.BREWING_STAND);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void openInventory(GeyserSession session, Inventory inventory) {
|
||||
super.openInventory(session, inventory);
|
||||
ContainerSetDataPacket dataPacket = new ContainerSetDataPacket();
|
||||
dataPacket.setWindowId((byte) inventory.getId());
|
||||
dataPacket.setProperty(ContainerSetDataPacket.BREWING_STAND_FUEL_TOTAL);
|
||||
dataPacket.setValue(20);
|
||||
session.getUpstream().sendPacket(dataPacket);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void updateProperty(GeyserSession session, Inventory inventory, int key, int value) {
|
||||
//bedrock protocol library is currently missing property mappings for windows.
|
||||
ContainerSetDataPacket dataPacket = new ContainerSetDataPacket();
|
||||
dataPacket.setWindowId((byte) inventory.getId());
|
||||
switch (key) {
|
||||
case 0:
|
||||
dataPacket.setProperty(ContainerSetDataPacket.Property.BREWING_STAND_BREW_TIME);
|
||||
dataPacket.setProperty(ContainerSetDataPacket.BREWING_STAND_BREW_TIME);
|
||||
break;
|
||||
case 1:
|
||||
dataPacket.setProperty(ContainerSetDataPacket.Property.BREWING_STAND_FUEL_AMOUNT);
|
||||
dataPacket.setProperty(ContainerSetDataPacket.BREWING_STAND_FUEL_AMOUNT);
|
||||
break;
|
||||
default:
|
||||
return;
|
||||
}
|
||||
dataPacket.setValue((short) value);
|
||||
dataPacket.setValue(value);
|
||||
session.getUpstream().sendPacket(dataPacket);
|
||||
}
|
||||
|
||||
|
|
|
@ -25,6 +25,7 @@
|
|||
|
||||
package org.geysermc.connector.network.translators.inventory;
|
||||
|
||||
import com.github.steveice10.mc.protocol.data.game.window.WindowType;
|
||||
import com.nukkitx.protocol.bedrock.data.ContainerType;
|
||||
import com.nukkitx.protocol.bedrock.packet.ContainerSetDataPacket;
|
||||
import org.geysermc.connector.inventory.Inventory;
|
||||
|
@ -37,23 +38,25 @@ public class FurnaceInventoryTranslator extends BlockInventoryTranslator {
|
|||
|
||||
@Override
|
||||
public void updateProperty(GeyserSession session, Inventory inventory, int key, int value) {
|
||||
//bedrock protocol library is currently missing property mappings for windows. only the furnace arrow will update for now
|
||||
ContainerSetDataPacket dataPacket = new ContainerSetDataPacket();
|
||||
dataPacket.setWindowId((byte) inventory.getId());
|
||||
switch (key) {
|
||||
case 0:
|
||||
dataPacket.setProperty(ContainerSetDataPacket.Property.FURNACE_LIT_TIME);
|
||||
dataPacket.setProperty(ContainerSetDataPacket.FURNACE_LIT_TIME);
|
||||
break;
|
||||
case 1:
|
||||
dataPacket.setProperty(ContainerSetDataPacket.Property.FURNACE_LIT_DURATION);
|
||||
dataPacket.setProperty(ContainerSetDataPacket.FURNACE_LIT_DURATION);
|
||||
break;
|
||||
case 2:
|
||||
dataPacket.setProperty(ContainerSetDataPacket.Property.FURNACE_TICK_COUNT);
|
||||
dataPacket.setProperty(ContainerSetDataPacket.FURNACE_TICK_COUNT);
|
||||
if (inventory.getWindowType() == WindowType.BLAST_FURNACE || inventory.getWindowType() == WindowType.SMOKER) {
|
||||
value *= 2;
|
||||
}
|
||||
break;
|
||||
default:
|
||||
return;
|
||||
}
|
||||
dataPacket.setValue((short) value);
|
||||
dataPacket.setValue(value);
|
||||
session.getUpstream().sendPacket(dataPacket);
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in a new issue