use of com.almuradev.content.type.block.state.LazyBlockState in project Almura by AlmuraDev.
the class GrassFeature method canPlace.
private boolean canPlace(final IBlockAccess access, final BlockPos pos, final IBlockState toPlaceState, final List<LazyBlockState> requires) {
World world;
if (access instanceof ChunkCache) {
world = ((ChunkCacheAccessor) access).accessor$getWorld();
} else {
world = (World) access;
}
final Block toPlaceBlock = toPlaceState.getBlock();
boolean canPlace = true;
if (!requires.isEmpty()) {
final IBlockState underState = access.getBlockState(pos.down());
boolean found = false;
for (final LazyBlockState lbs : requires) {
if (lbs.partialTest(underState)) {
found = true;
break;
}
}
canPlace = found;
}
if (canPlace) {
if (toPlaceBlock instanceof BlockBush) {
canPlace = ((BlockBush) toPlaceBlock).canBlockStay(world, pos, toPlaceState);
}
}
return canPlace;
}
use of com.almuradev.content.type.block.state.LazyBlockState in project Almura by AlmuraDev.
the class CactusFeature method canPlace.
private boolean canPlace(final IBlockAccess access, final BlockPos pos, final IBlockState toPlaceState, final List<LazyBlockState> requires) {
World world;
if (access instanceof ChunkCache) {
world = ((ChunkCacheAccessor) access).accessor$getWorld();
} else {
world = (World) access;
}
final Block toPlaceBlock = toPlaceState.getBlock();
boolean canPlace = true;
if (!requires.isEmpty()) {
final IBlockState underState = access.getBlockState(pos.down());
boolean found = false;
for (final LazyBlockState lbs : requires) {
if (lbs.partialTest(underState)) {
found = true;
break;
}
}
canPlace = found;
}
if (canPlace) {
// Why Vanilla lol
if (toPlaceBlock instanceof BlockCactus) {
canPlace = ((BlockCactus) toPlaceBlock).canBlockStay(world, pos);
} else if (toPlaceBlock instanceof BlockBush) {
canPlace = ((BlockBush) toPlaceBlock).canBlockStay(world, pos, toPlaceState);
}
}
return canPlace;
}
use of com.almuradev.content.type.block.state.LazyBlockState in project Almura by AlmuraDev.
the class FlowerFeature method canPlace.
private boolean canPlace(final IBlockAccess access, final BlockPos pos, final IBlockState toPlaceState, final List<LazyBlockState> requires) {
World world;
if (access instanceof ChunkCache) {
world = ((ChunkCacheAccessor) access).accessor$getWorld();
} else {
world = (World) access;
}
final Block toPlaceBlock = toPlaceState.getBlock();
boolean canPlace = true;
if (!requires.isEmpty()) {
final IBlockState underState = access.getBlockState(pos.down());
boolean found = false;
for (final LazyBlockState lbs : requires) {
if (lbs.partialTest(underState)) {
found = true;
break;
}
}
canPlace = found;
}
if (canPlace) {
// Why Vanilla lol
if (toPlaceBlock instanceof BlockCactus) {
canPlace = ((BlockCactus) toPlaceBlock).canBlockStay(world, pos);
} else if (toPlaceBlock instanceof BlockBush) {
canPlace = ((BlockBush) toPlaceBlock).canBlockStay(world, pos, toPlaceState);
}
}
return canPlace;
}
use of com.almuradev.content.type.block.state.LazyBlockState in project Almura by AlmuraDev.
the class DeadBushFeature method canPlace.
private boolean canPlace(final IBlockAccess access, final BlockPos pos, final IBlockState toPlaceState, final List<LazyBlockState> requires) {
World world;
if (access instanceof ChunkCache) {
world = ((ChunkCacheAccessor) access).accessor$getWorld();
} else {
world = (World) access;
}
final Block toPlaceBlock = toPlaceState.getBlock();
boolean canPlace = true;
if (!requires.isEmpty()) {
final IBlockState underState = access.getBlockState(pos.down());
boolean found = false;
for (final LazyBlockState lbs : requires) {
if (lbs.partialTest(underState)) {
found = true;
break;
}
}
canPlace = found;
}
if (canPlace) {
// Why Vanilla lol
if (toPlaceBlock instanceof BlockCactus) {
canPlace = ((BlockCactus) toPlaceBlock).canBlockStay(world, pos);
} else if (toPlaceBlock instanceof BlockBush) {
canPlace = ((BlockBush) toPlaceBlock).canBlockStay(world, pos, toPlaceState);
}
}
return canPlace;
}
Aggregations