Fixed gems dropping an item of the wrong affinity

This commit is contained in:
Sollace 2019-02-04 22:09:36 +02:00
parent 4033b48e24
commit c06c6c6a05

View file

@ -18,6 +18,7 @@ import net.minecraft.entity.EntityLiving;
import net.minecraft.entity.EntityLivingBase;
import net.minecraft.entity.player.EntityPlayer;
import net.minecraft.init.SoundEvents;
import net.minecraft.item.Item;
import net.minecraft.item.ItemStack;
import net.minecraft.nbt.NBTTagCompound;
import net.minecraft.network.datasync.DataParameter;
@ -99,11 +100,15 @@ public class EntitySpell extends EntityLiving implements IMagicals, ICaster<Enti
}
public ItemStack onPlayerMiddleClick(EntityPlayer player) {
ItemStack stack = new ItemStack(UItems.spell, 1);
ItemStack stack = new ItemStack(getItem(), 1);
SpellRegistry.instance().enchantStack(stack, getEffect().getName());
return stack;
}
protected Item getItem() {
return getAffinity() == SpellAffinity.BAD ? UItems.curse : UItems.spell;
}
@Override
protected boolean canTriggerWalking() {
return false;
@ -226,7 +231,7 @@ public class EntitySpell extends EntityLiving implements IMagicals, ICaster<Enti
if (world.getGameRules().getBoolean("doTileDrops")) {
int level = getCurrentLevel();
ItemStack stack = new ItemStack(UItems.spell, level + 1);
ItemStack stack = new ItemStack(getItem(), level + 1);
if (hasEffect()) {
SpellRegistry.instance().enchantStack(stack, getEffect().getName());
}