Java 类net.minecraftforge.fluids.BlockFluidBase 实例源码

项目:ThermionicsWorld    文件:BlockFluidSimple.java   
public BlockFluidSimple(Fluid fluid, String name) {
    super(fluid,
            //ThermionicsWorld.MATERIAL_PAIN);
            Material.WATER);
    //this.opaque = true;
    //this.icons = icons;
    this.quantaPerBlock = 4;
    this.quantaPerBlockFloat = 4.0f;
    this.tickRate = 10; //density-based tickrate winds up really high

    this.setRegistryName(name);
    this.setUnlocalizedName("thermionics_world.fluid."+name);

    this.fluidDamage = new DamageSource("fluid."+fluid.getName()).setDamageBypassesArmor().setDamageIsAbsolute();
    //if (fluid.getTemperature() > SCALDING) damageAmount = 1 + (fluid.getTemperature() - SCALDING) / 20f;

    this.setDefaultState(blockState.getBaseState().withProperty(BlockFluidBase.LEVEL, 3));
}
项目:FoodCraft-Reloaded    文件:EnumLoader.java   
@SideOnly(Side.CLIENT)
public void registerRenders() {
    enumInstanceMap.values().stream().map(Map::entrySet).map(Collection::stream).forEach(entries -> entries.forEach(entry -> {
        if (Item.class.isAssignableFrom(entry.getValue().getClass())) {
            if (entry.getValue() instanceof CustomModelMasking) {
                registerRender((Item) entry.getValue(), 0, ((CustomModelMasking) entry.getValue()).getModelLocation());
                FoodCraftReloaded.getLogger().debug("Registered custom model " + entry.getValue().getClass() + " as " + ((CustomModelMasking) entry.getValue()).getModelLocation());
            } else if (((Item) entry.getValue()).getRegistryName() != null) {
                registerRender((Item) entry.getValue(), 0, new ModelResourceLocation(((Item) entry.getValue()).getRegistryName(), "inventory"));
            }
        } else if (BlockFluidBase.class.isAssignableFrom(entry.getValue().getClass())) {
            // TODO Null condition
            registerFluidRender((BlockFluidBase) entry.getValue(), ((Block)entry.getValue()).getRegistryName().getResourcePath());
        } else if (Block.class.isAssignableFrom(entry.getValue().getClass())) {
            if (entry.getValue() instanceof CustomModelMasking)
                ModelLoader.setCustomStateMapper((Block) entry.getValue(), block -> ((CustomModelMasking) entry.getValue()).getStateModelLocations());
        }
    }));
}
项目:ExPetrum    文件:ExPBiome.java   
public ExPBiome(BiomeProperties properties, String name, float... biomedata)
{
    super(properties);
    this.name = name;
    this.temperatureMultiplier = biomedata[0];
    this.humidityMultiplier = biomedata[1];
    this.temperatureBaseModifier = biomedata[2];
    this.humidityBaseModifier = biomedata[3];
    this.spawnableCaveCreatureList.clear();
    this.spawnableCreatureList.clear();
    this.spawnableMonsterList.clear();
    this.spawnableWaterCreatureList.clear();
    this.SALT_WATER = ExPBlocks.saltWater.getDefaultState().withProperty(BlockFluidBase.LEVEL, 9);
    this.FRESH_WATER = ExPBlocks.freshWater.getDefaultState().withProperty(BlockFluidBase.LEVEL, 9);
    this.LAVA = ExPBlocks.lava.getDefaultState().withProperty(BlockFluidBase.LEVEL, 9);
    this.SALT_ICE = ExPBlocks.ice.getDefaultState().withProperty(ExPBlockProperties.ICE_IS_SALT, true);
    this.FRESH_ICE = ExPBlocks.ice.getDefaultState().withProperty(ExPBlockProperties.ICE_IS_SALT, false);
    this.setRegistryName(ExPRegistryNames.asLocation(name));
    Stream.of(EnumCrop.values()).filter(c -> c != EnumCrop.DEAD && c.getData().foundIn.contains(name.toLowerCase())).forEach(this.cropsToGenerate::add);
}
项目:BetterWithAddons    文件:BlockCherryLeaves.java   
@Override
public void randomTick(World world, BlockPos pos, IBlockState state, Random random) {
    super.randomTick(world, pos, state, random);

    if(random.nextFloat() < 0.05f)
    {
        for(int i = 1; i <= 50; i++)
        {
            BlockPos checkpos = pos.down(i);
            if(world.isSideSolid(checkpos, EnumFacing.UP))
            {
                IBlockState checkstate = world.getBlockState(checkpos.up());
                if(world.isAirBlock(checkpos.up()) || checkstate.getBlock().isReplaceable(world,checkpos.up()) && !(checkstate.getBlock() instanceof BlockLiquid || checkstate.getBlock() instanceof BlockFluidBase))
                    world.setBlockState(checkpos.up(), ModBlocks.sakuraLeafPile.getDefaultState(), 3);
                break;
            }
        }
    }
}
项目:Alchemy    文件:GeneratorBigFlowerHoney.java   
@Override
public boolean generate(World world, Random rand, BlockPos pos) {
    boolean result = super.func_180709_b(world, rand, pos);
    if (result)
        switch (flowerType) {
            case RED:
                int level = minLevel + rand.nextInt(maxLevel - minLevel);
                IBlockState state = fluid.withProperty(BlockFluidBase.LEVEL, level);
                world.setBlockState(pos = pos.up(7), state, 2);
                for (EnumFacing facing : EnumFacing.values())
                    world.setBlockState(pos.offset(facing), state, 2);
            default:
            break;
        }
    return result;
}
项目:BaseMetals    文件:Fluids.java   
@SideOnly(Side.CLIENT)
public static void bakeModels(String modID){
    for(Fluid fluid : fluidBlocks.keySet()){
        BlockFluidBase block = fluidBlocks.get(fluid);
        Item item = Item.getItemFromBlock(block);
        final ModelResourceLocation fluidModelLocation = new ModelResourceLocation(
                modID.toLowerCase() + ":" + fluidBlockNames.get(block), "fluid");
           ModelBakery.registerItemVariants(item);
        ModelLoader.setCustomMeshDefinition(item, new ItemMeshDefinition()
        {
            public ModelResourceLocation getModelLocation(ItemStack stack)
            {
                return fluidModelLocation;
            }
        });
        ModelLoader.setCustomStateMapper(block, new StateMapperBase()
        {
            protected ModelResourceLocation getModelResourceLocation(IBlockState state)
            {
                return fluidModelLocation;
            }
        });
    }
}
项目:Framez    文件:MovementHandlerFluid.java   
@Override
@Priority(PriorityEnum.OVERRIDE)
public BlockMovementType getMovementType(World world, int x, int y, int z, ForgeDirection side, IMovement movement) {

    Block b = world.getBlock(x, y, z);

    if (b instanceof BlockFluidBase) {
        if (((BlockFluidBase) b).getFilledPercentage(world, x, y, z) == 1F)
            return BlockMovementType.SEMI_MOVABLE;
        return BlockMovementType.UNMOVABLE;
    }
    if (b instanceof BlockLiquid) {
        if (BlockLiquid.getLiquidHeightPercent(world.getBlockMetadata(x, y, z)) == 1 / 9F)
            return BlockMovementType.SEMI_MOVABLE;
        return BlockMovementType.UNMOVABLE;
    }

    return null;
}
项目:HCoreLib    文件:FluidFactory.java   
/**
 * Creates and returns fluid object if successful, else returns null.
 *
 * @param name name of fluid.
 * @param still ResourceLocation.
 * @param flowing ResourceLocation.
 * @param fluidBlock block fluid uses if applicable.
 * @param luminosity luminosity of fluid.
 * @param density density of fluid.
 * @param temperature temperature of fluid.
 * @param viscosity viscosity of fluid.
 * @param isGaseous isGaseous of fluid.
 * @param rarity rarity of fluid.
 * @return fluid object.
 */
public static Fluid createNewFluid(String name, ResourceLocation still, ResourceLocation flowing, BlockFluidBase fluidBlock,
        int luminosity, int density, int temperature, int viscosity, boolean isGaseous, EnumRarity rarity) {
    Fluid ret = null;

    if (name != null && name.length() > 0) {

        if (luminosity < 0) luminosity = 0;
        else if (luminosity > 0xf) luminosity = 0xf;

        ret = new Fluid(name, still, flowing);

        if (fluidBlock != null) ret.setBlock(fluidBlock);
        ret.setLuminosity(luminosity);
        ret.setDensity(density);
        ret.setTemperature(temperature);
        ret.setViscosity(viscosity);
        ret.setGaseous(isGaseous);
        ret.setRarity(rarity);

    }

    return ret;
}
项目:EarliestOfGames    文件:FluidHelper.java   
public static int getFlowDecayOfFluidAt(World world, int x, int y, int z, Fluid fluid)
{
    int flowDecay = -1;
    TileEntity tile = world.getTileEntity(x, y, z);

    if (tile != null && tile instanceof TileEntityFluidJunction)
    {
        flowDecay = ((TileEntityFluidJunction) tile).getFlowDecay(fluid);
    }
    else
    {
        Block block = world.getBlock(x, y, z);

        if (block != null && getFluidTypeOfBlock(block) == fluid)
        {
            if (block instanceof BlockLiquid)
                flowDecay = Wrappers.getFlowDecay(((BlockLiquid) block), world, x, y, z);
            else if (block instanceof BlockFluidBase)
                flowDecay = convertQuantaRemainingToFlowDecay(((BlockFluidBase) block).getQuantaValue(world, x, y, z), getFluidTypeOfBlock(block));
        }
    }

    return flowDecay;
}
项目:CodeLyokoMod    文件:TileEntitySuperCalc.java   
public float getCoolant(World world, int x, int y, int z)
{
    float coolant = 0.0F;
    for (int i = -1; i < 2; i++)
        for (int j = -1; j < 2; j++) {
            Block block = world.getBlock(x + i, y, z + j);
            if (block == Block.getBlockFromName("flowing_water") || block == Block.getBlockFromName("water"))
                coolant += 0.2F;
            else if (block == Block.getBlockFromName("flowing_lava") || block == Block.getBlockFromName("lava"))
                coolant -= 0.2F;
            else if (block != null && block instanceof BlockFluidBase) {
                BlockFluidBase liquid = (BlockFluidBase) block;
                Fluid fluid = liquid.getFluid();
                if (fluid != null) {
                    float fluidTemp = fluid.getTemperature(world, x + i, y, z + j);
                    if (fluidTemp < this.getTemperature())
                        coolant += (this.getTemperature() - fluidTemp) / 10;
                    else
                        coolant -= (fluidTemp - this.getTemperature()) / 10;
                }
            }
        }
    return coolant;
}
项目:pnc-repressurized    文件:ItemBlockPneumaticCraft.java   
public ItemBlockPneumaticCraft(Block block) {
    super(block);
    if (block instanceof BlockPneumaticCraft) {
        this.block = (BlockPneumaticCraft) block;
    } else {
        if (!(block instanceof BlockAir) && !(block instanceof BlockFluidBase)) {
            Log.warning("Block " + block.getUnlocalizedName() + " does not extend BlockPneumaticCraft! No tooltip displayed");
        }
    }
}
项目:pnc-repressurized    文件:FluidUtils.java   
/**
 * Check if the given blockpos contains a fluid source block.
 *
 * @param world the world
 * @param pos the blockpos
 * @return true if there is a fluid source block at the given blockpos, false otherwise
 */
public static boolean isSourceBlock(World world, BlockPos pos) {
    IBlockState state = world.getBlockState(pos);
    if (state.getProperties().containsKey(BlockLiquid.LEVEL)) {
        return state.getValue(BlockLiquid.LEVEL) == 0;
    } else
        return state.getProperties().containsKey(BlockFluidBase.LEVEL) && state.getValue(BlockFluidBase.LEVEL) == 0;
}
项目:harshencastle    文件:HarshenClientUtils.java   
public static void renderGhostBlock(IBlockState state, BlockPos position, Color color, boolean noDepth, float partialTicks)
{
    if(!(state.getBlock() instanceof BlockLiquid) && !(state.getBlock() instanceof BlockFluidBase))
    {
        renderGhostModel(Minecraft.getMinecraft().getBlockRendererDispatcher().getModelForState(state), position, color, noDepth, partialTicks);
        return;
    }
    GlStateManager.enableBlend();
       GL11.glBlendFunc(GL11.GL_ONE, GL11.GL_ONE_MINUS_DST_COLOR);
    BufferBuilder vb;
    if(noDepth)
    {
           GlStateManager.depthFunc(519);
        vb = prepRenderBlockDepth(partialTicks, true);
    }
    else
        vb = prepRender(partialTicks, true);
       vb.begin(7, DefaultVertexFormats.BLOCK);
       World world = Minecraft.getMinecraft().world;
       Minecraft.getMinecraft().getBlockRendererDispatcher().renderBlock(state, position.add(0, noDepth ? 500 : 0, 0), world, vb);
       for(int i = 0; i < vb.getVertexCount(); i++)
        vb.putColorMultiplier(color.getRed() / 255f, color.getGreen() / 255f, color.getBlue() / 255f, i);
       vb.color(1, 1, 1, 0.1f);
       postRender();
       GlStateManager.disableBlend();
       GlStateManager.depthFunc(515);
}
项目:Anima-Mundi    文件:BlockUtil.java   
public static boolean isFluid(IBlockState state)
{
    boolean flag1 =  state.getBlock() instanceof BlockLiquid;
    boolean flag2 = state.getBlock().getMaterial(state).isLiquid();
    boolean flag3 = state.getBlock() instanceof BlockFluidBase;

    return flag1 || flag2 || flag3;
}
项目:CustomWorldGen    文件:ModelFluid.java   
private static int[] getCorners(Optional<IExtendedBlockState> stateOption)
{
    int[] cornerRound = new int[]{0, 0, 0, 0};
    if(stateOption.isPresent())
    {
        IExtendedBlockState state = stateOption.get();
        for(int i = 0; i < 4; i++)
        {
            Float level = state.getValue(BlockFluidBase.LEVEL_CORNERS[i]);
            cornerRound[i] = Math.round((level == null ? 7f / 8 : level) * 768);
        }
    }
    return cornerRound;
}
项目:CustomWorldGen    文件:ModelFluid.java   
private static int getFlow(Optional<IExtendedBlockState> stateOption)
{
    Float flow = -1000f;
    if(stateOption.isPresent())
    {
        flow = stateOption.get().getValue(BlockFluidBase.FLOW_DIRECTION);
        if(flow == null) flow = -1000f;
    }
    int flowRound = (int)Math.round(Math.toDegrees(flow));
    flowRound = MathHelper.clamp_int(flowRound, -1000, 1000);
    return flowRound;
}
项目:FoodCraft-Reloaded    文件:EnumLoader.java   
@SideOnly(Side.CLIENT)
protected void registerFluidRender(BlockFluidBase blockFluid, String blockStateName) {
    final String location = FoodCraftReloaded.MODID + ":" + blockStateName;
    final Item itemFluid = Item.getItemFromBlock(blockFluid);
    ModelLoader.setCustomMeshDefinition(itemFluid, stack -> new ModelResourceLocation(location, "fluid"));
    ModelLoader.setCustomStateMapper(blockFluid, new StateMapperBase() {
        @Nonnull
        @Override
        protected ModelResourceLocation getModelResourceLocation(@Nonnull IBlockState state) {
            return new ModelResourceLocation(location, "fluid");
        }
    });
}
项目:ExPetrum    文件:OilGenerator.java   
@Override
public boolean generate(World worldIn, Random rand, BlockPos position)
{
    IBlockState oilBlock = ExPBlocks.oil.getDefaultState().withProperty(BlockFluidBase.LEVEL, 10);
    int randomY = 32 + rand.nextInt(64);
    int size = 4 + rand.nextInt(8);
    BlockPos at = new BlockPos(position.getX(), randomY, position.getZ());
    for (int dx = -size; dx <= size; ++dx)
    {
        for (int dy = -size; dy <= size; ++dy)
        {
            for (int dz = -size; dz <= size; ++dz)
            {
                double dist = Math.sqrt(dx * dx + dy * dy + dz * dz);
                if (dist > size)
                {
                    continue;
                }

                worldIn.setBlockState(at.add(dx, dy, dz), oilBlock, 2);
            }
        }
    }

    int randomYEx = 8 + rand.nextInt(size * 2);
    while (at.getY() < randomYEx + 128)
    {
        if (worldIn.getBlockState(at.up(3)).getMaterial() == Material.WATER && worldIn.getBlockState(at.up(3)) != oilBlock)
        {
            break;
        }

        worldIn.setBlockState(at, oilBlock, 2);
        at = at.up();
    }

    return true;
}
项目:ExPetrum    文件:BlockIce.java   
public void tryMelt(World world, BlockPos pos, IBlockState state, Random rand)
{
    float temp = Helpers.getTemperatureAt(world, pos);
    if (temp > 0 && rand.nextFloat() < temp / 10 && world.isAirBlock(pos.up()))
    {
        boolean salt = state.getValue(ExPBlockProperties.ICE_IS_SALT);
        world.setBlockState(pos, salt ? ExPBlocks.saltWater.getDefaultState().withProperty(BlockFluidBase.LEVEL, 9) : ExPBlocks.freshWater.getDefaultState().withProperty(BlockFluidBase.LEVEL, 9));
    }
}
项目:ExPetrum    文件:ExPHandlerServer.java   
@SubscribeEvent
public void onRightClick(PlayerInteractEvent.RightClickBlock event)
{
    if (!event.getWorld().isRemote)
    {
        EntityPlayer player = event.getEntityPlayer();
        IExPPlayer data = IExPPlayer.of(player);
        if (data.getThirst() < data.getMaxThirst(true) - 200)
        {
            RayTraceResult rtr = event.getWorld().rayTraceBlocks(player.getPositionEyes(1), player.getPositionEyes(1).add(player.getLook(1).scale(3)), true, false, false);
            if (rtr != null && rtr.typeOfHit == Type.BLOCK)
            {
                BlockPos pos = rtr.getBlockPos();
                IBlockState hit = event.getWorld().getBlockState(pos);
                if (hit.getBlock() instanceof IWater && !((IWater)hit.getBlock()).isSalt(event.getWorld(), pos))
                {
                    int level = hit.getValue(BlockFluidBase.LEVEL);
                    if (level > 0)
                    {
                        event.getWorld().setBlockState(pos, hit.withProperty(BlockFluidBase.LEVEL, level - 1));
                    }
                    else
                    {
                        event.getWorld().setBlockToAir(pos);
                    }

                    data.setThirst(data.getThirst() + 200, true);
                    event.getWorld().playSound(null, pos, SoundEvents.ENTITY_GENERIC_DRINK, SoundCategory.PLAYERS, 1, 1);
                }
            }
        }
    }
}
项目:ModularMachinery    文件:BlockArray.java   
private IBlockStateDescriptor(Block block) {
    List<Integer> usedMetas = Lists.newArrayList();
    if(!(block instanceof BlockLiquid) && !(block instanceof BlockFluidBase)) {
        for (IBlockState state : block.getBlockState().getValidStates()) {
            int meta = block.getMetaFromState(state);
            if(!usedMetas.contains(meta)) {
                usedMetas.add(meta);
                this.applicable.add(state);
            }
        }
    }
    if(applicable.isEmpty()) {
        applicable.add(block.getDefaultState());
    }
}
项目:4Space-5    文件:SchematicBlock.java   
@Override
public BuildingStage getBuildStage () {
    if (block instanceof BlockFalling) {
        return BuildingStage.SUPPORTED;
    } else if (block instanceof BlockFluidBase || block instanceof BlockLiquid) {
        return BuildingStage.EXPANDING;
    } else if (block.isOpaqueCube()) {
        return BuildingStage.STANDALONE;
    } else {
        return BuildingStage.SUPPORTED;
    }
}
项目:CrystalMod    文件:ModFluids.java   
public static BlockFluidBase registerClassicBlock(Fluid fluid) {
    BlockFluidBase block = new BlockCrystalFluid(fluid, net.minecraft.block.material.Material.WATER);
    return ModBlocks.registerBlock(block, new ItemBlock(block){
        @Override
        public String getItemStackDisplayName(ItemStack stack)
                {
                    return Lang.translateToLocal(this.getUnlocalizedNameInefficiently(stack)).trim();
                }
            }, fluid.getName());
}
项目:CrystalMod    文件:ModFluids.java   
public static BlockFluidBase registerMoltenBlock(Fluid fluid) {
    BlockFluidBase block = new BlockCrystalFluid(fluid, net.minecraft.block.material.Material.LAVA);
    return ModBlocks.registerBlock(block, new ItemBlock(block){
        @Override
        public String getItemStackDisplayName(ItemStack stack)
        {
            return Lang.translateToLocal(this.getUnlocalizedNameInefficiently(stack)).trim();
        }
    }, fluid.getName());
}
项目:Toms-Mod    文件:TileEntityPump.java   
private void checkFluidBlocks(BlockPos pos) {
    if (pos.getY() < 2) {
        lvl = 0;
        return;
    }
    fluidBlocks.clear();
    IBlockState stateB = world.getBlockState(pos);
    if (stateB.getBlock() instanceof BlockFluidBase || stateB.getBlock() instanceof BlockLiquid) {
        Stack<BlockPos> nextPos = new Stack<>();
        nextPos.add(pos);
        while (!nextPos.isEmpty()) {
            BlockPos p = nextPos.pop();
            if (!fluidBlocks.contains(p) && p.distanceSq(this.pos) < 4096) {
                fluidBlocks.add(p);
                for (EnumFacing f : EnumFacing.HORIZONTALS) {
                    if (!fluidBlocks.contains(p.offset(f))) {
                        IBlockState stateB2 = world.getBlockState(p.offset(f));
                        if (stateB2.getBlock() instanceof BlockFluidBase || stateB2.getBlock() instanceof BlockLiquid) {
                            nextPos.add(p.offset(f));
                        }
                    }
                }
            }
        }
    } else if (stateB.getMaterial() != Material.AIR) {
        lvl = 0;
    }
}
项目:LightningCraft    文件:LCFluids.java   
/** Make sure to set up the rendering info */
@SideOnly(Side.CLIENT)
public static void registerRendering() {
    for(Fluid fluid : fluidBlocks.keySet()) {
        BlockFluidBase block = fluidBlocks.get(fluid);
        final ModelResourceLocation fluidModelLocation = new ModelResourceLocation(
                RefStrings.MODID + ":" + fluidBlockNames.get(block), "fluid");
        ModelLoader.setCustomStateMapper(block, new StateMapperBase() {
            @Override
            protected ModelResourceLocation getModelResourceLocation(IBlockState state) {
                return fluidModelLocation;
            }
        });
    }
}
项目:Connected    文件:SchematicBlock.java   
@Override
public BuildingStage getBuildStage () {
    if (block instanceof BlockFalling) {
        return BuildingStage.SUPPORTED;
    } else if (block instanceof BlockFluidBase || block instanceof BlockLiquid) {
        return BuildingStage.EXPANDING;
    } else if (block.isOpaqueCube()) {
        return BuildingStage.STANDALONE;
    } else {
        return BuildingStage.SUPPORTED;
    }
}
项目:BaseMetals    文件:Fluids.java   
private static BlockFluidBase registerFluidBlock(Fluid f, BlockFluidBase block, String name) {
    block.setUnlocalizedName(BaseMetals.MODID+"."+name);
    GameRegistry.registerBlock(block, name);
    block.setCreativeTab(CreativeTabs.MISC);
    FluidRegistry.addBucketForFluid(f);
    fluidBlocks.put(f, block);
    fluidBlockNames.put(block, name);
    return block;
}
项目:Framez    文件:SchematicBlock.java   
@Override
public BuildingStage getBuildStage () {
    if (block instanceof BlockFalling) {
        return BuildingStage.SUPPORTED;
    } else if (block instanceof BlockFluidBase || block instanceof BlockLiquid) {
        return BuildingStage.EXPANDING;
    } else if (block.isOpaqueCube()) {
        return BuildingStage.STANDALONE;
    } else {
        return BuildingStage.SUPPORTED;
    }
}
项目:HCoreLib    文件:FluidFactory.java   
/**
 * Creates and resturns fluid object if successful, else returns null.
 *
 * @param name name of fluid.
 * @param still ResourceLocation.
 * @param flowing ResourceLocation.
 * @param fluidBlock block fluid uses if applicable.
 * @param rarity rarity of fluid.
 * @return fluid object.
 */
public static Fluid createNewFluid(String name, ResourceLocation still, ResourceLocation flowing, BlockFluidBase fluidBlock, EnumRarity rarity) {
    if (name != null && name.length() > 0) {
        Fluid fluid = new Fluid(name, still, flowing);
        if (fluidBlock != null) fluid.setBlock(fluidBlock);
        fluid.setRarity(rarity);

        return fluid;
    }

    return null;
}
项目:IgnitionUtilities    文件:IGL_Utils.java   
public static boolean canBreak(Block block,World w, int x, int y,int z){
    if(block == Blocks.air)return false;
    if(block instanceof BlockLiquid)return false;
    if(block instanceof BlockFluidBase)return false;
    if(Block.isEqualTo(block,Blocks.mob_spawner))return false;
    if(block == Blocks.portal)return false;
    if(block == Blocks.end_portal)return false;
    if(block == Blocks.end_portal_frame)return false;
    if(block.getBlockHardness(w, x, y, z) == -1)return false;
    return true;
}
项目:PowerAdvantageAPI    文件:Blocks.java   
/**
 * Adds fluid block models to the game and applies them to the fluid blocks
 */
@SideOnly(Side.CLIENT)
public static void bakeModels(){
    String modID = PowerAdvantage.MODID;
    for(Map.Entry<String,Block> e : allBlocks.entrySet()){
        Block b = e.getValue();
        String name = e.getKey();
        if(b instanceof BlockFluidBase){
            BlockFluidBase block = (BlockFluidBase)b;
            Fluid fluid = block.getFluid();
            Item item = Item.getItemFromBlock(block);
            final ModelResourceLocation fluidModelLocation = new ModelResourceLocation(
                    modID.toLowerCase() + ":" + name, "fluid");
            ModelBakery.registerItemVariants(item);
            ModelLoader.setCustomMeshDefinition(item, new ItemMeshDefinition()
            {
                public ModelResourceLocation getModelLocation(ItemStack stack)
                {
                    return fluidModelLocation;
                }
            });
            ModelLoader.setCustomStateMapper(block, new StateMapperBase()
            {
                protected ModelResourceLocation getModelResourceLocation(IBlockState state)
                {
                    return fluidModelLocation;
                }
            });
        }
    }
}
项目:PowerAdvantageAPI    文件:Blocks.java   
private static Block addBlock(Block block, String name ){
    block.setUnlocalizedName(PowerAdvantage.MODID+"."+name);
    GameRegistry.registerBlock(block, name);
    if((block instanceof BlockFluidBase) == false)block.setCreativeTab(ItemGroups.tab_powerAdvantage);
    allBlocks.put(name, block);
    return block;
}
项目:PowerAdvantageAPI    文件:ModSupport.java   
private static Block addBlock(Block block, String name ){
    block.setUnlocalizedName(PowerAdvantage.MODID+"."+name);
    GameRegistry.registerBlock(block, name);
    if((block instanceof BlockFluidBase) == false)block.setCreativeTab(ItemGroups.tab_powerAdvantage);
    allBlocks.put(name, block);
    return block;
}
项目:hcables    文件:SchematicBlock.java   
@Override
public BuildingStage getBuildStage () {
    if (block instanceof BlockFalling) {
        return BuildingStage.SUPPORTED;
    } else if (block instanceof BlockFluidBase || block instanceof BlockLiquid) {
        return BuildingStage.EXPANDING;
    } else if (block.isOpaqueCube()) {
        return BuildingStage.STANDALONE;
    } else {
        return BuildingStage.SUPPORTED;
    }
}
项目:IceAndShadow2    文件:NyxBlockWater.java   
@Override
public void updateTick(World world, int x, int y, int z, Random rand) {
    super.updateTick(world, x, y, z, rand);
    final Block bl = world.getBlock(x, y - 1, z);
    if (!world.isRemote && !(bl instanceof BlockFluidBase)
            && bl.getHarvestLevel(world.getBlockMetadata(x, y - 1, z)) < rand.nextInt(2)) {
        IaSBlockHelper.breakBlock(world, x, y - 1, z, false);
    }
}
项目:EarliestOfGames    文件:FluidHelper.java   
public static int getQuantaPerBlock(Block block)
{
    if (block instanceof BlockFluidBase)
        return Wrappers.getQuantaPerBlock((BlockFluidBase) block);
    else
    {
        if (isBlockWater(block))
            return 8;
        else if (isBlockLava(block))
            return 8;
    }
    return 0;
}
项目:EarliestOfGames    文件:FluidFlow.java   
public int getQuantaRemaining()
{
    int quantaPerBlock = 8;

    if (fluid != FluidRegistry.WATER || fluid != FluidRegistry.LAVA && fluid.getBlock() instanceof BlockFluidBase)
        quantaPerBlock = Wrappers.getQuantaPerBlock((BlockFluidBase) fluid.getBlock());

    return Math.max(0, quantaPerBlock - flowDecay);
}
项目:EarliestOfGames    文件:Wrappers.java   
public static int getQuantaPerBlock(BlockFluidBase fluidBlock)
{
    try
    {
        return quantaPerBlock.getInt(fluidBlock);
    }
    catch (Exception e)
    {
        e.printStackTrace();
        return 0;
    }
}
项目:PneumaticCraft    文件:ItemBlockPneumaticCraft.java   
public ItemBlockPneumaticCraft(Block block){
    super(block);
    if(block instanceof BlockPneumaticCraft) {
        this.block = (BlockPneumaticCraft)block;
    } else {
        if(!(block instanceof BlockPneumaticPlantBase) && !(block instanceof BlockAir) && !(block instanceof BlockFluidBase)) {
            Log.warning("Block " + block.getUnlocalizedName() + " does not extend BlockPneumaticCraft! No tooltip displayed");
        }
    }
}