Jump to content




[CC 1.4.8][MC 1.4.6]Turtle Item Analyzer

turtle peripheral

47 replies to this topic

#1 someone9999

  • New Members
  • 19 posts

Posted 10 November 2012 - 03:56 PM

This mod for computer craft contains an item analyzer for computer craft which allows Items to be analyzed by a turtle. The turtle is able to read the name, id, metadata (damage), and count of any item in the turtle's inventory.

Works for multiplayer

Why this was made:
Spoiler

This mod adds an analytical turtle which can be used to determine the block id or metadata of any block or item in it's inventory

Crafting Recipes
Spoiler

Images
Spoiler

Methods that you can call using this turtle upgrade.
"analyzer" is the variable that the peripheral is wrapped to in these examples.

Note: The latest update makes it so most methods that can be called now return a string describing an error if it fails. This is configurable in the config options to return false only. This may break pre 2.2 programs. Sorry for the inconvenience.

--Note that anytime slot is sent as an argument, it's valid values are integer values
--starting from 1 to the inventory size.

analyzer.getBlockId()
--Returns the block Id of the currently selected block in the turtle's inventory.

analyzer.getBlockIdAt(slot)
analyzer.getBlockIdAtUp(slot)
analyzer.getBlockIdAtDown(slot)
--Returns the block Id of the slot sent as an argument in the adjacent inventory above, infront, or below the turtle.
--This counts as a "check" for fuel usage.

analyzer.getBlockName()
--Returns a string containing the localized block name in the currently selected slot in the turtle's inventory.
--Items named with the anvil will NOT return their custom name, this is a known bug.

analyzer.getBlockNameAt(slot)
analyzer.getBlockNameAtUp(slot)
analyzer.getBlockNameAtDown(slot)
--Returns a string containing the localized block name in the send argument in the adjacent inventory above, infront, or below the turtle.
--This counts as a "check" for fuel usage.
--Items named with the anvil will NOT return their custom name, this is a known bug.

analyzer.getBlockMetadata()
--Returns the metadata of the currently selected block in the turtle's inventory, or the item damage if the selected block is an item.

analyzer.getBlockMetadataAt(slot)
analyzer.getBlockMetadataAtUp(slot)
analyzer.getBlockMetadataAtDown(slot)
--Returns the metadata of the selected slot in the adjacent inventory above, infront, or below the turtle.
--This counts as a "check" for fuel usage.

analyzer.getBlockCount()
--Returns the number of blocks or items in the currently selected slot in the turtles inventory.

analyzer.getBlockCountAt()
analyzer.getBlockCountAtUp()
analyzer.getBlockCountAtDown()
--Returns the number of blocks or items in the selected slot in the adjacent inventory above, infront, or below the turtle.
--This counts as a "check" for fuel usage.


analyzer.placeAt(slot)
analyzer.placeAtUp(slot)
analyzer.placeAtDown(slot)
--Places the selected item in the turtle's inventory into the selected slot in the container infront, above, or below the turtle.
--This counts as an "action" for fuel usage.

analyzer.takeAt(slot)
analyzer.takeAtUp(slot)
analyzer.takeAtDown(slot)
--Takes the selected item in the container infront, above, or below the turtle into the selected slot in the turtle
--This counts as an "action" for fuel usage.

analyzer.getCheckUsesLeft()
--Returns the number of checks the turtle can do until more fuel is required.

analyzer.getActionUsesLeft()
--Returns the number of actions the turtle can do until more fuel is required.


Example Code:
Spoiler

Download:

2.3 (MC 1.4.6) (CC 1.4.8) Universal
2.2 (MC 1.4.6) (CC 1.4.8) Universal (Warning: takeAt() and placeAt() have serious bugs in this version)
2.1 (MC 1.4.4) (CC 1.4.7) Universal
2.0 (MC 1.4.2) (CC 1.4.6) Universal
1.0 (MC 1.4.2) (CC 1.4.6) Universal


Change Log:
Spoiler


#2 cant_delete_account

  • Members
  • 484 posts

Posted 10 November 2012 - 07:34 PM

Totally wrong thread, oops.

#3 Shnupbups

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

Posted 10 November 2012 - 08:39 PM

Added analytic turtle to official list of turtle upgrade ids on the wiki.

#4 someone9999

  • New Members
  • 19 posts

Posted 10 November 2012 - 08:51 PM

View Postthesbros, on 10 November 2012 - 07:34 PM, said:

With forestry installed I'm getting an error, it's like:
faubiguy.xpupgrade.XPUpgradeItem cannot be cast to forestry.core.items.ItemCrated
...

You have an item ID conflict with the XP upgrade mod and the forestry mod (the crated netherwart item and the XP Upgrade item). Try changing the XP Upgrade Item Id in the config file "XPUpgrade" under /%appdata%/.minecraft/config/

That should fix your problem.

View PostShnupbups100, on 10 November 2012 - 08:39 PM, said:

Added analytic turtle to official list of turtle upgrade ids on the wiki.

Thank you.


Edit:

Version 2.0 of Computer Craft Analyzer released.

Changes include:
  • Added ability to configure which methods are allowed to be called in config.
  • Added the ability to find out information about blocks in adjacent inventories to turtles. (Analyzer Upgrade).
  • Added the ability to place and take items out of specific slots in adjacent inventories to turtles. (Analyzer Upgrade).
  • Changed getBlockCount to return 0 instead of -1 if there is no block at the selected slot. (Analyzer Upgrade).


#5 Marval

  • Members
  • 47 posts

Posted 11 November 2012 - 11:19 PM

Would it be possible to make this for MC 1.2.5? I'm sure that many peopole still playing on 1.2.5 because of some mods that still didn't upgrade to 1.4.2 (f.e. RedPower). And your mod is owesome. I already have a lot of applications for this.

#6 someone9999

  • New Members
  • 19 posts

Posted 12 November 2012 - 01:40 PM

View PostMarval, on 11 November 2012 - 11:19 PM, said:

Would it be possible to make this for MC 1.2.5? I'm sure that many peopole still playing on 1.2.5 because of some mods that still didn't upgrade to 1.4.2 (f.e. RedPower). And your mod is owesome. I already have a lot of applications for this.

No, sorry. The changes between 1.2.5 and 1.4.2 are huge, and this would require a large amount of work due the client side and server side code being split up, and the inability to use many forge API's that my mod currently requires to function. This is also the same reason that many mods have been taking so long to update is because of these massive changes.

I miss Red Power 2 as well in the latest minecraft, but It would be too much work to add backwards compatibility to the Item Analyzer to allow for compatibility with minecraft 1.2.5.


Unreleated Edit:

Computer Craft Analyzer ported to minecraft 1.4.4

#7 cant_delete_account

  • Members
  • 484 posts

Posted 17 November 2012 - 04:24 PM

I was gonna post that error on the XP Turtle thread, oops.

#8 Mitchfizz05

  • Members
  • 125 posts
  • LocationAdelaide, Australia

Posted 24 November 2012 - 02:40 AM

I have a suggestion for the RFID card writers.
Can you make a method like 'whatever.closeLid()' or 'whatever.lock(true/false)' so you can close the glass block thing through code?
I have made a simple program that is simply for writing data to RFID cards, but after it checks if the card in in the reader, and before it writes data, it is possible to just take the card out, and then cause problems.

#9 Orwell

    Self-Destructive

  • Members
  • 1,091 posts

Posted 24 November 2012 - 05:31 AM

View Postmitchfizz05, on 24 November 2012 - 02:40 AM, said:

I have a suggestion for the RFID card writers.
Can you make a method like 'whatever.closeLid()' or 'whatever.lock(true/false)' so you can close the glass block thing through code?
I have made a simple program that is simply for writing data to RFID cards, but after it checks if the card in in the reader, and before it writes data, it is possible to just take the card out, and then cause problems.
Are you sure this is the right thread?

#10 aaakk

  • Members
  • 58 posts

Posted 24 November 2012 - 06:38 AM

please add a getBlockIdFoward() to give us the id of the block in front of the turtle

#11 someone9999

  • New Members
  • 19 posts

Posted 24 November 2012 - 08:35 PM

View PostViproz, on 24 November 2012 - 06:38 AM, said:

please add a getBlockIdFoward() to give us the id of the block in front of the turtle

Hmm... I like it.

Ill likely include this in the next release, although it will probably cost fuel or something. (dont worry, config option)

Thanks for the suggestion.

#12 immibis

    Lua God

  • Members
  • 1,033 posts
  • LocationWellington, New Zealand

Posted 24 November 2012 - 10:17 PM

View Postmitchfizz05, on 24 November 2012 - 02:40 AM, said:

I have a suggestion for the RFID card writers.
Can you make a method like 'whatever.closeLid()' or 'whatever.lock(true/false)' so you can close the glass block thing through code?
I have made a simple program that is simply for writing data to RFID cards, but after it checks if the card in in the reader, and before it writes data, it is possible to just take the card out, and then cause problems.
This is the wrong thread, but you can check whether encode returns an error message - it returns true on success, or an error message on failure.

#13 Nietsnie

  • Members
  • 14 posts

Posted 26 November 2012 - 09:05 AM

Thanks for the great mod! It was super useful in my automated bee farm.

#14 huldu

  • Members
  • 9 posts

Posted 11 December 2012 - 10:56 AM

How come this isn't popular? It's probably one of the best things for the turtle to have, just a shame it takes up a slot... But still how come the turtle by default can't identify what item it got in a slot? It can do pretty much anything but not that... item compare, seriously?

Anyways great job on making this. I had no idea it even existed until I by accident found it on a forum linking here.

#15 Tiin57

    Java Lunatic

  • Members
  • 1,412 posts
  • LocationIndiana, United States

Posted 11 December 2012 - 12:46 PM

View Posthuldu, on 11 December 2012 - 10:56 AM, said:

How come this isn't popular?
This community seems to dislike over-powered mods. :P
Except mine. Mine was awesome. (Don't bother looking for it. An admin removed it for ruining the forums with its beauty. :D)

#16 Nietsnie

  • Members
  • 14 posts

Posted 12 December 2012 - 08:00 AM

Hmm, I'm not sure I'd call it overpowered. I guess it depends on what your definition of a turtle is. I tend to think of them as automated replacements for a player. A player can easily look in a container, determine what is there, and move things from specific slots.

I think this mod nicely extends turtles with some missing functionality. It's not like you click a button and get diamonds or something :)

#17 immibis

    Lua God

  • Members
  • 1,033 posts
  • LocationWellington, New Zealand

Posted 12 December 2012 - 12:40 PM

View PostNietsnie, on 12 December 2012 - 08:00 AM, said:

Hmm, I'm not sure I'd call it overpowered. I guess it depends on what your definition of a turtle is. I tend to think of them as automated replacements for a player. A player can easily look in a container, determine what is there, and move things from specific slots.

I think this mod nicely extends turtles with some missing functionality. It's not like you click a button and get diamonds or something :)/>

I think the main reason this hasn't been implemented in CC is that it would have to expose item IDs to the player. ASTU has database turtles, which can identify items without using IDs (you have to set your own IDs that the turtle uses) and would fit in CC.

#18 PixelToast

  • Signature Abuser
  • 2,265 posts
  • Location3232235883

Posted 12 December 2012 - 04:30 PM

items can have negative damage values, so getmetadata might return -1 for something that exist

#19 etopsirhc

  • Members
  • 122 posts

Posted 17 December 2012 - 09:43 PM

like the idea just not the implementation , i'd prefer it to return a unique item hash, that way you cant just tell a turtle to mine untill it fills its inventory with 264 XP

#20 Nietsnie

  • Members
  • 14 posts

Posted 18 December 2012 - 03:34 PM

Any ideas why, with the latest version of forestry, using the analyzer.takeAt() functionality somehow screws up the bee data? They get revered to a white drone, and when analyzed, turn into a forest drone. This has only started in Forestry 1.6.2.9 or so.





1 user(s) are reading this topic

0 members, 1 guests, 0 anonymous users