use of net.minecraft.world.level.BlockGetter in project Flywheel by Jozufozu.
the class EntityInstanceManager method canCreateInstance.
@Override
protected boolean canCreateInstance(Entity entity) {
if (!entity.isAlive())
return false;
Level world = entity.level;
if (Backend.isFlywheelWorld(world)) {
BlockPos pos = entity.blockPosition();
BlockGetter existingChunk = world.getChunkForCollisions(pos.getX() >> 4, pos.getZ() >> 4);
return existingChunk != null;
}
return false;
}
use of net.minecraft.world.level.BlockGetter in project Flywheel by Jozufozu.
the class BlockEntityInstanceManager method canCreateInstance.
@Override
protected boolean canCreateInstance(BlockEntity blockEntity) {
if (blockEntity.isRemoved())
return false;
Level world = blockEntity.getLevel();
if (world == null)
return false;
if (world.isEmptyBlock(blockEntity.getBlockPos()))
return false;
if (Backend.isFlywheelWorld(world)) {
BlockPos pos = blockEntity.getBlockPos();
BlockGetter existingChunk = world.getChunkForCollisions(pos.getX() >> 4, pos.getZ() >> 4);
return existingChunk != null;
}
return false;
}
use of net.minecraft.world.level.BlockGetter in project ConnectedTexturesMod by Chisel-Team.
the class RegionCache method getPassthrough.
private BlockGetter getPassthrough() {
BlockGetter ret = passthrough.get();
Preconditions.checkNotNull(ret);
return ret;
}
use of net.minecraft.world.level.BlockGetter in project Tetra-Pak by Noobulus.
the class CorundumEffect method corundumToolsBreakBlocksFaster.
@SubscribeEvent
public void corundumToolsBreakBlocksFaster(PlayerEvent.BreakSpeed event) {
int effectLevel = getEffectLevel(event.getPlayer().getMainHandItem());
if (effectLevel <= 0)
return;
BlockPos pos = event.getPos();
BlockGetter world = event.getEntityLiving().level;
boolean matches = CorundumMap.COLOR_MAP.get(world.getBlockState(event.getPos()).getMapColor(world, pos)) == effectLevel;
event.setNewSpeed((float) (event.getOriginalSpeed() * (matches ? Config.MATCHING_CRYSTAL_FACTOR.get() : Config.NON_MATCHING_CRYSTAL_FACTOR.get())));
}
Aggregations