Skip to content

Commit 28b3a84

Browse files
committed
Account for non-vanilla item definitions in block breaking.
1 parent 5d419ba commit 28b3a84

File tree

3 files changed

+7
-1
lines changed

3 files changed

+7
-1
lines changed

core/src/main/java/org/geysermc/geyser/registry/populator/ItemRegistryPopulator.java

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -651,6 +651,7 @@ public static void populate() {
651651
.customItemDefinitions(null)
652652
.build();
653653

654+
final List<Integer> nonVanillaCustomItemIds = new ArrayList<>();
654655
if (customItemsAllowed) {
655656
// Add furnace minecart
656657
int furnaceMinecartId = nextFreeBedrockId++;
@@ -695,6 +696,8 @@ public static void populate() {
695696
mappings.set(javaItem.javaId(), mapping);
696697
registry.put(customItemId, mapping.getBedrockDefinition());
697698

699+
nonVanillaCustomItemIds.add(javaItem.javaId());
700+
698701
if (customItem.bedrockOptions().creativeCategory() != CreativeCategory.NONE) {
699702
CreativeItemData creativeItemData = new CreativeItemData(ItemData.builder()
700703
.definition(registration.mapping().getBedrockDefinition())
@@ -770,6 +773,7 @@ public static void populate() {
770773
.lightBlocks(lightBlocks)
771774
.lodestoneCompass(lodestoneEntry)
772775
.customIdMappings(customIdMappings)
776+
.nonVanillaCustomItemIds(nonVanillaCustomItemIds)
773777
.customBlockItemDefinitions(customBlockItemDefinitions)
774778
.build();
775779

core/src/main/java/org/geysermc/geyser/registry/type/ItemMappings.java

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -74,6 +74,8 @@ public class ItemMappings implements DefinitionRegistry<ItemDefinition> {
7474
List<ItemDefinition> boats;
7575
Int2ObjectMap<String> customIdMappings;
7676

77+
List<Integer> nonVanillaCustomItemIds;
78+
7779
Object2ObjectMap<CustomBlockData, ItemDefinition> customBlockItemDefinitions;
7880

7981
/**

core/src/main/java/org/geysermc/geyser/session/cache/BlockBreakHandler.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -323,7 +323,7 @@ protected void handleStartBreak(@NonNull Vector3i position, @NonNull BlockState
323323

324324
this.serverSideBlockBreaking = false;
325325
if (BlockRegistries.NON_VANILLA_BLOCK_IDS.get().get(state.javaId()) || blockStateOverride != null ||
326-
customItem != null || (skull != null && skull.getBlockDefinition() != null)) {
326+
customItem != null || session.getItemMappings().getNonVanillaCustomItemIds().contains(item.getJavaId()) || (skull != null && skull.getBlockDefinition() != null)) {
327327
this.serverSideBlockBreaking = true;
328328
}
329329

0 commit comments

Comments
 (0)