Register here: http://gg.gg/owd50
Nov 12th, 2020 (edited)
*Inventory Slot Id Minecraft
*Inventory Slot Id Minecraft 1.8
*Inventory Slot Id Minecraft Servers Never Not a member of Pastebin yet?Sign Up, it unlocks many cool features!
*Provides useful utility functions.]]
*-- selectItem() selects the inventory
*-- true if found and false if not
*-- check all inventory slots
*for slot =1,16do
*if item ~=niland item[’name’] name then
*returntrue
*end
*returnfalse-- couldn’t find item
*-- selectEmptySlot() selects inventory
*-- found, false if no empty spaces
*for slot =1,16do
* turtle.select(slot)
*end
*returnfalse-- couldn’t find empty space
*-- number of a given minecraft id item in the inventory
*local total =0
*for slot =1,16do
*if item ~=niland item[’name’]’minecraft:’.. minecraft_id then
*end
*return total
*-- minecraft id and places a block from it under the turtle
*for slot =1,16do
*if item ~=niland item[’name’]’minecraft:’.. minecraft_id then
* turtle.placeDown()
*end
*end
*-- in front of the turtle
*if modules.count_inventory()> length * height then
*end
* turtle.up()
*local movingForward =true
*for currentHeight =1, height do
* select_and_place_down()-- Place the block
* turtle.forward()
*elseifnot movingForward and currentLength ~= length then
*end
*if currentHeight ~= height then
*end
*end
*-- done building wall; move to end position
*-- turtle is near the start position
* turtle.forward()
*else
* turtle.forward()
*for currentHeight =1, height do
*end
*returntrue
*-- and a ceiling
*if modules.count_inventory()<(((length -1)* height *2)+
*returnfalse-- not enough blocks
* build_wall(length -1, height)
* turtle.turnRight()
* build_wall(length -1, height)
* turtle.turnRight()
*returntrue
*-- and columns of an area in front and
*-- the provided sweepFunc at each space
*local turnRightNext =true
*for x =1, width do
* sweepFunc()
*-- don’t move forward on the last row
* turtle.forward()
*end
*if x ~= width then
*if turnRightNext then
* turtle.forward()
*else
* turtle.forward()
*end
* turnRightNext =not turnRightNext
*end
*if width %20then
*else
* turtle.back()
* turtle.turnLeft()
* turtle.turnRight()
*returntrue
*--for the named block next to the turtle
*local result, block
*for i =1,4do
*if block ~=niland block[’name’] name then
*end
*end
*end
*-- puke() puke everything that is in the turtles
*-- inventory out in front of it (hopefully there is
*function puke()
* turtle.select(i)
*end
*-- Check Fuel checks if the turtle has enough fuel.
*-- if not, it asks for fuel in slot 1 and refuels.
*local refueled =false
*if turtle.getFuelLevel()0then
*print(’Fuel is empty. Please put fuel in slot 1 and press a key.’)
* turtle.select(1)
*else
*end
Inventory slot ids. Discussion in ’Plugin Development’ started by Baummann, Jun 24, 2011. Thread Status: Not open for further replies. Offline Baummann. Im building a project with commands. How to add / testfor @a Inventory: Slot: 100b, id: minecraft: diamondboots if it has a specific tag, for example: Ski? You may obtain the IDs either by calling GetInventorySlotInfo, ContainerIDToInventoryID, or from the table below. Note that you should never use these values in AddOns, since they may change. Use GetInventorySlotInfo (invSlotName) to get the current mapping.Inventory Slot Id Minecraft RAW Paste Data Inventory Slot Id Minecraft 1.8
Inventory size on the minecraft:inventory component has to be increased to match the equippable slots in order for the server to accept the item placement The tooltip for item with item lock component will no longer show when game rule ‘showtags’ is disabled.Inventory Slot Id Minecraft Servers--[[Function Module program by Al Sweigart Provides useful utility functions.]] -- selectItem() selects the inventory -- slot with the named item, returns -- true if found and false if not function select_item(name) -- check all inventory slots local item for slot = 1, 16 do item = turtle.getItemDetail(slot) if item ~= nil and item[’name’] name then turtle.select(slot) return true end end return false -- couldn’t find item end -- selectEmptySlot() selects inventory -- slot that is empty, returns true if -- found, false if no empty spaces function select_emptySlot() -- loop through all slots for slot = 1, 16 do if turtle.getItemCount(slot) 0 then turtle.select(slot) return true end end return false -- couldn’t find empty space end -- countInventory() returns the total -- number of a given minecraft id item in the inventory function count_inventory(minecraft_id, times) local total = 0 for slot = 1, 16 do item = turtle.getItemDetail(slot) if item ~= nil and item[’name’] ’minecraft:’ .. minecraft_id then total = total + turtle.getItemCount(slot) end end return total end -- selectAndPlaceDown() selects a slot with given -- minecraft id and places a block from it under the turtle function select_and_place_down(minecraft_id) for slot = 1, 16 do item = turtle.getItemDetail(slot) if item ~= nil and item[’name’] ’minecraft:’ .. minecraft_id then turtle.select(slot) turtle.placeDown() return end end end -- build_wall() creates a wall stretching -- in front of the turtle function build_wall(length, height) if modules.count_inventory() > length * height then return false --not enough block end turtle.up() local movingForward = true for currentHeight = 1, height do for currentLength = 1, length do select_and_place_down() -- Place the block if movingForward and currentLength ~= length then turtle.forward() elseif not movingForward and currentLength ~= length then turtle.back() end end if currentHeight ~= height then turtle.up() end movingForward = not movingForward end -- done building wall; move to end position if movingForward then -- turtle is near the start position for currentLength = 1, length do turtle.forward() end else -- turtle is near the end position turtle.forward() end -- move down to the ground for currentHeight = 1, height do turtle.down() end return true end -- build_room() constructs four walls -- and a ceiling function build_room(length, width, height) if modules.count_inventory() < (((length -1) * height * 2) + ((width -1) * height * 2)) then return false -- not enough blocks end -- build the four walls build_wall(length -1, height) turtle.turnRight() build_wall(width - 1, height) turtle.turnRight() build_wall(length - 1, height) turtle.turnRight() build_wall(width - 1, height) turtle.turnRight() return true end -- sweepField() moves acress the rows -- and columns of an area in front and -- to the right of the turtle, calling -- the provided sweepFunc at each space function sweepField(length, width, sweepFunc) local turnRightNext = true for x = 1, width do for y = 1, length do sweepFunc() -- don’t move forward on the last row if y ~= width then turtle.forward() end end -- don’t turn on the last column if x ~= width then -- turn to the next column if turnRightNext then turtle.turnRight() turtle.forward() turtle.turnRight() else turtle.turnLeft() turtle.forward() turtle.turnLeft() end turnRightNext = not turnRightNext end end -- move back to the start position if width % 2 0 then turtle.turnRight() else for y = 1, length -1 do turtle.back() end turtle.turnLeft() end turtle.turnRight() return true end --findBlock() spins around searching --for the named block next to the turtle function findBlock(name) local result, block for i = 1, 4 do result, block = turtle.inspect() if block ~= nil and block[’name’] name then return true end turtle.turnRight() end return false end -- puke() puke everything that is in the turtles -- inventory out in front of it (hopefully there is -- a chest function puke() for i = 1, 16 do turtle.select(i) turtle.drop() end end -- Check Fuel checks if the turtle has enough fuel. -- if not, it asks for fuel in slot 1 and refuels. function check_fuel() local refueled = false while not refueld do if turtle.getFuelLevel() 0 then print(’Fuel is empty. Please put fuel in slot 1 and press a key.’) read() turtle.select(1) turtle.refuel() else refueled = true end end
Register here: http://gg.gg/owd50

https://diarynote-jp.indered.space

コメント

最新の日記 一覧

<<  2025年7月  >>
293012345
6789101112
13141516171819
20212223242526
272829303112

お気に入り日記の更新

テーマ別日記一覧

まだテーマがありません

この日記について

日記内を検索