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

Xp turtle?

Started by jakemg, 08 April 2013 - 07:12 AM
jakemg #1
Posted 08 April 2013 - 09:12 AM
Hi I usually make mining turtle programs but i have a good mob spawner on my world and I would like to create a turtle that could just attack (i know how to do that part) but I also would like it to turn around and go to an enchantment table and enchant(thats the part where I have no clue) I dont know how to get enchantment levels or enchant from a turtle. any ideas?
theoriginalbit #2
Posted 08 April 2013 - 09:17 AM
it is not possible without peripherals installed. I believe it is MiscPeripherals that adds the XP turtle, and you craft the table with the turtle to get it.
SuicidalSTDz #3
Posted 08 April 2013 - 09:40 AM
it is not possible without peripherals installed. I believe it is MiscPeripherals that adds the XP turtle, and you craft the table with the turtle to get it.
Yes, MiscPeripherals adds the XP turtle in which you can autoCollect xp, enchant items, print the amount of levels, print the amount of xp orbs, and all that good stuff.
jakemg #4
Posted 08 April 2013 - 09:50 AM
I am on ftb so i think its installed
theoriginalbit #5
Posted 08 April 2013 - 10:00 AM
In that case here are all the functions you have access to with the XP turtles (taken directly from the MiscPeripherals thread), you are required to wrap the enchantment table with peripheral.wrap and call the function on the wrapped object.

XP Upgrade
Craft a Turtle alongside an Enchantment Table to get a XP Turtle. It is able to store XP and enchant items using the stored levels.
Exposes the following functions:
  • add(amount): Adds XP from XP bottles or monster eggs, using amount (optional, defaults to as much as possible) of the item in the current slot. Returns the amount of XP added.
  • get(): Returns the total amount of XP on the turtle.
  • getLevels(): Returns the amount of XP levels on the turtle.
  • collect(): Collects XP from XP orbs on the ground in a 2 block radius around the turtle. Returns the amount of XP collected.
  • setAutoCollect(autoCollect): If autoCollect is true, allow the turtle to automatically collect XP periodically.
  • enchant(levels): Enchants the item in the current slot using the specified levels. Returns true if successful, false if not.
  • get/getUp/getDown(): Gets XP from the following XP sources:
    • Other XP turtles
    • Furnaces, IC2 Iron Furnaces and Induction Furnaces, Thermal Expansion Powered Furnaces (sucking the item in the output slot(s))
    • Thaumcraft Brain in a Jar
    Returns the amount of XP obtained.
QuantumGrav #6
Posted 08 April 2013 - 05:31 PM
There are also a few topics very similar to this in other threads, so if you want some inspiration or guidance on how to go about doing this, the forum's search bar and google are your friends! I once built this kind of system in my FTB world (now lost to a hard drive crash), and it's really fun seeing something you've programmed work exactly how you wanted it to! Keep learning and trying and you'll get it!