use of net.minecraftforge.fluids.IFluidBlock in project MorePlanets by SteveKunG.
the class ClientEventHandler method isInsideLiquid.
private boolean isInsideLiquid(BlockPos pos) {
IBlockState state = this.mc.player.world.getBlockState(pos);
Block block = state.getBlock();
double eyes = this.mc.player.posY + this.mc.player.getEyeHeight();
double filled = 1.0f;
if (block instanceof IFluidBlock) {
filled = ((IFluidBlock) block).getFilledPercentage(this.mc.player.world, pos);
} else if (block instanceof BlockLiquid) {
filled = BlockLiquid.getLiquidHeightPercent(block.getMetaFromState(state));
}
if (filled < 0) {
filled *= -1;
return eyes > pos.getY() + 1 + (1 - filled);
} else {
return eyes < pos.getY() + 1 + filled;
}
}
use of net.minecraftforge.fluids.IFluidBlock in project NewHorizonsCoreMod by GTNewHorizons.
the class OilGeneratorFix method getTopBlock.
private int getTopBlock(World pWorld, int pLocX, int pLocZ) {
Chunk tChunk = pWorld.getChunkFromBlockCoords(pLocX, pLocZ);
int y = tChunk.getTopFilledSegment() + 15;
int trimmedX = pLocX & 0xF;
int trimmedZ = pLocZ & 0xF;
for (; y > 0; y--) {
Block tBlock = tChunk.getBlock(trimmedX, y, trimmedZ);
if (!tBlock.isAir(pWorld, pLocX, y, pLocZ)) {
if ((tBlock instanceof BlockStaticLiquid)) {
return y;
}
if ((tBlock instanceof BlockFluidBase)) {
return y;
}
if ((tBlock instanceof IFluidBlock)) {
return y;
}
if (tBlock.getMaterial().blocksMovement()) {
if (!(tBlock instanceof BlockFlower)) {
return y - 1;
}
}
}
}
return -1;
}
use of net.minecraftforge.fluids.IFluidBlock in project Bewitchment by Um-Mitternacht.
the class ModItems method register.
public static void register(final IForgeRegistry<Item> registry) {
CropRegistry.getFoods().forEach((crop, item) -> registry.register(item));
CropRegistry.getSeeds().forEach((crop, item) -> registry.register(item));
for (final IFluidBlock fluidBlock : Fluids.MOD_FLUID_BLOCKS) {
registry.register(itemBlock((Block) fluidBlock));
}
registry.register(new ItemGem());
// registry.register(new ItemFume());
registry.register(new ItemFumes("fume"));
registry.register(new ItemGemPowder("powders"));
registry.register(new ItemMod(LibItemName.GEMSTONE_AMALGAM));
registry.register(new ItemMod(LibItemName.COLD_IRON_INGOT));
registry.register(new ItemMod(LibItemName.SILVER_POWDER));
registry.register(new ItemMod(LibItemName.SILVER_INGOT));
registry.register(new ItemMod(LibItemName.SILVER_NUGGET));
registry.register(new ItemSpellPage(LibItemName.SPELL_PAGE));
// Misc
registry.registerAll(new ItemHoney(), new ItemSalt(), new ItemMod(LibItemName.WAX), new ItemMod(LibItemName.BEE).setMaxDamage(35), new ItemMod(LibItemName.HONEYCOMB), new ItemMod(LibItemName.EMPTY_HONEYCOMB), new ItemMod(LibItemName.MORTAR_AND_PESTLE), new ItemBrewDrink(), new ItemBrewSplash(), new ItemBrewLinger(), new ItemMod(LibItemName.GLASS_JAR), new ItemAthame(), new ItemBoline(), new ItemTaglock(), new ItemMod(LibItemName.NEEDLE_BONE), new ItemMod(LibItemName.WOOL_OF_BAT), new ItemMod(LibItemName.TONGUE_OF_DOG), new ItemMod(LibItemName.WOOD_ASH), new ItemMod(LibItemName.ECTOPLASM), new ItemMod(LibItemName.SPECTRAL_DUST), new ItemMod(LibItemName.SILVER_SCALES), new ItemEyeOfOld(), new ItemMod(LibItemName.ENVENOMED_FANG), new ItemMod(LibItemName.DIMENSIONAL_SAND), new ItemMod(LibItemName.CHROMATIC_QUILL), new ItemMod(LibItemName.CARNIVOROUS_TOOTH), new ItemMod(LibItemName.EYE_OF_ANCIENT), new ItemMod(LibItemName.HOOF), new ItemMod(LibItemName.EQUINE_TAIL), new ItemMod(LibItemName.CATECHU), new ItemMod(LibItemName.OAK_APPLE_GALL), new ItemMod(LibItemName.IRON_GALL_INK), new ItemMod(LibItemName.ABSINTHE_GREEN), new ItemMod(LibItemName.ALBEDO), new ItemHeart(), new ItemShadowBook(), new ItemGrilledWatermelon(), new ItemFilledBowl(), new ItemDustyGrimoire(), new ItemRitualChalk(LibItemName.RITUAL_CHALK), new ItemRemedyTalisman(), new ItemTarots(LibItemName.TAROTS), new ItemBroom(LibItemName.BROOM));
// Baubles
//
registry.registerAll(new ItemNazar(), new ItemHorseshoe(), new ItemTriskelionAmulet(), new ItemHellishBauble(), new ItemThornyGarment(), new ItemTalisman(BaubleType.HEAD, 35, LibItemName.TALISMAN_AQUAMARINE_CROWN), new ItemTalisman(BaubleType.RING, 18, LibItemName.TALISMAN_ADAMANTINE_STAR_RING), new ItemTalisman(BaubleType.AMULET, 18, LibItemName.TALISMAN_EMERALD_PENDANT), new ItemTalisman(BaubleType.BELT, 30, LibItemName.TALISMAN_RUBY_ORB), new ItemTalisman(BaubleType.CHARM, 18, LibItemName.TALISMAN_WATCHING_EYE), new ItemGirdleOfTheWooded(LibItemName.GIRDLE_OF_THE_WOODED));
// Equipment
registry.registerAll(new ItemSilverPickaxe(), new ItemSilverAxe(), new ItemSilverSpade(), new ItemSilverHoe(), new ItemSilverSword(), new ItemSilverArmor(LibItemName.SILVER_HELMET, ModMaterials.ARMOR_SILVER, 1, EntityEquipmentSlot.HEAD), new ItemSilverArmor(LibItemName.SILVER_CHESTPLATE, ModMaterials.ARMOR_SILVER, 1, EntityEquipmentSlot.CHEST), new ItemSilverArmor(LibItemName.SILVER_LEGGINGS, ModMaterials.ARMOR_SILVER, 2, EntityEquipmentSlot.LEGS), new ItemSilverArmor(LibItemName.SILVER_BOOTS, ModMaterials.ARMOR_SILVER, 1, EntityEquipmentSlot.FEET));
// Item Blocks
registry.registerAll(new ItemBlockColor(ModBlocks.candle_medium), new ItemBlockColor(ModBlocks.candle_small), itemBlock(ModBlocks.fake_ice), itemBlock(ModBlocks.fake_ice_fence), itemBlock(ModBlocks.fake_ice_stairs), itemBlock(ModBlocks.embittered_bricks), itemBlock(ModBlocks.scorned_bricks), itemBlock(ModBlocks.scorned_brick_fence), itemBlock(ModBlocks.scorned_brick_stairs), new ItemGemOre(ModBlocks.gem_ore).setCreativeTab(ModCreativeTabs.BLOCKS_CREATIVE_TAB), new ItemSlab(ModBlocks.fake_ice_slab_half, (BlockSlab) ModBlocks.fake_ice_slab_half, (BlockSlab) ModBlocks.fake_ice_slab_double).setRegistryName(ModBlocks.fake_ice_slab_half.getRegistryName()), itemBlock(ModBlocks.silver_block), itemBlock(ModBlocks.silver_ore), itemBlock(ModBlocks.moldavite_block), itemBlock(ModBlocks.coquina), itemBlock(ModBlocks.bloodstone_block), itemBlock(ModBlocks.cauldron), itemBlock(ModBlocks.oven), itemBlock(ModBlocks.apiary), itemBlock(ModBlocks.torchwood), itemBlock(ModBlocks.ember_grass), itemBlock(ModBlocks.raging_grass), itemBlock(ModBlocks.beehive), itemBlock(ModBlocks.tourmaline_block), itemBlock(ModBlocks.malachite_block), itemBlock(ModBlocks.tigers_eye_block), itemBlock(ModBlocks.nuummite_block), itemBlock(ModBlocks.alexandrite_block), itemBlock(ModBlocks.garnet_block), itemBlock(ModBlocks.jasper_block), itemBlock(ModBlocks.amethyst_block), itemBlock(ModBlocks.salt_ore), itemBlock(ModBlocks.nethersteel), itemBlock(ModBlocks.salt_barrier), itemBlock(ModBlocks.log_elder), itemBlock(ModBlocks.log_juniper), itemBlock(ModBlocks.log_yew), itemBlock(ModBlocks.log_cypress), itemBlock(ModBlocks.leaves_elder), itemBlock(ModBlocks.leaves_juniper), itemBlock(ModBlocks.leaves_yew), itemBlock(ModBlocks.leaves_cypress), itemBlock(ModBlocks.planks_elder), itemBlock(ModBlocks.planks_juniper), itemBlock(ModBlocks.planks_yew), itemBlock(ModBlocks.planks_cypress), new ItemBlockSapling(), itemBlock(ModBlocks.moonbell), itemBlock(ModBlocks.witch_altar), itemBlock(ModBlocks.thread_spinner), new ItemBlockBarrel(), itemBlock(ModBlocks.infested_farmland), itemBlock(ModBlocks.crystal_ball), itemBlock(ModBlocks.goblet), itemBlock(ModBlocks.tarot_table));
}
use of net.minecraftforge.fluids.IFluidBlock in project Bewitchment by Um-Mitternacht.
the class ModBlocks method register.
public static void register(final IForgeRegistry<Block> registry) {
for (final IFluidBlock fluidBlock : Fluids.MOD_FLUID_BLOCKS) {
registry.register((Block) fluidBlock);
}
// Crops
registry.registerAll(new BlockCrop(LibBlockName.CROP_ACONITUM), new BlockCrop(LibBlockName.CROP_ASPHODEL), new BlockCrop(LibBlockName.CROP_GINGER), new BlockCrop(LibBlockName.CROP_WHITE_SAGE), new BlockCrop(LibBlockName.CROP_MANDRAKE), new BlockCrop(LibBlockName.CROP_LAVENDER), new BlockCrop(LibBlockName.CROP_TULSI), new BlockCrop(LibBlockName.CROP_GARLIC), new BlockCrop(LibBlockName.CROP_HELLEBORE), new BlockCrop(LibBlockName.CROP_CHRYSANTHEMUM), new BlockCrop(LibBlockName.CROP_SAGEBRUSH), new CropWormwood(), new CropSilphium(), new CropKenaf(), new CropThistle(), new CropKelp(), new CropBelladonna(), new CropMint(), new BlockMoonbell(), new BlockInfestedFarmland());
// Ore
registry.register(new BlockSilverOre());
registry.register(new BlockSaltOre());
registry.register(new BlockGemOre());
// Tool Blocks
registry.registerAll(new BlockCauldron(), new BlockOven(), new BlockCandleMedium(LibBlockName.CANDLE_MEDIUM, false), new BlockCandleSmall(LibBlockName.CANDLE_SMALL, false), new BlockCandleMedium(LibBlockName.CANDLE_MEDIUM_LIT, true), new BlockCandleSmall(LibBlockName.CANDLE_SMALL_LIT, true), new BlockSaltBarrier(), new BlockApiary(), new BlockTorchwood(), new BlockEmberGrass(), new BlockRagingGrass(), new BlockFakeIce(), new BlockFakeIceFence(), new BlockScornedBrickFence(), new BlockFakeIceStairs("fake_ice_stairs", STAIRS_ICE.getDefaultState(), Material.ICE), new BlockScornedBrickStairs("scorned_brick_stairs", STAIRS_SCORNED_BRICK.getDefaultState(), Material.ROCK), new BlockFakeIceSlabDouble("fake_ice_slab_double"), new BlockFakeIceSlabHalf("fake_ice_slab_half"), new BlockBeehive(), new BlockWitchAltar(LibBlockName.WITCH_ALTAR, Material.ROCK), new BlockThreadSpinner(LibBlockName.THREAD_SPINNER), new BlockBarrel(LibBlockName.BARREL), new BlockCircleGlyph(LibBlockName.GLYPHS), new BlockCrystalBall(LibBlockName.CRYSTAL_BALL), new BlockGoblet(LibBlockName.GOBLET), new BlockTarotTable());
// Normal Blocks
registry.registerAll(new BlockMod(LibBlockName.MOLDAVITE_BLOCK, Material.ROCK).setSound(SoundType.GLASS).setHardness(5.0F), new BlockMod(LibBlockName.SILVER_BLOCK, Material.IRON).setSound(SoundType.METAL).setHardness(5.0F), new BlockMod(LibBlockName.NETHERSTEEL, Material.IRON).setSound(SoundType.METAL).setHardness(5.0F), new BlockMod(LibBlockName.TOURMALINE_BLOCK, Material.ROCK).setHardness(5.0F), new BlockMod(LibBlockName.BLOODSTONE_BLOCK, Material.ROCK).setHardness(5.0F), new BlockMod(LibBlockName.MALACHITE_BLOCK, Material.ROCK).setHardness(5.0F), new BlockMod(LibBlockName.TIGERS_EYE_BLOCK, Material.ROCK).setHardness(5.0F), new BlockMod(LibBlockName.NUUMMITE_BLOCK, Material.ROCK).setHardness(5.0F), new BlockMod(LibBlockName.ALEXANDRITE_BLOCK, Material.ROCK).setHardness(5.0F), new BlockMod(LibBlockName.JASPER_BLOCK, Material.ROCK).setHardness(5.0F), new BlockMod(LibBlockName.AMETHYST_BLOCK, Material.ROCK).setHardness(5.0F), new BlockMod(LibBlockName.GARNET_BLOCK, Material.ROCK).setHardness(5.0F), new BlockMod(LibBlockName.COQUINA, Material.ROCK).setHardness(5.0F), new BlockMod(LibBlockName.EMBITTERED_BRICKS, Material.ROCK).setSound(SoundType.STONE).setHardness(5.0F), new BlockMod(LibBlockName.SCORNED_BRICKS, Material.ROCK).setSound(SoundType.STONE).setHardness(5.0F));
// Trees
registry.registerAll(new BlockModLog(LibBlockName.LOG_ELDER), new BlockModLog(LibBlockName.LOG_JUNIPER), new BlockModLog(LibBlockName.LOG_YEW), new BlockModLog(LibBlockName.LOG_CYPRESS), new BlockModLeaves(LibBlockName.LEAVES_ELDER), new BlockModLeaves(LibBlockName.LEAVES_JUNIPER), new BlockModLeaves(LibBlockName.LEAVES_YEW), new BlockModLeaves(LibBlockName.LEAVES_CYPRESS), new BlockPlanks(LibBlockName.PLANKS_ELDER), new BlockPlanks(LibBlockName.PLANKS_JUNIPER), new BlockPlanks(LibBlockName.PLANKS_YEW), new BlockPlanks(LibBlockName.PLANKS_CYPRESS), new BlockModSapling(LibBlockName.SAPLING));
}
use of net.minecraftforge.fluids.IFluidBlock in project BuildCraft by BuildCraft.
the class TileQuarry method createColumnVisitList.
/**
* Make the column visit list: called once per layer
*/
private void createColumnVisitList() {
visitList.clear();
boolean[][] blockedColumns = new boolean[builder.blueprint.size.getX() - 2][builder.blueprint.size.getZ() - 2];
for (int searchY = pos.getY() + 3; searchY >= 1; --searchY) {
int startX, endX, incX;
if (searchY % 2 == 0) {
startX = 0;
endX = builder.blueprint.size.getX() - 2;
incX = 1;
} else {
startX = builder.blueprint.size.getX() - 3;
endX = -1;
incX = -1;
}
for (int searchX = startX; searchX != endX; searchX += incX) {
int startZ, endZ, incZ;
if (searchX % 2 == searchY % 2) {
startZ = 0;
endZ = builder.blueprint.size.getZ() - 2;
incZ = 1;
} else {
startZ = builder.blueprint.size.getZ() - 3;
endZ = -1;
incZ = -1;
}
for (int searchZ = startZ; searchZ != endZ; searchZ += incZ) {
if (!blockedColumns[searchX][searchZ]) {
int bx = box.min().getX() + searchX + 1;
int by = searchY;
int bz = box.min().getZ() + searchZ + 1;
BlockPos pos = new BlockPos(bx, by, bz);
IBlockState state = worldObj.getBlockState(pos);
Block block = state.getBlock();
if (!BlockUtil.canChangeBlock(state, worldObj, pos)) {
blockedColumns[searchX][searchZ] = true;
} else if (!BuildCraftAPI.isSoftBlock(worldObj, pos) && !(block instanceof BlockLiquid) && !(block instanceof IFluidBlock)) {
visitList.add(new int[] { bx, by, bz });
}
// recompute prior to this
if (visitList.size() > builder.blueprint.size.getZ() * builder.blueprint.size.getX() * 2) {
return;
}
}
}
}
}
}
Aggregations