mirror of
https://github.com/MinecraftForge/MinecraftForge.git
synced 2026-11-21 04:32:15 +00:00
More patchwork.
This commit is contained in:
1 parent
acb7acd661
commit
b6ddb0a7cf
52 files changed
+1614
-83
No files matched your search
@@ -62,6 +62,7 @@ import net.minecraft.util.text.ChatType;
|
||||
import net.minecraft.util.text.ITextComponent;
|
||||
import net.minecraft.village.Village;
|
||||
import net.minecraft.world.Explosion;
|
||||
import net.minecraft.world.IWorld;
|
||||
import net.minecraft.world.World;
|
||||
import net.minecraft.world.WorldServer;
|
||||
import net.minecraft.world.WorldSettings;
|
||||
@@ -191,13 +192,9 @@ public class ForgeEventFactory
|
||||
{
|
||||
Result result = canEntitySpawn(entity, world, x, y, z, spawner);
|
||||
if (result == Result.DEFAULT)
|
||||
{
|
||||
return entity.getCanSpawnHere() && entity.isNotColliding(); // vanilla logic
|
||||
}
|
||||
else
|
||||
{
|
||||
return result == Result.ALLOW;
|
||||
}
|
||||
}
|
||||
|
||||
public static boolean doSpecialSpawn(EntityLiving entity, World world, float x, float y, float z, MobSpawnerBaseLogic spawner)
|
||||
@@ -675,7 +672,7 @@ public class ForgeEventFactory
|
||||
return result == Result.DEFAULT ? def : result == Result.ALLOW;
|
||||
}
|
||||
|
||||
public static boolean onTrySpawnPortal(World world, BlockPos pos, BlockPortal.Size size)
|
||||
public static boolean onTrySpawnPortal(IWorld world, BlockPos pos, BlockPortal.Size size)
|
||||
{
|
||||
return MinecraftForge.EVENT_BUS.post(new BlockEvent.PortalSpawnEvent(world, pos, world.getBlockState(pos), size));
|
||||
}
|
||||
|
||||
@@ -27,6 +27,7 @@ import net.minecraftforge.common.MinecraftForge;
|
||||
import net.minecraftforge.eventbus.api.Cancelable;
|
||||
import net.minecraftforge.eventbus.api.Event.HasResult;
|
||||
import net.minecraft.util.math.BlockPos;
|
||||
import net.minecraft.world.IWorld;
|
||||
import net.minecraft.world.World;
|
||||
import net.minecraftforge.event.world.WorldEvent;
|
||||
|
||||
@@ -51,7 +52,7 @@ public class SaplingGrowTreeEvent extends WorldEvent
|
||||
private final BlockPos pos;
|
||||
private final Random rand;
|
||||
|
||||
public SaplingGrowTreeEvent(World world, Random rand, BlockPos pos)
|
||||
public SaplingGrowTreeEvent(IWorld world, Random rand, BlockPos pos)
|
||||
{
|
||||
super(world);
|
||||
this.rand = rand;
|
||||
|
||||
@@ -23,6 +23,7 @@ import java.util.Random;
|
||||
|
||||
import net.minecraft.util.math.BlockPos;
|
||||
import net.minecraft.util.math.ChunkPos;
|
||||
import net.minecraft.world.IWorld;
|
||||
import net.minecraft.world.World;
|
||||
import net.minecraft.world.gen.IChunkGenerator;
|
||||
import net.minecraftforge.common.MinecraftForge;
|
||||
@@ -107,7 +108,7 @@ public abstract class TerrainGen
|
||||
}
|
||||
*/
|
||||
|
||||
public static boolean saplingGrowTree(World world, Random rand, BlockPos pos)
|
||||
public static boolean saplingGrowTree(IWorld world, Random rand, BlockPos pos)
|
||||
{
|
||||
SaplingGrowTreeEvent event = new SaplingGrowTreeEvent(world, rand, pos);
|
||||
MinecraftForge.TERRAIN_GEN_BUS.post(event);
|
||||
|
||||
@@ -33,6 +33,7 @@ import net.minecraft.util.EnumHand;
|
||||
import net.minecraft.util.NonNullList;
|
||||
import net.minecraft.util.math.BlockPos;
|
||||
import net.minecraft.util.EnumFacing;
|
||||
import net.minecraft.world.IWorld;
|
||||
import net.minecraft.world.World;
|
||||
import net.minecraftforge.common.ForgeHooks;
|
||||
import net.minecraftforge.common.util.BlockSnapshot;
|
||||
@@ -49,17 +50,17 @@ public class BlockEvent extends Event
|
||||
{
|
||||
private static final boolean DEBUG = Boolean.parseBoolean(System.getProperty("forge.debugBlockEvent", "false"));
|
||||
|
||||
private final World world;
|
||||
private final IWorld world;
|
||||
private final BlockPos pos;
|
||||
private final IBlockState state;
|
||||
public BlockEvent(World world, BlockPos pos, IBlockState state)
|
||||
public BlockEvent(IWorld world, BlockPos pos, IBlockState state)
|
||||
{
|
||||
this.pos = pos;
|
||||
this.world = world;
|
||||
this.state = state;
|
||||
}
|
||||
|
||||
public World getWorld()
|
||||
public IWorld getWorld()
|
||||
{
|
||||
return world;
|
||||
}
|
||||
@@ -435,7 +436,7 @@ public class BlockEvent extends Event
|
||||
{
|
||||
private final BlockPortal.Size size;
|
||||
|
||||
public PortalSpawnEvent(World world, BlockPos pos, IBlockState state, BlockPortal.Size size)
|
||||
public PortalSpawnEvent(IWorld world, BlockPos pos, IBlockState state, BlockPortal.Size size)
|
||||
{
|
||||
super(world, pos, state);
|
||||
this.size = size;
|
||||
|
||||
@@ -33,6 +33,7 @@ import net.minecraft.server.integrated.IntegratedServer;
|
||||
import net.minecraft.util.IProgressUpdate;
|
||||
import net.minecraft.util.math.BlockPos;
|
||||
import net.minecraft.world.EnumDifficulty;
|
||||
import net.minecraft.world.IWorld;
|
||||
import net.minecraft.world.World;
|
||||
import net.minecraft.world.WorldServer;
|
||||
import net.minecraft.world.WorldSettings;
|
||||
@@ -51,14 +52,14 @@ import net.minecraftforge.eventbus.api.Event;
|
||||
**/
|
||||
public class WorldEvent extends Event
|
||||
{
|
||||
private final World world;
|
||||
private final IWorld world;
|
||||
|
||||
public WorldEvent(World world)
|
||||
public WorldEvent(IWorld world)
|
||||
{
|
||||
this.world = world;
|
||||
}
|
||||
|
||||
public World getWorld()
|
||||
public IWorld getWorld()
|
||||
{
|
||||
return world;
|
||||
}
|
||||
@@ -80,7 +81,7 @@ public class WorldEvent extends Event
|
||||
**/
|
||||
public static class Load extends WorldEvent
|
||||
{
|
||||
public Load(World world) { super(world); }
|
||||
public Load(IWorld world) { super(world); }
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -99,7 +100,7 @@ public class WorldEvent extends Event
|
||||
**/
|
||||
public static class Unload extends WorldEvent
|
||||
{
|
||||
public Unload(World world) { super(world); }
|
||||
public Unload(IWorld world) { super(world); }
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -116,7 +117,7 @@ public class WorldEvent extends Event
|
||||
**/
|
||||
public static class Save extends WorldEvent
|
||||
{
|
||||
public Save(World world) { super(world); }
|
||||
public Save(IWorld world) { super(world); }
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -134,7 +135,7 @@ public class WorldEvent extends Event
|
||||
private final BlockPos pos;
|
||||
private final List<SpawnListEntry> list;
|
||||
|
||||
public PotentialSpawns(World world, EnumCreatureType type, BlockPos pos, List<SpawnListEntry> oldList)
|
||||
public PotentialSpawns(IWorld world, EnumCreatureType type, BlockPos pos, List<SpawnListEntry> oldList)
|
||||
{
|
||||
super(world);
|
||||
this.pos = pos;
|
||||
@@ -173,7 +174,7 @@ public class WorldEvent extends Event
|
||||
public static class CreateSpawnPosition extends WorldEvent
|
||||
{
|
||||
private final WorldSettings settings;
|
||||
public CreateSpawnPosition(World world, WorldSettings settings)
|
||||
public CreateSpawnPosition(IWorld world, WorldSettings settings)
|
||||
{
|
||||
super(world);
|
||||
this.settings = settings;
|
||||
|
||||
Reference in new issue
Block a user