当前位置: 首页>>代码示例>>Java>>正文


Java TickEvent.PlayerTickEvent方法代码示例

本文整理汇总了Java中net.minecraftforge.fml.common.gameevent.TickEvent.PlayerTickEvent方法的典型用法代码示例。如果您正苦于以下问题:Java TickEvent.PlayerTickEvent方法的具体用法?Java TickEvent.PlayerTickEvent怎么用?Java TickEvent.PlayerTickEvent使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在net.minecraftforge.fml.common.gameevent.TickEvent的用法示例。


在下文中一共展示了TickEvent.PlayerTickEvent方法的14个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: playerTick

import net.minecraftforge.fml.common.gameevent.TickEvent; //导入方法依赖的package包/类
@SubscribeEvent
public void playerTick(TickEvent.PlayerTickEvent event) {
    if (event.phase == TickEvent.Phase.END) {
        Minecraft mc = FMLClientHandler.instance().getClient();
        EntityPlayer player = event.player;
        if (player == mc.player) {
            ItemStack helmetStack = player.getItemStackFromSlot(EntityEquipmentSlot.HEAD);
            if (helmetStack.getItem() == Itemss.PNEUMATIC_HELMET) {
                if (player.world.isRemote) {
                    update(mc.player);
                }
            } else {
                CommonHUDHandler.getHandlerForPlayer(player).ticksExisted = 0;
            }
        }
    }
}
 
开发者ID:TeamPneumatic,项目名称:pnc-repressurized,代码行数:18,代码来源:HUDHandler.java

示例2: move

import net.minecraftforge.fml.common.gameevent.TickEvent; //导入方法依赖的package包/类
@SubscribeEvent
public void move(TickEvent.PlayerTickEvent event) {
	

	if (event.player.world.isRemote) {
		//System.out.println("CLIENT "+event.player.world.getBiome(event.player.getPosition()).getBiomeName());

		return;
	}
	//System.out.println(event.player.world.getBiome(event.player.getPosition()).getBiomeName());
	if (CommonProxy.d == 0) {
		return;
	}
	World w = event.player.world;
	if (w != null && w.getWorldType() == WorldType.DEFAULT) {
		new SpawnTeleport(DimensionManager.getWorld(CommonProxy.d)).teleport(event.player, DimensionManager.getWorld(CommonProxy.d));
	}
}
 
开发者ID:trigg,项目名称:Firma,代码行数:19,代码来源:JoinHandler.java

示例3: onDeathUpdate

import net.minecraftforge.fml.common.gameevent.TickEvent; //导入方法依赖的package包/类
@SubscribeEvent
public void onDeathUpdate(TickEvent.PlayerTickEvent event) {
	if (event.phase == TickEvent.Phase.START) {
		if (event.player.getHealth() <= 0f && !event.player.getEntityData().getBoolean(IGNORE_REVIVAL_DEATH)) {
			// Prevent deathTime from removing the entity from the world
			if (event.player.deathTime == 19) {
				event.player.deathTime = 18;
			}
			// Update our death timer instead
			IHardcoreRevival revival = event.player.getCapability(CapabilityHardcoreRevival.REVIVAL_CAPABILITY, null);
			if (revival != null) {
				revival.setDeathTime(revival.getDeathTime() + 1);
				if (revival.getDeathTime() >= ModConfig.maxDeathTicks) {
					event.player.getEntityData().setBoolean(IGNORE_REVIVAL_DEATH, true);
					NetworkHandler.instance.sendTo(new MessageDie(), (EntityPlayerMP) event.player);
					event.player.getCombatTracker().trackDamage(HardcoreRevival.notRescuedInTime, 0, 0);
					event.player.onDeath(HardcoreRevival.notRescuedInTime);
				}
			}
		}
	}
}
 
开发者ID:blay09,项目名称:HardcoreRevival,代码行数:23,代码来源:DeathHandler.java

示例4: onPlayerTick

import net.minecraftforge.fml.common.gameevent.TickEvent; //导入方法依赖的package包/类
@SubscribeEvent
public void onPlayerTick(TickEvent.PlayerTickEvent event)
{
    if(event.side == Side.SERVER && event.phase == TickEvent.Phase.END)
    {
        if(iChunUtil.eventHandlerServer.ticks + 5 % 10 == 2)
        {
            ItemStack isMain = event.player.getHeldItemMainhand();
            ItemStack isOff = event.player.getHeldItemOffhand();
            if(isMain.getItem() == Clef.itemInstrument)
            {
                InstrumentLibrary.checkForInstrument(isMain, event.player);
            }
            if(isOff.getItem() == Clef.itemInstrument)
            {
                InstrumentLibrary.checkForInstrument(isOff, event.player);
            }
        }
    }
}
 
开发者ID:iChun,项目名称:Clef,代码行数:21,代码来源:EventHandlerServer.java

示例5: onTickPlayerTick

import net.minecraftforge.fml.common.gameevent.TickEvent; //导入方法依赖的package包/类
@SubscribeEvent
public void onTickPlayerTick(TickEvent.PlayerTickEvent event)
{
    if (event.side.isClient() || event.phase != TickEvent.Phase.START || !hasPermission(event.player)) return;
    int count = event.player.getEntityData().getInteger(NBT_COUNTER);
    if (count <= 0) return;
    event.player.getEntityData().setInteger(NBT_COUNTER, count - 1);
    Data data = ServerHelper.getData();
    if (data != null)
    {
        try
        {
            DebugServerInfo.getSnw().sendTo(data, (EntityPlayerMP) event.player);
        }
        catch (Exception e)
        {
            getLogger().info("Caught error in sendTo. {} ({})", e.getMessage(), e.getClass().getName());
        }
    }
}
 
开发者ID:dries007,项目名称:DebugServerInfo,代码行数:21,代码来源:ServerHelper.java

示例6: onPlayerJoin

import net.minecraftforge.fml.common.gameevent.TickEvent; //导入方法依赖的package包/类
@SubscribeEvent
public void onPlayerJoin(TickEvent.PlayerTickEvent event) {
    if (event.player.world.isRemote && event.player == FMLClientHandler.instance().getClientPlayerEntity()) {
        event.player.sendStatusMessage(ITextComponent.Serializer.jsonToComponent("[\"" + TextFormatting.GOLD + "The mod " + supportingMod + " is supporting In-Game Wiki mod. " + TextFormatting.GOLD + "However, In-Game Wiki isn't installed! " + "[\"," + "{\"text\":\"Download Latest\",\"color\":\"green\",\"clickEvent\":{\"action\":\"run_command\",\"value\":\"/igwmod_download\"}}," + "\"]\"]"), false);
        MinecraftForge.EVENT_BUS.unregister(this);
    }
}
 
开发者ID:TeamPneumatic,项目名称:pnc-repressurized,代码行数:8,代码来源:IGWSupportNotifier.java

示例7: tickEnd

import net.minecraftforge.fml.common.gameevent.TickEvent; //导入方法依赖的package包/类
@SubscribeEvent
public void tickEnd(TickEvent.PlayerTickEvent event) {
    if (event.phase == TickEvent.Phase.END) {
        EntityPlayer player = event.player;
        if (this == PneumaticCraftRepressurized.proxy.getCommonHudHandler()) {
            getHandlerForPlayer(player).tickEnd(event);
        } else {
            ItemStack helmetStack = player.getItemStackFromSlot(EntityEquipmentSlot.HEAD);
            if (helmetStack.getItem() == Itemss.PNEUMATIC_HELMET) {
                helmetPressure = ((IPressurizable) helmetStack.getItem()).getPressure(helmetStack);
                if (ticksExisted == 0) {
                    checkHelmetInventory(helmetStack);
                }
                ticksExisted++;
                if (!player.world.isRemote) {
                    if (ticksExisted > getStartupTime() && !player.capabilities.isCreativeMode) {
                        ((IPressurizable) helmetStack.getItem()).addAir(helmetStack, (int) -UpgradeRenderHandlerList.instance().getAirUsage(player, false));
                    }
                }

            } else {
                ticksExisted = 0;
            }
            if (!player.world.isRemote) handleHacking(player);
        }
    }
}
 
开发者ID:TeamPneumatic,项目名称:pnc-repressurized,代码行数:28,代码来源:CommonHUDHandler.java

示例8: onPlayerTick

import net.minecraftforge.fml.common.gameevent.TickEvent; //导入方法依赖的package包/类
@SubscribeEvent
public void onPlayerTick(TickEvent.PlayerTickEvent event) {
	if (event.side == Side.SERVER && event.phase == TickEvent.Phase.END) {
		IHardcoreRevival revival = event.player.getCapability(CapabilityHardcoreRevival.REVIVAL_CAPABILITY, null);
		if (revival != null && revival.getRescueTarget() != null) {
			// Stop rescuing if the target logged out
			if (revival.getRescueTarget().isDead) {
				abortRescue(event.player);
			} else {
				// Stop rescuing if the player is out of range
				float dist = event.player.getDistanceToEntity(revival.getRescueTarget());
				if (dist > ModConfig.maxRescueDist) {
					abortRescue(event.player);
				} else {
					int rescueTime = revival.getRescueTime() + 1;
					revival.setRescueTime(rescueTime);
					int step = ModConfig.rescueTime / 4;
					if (rescueTime >= ModConfig.rescueTime) {
						finishRescue(event.player);
					} else if (rescueTime % step == 0) {
						NetworkHandler.instance.sendTo(new MessageRevivalProgress(revival.getRescueTarget().getEntityId(), (float) rescueTime / (float) ModConfig.rescueTime), (EntityPlayerMP) event.player);
					}
				}
			}
		}
	}
}
 
开发者ID:blay09,项目名称:HardcoreRevival,代码行数:28,代码来源:RescueHandler.java

示例9: tickEvent

import net.minecraftforge.fml.common.gameevent.TickEvent; //导入方法依赖的package包/类
@SubscribeEvent
public void tickEvent(TickEvent.PlayerTickEvent e) {
	if (e.side == Side.CLIENT) {
		if (ModGlobals.TIME >= 360.1F) {
			ModGlobals.TIME = 0.0F;
		}
		ModGlobals.TIME += 0.75F;
	}
}
 
开发者ID:p455w0rd,项目名称:DankNull,代码行数:10,代码来源:DankNullRenderer.java

示例10: tick

import net.minecraftforge.fml.common.gameevent.TickEvent; //导入方法依赖的package包/类
@SubscribeEvent
public static void tick(TickEvent.PlayerTickEvent event) {
    if (event.phase == TickEvent.Phase.END && !event.player.isCreative()) {
        PlayerDataManager.tickPlayer(event.player);
        hitList.remove(event.player); //Damage should be done in the same tick as the hit was noted, otherwise we got a false-positive
    }
}
 
开发者ID:ichttt,项目名称:FirstAid,代码行数:8,代码来源:EventHandler.java

示例11: onPlayerTick

import net.minecraftforge.fml.common.gameevent.TickEvent; //导入方法依赖的package包/类
@SubscribeEvent
public void onPlayerTick(TickEvent.PlayerTickEvent ev)
{
    // Pass the event on to the active episode, if there is one:
    this.stateEpisodeLock.readLock().lock();
    if (this.stateEpisode != null && this.stateEpisode.isLive())
    {
        this.stateEpisode.onPlayerTick(ev);
    }
    this.stateEpisodeLock.readLock().unlock();
}
 
开发者ID:Yarichi,项目名称:Proyecto-DASI,代码行数:12,代码来源:EpisodeEventWrapper.java

示例12: playerTick

import net.minecraftforge.fml.common.gameevent.TickEvent; //导入方法依赖的package包/类
@SubscribeEvent
public void playerTick(TickEvent.PlayerTickEvent event)
{
    if(event.side == Side.CLIENT && event.phase == TickEvent.Phase.END)
    {
        EntityPlayer player = event.player;

        ItemStack heldItem = player.getHeldItem(EnumHand.MAIN_HAND);
        if(heldItem != currentTool.get(player.getName()) && (heldItem.isEmpty() || (Block.getBlockFromItem(heldItem.getItem()) == Blocks.AIR)))
        {
            if(currentTool.get(player.getName()) != null && (currentTool.get(player.getName()).getItem().isFull3D() || currentTool.get(player.getName()).getItem() instanceof ItemBow) && !BackTools.blacklist.contains(currentTool.get(player.getName()).getItem()))
            {
                ItemStack is = currentTool.get(player.getName()).copy();
                IBakedModel model = Minecraft.getMinecraft().getRenderItem().getItemModelMesher().getItemModel(is);
                if(!(model instanceof ModelBaseWrapper))
                {
                    is.setItemDamage(0);
                    ItemStack prevTool = playerTool.get(player.getName());
                    if(prevTool == null || (prevTool.isEmpty() || !ItemStack.areItemStacksEqual(prevTool, is)))
                    {
                        playerTool.put(player.getName(), is);
                    }
                }
            }
            currentTool.put(player.getName(), heldItem);
        }
    }
}
 
开发者ID:iChun,项目名称:BackTools,代码行数:29,代码来源:EventHandlerClient.java

示例13: onPlayerTick

import net.minecraftforge.fml.common.gameevent.TickEvent; //导入方法依赖的package包/类
@SubscribeEvent
public void onPlayerTick(TickEvent.PlayerTickEvent event) {
	EntityPlayerMP player = (EntityPlayerMP) event.player;
	Chunk oldChunk = AllChunks.getChunkPlayerWasLastSeenIn(player);
	int newChunkX = event.player.getPosition().getX() >> 4;
	int newChunkZ = event.player.getPosition().getZ() >> 4;
	Chunk newChunk = new Chunk(event.player.getEntityWorld(), (int) newChunkX, (int) newChunkZ);
	if (oldChunk == null || !(oldChunk.getPos().equals(newChunk.getPos()) && oldChunk.getWorld().equals(newChunk.getWorld()))) {
		AllChunks.playerEnteredChunk(newChunk, player);
		if (oldChunk != null) {
			AllChunks.playerLeft(oldChunk, player);
		}
	}
}
 
开发者ID:coehlrich,项目名称:chunk-logger,代码行数:15,代码来源:EventHandlerCommon.java

示例14: playerTick

import net.minecraftforge.fml.common.gameevent.TickEvent; //导入方法依赖的package包/类
@SubscribeEvent
public void playerTick(TickEvent.PlayerTickEvent event)
{
	if (event.player.hasCapability(ExPPlayerCapability.playerCap, null) && event.phase == Phase.END)
	{
		IExPPlayer.of(event.player).onTick();
	}
}
 
开发者ID:V0idWa1k3r,项目名称:ExPetrum,代码行数:9,代码来源:ExPHandlerServer.java


注:本文中的net.minecraftforge.fml.common.gameevent.TickEvent.PlayerTickEvent方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。