MC百科社群

标题: 1.12.2Contenttweaker物品注册错误 [打印本页]

作者: QQ酱19442    时间: 2020-11-15 08:32
标题: 1.12.2Contenttweaker物品注册错误
脚本代码:#loader contenttweakerimport mods.contenttweaker.VanillaFactory;
import mods.contenttweaker.Item;
import mods.contenttweaker.IItemRightClick;
import mods.contenttweaker.Commands;
import mods.contenttweaker.Fluid;
import mods.contenttweaker.Color;
import mods.contenttweaker.MaterialSystem;
import mods.contenttweaker.Material;
import crafttweaker.entity.IEntityLivingBase;
import crafttweaker.entity.IEntity;
import crafttweaker.player.IPlayer;
import crafttweaker.events.IEventManager;
import crafttweaker.item.IItemStack;
import crafttweaker.item.IIngredient;

var book = VanillaFactory.createItem("book");
book.maxStackSize = 1;
book.creativeTab = <creativetab:misc>;
book.rarity = "epic";
book.glowing = true;

book.itemRightClick = function(stack, world, player, hand) {
if(player.offHandHeldItem == <item:bloodmagic:activation_crystal:2>) {
    Commands.call("summon minecraft:lightning_bolt", player, world);
    Commands.call("clear @p", player, world);
    Commands.call("give @p projecte:item.pe_tome", player, world);
    player.attackEntityFrom(<damageSource:OUT_OF_WORLD>, 1000000000000000.0f);
    } else {
    player.attackEntityFrom(<damageSource:OUT_OF_WORLD>, 1000000000000000.0f);
    }
    return "Pass";
};
book.register();

crafttweaker.log.txt (7.25 KB, 下载次数: 2)








作者: ChromaPIE    时间: 2020-11-15 08:32
把 if(player.offHandHeldItem == <item:bloodmagic:activation_crystal:2>)

改成 if(player.offHandHeldItem has <item:bloodmagic:activation_crystal:2>)




欢迎光临 MC百科社群 (https://bbs.mcmod.cn/) MC百科|最大的MineCraft中文模组百科