mirror of
https://github.com/MinecraftForge/MinecraftForge.git
synced 2026-11-13 16:54:22 +00:00
Added CreateSpawnPosition event.
This commit is contained in:
1 parent
0c11a1544f
commit
f2b1622355
3 files changed
+37
-6
No files matched your search
@@ -27,6 +27,7 @@ import net.minecraft.util.Vec3;
|
||||
import net.minecraft.world.Explosion;
|
||||
import net.minecraft.world.World;
|
||||
import net.minecraft.world.WorldServer;
|
||||
import net.minecraft.world.WorldSettings;
|
||||
import net.minecraft.world.biome.BiomeGenBase;
|
||||
import net.minecraft.world.storage.IPlayerFileData;
|
||||
import net.minecraft.world.storage.SaveHandler;
|
||||
@@ -372,4 +373,9 @@ public class ForgeEventFactory
|
||||
*/
|
||||
MinecraftForge.EVENT_BUS.post(new ExplosionEvent.Detonate(world, explosion, list));
|
||||
}
|
||||
|
||||
public static boolean onCreateWorldSpawn(World world, WorldSettings settings)
|
||||
{
|
||||
return MinecraftForge.EVENT_BUS.post(new WorldEvent.CreateSpawnPosition(world, settings));
|
||||
}
|
||||
}
|
||||
@@ -2,9 +2,11 @@ package net.minecraftforge.event.world;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
|
||||
import net.minecraft.entity.EnumCreatureType;
|
||||
import net.minecraft.util.BlockPos;
|
||||
import net.minecraft.world.World;
|
||||
import net.minecraft.world.WorldSettings;
|
||||
import net.minecraft.world.biome.BiomeGenBase.SpawnListEntry;
|
||||
import net.minecraftforge.fml.common.eventhandler.Cancelable;
|
||||
import net.minecraftforge.fml.common.eventhandler.Event;
|
||||
@@ -109,4 +111,19 @@ public class WorldEvent extends Event
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Called by WorldServer when it attempts to create a spawnpoint for a dimension.
|
||||
* Canceling the event will prevent the vanilla code from running.
|
||||
*/
|
||||
@Cancelable
|
||||
public static class CreateSpawnPosition extends WorldEvent
|
||||
{
|
||||
public final WorldSettings settings;
|
||||
public CreateSpawnPosition(World world, WorldSettings settings)
|
||||
{
|
||||
super(world);
|
||||
this.settings = settings;
|
||||
}
|
||||
}
|
||||
}
|
||||
Reference in new issue
Block a user