Skip to content

Commit

Permalink
Update Properties/Blocks, re-include neoforge, target 1.21.4 release
Browse files Browse the repository at this point in the history
  • Loading branch information
onebeastchris committed Dec 3, 2024
1 parent d114ab9 commit db246ff
Show file tree
Hide file tree
Showing 24 changed files with 94 additions and 106 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,6 @@
import org.geysermc.geyser.adapters.WorldAdapter;
import org.geysermc.geyser.adapters.paper.PaperAdapters;
import org.geysermc.geyser.adapters.spigot.SpigotAdapters;
import org.geysermc.geyser.level.block.BlockStateValues;
import org.geysermc.geyser.level.block.type.Block;
import org.geysermc.geyser.session.GeyserSession;

Expand Down
73 changes: 52 additions & 21 deletions core/src/main/java/org/geysermc/geyser/level/block/Blocks.java

Large diffs are not rendered by default.

Original file line number Diff line number Diff line change
Expand Up @@ -29,8 +29,12 @@
import org.geysermc.geyser.level.physics.Direction;

public final class Properties {
public static final BooleanProperty ACTIVE = BooleanProperty.create("active");
public static final BooleanProperty ATTACHED = BooleanProperty.create("attached");
public static final BooleanProperty BERRIES = BooleanProperty.create("berries");
public static final BooleanProperty BLOOM = BooleanProperty.create("bloom");
public static final BooleanProperty BOTTOM = BooleanProperty.create("bottom");
public static final BooleanProperty CAN_SUMMON = BooleanProperty.create("can_summon");
public static final BooleanProperty CONDITIONAL = BooleanProperty.create("conditional");
public static final BooleanProperty DISARMED = BooleanProperty.create("disarmed");
public static final BooleanProperty DRAG = BooleanProperty.create("drag");
Expand All @@ -47,22 +51,20 @@ public final class Properties {
public static final BooleanProperty INVERTED = BooleanProperty.create("inverted");
public static final BooleanProperty IN_WALL = BooleanProperty.create("in_wall");
public static final BooleanProperty LIT = BooleanProperty.create("lit");
public static final BooleanProperty TIP = BooleanProperty.create("tip");
public static final BooleanProperty LOCKED = BooleanProperty.create("locked");
public static final BooleanProperty NATURAL = BooleanProperty.create("natural");
public static final BooleanProperty OCCUPIED = BooleanProperty.create("occupied");
public static final BooleanProperty OPEN = BooleanProperty.create("open");
public static final BooleanProperty PERSISTENT = BooleanProperty.create("persistent");
public static final BooleanProperty POWERED = BooleanProperty.create("powered");
public static final BooleanProperty SHORT = BooleanProperty.create("short");
public static final BooleanProperty SHRIEKING = BooleanProperty.create("shrieking");
public static final BooleanProperty SIGNAL_FIRE = BooleanProperty.create("signal_fire");
public static final BooleanProperty SNOWY = BooleanProperty.create("snowy");
public static final BooleanProperty TIP = BooleanProperty.create("tip");
public static final BooleanProperty TRIGGERED = BooleanProperty.create("triggered");
public static final BooleanProperty UNSTABLE = BooleanProperty.create("unstable");
public static final BooleanProperty WATERLOGGED = BooleanProperty.create("waterlogged");
public static final BooleanProperty BERRIES = BooleanProperty.create("berries");
public static final BooleanProperty BLOOM = BooleanProperty.create("bloom");
public static final BooleanProperty SHRIEKING = BooleanProperty.create("shrieking");
public static final BooleanProperty CAN_SUMMON = BooleanProperty.create("can_summon");
public static final EnumProperty<Axis> HORIZONTAL_AXIS = EnumProperty.create("axis", Axis.X, Axis.Z);
public static final EnumProperty<Axis> AXIS = EnumProperty.create("axis", Axis.VALUES);
public static final BooleanProperty UP = BooleanProperty.create("up");
Expand Down Expand Up @@ -143,6 +145,5 @@ public final class Properties {
public static final BooleanProperty CRAFTING = BooleanProperty.create("crafting");
public static final BasicEnumProperty TRIAL_SPAWNER_STATE = BasicEnumProperty.create("trial_spawner_state", "inactive", "waiting_for_players", "active", "waiting_for_reward_ejection", "ejecting_reward", "cooldown");
public static final BasicEnumProperty VAULT_STATE = BasicEnumProperty.create("vault_state", "inactive", "active", "unlocking", "ejecting");
public static final BasicEnumProperty CREAKING = BasicEnumProperty.create("creaking", "disabled", "dormant", "active");
public static final BooleanProperty OMINOUS = BooleanProperty.create("ominous");
}
Original file line number Diff line number Diff line change
Expand Up @@ -73,7 +73,7 @@ protected ItemStackResponse translateSpecialRequest(GeyserSession session, Inven

@Override
public int bedrockSlotToJava(ItemStackRequestSlotData slotInfoData) {
return switch (slotInfoData.getContainer()) {
return switch (slotInfoData.getContainerName().getContainer()) {
case ANVIL_INPUT -> 0;
case ANVIL_MATERIAL -> 1;
case ANVIL_RESULT, CREATED_OUTPUT -> 2;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,7 @@ public void updateProperty(GeyserSession session, Inventory inventory, int key,
@Override
public int bedrockSlotToJava(ItemStackRequestSlotData slotInfoData) {
int slotnum = slotInfoData.getSlot();
switch (slotInfoData.getContainer()) {
switch (slotInfoData.getContainerName().getContainer()) {
case HOTBAR_AND_INVENTORY:
case HOTBAR:
case INVENTORY:
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -121,7 +121,7 @@ private OptionalInt toJava(int effectChoice) {

@Override
public int bedrockSlotToJava(ItemStackRequestSlotData slotInfoData) {
if (slotInfoData.getContainer() == ContainerSlotType.BEACON_PAYMENT) {
if (slotInfoData.getContainerName().getContainer() == ContainerSlotType.BEACON_PAYMENT) {
return 0;
}
return super.bedrockSlotToJava(slotInfoData);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -74,11 +74,11 @@ public void updateProperty(GeyserSession session, Inventory inventory, int key,

@Override
public int bedrockSlotToJava(ItemStackRequestSlotData slotInfoData) {
if (slotInfoData.getContainer() == ContainerSlotType.BREWING_INPUT) {
if (slotInfoData.getContainerName().getContainer() == ContainerSlotType.BREWING_INPUT) {
// Ingredient
return 3;
}
if (slotInfoData.getContainer() == ContainerSlotType.BREWING_RESULT) {
if (slotInfoData.getContainerName().getContainer() == ContainerSlotType.BREWING_RESULT) {
// Potions
return slotInfoData.getSlot() - 1;
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -56,7 +56,7 @@ protected boolean shouldRejectItemPlace(GeyserSession session, Inventory invento

@Override
public int bedrockSlotToJava(ItemStackRequestSlotData slotInfoData) {
return switch (slotInfoData.getContainer()) {
return switch (slotInfoData.getContainerName().getContainer()) {
case CARTOGRAPHY_INPUT -> 0;
case CARTOGRAPHY_ADDITIONAL -> 1;
case CARTOGRAPHY_RESULT, CREATED_OUTPUT -> 2;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -77,7 +77,7 @@ public void updateProperty(GeyserSession session, Inventory inventory, int key,
@Override
public int bedrockSlotToJava(ItemStackRequestSlotData slotInfoData) {
int slot = slotInfoData.getSlot();
switch (slotInfoData.getContainer()) {
switch (slotInfoData.getContainerName().getContainer()) {
case HOTBAR_AND_INVENTORY, HOTBAR, INVENTORY -> {
//hotbar
if (slot >= 9) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -64,12 +64,12 @@ public BedrockContainerSlot javaSlotToBedrockContainer(int slot) {

@Override
public int bedrockSlotToJava(ItemStackRequestSlotData slotInfoData) {
if (slotInfoData.getContainer() == ContainerSlotType.CRAFTING_INPUT) {
if (slotInfoData.getContainerName().getContainer() == ContainerSlotType.CRAFTING_INPUT) {
// Java goes from 1 - 9, left to right then up to down
// Bedrock is the same, but it starts from 32.
return slotInfoData.getSlot() - 31;
}
if (slotInfoData.getContainer() == ContainerSlotType.CRAFTING_OUTPUT || slotInfoData.getContainer() == ContainerSlotType.CREATED_OUTPUT) {
if (slotInfoData.getContainerName().getContainer() == ContainerSlotType.CRAFTING_OUTPUT || slotInfoData.getContainerName().getContainer() == ContainerSlotType.CREATED_OUTPUT) {
return 0;
}
return super.bedrockSlotToJava(slotInfoData);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -135,10 +135,10 @@ public ItemStackResponse translateSpecialRequest(GeyserSession session, Inventor

@Override
public int bedrockSlotToJava(ItemStackRequestSlotData slotInfoData) {
if (slotInfoData.getContainer() == ContainerSlotType.ENCHANTING_INPUT) {
if (slotInfoData.getContainerName().getContainer() == ContainerSlotType.ENCHANTING_INPUT) {
return 0;
}
if (slotInfoData.getContainer() == ContainerSlotType.ENCHANTING_MATERIAL) {
if (slotInfoData.getContainerName().getContainer() == ContainerSlotType.ENCHANTING_MATERIAL) {
return 1;
}
return super.bedrockSlotToJava(slotInfoData);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,7 @@ public GrindstoneInventoryTranslator() {

@Override
public int bedrockSlotToJava(ItemStackRequestSlotData slotInfoData) {
return switch (slotInfoData.getContainer()) {
return switch (slotInfoData.getContainerName().getContainer()) {
case GRINDSTONE_INPUT -> 0;
case GRINDSTONE_ADDITIONAL -> 1;
case GRINDSTONE_RESULT, CREATED_OUTPUT -> 2;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -169,7 +169,7 @@ public ItemStackResponse translateSpecialRequest(GeyserSession session, Inventor

@Override
public int bedrockSlotToJava(ItemStackRequestSlotData slotInfoData) {
return switch (slotInfoData.getContainer()) {
return switch (slotInfoData.getContainerName().getContainer()) {
case LOOM_INPUT -> 0;
case LOOM_DYE -> 1;
case LOOM_MATERIAL -> 2;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -77,7 +77,7 @@ public BedrockContainerSlot javaSlotToBedrockContainer(int slot) {

@Override
public int bedrockSlotToJava(ItemStackRequestSlotData slotInfoData) {
return switch (slotInfoData.getContainer()) {
return switch (slotInfoData.getContainerName().getContainer()) {
case TRADE2_INGREDIENT_1 -> 0;
case TRADE2_INGREDIENT_2 -> 1;
case TRADE2_RESULT, CREATED_OUTPUT -> 2;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -63,7 +63,7 @@ private OldSmithingTableTranslator() {

@Override
public int bedrockSlotToJava(ItemStackRequestSlotData slotInfoData) {
return switch (slotInfoData.getContainer()) {
return switch (slotInfoData.getContainerName().getContainer()) {
case SMITHING_TABLE_INPUT -> 0;
case SMITHING_TABLE_MATERIAL -> 1;
case SMITHING_TABLE_RESULT, CREATED_OUTPUT -> 2;
Expand Down Expand Up @@ -130,7 +130,7 @@ protected ItemStackResponse translateSpecialRequest(GeyserSession session, Inven
}

private boolean isInvalidAction(ItemStackRequestSlotData slotData) {
return slotData.getContainer().equals(ContainerSlotType.SMITHING_TABLE_TEMPLATE);
return slotData.getContainerName().getContainer().equals(ContainerSlotType.SMITHING_TABLE_TEMPLATE);
}

@Override
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -184,7 +184,7 @@ public void updateSlot(GeyserSession session, Inventory inventory, int slot) {
@Override
public int bedrockSlotToJava(ItemStackRequestSlotData slotInfoData) {
int slotnum = slotInfoData.getSlot();
switch (slotInfoData.getContainer()) {
switch (slotInfoData.getContainerName().getContainer()) {
case HOTBAR_AND_INVENTORY:
case HOTBAR:
case INVENTORY:
Expand Down Expand Up @@ -462,7 +462,7 @@ protected ItemStackResponse translateCreativeRequest(GeyserSession session, Inve
}
craftState = CraftState.TRANSFER;

if (transferAction.getSource().getContainer() != ContainerSlotType.CREATED_OUTPUT) {
if (transferAction.getSource().getContainerName().getContainer() != ContainerSlotType.CREATED_OUTPUT) {
return rejectRequest(request);
}

Expand Down Expand Up @@ -495,7 +495,7 @@ protected ItemStackResponse translateCreativeRequest(GeyserSession session, Inve
}

DropAction dropAction = (DropAction) action;
if (dropAction.getSource().getContainer() != ContainerSlotType.CREATED_OUTPUT || dropAction.getSource().getSlot() != 50) {
if (dropAction.getSource().getContainerName().getContainer() != ContainerSlotType.CREATED_OUTPUT || dropAction.getSource().getSlot() != 50) {
return rejectRequest(request);
}

Expand Down Expand Up @@ -532,7 +532,7 @@ private static void sendCreativeAction(GeyserSession session, Inventory inventor
}

private static boolean isCraftingGrid(ItemStackRequestSlotData slotInfoData) {
return slotInfoData.getContainer() == ContainerSlotType.CRAFTING_INPUT;
return slotInfoData.getContainerName().getContainer() == ContainerSlotType.CRAFTING_INPUT;
}

@Override
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,7 @@ public SmithingInventoryTranslator() {

@Override
public int bedrockSlotToJava(ItemStackRequestSlotData slotInfoData) {
return switch (slotInfoData.getContainer()) {
return switch (slotInfoData.getContainerName().getContainer()) {
case SMITHING_TABLE_TEMPLATE -> TEMPLATE;
case SMITHING_TABLE_INPUT -> INPUT;
case SMITHING_TABLE_MATERIAL -> MATERIAL;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -84,7 +84,7 @@ protected ItemStackResponse translateSpecialRequest(GeyserSession session, Inven

@Override
public int bedrockSlotToJava(ItemStackRequestSlotData slotInfoData) {
return switch (slotInfoData.getContainer()) {
return switch (slotInfoData.getContainerName().getContainer()) {
case STONECUTTER_INPUT -> 0;
case STONECUTTER_RESULT, CREATED_OUTPUT -> 1;
default -> super.bedrockSlotToJava(slotInfoData);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -53,10 +53,10 @@ public ChestedHorseInventoryTranslator(int size, int equipSlot) {

@Override
public int bedrockSlotToJava(ItemStackRequestSlotData slotInfoData) {
if (slotInfoData.getContainer() == ContainerSlotType.HORSE_EQUIP) {
if (slotInfoData.getContainerName().getContainer() == ContainerSlotType.HORSE_EQUIP) {
return this.equipSlot;
}
if (slotInfoData.getContainer() == ContainerSlotType.LEVEL_ENTITY) {
if (slotInfoData.getContainerName().getContainer() == ContainerSlotType.LEVEL_ENTITY) {
return slotInfoData.getSlot() + 1;
}
return super.bedrockSlotToJava(slotInfoData);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,7 @@ public HorseInventoryTranslator(int size) {

@Override
public int bedrockSlotToJava(ItemStackRequestSlotData slotInfoData) {
if (slotInfoData.getContainer() == ContainerSlotType.HORSE_EQUIP) {
if (slotInfoData.getContainerName().getContainer() == ContainerSlotType.HORSE_EQUIP) {
return slotInfoData.getSlot();
}
return super.bedrockSlotToJava(slotInfoData);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -28,13 +28,15 @@
import org.geysermc.geyser.entity.type.Entity;
import org.geysermc.geyser.entity.type.LivingEntity;
import org.geysermc.geyser.entity.type.player.PlayerEntity;
import org.geysermc.geyser.inventory.GeyserItemStack;
import org.geysermc.geyser.item.Items;
import org.geysermc.geyser.session.GeyserSession;
import org.geysermc.geyser.skin.FakeHeadProvider;
import org.geysermc.geyser.translator.protocol.PacketTranslator;
import org.geysermc.geyser.translator.protocol.Translator;
import org.geysermc.mcprotocollib.protocol.data.game.entity.metadata.Equipment;
import org.geysermc.mcprotocollib.protocol.data.game.item.ItemStack;
import org.geysermc.mcprotocollib.protocol.data.game.item.component.DataComponentType;
import org.geysermc.mcprotocollib.protocol.packet.ingame.clientbound.entity.ClientboundSetEquipmentPacket;

@Translator(packet = ClientboundSetEquipmentPacket.class)
Expand Down Expand Up @@ -64,7 +66,7 @@ public void translate(GeyserSession session, ClientboundSetEquipmentPacket packe
&& javaItem != null
&& javaItem.getId() == Items.PLAYER_HEAD.javaId()
&& javaItem.getDataComponents() != null) {
FakeHeadProvider.setHead(session, (PlayerEntity) livingEntity, javaItem.getDataComponents());
FakeHeadProvider.setHead(session, (PlayerEntity) livingEntity, GeyserItemStack.from(javaItem).getComponent(DataComponentType.PROFILE));
} else {
FakeHeadProvider.restoreOriginalSkin(session, livingEntity);
}
Expand Down
Loading

0 comments on commit db246ff

Please sign in to comment.