tiny cleanup for WaterLoggableDoorBlock

This commit is contained in:
CreepyCre 2021-04-17 03:59:31 +02:00
parent 1135a8188a
commit 3e87d79b09
2 changed files with 3 additions and 11 deletions

View file

@ -76,10 +76,7 @@ public class WaterLoggableDoorBlock extends DoorBlock implements Waterloggable {
}
BlockState newState = super.getStateForNeighborUpdate(state, direction, neighborState, world, pos, neighborPos);
if (state.getFluidState().getFluid() == Fluids.WATER) {
if (newState.isAir()) return Blocks.WATER.getDefaultState();
if (newState.getProperties().contains(WATERLOGGED)) return newState.with(WATERLOGGED, true);
}
if (newState.isAir() && state.getFluidState().getFluid() == Fluids.WATER) return Blocks.WATER.getDefaultState();
return newState;
}

View file

@ -2,6 +2,7 @@ package org.dimdev.dimdoors.item;
import java.util.function.Consumer;
import net.minecraft.item.BlockItem;
import org.dimdev.dimdoors.DimensionalDoorsInitializer;
import org.dimdev.dimdoors.block.ModBlocks;
import org.dimdev.dimdoors.block.RiftProvider;
@ -13,13 +14,12 @@ import net.minecraft.block.Block;
import net.minecraft.block.BlockState;
import net.minecraft.item.Item;
import net.minecraft.item.ItemPlacementContext;
import net.minecraft.item.TallBlockItem;
import net.minecraft.text.TranslatableText;
import net.minecraft.util.ActionResult;
import net.minecraft.util.math.BlockPos;
import net.minecraft.world.World;
public class DimensionalDoorItem extends TallBlockItem {
public class DimensionalDoorItem extends BlockItem {
private final Consumer<? super EntranceRiftBlockEntity> setupFunction;
public DimensionalDoorItem(Block block, Item.Settings settings, Consumer<? super EntranceRiftBlockEntity> setupFunction) {
@ -88,11 +88,6 @@ public class DimensionalDoorItem extends TallBlockItem {
return result;
}
@Override
protected boolean place(ItemPlacementContext context, BlockState state) {
return context.getWorld().setBlockState(context.getBlockPos(), state, 11);
}
public static boolean isRiftNear(World world, BlockPos pos) {
for (int x = pos.getX() - 5; x < pos.getX() + 5; x++) {
for (int y = pos.getY() - 5; y < pos.getY() + 5; y++) {