2018-09-16 00:45:44 +02:00
|
|
|
package com.minelittlepony.unicopia.block;
|
|
|
|
|
|
|
|
import com.minelittlepony.unicopia.CloudType;
|
|
|
|
|
2018-09-19 09:07:39 +02:00
|
|
|
import net.minecraft.block.Block;
|
|
|
|
import net.minecraft.block.BlockFalling;
|
2018-09-16 00:45:44 +02:00
|
|
|
import net.minecraft.block.state.IBlockState;
|
|
|
|
import net.minecraft.entity.Entity;
|
2018-09-19 09:07:39 +02:00
|
|
|
import net.minecraft.util.math.BlockPos;
|
|
|
|
import net.minecraft.world.IBlockAccess;
|
2018-09-16 00:45:44 +02:00
|
|
|
|
|
|
|
public interface ICloudBlock {
|
|
|
|
|
|
|
|
CloudType getCloudMaterialType(IBlockState blockState);
|
|
|
|
|
|
|
|
default boolean getCanInteract(IBlockState state, Entity e) {
|
|
|
|
return getCloudMaterialType(state).canInteract(e);
|
|
|
|
}
|
|
|
|
|
2018-09-19 09:07:39 +02:00
|
|
|
default boolean isDense(IBlockState blockState) {
|
|
|
|
return getCloudMaterialType(blockState) != CloudType.NORMAL;
|
|
|
|
}
|
|
|
|
|
|
|
|
default boolean allowsFallingBlockToPass(IBlockState state, IBlockAccess world, BlockPos pos) {
|
|
|
|
if (isDense(state)) {
|
|
|
|
return false;
|
|
|
|
}
|
|
|
|
|
|
|
|
Block above = world.getBlockState(pos.up()).getBlock();
|
|
|
|
return !(above instanceof ICloudBlock) && above instanceof BlockFalling;
|
|
|
|
}
|
2018-09-16 00:45:44 +02:00
|
|
|
}
|