I have been working on learning Python by creating mods in Minecraft. Working my way through this Learn to Program With Minecraft book and I decided to modify one of the missions in chapter four that talks about posting a message to the users. Well one message that I have always wanted to see is if there are diamonds around me. I wrote a script with some loop nesting and slow as can be, but it finds diamond ore and posts a message with position values so I can find them. Below is that script.
from mcpi.minecraft import Minecraft
from mcpi.minecraft import Block
mc = Minecraft.create()
pos = mc.player.getPos()
distance = 10
totalCheck = 0
for x in range(int(pos.x), int(pos.x + distance)):
for y in range(4, 17):
for z in range(int(pos.z), int(pos.z + distance)):
blockId = mc.getBlock(x, y, z)
totalCheck += 1
if (blockId == 56):
mc.postToChat("block: " + str(blockId) + "x: " + str(x) + " y: " + str(y) + " z: " + str(z))
mc.postToChat("Total blocks checked: " + str(totalCheck))
Thursday, December 29, 2016
Saturday, December 3, 2016
Time To Be Prolific
I keep forgetting to blog! LOL, not forgetting, just haven't. And since I don't really produce much, it doesn't really matter. But this is about to change, I am going to become prolific. I am going to start doing so many things, something is bound to succeed.
I am going to start coding on my own projects again
Make a mobile app - Xamarin
Convert my API - Java -> c#
Put more cool JS on my site -> not sure yet, need ideas
Do something with FB -> need some ideas
MOD Minecraft with Python
Said it before, but going to do it this time, going to stay on it.
I am going to start coding on my own projects again
Make a mobile app - Xamarin
Convert my API - Java -> c#
Put more cool JS on my site -> not sure yet, need ideas
Do something with FB -> need some ideas
MOD Minecraft with Python
Said it before, but going to do it this time, going to stay on it.
Subscribe to:
Posts (Atom)