2022-05-11 01:10:31 -05:00
|
|
|
package noppes.npcs.items;
|
|
|
|
|
|
2025-03-08 17:52:39 -05:00
|
|
|
import kamkeel.npcs.network.packets.data.ChatAlertPacket;
|
2022-05-11 01:10:31 -05:00
|
|
|
import net.minecraft.entity.player.EntityPlayer;
|
2025-03-08 17:52:39 -05:00
|
|
|
import net.minecraft.entity.player.EntityPlayerMP;
|
2022-05-11 01:10:31 -05:00
|
|
|
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;
|
2025-03-08 17:52:39 -05:00
|
|
|
import noppes.npcs.NoppesUtilServer;
|
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;
|
|
|
|
|
|
2025-02-13 18:16:53 -06:00
|
|
|
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
|
|
|
{
|
2025-03-08 17:52:39 -05:00
|
|
|
if (!world.isRemote){
|
|
|
|
|
if(player.isSneaking() && player.capabilities.isCreativeMode) {
|
|
|
|
|
if(!ConfigScript.canScript(player, CustomNpcsPermissions.TOOL_SCRIPTED_ITEM)){
|
|
|
|
|
ChatAlertPacket.sendChatAlert((EntityPlayerMP) player, "availability.permission");
|
|
|
|
|
} else {
|
|
|
|
|
NoppesUtilServer.sendOpenGui(player, EnumGuiType.ScriptItem, null, 0, 0, 0);
|
|
|
|
|
}
|
2022-07-07 16:22:50 -05:00
|
|
|
}
|
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
|
|
|
}
|
|
|
|
|
}
|