mirror of
https://github.com/GeyserMC/Geyser.git
synced 2025-12-24 01:09:30 +00:00
Fix non-vanilla block breaking (#5575)
* Keep track of non-vanilla block break. * Just use simple BitSet registry.
This commit is contained in:
@@ -82,6 +82,11 @@ public class BlockRegistries {
|
||||
*/
|
||||
public static final MappedRegistry<String, Integer, Object2IntMap<String>> JAVA_IDENTIFIER_TO_ID = MappedRegistry.create(RegistryLoaders.empty(Object2IntOpenHashMap::new));
|
||||
|
||||
/**
|
||||
* A registry containing non-vanilla block IDS.
|
||||
*/
|
||||
public static final SimpleRegistry<BitSet> NON_VANILLA_BLOCK_IDS = SimpleRegistry.create(RegistryLoaders.empty(BitSet::new));
|
||||
|
||||
/**
|
||||
* A registry containing all the waterlogged blockstates.
|
||||
* Properties.WATERLOGGED should not be relied on for two reasons:
|
||||
|
||||
@@ -303,6 +303,7 @@ public class CustomBlockRegistryPopulator {
|
||||
|
||||
BlockRegistries.JAVA_BLOCKS.registerWithAnyIndex(javaBlockState.stateGroupId(), block, Blocks.AIR);
|
||||
BlockRegistries.JAVA_IDENTIFIER_TO_ID.register(javaId, stateRuntimeId);
|
||||
BlockRegistries.NON_VANILLA_BLOCK_IDS.register(set -> set.set(stateRuntimeId));
|
||||
|
||||
// TODO register different collision types?
|
||||
BoundingBox[] geyserCollisions = Arrays.stream(javaBlockState.collision())
|
||||
|
||||
@@ -33,6 +33,7 @@ import org.cloudburstmc.protocol.bedrock.data.PlayerBlockActionData;
|
||||
import org.cloudburstmc.protocol.bedrock.data.definitions.ItemDefinition;
|
||||
import org.cloudburstmc.protocol.bedrock.packet.LevelEventPacket;
|
||||
import org.geysermc.geyser.api.block.custom.CustomBlockState;
|
||||
import org.geysermc.geyser.api.block.custom.nonvanilla.JavaBlockState;
|
||||
import org.geysermc.geyser.entity.type.Entity;
|
||||
import org.geysermc.geyser.entity.type.ItemFrameEntity;
|
||||
import org.geysermc.geyser.inventory.GeyserItemStack;
|
||||
@@ -101,7 +102,7 @@ final class BedrockBlockActions {
|
||||
SkullCache.Skull skull = session.getSkullCache().getSkulls().get(vector);
|
||||
|
||||
session.setBlockBreakStartTime(0);
|
||||
if (blockStateOverride != null || customItem != null || (skull != null && skull.getBlockDefinition() != null)) {
|
||||
if (BlockRegistries.NON_VANILLA_BLOCK_IDS.get().get(blockState) || blockStateOverride != null || customItem != null || (skull != null && skull.getBlockDefinition() != null)) {
|
||||
session.setBlockBreakStartTime(System.currentTimeMillis());
|
||||
}
|
||||
startBreak.setData((int) (65535 / breakTime));
|
||||
|
||||
Reference in New Issue
Block a user