Search in sources :

Example 16 with EnumDemonWillType

use of WayofTime.bloodmagic.soul.EnumDemonWillType in project BloodMagic by WayofTime.

the class HUDElementDemonWillAura method render.

@Override
public void render(Minecraft minecraft, ScaledResolution resolution, float partialTicks) {
    EntityPlayer player = minecraft.player;
    if (!Utils.canPlayerSeeDemonWill(player)) {
        return;
    }
    minecraft.getTextureManager().bindTexture(new ResourceLocation(BloodMagic.MODID, "textures/hud/bars.png"));
    GlStateManager.color(1.0F, 1.0F, 1.0F);
    this.drawTexturedModalRect(getXOffset(), getYOffset(), 0, 105 * 2, 80, 46);
    double maxAmount = Utils.getDemonWillResolution(player);
    int i = 0;
    for (EnumDemonWillType type : barOrder) {
        i++;
        GlStateManager.color(1.0F, 1.0F, 1.0F);
        minecraft.getTextureManager().bindTexture(new ResourceLocation(BloodMagic.MODID, "textures/hud/bars.png"));
        int textureXOffset = (i > 3) ? (i - 3) : (3 - i);
        int maxBarSize = 30 - 2 * textureXOffset;
        double amount = ClientProxy.currentAura == null ? 0 : ClientProxy.currentAura.getWill(type);
        double ratio = Math.max(Math.min(amount / maxAmount, 1), 0);
        double width = maxBarSize * ratio * 2;
        double height = 2;
        double x = getXOffset() + 2 * textureXOffset + 10;
        double y = getYOffset() + 4 * i + 10;
        double textureX = 2 * textureXOffset + 2 * 42;
        double textureY = 4 * i + 220;
        this.drawTexturedModalRect(x, y, textureX, textureY, width, height);
        if (player.isSneaking()) {
            GlStateManager.pushMatrix();
            String value = "" + (int) amount;
            GlStateManager.translate(x - 2 * textureXOffset - value.length() * 0 + 70, (y - 1), 0);
            GlStateManager.scale(0.5, 0.5, 1);
            minecraft.fontRenderer.drawStringWithShadow("" + (int) amount, 0, 2, 0xffffff);
            GlStateManager.popMatrix();
        }
    }
}
Also used : ResourceLocation(net.minecraft.util.ResourceLocation) EntityPlayer(net.minecraft.entity.player.EntityPlayer) EnumDemonWillType(WayofTime.bloodmagic.soul.EnumDemonWillType)

Example 17 with EnumDemonWillType

use of WayofTime.bloodmagic.soul.EnumDemonWillType in project BloodMagic by WayofTime.

the class RegistrarBloodMagicRecipes method registerRecipes.

@SubscribeEvent
public static void registerRecipes(RegistryEvent.Register<IRecipe> event) {
    for (int i = 0; i < ItemSoulGem.names.length; i++) {
        for (EnumDemonWillType willType : EnumDemonWillType.values()) {
            ItemStack baseGemStack = new ItemStack(RegistrarBloodMagicItems.SOUL_GEM, 1, i);
            ItemStack newGemStack = new ItemStack(RegistrarBloodMagicItems.SOUL_GEM, 1, i);
            ((ItemSoulGem) RegistrarBloodMagicItems.SOUL_GEM).setCurrentType(willType, newGemStack);
            ShapelessOreRecipe shapeless = new ShapelessOreRecipe(new ResourceLocation(BloodMagic.MODID, "soul_gem"), newGemStack, baseGemStack, willType.getStack());
            event.getRegistry().register(shapeless.setRegistryName("soul_gem_" + willType.getName()));
        }
    }
    OreDictionary.registerOre("dustIron", ComponentTypes.SAND_IRON.getStack());
    OreDictionary.registerOre("dustGold", ComponentTypes.SAND_GOLD.getStack());
    OreDictionary.registerOre("dustCoal", ComponentTypes.SAND_COAL.getStack());
    PluginUtil.handlePluginStep(PluginUtil.RegistrationStep.RECIPE_REGISTER);
}
Also used : ResourceLocation(net.minecraft.util.ResourceLocation) ShapelessOreRecipe(net.minecraftforge.oredict.ShapelessOreRecipe) ItemSoulGem(WayofTime.bloodmagic.item.soul.ItemSoulGem) EnumDemonWillType(WayofTime.bloodmagic.soul.EnumDemonWillType) ItemStack(net.minecraft.item.ItemStack) SubscribeEvent(net.minecraftforge.fml.common.eventhandler.SubscribeEvent)

Example 18 with EnumDemonWillType

use of WayofTime.bloodmagic.soul.EnumDemonWillType in project BloodMagic by WayofTime.

the class ItemRitualDiviner method addInformation.

@Override
@SideOnly(Side.CLIENT)
public void addInformation(ItemStack stack, World world, List<String> tooltip, ITooltipFlag flag) {
    if (!stack.hasTagCompound())
        return;
    Ritual ritual = RitualRegistry.getRitualForId(this.getCurrentRitual(stack));
    if (ritual != null) {
        tooltip.add(TextHelper.localize("tooltip.bloodmagic.diviner.currentRitual") + TextHelper.localize(ritual.getUnlocalizedName()));
        boolean sneaking = Keyboard.isKeyDown(Keyboard.KEY_RSHIFT) || Keyboard.isKeyDown(Keyboard.KEY_LSHIFT);
        boolean extraInfo = sneaking && Keyboard.isKeyDown(Keyboard.KEY_M);
        if (extraInfo) {
            tooltip.add("");
            for (EnumDemonWillType type : EnumDemonWillType.values()) {
                if (TextHelper.canTranslate(ritual.getUnlocalizedName() + "." + type.getName().toLowerCase() + ".info")) {
                    tooltip.addAll(Arrays.asList(TextHelper.cutLongString(TextHelper.localizeEffect(ritual.getUnlocalizedName() + "." + type.getName().toLowerCase() + ".info"))));
                }
            }
        } else if (sneaking) {
            tooltip.add(TextHelper.localize(tooltipBase + "currentDirection", Utils.toFancyCasing(getDirection(stack).getName())));
            tooltip.add("");
            List<RitualComponent> components = Lists.newArrayList();
            ritual.gatherComponents(components::add);
            int blankRunes = 0;
            int airRunes = 0;
            int waterRunes = 0;
            int fireRunes = 0;
            int earthRunes = 0;
            int duskRunes = 0;
            int dawnRunes = 0;
            int totalRunes = components.size();
            for (RitualComponent component : components) {
                switch(component.getRuneType()) {
                    case BLANK:
                        blankRunes++;
                        break;
                    case AIR:
                        airRunes++;
                        break;
                    case EARTH:
                        earthRunes++;
                        break;
                    case FIRE:
                        fireRunes++;
                        break;
                    case WATER:
                        waterRunes++;
                        break;
                    case DUSK:
                        duskRunes++;
                        break;
                    case DAWN:
                        dawnRunes++;
                        break;
                }
            }
            if (blankRunes > 0)
                tooltip.add(EnumRuneType.BLANK.colorCode + TextHelper.localize(tooltipBase + "blankRune", blankRunes));
            if (waterRunes > 0)
                tooltip.add(EnumRuneType.WATER.colorCode + TextHelper.localize(tooltipBase + "waterRune", waterRunes));
            if (airRunes > 0)
                tooltip.add(EnumRuneType.AIR.colorCode + TextHelper.localize(tooltipBase + "airRune", airRunes));
            if (fireRunes > 0)
                tooltip.add(EnumRuneType.FIRE.colorCode + TextHelper.localize(tooltipBase + "fireRune", fireRunes));
            if (earthRunes > 0)
                tooltip.add(EnumRuneType.EARTH.colorCode + TextHelper.localize(tooltipBase + "earthRune", earthRunes));
            if (duskRunes > 0)
                tooltip.add(EnumRuneType.DUSK.colorCode + TextHelper.localize(tooltipBase + "duskRune", duskRunes));
            if (dawnRunes > 0)
                tooltip.add(EnumRuneType.DAWN.colorCode + TextHelper.localize(tooltipBase + "dawnRune", dawnRunes));
            tooltip.add("");
            tooltip.add(TextHelper.localize(tooltipBase + "totalRune", totalRunes));
        } else {
            tooltip.add("");
            if (TextHelper.canTranslate(ritual.getUnlocalizedName() + ".info")) {
                tooltip.addAll(Arrays.asList(TextHelper.cutLongString(TextHelper.localizeEffect(ritual.getUnlocalizedName() + ".info"))));
                tooltip.add("");
            }
            tooltip.add(TextHelper.localizeEffect(tooltipBase + "extraInfo"));
            tooltip.add(TextHelper.localizeEffect(tooltipBase + "extraExtraInfo"));
        }
    }
}
Also used : Ritual(WayofTime.bloodmagic.ritual.Ritual) RitualComponent(WayofTime.bloodmagic.ritual.RitualComponent) List(java.util.List) EnumDemonWillType(WayofTime.bloodmagic.soul.EnumDemonWillType) SideOnly(net.minecraftforge.fml.relauncher.SideOnly)

Example 19 with EnumDemonWillType

use of WayofTime.bloodmagic.soul.EnumDemonWillType in project BloodMagic by WayofTime.

the class ItemSentientPickaxe method getRandomDemonWillDrop.

@Override
public List<ItemStack> getRandomDemonWillDrop(EntityLivingBase killedEntity, EntityLivingBase attackingEntity, ItemStack stack, int looting) {
    List<ItemStack> soulList = new ArrayList<>();
    if (killedEntity.getEntityWorld().getDifficulty() != EnumDifficulty.PEACEFUL && !(killedEntity instanceof IMob)) {
        return soulList;
    }
    double willModifier = killedEntity instanceof EntitySlime ? 0.67 : 1;
    IDemonWill soul = ((IDemonWill) RegistrarBloodMagicItems.MONSTER_SOUL);
    EnumDemonWillType type = this.getCurrentType(stack);
    for (int i = 0; i <= looting; i++) {
        if (i == 0 || attackingEntity.getEntityWorld().rand.nextDouble() < 0.4) {
            ItemStack soulStack = soul.createWill(type.ordinal(), willModifier * (this.getDropOfActivatedSword(stack) * attackingEntity.getEntityWorld().rand.nextDouble() + this.getStaticDropOfActivatedSword(stack)) * killedEntity.getMaxHealth() / 20d);
            soulList.add(soulStack);
        }
    }
    return soulList;
}
Also used : IMob(net.minecraft.entity.monster.IMob) EntitySlime(net.minecraft.entity.monster.EntitySlime) IDemonWill(WayofTime.bloodmagic.soul.IDemonWill) ItemStack(net.minecraft.item.ItemStack) EnumDemonWillType(WayofTime.bloodmagic.soul.EnumDemonWillType)

Example 20 with EnumDemonWillType

use of WayofTime.bloodmagic.soul.EnumDemonWillType in project BloodMagic by WayofTime.

the class ItemSentientBow method onPlayerStoppedUsing.

@Override
public void onPlayerStoppedUsing(ItemStack stack, World world, EntityLivingBase entityLiving, int timeLeft) {
    if (entityLiving instanceof EntityPlayer) {
        EntityPlayer player = (EntityPlayer) entityLiving;
        boolean flag = player.capabilities.isCreativeMode || EnchantmentHelper.getEnchantmentLevel(Enchantments.INFINITY, stack) > 0;
        ItemStack itemstack = this.getFiredArrow(player);
        int i = this.getMaxItemUseDuration(stack) - timeLeft;
        i = net.minecraftforge.event.ForgeEventFactory.onArrowLoose(stack, world, (EntityPlayer) entityLiving, i, itemstack != null || flag);
        if (i < 0)
            return;
        if (itemstack != null || flag) {
            if (itemstack == null) {
                itemstack = new ItemStack(Items.ARROW);
            }
            float arrowVelocity = getArrowVelocity(i);
            if ((double) arrowVelocity >= 0.1D) {
                // Forge: Fix consuming custom arrows.
                boolean flag1 = flag && itemstack.getItem() == Items.ARROW;
                if (!world.isRemote) {
                    this.recalculatePowers(stack, world, player);
                    EnumDemonWillType type = this.getCurrentType(stack);
                    // Need to do some stuffs
                    // ItemArrow itemarrow = ((ItemArrow) (itemstack.getItem() instanceof ItemArrow ? itemstack.getItem() : Items.arrow));
                    // EntityArrow entityArrow = itemarrow.createArrow(world, itemstack, player);
                    double amount = (this.getDropOfActivatedBow(stack) * world.rand.nextDouble() + this.getStaticDropOfActivatedBow(stack));
                    float newArrowVelocity = arrowVelocity * getVelocityOfArrow(stack);
                    double soulsRemaining = PlayerDemonWillHandler.getTotalDemonWill(type, player);
                    EntitySentientArrow entityArrow = new EntitySentientArrow(world, entityLiving, type, amount, getLevel(soulsRemaining));
                    entityArrow.shoot(player, player.rotationPitch, player.rotationYaw, 0.0F, newArrowVelocity, 1.0F);
                    if (newArrowVelocity == 0) {
                        world.playSound(null, player.getPosition(), SoundEvents.BLOCK_FIRE_EXTINGUISH, SoundCategory.NEUTRAL, 0.4F, 1.0F);
                        return;
                    }
                    if (arrowVelocity == 1.0F) {
                        entityArrow.setIsCritical(true);
                    }
                    int j = EnchantmentHelper.getEnchantmentLevel(Enchantments.POWER, stack);
                    entityArrow.setDamage(entityArrow.getDamage() + this.getDamageAdded(stack) + (j > 0 ? j * 0.5 + 0.5 : 0));
                    int k = EnchantmentHelper.getEnchantmentLevel(Enchantments.PUNCH, stack);
                    if (k > 0) {
                        entityArrow.setKnockbackStrength(k);
                    }
                    if (EnchantmentHelper.getEnchantmentLevel(Enchantments.FLAME, stack) > 0) {
                        entityArrow.setFire(100);
                    }
                    stack.damageItem(1, player);
                    if (flag1) {
                        entityArrow.pickupStatus = EntityArrow.PickupStatus.CREATIVE_ONLY;
                    }
                    world.spawnEntity(entityArrow);
                }
                world.playSound(null, player.posX, player.posY, player.posZ, SoundEvents.ENTITY_ARROW_SHOOT, SoundCategory.NEUTRAL, 1.0F, 1.0F / (itemRand.nextFloat() * 0.4F + 1.2F) + arrowVelocity * 0.5F);
                if (!flag1) {
                    itemstack.shrink(1);
                    if (itemstack.isEmpty()) {
                        player.inventory.deleteStack(itemstack);
                    }
                }
                player.addStat(StatList.getObjectUseStats(this));
            }
        }
    }
}
Also used : EntityPlayer(net.minecraft.entity.player.EntityPlayer) EntitySentientArrow(WayofTime.bloodmagic.entity.projectile.EntitySentientArrow) ItemStack(net.minecraft.item.ItemStack) EnumDemonWillType(WayofTime.bloodmagic.soul.EnumDemonWillType)

Aggregations

EnumDemonWillType (WayofTime.bloodmagic.soul.EnumDemonWillType)65 ItemStack (net.minecraft.item.ItemStack)21 BlockPos (net.minecraft.util.math.BlockPos)14 EntityPlayer (net.minecraft.entity.player.EntityPlayer)13 World (net.minecraft.world.World)13 PotionEffect (net.minecraft.potion.PotionEffect)6 TileEntity (net.minecraft.tileentity.TileEntity)6 EntitySentientSpecter (WayofTime.bloodmagic.entity.mob.EntitySentientSpecter)5 IDemonWill (WayofTime.bloodmagic.soul.IDemonWill)5 IBlockState (net.minecraft.block.state.IBlockState)5 EntityLivingBase (net.minecraft.entity.EntityLivingBase)5 AxisAlignedBB (net.minecraft.util.math.AxisAlignedBB)5 ISentientSwordEffectProvider (WayofTime.bloodmagic.iface.ISentientSwordEffectProvider)4 DemonWillHolder (WayofTime.bloodmagic.soul.DemonWillHolder)4 EntitySlime (net.minecraft.entity.monster.EntitySlime)4 IMob (net.minecraft.entity.monster.IMob)4 ArrayList (java.util.ArrayList)3 EntitySentientArrow (WayofTime.bloodmagic.entity.projectile.EntitySentientArrow)2 IDiscreteDemonWill (WayofTime.bloodmagic.soul.IDiscreteDemonWill)2 List (java.util.List)2