本文整理汇总了Java中net.minecraft.world.World.getWorldTime方法的典型用法代码示例。如果您正苦于以下问题:Java World.getWorldTime方法的具体用法?Java World.getWorldTime怎么用?Java World.getWorldTime使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类net.minecraft.world.World
的用法示例。
在下文中一共展示了World.getWorldTime方法的14个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: renderSky
import net.minecraft.world.World; //导入方法依赖的package包/类
public static void renderSky(World p_renderSky_0_, TextureManager p_renderSky_1_, float p_renderSky_2_, float p_renderSky_3_)
{
if (worldSkyLayers != null)
{
if (Config.getGameSettings().renderDistanceChunks >= 8)
{
int i = p_renderSky_0_.provider.getDimensionId();
if (i >= 0 && i < worldSkyLayers.length)
{
CustomSkyLayer[] acustomskylayer = worldSkyLayers[i];
if (acustomskylayer != null)
{
long j = p_renderSky_0_.getWorldTime();
int k = (int)(j % 24000L);
for (int l = 0; l < acustomskylayer.length; ++l)
{
CustomSkyLayer customskylayer = acustomskylayer[l];
if (customskylayer.isActive(p_renderSky_0_, k))
{
customskylayer.render(k, p_renderSky_2_, p_renderSky_3_);
}
}
Blender.clearBlend(p_renderSky_3_);
}
}
}
}
}
示例2: isActive
import net.minecraft.world.World; //导入方法依赖的package包/类
public boolean isActive(World p_isActive_1_, int p_isActive_2_)
{
if (this.timeBetween(p_isActive_2_, this.endFadeOut, this.startFadeIn))
{
return false;
}
else
{
if (this.days != null)
{
long i = p_isActive_1_.getWorldTime();
long j;
for (j = i - (long)this.startFadeIn; j < 0L; j += (long)(24000 * this.daysLoop))
{
;
}
int k = (int)(j / 24000L);
int l = k % this.daysLoop;
if (!this.days.isInRange(l))
{
return false;
}
}
return true;
}
}
示例3: renderSky
import net.minecraft.world.World; //导入方法依赖的package包/类
public static void renderSky(World p_renderSky_0_, TextureManager p_renderSky_1_, float p_renderSky_2_, float p_renderSky_3_)
{
if (worldSkyLayers != null)
{
if (Config.getGameSettings().renderDistanceChunks >= 8)
{
int i = p_renderSky_0_.provider.getDimensionId();
if (i >= 0 && i < worldSkyLayers.length)
{
CustomSkyLayer[] acustomskylayer = worldSkyLayers[i];
if (acustomskylayer != null)
{
long j = p_renderSky_0_.getWorldTime();
int k = (int)(j % 24000L);
for (int l = 0; l < acustomskylayer.length; ++l)
{
CustomSkyLayer customskylayer = acustomskylayer[l];
if (customskylayer.isActive(k))
{
customskylayer.render(k, p_renderSky_2_, p_renderSky_3_);
}
}
Blender.clearBlend(p_renderSky_3_);
}
}
}
}
}
示例4: onServerTick
import net.minecraft.world.World; //导入方法依赖的package包/类
@SubscribeEvent
public void onServerTick(ServerTickEvent e)
{
if(counter == 1)
{
MinecraftServer server = FMLCommonHandler.instance().getMinecraftServerInstance();
World world = server.getEntityWorld();
if(world.isRemote == false)
{
long totalTime = world.getWorldTime();
long currentTime = totalTime % 24000;
if(currentTime == 1)
{
System.out.println("Time is 0");
WorldTurn turn = WorldTurn.get(world);
int currentTurn = turn.advanceTurn();
System.out.println("New Turn!! The World Turn is now " + currentTurn);
ArrayList<EntityPlayerMP> playerList = (ArrayList<EntityPlayerMP>)(world.getMinecraftServer().getServer().getPlayerList().getPlayers());
for(int i=0; i < playerList.size(); i++)
{
EntityPlayer player = playerList.get(i);
ITurn playerTurn = player.getCapability(CapPlayerTurn.TURN_CAP, null);
playerTurn.addTurn();
}
}
}
counter = 0;
}
else
{
counter++;
}
}
示例5: updateTick
import net.minecraft.world.World; //导入方法依赖的package包/类
@Override
public void updateTick(World world, BlockPos pos, IBlockState state, Random rand) {
TileEntity te = world.getTileEntity(pos);
if (te != null && te instanceof TileCinderbella) {
TileCinderbella tile = (TileCinderbella)te;
long time = world.getWorldTime() % 24000L;
if (tile.plantedCorrect && tile.timePlanted >= (time - 6000)) {
super.updateTick(world, pos, state, rand);
return;
}
}
world.setBlockState(pos, Blocks.DEADBUSH.getDefaultState(), 2);
}
示例6: updateAnimation
import net.minecraft.world.World; //导入方法依赖的package包/类
@Override
@SideOnly(Side.CLIENT)
public void updateAnimation() {
World world = Minecraft.getMinecraft().theWorld;
if (world != null) {
long time = world.getWorldTime() % 24000L;
this.frameCounter = (int)(time / 1500);
}
TextureUtil.uploadTextureMipmap((int[][])this.framesTextureData.get(this.frameCounter), this.width, this.height, this.originX, this.originY, false, false);
}
示例7: renderSky
import net.minecraft.world.World; //导入方法依赖的package包/类
public static void renderSky(World p_renderSky_0_, TextureManager p_renderSky_1_, float p_renderSky_2_)
{
if (worldSkyLayers != null)
{
int i = p_renderSky_0_.provider.getDimensionType().getId();
if (i >= 0 && i < worldSkyLayers.length)
{
CustomSkyLayer[] acustomskylayer = worldSkyLayers[i];
if (acustomskylayer != null)
{
long j = p_renderSky_0_.getWorldTime();
int k = (int)(j % 24000L);
float f = p_renderSky_0_.getCelestialAngle(p_renderSky_2_);
float f1 = p_renderSky_0_.getRainStrength(p_renderSky_2_);
float f2 = p_renderSky_0_.getThunderStrength(p_renderSky_2_);
if (f1 > 0.0F)
{
f2 /= f1;
}
for (int l = 0; l < acustomskylayer.length; ++l)
{
CustomSkyLayer customskylayer = acustomskylayer[l];
if (customskylayer.isActive(p_renderSky_0_, k))
{
customskylayer.render(k, f, f1, f2);
}
}
float f3 = 1.0F - f1;
Blender.clearBlend(f3);
}
}
}
}
示例8: onUpdate
import net.minecraft.world.World; //导入方法依赖的package包/类
@Override
public void onUpdate(ItemStack p_77663_1_, World p_77663_2_, Entity p_77663_3_, int i, boolean p_77663_5_) {
if (!p_77663_2_.isRemote && p_77663_1_.hasTagCompound()) {
if (p_77663_1_.getTagCompound().getInteger("explode") > 0)
p_77663_1_.getTagCompound().setInteger("explode",
p_77663_1_.getTagCompound().getInteger("explode") - 1);
EntityPlayer player = (EntityPlayer) p_77663_3_;
if (p_77663_1_.getTagCompound().getInteger("wait") > 0)
// ((EntityPlayerMP)player).isChangingQuantityOnly=true;
p_77663_1_.getTagCompound().setInteger("wait", p_77663_1_.getTagCompound().getInteger("wait") - 1);
// else if (player instanceof EntityPlayerMP)
// {
// ((EntityPlayerMP)player).isChangingQuantityOnly=false;
// if(p_77663_1_.getTagCompound().getInteger("wait")==0){
// ((EntityPlayerMP)player).playerNetServerHandler.sendPacket(new
// S2FPacketSetSlot(-1, -1, player.inventory.getItemStack()));
// }
// }
if (this.isRepeatable(p_77663_1_) && i == player.inventory.currentItem
&& p_77663_1_.getTagCompound().getInteger("repeat") > 0)
if (p_77663_2_.getWorldTime() % 2 == 0 && this.allowShot(player, p_77663_1_, player.world)) {
this.use(p_77663_1_, player.world, player, 1.8f,
player.inventory.getStackInSlot(this.getSlotForUse(player, p_77663_1_)),
!(this.getType(p_77663_1_) == 4 && p_77663_1_.getTagCompound().getInteger("repeat") == 2));
p_77663_1_.getTagCompound().setInteger("repeat",
p_77663_1_.getTagCompound().getInteger("repeat") - 1);
}
}
}
示例9: getRedstoneValue
import net.minecraft.world.World; //导入方法依赖的package包/类
@Override
public int getRedstoneValue(World world, BlockPos pos, int sensorRange, String textBoxText) {
return (int) (world.getWorldTime() % 24000) / 1500;
}
示例10: setAbleToGrow
import net.minecraft.world.World; //导入方法依赖的package包/类
public void setAbleToGrow(World world) {
plantedCorrect = true;
timePlanted = world.getWorldTime();
}
示例11: canPlantCrop
import net.minecraft.world.World; //导入方法依赖的package包/类
public static boolean canPlantCrop(ItemStack stack, EntityPlayer player, World world, BlockPos pos, EnumFacing side, Block cropBlock) {
if (side != EnumFacing.UP)
return false;
if (!world.isRemote && cropBlock instanceof BlockCropsBase && !((BlockCropsBase)cropBlock).canPlantCrop()) {
UCPacketHandler.sendToNearbyPlayers(world, pos, new PacketUCEffect(EnumParticleTypes.BARRIER, pos.getX(), pos.getY() + 2, pos.getZ(), 0));
return false;
}
else if (player.canPlayerEdit(pos, side, stack) && player.canPlayerEdit(pos.offset(EnumFacing.UP), side, stack)) {
IBlockState state = world.getBlockState(pos);
if (state.getBlock().canSustainPlant(state, world, pos, EnumFacing.UP, (IPlantable)stack.getItem()) && world.isAirBlock(pos.offset(EnumFacing.UP))) {
if (cropBlock == UCBlocks.cropCollis) {
if (!world.provider.isSurfaceWorld() || pos.getY() <= 100)
return false;
}
if (cropBlock == UCBlocks.cropCinderbella) {
long time = world.getWorldTime() % 24000L;
if (time >= 18000)
return false;
BlockPos pos1 = pos.add(0, 1, 0);
int pumpkins = 0;
for (EnumFacing facing : EnumFacing.HORIZONTALS) {
IBlockState pumpkin = world.getBlockState(pos1.offset(facing));
if (pumpkin.getBlock() != null && pumpkin.getBlock() == Blocks.PUMPKIN && !world.isRemote) {
pumpkins++;
}
}
if (pumpkins >= 4) {
cropBlock.onBlockPlacedBy(world, pos.offset(side), cropBlock.getDefaultState(), player, stack);
return true;
}
}
if (cropBlock == UCBlocks.cropFeroxia) {
cropBlock.onBlockPlacedBy(world, pos.offset(side), cropBlock.getDefaultState(), player, stack);
return true;
}
if (cropBlock == UCBlocks.cropEula) {
player.openGui(UniqueCrops.instance, 1, world, (int)player.posX, (int)player.posY, (int)player.posZ);
}
if (cropBlock == UCBlocks.cropAbstract) {
player.renderBrokenItemStack(stack);
if (!player.worldObj.isRemote)
setAbstractCropGrowth(player, true);
return true;
}
if (cropBlock == UCBlocks.cropPetramia && pos.offset(side).getY() >= 10) {
return false;
}
world.setBlockState(pos.offset(side), cropBlock.getDefaultState(), 3);
return true;
}
}
return false;
}
示例12: drawTextEvent
import net.minecraft.world.World; //导入方法依赖的package包/类
@SubscribeEvent
public void drawTextEvent(RenderGameOverlayEvent.Text event)
{
ArrayList<String> list = cfgLeft ? event.getLeft() : event.getRight();
World world = Minecraft.getMinecraft().world;
if (world != null)
{
StringBuilder mc = new StringBuilder();
if (show(cfgClockMCDays))
{
mc.append("Day ").append(world.getTotalWorldTime() / 24000);
}
if (show(cfgClockMC))
{
if (mc.length() > 0) mc.append(' ');
// 0 -> 24000
int time = (int) world.getWorldTime();
// minutes = time % 1000
// hours = (6 + time / 1000) % 24, cause 0 = 6h, max = 24h
mc.append(doTime((6 + (time / 1000)) % 24, (int) ((time % 1000)*0.06), "MC"));
}
if (mc.length() > 0)
{
list.add(mc.toString());
}
if (show(cfgClockIRL))
{
Calendar cal = world.getCurrentDate();
list.add(doTime(cal.get(Calendar.HOUR_OF_DAY), cal.get(Calendar.MINUTE), "IRL"));
}
}
if (show(cfgModeFPS))
{
list.add(String.format("%d FPS", Minecraft.getDebugFPS()));
}
if (show(cfgModeRAM_Client))
{
drawRAM(list, Side.CLIENT);
}
if (show(cfgModeRAM_Server))
{
drawRAM(list, Side.SERVER);
}
if (show(cfgModeTPS))
{
if (dims == null)
{
list.add("No server TPS data :(");
}
else
{
list.add(String.format("Ticktime Overall: %sms (%d TPS)", DECIMAL_FORMAT.format(meanTickTime), (int) Math.min(1000.0 / meanTickTime, 20)));
for (Map.Entry<Integer, Double> entry : dims.entrySet())
{
list.add(String.format("Dim %d: %sms (%d TPS)", entry.getKey(), DECIMAL_FORMAT.format(entry.getValue()), (int) Math.min(1000.0 / entry.getValue(), 20)));
}
}
}
}
示例13: checkBlooming
import net.minecraft.world.World; //导入方法依赖的package包/类
public void checkBlooming(World worldIn, BlockPos pos, IBlockState state, Random rand)
{
// FIXME Check blooming corresponding to current season, or temp | humidity!
EnumWaterLilyType type = state.getValue(LILY_TYPE);
boolean isNight = worldIn.getWorldTime() % 24000 >= 12000;
boolean blooming = state.getValue(PLANT_BLOOMING);
float growthChanceModifier = (float) Math.sin(Math.toRadians((worldIn.getWorldTime() % 12000) * 0.015));
if (isNight)
{
if (type.isNightBloomer())
{
if (rand.nextDouble() <= growthChanceModifier && !blooming)
{
worldIn.setBlockState(pos, this.getDefaultState().withProperty(LILY_TYPE, type).withProperty(PLANT_BLOOMING, true), 2);
}
}
else
{
if (rand.nextDouble() <= growthChanceModifier / 3 && blooming)
{
worldIn.setBlockState(pos, this.getDefaultState().withProperty(LILY_TYPE, type).withProperty(PLANT_BLOOMING, false), 2);
}
}
}
else
{
if (!type.isNightBloomer())
{
if (rand.nextDouble() <= growthChanceModifier && !blooming)
{
worldIn.setBlockState(pos, this.getDefaultState().withProperty(LILY_TYPE, type).withProperty(PLANT_BLOOMING, true), 2);
}
}
else
{
if (rand.nextDouble() <= growthChanceModifier / 3 && blooming)
{
worldIn.setBlockState(pos, this.getDefaultState().withProperty(LILY_TYPE, type).withProperty(PLANT_BLOOMING, false), 2);
}
}
}
}
示例14: getTime
import net.minecraft.world.World; //导入方法依赖的package包/类
public static long getTime(World world) { return world.getWorldTime(); }