EventHook: Add dropped items to the death chest
parent
3c320d9bbf
commit
d3f300da85
|
@ -1,13 +1,17 @@
|
||||||
package lostcave.deathchests;
|
package lostcave.deathchests;
|
||||||
|
|
||||||
|
import java.util.ArrayList;
|
||||||
|
|
||||||
import cpw.mods.fml.common.eventhandler.SubscribeEvent;
|
import cpw.mods.fml.common.eventhandler.SubscribeEvent;
|
||||||
import cpw.mods.fml.common.gameevent.PlayerEvent;
|
import cpw.mods.fml.common.gameevent.PlayerEvent;
|
||||||
import lostcave.deathchests.block.BlockDeathChest;
|
import lostcave.deathchests.block.BlockDeathChest;
|
||||||
|
import lostcave.deathchests.block.BlockDeathChest.TileDeathChest;
|
||||||
import lostcave.deathchests.item.ItemObituary;
|
import lostcave.deathchests.item.ItemObituary;
|
||||||
import lostcave.deathchests.util.Config;
|
import lostcave.deathchests.util.Config;
|
||||||
import lostcave.deathchests.util.DeathChestStorage;
|
import lostcave.deathchests.util.DeathChestStorage;
|
||||||
import lostcave.deathchests.util.Debug;
|
import lostcave.deathchests.util.Debug;
|
||||||
import net.minecraft.block.BlockAir;
|
import net.minecraft.block.BlockAir;
|
||||||
|
import net.minecraft.entity.item.EntityItem;
|
||||||
import net.minecraft.entity.player.EntityPlayer;
|
import net.minecraft.entity.player.EntityPlayer;
|
||||||
import net.minecraft.item.ItemStack;
|
import net.minecraft.item.ItemStack;
|
||||||
import net.minecraft.world.World;
|
import net.minecraft.world.World;
|
||||||
|
@ -162,7 +166,14 @@ public class EventHook {
|
||||||
suitableBlock[3] = event.entityPlayer.dimension;
|
suitableBlock[3] = event.entityPlayer.dimension;
|
||||||
|
|
||||||
world.setBlock(suitableBlock[0], suitableBlock[1], suitableBlock[2], BlockDeathChest.getInstance());
|
world.setBlock(suitableBlock[0], suitableBlock[1], suitableBlock[2], BlockDeathChest.getInstance());
|
||||||
//TODO: Get the player's items and put them in the death chest
|
|
||||||
|
TileDeathChest tile = (TileDeathChest) world.getTileEntity(suitableBlock[0], suitableBlock[1], suitableBlock[2]);
|
||||||
|
tile.owner = event.entityPlayer.getGameProfile().getId();
|
||||||
|
ArrayList<EntityItem> drops = event.drops;
|
||||||
|
for (EntityItem drop : drops) {
|
||||||
|
Debug.out(drop.getEntityItem().getDisplayName());
|
||||||
|
tile.addItemStack(drop.getEntityItem());
|
||||||
|
}
|
||||||
|
|
||||||
String uuid = event.entityPlayer.getGameProfile().getId().toString();
|
String uuid = event.entityPlayer.getGameProfile().getId().toString();
|
||||||
Debug.out(uuid);
|
Debug.out(uuid);
|
||||||
|
@ -183,7 +194,6 @@ public class EventHook {
|
||||||
String uuid = event.player.getGameProfile().getId().toString();
|
String uuid = event.player.getGameProfile().getId().toString();
|
||||||
Debug.out("UUID: " + uuid);
|
Debug.out("UUID: " + uuid);
|
||||||
|
|
||||||
//TODO: check for stored chest location
|
|
||||||
if (DeathChestStorage.hasNewDeathChestLocation(uuid)) {
|
if (DeathChestStorage.hasNewDeathChestLocation(uuid)) {
|
||||||
int[] chestLocation = DeathChestStorage.popNewDeathChestLocation(uuid);
|
int[] chestLocation = DeathChestStorage.popNewDeathChestLocation(uuid);
|
||||||
Debug.out("Chest location X: " + Integer.toString(chestLocation[0]));
|
Debug.out("Chest location X: " + Integer.toString(chestLocation[0]));
|
||||||
|
|
Loading…
Reference in New Issue