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
This commit is contained in:
SD 2020-09-09 17:11:29 +05:30
parent 21a90f12f2
commit 502d86f514
No known key found for this signature in database
GPG key ID: E36B57EE08544BC5
56 changed files with 218 additions and 312 deletions

View file

@ -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;

View file

@ -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 {

View file

@ -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;

View file

@ -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<EntranceRiftBlockEntity>, ConditionalBlockEntityProvider {
public DimensionalDoorBlock(Settings settings) {

View file

@ -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 {

View file

@ -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;

View file

@ -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;

View file

@ -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;

View file

@ -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;

View file

@ -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<DetachedRiftBlockEntity> {

View file

@ -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;

View file

@ -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;

View file

@ -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;

View file

@ -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;

View file

@ -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];

View file

@ -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;

View file

@ -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";

View file

@ -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";

View file

@ -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;

View file

@ -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();
}

View file

@ -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;

View file

@ -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

View file

@ -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;

View file

@ -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<PlayerRiftPointer> CODEC = RecordCodecBuilder.create(instance -> {

View file

@ -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?

View file

@ -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<RegistryVertexType> registry = FabricRegistryBuilder.createSimple(RegistryVertex.RegistryVertexType.class, new Identifier("dimdoors", "registry_vertex")).attribute(RegistryAttribute.MODDED).buildAndRegister();

View file

@ -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<Rift> CODEC = RecordCodecBuilder.create(instance -> {
@ -26,7 +24,6 @@ public class Rift extends RegistryVertex {
});
});
private static final Logger LOGGER = LogManager.getLogger();
@Saved
public Location location;

View file

@ -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();

View file

@ -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();

View file

@ -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<GlobalReference> CODEC = Location.CODEC.fieldOf("location").xmap(GlobalReference::new, GlobalReference::getReferencedLocation).codec();

View file

@ -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<LimboTarget> CODEC = Codec.unit(LimboTarget::new);

View file

@ -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 {

View file

@ -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;

View file

@ -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 {

View file

@ -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<PublicPocketTarget> CODEC = RecordCodecBuilder.create(instance -> {
return instance.group(

View file

@ -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;

View file

@ -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 {

View file

@ -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 {

View file

@ -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

View file

@ -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

View file

@ -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<Set<Integer>> INT_SET = Codec.INT_STREAM.<Set<Integer>>comapFlatMap(a -> DataResult.success(a.boxed().collect(Collectors.toSet())), a -> a.stream().mapToInt(Integer::intValue));

View file

@ -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<Location> CODEC = RecordCodecBuilder.create(instance -> {

View file

@ -1,6 +1,7 @@
package org.dimdev.dimdoors.util;
import com.mojang.serialization.Codec;
import net.minecraft.nbt.NbtOps;
import net.minecraft.nbt.Tag;

View file

@ -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);

View file

@ -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<RotatedLocation> CODEC = RecordCodecBuilder.create(instance -> {

View file

@ -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;

View file

@ -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<World> key) {

View file

@ -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);
}

View file

@ -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;

View file

@ -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<LimboChunkGenerator> 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<ChunkGeneratorSettings> 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<ChunkGeneratorSettings> settings;
private final int worldHeight;
public LimboChunkGenerator(BiomeSource biomeSource, Supplier<ChunkGeneratorSettings> supplier) {
@ -109,7 +105,7 @@ public class LimboChunkGenerator extends ChunkGenerator {
private LimboChunkGenerator(BiomeSource biomeSource, BiomeSource biomeSource2, Supplier<ChunkGeneratorSettings> 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<? extends ChunkGenerator> 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<? extends ChunkGenerator> 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<ChunkGeneratorSettings> 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<BlockState> predicate) {
private int sampleHeightmap(int x, int z, BlockState[] states, Predicate<BlockState> 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<BlockPos> iterator = BlockPos.iterate(i, 0, j, i + 15, 0, j + 15).iterator();
Iterator<BlockPos> 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<StructurePiece> structurePieces = new ObjectArrayList<>(10);
ObjectList<JigsawJunction> jigsawJunctions = new ObjectArrayList<>(32);
ObjectList<StructurePiece> objectList = new ObjectArrayList<StructurePiece>(10);
ObjectList<JigsawJunction> objectList2 = new ObjectArrayList<JigsawJunction>(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<StructurePiece> 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<StructurePiece> 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<StructurePiece> structurePiecesIterator = structurePieces.iterator();
ObjectListIterator<JigsawJunction> objectListIterator = jigsawJunctions.iterator();
ObjectListIterator<StructurePiece> objectListIterator = objectList.iterator();
ObjectListIterator<JigsawJunction> 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();
}

View file

@ -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

View file

@ -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<Pocket> CODEC = RecordCodecBuilder.create(instance -> {

View file

@ -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<Map<Integer, Pocket>> pocketsCodec = Codec.unboundedMap(Codec.INT, Pocket.CODEC);

View file

@ -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 {

View file

@ -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;

View file

@ -4,6 +4,7 @@
"compatibilityLevel": "JAVA_8",
"mixins": [
"BuiltinBiomesAccessor",
"ChunkGeneratorAccessor",
"DefaultBiomeFeaturesMixin",
"DimensionTypeAccessor",
"DirectionAccessor",