-
Notifications
You must be signed in to change notification settings - Fork 19
Expand file tree
/
Copy pathItemMagicWand.java
More file actions
66 lines (54 loc) · 2.03 KB
/
ItemMagicWand.java
File metadata and controls
66 lines (54 loc) · 2.03 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
package com.teamwizardry.wizardry.common.item;
import com.teamwizardry.librarianlib.features.base.item.IGlowingItem;
import com.teamwizardry.librarianlib.features.base.item.ItemMod;
import com.teamwizardry.librarianlib.features.helpers.NBTHelper;
import com.teamwizardry.wizardry.init.ModItems;
import net.minecraft.client.renderer.block.model.IBakedModel;
import net.minecraft.entity.player.EntityPlayer;
import net.minecraft.item.EnumRarity;
import net.minecraft.item.ItemStack;
import net.minecraft.util.EnumActionResult;
import net.minecraft.util.EnumFacing;
import net.minecraft.util.EnumHand;
import net.minecraft.util.math.BlockPos;
import net.minecraft.world.World;
import net.minecraftforge.fml.relauncher.Side;
import net.minecraftforge.fml.relauncher.SideOnly;
import org.jetbrains.annotations.NotNull;
import javax.annotation.Nonnull;
import javax.annotation.Nullable;
public class ItemMagicWand extends ItemMod implements IGlowingItem {
public ItemMagicWand() {
super("magic_wand");
setMaxStackSize(1);
}
@Override
public EnumActionResult onItemUse(EntityPlayer player, World worldIn, BlockPos pos, EnumHand hand, EnumFacing facing, float hitX, float hitY, float hitZ) {
if (worldIn.isRemote) return EnumActionResult.SUCCESS;
ItemStack cape = new ItemStack(ModItems.CAPE);
NBTHelper.setInt(cape, "maxTick", 1000000);
player.inventory.addItemStackToInventory(cape);
return EnumActionResult.SUCCESS;
}
@SideOnly(Side.CLIENT)
@Override
public int packedGlowCoords(@Nonnull ItemStack itemStack, @Nonnull IBakedModel iBakedModel) {
return 0xf000f0;
}
@SideOnly(Side.CLIENT)
@Nullable
@Override
public IBakedModel transformToGlow(@Nonnull ItemStack itemStack, @Nonnull IBakedModel iBakedModel) {
return IGlowingItem.Helper.wrapperBake(iBakedModel, false, 1);
}
@SideOnly(Side.CLIENT)
@Override
public boolean shouldDisableLightingForGlow(@Nonnull ItemStack itemStack, @Nonnull IBakedModel iBakedModel) {
return true;
}
@NotNull
@Override
public EnumRarity getRarity(ItemStack stack) {
return EnumRarity.EPIC;
}
}