mirror of
https://github.com/Creators-of-Create/Create.git
synced 2025-02-27 20:34:43 +01:00
Fix Copycat step placement helper (#6267)
This commit is contained in:
parent
41f957a94d
commit
51db53c74f
1 changed files with 17 additions and 2 deletions
|
@ -4,8 +4,10 @@ import java.util.function.Predicate;
|
||||||
|
|
||||||
import com.simibubi.create.AllBlocks;
|
import com.simibubi.create.AllBlocks;
|
||||||
import com.simibubi.create.AllShapes;
|
import com.simibubi.create.AllShapes;
|
||||||
|
import com.simibubi.create.content.kinetics.steamEngine.PoweredShaftBlock;
|
||||||
import com.simibubi.create.foundation.placement.IPlacementHelper;
|
import com.simibubi.create.foundation.placement.IPlacementHelper;
|
||||||
import com.simibubi.create.foundation.placement.PlacementHelpers;
|
import com.simibubi.create.foundation.placement.PlacementHelpers;
|
||||||
|
import com.simibubi.create.foundation.placement.PlacementOffset;
|
||||||
import com.simibubi.create.foundation.placement.PoleHelper;
|
import com.simibubi.create.foundation.placement.PoleHelper;
|
||||||
import com.simibubi.create.foundation.utility.Iterate;
|
import com.simibubi.create.foundation.utility.Iterate;
|
||||||
import com.simibubi.create.foundation.utility.VoxelShaper;
|
import com.simibubi.create.foundation.utility.VoxelShaper;
|
||||||
|
@ -36,6 +38,8 @@ import net.minecraft.world.phys.BlockHitResult;
|
||||||
import net.minecraft.world.phys.shapes.CollisionContext;
|
import net.minecraft.world.phys.shapes.CollisionContext;
|
||||||
import net.minecraft.world.phys.shapes.VoxelShape;
|
import net.minecraft.world.phys.shapes.VoxelShape;
|
||||||
|
|
||||||
|
import org.jetbrains.annotations.NotNull;
|
||||||
|
|
||||||
public class CopycatStepBlock extends WaterloggedCopycatBlock {
|
public class CopycatStepBlock extends WaterloggedCopycatBlock {
|
||||||
|
|
||||||
public static final EnumProperty<Half> HALF = BlockStateProperties.HALF;
|
public static final EnumProperty<Half> HALF = BlockStateProperties.HALF;
|
||||||
|
@ -134,7 +138,7 @@ public class CopycatStepBlock extends WaterloggedCopycatBlock {
|
||||||
return (state.getValue(HALF) == Half.TOP) == (face == Direction.UP);
|
return (state.getValue(HALF) == Half.TOP) == (face == Direction.UP);
|
||||||
return state.getValue(FACING) == face;
|
return state.getValue(FACING) == face;
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public boolean shouldFaceAlwaysRender(BlockState state, Direction face) {
|
public boolean shouldFaceAlwaysRender(BlockState state, Direction face) {
|
||||||
return canFaceBeOccluded(state, face.getOpposite());
|
return canFaceBeOccluded(state, face.getOpposite());
|
||||||
|
@ -222,10 +226,21 @@ public class CopycatStepBlock extends WaterloggedCopycatBlock {
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public Predicate<ItemStack> getItemPredicate() {
|
public @NotNull Predicate<ItemStack> getItemPredicate() {
|
||||||
return AllBlocks.COPYCAT_STEP::isIn;
|
return AllBlocks.COPYCAT_STEP::isIn;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public @NotNull PlacementOffset getOffset(Player player, Level world, BlockState state, BlockPos pos,
|
||||||
|
BlockHitResult ray) {
|
||||||
|
PlacementOffset offset = super.getOffset(player, world, state, pos, ray);
|
||||||
|
|
||||||
|
if (offset.isSuccessful())
|
||||||
|
offset.withTransform(offset.getTransform()
|
||||||
|
.andThen(s -> s.setValue(HALF, state.getValue(HALF))));
|
||||||
|
|
||||||
|
return offset;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
Loading…
Add table
Reference in a new issue