本文整理汇总了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;
}
}
}
}
示例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();
}
}
}
示例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.
}
}
}
示例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();
}
}
}
示例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);
}
示例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();
}
}
}
示例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));
}
}
示例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());
}
}
示例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());
}
}
}
示例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();
}
}
}
}
}
示例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++;
}
}
示例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);
}
}
}
}
}
示例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());
}
}
示例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--;
}
}
示例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());
}
}
}