本文整理匯總了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;
}
}
}
}
示例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));
}
}
示例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);
}
}
}
}
}
示例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);
}
}
}
}
示例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());
}
}
}
示例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);
}
}
示例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);
}
}
}
示例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);
}
}
}
}
}
}
示例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;
}
}
示例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
}
}
示例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();
}
示例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);
}
}
}
示例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);
}
}
}
示例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();
}
}