Initial 1.13.2 update. Major thing to note is that Dimensions have been completely revamped.

DimensionType is not unique per Dimension. See DimensionManager for more details.
Vanilla now has a chunk loading system, so Forge's will need to be deprecated/adapted.
This commit is contained in:
LexManos committed 2019-02-14 15:08:53 -08:00
1 parent 9a1688599a
commit ca72710937
361 files changed
+3166 -3547

No files matched your search

@@ -175,7 +175,7 @@ public class ForgeEventFactory
MinecraftForge.EVENT_BUS.post(new PlayerDestroyItemEvent(player, stack, hand));
}
public static Result canEntitySpawn(EntityLiving entity, IWorld world, float x, float y, float z, MobSpawnerBaseLogic spawner)
public static Result canEntitySpawn(EntityLiving entity, IWorld world, double x, double y, double z, MobSpawnerBaseLogic spawner)
{
if (entity == null)
return Result.DEFAULT;
@@ -188,7 +188,7 @@ public class ForgeEventFactory
{
Result result = canEntitySpawn(entity, world, x, y, z, spawner);
if (result == Result.DEFAULT)
return entity.getCanSpawnHere() && entity.isNotColliding(); // vanilla logic
return entity.canSpawn(world, true) && entity.isNotColliding(); // vanilla logic
else
return result == Result.ALLOW;
}
@@ -20,6 +20,7 @@
package net.minecraftforge.event.entity;
import net.minecraft.entity.Entity;
import net.minecraft.world.dimension.DimensionType;
import net.minecraftforge.common.MinecraftForge;
import net.minecraftforge.eventbus.api.Cancelable;
import net.minecraftforge.eventbus.api.Event.HasResult;
@@ -39,15 +40,15 @@ import net.minecraftforge.eventbus.api.Event.HasResult;
@Cancelable
public class EntityTravelToDimensionEvent extends EntityEvent
{
private final int dimension;
private final DimensionType dimension;
public EntityTravelToDimensionEvent(Entity entity, int dimension)
public EntityTravelToDimensionEvent(Entity entity, DimensionType dimension)
{
super(entity);
this.dimension = dimension;
}
public int getDimension()
public DimensionType getDimension()
{
return dimension;
}
@@ -45,11 +45,11 @@ import net.minecraftforge.eventbus.api.Event.HasResult;
public class LivingSpawnEvent extends LivingEvent
{
private final IWorld world;
private final float x;
private final float y;
private final float z;
private final double x;
private final double y;
private final double z;
public LivingSpawnEvent(EntityLiving entity, IWorld world, float x, float y, float z)
public LivingSpawnEvent(EntityLiving entity, IWorld world, double x, double y, double z)
{
super(entity);
this.world = world;
@@ -59,9 +59,9 @@ public class LivingSpawnEvent extends LivingEvent
}
public IWorld getWorld() { return world; }
public float getX() { return x; }
public float getY() { return y; }
public float getZ() { return z; }
public double getX() { return x; }
public double getY() { return y; }
public double getZ() { return z; }
/**
* Fires before mob spawn events.
*
@@ -87,7 +87,7 @@ public class LivingSpawnEvent extends LivingEvent
* @param spawner position of the MobSpawner
* null if it this spawn is coming from a WorldSpawner
*/
public CheckSpawn(EntityLiving entity, IWorld world, float x, float y, float z, @Nullable MobSpawnerBaseLogic spawner)
public CheckSpawn(EntityLiving entity, IWorld world, double x, double y, double z, @Nullable MobSpawnerBaseLogic spawner)
{
super(entity, world, x, y, z);
this.spawner = spawner;
@@ -127,7 +127,7 @@ public class LivingSpawnEvent extends LivingEvent
/**
* @param spawner the position of a tileentity or approximate position of an entity that initiated the spawn if any
*/
public SpecialSpawn(EntityLiving entity, World world, float x, float y, float z, @Nullable MobSpawnerBaseLogic spawner)
public SpecialSpawn(EntityLiving entity, World world, double x, double y, double z, @Nullable MobSpawnerBaseLogic spawner)
{
super(entity, world, x, y, z);
this.spawner = spawner;
@@ -158,7 +158,7 @@ public class LivingSpawnEvent extends LivingEvent
{
public AllowDespawn(EntityLiving entity)
{
super(entity, entity.world, (float)entity.posX, (float)entity.posY, (float)entity.posZ);
super(entity, entity.world, entity.posX, entity.posY, entity.posZ);
}
}
@@ -0,0 +1,59 @@
/*
* Minecraft Forge
* Copyright (c) 2016-2019.
*
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public
* License as published by the Free Software Foundation version 2.1
* of the License.
*
* This library is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* Lesser General Public License for more details.
*
* You should have received a copy of the GNU Lesser General Public
* License along with this library; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
*/
package net.minecraftforge.event.world;
import java.util.Collections;
import java.util.Map;
import java.util.Set;
import javax.annotation.Nullable;
import net.minecraft.util.ResourceLocation;
import net.minecraftforge.common.DimensionManager.SavedEntry;
import net.minecraftforge.eventbus.api.Event;
/**
* Register all of your custom ModDimensons here, fired during server loading when
* dimension data is read from the world file.
*
* Contains a list of missing entries. Registering an entry with the DimensionManger
* will remove the matching entry from the missing list.
*/
public class RegisterDimensionsEvent extends Event
{
private final Map<ResourceLocation, SavedEntry> missing;
private final Set<ResourceLocation> keys;
public RegisterDimensionsEvent(Map<ResourceLocation, SavedEntry> missing)
{
this.missing = missing;
this.keys = Collections.unmodifiableSet(this.missing.keySet());
}
public Set<ResourceLocation> getMissingNames()
{
return keys;
}
@Nullable
public SavedEntry getEntry(ResourceLocation key)
{
return missing.get(key);
}
}