Reformat
This commit is contained in:
@@ -39,6 +39,7 @@ import net.minecraft.world.World;
|
||||
import net.minecraft.world.chunk.Chunk;
|
||||
import net.minecraft.world.chunk.ChunkSection;
|
||||
import net.minecraft.world.chunk.WorldChunk;
|
||||
import net.minecraft.world.chunk.light.LightingProvider;
|
||||
|
||||
import appeng.api.movable.IMovableHandler;
|
||||
import appeng.api.movable.IMovableRegistry;
|
||||
@@ -47,7 +48,6 @@ import appeng.api.util.WorldCoord;
|
||||
import appeng.core.AELog;
|
||||
import appeng.core.Api;
|
||||
import appeng.core.worlddata.WorldData;
|
||||
import net.minecraft.world.chunk.light.LightingProvider;
|
||||
|
||||
public class CachedPlane {
|
||||
private final int x_size;
|
||||
@@ -68,8 +68,8 @@ public class CachedPlane {
|
||||
private int verticalBits;
|
||||
private final BlockState matrixBlockState;
|
||||
|
||||
public CachedPlane(final ServerWorld w, final int minX, final int minY, final int minZ, final int maxX, final int maxY,
|
||||
final int maxZ) {
|
||||
public CachedPlane(final ServerWorld w, final int minX, final int minY, final int minZ, final int maxX,
|
||||
final int maxY, final int maxZ) {
|
||||
|
||||
Block matrixFrameBlock = Api.instance().definitions().blocks().matrixFrame().maybeBlock().orElse(null);
|
||||
if (matrixFrameBlock != null) {
|
||||
@@ -327,8 +327,8 @@ public class CachedPlane {
|
||||
|
||||
// FIXME this was sending chunks to players...
|
||||
ChunkDataS2CPacket cdp = new ChunkDataS2CPacket(c, verticalBits);
|
||||
world.getChunkManager().threadedAnvilChunkStorage
|
||||
.getPlayersWatchingChunk(c.getPos(), false).forEach(spe -> spe.networkHandler.sendPacket(cdp));
|
||||
world.getChunkManager().threadedAnvilChunkStorage.getPlayersWatchingChunk(c.getPos(), false)
|
||||
.forEach(spe -> spe.networkHandler.sendPacket(cdp));
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
@@ -36,9 +36,8 @@ public class SpatialStorageBiome {
|
||||
.build())
|
||||
.precipitation(Biome.Precipitation.NONE).category(Biome.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).skyColor(0x111111)
|
||||
.build())
|
||||
.temperature(0.5F).downfall(0.5F).effects(new BiomeEffects.Builder().waterColor(4159204)
|
||||
.waterFogColor(329011).fogColor(0).skyColor(0x111111).build())
|
||||
.spawnSettings(new SpawnSettings.Builder().creatureSpawnProbability(0).build()).build();
|
||||
|
||||
}
|
||||
|
||||
@@ -18,8 +18,12 @@
|
||||
|
||||
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 net.minecraft.block.BlockState;
|
||||
import net.minecraft.util.math.BlockPos;
|
||||
import net.minecraft.util.registry.Registry;
|
||||
@@ -38,9 +42,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;
|
||||
|
||||
/**
|
||||
* Chunk generator the spatial storage world.
|
||||
@@ -49,12 +51,14 @@ public class SpatialStorageChunkGenerator extends ChunkGenerator {
|
||||
|
||||
/**
|
||||
* This codec is necessary to restore the actual instance of the Biome we use,
|
||||
* since it is sources from the dynamic registries and <em>must be the same object as in the registry!</em>.
|
||||
* <p>If it was not the same object, then the Object->ID lookup would fail since it uses an identity hashmap
|
||||
* internally.
|
||||
* since it is sources from the dynamic registries and <em>must be the same
|
||||
* object as in the registry!</em>.
|
||||
* <p>
|
||||
* If it was not the same object, then the Object->ID lookup would fail since it
|
||||
* uses an identity hashmap internally.
|
||||
*/
|
||||
public static final Codec<SpatialStorageChunkGenerator> CODEC
|
||||
= RegistryLookupCodec.of(Registry.BIOME_KEY).xmap(SpatialStorageChunkGenerator::new, SpatialStorageChunkGenerator::getBiomeRegistry).stable().codec();
|
||||
public static final Codec<SpatialStorageChunkGenerator> CODEC = RegistryLookupCodec.of(Registry.BIOME_KEY)
|
||||
.xmap(SpatialStorageChunkGenerator::new, SpatialStorageChunkGenerator::getBiomeRegistry).stable().codec();
|
||||
|
||||
private final Registry<Biome> biomeRegistry;
|
||||
|
||||
@@ -74,7 +78,6 @@ public class SpatialStorageChunkGenerator extends ChunkGenerator {
|
||||
this.columnSample = new VerticalBlockSample(columnSample);
|
||||
}
|
||||
|
||||
|
||||
@Override
|
||||
protected Codec<? extends ChunkGenerator> getCodec() {
|
||||
return CODEC;
|
||||
|
||||
@@ -1,6 +1,5 @@
|
||||
package appeng.spatial;
|
||||
|
||||
import appeng.core.AppEng;
|
||||
import net.minecraft.util.Identifier;
|
||||
import net.minecraft.util.registry.Registry;
|
||||
import net.minecraft.util.registry.RegistryKey;
|
||||
@@ -9,6 +8,8 @@ import net.minecraft.world.biome.Biome;
|
||||
import net.minecraft.world.dimension.DimensionOptions;
|
||||
import net.minecraft.world.dimension.DimensionType;
|
||||
|
||||
import appeng.core.AppEng;
|
||||
|
||||
/**
|
||||
* IDs for the spatial storage world related dimension objects.
|
||||
*/
|
||||
@@ -19,12 +20,12 @@ public final class SpatialStorageDimensionIds {
|
||||
* <p>
|
||||
* This is defined in {@link appeng.mixins.spatial.DimensionTypeMixin}.
|
||||
*/
|
||||
public static final RegistryKey<DimensionType> DIMENSION_TYPE_ID = RegistryKey
|
||||
.of(Registry.DIMENSION_TYPE_KEY, AppEng.makeId("spatial_storage"));
|
||||
public static final RegistryKey<DimensionType> DIMENSION_TYPE_ID = RegistryKey.of(Registry.DIMENSION_TYPE_KEY,
|
||||
AppEng.makeId("spatial_storage"));
|
||||
|
||||
/**
|
||||
* ID of the {@link net.minecraft.world.gen.chunk.ChunkGenerator} used for the spatial
|
||||
* storage world.
|
||||
* ID of the {@link net.minecraft.world.gen.chunk.ChunkGenerator} used for the
|
||||
* spatial storage world.
|
||||
*/
|
||||
public static final Identifier CHUNK_GENERATOR_ID = AppEng.makeId("spatial_storage");
|
||||
|
||||
@@ -32,7 +33,8 @@ public final class SpatialStorageDimensionIds {
|
||||
* ID of the {@link net.minecraft.world.biome.Biome} used for the spatial
|
||||
* storage world.
|
||||
*/
|
||||
public static final RegistryKey<Biome> BIOME_KEY = RegistryKey.of(Registry.BIOME_KEY, AppEng.makeId("spatial_storage"));
|
||||
public static final RegistryKey<Biome> BIOME_KEY = RegistryKey.of(Registry.BIOME_KEY,
|
||||
AppEng.makeId("spatial_storage"));
|
||||
|
||||
/**
|
||||
* ID of the {@link DimensionOptions} used for the spatial storage dimension.
|
||||
@@ -51,7 +53,8 @@ public final class SpatialStorageDimensionIds {
|
||||
AppEng.makeId("spatial_storage"));
|
||||
|
||||
/**
|
||||
* ID of the {@link net.minecraft.client.render.SkyProperties} used for the spatial storage world.
|
||||
* ID of the {@link net.minecraft.client.render.SkyProperties} used for the
|
||||
* spatial storage world.
|
||||
*/
|
||||
public static Identifier SKY_PROPERTIES_ID = AppEng.makeId("spatial_storage");
|
||||
|
||||
|
||||
@@ -18,9 +18,9 @@
|
||||
|
||||
package appeng.spatial;
|
||||
|
||||
import appeng.api.util.WorldCoord;
|
||||
import appeng.core.Api;
|
||||
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;
|
||||
@@ -35,8 +35,9 @@ import net.minecraft.world.TeleportTarget;
|
||||
import net.minecraft.world.World;
|
||||
import net.minecraft.world.chunk.ChunkStatus;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
import appeng.api.util.WorldCoord;
|
||||
import appeng.core.Api;
|
||||
import appeng.core.AppEng;
|
||||
|
||||
public class SpatialStorageHelper {
|
||||
|
||||
@@ -52,7 +53,8 @@ public class SpatialStorageHelper {
|
||||
private final ThreadLocal<TeleportTarget> teleportTarget = new ThreadLocal<>();
|
||||
|
||||
/**
|
||||
* If an entity is currently being teleported, this will return the target within the target dimension.
|
||||
* If an entity is currently being teleported, this will return the target
|
||||
* within the target dimension.
|
||||
*/
|
||||
public TeleportTarget getTeleportTarget() {
|
||||
return teleportTarget.get();
|
||||
@@ -104,16 +106,13 @@ public class SpatialStorageHelper {
|
||||
newWorld.getChunkManager().getChunk(MathHelper.floor(link.x) >> 4, MathHelper.floor(link.z) >> 4,
|
||||
ChunkStatus.FULL, true);
|
||||
|
||||
if (entity instanceof ServerPlayerEntity
|
||||
&& link.dim.getRegistryKey() == SpatialStorageDimensionIds.WORLD_ID) {
|
||||
if (entity instanceof ServerPlayerEntity && link.dim.getRegistryKey() == SpatialStorageDimensionIds.WORLD_ID) {
|
||||
AppEng.instance().getAdvancementTriggers().getSpatialExplorer().trigger((ServerPlayerEntity) entity);
|
||||
}
|
||||
|
||||
// Store in a threadlocal so that EntityMixin can return it for the Vanilla logic to use
|
||||
teleportTarget.set(new TeleportTarget(new Vec3d(link.x, link.y, link.z),
|
||||
Vec3d.ZERO,
|
||||
entity.yaw,
|
||||
entity.pitch));
|
||||
// Store in a threadlocal so that EntityMixin can return it for the Vanilla
|
||||
// logic to use
|
||||
teleportTarget.set(new TeleportTarget(new Vec3d(link.x, link.y, link.z), Vec3d.ZERO, entity.yaw, entity.pitch));
|
||||
try {
|
||||
entity = entity.moveToWorld(link.dim);
|
||||
} finally {
|
||||
|
||||
@@ -22,15 +22,15 @@ import java.util.List;
|
||||
|
||||
import javax.annotation.Nullable;
|
||||
|
||||
import appeng.core.AppEng;
|
||||
import net.minecraft.block.BlockState;
|
||||
import net.minecraft.server.MinecraftServer;
|
||||
import net.minecraft.server.world.ServerWorld;
|
||||
import net.minecraft.util.math.BlockPos;
|
||||
import net.minecraft.world.TeleportTarget;
|
||||
|
||||
import appeng.core.AELog;
|
||||
import appeng.core.Api;
|
||||
import net.minecraft.world.TeleportTarget;
|
||||
import appeng.core.AppEng;
|
||||
|
||||
/**
|
||||
* Allocates and manages plots for spatial storage in the spatial storage world.
|
||||
|
||||
Reference in New Issue
Block a user