本文整理匯總了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));
}
}
}
示例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());
}
示例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);
}
}
}
示例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());
}
}
}
}
示例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;
}
示例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()));
}
}
示例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;
}
}