Fix auto coil placement in some cases
This commit is contained in:
parent
57c8ebdb3d
commit
0cf6d7e888
1 changed files with 3 additions and 1 deletions
|
@ -28,6 +28,8 @@ import net.minecraft.block.BlockState;
|
||||||
import net.minecraft.block.entity.BlockEntity;
|
import net.minecraft.block.entity.BlockEntity;
|
||||||
import net.minecraft.entity.Entity;
|
import net.minecraft.entity.Entity;
|
||||||
import net.minecraft.entity.player.PlayerEntity;
|
import net.minecraft.entity.player.PlayerEntity;
|
||||||
|
import net.minecraft.item.ItemPlacementContext;
|
||||||
|
import net.minecraft.item.ItemUsageContext;
|
||||||
import net.minecraft.util.ActionResult;
|
import net.minecraft.util.ActionResult;
|
||||||
import net.minecraft.util.Hand;
|
import net.minecraft.util.Hand;
|
||||||
import net.minecraft.util.hit.BlockHitResult;
|
import net.minecraft.util.hit.BlockHitResult;
|
||||||
|
@ -57,7 +59,7 @@ public class BlockFusionControlComputer extends BlockMachineBase {
|
||||||
if(playerIn.getStackInHand(hand).isEmpty()){
|
if(playerIn.getStackInHand(hand).isEmpty()){
|
||||||
return ActionResult.SUCCESS;
|
return ActionResult.SUCCESS;
|
||||||
}
|
}
|
||||||
if(worldIn.isAir(coil) && !blockEntityFusionControlComputer.isCoil(coil)){
|
if(worldIn.getBlockState(coil).canReplace(new ItemPlacementContext(new ItemUsageContext(playerIn, hand, hitResult))) && !blockEntityFusionControlComputer.isCoil(coil)){
|
||||||
worldIn.setBlockState(coil, TRContent.Machine.FUSION_COIL.block.getDefaultState());
|
worldIn.setBlockState(coil, TRContent.Machine.FUSION_COIL.block.getDefaultState());
|
||||||
if(!playerIn.isCreative()){
|
if(!playerIn.isCreative()){
|
||||||
playerIn.getStackInHand(hand).decrement(1);
|
playerIn.getStackInHand(hand).decrement(1);
|
||||||
|
|
Loading…
Add table
Reference in a new issue