package com.five35.minecraft.deathbox;

import cpw.mods.fml.common.eventhandler.SubscribeEvent;
import net.minecraft.entity.player.EntityPlayer;
import net.minecraftforge.event.entity.living.LivingDeathEvent;

public class LivingDeathEventHandler {
	@SubscribeEvent
	@SuppressWarnings("static-method")
	public void onLivingDeathEvent(final LivingDeathEvent event) {
		DeathBox.getLogger().info("Something died.");

		if (!(event.entity instanceof EntityPlayer)) {
			return;
		}

		final EntityPlayer player = (EntityPlayer) event.entity;

		DeathBox.getLogger().info(String.format("Player %s died.", player.getCommandSenderName()));
	}
}

@@ -138,16 +138,50 @@
 Player;%0A
+import net.minecraft.world.World;%0A
 import n
@@ -397,57 +397,8 @@
 ) %7B%0A
-%09%09DeathBox.getLogger().info(%22Something died.%22);%0A%0A
 %09%09if
@@ -521,100 +521,615 @@
 ty;%0A
-%0A
 %09%09
-DeathBox.getLogger().info(String.format(%22Player %25s died.%22, player.getCommandSenderName())
+final String playerName = player.getCommandSenderName();%0A%09%09final World world = player.worldObj;%0A%0A%09%09final int x = (int) player.posX;%0A%09%09final int y = (int) player.posY;%0A%09%09final int z = (int) player.posZ;%0A%0A%09%09final String message = String.format(%22Player %25s died at %25d,%25d,%25d in dimension %25s, saving inventory.%22, playerName, x, y, z, world.provider.getDimensionName());%0A%09%09DeathBox.getLogger().info(message);%0A%0A%09%09if (!world.isAirBlock(x, y, z)) %7B%0A%09%09%09// TODO: find appropriate position for death box%0A%09%09%7D%0A%0A%09%09world.setBlock(x, y, z, DeathBox.BLOCK);%0A%09%09((DeathBoxTileEntity) world.getTileEntity(x, y, z)).store(player
 );%0A%09

implement creation of death box on player death