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
}
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);
}
}
Aggregations