This is a read-only snapshot of the ComputerCraft forums, taken in April 2020.
Neonbeta's profile picture

Turtle Blockbreaking Whitelist

Started by Neonbeta, 09 August 2013 - 02:47 AM
Neonbeta #1
Posted 09 August 2013 - 04:47 AM
Hello ladies and gents!

Before I get into the meat of the title, I hope you guys don't mind if I introduce myself a little? thanks
(P.S. From what I saw, this should be the right section to post this is, SORRY otherwise :/).

My name is Francis, but I'm also known as Neonbeta (as you can plainly see) and also Shad on some forums due to my old IGN (Bad decision on my part). I am a student that is studying computer programming in my own time, and since I have a lot of free time I do a lot of things that are included with playing minecraft and very little studying ^.^.

So now that I've force you all to read that little snippet, time to get into the meat.

Right now, I help develop and maintain the modpack with a few people for the Industrial Modded server SKCraft, hosted by sk89q.
Now this is where it gets tricky. Turtles, in their entirety; Have been a topic of discussion on the server for many months now. And it was only recently that I was able to talk sk89q into letting me enable turtles, but he gave me an ultimatum (and this is the tricky part) that they cannot grief protected land. On the SKCraft Industrial server codenamed "Alice", we have a custom claims system, which is basically world protection but every player is allowed access to 'claim' chunks (in other words to just protect an area from griefing and such). And because of that, I have to find a way to make sure they(turtles) cannot be used for griefing in any way, shape or form. The thing is, turtles breaking blocks IS logged, but that's not enough for him (that's the gist of it at least).

And that's where this thread comes in. Now, I don't know terribly a lot of java, so that's why I'm posting this here in hopes of someone knowing a way to solve my problem. So after many months of deliberation and decision, I've tried to come up with a way to make sure that turtles couldn't be used for griefing. So far, the ways that I've though of are
  • Disabling the turtles that break blocks.
Of course you would think that this would be the primary option?, but sadly no. With dans genius, he's coded them all to work with NBTdata for the most part, which sucks for me in the position of the recipe disabler we use: Recipear. I'm guessing that most of you will know about my Conundrum, but I'll say it anyways.
The thing about recipear, is that it disables any recipes relating to the original blockID. So say I disable the craft of a block with the ID of 1100, anything with meta data or NBTdata regarding that blockID is disablde also. Which really makes me cry :(/> (sometimes i wish we used the old recipe remover by shdwdrgn…)

The second idea i had was with the help of sk89q himself.
  • Make turtles respect claimed(protected) land.
The end reason is pretty simple why I couldn't use it.
It was because sk89q said with the custom claims system, it would be too tedious to try and work out. And I won't argue with him since he's the expert and I'm not.

Then I came to this idea.
  • Have a whitelist of blocks that turtles can break.
Now. It sounds simple in my head…but of course that never is the reality is it?. As I said previously, I don't know very much java; So this is quite a large hurdle to accomplish by myself, IF it can even be done (I have my doubts :(/> ). So basically what I'm here to ask is; Is it possible to have a set list of blocks that turtles can break? and if so; How easy would it be to create?
I say this from the times when you could set a blacklist of blocks RP2 blockbreakers could break. But sure, that's in the past now isn't it?

But yeah, that's my question.
  • Is it possible to have a set list of blocks that turtles can break? and if so; How easy would it be to create?
Hopefully this wasn't all in vain, but even if it is, I still got to introduce myself to a great community and maybe I'll stick around. But please and thank you for any replies.

Have a great day!
(P.S. It took me so long to get the nerves to press 'Post New Topic' when I'm so new here :<)
Jinchuuriki #2
Posted 11 August 2013 - 10:08 PM
I think the best way to solve the problem is to emulate the block break/place events as the player that placed the turtle down(or started the program if possible?). That way if the player doesn't have access to the claim the place/break event fails, otherwise it's allowed
AfterLifeLochie #3
Posted 12 August 2013 - 05:18 PM
Turtles don't and likely won't obey protection for some time, particularly because ComputerCraft only targets Forge and not MCPC+ and other Bukkit-related Forge-to-Bukkit mods. Protection for block breaking and placing is pretty much useless in the face of ComputerCraft as it doesn't even remotely consider notifying any of the events Bukkit fires - and you can't block destroying using events either as ComputerCraft also doesn't obey the result of the event-limbo in Bukkit. While the changes themselves are rather trivial, Bukkit ports of ComputerCraft were discontinued around 1.33 and haven't been built since – MCPC+ doesn't explicitly require the dedicated porting anymore.

If you really want turtles, you can actually disable all the digging functions in the BIOS - these little modifications would be relatively easy on your part and would be globally retroactive to all turtles - and done properly, cannot be bypassed. This does mean, however, the Mining, Felling, Digging and Farming turtles wouldn't be able to use their tools at all - as even though things like hoes are actually right-clicks to the players, they're treated as dig() by Turtles. On top of this, there is also no way to identify the type of turtle - you can only determine if it's a turtle - so any changes will be retroactively applied to any other Turtles which come from other ComputerCraft-API extending mods.

On the final, while it is technically always possible to alter ComputerCraft by means of careful recompilation, it is not advised. While we cannot directly stop you, we definitely won't endorse nor approve of any such tinkering, and we certainly don't want said tinker code distributed to others.