Fixed playerWillDestroy
signature
This commit is contained in:
parent
554b1b7d6c
commit
9a758565d7
3 changed files with 12 additions and 6 deletions
|
@ -29,6 +29,8 @@ import net.fabricmc.api.EnvType;
|
||||||
import net.fabricmc.api.Environment;
|
import net.fabricmc.api.Environment;
|
||||||
import net.fabricmc.fabric.api.object.builder.v1.block.FabricBlockSettings;
|
import net.fabricmc.fabric.api.object.builder.v1.block.FabricBlockSettings;
|
||||||
|
|
||||||
|
import org.jetbrains.annotations.NotNull;
|
||||||
|
|
||||||
@SuppressWarnings("deprecation")
|
@SuppressWarnings("deprecation")
|
||||||
public class MengerSpongeWetBlock extends BaseBlockNotFull implements RenderLayerProvider {
|
public class MengerSpongeWetBlock extends BaseBlockNotFull implements RenderLayerProvider {
|
||||||
public MengerSpongeWetBlock() {
|
public MengerSpongeWetBlock() {
|
||||||
|
@ -91,7 +93,7 @@ public class MengerSpongeWetBlock extends BaseBlockNotFull implements RenderLaye
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void playerWillDestroy(Level world, BlockPos pos, BlockState state, Player player) {
|
public @NotNull BlockState playerWillDestroy(Level world, BlockPos pos, BlockState state, Player player) {
|
||||||
BlocksHelper.setWithUpdate(world, pos, Blocks.AIR);
|
BlocksHelper.setWithUpdate(world, pos, Blocks.AIR);
|
||||||
if (!world.isClientSide()) {
|
if (!world.isClientSide()) {
|
||||||
world.levelEvent(2001, pos, getId(state));
|
world.levelEvent(2001, pos, getId(state));
|
||||||
|
@ -106,6 +108,8 @@ public class MengerSpongeWetBlock extends BaseBlockNotFull implements RenderLaye
|
||||||
);
|
);
|
||||||
world.addFreshEntity(drop);
|
world.addFreshEntity(drop);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
return state;
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
|
|
@ -46,6 +46,7 @@ import net.fabricmc.fabric.api.object.builder.v1.block.FabricBlockSettings;
|
||||||
import com.google.common.collect.Lists;
|
import com.google.common.collect.Lists;
|
||||||
|
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
|
import org.jetbrains.annotations.NotNull;
|
||||||
import org.jetbrains.annotations.Nullable;
|
import org.jetbrains.annotations.Nullable;
|
||||||
|
|
||||||
public class RespawnObeliskBlock extends BaseBlock.Stone implements CustomColorProvider, RenderLayerProvider {
|
public class RespawnObeliskBlock extends BaseBlock.Stone implements CustomColorProvider, RenderLayerProvider {
|
||||||
|
@ -75,7 +76,7 @@ public class RespawnObeliskBlock extends BaseBlock.Stone implements CustomColorP
|
||||||
@SuppressWarnings("deprecation")
|
@SuppressWarnings("deprecation")
|
||||||
public boolean canSurvive(BlockState state, LevelReader world, BlockPos pos) {
|
public boolean canSurvive(BlockState state, LevelReader world, BlockPos pos) {
|
||||||
for (int i = 0; i < 3; i++) {
|
for (int i = 0; i < 3; i++) {
|
||||||
if (!world.getBlockState(pos.above(i)).canBeReplaced()){
|
if (!world.getBlockState(pos.above(i)).canBeReplaced()) {
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -129,7 +130,7 @@ public class RespawnObeliskBlock extends BaseBlock.Stone implements CustomColorP
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void playerWillDestroy(Level world, BlockPos pos, BlockState state, Player player) {
|
public @NotNull BlockState playerWillDestroy(Level world, BlockPos pos, BlockState state, Player player) {
|
||||||
if (player.isCreative()) {
|
if (player.isCreative()) {
|
||||||
TripleShape shape = state.getValue(SHAPE);
|
TripleShape shape = state.getValue(SHAPE);
|
||||||
if (shape == TripleShape.MIDDLE) {
|
if (shape == TripleShape.MIDDLE) {
|
||||||
|
@ -138,7 +139,7 @@ public class RespawnObeliskBlock extends BaseBlock.Stone implements CustomColorP
|
||||||
BlocksHelper.setWithUpdate(world, pos.below(2), Blocks.AIR);
|
BlocksHelper.setWithUpdate(world, pos.below(2), Blocks.AIR);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
super.playerWillDestroy(world, pos, state, player);
|
return super.playerWillDestroy(world, pos, state, player);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
|
|
@ -45,6 +45,7 @@ import net.fabricmc.fabric.api.object.builder.v1.block.FabricBlockSettings;
|
||||||
|
|
||||||
import java.util.Collections;
|
import java.util.Collections;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
|
import org.jetbrains.annotations.NotNull;
|
||||||
|
|
||||||
public class SilkMothNestBlock extends BaseBlock implements RenderLayerProvider, AddMineableShears {
|
public class SilkMothNestBlock extends BaseBlock implements RenderLayerProvider, AddMineableShears {
|
||||||
public static final BooleanProperty ACTIVE = EndBlockProperties.ACTIVE;
|
public static final BooleanProperty ACTIVE = EndBlockProperties.ACTIVE;
|
||||||
|
@ -124,7 +125,7 @@ public class SilkMothNestBlock extends BaseBlock implements RenderLayerProvider,
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void playerWillDestroy(Level world, BlockPos pos, BlockState state, Player player) {
|
public @NotNull BlockState playerWillDestroy(Level world, BlockPos pos, BlockState state, Player player) {
|
||||||
if (!state.getValue(ACTIVE) && player.isCreative()) {
|
if (!state.getValue(ACTIVE) && player.isCreative()) {
|
||||||
BlocksHelper.setWithUpdate(world, pos.below(), Blocks.AIR);
|
BlocksHelper.setWithUpdate(world, pos.below(), Blocks.AIR);
|
||||||
}
|
}
|
||||||
|
@ -132,7 +133,7 @@ public class SilkMothNestBlock extends BaseBlock implements RenderLayerProvider,
|
||||||
if (up.is(this) && !up.getValue(ACTIVE)) {
|
if (up.is(this) && !up.getValue(ACTIVE)) {
|
||||||
BlocksHelper.setWithUpdate(world, pos.above(), Blocks.AIR);
|
BlocksHelper.setWithUpdate(world, pos.above(), Blocks.AIR);
|
||||||
}
|
}
|
||||||
super.playerWillDestroy(world, pos, state, player);
|
return super.playerWillDestroy(world, pos, state, player);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue