tag:blogger.com,1999:blog-9007601562606157016.post3784055084112239681..comments2023-05-11T16:21:37.725+01:00Comments on <Stuff about="code" />: Raspberry Pi - Minecraft - Auto BridgeMartin O'Hanlonhttp://www.blogger.com/profile/03047799173301971515noreply@blogger.comBlogger28125tag:blogger.com,1999:blog-9007601562606157016.post-73469102437303971262016-04-11T18:14:34.925+01:002016-04-11T18:14:34.925+01:00This comment has been removed by the author.Anonymoushttps://www.blogger.com/profile/17014133431180769121noreply@blogger.comtag:blogger.com,1999:blog-9007601562606157016.post-21840541591566697632014-02-04T20:47:41.174+00:002014-02-04T20:47:41.174+00:00Did the code download properly from github? Does ...Did the code download properly from github? Does the ~/minecraft-bridge/minecraft-bridge.py file exist? Martin O'Hanlonhttps://www.blogger.com/profile/03047799173301971515noreply@blogger.comtag:blogger.com,1999:blog-9007601562606157016.post-57602639504527538812014-01-12T00:47:33.716+00:002014-01-12T00:47:33.716+00:00hi
slight problem here. after i typed python minec...hi<br />slight problem here. after i typed python minecraft-bridge.py it said python: cant open file 'minecraft-bridge.py' : [errno 2] no such file or directory.<br />im new to programming and not very good at it. also no luck with copy paste too. <br />-TylerAnonymoushttps://www.blogger.com/profile/09458002445586416274noreply@blogger.comtag:blogger.com,1999:blog-9007601562606157016.post-76748974154719909612013-09-14T03:13:05.581+01:002013-09-14T03:13:05.581+01:00The error is easy to explain, you are trying to fi...The error is easy to explain, you are trying to find an item in your list which doesnt exist, in this case i, which always seems to be 1, why this is happening is more difficult as i cant understand what trying to do.<br /><br />The code to me says, if im standing on grass and i have more than 3 blocks in my list, set block 1 in that list to air and move on. If the block below me is air, create a bridge block and add it to the list.<br /><br />If your walking through the air you are going to put LOADS of blocks in your list, say 100, if you start standing on grass you are going to remove blocks from that list until you are no longer standing on grass and which point you stop taking blocks off the list, unless you reach a point where there are only 3 blocks list on the list? Is that right? Comments are always very helpful!<br /><br />The first thing i would check is that mc.setBlock is ok with you passing a list as the x,y,z parameters e.g. setBlock(list[i], air) i would expect to see setBlock(x,y,z, air). I dont think this is the route of you issue but it might be hiding the real error.<br /><br />Best of luckMartin O'Hanlonhttps://www.blogger.com/profile/03047799173301971515noreply@blogger.comtag:blogger.com,1999:blog-9007601562606157016.post-32173678315665102932013-09-12T18:14:00.739+01:002013-09-12T18:14:00.739+01:00I think I need a way to stop it before it deletes ...I think I need a way to stop it before it deletes the last blockAnonymoushttps://www.blogger.com/profile/13643145758687182111noreply@blogger.comtag:blogger.com,1999:blog-9007601562606157016.post-81116898500657535252013-09-12T18:12:51.328+01:002013-09-12T18:12:51.328+01:00this is the error message (tabs don't work so ...this is the error message (tabs don't work so i'll add an '~' to replace them):<br /><br />Traceback (most recent call last):<br />~File 'bridge.py', line 25, in <br />~~mc.setBlock(list[i], air)<br />IndexError: list index out of rangeAnonymoushttps://www.blogger.com/profile/13643145758687182111noreply@blogger.comtag:blogger.com,1999:blog-9007601562606157016.post-440168896340321762013-09-12T09:03:06.161+01:002013-09-12T09:03:06.161+01:00Crashes? Is there an error message?Crashes? Is there an error message?Martin O'Hanlonhttps://www.blogger.com/profile/03047799173301971515noreply@blogger.comtag:blogger.com,1999:blog-9007601562606157016.post-89873948719441890562013-09-11T18:37:21.341+01:002013-09-11T18:37:21.341+01:00the tabs don't work on blogger, but there ther...the tabs don't work on blogger, but there there<br />Anonymoushttps://www.blogger.com/profile/13643145758687182111noreply@blogger.comtag:blogger.com,1999:blog-9007601562606157016.post-59330871378233135432013-09-11T18:36:25.403+01:002013-09-11T18:36:25.403+01:00hi there!
I have made a program similar to this an...hi there!<br />I have made a program similar to this and i thought that you could help. My program does almost the same thing but disassembls the bridge when you walk on grass, but it crashes when it removes the bridge. can you help me? here is the program:<br /><br /><br />import mcpi.minecraft as minecraft<br />import time<br />mc = minecraft.Minecraft.create()<br />list = ['e',]<br />bridge = 20<br />water = (8, 9)<br />air = 0<br />grass = 2<br />i = 1<br /><br />listlen = 0<br /><br />while True:<br /> <br /> pos = mc.player.getTilePos()<br /> blockbelow = mc.getBlock(pos.x, pos.y - 1, pos.z)<br /> if blockbelow == air:<br /> mc.setBlock(pos.x, pos.y - 1, pos.z, bridge)<br /> list.append((pos.x, pos.y - 1, pos.z))<br /> print len(list)<br /> listlen = len(list)<br /> elif blockbelow == grass and listlen > 3:<br /> mc.setBlock(list[i], air)<br /> del(list[i])<br /> time.sleep(0.01)<br /> time.sleep(0.001) Anonymoushttps://www.blogger.com/profile/13643145758687182111noreply@blogger.comtag:blogger.com,1999:blog-9007601562606157016.post-24340405822106523472013-08-14T06:43:19.460+01:002013-08-14T06:43:19.460+01:00Yes, you solved it. I cut-and-paste, and there was...Yes, you solved it. I cut-and-paste, and there was not a real "space" between "clone" and "https". Seems obvious in retrospect. Thank you for taking the time to clue me in!Mr. Hagenhttps://www.blogger.com/profile/09133430833393193694noreply@blogger.comtag:blogger.com,1999:blog-9007601562606157016.post-40180472219529969202013-08-13T23:08:31.227+01:002013-08-13T23:08:31.227+01:00Er no. I haven't experienced that before or ha...Er no. I haven't experienced that before or had anyone else mention it. <br /><br />1 thought are you cutting and pasting the command from the browser sometimes you get odd characters. Try typing it if you are. Martin O'Hanlonhttps://www.blogger.com/profile/03047799173301971515noreply@blogger.comtag:blogger.com,1999:blog-9007601562606157016.post-76451142705415299142013-08-13T21:57:49.803+01:002013-08-13T21:57:49.803+01:00I am not able to successfully complete the "g...I am not able to successfully complete the "git clone" command (this or any other git clone attempt). When I try, I get:<br />git: 'clone https://github.com/martinohanlon/minecraft-bridge.git' is not a git command. See 'git --help'<br /><br />Any ideas?Mr. Hagenhttps://www.blogger.com/profile/09133430833393193694noreply@blogger.comtag:blogger.com,1999:blog-9007601562606157016.post-885631778658300322013-07-17T13:38:19.852+01:002013-07-17T13:38:19.852+01:00Then I am at a loss Im afraid. Just re-downloaded...Then I am at a loss Im afraid. Just re-downloaded the code and run it with no problems. Sorry.<br /><br />Just to confirm any error would appear in the terminal window not as a message in the game tho.Martin O'Hanlonhttps://www.blogger.com/profile/03047799173301971515noreply@blogger.comtag:blogger.com,1999:blog-9007601562606157016.post-42307368207204328612013-07-17T13:20:24.350+01:002013-07-17T13:20:24.350+01:00I've got run to run it but it doesn't say ...I've got run to run it but it doesn't say anything or do anything. <br /><br />Yeah, it runs in the Terminal and i get the ingame message but the Auto-Bridge doesn't form when i walk off a cliff etc. It doesn't give any error whatsoever.Anonymoushttps://www.blogger.com/profile/14900442883822145345noreply@blogger.comtag:blogger.com,1999:blog-9007601562606157016.post-60833673262975606062013-07-17T10:00:07.719+01:002013-07-17T10:00:07.719+01:00I have never experienced a permission denied error...I have never experienced a permission denied error before, have you tried the simple stuff like running it with sudo, perhaps you have got some odd permissions.<br /><br />When you say you have got it to run in terminal, do you mean that the program is running successfully and you get the "Minecraft Autobridge Active" message in Minecraft? When you say it doesnt do anything, Im guessing you mean when you walk it doesnt automatically create a bridge? Do the program give an error in the terminal window?Martin O'Hanlonhttps://www.blogger.com/profile/03047799173301971515noreply@blogger.comtag:blogger.com,1999:blog-9007601562606157016.post-22514445627314649762013-07-16T13:16:47.848+01:002013-07-16T13:16:47.848+01:00When i try to run the program in run it comes up w...When i try to run the program in run it comes up with this; Failed to execute child process "minecraft-bridge/minecraft-bridge.py" (Permission Denied)<br /><br />I've gotten it to run in Terminal but the message pops up in the game and does nothing.Anonymoushttps://www.blogger.com/profile/14900442883822145345noreply@blogger.comtag:blogger.com,1999:blog-9007601562606157016.post-12921683675760305582013-06-12T18:20:49.774+01:002013-06-12T18:20:49.774+01:00Brilliant. This should get a lot of kids hooked in...Brilliant. This should get a lot of kids hooked in to programming. MC is all about algorithms! I'm hoping to use something like this at our Bring Your Kids to Work Day.<br /><br />The biggest problem I'm having in playing MC is knowing what direction I'm facing (and getting disoriented all the time). Do you know of a way to show that in the chat window using the API, like you do for distance in the Hide & Seek?<br /><br />I'm also wondering about using the API to create a world map and showing it in a separate screen using PyGame.<br /><br />At any rate, thanks for blazing the way on this. Great stuff!Kenhttps://www.blogger.com/profile/00526709522608721937noreply@blogger.comtag:blogger.com,1999:blog-9007601562606157016.post-85812667978394937092013-06-02T12:44:58.682+01:002013-06-02T12:44:58.682+01:00Do you mean the block I use to create the Bridge? ...Do you mean the block I use to create the Bridge? Its actually Diamond block, not ice. <br /><br />If so absolutely you can use any block you want, other than ones affected by gravity I suppose like sand.<br /><br />Change the DIAMOND_BLOCK in the code to TNT.Martin O'Hanlonhttps://www.blogger.com/profile/03047799173301971515noreply@blogger.comtag:blogger.com,1999:blog-9007601562606157016.post-71548321402757445192013-06-02T11:31:01.037+01:002013-06-02T11:31:01.037+01:00hi martin, can I change the Ice block to TNT block...hi martin, can I change the Ice block to TNT block ?<br />Thanks. :)David Layardihttps://www.blogger.com/profile/12092955864805578349noreply@blogger.comtag:blogger.com,1999:blog-9007601562606157016.post-88287940896961424112013-03-30T15:47:01.056+00:002013-03-30T15:47:01.056+00:00SuperSuperMartin O'Hanlonhttps://www.blogger.com/profile/03047799173301971515noreply@blogger.comtag:blogger.com,1999:blog-9007601562606157016.post-49581132312417454402013-03-30T14:50:54.616+00:002013-03-30T14:50:54.616+00:00Doing it from github worked perfectly. There is a ...Doing it from github worked perfectly. There is a very happy 5 year old.<br />Thanks so muchSFarringtonhttps://www.blogger.com/profile/00876910263925301495noreply@blogger.comtag:blogger.com,1999:blog-9007601562606157016.post-36489338599406015222013-03-30T09:42:33.746+00:002013-03-30T09:42:33.746+00:00Hi,
What's the syntax error? Is there anythi...Hi,<br /><br />What's the syntax error? Is there anything specific?<br /><br />Are you by any chance cutting and pasting the code directly from the browser into Idle? I suspect you might be getting some odd characters from the browser, they have a habit of doing that.<br /><br />I've modified the post to give some instructions about how to download the code directly from github. This way you can be sure you have the right code.<br /><br />Let me know ho you get on.<br /><br />MartMartin O'Hanlonhttps://www.blogger.com/profile/03047799173301971515noreply@blogger.comtag:blogger.com,1999:blog-9007601562606157016.post-88911438897282987112013-03-30T07:30:06.856+00:002013-03-30T07:30:06.856+00:00Question.
When I do this it is giving me a syntax ...Question.<br />When I do this it is giving me a syntax error. I have tried this and the clock and it does the same on both. I am trying to get these working for my son and I am a little lost. ThanksSFarringtonhttps://www.blogger.com/profile/00876910263925301495noreply@blogger.comtag:blogger.com,1999:blog-9007601562606157016.post-18645181126947801412013-03-13T06:43:06.365+00:002013-03-13T06:43:06.365+00:00No idea, they might not be supported, i havent see...No idea, they might not be supported, i havent seen them wandering about in the game. Hopefully they will appear in an update.Martin O'Hanlonhttps://www.blogger.com/profile/03047799173301971515noreply@blogger.comtag:blogger.com,1999:blog-9007601562606157016.post-74985635926939819632013-03-12T23:00:27.357+00:002013-03-12T23:00:27.357+00:00Hi, I just commented on your other post but anyway...Hi, I just commented on your other post but anyway, do you know how to spawn pigs? I don't know if you can use the setBlock or what.Anonymoushttps://www.blogger.com/profile/12708314142304273137noreply@blogger.com