Search in sources :

Example 6 with EntityMagmaCube

use of net.minecraft.entity.monster.EntityMagmaCube in project UtilityClient2 by Utility-Client.

the class ModelMagmaCube method setLivingAnimations.

/**
 * Used for easily adding entity-dependent animations. The second and third float params here are the same second
 * and third as in the setRotationAngles method.
 */
public void setLivingAnimations(EntityLivingBase entitylivingbaseIn, float p_78086_2_, float p_78086_3_, float partialTickTime) {
    EntityMagmaCube entitymagmacube = (EntityMagmaCube) entitylivingbaseIn;
    float f = entitymagmacube.prevSquishFactor + (entitymagmacube.squishFactor - entitymagmacube.prevSquishFactor) * partialTickTime;
    if (f < 0.0F) {
        f = 0.0F;
    }
    for (int i = 0; i < this.segments.length; ++i) {
        this.segments[i].rotationPointY = (float) (-(4 - i)) * f * 1.7F;
    }
}
Also used : EntityMagmaCube(net.minecraft.entity.monster.EntityMagmaCube)

Example 7 with EntityMagmaCube

use of net.minecraft.entity.monster.EntityMagmaCube in project EnderIO by SleepyTrousers.

the class ModelDireSlime method setLivingAnimations.

@Override
public void setLivingAnimations(@Nonnull EntityLivingBase p_78086_1_, float p_78086_2_, float p_78086_3_, float p_78086_4_) {
    EntityMagmaCube entitymagmacube = (EntityMagmaCube) p_78086_1_;
    float f3 = entitymagmacube.prevSquishFactor + (entitymagmacube.squishFactor - entitymagmacube.prevSquishFactor) * p_78086_4_;
    int size = entitymagmacube.getSlimeSize();
    if (f3 < 0.0F) {
        f3 = 0.0F;
    }
    if (size > 1) {
        int i = (p_78086_1_.ticksExisted >> 2) % 8;
        coreRenderer = coreRenderers[i];
    } else {
        coreRenderer = coreRendererClay;
    }
    coreRenderer.rotationPointY = f3 * 1.7F;
    for (int i = 0; i < this.sliceRenderers.length; ++i) {
        this.sliceRenderers[i].rotationPointY = (-(4 - i)) * f3 * 1.7F;
    }
}
Also used : EntityMagmaCube(net.minecraft.entity.monster.EntityMagmaCube)

Example 8 with EntityMagmaCube

use of net.minecraft.entity.monster.EntityMagmaCube in project kull by Sxmurai.

the class ModelMagmaCube method setLivingAnimations.

/**
 * Used for easily adding entity-dependent animations. The second and third float params here are the same second
 * and third as in the setRotationAngles method.
 */
public void setLivingAnimations(EntityLivingBase entitylivingbaseIn, float p_78086_2_, float p_78086_3_, float partialTickTime) {
    EntityMagmaCube entitymagmacube = (EntityMagmaCube) entitylivingbaseIn;
    float f = entitymagmacube.prevSquishFactor + (entitymagmacube.squishFactor - entitymagmacube.prevSquishFactor) * partialTickTime;
    if (f < 0.0F) {
        f = 0.0F;
    }
    for (int i = 0; i < this.segments.length; ++i) {
        this.segments[i].rotationPointY = (float) (-(4 - i)) * f * 1.7F;
    }
}
Also used : EntityMagmaCube(net.minecraft.entity.monster.EntityMagmaCube)

Example 9 with EntityMagmaCube

use of net.minecraft.entity.monster.EntityMagmaCube in project SkyblockAddons by BiscuitDevelopment.

the class PlayerListener method onEntitySpawn.

@SubscribeEvent()
public void onEntitySpawn(EntityEvent.EnteringChunk e) {
    Entity entity = e.entity;
    if (main.getUtils().isOnSkyblock() && main.getConfigValues().isEnabled(Feature.ZEALOT_COUNTER_EXPLOSIVE_BOW_SUPPORT) && entity instanceof EntityArrow) {
        EntityArrow arrow = (EntityArrow) entity;
        EntityPlayerSP p = Minecraft.getMinecraft().thePlayer;
        ItemStack heldItem = p.getHeldItem();
        if (heldItem != null && "EXPLOSIVE_BOW".equals(ItemUtils.getSkyBlockItemID(heldItem))) {
            AxisAlignedBB playerRadius = new AxisAlignedBB(p.posX - 3, p.posY - 3, p.posZ - 3, p.posX + 3, p.posY + 3, p.posZ + 3);
            if (playerRadius.isVecInside(arrow.getPositionVector())) {
                // System.out.println("Spawned explosive arrow!");
                main.getNewScheduler().scheduleRepeatingTask(new SkyblockRunnable() {

                    @Override
                    public void run() {
                        if (arrow.isDead || arrow.isCollided || arrow.inGround) {
                            cancel();
                            // System.out.println("Arrow is done, added an explosion!");
                            Vec3 explosionLocation = new Vec3(arrow.posX, arrow.posY, arrow.posZ);
                            explosiveBowExplosions.put(System.currentTimeMillis(), explosionLocation);
                            recentlyKilledZealots.keySet().removeIf((killedTime) -> System.currentTimeMillis() - killedTime > 150);
                            Set<Vec3> filteredRecentlyKilledZealots = new HashSet<>();
                            for (Map.Entry<Long, Set<Vec3>> recentlyKilledZealotEntry : recentlyKilledZealots.entrySet()) {
                                filteredRecentlyKilledZealots.addAll(recentlyKilledZealotEntry.getValue());
                            }
                            if (filteredRecentlyKilledZealots.isEmpty())
                                return;
                            for (Vec3 zealotDeathLocation : filteredRecentlyKilledZealots) {
                                double distance = explosionLocation.distanceTo(zealotDeathLocation);
                                System.out.println("Distance was " + distance + "!");
                                if (distance < 4.6) {
                                    // possibleZealotsKilled--;
                                    main.getPersistentValues().addKill();
                                    EndstoneProtectorManager.onKill();
                                }
                            }
                        // System.out.println((originalPossibleZealotsKilled-possibleZealotsKilled)+" zealots were actually killed...");
                        }
                    }
                }, 0, 1);
            }
        }
    }
    if (main.getUtils().getLocation() == Location.BLAZING_FORTRESS) {
        if (magmaBossSpawnArea.isVecInside(new Vec3(entity.posX, entity.posY, entity.posZ))) {
            // timers will trigger if 15 magmas/8 blazes spawn in the box within a 4 second time period
            long currentTime = System.currentTimeMillis();
            if (e.entity instanceof EntityMagmaCube) {
                if (!recentlyLoadedChunks.contains(new IntPair(e.newChunkX, e.newChunkZ)) && entity.ticksExisted == 0) {
                    recentMagmaCubes++;
                    main.getScheduler().schedule(Scheduler.CommandType.SUBTRACT_MAGMA_COUNT, 4);
                    if (recentMagmaCubes >= 17) {
                        magmaTime = 600;
                        magmaAccuracy = EnumUtils.MagmaTimerAccuracy.EXACTLY;
                        if (currentTime - lastMagmaWavePost > 300000) {
                            lastMagmaWavePost = currentTime;
                            main.getUtils().sendInventiveTalentPingRequest(EnumUtils.MagmaEvent.MAGMA_WAVE);
                        }
                    }
                }
            } else if (e.entity instanceof EntityBlaze) {
                if (!recentlyLoadedChunks.contains(new IntPair(e.newChunkX, e.newChunkZ)) && entity.ticksExisted == 0) {
                    recentBlazes++;
                    main.getScheduler().schedule(Scheduler.CommandType.SUBTRACT_BLAZE_COUNT, 4);
                    if (recentBlazes >= 10) {
                        magmaTime = 1200;
                        magmaAccuracy = EnumUtils.MagmaTimerAccuracy.EXACTLY;
                        if (currentTime - lastBlazeWavePost > 300000) {
                            lastBlazeWavePost = currentTime;
                            main.getUtils().sendInventiveTalentPingRequest(EnumUtils.MagmaEvent.BLAZE_WAVE);
                        }
                    }
                }
            }
        }
    }
}
Also used : AxisAlignedBB(net.minecraft.util.AxisAlignedBB) IslandWarpGui(codes.biscuit.skyblockaddons.gui.IslandWarpGui) Backpack(codes.biscuit.skyblockaddons.features.backpacks.Backpack) EntitySlime(net.minecraft.entity.monster.EntitySlime) EntityEnderman(net.minecraft.entity.monster.EntityEnderman) InputEvent(net.minecraftforge.fml.common.gameevent.InputEvent) IntPair(codes.biscuit.skyblockaddons.utils.objects.IntPair) ContainerChest(net.minecraft.inventory.ContainerChest) Keyboard(org.lwjgl.input.Keyboard) NPCUtils(codes.biscuit.skyblockaddons.core.npc.NPCUtils) Message(codes.biscuit.skyblockaddons.core.Message) Matcher(java.util.regex.Matcher) ChatComponentText(net.minecraft.util.ChatComponentText) Attribute(codes.biscuit.skyblockaddons.core.Attribute) EntityMagmaCube(net.minecraft.entity.monster.EntityMagmaCube) FillBucketEvent(net.minecraftforge.event.entity.player.FillBucketEvent) EntityPlayerSP(net.minecraft.client.entity.EntityPlayerSP) PowerOrbManager(codes.biscuit.skyblockaddons.features.powerorbs.PowerOrbManager) EnumChatFormatting(net.minecraft.util.EnumChatFormatting) NBTTagCompound(net.minecraft.nbt.NBTTagCompound) Vec3(net.minecraft.util.Vec3) EntityArmorStand(net.minecraft.entity.item.EntityArmorStand) ChunkEvent(net.minecraftforge.event.world.ChunkEvent) AxisAlignedBB(net.minecraft.util.AxisAlignedBB) Sets(com.google.common.collect.Sets) EventPriority(net.minecraftforge.fml.common.eventhandler.EventPriority) EntityJoinWorldEvent(net.minecraftforge.event.entity.EntityJoinWorldEvent) LivingEvent(net.minecraftforge.event.entity.living.LivingEvent) EntityPlayer(net.minecraft.entity.player.EntityPlayer) ItemTooltipEvent(net.minecraftforge.event.entity.player.ItemTooltipEvent) GuiChestHook(codes.biscuit.skyblockaddons.asm.hooks.GuiChestHook) ClientChatReceivedEvent(net.minecraftforge.client.event.ClientChatReceivedEvent) codes.biscuit.skyblockaddons.utils(codes.biscuit.skyblockaddons.utils) Pattern(java.util.regex.Pattern) TabEffectManager(codes.biscuit.skyblockaddons.features.tabtimers.TabEffectManager) TickEvent(net.minecraftforge.fml.common.gameevent.TickEvent) Container(net.minecraft.inventory.Container) EnchantedItemBlacklist(codes.biscuit.skyblockaddons.features.EnchantedItemBlacklist) Setter(lombok.Setter) java.util(java.util) Feature(codes.biscuit.skyblockaddons.core.Feature) Getter(lombok.Getter) EntityFishHook(net.minecraft.entity.projectile.EntityFishHook) EndstoneProtectorManager(codes.biscuit.skyblockaddons.features.EndstoneProtectorManager) GuiScreenEvent(net.minecraftforge.client.event.GuiScreenEvent) EntityArrow(net.minecraft.entity.projectile.EntityArrow) ItemStack(net.minecraft.item.ItemStack) Minecraft(net.minecraft.client.Minecraft) ThreadLocalRandom(java.util.concurrent.ThreadLocalRandom) SkyblockRunnable(codes.biscuit.skyblockaddons.misc.scheduler.SkyblockRunnable) PlayerInteractEvent(net.minecraftforge.event.entity.player.PlayerInteractEvent) Entity(net.minecraft.entity.Entity) SkyblockAddons(codes.biscuit.skyblockaddons.SkyblockAddons) Items(net.minecraft.init.Items) EnderTeleportEvent(net.minecraftforge.event.entity.living.EnderTeleportEvent) KeyBinding(net.minecraft.client.settings.KeyBinding) BackpackManager(codes.biscuit.skyblockaddons.features.backpacks.BackpackManager) GuiChest(net.minecraft.client.gui.inventory.GuiChest) Scheduler(codes.biscuit.skyblockaddons.misc.scheduler.Scheduler) GuiScreen(net.minecraft.client.gui.GuiScreen) EntityBlaze(net.minecraft.entity.monster.EntityBlaze) LivingDeathEvent(net.minecraftforge.event.entity.living.LivingDeathEvent) GuiOpenEvent(net.minecraftforge.client.event.GuiOpenEvent) IInventory(net.minecraft.inventory.IInventory) CooldownManager(codes.biscuit.skyblockaddons.features.cooldowns.CooldownManager) SubscribeEvent(net.minecraftforge.fml.common.eventhandler.SubscribeEvent) EntityOtherPlayerMP(net.minecraft.client.entity.EntityOtherPlayerMP) EntityEvent(net.minecraftforge.event.entity.EntityEvent) Location(codes.biscuit.skyblockaddons.core.Location) BaitManager(codes.biscuit.skyblockaddons.features.BaitManager) AttackEntityEvent(net.minecraftforge.event.entity.player.AttackEntityEvent) Entity(net.minecraft.entity.Entity) EntityArrow(net.minecraft.entity.projectile.EntityArrow) SkyblockRunnable(codes.biscuit.skyblockaddons.misc.scheduler.SkyblockRunnable) IntPair(codes.biscuit.skyblockaddons.utils.objects.IntPair) EntityBlaze(net.minecraft.entity.monster.EntityBlaze) Vec3(net.minecraft.util.Vec3) EntityPlayerSP(net.minecraft.client.entity.EntityPlayerSP) ItemStack(net.minecraft.item.ItemStack) EntityMagmaCube(net.minecraft.entity.monster.EntityMagmaCube) SubscribeEvent(net.minecraftforge.fml.common.eventhandler.SubscribeEvent)

Example 10 with EntityMagmaCube

use of net.minecraft.entity.monster.EntityMagmaCube in project SkyblockAddons by BiscuitDevelopment.

the class PlayerListener method onClientTickMagma.

/**
 * The main timer for the magma boss checker.
 */
@SubscribeEvent()
public void onClientTickMagma(TickEvent.ClientTickEvent e) {
    if (e.phase == TickEvent.Phase.START) {
        Minecraft mc = Minecraft.getMinecraft();
        if (main.getConfigValues().isEnabled(Feature.MAGMA_WARNING) && main.getUtils().isOnSkyblock()) {
            if (mc != null && mc.theWorld != null) {
                if (magmaTick % 5 == 0) {
                    boolean foundBoss = false;
                    long currentTime = System.currentTimeMillis();
                    for (Entity entity : mc.theWorld.loadedEntityList) {
                        // Loop through all the entities.
                        if (entity instanceof EntityMagmaCube) {
                            EntitySlime magma = (EntitySlime) entity;
                            if (magma.getSlimeSize() > 10) {
                                // Find a big magma boss
                                foundBoss = true;
                                if ((lastBoss == -1 || System.currentTimeMillis() - lastBoss > 1800000)) {
                                    lastBoss = System.currentTimeMillis();
                                    // Enable warning and disable again in four seconds.
                                    main.getRenderListener().setTitleFeature(Feature.MAGMA_WARNING);
                                    // so the sound plays instantly
                                    magmaTick = 16;
                                    main.getScheduler().schedule(Scheduler.CommandType.RESET_TITLE_FEATURE, main.getConfigValues().getWarningSeconds());
                                // logServer(mc);
                                }
                                magmaAccuracy = EnumUtils.MagmaTimerAccuracy.SPAWNED;
                                if (currentTime - lastBossSpawnPost > 300000) {
                                    lastBossSpawnPost = currentTime;
                                    main.getUtils().sendInventiveTalentPingRequest(EnumUtils.MagmaEvent.BOSS_SPAWN);
                                }
                            }
                        }
                    }
                    if (!foundBoss && main.getRenderListener().getTitleFeature() == Feature.MAGMA_WARNING) {
                        main.getRenderListener().setTitleFeature(null);
                    }
                    if (!foundBoss && magmaAccuracy == EnumUtils.MagmaTimerAccuracy.SPAWNED) {
                        magmaAccuracy = EnumUtils.MagmaTimerAccuracy.ABOUT;
                        magmaTime = 7200;
                        if (currentTime - lastBossDeathPost > 300000) {
                            lastBossDeathPost = currentTime;
                            main.getUtils().sendInventiveTalentPingRequest(EnumUtils.MagmaEvent.BOSS_DEATH);
                        }
                    }
                }
                if (main.getRenderListener().getTitleFeature() == Feature.MAGMA_WARNING && magmaTick % 4 == 0) {
                    // Play sound every 4 ticks or 1/5 second.
                    main.getUtils().playLoudSound("random.orb", 0.5);
                }
            }
        }
        magmaTick++;
        if (magmaTick > 20) {
            if ((magmaAccuracy == EnumUtils.MagmaTimerAccuracy.EXACTLY || magmaAccuracy == EnumUtils.MagmaTimerAccuracy.ABOUT) && magmaTime == 0) {
                magmaAccuracy = EnumUtils.MagmaTimerAccuracy.SPAWNED_PREDICTION;
                main.getScheduler().schedule(Scheduler.CommandType.RESET_MAGMA_PREDICTION, 20);
            }
            magmaTime--;
            magmaTick = 1;
        }
    }
}
Also used : Entity(net.minecraft.entity.Entity) EntitySlime(net.minecraft.entity.monster.EntitySlime) Minecraft(net.minecraft.client.Minecraft) EntityMagmaCube(net.minecraft.entity.monster.EntityMagmaCube) SubscribeEvent(net.minecraftforge.fml.common.eventhandler.SubscribeEvent)

Aggregations

EntityMagmaCube (net.minecraft.entity.monster.EntityMagmaCube)12 EntityBlaze (net.minecraft.entity.monster.EntityBlaze)4 EntityArmorStand (net.minecraft.entity.item.EntityArmorStand)3 EntityEnderman (net.minecraft.entity.monster.EntityEnderman)3 EntitySlime (net.minecraft.entity.monster.EntitySlime)3 ArrayList (java.util.ArrayList)2 Iterator (java.util.Iterator)2 List (java.util.List)2 Minecraft (net.minecraft.client.Minecraft)2 Entity (net.minecraft.entity.Entity)2 EntityTNTPrimed (net.minecraft.entity.item.EntityTNTPrimed)2 EntityCreeper (net.minecraft.entity.monster.EntityCreeper)2 EntityPigZombie (net.minecraft.entity.monster.EntityPigZombie)2 EntityFireball (net.minecraft.entity.projectile.EntityFireball)2 SubscribeEvent (net.minecraftforge.fml.common.eventhandler.SubscribeEvent)2 SkyblockAddons (codes.biscuit.skyblockaddons.SkyblockAddons)1 GuiChestHook (codes.biscuit.skyblockaddons.asm.hooks.GuiChestHook)1 Attribute (codes.biscuit.skyblockaddons.core.Attribute)1 Feature (codes.biscuit.skyblockaddons.core.Feature)1 Location (codes.biscuit.skyblockaddons.core.Location)1