本文整理汇总了Java中net.minecraft.world.World.getTotalWorldTime方法的典型用法代码示例。如果您正苦于以下问题:Java World.getTotalWorldTime方法的具体用法?Java World.getTotalWorldTime怎么用?Java World.getTotalWorldTime使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类net.minecraft.world.World
的用法示例。
在下文中一共展示了World.getTotalWorldTime方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: coolHeatSinks
import net.minecraft.world.World; //导入方法依赖的package包/类
private void coolHeatSinks(World world, BlockPos pos, int range) {
if (grateRange > 2) {
int curTeIndex = (int) (world.getTotalWorldTime() % 27);
BlockPos curPos = pos.offset(dir, 2).add(-1 + curTeIndex % 3, -1 + curTeIndex / 3 % 3, -1 + curTeIndex / 9 % 3);
TileEntity te = world.getTileEntity(curPos);
if (te instanceof TileEntityHeatSink) heatSinks.add((TileEntityHeatSink) te);
Iterator<TileEntityHeatSink> iterator = heatSinks.iterator();
while (iterator.hasNext()) {
TileEntityHeatSink heatSink = iterator.next();
if (heatSink.isInvalid()) {
iterator.remove();
} else {
for (int i = 0; i < 4; i++)
heatSink.onFannedByAirGrate();
}
}
}
}
示例2: markTimeIfDelay
import net.minecraft.world.World; //导入方法依赖的package包/类
/** Return true if a given delay has passed since last time marked was called successfully. */
public boolean markTimeIfDelay(World world, long delay) {
if (world == null) {
return false;
}
long currentTime = world.getTotalWorldTime();
if (currentTime < lastMark) {
lastMark = currentTime;
return false;
} else if (lastMark + delay + lastRandomDelay <= currentTime) {
duration = currentTime - lastMark;
lastMark = currentTime;
lastRandomDelay = (int) (Math.random() * randomRange);
return true;
} else {
return false;
}
}
示例3: entityJamTest
import net.minecraft.world.World; //导入方法依赖的package包/类
private void entityJamTest(World world)
{
if(world.getTotalWorldTime() % 10 != 0)
return;
int dimension = CommonUtils.getDimension(world);
for(Iterator<BlockPos> iterator = ethers.get(dimension).jammerset.iterator(); iterator.hasNext();)
{
BlockPos jammer = iterator.next();
List<Entity> entitiesinrange = world.getEntitiesWithinAABBExcludingEntity(null, new AxisAlignedBB(jammer.getX()-9.5, jammer.getY()-9.5, jammer.getZ()-9.5, jammer.getX()+10.5, jammer.getY()+10.5, jammer.getZ()+10.5));
for(Iterator<Entity> iterator2 = entitiesinrange.iterator(); iterator2.hasNext();)
{
Entity entity = iterator2.next();
if(!(entity instanceof EntityLivingBase))
continue;
if(entity instanceof EntityPlayer)
if(isPlayerJammed((EntityPlayer)entity))
continue;
jamEntitySometime((EntityLivingBase) entity);
}
}
}
示例4: onDrink
import net.minecraft.world.World; //导入方法依赖的package包/类
@Override
public void onDrink(World world, BlockPos pos, FluidStack stack, EntityPlayer player, boolean fromFluidContainer) {
player.extinguish();
NBTTagCompound tag = player.getEntityData();
if (tag.hasKey("lavaDrink") && world.getTotalWorldTime() - tag.getLong("lavaDrink") < 120) { //6 Seconds to drink water after drinking lava to create obsidian
player.entityDropItem(new ItemStack(Blocks.OBSIDIAN), player.getEyeHeight());
tag.setLong("lavaDrink", 0);
world.playSound(null, player.posX, player.posY, player.posZ, SoundEvents.ENTITY_PLAYER_BURP, SoundCategory.PLAYERS, 1.5F, world.rand.nextFloat() * 0.1F + 0.9F);
}
}
示例5: spawnFlowers
import net.minecraft.world.World; //导入方法依赖的package包/类
@SubscribeEvent
public void spawnFlowers(PlayerTickEvent evt) {
if (evt.side == Side.SERVER && evt.phase == Phase.START) {
World w = evt.player.world;
if (w.getTotalWorldTime() % 20 == 0 && validBiomesMoonBell.contains(w.getBiome(evt.player.getPosition()))) {
Random r = evt.player.getRNG();
if (w.provider.getDimension() == 0 && w.provider.getMoonPhase(w.getWorldTime()) == 4 && !w.isDaytime() && evt.player.getRNG().nextDouble() < 0.2) {
int dx = (r.nextInt(7) - 3) * 10;
int dz = (r.nextInt(7) - 3) * 10;
MutableBlockPos pos = new MutableBlockPos(evt.player.getPosition().add(dx, 0, dz));
tryAndSpawn(w, pos);
}
}
}
}
示例6: randomJamTest
import net.minecraft.world.World; //导入方法依赖的package包/类
private void randomJamTest(World world)
{
if(world.getTotalWorldTime() % 600 != 0)//30 seconds
return;
for(Entry<Integer, DimensionalEtherHash> entry : ethers.entrySet())
if(entry.getValue().jammerset != null)
for(Iterator<BlockPos> iterator = entry.getValue().jammerset.iterator(); iterator.hasNext();)
jamNodesInAOEOfJammer(world, iterator.next(), entry.getKey());
}
示例7: getWheelColor
import net.minecraft.world.World; //导入方法依赖的package包/类
/**
* This function is presented to you by you neat helper in every situation, Actually Additions
* @param world The world the player does live in
* @return The coloration of something
*/
@SideOnly(Side.CLIENT)
public static float[] getWheelColor(World world){
long time = world.getTotalWorldTime() % 256;
if(time < 85){
return new float[]{time * 3.0F, 255.0f - time * 3.0f, 0.0f};
}
if(time < 170){
return new float[]{255.0f - (time -= 85) * 3.0f, 0.0f, time * 3.0f};
}
return new float[]{0.0f, (time -= 170) * 3.0f, 255.0f - time * 3.0f};
}
示例8: updateTick
import net.minecraft.world.World; //导入方法依赖的package包/类
public void updateTick(World worldIn, BlockPos pos, IBlockState state, Random rand)
{
boolean flag = this.shouldBeOff(worldIn, pos, state);
List<BlockRedstoneTorch.Toggle> list = (List)toggles.get(worldIn);
while (list != null && !list.isEmpty() && worldIn.getTotalWorldTime() - ((BlockRedstoneTorch.Toggle)list.get(0)).time > 60L)
{
list.remove(0);
}
if (this.isOn)
{
if (flag)
{
worldIn.setBlockState(pos, Blocks.unlit_redstone_torch.getDefaultState().withProperty(FACING, state.getValue(FACING)), 3);
if (this.isBurnedOut(worldIn, pos, true))
{
worldIn.playSoundEffect((double)((float)pos.getX() + 0.5F), (double)((float)pos.getY() + 0.5F), (double)((float)pos.getZ() + 0.5F), "random.fizz", 0.5F, 2.6F + (worldIn.rand.nextFloat() - worldIn.rand.nextFloat()) * 0.8F);
for (int i = 0; i < 5; ++i)
{
double d0 = (double)pos.getX() + rand.nextDouble() * 0.6D + 0.2D;
double d1 = (double)pos.getY() + rand.nextDouble() * 0.6D + 0.2D;
double d2 = (double)pos.getZ() + rand.nextDouble() * 0.6D + 0.2D;
worldIn.spawnParticle(EnumParticleTypes.SMOKE_NORMAL, d0, d1, d2, 0.0D, 0.0D, 0.0D, new int[0]);
}
worldIn.scheduleUpdate(pos, worldIn.getBlockState(pos).getBlock(), 160);
}
}
}
else if (!flag && !this.isBurnedOut(worldIn, pos, false))
{
worldIn.setBlockState(pos, Blocks.redstone_torch.getDefaultState().withProperty(FACING, state.getValue(FACING)), 3);
}
}
示例9: onUpdate
import net.minecraft.world.World; //导入方法依赖的package包/类
@Override
public void onUpdate(ItemStack stack, World worldIn, Entity entityIn, int itemSlot, boolean isSelected)
{
if(isOn(stack))
{
Shield sh = getShield(stack);
if(entityIn instanceof EntityPlayer)
{
sh.update(stack, (EntityPlayer) entityIn);
ItemStack active = EntityUtil.getActivePlayerShield((EntityPlayer) entityIn);
ItemAnimaShield sI = (ItemAnimaShield) active.getItem();
if(!active.equals(stack) && sI.isOn(active))
{
setOff(stack, (EntityPlayer) entityIn);
}
}
if(!stack.isEmpty())
{
stack.getTagCompound().setTag("shield", sh.serialize());
super.onUpdate(stack, worldIn, entityIn, itemSlot, isSelected);
}
if(worldIn.getTotalWorldTime() % 40 == 0)
this.removeCharge(stack, 1);
if(getCurrentCharge(stack) == 0 && entityIn instanceof EntityPlayer)
{
setOff(stack, (EntityPlayer) entityIn);
}
}
}
示例10: getWorldTime
import net.minecraft.world.World; //导入方法依赖的package包/类
@Override
protected long getWorldTime()
{
World world = null;
MinecraftServer server = MinecraftServer.getServer();
if (server.worldServers != null && server.worldServers.length != 0)
world = server.getEntityWorld();
return (world != null) ? world.getTotalWorldTime() : 0;
}
示例11: onWorldUpdate
import net.minecraft.world.World; //导入方法依赖的package包/类
@SubscribeEvent
public void onWorldUpdate(PlayerTickEvent event) {
EntityPlayer player = event.player;
World world = player.world;
if (!world.isRemote || world.getTotalWorldTime() % 2 != 0) {
return;
}
EntityPlayerSP playerSp = (EntityPlayerSP) player;
resetOverlays();
if (wearingHelmet()) {
updateAreaScan(playerSp, world);
} else {
cursorOverlay = null;
}
PowerMeterGui.INSTANCE.setPower(0);
if (holdingProbe()) {
updateOverlayUnderCursor(world, playerSp);
} else {
if (cursorOverlay != null) {
cursorOverlay.pos = null;
}
}
}
示例12: updateTick
import net.minecraft.world.World; //导入方法依赖的package包/类
public void updateTick(World worldIn, BlockPos pos, IBlockState state, Random rand)
{
boolean flag = this.shouldBeOff(worldIn, pos, state);
List<BlockRedstoneTorch.Toggle> list = (List)toggles.get(worldIn);
while (list != null && !list.isEmpty() && worldIn.getTotalWorldTime() - ((BlockRedstoneTorch.Toggle)list.get(0)).time > 60L)
{
list.remove(0);
}
if (this.isOn)
{
if (flag)
{
worldIn.setBlockState(pos, Blocks.UNLIT_REDSTONE_TORCH.getDefaultState().withProperty(FACING, state.getValue(FACING)), 3);
if (this.isBurnedOut(worldIn, pos, true))
{
worldIn.playSound((EntityPlayer)null, pos, SoundEvents.BLOCK_REDSTONE_TORCH_BURNOUT, SoundCategory.BLOCKS, 0.5F, 2.6F + (worldIn.rand.nextFloat() - worldIn.rand.nextFloat()) * 0.8F);
for (int i = 0; i < 5; ++i)
{
double d0 = (double)pos.getX() + rand.nextDouble() * 0.6D + 0.2D;
double d1 = (double)pos.getY() + rand.nextDouble() * 0.6D + 0.2D;
double d2 = (double)pos.getZ() + rand.nextDouble() * 0.6D + 0.2D;
worldIn.spawnParticle(EnumParticleTypes.SMOKE_NORMAL, d0, d1, d2, 0.0D, 0.0D, 0.0D, new int[0]);
}
worldIn.scheduleUpdate(pos, worldIn.getBlockState(pos).getBlock(), 160);
}
}
}
else if (!flag && !this.isBurnedOut(worldIn, pos, false))
{
worldIn.setBlockState(pos, Blocks.REDSTONE_TORCH.getDefaultState().withProperty(FACING, state.getValue(FACING)), 3);
}
}
示例13: onUpdate
import net.minecraft.world.World; //导入方法依赖的package包/类
@Override
public void onUpdate(ItemStack stack, World worldIn, Entity entityIn, int itemSlot, boolean isSelected)
{
super.onUpdate(stack, worldIn, entityIn, itemSlot, isSelected);
if (!stack.hasTagCompound() || !stack.getTagCompound().hasKey("exp.foodData"))
{
this.initDefaultNBT(stack);
}
if (worldIn.getTotalWorldTime() % 500 == 0 && entityIn != null)
{
this.checkRot(stack, worldIn, entityIn.getPosition(), 1);
}
}
示例14: onContainerTick
import net.minecraft.world.World; //导入方法依赖的package包/类
@Override
public void onContainerTick(ItemStack is, World w, BlockPos pos, TileEntity container)
{
if (w.getTotalWorldTime() % 500 == 0)
{
this.checkRot(is, w, pos, 1);
}
}
示例15: notReadyToSpawn
import net.minecraft.world.World; //导入方法依赖的package包/类
private static boolean notReadyToSpawn(World world, NemesisEntry n) {
if (n.getLastSpawned() == null) {
return false;
}
long delay = (n.getLastSpawned() + SPAWN_COOLDOWN_PERIOD) - world.getTotalWorldTime();
return delay > 0;
}