当前位置: 首页>>代码示例>>Java>>正文


Java EntityEvent.EnteringChunk方法代码示例

本文整理汇总了Java中net.minecraftforge.event.entity.EntityEvent.EnteringChunk方法的典型用法代码示例。如果您正苦于以下问题:Java EntityEvent.EnteringChunk方法的具体用法?Java EntityEvent.EnteringChunk怎么用?Java EntityEvent.EnteringChunk使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在net.minecraftforge.event.entity.EntityEvent的用法示例。


在下文中一共展示了EntityEvent.EnteringChunk方法的7个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: onEnterChunk

import net.minecraftforge.event.entity.EntityEvent; //导入方法依赖的package包/类
@SubscribeEvent
public void onEnterChunk(EntityEvent.EnteringChunk event)
{
    if(FMLCommonHandler.instance().getEffectiveSide().isServer() && (event.entity instanceof EntityMeteorite || event.entity instanceof EntityPigzilla) && !event.entity.isDead)
    {
        ForgeChunkManager.Ticket ticket = ChunkLoadHandler.tickets.get(event.entity);
        if(ticket == null)
        {
            ticket = ForgeChunkManager.requestTicket(ItFellFromTheSky.instance, event.entity.worldObj, ForgeChunkManager.Type.ENTITY);
            if(ticket != null)
            {
                ticket.bindEntity(event.entity);
                ChunkLoadHandler.addTicket(event.entity, ticket);
            }
        }
        if(ticket != null)
        {
            if(event.oldChunkX != 0 && event.oldChunkZ != 0)
            {
                ForgeChunkManager.unforceChunk(ticket, new ChunkCoordIntPair(event.oldChunkX, event.oldChunkZ));
            }
            ForgeChunkManager.forceChunk(ticket, new ChunkCoordIntPair(event.newChunkX, event.newChunkZ));
        }
    }
}
 
开发者ID:iChun,项目名称:ItFellFromTheSky,代码行数:26,代码来源:EventHandler.java

示例2: handleEnteringProvince

import net.minecraftforge.event.entity.EntityEvent; //导入方法依赖的package包/类
@SubscribeEvent
public void handleEnteringProvince(EntityEvent.EnteringChunk event) {
	if (!(event.getEntity() instanceof EntityPlayerMP)) {
		return;
	}
	EntityPlayerMP player = (EntityPlayerMP) event.getEntity();
	PlayerCivilizationCapabilityImpl.get(player).updatePlayerLocation(event.getNewChunkX(), event.getNewChunkZ());
}
 
开发者ID:ToroCraft,项目名称:ToroQuest,代码行数:9,代码来源:CivilizationHandlers.java

示例3: entityEnteredChunk

import net.minecraftforge.event.entity.EntityEvent; //导入方法依赖的package包/类
@SubscribeEvent
public void entityEnteredChunk(EntityEvent.EnteringChunk event) {
    Entity entity = event.entity;
    if (entity instanceof LocoBase) {
        if (!entity.worldObj.isRemote) {
            ((LocoBase) entity).forceChunkLoading(event.newChunkX, event.newChunkZ);
        } else {
            ((LocoBase) entity).setupChunks(event.newChunkX, event.newChunkZ);
        }
    }
}
 
开发者ID:NSDN,项目名称:NyaSamaRailway,代码行数:12,代码来源:ChunkLoaderHandler.java

示例4: on

import net.minecraftforge.event.entity.EntityEvent; //导入方法依赖的package包/类
@SubscribeEvent(priority = EventPriority.HIGHEST)
public void on(EntityEvent.EnteringChunk event) {
    if(event.entity instanceof EntityGolemBase) {
        EntityGolemBase golem = (EntityGolemBase) event.entity;
        if(GadomancyApi.isAdditionalGolemType(golem.getGolemType())) {
            ExtendedGolemProperties props = (ExtendedGolemProperties)event.entity.getExtendedProperties(Gadomancy.MODID);
            if(props.shouldUpdateHealth()) {
                props.resetUpdateHealth();
                golem.setHealth(props.getHealth());
            }
        }
    }
}
 
开发者ID:makeoo,项目名称:Gadomancy,代码行数:14,代码来源:EventHandlerGolem.java

示例5: onEntityItemUpdate

import net.minecraftforge.event.entity.EntityEvent; //导入方法依赖的package包/类
@SubscribeEvent
public void onEntityItemUpdate(EntityEvent.EnteringChunk parEvent)
{
	if (!REFORESTATION) return;
	if (!(parEvent.entity instanceof EntityItem)) return;

	EntityItem entityitem = (EntityItem) parEvent.entity;
	ItemStack itemstack = entityitem.getDataWatcher().getWatchableObjectItemStack(10);
	if (itemstack == null || !(Block.getBlockFromItem(itemstack.getItem()) instanceof BlockSapling)) return;
	entityitem.lifespan = REFOREST_AGE;
}
 
开发者ID:andykuo1,项目名称:mcplus_mods,代码行数:12,代码来源:EventHandlerOvergrowth.java

示例6: enterChunk

import net.minecraftforge.event.entity.EntityEvent; //导入方法依赖的package包/类
@SubscribeEvent
public void enterChunk(EntityEvent.EnteringChunk event) {
    if (event.entity instanceof EntityPlayer) {
        BiomeGenBase biome = event.entity.worldObj.getBiomeGenForCoords(event.newChunkX * 16, event.newChunkZ * 16);

        if (biome instanceof IBiomeAnomaly)
            NetworkHandler.wrapper.sendToServer(new MessageDiscoveryItem(QADiscoveries.Item.BIOME.get().getKey()));

        if (biome.equals(BiomeGenBase.sky))
            NetworkHandler.wrapper.sendToServer(new MessageDiscoveryItem(QADiscoveries.Item.CHAOS.get().getKey()));

    }
}
 
开发者ID:MSourceCoded,项目名称:Quantum-Anomalies,代码行数:14,代码来源:BiomeListener.java

示例7: onSpawnInChunk

import net.minecraftforge.event.entity.EntityEvent; //导入方法依赖的package包/类
@ForgeSubscribe
public void onSpawnInChunk(EntityEvent.EnteringChunk event) {
	if (event.entity.posX > event.newChunkX * 16 + 16 || event.entity.posX < event.newChunkX * 16 || event.entity.posZ > event.newChunkZ * 16 + 16
			|| event.entity.posZ < event.newChunkZ * 16) {
		if (MaemeConfig.printErrors)
			System.out.println("Fixing entity");
		event.entity.posX = RandomHelper.getRandomNumberBetween(0, 15) + event.newChunkX * 16;
		event.entity.posZ = RandomHelper.getRandomNumberBetween(0, 15) + event.newChunkZ * 16;
	}
}
 
开发者ID:uzzaco2002,项目名称:secri,代码行数:11,代码来源:EntitySpawning.java


注:本文中的net.minecraftforge.event.entity.EntityEvent.EnteringChunk方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。