本文整理汇总了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;
}
}