Search in sources :

Example 1 with BiomeGreenVeinFields

use of stevekung.mods.moreplanets.planets.nibiru.world.gen.biome.BiomeGreenVeinFields in project MorePlanets by SteveKunG.

the class GeneralEventHandler method onBlockBreak.

@SubscribeEvent
public void onBlockBreak(BreakEvent event) {
    IBlockState sourceState = event.getState();
    Block sourceBlock = sourceState.getBlock();
    EntityPlayer player = event.getPlayer();
    if (sourceBlock == MPBlocks.INFECTED_FARMLAND && event.getWorld().getBiomeForCoordsBody(event.getPos()) instanceof BiomeGreenVeinFields || player == null) {
        return;
    }
    for (Block block : GeneralEventHandler.INFECTED_BLOCK_LIST) {
        if (sourceBlock == block && !player.isPotionActive(MPPotions.INFECTED_SPORE_PROTECTION) && !player.capabilities.isCreativeMode) {
            player.addPotionEffect(new PotionEffect(MPPotions.INFECTED_SPORE, 60));
        }
    }
    if (sourceBlock.getRegistryName().toString().startsWith("moreplanets")) {
        String sourceName = sourceBlock.getTranslationKey().substring(5);
        if (sourceName.startsWith("infected_purlonite")) {
            return;
        } else {
            if (sourceName.contains("infected") || sourceName.contains("nibiru")) {
                if (!player.isPotionActive(MPPotions.INFECTED_SPORE_PROTECTION) && !player.capabilities.isCreativeMode) {
                    player.addPotionEffect(new PotionEffect(MPPotions.INFECTED_SPORE, 60));
                }
            }
        }
    }
    if (this.isShears(player)) {
        if (sourceBlock == MPBlocks.RED_CANDY_CANE || sourceBlock == MPBlocks.GREEN_CANDY_CANE || sourceBlock == MPBlocks.BLUE_CANDY_CANE || sourceBlock == MPBlocks.ORANGE_CANDY_CANE || sourceBlock == MPBlocks.PINK_CANDY_CANE || sourceBlock == MPBlocks.YELLOW_CANDY_CANE || sourceBlock == MPBlocks.PURPLE_CANDY_CANE || sourceBlock == MPBlocks.RAINBOW_CANDY_CANE) {
            player.getActiveItemStack().damageItem(1, player);
        }
    }
}
Also used : IBlockState(net.minecraft.block.state.IBlockState) PotionEffect(net.minecraft.potion.PotionEffect) BiomeGreenVeinFields(stevekung.mods.moreplanets.planets.nibiru.world.gen.biome.BiomeGreenVeinFields) Block(net.minecraft.block.Block) EntityPlayer(net.minecraft.entity.player.EntityPlayer) SubscribeEvent(net.minecraftforge.fml.common.eventhandler.SubscribeEvent)

Example 2 with BiomeGreenVeinFields

use of stevekung.mods.moreplanets.planets.nibiru.world.gen.biome.BiomeGreenVeinFields in project MorePlanets by SteveKunG.

the class EntityEventHandler method onLivingUpdate.

@SubscribeEvent
public void onLivingUpdate(LivingEvent.LivingUpdateEvent event) {
    EntityLivingBase living = event.getEntityLiving();
    World world = living.world;
    if (living instanceof EntityPlayerMP) {
        EntityPlayerMP player = (EntityPlayerMP) living;
        if (player.isPotionActive(MPPotions.INFECTED_SPORE_PROTECTION) || this.isInOxygen(world, player)) {
            player.removePotionEffect(MPPotions.INFECTED_SPORE);
        }
        if (player.isPotionActive(MPPotions.DARK_ENERGY_PROTECTION)) {
            player.removePotionEffect(MPPotions.DARK_ENERGY);
        }
        if (world.provider instanceof WorldProviderNibiru) {
            if (!this.isGodPlayer(player) && !player.isPotionActive(MPPotions.INFECTED_SPORE_PROTECTION) && !(world.getBiome(player.getPosition()) instanceof BiomeGreenVeinFields)) {
                if (world.isRainingAt(player.getPosition())) {
                    player.addPotionEffect(new PotionEffect(MPPotions.INFECTED_SPORE, 40));
                }
                if (player.ticksExisted % 128 == 0 && !this.isInOxygen(world, player)) {
                    player.addPotionEffect(new PotionEffect(MPPotions.INFECTED_SPORE, 80));
                }
            }
        }
        if (!world.isRemote && world.provider instanceof IMeteorType) {
            this.spawnMeteors(world, player, (IMeteorType) world.provider);
        }
    } else {
        if (ConfigManagerMP.moreplanets_planet_settings.enableInfectedSporeForMobs && world.provider instanceof WorldProviderNibiru) {
            if (!EntityEffectUtils.isGalacticraftMob(living) && !(living instanceof EntityJuicer) && !(world.getBiome(living.getPosition()) instanceof BiomeGreenVeinFields)) {
                if (living.ticksExisted % 128 == 0) {
                    living.addPotionEffect(new PotionEffect(MPPotions.INFECTED_SPORE, 80));
                } else if (world.isRainingAt(living.getPosition())) {
                    living.addPotionEffect(new PotionEffect(MPPotions.INFECTED_SPORE, 40));
                }
            }
        }
    }
    if (living instanceof IMob) {
        for (BlockVec3Dim vec : TileEntityShieldGenerator.LOADED_GENERATORS) {
            if (vec != null && vec.dim == GCCoreUtil.getDimensionID(world)) {
                TileEntity tile = vec.getTileEntity();
                if (tile instanceof TileEntityShieldGenerator) {
                    TileEntityShieldGenerator shield = (TileEntityShieldGenerator) tile;
                    if (!living.world.isRemote && !living.isDead && shield.isInsideShield(living.getPosition()) && !shield.disabled && shield.enableShield && shield.shieldCapacity > 0) {
                        if (!shield.enableDamage) {
                            double d4 = living.getDistance(tile.getPos().getX(), tile.getPos().getY(), tile.getPos().getZ());
                            double d6 = living.posX - tile.getPos().getX();
                            double d8 = living.posY - tile.getPos().getY();
                            double d10 = living.posZ - tile.getPos().getZ();
                            double d11 = MathHelper.sqrt(d6 * d6 + d8 * d8 + d10 * d10);
                            d6 /= d11;
                            d8 /= d11;
                            d10 /= d11;
                            double d13 = (0.0D - d4) * 2.0D / 10.0D;
                            double d14 = d13;
                            double knockback = 10.0D;
                            living.motionX -= d6 * d14 / knockback;
                            living.motionY -= d8 * d14 / knockback;
                            living.motionZ -= d10 * d14 / knockback;
                        }
                        UUID uuid;
                        try {
                            uuid = UUID.fromString(shield.ownerUUID);
                        } catch (Exception e) {
                            // default uuid :)
                            uuid = UUID.fromString("eef3a603-1c1b-4c98-8264-d2f04b231ef4");
                        }
                        if (living.world.getPlayerEntityByUUID(uuid) != null) {
                            if (living.ticksExisted % 8 == 0) {
                                ((WorldServer) living.world).spawnParticle(EnumParticleTypes.CRIT_MAGIC, living.posX, living.posY, living.posZ, 20, 0.0D, 0.5D, 0.0D, 1.0D);
                            }
                            if (shield.enableDamage) {
                                living.attackEntityFrom(DamageSource.causePlayerDamage(living.world.getPlayerEntityByUUID(uuid)), shield.shieldDamage);
                            }
                        } else {
                            if (living.ticksExisted % 8 == 0) {
                                ((WorldServer) living.world).spawnParticle(EnumParticleTypes.CRIT_MAGIC, living.posX, living.posY, living.posZ, 20, 0.0D, 0.5D, 0.0D, 1.0D);
                            }
                            if (shield.enableDamage) {
                                living.attackEntityFrom(DamageSource.GENERIC, shield.shieldDamage);
                            }
                        }
                        float motion = MathHelper.sqrt(living.motionX * living.motionX + living.motionZ * living.motionZ);
                        shield.shieldCapacity -= motion * 2;
                    }
                }
            }
        }
    }
}
Also used : WorldProviderNibiru(stevekung.mods.moreplanets.planets.nibiru.dimension.WorldProviderNibiru) PotionEffect(net.minecraft.potion.PotionEffect) WorldServer(net.minecraft.world.WorldServer) World(net.minecraft.world.World) IMeteorType(stevekung.mods.moreplanets.world.IMeteorType) BlockVec3Dim(micdoodle8.mods.galacticraft.api.vector.BlockVec3Dim) TileEntity(net.minecraft.tileentity.TileEntity) IMob(net.minecraft.entity.monster.IMob) BiomeGreenVeinFields(stevekung.mods.moreplanets.planets.nibiru.world.gen.biome.BiomeGreenVeinFields) EntityJuicer(micdoodle8.mods.galacticraft.planets.venus.entities.EntityJuicer) TileEntityShieldGenerator(stevekung.mods.moreplanets.tileentity.TileEntityShieldGenerator) EntityLivingBase(net.minecraft.entity.EntityLivingBase) EntityPlayerMP(net.minecraft.entity.player.EntityPlayerMP) UUID(java.util.UUID) SubscribeEvent(net.minecraftforge.fml.common.eventhandler.SubscribeEvent)

Example 3 with BiomeGreenVeinFields

use of stevekung.mods.moreplanets.planets.nibiru.world.gen.biome.BiomeGreenVeinFields in project MorePlanets by SteveKunG.

the class BiomeDecoratorNibiruOre method generate.

@Override
protected void generate(Biome biome, World world, Random rand) {
    int i;
    int x = rand.nextInt(16) + 8;
    int z = rand.nextInt(16) + 8;
    this.generateOre(this.dirtGen, EnumOreGen.DIRT, world, rand);
    if (ConfigManagerMP.moreplanets_world_gen_settings.enableCommonOreGenAllPlanets || ConfigManagerMP.moreplanets_world_gen_settings.enableCommonNibiruOre) {
        this.generateOre(this.coalGen, EnumOreGen.COAL, world, rand);
        this.generateOre(this.ironGen, EnumOreGen.IRON, world, rand);
        this.generateOre(this.goldGen, EnumOreGen.GOLD, world, rand);
        this.generateOre(this.redstoneGen, EnumOreGen.REDSTONE, world, rand);
        this.generateOre(this.diamondGen, EnumOreGen.DIAMOND, world, rand);
        this.generateOre(this.tinGen, EnumOreGen.TIN, world, rand);
        this.generateOre(this.copperGen, EnumOreGen.COPPER, world, rand);
        this.generateOre(this.aluminumGen, EnumOreGen.ALUMINUM, world, rand);
        this.generateOre(this.siliconGen, EnumOreGen.SILICON, world, rand);
        this.generateLapis(this.lapisGen, EnumOreGen.LAPIS, world, rand);
    }
    this.generateOre(biome instanceof BiomeGreenVeinFields ? this.purifiedGravelGen : this.infectedGravelGen, EnumOreGen.GRAVEL, world, rand);
    this.generateOre(this.inferumiteGen, 16, 0, 64, world, rand);
    this.generateOre(this.oilGen, 3, 0, 36, world, rand);
    for (i = 0; i < 50; ++i) {
        int y = rand.nextInt(rand.nextInt(248) + 8);
        new WorldGenCaveLiquid(MPBlocks.INFECTED_WATER_FLUID_BLOCK.getDefaultState(), MPBlocks.NIBIRU_ROCK.getDefaultState()).generate(world, rand, this.chunkPos.add(x, y, z));
    }
    for (i = 0; i < 20; ++i) {
        int y = rand.nextInt(rand.nextInt(rand.nextInt(240) + 8) + 8);
        new WorldGenCaveLiquid(Blocks.FLOWING_LAVA.getDefaultState(), MPBlocks.NIBIRU_ROCK.getDefaultState()).generate(world, rand, this.chunkPos.add(x, y, z));
    }
}
Also used : BiomeGreenVeinFields(stevekung.mods.moreplanets.planets.nibiru.world.gen.biome.BiomeGreenVeinFields) WorldGenCaveLiquid(stevekung.mods.stevekunglib.world.gen.WorldGenCaveLiquid)

Aggregations

BiomeGreenVeinFields (stevekung.mods.moreplanets.planets.nibiru.world.gen.biome.BiomeGreenVeinFields)3 PotionEffect (net.minecraft.potion.PotionEffect)2 SubscribeEvent (net.minecraftforge.fml.common.eventhandler.SubscribeEvent)2 UUID (java.util.UUID)1 BlockVec3Dim (micdoodle8.mods.galacticraft.api.vector.BlockVec3Dim)1 EntityJuicer (micdoodle8.mods.galacticraft.planets.venus.entities.EntityJuicer)1 Block (net.minecraft.block.Block)1 IBlockState (net.minecraft.block.state.IBlockState)1 EntityLivingBase (net.minecraft.entity.EntityLivingBase)1 IMob (net.minecraft.entity.monster.IMob)1 EntityPlayer (net.minecraft.entity.player.EntityPlayer)1 EntityPlayerMP (net.minecraft.entity.player.EntityPlayerMP)1 TileEntity (net.minecraft.tileentity.TileEntity)1 World (net.minecraft.world.World)1 WorldServer (net.minecraft.world.WorldServer)1 WorldProviderNibiru (stevekung.mods.moreplanets.planets.nibiru.dimension.WorldProviderNibiru)1 TileEntityShieldGenerator (stevekung.mods.moreplanets.tileentity.TileEntityShieldGenerator)1 IMeteorType (stevekung.mods.moreplanets.world.IMeteorType)1 WorldGenCaveLiquid (stevekung.mods.stevekunglib.world.gen.WorldGenCaveLiquid)1