mirror of
https://github.com/GTNewHorizons/Avaritia.git
synced 2026-11-21 04:32:29 +00:00
Fixed invalid fractured ores, added ticon effects.
This commit is contained in:
1 parent
4add7a28e6
commit
8d8544a15b
3 files changed
+90
-5
No files matched your search
@@ -7,8 +7,10 @@ import net.minecraftforge.common.MinecraftForge;
|
||||
import fox.spiteful.avaritia.crafting.ExtremeCraftingManager;
|
||||
import fox.spiteful.avaritia.items.LudicrousItems;
|
||||
import tconstruct.library.TConstructRegistry;
|
||||
import tconstruct.library.crafting.ModifyBuilder;
|
||||
import tconstruct.library.crafting.PatternBuilder;
|
||||
import tconstruct.library.tools.ToolMaterial;
|
||||
import tconstruct.modifiers.tools.ModExtraModifier;
|
||||
import tconstruct.tools.TinkerTools;
|
||||
import tconstruct.weaponry.TinkerWeaponry;
|
||||
|
||||
@@ -24,7 +26,7 @@ public class Tonkers {
|
||||
public static void buildstruct() {
|
||||
|
||||
neutronium = new ToolMaterial(neutroniumName, "material."+neutroniumName, 5, 2400, 900, 6, 2.5f, 0, 0.0f, EnumChatFormatting.DARK_GRAY.toString(), 0x303030);
|
||||
infinityMetal = new ToolMaterial(infinityMetalName, "material."+infinityMetalName, 5, 10000, 3000, 50, 10.0f, 5, 0.0f, LudicrousItems.cosmic.rarityColor.toString(), 0xFFFFFF);
|
||||
infinityMetal = new ToolMaterial(infinityMetalName, "material."+infinityMetalName, 5, 10000, 6000, 50, 10.0f, 5, 0.0f, LudicrousItems.cosmic.rarityColor.toString(), 0xFFFFFF);
|
||||
|
||||
TConstructRegistry.addtoolMaterial(neutroniumId, neutronium);
|
||||
TConstructRegistry.addtoolMaterial(infinityMetalId, infinityMetal);
|
||||
@@ -273,5 +275,8 @@ public class Tonkers {
|
||||
"XXX ",
|
||||
" XXX",
|
||||
'X', ingot);
|
||||
|
||||
// extra modifier from catalyst
|
||||
ModifyBuilder.registerModifier(new ModExtraModifier(new ItemStack[] { new ItemStack(LudicrousItems.resource, 1, 5) }, "AvaritiaFree"));
|
||||
}
|
||||
}
|
||||
@@ -1,17 +1,28 @@
|
||||
package fox.spiteful.avaritia.compat.ticon;
|
||||
|
||||
import java.util.Random;
|
||||
|
||||
import net.minecraft.entity.Entity;
|
||||
import net.minecraft.entity.EntityLivingBase;
|
||||
import net.minecraft.item.ItemStack;
|
||||
import net.minecraft.nbt.NBTTagCompound;
|
||||
import net.minecraft.util.MathHelper;
|
||||
import net.minecraftforge.event.entity.living.LivingAttackEvent;
|
||||
import net.minecraftforge.event.entity.living.LivingEvent.LivingUpdateEvent;
|
||||
import net.minecraftforge.event.entity.living.LivingHurtEvent;
|
||||
import net.minecraftforge.event.world.BlockEvent.HarvestDropsEvent;
|
||||
import tconstruct.library.event.ToolCraftEvent;
|
||||
import tconstruct.library.tools.AbilityHelper;
|
||||
import tconstruct.library.tools.ToolCore;
|
||||
import cpw.mods.fml.common.eventhandler.SubscribeEvent;
|
||||
import fox.spiteful.avaritia.LudicrousEvents;
|
||||
import fox.spiteful.avaritia.Lumberjack;
|
||||
|
||||
public class TonkersEvents {
|
||||
|
||||
private Random randy = new Random();
|
||||
|
||||
@SubscribeEvent
|
||||
public void craftTool (ToolCraftEvent.NormalTool event)
|
||||
public void craftTool(ToolCraftEvent.NormalTool event)
|
||||
{
|
||||
NBTTagCompound toolTag = event.toolTag.getCompoundTag("InfiTool");
|
||||
handleInfinityMods(toolTag, event.tool);
|
||||
@@ -73,4 +84,66 @@ public class TonkersEvents {
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@SubscribeEvent
|
||||
public void onHurt(LivingHurtEvent event) {
|
||||
Entity damaged = event.entity;
|
||||
Entity damager = event.source.getSourceOfDamage();
|
||||
if (damager != null && damager instanceof EntityLivingBase && damaged instanceof EntityLivingBase) {
|
||||
EntityLivingBase attacker = (EntityLivingBase)damager;
|
||||
EntityLivingBase attacked = (EntityLivingBase)damaged;
|
||||
|
||||
ItemStack held = attacker.getHeldItem();
|
||||
if (held != null && held.hasTagCompound() && held.getItem() instanceof ToolCore) {
|
||||
ToolCore tool = (ToolCore)held.getItem();
|
||||
NBTTagCompound toolTag = held.getTagCompound().getCompoundTag("InfiTool");
|
||||
|
||||
float puntpower = 0.0f;
|
||||
float puntboost = 1.5f;
|
||||
if (toolTag.getInteger("Head") == Tonkers.neutroniumId) {
|
||||
puntpower += puntboost;
|
||||
}
|
||||
if (toolTag.getInteger("Handle") == Tonkers.neutroniumId) {
|
||||
puntpower += puntboost;
|
||||
}
|
||||
if (toolTag.getInteger("Accessory") == Tonkers.neutroniumId) {
|
||||
puntpower += puntboost;
|
||||
}
|
||||
if (toolTag.getInteger("Extra") == Tonkers.neutroniumId) {
|
||||
puntpower += puntboost;
|
||||
}
|
||||
|
||||
float knockback = (AbilityHelper.calcKnockback(attacker, attacked, held, tool, toolTag, 0) + 1) * puntpower;
|
||||
attacked.addVelocity((double) (-MathHelper.sin(attacker.rotationYaw * (float) Math.PI / 180.0F) * (float) knockback * 0.5F), 0.1D, (double) (MathHelper.cos(attacker.rotationYaw * (float) Math.PI / 180.0F) * (float) knockback * 0.5F));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@SubscribeEvent
|
||||
public void onLivingUpdate(LivingUpdateEvent event) {
|
||||
ItemStack held = event.entityLiving.getHeldItem();
|
||||
if (held != null && held.hasTagCompound() && held.getItem() instanceof ToolCore) {
|
||||
ToolCore tool = (ToolCore)held.getItem();
|
||||
NBTTagCompound toolTag = held.getTagCompound().getCompoundTag("InfiTool");
|
||||
|
||||
int chance = 0;
|
||||
int per = 1;
|
||||
if (toolTag.getInteger("Head") == Tonkers.infinityMetalId) {
|
||||
chance += per;
|
||||
}
|
||||
if (toolTag.getInteger("Handle") == Tonkers.infinityMetalId) {
|
||||
chance += per;
|
||||
}
|
||||
if (toolTag.getInteger("Accessory") == Tonkers.infinityMetalId) {
|
||||
chance += per;
|
||||
}
|
||||
if (toolTag.getInteger("Extra") == Tonkers.infinityMetalId) {
|
||||
chance += per;
|
||||
}
|
||||
|
||||
if (randy.nextInt(60) < chance) {
|
||||
AbilityHelper.healTool(held, MathHelper.floor_float(tool.getDurabilityModifier()), event.entityLiving, true);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -16,6 +16,7 @@ import cpw.mods.fml.relauncher.Side;
|
||||
import cpw.mods.fml.relauncher.SideOnly;
|
||||
|
||||
import fox.spiteful.avaritia.Avaritia;
|
||||
import fox.spiteful.avaritia.Lumberjack;
|
||||
import net.minecraft.client.renderer.texture.IIconRegister;
|
||||
import net.minecraft.creativetab.CreativeTabs;
|
||||
import net.minecraft.item.Item;
|
||||
@@ -67,8 +68,14 @@ public class ItemFracturedOre extends Item {
|
||||
public String getItemStackDisplayName(ItemStack stack)
|
||||
{
|
||||
if (stack.hasTagCompound() && stack.getTagCompound().hasKey(OREKEY)) {
|
||||
ItemStack orestack = NameStack.loadFromNBT(stack.getTagCompound().getCompoundTag(OREKEY)).getStack();
|
||||
return StatCollector.translateToLocal("item.avaritia_fracturedore.prefix") +" "+ orestack.getItem().getItemStackDisplayName(orestack);
|
||||
NBTTagCompound tag = stack.getTagCompound().getCompoundTag(OREKEY);
|
||||
NameStack namestack = NameStack.loadFromNBT(tag);
|
||||
|
||||
if (namestack != null && namestack.tag != null) {
|
||||
ItemStack orestack = namestack.getStack();
|
||||
Item oreitem = orestack.getItem();
|
||||
return StatCollector.translateToLocal("item.avaritia_fracturedore.prefix") +" "+ oreitem.getItemStackDisplayName(orestack);
|
||||
}
|
||||
}
|
||||
return super.getItemStackDisplayName(stack);
|
||||
}
|
||||
|
||||
Reference in new issue
Block a user