Files
CustomNPC-Plus/src/main/java/noppes/npcs/items/ItemScripted.java
T

33 lines
1.1 KiB
Java
Raw Normal View History

2022-05-11 01:10:31 -05:00
package noppes.npcs.items;
import net.minecraft.entity.player.EntityPlayer;
import net.minecraft.item.ItemStack;
2022-07-07 16:22:50 -05:00
import net.minecraft.util.ChatComponentTranslation;
2022-05-11 01:10:31 -05:00
import net.minecraft.world.World;
import noppes.npcs.CustomItems;
import noppes.npcs.CustomNpcs;
2024-02-19 19:14:51 -05:00
import noppes.npcs.CustomNpcsPermissions;
2023-01-07 00:21:08 -05:00
import noppes.npcs.config.ConfigScript;
2022-05-11 01:10:31 -05:00
import noppes.npcs.constants.EnumGuiType;
public class ItemScripted extends ItemCustomizable {
2025-02-13 18:20:01 -06:00
2022-05-11 01:10:31 -05:00
public ItemScripted() {
maxStackSize = 1;
setCreativeTab(CustomItems.tab);
CustomNpcs.proxy.registerItem(this);
setHasSubtypes(true);
}
2022-07-07 16:22:50 -05:00
public ItemStack onItemRightClick(ItemStack stack, World world, EntityPlayer player)
2022-05-11 01:10:31 -05:00
{
2022-07-07 16:22:50 -05:00
if(player.isSneaking() && player.capabilities.isCreativeMode) {
2024-03-07 19:34:25 -05:00
if(!ConfigScript.canScript(player, CustomNpcsPermissions.TOOL_SCRIPTED_ITEM)){
2022-07-07 16:22:50 -05:00
player.addChatMessage(new ChatComponentTranslation("availability.permission"));
} else {
CustomNpcs.proxy.openGui(0, 0, 0, EnumGuiType.ScriptItem, player);
}
2022-05-11 01:10:31 -05:00
}
2025-02-13 18:20:01 -06:00
return super.onItemRightClick(stack, world, player);
2022-05-11 01:10:31 -05:00
}
}