當前位置: 首頁>>代碼示例>>Java>>正文


Java TickEvent類代碼示例

本文整理匯總了Java中net.minecraftforge.fml.common.gameevent.TickEvent的典型用法代碼示例。如果您正苦於以下問題:Java TickEvent類的具體用法?Java TickEvent怎麽用?Java TickEvent使用的例子?那麽, 這裏精選的類代碼示例或許可以為您提供幫助。


TickEvent類屬於net.minecraftforge.fml.common.gameevent包,在下文中一共展示了TickEvent類的15個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的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: onServerTick

import net.minecraftforge.fml.common.gameevent.TickEvent; //導入依賴的package包/類
@SubscribeEvent
public void onServerTick(TickEvent.ServerTickEvent event) {
    if (event.phase == TickEvent.Phase.END) {
        Iterator<Map.Entry<WorldAndCoord, IHackableBlock>> blockIterator = hackedBlocks.entrySet().iterator();
        while (blockIterator.hasNext()) {
            Map.Entry<WorldAndCoord, IHackableBlock> entry = blockIterator.next();
            IHackableBlock hackableBlock = entry.getValue();
            WorldAndCoord hackedBlock = entry.getKey();

            boolean found = false;
            for (Map.Entry<Block, Class<? extends IHackableBlock>> registeredEntry : PneumaticHelmetRegistry.getInstance().hackableBlocks.entrySet()) {
                if (hackableBlock.getClass() == registeredEntry.getValue()) {
                    if (hackedBlock.getBlock() == registeredEntry.getKey()) {
                        if (!hackableBlock.afterHackTick((World) hackedBlock.world, hackedBlock.pos)) {
                            blockIterator.remove();
                        }
                        found = true;
                        break;
                    }
                }
            }
            if (!found) blockIterator.remove();
        }
    }
}
 
開發者ID:TeamPneumatic,項目名稱:pnc-repressurized,代碼行數:26,代碼來源:HackTickHandler.java

示例3: worldTick

import net.minecraftforge.fml.common.gameevent.TickEvent; //導入依賴的package包/類
@SubscribeEvent
public void worldTick(TickEvent.WorldTickEvent event) {
    if (event.phase == TickEvent.Phase.END) {
        try {
            for (Entity entity : event.world.loadedEntityList) {
                if (entity.hasCapability(CapabilityHackingProvider.HACKING_CAPABILITY, null)) {
                    IHacking hack = entity.getCapability(CapabilityHackingProvider.HACKING_CAPABILITY, null);
                    if (!hack.getCurrentHacks().isEmpty()) {
                        hack.update(entity);
                    }
                }
            }
        } catch (Throwable e) {
            // Catching a CME which I have no clue on what might cause it.
        }
    }
}
 
開發者ID:TeamPneumatic,項目名稱:pnc-repressurized,代碼行數:18,代碼來源:HackTickHandler.java

示例4: tickEnd

import net.minecraftforge.fml.common.gameevent.TickEvent; //導入依賴的package包/類
@SubscribeEvent
public void tickEnd(TickEvent.WorldTickEvent event) {
    if (event.phase == TickEvent.Phase.END) {
        World world = event.world;
        checkLightning(world);
        DroneClaimManager.getInstance(world).update();
        if (!event.world.isRemote && event.world.provider.getDimension() == 0 && event.world.getWorldTime() % (24000 / AmadronOfferPeriodicConfig.timesPerDay) == 1) {
            AmadronOfferManager.getInstance().shufflePeriodicOffers();
        }
        if (!event.world.isRemote && event.world.getTotalWorldTime() % 100 == 0) {
            double tickTime = net.minecraft.util.math.MathHelper.average(FMLCommonHandler.instance().getMinecraftServerInstance().tickTimeArray) * 1.0E-6D;//In case world are going to get their own thread: MinecraftServer.getServer().worldTickTimes.get(event.world.provider.getDimension())
            NetworkHandler.sendToDimension(new PacketServerTickTime(tickTime), event.world.provider.getDimension());
            if (event.world.getTotalWorldTime() % 600 == 0)
                AmadronOfferManager.getInstance().tryRestockCustomOffers();
        }
    }
}
 
開發者ID:TeamPneumatic,項目名稱:pnc-repressurized,代碼行數:18,代碼來源:TickHandlerPneumaticCraft.java

示例5: onServerTick

import net.minecraftforge.fml.common.gameevent.TickEvent; //導入依賴的package包/類
@SubscribeEvent
public void onServerTick(TickEvent.ServerTickEvent event) {
    for (ISemiBlock semiBlock : addingBlocks) {
        Chunk chunk = semiBlock.getWorld().getChunkFromBlockCoords(semiBlock.getPos());
        addPendingBlock(chunk, semiBlock);
        chunk.markDirty();

        for (EntityPlayer player : syncList.get(chunk)) {
            NetworkHandler.sendTo(new PacketAddSemiBlock(semiBlock), (EntityPlayerMP) player);
            PacketDescription descPacket = semiBlock.getDescriptionPacket();
            if (descPacket != null) NetworkHandler.sendTo(descPacket, (EntityPlayerMP) player);
        }
    }
    addingBlocks.clear();

    for (Chunk removingChunk : chunksMarkedForRemoval) {
        if (!removingChunk.isLoaded()) {
            semiBlocks.remove(removingChunk);
            syncList.remove(removingChunk);
        }
    }
    chunksMarkedForRemoval.clear();

    semiBlocks.values().forEach(this::update);
}
 
開發者ID:TeamPneumatic,項目名稱:pnc-repressurized,代碼行數:26,代碼來源:SemiBlockManager.java

示例6: onClientTick

import net.minecraftforge.fml.common.gameevent.TickEvent; //導入依賴的package包/類
@SubscribeEvent
public void onClientTick(TickEvent.ClientTickEvent event) {
    if (this == getServerInstance()) getClientOldInstance().onClientTick(event);
    else {
        EntityPlayer player = PneumaticCraftRepressurized.proxy.getPlayer();
        if (player != null) {
            for (ISemiBlock semiBlock : addingBlocks) {
                Chunk chunk = semiBlock.getWorld().getChunkFromBlockCoords(semiBlock.getPos());
                addPendingBlock(chunk, semiBlock);
            }
            addingBlocks.clear();

            Iterator<Map.Entry<Chunk, Map<BlockPos, List<ISemiBlock>>>> iterator = semiBlocks.entrySet().iterator();
            while (iterator.hasNext()) {
                Map.Entry<Chunk, Map<BlockPos, List<ISemiBlock>>> entry = iterator.next();
                if (PneumaticCraftUtils.distBetween(player.posX, 0, player.posZ, entry.getKey().x * 16 - 8, 0, entry.getKey().z * 16 - 8) > SYNC_DISTANCE + 10) {
                    iterator.remove();
                } else {
                    update(entry.getValue());
                }
            }
        } else {
            semiBlocks.clear();
        }
    }
}
 
開發者ID:TeamPneumatic,項目名稱:pnc-repressurized,代碼行數:27,代碼來源:SemiBlockManager.java

示例7: 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

示例8: onWorldTick

import net.minecraftforge.fml.common.gameevent.TickEvent; //導入依賴的package包/類
@SubscribeEvent
public void onWorldTick(TickEvent.WorldTickEvent event) {
	if(event.world.isRemote){ return; } // Not called on client
	long time = event.world.getWorldTime();
	if (time > Util.ticksInDay) {
		MapStorage storage = event.world.getPerWorldStorage();
		TimeData td = (TimeData) storage.getOrLoadData(TimeData.class, "firmatime");
		if(td==null){
			td = new TimeData("");
			storage.setData("firmatime", td);
		}
		td.addDay();
		event.world.setWorldTime(time - Util.ticksInDay);
		td.setDirty(true);
		System.out.println("Day inceremented on Server " + td.toString());
	}
}
 
開發者ID:trigg,項目名稱:Firma,代碼行數:18,代碼來源:CommonProxy.java

示例9: 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

示例10: onServerTick

import net.minecraftforge.fml.common.gameevent.TickEvent; //導入依賴的package包/類
@SubscribeEvent
public void onServerTick(TickEvent.ServerTickEvent event)
{
    if(event.phase == TickEvent.Phase.END)
    {
        Iterator<Map.Entry<String, Integer>> ite = playerDelay.entrySet().iterator();
        while(ite.hasNext())
        {
            Map.Entry<String, Integer> e = ite.next();

            e.setValue(e.getValue() - 1);
            if(e.getValue() == 0)
            {
                EntityPlayer player = FMLCommonHandler.instance().getMinecraftServerInstance().getPlayerList().getPlayerByUsername(e.getKey());
                if(player != null)
                {
                    shootTorch(player);
                }
                else
                {
                    ite.remove();
                }
            }
        }
    }
}
 
開發者ID:iChun,項目名稱:Torched,代碼行數:27,代碼來源:EventHandlerServer.java

示例11: onServerWorldTick

import net.minecraftforge.fml.common.gameevent.TickEvent; //導入依賴的package包/類
@SubscribeEvent
public static void onServerWorldTick(TickEvent.WorldTickEvent event) {
	if (event.side != Side.CLIENT) {

		int dim = event.world.provider.getDimension();
		if (ticks % 20 == 0) {
			for (ChunkPos pos : getDirtyChunks(dim)) {
				event.world.markChunkDirty(new BlockPos(pos.x << 4, 16, pos.z << 4), null);
			}
			getDirtyChunks(dim).clear();

			// for (InstabilityEvent e : instabilityEvents.get(dim)) {
			// e.affectChunk(event.world);
			// }
			// instabilityEvents.clear();
		}

		ticks++;
	}
}
 
開發者ID:the-realest-stu,項目名稱:Etheric,代碼行數:21,代碼來源:StabilityHandler.java

示例12: 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

示例13: onClientTick

import net.minecraftforge.fml.common.gameevent.TickEvent; //導入依賴的package包/類
@SubscribeEvent
public void onClientTick(TickEvent.ClientTickEvent event) {
    //check if the player is really riding a entity
    if (MC.player != null && MC.player.getRidingEntity() != null) {

        ForgeHaxHooks.isNoClampingActivated = noClamp.getAsBoolean();
        ForgeHaxHooks.isNoBoatGravityActivated = noGravity.getAsBoolean();
        ForgeHaxHooks.isBoatSetYawActivated = setYaw.getAsBoolean();

        if (MC.gameSettings.keyBindJump.isKeyDown()) {
            //trick the riding entity to think its onground
            MC.player.getRidingEntity().onGround = false;

            //teleport up
            MC.player.getRidingEntity().motionY = MC.gameSettings.keyBindSprint.isKeyDown() ? 5 : 1.5;
        }  else {
            MC.player.getRidingEntity().motionY = MC.gameSettings.keyBindSprint.isKeyDown() ? -1.0 : -speedY.getAsDouble();
        }

        /*if ((MC.player.posY <= maintainY.getAsDouble()-5D) && (MC.player.posY > maintainY.getAsDouble()-10D) && maintainY.getAsDouble() != 0D)
            MC.player.getRidingEntity().setPositionAndUpdate(MC.player.posX, maintainY.getAsDouble(), MC.player.posZ );*/

        setMoveSpeedEntity(speed.getAsDouble());

    }
}
 
開發者ID:fr1kin,項目名稱:ForgeHax,代碼行數:27,代碼來源:BoatFly.java

示例14: serverTickEnd

import net.minecraftforge.fml.common.gameevent.TickEvent; //導入依賴的package包/類
@SubscribeEvent
public void serverTickEnd(TickEvent.ServerTickEvent event) {

	if (event.phase == TickEvent.Phase.START)
		if (tickleft <= 0) {
			tickleft = 20;
			Object[] entArray = ItemUsable.lastDamage.keySet().toArray();
			for (int x = 0; x < entArray.length; x++) {
				Entity entity = (Entity) entArray[x];
				float[] dmg = ItemUsable.lastDamage.get(entArray[x]);
				for (int i = 19; i >= 0; i--)
					if (i > 0) {
						dmg[i] = dmg[i - 1];
					} else {
						dmg[0] = 0;
					}
			}

		} else {
			tickleft--;
		}
}
 
開發者ID:rafradek,項目名稱:Mods,代碼行數:23,代碼來源:TF2EventsCommon.java

示例15: onTick

import net.minecraftforge.fml.common.gameevent.TickEvent; //導入依賴的package包/類
@SubscribeEvent(priority = EventPriority.LOW)
public void onTick(TickEvent.RenderTickEvent event) {
    if (TextDisplayerMod.getInstance().getWebsiteUtils().isDisabled()) return;

    boolean isClickedLeft = Mouse.isButtonDown(0);
    if (isClickedLeft != this.lastLeft) {
        this.lastLeft = isClickedLeft;
        if (isClickedLeft) {
            this.leftClicks.add(System.currentTimeMillis());
        }
    }

    boolean isClickedRight = Mouse.isButtonDown(1);
    if (isClickedRight != this.lastRight) {
        this.lastRight = isClickedRight;
        if (isClickedRight) {
            this.rightClicks.add(System.currentTimeMillis());
        }
    }
}
 
開發者ID:boomboompower,項目名稱:TextDisplayer,代碼行數:21,代碼來源:CPSParser.java


注:本文中的net.minecraftforge.fml.common.gameevent.TickEvent類示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。