mirror of
https://github.com/MinecraftForge/MinecraftForge.git
synced 2026-11-12 08:17:35 +00:00
Reimplement ITeleporter Patches (#6886)
This commit is contained in:
1 parent
a567ddaa10
commit
91a2b02590
9 files changed
+151
-33
No files matched your search
@@ -42,8 +42,7 @@ public interface ITeleporter {
|
||||
*
|
||||
* The initial position of the entity will be its
|
||||
* position in the origin world, multiplied horizontally
|
||||
* by the computed cross-dimensional movement factor
|
||||
* (see {@link Dimension#getMovementFactor()}).
|
||||
* by the computed cross-dimensional movement factor.
|
||||
*
|
||||
* Note that the supplied entity has not yet been spawned
|
||||
* in the destination world at the time.
|
||||
@@ -53,7 +52,7 @@ public interface ITeleporter {
|
||||
* @param destWorld the entity's destination
|
||||
* @param yaw the suggested yaw value to apply
|
||||
* @param repositionEntity a function to reposition the entity, which returns the new entity in the new dimension. This is the vanilla implementation of the dimension travel logic. If the supplied boolean is true, it is attempted to spawn a new portal.
|
||||
* @return the entity in the new World. Vanilla creates for most {@link Entity}s a new instance and copy the data. But <b>you are not allowed</b> to create a new instance for {@link PlayerEntity}s! Move the player and update its state, see {@link ServerPlayerEntity#changeDimension(net.minecraft.world.dimension.DimensionType, ITeleporter)}
|
||||
* @return the entity in the new World. Vanilla creates for most {@link Entity}s a new instance and copy the data. But <b>you are not allowed</b> to create a new instance for {@link PlayerEntity}s! Move the player and update its state, see {@link ServerPlayerEntity#changeDimension(net.minecraft.world.server.ServerWorld, ITeleporter)}
|
||||
*/
|
||||
default Entity placeEntity(Entity entity, ServerWorld currentWorld, ServerWorld destWorld, float yaw, Function<Boolean, Entity> repositionEntity) {
|
||||
return repositionEntity.apply(true);
|
||||
|
||||
@@ -66,7 +66,7 @@ public class CommandSetDimension
|
||||
// throw INVALID_DIMENSION.create(dim);
|
||||
|
||||
entities.stream().filter(e -> e.world == dim).forEach(e -> sender.sendFeedback(new TranslationTextComponent("commands.forge.setdim.invalid.nochange", e.getDisplayName().getString(), dim), true));
|
||||
entities.stream().filter(e -> e.world != dim).forEach(e -> e.func_241206_a_(dim/* TODO: Custom Teleporters , new ITeleporter()
|
||||
entities.stream().filter(e -> e.world != dim).forEach(e -> e.changeDimension(dim , new ITeleporter()
|
||||
{
|
||||
@Override
|
||||
public Entity placeEntity(Entity entity, ServerWorld currentWorld, ServerWorld destWorld, float yaw, Function<Boolean, Entity> repositionEntity)
|
||||
@@ -75,7 +75,7 @@ public class CommandSetDimension
|
||||
repositionedEntity.setPositionAndUpdate(pos.getX(), pos.getY(), pos.getZ());
|
||||
return repositionedEntity;
|
||||
}
|
||||
}*/));
|
||||
}));
|
||||
|
||||
|
||||
return 0;
|
||||
|
||||
Reference in new issue
Block a user