mirror of
https://github.com/Ellpeck/ActuallyAdditions.git
synced 2024-12-22 19:39:24 +01:00
Fix placer not working
This commit is contained in:
parent
8e06e4bcb0
commit
a117dd5340
2 changed files with 16 additions and 10 deletions
|
@ -78,16 +78,20 @@ public class TileEntityBreaker extends TileEntityInventoryBase implements MenuPr
|
|||
public static <T extends BlockEntity> void serverTick(Level level, BlockPos pos, BlockState state, T t) {
|
||||
if (t instanceof TileEntityBreaker tile) {
|
||||
tile.serverTick();
|
||||
}
|
||||
}
|
||||
|
||||
if (!tile.isRedstonePowered && !tile.isPulseMode) {
|
||||
if (tile.currentTime > 0) {
|
||||
tile.currentTime--;
|
||||
if (tile.currentTime <= 0) {
|
||||
tile.doWork();
|
||||
}
|
||||
} else {
|
||||
tile.currentTime = 15;
|
||||
@Override
|
||||
protected void serverTick() {
|
||||
super.serverTick();
|
||||
if (!isRedstonePowered && !isPulseMode) {
|
||||
if (currentTime > 0) {
|
||||
currentTime--;
|
||||
if (currentTime <= 0) {
|
||||
doWork();
|
||||
}
|
||||
} else {
|
||||
currentTime = 15;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -23,6 +23,7 @@ import net.minecraft.world.entity.item.ItemEntity;
|
|||
import net.minecraft.world.entity.player.Player;
|
||||
import net.minecraft.world.item.ItemStack;
|
||||
import net.minecraft.world.item.Items;
|
||||
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;
|
||||
|
@ -165,8 +166,9 @@ public final class WorldUtil {
|
|||
if (level instanceof ServerLevel && StackUtil.isValid(stack) && pos != null) {
|
||||
BlockPos offsetPos = pos.relative(side);
|
||||
BlockState state = level.getBlockState(offsetPos);
|
||||
Block block = state.getBlock();
|
||||
boolean replaceable = false; //= block.canBeReplaced(world, offsetPos); //TODO
|
||||
boolean replaceable = state.canBeReplaced(new BlockPlaceContext(level, null, InteractionHand.MAIN_HAND, stack,
|
||||
new BlockHitResult(new Vec3(0, 0, 0), side, pos, false)
|
||||
));
|
||||
|
||||
//Redstone
|
||||
if (replaceable && stack.getItem() == Items.REDSTONE) {
|
||||
|
|
Loading…
Reference in a new issue