本文整理汇总了Java中net.minecraftforge.fluids.BlockFluidClassic类的典型用法代码示例。如果您正苦于以下问题:Java BlockFluidClassic类的具体用法?Java BlockFluidClassic怎么用?Java BlockFluidClassic使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
BlockFluidClassic类属于net.minecraftforge.fluids包,在下文中一共展示了BlockFluidClassic类的13个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: setFluid
import net.minecraftforge.fluids.BlockFluidClassic; //导入依赖的package包/类
public EngineNiard setFluid(Fluid fluid) {
if (fluid.canBePlacedInWorld()) {
this.radiusItr = radius >= 0 ? new RadiusIterator(owner.getLocation(), radius) : null;
this.fluid = fluid;
this.downflowDirection = fluid.getDensity() > 0 ? ForgeDirection.DOWN : ForgeDirection.UP;
block = fluid.getBlock();
if (block instanceof BlockFluidClassic) {
type = FluidType.CLASSIC;
} else if (block instanceof BlockFluidFinite) {
type = FluidType.FINITE;
} else if (block instanceof BlockLiquid) {
type = FluidType.VANILLA;
} else {
this.fluid = null;
}
} else {
this.fluid = null;
}
return this;
}
示例2: setSourceBlock
import net.minecraftforge.fluids.BlockFluidClassic; //导入依赖的package包/类
private void setSourceBlock(BlockCoord bc) {
Block blockToSet = block;
int metaToSet = 0;
final World world = owner.getWorldObj();
switch (type) {
case CLASSIC:
metaToSet = ((BlockFluidClassic) block).getMaxRenderHeightMeta();
break;
case FINITE:
metaToSet = ((BlockFluidFinite) block).getMaxRenderHeightMeta();
break;
case VANILLA:
if (world.provider.isHellWorld && fluid == FluidRegistry.WATER && !niardAllowWaterInHell.getBoolean()) {
world.playSoundEffect(bc.x + 0.5F, bc.y + 0.1F, bc.z + 0.5F, "random.fizz", 0.5F, 2.6F + (world.rand.nextFloat() - world.rand.nextFloat()) * 0.8F);
for (int l = 0; l < 8; ++l) {
spawnParticle(world, "largesmoke", bc.x - 1 + 3 * Math.random(), bc.y + Math.random(), bc.z - 1 + 3 * Math.random(), 0.0D, 0.0D, 0.0D);
}
setVerticalBlock(bc, false);
return;
}
metaToSet = 0;
break;
}
world.setBlock(bc.x, bc.y, bc.z, blockToSet, metaToSet, 3);
}
示例3: FluidHelper
import net.minecraftforge.fluids.BlockFluidClassic; //导入依赖的package包/类
private FluidHelper(@Nonnull World world, @Nonnull FluidStack stack, @Nullable BlockCoord startbc) throws Exception {
this.world = world;
this.stack = stack;
this.fluid = notnullF(stack.getFluid(), "FluidStack.getFluid()");
this.block = notnull(fluid.getBlock(), "Invalid Fluid (it has no source block)");
this.downflowDirection = fluid.getDensity() > 0 ? ForgeDirection.DOWN : ForgeDirection.UP;
this.upflowDirection = downflowDirection == ForgeDirection.UP ? ForgeDirection.DOWN : ForgeDirection.UP;
if (this.block instanceof BlockFluidClassic) {
this.type = FluidType.CLASSIC;
} else if (this.block instanceof BlockFluidFinite) {
this.type = FluidType.FINITE;
} else if (this.block instanceof BlockLiquid) {
this.type = FluidType.VANILLA;
} else {
throw new Exception();
}
this.startbc = startbc;
}
示例4: randomTick
import net.minecraftforge.fluids.BlockFluidClassic; //导入依赖的package包/类
@Override
public void randomTick(World worldIn, BlockPos pos, IBlockState state, Random random) {
if (state.getBlock() instanceof BlockFluidClassic && ((BlockFluidClassic) state.getBlock()).isSourceBlock(worldIn, pos)) {
worldIn.setBlockToAir(pos);
EntityPinkSlime pinkSlime = new EntityPinkSlime(worldIn);
pinkSlime.setPosition(pos.getX() + 0.5, pos.getY(), pos.getZ() + 0.5);
worldIn.spawnEntity(pinkSlime);
}
}
示例5: registerBlocks
import net.minecraftforge.fluids.BlockFluidClassic; //导入依赖的package包/类
@SubscribeEvent
public static void registerBlocks(RegistryEvent.Register<Block> event)
{
event.getRegistry().register(new BlockButter());
event.getRegistry().register(new BlockMemeOre());
event.getRegistry().register(new BlockFluidClassic(ModFluids.liquid_butter, MaterialLiquid.WATER).setRegistryName("liquid_butter").setUnlocalizedName("liquid_butter").setCreativeTab(BetterThanWeagles.tabBTWeagles));
}
示例6: create
import net.minecraftforge.fluids.BlockFluidClassic; //导入依赖的package包/类
public static ItemBucketCrystalMod create(BlockFluidClassic block, Fluid fluid) {
ItemBucketCrystalMod b = new ItemBucketCrystalMod(block != null ? block : Blocks.AIR, fluid.getName());
b.init();
//FluidContainerRegistry.registerFluidContainer(fluid, new ItemStack(b), new ItemStack(Items.BUCKET));
/*if (block != null) {
BucketHandler.instance.registerFluid(block, b);
}*/
return b;
}
示例7: registerFluidBlock
import net.minecraftforge.fluids.BlockFluidClassic; //导入依赖的package包/类
/** Register a fluid block with the specified fluid */
private static BlockFluidClassic registerFluidBlock(Fluid fluid, String blockName) {
BlockFluidClassic block = new BlockFluidLC(fluid);
ResourceLocation location = new ResourceLocation(RefStrings.MODID, blockName);
block.setRegistryName(location);
block.setUnlocalizedName(location.toString());
GameRegistry.register(block);
fluidBlocks.put(fluid, block);
fluidBlockNames.put(block, blockName);
return block;
}
示例8: isFlowingBlock
import net.minecraftforge.fluids.BlockFluidClassic; //导入依赖的package包/类
private boolean isFlowingBlock(@Nonnull BlockCoord bc) {
switch (type) {
case CLASSIC:
return !((BlockFluidClassic) block).isSourceBlock(owner.getWorldObj(), bc.x, bc.y, bc.z);
case FINITE:
return false;
case VANILLA:
return owner.getWorldObj().getBlockMetadata(bc.x, bc.y, bc.z) != 0;
}
throw new IllegalStateException("unreachable code");
}
示例9: isSourceBlock
import net.minecraftforge.fluids.BlockFluidClassic; //导入依赖的package包/类
public static boolean isSourceBlock(@Nonnull World world, @Nonnull BlockCoord bc) {
if (!world.blockExists(bc.x, bc.y, bc.z)) {
return false;
}
Block block = bc.getBlock(world);
if (block instanceof BlockFluidClassic) {
return ((BlockFluidClassic) block).isSourceBlock(world, bc.x, bc.y, bc.z);
} else if (block instanceof BlockFluidFinite) {
return ((BlockFluidFinite)block).canDrain(world, bc.x, bc.y, bc.z);
} else if (block instanceof BlockLiquid) {
return world.getBlockMetadata(bc.x, bc.y, bc.z) == 0;
} else {
return false;
}
}
示例10: isFlowingBlock
import net.minecraftforge.fluids.BlockFluidClassic; //导入依赖的package包/类
public boolean isFlowingBlock(@Nonnull BlockCoord bc) {
switch (type) {
case CLASSIC:
return !((BlockFluidClassic) block).isSourceBlock(world, bc.x, bc.y, bc.z);
case FINITE:
return false;
case VANILLA:
return world.getBlockMetadata(bc.x, bc.y, bc.z) != 0;
}
throw new IllegalStateException("unreachable code");
}
示例11: fillOreBucket
import net.minecraftforge.fluids.BlockFluidClassic; //导入依赖的package包/类
private ItemStack fillOreBucket(World world, MovingObjectPosition target) {
Block targetBlock = world.getBlock(target.blockX, target.blockY, target.blockZ);
if (!(targetBlock instanceof BlockFluidClassic)) {
return null;
}
ItemStack filledBucket = FluidContainerRegistry.fillFluidContainer(new FluidStack(((BlockFluidClassic)targetBlock).getFluid(), 1000), new ItemStack(net.minecraft.init.Items.bucket));
if (filledBucket != null && world.getBlockMetadata(target.blockX, target.blockY, target.blockZ) == 0) {
world.setBlockToAir(target.blockX, target.blockY, target.blockZ);
return filledBucket;
}
else {
return null;
}
}
示例12: registerFluid
import net.minecraftforge.fluids.BlockFluidClassic; //导入依赖的package包/类
private static void registerFluid(BlockFluidClassic fluid) {
final ModelResourceLocation location = new ModelResourceLocation(TRConstants.MOD_ID + ":fluids", fluid.getFluid().getName().toLowerCase());
ModelLoader.setCustomStateMapper(fluid, new StateMapperBase() {
protected ModelResourceLocation getModelResourceLocation(IBlockState state) { return location; }
});
}
示例13: generate
import net.minecraftforge.fluids.BlockFluidClassic; //导入依赖的package包/类
@Override
public boolean generate (World world, Random random, int startX, int startY, int startZ)
{
if (alterSize)
{
startY = world.getHeightValue(startX, startZ);
}
float f = random.nextFloat() * (float) Math.PI;
int blockNumber = numberOfBlocks;
if (alterSize)
blockNumber = numberOfBlocks * 2 / 5 + random.nextInt(numberOfBlocks * 3 / 5);
double d0 = (double) ((float) (startX + 8) + MathHelper.sin(f) * (float) blockNumber / 8.0F);
double d1 = (double) ((float) (startX + 8) - MathHelper.sin(f) * (float) blockNumber / 8.0F);
double d2 = (double) ((float) (startZ + 8) + MathHelper.cos(f) * (float) blockNumber / 8.0F);
double d3 = (double) ((float) (startZ + 8) - MathHelper.cos(f) * (float) blockNumber / 8.0F);
double d4 = (double) (startY + random.nextInt(3) - 2);
double d5 = (double) (startY + random.nextInt(3) - 2);
for (int l = 0; l <= blockNumber; ++l)
{
double d6 = d0 + (d1 - d0) * (double) l / (double) blockNumber;
double d7 = d4 + (d5 - d4) * (double) l / (double) blockNumber;
double d8 = d2 + (d3 - d2) * (double) l / (double) blockNumber;
double d9 = random.nextDouble() * (double) blockNumber / 16.0D;
double d10 = (double) (MathHelper.sin((float) l * (float) Math.PI / (float) blockNumber) + 1.0F) * d9 + 1.0D;
double d11 = (double) (MathHelper.sin((float) l * (float) Math.PI / (float) blockNumber) + 1.0F) * d9 + 1.0D;
int i1 = MathHelper.floor_double(d6 - d10 / 2.0D);
int j1 = MathHelper.floor_double(d7 - d11 / 2.0D);
int k1 = MathHelper.floor_double(d8 - d10 / 2.0D);
int l1 = MathHelper.floor_double(d6 + d10 / 2.0D);
int i2 = MathHelper.floor_double(d7 + d11 / 2.0D);
int j2 = MathHelper.floor_double(d8 + d10 / 2.0D);
for (int k2 = i1; k2 <= l1; ++k2)
{
double d12 = ((double) k2 + 0.5D - d6) / (d10 / 2.0D);
if (d12 * d12 < 1.0D)
{
for (int l2 = j1; l2 <= i2; ++l2)
{
double d13 = ((double) l2 + 0.5D - d7) / (d11 / 2.0D);
if (d12 * d12 + d13 * d13 < 1.0D)
{
for (int i3 = k1; i3 <= j2; ++i3)
{
double d14 = ((double) i3 + 0.5D - d8) / (d10 / 2.0D);
Block block = world.getBlock(k2, l2, i3);
if (d12 * d12 + d13 * d13 + d14 * d14 < 1.0D)
{
if (block == null && world.getBlock(k2, l2-1, i3).isOpaqueCube() || !world.getBlock(k2, l2, i3).isOpaqueCube() && world.getBlock(k2, l2-1, i3).isOpaqueCube()) {
if(minableBlock.canPlaceBlockAt(world, k2, l2, i3) && !(world.getBlock(k2, l2, i3) instanceof BlockLiquid) && !(world.getBlock(k2, l2, i3) instanceof BlockFluidClassic)) {
if(minableBlock instanceof BlockBasicBush && !BlockBasicBush.isWaterNearby(world, k2, l2, i3)) {return false;}
else {
world.setBlock(k2, l2, i3, this.minableBlock, minableBlockMeta, 2);
world.scheduleBlockUpdate(k2, l2, i3, world.getBlock(k2, l2, i3), 1);
}
}
}
}
}
}
}
}
}
}
return true;
}