Skip to content

Commit ab3d4a8

Browse files
committed
fix: single mode,bt no process twice
1 parent ae261ec commit ab3d4a8

2 files changed

Lines changed: 8 additions & 5 deletions

File tree

gradle.properties

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@ show_testing_output = false
1515

1616
# Mod Information
1717
# HIGHLY RECOMMEND complying with SemVer for mod_version: https://semver.org/
18-
mod_version = 1.4.0
18+
mod_version = 1.4.1
1919
root_package =work.crash
2020
mod_id = fallingalchemy
2121
mod_name = FallingAlchemy

src/main/java/work/crash/fallingalchemy/handler/FallingBlockHandler.java

Lines changed: 7 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -35,8 +35,10 @@ public void onEntityJoinWorld(EntityJoinWorldEvent event) {
3535
if (event.getEntity() instanceof EntityFallingBlock block) {
3636
Block blockType = block.getBlock().getBlock();
3737
if (FallingAlchemyTweaker.RULES.containsKey(blockType)) {
38-
trackedBlocks.add(new WeakReference<>(block));
39-
blockPosition.put(block, block.getPosition());
38+
if (blockPosition.get(block) == null) {
39+
trackedBlocks.add(new WeakReference<>(block));
40+
blockPosition.put(block, block.getPosition());
41+
}
4042
}
4143
}
4244
}
@@ -52,8 +54,9 @@ public void onWorldTick(TickEvent.WorldTickEvent event) {
5254
if (block != null) {
5355
BlockPos pos = new BlockPos(block.posX, block.posY, block.posZ);
5456
IBlockState state = event.world.getBlockState(pos);
55-
if (state.getBlock() == block.getBlock().getBlock()) {
56-
processConversion(event.world, blockPosition.get(block), pos, state);
57+
BlockPos originPos = blockPosition.remove(block);
58+
if (originPos != null && state.getBlock() == block.getBlock().getBlock()) {
59+
processConversion(event.world, originPos, pos, state);
5760
}
5861
}
5962
iterator.remove();

0 commit comments

Comments
 (0)