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

[MC 1.7.10][CC 1.74] RandomPeripherals, read NBT data from every item and more

Started by redstoneduck, 22 October 2014 - 06:40 PM
redstoneduck #1
Posted 22 October 2014 - 08:40 PM
Random Peripherals


Random Peripherals is an CC addons mod, which adds some random peripherals like a hologram projector, an dispenser Turtle or a computer controlled interface for items, fluids, energy and peripherals to the game(Thats almost everything what the mod adds).

I'm trying to update as quickly as I can, when major bugs apear or CC updates, but I can't warrant for anything

Download links, the license and the wiki

Images(yes, I finally know how I can add spoilers!)
SpoilerThe Universal Interface

The hologram projector
Edited on 29 September 2015 - 07:57 PM
redstoneduck #2
Posted 11 December 2014 - 10:09 PM
The mod and I aren't dead. In the last 1-2 weeks I updated and improved the mod, so a new version of the mod will available soon with:
-All APIs will be updated, so when the new update will be released in a few, make sure you are using the latest version of CofhCore and all other mods which require CoFHCore
-A new Turtle Upgrade, the Dispenser Turtle will be available, which acts just like a Vanilla Dispenser, so it can dispense all kinds of things that a dispenser can dispense. Because it uses the same code it can even dispense things from other mods.
-Signs as Peripheral, yes that is probably very useless but perhaps somebody can do something with it
-Internal improvements, now it's possible that peripherals can inherit method so e.g. I have to write a function for Getting the amount of Stored energy only once and all peripherals who handle energy have this method available
-All siding informations in function arguments will be relative to the computer/turtle align so instead of writing 0 for bottom you have to write "bottom" like in the standard computercraft functions.

I hope you are like the changes and new things, the update will be available in a few, and don't be so hard about my bad grammar and spelling I'm only a student and English isn't my first language
And please give feedback!
redstoneduck #3
Posted 26 December 2014 - 12:50 PM
Version 1.3 available!
Checkout https://github.com/RSDuck/RandomPeripherals/wiki for the Changelog, Downloads and the API
makromoo #4
Posted 28 December 2014 - 09:30 PM
Just the mod I was looking for, my late Christmas present! Huzzah! Thank you, sir! :)/>

In version 1.3 how would I go about retrieving the NBT data of an item?
redstoneduck #5
Posted 29 December 2014 - 01:37 PM
Probably you found already the solution, but if not simply craft an turtle and a pumpkin together(The turtle at the moment the turtle aren't available in the creative inventory or NEI so you have to craft them in creative mode). Put any item into the current selected slot and open the lua shell. Then wrap the peripheral and enter
peripheralVariable.getStackInSlot()
, this will return a table which will be serialized because you are in the lua shell so you can see which variables you need. And don't forget: All peripherals have two functions called
getMethods()
and
help("methodName")
, next time try these and the methods in lua shell where tables get serialized or look in the wiki: https://github.com/RSDuck/RandomPeripherals/wiki.

Oh and ideas are welcome
makromoo #6
Posted 29 December 2014 - 06:05 PM
Ooooooh noob me I forgot to wrap the pumpkin peripheral! :P/> Thanks for the tip I knew of the openperipherals way of finding methods but not the ComputerCraft way! :)/>
Edited on 30 December 2014 - 09:04 AM
redstoneduck #7
Posted 29 December 2014 - 10:53 PM
1.3b Released
Fixed Server Compatibility, now Random Peripherals should work on a Server

Oh and soon I will add an hologram projector
https://github.com/RSDuck/RandomPeripherals/wiki
makromoo #8
Posted 30 December 2014 - 08:35 AM
Thanks for fix! Anticipated the for projector! :D/>

Hopefully the inventory turtle gets a recipe soon then can use it on our server :P/>. I was thinking a pretty expensive recipe since reading NBT is quite a powerful tool.
Edited on 30 December 2014 - 05:11 PM
redstoneduck #9
Posted 31 January 2015 - 04:51 PM
For those who are waiting for the hologram projector(probably 0-2 persons) here is an picture:

(The computer is under the projector, you can see some things do not work correctly, like that the bounding box of the glass do not change when rotating)

These things are also already implemented:
  • An command which returns the unlocalized name, the metadata(damage), and the NBT-data of the items which you hold in your hand
  • Random Peripherals got finally an creative tab
These things will be implemented soon:
  • An 3D-Scanner to scan "real" world block structures which can be displayed with the hologram
If you have any suggestions, please write it below
Edited on 31 January 2015 - 04:02 PM
makromoo #10
Posted 25 March 2015 - 03:52 PM
Wow that is epic!
vargaszm #11
Posted 27 April 2015 - 05:59 PM
3 people waiting on the hologram projector now. How does it work? i should probably read earlier posts. awesome potential for stuff tho, especially the limited interface. Will it offer any touch events or similar?
BizzySleepin #12
Posted 10 May 2015 - 02:23 PM
Is this mod still active? I installed it but don't see the the dispenser turtle in game. Btw the projector looks awesome!
redstoneduck #13
Posted 18 May 2015 - 05:47 PM
Hi there,
surprised that theres such an interest in newer versions of random peripherals(Btw, I haven't planned to implement an input possibility to interact with the hologram, but it is an brillant idea!).


To clarify it, the mod development is currently paused, but once the summer holidays begins it will be continued!

I'm back and a new version of Random Peripherals will probably released next week, which will include the hologram projector and some other new feature.

Sorry for the long waiting time, but something will probably won't happen again. The problem was simply the result of trying to combine my hobby(programming) and a school project with any topic, it ends up with having no time for anything.
Edited on 19 July 2015 - 12:49 PM
redstoneduck #14
Posted 08 August 2015 - 12:09 AM
Random Peripherals Version 1.4 "Falco" is out!
After long waiting time the Version of Random Peripherals with the hologram projector, countless bug fixes and other stuff I'm to lazy to list them is there.

The wiki will be updated in the next days.


So here is a little program for the Hologram Projector, just place an Computer nearby one and start it. Just try it out, it makes use of the touchscreen feature of the hologram projector and demonstrates what the hologram projector can do:

p = peripheral.find("hologram_projector")
--Clear with air
p.clear("minecraft:air",0)
for x=0,7 do
  for z=0,7 do
	p.setBlock(x,0,z,"minecraft:grass")
  end
end
while true do
  local event,button,x,y,z,side,item =
	 os.pullEvent("hologramTouch")
  if item ~= nil and button == 1 then
	if side == "top" then
	  y = y + 1  
	elseif side == "bottom" then
	  y = y -1
	elseif side == "west" then
	  x = x -1
	elseif side == "east" then
	  x = x +1
	elseif side == "north" then
	  z = z - 1
	elseif side == "south" then
	  z = z + 1
	end
  
	p.setBlock(x,y,z,item.internalName)
  elseif button == 0 then
	p.setBlock(x,y,z,"minecraft:air")
  end
end

You can download it here:
https://github.com/R...herals/releases

Oh and don't forget it depends on CoFHCore so it needs to be installed to use Random Peripherals.

Before this question comes I answer to it:
Q: Why is the ComputerCraft computer correctly displayed in the previous screenshot and here not?
A: I switched to an alternative hacky rendering system that allows to display more block types as there would be displayed in the world(So I'm render the blocks as there would render in the world). Unfortunate the system don't works with Blocks that have to TileEnities which are so implemented that if there is no tile entity, no block will be rendered.

I hope you enjoy this new version of Random Peripherals!

Oh and before I forget about it, big thanks to everyone who waited that long for the update, every Person who gave me feedback and suggestions and ChickenBones, I took the code that a block can have multiple selection boxes from him(The code is licends under MIT License)

And the last thing backup your worlds, the mod is almost completely untested!

Please give feedback, thanks!

EDIT: added screenshot
EDIT 2: I updated the changelog, you can find it here: https://github.com/RSDuck/RandomPeripherals/wiki/Changelog
Edited on 07 August 2015 - 10:26 PM
Bomb Bloke #15
Posted 08 August 2015 - 02:08 PM
Oh, I got me some plans for this… B)/>

They're not terribly imaginative, but still, should be fun to mess with.

… any chance that the hologram can be made to rotate? Like, so you can have it slowly spinning in circles?
redstoneduck #16
Posted 08 August 2015 - 03:19 PM
Rotating the drawn blocks is easy and I can manage to implement that until the small bug fix update which comes soon.

But rotating the bounding box isn't possible (as far I know), so the touchscreen feature will only be available if the rotation is a number that is dividable through 90(or if it's 0)
Bomb Bloke #17
Posted 09 August 2015 - 02:37 PM
Here we go:

pastebin get rkgbqcUk holobuild

The above is a quick'n'dirty edit of WorldPorter, rigged to display a "scan" file generated by the original version via a hologram projector. Since it doesn't use any MineCraft commands it doesn't need a Command Computer.

Some pre-made scan files can be downloaded with:

pastebin run cUYTGbpb get SKDhmxC7

… but for the most part they're way too large for the projector to display. Still, the original version of the script can always be used to make more.

Spoiler

It'd be really nice to have a peripheral which was able to return the world-locations of other peripherals on the same network… or at least get their locations relative to each other. But still, even with an array of projectors, I don't see how a structure taller than eight blocks would be displayed…

I assume the bug you intend to fix is the crash I'm getting every time I click a block in the hologram? Here's the crash report, if you haven't run into it yourself.

Once that's figured out I should be able to go the other way - let the user build a hologram with eg your example script, then save that to a WorldPorter file that can actually be generated full-size within the world.

In regards to rotating, disabling the touch-screen ability whenever the angle didn't have a factor of 90 would be fine by me.
Edited on 10 February 2016 - 10:18 PM
redstoneduck #18
Posted 10 August 2015 - 07:50 PM
1.4b released!
This version fixes all known issues(including the crash when clicking with an empty hand the hologram) and adds the possiblity to rotate the hologram

Also I updated the wiki to the newest version

You can find the wiki and the downloads here: https://github.com/RSDuck/RandomPeripherals/wiki
Bomb Bloke #19
Posted 11 August 2015 - 12:26 PM
Well that rotation feature's really pretty cool. Exactly what I wanted - thank you! :)/>/>

But, I'm still having some stability issues, sorry. For some reason, continuous operation eventually causes the projectors to "stall": they still return true on setBlock/draw/clear calls, but they stop updating the hologram display.

It's still possible to change the metadata of the blocks that were set when the projectors froze, but they otherwise can't be visibly changed. Even shutting down Minecraft and restarting it doesn't resolve this, nor does destroying/replacing the projectors: instead, you have to stop attempting to update the holograms for a minute or so (while the game is still running), then they should eventually "snap to" to whatever state they're supposed to be in, and resume operation from there (until they freeze again, or the game crashes).

If it helps, you should be able to reproduce this issues by running this script for about a minute. The number of projectors connected, and whether they're using universal interfaces, doesn't seem to matter. When the projector freezes, try a projector.clear("minecraft:air",0) call on it: the blocks should go white (as the metadata updates correctly), then a minute or three later the blocks should disappear (as the projector decides to fix itself), then you can re-run the script and it should resume animating for another minute or so before freezing again.

I'm also having some trouble using the universal interface for remote peripheral wrapping, come to mention it: ui.wrapPeripheral() doesn't detect blocks next to the interface after a world reload (until they're broken / replaced).

It'd be nice to be able to call setBlock with an optional metadata parameter, and it'd likewise be nice to be able to connect wired modems to the base of the hologram projectors. I understand these tasks aren't as simple as they sound - as BIT had to do some tinkering to get these sort of features working with the peripherals in his mod - but I gather it can be done.

Edit:

I ran into another crash when disconnecting a bunch of wired modems from a bunch of universal interfaces (with projectors on top of them).

Speaking of using multiple projectors, the hologramTouch event doesn't include any information about the identity of the projector that triggered it.
Edited on 11 August 2015 - 01:11 PM
redstoneduck #20
Posted 30 August 2015 - 12:31 AM
1.4c released
This update includes bug fixes for pretty much every known bug(including the startup crash on servers, that Universal Interface don't recognise neightbor peripherals after world reload etc.)
Also hologram projectors do now include in touch events where the projector is located and there is a method(setBlockMeta) to set both the block and meta data for one block.

Get it here: https://github.com/RSDuck/RandomPeripherals/releases
Bomb Bloke #21
Posted 30 August 2015 - 07:46 AM
Excellent! The projectors are now updating reliably, the UIs are picking up their peripherals correctly, and I've got plans for that new event info. :)/>

And I see wired modems can now attach to projector bases, too! Mwuhahah!

There are a few new bugs, though: getBlock isn't returning anything, setVelocity only applies after the blocks in the hologram are altered in some other way (eg via clear), and setRotation doesn't apply until the chunk reloads (and best I can make out it doesn't entirely work correctly then, either, though getRotation always reports what it "should" do).

But good work, and thanks for updating! :)/>

Edit: ah, another thing: The projectors seem to break instantly if punched without a tool.
Edited on 30 August 2015 - 09:23 AM
Bomb Bloke #22
Posted 20 September 2015 - 01:03 AM
Seems that placing a projector simply deletes whatever block is above it - regardless as to whether it's dirt, diamond, bedrock, etc…

Edit: I made a slide puzzle out of them. :)/>
Edited on 26 September 2015 - 11:30 AM
gollark8 #23
Posted 27 September 2015 - 01:11 PM
I love the hologram projectors. With some work, they could be used to control construction turtles.
Wojbie #24
Posted 27 September 2015 - 01:26 PM
Seems that placing a projector simply deletes whatever block is above it - regardless as to whether it's dirt, diamond, bedrock, etc…

Edit: I made a slide puzzle out of them. :)/>

That gives me fun idea. Treat array of projectors like in your slide puzzle and create terminal object so that you could technically redirect contents of computer terminal onto hologram screen. Would need to builld font library of letters as shapes and use wool blocks for colors. I am correct in assuming that hologramTouch event tells you witch of hologram blocks was pressed? I think this is going onto my todo list :P/>
gollark8 #25
Posted 27 September 2015 - 02:09 PM
Seems that placing a projector simply deletes whatever block is above it - regardless as to whether it's dirt, diamond, bedrock, etc…

Edit: I made a slide puzzle out of them. :)/>/>/>

That gives me fun idea. Treat array of projectors like in your slide puzzle and create terminal object so that you could technically redirect contents of computer terminal onto hologram screen. Would need to builld font library of letters as shapes and use wool blocks for colors. I am correct in assuming that hologramTouch event tells you witch of hologram blocks was pressed? I think this is going onto my todo list :P/>/>/>

Stained glass doesn't render properly, and it comes up as a solid color. So while it may not last long, it's the best choice for this stuff right now.

I was considering that sort of redirect, but I was a bit busy hooking up Value Noise to a hologram projector.
In my opinion a term object with 3D capabilites (term.setLayer etc) would be cooler. Imagine a 3D file browser!
Edited on 27 September 2015 - 12:10 PM
Wojbie #26
Posted 27 September 2015 - 02:36 PM
In my opinion a term object with 3D capabilites (term.setLayer etc) would be cooler. Imagine a 3D file browser!

Thanks for the tip with glass. Will see,
As for layers? You want to make something avesome :P/> I just want to play worm on hologram :D/>

Edit: Now i am thinking about it.. 3D Worm.
Edited on 27 September 2015 - 12:37 PM
Bomb Bloke #27
Posted 27 September 2015 - 05:04 PM
Putting the background on one layer and the text just above it would be sufficient to make most any script look pretty cool.

The way stained glass renders seems to depend on the angle of your camera… or something. If one visible block becomes opaque, then all do. Most angles result in opaque glass, which is quite handy. The result is a brightly coloured and untextured block.

There's also stained clay, which is darker compared to wool. Heck, you could use the three different shades provided by the three different blocks to provide a shade control to a "display".

Each projector indeed includes its identity in the events they generate (assuming you're on at least RandomPeripherals 1.4c), so it's easy to precisely pinpoint where a click was performed so long as you know where the projectors are. My slide puzzle script has a "calibration" process for gathering positional information (saving a config file when it's done), which I'd been considering splitting into a separate script so that it could be easily used for other multi-projector purposes. I suggest trying that out and using the generated config file for your own purposes - should save some time. Note that hologram rotating is busted in the latest RandomPeripherals build, so you currently need to implement it within your own code instead.

As far as fonts go, the easy method would be to just convert one of the font files MineCraft uses (these being square image files with the 256 characters arranged in a 16x16 pattern), to something that a script can load. You then take the pixel map for each character and store it in a 6x8 array (or apply the relevant maths if the font file is from a high-res texture pack), and hey presto - an array of 39x19 projectors would be able to simulate a 51x19 display. Cursor blinking is the only tricky(ish) part - well, that, and the screen being over two chunks wide. You'd need about four and a half thousand redstone dust to build it legitimately.

You could also load the glyphs at their actual resolution, that being 8x8, which'd make it possible to render the whole code-sheet without cropping any characters (the fact that you can't do this if you load at 6x8 is why we get question marks on regular ComputerCraft terminals). Your display would end up even wider, though…

Once upon a time I drew a low-res font file:



That one offers 4x6 characters, which'd only require a 26x15 array of projectors (about halving the cost to build, and making it somewhat easier to use, to).

The one other hurdle that comes up is that I've found the projector's setBlockMeta() function seems to take a fraction of a second between setting the block ID, and its meta data. If you watched my video you probably noticed how some of the blocks turned white while the slide puzzle panels slid around. I'm fairly certain draw() is immune to this problem, though.

But yeah, a projected terminal would work very well with the MoarPeripherals Keyboard.
Edited on 10 February 2016 - 10:19 PM
Konlab #28
Posted 27 September 2015 - 05:04 PM
Can I project a Hologram Projector projecting an other projector?
Bomb Bloke #29
Posted 27 September 2015 - 05:10 PM
Nah, you can only set the metadata of the blocks projected, not the NBT data that'd be required to make the projected blocks project.

Assuming you can project projectors at all. I found I couldn't project Command Computers, for some reason.

If it counts, at one point I took a screenshot of a projected image, and then projected that. :P/>
Konlab #30
Posted 27 September 2015 - 05:16 PM
Nah, you can only set the metadata of the blocks projected, not the NBT data that'd be required to make the projected blocks project.

Assuming you can project projectors at all. I found I couldn't project Command Computers, for some reason.

If it counts, at one point I took a screenshot of a projected image, and then projected that. :P/>/>
Maybe you can't project TileEntities…
Konlab #31
Posted 27 September 2015 - 05:22 PM
Bomb Bloke said:
-Very long post-
Imagine playing Miniaturecraft in holo-projectors
negamartin #32
Posted 03 October 2015 - 03:07 PM
Wow. Projectors are really awesome.
Maybe to project stuff taller than 8 blocks you could stack projectors?
A stack of projectors would project on the top, but the height limit is increased by 8 by every projector in the stack?
Just a suggestion.
Awesome mod :)/>
redstoneduck #33
Posted 19 November 2015 - 09:20 PM
Update time!

1.4d released
It's just an bugfix update so don't hope for something big(sorry)
The only "feature" is that transparent blocks render now actually transparent when they are projected by a hologram projector

Get it here: https://github.com/RSDuck/RandomPeripherals/releases
Bomb Bloke #34
Posted 28 November 2015 - 12:35 AM
Thanks for the update. That does seem to fix everything I'd listed. :)/>

…. but I'm afraid the hologram transparency fix brings a new bug; now blocks which should be rendered as opaque are see-through, unless viewed on obscure angles (where previously, transparent blocks would render as opaque unless viewed on obscure angles).
redstoneduck #35
Posted 28 November 2015 - 05:11 PM
I tried most situations with transparency and everything seems to work correctly. The only problem I found was when one hologram projector is viewied through another. This isn't the fault of Random Peripherals, this comes from the deepest levels of the minecraft rendering engine(http://www.opengl-tu...0-transparency/, Minecraft doesn't sorts it's transparent triangles).
Edited on 28 November 2015 - 04:12 PM
Bomb Bloke #36
Posted 28 November 2015 - 10:58 PM
I'm able to reproduce with a single projector. Here's one after running projector.clear("minecraft:dirt", 0).
Edited on 10 February 2016 - 10:20 PM
redstoneduck #37
Posted 30 November 2015 - 09:13 PM
I tried it by my self and everything works as it should.
Could you describe your setup a little bit better? How many hologram projectors are running beside this one? Does this happen with every hologram projector or only with this one? What kind of GPU are you using?
Edited on 30 November 2015 - 08:13 PM
Bomb Bloke #38
Posted 01 December 2015 - 01:08 AM
How many hologram projectors are running beside this one?

Well, in the world where I took that screenshot, somewhere around two and a half thousand projectors have images over them within the nearby loaded chunks.

I stripped things down to just ComputerCraft 1.74 / CoFHCore 3.0.3-303 / RandomPeripherals 1.4d, created a new world, placed a single projector and "dirt cleared" it. Same deal; from some angles it appears correctly, from some angles it does not. The proximity of other blocks to the projector also doesn't seem to matter.

Does this happen with every hologram projector or only with this one?

Exactly which projectors are affected at any given moment depends on the angle of my character's view relative to the world. I'm able to reproduce with any projector, though some projectors seem more prone to failure than others (changing each time I relaunch the game). It's possible to get all to appear correctly, some to appear correctly, or none to appear correctly. Aiming the camera lower usually seems to affect more projectors. I sometimes found that immediately after loading a world I was not able to reproduce for anywhere up to about ten seconds.

What kind of GPU are you using?

My laptop has two, an Intel HD Graphics 4600 and a NVIDIA GeForce GT 740M. Switching between these makes no apparent difference other than to my frame rate.

Edit:

It took me a while to cotton on, but this bug is affecting blocks which are supposed to be transparent, too: They turn much brighter when affected.
Edited on 01 December 2015 - 12:51 AM
redstoneduck #39
Posted 02 December 2015 - 06:59 PM
Ok, I don't have a plan how to fix this.
I'm going to release a version which includes the option to turn off the transparency in the config(or maybe I let it turned off by default)

Oh and reader of this post, please try the new version of random peripherals and report if everything works or not and your GPU(thats the only clue I have at the moment, because I have an AMD GPU this could be the problem)
Bomb Bloke #40
Posted 02 December 2015 - 10:11 PM
Indeed, some more testers in here would be very helpful.
FHSgames99 #41
Posted 25 December 2015 - 02:31 PM
THIS ADDONS IS AMAZING good work
redstoneduck #42
Posted 05 January 2016 - 03:13 PM
I released a beta build featuring the clicky turtle(currently only right clicking supported) and turning off multipass transparency

It's beta so if your items are gone or something like that it's normal, please try to reproduce the error and write it here or make an issue on github

Get it here: https://github.com/RSDuck/RandomPeripherals/releases
ajloveslily14 #43
Posted 09 July 2016 - 09:51 PM
Question: how come the hologram projector is an 8x8 with 2x2 pixel block size instead of 16x16 with 1x1 pixel size.
redstoneduck #44
Posted 12 July 2016 - 05:37 PM
There isn't a specific reason behind this, probably it looked the best(changing this wouldn't be to hard, maybe thats going to be a new feature) ;)/>

At the moment I'm waiting ComputerCraft to update 1.10, then I'm going to update the mod further(except for bug fixes of course)

EDIT: not I looked the best
Edited on 21 July 2016 - 01:59 PM