Closed michal5575 closed 10 years ago
You can do already using the blockActivated
event.
Example:
blockActivated: function(world, x, y, z, entityplayer, itemStack) {
// do something here
return true
}
This goes in the options when creating a block using Block(id).create(options)
Okay, and how to do it with already existing blocks?
There is no way of doing that currently, I thought initially there should be no modification of built in blocks as it could cause unintentional damage to worlds. Also because the built in blocks are coded in the 'native' Java code, they perform better with less lag, and enabling mods to change these blocks would make game-play more laggy.
Though I could try some tests but it's unlikely to perform well. You'll have to create a new block to customize its properties
Okay
And can I print text on screen (for example if will someone mine/place block it will change number) I do not know how it looks in java so there is c++ example (Sorry for "mWorld", this code is from my Lamecraft mod):
int IronNumber;
mWorld->player.IronNumber = 0;
if (mWorld->GetBlock(testPos.x, testPos.y, testPos.z) == 41)
{
if(mWorld->player.IronNumber -= 1);
else if(mWorld->player.IronNumber <= 0)
{
mWorld->player.health = 0;
mWorld->player.hunger = 0;
mWorld->player.gamemode = 2;
}
}
if (mWorld->GetBlock(testPos.x, testPos.y, testPos.z) == 41)
{
mWorld->player.IronNumber += 1;
}
mRender->DebugPrint(255,110,"Iron: %i", mWorld->player.IronNumber - 1);
There is Console.log
which prints to stdout (use emulator) but there is no on-screen printing
Okay
Can you make possiblity to make action if click on some block (for example change sky color if click on bed) to your mod(and make it useable in mods)?