Skip to content

Commit

Permalink
Merge branch '1.14' of github.com:itsmeow/betteranimalsplus into 1.14
Browse files Browse the repository at this point in the history
  • Loading branch information
itsmeow committed Nov 22, 2019
2 parents 2c7208d + ec3b6ea commit cce511d
Show file tree
Hide file tree
Showing 2 changed files with 24 additions and 6 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -10,10 +10,14 @@
import net.minecraft.block.BlockState;
import net.minecraft.block.ContainerBlock;
import net.minecraft.block.SoundType;
import net.minecraft.block.IWaterLoggable;
import net.minecraft.block.material.Material;
import net.minecraft.fluid.Fluids;
import net.minecraft.fluid.IFluidState;
import net.minecraft.item.BlockItemUseContext;
import net.minecraft.state.DirectionProperty;
import net.minecraft.state.StateContainer;
import net.minecraft.state.properties.BlockStateProperties;
import net.minecraft.tileentity.TileEntity;
import net.minecraft.util.Direction;
import net.minecraft.util.Mirror;
Expand All @@ -25,7 +29,7 @@
import net.minecraftforge.api.distmarker.Dist;
import net.minecraftforge.api.distmarker.OnlyIn;

public class BlockAnimalSkull extends ContainerBlock {
public class BlockAnimalSkull extends ContainerBlock implements IWaterLoggable {

public static final DirectionProperty FACING_EXCEPT_DOWN = DirectionProperty.create("facing", Direction.NORTH, Direction.EAST, Direction.SOUTH, Direction.WEST, Direction.UP);
private static final Map<Direction, VoxelShape> SHAPES = Maps
Expand All @@ -38,7 +42,7 @@ public class BlockAnimalSkull extends ContainerBlock {

public BlockAnimalSkull() {
super(Block.Properties.create(Material.WOOL).sound(SoundType.STONE).hardnessAndResistance(0.8F));
this.setDefaultState(this.stateContainer.getBaseState().with(FACING_EXCEPT_DOWN, Direction.NORTH));
this.setDefaultState(this.stateContainer.getBaseState().with(FACING_EXCEPT_DOWN, Direction.NORTH).with(BlockStateProperties.WATERLOGGED, false));
}

@Override
Expand Down Expand Up @@ -94,9 +98,14 @@ public BlockState getStateForPlacement(BlockItemUseContext context) {
return null;
}

@Override
public IFluidState getFluidState(BlockState state) {
return state.get(BlockStateProperties.WATERLOGGED) ? Fluids.WATER.getStillFluidState(false) : super.getFluidState(state);
}

@Override
protected void fillStateContainer(StateContainer.Builder<Block, BlockState> builder) {
builder.add(FACING_EXCEPT_DOWN);
builder.add(FACING_EXCEPT_DOWN, BlockStateProperties.WATERLOGGED);
}

@Override
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,12 +7,16 @@
import net.minecraft.block.BlockState;
import net.minecraft.block.Blocks;
import net.minecraft.block.HorizontalBlock;
import net.minecraft.block.IWaterLoggable;
import net.minecraft.block.material.Material;
import net.minecraft.entity.player.PlayerEntity;
import net.minecraft.fluid.Fluids;
import net.minecraft.fluid.IFluidState;
import net.minecraft.item.BlockItemUseContext;
import net.minecraft.item.ItemStack;
import net.minecraft.item.Items;
import net.minecraft.state.StateContainer.Builder;
import net.minecraft.state.properties.BlockStateProperties;
import net.minecraft.tileentity.TileEntity;
import net.minecraft.util.Direction;
import net.minecraft.util.Hand;
Expand All @@ -27,7 +31,7 @@
import net.minecraftforge.api.distmarker.Dist;
import net.minecraftforge.api.distmarker.OnlyIn;

public class BlockHandOfFate extends HorizontalBlock {
public class BlockHandOfFate extends HorizontalBlock implements IWaterLoggable {

private static VoxelShape SHAPE;

Expand All @@ -39,7 +43,7 @@ public class BlockHandOfFate extends HorizontalBlock {
public BlockHandOfFate() {
super(Properties.create(Material.IRON).hardnessAndResistance(3.0F, 2.0F));
this.setRegistryName("handoffate");
this.setDefaultState(this.getDefaultState().with(HorizontalBlock.HORIZONTAL_FACING, Direction.NORTH));
this.setDefaultState(this.getDefaultState().with(HorizontalBlock.HORIZONTAL_FACING, Direction.NORTH).with(BlockStateProperties.WATERLOGGED, false));
}

@Override
Expand All @@ -65,9 +69,14 @@ public int getLightValue(BlockState state, IEnviromentBlockReader world, BlockPo
return super.getLightValue(state, world, pos);
}

@Override
public IFluidState getFluidState(BlockState state) {
return state.get(BlockStateProperties.WATERLOGGED) ? Fluids.WATER.getStillFluidState(false) : super.getFluidState(state);
}

@Override
protected void fillStateContainer(Builder<Block, BlockState> builder) {
builder.add(HorizontalBlock.HORIZONTAL_FACING);
builder.add(HorizontalBlock.HORIZONTAL_FACING, BlockStateProperties.WATERLOGGED);
}

@Override
Expand Down

0 comments on commit cce511d

Please sign in to comment.