diff --git a/src/main/java/drzhark/mocreatures/compat/CompatHandler.java b/src/main/java/drzhark/mocreatures/compat/CompatHandler.java index 26d22b00..c23d9310 100644 --- a/src/main/java/drzhark/mocreatures/compat/CompatHandler.java +++ b/src/main/java/drzhark/mocreatures/compat/CompatHandler.java @@ -12,6 +12,7 @@ import drzhark.mocreatures.compat.morph.MorphIntegration; import drzhark.mocreatures.compat.thaumcraft.ThaumcraftIntegration; import drzhark.mocreatures.compat.thermalexpansion.ThermalExpansionIntegration; +import drzhark.mocreatures.compat.tinkers.TinkersConstructIntegration; import net.minecraft.item.Item; import net.minecraft.item.ItemStack; import net.minecraft.item.crafting.IRecipe; @@ -89,6 +90,14 @@ public static void registerRecipes(RegistryEvent.Register event) { } public static void preInit() { + if (Loader.isModLoaded("tconstruct")) { + TinkersConstructIntegration.preInit(); + + // Only load Construct's Armory if Tinkers' Construct is also loaded + if (Loader.isModLoaded("conarm")) { + //ConstructsArmoryIntegration.preInit(); + } + } } public static void init() { @@ -99,6 +108,7 @@ public static void init() { IndustrialForegoingHelper.addWoodToLatex(entry); } if (Loader.isModLoaded("thaumcraft")) MinecraftForge.EVENT_BUS.register(ThaumcraftIntegration.class); + if (Loader.isModLoaded("tconstruct")) TinkersConstructIntegration.init(); if (Loader.isModLoaded("jeresources")) JERIntegration.init(); } diff --git a/src/main/java/drzhark/mocreatures/compat/tinkers/TinkersConstructIntegration.java b/src/main/java/drzhark/mocreatures/compat/tinkers/TinkersConstructIntegration.java new file mode 100644 index 00000000..2c883fa8 --- /dev/null +++ b/src/main/java/drzhark/mocreatures/compat/tinkers/TinkersConstructIntegration.java @@ -0,0 +1,100 @@ +package drzhark.mocreatures.compat.tinkers; + +import drzhark.mocreatures.compat.tinkers.traits.TraitStingEffect; +import drzhark.mocreatures.compat.tinkers.traits.TraitStingEffectPlayer; +import drzhark.mocreatures.compat.tinkers.traits.TraitStingFire; +import drzhark.mocreatures.init.MoCItems; +import net.minecraft.init.MobEffects; +import slimeknights.tconstruct.library.TinkerRegistry; +import slimeknights.tconstruct.library.materials.BowMaterialStats; +import slimeknights.tconstruct.library.materials.ExtraMaterialStats; +import slimeknights.tconstruct.library.materials.HandleMaterialStats; +import slimeknights.tconstruct.library.materials.HeadMaterialStats; +import slimeknights.tconstruct.library.materials.Material; +import slimeknights.tconstruct.library.materials.MaterialTypes; +import slimeknights.tconstruct.library.traits.AbstractTrait; +import slimeknights.tconstruct.library.utils.HarvestLevels; +import slimeknights.tconstruct.tools.TinkerTraits; + +public class TinkersConstructIntegration { + public static final Material DARK_CHITIN = new Material("dark_chitin", 0x535A6B); + public static final Material EARTH_CHITIN = new Material("earth_chitin", 0xF37A07); + public static final Material FIRE_CHITIN = new Material("fire_chitin", 0xC62B13); + public static final Material FROST_CHITIN = new Material("frost_chitin", 0x1B7A87); + public static final Material UNDEAD_CHITIN = new Material("undead_chitin", 0x92B859); + + public static final AbstractTrait DARK_STING = new TraitStingEffectPlayer("dark_sting", 0x535A6B, 1.5F, MobEffects.WEAKNESS, MobEffects.NAUSEA); + public static final AbstractTrait EARTH_STING = new TraitStingEffect("earth_sting", 0xF37A07, 1.5F, MobEffects.POISON); + public static final AbstractTrait FIRE_STING = new TraitStingFire(1.5F); + public static final AbstractTrait FROST_STING = new TraitStingEffect("frost_sting", 0x1B7A87, 1.5F, MobEffects.SLOWNESS); + public static final AbstractTrait UNDEAD_STING = new TraitStingEffectPlayer("undead_sting", 0x92B859, 1.5F, MobEffects.WITHER, MobEffects.BLINDNESS); + + public static void preInit() { + TinkerRegistry.addMaterialStats(DARK_CHITIN, + new HeadMaterialStats(300, 6.0F, 3.5F, HarvestLevels.DIAMOND), + new HandleMaterialStats(0.95F, 60), + new ExtraMaterialStats(60), + new BowMaterialStats(0.9F, 0.7F, 0.0F)); + DARK_CHITIN.addTrait(DARK_STING, MaterialTypes.HEAD); + DARK_CHITIN.addTrait(TinkerTraits.fractured); + TinkerRegistry.integrate(DARK_CHITIN).preInit(); + + TinkerRegistry.addMaterialStats(EARTH_CHITIN, + new HeadMaterialStats(300, 6.0F, 3.5F, HarvestLevels.DIAMOND), + new HandleMaterialStats(0.95F, 60), + new ExtraMaterialStats(60), + new BowMaterialStats(0.9F, 0.7F, 0.0F)); + EARTH_CHITIN.addTrait(EARTH_STING, MaterialTypes.HEAD); + EARTH_CHITIN.addTrait(TinkerTraits.fractured); + TinkerRegistry.integrate(EARTH_CHITIN).preInit(); + + TinkerRegistry.addMaterialStats(FIRE_CHITIN, + new HeadMaterialStats(300, 6.0F, 3.5F, HarvestLevels.DIAMOND), + new HandleMaterialStats(0.95F, 60), + new ExtraMaterialStats(60), + new BowMaterialStats(0.9F, 0.7F, 0.0F)); + FIRE_CHITIN.addTrait(FIRE_STING, MaterialTypes.HEAD); + FIRE_CHITIN.addTrait(TinkerTraits.fractured); + TinkerRegistry.integrate(FIRE_CHITIN).preInit(); + + TinkerRegistry.addMaterialStats(FROST_CHITIN, + new HeadMaterialStats(300, 6.0F, 3.5F, HarvestLevels.DIAMOND), + new HandleMaterialStats(0.95F, 60), + new ExtraMaterialStats(60), + new BowMaterialStats(0.9F, 0.7F, 0.0F)); + FROST_CHITIN.addTrait(FROST_STING, MaterialTypes.HEAD); + FROST_CHITIN.addTrait(TinkerTraits.fractured); + TinkerRegistry.integrate(FROST_CHITIN).preInit(); + + TinkerRegistry.addMaterialStats(UNDEAD_CHITIN, + new HeadMaterialStats(300, 6.0F, 3.5F, HarvestLevels.DIAMOND), + new HandleMaterialStats(0.95F, 60), + new ExtraMaterialStats(60), + new BowMaterialStats(0.9F, 0.7F, 0.0F)); + UNDEAD_CHITIN.addTrait(UNDEAD_STING, MaterialTypes.HEAD); + UNDEAD_CHITIN.addTrait(TinkerTraits.fractured); + TinkerRegistry.integrate(UNDEAD_CHITIN).preInit(); + } + + public static void init() { + DARK_CHITIN.addItem(MoCItems.chitinCave, 1, Material.VALUE_Ingot); + DARK_CHITIN.setRepresentativeItem(MoCItems.chitinCave); + DARK_CHITIN.setCraftable(true).setCastable(false); + + EARTH_CHITIN.addItem(MoCItems.chitin, 1, Material.VALUE_Ingot); + EARTH_CHITIN.setRepresentativeItem(MoCItems.chitin); + EARTH_CHITIN.setCraftable(true).setCastable(false); + + FIRE_CHITIN.addItem(MoCItems.chitinNether, 1, Material.VALUE_Ingot); + FIRE_CHITIN.setRepresentativeItem(MoCItems.chitinNether); + FIRE_CHITIN.setCraftable(true).setCastable(false); + + FROST_CHITIN.addItem(MoCItems.chitinFrost, 1, Material.VALUE_Ingot); + FROST_CHITIN.setRepresentativeItem(MoCItems.chitinFrost); + FROST_CHITIN.setCraftable(true).setCastable(false); + + UNDEAD_CHITIN.addItem(MoCItems.chitinUndead, 1, Material.VALUE_Ingot); + UNDEAD_CHITIN.setRepresentativeItem(MoCItems.chitinUndead); + UNDEAD_CHITIN.setCraftable(true).setCastable(false); + } +} diff --git a/src/main/java/drzhark/mocreatures/compat/tinkers/traits/TraitStingEffect.java b/src/main/java/drzhark/mocreatures/compat/tinkers/traits/TraitStingEffect.java new file mode 100644 index 00000000..2c845170 --- /dev/null +++ b/src/main/java/drzhark/mocreatures/compat/tinkers/traits/TraitStingEffect.java @@ -0,0 +1,41 @@ +package drzhark.mocreatures.compat.tinkers.traits; + +import net.minecraft.entity.EntityLivingBase; +import net.minecraft.item.ItemStack; +import net.minecraft.nbt.NBTTagCompound; +import net.minecraft.potion.Potion; +import net.minecraft.potion.PotionEffect; +import slimeknights.tconstruct.library.tools.ToolNBT; +import slimeknights.tconstruct.library.traits.AbstractTrait; +import slimeknights.tconstruct.library.utils.TagUtil; +import slimeknights.tconstruct.library.utils.TinkerUtil; + +public class TraitStingEffect extends AbstractTrait { + protected final float damage; + protected final Potion effect; + + public TraitStingEffect(String identifier, int color, float damage, Potion effect) { + super(identifier, color); + + this.damage = damage; + this.effect = effect; + } + + @Override + public void applyEffect(NBTTagCompound rootCompound, NBTTagCompound modifierTag) { + // Apply bonus damage if it hasn't been applied yet + if (!TinkerUtil.hasTrait(rootCompound, identifier)) { + ToolNBT data = TagUtil.getToolStats(rootCompound); + data.attack += damage; + TagUtil.setToolTag(rootCompound, data.get()); + } + super.applyEffect(rootCompound, modifierTag); + } + + @Override + public void afterHit(ItemStack tool, EntityLivingBase player, EntityLivingBase target, float damageDealt, boolean wasCritical, boolean wasHit) { + if (wasHit && target.isEntityAlive()) { + target.addPotionEffect(new PotionEffect(effect, 20 * 5)); + } + } +} diff --git a/src/main/java/drzhark/mocreatures/compat/tinkers/traits/TraitStingEffectPlayer.java b/src/main/java/drzhark/mocreatures/compat/tinkers/traits/TraitStingEffectPlayer.java new file mode 100644 index 00000000..5880533d --- /dev/null +++ b/src/main/java/drzhark/mocreatures/compat/tinkers/traits/TraitStingEffectPlayer.java @@ -0,0 +1,53 @@ +package drzhark.mocreatures.compat.tinkers.traits; + +import net.minecraft.entity.EntityLivingBase; +import net.minecraft.entity.player.EntityPlayer; +import net.minecraft.item.ItemStack; +import net.minecraft.nbt.NBTTagCompound; +import net.minecraft.potion.Potion; +import net.minecraft.potion.PotionEffect; +import slimeknights.tconstruct.library.tools.ToolNBT; +import slimeknights.tconstruct.library.traits.AbstractTrait; +import slimeknights.tconstruct.library.utils.TagUtil; +import slimeknights.tconstruct.library.utils.TinkerUtil; + +public class TraitStingEffectPlayer extends AbstractTrait { + protected final float damage; + protected final Potion effect; + protected final Potion playerEffect; + + public TraitStingEffectPlayer(String identifier, int color, float damage, Potion effect, Potion playerEffect) { + super(identifier, color); + + this.damage = damage; + this.effect = effect; + this.playerEffect = playerEffect; + } + + @Override + public void applyEffect(NBTTagCompound rootCompound, NBTTagCompound modifierTag) { + // Apply bonus damage if it hasn't been applied yet + if (!TinkerUtil.hasTrait(rootCompound, identifier)) { + ToolNBT data = TagUtil.getToolStats(rootCompound); + data.attack += damage; + TagUtil.setToolTag(rootCompound, data.get()); + } + + super.applyEffect(rootCompound, modifierTag); + } + + @Override + public void afterHit(ItemStack tool, EntityLivingBase player, EntityLivingBase target, float damageDealt, boolean wasCritical, boolean wasHit) { + if (wasHit && target.isEntityAlive()) { + // Don't set the normal effect on players + if (!(target instanceof EntityPlayer)) { + target.addPotionEffect(new PotionEffect(effect, 20 * 5)); + } + + // Set our alternative effect for players + if (target instanceof EntityPlayer) { + target.addPotionEffect(new PotionEffect(playerEffect, 20 * 5)); + } + } + } +} \ No newline at end of file diff --git a/src/main/java/drzhark/mocreatures/compat/tinkers/traits/TraitStingFire.java b/src/main/java/drzhark/mocreatures/compat/tinkers/traits/TraitStingFire.java new file mode 100644 index 00000000..a25745b6 --- /dev/null +++ b/src/main/java/drzhark/mocreatures/compat/tinkers/traits/TraitStingFire.java @@ -0,0 +1,37 @@ +package drzhark.mocreatures.compat.tinkers.traits; + +import net.minecraft.entity.EntityLivingBase; +import net.minecraft.item.ItemStack; +import net.minecraft.nbt.NBTTagCompound; +import slimeknights.tconstruct.library.tools.ToolNBT; +import slimeknights.tconstruct.library.traits.AbstractTrait; +import slimeknights.tconstruct.library.utils.TagUtil; +import slimeknights.tconstruct.library.utils.TinkerUtil; + +public class TraitStingFire extends AbstractTrait { + protected final float damage; + + public TraitStingFire(float damage) { + super("fire_sting", 0xC62B13); + + this.damage = damage; + } + + @Override + public void applyEffect(NBTTagCompound rootCompound, NBTTagCompound modifierTag) { + // Apply bonus damage if it hasn't been applied yet + if (!TinkerUtil.hasTrait(rootCompound, identifier)) { + ToolNBT data = TagUtil.getToolStats(rootCompound); + data.attack += damage; + TagUtil.setToolTag(rootCompound, data.get()); + } + super.applyEffect(rootCompound, modifierTag); + } + + @Override + public void afterHit(ItemStack tool, EntityLivingBase player, EntityLivingBase target, float damageDealt, boolean wasCritical, boolean wasHit) { + if (wasHit && target.isEntityAlive()) { + target.setFire(5); + } + } +} diff --git a/src/main/resources/assets/mocreatures/lang/en_us.lang b/src/main/resources/assets/mocreatures/lang/en_us.lang index 5a2ffcdb..d9a877f4 100644 --- a/src/main/resources/assets/mocreatures/lang/en_us.lang +++ b/src/main/resources/assets/mocreatures/lang/en_us.lang @@ -429,4 +429,22 @@ info.mocreatures.sting_weapon_dirt=Inflicts Poison II on the target for %d secon info.mocreatures.sting_weapon_fire=Burns the target for %d seconds info.mocreatures.sting_weapon_frost=Inflicts Slowness on the target for %d seconds info.mocreatures.sting_weapon_undead=Inflicts Wither on the target (Blindness on players) for %d seconds -info.mocreatures.whip=All tamed MoC mobs within a range of 10 blocks will automatically sit when the ground is right-clicked \ No newline at end of file +info.mocreatures.whip=All tamed MoC mobs within a range of 10 blocks will automatically sit when the ground is right-clicked + +# TINKERS CONSTRUCT +material.earth_chitin.name=Earth Chitin +material.dark_chitin.name=Dark Chitin +material.frost_chitin.name=Frost Chitin +material.fire_chitin.name=Fire Chitin +material.undead_chitin.name=Undead Chitin + +modifier.dark_sting.name=Sting of Darkness +modifier.dark_sting.desc=§oElemental Scorpions!§r\nYour tool weakens enemies (or nauseates players) on hit and deals increased damage. +modifier.earth_sting.name=Sting of Earth +modifier.earth_sting.desc=§oElemental Scorpions!§r\nYour tool poisons enemies on hit and deals increased damage. +modifier.frost_sting.name=Sting of Frost +modifier.frost_sting.desc=§oElemental Scorpions!§r\nYour tool slows enemies on hit and deals increased damage. +modifier.fire_sting.name=Sting of Fire +modifier.fire_sting.desc=§oElemental Scorpions!§r\nYour tool sets enemies on fire and deals increased damage. +modifier.undead_sting.name=Sting of Undead +modifier.undead_sting.desc=§oElemental Scorpions!§r\nYour tool withers enemies (or blinds players) on hit and deals increased damage. \ No newline at end of file diff --git a/src/main/resources/assets/mocreatures/materials/dark_chitin.json b/src/main/resources/assets/mocreatures/materials/dark_chitin.json new file mode 100644 index 00000000..4c55f5b6 --- /dev/null +++ b/src/main/resources/assets/mocreatures/materials/dark_chitin.json @@ -0,0 +1,9 @@ +{ + "type": "multicolor", + "suffix": "contrast", + "parameters": { + "dark": "363844", + "mid": "363844", + "bright": "363844" + } +} \ No newline at end of file diff --git a/src/main/resources/assets/mocreatures/materials/earth_chitin.json b/src/main/resources/assets/mocreatures/materials/earth_chitin.json new file mode 100644 index 00000000..80987199 --- /dev/null +++ b/src/main/resources/assets/mocreatures/materials/earth_chitin.json @@ -0,0 +1,9 @@ +{ + "type": "multicolor", + "suffix": "contrast", + "parameters": { + "dark": "F37A07", + "mid": "F37A07", + "bright": "F37A07" + } +} \ No newline at end of file diff --git a/src/main/resources/assets/mocreatures/materials/fire_chitin.json b/src/main/resources/assets/mocreatures/materials/fire_chitin.json new file mode 100644 index 00000000..899547f5 --- /dev/null +++ b/src/main/resources/assets/mocreatures/materials/fire_chitin.json @@ -0,0 +1,9 @@ +{ + "type": "multicolor", + "suffix": "contrast", + "parameters": { + "dark": "C62B13", + "mid": "C62B13", + "bright": "C62B13" + } +} \ No newline at end of file diff --git a/src/main/resources/assets/mocreatures/materials/frost_chitin.json b/src/main/resources/assets/mocreatures/materials/frost_chitin.json new file mode 100644 index 00000000..925bf89f --- /dev/null +++ b/src/main/resources/assets/mocreatures/materials/frost_chitin.json @@ -0,0 +1,9 @@ +{ + "type": "multicolor", + "suffix": "contrast", + "parameters": { + "dark": "1B7A87", + "mid": "1B7A87", + "bright": "1B7A87" + } +} \ No newline at end of file diff --git a/src/main/resources/assets/mocreatures/materials/undead_chitin.json b/src/main/resources/assets/mocreatures/materials/undead_chitin.json new file mode 100644 index 00000000..afcbc88e --- /dev/null +++ b/src/main/resources/assets/mocreatures/materials/undead_chitin.json @@ -0,0 +1,9 @@ +{ + "type": "multicolor", + "suffix": "contrast", + "parameters": { + "dark": "92B859", + "mid": "92B859", + "bright": "92B859" + } +} \ No newline at end of file