本文整理汇总了Java中cpw.mods.fml.common.gameevent.TickEvent.WorldTickEvent方法的典型用法代码示例。如果您正苦于以下问题:Java TickEvent.WorldTickEvent方法的具体用法?Java TickEvent.WorldTickEvent怎么用?Java TickEvent.WorldTickEvent使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类cpw.mods.fml.common.gameevent.TickEvent
的用法示例。
在下文中一共展示了TickEvent.WorldTickEvent方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: onWorldTickLoad
import cpw.mods.fml.common.gameevent.TickEvent; //导入方法依赖的package包/类
@SubscribeEvent
public void onWorldTickLoad(TickEvent.WorldTickEvent event)
{
EAWorldData eaWD = EAWorldData.forWorld((WorldServer)event.world);
eaWD.markDirty();
if(event.phase == TickEvent.Phase.START)
{
EAPlugin.internalTick();
for(EAPluginContainer plugin : EALoader.instance().loadedPlugins)
{
try
{
plugin.plugin.onTick(event.world);
}
catch(Exception e)
{
e.printStackTrace();
}
}
}
}
示例2: serverTickEvent
import cpw.mods.fml.common.gameevent.TickEvent; //导入方法依赖的package包/类
@SubscribeEvent
public void serverTickEvent(TickEvent.WorldTickEvent event) {
if(zmaster587.advancedRocketry.api.Configuration.allowTerraforming && event.world.provider.getClass() == WorldProviderPlanet.class) {
if(DimensionManager.getInstance().getDimensionProperties(event.world.provider.dimensionId).isTerraformed()) {
List<Chunk> list = ((WorldServer)event.world).theChunkProviderServer.loadedChunks;
if(list.size() > 0) {
for(int i = 0; i < Configuration.terraformingBlockSpeed; i++) {
Chunk chunk = list.get(event.world.rand.nextInt(list.size()));
int coord = event.world.rand.nextInt(256);
int x = (coord & 0xF) + chunk.xPosition*16;
int z = (coord >> 4) + chunk.zPosition*16;
BiomeHandler.changeBiome(event.world, ((WorldProviderPlanet)event.world.provider).chunkMgrTerraformed.getBiomeGenAt(x,z).biomeID, x, z);
}
}
}
}
}
示例3: onWorldTick
import cpw.mods.fml.common.gameevent.TickEvent; //导入方法依赖的package包/类
@SubscribeEvent
public void onWorldTick(TickEvent.WorldTickEvent tickEvent)
{
/*for (IJob job : unscheduledBackgroundJobs)
{
scheduleBackgroundJob(job);
}
unscheduledBackgroundJobs.clear();*/
int jobQuota = 32;
while (!scheduledTickJobs.isEmpty() && --jobQuota > 0)
{
IJob job = scheduledTickJobs.poll();
job.start();
}
}
示例4: onWorldTick
import cpw.mods.fml.common.gameevent.TickEvent; //导入方法依赖的package包/类
@SubscribeEvent
public void onWorldTick(TickEvent.WorldTickEvent event)
{
if (genQueue.isEmpty())
return;
if (event.phase == TickEvent.Phase.START)
return;
int count = 0;
ArrayList<RetroGenEntry> removeQueue = Lists.newArrayList();
ArrayList<RetroGenEntry> iterationQueue = (ArrayList<RetroGenEntry>) genQueue.clone();
for (RetroGenEntry entry : iterationQueue)
{
entry.gen.generate(entry.world.rand, entry.world, entry.coord.chunkX, entry.coord.chunkZ);
removeQueue.add(entry);
count++;
if (count >= 32)
break;
}
genQueue.removeAll(removeQueue);
}
示例5: clientTick
import cpw.mods.fml.common.gameevent.TickEvent; //导入方法依赖的package包/类
@SubscribeEvent
public void clientTick(TickEvent.WorldTickEvent event)
{
if(event.phase == TickEvent.Phase.START)
preTick(event.world);
else
postTick(event.world);
}
示例6: onWorldTick
import cpw.mods.fml.common.gameevent.TickEvent; //导入方法依赖的package包/类
@SubscribeEvent
public void onWorldTick(TickEvent.WorldTickEvent event)
{
EntityPlayer player;
player = null;
for (Dungeon d : Main.DUNGEONS)
{
if (event.world.provider.dimensionId == d.DIM_ID && d.is_running)
{
if (event.world.playerEntities.size() == 0)
{
d.is_running = false;
d.current_team = null;
}
else
{
for (Object obj : event.world.playerEntities)
{
if (((EntityPlayer)obj).getTeam() == null || !((EntityPlayer)obj).getTeam().isSameTeam(d.current_team)) //le joueur quitte le groupe du donjon
{
player = (EntityPlayer)obj;
break ;
}
}
}
}
if (player != null)
{
Main.getPlayerServer(player).travelToDimension(d.DIM_RETOUR, player.dimension);
player.addChatComponentMessage(new ChatComponentText("You are no longer in this dungeon's group."));
player = null;
}
}
}
示例7: onTick
import cpw.mods.fml.common.gameevent.TickEvent; //导入方法依赖的package包/类
@SubscribeEvent
public void onTick(TickEvent.WorldTickEvent event) {
final World world = event.world;
if( world != null && !world.isRemote
&& world.difficultySetting.getDifficultyId() > 0
&& world.getWorldInfo().getWorldTime() % 300L == 0L ) {
final List list = world.playerEntities;
if( list != null && list.size() > 0 ) {
final int maxNum = 12 + (list.size() * 6);
this.setMaxAnimals(maxNum);
}
this.doCustomSpawning(world, true, true);
}
}
示例8: onTick
import cpw.mods.fml.common.gameevent.TickEvent; //导入方法依赖的package包/类
@SubscribeEvent
public void onTick(TickEvent.WorldTickEvent worldt)
{
if(!EALoader.isPluginLoaded(this))return;
World world = worldt.world;
super.internalTick();
if(day >= 8) phase = day;
else phase = 8;
if(phase >= 1)
{
world.getWorldInfo().setRaining(true);
world.getWorldInfo().setRainTime(24000);
}
for(int i = 0; i < world.playerEntities.size(); i++)
{
EntityPlayer focusPlayer = (EntityPlayer)world.playerEntities.get(i);
int randX = world.rand.nextInt(16);
int randZ = world.rand.nextInt(16);
int playerPosX = MathHelper.floor_double(focusPlayer.posX);
int playerPosZ = MathHelper.floor_double(focusPlayer.posZ);
int randY = EAToolkit.getTopBlock(world, randX + playerPosX, randZ + playerPosZ);
byte effectRange = 7;
for(int xOffset = -effectRange; xOffset <= effectRange; xOffset++)
{
for(int zOffset = -effectRange; zOffset <= effectRange; zOffset++)
{
if(phase >= 1)
{
Block block = world.getBlock(randX + playerPosX, randY, randZ + playerPosZ);
}
}
}
}
}
示例9: onServerWorldTick
import cpw.mods.fml.common.gameevent.TickEvent; //导入方法依赖的package包/类
@SubscribeEvent
public void onServerWorldTick(TickEvent.WorldTickEvent event)
{
World world = event.world;
if (event.phase == TickEvent.Phase.START)
{
if (world.provider.dimensionId == 0 && !Recipes.areAnvilRecipesRegistered())
{
Recipes.registerAnvilRecipes(world);
}
}
}
示例10: tick
import cpw.mods.fml.common.gameevent.TickEvent; //导入方法依赖的package包/类
@SubscribeEvent
public void tick(TickEvent.WorldTickEvent event)
{
if (event.phase == TickEvent.Phase.END)
{
event.world.theProfiler.startSection("bioSystem");
BioSystemHandler handler = BioSystemHandler.get(event.world);
if (handler != null)
handler.update();
event.world.theProfiler.endSection();
}
}
示例11: onWorldTick
import cpw.mods.fml.common.gameevent.TickEvent; //导入方法依赖的package包/类
@SubscribeEvent
public void onWorldTick(TickEvent.WorldTickEvent event) {
if (event.phase == TickEvent.Phase.START)
return;
if (event.side == Side.CLIENT)
return;
TriggerRegistry.fireTrigger(PassiveTrigger.Type.WORLD, event.world);
}
示例12: onTickEnd
import cpw.mods.fml.common.gameevent.TickEvent; //导入方法依赖的package包/类
@SubscribeEvent
public void onTickEnd(TickEvent.WorldTickEvent event) {
if (event.phase != TickEvent.Phase.END)
return;
if (event.world.provider.dimensionId != 0)
return;
Queue<IDiscordCallback> processQueue = discordResponses;
Queue<IDiscordCallback> transferQueue = clientDiscordResponses;
if (event.world.isRemote) {
processQueue = clientDiscordResponses;
transferQueue = discordResponses;
}
//We only have one queue accessible externally to simplify the API.
//Instead of having the network layer handle the difference, the caller
//just makes sure that the difference is available in the callback object.
//If we are running on a dedicated server, then client callbacks are
//discarded. Ideally, we shouldn't be generating them.
while (!processQueue.isEmpty()) {
IDiscordCallback response = processQueue.remove();
if (response.shouldRunOnServer() == !event.world.isRemote)
response.run();
else if (!MinecraftServer.getServer().isDedicatedServer())
transferQueue.add(response);
}
}
示例13: onTickEvent
import cpw.mods.fml.common.gameevent.TickEvent; //导入方法依赖的package包/类
@SubscribeEvent
public void onTickEvent(TickEvent.WorldTickEvent ev) {
if(ev.side == Side.CLIENT)
return;
for(Resident res : MyTownUniverse.instance.residents) {
res.tick();
}
if((Config.instance.costTownUpkeep.get() > 0 || Config.instance.costAdditionalUpkeep.get() > 0) && ev.phase == TickEvent.Phase.START) {
if (ticked) {
if(lastCalendarDay != -1 && Calendar.getInstance().get(Calendar.DAY_OF_YEAR) != lastCalendarDay) {
for (int i = 0; i < MyTownUniverse.instance.towns.size(); i++) {
Town town = MyTownUniverse.instance.towns.get(i);
if (!(town instanceof AdminTown)) {
town.bank.payUpkeep();
if(town.bank.getDaysNotPaid() == Config.instance.upkeepTownDeletionDays.get() && Config.instance.upkeepTownDeletionDays.get() > 0) {
MyTown.instance.LOG.info("Town {} has been deleted because it didn't pay upkeep for {} days.", town.getName(), Config.instance.upkeepTownDeletionDays.get());
getDatasource().deleteTown(town);
} else {
getDatasource().saveTownBank(town.bank);
}
}
}
ticked = false;
}
lastCalendarDay = Calendar.getInstance().get(Calendar.DAY_OF_YEAR);
} else {
ticked = true;
}
}
}
示例14: onServerTick
import cpw.mods.fml.common.gameevent.TickEvent; //导入方法依赖的package包/类
@SubscribeEvent
public void onServerTick(TickEvent.WorldTickEvent event) {
if (event.type == TickEvent.Type.WORLD) {
if (callbacks.containsKey(event.world.provider.dimensionId)) {
Queue<FutureTask> callbackList = callbacks.get(event.world.provider.dimensionId);
FutureTask callback;
while ((callback = callbackList.poll()) != null) {
callback.run();
}
}
}
}
示例15: onWorldTick
import cpw.mods.fml.common.gameevent.TickEvent; //导入方法依赖的package包/类
@SubscribeEvent
public void onWorldTick(TickEvent.WorldTickEvent event){
if (needLoad && Minecraft.getMinecraft().ingameGUI != null) {
fileIO.getInstance().loadLanguageFiles();
needLoad = false;
}
}