2013-02-17 21:46:16 -05:00
package StevenDimDoors.mod_pocketDim ;
2013-06-13 19:01:54 -04:00
2013-03-22 00:58:55 -04:00
import net.minecraftforge.client.event.sound.SoundLoadEvent ;
2013-02-17 21:46:16 -05:00
import net.minecraftforge.event.ForgeSubscribe ;
import net.minecraftforge.event.entity.living.LivingFallEvent ;
import net.minecraftforge.event.entity.player.PlayerDropsEvent ;
import net.minecraftforge.event.world.WorldEvent ;
2013-08-29 02:14:24 -04:00
import StevenDimDoors.mod_pocketDim.core.PocketManager ;
import StevenDimDoors.mod_pocketDim.ticking.RiftRegenerator ;
2013-07-25 00:12:13 -04:00
import cpw.mods.fml.relauncher.Side ;
import cpw.mods.fml.relauncher.SideOnly ;
2013-06-13 19:01:54 -04:00
2013-02-17 21:46:16 -05:00
public class EventHookContainer
{
2013-06-13 19:01:54 -04:00
private static DDProperties properties = null ;
public EventHookContainer ( )
{
if ( properties = = null )
properties = DDProperties . instance ( ) ;
}
2013-03-22 00:58:55 -04:00
@SideOnly ( Side . CLIENT )
@ForgeSubscribe
public void onSoundLoad ( SoundLoadEvent event )
{
2013-05-31 02:17:05 -04:00
event . manager . soundPoolSounds . addSound ( " mods/DimDoors/sfx/monk.ogg " , ( mod_pocketDim . class . getResource ( " /mods/DimDoors/sfx/monk.ogg " ) ) ) ;
event . manager . soundPoolSounds . addSound ( " mods/DimDoors/sfx/crack.ogg " , ( mod_pocketDim . class . getResource ( " /mods/DimDoors/sfx/crack.ogg " ) ) ) ;
event . manager . soundPoolSounds . addSound ( " mods/DimDoors/sfx/tearing.ogg " , ( mod_pocketDim . class . getResource ( " /mods/DimDoors/sfx/tearing.ogg " ) ) ) ;
2013-07-15 02:45:25 -04:00
event . manager . soundPoolSounds . addSound ( " mods/DimDoors/sfx/rift.ogg " , ( mod_pocketDim . class . getResource ( " /mods/DimDoors/sfx/rift.ogg " ) ) ) ;
event . manager . soundPoolSounds . addSound ( " mods/DimDoors/sfx/riftStart.ogg " , ( mod_pocketDim . class . getResource ( " /mods/DimDoors/sfx/riftStart.ogg " ) ) ) ;
event . manager . soundPoolSounds . addSound ( " mods/DimDoors/sfx/riftEnd.ogg " , ( mod_pocketDim . class . getResource ( " /mods/DimDoors/sfx/riftEnd.ogg " ) ) ) ;
event . manager . soundPoolSounds . addSound ( " mods/DimDoors/sfx/riftClose.ogg " , ( mod_pocketDim . class . getResource ( " /mods/DimDoors/sfx/riftClose.ogg " ) ) ) ;
event . manager . soundPoolSounds . addSound ( " mods/DimDoors/sfx/riftDoor.ogg " , ( mod_pocketDim . class . getResource ( " /mods/DimDoors/sfx/riftDoor.ogg " ) ) ) ;
2013-03-22 00:58:55 -04:00
}
2013-02-17 21:46:16 -05:00
@ForgeSubscribe
public void onWorldLoad ( WorldEvent . Load event )
{
2013-08-29 02:14:24 -04:00
RiftRegenerator . regenerateRiftsInAllWorlds ( ) ;
2013-02-17 21:46:16 -05:00
}
2013-07-11 20:42:57 -04:00
2013-02-17 21:46:16 -05:00
@ForgeSubscribe
public void onPlayerFall ( LivingFallEvent event )
{
2013-07-25 00:12:13 -04:00
event . setCanceled ( event . entity . worldObj . provider . dimensionId = = properties . LimboDimensionID ) ;
2013-02-17 21:46:16 -05:00
}
2013-07-11 20:42:57 -04:00
2013-02-17 21:46:16 -05:00
@ForgeSubscribe
public void onPlayerDrops ( PlayerDropsEvent event )
{
2013-07-25 00:12:13 -04:00
//TODO: I have some doubts. Is this triggered even if you die outside Limbo? And do you still drop items that others could pick up? We don't cancel the event. ~SenseiKiwi
2013-04-07 00:37:13 -04:00
mod_pocketDim . limboSpawnInventory . put ( event . entityPlayer . username , event . drops ) ;
2013-02-17 21:46:16 -05:00
}
@ForgeSubscribe
public void onWorldsave ( WorldEvent . Save event )
{
2013-08-29 02:14:24 -04:00
if ( PocketManager . isInitialized ( ) & & event . world . provider . dimensionId = = 0 )
2013-02-17 21:46:16 -05:00
{
2013-08-29 02:14:24 -04:00
PocketManager . save ( ) ;
2013-02-17 21:46:16 -05:00
}
}
}