Thaumcraft Goggles upgrade for Living Helmet
Combine a Living Helmet with an undamaged Goggles of Revealing in an anvil (+1 level) to combine the two. Currently no way to split afterwards. Thoughts: - Tweak level requirement to be higher? 1 was chosen in order to make it work. - Require full set of armor to be worn? This would keep it in line with all the other upgrades. - I only used the full Thaumcraft jar because the uploaded API is a zip which does not work as a Gradle library.
This commit is contained in:
parent
332e16a585
commit
c1aeb2e7f6
6 changed files with 68 additions and 9 deletions
|
@ -4,6 +4,7 @@ import lombok.Getter;
|
|||
import net.minecraft.block.Block;
|
||||
import net.minecraft.item.Item;
|
||||
import net.minecraft.potion.Potion;
|
||||
import net.minecraftforge.fml.common.registry.GameRegistry;
|
||||
|
||||
import java.util.Locale;
|
||||
|
||||
|
@ -128,6 +129,9 @@ public class Constants
|
|||
public static final String WAILA_CONFIG_ALTAR = Mod.MODID + ".bloodAltar";
|
||||
public static final String WAILA_CONFIG_TELEPOSER = Mod.MODID + ".teleposer";
|
||||
public static final String WAILA_CONFIG_RITUAL = Mod.MODID + ".ritualController";
|
||||
|
||||
public static final String THAUMCRAFT_HAS_GOGGLES = "hasGoggles";
|
||||
public static final Item THAUMCRAFT_GOGGLES = GameRegistry.findItem("Thaumcraft", "goggles");
|
||||
}
|
||||
|
||||
public static class Misc
|
||||
|
|
|
@ -5,6 +5,7 @@ import java.util.List;
|
|||
import java.util.Map;
|
||||
import java.util.Map.Entry;
|
||||
|
||||
import WayofTime.bloodmagic.api.util.helper.NBTHelper;
|
||||
import net.minecraft.entity.Entity;
|
||||
import net.minecraft.entity.EntityLivingBase;
|
||||
import net.minecraft.entity.ai.attributes.AttributeModifier;
|
||||
|
@ -15,6 +16,7 @@ import net.minecraft.nbt.NBTTagCompound;
|
|||
import net.minecraft.util.DamageSource;
|
||||
import net.minecraft.world.World;
|
||||
import net.minecraftforge.common.ISpecialArmor;
|
||||
import net.minecraftforge.fml.common.Optional;
|
||||
import net.minecraftforge.fml.relauncher.Side;
|
||||
import net.minecraftforge.fml.relauncher.SideOnly;
|
||||
import WayofTime.bloodmagic.BloodMagic;
|
||||
|
@ -25,8 +27,14 @@ import WayofTime.bloodmagic.registry.ModItems;
|
|||
import WayofTime.bloodmagic.util.helper.TextHelper;
|
||||
|
||||
import com.google.common.collect.Multimap;
|
||||
import thaumcraft.api.items.IGoggles;
|
||||
import thaumcraft.api.items.IRevealer;
|
||||
|
||||
public class ItemLivingArmour extends ItemArmor implements ISpecialArmor
|
||||
@Optional.InterfaceList({
|
||||
@Optional.Interface(iface = "thaumcraft.api.items.IRevealer", modid = "Thaumcraft"),
|
||||
@Optional.Interface(iface = "thaumcraft.api.items.IGoggles", modid = "Thaumcraft")
|
||||
})
|
||||
public class ItemLivingArmour extends ItemArmor implements ISpecialArmor, IRevealer, IGoggles
|
||||
{
|
||||
public static String[] names = { "helmet", "chest", "legs", "boots" };
|
||||
|
||||
|
@ -168,6 +176,8 @@ public class ItemLivingArmour extends ItemArmor implements ISpecialArmor
|
|||
@SideOnly(Side.CLIENT)
|
||||
public void addInformation(ItemStack stack, EntityPlayer player, List<String> tooltip, boolean advanced)
|
||||
{
|
||||
stack = NBTHelper.checkNBT(stack);
|
||||
|
||||
if (this == ModItems.livingArmourChest)
|
||||
{
|
||||
LivingArmour armour = getLivingArmour(stack);
|
||||
|
@ -181,6 +191,12 @@ public class ItemLivingArmour extends ItemArmor implements ISpecialArmor
|
|||
}
|
||||
}
|
||||
|
||||
if (this == ModItems.livingArmourHelmet)
|
||||
{
|
||||
if (stack.getTagCompound().getBoolean(Constants.Compat.THAUMCRAFT_HAS_GOGGLES))
|
||||
tooltip.add(TextHelper.localizeEffect("tooltip.BloodMagic.livingArmour.hasGoggles"));
|
||||
}
|
||||
|
||||
super.addInformation(stack, player, tooltip, advanced);
|
||||
}
|
||||
|
||||
|
@ -311,4 +327,18 @@ public class ItemLivingArmour extends ItemArmor implements ISpecialArmor
|
|||
|
||||
return null;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean showIngamePopups(ItemStack stack, EntityLivingBase entityLivingBase)
|
||||
{
|
||||
stack = NBTHelper.checkNBT(stack);
|
||||
return stack != null && stack.getItem() == ModItems.livingArmourHelmet && stack.getTagCompound().getBoolean(Constants.Compat.THAUMCRAFT_HAS_GOGGLES);
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean showNodes(ItemStack stack, EntityLivingBase entityLivingBase)
|
||||
{
|
||||
stack = NBTHelper.checkNBT(stack);
|
||||
return stack != null && stack.getItem() == ModItems.livingArmourHelmet && stack.getTagCompound().getBoolean(Constants.Compat.THAUMCRAFT_HAS_GOGGLES);
|
||||
}
|
||||
}
|
||||
|
|
|
@ -3,6 +3,7 @@ package WayofTime.bloodmagic.util.handler;
|
|||
import java.util.List;
|
||||
import java.util.Random;
|
||||
|
||||
import WayofTime.bloodmagic.api.util.helper.NBTHelper;
|
||||
import net.minecraft.block.Block;
|
||||
import net.minecraft.enchantment.Enchantment;
|
||||
import net.minecraft.enchantment.EnchantmentHelper;
|
||||
|
@ -18,14 +19,12 @@ import net.minecraft.item.ItemStack;
|
|||
import net.minecraft.potion.PotionEffect;
|
||||
import net.minecraft.util.DamageSource;
|
||||
import net.minecraft.world.World;
|
||||
import net.minecraftforge.event.AnvilUpdateEvent;
|
||||
import net.minecraftforge.event.entity.living.LivingAttackEvent;
|
||||
import net.minecraftforge.event.entity.living.LivingDropsEvent;
|
||||
import net.minecraftforge.event.entity.living.LivingHealEvent;
|
||||
import net.minecraftforge.event.entity.living.LivingHurtEvent;
|
||||
import net.minecraftforge.event.entity.player.ArrowLooseEvent;
|
||||
import net.minecraftforge.event.entity.player.EntityItemPickupEvent;
|
||||
import net.minecraftforge.event.entity.player.FillBucketEvent;
|
||||
import net.minecraftforge.event.entity.player.PlayerEvent;
|
||||
import net.minecraftforge.event.entity.player.*;
|
||||
import net.minecraftforge.event.world.BlockEvent;
|
||||
import net.minecraftforge.fml.client.event.ConfigChangedEvent;
|
||||
import net.minecraftforge.fml.common.eventhandler.Event;
|
||||
|
@ -93,6 +92,20 @@ public class EventHandler
|
|||
}
|
||||
}
|
||||
|
||||
@SubscribeEvent
|
||||
public void onAnvil(AnvilUpdateEvent event)
|
||||
{
|
||||
if (event.left.getItem() == ModItems.livingArmourHelmet && event.right.getItem() == Constants.Compat.THAUMCRAFT_GOGGLES && !event.right.isItemDamaged())
|
||||
{
|
||||
ItemStack output = event.left.copy();
|
||||
output = NBTHelper.checkNBT(output);
|
||||
output.getTagCompound().setBoolean(Constants.Compat.THAUMCRAFT_HAS_GOGGLES, true);
|
||||
event.cost = 1;
|
||||
|
||||
event.output = output;
|
||||
}
|
||||
}
|
||||
|
||||
@SubscribeEvent
|
||||
public void onBucketFill(FillBucketEvent event)
|
||||
{
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue