Dropping the Ring of the Aesir reverts it into its base components.

This commit is contained in:
Lizbeth Rika committed 2015-05-12 17:51:45 +01:00
1 parent a8f63d376c
commit 30ab404d26
3 files changed
+35 -1

No files matched your search

@@ -15,11 +15,15 @@ import java.util.List;
import net.minecraft.entity.EntityLivingBase;
import net.minecraft.entity.SharedMonsterAttributes;
import net.minecraft.entity.ai.attributes.AttributeModifier;
import net.minecraft.entity.item.EntityItem;
import net.minecraft.entity.player.EntityPlayer;
import net.minecraft.inventory.IInventory;
import net.minecraft.item.Item;
import net.minecraft.item.ItemStack;
import net.minecraft.stats.Achievement;
import net.minecraft.util.ChunkCoordinates;
import net.minecraftforge.common.MinecraftForge;
import net.minecraftforge.event.entity.item.ItemTossEvent;
import net.minecraftforge.oredict.RecipeSorter;
import net.minecraftforge.oredict.RecipeSorter.Category;
import vazkii.botania.api.item.IExtendedWireframeCoordinateListProvider;
@@ -34,6 +38,7 @@ import baubles.api.BaubleType;
import com.google.common.collect.HashMultimap;
import com.google.common.collect.Multimap;
import cpw.mods.fml.common.eventhandler.SubscribeEvent;
import cpw.mods.fml.common.registry.GameRegistry;
public class ItemAesirRing extends ItemRelicBauble implements IExtendedWireframeCoordinateListProvider, ICraftAchievement {
@@ -44,6 +49,30 @@ public class ItemAesirRing extends ItemRelicBauble implements IExtendedWireframe
super(LibItemNames.AESIR_RING);
GameRegistry.addRecipe(new AesirRingRecipe());
RecipeSorter.register("botania:aesirRing", AesirRingRecipe.class, Category.SHAPELESS, "");
MinecraftForge.EVENT_BUS.register(this);
}
@SubscribeEvent
public void onDropped(ItemTossEvent event) {
if(event.entityItem != null && event.entityItem.getEntityItem() != null && !event.entityItem.worldObj.isRemote) {
ItemStack stack = event.entityItem.getEntityItem();
if(stack.getItem() != null && stack.getItem() == this) {
event.entityItem.setDead();
String user = getSoulbindUsername(stack);
for(Item item : new Item[] { ModItems.thorRing, ModItems.lokiRing, ModItems.odinRing }) {
ItemStack stack1 = new ItemStack(item);
bindToUsername(user, stack1);
EntityItem entity = new EntityItem(event.entityItem.worldObj, event.entityItem.posX, event.entityItem.posY, event.entityItem.posZ, stack1);
entity.motionX = event.entityItem.motionX;
entity.motionY = event.entityItem.motionY;
entity.motionZ = event.entityItem.motionZ;
entity.age = event.entityItem.age;
entity.delayBeforeCanPickup = event.entityItem.delayBeforeCanPickup;
entity.worldObj.spawnEntityInWorld(entity);
}
}
}
}
@Override
@@ -60,7 +89,7 @@ public class ItemAesirRing extends ItemRelicBauble implements IExtendedWireframe
public List<ChunkCoordinates> getWireframesToDraw(EntityPlayer player, ItemStack stack) {
return ((IWireframeCoordinateListProvider) ModItems.lokiRing).getWireframesToDraw(player, stack);
}
@Override
public ChunkCoordinates getSourceWireframe(EntityPlayer player, ItemStack stack) {
return ((IExtendedWireframeCoordinateListProvider) ModItems.lokiRing).getSourceWireframe(player, stack);
@@ -26,6 +26,7 @@ import vazkii.botania.api.BotaniaAPI;
import vazkii.botania.api.item.IRelic;
import vazkii.botania.common.core.helper.ItemNBTHelper;
import vazkii.botania.common.item.ItemMod;
import vazkii.botania.common.item.ModItems;
public class ItemRelic extends ItemMod implements IRelic {
@@ -60,6 +61,9 @@ public class ItemRelic extends ItemMod implements IRelic {
addStringToTooltip(String.format(StatCollector.translateToLocal("botaniamisc.notYourSagittarius"), bind), list);
}
if(stack.getItem() == ModItems.aesirRing)
addStringToTooltip(StatCollector.translateToLocal("botaniamisc.dropIkea"), list);
addStringToTooltip("", list);
String name = stack.getUnlocalizedName() + ".poem";
for(int i = 0; i < 4; i++)
@@ -110,6 +110,7 @@ botaniamisc.hasKeepIvy=Has Resolute Ivy
botaniamisc.active=&aActive
botaniamisc.inactive=&cInactive
botaniamisc.achievements=Botania Achievements
botaniamisc.dropIkea=&bDropping this item will break it down into its components
# NEI INTEGRATION
botania.nei.brewery=Botanical Brewery