Jump to content

Recommended Posts

Posted

So my light just won't show up. Through the

System.out.println()

s I know that the event IS being called, the addLight IS being called and the light value IS NOT over 15 (its 9). What am I doing wrong?

 

@SubscribeEvent
public void onTick(TickEvent.PlayerTickEvent evt){
	if(!evt.player.worldObj.isRemote){
		if(evt.player.inventory.getCurrentItem() != null && evt.player.inventory.getCurrentItem().getItem() instanceof ItemWand){
			ItemStack wand = evt.player.inventory.getCurrentItem();
			System.out.println(wand.stackTagCompound.getBoolean("lumos"));
			if(wand.stackTagCompound != null && wand.stackTagCompound.getBoolean("lumos") == true){
					evt.player.worldObj.updateLightByType(EnumSkyBlock.Block, prevposX, prevposY, prevposZ);
					this.addLight(evt.player.worldObj, evt.player);
					System.out.println("add light");

			}
			else if(wand.stackTagCompound != null && wand.stackTagCompound.getBoolean("lumos") == false){
				evt.player.worldObj.updateLightByType(EnumSkyBlock.Block, prevposX, prevposY, prevposZ);
				this.deleteLight(evt.player.worldObj, evt.player);
				evt.player.worldObj.updateLightByType(EnumSkyBlock.Block, prevposX, prevposY, prevposZ);

			}
		}
	}
}
private void addLight(World world, EntityPlayer player) {
	MagiSkills ext = MagiSkills.get(player);
	world.setLightValue(EnumSkyBlock.Block, (int) player.posX,

			(int) player.posY, (int) player.posZ, 9+ext.getCurrentSkillLevel(SpellLib.LUMOS));
	System.out.println(9+ext.getCurrentSkillLevel(SpellLib.LUMOS));
	prevposX = (int)player.posX;
	prevposY = (int)player.posY;
	prevposZ = (int)player.posZ;
	world.markBlockRangeForRenderUpdate((int) player.posX,
			(int) player.posY, (int) player.posX, 12, 12, 12);
	world.markBlockForUpdate((int) player.posX, (int) player.posY,
			(int) player.posZ);
//		for(int i = 1; i < 6; i++){
//			for(int j = 1; j < 6; j++){
//				for(int k = 1; k < 4; k++){
//					world.updateLightByType(EnumSkyBlock.Block, (int) player.posX - 3 + j, (int) player.posY - 2 + k, (int) player.posZ - 3 + i);
//				}
//			}
		world.updateLightByType(EnumSkyBlock.Block, (int) player.posX, (int) player.posY - 1, (int) player.posZ);
		world.updateLightByType(EnumSkyBlock.Block, (int) player.posX + 1, (int) player.posY - 1, (int) player.posZ + 1);
		world.updateLightByType(EnumSkyBlock.Block, (int) player.posX, (int) player.posY - 1, (int) player.posZ + 1);
		world.updateLightByType(EnumSkyBlock.Block, (int) player.posX - 1, (int) player.posY - 1, (int) player.posZ + 1);
		world.updateLightByType(EnumSkyBlock.Block, (int) player.posX + 1, (int) player.posY - 1, (int) player.posZ);
		world.updateLightByType(EnumSkyBlock.Block, (int) player.posX - 1, (int) player.posY - 1, (int) player.posZ);
		world.updateLightByType(EnumSkyBlock.Block, (int) player.posX + 1, (int) player.posY - 1, (int) player.posZ-1);
		world.updateLightByType(EnumSkyBlock.Block, (int) player.posX, (int) player.posY - 1, (int) player.posZ-1);
		world.updateLightByType(EnumSkyBlock.Block, (int) player.posX - 1, (int) player.posY - 1, (int) player.posZ - 1);

		world.updateLightByType(EnumSkyBlock.Block, (int) player.posX + 1, (int) player.posY + 1, (int) player.posZ + 1);
		world.updateLightByType(EnumSkyBlock.Block, (int) player.posX, (int) player.posY + 1, (int) player.posZ + 1);
		world.updateLightByType(EnumSkyBlock.Block, (int) player.posX - 1, (int) player.posY + 1, (int) player.posZ + 1);
		world.updateLightByType(EnumSkyBlock.Block, (int) player.posX + 1, (int) player.posY + 1, (int) player.posZ);
		world.updateLightByType(EnumSkyBlock.Block, (int) player.posX, (int) player.posY + 1, (int) player.posZ);
		world.updateLightByType(EnumSkyBlock.Block, (int) player.posX - 1, (int) player.posY + 1, (int) player.posZ);
		world.updateLightByType(EnumSkyBlock.Block, (int) player.posX + 1, (int) player.posY + 1, (int) player.posZ - 1);
		world.updateLightByType(EnumSkyBlock.Block, (int) player.posX, (int) player.posY + 1, (int) player.posZ - 1);
		world.updateLightByType(EnumSkyBlock.Block, (int) player.posX - 1, (int) player.posY + 1, (int) player.posZ - 1);

		world.updateLightByType(EnumSkyBlock.Block, (int) player.posX + 1, (int) player.posY, (int) player.posZ + 1);
		world.updateLightByType(EnumSkyBlock.Block, (int) player.posX, (int) player.posY, (int) player.posZ + 1);
		world.updateLightByType(EnumSkyBlock.Block, (int) player.posX - 1, (int) player.posY, (int) player.posZ + 1);
		world.updateLightByType(EnumSkyBlock.Block, (int) player.posX - 1, (int) player.posY, (int) player.posZ);
		world.updateLightByType(EnumSkyBlock.Block, (int) player.posX + 1, (int) player.posY, (int) player.posZ);
		world.updateLightByType(EnumSkyBlock.Block, (int) player.posX + 1, (int) player.posY, (int) player.posZ - 1);
		world.updateLightByType(EnumSkyBlock.Block, (int) player.posX, (int) player.posY, (int) player.posZ - 1);
		world.updateLightByType(EnumSkyBlock.Block, (int) player.posX - 1, (int) player.posY, (int) player.posZ - 1);




//		}
}

Creator of the MyFit, MagiCraft, Tesseract gun, and Papa's Wingeria mod.

Posted

Does this line: System.out.println(9+ext.getCurrentSkillLevel(SpellLib.LUMOS)) always gives value over 9?

I. Stellarium for Minecraft: Configurable Universe for Minecraft! (WIP)

II. Stellar Sky, Better Star Rendering&Sky Utility mod, had separated from Stellarium.

Posted

No wait it actually worked yesterday and it was full time, like the player was constantly a light source

Creator of the MyFit, MagiCraft, Tesseract gun, and Papa's Wingeria mod.

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
Unfortunately, your content contains terms that we do not allow. Please edit your content to remove the highlighted words below.
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.

Announcements



×
×
  • Create New...

Important Information

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