本文整理汇总了Java中net.minecraft.world.World.isRaining方法的典型用法代码示例。如果您正苦于以下问题:Java World.isRaining方法的具体用法?Java World.isRaining怎么用?Java World.isRaining使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类net.minecraft.world.World
的用法示例。
在下文中一共展示了World.isRaining方法的5个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: 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" };
}
示例2: handleFarmlandTimePassed
import net.minecraft.world.World; //导入方法依赖的package包/类
public static void handleFarmlandTimePassed(ExPFarmland farmland, long ticks, Calendar calendarReference)
{
World w = farmland.getContainer().getWorld();
BlockPos pos = farmland.getContainer().getPos();
ImmutableCalendar ref = new ImmutableCalendar(calendarReference);
EventFarmlandUpdate.Logic.Pre pre = new EventFarmlandUpdate.Logic.Pre(farmland, w, pos, ref, ticks);
if (MinecraftForge.EVENT_BUS.post(pre))
{
return;
}
ticks = pre.ticksHappened;
IBlockState above = w.getBlockState(pos.up());
TileEntity tileAbove = w.getTileEntity(pos.up());
if (tileAbove != null && tileAbove.hasCapability(ExPCropCapability.cropCap, EnumFacing.DOWN))
{
return;
}
EventFarmlandUpdate.Logic.WaterNutrientLogic wnLogic = new EventFarmlandUpdate.Logic.WaterNutrientLogic(farmland, w, pos, ref, ticks, (0.00001f * (above.getBlock() instanceof BlockVegetation ? 2 : 1)) * ticks, (1.39e-6F * (above.getBlock() instanceof BlockVegetation ? -10 : 1)) * ticks);
MinecraftForge.EVENT_BUS.post(wnLogic);
float waterLoss = wnLogic.waterLossBase;
float nutrientGain = wnLogic.nutrientGainBase;
if (w.isRaining() && w.getPrecipitationHeight(pos).getY() - 1 <= pos.getY() && !MinecraftForge.EVENT_BUS.post(new EventFarmlandUpdate.Logic.Rain(farmland, w, pos, ref, ticks)))
{
farmland.setMoisture(1);
}
else
{
farmland.setMoisture(MathHelper.clamp(farmland.getMoisture() - waterLoss, 0, 1));
}
Stream.of(EnumPlantNutrient.values()).forEach(n -> farmland.setNutrient(n, MathHelper.clamp(farmland.getNutrient(n) + nutrientGain, 0, 1)));
MinecraftForge.EVENT_BUS.post(new EventFarmlandUpdate.Logic.Post(farmland, w, pos, ref, ticks));
farmland.setDirty();
}
示例3: getRedstoneValue
import net.minecraft.world.World; //导入方法依赖的package包/类
@Override
public int getRedstoneValue(World world, BlockPos pos, int sensorRange, String textBoxText) {
return world.isRaining() ? 15 : 0;
}
示例4: updateTick
import net.minecraft.world.World; //导入方法依赖的package包/类
public void updateTick(World worldIn, BlockPos pos, IBlockState state, Random rand) {
if (worldIn.getGameRules().getBoolean("doFireTick")) {
if (!this.canPlaceBlockAt(worldIn, pos)) {
worldIn.setBlockToAir(pos);
}
Block block = worldIn.getBlockState(pos.down()).getBlock();
boolean flag = block.isFireSource(worldIn, pos.down(), EnumFacing.UP);
int i = state.getValue(AGE);
if (!flag && worldIn.isRaining() && this.canDie(worldIn, pos) && rand.nextFloat() < 0.2F + (float) i * 0.03F) {
worldIn.setBlockToAir(pos);
} else {
if (i < 15) {
state = state.withProperty(AGE, i + rand.nextInt(3) / 2);
worldIn.setBlockState(pos, state, 4);
}
worldIn.scheduleUpdate(pos, this, this.tickRate(worldIn) + rand.nextInt(10));
if (!flag) {
if (!this.canNeighborCatchFire(worldIn, pos)) {
if (!worldIn.getBlockState(pos.down()).isSideSolid(worldIn, pos.down(), EnumFacing.UP) || i > 3) {
worldIn.setBlockToAir(pos);
}
return;
}
if (!this.canCatchFire(worldIn, pos.down(), EnumFacing.UP) && i == 15 && rand.nextInt(4) == 0) {
worldIn.setBlockToAir(pos);
return;
}
}
boolean flag1 = worldIn.isBlockinHighHumidity(pos);
int j = 0;
if (flag1) {
j = -50;
}
this.tryCatchFire(worldIn, pos.east(), 300 + j, rand, i, EnumFacing.WEST);
this.tryCatchFire(worldIn, pos.west(), 300 + j, rand, i, EnumFacing.EAST);
this.tryCatchFire(worldIn, pos.down(), 250 + j, rand, i, EnumFacing.UP);
this.tryCatchFire(worldIn, pos.up(), 250 + j, rand, i, EnumFacing.DOWN);
this.tryCatchFire(worldIn, pos.north(), 300 + j, rand, i, EnumFacing.SOUTH);
this.tryCatchFire(worldIn, pos.south(), 300 + j, rand, i, EnumFacing.NORTH);
for (int k = -1; k <= 1; ++k) {
for (int l = -1; l <= 1; ++l) {
for (int i1 = -1; i1 <= 4; ++i1) {
if (k != 0 || i1 != 0 || l != 0) {
int j1 = 100;
if (i1 > 1) {
j1 += (i1 - 1) * 100;
}
BlockPos blockpos = pos.add(k, i1, l);
int k1 = this.getNeighborEncouragement(worldIn, blockpos);
if (k1 > 0) {
int l1 = (k1 + 40 + worldIn.getDifficulty().getDifficultyId() * 7) / (i + 30);
if (flag1) {
l1 /= 2;
}
if (l1 > 0 && rand.nextInt(j1) <= l1 && (!worldIn.isRaining() || !this.canDie(worldIn, blockpos))) {
int i2 = i + rand.nextInt(5) / 4;
if (i2 > 15) {
i2 = 15;
}
worldIn.setBlockState(blockpos, state.withProperty(AGE, i2), 3);
}
}
}
}
}
}
}
}
}
示例5: getMoistureAt
import net.minecraft.world.World; //导入方法依赖的package包/类
public static float getMoistureAt(World w, BlockPos pos)
{
return w.isRaining() ? 1 : IExPWorld.of(w).getOverhaulHumidity();
}