當前位置: 首頁>>代碼示例>>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;未經允許,請勿轉載。