Metadata issue

Issue #100 resolved
Jed created an issue

Using MC 1.7.10, CS2 2-0.11.28 - trying to find out how to enter metadata - for exapmle :

onUse[0] = "if (world.getBlockName(position) == 'Mymod:Numbers' || world.getBlockName(position) == 'minecraft:grass') { world.setBlock(position, 'Mymod:Numbers:2');

If I use 'Mymod:Numbers' it works and detaults to metadata 0, but if I use : 'Mymod:Numbers:2' then it doesn't place down the 'Numbers:2' - where 2 = metadata number block. I've tried the usual suspects [2], (2), and several other permutations. I've been trying to solve this for 5 hours now, just can't get it - sorry to be a nuisance - hope you can help, and sorry if I've posted in the wrong place.

Comments (1)

  1. Jed reporter

    Wow, I surprised myself and finally found the answer : onUse[0] = "if (world.getBlockName(position) == 'Mymod:Numbers' || world.getBlockName(position) == 'minecraft:grass') { world.setBlockMetadata(position, world.getBlockMetadata(position) + 1) ; itemstack.damageItem(1); } ; if (world.getBlockMetadata(position) > 9 ) { world.setBlockMetadata(position, 0); } ";

    I was lucky enough to find a recent mod out there which have me enough of a clue to have another go. I was trying to create a wand which, when you right-click a particular block, it would increase the metadata by +1. It's part of a numbers / alphabet mod I'm creating so that I can number and name my floors. Anyway, working ok now - thanks for providing such a good mod for those of us without java knowledge, its just that such tutorials are in short supply (unless you can point me in the right direction please ?)

  2. Log in to comment