Search in sources :

Example 21 with ITool

use of net.silentchaos512.gems.api.ITool in project SilentGems by SilentChaos512.

the class EquipmentTooltips method onRenderTooltip.

@SubscribeEvent
public void onRenderTooltip(RenderTooltipEvent.PostText event) {
    ItemStack stack = event.getStack();
    Item item = stack.getItem();
    boolean isTinkersHarvestTool = isTinkersLoaded && item instanceof slimeknights.tconstruct.library.tools.AoeToolCore;
    boolean isTinkersWeapon = isTinkersLoaded && item instanceof slimeknights.tconstruct.library.tools.SwordCore;
    boolean isTinkersBow = isTinkersLoaded && item instanceof slimeknights.tconstruct.library.tools.ranged.BowCore;
    // Tools (pickaxes, shovels, axes, and more)
    if (item instanceof ItemTool || item instanceof ItemHoe || item instanceof ItemShears || item instanceof ItemFishingRod || isTinkersHarvestTool) {
        renderBackground(event);
        renderForTool(event, stack);
    } else // Swords
    if (item instanceof ItemSword || isTinkersWeapon) {
        boolean isCaster = item instanceof ITool && ToolHelper.getToolTier(stack).ordinal() >= EnumMaterialTier.SUPER.ordinal();
        renderBackground(event);
        renderForWeapon(event, stack);
    } else // Bows
    if (item instanceof ItemBow || isTinkersBow) {
        renderBackground(event);
        renderForBow(event, stack);
    } else // Shields
    if (item instanceof ItemShield) {
        renderBackground(event);
        renderForShield(event, stack);
    } else // Armor
    if (item instanceof ItemArmor) {
        renderBackground(event);
        renderForArmor(event, stack);
    }
// Unknown
}
Also used : ItemSword(net.minecraft.item.ItemSword) ItemTool(net.minecraft.item.ItemTool) ItemShield(net.minecraft.item.ItemShield) ItemFishingRod(net.minecraft.item.ItemFishingRod) ItemArmor(net.minecraft.item.ItemArmor) ITool(net.silentchaos512.gems.api.ITool) ItemBow(net.minecraft.item.ItemBow) Item(net.minecraft.item.Item) ItemHoe(net.minecraft.item.ItemHoe) ItemShears(net.minecraft.item.ItemShears) ItemStack(net.minecraft.item.ItemStack) SubscribeEvent(net.minecraftforge.fml.common.eventhandler.SubscribeEvent)

Example 22 with ITool

use of net.silentchaos512.gems.api.ITool in project SilentGems by SilentChaos512.

the class GemsCommonEvents method onLivingDeath.

@SubscribeEvent
public void onLivingDeath(LivingDeathEvent event) {
    Entity entitySource = event.getSource().getTrueSource();
    EntityPlayer player = null;
    if (event.getEntityLiving() instanceof EntityPlayer) {
        EntityPlayer deadPlayer = (EntityPlayer) event.getEntityLiving();
        PlayerData data = PlayerDataHandler.get(deadPlayer);
        data.haloTime = data.HALO_TIME_DEFAULT;
    }
    if (entitySource instanceof EntityPlayer) {
        player = (EntityPlayer) entitySource;
    } else if (entitySource instanceof EntityChaosProjectile) {
        EntityChaosProjectile projectile = (EntityChaosProjectile) entitySource;
        EntityLivingBase shooter = projectile.getShooter();
        if (shooter instanceof EntityPlayer)
            player = (EntityPlayer) shooter;
    }
    if (player != null) {
        ItemStack weapon = player.getHeldItem(EnumHand.MAIN_HAND);
        if (StackHelper.isValid(weapon) && weapon.getItem() instanceof ITool)
            ToolHelper.incrementStatKillCount(weapon, 1);
    }
}
Also used : Entity(net.minecraft.entity.Entity) EntityChaosProjectile(net.silentchaos512.gems.entity.EntityChaosProjectile) EntityLivingBase(net.minecraft.entity.EntityLivingBase) EntityPlayer(net.minecraft.entity.player.EntityPlayer) ItemStack(net.minecraft.item.ItemStack) PlayerData(net.silentchaos512.gems.handler.PlayerDataHandler.PlayerData) ITool(net.silentchaos512.gems.api.ITool) SubscribeEvent(net.minecraftforge.fml.common.eventhandler.SubscribeEvent)

Aggregations

ITool (net.silentchaos512.gems.api.ITool)21 ItemStack (net.minecraft.item.ItemStack)14 IArmor (net.silentchaos512.gems.api.IArmor)11 EnumMaterialTier (net.silentchaos512.gems.api.lib.EnumMaterialTier)5 ToolPart (net.silentchaos512.gems.api.tool.part.ToolPart)5 EnumMaterialGrade (net.silentchaos512.gems.api.lib.EnumMaterialGrade)4 ToolSoul (net.silentchaos512.gems.lib.soul.ToolSoul)4 ArrayList (java.util.ArrayList)3 UUID (java.util.UUID)3 SubscribeEvent (net.minecraftforge.fml.common.eventhandler.SubscribeEvent)3 Nullable (javax.annotation.Nullable)2 NBTTagCompound (net.minecraft.nbt.NBTTagCompound)2 ResourceLocation (net.minecraft.util.ResourceLocation)2 ToolPartMain (net.silentchaos512.gems.api.tool.part.ToolPartMain)2 EnumGem (net.silentchaos512.gems.lib.EnumGem)2 HashMap (java.util.HashMap)1 LinkedHashMap (java.util.LinkedHashMap)1 List (java.util.List)1 Random (java.util.Random)1 Entity (net.minecraft.entity.Entity)1