Issue with setBlock

131 views
Skip to first unread message

Victor Winter

unread,
Jul 10, 2015, 3:02:50 PM7/10/15
to adventures-in-...@googlegroups.com

Hi, I am new to canaryMod and rasberryjuice. I am running on windows 8 and have almost everything working. I can run a basic python program (hello-world.py) and see the results in the world I am in. As a player, I can manually place blocks and destroy them (i.e., I have operator status and in the config file I have gamemode=1). However, from within a python program it appears that calls to setBlock have no effect. All other api functions I have tried work (e.g., getBlock, getRotation, getTilePos, getPitch, setPos). When it comes to executing calls to setBlock, the program doesn't crash or produce an error message, it just seems that the calls are "ignored" -- kind of like what happens when a player is in visitor mode. For this reason, it seems to me that the python programs I run have visitor mode permissions. Using lessons learned from setting up the canaryMod server, etc., I have installed the setup on a clean machine -- with the same results -- everything works except setBlock :-( 

Below is a program that runs perfectly except for the fact that a diamond block is not placed. The getBlock function reports air (0) at location (0,100,0). Any help would be greatly appreciated.

import mcpi.minecraft as minecraft
import mcpi.block as block
import time

mc  =  minecraft.Minecraft.create()

mc.postToChat("Python program is running...")
mc.postToChat("Preparing to set a diamond block.")
time.sleep(10)

mc.setBlock(0, 100, 0, block.DIAMOND_BLOCK.id)
blockType = mc.getBlock(0,100,0)

mc.postToChat("Block type (0,100,0) = " + str(blockType))
mc.postToChat("A diamond block should have been placed at: (0,100,0)")
time.sleep(10)
mc.postToChat("Done.")


Martin O'Hanlon

unread,
Jul 11, 2015, 5:17:54 AM7/11/15
to adventures-in-...@googlegroups.com
Hi  Victor,

I have run your program using the Canarymod Starter kit, and got the accepted result (i.e. the block was set to diamond)


So your program looks good.

Given this the following questions come to mind:
- what result do you get? could you post a screen shot?
- are you using the starter kit or have you built your own server from scratch?
- if not, do you get the same result if you use the starter kit?
- do any errors appear in the command window where canarymod is running?

I've just had a quick look through the readme in the starter kit about how to configure canarymod and this jumped out:

Change:
 -  spawn-protection=16  to  spawn-protection=0  so the spawn area can be built on

I wonder if spawn protection is stopping blocks being put at 0,y,0?

Let me know,

Mart

Victor Winter

unread,
Jul 11, 2015, 1:42:14 PM7/11/15
to adventures-in-...@googlegroups.com
Hi Martin:

  I had done a "from scratch" install. I was not aware of the starterKit. I have it now. I read through the readme a I pretty much had done all of this (well I thought anyway). So I tried the starterKit and everything works! Thank you so much.

David Barrera

unread,
Apr 19, 2017, 3:44:56 AM4/19/17
to Adventures in Minecraft Forum
Greetings...

I know this is an old thread, but I wish to know what is missing... I'm creating a server from scratch, have read the README in the Starter Kit and everything that is said there has been done and still I have the same behavior... So lets lay out the questions before we continue:

1.- Is there a difference between building the JAR or downloading it from getbukkit.com?
2.- What is the difference between craftbukkit and spigot?
3.- Does any of the above affect the setBlock and getBlock command?

For the second question I've googled it and apparently the only difference is performance so I dont see any meaningful impact, so my guess would be that building the JAR file would be the way to go... Or am I talking nonsense?

Martin O'Hanlon

unread,
Apr 19, 2017, 6:39:29 AM4/19/17
to Adventures in Minecraft Forum
Hi,

To asnwer your questions:

1.- Is there a difference between building the JAR or downloading it from getbukkit.com?

Probably not, but if you build it you know its authenticity

2.- What is the difference between craftbukkit and spigot?

Spigot is a high performance variant of craftbukkit

3.- Does any of the above affect the setBlock and getBlock command?

No


If you are looking for a newer version of the Minecraft starter kit, check out the 1.11.2 starter kit (https://groups.google.com/d/msg/adventures-in-minecraft-forum/ijFcXCFij9E/6YJjJCZ3AQAJ)

David Barrera

unread,
Apr 19, 2017, 9:04:57 AM4/19/17
to Adventures in Minecraft Forum
Thanks for your responses... Pretty much what I expected, but after some (a lot of) coffee, and way past sleep time, I found out that Minecraft is reporting a strange position value for XYZ when pressing F3. So, I got the player position with player.getPos() and used those values as reference for setBlockPos() and voila! Apparently it was working all the time...

Now, to find all those diamond blocks I created while testing...
Reply all
Reply to author
Forward
0 new messages