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 18d9af3 commit 3b94861
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 8 deletions.
2 changes: 1 addition & 1 deletion gradle.properties
Original file line number Diff line number Diff line change
Expand Up @@ -14,4 +14,4 @@ botania=1.16-398
jei_version=jei-1.16.1:7.0.1.10

version_major=2
version_minor=5
version_minor=11
Original file line number Diff line number Diff line change
@@ -1,8 +1,6 @@
package thetadev.constructionwand.wand.undo;

import net.minecraft.block.Block;
import net.minecraft.block.BlockState;
import net.minecraft.block.Blocks;
import net.minecraft.entity.player.PlayerEntity;
import net.minecraft.item.BlockItem;
import net.minecraft.item.BlockItemUseContext;
Expand Down Expand Up @@ -100,18 +98,14 @@ private static BlockState getPlaceBlockstate(World world, PlayerEntity player, B

// Can block be placed?
BlockState blockState = item.getBlock().getStateForPlacement(ctx);
if(blockState == null) return null;
if(blockState == null || !blockState.isValidPosition(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
blockState = Block.getValidBlockForPosition(blockState, world, pos);
if(blockState.getBlock() == Blocks.AIR || !blockState.isValidPosition(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 3b94861

Please sign in to comment.