本文整理汇总了Java中net.minecraft.world.World.getBlockLightValue方法的典型用法代码示例。如果您正苦于以下问题:Java World.getBlockLightValue方法的具体用法?Java World.getBlockLightValue怎么用?Java World.getBlockLightValue使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类net.minecraft.world.World
的用法示例。
在下文中一共展示了World.getBlockLightValue方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: onUpdate
import net.minecraft.world.World; //导入方法依赖的package包/类
@Override
public void onUpdate(ItemStack stack, World world, Entity entity, int animTick, boolean holdingItem) // Overhauled default
{
if (world.isRemote) { return; } // Not doing this on client side
int light = world.getBlockLightValue((int) entity.posX, (int) entity.posY + 1, (int) entity.posZ);
if (light >= this.LightMin)
{
if (this.getCooldown(stack) > 0) { this.setCooldown(stack, this.getCooldown(stack) - 1); } // Cooling down
if (this.getCooldown(stack) == 1) { this.doCooldownSFX(world, entity); } // One tick before cooldown is done with, so SFX now
}
}
示例2: get
import net.minecraft.world.World; //导入方法依赖的package包/类
@Override
@Callback
public Object[] get(Context context, Arguments args, World worldIn, TileEntitySensor teIn) {
if (args.checkString(0).equalsIgnoreCase("biome")) {
return new Object[] { worldIn.getBiomeGenForCoords((teIn.xCoord + rangeLimit(args.optInteger(1, 0))), (teIn.zCoord + rangeLimit(args.optInteger(1, 0)))).biomeName };
} else if (args.checkString(0).equalsIgnoreCase("lightlevel")) {
return new Object[] { worldIn.getBlockLightValue((teIn.xCoord + rangeLimit(args.optInteger(1, 0))), (teIn.yCoord + rangeLimit(rangeLimit(args.optInteger(1, 0)))), (teIn.zCoord + rangeLimit(args.optInteger(1, 0)))) };
} else if (args.checkString(0).equalsIgnoreCase("raining")) {
return new Object[] { worldIn.isRaining() };
} else if (args.checkString(0).equalsIgnoreCase("thundering")) {
return new Object[] { worldIn.isThundering() };
} else if (args.checkString(0).equalsIgnoreCase("daytime")) {
return new Object[] { worldIn.isDaytime() };
} else if (args.checkString(0).equalsIgnoreCase("moonphase")) {
return new Object[] { worldIn.getCurrentMoonPhaseFactor() };
} else if (args.checkString(0).equalsIgnoreCase("celestialangle")) {
return new Object[] { worldIn.getCelestialAngle(1.0F)};
} else if (args.checkString(0).equalsIgnoreCase("dimension")) {
return new Object[] { worldIn.getWorldInfo().getVanillaDimension()};
} else if (args.checkString(0).equalsIgnoreCase("temperature") || args.checkString(0).equalsIgnoreCase("temp")) {
return new Object[] { worldIn.getBiomeGenForCoords((teIn.xCoord + rangeLimit(args.optInteger(1, 0))), (teIn.zCoord + rangeLimit(args.optInteger(1, 0)))).temperature};
} else if (args.checkString(0).equalsIgnoreCase("highhumidity")) {
return new Object[] { worldIn.getBiomeGenForCoords((teIn.xCoord + rangeLimit(args.optInteger(1, 0))), (teIn.zCoord + rangeLimit(args.optInteger(1, 0)))).isHighHumidity()};
} else if (args.checkString(0).equalsIgnoreCase("humidity")) {
return new Object[] { worldIn.getBiomeGenForCoords((teIn.xCoord + rangeLimit(args.optInteger(1, 0))), (teIn.zCoord + rangeLimit(args.optInteger(1, 0)))).rainfall};
} else if (args.checkString(0).equalsIgnoreCase("worldseed")) {
return new Object[] { worldIn.getSeed()};
}
return new Object[] { "No method passed, or not found" };
}