Discussion in 'Plugin Development' started by phaed, Aug 24, 2011.
For instance, making a dirt block as hard to break as obsidian, is it possible?
You'd need to change the net.minecraft block.strength value.
How exacly can you do that ?
Well it's client side, so everyone would have to download a Mod that you make. Check out MCP if you really want to continue with this idea...
easy way is to download craftbukkit source and go into net.minecraft etc and edit block.java BUT without client sided changes ASWELL blocks will be unbreakable! D:
You could maybe do a hackish solution and send block change packets to the client to restart the mining process. It wouldn't give a relieable result, though, because of network speed and server lags.
actually, couldn't we cancel the onPlayerinteract/blockDamageEvent for a few ticks then allow it? :3
Whatever you do to make the server delay the breaking of the block, the client won't care. When you hold your left mouse button while facing a block, you will start mining it and break it after the client-set time - and no server can stop that.
No I mean it like that:
Player starts hitting a block, the PlayerInteract event gets called, we cancel it for 40 ticks, then don't cancel it anymore. On a lag free server wouldn't that mean that the block wouldn't break because the interact event would be cancelled? It was just a thought, never said that it WILL work...
Like I said, cancelling PlayerInteractEvent won't bother the client to break the block. It will still mine it and send the break packet. You might get the server to refuse that and deny the block break, that will send the block back to the player and your procedure starts again ...
Hm D: True
When someone starts breaking a block, the client sends the blockStartBreak packet. When it finishes mining the block, it sends the blockBreak packet. The server calculates how long they should be apart, and if they're too close, the server will ether cancel everything or wait for the time that the block was supposed to break, I'm not sure which.
Hm! When I get home I should give it a try anyways, we'll see then
I know all this because of my failed attempts at a client-sided insta mine.
Haha awesome I'll be home in an hour and I will be trying this no matter what everyone else says XD After I try it I'll know for sure
Tho I'm glad my idea wasn't so bad after all
Those statements suggest that the server waits until the expected time passed before allowing the client to break more blocks. It could be used for that purpose, but it wouldn't look very pretty and would have no/hardfly any effect on longer mine times like with obsidian.
It is in active development in Spout. It will be all server side.
Expect to see it in the API for 1.1
Dude your awesome!
Any way that you will reveal how you intend to accopmlish that? I can't think of an only server-side solution that would look pretty (and I'm not only thinking of the cracks on the block).
Sure. My explanation will assume you are at least somewhat familiar with notchian code.
Spout will replace all the blocks in Block.byId with a wrapper class that performs the identical function of the previous block.
Then, there will be an API to set the hardness of a block at a location, or the hardness of all the blocks of a type.
As for the visual half of it, you are correct. Vanilla clients will be unable to calculate the new hardness and will display it visually incorrectly, but will still be affected by. Spoutcraft clients will be sent the updated data and visually display it correctly.
Separate names with a comma.