@SubscribeEvent public void onEntitySpawn(LivingSpawnEvent.CheckSpawn evt) { if (evt.getResult() == Result.DENY || evt.isSpawner()) { return; } if (InhibitorConfig.stopAllSlimes.get() && evt.getEntity() instanceof EntitySlime) { evt.setResult(Result.DENY); return; } if (InhibitorConfig.stopAllSquid.get() && evt.getEntity().getClass() == EntitySquid.class) { evt.setResult(Result.DENY); return; } Map<BlockPos, ISpawnCallback> guards = getGuardsForWorld(evt.getWorld()); for (ISpawnCallback guard : guards.values()) { ISpawnCallback.Result result = guard.isSpawnPrevented(evt.getEntityLiving()); if (result == ISpawnCallback.Result.DENY) { evt.setResult(Result.DENY); return; } else if (result == ISpawnCallback.Result.DONE) { return; } } }
@SubscribeEvent public void onEntityCheckSpawn(LivingSpawnEvent.CheckSpawn event) { IBlockState blockState = event.getWorld().getBlockState(new BlockPos(event.getX() - 0.4F, event.getY(), event.getZ() - 0.4F).down()); if (blockState.getBlock().equals(ModBlocks.castle_block)) { if (BlockCastleBlock.EnumType.DARK_STONE.equals(blockState.getValue(BlockCastleBlock.VARIANT)) || !event.getEntity().isCreatureType(VReference.VAMPIRE_CREATURE_TYPE, false)) { event.setResult(Event.Result.DENY); } } else if (blockState.getBlock() instanceof BlockCastleStairs) { if (ModBlocks.castle_stairs_dark_stone.equals(blockState.getBlock()) || !event.getEntity().isCreatureType(VReference.VAMPIRE_CREATURE_TYPE, false)) { event.setResult(Event.Result.DENY); } } }
@SubscribeEvent public static void onEntitySpawn(LivingSpawnEvent.CheckSpawn evt) { if (evt.getResult() != Result.DENY && EntitySpawnPlacementRegistry .getPlacementForEntity(evt.getEntity().getClass()) == EntityLiving.SpawnPlacementType.IN_WATER && evt.getWorld().getBlockState(evt.getEntityLiving().getPosition()).getBlock() instanceof BlockFluidEnder) { evt.setResult(Result.DENY); } return; }
@SubscribeEvent public static void onSpawn(final LivingSpawnEvent.CheckSpawn event) { if (event.getEntity() instanceof EntityMobPassive || event.getEntity() instanceof EntityMobHostileBase) { if(GaiaConfig.DIMENSIONS.dimensionBlacklist.length > 0) { event.setResult(Event.Result.DEFAULT); for (int i : GaiaConfig.DIMENSIONS.dimensionBlacklist) { if (i == event.getWorld().provider.getDimension()) { event.setResult(Event.Result.DENY); } } } } } }
@SubscribeEvent public void debugGaiaSpawn(CheckSpawn event) { if (GaiaConfig.DEBUG.debugSpawn) { if (event.getEntity() instanceof EntityMobPassiveBase || event.getEntity() instanceof EntityMobHostileBase) { EntityLiving living = (EntityLiving) event.getEntity(); if (living.getCanSpawnHere()) { event.setResult(Event.Result.ALLOW); } else { event.setResult(Event.Result.DENY); } } else { event.setResult(Event.Result.DENY); } } }
@SubscribeEvent public void onSpawn(LivingSpawnEvent.CheckSpawn event) { if(event.getResult() != Result.ALLOW && event.getEntityLiving() instanceof IMob && event.getWorld() instanceof WorldServer) { List<EntityPlayer> players = ((WorldServer) event.getWorld()).playerEntities; for(EntityPlayer player : players) if(player.getActivePotionEffect(curse) != null && player.getDistanceSq(event.getEntity()) < curseRange * curseRange) { if(!(event.getEntity() instanceof EntityCreeper)) event.getEntityLiving().addPotionEffect(new PotionEffect(MobEffects.FIRE_RESISTANCE, Integer.MAX_VALUE, 0, false, false)); event.setResult(Result.ALLOW); return; } } }
@SubscribeEvent public void onSpawnCheck(LivingSpawnEvent.CheckSpawn event) { Entity e = event.getEntity(); World world = event.getWorld(); BlockPos pos = e.getPosition(); if(world.getBlockState(pos).getBlock() == black_ash || world.getBlockState(pos.down(2)).getBlock() == black_ash) event.setResult(Result.DENY); }