本文整理匯總了Java中net.minecraftforge.fml.common.gameevent.TickEvent.WorldTickEvent方法的典型用法代碼示例。如果您正苦於以下問題:Java TickEvent.WorldTickEvent方法的具體用法?Java TickEvent.WorldTickEvent怎麽用?Java TickEvent.WorldTickEvent使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在類net.minecraftforge.fml.common.gameevent.TickEvent
的用法示例。
在下文中一共展示了TickEvent.WorldTickEvent方法的13個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Java代碼示例。
示例1: 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.
}
}
}
示例2: 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();
}
}
}
示例3: 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());
}
}
示例4: onTick
import net.minecraftforge.fml.common.gameevent.TickEvent; //導入方法依賴的package包/類
@SubscribeEvent
public void onTick(TickEvent.WorldTickEvent event)
{
//only run this stuff if we are in the right world
if(!event.world.equals(this.worldObj))return;
//tick down time alive
alive--;
//if we've run out of time, delete self and replace with previous block and tile entity.
//I wonder if this will work?
if(alive<=0)
{
this.worldObj.setBlockState(this.pos,this.prev);
this.worldObj.setTileEntity(this.pos,this.tile);
}
}
示例5: 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++;
}
}
示例6: onWorldTick
import net.minecraftforge.fml.common.gameevent.TickEvent; //導入方法依賴的package包/類
@SubscribeEvent
public void onWorldTick(TickEvent.WorldTickEvent e) {
if (!e.world.isRemote && e.phase == TickEvent.Phase.START && e.world.provider.getDimension() == 0) {
long now = Instant.now().getEpochSecond();
if (now - lastCheck > checkInterval) {
BlockPos spawn = e.world.getSpawnPoint();
for (int i = 0; i < e.world.playerEntities.size(); i++)
{
EntityPlayer p = e.world.playerEntities.get(i);
// If the user is inside the zone radius, force them back to creative
if (p.getDistance(spawn.getX(), p.posY, spawn.getZ()) < zoneRadius) {
p.setGameType(GameType.CREATIVE);
} else {
// Otherwise, the user is outside the radius and we need to force
// them back to survival (assuming they're not on the whitelist)
if (!whitelist.contains(p.getName())) {
p.setGameType(GameType.SURVIVAL);
}
}
}
lastCheck = now;
}
}
}
示例7: onUpdate
import net.minecraftforge.fml.common.gameevent.TickEvent; //導入方法依賴的package包/類
@SubscribeEvent
public static void onUpdate(TickEvent.WorldTickEvent event)
{
if(event.side == Side.SERVER && event.phase == TickEvent.Phase.END)
{
openContainers.values().forEach(ContainerWrapper::update);
}
}
示例8: onWorldTick
import net.minecraftforge.fml.common.gameevent.TickEvent; //導入方法依賴的package包/類
@SubscribeEvent
public void onWorldTick(TickEvent.WorldTickEvent event){
if(DifficultyManager.enabled) {
DifficultyManager.onWorldTick(event.world.provider.getDimension());
MobUpkeepController.tick(event.world);
}
}
示例9: onWorldTick
import net.minecraftforge.fml.common.gameevent.TickEvent; //導入方法依賴的package包/類
@SubscribeEvent
public void onWorldTick(TickEvent.WorldTickEvent event) {
if (event.type == TickEvent.Type.WORLD && tick >= 40) {
TreeFluidExtractorTile.WoodLodProgress.woodLodProgressList.stream().filter(woodLodProgress -> woodLodProgress.getProgress() > 0).forEach(woodLodProgress -> woodLodProgress.getWorld().sendBlockBreakProgress(woodLodProgress.getBreakID(), woodLodProgress.getBlockPos(), woodLodProgress.getProgress() - 1));
tick = 0;
}
++tick;
}
示例10: onWorldTick
import net.minecraftforge.fml.common.gameevent.TickEvent; //導入方法依賴的package包/類
@SubscribeEvent
public void onWorldTick(TickEvent.WorldTickEvent evt) {
if (evt.phase == TickEvent.Phase.START) {
return;
}
World world = evt.world;
DimensionData data = getDimensionData(world);
if (data != null) {
data.worldTick(world);
}
}
示例11: doNextTick
import net.minecraftforge.fml.common.gameevent.TickEvent; //導入方法依賴的package包/類
@SubscribeEvent
public void doNextTick(TickEvent.WorldTickEvent event)
{
//only tick in this dimension
if(event.world.provider.getDimension()!=this.player.worldObj.provider.getDimension())
{
return;
}
//make sure player is still holding item
if((this.startPoint==StartPoint.RIGHT_CLICK||this.startPoint==StartPoint.SNEAK_RIGHT||this.startPoint==StartPoint.BLOCK_BREAK)
&&!(this.player.getHeldItem(EnumHand.MAIN_HAND)== RunicItem ||this.player.getHeldItem(EnumHand.OFF_HAND)== RunicItem)) {
done();
return;
}
this.processesThisTick=0;
variablesChanged=false;
//update script
compiledSymbols = ModDust.getScriptFromItem(RunicItem);
//run through our list until we've hit max processes
while(this.processesThisTick<processesPerTick&&actionQueue.size()>2)
{
processesThisTick++;
try {
resolveNextOutput();
}
catch(NullPointerException e)
{
}
}
if(actionQueue.size()<3) done();
if(variablesChanged)
ModDust.loadScriptToItem(compiledSymbols, RunicItem);
}
示例12: onWorldTick
import net.minecraftforge.fml.common.gameevent.TickEvent; //導入方法依賴的package包/類
@SubscribeEvent
public void onWorldTick(TickEvent.WorldTickEvent evt)
{
if (evt.world.hasCapability(ExPWorldCapability.worldCap, null) && evt.phase == Phase.END && evt.world.provider.getDimension() == 0)
{
IExPWorld.of(evt.world).onTick();
if (evt.world.isRaining() && evt.world instanceof WorldServer)
{
WeatherUtils.handleServerTick((WorldServer) evt.world);
}
}
}
示例13: onWorldTick
import net.minecraftforge.fml.common.gameevent.TickEvent; //導入方法依賴的package包/類
@SubscribeEvent
public void onWorldTick(TickEvent.WorldTickEvent event) {
if (!event.world.isRemote) {
syncWithPlayers(event.world);
}
}