Skip to content

Commit

Permalink
Some additional solid checks (#713)
Browse files Browse the repository at this point in the history
Check if not replaceable/no collision for solidness too
  • Loading branch information
Raycoms authored Dec 8, 2024
1 parent e077e0c commit 6abb52d
Show file tree
Hide file tree
Showing 3 changed files with 9 additions and 2 deletions.
2 changes: 1 addition & 1 deletion gradle.properties
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ javaVersion=21
useJavaToolChains=true

#The currently running forge.
forgeVersion=21.1.72
forgeVersion=21.1.84

fmlRange=[4,)
forgeRange=[21.0.143,)
Expand Down
7 changes: 6 additions & 1 deletion src/main/java/com/ldtteam/structurize/util/BlockUtils.java
Original file line number Diff line number Diff line change
Expand Up @@ -110,7 +110,7 @@ public static void checkOrInit()
{
BuiltInRegistries.BLOCK.stream()
.filter(BlockUtils::canBlockSurviveWithoutSupport)
.filter(block -> !block.defaultBlockState().isAir() && !(block instanceof LiquidBlock) && !block.builtInRegistryHolder().is(ModTags.WEAK_SOLID_BLOCKS))
.filter(block -> !block.defaultBlockState().canBeReplaced() && block.hasCollision && !block.defaultBlockState().isAir() && !(block instanceof LiquidBlock) && !block.builtInRegistryHolder().is(ModTags.WEAK_SOLID_BLOCKS))
.forEach(trueSolidBlocks::add);
}
}
Expand Down Expand Up @@ -802,6 +802,11 @@ public static boolean isWeakSolidBlock(final BlockState blockState)
return blockState.isRandomlyTicking();
}

if (blockState.canBeReplaced() || !blockState.getBlock().hasCollision)
{
return false;
}

final Block block = blockState.getBlock();
return block.builtInRegistryHolder().is(ModTags.WEAK_SOLID_BLOCKS) && canBlockSurviveWithoutSupport(block);
}
Expand Down
2 changes: 2 additions & 0 deletions src/main/resources/META-INF/accesstransformer.cfg
Original file line number Diff line number Diff line change
Expand Up @@ -25,3 +25,5 @@ public net.minecraft.client.KeyMapping clickCount
# itemHandler
public net.minecraft.world.entity.decoration.GlowItemFrame getFrameItemStack()Lnet/minecraft/world/item/ItemStack;
public net.minecraft.world.entity.decoration.ItemFrame getFrameItemStack()Lnet/minecraft/world/item/ItemStack;

public net.minecraft.world.level.block.state.BlockBehaviour hasCollision # hasCollision

0 comments on commit 6abb52d

Please sign in to comment.