use of net.minecraftforge.fluids.BlockFluidBase in project MorePlanets by SteveKunG.
the class WalkNodeProcessorMP method getStart.
@Override
public PathPoint getStart() {
int i;
if (this.getCanSwim() && this.entity.isInWater()) {
i = (int) this.entity.getEntityBoundingBox().minY;
BlockPos.MutableBlockPos blockpos$mutableblockpos = new BlockPos.MutableBlockPos(MathHelper.floor(this.entity.posX), i, MathHelper.floor(this.entity.posZ));
for (Block block = this.blockaccess.getBlockState(blockpos$mutableblockpos).getBlock(); block == Blocks.FLOWING_WATER || block == Blocks.WATER || block instanceof BlockFluidBase; block = this.blockaccess.getBlockState(blockpos$mutableblockpos).getBlock()) {
++i;
blockpos$mutableblockpos.setPos(MathHelper.floor(this.entity.posX), i, MathHelper.floor(this.entity.posZ));
}
} else if (this.entity.onGround) {
i = MathHelper.floor(this.entity.getEntityBoundingBox().minY + 0.5D);
} else {
BlockPos blockpos;
for (blockpos = new BlockPos(this.entity); (this.blockaccess.getBlockState(blockpos).getMaterial() == Material.AIR || this.blockaccess.getBlockState(blockpos).getBlock().isPassable(this.blockaccess, blockpos)) && blockpos.getY() > 0; blockpos = blockpos.down()) {
}
i = blockpos.up().getY();
}
BlockPos blockpos2 = new BlockPos(this.entity);
PathNodeType pathnodetype1 = this.getPathNodeType(this.entity, blockpos2.getX(), i, blockpos2.getZ());
if (this.entity.getPathPriority(pathnodetype1) < 0.0F) {
Set<BlockPos> set = new HashSet<>();
set.add(new BlockPos(this.entity.getEntityBoundingBox().minX, i, this.entity.getEntityBoundingBox().minZ));
set.add(new BlockPos(this.entity.getEntityBoundingBox().minX, i, this.entity.getEntityBoundingBox().maxZ));
set.add(new BlockPos(this.entity.getEntityBoundingBox().maxX, i, this.entity.getEntityBoundingBox().minZ));
set.add(new BlockPos(this.entity.getEntityBoundingBox().maxX, i, this.entity.getEntityBoundingBox().maxZ));
for (BlockPos blockpos1 : set) {
PathNodeType pathnodetype = this.getPathNodeType(this.entity, blockpos1);
if (this.entity.getPathPriority(pathnodetype) >= 0.0F) {
return this.openPoint(blockpos1.getX(), blockpos1.getY(), blockpos1.getZ());
}
}
}
return this.openPoint(blockpos2.getX(), i, blockpos2.getZ());
}
use of net.minecraftforge.fluids.BlockFluidBase in project MorePlanets by SteveKunG.
the class PathNavigateGroundMP method getPathablePosY.
private int getPathablePosY() {
if (this.entity.isInWater() && this.getCanSwim()) {
int i = (int) this.entity.getEntityBoundingBox().minY;
Block block = this.world.getBlockState(new BlockPos(MathHelper.floor(this.entity.posX), i, MathHelper.floor(this.entity.posZ))).getBlock();
int j = 0;
while (block == Blocks.FLOWING_WATER || block == Blocks.WATER || block instanceof BlockFluidBase && this.world.getBlockState(new BlockPos(MathHelper.floor(this.entity.posX), i, MathHelper.floor(this.entity.posZ))).getMaterial() == Material.WATER) {
++i;
block = this.world.getBlockState(new BlockPos(MathHelper.floor(this.entity.posX), i, MathHelper.floor(this.entity.posZ))).getBlock();
++j;
if (j > 16) {
return (int) this.entity.getEntityBoundingBox().minY;
}
}
return i;
} else {
return (int) (this.entity.getEntityBoundingBox().minY + 0.5D);
}
}
use of net.minecraftforge.fluids.BlockFluidBase in project BuildCraft by BuildCraft.
the class OilPopulateOld method getTopBlock.
private int getTopBlock(World world, int x, int z) {
BlockPos pos = new BlockPos(x, 0, z);
Chunk chunk = world.getChunkFromBlockCoords(pos);
int y = chunk.getTopFilledSegment() + 15;
pos = pos.up(y);
int trimmedX = x & 15;
int trimmedZ = z & 15;
for (; y > 0; --y) {
Block block = chunk.getBlock(trimmedX, y, trimmedZ);
if (block.isAir(world, pos)) {
continue;
}
if (block instanceof BlockStaticLiquid) {
return y;
}
if (block instanceof BlockFluidBase) {
return y;
}
if (block instanceof IFluidBlock) {
return y;
}
if (!block.getMaterial().blocksMovement()) {
continue;
}
if (block instanceof BlockFlower) {
continue;
}
return y - 1;
}
return -1;
}
use of net.minecraftforge.fluids.BlockFluidBase in project BuildCraft by BuildCraft.
the class TileFloodGate method placeFluid.
private boolean placeFluid(BlockPos pos, Fluid fluid) {
Block block = BlockUtil.getBlockState(worldObj, pos).getBlock();
if (canPlaceFluidAt(block, pos)) {
boolean placed;
Block b = TankUtils.getFluidBlock(fluid, true);
if (b instanceof BlockFluidBase) {
BlockFluidBase blockFluid = (BlockFluidBase) b;
placed = worldObj.setBlockState(pos, blockFluid.getDefaultState(), 3);
} else {
placed = worldObj.setBlockState(pos, b.getDefaultState());
}
if (placed) {
queueAdjacent(pos);
expandQueue();
}
return placed;
}
return false;
}
use of net.minecraftforge.fluids.BlockFluidBase in project BuildCraft by BuildCraft.
the class BuildCraftCore method postInit.
@Mod.EventHandler
public void postInit(FMLPostInitializationEvent event) {
BCLog.logger.info("BuildCraft's fake player: UUID = " + gameProfile.getId().toString() + ", name = '" + gameProfile.getName() + "'!");
BCRegistry.INSTANCE.save();
for (Object o : Block.blockRegistry) {
Block block = (Block) o;
if (block instanceof BlockFluidBase || block instanceof BlockLiquid || block instanceof IPlantable) {
BuildCraftAPI.softBlocks.add(block);
}
}
BuildCraftAPI.softBlocks.add(Blocks.snow);
BuildCraftAPI.softBlocks.add(Blocks.vine);
BuildCraftAPI.softBlocks.add(Blocks.fire);
CropManager.setDefaultHandler(new CropHandlerPlantable());
CropManager.registerHandler(new CropHandlerReeds());
BuildCraftAPI.registerWorldProperty("replaceable", new WorldPropertyIsReplaceable());
BuildCraftAPI.registerWorldProperty("soft", new WorldPropertyIsSoft());
BuildCraftAPI.registerWorldProperty("wood", new WorldPropertyIsWood());
BuildCraftAPI.registerWorldProperty("leaves", new WorldPropertyIsLeaf());
for (int i = 0; i < 4; i++) {
BuildCraftAPI.registerWorldProperty("ore@hardness=" + i, new WorldPropertyIsOre(i));
}
BuildCraftAPI.registerWorldProperty("harvestable", new WorldPropertyIsHarvestable());
BuildCraftAPI.registerWorldProperty("farmland", new WorldPropertyIsFarmland());
BuildCraftAPI.registerWorldProperty("shoveled", new WorldPropertyIsShoveled());
BuildCraftAPI.registerWorldProperty("dirt", new WorldPropertyIsDirt());
BuildCraftAPI.registerWorldProperty("fluidSource", new WorldPropertyIsFluidSource());
BuildCraftAPI.registerWorldProperty("freepath", new WorldPropertyIsFreePath());
// Landmarks are often caught incorrectly, making building them counter-productive.
SchematicRegistry.INSTANCE.registerSchematicBlock(markerBlock, SchematicIgnore.class);
SchematicRegistry.INSTANCE.registerSchematicBlock(pathMarkerBlock, SchematicIgnore.class);
ColorUtils.initialize();
actionControl = new IActionExternal[IControllable.Mode.values().length];
for (IControllable.Mode mode : IControllable.Mode.values()) {
if (mode != IControllable.Mode.Unknown && mode != IControllable.Mode.Mode) {
actionControl[mode.ordinal()] = new ActionMachineControl(mode);
}
}
MinecraftForge.EVENT_BUS.register(ListOreDictionaryCache.INSTANCE);
for (String s : OreDictionary.getOreNames()) {
ListOreDictionaryCache.INSTANCE.registerName(s);
}
ListRegistry.registerHandler(new ListMatchHandlerOreDictionary());
}
Aggregations