Skip to content

Commit

Permalink
fix: #76 Logic Issue with Placement
Browse files Browse the repository at this point in the history
  • Loading branch information
Theta-Dev committed Jun 1, 2023
1 parent 58f136b commit f82f968
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 9 deletions.
2 changes: 1 addition & 1 deletion gradle.properties
Original file line number Diff line number Diff line change
Expand Up @@ -15,4 +15,4 @@ botania=1.19.2-437-FORGE
jei_version=12.2.0.16

version_major=2
version_minor=10
version_minor=11
Original file line number Diff line number Diff line change
Expand Up @@ -6,8 +6,6 @@
import net.minecraft.world.item.ItemStack;
import net.minecraft.world.item.context.BlockPlaceContext;
import net.minecraft.world.level.Level;
import net.minecraft.world.level.block.Block;
import net.minecraft.world.level.block.Blocks;
import net.minecraft.world.level.block.state.BlockState;
import net.minecraft.world.level.block.state.properties.BlockStateProperties;
import net.minecraft.world.level.block.state.properties.Property;
Expand Down Expand Up @@ -100,19 +98,14 @@ private static BlockState getPlaceBlockstate(Level world, Player player, BlockHi

// Can block be placed?
BlockState blockState = item.getBlock().getStateForPlacement(ctx);
if(blockState == null) return null;
if(blockState == null || !blockState.canSurvive(world, pos)) return null;

// Forbidden Tile Entity?
if(!WandUtil.isTEAllowed(blockState)) return null;

// No entities colliding?
if(WandUtil.entitiesCollidingWithBlock(world, blockState, pos)) return null;

// Adjust blockstate to neighbors
// TODO: verify that
blockState = Block.updateFromNeighbourShapes(blockState, world, pos);
if(blockState.getBlock() == Blocks.AIR || !blockState.canSurvive(world, pos)) return null;

// Copy block properties from supporting block
if(targetMode && supportingBlock != null) {
// Block properties to be copied (alignment/rotation properties)
Expand Down

0 comments on commit f82f968

Please sign in to comment.