ContentTweaker

ContentTweaker

27M Downloads

Equality operators are inverted

superfluke opened this issue ยท 0 comments

commented

In an onItemUse function, if(blocky != <block:minecraft:wool:6>) returns true when clicked on pink wool.

In a single player world.
base-1.12.2-3.6.1.jar
ContentTweaker-1.12.2-4.4.1
Forge 14.23.2.2611

Test item code:

var woolkiller = VanillaFactory.createItem("woolkiller");
woolkiller.maxStackSize = 1;
woolkiller.setMaxDamage(10);
woolkiller.onItemUse = function(player, world, pos, hand, facing, blockHit) {
    var blocky = world.getBlockState(pos);
    if(blocky != <block:minecraft:wool:6>){
        var cmdstr = "give " ~ player.name ~ " minecraft:gold_block";
        print(cmdstr);
        Commands.call(cmdstr, player, world, false, true);
        world.setBlockState(<block:minecraft:air>, pos);
        player.getHeldItem(hand).shrink(1);
    }
    else {
        player.sendChat("Hello darkness my old friend");
        player.getHeldItem(hand).damage(1, player);        
    }
    return ActionResult.success();  
};
woolkiller.register();