From 3b948612c719fdcb79a2e06580efb836c00420aa Mon Sep 17 00:00:00 2001 From: ThetaDev Date: Thu, 1 Jun 2023 13:52:40 +0200 Subject: [PATCH] fix: #76 Logic Issue with Placement --- gradle.properties | 2 +- .../constructionwand/wand/undo/PlaceSnapshot.java | 8 +------- 2 files changed, 2 insertions(+), 8 deletions(-) diff --git a/gradle.properties b/gradle.properties index 93053cb..60e1417 100644 --- a/gradle.properties +++ b/gradle.properties @@ -14,4 +14,4 @@ botania=1.16-398 jei_version=jei-1.16.1:7.0.1.10 version_major=2 -version_minor=5 \ No newline at end of file +version_minor=11 \ No newline at end of file diff --git a/src/main/java/thetadev/constructionwand/wand/undo/PlaceSnapshot.java b/src/main/java/thetadev/constructionwand/wand/undo/PlaceSnapshot.java index 63fae19..a01e851 100644 --- a/src/main/java/thetadev/constructionwand/wand/undo/PlaceSnapshot.java +++ b/src/main/java/thetadev/constructionwand/wand/undo/PlaceSnapshot.java @@ -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; @@ -100,7 +98,7 @@ 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; @@ -108,10 +106,6 @@ private static BlockState getPlaceBlockstate(World world, PlayerEntity player, B // 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)