Added spotless back and reformatted
This commit is contained in:
@@ -18,13 +18,10 @@
|
||||
|
||||
package appeng.spatial;
|
||||
|
||||
import appeng.core.Api;
|
||||
import appeng.api.movable.IMovableHandler;
|
||||
import appeng.api.movable.IMovableRegistry;
|
||||
import appeng.api.util.AEPartLocation;
|
||||
import appeng.api.util.WorldCoord;
|
||||
import appeng.core.AELog;
|
||||
import appeng.core.worlddata.WorldData;
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
import java.util.Set;
|
||||
|
||||
import net.minecraft.block.Block;
|
||||
import net.minecraft.block.BlockState;
|
||||
import net.minecraft.block.Blocks;
|
||||
@@ -42,9 +39,13 @@ import net.minecraft.world.chunk.Chunk;
|
||||
import net.minecraft.world.chunk.ChunkSection;
|
||||
import net.minecraft.world.chunk.WorldChunk;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
import java.util.Set;
|
||||
import appeng.api.movable.IMovableHandler;
|
||||
import appeng.api.movable.IMovableRegistry;
|
||||
import appeng.api.util.AEPartLocation;
|
||||
import appeng.api.util.WorldCoord;
|
||||
import appeng.core.AELog;
|
||||
import appeng.core.Api;
|
||||
import appeng.core.worlddata.WorldData;
|
||||
|
||||
public class CachedPlane {
|
||||
private final int x_size;
|
||||
@@ -159,8 +160,8 @@ public class CachedPlane {
|
||||
final BlockPos tePOS = entry.pos;
|
||||
if (tePOS.getX() >= minX && tePOS.getX() <= maxX && tePOS.getY() >= minY && tePOS.getY() <= maxY
|
||||
&& tePOS.getZ() >= minZ && tePOS.getZ() <= maxZ) {
|
||||
this.ticks.add(new ScheduledTick<>(tePOS, entry.getObject(),
|
||||
entry.time - gameTime, entry.priority));
|
||||
this.ticks.add(new ScheduledTick<>(tePOS, entry.getObject(), entry.time - gameTime,
|
||||
entry.priority));
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -264,8 +265,7 @@ public class CachedPlane {
|
||||
|
||||
private void addTick(final int x, final int y, final int z, final ScheduledTick<Block> entry) {
|
||||
BlockPos where = new BlockPos(x + this.x_offset, y + this.y_offset, z + this.z_offset);
|
||||
this.world.getBlockTickScheduler().schedule(where, entry.getObject(), (int) entry.time,
|
||||
entry.priority);
|
||||
this.world.getBlockTickScheduler().schedule(where, entry.getObject(), (int) entry.time, entry.priority);
|
||||
}
|
||||
|
||||
private void addTile(final int x, final int y, final int z, final BlockEntity te,
|
||||
@@ -320,8 +320,8 @@ public class CachedPlane {
|
||||
|
||||
// FIXME this was sending chunks to players...
|
||||
ChunkDataS2CPacket cdp = new ChunkDataS2CPacket(c, verticalBits, false);
|
||||
((ServerChunkManager) world.getChunkManager()).threadedAnvilChunkStorage.getPlayersWatchingChunk(c.getPos(), false)
|
||||
.forEach(spe -> spe.networkHandler.sendPacket(cdp));
|
||||
((ServerChunkManager) world.getChunkManager()).threadedAnvilChunkStorage
|
||||
.getPlayersWatchingChunk(c.getPos(), false).forEach(spe -> spe.networkHandler.sendPacket(cdp));
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
@@ -18,11 +18,11 @@
|
||||
|
||||
package appeng.spatial;
|
||||
|
||||
import appeng.api.storage.ISpatialDimension;
|
||||
import appeng.core.AELog;
|
||||
import appeng.core.AppEng;
|
||||
import appeng.core.localization.GuiText;
|
||||
import appeng.hooks.DynamicDimensions;
|
||||
import java.util.List;
|
||||
import java.util.Locale;
|
||||
|
||||
import javax.annotation.Nullable;
|
||||
|
||||
import net.minecraft.client.render.SkyProperties;
|
||||
import net.minecraft.server.MinecraftServer;
|
||||
import net.minecraft.server.world.ServerWorld;
|
||||
@@ -35,9 +35,11 @@ import net.minecraft.util.registry.RegistryKey;
|
||||
import net.minecraft.world.World;
|
||||
import net.minecraft.world.dimension.DimensionType;
|
||||
|
||||
import javax.annotation.Nullable;
|
||||
import java.util.List;
|
||||
import java.util.Locale;
|
||||
import appeng.api.storage.ISpatialDimension;
|
||||
import appeng.core.AELog;
|
||||
import appeng.core.AppEng;
|
||||
import appeng.core.localization.GuiText;
|
||||
import appeng.hooks.DynamicDimensions;
|
||||
|
||||
public final class SpatialDimensionManager implements ISpatialDimension {
|
||||
|
||||
@@ -46,15 +48,11 @@ public final class SpatialDimensionManager implements ISpatialDimension {
|
||||
// we move the origin to the middle of region 0,0
|
||||
public static final BlockPos REGION_CENTER = new BlockPos(512 / 2, 64, 512 / 2);
|
||||
|
||||
public static final RegistryKey<DimensionType> STORAGE_DIMENSION_TYPE = RegistryKey.of(Registry.DIMENSION_TYPE_KEY, AppEng.makeId("storage_cell"));
|
||||
public static final RegistryKey<DimensionType> STORAGE_DIMENSION_TYPE = RegistryKey.of(Registry.DIMENSION_TYPE_KEY,
|
||||
AppEng.makeId("storage_cell"));
|
||||
|
||||
public static final SkyProperties STORAGE_SKY = new SkyProperties(
|
||||
Float.NaN /* disables clouds */,
|
||||
false,
|
||||
SkyProperties.SkyType.NONE /* we use a custom render mixin */,
|
||||
true,
|
||||
false
|
||||
) {
|
||||
public static final SkyProperties STORAGE_SKY = new SkyProperties(Float.NaN /* disables clouds */, false,
|
||||
SkyProperties.SkyType.NONE /* we use a custom render mixin */, true, false) {
|
||||
@Override
|
||||
public Vec3d adjustSkyColor(Vec3d color, float sunHeight) {
|
||||
return Vec3d.ZERO;
|
||||
@@ -96,7 +94,8 @@ public final class SpatialDimensionManager implements ISpatialDimension {
|
||||
|
||||
ServerWorld world = dynamicDimensions.addWorld(worldId, STORAGE_DIMENSION_TYPE, StorageChunkGenerator.INSTANCE);
|
||||
|
||||
SpatialDimensionExtraData spatialExtraData = world.getPersistentStateManager().getOrCreate(SpatialDimensionExtraData::new, SpatialDimensionExtraData.ID);
|
||||
SpatialDimensionExtraData spatialExtraData = world.getPersistentStateManager()
|
||||
.getOrCreate(SpatialDimensionExtraData::new, SpatialDimensionExtraData.ID);
|
||||
spatialExtraData.setSize(size);
|
||||
|
||||
return worldId;
|
||||
|
||||
@@ -30,15 +30,12 @@ public class StorageCellBiome extends Biome {
|
||||
public static final StorageCellBiome INSTANCE = new StorageCellBiome();
|
||||
|
||||
public StorageCellBiome() {
|
||||
super(new Biome.Settings().surfaceBuilder(new ConfiguredSurfaceBuilder<>(SurfaceBuilder.NOPE, SurfaceBuilder.STONE_CONFIG))
|
||||
super(new Biome.Settings()
|
||||
.surfaceBuilder(new ConfiguredSurfaceBuilder<>(SurfaceBuilder.NOPE, SurfaceBuilder.STONE_CONFIG))
|
||||
.precipitation(Precipitation.NONE).category(Category.NONE).depth(0).scale(1)
|
||||
// Copied from the vanilla void biome
|
||||
.temperature(0.5F).downfall(0.5F)
|
||||
.effects(new BiomeEffects.Builder()
|
||||
.waterColor(4159204)
|
||||
.waterFogColor(329011)
|
||||
.fogColor(0)
|
||||
.build())
|
||||
.effects(new BiomeEffects.Builder().waterColor(4159204).waterFogColor(329011).fogColor(0).build())
|
||||
.parent(null));
|
||||
}
|
||||
|
||||
|
||||
@@ -18,9 +18,13 @@
|
||||
|
||||
package appeng.spatial;
|
||||
|
||||
import appeng.core.Api;
|
||||
import java.util.Arrays;
|
||||
import java.util.Collections;
|
||||
import java.util.Optional;
|
||||
|
||||
import com.mojang.serialization.Codec;
|
||||
import com.mojang.serialization.codecs.RecordCodecBuilder;
|
||||
|
||||
import net.minecraft.block.BlockState;
|
||||
import net.minecraft.util.math.BlockPos;
|
||||
import net.minecraft.world.BlockView;
|
||||
@@ -37,9 +41,7 @@ import net.minecraft.world.gen.chunk.ChunkGenerator;
|
||||
import net.minecraft.world.gen.chunk.StructuresConfig;
|
||||
import net.minecraft.world.gen.chunk.VerticalBlockSample;
|
||||
|
||||
import java.util.Arrays;
|
||||
import java.util.Collections;
|
||||
import java.util.Optional;
|
||||
import appeng.core.Api;
|
||||
|
||||
public class StorageChunkGenerator extends ChunkGenerator {
|
||||
|
||||
@@ -47,8 +49,8 @@ public class StorageChunkGenerator extends ChunkGenerator {
|
||||
|
||||
public static final StorageChunkGenerator INSTANCE = new StorageChunkGenerator();
|
||||
|
||||
public static final Codec<StorageChunkGenerator> CODEC = RecordCodecBuilder.create((instance) ->
|
||||
instance.stable(INSTANCE));
|
||||
public static final Codec<StorageChunkGenerator> CODEC = RecordCodecBuilder
|
||||
.create((instance) -> instance.stable(INSTANCE));
|
||||
|
||||
private final BlockState defaultBlockState;
|
||||
|
||||
@@ -56,7 +58,8 @@ public class StorageChunkGenerator extends ChunkGenerator {
|
||||
super(createBiomeProvider(), createSettings());
|
||||
this.defaultBlockState = Api.instance().definitions().blocks().matrixFrame().block().getDefaultState();
|
||||
|
||||
// Vertical sample is mostly used for Feature generation, for those purposes we're all filled with matrix blocks
|
||||
// Vertical sample is mostly used for Feature generation, for those purposes
|
||||
// we're all filled with matrix blocks
|
||||
BlockState[] columnSample = new BlockState[256];
|
||||
Arrays.fill(columnSample, this.defaultBlockState);
|
||||
this.columnSample = new VerticalBlockSample(columnSample);
|
||||
|
||||
@@ -18,9 +18,9 @@
|
||||
|
||||
package appeng.spatial;
|
||||
|
||||
import appeng.core.Api;
|
||||
import appeng.api.util.WorldCoord;
|
||||
import appeng.core.AppEng;
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
|
||||
import net.minecraft.block.Block;
|
||||
import net.minecraft.block.BlockState;
|
||||
import net.minecraft.block.Blocks;
|
||||
@@ -36,8 +36,6 @@ import net.minecraft.world.World;
|
||||
import net.minecraft.world.chunk.ChunkStatus;
|
||||
import net.minecraft.world.dimension.DimensionType;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
import appeng.api.util.WorldCoord;
|
||||
import appeng.core.Api;
|
||||
import appeng.core.AppEng;
|
||||
@@ -100,7 +98,8 @@ public class StorageHelper {
|
||||
newWorld.getChunkManager().getChunk(MathHelper.floor(link.x) >> 4, MathHelper.floor(link.z) >> 4,
|
||||
ChunkStatus.FULL, true);
|
||||
|
||||
if (entity instanceof ServerPlayerEntity && link.dim.getDimensionRegistryKey().equals(SpatialDimensionManager.STORAGE_DIMENSION_TYPE)) {
|
||||
if (entity instanceof ServerPlayerEntity
|
||||
&& link.dim.getDimensionRegistryKey().equals(SpatialDimensionManager.STORAGE_DIMENSION_TYPE)) {
|
||||
AppEng.instance().getAdvancementTriggers().getSpatialExplorer().trigger((ServerPlayerEntity) entity);
|
||||
}
|
||||
|
||||
@@ -144,18 +143,17 @@ public class StorageHelper {
|
||||
}
|
||||
}
|
||||
|
||||
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) {
|
||||
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) {
|
||||
Api.instance().definitions().blocks().matrixFrame().maybeBlock()
|
||||
.ifPresent(matrixFrameBlock -> this.transverseEdges(dstX - 1, dstY - 1, dstZ - 1, dstX + scaleX + 1,
|
||||
dstY + scaleY + 1, dstZ + scaleZ + 1,
|
||||
new WrapInMatrixFrame(matrixFrameBlock.getDefaultState(), dstWorld)));
|
||||
|
||||
final Box srcBox = new Box(srcX, srcY, srcZ, srcX + scaleX + 1, srcY + scaleY + 1,
|
||||
srcZ + scaleZ + 1);
|
||||
final Box srcBox = new Box(srcX, srcY, srcZ, srcX + scaleX + 1, srcY + scaleY + 1, srcZ + scaleZ + 1);
|
||||
|
||||
final Box dstBox = new Box(dstX, dstY, dstZ, dstX + scaleX + 1, dstY + scaleY + 1,
|
||||
dstZ + scaleZ + 1);
|
||||
final Box dstBox = new Box(dstX, dstY, dstZ, dstX + scaleX + 1, dstY + scaleY + 1, dstZ + scaleZ + 1);
|
||||
|
||||
final CachedPlane cDst = new CachedPlane(dstWorld, dstX, dstY, dstZ, dstX + scaleX, dstY + scaleY,
|
||||
dstZ + scaleZ);
|
||||
@@ -169,13 +167,13 @@ public class StorageHelper {
|
||||
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(),
|
||||
-dstX + srcX, -dstY + srcY, -dstZ + srcZ));
|
||||
this.teleportEntity(e, new TelDestination(srcWorld, srcBox, e.getX(), e.getY(), e.getZ(), -dstX + srcX,
|
||||
-dstY + srcY, -dstZ + srcZ));
|
||||
}
|
||||
|
||||
for (final Entity e : srcE) {
|
||||
this.teleportEntity(e, new TelDestination(dstWorld, dstBox, e.getX(), e.getY(), e.getZ(),
|
||||
-srcX + dstX, -srcY + dstY, -srcZ + dstZ));
|
||||
this.teleportEntity(e, new TelDestination(dstWorld, dstBox, e.getX(), e.getY(), e.getZ(), -srcX + dstX,
|
||||
-srcY + dstY, -srcZ + dstZ));
|
||||
}
|
||||
|
||||
for (final WorldCoord wc : cDst.getUpdates()) {
|
||||
@@ -235,8 +233,8 @@ public class StorageHelper {
|
||||
private final double y;
|
||||
private final double z;
|
||||
|
||||
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) {
|
||||
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));
|
||||
this.y = Math.min(srcBox.maxY - 0.5, Math.max(srcBox.minY + 0.5, y + tileY));
|
||||
|
||||
Reference in New Issue
Block a user