Search in sources :

Example 1 with ItemGemScepter

use of net.silentchaos512.gems.item.tool.ItemGemScepter in project SilentGems by SilentChaos512.

the class ItemGemSword method getShots.

private List<EntityChaosProjectile> getShots(EntityPlayer player, ItemStack stack) {
    List<EntityChaosProjectile> list = Lists.newArrayList();
    if (ToolHelper.getToolTier(stack).ordinal() < EnumMaterialTier.SUPER.ordinal()) {
        return list;
    }
    EnumMagicType magicType = EnumMagicType.getMagicType(stack);
    int shotCount = magicType.getShotCount(stack);
    // Calculate magic damage.
    // Includes player "magic strength" (currently just a constant 1, might do something with it later).
    float damage = 1f + getMagicDamage(stack);
    // Magic damage enchantment
    int magicEnchLevel = EnchantmentHelper.getEnchantmentLevel(ModEnchantments.magicDamage, stack);
    if (magicEnchLevel > 0)
        damage += ModEnchantments.magicDamage.calcDamage(magicEnchLevel);
    damage *= magicType.getDamagePerShotMultiplier();
    Item item = stack.getItem();
    // Dagger
    if (item instanceof ItemGemDagger) {
        for (int i = 0; i < shotCount; ++i) {
            list.add(new EntityChaosProjectileHoming(player, stack, damage, false, 0.0325, 0.25));
        }
    } else // Scepter
    if (item instanceof ItemGemScepter) {
        for (int i = 0; i < shotCount; ++i) {
            list.add(new EntityChaosProjectileHoming(player, stack, damage, true, 0.075, 0.35));
        }
    } else // Katana
    if (item instanceof ItemGemKatana) {
        final float maxAngle = 0.05f;
        for (float angle = -maxAngle; angle <= maxAngle; angle += maxAngle / (shotCount / 2)) {
            list.add(new EntityChaosProjectileSweep(player, stack, damage, angle));
        }
    } else // Machete
    if (item instanceof ItemGemMachete) {
        for (int i = 0; i < shotCount; ++i) {
            list.add(new EntityChaosProjectileScatter(player, stack, damage));
        }
    } else // Classic sword (default)
    {
        for (int i = 0; i < shotCount; ++i) {
            EntityChaosProjectile e = new EntityChaosProjectile(player, stack, damage);
            e.motionY += 0.2 * i;
            list.add(e);
        }
    }
    return list;
}
Also used : EntityChaosProjectileScatter(net.silentchaos512.gems.entity.EntityChaosProjectileScatter) EntityChaosProjectileSweep(net.silentchaos512.gems.entity.EntityChaosProjectileSweep) EnumMagicType(net.silentchaos512.gems.util.EnumMagicType) EntityChaosProjectile(net.silentchaos512.gems.entity.EntityChaosProjectile) EntityChaosProjectileHoming(net.silentchaos512.gems.entity.EntityChaosProjectileHoming) Item(net.minecraft.item.Item) EntityItem(net.minecraft.entity.item.EntityItem)

Example 2 with ItemGemScepter

use of net.silentchaos512.gems.item.tool.ItemGemScepter in project SilentGems by SilentChaos512.

the class ToolModel method getQuads.

@Override
public List<BakedQuad> getQuads(IBlockState state, EnumFacing side, long rand) {
    LogHelper log = SilentGems.logHelper;
    if (tool == null) {
        return new ArrayList<BakedQuad>();
    }
    if (modelManager == null) {
        modelManager = Minecraft.getMinecraft().getRenderItem().getItemModelMesher().getModelManager();
    }
    List<BakedQuad> quads = Lists.newArrayList();
    ModelResourceLocation location;
    IBakedModel model;
    IBakedModel rodModel = null;
    Item item = tool.getItem();
    // Invalid tools models.
    if (ToolHelper.getMaxDamage(tool) <= 0 && tool.getItem() instanceof IRegistryObject) {
        String name = ((IRegistryObject) tool.getItem()).getName();
        location = new ModelResourceLocation(SilentGems.MODID + ":" + name.toLowerCase() + "/_error", "inventory");
        model = modelManager.getModel(location);
        if (model != null) {
            quads.addAll(model.getQuads(state, side, rand));
        }
        return quads;
    }
    for (ToolPartPosition partPos : ToolPartPosition.values()) {
        // Scepter rods on top of head.
        if (tool.getItem() instanceof ItemGemScepter) {
            if (partPos == ToolPartPosition.ROD) {
                location = ToolRenderHelper.getInstance().getModel(tool, partPos);
                rodModel = modelManager.getModel(location);
                continue;
            } else if (partPos == ToolPartPosition.ROD_DECO) {
                quads.addAll(rodModel.getQuads(state, side, rand));
            }
        }
        // Normal logic.
        location = ToolRenderHelper.getInstance().getModel(tool, partPos);
        // debug += partPos + ": " + (location == null ? "null" : location.toString()) + "\n";
        if (location != null) {
            model = modelManager.getModel(location);
            if (model != null) {
                quads.addAll(model.getQuads(state, side, rand));
            }
        }
    }
    if (ModuleAprilTricks.instance.isEnabled() && ModuleAprilTricks.instance.isRightDay()) {
        model = modelManager.getModel(ToolRenderHelper.getInstance().modelGooglyEyes);
        quads.addAll(model.getQuads(state, side, rand));
    }
    return quads;
}
Also used : BakedQuad(net.minecraft.client.renderer.block.model.BakedQuad) ItemGemScepter(net.silentchaos512.gems.item.tool.ItemGemScepter) Item(net.minecraft.item.Item) IRegistryObject(net.silentchaos512.lib.registry.IRegistryObject) ToolPartPosition(net.silentchaos512.gems.api.lib.ToolPartPosition) LogHelper(net.silentchaos512.lib.util.LogHelper) ArrayList(java.util.ArrayList) ModelResourceLocation(net.minecraft.client.renderer.block.model.ModelResourceLocation) IBakedModel(net.minecraft.client.renderer.block.model.IBakedModel)

Aggregations

Item (net.minecraft.item.Item)2 ArrayList (java.util.ArrayList)1 BakedQuad (net.minecraft.client.renderer.block.model.BakedQuad)1 IBakedModel (net.minecraft.client.renderer.block.model.IBakedModel)1 ModelResourceLocation (net.minecraft.client.renderer.block.model.ModelResourceLocation)1 EntityItem (net.minecraft.entity.item.EntityItem)1 ToolPartPosition (net.silentchaos512.gems.api.lib.ToolPartPosition)1 EntityChaosProjectile (net.silentchaos512.gems.entity.EntityChaosProjectile)1 EntityChaosProjectileHoming (net.silentchaos512.gems.entity.EntityChaosProjectileHoming)1 EntityChaosProjectileScatter (net.silentchaos512.gems.entity.EntityChaosProjectileScatter)1 EntityChaosProjectileSweep (net.silentchaos512.gems.entity.EntityChaosProjectileSweep)1 ItemGemScepter (net.silentchaos512.gems.item.tool.ItemGemScepter)1 EnumMagicType (net.silentchaos512.gems.util.EnumMagicType)1 IRegistryObject (net.silentchaos512.lib.registry.IRegistryObject)1 LogHelper (net.silentchaos512.lib.util.LogHelper)1