This is a read-only snapshot of the ComputerCraft forums,
taken in April 2020.
Computer Craft Mod?
Started by The Inspector, 27 October 2013 - 07:20 PMPosted 27 October 2013 - 08:20 PM
I'm currently playing Pixelmon + CC, and I want to be able to make a turtle that can harvest acorn trees, but to harvest acorns you need to just right click the tree, which turtles can't do. Is there anyway someone could either point me to the java file that I have to edit to add in this function or even give me a snippet as I know shit all about java, being a .net developer.
Posted 27 October 2013 - 09:28 PM
Ok well firstly have you tried to use turtle.place as this does emulate a player's "right-click", you could also try turtle.attack.
If you know nothing about Java or Minecraft modding this will be very, very difficult as there is no one method that you edit to fix this, it'd be a case of several classes, it may even be impossible depending on the implementation of the acorn trees.
If you know nothing about Java or Minecraft modding this will be very, very difficult as there is no one method that you edit to fix this, it'd be a case of several classes, it may even be impossible depending on the implementation of the acorn trees.
Posted 27 October 2013 - 10:56 PM
Buggar thought it might of been of something like copying the method for one of the other methods and setting it up for right clicking, something like Entity.PerformRightClick(cords) I dunno. I did try place and attack and they don't work :(/>
Be a shame if I can't get it to work, doesn't really matter was just toying around anyway.
Be a shame if I can't get it to work, doesn't really matter was just toying around anyway.
Posted 27 October 2013 - 11:02 PM
Yeh its definitely not that easy.
Posted 27 October 2013 - 11:25 PM
What about detecting the block in front of the turtle, then calling the method in the tree/block to pop off the apricorn? Way to difficult for minecraft?
Posted 28 October 2013 - 01:04 AM
That depends on how they are implemented. But because pixelmon is closed-source, it might be hard to find out. But one thing that might be possible calling the onBlockActivated method of the block, but there is no guarantee that that would work. I might try to see if this work.What about detecting the block in front of the turtle, then calling the method in the tree/block to pop off the apricorn? Way to difficult for minecraft?
Posted 28 October 2013 - 01:11 AM
yeh I'd assume that you should be able to get the block and call onBlockActivated on it, I don't see any other logical way that pixelmon would have implemented it, it would not be too hard to find out though… this being said, it will still require decompiling ComputerCraft and modifying its source to include your changes, and if you plan on providing this on a server, or to other players, you cannot as it breaks the T&Cs of CC.
Posted 28 October 2013 - 02:45 AM
But how about a peripheral?yeh I'd assume that you should be able to get the block and call onBlockActivated on it, I don't see any other logical way that pixelmon would have implemented it, it would not be too hard to find out though… this being said, it will still require decompiling ComputerCraft and modifying its source to include your changes, and if you plan on providing this on a server, or to other players, you cannot as it breaks the T&Cs of CC.
Posted 28 October 2013 - 02:50 AM
Its only for my SP on lan. I can't stand servers.yeh I'd assume that you should be able to get the block and call onBlockActivated on it, I don't see any other logical way that pixelmon would have implemented it, it would not be too hard to find out though… this being said, it will still require decompiling ComputerCraft and modifying its source to include your changes, and if you plan on providing this on a server, or to other players, you cannot as it breaks the T&Cs of CC.
Posted 28 October 2013 - 07:34 AM
As far as I know a peripheral would work.
Posted 28 October 2013 - 08:16 PM
So where would I start in making a peripheral? I had a quick look through the peripheral section, is there any sort of example peripheral I can have a look at?
I also keep seeing people talk about documentation, but where is it?
I also keep seeing people talk about documentation, but where is it?
Posted 28 October 2013 - 11:04 PM
The javadocs with the API. The API can be found in the sticky post in the Peripherals section.
Posted 29 October 2013 - 12:21 AM
Try bubba's tutorial in the tutorial section, and maybe vswe's java/modding lectures http://courses.vswe.seSo where would I start in making a peripheral? I had a quick look through the peripheral section, is there any sort of example peripheral I can have a look at?
I also keep seeing people talk about documentation, but where is it?
Posted 29 October 2013 - 10:27 AM
As you are a .net developer, you need to learn Java first. I personally got into modding when I only got the basics of java, or not even.
For my experience I think I should tell you that it's not going to be an easy task. I learnt a lot already from modding, because I finally got something to do with Java :P/>
And as for a side note: I just got started to get into modding, it's a long way before you can properly write a mod like… CC for example!
Oh, and also be eager to understand what you are doing, not simply copy code from people.
For my experience I think I should tell you that it's not going to be an easy task. I learnt a lot already from modding, because I finally got something to do with Java :P/>
And as for a side note: I just got started to get into modding, it's a long way before you can properly write a mod like… CC for example!
Oh, and also be eager to understand what you are doing, not simply copy code from people.
Posted 30 October 2013 - 05:10 AM
The javadocs with the API. The API can be found in the sticky post in the Peripherals section.
Nope. The API and docs are included in the CC download.
Posted 31 October 2013 - 12:56 AM
Any tips on how to get the block thats in front of a turtle? I can get the ID, but can't find a way to get a reference of it so that I can call the "onBlockActivated"
I can get the tileEntity, but I can't find a method to return the block, unless its getBlockMetaData but I don't think thats it.
Also has anyone released any open source turtles/peripheral?
I can get the tileEntity, but I can't find a method to return the block, unless its getBlockMetaData but I don't think thats it.
Also has anyone released any open source turtles/peripheral?
Posted 31 October 2013 - 07:14 AM
Open peripherals? http://www.openmods.infoAny tips on how to get the block thats in front of a turtle? I can get the ID, but can't find a way to get a reference of it so that I can call the "onBlockActivated"
I can get the tileEntity, but I can't find a method to return the block, unless its getBlockMetaData but I don't think thats it.
Also has anyone released any open source turtles/peripheral?
Posted 31 October 2013 - 09:26 AM
The javadocs with the API. The API can be found in the sticky post in the Peripherals section.
Nope. The API and docs are included in the CC download.
Ah, thanks! I'll be sure to point people there instead.
Any tips on how to get the block thats in front of a turtle? I can get the ID, but can't find a way to get a reference of it so that I can call the "onBlockActivated"
I can get the tileEntity, but I can't find a method to return the block, unless its getBlockMetaData but I don't think thats it.
Also has anyone released any open source turtles/peripheral?
IIRC, you should be able to get the Block at a given set of world coordinates. You'd then call onBlockActivated on that Block, I believe.
Posted 31 October 2013 - 05:39 PM
Thats my problem! I can't find any method for getting a block at a set of world coordinates, I can find the methods for getting the tile entity and metadata but not the actual block!
I have seen small mentions of maybe some huge list type thing that stores all the blocks in the world, if I can find that I might be right, thats if it even exists, sounds rather odd.
I have seen small mentions of maybe some huge list type thing that stores all the blocks in the world, if I can find that I might be right, thats if it even exists, sounds rather odd.
Posted 31 October 2013 - 07:34 PM
Yeah, I was misremembering. You could probably get the block ID, then call Block.blockslist[blockID].onBlockActivated(worldObj, x, y, z, entityPlayer, whatever, other, args, it, has). Actual implementation is left as an exercise for the reader.
Posted 01 November 2013 - 09:43 PM
I managed to get that to work on a normal peripheral for a computer, but can't workout how to get a turtle ingame. I have been looking through Openmods but can't seem to find the actual method that adds the turtle to creative.