More moves and compilation fixes
This commit is contained in:
@@ -321,14 +321,14 @@ public class CachedPlane {
|
||||
|
||||
// FIXME this was sending chunks to players...
|
||||
SChunkDataPacket cdp = new SChunkDataPacket(c, verticalBits);
|
||||
((ServerChunkProvider) world.getChunkProvider()).chunkManager.getTrackingPlayers(c.getPos(), false)
|
||||
((ServerChunkProvider) world.getChunkManager()).chunkManager.getTrackingPlayers(c.getPos(), false)
|
||||
.forEach(spe -> spe.connection.sendPacket(cdp));
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
// FIXME check if this makes any sense at all to send changes to players asap
|
||||
ServerChunkProvider serverChunkProvider = (ServerChunkProvider) world.getChunkProvider();
|
||||
ServerChunkProvider serverChunkProvider = (ServerChunkProvider) world.getChunkManager();
|
||||
serverChunkProvider.tick(() -> false);
|
||||
}
|
||||
|
||||
|
||||
@@ -47,7 +47,7 @@ public class DefaultSpatialHandler implements IMovableHandler {
|
||||
final Chunk c = w.getChunkAt(newPosition);
|
||||
c.addTileEntity(newPosition, te);
|
||||
|
||||
if (w.getChunkProvider().isChunkLoaded(c.getPos())) {
|
||||
if (w.getChunkManager().isChunkLoaded(c.getPos())) {
|
||||
final BlockState state = w.getBlockState(newPosition);
|
||||
w.addTileEntity(te);
|
||||
w.updateListeners(newPosition, state, state, 1);
|
||||
|
||||
@@ -25,7 +25,7 @@ import net.minecraft.world.World;
|
||||
import net.minecraft.world.biome.provider.BiomeProvider;
|
||||
import net.minecraft.world.biome.provider.SingleBiomeProvider;
|
||||
import net.minecraft.world.biome.provider.SingleBiomeProviderSettings;
|
||||
import net.minecraft.world.chunk.IChunk;
|
||||
import net.minecraft.world.chunk.Chunk;
|
||||
import net.minecraft.world.gen.ChunkGenerator;
|
||||
import net.minecraft.world.gen.GenerationSettings;
|
||||
import net.minecraft.world.gen.Heightmap;
|
||||
@@ -53,12 +53,12 @@ public class StorageChunkGenerator extends ChunkGenerator<GenerationSettings> {
|
||||
}
|
||||
|
||||
@Override
|
||||
public void generateSurface(WorldGenRegion region, IChunk chunk) {
|
||||
public void generateSurface(WorldGenRegion region, Chunk chunk) {
|
||||
this.fillChunk(chunk);
|
||||
chunk.setModified(false);
|
||||
}
|
||||
|
||||
private void fillChunk(IChunk chunk) {
|
||||
private void fillChunk(Chunk chunk) {
|
||||
BlockPos.Mutable mutPos = new BlockPos.Mutable();
|
||||
for (int cx = 0; cx < 16; cx++) {
|
||||
mutPos.setX(cx);
|
||||
@@ -80,7 +80,7 @@ public class StorageChunkGenerator extends ChunkGenerator<GenerationSettings> {
|
||||
}
|
||||
|
||||
@Override
|
||||
public void makeBase(WorldAccess worldIn, IChunk chunkIn) {
|
||||
public void makeBase(WorldAccess worldIn, Chunk chunkIn) {
|
||||
}
|
||||
|
||||
@Override
|
||||
|
||||
@@ -20,7 +20,6 @@ package appeng.spatial;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
import java.util.function.Function;
|
||||
|
||||
import net.minecraft.block.Block;
|
||||
import net.minecraft.block.BlockState;
|
||||
@@ -33,7 +32,6 @@ import net.minecraft.util.math.MathHelper;
|
||||
import net.minecraft.world.World;
|
||||
import net.minecraft.world.chunk.ChunkStatus;
|
||||
import net.minecraft.server.world.ServerWorld;
|
||||
import net.minecraftforge.common.util.ITeleporter;
|
||||
|
||||
import appeng.api.AEApi;
|
||||
import appeng.api.util.WorldCoord;
|
||||
@@ -64,7 +62,7 @@ public class StorageHelper {
|
||||
|
||||
try {
|
||||
oldWorld = (ServerWorld) entity.world;
|
||||
newWorld = (ServerWorld) link.dim;
|
||||
newWorld = link.dim;
|
||||
} catch (final Throwable e) {
|
||||
return entity;
|
||||
}
|
||||
@@ -80,12 +78,12 @@ public class StorageHelper {
|
||||
}
|
||||
|
||||
// Are we riding something? Teleport it instead.
|
||||
if (entity.isPassenger()) {
|
||||
return this.teleportEntity(entity.getRidingEntity(), link);
|
||||
if (entity.hasVehicle()) {
|
||||
return this.teleportEntity(entity.getVehicle(), link);
|
||||
}
|
||||
|
||||
// Is something riding us? Handle it first.
|
||||
final List<Entity> passengers = entity.getPassengers();
|
||||
final List<Entity> passengers = entity.getPassengerList();
|
||||
final List<Entity> passengersOnOtherSide = new ArrayList<>(passengers.size());
|
||||
for (Entity passenger : passengers) {
|
||||
passenger.stopRiding();
|
||||
@@ -94,14 +92,19 @@ public class StorageHelper {
|
||||
// We keep track of all so we can remount them on the other side.
|
||||
|
||||
// load the chunk!
|
||||
newWorld.getChunkProvider().getChunk(MathHelper.floor(link.x) >> 4, MathHelper.floor(link.z) >> 4,
|
||||
newWorld.getChunkManager().getChunk(MathHelper.floor(link.x) >> 4, MathHelper.floor(link.z) >> 4,
|
||||
ChunkStatus.FULL, true);
|
||||
|
||||
if (entity instanceof ServerPlayerEntity && link.dim.getDimension() instanceof StorageCellDimension) {
|
||||
AppEng.instance().getAdvancementTriggers().getSpatialExplorer().trigger((ServerPlayerEntity) entity);
|
||||
}
|
||||
|
||||
entity.changeDimension(link.dim.getDimension().getType(), new METeleporter(link));
|
||||
// FIXME FABRIC new METeleporter(link)
|
||||
float yaw = entity.yaw;
|
||||
entity = entity.changeDimension(link.dim);
|
||||
entity.yaw = yaw;
|
||||
entity.refreshPositionAfterTeleport(link.x, link.y, link.z);
|
||||
entity.setVelocity(0, 0, 0);
|
||||
|
||||
if (!passengersOnOtherSide.isEmpty()) {
|
||||
for (Entity passanger : passengersOnOtherSide) {
|
||||
@@ -136,7 +139,7 @@ public class StorageHelper {
|
||||
}
|
||||
}
|
||||
|
||||
public void swapRegions(final World srcWorld, final int srcX, final int srcY, final int srcZ, final World dstWorld,
|
||||
public void swapRegions(final ServerWorld srcWorld, final int srcX, final int srcY, final int srcZ, final ServerWorld dstWorld,
|
||||
final int dstX, final int dstY, final int dstZ, final int scaleX, final int scaleY, final int scaleZ) {
|
||||
AEApi.instance().definitions().blocks().matrixFrame().maybeBlock()
|
||||
.ifPresent(matrixFrameBlock -> this.transverseEdges(dstX - 1, dstY - 1, dstZ - 1, dstX + scaleX + 1,
|
||||
@@ -157,8 +160,8 @@ public class StorageHelper {
|
||||
// do nearly all the work... swaps blocks, tiles, and block ticks
|
||||
cSrc.swap(cDst);
|
||||
|
||||
final List<Entity> srcE = srcWorld.getEntitiesWithinAABB(Entity.class, srcBox);
|
||||
final List<Entity> dstE = dstWorld.getEntitiesWithinAABB(Entity.class, dstBox);
|
||||
final List<Entity> srcE = srcWorld.getEntitiesIncludingUngeneratedChunks(Entity.class, srcBox);
|
||||
final List<Entity> dstE = dstWorld.getEntitiesIncludingUngeneratedChunks(Entity.class, dstBox);
|
||||
|
||||
for (final Entity e : dstE) {
|
||||
this.teleportEntity(e, new TelDestination(srcWorld, srcBox, e.getX(), e.getY(), e.getZ(),
|
||||
@@ -222,12 +225,12 @@ public class StorageHelper {
|
||||
}
|
||||
|
||||
private static class TelDestination {
|
||||
private final World dim;
|
||||
private final ServerWorld dim;
|
||||
private final double x;
|
||||
private final double y;
|
||||
private final double z;
|
||||
|
||||
TelDestination(final World dimension, final Box srcBox, final double x, final double y,
|
||||
TelDestination(final ServerWorld dimension, final Box srcBox, final double x, final double y,
|
||||
final double z, final int tileX, final int tileY, final int tileZ) {
|
||||
this.dim = dimension;
|
||||
this.x = Math.min(srcBox.maxX - 0.5, Math.max(srcBox.minX + 0.5, x + tileX));
|
||||
@@ -236,22 +239,4 @@ public class StorageHelper {
|
||||
}
|
||||
}
|
||||
|
||||
private static class METeleporter implements ITeleporter {
|
||||
|
||||
private final TelDestination destination;
|
||||
|
||||
METeleporter(final TelDestination d) {
|
||||
this.destination = d;
|
||||
}
|
||||
|
||||
@Override
|
||||
public Entity placeEntity(Entity entity, ServerWorld currentWorld, ServerWorld destWorld, float yaw,
|
||||
Function<Boolean, Entity> repositionEntity) {
|
||||
Entity newEntity = repositionEntity.apply(false);
|
||||
newEntity.yaw = yaw;
|
||||
newEntity.setPositionAndUpdate(this.destination.x, this.destination.y, this.destination.z);
|
||||
newEntity.setMotion(0, 0, 0);
|
||||
return newEntity;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user