←  Command Programs

ComputerCraft | Programmable Computers for Minecraft

»

[MC1.8+] Banner Editor

Bomb Bloke's Photo Bomb Bloke 05 Apr 2016

pastebin get YxLzGY53 banedit

As so often happens, I set out to do one thing, got sidetracked, and did something else... in this case I was going to add NBT reading/writing support to WorldPorter, but made this instead.

Banners are a Minecraft 1.8 thing. You craft them together with various bits and bobs to put patterns on them. This script lets you set those patterns directly, using a Command Computer. Should be fairly simple to use; you plonk a chest on top of the computer, fill it with banners, create your masterpiece with the script and then "export" it to the banners in the chest.


Worth noting that this is hardly the first banner editor out there - eg Planet Minecraft has a web-based one - but what the heck. It does open up an easy avenue for allowing non-server OPs to fully customise their banners (they can usually only define up to six layers). With any luck it might lead to some more colourful servers?

Version History

Edited by Bomb Bloke, 28 March 2018 - 09:50 AM.
Quote

Selim's Photo Selim 05 Apr 2016

That is actually really cool.
Quote

LDDestroier's Photo LDDestroier 22 Apr 2016

Does this use the NFP format for exporting?
Edited by LDDestroier, 22 April 2016 - 03:28 AM.
Quote

Bomb Bloke's Photo Bomb Bloke 22 Apr 2016

No, it doesn't write files at all.
Quote

LDDestroier's Photo LDDestroier 22 Apr 2016

View PostBomb Bloke, on 22 April 2016 - 02:59 AM, said:

No, it doesn't write files at all.

I mean importing! Does it import NFP files to be put onto banners?
Quote

Bomb Bloke's Photo Bomb Bloke 22 Apr 2016

No, that'd be a bit complex.

As the links above describe, Minecraft banners are made up of layers, each containing a pre-defined image. Those images are all built into the game (you don't get to change them, outside of resource packs or whatever), and so you can't just load any abstract image directly onto a banner.

One could theoretically build a script which tries to figure out the best combination of layers that most closely resembles a given image file, but there are a lot of possible layer combinations, and even so the "best match" is still unlikely to be a "good match". You'll tend to get better results manually arranging the layers into something that at least looks decent, even if it's not altogether accurate.
Quote

Luca_S's Photo Luca_S 24 Apr 2016

It would be cool if you could save the banners as a file.
Quote

Bomb Bloke's Photo Bomb Bloke 24 Apr 2016

What sort of file, and what would you do with it?
Quote

Lupus590's Photo Lupus590 24 Apr 2016

Share it across MC servers?
Quote

Bomb Bloke's Photo Bomb Bloke 25 Apr 2016

The main problem with saving files is that files need names, and this script is mostly useful for users who aren't OPs... meaning that they need to access the script through an external monitor, where filename entry is... cumbersome. But let's say I added some form of on-screen keyboard and rigged the script to save / load using an external disk drive... such users are still going to have to use the pastebin script or something to transfer the files.

So it seems to me that it'd be a whole lot easier to just take a screenshot of the banner in the editor, and copy the layout into another server from there, if ever need be.

On the other hand, if you're talking about saving to a more conventional image file of some sort, there are problems there too - for one thing the editor won't be able to load them, for another if you want to draw regular images you'd be better off using a regular image editor.
Quote

vico's Photo vico 31 May 2016

I wonder if is possible to add optional support for Et Futurum banners (exacly same structure, its a backport mod) for 1.7.10.

I think its just a matter to replace all "minecraft:banner" references to a variable and, upon verifying (presuming the user have the mod) if minecraft version is 1.7.10, use in the var "etfuturum:banner" (dont know the id exacly) instead.

I don't have enough time to see it now, if i was, i would try to convert myself.
Quote

Bomb Bloke's Photo Bomb Bloke 31 May 2016

There are two difficulties in taking this particular script back to MC 1.7.10.

One is the lack of MC 1.8's "blockdata" command, upon which I rely to read and write to the external chest's inventory. Without that, exporting banners becomes clunkier, and importing becomes pretty much impossible. If a peripheral mod existed that allowed reading (and ideally writing!) directly to a tile entity's NBT data it wouldn't be a problem, but as far as I'm aware, no such mod exists yet.

The above isn't such a big deal, but the other is that ComputerCraft 1.76's graphical capabilities are used for the preview pane (via BLittle), and CC 1.76 also requires MC 1.8. Ditching the new techniques would make it next to impossible to display a banner with any degree of accuracy on a regular ComputerCraft display.
Quote

Forgotten_Boy's Photo Forgotten_Boy 24 Sep 2016

Can't seem to get this to work :( The import/export functions won't work for me - they do nothing when clicked. I've arranged the chest with banners as you demonstrate in the video. Using Minecraft 1.8.9 in Creative mode. Another Command computer I have to set the time works so presumably it's not permissions.

Where should I look?
Quote

Bomb Bloke's Photo Bomb Bloke 24 Sep 2016

If you turtle.inspect() your chest, is it a "minecraft:chest", or has a mod overridden it?
Quote

Forgotten_Boy's Photo Forgotten_Boy 24 Sep 2016

The only mod I have installed is ComputerCraft, but it's the ComputerCraftEDU version (file: ComputerCraftPlusComputerCraftEdu1.79.jar).

I can check that chest, but it should be vanilla. Maybe it is my mod jar?
Quote

Bomb Bloke's Photo Bomb Bloke 25 Sep 2016

Nah, probably not a mod issue in that case.

But if it's not the type of chest, then I'll need some more info. If you run this line through the system's Lua console it should hopefully generate a debug.txt with some clues:

_, input = commands.blockdata("~ ~1 ~ {}") out = fs.open("debug.txt", "w") out.writeLine(input) out.close()
Quote

Forgotten_Boy's Photo Forgotten_Boy 25 Sep 2016

The debug.txt contents:

{1.0=The data tag did not change: {x:-401,y:69,z:280,Items:[0:{Slot:0b,id:"minecraft:banner",Count:1b,tag:{BlockEntityTag:{Patterns:[0:{Pattern:"flo",Color:0}],Base:15}},Damage:15s},1:{Slot:1b,id:"minecraft:banner",Count:1b,tag:{BlockEntityTag:{Base:10}},Damage:10s}],id:"Chest",Lock:""}}

This was after attempting an "Export" into a chest with a single white banner in its first slot.

Other data:
- per your previous request about the chest, if I go to the lua prompt and type "turtle" it prints "nil". Command Computers are not turtles?
- your WorldPorter program works great so it's specific to this situation.
Edited by Forgotten_Boy, 25 September 2016 - 06:12 PM.
Quote

Bomb Bloke's Photo Bomb Bloke 26 Sep 2016

View PostForgotten_Boy, on 25 September 2016 - 06:11 PM, said:

The debug.txt contents:
...
This was after attempting an "Export" into a chest with a single white banner in its first slot.

Odd, that string indicates there were two banners in the chest at the time you ran the command. In any case no problems are revealed there.

View PostForgotten_Boy, on 25 September 2016 - 06:11 PM, said:

per your previous request about the chest, if I go to the lua prompt and type "turtle" it prints "nil". Command Computers are not turtles?

Well it's a good thing I wrote this, then, isn't it? :lol:

Or you could, I dunno, maybe just place a turtle in front of a chest? Whatever you find easier. ;)
Quote

Forgotten_Boy's Photo Forgotten_Boy 26 Sep 2016

I've tried a variety of banner combos in the chest; it could be I didn't save the debug.txt for the right attempt.

What should I try next?
Quote

Bomb Bloke's Photo Bomb Bloke 26 Sep 2016

Here's a version which'll write a rather more informative debug.txt.
Quote