Jump to content




[MC1.8+] Banner Editor

command

26 replies to this topic

#1 Bomb Bloke

    Hobbyist Coder

  • Moderators
  • 7,099 posts
  • LocationTasmania (AU)

Posted 05 April 2016 - 02:29 AM

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.


#2 Selim

  • Members
  • 189 posts
  • LocationHiding in Online Storage

Posted 05 April 2016 - 12:58 PM

That is actually really cool.

#3 LDDestroier

  • Members
  • 1,095 posts
  • LocationACDC Town

Posted 22 April 2016 - 12:45 AM

Does this use the NFP format for exporting?

Edited by LDDestroier, 22 April 2016 - 03:28 AM.


#4 Bomb Bloke

    Hobbyist Coder

  • Moderators
  • 7,099 posts
  • LocationTasmania (AU)

Posted 22 April 2016 - 02:59 AM

No, it doesn't write files at all.

#5 LDDestroier

  • Members
  • 1,095 posts
  • LocationACDC Town

Posted 22 April 2016 - 03:28 AM

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?

#6 Bomb Bloke

    Hobbyist Coder

  • Moderators
  • 7,099 posts
  • LocationTasmania (AU)

Posted 22 April 2016 - 04:10 AM

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.

#7 Luca_S

  • Members
  • 407 posts
  • LocationGermany

Posted 24 April 2016 - 01:28 PM

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

#8 Bomb Bloke

    Hobbyist Coder

  • Moderators
  • 7,099 posts
  • LocationTasmania (AU)

Posted 24 April 2016 - 02:03 PM

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

#9 Lupus590

  • Members
  • 2,029 posts
  • LocationUK

Posted 24 April 2016 - 06:33 PM

Share it across MC servers?

#10 Bomb Bloke

    Hobbyist Coder

  • Moderators
  • 7,099 posts
  • LocationTasmania (AU)

Posted 25 April 2016 - 01:46 AM

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.

#11 vico

  • Members
  • 77 posts
  • Location-

Posted 31 May 2016 - 07:06 AM

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.

#12 Bomb Bloke

    Hobbyist Coder

  • Moderators
  • 7,099 posts
  • LocationTasmania (AU)

Posted 31 May 2016 - 08:27 AM

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.

#13 Forgotten_Boy

  • Members
  • 72 posts
  • LocationOntario, Canada

Posted 24 September 2016 - 06:26 AM

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?

#14 Bomb Bloke

    Hobbyist Coder

  • Moderators
  • 7,099 posts
  • LocationTasmania (AU)

Posted 24 September 2016 - 08:29 AM

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

#15 Forgotten_Boy

  • Members
  • 72 posts
  • LocationOntario, Canada

Posted 24 September 2016 - 05:05 PM

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?

#16 Bomb Bloke

    Hobbyist Coder

  • Moderators
  • 7,099 posts
  • LocationTasmania (AU)

Posted 25 September 2016 - 12:17 PM

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()


#17 Forgotten_Boy

  • Members
  • 72 posts
  • LocationOntario, Canada

Posted 25 September 2016 - 06:11 PM

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.


#18 Bomb Bloke

    Hobbyist Coder

  • Moderators
  • 7,099 posts
  • LocationTasmania (AU)

Posted 26 September 2016 - 12:27 AM

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. ;)

#19 Forgotten_Boy

  • Members
  • 72 posts
  • LocationOntario, Canada

Posted 26 September 2016 - 01:48 AM

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?

#20 Bomb Bloke

    Hobbyist Coder

  • Moderators
  • 7,099 posts
  • LocationTasmania (AU)

Posted 26 September 2016 - 11:27 AM

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





1 user(s) are reading this topic

0 members, 1 guests, 0 anonymous users