From 502d86f514ea8a503a14c4837a042786fc6042ef Mon Sep 17 00:00:00 2001 From: SD Date: Wed, 9 Sep 2020 17:11:29 +0530 Subject: [PATCH] Reverted some breaking changes Changes to be committed: modified: src/main/java/org/dimdev/dimcore/schematic/Schematic.java modified: src/main/java/org/dimdev/dimdoors/DimensionalDoorsInitializer.java modified: src/main/java/org/dimdev/dimdoors/block/DetachedRiftBlock.java modified: src/main/java/org/dimdev/dimdoors/block/DimensionalDoorBlock.java modified: src/main/java/org/dimdev/dimdoors/block/entity/DetachedRiftBlockEntity.java modified: src/main/java/org/dimdev/dimdoors/block/entity/EntranceRiftBlockEntity.java modified: src/main/java/org/dimdev/dimdoors/block/entity/RiftBlockEntity.java modified: src/main/java/org/dimdev/dimdoors/block/entity/RiftData.java modified: src/main/java/org/dimdev/dimdoors/client/CustomSkyProvider.java modified: src/main/java/org/dimdev/dimdoors/client/DetachedRiftBlockEntityRenderer.java modified: src/main/java/org/dimdev/dimdoors/client/ModRendering.java modified: src/main/java/org/dimdev/dimdoors/client/MyRenderLayer.java modified: src/main/java/org/dimdev/dimdoors/client/RiftCrackRenderer.java modified: src/main/java/org/dimdev/dimdoors/client/tesseract/Plane.java modified: src/main/java/org/dimdev/dimdoors/client/tesseract/Tesseract.java modified: src/main/java/org/dimdev/dimdoors/entity/ai/MonolithTask.java modified: src/main/java/org/dimdev/dimdoors/item/RiftSignatureItem.java modified: src/main/java/org/dimdev/dimdoors/item/StabilizedRiftSignatureItem.java modified: src/main/java/org/dimdev/dimdoors/mixin/BuiltinBiomesAccessor.java new file: src/main/java/org/dimdev/dimdoors/mixin/ChunkGeneratorAccessor.java modified: src/main/java/org/dimdev/dimdoors/pockets/PocketGenerator.java modified: src/main/java/org/dimdev/dimdoors/pockets/PocketTemplate.java modified: src/main/java/org/dimdev/dimdoors/rift/registry/LinkProperties.java modified: src/main/java/org/dimdev/dimdoors/rift/registry/PlayerRiftPointer.java modified: src/main/java/org/dimdev/dimdoors/rift/registry/PocketEntrancePointer.java modified: src/main/java/org/dimdev/dimdoors/rift/registry/RegistryVertex.java modified: src/main/java/org/dimdev/dimdoors/rift/registry/Rift.java modified: src/main/java/org/dimdev/dimdoors/rift/registry/RiftPlaceholder.java modified: src/main/java/org/dimdev/dimdoors/rift/registry/RiftRegistry.java modified: src/main/java/org/dimdev/dimdoors/rift/targets/GlobalReference.java modified: src/main/java/org/dimdev/dimdoors/rift/targets/LimboTarget.java modified: src/main/java/org/dimdev/dimdoors/rift/targets/LocalReference.java modified: src/main/java/org/dimdev/dimdoors/rift/targets/PocketEntranceMarker.java modified: src/main/java/org/dimdev/dimdoors/rift/targets/PocketExitMarker.java modified: src/main/java/org/dimdev/dimdoors/rift/targets/PublicPocketTarget.java modified: src/main/java/org/dimdev/dimdoors/rift/targets/RandomTarget.java modified: src/main/java/org/dimdev/dimdoors/rift/targets/RelativeReference.java modified: src/main/java/org/dimdev/dimdoors/rift/targets/RestoringTarget.java modified: src/main/java/org/dimdev/dimdoors/rift/targets/RiftReference.java modified: src/main/java/org/dimdev/dimdoors/rift/targets/VirtualTarget.java modified: src/main/java/org/dimdev/dimdoors/util/Codecs.java modified: src/main/java/org/dimdev/dimdoors/util/Location.java modified: src/main/java/org/dimdev/dimdoors/util/NbtUtil.java modified: src/main/java/org/dimdev/dimdoors/util/RGBA.java modified: src/main/java/org/dimdev/dimdoors/util/RotatedLocation.java modified: src/main/java/org/dimdev/dimdoors/util/TeleportUtil.java modified: src/main/java/org/dimdev/dimdoors/util/WorldUtil.java modified: src/main/java/org/dimdev/dimdoors/util/math/GridUtil.java modified: src/main/java/org/dimdev/dimdoors/world/feature/ModFeatures.java modified: src/main/java/org/dimdev/dimdoors/world/limbo/LimboChunkGenerator.java modified: src/main/java/org/dimdev/dimdoors/world/limbo/LimboDecay.java modified: src/main/java/org/dimdev/dimdoors/world/pocket/Pocket.java modified: src/main/java/org/dimdev/dimdoors/world/pocket/PocketRegistry.java modified: src/main/java/org/dimdev/dimdoors/world/pocket/PrivatePocketData.java modified: src/main/java/org/dimdev/dimdoors/world/pocket/VirtualLocation.java modified: src/main/resources/dimdoors.mixins.json --- .../dimdev/dimcore/schematic/Schematic.java | 10 +- .../dimdoors/DimensionalDoorsInitializer.java | 23 +- .../dimdoors/block/DetachedRiftBlock.java | 6 +- .../dimdoors/block/DimensionalDoorBlock.java | 1 - .../block/entity/DetachedRiftBlockEntity.java | 4 - .../block/entity/EntranceRiftBlockEntity.java | 1 - .../block/entity/RiftBlockEntity.java | 3 - .../dimdoors/block/entity/RiftData.java | 1 - .../dimdoors/client/CustomSkyProvider.java | 1 - .../DetachedRiftBlockEntityRenderer.java | 5 +- .../dimdev/dimdoors/client/ModRendering.java | 3 +- .../dimdev/dimdoors/client/MyRenderLayer.java | 6 - .../dimdoors/client/RiftCrackRenderer.java | 2 +- .../dimdoors/client/tesseract/Plane.java | 2 +- .../dimdoors/client/tesseract/Tesseract.java | 4 +- .../dimdoors/entity/ai/MonolithTask.java | 3 +- .../dimdoors/item/RiftSignatureItem.java | 4 +- .../item/StabilizedRiftSignatureItem.java | 2 +- .../dimdoors/mixin/BuiltinBiomesAccessor.java | 1 - .../mixin/ChunkGeneratorAccessor.java | 12 + .../dimdoors/pockets/PocketGenerator.java | 1 - .../dimdoors/pockets/PocketTemplate.java | 2 - .../rift/registry/LinkProperties.java | 5 +- .../rift/registry/PlayerRiftPointer.java | 5 +- .../rift/registry/PocketEntrancePointer.java | 7 +- .../rift/registry/RegistryVertex.java | 15 +- .../dimdev/dimdoors/rift/registry/Rift.java | 5 +- .../rift/registry/RiftPlaceholder.java | 3 +- .../dimdoors/rift/registry/RiftRegistry.java | 2 +- .../rift/targets/GlobalReference.java | 8 - .../dimdoors/rift/targets/LimboTarget.java | 3 +- .../dimdoors/rift/targets/LocalReference.java | 2 - .../rift/targets/PocketEntranceMarker.java | 3 - .../rift/targets/PocketExitMarker.java | 1 - .../rift/targets/PublicPocketTarget.java | 2 - .../dimdoors/rift/targets/RandomTarget.java | 4 - .../rift/targets/RelativeReference.java | 4 - .../rift/targets/RestoringTarget.java | 6 - .../dimdoors/rift/targets/RiftReference.java | 2 +- .../dimdoors/rift/targets/VirtualTarget.java | 14 +- .../java/org/dimdev/dimdoors/util/Codecs.java | 21 +- .../org/dimdev/dimdoors/util/Location.java | 2 +- .../org/dimdev/dimdoors/util/NbtUtil.java | 1 + .../java/org/dimdev/dimdoors/util/RGBA.java | 5 +- .../dimdev/dimdoors/util/RotatedLocation.java | 6 +- .../dimdev/dimdoors/util/TeleportUtil.java | 1 - .../org/dimdev/dimdoors/util/WorldUtil.java | 4 +- .../dimdev/dimdoors/util/math/GridUtil.java | 5 +- .../dimdoors/world/feature/ModFeatures.java | 4 +- .../world/limbo/LimboChunkGenerator.java | 250 ++++++++---------- .../dimdoors/world/limbo/LimboDecay.java | 10 +- .../dimdev/dimdoors/world/pocket/Pocket.java | 8 +- .../dimdoors/world/pocket/PocketRegistry.java | 5 +- .../world/pocket/PrivatePocketData.java | 13 +- .../world/pocket/VirtualLocation.java | 6 +- src/main/resources/dimdoors.mixins.json | 1 + 56 files changed, 218 insertions(+), 312 deletions(-) create mode 100644 src/main/java/org/dimdev/dimdoors/mixin/ChunkGeneratorAccessor.java diff --git a/src/main/java/org/dimdev/dimcore/schematic/Schematic.java b/src/main/java/org/dimdev/dimcore/schematic/Schematic.java index b41d100a..0ceca495 100644 --- a/src/main/java/org/dimdev/dimcore/schematic/Schematic.java +++ b/src/main/java/org/dimdev/dimcore/schematic/Schematic.java @@ -8,9 +8,6 @@ import java.util.Map; import java.util.Map.Entry; import java.util.Set; -import net.minecraft.block.entity.BlockEntityType; -import net.minecraft.server.world.ServerWorld; -import net.minecraft.world.*; import org.apache.logging.log4j.LogManager; import org.apache.logging.log4j.Logger; @@ -18,6 +15,7 @@ import net.minecraft.block.Block; import net.minecraft.block.BlockState; import net.minecraft.block.Blocks; import net.minecraft.block.entity.BlockEntity; +import net.minecraft.block.entity.BlockEntityType; import net.minecraft.entity.Entity; import net.minecraft.entity.player.PlayerEntity; import net.minecraft.fluid.FluidState; @@ -26,6 +24,7 @@ import net.minecraft.nbt.DoubleTag; import net.minecraft.nbt.ListTag; import net.minecraft.nbt.StringTag; import net.minecraft.nbt.Tag; +import net.minecraft.server.world.ServerWorld; import net.minecraft.state.StateManager; import net.minecraft.state.property.Property; import net.minecraft.util.Identifier; @@ -33,6 +32,11 @@ import net.minecraft.util.math.BlockPos; import net.minecraft.util.math.Box; import net.minecraft.util.math.Vec3i; import net.minecraft.util.registry.Registry; +import net.minecraft.world.BlockView; +import net.minecraft.world.Heightmap; +import net.minecraft.world.ServerWorldAccess; +import net.minecraft.world.World; +import net.minecraft.world.WorldAccess; import net.minecraft.world.chunk.Chunk; import net.minecraft.world.chunk.ChunkSection; diff --git a/src/main/java/org/dimdev/dimdoors/DimensionalDoorsInitializer.java b/src/main/java/org/dimdev/dimdoors/DimensionalDoorsInitializer.java index b0d4979d..33f9b3f7 100644 --- a/src/main/java/org/dimdev/dimdoors/DimensionalDoorsInitializer.java +++ b/src/main/java/org/dimdev/dimdoors/DimensionalDoorsInitializer.java @@ -1,38 +1,25 @@ package org.dimdev.dimdoors; -import net.fabricmc.fabric.api.event.lifecycle.v1.ServerLifecycleEvents; -import net.minecraft.server.MinecraftServer; -import net.minecraft.server.world.ServerWorld; -import net.minecraft.util.registry.RegistryKey; -import net.minecraft.world.World; -import org.apache.logging.log4j.core.jmx.Server; import org.dimdev.dimdoors.block.ModBlocks; import org.dimdev.dimdoors.block.entity.ModBlockEntityTypes; import org.dimdev.dimdoors.command.ModCommands; import org.dimdev.dimdoors.entity.ModEntityTypes; import org.dimdev.dimdoors.item.ModItems; import org.dimdev.dimdoors.pockets.SchematicHandler; -import org.dimdev.dimdoors.rift.targets.EscapeTarget; -import org.dimdev.dimdoors.rift.targets.GlobalReference; -import org.dimdev.dimdoors.rift.targets.LimboTarget; -import org.dimdev.dimdoors.rift.targets.LocalReference; -import org.dimdev.dimdoors.rift.targets.PocketEntranceMarker; -import org.dimdev.dimdoors.rift.targets.PocketExitMarker; -import org.dimdev.dimdoors.rift.targets.PrivatePocketExitTarget; -import org.dimdev.dimdoors.rift.targets.PrivatePocketTarget; -import org.dimdev.dimdoors.rift.targets.PublicPocketTarget; -import org.dimdev.dimdoors.rift.targets.RandomTarget; -import org.dimdev.dimdoors.rift.targets.RelativeReference; import org.dimdev.dimdoors.rift.targets.Targets; -import org.dimdev.dimdoors.rift.targets.VirtualTarget; import org.dimdev.dimdoors.sound.ModSoundEvents; import org.dimdev.dimdoors.world.ModBiomes; import org.dimdev.dimdoors.world.ModDimensions; import org.dimdev.dimdoors.world.feature.ModFeatures; +import net.minecraft.server.MinecraftServer; +import net.minecraft.server.world.ServerWorld; import net.minecraft.util.Identifier; +import net.minecraft.util.registry.RegistryKey; +import net.minecraft.world.World; import net.fabricmc.api.ModInitializer; +import net.fabricmc.fabric.api.event.lifecycle.v1.ServerLifecycleEvents; public class DimensionalDoorsInitializer implements ModInitializer { diff --git a/src/main/java/org/dimdev/dimdoors/block/DetachedRiftBlock.java b/src/main/java/org/dimdev/dimdoors/block/DetachedRiftBlock.java index c8930a38..8a6c5852 100644 --- a/src/main/java/org/dimdev/dimdoors/block/DetachedRiftBlock.java +++ b/src/main/java/org/dimdev/dimdoors/block/DetachedRiftBlock.java @@ -2,11 +2,15 @@ package org.dimdev.dimdoors.block; import java.util.Random; -import net.minecraft.block.*; import org.dimdev.dimdoors.block.entity.DetachedRiftBlockEntity; import org.dimdev.dimdoors.client.RiftParticle; import org.dimdev.dimdoors.world.ModDimensions; +import net.minecraft.block.Block; +import net.minecraft.block.BlockRenderType; +import net.minecraft.block.BlockState; +import net.minecraft.block.MaterialColor; +import net.minecraft.block.ShapeContext; import net.minecraft.block.entity.BlockEntity; import net.minecraft.client.MinecraftClient; import net.minecraft.client.world.ClientWorld; diff --git a/src/main/java/org/dimdev/dimdoors/block/DimensionalDoorBlock.java b/src/main/java/org/dimdev/dimdoors/block/DimensionalDoorBlock.java index 5d091d78..f6c6c106 100644 --- a/src/main/java/org/dimdev/dimdoors/block/DimensionalDoorBlock.java +++ b/src/main/java/org/dimdev/dimdoors/block/DimensionalDoorBlock.java @@ -19,7 +19,6 @@ import net.minecraft.util.hit.BlockHitResult; import net.minecraft.util.math.BlockPos; import net.minecraft.world.BlockView; import net.minecraft.world.World; -import org.dimdev.dimdoors.item.RiftSignatureItem; public class DimensionalDoorBlock extends DoorBlock implements RiftProvider, ConditionalBlockEntityProvider { public DimensionalDoorBlock(Settings settings) { diff --git a/src/main/java/org/dimdev/dimdoors/block/entity/DetachedRiftBlockEntity.java b/src/main/java/org/dimdev/dimdoors/block/entity/DetachedRiftBlockEntity.java index c94bbc48..a5ab4e81 100644 --- a/src/main/java/org/dimdev/dimdoors/block/entity/DetachedRiftBlockEntity.java +++ b/src/main/java/org/dimdev/dimdoors/block/entity/DetachedRiftBlockEntity.java @@ -2,14 +2,11 @@ package org.dimdev.dimdoors.block.entity; import java.util.Random; -import org.dimdev.annotatednbt.AnnotatedNbt; import org.dimdev.annotatednbt.Saved; import org.dimdev.dimdoors.ModConfig; import org.dimdev.dimdoors.block.ModBlocks; -import org.dimdev.dimdoors.client.RiftCurves; import org.dimdev.dimdoors.util.TeleportUtil; -import net.minecraft.block.BlockState; import net.minecraft.entity.Entity; import net.minecraft.entity.EntityType; import net.minecraft.entity.SpawnReason; @@ -20,7 +17,6 @@ import net.minecraft.util.Tickable; import net.fabricmc.api.EnvType; import net.fabricmc.api.Environment; -import org.lwjgl.system.macosx.LibSystem; public class DetachedRiftBlockEntity extends RiftBlockEntity implements Tickable { diff --git a/src/main/java/org/dimdev/dimdoors/block/entity/EntranceRiftBlockEntity.java b/src/main/java/org/dimdev/dimdoors/block/entity/EntranceRiftBlockEntity.java index cd7b6744..846841e8 100644 --- a/src/main/java/org/dimdev/dimdoors/block/entity/EntranceRiftBlockEntity.java +++ b/src/main/java/org/dimdev/dimdoors/block/entity/EntranceRiftBlockEntity.java @@ -2,7 +2,6 @@ package org.dimdev.dimdoors.block.entity; import java.util.Random; -import org.dimdev.annotatednbt.AnnotatedNbt; import org.dimdev.dimdoors.ModConfig; import org.dimdev.dimdoors.util.RGBA; import org.dimdev.dimdoors.util.TeleportUtil; diff --git a/src/main/java/org/dimdev/dimdoors/block/entity/RiftBlockEntity.java b/src/main/java/org/dimdev/dimdoors/block/entity/RiftBlockEntity.java index 6ae57e11..d9a80174 100644 --- a/src/main/java/org/dimdev/dimdoors/block/entity/RiftBlockEntity.java +++ b/src/main/java/org/dimdev/dimdoors/block/entity/RiftBlockEntity.java @@ -1,11 +1,8 @@ package org.dimdev.dimdoors.block.entity; import java.util.Objects; -import java.util.function.Supplier; import com.mojang.serialization.Codec; -import net.minecraft.nbt.Tag; -import net.minecraft.util.Language; import org.apache.logging.log4j.LogManager; import org.apache.logging.log4j.Logger; import org.dimdev.dimdoors.pockets.PocketTemplate; diff --git a/src/main/java/org/dimdev/dimdoors/block/entity/RiftData.java b/src/main/java/org/dimdev/dimdoors/block/entity/RiftData.java index 52d9e7c3..084cd3c2 100644 --- a/src/main/java/org/dimdev/dimdoors/block/entity/RiftData.java +++ b/src/main/java/org/dimdev/dimdoors/block/entity/RiftData.java @@ -2,7 +2,6 @@ package org.dimdev.dimdoors.block.entity; import com.mojang.serialization.Codec; import com.mojang.serialization.codecs.RecordCodecBuilder; -import org.dimdev.annotatednbt.Saved; import org.dimdev.dimdoors.rift.registry.LinkProperties; import org.dimdev.dimdoors.rift.targets.VirtualTarget; import org.dimdev.dimdoors.util.RGBA; diff --git a/src/main/java/org/dimdev/dimdoors/client/CustomSkyProvider.java b/src/main/java/org/dimdev/dimdoors/client/CustomSkyProvider.java index 3cd491e7..a459ed62 100644 --- a/src/main/java/org/dimdev/dimdoors/client/CustomSkyProvider.java +++ b/src/main/java/org/dimdev/dimdoors/client/CustomSkyProvider.java @@ -1,7 +1,6 @@ package org.dimdev.dimdoors.client; import io.github.waterpicker.openworlds.renderer.SkyRenderer; - import com.mojang.blaze3d.systems.RenderSystem; import net.minecraft.client.MinecraftClient; diff --git a/src/main/java/org/dimdev/dimdoors/client/DetachedRiftBlockEntityRenderer.java b/src/main/java/org/dimdev/dimdoors/client/DetachedRiftBlockEntityRenderer.java index 984a99a6..951f6fad 100644 --- a/src/main/java/org/dimdev/dimdoors/client/DetachedRiftBlockEntityRenderer.java +++ b/src/main/java/org/dimdev/dimdoors/client/DetachedRiftBlockEntityRenderer.java @@ -1,22 +1,21 @@ package org.dimdev.dimdoors.client; import com.flowpowered.math.TrigMath; -import net.minecraft.util.math.Matrix4f; import org.dimdev.dimdoors.ModConfig; import org.dimdev.dimdoors.block.entity.DetachedRiftBlockEntity; import org.dimdev.dimdoors.client.tesseract.Tesseract; +import org.dimdev.dimdoors.util.RGBA; -import net.minecraft.client.render.RenderLayer; import net.minecraft.client.render.VertexConsumer; import net.minecraft.client.render.VertexConsumerProvider; import net.minecraft.client.render.block.entity.BlockEntityRenderDispatcher; import net.minecraft.client.render.block.entity.BlockEntityRenderer; import net.minecraft.client.util.math.MatrixStack; import net.minecraft.util.Identifier; +import net.minecraft.util.math.Matrix4f; import net.fabricmc.api.EnvType; import net.fabricmc.api.Environment; -import org.dimdev.dimdoors.util.RGBA; @Environment(EnvType.CLIENT) public class DetachedRiftBlockEntityRenderer extends BlockEntityRenderer { diff --git a/src/main/java/org/dimdev/dimdoors/client/ModRendering.java b/src/main/java/org/dimdev/dimdoors/client/ModRendering.java index 2fb05116..8029e3f9 100644 --- a/src/main/java/org/dimdev/dimdoors/client/ModRendering.java +++ b/src/main/java/org/dimdev/dimdoors/client/ModRendering.java @@ -1,9 +1,8 @@ package org.dimdev.dimdoors.client; -import io.github.waterpicker.openworlds.OpenWorlds; - import java.util.function.Function; +import io.github.waterpicker.openworlds.OpenWorlds; import org.dimdev.dimdoors.fluid.ModFluids; import org.dimdev.dimdoors.world.ModDimensions; diff --git a/src/main/java/org/dimdev/dimdoors/client/MyRenderLayer.java b/src/main/java/org/dimdev/dimdoors/client/MyRenderLayer.java index 68227f22..c75482ea 100644 --- a/src/main/java/org/dimdev/dimdoors/client/MyRenderLayer.java +++ b/src/main/java/org/dimdev/dimdoors/client/MyRenderLayer.java @@ -1,6 +1,5 @@ package org.dimdev.dimdoors.client; -import java.nio.FloatBuffer; import java.util.Arrays; import java.util.Random; @@ -12,15 +11,10 @@ import org.dimdev.dimdoors.util.RGBA; import org.lwjgl.opengl.GL11; import net.minecraft.block.enums.DoorHinge; -import net.minecraft.client.MinecraftClient; import net.minecraft.client.render.RenderLayer; import net.minecraft.client.render.RenderPhase; import net.minecraft.client.render.VertexFormat; import net.minecraft.client.render.VertexFormats; -import net.minecraft.client.render.block.BlockModels; -import net.minecraft.client.render.model.BakedModelManager; -import net.minecraft.client.texture.TextureManager; -import net.minecraft.client.util.GlAllocationUtils; import net.minecraft.state.property.BooleanProperty; import net.minecraft.state.property.DirectionProperty; import net.minecraft.state.property.EnumProperty; diff --git a/src/main/java/org/dimdev/dimdoors/client/RiftCrackRenderer.java b/src/main/java/org/dimdev/dimdoors/client/RiftCrackRenderer.java index 3aa107a7..0314023a 100644 --- a/src/main/java/org/dimdev/dimdoors/client/RiftCrackRenderer.java +++ b/src/main/java/org/dimdev/dimdoors/client/RiftCrackRenderer.java @@ -1,9 +1,9 @@ package org.dimdev.dimdoors.client; -import net.minecraft.util.math.Matrix4f; import org.dimdev.dimdoors.ModConfig; import net.minecraft.client.render.VertexConsumer; +import net.minecraft.util.math.Matrix4f; import net.fabricmc.api.EnvType; import net.fabricmc.api.Environment; diff --git a/src/main/java/org/dimdev/dimdoors/client/tesseract/Plane.java b/src/main/java/org/dimdev/dimdoors/client/tesseract/Plane.java index 2eb748f1..3445768c 100644 --- a/src/main/java/org/dimdev/dimdoors/client/tesseract/Plane.java +++ b/src/main/java/org/dimdev/dimdoors/client/tesseract/Plane.java @@ -3,9 +3,9 @@ package org.dimdev.dimdoors.client.tesseract; import com.flowpowered.math.matrix.Matrix4f; import com.flowpowered.math.vector.Vector3f; import com.flowpowered.math.vector.Vector4f; +import org.dimdev.dimdoors.util.RGBA; import net.minecraft.client.render.VertexConsumer; -import org.dimdev.dimdoors.util.RGBA; import static com.flowpowered.math.TrigMath.cos; import static com.flowpowered.math.TrigMath.sin; diff --git a/src/main/java/org/dimdev/dimdoors/client/tesseract/Tesseract.java b/src/main/java/org/dimdev/dimdoors/client/tesseract/Tesseract.java index eee821b7..15975f69 100644 --- a/src/main/java/org/dimdev/dimdoors/client/tesseract/Tesseract.java +++ b/src/main/java/org/dimdev/dimdoors/client/tesseract/Tesseract.java @@ -1,13 +1,13 @@ package org.dimdev.dimdoors.client.tesseract; import com.flowpowered.math.vector.Vector4f; +import org.dimdev.dimdoors.util.RGBA; import net.minecraft.client.render.VertexConsumer; +import net.minecraft.util.math.Matrix4f; import net.fabricmc.api.EnvType; import net.fabricmc.api.Environment; -import net.minecraft.util.math.Matrix4f; -import org.dimdev.dimdoors.util.RGBA; public class Tesseract { private final Plane[] planes = new Plane[24]; diff --git a/src/main/java/org/dimdev/dimdoors/entity/ai/MonolithTask.java b/src/main/java/org/dimdev/dimdoors/entity/ai/MonolithTask.java index ab95dc2f..a865b270 100644 --- a/src/main/java/org/dimdev/dimdoors/entity/ai/MonolithTask.java +++ b/src/main/java/org/dimdev/dimdoors/entity/ai/MonolithTask.java @@ -1,10 +1,9 @@ package org.dimdev.dimdoors.entity.ai; -import io.netty.buffer.Unpooled; - import java.util.EnumSet; import java.util.Random; +import io.netty.buffer.Unpooled; import org.dimdev.dimdoors.DimensionalDoorsInitializer; import org.dimdev.dimdoors.ModConfig; import org.dimdev.dimdoors.entity.MonolithEntity; diff --git a/src/main/java/org/dimdev/dimdoors/item/RiftSignatureItem.java b/src/main/java/org/dimdev/dimdoors/item/RiftSignatureItem.java index ec9d31bf..0a8b46f5 100644 --- a/src/main/java/org/dimdev/dimdoors/item/RiftSignatureItem.java +++ b/src/main/java/org/dimdev/dimdoors/item/RiftSignatureItem.java @@ -8,6 +8,8 @@ import org.dimdev.dimdoors.rift.targets.RiftReference; import org.dimdev.dimdoors.sound.ModSoundEvents; import org.dimdev.dimdoors.util.Location; import org.dimdev.dimdoors.util.RotatedLocation; +import org.dimdev.dimdoors.util.WorldUtil; +import org.jetbrains.annotations.NotNull; import net.minecraft.client.item.TooltipContext; import net.minecraft.entity.player.PlayerEntity; @@ -28,8 +30,6 @@ import net.minecraft.world.World; import net.fabricmc.api.EnvType; import net.fabricmc.api.Environment; -import org.dimdev.dimdoors.util.WorldUtil; -import org.jetbrains.annotations.NotNull; public class RiftSignatureItem extends Item { public static final String ID = "rift_signature"; diff --git a/src/main/java/org/dimdev/dimdoors/item/StabilizedRiftSignatureItem.java b/src/main/java/org/dimdev/dimdoors/item/StabilizedRiftSignatureItem.java index 61544081..cf6b6792 100644 --- a/src/main/java/org/dimdev/dimdoors/item/StabilizedRiftSignatureItem.java +++ b/src/main/java/org/dimdev/dimdoors/item/StabilizedRiftSignatureItem.java @@ -8,6 +8,7 @@ import org.dimdev.dimdoors.rift.targets.RiftReference; import org.dimdev.dimdoors.sound.ModSoundEvents; import org.dimdev.dimdoors.util.Location; import org.dimdev.dimdoors.util.RotatedLocation; +import org.dimdev.dimdoors.util.WorldUtil; import net.minecraft.client.item.TooltipContext; import net.minecraft.entity.player.PlayerEntity; @@ -25,7 +26,6 @@ import net.minecraft.util.Hand; import net.minecraft.util.math.BlockPos; import net.minecraft.util.math.Direction; import net.minecraft.world.World; -import org.dimdev.dimdoors.util.WorldUtil; public class StabilizedRiftSignatureItem extends Item { // TODO: common superclass with rift signature public static final String ID = "stabilized_rift_signature"; diff --git a/src/main/java/org/dimdev/dimdoors/mixin/BuiltinBiomesAccessor.java b/src/main/java/org/dimdev/dimdoors/mixin/BuiltinBiomesAccessor.java index 475bded0..f0d46672 100644 --- a/src/main/java/org/dimdev/dimdoors/mixin/BuiltinBiomesAccessor.java +++ b/src/main/java/org/dimdev/dimdoors/mixin/BuiltinBiomesAccessor.java @@ -1,7 +1,6 @@ package org.dimdev.dimdoors.mixin; import it.unimi.dsi.fastutil.ints.Int2ObjectMap; - import org.spongepowered.asm.mixin.Mixin; import org.spongepowered.asm.mixin.gen.Accessor; diff --git a/src/main/java/org/dimdev/dimdoors/mixin/ChunkGeneratorAccessor.java b/src/main/java/org/dimdev/dimdoors/mixin/ChunkGeneratorAccessor.java new file mode 100644 index 00000000..07ed263d --- /dev/null +++ b/src/main/java/org/dimdev/dimdoors/mixin/ChunkGeneratorAccessor.java @@ -0,0 +1,12 @@ +package org.dimdev.dimdoors.mixin; + +import org.spongepowered.asm.mixin.Mixin; +import org.spongepowered.asm.mixin.gen.Accessor; + +import net.minecraft.world.gen.chunk.ChunkGenerator; + +@Mixin(ChunkGenerator.class) +public interface ChunkGeneratorAccessor { + @Accessor + long getWorldSeed(); +} diff --git a/src/main/java/org/dimdev/dimdoors/pockets/PocketGenerator.java b/src/main/java/org/dimdev/dimdoors/pockets/PocketGenerator.java index aa1938e5..bf4e07f7 100644 --- a/src/main/java/org/dimdev/dimdoors/pockets/PocketGenerator.java +++ b/src/main/java/org/dimdev/dimdoors/pockets/PocketGenerator.java @@ -4,7 +4,6 @@ import java.util.Random; import org.apache.logging.log4j.LogManager; import org.apache.logging.log4j.Logger; -import org.dimdev.dimdoors.DimensionalDoorsInitializer; import org.dimdev.dimdoors.ModConfig; import org.dimdev.dimdoors.rift.registry.LinkProperties; import org.dimdev.dimdoors.rift.targets.VirtualTarget; diff --git a/src/main/java/org/dimdev/dimdoors/pockets/PocketTemplate.java b/src/main/java/org/dimdev/dimdoors/pockets/PocketTemplate.java index ab78552d..1aee206b 100644 --- a/src/main/java/org/dimdev/dimdoors/pockets/PocketTemplate.java +++ b/src/main/java/org/dimdev/dimdoors/pockets/PocketTemplate.java @@ -35,8 +35,6 @@ import net.minecraft.nbt.CompoundTag; import net.minecraft.server.world.ServerWorld; import net.minecraft.util.Identifier; import net.minecraft.util.math.BlockPos; -import net.minecraft.world.StructureWorldAccess; -import net.minecraft.world.World; /** * @author Robijnvogel diff --git a/src/main/java/org/dimdev/dimdoors/rift/registry/LinkProperties.java b/src/main/java/org/dimdev/dimdoors/rift/registry/LinkProperties.java index c1b57b6e..2da40373 100644 --- a/src/main/java/org/dimdev/dimdoors/rift/registry/LinkProperties.java +++ b/src/main/java/org/dimdev/dimdoors/rift/registry/LinkProperties.java @@ -1,10 +1,11 @@ package org.dimdev.dimdoors.rift.registry; -import java.util.*; +import java.util.HashSet; +import java.util.Objects; +import java.util.Set; import com.mojang.serialization.Codec; import com.mojang.serialization.codecs.RecordCodecBuilder; -import net.minecraft.util.dynamic.DynamicSerializableUuid; import org.dimdev.annotatednbt.Saved; import org.dimdev.dimdoors.util.Codecs; diff --git a/src/main/java/org/dimdev/dimdoors/rift/registry/PlayerRiftPointer.java b/src/main/java/org/dimdev/dimdoors/rift/registry/PlayerRiftPointer.java index 30926297..ed111674 100644 --- a/src/main/java/org/dimdev/dimdoors/rift/registry/PlayerRiftPointer.java +++ b/src/main/java/org/dimdev/dimdoors/rift/registry/PlayerRiftPointer.java @@ -4,12 +4,9 @@ import java.util.UUID; import com.mojang.serialization.Codec; import com.mojang.serialization.codecs.RecordCodecBuilder; -import net.minecraft.util.dynamic.DynamicSerializableUuid; -import org.dimdev.annotatednbt.AnnotatedNbt; import org.dimdev.annotatednbt.Saved; -import net.minecraft.nbt.CompoundTag; -import org.dimdev.dimdoors.util.NbtUtil; +import net.minecraft.util.dynamic.DynamicSerializableUuid; public class PlayerRiftPointer extends RegistryVertex { public static final Codec CODEC = RecordCodecBuilder.create(instance -> { diff --git a/src/main/java/org/dimdev/dimdoors/rift/registry/PocketEntrancePointer.java b/src/main/java/org/dimdev/dimdoors/rift/registry/PocketEntrancePointer.java index 534f03f5..31c60a91 100644 --- a/src/main/java/org/dimdev/dimdoors/rift/registry/PocketEntrancePointer.java +++ b/src/main/java/org/dimdev/dimdoors/rift/registry/PocketEntrancePointer.java @@ -2,13 +2,10 @@ package org.dimdev.dimdoors.rift.registry; import com.mojang.serialization.Codec; import com.mojang.serialization.codecs.RecordCodecBuilder; -import net.minecraft.util.dynamic.DynamicSerializableUuid; -import net.minecraft.util.registry.RegistryKey; -import net.minecraft.world.gen.surfacebuilder.SurfaceConfig; -import org.dimdev.annotatednbt.AnnotatedNbt; import org.dimdev.annotatednbt.Saved; -import net.minecraft.nbt.CompoundTag; +import net.minecraft.util.dynamic.DynamicSerializableUuid; +import net.minecraft.util.registry.RegistryKey; import net.minecraft.world.World; public class PocketEntrancePointer extends RegistryVertex { // TODO: PocketRiftPointer superclass? diff --git a/src/main/java/org/dimdev/dimdoors/rift/registry/RegistryVertex.java b/src/main/java/org/dimdev/dimdoors/rift/registry/RegistryVertex.java index 5e7b06f4..9cea6df2 100644 --- a/src/main/java/org/dimdev/dimdoors/rift/registry/RegistryVertex.java +++ b/src/main/java/org/dimdev/dimdoors/rift/registry/RegistryVertex.java @@ -3,22 +3,15 @@ package org.dimdev.dimdoors.rift.registry; import java.util.UUID; import com.mojang.serialization.Codec; -import com.mojang.serialization.codecs.RecordCodecBuilder; -import net.fabricmc.fabric.api.event.registry.FabricRegistryBuilder; -import net.fabricmc.fabric.api.event.registry.RegistryAttribute; +import org.dimdev.annotatednbt.Saved; + import net.minecraft.util.Identifier; -import net.minecraft.util.dynamic.DynamicSerializableUuid; import net.minecraft.util.registry.Registry; import net.minecraft.util.registry.RegistryKey; import net.minecraft.world.World; -import org.dimdev.annotatednbt.AnnotatedNbt; -import org.dimdev.annotatednbt.Saved; -import net.minecraft.nbt.CompoundTag; -import net.minecraft.server.world.ServerWorld; -import org.dimdev.dimdoors.rift.targets.*; -import org.dimdev.dimdoors.util.NbtUtil; -import org.dimdev.dimdoors.util.RGBA; +import net.fabricmc.fabric.api.event.registry.FabricRegistryBuilder; +import net.fabricmc.fabric.api.event.registry.RegistryAttribute; public abstract class RegistryVertex { public static final Registry registry = FabricRegistryBuilder.createSimple(RegistryVertex.RegistryVertexType.class, new Identifier("dimdoors", "registry_vertex")).attribute(RegistryAttribute.MODDED).buildAndRegister(); diff --git a/src/main/java/org/dimdev/dimdoors/rift/registry/Rift.java b/src/main/java/org/dimdev/dimdoors/rift/registry/Rift.java index a1300725..a6e5e3e2 100644 --- a/src/main/java/org/dimdev/dimdoors/rift/registry/Rift.java +++ b/src/main/java/org/dimdev/dimdoors/rift/registry/Rift.java @@ -2,15 +2,13 @@ package org.dimdev.dimdoors.rift.registry; import com.mojang.serialization.Codec; import com.mojang.serialization.codecs.RecordCodecBuilder; -import net.minecraft.util.dynamic.DynamicSerializableUuid; import org.apache.logging.log4j.LogManager; import org.apache.logging.log4j.Logger; -import org.dimdev.annotatednbt.AnnotatedNbt; import org.dimdev.annotatednbt.Saved; import org.dimdev.dimdoors.block.entity.RiftBlockEntity; import org.dimdev.dimdoors.util.Location; -import net.minecraft.nbt.CompoundTag; +import net.minecraft.util.dynamic.DynamicSerializableUuid; public class Rift extends RegistryVertex { public static final Codec CODEC = RecordCodecBuilder.create(instance -> { @@ -26,7 +24,6 @@ public class Rift extends RegistryVertex { }); }); - private static final Logger LOGGER = LogManager.getLogger(); @Saved public Location location; diff --git a/src/main/java/org/dimdev/dimdoors/rift/registry/RiftPlaceholder.java b/src/main/java/org/dimdev/dimdoors/rift/registry/RiftPlaceholder.java index 78d7feeb..8905eefb 100644 --- a/src/main/java/org/dimdev/dimdoors/rift/registry/RiftPlaceholder.java +++ b/src/main/java/org/dimdev/dimdoors/rift/registry/RiftPlaceholder.java @@ -1,11 +1,10 @@ package org.dimdev.dimdoors.rift.registry; import com.mojang.serialization.Codec; -import net.minecraft.util.dynamic.DynamicSerializableUuid; import org.apache.logging.log4j.LogManager; import org.apache.logging.log4j.Logger; -import net.minecraft.nbt.CompoundTag; +import net.minecraft.util.dynamic.DynamicSerializableUuid; public class RiftPlaceholder extends Rift { // TODO: don't extend rift private static final Logger LOGGER = LogManager.getLogger(); diff --git a/src/main/java/org/dimdev/dimdoors/rift/registry/RiftRegistry.java b/src/main/java/org/dimdev/dimdoors/rift/registry/RiftRegistry.java index e69aec41..d5295c49 100644 --- a/src/main/java/org/dimdev/dimdoors/rift/registry/RiftRegistry.java +++ b/src/main/java/org/dimdev/dimdoors/rift/registry/RiftRegistry.java @@ -26,7 +26,7 @@ import net.minecraft.world.PersistentState; import net.minecraft.world.World; import static net.minecraft.world.World.OVERWORLD; -import static org.dimdev.dimdoors.DimensionalDoorsInitializer.*; +import static org.dimdev.dimdoors.DimensionalDoorsInitializer.getWorld; public class RiftRegistry extends PersistentState { private static final Logger LOGGER = LogManager.getLogger(); diff --git a/src/main/java/org/dimdev/dimdoors/rift/targets/GlobalReference.java b/src/main/java/org/dimdev/dimdoors/rift/targets/GlobalReference.java index e7866da1..7160b8ca 100644 --- a/src/main/java/org/dimdev/dimdoors/rift/targets/GlobalReference.java +++ b/src/main/java/org/dimdev/dimdoors/rift/targets/GlobalReference.java @@ -1,16 +1,8 @@ package org.dimdev.dimdoors.rift.targets; -import com.mojang.datafixers.util.Pair; import com.mojang.serialization.Codec; -import net.minecraft.nbt.NbtOps; -import org.dimdev.annotatednbt.AnnotatedNbt; -import org.dimdev.annotatednbt.Saved; import org.dimdev.dimdoors.util.Location; -import net.minecraft.nbt.CompoundTag; - -import java.util.function.Function; - public class GlobalReference extends RiftReference { public static Codec CODEC = Location.CODEC.fieldOf("location").xmap(GlobalReference::new, GlobalReference::getReferencedLocation).codec(); diff --git a/src/main/java/org/dimdev/dimdoors/rift/targets/LimboTarget.java b/src/main/java/org/dimdev/dimdoors/rift/targets/LimboTarget.java index b693590e..98391c85 100644 --- a/src/main/java/org/dimdev/dimdoors/rift/targets/LimboTarget.java +++ b/src/main/java/org/dimdev/dimdoors/rift/targets/LimboTarget.java @@ -1,9 +1,8 @@ package org.dimdev.dimdoors.rift.targets; import com.mojang.serialization.Codec; + import net.minecraft.entity.Entity; -import net.minecraft.nbt.CompoundTag; -import org.dimdev.dimdoors.util.TeleportUtil; public class LimboTarget extends VirtualTarget implements EntityTarget { public static final Codec CODEC = Codec.unit(LimboTarget::new); diff --git a/src/main/java/org/dimdev/dimdoors/rift/targets/LocalReference.java b/src/main/java/org/dimdev/dimdoors/rift/targets/LocalReference.java index 58d2f05e..ffc26e40 100644 --- a/src/main/java/org/dimdev/dimdoors/rift/targets/LocalReference.java +++ b/src/main/java/org/dimdev/dimdoors/rift/targets/LocalReference.java @@ -1,11 +1,9 @@ package org.dimdev.dimdoors.rift.targets; import com.mojang.serialization.Codec; -import org.dimdev.annotatednbt.AnnotatedNbt; import org.dimdev.annotatednbt.Saved; import org.dimdev.dimdoors.util.Location; -import net.minecraft.nbt.CompoundTag; import net.minecraft.util.math.BlockPos; public class LocalReference extends RiftReference { diff --git a/src/main/java/org/dimdev/dimdoors/rift/targets/PocketEntranceMarker.java b/src/main/java/org/dimdev/dimdoors/rift/targets/PocketEntranceMarker.java index be73da04..4f4a9924 100644 --- a/src/main/java/org/dimdev/dimdoors/rift/targets/PocketEntranceMarker.java +++ b/src/main/java/org/dimdev/dimdoors/rift/targets/PocketEntranceMarker.java @@ -2,12 +2,9 @@ package org.dimdev.dimdoors.rift.targets; import com.mojang.serialization.Codec; import com.mojang.serialization.codecs.RecordCodecBuilder; -import org.dimdev.annotatednbt.AnnotatedNbt; -import org.dimdev.annotatednbt.Saved; import org.dimdev.dimdoors.util.EntityUtils; import net.minecraft.entity.Entity; -import net.minecraft.nbt.CompoundTag; import net.minecraft.text.TranslatableText; diff --git a/src/main/java/org/dimdev/dimdoors/rift/targets/PocketExitMarker.java b/src/main/java/org/dimdev/dimdoors/rift/targets/PocketExitMarker.java index e23264f0..4f7d6598 100644 --- a/src/main/java/org/dimdev/dimdoors/rift/targets/PocketExitMarker.java +++ b/src/main/java/org/dimdev/dimdoors/rift/targets/PocketExitMarker.java @@ -4,7 +4,6 @@ import com.mojang.serialization.Codec; import org.dimdev.dimdoors.util.EntityUtils; import net.minecraft.entity.Entity; -import net.minecraft.nbt.CompoundTag; import net.minecraft.text.TranslatableText; public class PocketExitMarker extends VirtualTarget implements EntityTarget { diff --git a/src/main/java/org/dimdev/dimdoors/rift/targets/PublicPocketTarget.java b/src/main/java/org/dimdev/dimdoors/rift/targets/PublicPocketTarget.java index dc835d3f..319da8df 100644 --- a/src/main/java/org/dimdev/dimdoors/rift/targets/PublicPocketTarget.java +++ b/src/main/java/org/dimdev/dimdoors/rift/targets/PublicPocketTarget.java @@ -8,8 +8,6 @@ import org.dimdev.dimdoors.util.Location; import org.dimdev.dimdoors.world.pocket.Pocket; import org.dimdev.dimdoors.world.pocket.VirtualLocation; -import net.minecraft.nbt.CompoundTag; - public class PublicPocketTarget extends RestoringTarget { public final static Codec CODEC = RecordCodecBuilder.create(instance -> { return instance.group( diff --git a/src/main/java/org/dimdev/dimdoors/rift/targets/RandomTarget.java b/src/main/java/org/dimdev/dimdoors/rift/targets/RandomTarget.java index 478266a1..1dec1f3b 100644 --- a/src/main/java/org/dimdev/dimdoors/rift/targets/RandomTarget.java +++ b/src/main/java/org/dimdev/dimdoors/rift/targets/RandomTarget.java @@ -9,9 +9,6 @@ import com.google.common.collect.Sets; import com.mojang.serialization.Codec; import com.mojang.serialization.DataResult; import com.mojang.serialization.codecs.RecordCodecBuilder; -import net.minecraft.nbt.NbtOps; -import net.minecraft.nbt.Tag; -import org.dimdev.annotatednbt.AnnotatedNbt; import org.dimdev.annotatednbt.Saved; import org.dimdev.dimdoors.block.ModBlocks; import org.dimdev.dimdoors.block.entity.DetachedRiftBlockEntity; @@ -26,7 +23,6 @@ import org.dimdev.dimdoors.util.math.MathUtil; import org.dimdev.dimdoors.world.pocket.Pocket; import org.dimdev.dimdoors.world.pocket.VirtualLocation; -import net.minecraft.nbt.CompoundTag; import net.minecraft.server.world.ServerWorld; import net.minecraft.util.math.BlockPos; import net.minecraft.world.Heightmap; diff --git a/src/main/java/org/dimdev/dimdoors/rift/targets/RelativeReference.java b/src/main/java/org/dimdev/dimdoors/rift/targets/RelativeReference.java index aacc7bee..87b9bab9 100644 --- a/src/main/java/org/dimdev/dimdoors/rift/targets/RelativeReference.java +++ b/src/main/java/org/dimdev/dimdoors/rift/targets/RelativeReference.java @@ -1,12 +1,8 @@ package org.dimdev.dimdoors.rift.targets; import com.mojang.serialization.Codec; -import com.mojang.serialization.DataResult; -import org.dimdev.annotatednbt.AnnotatedNbt; -import org.dimdev.annotatednbt.Saved; import org.dimdev.dimdoors.util.Location; -import net.minecraft.nbt.CompoundTag; import net.minecraft.util.math.Vec3i; public class RelativeReference extends RiftReference { diff --git a/src/main/java/org/dimdev/dimdoors/rift/targets/RestoringTarget.java b/src/main/java/org/dimdev/dimdoors/rift/targets/RestoringTarget.java index ee2fc068..7b0c21d7 100644 --- a/src/main/java/org/dimdev/dimdoors/rift/targets/RestoringTarget.java +++ b/src/main/java/org/dimdev/dimdoors/rift/targets/RestoringTarget.java @@ -1,12 +1,6 @@ package org.dimdev.dimdoors.rift.targets; -import com.mojang.serialization.Codec; -import com.mojang.serialization.codecs.RecordCodecBuilder; -import net.minecraft.util.math.BlockPos; -import net.minecraft.world.World; import org.dimdev.dimdoors.util.Location; - -import net.minecraft.nbt.CompoundTag; import org.dimdev.dimdoors.util.RGBA; public abstract class RestoringTarget extends VirtualTarget { diff --git a/src/main/java/org/dimdev/dimdoors/rift/targets/RiftReference.java b/src/main/java/org/dimdev/dimdoors/rift/targets/RiftReference.java index a530fe7a..1506ea06 100644 --- a/src/main/java/org/dimdev/dimdoors/rift/targets/RiftReference.java +++ b/src/main/java/org/dimdev/dimdoors/rift/targets/RiftReference.java @@ -4,9 +4,9 @@ import java.util.Set; import org.dimdev.dimdoors.rift.registry.RiftRegistry; import org.dimdev.dimdoors.util.Location; +import org.dimdev.dimdoors.util.RGBA; import net.minecraft.util.math.Vec3i; -import org.dimdev.dimdoors.util.RGBA; /** * Allows rifts and targets to reference another rift without having to diff --git a/src/main/java/org/dimdev/dimdoors/rift/targets/VirtualTarget.java b/src/main/java/org/dimdev/dimdoors/rift/targets/VirtualTarget.java index 790ac73a..aa0e571d 100644 --- a/src/main/java/org/dimdev/dimdoors/rift/targets/VirtualTarget.java +++ b/src/main/java/org/dimdev/dimdoors/rift/targets/VirtualTarget.java @@ -1,18 +1,16 @@ package org.dimdev.dimdoors.rift.targets; -import com.mojang.datafixers.util.Pair; import com.mojang.serialization.Codec; -import net.fabricmc.fabric.api.event.registry.FabricRegistryBuilder; -import net.fabricmc.fabric.api.event.registry.RegistryAttribute; -import net.minecraft.nbt.CompoundTag; -import net.minecraft.nbt.NbtOps; -import net.minecraft.util.Identifier; -import net.minecraft.util.registry.Registry; import org.dimdev.dimdoors.util.Location; import org.dimdev.dimdoors.util.NbtUtil; import org.dimdev.dimdoors.util.RGBA; -import java.util.function.Function; +import net.minecraft.nbt.CompoundTag; +import net.minecraft.util.Identifier; +import net.minecraft.util.registry.Registry; + +import net.fabricmc.fabric.api.event.registry.FabricRegistryBuilder; +import net.fabricmc.fabric.api.event.registry.RegistryAttribute; /** * A target that is not an actual object in the game such as a block or a tile diff --git a/src/main/java/org/dimdev/dimdoors/util/Codecs.java b/src/main/java/org/dimdev/dimdoors/util/Codecs.java index 0e9fe053..a9c9c22c 100644 --- a/src/main/java/org/dimdev/dimdoors/util/Codecs.java +++ b/src/main/java/org/dimdev/dimdoors/util/Codecs.java @@ -1,21 +1,14 @@ package org.dimdev.dimdoors.util; -import com.mojang.datafixers.util.Pair; -import com.mojang.serialization.*; -import com.mojang.serialization.codecs.PrimitiveCodec; -import com.mojang.serialization.codecs.RecordCodecBuilder; -import net.minecraft.item.ItemStack; -import net.minecraft.nbt.CompoundTag; +import java.util.Set; +import java.util.stream.Collectors; +import java.util.stream.IntStream; + +import com.mojang.serialization.Codec; +import com.mojang.serialization.DataResult; + import net.minecraft.util.DyeColor; import net.minecraft.util.math.BlockBox; -import net.minecraft.util.math.BlockPos; -import net.minecraft.util.math.Vec3i; -import net.minecraft.world.World; - -import java.util.List; -import java.util.Optional; -import java.util.Set; -import java.util.stream.*; public class Codecs { public static Codec> INT_SET = Codec.INT_STREAM.>comapFlatMap(a -> DataResult.success(a.boxed().collect(Collectors.toSet())), a -> a.stream().mapToInt(Integer::intValue)); diff --git a/src/main/java/org/dimdev/dimdoors/util/Location.java b/src/main/java/org/dimdev/dimdoors/util/Location.java index 1c18e656..97a2fa88 100644 --- a/src/main/java/org/dimdev/dimdoors/util/Location.java +++ b/src/main/java/org/dimdev/dimdoors/util/Location.java @@ -2,6 +2,7 @@ package org.dimdev.dimdoors.util; import com.mojang.serialization.Codec; import com.mojang.serialization.codecs.RecordCodecBuilder; +import org.dimdev.dimdoors.DimensionalDoorsInitializer; import net.minecraft.block.BlockState; import net.minecraft.block.entity.BlockEntity; @@ -10,7 +11,6 @@ import net.minecraft.server.world.ServerWorld; import net.minecraft.util.math.BlockPos; import net.minecraft.util.registry.RegistryKey; import net.minecraft.world.World; -import org.dimdev.dimdoors.DimensionalDoorsInitializer; public class Location { public static final Codec CODEC = RecordCodecBuilder.create(instance -> { diff --git a/src/main/java/org/dimdev/dimdoors/util/NbtUtil.java b/src/main/java/org/dimdev/dimdoors/util/NbtUtil.java index ef1270d1..033c9f2f 100644 --- a/src/main/java/org/dimdev/dimdoors/util/NbtUtil.java +++ b/src/main/java/org/dimdev/dimdoors/util/NbtUtil.java @@ -1,6 +1,7 @@ package org.dimdev.dimdoors.util; import com.mojang.serialization.Codec; + import net.minecraft.nbt.NbtOps; import net.minecraft.nbt.Tag; diff --git a/src/main/java/org/dimdev/dimdoors/util/RGBA.java b/src/main/java/org/dimdev/dimdoors/util/RGBA.java index 6cd3be4e..1e783e8d 100644 --- a/src/main/java/org/dimdev/dimdoors/util/RGBA.java +++ b/src/main/java/org/dimdev/dimdoors/util/RGBA.java @@ -1,10 +1,9 @@ package org.dimdev.dimdoors.util; +import java.util.Objects; + import com.mojang.serialization.Codec; import com.mojang.serialization.codecs.RecordCodecBuilder; -import org.dimdev.dimdoors.rift.targets.EscapeTarget; - -import java.util.Objects; public class RGBA implements Cloneable { public static final RGBA NONE = new RGBA(-1, -1, -1, -1); diff --git a/src/main/java/org/dimdev/dimdoors/util/RotatedLocation.java b/src/main/java/org/dimdev/dimdoors/util/RotatedLocation.java index 7faaf1ca..c16500e1 100644 --- a/src/main/java/org/dimdev/dimdoors/util/RotatedLocation.java +++ b/src/main/java/org/dimdev/dimdoors/util/RotatedLocation.java @@ -2,13 +2,13 @@ package org.dimdev.dimdoors.util; import com.mojang.serialization.Codec; import com.mojang.serialization.codecs.RecordCodecBuilder; -import net.minecraft.nbt.Tag; -import net.minecraft.util.registry.RegistryKey; -import net.minecraft.world.World; import org.dimdev.annotatednbt.Saved; import net.minecraft.nbt.CompoundTag; +import net.minecraft.nbt.Tag; import net.minecraft.util.math.BlockPos; +import net.minecraft.util.registry.RegistryKey; +import net.minecraft.world.World; public class RotatedLocation extends Location { static Codec CODEC = RecordCodecBuilder.create(instance -> { diff --git a/src/main/java/org/dimdev/dimdoors/util/TeleportUtil.java b/src/main/java/org/dimdev/dimdoors/util/TeleportUtil.java index 3153a123..f922a84e 100644 --- a/src/main/java/org/dimdev/dimdoors/util/TeleportUtil.java +++ b/src/main/java/org/dimdev/dimdoors/util/TeleportUtil.java @@ -5,7 +5,6 @@ import net.minecraft.server.network.ServerPlayerEntity; import net.minecraft.server.world.ServerWorld; import net.minecraft.util.math.BlockPos; import net.minecraft.util.math.Vec3d; -import net.minecraft.world.StructureWorldAccess; import net.minecraft.world.World; diff --git a/src/main/java/org/dimdev/dimdoors/util/WorldUtil.java b/src/main/java/org/dimdev/dimdoors/util/WorldUtil.java index ffc8575b..ffb6bcb1 100644 --- a/src/main/java/org/dimdev/dimdoors/util/WorldUtil.java +++ b/src/main/java/org/dimdev/dimdoors/util/WorldUtil.java @@ -1,10 +1,10 @@ package org.dimdev.dimdoors.util; +import org.dimdev.dimdoors.DimensionalDoorsInitializer; + import net.minecraft.server.world.ServerWorld; import net.minecraft.util.registry.RegistryKey; import net.minecraft.world.World; -import org.dimdev.dimdoors.DimensionalDoorsInitializer; -import org.dimdev.dimdoors.ModConfig; public class WorldUtil { public static ServerWorld getWorld(RegistryKey key) { diff --git a/src/main/java/org/dimdev/dimdoors/util/math/GridUtil.java b/src/main/java/org/dimdev/dimdoors/util/math/GridUtil.java index a65a71b6..9282afb4 100644 --- a/src/main/java/org/dimdev/dimdoors/util/math/GridUtil.java +++ b/src/main/java/org/dimdev/dimdoors/util/math/GridUtil.java @@ -15,8 +15,7 @@ public final class GridUtil { if (!(o instanceof GridPos)) return false; GridPos other = (GridPos) o; if (this.x != other.x) return false; - if (this.z != other.z) return false; - return true; + return this.z == other.z; } public int hashCode() { @@ -44,7 +43,7 @@ public final class GridUtil { int layerNumber = num - layer * layer; // The number of the spot on that layer // | First Side | Second Side | int x = layerNumber <= layer ? layer : layer - (layerNumber - layer); - int z = layerNumber <= layer ? layerNumber : layer; + int z = Math.min(layerNumber, layer); return new GridPos(x, z); } diff --git a/src/main/java/org/dimdev/dimdoors/world/feature/ModFeatures.java b/src/main/java/org/dimdev/dimdoors/world/feature/ModFeatures.java index 6ad15cf2..80d4ed59 100644 --- a/src/main/java/org/dimdev/dimdoors/world/feature/ModFeatures.java +++ b/src/main/java/org/dimdev/dimdoors/world/feature/ModFeatures.java @@ -1,10 +1,10 @@ package org.dimdev.dimdoors.world.feature; import org.dimdev.dimdoors.ModConfig; -import org.dimdev.dimdoors.world.feature.gateway.SchematicGatewayFeature; -import org.dimdev.dimdoors.world.feature.gateway.SchematicGatewayFeatureConfig; import org.dimdev.dimdoors.world.feature.gateway.SandstonePillarsGateway; import org.dimdev.dimdoors.world.feature.gateway.SchematicGateway; +import org.dimdev.dimdoors.world.feature.gateway.SchematicGatewayFeature; +import org.dimdev.dimdoors.world.feature.gateway.SchematicGatewayFeatureConfig; import org.dimdev.dimdoors.world.feature.gateway.TwoPillarsGateway; import net.minecraft.util.Identifier; diff --git a/src/main/java/org/dimdev/dimdoors/world/limbo/LimboChunkGenerator.java b/src/main/java/org/dimdev/dimdoors/world/limbo/LimboChunkGenerator.java index 68add017..f667ac53 100644 --- a/src/main/java/org/dimdev/dimdoors/world/limbo/LimboChunkGenerator.java +++ b/src/main/java/org/dimdev/dimdoors/world/limbo/LimboChunkGenerator.java @@ -1,18 +1,18 @@ package org.dimdev.dimdoors.world.limbo; -import it.unimi.dsi.fastutil.objects.ObjectArrayList; -import it.unimi.dsi.fastutil.objects.ObjectList; -import it.unimi.dsi.fastutil.objects.ObjectListIterator; - import java.util.Iterator; import java.util.Random; import java.util.function.Predicate; import java.util.function.Supplier; import java.util.stream.IntStream; +import it.unimi.dsi.fastutil.objects.ObjectArrayList; +import it.unimi.dsi.fastutil.objects.ObjectList; +import it.unimi.dsi.fastutil.objects.ObjectListIterator; import com.mojang.serialization.Codec; import com.mojang.serialization.codecs.RecordCodecBuilder; import org.dimdev.dimdoors.block.ModBlocks; +import org.dimdev.dimdoors.mixin.ChunkGeneratorAccessor; import org.jetbrains.annotations.Nullable; import net.minecraft.block.BlockState; @@ -32,7 +32,6 @@ import net.minecraft.util.math.noise.OctavePerlinNoiseSampler; import net.minecraft.util.math.noise.OctaveSimplexNoiseSampler; import net.minecraft.util.math.noise.PerlinNoiseSampler; import net.minecraft.util.math.noise.SimplexNoiseSampler; -import net.minecraft.util.registry.RegistryKey; import net.minecraft.world.BlockView; import net.minecraft.world.ChunkRegion; import net.minecraft.world.Heightmap; @@ -57,13 +56,12 @@ import net.fabricmc.api.Environment; public class LimboChunkGenerator extends ChunkGenerator { public static final Codec CODEC = RecordCodecBuilder.create((instance) -> { - return instance.group(BiomeSource.CODEC.fieldOf("biome_source").forGetter((limboChunkGenerator) -> { - return limboChunkGenerator.biomeSource; - }), ChunkGeneratorSettings.REGISTRY_CODEC.fieldOf("settings").forGetter((limboChunkGenerator) -> { - return limboChunkGenerator.settings; + return instance.group(BiomeSource.CODEC.fieldOf("biome_source").forGetter((chunkGenerator) -> { + return chunkGenerator.biomeSource; + }), ChunkGeneratorSettings.REGISTRY_CODEC.fieldOf("settings").forGetter((chunkGenerator) -> { + return chunkGenerator.settings; })).apply(instance, instance.stable(LimboChunkGenerator::new)); }); - private static final float[] NOISE_WEIGHT_TABLE = Util.make(new float[13824], (array) -> { for (int i = 0; i < 24; ++i) { for (int j = 0; j < 24; ++j) { @@ -73,7 +71,6 @@ public class LimboChunkGenerator extends ChunkGenerator { } } }); - private static final float[] BIOME_WEIGHT_TABLE = Util.make(new float[25], (fs) -> { for (int i = -2; i <= 2; ++i) { for (int j = -2; j <= 2; ++j) { @@ -83,13 +80,15 @@ public class LimboChunkGenerator extends ChunkGenerator { } }); - private static final BlockState AIR = Blocks.AIR.getDefaultState(); + protected final ChunkRandom random; + protected final BlockState defaultBlock; + protected final BlockState defaultFluid; + protected final Supplier settings; private final int verticalNoiseResolution; private final int horizontalNoiseResolution; private final int noiseSizeX; private final int noiseSizeY; private final int noiseSizeZ; - protected final ChunkRandom random; private final OctavePerlinNoiseSampler lowerInterpolatedNoise; private final OctavePerlinNoiseSampler upperInterpolatedNoise; private final OctavePerlinNoiseSampler interpolationNoise; @@ -97,10 +96,7 @@ public class LimboChunkGenerator extends ChunkGenerator { private final OctavePerlinNoiseSampler densityNoise; @Nullable private final SimplexNoiseSampler islandNoise; - protected final BlockState defaultBlock; - protected final BlockState defaultFluid; private final long worldSeed; - protected final Supplier settings; private final int worldHeight; public LimboChunkGenerator(BiomeSource biomeSource, Supplier supplier) { @@ -109,7 +105,7 @@ public class LimboChunkGenerator extends ChunkGenerator { private LimboChunkGenerator(BiomeSource biomeSource, BiomeSource biomeSource2, Supplier supplier) { super(biomeSource, biomeSource2, supplier.get().getStructuresConfig(), new Random().nextLong()); - this.worldSeed = new Random().nextLong(); + this.worldSeed = ((ChunkGeneratorAccessor) this).getWorldSeed(); ChunkGeneratorSettings chunkGeneratorSettings = supplier.get(); this.settings = supplier; GenerationShapeConfig generationShapeConfig = chunkGeneratorSettings.getGenerationShapeConfig(); @@ -129,16 +125,40 @@ public class LimboChunkGenerator extends ChunkGenerator { this.random.consume(2620); this.densityNoise = new OctavePerlinNoiseSampler(this.random, IntStream.rangeClosed(-15, 0)); if (generationShapeConfig.hasIslandNoiseOverride()) { - ChunkRandom chunkRandom = new ChunkRandom(this.worldSeed); + ChunkRandom chunkRandom = new ChunkRandom(worldSeed); chunkRandom.consume(17292); this.islandNoise = new SimplexNoiseSampler(chunkRandom); } else { this.islandNoise = null; } - } - public final Codec getCodec() { + private static double getNoiseWeight(int x, int y, int z) { + int i = x + 12; + int j = y + 12; + int k = z + 12; + if (i >= 0 && i < 24) { + if (j >= 0 && j < 24) { + return k >= 0 && k < 24 ? (double) NOISE_WEIGHT_TABLE[k * 24 * 24 + i * 24 + j] : 0.0D; + } else { + return 0.0D; + } + } else { + return 0.0D; + } + } + + private static double calculateNoiseWeight(int x, int y, int z) { + double d = x * x + z * z; + double e = (double) y + 0.5D; + double f = e * e; + double g = Math.pow(2.718281828459045D, -(f / 16.0D + d / 16.0D)); + double h = -e * MathHelper.fastInverseSqrt(f / 2.0D + d / 2.0D) / 2.0D; + return h * g; + } + + @Override + public Codec getCodec() { return CODEC; } @@ -147,42 +167,32 @@ public class LimboChunkGenerator extends ChunkGenerator { return new LimboChunkGenerator(this.biomeSource.withSeed(seed), this.settings); } - - public boolean equals(long seed, RegistryKey registryKey) { - return this.worldSeed == seed && this.settings.get().equals(registryKey); - } - private double sampleNoise(int x, int y, int z, double horizontalScale, double verticalScale, double horizontalStretch, double verticalStretch) { double d = 0.0D; double e = 0.0D; double f = 0.0D; double g = 1.0D; - for (int i = 0; i < 16; ++i) { - double xScale = OctavePerlinNoiseSampler.maintainPrecision((double) x * horizontalScale * g); - double yScale = OctavePerlinNoiseSampler.maintainPrecision((double) y * verticalScale * g); - double zScale = OctavePerlinNoiseSampler.maintainPrecision((double) z * horizontalScale * g); + double h = OctavePerlinNoiseSampler.maintainPrecision((double) x * horizontalScale * g); + double j = OctavePerlinNoiseSampler.maintainPrecision((double) y * verticalScale * g); + double k = OctavePerlinNoiseSampler.maintainPrecision((double) z * horizontalScale * g); double l = verticalScale * g; - PerlinNoiseSampler lowerSampler = this.lowerInterpolatedNoise.getOctave(i); - if (lowerSampler != null) { - d += lowerSampler.sample(xScale, yScale, zScale, l, (double) y * l) / g; + PerlinNoiseSampler perlinNoiseSampler = this.lowerInterpolatedNoise.getOctave(i); + if (perlinNoiseSampler != null) { + d += perlinNoiseSampler.sample(h, j, k, l, (double) y * l) / g; } - - PerlinNoiseSampler upperSampler = this.upperInterpolatedNoise.getOctave(i); - if (upperSampler != null) { - e += upperSampler.sample(xScale, yScale, zScale, l, (double) y * l) / g; + PerlinNoiseSampler perlinNoiseSampler2 = this.upperInterpolatedNoise.getOctave(i); + if (perlinNoiseSampler2 != null) { + e += perlinNoiseSampler2.sample(h, j, k, l, (double) y * l) / g; } - if (i < 8) { - PerlinNoiseSampler interpolatedSampler = this.interpolationNoise.getOctave(i); - if (interpolatedSampler != null) { - f += interpolatedSampler.sample(OctavePerlinNoiseSampler.maintainPrecision((double) x * horizontalStretch * g), OctavePerlinNoiseSampler.maintainPrecision((double) y * verticalStretch * g), OctavePerlinNoiseSampler.maintainPrecision((double) z * horizontalStretch * g), verticalStretch * g, (double) y * verticalStretch * g) / g; + PerlinNoiseSampler perlinNoiseSampler3 = this.interpolationNoise.getOctave(i); + if (perlinNoiseSampler3 != null) { + f += perlinNoiseSampler3.sample(OctavePerlinNoiseSampler.maintainPrecision((double) x * horizontalStretch * g), OctavePerlinNoiseSampler.maintainPrecision((double) y * verticalStretch * g), OctavePerlinNoiseSampler.maintainPrecision((double) z * horizontalStretch * g), verticalStretch * g, (double) y * verticalStretch * g) / g; } } - g /= 2.0D; } - return MathHelper.clampedLerp(d / 512.0D, e / 512.0D, (f / 10.0D + 1.0D) / 2.0D); } @@ -194,27 +204,26 @@ public class LimboChunkGenerator extends ChunkGenerator { private void sampleNoiseColumn(double[] buffer, int x, int z) { GenerationShapeConfig generationShapeConfig = this.settings.get().getGenerationShapeConfig(); - double endNoise; - double endNoiseOffset; + double ac; + double ad; double topSlideTarget; double topSlideSize; if (this.islandNoise != null) { - endNoise = TheEndBiomeSource.getNoiseAt(this.islandNoise, x, z) - 8.0F; - if (endNoise > 0.0D) { - endNoiseOffset = 0.25D; + ac = TheEndBiomeSource.getNoiseAt(this.islandNoise, x, z) - 8.0F; + if (ac > 0.0D) { + ad = 0.25D; } else { - endNoiseOffset = 1.0D; + ad = 1.0D; } } else { float g = 0.0F; float h = 0.0F; float i = 0.0F; - int seaLevel = this.getSeaLevel(); - float depth = this.biomeSource.getBiomeForNoiseGen(x, seaLevel, z).getDepth(); - + int k = this.getSeaLevel(); + float l = this.biomeSource.getBiomeForNoiseGen(x, k, z).getDepth(); for (int m = -2; m <= 2; ++m) { for (int n = -2; n <= 2; ++n) { - Biome biome = this.biomeSource.getBiomeForNoiseGen(x + m, seaLevel, z + n); + Biome biome = this.biomeSource.getBiomeForNoiseGen(x + m, k, z + n); float o = biome.getDepth(); float p = biome.getScale(); float s; @@ -226,23 +235,21 @@ public class LimboChunkGenerator extends ChunkGenerator { s = o; t = p; } - - float u = o > depth ? 0.5F : 1.0F; + float u = o > l ? 0.5F : 1.0F; float v = u * BIOME_WEIGHT_TABLE[m + 2 + (n + 2) * 5] / (s + 2.0F); g += t * v; h += s * v; i += v; } } - float w = h / i; float y = g / i; topSlideTarget = w * 0.5F - 0.125F; topSlideSize = y * 0.9F + 0.1F; - endNoise = topSlideTarget * 0.265625D; - endNoiseOffset = 96.0D / topSlideSize; + ac = topSlideTarget * 0.265625D; + ad = 96.0D / topSlideSize; } - double xzScale = 984.412D * generationShapeConfig.getSampling().getXZScale(); + double xzScale = 684.412D * generationShapeConfig.getSampling().getXZScale(); double yScale = 684.412D * generationShapeConfig.getSampling().getYScale(); double xzFactor = xzScale / generationShapeConfig.getSampling().getXZFactor(); double yFactor = yScale / generationShapeConfig.getSampling().getYFactor(); @@ -256,29 +263,29 @@ public class LimboChunkGenerator extends ChunkGenerator { double densityFactor = generationShapeConfig.getDensityFactor(); double densityOffset = generationShapeConfig.getDensityOffset(); - for (int ar = 0; ar <= this.noiseSizeY; ++ar) { - double sampleNoise = this.sampleNoise(x, ar, z, xzScale, yScale, xzFactor, yFactor); - double ySampledDensityNoise = 1.0D - (double) ar * 2.0D / (double) this.noiseSizeY + randomDensity; - double sampledDensityFactorOffset = ySampledDensityNoise * densityFactor + densityOffset; - double av = (sampledDensityFactorOffset + endNoise) * endNoiseOffset; + for (int loop = 0; loop <= this.noiseSizeY; ++loop) { + double as = this.sampleNoise(x, loop, z, xzScale, yScale, xzFactor, yFactor); + double at = 1.0D - (double) loop * 2.0D / (double) this.noiseSizeY + randomDensity; + double au = at * densityFactor + densityOffset; + double av = (au + ac) * ad; if (av > 0.0D) { - sampleNoise += av * 4.0D; + as += av * 4.0D; } else { - sampleNoise += av; + as += av; } double ax; if (topSlideSize > 0.0D) { - ax = ((double) (this.noiseSizeY - ar) - topSlideOffset) / topSlideSize; - sampleNoise = MathHelper.clampedLerp(topSlideTarget, sampleNoise, ax); + ax = ((double) (this.noiseSizeY - loop) - topSlideOffset) / topSlideSize; + as = MathHelper.clampedLerp(topSlideTarget, as, ax); } if (bottomSlideSize > 0.0D) { - ax = ((double) ar - bottomSlideOffset) / bottomSlideSize; - sampleNoise = MathHelper.clampedLerp(bottomSlideTarget, sampleNoise, ax); + ax = ((double) loop - bottomSlideOffset) / bottomSlideSize; + as = MathHelper.clampedLerp(bottomSlideTarget, as, ax); } - buffer[ar] = sampleNoise; + buffer[loop] = as; } } @@ -296,19 +303,17 @@ public class LimboChunkGenerator extends ChunkGenerator { return g < 0.0D ? g * 0.009486607142857142D : Math.min(g, 1.0D) * 0.006640625D; } - @Override public int getHeight(int x, int z, Heightmap.Type heightmapType) { return this.sampleHeightmap(x, z, null, heightmapType.getBlockPredicate()); } - @Override public BlockView getColumnSample(int x, int z) { BlockState[] blockStates = new BlockState[this.noiseSizeY * this.verticalNoiseResolution]; this.sampleHeightmap(x, z, blockStates, null); return new VerticalBlockSample(blockStates); } - private int sampleHeightmap(int x, int z, @Nullable BlockState[] states, @Nullable Predicate predicate) { + private int sampleHeightmap(int x, int z, BlockState[] states, Predicate predicate) { int i = Math.floorDiv(x, this.horizontalNoiseResolution); int j = Math.floorDiv(z, this.horizontalNoiseResolution); int k = Math.floorMod(x, this.horizontalNoiseResolution); @@ -352,13 +357,12 @@ public class LimboChunkGenerator extends ChunkGenerator { } else if (y < this.getSeaLevel()) { blockState3 = this.defaultFluid; } else { - blockState3 = AIR; + blockState3 = Blocks.AIR.getDefaultState(); } return blockState3; } - @Override public void buildSurface(ChunkRegion region, Chunk chunk) { ChunkPos chunkPos = chunk.getPos(); int i = chunkPos.x; @@ -368,6 +372,7 @@ public class LimboChunkGenerator extends ChunkGenerator { ChunkPos chunkPos2 = chunk.getPos(); int k = chunkPos2.getStartX(); int l = chunkPos2.getStartZ(); + double d = 0.0625D; BlockPos.Mutable mutable = new BlockPos.Mutable(); for (int m = 0; m < 16; ++m) { @@ -380,10 +385,10 @@ public class LimboChunkGenerator extends ChunkGenerator { } } - this.buildEternalFluidFloor(chunk, chunkRandom); + this.buildBedrock(chunk, chunkRandom); } - private void buildEternalFluidFloor(Chunk chunk, Random random) { + private void buildBedrock(Chunk chunk, Random random) { BlockPos.Mutable mutable = new BlockPos.Mutable(); int i = chunk.getPos().getStartX(); int j = chunk.getPos().getStartZ(); @@ -393,19 +398,22 @@ public class LimboChunkGenerator extends ChunkGenerator { boolean bl = l + 4 >= 0 && l < this.worldHeight; boolean bl2 = k + 4 >= 0 && k < this.worldHeight; if (bl || bl2) { - Iterator iterator = BlockPos.iterate(i, 0, j, i + 15, 0, j + 15).iterator(); + Iterator var12 = BlockPos.iterate(i, 0, j, i + 15, 0, j + 15).iterator(); + while (true) { BlockPos blockPos; int o; - if (!iterator.hasNext()) { + if (!var12.hasNext()) { return; } - blockPos = iterator.next(); + + blockPos = var12.next(); for (o = 0; o < 5; ++o) { if (o <= random.nextInt(5)) { chunk.setBlockState(mutable.set(blockPos.getX(), l - o, blockPos.getZ()), ModBlocks.ETERNAL_FLUID.getDefaultState(), false); } } + for (o = 4; o >= 0; --o) { if (o <= random.nextInt(5)) { chunk.setBlockState(mutable.set(blockPos.getX(), k + o, blockPos.getZ()), ModBlocks.ETERNAL_FLUID.getDefaultState(), false); @@ -415,46 +423,44 @@ public class LimboChunkGenerator extends ChunkGenerator { } } - @Override public void populateNoise(WorldAccess world, StructureAccessor accessor, Chunk chunk) { - ObjectList structurePieces = new ObjectArrayList<>(10); - ObjectList jigsawJunctions = new ObjectArrayList<>(32); + ObjectList objectList = new ObjectArrayList(10); + ObjectList objectList2 = new ObjectArrayList(32); ChunkPos chunkPos = chunk.getPos(); int posX = chunkPos.x; int posZ = chunkPos.z; - int chunkX = posX << 4; - int chunkZ = posZ << 4; - - for (StructureFeature structureFeature : StructureFeature.JIGSAW_STRUCTURES) { - accessor.getStructuresWithChildren(ChunkSectionPos.from(chunkPos, 0), structureFeature).forEach((start) -> { - Iterator iterator = start.getChildren().iterator(); + int k = posX << 4; + int l = posZ << 4; + for (StructureFeature feature : StructureFeature.JIGSAW_STRUCTURES) { + accessor.getStructuresWithChildren(ChunkSectionPos.from(chunkPos, 0), feature).forEach((start) -> { + Iterator var6 = start.getChildren().iterator(); while (true) { StructurePiece structurePiece; do { - if (!iterator.hasNext()) { + if (!var6.hasNext()) { return; } - structurePiece = iterator.next(); + structurePiece = (StructurePiece) var6.next(); } while (!structurePiece.intersectsChunk(chunkPos, 12)); if (structurePiece instanceof PoolStructurePiece) { PoolStructurePiece poolStructurePiece = (PoolStructurePiece) structurePiece; StructurePool.Projection projection = poolStructurePiece.getPoolElement().getProjection(); if (projection == StructurePool.Projection.RIGID) { - structurePieces.add(poolStructurePiece); + objectList.add(poolStructurePiece); } for (JigsawJunction jigsawJunction : poolStructurePiece.getJunctions()) { int kx = jigsawJunction.getSourceX(); int lx = jigsawJunction.getSourceZ(); - if (kx > chunkX - 12 && lx > chunkZ - 12 && kx < chunkX + 15 + 12 && lx < chunkZ + 15 + 12) { - jigsawJunctions.add(jigsawJunction); + if (kx > k - 12 && lx > l - 12 && kx < k + 15 + 12 && lx < l + 15 + 12) { + objectList2.add(jigsawJunction); } } } else { - structurePieces.add(structurePiece); + objectList.add(structurePiece); } } }); @@ -472,8 +478,8 @@ public class LimboChunkGenerator extends ChunkGenerator { Heightmap heightmap = protoChunk.getHeightmap(Heightmap.Type.OCEAN_FLOOR_WG); Heightmap heightmap2 = protoChunk.getHeightmap(Heightmap.Type.WORLD_SURFACE_WG); BlockPos.Mutable mutable = new BlockPos.Mutable(); - ObjectListIterator structurePiecesIterator = structurePieces.iterator(); - ObjectListIterator objectListIterator = jigsawJunctions.iterator(); + ObjectListIterator objectListIterator = objectList.iterator(); + ObjectListIterator objectListIterator2 = objectList2.iterator(); for (int n = 0; n < this.noiseSizeX; ++n) { int p; @@ -498,10 +504,10 @@ public class LimboChunkGenerator extends ChunkGenerator { for (int u = this.verticalNoiseResolution - 1; u >= 0; --u) { int v = q * this.verticalNoiseResolution + u; int w = v & 15; - int y1 = v >> 4; - if (chunkSection.getYOffset() >> 4 != y1) { + int ax = v >> 4; + if (chunkSection.getYOffset() >> 4 != ax) { chunkSection.unlock(); - chunkSection = protoChunk.getSection(y1); + chunkSection = protoChunk.getSection(ax); chunkSection.lock(); } @@ -512,14 +518,14 @@ public class LimboChunkGenerator extends ChunkGenerator { double ac = MathHelper.lerp(y, g, t); for (int ad = 0; ad < this.horizontalNoiseResolution; ++ad) { - int ae = chunkX + n * this.horizontalNoiseResolution + ad; + int ae = k + n * this.horizontalNoiseResolution + ad; int af = ae & 15; double ag = (double) ad / (double) this.horizontalNoiseResolution; double ah = MathHelper.lerp(ag, z, aa); double ai = MathHelper.lerp(ag, ab, ac); for (int aj = 0; aj < this.horizontalNoiseResolution; ++aj) { - int ak = chunkZ + p * this.horizontalNoiseResolution + aj; + int ak = l + p * this.horizontalNoiseResolution + aj; int al = ak & 15; double am = (double) aj / (double) this.horizontalNoiseResolution; double an = MathHelper.lerp(am, ah, ai); @@ -528,27 +534,27 @@ public class LimboChunkGenerator extends ChunkGenerator { int at; int au; int ar; - for (ao = ao / 2.0D - ao * ao * ao / 24.0D; structurePiecesIterator.hasNext(); ao += getNoiseWeight(at, au, ar) * 0.8D) { - StructurePiece structurePiece = structurePiecesIterator.next(); + for (ao = ao / 2.0D - ao * ao * ao / 24.0D; objectListIterator.hasNext(); ao += getNoiseWeight(at, au, ar) * 0.8D) { + StructurePiece structurePiece = objectListIterator.next(); BlockBox blockBox = structurePiece.getBoundingBox(); at = Math.max(0, Math.max(blockBox.minX - ae, ae - blockBox.maxX)); au = v - (blockBox.minY + (structurePiece instanceof PoolStructurePiece ? ((PoolStructurePiece) structurePiece).getGroundLevelDelta() : 0)); ar = Math.max(0, Math.max(blockBox.minZ - ak, ak - blockBox.maxZ)); } - structurePiecesIterator.back(structurePieces.size()); + objectListIterator.back(objectList.size()); - while (objectListIterator.hasNext()) { - JigsawJunction jigsawJunction = objectListIterator.next(); + while (objectListIterator2.hasNext()) { + JigsawJunction jigsawJunction = objectListIterator2.next(); int as = ae - jigsawJunction.getSourceX(); at = v - jigsawJunction.getSourceGroundY(); au = ak - jigsawJunction.getSourceZ(); ao += getNoiseWeight(as, at, au) * 0.4D; } - objectListIterator.back(jigsawJunctions.size()); + objectListIterator2.back(objectList2.size()); BlockState blockState = this.getBlockState(ao, v); - if (blockState != AIR) { + if (blockState != Blocks.AIR.getDefaultState()) { if (blockState.getLuminance() != 0) { mutable.set(ae, v, ak); protoChunk.addLightSource(mutable); @@ -573,36 +579,10 @@ public class LimboChunkGenerator extends ChunkGenerator { } - private static double getNoiseWeight(int x, int y, int z) { - int i = x + 12; - int j = y + 12; - int k = z + 12; - if (i >= 0 && i < 24) { - if (j >= 0 && j < 24) { - return k >= 0 && k < 24 ? (double) NOISE_WEIGHT_TABLE[k * 24 * 24 + i * 24 + j] : 0.0D; - } else { - return 0.0D; - } - } else { - return 0.0D; - } - } - - private static double calculateNoiseWeight(int x, int y, int z) { - double d = x * x + z * z; - double e = (double) y + 0.5D; - double f = e * e; - double g = Math.pow(2.718281828459045D, -(f / 16.0D + d / 16.0D)); - double h = -e * MathHelper.fastInverseSqrt(f / 2.0D + d / 2.0D) / 2.0D; - return h * g; - } - - @Override public int getMaxY() { return this.worldHeight; } - @Override public int getSeaLevel() { return this.settings.get().getSeaLevel(); } diff --git a/src/main/java/org/dimdev/dimdoors/world/limbo/LimboDecay.java b/src/main/java/org/dimdev/dimdoors/world/limbo/LimboDecay.java index dda6136a..bf604c04 100644 --- a/src/main/java/org/dimdev/dimdoors/world/limbo/LimboDecay.java +++ b/src/main/java/org/dimdev/dimdoors/world/limbo/LimboDecay.java @@ -14,7 +14,15 @@ import net.minecraft.util.math.BlockPos; import net.minecraft.world.World; import static net.minecraft.block.Blocks.*; -import static org.dimdev.dimdoors.block.ModBlocks.*; +import static org.dimdev.dimdoors.block.ModBlocks.DETACHED_RIFT; +import static org.dimdev.dimdoors.block.ModBlocks.DIMENSIONAL_PORTAL; +import static org.dimdev.dimdoors.block.ModBlocks.ETERNAL_FLUID; +import static org.dimdev.dimdoors.block.ModBlocks.GOLD_DIMENSIONAL_DOOR; +import static org.dimdev.dimdoors.block.ModBlocks.GOLD_DOOR; +import static org.dimdev.dimdoors.block.ModBlocks.IRON_DIMENSIONAL_DOOR; +import static org.dimdev.dimdoors.block.ModBlocks.OAK_DIMENSIONAL_DOOR; +import static org.dimdev.dimdoors.block.ModBlocks.QUARTZ_DOOR; +import static org.dimdev.dimdoors.block.ModBlocks.UNRAVELLED_FABRIC; /** * Provides methods for applying Limbo decay. Limbo decay refers to the effect that most blocks placed in Limbo diff --git a/src/main/java/org/dimdev/dimdoors/world/pocket/Pocket.java b/src/main/java/org/dimdev/dimdoors/world/pocket/Pocket.java index cc5a77e5..2e4faf64 100644 --- a/src/main/java/org/dimdev/dimdoors/world/pocket/Pocket.java +++ b/src/main/java/org/dimdev/dimdoors/world/pocket/Pocket.java @@ -3,22 +3,18 @@ package org.dimdev.dimdoors.world.pocket; import com.flowpowered.math.vector.Vector3i; import com.mojang.serialization.Codec; import com.mojang.serialization.codecs.RecordCodecBuilder; -import net.minecraft.block.MaterialColor; -import net.minecraft.util.registry.RegistryKey; -import net.minecraft.world.World; import org.dimdev.annotatednbt.Saved; import org.dimdev.dimdoors.util.Codecs; import org.dimdev.dimdoors.util.EntityUtils; import net.minecraft.entity.Entity; -import net.minecraft.server.world.ServerWorld; import net.minecraft.text.TranslatableText; import net.minecraft.util.DyeColor; import net.minecraft.util.math.BlockBox; import net.minecraft.util.math.BlockPos; import net.minecraft.util.math.Vec3i; - -import java.util.stream.Stream; +import net.minecraft.util.registry.RegistryKey; +import net.minecraft.world.World; public final class Pocket { public static final Codec CODEC = RecordCodecBuilder.create(instance -> { diff --git a/src/main/java/org/dimdev/dimdoors/world/pocket/PocketRegistry.java b/src/main/java/org/dimdev/dimdoors/world/pocket/PocketRegistry.java index 9034b84b..086f428e 100644 --- a/src/main/java/org/dimdev/dimdoors/world/pocket/PocketRegistry.java +++ b/src/main/java/org/dimdev/dimdoors/world/pocket/PocketRegistry.java @@ -4,9 +4,6 @@ import java.util.HashMap; import java.util.Map; import com.mojang.serialization.Codec; -import net.minecraft.util.registry.RegistryKey; -import net.minecraft.world.World; -import org.dimdev.annotatednbt.AnnotatedNbt; import org.dimdev.annotatednbt.Saved; import org.dimdev.dimdoors.ModConfig; import org.dimdev.dimdoors.util.NbtUtil; @@ -17,7 +14,9 @@ import org.dimdev.dimdoors.world.ModDimensions; import net.minecraft.nbt.CompoundTag; import net.minecraft.server.world.ServerWorld; import net.minecraft.util.math.BlockPos; +import net.minecraft.util.registry.RegistryKey; import net.minecraft.world.PersistentState; +import net.minecraft.world.World; public class PocketRegistry extends PersistentState { private Codec> pocketsCodec = Codec.unboundedMap(Codec.INT, Pocket.CODEC); diff --git a/src/main/java/org/dimdev/dimdoors/world/pocket/PrivatePocketData.java b/src/main/java/org/dimdev/dimdoors/world/pocket/PrivatePocketData.java index 63c74a8f..18222518 100644 --- a/src/main/java/org/dimdev/dimdoors/world/pocket/PrivatePocketData.java +++ b/src/main/java/org/dimdev/dimdoors/world/pocket/PrivatePocketData.java @@ -6,17 +6,16 @@ import com.google.common.collect.BiMap; import com.google.common.collect.HashBiMap; import com.mojang.serialization.Codec; import com.mojang.serialization.codecs.RecordCodecBuilder; -import net.minecraft.util.dynamic.DynamicSerializableUuid; -import net.minecraft.util.registry.RegistryKey; -import org.dimdev.annotatednbt.AnnotatedNbt; import org.dimdev.annotatednbt.Saved; - -import net.minecraft.nbt.CompoundTag; -import net.minecraft.world.PersistentState; -import net.minecraft.world.World; import org.dimdev.dimdoors.util.NbtUtil; import org.dimdev.dimdoors.util.WorldUtil; +import net.minecraft.nbt.CompoundTag; +import net.minecraft.util.dynamic.DynamicSerializableUuid; +import net.minecraft.util.registry.RegistryKey; +import net.minecraft.world.PersistentState; +import net.minecraft.world.World; + import static net.minecraft.world.World.OVERWORLD; public class PrivatePocketData extends PersistentState { diff --git a/src/main/java/org/dimdev/dimdoors/world/pocket/VirtualLocation.java b/src/main/java/org/dimdev/dimdoors/world/pocket/VirtualLocation.java index b12df30b..510502f7 100644 --- a/src/main/java/org/dimdev/dimdoors/world/pocket/VirtualLocation.java +++ b/src/main/java/org/dimdev/dimdoors/world/pocket/VirtualLocation.java @@ -2,20 +2,18 @@ package org.dimdev.dimdoors.world.pocket; import com.mojang.serialization.Codec; import com.mojang.serialization.codecs.RecordCodecBuilder; -import net.minecraft.util.registry.RegistryKey; -import net.minecraft.world.World; import org.dimdev.annotatednbt.AnnotatedNbt; -import org.dimdev.annotatednbt.Saved; import org.dimdev.dimdoors.DimensionalDoorsInitializer; import org.dimdev.dimdoors.ModConfig; import org.dimdev.dimdoors.util.Location; -import org.dimdev.dimdoors.util.WorldUtil; import org.dimdev.dimdoors.world.ModDimensions; import net.minecraft.nbt.CompoundTag; import net.minecraft.server.world.ServerWorld; import net.minecraft.util.math.BlockPos; +import net.minecraft.util.registry.RegistryKey; import net.minecraft.world.Heightmap; +import net.minecraft.world.World; import static net.minecraft.world.World.OVERWORLD; diff --git a/src/main/resources/dimdoors.mixins.json b/src/main/resources/dimdoors.mixins.json index 00daa36a..f84e3e0f 100644 --- a/src/main/resources/dimdoors.mixins.json +++ b/src/main/resources/dimdoors.mixins.json @@ -4,6 +4,7 @@ "compatibilityLevel": "JAVA_8", "mixins": [ "BuiltinBiomesAccessor", + "ChunkGeneratorAccessor", "DefaultBiomeFeaturesMixin", "DimensionTypeAccessor", "DirectionAccessor",