Jump to content

Getting a blocks x, y & z


Manslaughter777
 Share

Recommended Posts

I need to get a blocks x y and z in the world. How would i go about doing that? (Im used to constructors  and methods giving me these variables)

 

PlayerTickEvent:

 

 

@SubscribeEvent
public void onPlayerTick(TickEvent.PlayerTickEvent event) { //TODO WorldProviderHell
	EntityPlayer player = event.player;
	World world = event.player.worldObj;

	//Kill player if no space suit is worn
	if(!player.capabilities.disableDamage && !player.isPotionActive(Potion.waterBreathing)) {
		if(world.provider.dimensionId == Main.dimensionId) {
			if(player.getEquipmentInSlot(1) != null && player.getEquipmentInSlot(2) != null && player.getEquipmentInSlot(3) != null && player.getEquipmentInSlot(4) != null) {
				if(player.getEquipmentInSlot(4).getItem() == Main.spaceHelmet && player.getEquipmentInSlot(3).getItem() == Main.spaceJacket && player.getEquipmentInSlot(2).getItem() == Main.spacePants && player.getEquipmentInSlot(1).getItem() == Main.spaceBoots || player.getEquipmentInSlot(1).getItem() == Main.heavyMoonBoots) {

				} else player.attackEntityFrom(Main.onMoon, 1.0F);
			} else player.attackEntityFrom(Main.onMoon, 1.0F);
		}
	}

	//Change block forms on moon
	if(world.provider.dimensionId == Main.dimensionId) {
		if(world.getBlock(x, y, z).getMaterial() == Material.water) { //help here
			world.setBlock(x, y, z, Blocks.ice);
		}
	}
}

 

 

Link to comment
Share on other sites

player.posX?

Apparently I'm a complete and utter jerk and come to this forum just like to make fun of people, be confrontational, and make your personal life miserable.  If you think this is the case, JUST REPORT ME.  Otherwise you're just going to get reported when you reply to my posts and point it out, because odds are, I was trying to be nice.

 

Exception: If you do not understand Java, I WILL NOT HELP YOU and your thread will get locked.

 

DO NOT PM ME WITH PROBLEMS. No help will be given.

Link to comment
Share on other sites

Assuming from OP's code he tried to turn water into ice on moon by using PlayerEvent. That is wrong way to go.

 

You will need to use some ChunkEvent (Populate?) or World generator. I sadly have little experience as to second one.

1.7.10 is no longer supported by forge, you are on your own.

Link to comment
Share on other sites

Are you trying to turn ALL water blocks to ice? Or is it one or more specific blocks?

 

If specific, what conditions determine when a water block should freeze?

Yes, all water blocks to ice. I managed to do this in BlockPlaceEvent, but it only works if the water block is placed from a water block, it doesn't work if its placed with a bucket which is why I'm trying to find an alternate way

Link to comment
Share on other sites

Then you want the bucket events.

 

I should note that ice is trivial to turn back into flowing water.

 

*Pops a torch down*

Apparently I'm a complete and utter jerk and come to this forum just like to make fun of people, be confrontational, and make your personal life miserable.  If you think this is the case, JUST REPORT ME.  Otherwise you're just going to get reported when you reply to my posts and point it out, because odds are, I was trying to be nice.

 

Exception: If you do not understand Java, I WILL NOT HELP YOU and your thread will get locked.

 

DO NOT PM ME WITH PROBLEMS. No help will be given.

Link to comment
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

 Share



×
×
  • Create New...

Important Information

By using this site, you agree to our Terms of Use.