4086e75ead
Fixed the code in DDTeleporter and made minor changes to other classes that depended on those fixes. Ensured that PocketManager's load, save, and unload methods are called appropriately and rewrote some of their code. Made various changes in other classes (e.g. EventHookContainer, PlayerRespawnTracker) to pass them references to DDProperties through their constructors instead of having them rely on DDProperties.instance() - this is a better programming practice in the long run. Renamed initialization methods in mod_pocketDim to make it clear that they're called on events. Commented out command registration in mod_pocketDim so that we can test DD as soon as PacketHandler is fixed, without worrying about fixing the command classes.
79 lines
No EOL
1.4 KiB
Java
79 lines
No EOL
1.4 KiB
Java
|
|
|
|
package StevenDimDoors.mod_pocketDim;
|
|
|
|
|
|
import net.minecraft.entity.item.EntityItem;
|
|
|
|
import net.minecraft.entity.player.EntityPlayer;
|
|
import net.minecraft.item.ItemArmor;
|
|
import cpw.mods.fml.common.IPlayerTracker;
|
|
|
|
|
|
public class PlayerRespawnTracker implements IPlayerTracker
|
|
{
|
|
private final DDProperties properties;
|
|
|
|
public PlayerRespawnTracker(DDProperties properties)
|
|
{
|
|
this.properties = properties;
|
|
}
|
|
|
|
@Override
|
|
public void onPlayerLogin(EntityPlayer player) {
|
|
// TODO Auto-generated method stub
|
|
|
|
}
|
|
|
|
@Override
|
|
public void onPlayerLogout(EntityPlayer player) {
|
|
// TODO Auto-generated method stub
|
|
|
|
}
|
|
|
|
@Override
|
|
public void onPlayerChangedDimension(EntityPlayer player) {
|
|
// TODO Auto-generated method stub
|
|
|
|
}
|
|
|
|
@Override
|
|
public void onPlayerRespawn(EntityPlayer player)
|
|
{
|
|
if(player.worldObj.provider.dimensionId==properties.LimboDimensionID)
|
|
{
|
|
|
|
if(!player.worldObj.isRemote && properties.LimboReturnsInventoryEnabled)
|
|
{
|
|
|
|
if(player.username!=null)
|
|
{
|
|
|
|
if(!mod_pocketDim.limboSpawnInventory.isEmpty()&&mod_pocketDim.limboSpawnInventory.containsKey(player.username))
|
|
{
|
|
for(EntityItem drop : mod_pocketDim.limboSpawnInventory.get(player.username))
|
|
{
|
|
if(drop.getEntityItem().getItem() instanceof ItemArmor)
|
|
{
|
|
|
|
|
|
}
|
|
player.inventory.addItemStackToInventory(drop.getEntityItem());
|
|
|
|
|
|
}
|
|
}
|
|
}
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
}
|
|
|
|
} |