本文整理汇总了Java中net.minecraftforge.fml.common.gameevent.TickEvent.WorldTickEvent类的典型用法代码示例。如果您正苦于以下问题:Java WorldTickEvent类的具体用法?Java WorldTickEvent怎么用?Java WorldTickEvent使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。
WorldTickEvent类属于net.minecraftforge.fml.common.gameevent.TickEvent包,在下文中一共展示了WorldTickEvent类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: tickWorld
import net.minecraftforge.fml.common.gameevent.TickEvent.WorldTickEvent; //导入依赖的package包/类
public void tickWorld(WorldTickEvent event) {
if(!(event.world instanceof WorldServer))
return;
// System.out.println("TICKING WORLD -> @" + event.world);
// TaleCraft.proxy.tick(event);
GameRules rules = event.world.getGameRules();
//TODO: Fix this
if(rules.getBoolean("tc_disableWeather")) {
// Clear the weather for 5 seconds.
event.world.getWorldInfo().setCleanWeatherTime(20*5);
}
NBTTagCompound current = rules.writeToNBT();
if(!current.equals(gamerules)){
gamerules = current;
TaleCraft.network.sendToAll(new GameruleSyncPacket(current));
}
}
示例2: onServerWorldTick
import net.minecraftforge.fml.common.gameevent.TickEvent.WorldTickEvent; //导入依赖的package包/类
@SubscribeEvent
public void onServerWorldTick(WorldTickEvent event)
{
World world = event.world;
if(event.phase == Phase.START)
{
if(WorldGen.getInstance() != null)
{
if(world.provider.getDimension() == 0)
{
WorldGen.getInstance().trimCache();
WorldGen.getInstance().buildFromQueue();
WorldGen.getInstance().runUpdateLoop(event.world);
}
}
}
}
示例3: onTick
import net.minecraftforge.fml.common.gameevent.TickEvent.WorldTickEvent; //导入依赖的package包/类
@SubscribeEvent
public void onTick(WorldTickEvent event)
{
if(Minecraft.getMinecraft().world != null && ticks++%40==0)
for(TileEntity te : new ArrayList<TileEntity>(Minecraft.getMinecraft().world.loadedTileEntityList))
if(te instanceof TileEntityCaulronBlock && ((TileEntityCaulronBlock)te).isLeader())
Minecraft.getMinecraft().renderGlobal.markBlockRangeForRenderUpdate(te.getPos().getX(), te.getPos().getY(), te.getPos().getZ(),
te.getPos().getX() + ((TileEntityCaulronBlock)te).getSize(), te.getPos().getY() + ((TileEntityCaulronBlock)te).getSize(), te.getPos().getZ() + ((TileEntityCaulronBlock)te).getSize());
}
示例4: serverTick
import net.minecraftforge.fml.common.gameevent.TickEvent.WorldTickEvent; //导入依赖的package包/类
@SubscribeEvent
public void serverTick(WorldTickEvent event) {
if (!event.world.isRemote) {
if (event.phase == Phase.END) {
RedstoneEther.server().tick(event.world);
} else {
RedstoneEtherAddons.server().processSMPMaps(event.world);
}
}
}
示例5: onWorldTick
import net.minecraftforge.fml.common.gameevent.TickEvent.WorldTickEvent; //导入依赖的package包/类
@SubscribeEvent
public static void onWorldTick(WorldTickEvent event) {
WorldServer world = (WorldServer) event.world;
if (world.isRaining()) {
onTickSnowIncrease(world);
} else if (world.provider.isDaytime()) {
onTickSnowDecrease(world);
}
}
示例6: worldTick
import net.minecraftforge.fml.common.gameevent.TickEvent.WorldTickEvent; //导入依赖的package包/类
@SubscribeEvent
public static void worldTick(WorldTickEvent event){
// I only want to tick on the server
if(event.world.isRemote){return;}
// If I don't have this code everything runs twice per tick
if(event.phase == Phase.END){return;}
if(Math.floorMod(event.world.getTotalWorldTime(), tickSpeed) != 0){return;}
TickTracker tickTracker = getTickTrackerForDimension(event.world.provider.getDimension());
if(!tickTracker.trackedWorldHasPlayers()){
if(tickTracker.worldToTick == nextWorldToTick){
tickTracker.hasTicked = true;
findNextWorldToTick();
}
return;
}
if(!tickTracker.hasTicked && tickTracker.worldToTick == nextWorldToTick && event.world.getTotalWorldTime() > lastTickProcessed){
if(dimensionsToTick.contains(tickTracker.worldToTick)){
if(ConfigHandler.LOGGING)LogManager.getLogger().log(Level.INFO, "We're ticking in this dimension: " + tickTracker.worldToTick);
if(tickTracker.trackedWorldHasPlayers() && tickTracker.playerToTick < event.world.playerEntities.size()){
SpawnHandler.attemptSpawnNearPlayer(event.world.playerEntities.get(tickTracker.playerToTick), event.world);
tickTracker.setNextPlayerToTick(event.world);
}
}
tickTracker.hasTicked = true;
findNextWorldToTick();
lastTickProcessed = event.world.getTotalWorldTime();
return;
}
// if we get to this point, a world has probably unloaded and eaten our tick tracker, so find a new world to tick on
if(DimensionManager.getWorld(nextWorldToTick) == null){
if(ConfigHandler.LOGGING)LogManager.getLogger().log(Level.WARN, "Tracker lost, generating new tracker.");
findNextWorldToTick();
}
}
示例7: worldTicked
import net.minecraftforge.fml.common.gameevent.TickEvent.WorldTickEvent; //导入依赖的package包/类
@SubscribeEvent
public void worldTicked(WorldTickEvent event)
{
if(event.phase == TickEvent.Phase.START && event.type == TickEvent.Type.WORLD)
{
if(event.world.getGameRules().getBoolean("teleportXP") || ModConfig.ignoreGamerule)
{
for(int i = 0; i < event.world.loadedEntityList.size(); i++)
{
if(event.world.loadedEntityList.get(i) instanceof EntityXPOrb)
{
EntityXPOrb xpOrb = (EntityXPOrb) event.world.loadedEntityList.get(i);
EntityPlayer player;
if (ModConfig.prioritizeNonCreative)
{
player = event.world.getNearestPlayerNotCreative(xpOrb, Double.MAX_VALUE);
if(player != null)
{
xpOrb.setPosition(player.posX, player.posY, player.posZ);
return;
}
}
player = event.world.getClosestPlayerToEntity(xpOrb, Double.MAX_VALUE);
if(player != null)
{
xpOrb.setPosition(player.posX, player.posY, player.posZ);
}
}
}
}
}
}
示例8: cleanUp
import net.minecraftforge.fml.common.gameevent.TickEvent.WorldTickEvent; //导入依赖的package包/类
@SubscribeEvent
public void cleanUp(WorldTickEvent event) {
if (event.world.getTotalWorldTime() % 20 != 0) {
return;
}
despawnLogic(event, NemesisRegistryProvider.get(event.world));
}
示例9: despawnLogic
import net.minecraftforge.fml.common.gameevent.TickEvent.WorldTickEvent; //导入依赖的package包/类
private void despawnLogic(WorldTickEvent event, INemesisRegistry registry) {
registry.list().forEach((NemesisEntry nemesis) -> {
if (nemesis.isSpawned()) {
if (shouldBeDespawned(event.world, nemesis)) {
despawnNemesis(event.world, registry, nemesis);
} else {
unloadNemesis(event.world, registry, nemesis);
}
}
});
}
示例10: onWorldTick
import net.minecraftforge.fml.common.gameevent.TickEvent.WorldTickEvent; //导入依赖的package包/类
@SubscribeEvent
public void onWorldTick(WorldTickEvent event)
{
if (event.phase != Phase.END) { return; } // Only doing it once
if (event.side == Side.CLIENT) { return; }
upkeepTick += 1;
if (upkeepTick >= Main.getConsumeUpkeepTick())
{
TerritoryHandler.consumeUpkeep(event.world);
upkeepTick = 0; // Reset
}
}
示例11: onTick
import net.minecraftforge.fml.common.gameevent.TickEvent.WorldTickEvent; //导入依赖的package包/类
@SubscribeEvent
public void onTick(WorldTickEvent event) {
if (event.phase == Phase.START) {
onTickStart();
} else if (event.phase == Phase.END) {
onTickEnd();
}
}
示例12: handleWorldTick
import net.minecraftforge.fml.common.gameevent.TickEvent.WorldTickEvent; //导入依赖的package包/类
@SubscribeEvent
public void handleWorldTick(WorldTickEvent event) {
if (queue.size() < 1) {
return;
}
runNextQueueItem();
}
示例13: handleWorldTick
import net.minecraftforge.fml.common.gameevent.TickEvent.WorldTickEvent; //导入依赖的package包/类
@SubscribeEvent
public void handleWorldTick(WorldTickEvent event) {
if (runQueue.size() < 1) {
return;
}
runNextQueueItem();
}
示例14: worldTick
import net.minecraftforge.fml.common.gameevent.TickEvent.WorldTickEvent; //导入依赖的package包/类
@SubscribeEvent
public void worldTick(WorldTickEvent event) {
if (event.phase == Phase.END && !event.world.isRemote) {
ChunkLoaderManager.onTickEnd((WorldServer) event.world);
PlayerChunkViewerManager.instance().calculateChunkChanges((WorldServer) event.world);
}
}
示例15: tickWorld
import net.minecraftforge.fml.common.gameevent.TickEvent.WorldTickEvent; //导入依赖的package包/类
public void tickWorld(WorldTickEvent event) {
TCWorldManager mng = TaleCraft.worldsManager.fetchManager(event.world);
if(mng == null) {
TaleCraft.logger.error("No WorldManager for @" + event.world.hashCode());
return;
}
mng.tickWorld(event);
}