[squeak-dev] Re: Re: Re: [ANN] Minecraft Bindings - Minecraft.zip (0/1)

Louis LaBrunda Lou at Keystone-Software.com
Tue Mar 5 20:38:30 UTC 2013


Hi Bert,

>Pool vars sound okay,

I decided to start with the pool dictionary.  Attached you will find a zip
of two files.  One is a fileout of the pool dictionary.

Alex (my son) found a list of about 485 Minecraft textures and colors.  We
put them all in the pool dictionary, MinecraftConstants.

>except that you couldn't use these them from a workspace.

I thought this was a problem too but I'm pleased to say that if you look at
the replies to my post "How to use pool dictionaries in a workspace?" you
will see a way around it.

>Or, add them as methods to the Minecraft object so you could say "mc glowStone".

I like this too.  But I need a little help.  Below is a snippet of code
(unfinished) that I will use to create the instance methods to Minecraft
from the MinecraftConstants pool dictionary.  For now the code fills
#testStream with all the methods so we can see what they will look like.

What I need is (what I expect is one) line of code that will compile the
contents of #stream as a method of Minecraft. Can you help with that?

Will adding 485 methods to Minecraft for these values be a good idea?  I
have no reason to think not but it is a large number of methods.

Lou

	| testStream |

	testStream := WriteStream on: ''.
	MinecraftConstants bindingsDo: [:b | | key methodName stream |
		key := b key.
		methodName := key asString copy.
		methodName at: 1 put: ((methodName at: 1) asLowercase).
		stream := WriteStream on: ''.
		stream nextPutAll: methodName; cr; cr; tab; nextPut: $^; nextPutAll:
key; nextPut: $.; cr.
			
		testStream nextPutAll: stream contents; cr.
	].
	testStream inspect.
-----------------------------------------------------------
Louis LaBrunda
Keystone Software Corp.
SkypeMe callto://PhotonDemon
mailto:Lou at Keystone-Software.com http://www.Keystone-Software.com



More information about the Squeak-dev mailing list