You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
@EventBusSubscriber
public class ItemMascara extends Item implements IBauble {
@GameRegistry.ObjectHolder("pruebas:mascara")
public static final Item block = null;
public ItemMascara() {
this.setMaxStackSize(1);
this.setHasSubtypes(true);
this.setMaxDamage(0);
this.setCreativeTab(CreativeTabs.TOOLS);
}
@SubscribeEvent
public static void registerItems(RegistryEvent.Register<Item> event) {
event.getRegistry().register((new ItemMascara()).setUnlocalizedName("mascara").setRegistryName("mascara"));
}
@Override
public void getSubItems(CreativeTabs tab, NonNullList<ItemStack> list) {
if (this.isInCreativeTab(tab)) {
list.add(new ItemStack(this, 1, 0));
}
}
@Override
public BaubleType getBaubleType(ItemStack itemstack) {
return BaubleType.BELT;
}
@Override
public ActionResult<ItemStack> onItemRightClick(World world, EntityPlayer player, EnumHand hand) {
if (!world.isRemote) {
IBaublesItemHandler baubles = BaublesApi.getBaublesHandler(player);
for (int i = 0; i < baubles.getSlots(); i++) {
if ((baubles.getStackInSlot(i) == null || baubles.getStackInSlot(i).isEmpty()) && baubles.isItemValidForSlot(i, player.getHeldItem(hand), player)) {
baubles.setStackInSlot(i, player.getHeldItem(hand).copy());
if (!player.capabilities.isCreativeMode) {
player.inventory.setInventorySlotContents(player.inventory.currentItem, ItemStack.EMPTY);
}
onEquipped(player.getHeldItem(hand), player);
break;
}
}
}
return new ActionResult<ItemStack>(EnumActionResult.SUCCESS, player.getHeldItem(hand));
}
@Override
public void onWornTick(ItemStack itemstack, EntityLivingBase player) {
if (itemstack.getItemDamage() == 0 && player.ticksExisted % 39 == 0) {
player.addPotionEffect(new PotionEffect(MobEffects.STRENGTH, 40, 0, true, true));
}
}
@Override
public boolean hasEffect(ItemStack par1ItemStack) {
return true;
}
@Override
public EnumRarity getRarity(ItemStack par1ItemStack) {
return EnumRarity.RARE;
}
@Override
public void onEquipped(ItemStack itemstack, EntityLivingBase player) {
player.playSound(SoundEvents.ITEM_ARMOR_EQUIP_DIAMOND, .75F, 1.9f);
}
@Override
public void onUnequipped(ItemStack itemstack, EntityLivingBase player) {
player.playSound(SoundEvents.ITEM_ARMOR_EQUIP_DIAMOND, .75F, 2f);
}
}
The text was updated successfully, but these errors were encountered:
code:
package net.mcreator.pruebas.item;
import baubles.api.BaubleType;
import baubles.api.BaublesApi;
import baubles.api.IBauble;
import baubles.api.cap.IBaublesItemHandler;
import baubles.common.Baubles;
import net.minecraft.creativetab.CreativeTabs;
import net.minecraft.entity.EntityLivingBase;
import net.minecraft.entity.player.EntityPlayer;
import net.minecraft.init.MobEffects;
import net.minecraft.init.SoundEvents;
import net.minecraft.item.EnumRarity;
import net.minecraft.item.Item;
import net.minecraft.item.ItemStack;
import net.minecraft.potion.PotionEffect;
import net.minecraft.util.ActionResult;
import net.minecraft.util.EnumActionResult;
import net.minecraft.util.EnumHand;
import net.minecraft.util.NonNullList;
import net.minecraft.world.World;
import net.minecraftforge.client.event.ModelRegistryEvent;
import net.minecraftforge.client.model.ModelLoader;
import net.minecraftforge.common.MinecraftForge;
import net.minecraftforge.event.RegistryEvent;
import net.minecraftforge.fml.common.Mod;
import net.minecraftforge.fml.common.Mod.EventBusSubscriber;
import net.minecraftforge.fml.common.Mod.Instance;
import net.minecraftforge.fml.common.event.FMLInitializationEvent;
import net.minecraftforge.fml.common.event.FMLPreInitializationEvent;
import net.minecraftforge.fml.common.eventhandler.SubscribeEvent;
import net.minecraftforge.fml.common.registry.GameRegistry;
import net.minecraftforge.fml.relauncher.Side;
import net.minecraftforge.fml.relauncher.SideOnly;
import net.minecraft.client.renderer.block.model.ModelResourceLocation;
@EventBusSubscriber
public class ItemMascara extends Item implements IBauble {
@GameRegistry.ObjectHolder("pruebas:mascara")
public static final Item block = null;
}
The text was updated successfully, but these errors were encountered: