Jump to content




Creating Peripherals and Turtle Upgrades (Updated for 1.5)


65 replies to this topic

#41 Zinal

  • New Members
  • 1 posts

Posted 02 February 2013 - 10:07 PM

Is there any way to download the 1.46 API version? I'm trying to make a turtle upgrade for an FTB Server but FTB (Beta Pack A) is using version 1.46 of ComputerCraft, not 1.48.

Oh, as a side-note (Might have to do with the version change): ITurtleUpgrade.createPeripheral is giving me an AbstractError, which i found very wierd

#42 ee_man

  • Members
  • 5 posts

Posted 30 March 2013 - 08:34 AM

I don't have permission to edit this list (http://www.computerc...tle_Upgrade_IDs)
My mod (http://www.minecraft.../topic/1715756-) use 245 and 246 ids

#43 Cloudy

    Ex-Developer

  • Members
  • 2,543 posts

Posted 30 March 2013 - 11:02 AM

Then request permission on the forum thread... check the wiki discussion forum.

#44 Shnupbups

  • Members
  • 596 posts
  • LocationThat place over there. Y'know. The one where I am.

Posted 30 March 2013 - 11:16 AM

View Postee_man, on 30 March 2013 - 08:34 AM, said:

I don't have permission to edit this list (http://www.computerc...tle_Upgrade_IDs)
My mod (http://www.minecraft.../topic/1715756-) use 245 and 246 ids
I have added them for you.

#45 ee_man

  • Members
  • 5 posts

Posted 08 April 2013 - 04:10 AM

View PostShnupbups100, on 30 March 2013 - 11:16 AM, said:

View Postee_man, on 30 March 2013 - 08:34 AM, said:

I don't have permission to edit this list (http://www.computerc...tle_Upgrade_IDs)
My mod (http://www.minecraft.../topic/1715756-) use 245 and 246 ids
I have added them for you.
Thanks

#46 Khalory

  • Members
  • 4 posts

Posted 10 April 2013 - 05:33 AM

This seems pretty stupid since I've already managed to get the API ready to use but... Where is the documentation? I can't find it inside the download so am I just blind or is it somewhere else?

#47 Cloudy

    Ex-Developer

  • Members
  • 2,543 posts

Posted 10 April 2013 - 07:30 AM

View PostKhalory, on 10 April 2013 - 05:33 AM, said:

This seems pretty stupid since I've already managed to get the API ready to use but... Where is the documentation? I can't find it inside the download so am I just blind or is it somewhere else?

It is javadoc comments in the API source.

#48 Khalory

  • Members
  • 4 posts

Posted 10 April 2013 - 08:02 AM

View PostCloudy, on 10 April 2013 - 07:30 AM, said:

It is javadoc comments in the API source.

The API I have doesn't have them so maybe I wasn't supposed to do what I did? I opened up the main ComputerCraft download and decompiled and deobfuscated the API that was inside but there are no javadocs in what I have. Is there a separate, already deobfuscated source elsewhere that has the javadocs?

#49 Espen

    Curious Explorer

  • Members
  • 708 posts

Posted 10 April 2013 - 08:26 AM

View PostKhalory, on 10 April 2013 - 08:02 AM, said:

The API I have doesn't have them so maybe I wasn't supposed to do what I did? I opened up the main ComputerCraft download and decompiled and deobfuscated the API that was inside but there are no javadocs in what I have. Is there a separate, already deobfuscated source elsewhere that has the javadocs?
The API source files (including comments) are within the ComputerCraft zip file under "api\src".
Copy the contents from that folder into your Mod's project.

However when you're packing up your mod for release, you needn't and shouldn't include the API!

Edited by Espen, 10 April 2013 - 08:29 AM.


#50 Khalory

  • Members
  • 4 posts

Posted 10 April 2013 - 08:43 AM

View PostEspen, on 10 April 2013 - 08:26 AM, said:

The API source files (including comments) are within the ComputerCraft zip file under "api\src".
Copy the contents from that folder into your Mod's project.

However when you're packing up your mod for release, you needn't and shouldn't include the API!

Thanks to your help I found out that I was just using a version of the download that was before the api\src folder was added to the .zip file. I can definitely find the newest version of the API, thanks.

#51 gudenau

  • Members
  • 24 posts

Posted 27 June 2013 - 07:10 PM

I can not add my ids to the wiki page, why is this?

#52 Xfel

    Peripheral Designer

  • Members
  • 515 posts

Posted 02 July 2013 - 01:02 AM

View PostCloudy, on 30 March 2013 - 11:02 AM, said:

Then request permission on the forum thread... check the wiki discussion forum.


#53 JustPingo

  • Members
  • 108 posts
  • LocationFrance

Posted 02 September 2013 - 04:38 AM

Hi !
When I put the API, there's no computer when I launch the game with eclipse, and if I put CC in jars' mods folder, it crash.
What should I do please ?

Thanks in advance.

#54 GammaPaladin

  • Members
  • 10 posts

Posted 25 September 2013 - 07:46 PM

Sooooooo... I'm working on a peripheral for my own convenience, mostly, and I'm having a slight problem. I'm returning an Object[] with 3 Integers in the array, but for some reason, when I call the function, I only get the first Integer's value.

This is my callMethod block. It only has one method for now, but I plan to add a few later, hence the switch.
@Override
	public Object[] callMethod(IComputerAccess computer, int method,
			Object[] arguments) throws Exception
	{
		if (computer == data.controller)
		{
			switch (method)
			{
				case 0:
					return getPos();
					
			}
		}
		return null;
	}

That's working, because getPos() is called. Here is the getPos function:
private Integer[] getPos()
	{
		
		Integer x = new Integer(xCoord);
		Integer y = new Integer(yCoord);
		Integer z = new Integer(zCoord);
		
		OverNet.log(Level.INFO, "Coordinates: (" + x.toString() + ", " + y.toString() + ", " + z.toString() + ")");
		
		Integer[] pos = new Integer[3];
		pos[0] = x;
		pos[1] = y;
		pos[2] = z;
		
		return pos;
	}

I know the array initialization is ugly, I was just trying to do it in the most basic way possible to ferret out any possible problems. The log statement works, I get the correct xyz coordinates displayed in the log:
2013-09-25 17:31:48 [INFO] [OverNet] Coordinates: (1106, 4, 1534)

But if I try:
local gps = peripheral.wrap("right")

print(textutils.serialize(gps.locate()))

I just get 1106.

I'm sure I've missed something obvious, so I figured I'd see if anyone can spot whatever it is I've missed.

#55 tikiking1

  • New Members
  • 1 posts

Posted 29 September 2013 - 06:33 PM

Is there any way to make a custom computer? I'm thinking of making a PDA-style item, and none of the classes in the Javadoc seem like they'd help. Would I have to decompile the "actual" mod and use whichever class makes the GUI?

#56 sockeye

  • New Members
  • 1 posts

Posted 06 November 2013 - 04:36 AM

I created a peripheral. Please add Turtle ID 70 as Crop Manager turtle and give me permission to create a post about my mod here. My mod is here.

#57 M4sh3dP0t4t03

  • Members
  • 255 posts
  • LocationGermany

Posted 20 December 2013 - 05:53 PM

View PostGammaPaladin, on 25 September 2013 - 07:46 PM, said:

Snip snip
The array that you return isn't returned as a table in Lua, but instead as a list. So either you could do:
--Lua side fix
local gps = peripheral.wrap("right")
local x, y, z = gps.locate()
Or Java side:
@Override
        public Object[] callMethod(IComputerAccess computer, int method,
                        Object[] arguments) throws Exception
        {
                if (computer == data.controller)
                {
                        switch (method)
                        {
                                case 0:
                                        return new Object[] {getPos()};

                        }
                }
                return null;
        }


#58 _CR_

  • Members
  • 39 posts
  • LocationMestre, Italy

Posted 15 April 2014 - 08:40 PM

Hi, I just registered 'cause I've recently developed a mod that adds a turtle chunkloader and I wanted to post it here. I've seen I can't start a new topic, can you please give me the rights to do so?
I also wanted to ask before releasing the mod: I have to follow some logic in choosing the turtle upgrade ID other then looking on the wiki if it's already used? thanks :)

#59 Cranium

    Ninja Scripter

  • Moderators
  • 4,031 posts
  • LocationLincoln, Nebraska

Posted 15 April 2014 - 08:52 PM

You actually should be able to create a topic as a New Member.
Take a look at the forum guidelines in the announcements, and it explains the restrictions on new members.

#60 Lyqyd

    Lua Liquidator

  • Moderators
  • 8,465 posts

Posted 15 April 2014 - 09:13 PM

The Peripherals section may not have the topic creation permissions for new members because it's a relatively rare situation, so I probably didn't think of it when changing around the new members restrictions last time. I'll adjust them later this evening.

As for the upgrade ID, be sure to reserve your number in the wiki when you publish the mod. If you don't already have edit permissions, you could post in the sticky post in the wiki discussion section.





1 user(s) are reading this topic

0 members, 1 guests, 0 anonymous users