Refactor initializers
Changes to be committed: deleted: src/main/java/org/dimdev/annotatednbt/Saved.java modified: src/main/java/org/dimdev/dimcore/schematic/v2/SchematicBlockPalette.java modified: src/main/java/org/dimdev/dimcore/schematic/v2/SchematicTest.java modified: src/main/java/org/dimdev/dimdoors/DimensionalDoorsInitializer.java modified: src/main/java/org/dimdev/dimdoors/block/entity/DetachedRiftBlockEntity.java modified: src/main/java/org/dimdev/dimdoors/block/entity/ModBlockEntityTypes.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/DetachedRiftBlockEntityRenderer.java modified: src/main/java/org/dimdev/dimdoors/client/EntranceRiftBlockEntityRenderer.java modified: src/main/java/org/dimdev/dimdoors/client/MonolithRenderer.java modified: src/main/java/org/dimdev/dimdoors/client/MyRenderLayer.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/command/DimTeleportCommand.java modified: src/main/java/org/dimdev/dimdoors/command/PocketCommand.java modified: src/main/java/org/dimdev/dimdoors/command/arguments/GroupArugmentType.java modified: src/main/java/org/dimdev/dimdoors/command/arguments/NameArugmentType.java modified: src/main/java/org/dimdev/dimdoors/entity/ai/MonolithAggroGoal.java modified: src/main/java/org/dimdev/dimdoors/item/RiftRemoverItem.java modified: src/main/java/org/dimdev/dimdoors/mixin/client/GlStateManagerAccessor.java modified: src/main/java/org/dimdev/dimdoors/mixin/client/InGameHudMixin.java modified: src/main/java/org/dimdev/dimdoors/pockets/SchematicHandler.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/EscapeTarget.java modified: src/main/java/org/dimdev/dimdoors/rift/targets/FlowTracker.java modified: src/main/java/org/dimdev/dimdoors/rift/targets/GlobalReference.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/PrivatePocketExitTarget.java modified: src/main/java/org/dimdev/dimdoors/rift/targets/PrivatePocketTarget.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/VirtualTarget.java renamed: src/main/java/org/dimdev/annotatednbt/AnnotatedNbt.java -> src/main/java/org/dimdev/dimdoors/util/AnnotatedNbt.java modified: src/main/java/org/dimdev/dimdoors/util/Location.java modified: src/main/java/org/dimdev/dimdoors/util/RotatedLocation.java modified: src/main/java/org/dimdev/dimdoors/world/ModBiomes.java modified: src/main/java/org/dimdev/dimdoors/world/ModDimensions.java modified: src/main/java/org/dimdev/dimdoors/world/feature/ModFeatures.java modified: src/main/java/org/dimdev/dimdoors/world/limbo/LimboBiomeSource.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
This commit is contained in:
parent
2d488a63d1
commit
714adbbe2a
55 changed files with 143 additions and 193 deletions
|
@ -1,4 +0,0 @@
|
||||||
package org.dimdev.annotatednbt;
|
|
||||||
|
|
||||||
public @interface Saved {
|
|
||||||
}
|
|
|
@ -7,8 +7,6 @@ import com.mojang.serialization.Codec;
|
||||||
import com.mojang.serialization.DataResult;
|
import com.mojang.serialization.DataResult;
|
||||||
import com.mojang.serialization.codecs.UnboundedMapCodec;
|
import com.mojang.serialization.codecs.UnboundedMapCodec;
|
||||||
|
|
||||||
import com.sk89q.worldedit.WorldEdit;
|
|
||||||
import com.sk89q.worldedit.world.block.BaseBlock;
|
|
||||||
import net.minecraft.block.Block;
|
import net.minecraft.block.Block;
|
||||||
import net.minecraft.block.BlockState;
|
import net.minecraft.block.BlockState;
|
||||||
import net.minecraft.state.property.Property;
|
import net.minecraft.state.property.Property;
|
||||||
|
|
|
@ -4,12 +4,11 @@ import java.io.IOException;
|
||||||
import java.nio.ByteBuffer;
|
import java.nio.ByteBuffer;
|
||||||
import java.nio.file.Files;
|
import java.nio.file.Files;
|
||||||
import java.nio.file.Path;
|
import java.nio.file.Path;
|
||||||
import java.util.stream.IntStream;
|
|
||||||
|
|
||||||
|
import org.dimdev.dimdoors.DimensionalDoorsInitializer;
|
||||||
import com.google.common.collect.ImmutableBiMap;
|
import com.google.common.collect.ImmutableBiMap;
|
||||||
import com.google.common.collect.ImmutableList;
|
import com.google.common.collect.ImmutableList;
|
||||||
import com.mojang.serialization.DataResult;
|
import com.mojang.serialization.DataResult;
|
||||||
import org.dimdev.dimdoors.DimensionalDoorsInitializer;
|
|
||||||
|
|
||||||
import net.minecraft.block.Blocks;
|
import net.minecraft.block.Blocks;
|
||||||
import net.minecraft.block.entity.BlastFurnaceBlockEntity;
|
import net.minecraft.block.entity.BlastFurnaceBlockEntity;
|
||||||
|
|
|
@ -58,13 +58,13 @@ public class DimensionalDoorsInitializer implements ModInitializer {
|
||||||
|
|
||||||
ModBlocks.init();
|
ModBlocks.init();
|
||||||
ModItems.init();
|
ModItems.init();
|
||||||
|
ModFeatures.init();
|
||||||
|
ModBiomes.init();
|
||||||
ModDimensions.init();
|
ModDimensions.init();
|
||||||
ModEntityTypes.init();
|
ModEntityTypes.init();
|
||||||
ModBiomes.init();
|
|
||||||
ModBlockEntityTypes.init();
|
ModBlockEntityTypes.init();
|
||||||
ModCommands.init();
|
ModCommands.init();
|
||||||
ModSoundEvents.init();
|
ModSoundEvents.init();
|
||||||
ModFeatures.init();
|
|
||||||
|
|
||||||
ModConfig.deserialize();
|
ModConfig.deserialize();
|
||||||
|
|
||||||
|
|
|
@ -2,7 +2,6 @@ package org.dimdev.dimdoors.block.entity;
|
||||||
|
|
||||||
import java.util.Random;
|
import java.util.Random;
|
||||||
|
|
||||||
import org.dimdev.annotatednbt.Saved;
|
|
||||||
import org.dimdev.dimdoors.ModConfig;
|
import org.dimdev.dimdoors.ModConfig;
|
||||||
import org.dimdev.dimdoors.block.ModBlocks;
|
import org.dimdev.dimdoors.block.ModBlocks;
|
||||||
import org.dimdev.dimdoors.util.TeleportUtil;
|
import org.dimdev.dimdoors.util.TeleportUtil;
|
||||||
|
@ -22,13 +21,9 @@ import net.fabricmc.api.Environment;
|
||||||
public class DetachedRiftBlockEntity extends RiftBlockEntity implements Tickable {
|
public class DetachedRiftBlockEntity extends RiftBlockEntity implements Tickable {
|
||||||
private static final Random random = new Random();
|
private static final Random random = new Random();
|
||||||
|
|
||||||
@Saved
|
|
||||||
public boolean closing = false;
|
public boolean closing = false;
|
||||||
@Saved
|
|
||||||
public boolean stabilized = false;
|
public boolean stabilized = false;
|
||||||
@Saved
|
|
||||||
public int spawnedEndermanId = 0;
|
public int spawnedEndermanId = 0;
|
||||||
@Saved
|
|
||||||
public float size = 0;
|
public float size = 0;
|
||||||
|
|
||||||
private boolean unregisterDisabled = false;
|
private boolean unregisterDisabled = false;
|
||||||
|
|
|
@ -2,10 +2,10 @@ package org.dimdev.dimdoors.block.entity;
|
||||||
|
|
||||||
import java.util.function.Supplier;
|
import java.util.function.Supplier;
|
||||||
|
|
||||||
import com.google.common.collect.Sets;
|
|
||||||
import org.dimdev.dimdoors.block.ModBlocks;
|
import org.dimdev.dimdoors.block.ModBlocks;
|
||||||
import org.dimdev.dimdoors.client.DetachedRiftBlockEntityRenderer;
|
import org.dimdev.dimdoors.client.DetachedRiftBlockEntityRenderer;
|
||||||
import org.dimdev.dimdoors.client.EntranceRiftBlockEntityRenderer;
|
import org.dimdev.dimdoors.client.EntranceRiftBlockEntityRenderer;
|
||||||
|
import com.google.common.collect.Sets;
|
||||||
|
|
||||||
import net.minecraft.block.Block;
|
import net.minecraft.block.Block;
|
||||||
import net.minecraft.block.entity.BlockEntity;
|
import net.minecraft.block.entity.BlockEntity;
|
||||||
|
|
|
@ -2,7 +2,6 @@ package org.dimdev.dimdoors.block.entity;
|
||||||
|
|
||||||
import java.util.Objects;
|
import java.util.Objects;
|
||||||
|
|
||||||
import com.mojang.serialization.Codec;
|
|
||||||
import org.apache.logging.log4j.LogManager;
|
import org.apache.logging.log4j.LogManager;
|
||||||
import org.apache.logging.log4j.Logger;
|
import org.apache.logging.log4j.Logger;
|
||||||
import org.dimdev.dimdoors.pockets.PocketTemplate;
|
import org.dimdev.dimdoors.pockets.PocketTemplate;
|
||||||
|
@ -19,6 +18,7 @@ import org.dimdev.dimdoors.util.Location;
|
||||||
import org.dimdev.dimdoors.util.NbtUtil;
|
import org.dimdev.dimdoors.util.NbtUtil;
|
||||||
import org.dimdev.dimdoors.util.RGBA;
|
import org.dimdev.dimdoors.util.RGBA;
|
||||||
import org.dimdev.dimdoors.world.pocket.VirtualLocation;
|
import org.dimdev.dimdoors.world.pocket.VirtualLocation;
|
||||||
|
import com.mojang.serialization.Codec;
|
||||||
|
|
||||||
import net.minecraft.block.BlockState;
|
import net.minecraft.block.BlockState;
|
||||||
import net.minecraft.block.entity.BlockEntity;
|
import net.minecraft.block.entity.BlockEntity;
|
||||||
|
|
|
@ -1,10 +1,10 @@
|
||||||
package org.dimdev.dimdoors.block.entity;
|
package org.dimdev.dimdoors.block.entity;
|
||||||
|
|
||||||
import com.mojang.serialization.Codec;
|
|
||||||
import com.mojang.serialization.codecs.RecordCodecBuilder;
|
|
||||||
import org.dimdev.dimdoors.rift.registry.LinkProperties;
|
import org.dimdev.dimdoors.rift.registry.LinkProperties;
|
||||||
import org.dimdev.dimdoors.rift.targets.VirtualTarget;
|
import org.dimdev.dimdoors.rift.targets.VirtualTarget;
|
||||||
import org.dimdev.dimdoors.util.RGBA;
|
import org.dimdev.dimdoors.util.RGBA;
|
||||||
|
import com.mojang.serialization.Codec;
|
||||||
|
import com.mojang.serialization.codecs.RecordCodecBuilder;
|
||||||
|
|
||||||
public class RiftData {
|
public class RiftData {
|
||||||
public static Codec<RiftData> CODEC = RecordCodecBuilder.create(instance -> {
|
public static Codec<RiftData> CODEC = RecordCodecBuilder.create(instance -> {
|
||||||
|
|
|
@ -1,10 +1,10 @@
|
||||||
package org.dimdev.dimdoors.client;
|
package org.dimdev.dimdoors.client;
|
||||||
|
|
||||||
import com.flowpowered.math.TrigMath;
|
|
||||||
import org.dimdev.dimdoors.ModConfig;
|
import org.dimdev.dimdoors.ModConfig;
|
||||||
import org.dimdev.dimdoors.block.entity.DetachedRiftBlockEntity;
|
import org.dimdev.dimdoors.block.entity.DetachedRiftBlockEntity;
|
||||||
import org.dimdev.dimdoors.client.tesseract.Tesseract;
|
import org.dimdev.dimdoors.client.tesseract.Tesseract;
|
||||||
import org.dimdev.dimdoors.util.RGBA;
|
import org.dimdev.dimdoors.util.RGBA;
|
||||||
|
import com.flowpowered.math.TrigMath;
|
||||||
|
|
||||||
import net.minecraft.client.render.VertexConsumer;
|
import net.minecraft.client.render.VertexConsumer;
|
||||||
import net.minecraft.client.render.VertexConsumerProvider;
|
import net.minecraft.client.render.VertexConsumerProvider;
|
||||||
|
|
|
@ -2,13 +2,10 @@ package org.dimdev.dimdoors.client;
|
||||||
|
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
import java.util.Random;
|
import java.util.Random;
|
||||||
import java.util.stream.Collector;
|
|
||||||
import java.util.stream.IntStream;
|
import java.util.stream.IntStream;
|
||||||
|
|
||||||
import com.google.common.collect.ImmutableList;
|
|
||||||
import it.unimi.dsi.fastutil.ints.AbstractInt2FloatMap;
|
|
||||||
import org.dimdev.dimdoors.block.entity.EntranceRiftBlockEntity;
|
import org.dimdev.dimdoors.block.entity.EntranceRiftBlockEntity;
|
||||||
import org.dimdev.dimdoors.util.RGBA;
|
import com.google.common.collect.ImmutableList;
|
||||||
|
|
||||||
import net.minecraft.client.MinecraftClient;
|
import net.minecraft.client.MinecraftClient;
|
||||||
import net.minecraft.client.render.RenderLayer;
|
import net.minecraft.client.render.RenderLayer;
|
||||||
|
|
|
@ -2,8 +2,8 @@ package org.dimdev.dimdoors.client;
|
||||||
|
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
|
|
||||||
import com.google.common.collect.Lists;
|
|
||||||
import org.dimdev.dimdoors.entity.MonolithEntity;
|
import org.dimdev.dimdoors.entity.MonolithEntity;
|
||||||
|
import com.google.common.collect.Lists;
|
||||||
|
|
||||||
import net.minecraft.client.render.entity.EntityRenderDispatcher;
|
import net.minecraft.client.render.entity.EntityRenderDispatcher;
|
||||||
import net.minecraft.client.render.entity.LivingEntityRenderer;
|
import net.minecraft.client.render.entity.LivingEntityRenderer;
|
||||||
|
|
|
@ -3,12 +3,12 @@ package org.dimdev.dimdoors.client;
|
||||||
import java.util.Arrays;
|
import java.util.Arrays;
|
||||||
import java.util.Random;
|
import java.util.Random;
|
||||||
|
|
||||||
|
import org.dimdev.dimdoors.mixin.DirectionAccessor;
|
||||||
|
import org.lwjgl.opengl.GL11;
|
||||||
import com.flowpowered.math.vector.VectorNi;
|
import com.flowpowered.math.vector.VectorNi;
|
||||||
import com.mojang.blaze3d.systems.RenderSystem;
|
import com.mojang.blaze3d.systems.RenderSystem;
|
||||||
import org.dimdev.dimdoors.block.entity.EntranceRiftBlockEntity;
|
import static org.lwjgl.opengl.GL11.GL_ONE_MINUS_DST_COLOR;
|
||||||
import org.dimdev.dimdoors.mixin.DirectionAccessor;
|
import static org.lwjgl.opengl.GL11.GL_ZERO;
|
||||||
import org.dimdev.dimdoors.util.RGBA;
|
|
||||||
import org.lwjgl.opengl.GL11;
|
|
||||||
|
|
||||||
import net.minecraft.block.enums.DoorHinge;
|
import net.minecraft.block.enums.DoorHinge;
|
||||||
import net.minecraft.client.render.RenderLayer;
|
import net.minecraft.client.render.RenderLayer;
|
||||||
|
@ -20,12 +20,6 @@ import net.minecraft.state.property.BooleanProperty;
|
||||||
import net.minecraft.state.property.DirectionProperty;
|
import net.minecraft.state.property.DirectionProperty;
|
||||||
import net.minecraft.state.property.EnumProperty;
|
import net.minecraft.state.property.EnumProperty;
|
||||||
import net.minecraft.util.Identifier;
|
import net.minecraft.util.Identifier;
|
||||||
import net.minecraft.util.Util;
|
|
||||||
import net.minecraft.util.math.Direction;
|
|
||||||
import net.minecraft.util.math.Vec3d;
|
|
||||||
|
|
||||||
import static org.lwjgl.opengl.GL11.GL_ONE_MINUS_DST_COLOR;
|
|
||||||
import static org.lwjgl.opengl.GL11.GL_ZERO;
|
|
||||||
|
|
||||||
public class MyRenderLayer extends RenderLayer {
|
public class MyRenderLayer extends RenderLayer {
|
||||||
public static final Identifier WARP_PATH = new Identifier("dimdoors:textures/other/warp.png");
|
public static final Identifier WARP_PATH = new Identifier("dimdoors:textures/other/warp.png");
|
||||||
|
|
|
@ -1,9 +1,9 @@
|
||||||
package org.dimdev.dimdoors.client.tesseract;
|
package org.dimdev.dimdoors.client.tesseract;
|
||||||
|
|
||||||
|
import org.dimdev.dimdoors.util.RGBA;
|
||||||
import com.flowpowered.math.matrix.Matrix4f;
|
import com.flowpowered.math.matrix.Matrix4f;
|
||||||
import com.flowpowered.math.vector.Vector3f;
|
import com.flowpowered.math.vector.Vector3f;
|
||||||
import com.flowpowered.math.vector.Vector4f;
|
import com.flowpowered.math.vector.Vector4f;
|
||||||
import org.dimdev.dimdoors.util.RGBA;
|
|
||||||
|
|
||||||
import net.minecraft.client.render.VertexConsumer;
|
import net.minecraft.client.render.VertexConsumer;
|
||||||
|
|
||||||
|
|
|
@ -1,7 +1,7 @@
|
||||||
package org.dimdev.dimdoors.client.tesseract;
|
package org.dimdev.dimdoors.client.tesseract;
|
||||||
|
|
||||||
import com.flowpowered.math.vector.Vector4f;
|
|
||||||
import org.dimdev.dimdoors.util.RGBA;
|
import org.dimdev.dimdoors.util.RGBA;
|
||||||
|
import com.flowpowered.math.vector.Vector4f;
|
||||||
|
|
||||||
import net.minecraft.client.render.VertexConsumer;
|
import net.minecraft.client.render.VertexConsumer;
|
||||||
import net.minecraft.util.math.Matrix4f;
|
import net.minecraft.util.math.Matrix4f;
|
||||||
|
|
|
@ -1,7 +1,6 @@
|
||||||
package org.dimdev.dimdoors.command;
|
package org.dimdev.dimdoors.command;
|
||||||
|
|
||||||
import com.mojang.brigadier.CommandDispatcher;
|
import com.mojang.brigadier.CommandDispatcher;
|
||||||
import org.dimdev.dimdoors.util.TeleportUtil;
|
|
||||||
|
|
||||||
import net.minecraft.command.argument.DimensionArgumentType;
|
import net.minecraft.command.argument.DimensionArgumentType;
|
||||||
import net.minecraft.command.argument.Vec3ArgumentType;
|
import net.minecraft.command.argument.Vec3ArgumentType;
|
||||||
|
@ -10,8 +9,6 @@ import net.minecraft.server.command.ServerCommandSource;
|
||||||
import net.minecraft.server.network.ServerPlayerEntity;
|
import net.minecraft.server.network.ServerPlayerEntity;
|
||||||
import net.minecraft.server.world.ServerWorld;
|
import net.minecraft.server.world.ServerWorld;
|
||||||
import net.minecraft.util.math.Vec3d;
|
import net.minecraft.util.math.Vec3d;
|
||||||
import net.minecraft.util.registry.RegistryKey;
|
|
||||||
import net.minecraft.world.World;
|
|
||||||
|
|
||||||
public class DimTeleportCommand {
|
public class DimTeleportCommand {
|
||||||
public static void register(CommandDispatcher<ServerCommandSource> dispatcher) {
|
public static void register(CommandDispatcher<ServerCommandSource> dispatcher) {
|
||||||
|
|
|
@ -1,10 +1,5 @@
|
||||||
package org.dimdev.dimdoors.command;
|
package org.dimdev.dimdoors.command;
|
||||||
|
|
||||||
import com.flowpowered.math.vector.Vector3i;
|
|
||||||
import com.mojang.brigadier.CommandDispatcher;
|
|
||||||
import com.mojang.brigadier.arguments.BoolArgumentType;
|
|
||||||
import com.mojang.brigadier.context.CommandContext;
|
|
||||||
import com.mojang.brigadier.exceptions.CommandSyntaxException;
|
|
||||||
import org.dimdev.dimdoors.command.arguments.GroupArugmentType;
|
import org.dimdev.dimdoors.command.arguments.GroupArugmentType;
|
||||||
import org.dimdev.dimdoors.command.arguments.NameArugmentType;
|
import org.dimdev.dimdoors.command.arguments.NameArugmentType;
|
||||||
import org.dimdev.dimdoors.pockets.PocketGenerator;
|
import org.dimdev.dimdoors.pockets.PocketGenerator;
|
||||||
|
@ -16,6 +11,11 @@ import org.dimdev.dimdoors.util.Location;
|
||||||
import org.dimdev.dimdoors.util.TeleportUtil;
|
import org.dimdev.dimdoors.util.TeleportUtil;
|
||||||
import org.dimdev.dimdoors.world.ModDimensions;
|
import org.dimdev.dimdoors.world.ModDimensions;
|
||||||
import org.dimdev.dimdoors.world.pocket.Pocket;
|
import org.dimdev.dimdoors.world.pocket.Pocket;
|
||||||
|
import com.flowpowered.math.vector.Vector3i;
|
||||||
|
import com.mojang.brigadier.CommandDispatcher;
|
||||||
|
import com.mojang.brigadier.arguments.BoolArgumentType;
|
||||||
|
import com.mojang.brigadier.context.CommandContext;
|
||||||
|
import com.mojang.brigadier.exceptions.CommandSyntaxException;
|
||||||
|
|
||||||
import net.minecraft.command.CommandException;
|
import net.minecraft.command.CommandException;
|
||||||
import net.minecraft.server.command.CommandManager;
|
import net.minecraft.server.command.CommandManager;
|
||||||
|
|
|
@ -2,14 +2,14 @@ package org.dimdev.dimdoors.command.arguments;
|
||||||
|
|
||||||
import java.util.concurrent.CompletableFuture;
|
import java.util.concurrent.CompletableFuture;
|
||||||
|
|
||||||
|
import org.dimdev.dimdoors.pockets.PocketTemplate;
|
||||||
|
import org.dimdev.dimdoors.pockets.SchematicHandler;
|
||||||
import com.mojang.brigadier.StringReader;
|
import com.mojang.brigadier.StringReader;
|
||||||
import com.mojang.brigadier.arguments.ArgumentType;
|
import com.mojang.brigadier.arguments.ArgumentType;
|
||||||
import com.mojang.brigadier.context.CommandContext;
|
import com.mojang.brigadier.context.CommandContext;
|
||||||
import com.mojang.brigadier.exceptions.CommandSyntaxException;
|
import com.mojang.brigadier.exceptions.CommandSyntaxException;
|
||||||
import com.mojang.brigadier.suggestion.Suggestions;
|
import com.mojang.brigadier.suggestion.Suggestions;
|
||||||
import com.mojang.brigadier.suggestion.SuggestionsBuilder;
|
import com.mojang.brigadier.suggestion.SuggestionsBuilder;
|
||||||
import org.dimdev.dimdoors.pockets.PocketTemplate;
|
|
||||||
import org.dimdev.dimdoors.pockets.SchematicHandler;
|
|
||||||
|
|
||||||
import net.minecraft.server.command.CommandSource;
|
import net.minecraft.server.command.CommandSource;
|
||||||
|
|
||||||
|
|
|
@ -2,13 +2,13 @@ package org.dimdev.dimdoors.command.arguments;
|
||||||
|
|
||||||
import java.util.concurrent.CompletableFuture;
|
import java.util.concurrent.CompletableFuture;
|
||||||
|
|
||||||
|
import org.dimdev.dimdoors.pockets.SchematicHandler;
|
||||||
import com.mojang.brigadier.StringReader;
|
import com.mojang.brigadier.StringReader;
|
||||||
import com.mojang.brigadier.arguments.ArgumentType;
|
import com.mojang.brigadier.arguments.ArgumentType;
|
||||||
import com.mojang.brigadier.context.CommandContext;
|
import com.mojang.brigadier.context.CommandContext;
|
||||||
import com.mojang.brigadier.exceptions.CommandSyntaxException;
|
import com.mojang.brigadier.exceptions.CommandSyntaxException;
|
||||||
import com.mojang.brigadier.suggestion.Suggestions;
|
import com.mojang.brigadier.suggestion.Suggestions;
|
||||||
import com.mojang.brigadier.suggestion.SuggestionsBuilder;
|
import com.mojang.brigadier.suggestion.SuggestionsBuilder;
|
||||||
import org.dimdev.dimdoors.pockets.SchematicHandler;
|
|
||||||
|
|
||||||
import net.minecraft.server.command.CommandSource;
|
import net.minecraft.server.command.CommandSource;
|
||||||
|
|
||||||
|
|
|
@ -9,6 +9,7 @@ import org.dimdev.dimdoors.ModConfig;
|
||||||
import org.dimdev.dimdoors.entity.MonolithEntity;
|
import org.dimdev.dimdoors.entity.MonolithEntity;
|
||||||
import org.dimdev.dimdoors.item.ModItems;
|
import org.dimdev.dimdoors.item.ModItems;
|
||||||
import org.dimdev.dimdoors.sound.ModSoundEvents;
|
import org.dimdev.dimdoors.sound.ModSoundEvents;
|
||||||
|
import static org.dimdev.dimdoors.entity.MonolithEntity.MAX_AGGRO;
|
||||||
|
|
||||||
import net.minecraft.entity.ai.TargetPredicate;
|
import net.minecraft.entity.ai.TargetPredicate;
|
||||||
import net.minecraft.entity.ai.goal.Goal;
|
import net.minecraft.entity.ai.goal.Goal;
|
||||||
|
@ -20,7 +21,6 @@ import net.minecraft.util.math.BlockPos;
|
||||||
|
|
||||||
import net.fabricmc.fabric.api.network.ServerSidePacketRegistry;
|
import net.fabricmc.fabric.api.network.ServerSidePacketRegistry;
|
||||||
import static net.minecraft.predicate.entity.EntityPredicates.EXCEPT_SPECTATOR;
|
import static net.minecraft.predicate.entity.EntityPredicates.EXCEPT_SPECTATOR;
|
||||||
import static org.dimdev.dimdoors.entity.MonolithEntity.MAX_AGGRO;
|
|
||||||
|
|
||||||
public class MonolithAggroGoal extends Goal {
|
public class MonolithAggroGoal extends Goal {
|
||||||
protected final MonolithEntity mob;
|
protected final MonolithEntity mob;
|
||||||
|
|
|
@ -9,7 +9,6 @@ import org.dimdev.dimdoors.client.DetachedRiftBlockEntityRenderer;
|
||||||
import org.dimdev.dimdoors.sound.ModSoundEvents;
|
import org.dimdev.dimdoors.sound.ModSoundEvents;
|
||||||
|
|
||||||
import net.minecraft.client.item.TooltipContext;
|
import net.minecraft.client.item.TooltipContext;
|
||||||
import net.minecraft.client.resource.language.I18n;
|
|
||||||
import net.minecraft.entity.player.PlayerEntity;
|
import net.minecraft.entity.player.PlayerEntity;
|
||||||
import net.minecraft.item.Item;
|
import net.minecraft.item.Item;
|
||||||
import net.minecraft.item.ItemStack;
|
import net.minecraft.item.ItemStack;
|
||||||
|
|
|
@ -2,9 +2,9 @@ package org.dimdev.dimdoors.mixin.client;
|
||||||
|
|
||||||
import java.nio.FloatBuffer;
|
import java.nio.FloatBuffer;
|
||||||
|
|
||||||
import com.mojang.blaze3d.platform.GlStateManager;
|
|
||||||
import org.spongepowered.asm.mixin.Mixin;
|
import org.spongepowered.asm.mixin.Mixin;
|
||||||
import org.spongepowered.asm.mixin.gen.Invoker;
|
import org.spongepowered.asm.mixin.gen.Invoker;
|
||||||
|
import com.mojang.blaze3d.platform.GlStateManager;
|
||||||
|
|
||||||
import net.fabricmc.api.EnvType;
|
import net.fabricmc.api.EnvType;
|
||||||
import net.fabricmc.api.Environment;
|
import net.fabricmc.api.Environment;
|
||||||
|
|
|
@ -1,11 +1,11 @@
|
||||||
package org.dimdev.dimdoors.mixin.client;
|
package org.dimdev.dimdoors.mixin.client;
|
||||||
|
|
||||||
import com.mojang.blaze3d.systems.RenderSystem;
|
|
||||||
import org.dimdev.dimdoors.world.ModBiomes;
|
import org.dimdev.dimdoors.world.ModBiomes;
|
||||||
import org.spongepowered.asm.mixin.Mixin;
|
import org.spongepowered.asm.mixin.Mixin;
|
||||||
import org.spongepowered.asm.mixin.injection.At;
|
import org.spongepowered.asm.mixin.injection.At;
|
||||||
import org.spongepowered.asm.mixin.injection.Inject;
|
import org.spongepowered.asm.mixin.injection.Inject;
|
||||||
import org.spongepowered.asm.mixin.injection.callback.CallbackInfo;
|
import org.spongepowered.asm.mixin.injection.callback.CallbackInfo;
|
||||||
|
import com.mojang.blaze3d.systems.RenderSystem;
|
||||||
|
|
||||||
import net.minecraft.client.gui.hud.InGameHud;
|
import net.minecraft.client.gui.hud.InGameHud;
|
||||||
import net.minecraft.entity.Entity;
|
import net.minecraft.entity.Entity;
|
||||||
|
|
|
@ -23,10 +23,6 @@ import java.util.Map.Entry;
|
||||||
import java.util.Set;
|
import java.util.Set;
|
||||||
import java.util.stream.Collectors;
|
import java.util.stream.Collectors;
|
||||||
|
|
||||||
import com.google.gson.JsonArray;
|
|
||||||
import com.google.gson.JsonElement;
|
|
||||||
import com.google.gson.JsonObject;
|
|
||||||
import com.google.gson.JsonParser;
|
|
||||||
import org.apache.commons.io.IOUtils;
|
import org.apache.commons.io.IOUtils;
|
||||||
import org.apache.logging.log4j.LogManager;
|
import org.apache.logging.log4j.LogManager;
|
||||||
import org.apache.logging.log4j.Logger;
|
import org.apache.logging.log4j.Logger;
|
||||||
|
@ -34,6 +30,10 @@ import org.dimdev.dimcore.schematic.Schematic;
|
||||||
import org.dimdev.dimdoors.DimensionalDoorsInitializer;
|
import org.dimdev.dimdoors.DimensionalDoorsInitializer;
|
||||||
import org.dimdev.dimdoors.ModConfig;
|
import org.dimdev.dimdoors.ModConfig;
|
||||||
import org.dimdev.dimdoors.util.math.MathUtil;
|
import org.dimdev.dimdoors.util.math.MathUtil;
|
||||||
|
import com.google.gson.JsonArray;
|
||||||
|
import com.google.gson.JsonElement;
|
||||||
|
import com.google.gson.JsonObject;
|
||||||
|
import com.google.gson.JsonParser;
|
||||||
|
|
||||||
import net.minecraft.nbt.CompoundTag;
|
import net.minecraft.nbt.CompoundTag;
|
||||||
import net.minecraft.nbt.NbtIo;
|
import net.minecraft.nbt.NbtIo;
|
||||||
|
|
|
@ -4,10 +4,9 @@ import java.util.HashSet;
|
||||||
import java.util.Objects;
|
import java.util.Objects;
|
||||||
import java.util.Set;
|
import java.util.Set;
|
||||||
|
|
||||||
|
import org.dimdev.dimdoors.util.Codecs;
|
||||||
import com.mojang.serialization.Codec;
|
import com.mojang.serialization.Codec;
|
||||||
import com.mojang.serialization.codecs.RecordCodecBuilder;
|
import com.mojang.serialization.codecs.RecordCodecBuilder;
|
||||||
import org.dimdev.annotatednbt.Saved;
|
|
||||||
import org.dimdev.dimdoors.util.Codecs;
|
|
||||||
|
|
||||||
|
|
||||||
public class LinkProperties {
|
public class LinkProperties {
|
||||||
|
@ -39,11 +38,8 @@ public class LinkProperties {
|
||||||
public float floatingWeight; // TODO: depend on rift properties (ex. size, stability, or maybe a getWeightFactor method) rather than rift type
|
public float floatingWeight; // TODO: depend on rift properties (ex. size, stability, or maybe a getWeightFactor method) rather than rift type
|
||||||
|
|
||||||
public float entranceWeight;
|
public float entranceWeight;
|
||||||
@Saved
|
|
||||||
public Set<Integer> groups = new HashSet<>();
|
public Set<Integer> groups = new HashSet<>();
|
||||||
@Saved
|
|
||||||
public int linksRemaining;
|
public int linksRemaining;
|
||||||
@Saved
|
|
||||||
public boolean oneWay;
|
public boolean oneWay;
|
||||||
|
|
||||||
public LinkProperties(float floatingWeight, float entranceWeight, Set<Integer> groups, int linksRemaining, boolean oneWay) {
|
public LinkProperties(float floatingWeight, float entranceWeight, Set<Integer> groups, int linksRemaining, boolean oneWay) {
|
||||||
|
|
|
@ -4,7 +4,6 @@ import java.util.UUID;
|
||||||
|
|
||||||
import com.mojang.serialization.Codec;
|
import com.mojang.serialization.Codec;
|
||||||
import com.mojang.serialization.codecs.RecordCodecBuilder;
|
import com.mojang.serialization.codecs.RecordCodecBuilder;
|
||||||
import org.dimdev.annotatednbt.Saved;
|
|
||||||
|
|
||||||
import net.minecraft.util.dynamic.DynamicSerializableUuid;
|
import net.minecraft.util.dynamic.DynamicSerializableUuid;
|
||||||
|
|
||||||
|
@ -20,7 +19,6 @@ public class PlayerRiftPointer extends RegistryVertex {
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
|
|
||||||
@Saved
|
|
||||||
public UUID player;
|
public UUID player;
|
||||||
|
|
||||||
public PlayerRiftPointer(UUID player) {
|
public PlayerRiftPointer(UUID player) {
|
||||||
|
|
|
@ -2,7 +2,6 @@ package org.dimdev.dimdoors.rift.registry;
|
||||||
|
|
||||||
import com.mojang.serialization.Codec;
|
import com.mojang.serialization.Codec;
|
||||||
import com.mojang.serialization.codecs.RecordCodecBuilder;
|
import com.mojang.serialization.codecs.RecordCodecBuilder;
|
||||||
import org.dimdev.annotatednbt.Saved;
|
|
||||||
|
|
||||||
import net.minecraft.util.dynamic.DynamicSerializableUuid;
|
import net.minecraft.util.dynamic.DynamicSerializableUuid;
|
||||||
import net.minecraft.util.registry.RegistryKey;
|
import net.minecraft.util.registry.RegistryKey;
|
||||||
|
@ -21,9 +20,7 @@ public class PocketEntrancePointer extends RegistryVertex { // TODO: PocketRiftP
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
|
|
||||||
@Saved
|
|
||||||
public RegistryKey<World> pocketDim;
|
public RegistryKey<World> pocketDim;
|
||||||
@Saved
|
|
||||||
public int pocketId;
|
public int pocketId;
|
||||||
|
|
||||||
public PocketEntrancePointer(RegistryKey<World> pocketDim, int pocketId) {
|
public PocketEntrancePointer(RegistryKey<World> pocketDim, int pocketId) {
|
||||||
|
|
|
@ -3,7 +3,6 @@ package org.dimdev.dimdoors.rift.registry;
|
||||||
import java.util.UUID;
|
import java.util.UUID;
|
||||||
|
|
||||||
import com.mojang.serialization.Codec;
|
import com.mojang.serialization.Codec;
|
||||||
import org.dimdev.annotatednbt.Saved;
|
|
||||||
|
|
||||||
import net.minecraft.util.Identifier;
|
import net.minecraft.util.Identifier;
|
||||||
import net.minecraft.util.registry.Registry;
|
import net.minecraft.util.registry.Registry;
|
||||||
|
@ -20,7 +19,6 @@ public abstract class RegistryVertex {
|
||||||
|
|
||||||
public static final Codec<RegistryVertex> CODEC = registry.dispatch(RegistryVertex::getType, RegistryVertexType::codec);
|
public static final Codec<RegistryVertex> CODEC = registry.dispatch(RegistryVertex::getType, RegistryVertexType::codec);
|
||||||
|
|
||||||
@Saved
|
|
||||||
public UUID id = UUID.randomUUID(); // Used to create pointers to registry vertices. Should not be used for anything other than saving.
|
public UUID id = UUID.randomUUID(); // Used to create pointers to registry vertices. Should not be used for anything other than saving.
|
||||||
|
|
||||||
public void sourceGone(RegistryVertex source) {
|
public void sourceGone(RegistryVertex source) {
|
||||||
|
|
|
@ -1,12 +1,11 @@
|
||||||
package org.dimdev.dimdoors.rift.registry;
|
package org.dimdev.dimdoors.rift.registry;
|
||||||
|
|
||||||
import com.mojang.serialization.Codec;
|
|
||||||
import com.mojang.serialization.codecs.RecordCodecBuilder;
|
|
||||||
import org.apache.logging.log4j.LogManager;
|
import org.apache.logging.log4j.LogManager;
|
||||||
import org.apache.logging.log4j.Logger;
|
import org.apache.logging.log4j.Logger;
|
||||||
import org.dimdev.annotatednbt.Saved;
|
|
||||||
import org.dimdev.dimdoors.block.entity.RiftBlockEntity;
|
import org.dimdev.dimdoors.block.entity.RiftBlockEntity;
|
||||||
import org.dimdev.dimdoors.util.Location;
|
import org.dimdev.dimdoors.util.Location;
|
||||||
|
import com.mojang.serialization.Codec;
|
||||||
|
import com.mojang.serialization.codecs.RecordCodecBuilder;
|
||||||
|
|
||||||
import net.minecraft.util.dynamic.DynamicSerializableUuid;
|
import net.minecraft.util.dynamic.DynamicSerializableUuid;
|
||||||
|
|
||||||
|
@ -25,11 +24,8 @@ public class Rift extends RegistryVertex {
|
||||||
});
|
});
|
||||||
|
|
||||||
private static final Logger LOGGER = LogManager.getLogger();
|
private static final Logger LOGGER = LogManager.getLogger();
|
||||||
@Saved
|
|
||||||
public Location location;
|
public Location location;
|
||||||
@Saved
|
|
||||||
public boolean isDetached;
|
public boolean isDetached;
|
||||||
@Saved
|
|
||||||
public LinkProperties properties;
|
public LinkProperties properties;
|
||||||
|
|
||||||
public Rift(Location location) {
|
public Rift(Location location) {
|
||||||
|
|
|
@ -1,8 +1,8 @@
|
||||||
package org.dimdev.dimdoors.rift.registry;
|
package org.dimdev.dimdoors.rift.registry;
|
||||||
|
|
||||||
import com.mojang.serialization.Codec;
|
|
||||||
import org.apache.logging.log4j.LogManager;
|
import org.apache.logging.log4j.LogManager;
|
||||||
import org.apache.logging.log4j.Logger;
|
import org.apache.logging.log4j.Logger;
|
||||||
|
import com.mojang.serialization.Codec;
|
||||||
|
|
||||||
import net.minecraft.util.dynamic.DynamicSerializableUuid;
|
import net.minecraft.util.dynamic.DynamicSerializableUuid;
|
||||||
|
|
||||||
|
|
|
@ -18,6 +18,7 @@ import org.dimdev.dimdoors.world.pocket.PocketRegistry;
|
||||||
import org.dimdev.dimdoors.world.pocket.PrivatePocketData;
|
import org.dimdev.dimdoors.world.pocket.PrivatePocketData;
|
||||||
import org.jgrapht.graph.DefaultDirectedGraph;
|
import org.jgrapht.graph.DefaultDirectedGraph;
|
||||||
import org.jgrapht.graph.DefaultEdge;
|
import org.jgrapht.graph.DefaultEdge;
|
||||||
|
import static org.dimdev.dimdoors.DimensionalDoorsInitializer.getWorld;
|
||||||
|
|
||||||
import net.minecraft.nbt.CompoundTag;
|
import net.minecraft.nbt.CompoundTag;
|
||||||
import net.minecraft.nbt.ListTag;
|
import net.minecraft.nbt.ListTag;
|
||||||
|
@ -26,7 +27,6 @@ import net.minecraft.world.PersistentState;
|
||||||
import net.minecraft.world.World;
|
import net.minecraft.world.World;
|
||||||
|
|
||||||
import static net.minecraft.world.World.OVERWORLD;
|
import static net.minecraft.world.World.OVERWORLD;
|
||||||
import static org.dimdev.dimdoors.DimensionalDoorsInitializer.getWorld;
|
|
||||||
|
|
||||||
public class RiftRegistry extends PersistentState {
|
public class RiftRegistry extends PersistentState {
|
||||||
private static final Logger LOGGER = LogManager.getLogger();
|
private static final Logger LOGGER = LogManager.getLogger();
|
||||||
|
|
|
@ -2,21 +2,20 @@ package org.dimdev.dimdoors.rift.targets;
|
||||||
|
|
||||||
import java.util.UUID;
|
import java.util.UUID;
|
||||||
|
|
||||||
import com.mojang.serialization.Codec;
|
|
||||||
import com.mojang.serialization.codecs.RecordCodecBuilder;
|
|
||||||
import org.dimdev.dimdoors.block.entity.RiftBlockEntity;
|
import org.dimdev.dimdoors.block.entity.RiftBlockEntity;
|
||||||
import org.dimdev.dimdoors.rift.registry.RiftRegistry;
|
import org.dimdev.dimdoors.rift.registry.RiftRegistry;
|
||||||
import org.dimdev.dimdoors.util.Location;
|
import org.dimdev.dimdoors.util.Location;
|
||||||
import org.dimdev.dimdoors.util.TeleportUtil;
|
import org.dimdev.dimdoors.util.TeleportUtil;
|
||||||
import org.dimdev.dimdoors.world.ModDimensions;
|
import org.dimdev.dimdoors.world.ModDimensions;
|
||||||
import org.dimdev.dimdoors.world.pocket.VirtualLocation;
|
import org.dimdev.dimdoors.world.pocket.VirtualLocation;
|
||||||
|
import com.mojang.serialization.Codec;
|
||||||
|
import com.mojang.serialization.codecs.RecordCodecBuilder;
|
||||||
|
import static org.dimdev.dimdoors.util.EntityUtils.chat;
|
||||||
|
|
||||||
import net.minecraft.entity.Entity;
|
import net.minecraft.entity.Entity;
|
||||||
import net.minecraft.server.world.ServerWorld;
|
import net.minecraft.server.world.ServerWorld;
|
||||||
import net.minecraft.text.TranslatableText;
|
import net.minecraft.text.TranslatableText;
|
||||||
|
|
||||||
import static org.dimdev.dimdoors.util.EntityUtils.chat;
|
|
||||||
|
|
||||||
public class EscapeTarget extends VirtualTarget implements EntityTarget { // TODO: createRift option
|
public class EscapeTarget extends VirtualTarget implements EntityTarget { // TODO: createRift option
|
||||||
public static final Codec<EscapeTarget> CODEC = RecordCodecBuilder.create(instance -> {
|
public static final Codec<EscapeTarget> CODEC = RecordCodecBuilder.create(instance -> {
|
||||||
return instance.group(
|
return instance.group(
|
||||||
|
|
|
@ -1,31 +1,28 @@
|
||||||
package org.dimdev.dimdoors.rift.targets;
|
//package org.dimdev.dimdoors.rift.targets;
|
||||||
|
//
|
||||||
import java.util.HashMap;
|
//import java.util.HashMap;
|
||||||
import java.util.Map;
|
//import java.util.Map;
|
||||||
|
//
|
||||||
import org.dimdev.annotatednbt.AnnotatedNbt;
|
//import org.dimdev.dimdoors.util.AnnotatedNbt;
|
||||||
import org.dimdev.annotatednbt.Saved;
|
//
|
||||||
|
//import net.minecraft.nbt.CompoundTag;
|
||||||
import net.minecraft.nbt.CompoundTag;
|
//import net.minecraft.util.math.Direction;
|
||||||
import net.minecraft.util.math.Direction;
|
//
|
||||||
|
///**
|
||||||
/**
|
// * Helps flow (fluid, redstone, power) senders to keep track of flow received by the
|
||||||
* Helps flow (fluid, redstone, power) senders to keep track of flow received by the
|
// * target rift.
|
||||||
* target rift.
|
// */
|
||||||
*/
|
//
|
||||||
|
//public class FlowTracker { // TODO
|
||||||
public class FlowTracker { // TODO
|
// //@Saved public Map<Direction, Map<Fluid, Integer>> fluids = new HashMap<>();
|
||||||
//@Saved public Map<Direction, Map<Fluid, Integer>> fluids = new HashMap<>();
|
// public Map<Direction, Integer> redstone = new HashMap<>();
|
||||||
@Saved
|
// public Map<Direction, Integer> power = new HashMap<>();
|
||||||
public Map<Direction, Integer> redstone = new HashMap<>();
|
//
|
||||||
@Saved
|
// public void fromTag(CompoundTag nbt) {
|
||||||
public Map<Direction, Integer> power = new HashMap<>();
|
// AnnotatedNbt.load(this, nbt);
|
||||||
|
// }
|
||||||
public void fromTag(CompoundTag nbt) {
|
//
|
||||||
AnnotatedNbt.load(this, nbt);
|
// public CompoundTag toTag(CompoundTag nbt) {
|
||||||
}
|
// return AnnotatedNbt.serialize(this);
|
||||||
|
// }
|
||||||
public CompoundTag toTag(CompoundTag nbt) {
|
//}
|
||||||
return AnnotatedNbt.serialize(this);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
|
@ -1,7 +1,7 @@
|
||||||
package org.dimdev.dimdoors.rift.targets;
|
package org.dimdev.dimdoors.rift.targets;
|
||||||
|
|
||||||
import com.mojang.serialization.Codec;
|
|
||||||
import org.dimdev.dimdoors.util.Location;
|
import org.dimdev.dimdoors.util.Location;
|
||||||
|
import com.mojang.serialization.Codec;
|
||||||
|
|
||||||
public class GlobalReference extends RiftReference {
|
public class GlobalReference extends RiftReference {
|
||||||
public static Codec<GlobalReference> CODEC = Location.CODEC.fieldOf("location").xmap(GlobalReference::new, GlobalReference::getReferencedLocation).codec();
|
public static Codec<GlobalReference> CODEC = Location.CODEC.fieldOf("location").xmap(GlobalReference::new, GlobalReference::getReferencedLocation).codec();
|
||||||
|
|
|
@ -1,15 +1,13 @@
|
||||||
package org.dimdev.dimdoors.rift.targets;
|
package org.dimdev.dimdoors.rift.targets;
|
||||||
|
|
||||||
import com.mojang.serialization.Codec;
|
|
||||||
import org.dimdev.annotatednbt.Saved;
|
|
||||||
import org.dimdev.dimdoors.util.Location;
|
import org.dimdev.dimdoors.util.Location;
|
||||||
|
import com.mojang.serialization.Codec;
|
||||||
|
|
||||||
import net.minecraft.util.math.BlockPos;
|
import net.minecraft.util.math.BlockPos;
|
||||||
|
|
||||||
public class LocalReference extends RiftReference {
|
public class LocalReference extends RiftReference {
|
||||||
public static final Codec<LocalReference> CODEC = BlockPos.CODEC.xmap(LocalReference::new, LocalReference::getTarget).fieldOf("target").codec();
|
public static final Codec<LocalReference> CODEC = BlockPos.CODEC.xmap(LocalReference::new, LocalReference::getTarget).fieldOf("target").codec();
|
||||||
|
|
||||||
@Saved
|
|
||||||
protected BlockPos target;
|
protected BlockPos target;
|
||||||
|
|
||||||
public LocalReference(BlockPos target) {
|
public LocalReference(BlockPos target) {
|
||||||
|
|
|
@ -1,8 +1,8 @@
|
||||||
package org.dimdev.dimdoors.rift.targets;
|
package org.dimdev.dimdoors.rift.targets;
|
||||||
|
|
||||||
|
import org.dimdev.dimdoors.util.EntityUtils;
|
||||||
import com.mojang.serialization.Codec;
|
import com.mojang.serialization.Codec;
|
||||||
import com.mojang.serialization.codecs.RecordCodecBuilder;
|
import com.mojang.serialization.codecs.RecordCodecBuilder;
|
||||||
import org.dimdev.dimdoors.util.EntityUtils;
|
|
||||||
|
|
||||||
import net.minecraft.entity.Entity;
|
import net.minecraft.entity.Entity;
|
||||||
import net.minecraft.text.TranslatableText;
|
import net.minecraft.text.TranslatableText;
|
||||||
|
|
|
@ -1,7 +1,7 @@
|
||||||
package org.dimdev.dimdoors.rift.targets;
|
package org.dimdev.dimdoors.rift.targets;
|
||||||
|
|
||||||
import com.mojang.serialization.Codec;
|
|
||||||
import org.dimdev.dimdoors.util.EntityUtils;
|
import org.dimdev.dimdoors.util.EntityUtils;
|
||||||
|
import com.mojang.serialization.Codec;
|
||||||
|
|
||||||
import net.minecraft.entity.Entity;
|
import net.minecraft.entity.Entity;
|
||||||
import net.minecraft.text.TranslatableText;
|
import net.minecraft.text.TranslatableText;
|
||||||
|
|
|
@ -2,7 +2,6 @@ package org.dimdev.dimdoors.rift.targets;
|
||||||
|
|
||||||
import java.util.UUID;
|
import java.util.UUID;
|
||||||
|
|
||||||
import com.mojang.serialization.Codec;
|
|
||||||
import org.dimdev.dimdoors.block.entity.RiftBlockEntity;
|
import org.dimdev.dimdoors.block.entity.RiftBlockEntity;
|
||||||
import org.dimdev.dimdoors.rift.registry.RiftRegistry;
|
import org.dimdev.dimdoors.rift.registry.RiftRegistry;
|
||||||
import org.dimdev.dimdoors.util.EntityUtils;
|
import org.dimdev.dimdoors.util.EntityUtils;
|
||||||
|
@ -12,6 +11,7 @@ import org.dimdev.dimdoors.world.ModDimensions;
|
||||||
import org.dimdev.dimdoors.world.pocket.Pocket;
|
import org.dimdev.dimdoors.world.pocket.Pocket;
|
||||||
import org.dimdev.dimdoors.world.pocket.PocketRegistry;
|
import org.dimdev.dimdoors.world.pocket.PocketRegistry;
|
||||||
import org.dimdev.dimdoors.world.pocket.PrivatePocketData;
|
import org.dimdev.dimdoors.world.pocket.PrivatePocketData;
|
||||||
|
import com.mojang.serialization.Codec;
|
||||||
|
|
||||||
import net.minecraft.entity.Entity;
|
import net.minecraft.entity.Entity;
|
||||||
import net.minecraft.text.TranslatableText;
|
import net.minecraft.text.TranslatableText;
|
||||||
|
|
|
@ -2,7 +2,6 @@ package org.dimdev.dimdoors.rift.targets;
|
||||||
|
|
||||||
import java.util.UUID;
|
import java.util.UUID;
|
||||||
|
|
||||||
import com.mojang.serialization.Codec;
|
|
||||||
import org.apache.logging.log4j.LogManager;
|
import org.apache.logging.log4j.LogManager;
|
||||||
import org.apache.logging.log4j.Logger;
|
import org.apache.logging.log4j.Logger;
|
||||||
import org.dimdev.dimdoors.pockets.PocketGenerator;
|
import org.dimdev.dimdoors.pockets.PocketGenerator;
|
||||||
|
@ -13,6 +12,7 @@ import org.dimdev.dimdoors.util.RGBA;
|
||||||
import org.dimdev.dimdoors.world.pocket.Pocket;
|
import org.dimdev.dimdoors.world.pocket.Pocket;
|
||||||
import org.dimdev.dimdoors.world.pocket.PrivatePocketData;
|
import org.dimdev.dimdoors.world.pocket.PrivatePocketData;
|
||||||
import org.dimdev.dimdoors.world.pocket.VirtualLocation;
|
import org.dimdev.dimdoors.world.pocket.VirtualLocation;
|
||||||
|
import com.mojang.serialization.Codec;
|
||||||
|
|
||||||
import net.minecraft.block.entity.BlockEntity;
|
import net.minecraft.block.entity.BlockEntity;
|
||||||
import net.minecraft.entity.Entity;
|
import net.minecraft.entity.Entity;
|
||||||
|
|
|
@ -1,12 +1,12 @@
|
||||||
package org.dimdev.dimdoors.rift.targets;
|
package org.dimdev.dimdoors.rift.targets;
|
||||||
|
|
||||||
import com.mojang.serialization.Codec;
|
|
||||||
import com.mojang.serialization.codecs.RecordCodecBuilder;
|
|
||||||
import org.dimdev.dimdoors.pockets.PocketGenerator;
|
import org.dimdev.dimdoors.pockets.PocketGenerator;
|
||||||
import org.dimdev.dimdoors.rift.registry.RiftRegistry;
|
import org.dimdev.dimdoors.rift.registry.RiftRegistry;
|
||||||
import org.dimdev.dimdoors.util.Location;
|
import org.dimdev.dimdoors.util.Location;
|
||||||
import org.dimdev.dimdoors.world.pocket.Pocket;
|
import org.dimdev.dimdoors.world.pocket.Pocket;
|
||||||
import org.dimdev.dimdoors.world.pocket.VirtualLocation;
|
import org.dimdev.dimdoors.world.pocket.VirtualLocation;
|
||||||
|
import com.mojang.serialization.Codec;
|
||||||
|
import com.mojang.serialization.codecs.RecordCodecBuilder;
|
||||||
|
|
||||||
public class PublicPocketTarget extends RestoringTarget {
|
public class PublicPocketTarget extends RestoringTarget {
|
||||||
public final static Codec<PublicPocketTarget> CODEC = RecordCodecBuilder.create(instance -> {
|
public final static Codec<PublicPocketTarget> CODEC = RecordCodecBuilder.create(instance -> {
|
||||||
|
|
|
@ -5,11 +5,6 @@ import java.util.Map;
|
||||||
import java.util.Set;
|
import java.util.Set;
|
||||||
import java.util.stream.Collectors;
|
import java.util.stream.Collectors;
|
||||||
|
|
||||||
import com.google.common.collect.Sets;
|
|
||||||
import com.mojang.serialization.Codec;
|
|
||||||
import com.mojang.serialization.DataResult;
|
|
||||||
import com.mojang.serialization.codecs.RecordCodecBuilder;
|
|
||||||
import org.dimdev.annotatednbt.Saved;
|
|
||||||
import org.dimdev.dimdoors.block.ModBlocks;
|
import org.dimdev.dimdoors.block.ModBlocks;
|
||||||
import org.dimdev.dimdoors.block.entity.DetachedRiftBlockEntity;
|
import org.dimdev.dimdoors.block.entity.DetachedRiftBlockEntity;
|
||||||
import org.dimdev.dimdoors.block.entity.RiftBlockEntity;
|
import org.dimdev.dimdoors.block.entity.RiftBlockEntity;
|
||||||
|
@ -22,6 +17,10 @@ import org.dimdev.dimdoors.util.WorldUtil;
|
||||||
import org.dimdev.dimdoors.util.math.MathUtil;
|
import org.dimdev.dimdoors.util.math.MathUtil;
|
||||||
import org.dimdev.dimdoors.world.pocket.Pocket;
|
import org.dimdev.dimdoors.world.pocket.Pocket;
|
||||||
import org.dimdev.dimdoors.world.pocket.VirtualLocation;
|
import org.dimdev.dimdoors.world.pocket.VirtualLocation;
|
||||||
|
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.server.world.ServerWorld;
|
import net.minecraft.server.world.ServerWorld;
|
||||||
import net.minecraft.util.math.BlockPos;
|
import net.minecraft.util.math.BlockPos;
|
||||||
|
@ -42,21 +41,13 @@ public class RandomTarget extends VirtualTarget { // TODO: Split into DungeonTar
|
||||||
).apply(instance, RandomTarget::new);
|
).apply(instance, RandomTarget::new);
|
||||||
});
|
});
|
||||||
|
|
||||||
@Saved
|
|
||||||
protected float newRiftWeight;
|
protected float newRiftWeight;
|
||||||
@Saved
|
|
||||||
protected double weightMaximum;
|
protected double weightMaximum;
|
||||||
@Saved
|
|
||||||
protected double coordFactor;
|
protected double coordFactor;
|
||||||
@Saved
|
|
||||||
protected double positiveDepthFactor;
|
protected double positiveDepthFactor;
|
||||||
@Saved
|
|
||||||
protected double negativeDepthFactor;
|
protected double negativeDepthFactor;
|
||||||
@Saved
|
|
||||||
protected Set<Integer> acceptedGroups;
|
protected Set<Integer> acceptedGroups;
|
||||||
@Saved
|
|
||||||
protected boolean noLink;
|
protected boolean noLink;
|
||||||
@Saved
|
|
||||||
protected boolean noLinkBack;
|
protected boolean noLinkBack;
|
||||||
|
|
||||||
public RandomTarget(float newRiftWeight, double weightMaximum, double coordFactor, double positiveDepthFactor, double negativeDepthFactor, Set<Integer> acceptedGroups, boolean noLink, boolean noLinkBack) {
|
public RandomTarget(float newRiftWeight, double weightMaximum, double coordFactor, double positiveDepthFactor, double negativeDepthFactor, Set<Integer> acceptedGroups, boolean noLink, boolean noLinkBack) {
|
||||||
|
|
|
@ -1,7 +1,7 @@
|
||||||
package org.dimdev.dimdoors.rift.targets;
|
package org.dimdev.dimdoors.rift.targets;
|
||||||
|
|
||||||
import com.mojang.serialization.Codec;
|
|
||||||
import org.dimdev.dimdoors.util.Location;
|
import org.dimdev.dimdoors.util.Location;
|
||||||
|
import com.mojang.serialization.Codec;
|
||||||
|
|
||||||
import net.minecraft.util.math.Vec3i;
|
import net.minecraft.util.math.Vec3i;
|
||||||
|
|
||||||
|
|
|
@ -1,9 +1,9 @@
|
||||||
package org.dimdev.dimdoors.rift.targets;
|
package org.dimdev.dimdoors.rift.targets;
|
||||||
|
|
||||||
import com.mojang.serialization.Codec;
|
|
||||||
import org.dimdev.dimdoors.util.Location;
|
import org.dimdev.dimdoors.util.Location;
|
||||||
import org.dimdev.dimdoors.util.NbtUtil;
|
import org.dimdev.dimdoors.util.NbtUtil;
|
||||||
import org.dimdev.dimdoors.util.RGBA;
|
import org.dimdev.dimdoors.util.RGBA;
|
||||||
|
import com.mojang.serialization.Codec;
|
||||||
|
|
||||||
import net.minecraft.nbt.CompoundTag;
|
import net.minecraft.nbt.CompoundTag;
|
||||||
import net.minecraft.util.Identifier;
|
import net.minecraft.util.Identifier;
|
||||||
|
|
|
@ -1,9 +1,9 @@
|
||||||
package org.dimdev.annotatednbt;
|
package org.dimdev.dimdoors.util;
|
||||||
|
|
||||||
|
import org.dimdev.dimdoors.util.RotatedLocation;
|
||||||
import com.google.gson.Gson;
|
import com.google.gson.Gson;
|
||||||
import com.mojang.serialization.Dynamic;
|
import com.mojang.serialization.Dynamic;
|
||||||
import com.mojang.serialization.JsonOps;
|
import com.mojang.serialization.JsonOps;
|
||||||
import org.dimdev.dimdoors.util.RotatedLocation;
|
|
||||||
|
|
||||||
import net.minecraft.nbt.CompoundTag;
|
import net.minecraft.nbt.CompoundTag;
|
||||||
import net.minecraft.nbt.NbtOps;
|
import net.minecraft.nbt.NbtOps;
|
|
@ -1,8 +1,8 @@
|
||||||
package org.dimdev.dimdoors.util;
|
package org.dimdev.dimdoors.util;
|
||||||
|
|
||||||
|
import org.dimdev.dimdoors.DimensionalDoorsInitializer;
|
||||||
import com.mojang.serialization.Codec;
|
import com.mojang.serialization.Codec;
|
||||||
import com.mojang.serialization.codecs.RecordCodecBuilder;
|
import com.mojang.serialization.codecs.RecordCodecBuilder;
|
||||||
import org.dimdev.dimdoors.DimensionalDoorsInitializer;
|
|
||||||
|
|
||||||
import net.minecraft.block.BlockState;
|
import net.minecraft.block.BlockState;
|
||||||
import net.minecraft.block.entity.BlockEntity;
|
import net.minecraft.block.entity.BlockEntity;
|
||||||
|
|
|
@ -2,7 +2,6 @@ package org.dimdev.dimdoors.util;
|
||||||
|
|
||||||
import com.mojang.serialization.Codec;
|
import com.mojang.serialization.Codec;
|
||||||
import com.mojang.serialization.codecs.RecordCodecBuilder;
|
import com.mojang.serialization.codecs.RecordCodecBuilder;
|
||||||
import org.dimdev.annotatednbt.Saved;
|
|
||||||
|
|
||||||
import net.minecraft.nbt.CompoundTag;
|
import net.minecraft.nbt.CompoundTag;
|
||||||
import net.minecraft.nbt.Tag;
|
import net.minecraft.nbt.Tag;
|
||||||
|
@ -20,9 +19,7 @@ public class RotatedLocation extends Location {
|
||||||
).apply(instance, RotatedLocation::new);
|
).apply(instance, RotatedLocation::new);
|
||||||
});
|
});
|
||||||
|
|
||||||
@Saved
|
|
||||||
public final float yaw;
|
public final float yaw;
|
||||||
@Saved
|
|
||||||
public final float pitch;
|
public final float pitch;
|
||||||
|
|
||||||
public RotatedLocation(RegistryKey<World> world, BlockPos pos, float yaw, float pitch) {
|
public RotatedLocation(RegistryKey<World> world, BlockPos pos, float yaw, float pitch) {
|
||||||
|
|
|
@ -80,6 +80,7 @@ public final class ModBiomes {
|
||||||
.build())
|
.build())
|
||||||
.generationSettings(new GenerationSettings.Builder()
|
.generationSettings(new GenerationSettings.Builder()
|
||||||
.feature(GenerationStep.Feature.SURFACE_STRUCTURES, ModFeatures.LIMBO_GATEWAY_CONFIGURED_FEATURE)
|
.feature(GenerationStep.Feature.SURFACE_STRUCTURES, ModFeatures.LIMBO_GATEWAY_CONFIGURED_FEATURE)
|
||||||
|
.feature(GenerationStep.Feature.LAKES, ModFeatures.ETERNAL_FLUID_LAKE)
|
||||||
.surfaceBuilder(SurfaceBuilder.NETHER.method_30478(new TernarySurfaceConfig(ModBlocks.UNRAVELLED_FABRIC.getDefaultState(), ModBlocks.UNRAVELLED_FABRIC.getDefaultState(), ModBlocks.ETERNAL_FLUID.getDefaultState())))
|
.surfaceBuilder(SurfaceBuilder.NETHER.method_30478(new TernarySurfaceConfig(ModBlocks.UNRAVELLED_FABRIC.getDefaultState(), ModBlocks.UNRAVELLED_FABRIC.getDefaultState(), ModBlocks.ETERNAL_FLUID.getDefaultState())))
|
||||||
.build())
|
.build())
|
||||||
.precipitation(Biome.Precipitation.NONE)
|
.precipitation(Biome.Precipitation.NONE)
|
||||||
|
|
|
@ -3,13 +3,13 @@ package org.dimdev.dimdoors.world;
|
||||||
import java.util.Optional;
|
import java.util.Optional;
|
||||||
import java.util.OptionalLong;
|
import java.util.OptionalLong;
|
||||||
|
|
||||||
import com.google.common.collect.ImmutableMap;
|
|
||||||
import org.dimdev.dimdoors.block.ModBlocks;
|
import org.dimdev.dimdoors.block.ModBlocks;
|
||||||
import org.dimdev.dimdoors.mixin.ChunkGeneratorSettingsAccessor;
|
import org.dimdev.dimdoors.mixin.ChunkGeneratorSettingsAccessor;
|
||||||
import org.dimdev.dimdoors.mixin.DimensionTypeAccessor;
|
import org.dimdev.dimdoors.mixin.DimensionTypeAccessor;
|
||||||
import org.dimdev.dimdoors.world.limbo.LimboBiomeSource;
|
import org.dimdev.dimdoors.world.limbo.LimboBiomeSource;
|
||||||
import org.dimdev.dimdoors.world.limbo.LimboChunkGenerator;
|
import org.dimdev.dimdoors.world.limbo.LimboChunkGenerator;
|
||||||
import org.dimdev.dimdoors.world.pocket.BlankChunkGenerator;
|
import org.dimdev.dimdoors.world.pocket.BlankChunkGenerator;
|
||||||
|
import com.google.common.collect.ImmutableMap;
|
||||||
|
|
||||||
import net.minecraft.server.world.ServerWorld;
|
import net.minecraft.server.world.ServerWorld;
|
||||||
import net.minecraft.tag.BlockTags;
|
import net.minecraft.tag.BlockTags;
|
||||||
|
|
|
@ -27,12 +27,13 @@ public final class ModFeatures {
|
||||||
public static final SchematicV2Gateway SANDSTONE_PILLARS_GATEWAY = new SandstonePillarsV2Gateway();
|
public static final SchematicV2Gateway SANDSTONE_PILLARS_GATEWAY = new SandstonePillarsV2Gateway();
|
||||||
public static final ConfiguredFeature<?, ?> SANDSTONE_PILLARS_FEATURE;
|
public static final ConfiguredFeature<?, ?> SANDSTONE_PILLARS_FEATURE;
|
||||||
public static final ConfiguredFeature<?, ?> LIMBO_GATEWAY_CONFIGURED_FEATURE;
|
public static final ConfiguredFeature<?, ?> LIMBO_GATEWAY_CONFIGURED_FEATURE;
|
||||||
public static final ConfiguredFeature<?, ?> ETERNAL_FLUID_LAKE;
|
public static ConfiguredFeature<?, ?> ETERNAL_FLUID_LAKE;
|
||||||
|
|
||||||
public static void init() {
|
public static void init() {
|
||||||
SANDSTONE_PILLARS_GATEWAY.init();
|
SANDSTONE_PILLARS_GATEWAY.init();
|
||||||
Registry.register(BuiltinRegistries.CONFIGURED_FEATURE, new Identifier("dimdoors", "sandstone_pillars"), SANDSTONE_PILLARS_FEATURE);
|
Registry.register(BuiltinRegistries.CONFIGURED_FEATURE, new Identifier("dimdoors", "sandstone_pillars"), SANDSTONE_PILLARS_FEATURE);
|
||||||
Registry.register(BuiltinRegistries.CONFIGURED_FEATURE, new Identifier("dimdoors", "limbo_gateway"), LIMBO_GATEWAY_CONFIGURED_FEATURE);
|
Registry.register(BuiltinRegistries.CONFIGURED_FEATURE, new Identifier("dimdoors", "limbo_gateway"), LIMBO_GATEWAY_CONFIGURED_FEATURE);
|
||||||
|
ETERNAL_FLUID_LAKE = Registry.register(BuiltinRegistries.CONFIGURED_FEATURE, new Identifier("dimdoors", "eternal_fluid_lake"), Feature.LAKE.configure(new SingleStateFeatureConfig(ModBlocks.ETERNAL_FLUID.getDefaultState())).decorate(Decorator.RANGE.configure(new RangeDecoratorConfig(5, 17, 128)).applyChance(20)));
|
||||||
}
|
}
|
||||||
|
|
||||||
static {
|
static {
|
||||||
|
@ -41,6 +42,5 @@ public final class ModFeatures {
|
||||||
.decorate(ConfiguredFeatures.Decorators.SQUARE_TOP_SOLID_HEIGHTMAP
|
.decorate(ConfiguredFeatures.Decorators.SQUARE_TOP_SOLID_HEIGHTMAP
|
||||||
.applyChance(gatewayChance));
|
.applyChance(gatewayChance));
|
||||||
LIMBO_GATEWAY_CONFIGURED_FEATURE = LIMBO_GATEWAY_FEATURE.configure(DefaultFeatureConfig.INSTANCE).decorate(ConfiguredFeatures.Decorators.SQUARE_TOP_SOLID_HEIGHTMAP.applyChance(gatewayChance));
|
LIMBO_GATEWAY_CONFIGURED_FEATURE = LIMBO_GATEWAY_FEATURE.configure(DefaultFeatureConfig.INSTANCE).decorate(ConfiguredFeatures.Decorators.SQUARE_TOP_SOLID_HEIGHTMAP.applyChance(gatewayChance));
|
||||||
ETERNAL_FLUID_LAKE = Feature.LAKE.configure(new SingleStateFeatureConfig(ModBlocks.ETERNAL_FLUID.getDefaultState())).decorate(Decorator.RANGE.configure(new RangeDecoratorConfig(5, 17, 128)).applyChance(20));
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -2,10 +2,10 @@ package org.dimdev.dimdoors.world.limbo;
|
||||||
|
|
||||||
import java.util.Set;
|
import java.util.Set;
|
||||||
|
|
||||||
|
import org.dimdev.dimdoors.world.ModBiomes;
|
||||||
import com.google.common.collect.ImmutableList;
|
import com.google.common.collect.ImmutableList;
|
||||||
import com.google.common.collect.ImmutableSet;
|
import com.google.common.collect.ImmutableSet;
|
||||||
import com.mojang.serialization.Codec;
|
import com.mojang.serialization.Codec;
|
||||||
import org.dimdev.dimdoors.world.ModBiomes;
|
|
||||||
|
|
||||||
import net.minecraft.world.biome.Biome;
|
import net.minecraft.world.biome.Biome;
|
||||||
import net.minecraft.world.biome.source.BiomeSource;
|
import net.minecraft.world.biome.source.BiomeSource;
|
||||||
|
|
|
@ -9,11 +9,11 @@ import java.util.stream.IntStream;
|
||||||
import it.unimi.dsi.fastutil.objects.ObjectArrayList;
|
import it.unimi.dsi.fastutil.objects.ObjectArrayList;
|
||||||
import it.unimi.dsi.fastutil.objects.ObjectList;
|
import it.unimi.dsi.fastutil.objects.ObjectList;
|
||||||
import it.unimi.dsi.fastutil.objects.ObjectListIterator;
|
import it.unimi.dsi.fastutil.objects.ObjectListIterator;
|
||||||
import com.mojang.serialization.Codec;
|
|
||||||
import org.dimdev.dimdoors.block.ModBlocks;
|
import org.dimdev.dimdoors.block.ModBlocks;
|
||||||
import org.dimdev.dimdoors.mixin.ChunkGeneratorAccessor;
|
import org.dimdev.dimdoors.mixin.ChunkGeneratorAccessor;
|
||||||
import org.dimdev.dimdoors.world.ModDimensions;
|
import org.dimdev.dimdoors.world.ModDimensions;
|
||||||
import org.jetbrains.annotations.Nullable;
|
import org.jetbrains.annotations.Nullable;
|
||||||
|
import com.mojang.serialization.Codec;
|
||||||
|
|
||||||
import net.minecraft.block.BlockState;
|
import net.minecraft.block.BlockState;
|
||||||
import net.minecraft.block.Blocks;
|
import net.minecraft.block.Blocks;
|
||||||
|
|
|
@ -6,14 +6,6 @@ import java.util.Random;
|
||||||
import java.util.function.BiConsumer;
|
import java.util.function.BiConsumer;
|
||||||
|
|
||||||
import org.dimdev.dimdoors.ModConfig;
|
import org.dimdev.dimdoors.ModConfig;
|
||||||
|
|
||||||
import net.minecraft.block.Block;
|
|
||||||
import net.minecraft.block.BlockState;
|
|
||||||
import net.minecraft.block.BlockWithEntity;
|
|
||||||
import net.minecraft.util.math.BlockPos;
|
|
||||||
import net.minecraft.world.World;
|
|
||||||
|
|
||||||
import static net.minecraft.block.Blocks.*;
|
|
||||||
import static org.dimdev.dimdoors.block.ModBlocks.DETACHED_RIFT;
|
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.DIMENSIONAL_PORTAL;
|
||||||
import static org.dimdev.dimdoors.block.ModBlocks.ETERNAL_FLUID;
|
import static org.dimdev.dimdoors.block.ModBlocks.ETERNAL_FLUID;
|
||||||
|
@ -24,6 +16,14 @@ 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.QUARTZ_DOOR;
|
||||||
import static org.dimdev.dimdoors.block.ModBlocks.UNRAVELLED_FABRIC;
|
import static org.dimdev.dimdoors.block.ModBlocks.UNRAVELLED_FABRIC;
|
||||||
|
|
||||||
|
import net.minecraft.block.Block;
|
||||||
|
import net.minecraft.block.BlockState;
|
||||||
|
import net.minecraft.block.BlockWithEntity;
|
||||||
|
import net.minecraft.util.math.BlockPos;
|
||||||
|
import net.minecraft.world.World;
|
||||||
|
|
||||||
|
import static net.minecraft.block.Blocks.*;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Provides methods for applying Limbo decay. Limbo decay refers to the effect that most blocks placed in Limbo
|
* Provides methods for applying Limbo decay. Limbo decay refers to the effect that most blocks placed in Limbo
|
||||||
* naturally change into stone, then cobble, then gravel, and finally Unraveled Fabric as time passes.
|
* naturally change into stone, then cobble, then gravel, and finally Unraveled Fabric as time passes.
|
||||||
|
|
|
@ -1,11 +1,10 @@
|
||||||
package org.dimdev.dimdoors.world.pocket;
|
package org.dimdev.dimdoors.world.pocket;
|
||||||
|
|
||||||
|
import org.dimdev.dimdoors.util.Codecs;
|
||||||
|
import org.dimdev.dimdoors.util.EntityUtils;
|
||||||
import com.flowpowered.math.vector.Vector3i;
|
import com.flowpowered.math.vector.Vector3i;
|
||||||
import com.mojang.serialization.Codec;
|
import com.mojang.serialization.Codec;
|
||||||
import com.mojang.serialization.codecs.RecordCodecBuilder;
|
import com.mojang.serialization.codecs.RecordCodecBuilder;
|
||||||
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.entity.Entity;
|
||||||
import net.minecraft.text.TranslatableText;
|
import net.minecraft.text.TranslatableText;
|
||||||
|
@ -29,17 +28,11 @@ public final class Pocket {
|
||||||
});
|
});
|
||||||
private static final int BLOCKS_PAINTED_PER_DYE = 1106;
|
private static final int BLOCKS_PAINTED_PER_DYE = 1106;
|
||||||
|
|
||||||
@Saved
|
|
||||||
public final int id;
|
public final int id;
|
||||||
@Saved
|
|
||||||
public BlockBox box;
|
public BlockBox box;
|
||||||
@Saved
|
|
||||||
public VirtualLocation virtualLocation;
|
public VirtualLocation virtualLocation;
|
||||||
@Saved
|
|
||||||
public PocketColor dyeColor = PocketColor.WHITE;
|
public PocketColor dyeColor = PocketColor.WHITE;
|
||||||
@Saved
|
|
||||||
public PocketColor nextDyeColor = PocketColor.NONE;
|
public PocketColor nextDyeColor = PocketColor.NONE;
|
||||||
@Saved
|
|
||||||
public int count = 0;
|
public int count = 0;
|
||||||
|
|
||||||
public RegistryKey<World> world;
|
public RegistryKey<World> world;
|
||||||
|
|
|
@ -3,13 +3,12 @@ package org.dimdev.dimdoors.world.pocket;
|
||||||
import java.util.HashMap;
|
import java.util.HashMap;
|
||||||
import java.util.Map;
|
import java.util.Map;
|
||||||
|
|
||||||
import com.mojang.serialization.Codec;
|
|
||||||
import org.dimdev.annotatednbt.Saved;
|
|
||||||
import org.dimdev.dimdoors.ModConfig;
|
import org.dimdev.dimdoors.ModConfig;
|
||||||
import org.dimdev.dimdoors.util.NbtUtil;
|
import org.dimdev.dimdoors.util.NbtUtil;
|
||||||
import org.dimdev.dimdoors.util.WorldUtil;
|
import org.dimdev.dimdoors.util.WorldUtil;
|
||||||
import org.dimdev.dimdoors.util.math.GridUtil;
|
import org.dimdev.dimdoors.util.math.GridUtil;
|
||||||
import org.dimdev.dimdoors.world.ModDimensions;
|
import org.dimdev.dimdoors.world.ModDimensions;
|
||||||
|
import com.mojang.serialization.Codec;
|
||||||
|
|
||||||
import net.minecraft.nbt.CompoundTag;
|
import net.minecraft.nbt.CompoundTag;
|
||||||
import net.minecraft.server.world.ServerWorld;
|
import net.minecraft.server.world.ServerWorld;
|
||||||
|
@ -23,11 +22,11 @@ public class PocketRegistry extends PersistentState {
|
||||||
|
|
||||||
private static final String DATA_NAME = "pocketlib_pockets";
|
private static final String DATA_NAME = "pocketlib_pockets";
|
||||||
|
|
||||||
@Saved /*package-private*/ int gridSize; // Determines how much pockets in their dimension are spaced
|
/*package-private*/ int gridSize; // Determines how much pockets in their dimension are spaced
|
||||||
@Saved /*package-private*/ int privatePocketSize;
|
/*package-private*/ int privatePocketSize;
|
||||||
@Saved /*package-private*/ int publicPocketSize;
|
/*package-private*/ int publicPocketSize;
|
||||||
@Saved /*package-private*/ Map<Integer, Pocket> pockets;
|
/*package-private*/ Map<Integer, Pocket> pockets;
|
||||||
@Saved /*package-private*/ int nextID;
|
/*package-private*/ int nextID;
|
||||||
|
|
||||||
private ServerWorld world;
|
private ServerWorld world;
|
||||||
|
|
||||||
|
|
|
@ -2,13 +2,12 @@ package org.dimdev.dimdoors.world.pocket;
|
||||||
|
|
||||||
import java.util.UUID;
|
import java.util.UUID;
|
||||||
|
|
||||||
|
import org.dimdev.dimdoors.util.NbtUtil;
|
||||||
|
import org.dimdev.dimdoors.util.WorldUtil;
|
||||||
import com.google.common.collect.BiMap;
|
import com.google.common.collect.BiMap;
|
||||||
import com.google.common.collect.HashBiMap;
|
import com.google.common.collect.HashBiMap;
|
||||||
import com.mojang.serialization.Codec;
|
import com.mojang.serialization.Codec;
|
||||||
import com.mojang.serialization.codecs.RecordCodecBuilder;
|
import com.mojang.serialization.codecs.RecordCodecBuilder;
|
||||||
import org.dimdev.annotatednbt.Saved;
|
|
||||||
import org.dimdev.dimdoors.util.NbtUtil;
|
|
||||||
import org.dimdev.dimdoors.util.WorldUtil;
|
|
||||||
|
|
||||||
import net.minecraft.nbt.CompoundTag;
|
import net.minecraft.nbt.CompoundTag;
|
||||||
import net.minecraft.util.dynamic.DynamicSerializableUuid;
|
import net.minecraft.util.dynamic.DynamicSerializableUuid;
|
||||||
|
@ -27,9 +26,7 @@ public class PrivatePocketData extends PersistentState {
|
||||||
).apply(instance, PocketInfo::new);
|
).apply(instance, PocketInfo::new);
|
||||||
});
|
});
|
||||||
|
|
||||||
@Saved
|
|
||||||
public final RegistryKey<World> world;
|
public final RegistryKey<World> world;
|
||||||
@Saved
|
|
||||||
public final int id;
|
public final int id;
|
||||||
|
|
||||||
public PocketInfo(RegistryKey<World> world, int id) {
|
public PocketInfo(RegistryKey<World> world, int id) {
|
||||||
|
@ -42,7 +39,6 @@ public class PrivatePocketData extends PersistentState {
|
||||||
|
|
||||||
private static final String DATA_NAME = "dimdoors_private_pockets";
|
private static final String DATA_NAME = "dimdoors_private_pockets";
|
||||||
|
|
||||||
@Saved
|
|
||||||
protected BiMap<UUID, PocketInfo> privatePocketMap = HashBiMap.create(); // Player UUID -> Pocket Info TODO: fix AnnotatedNBT and use UUID rather than String
|
protected BiMap<UUID, PocketInfo> privatePocketMap = HashBiMap.create(); // Player UUID -> Pocket Info TODO: fix AnnotatedNBT and use UUID rather than String
|
||||||
|
|
||||||
public PrivatePocketData(String name) {
|
public PrivatePocketData(String name) {
|
||||||
|
|
|
@ -1,14 +1,14 @@
|
||||||
package org.dimdev.dimdoors.world.pocket;
|
package org.dimdev.dimdoors.world.pocket;
|
||||||
|
|
||||||
import com.mojang.serialization.Codec;
|
|
||||||
import com.mojang.serialization.codecs.RecordCodecBuilder;
|
|
||||||
import org.dimdev.annotatednbt.AnnotatedNbt;
|
|
||||||
import org.dimdev.dimdoors.DimensionalDoorsInitializer;
|
import org.dimdev.dimdoors.DimensionalDoorsInitializer;
|
||||||
import org.dimdev.dimdoors.ModConfig;
|
import org.dimdev.dimdoors.ModConfig;
|
||||||
import org.dimdev.dimdoors.util.Location;
|
import org.dimdev.dimdoors.util.Location;
|
||||||
import org.dimdev.dimdoors.world.ModDimensions;
|
import org.dimdev.dimdoors.world.ModDimensions;
|
||||||
|
import com.mojang.serialization.Codec;
|
||||||
|
import com.mojang.serialization.codecs.RecordCodecBuilder;
|
||||||
|
|
||||||
import net.minecraft.nbt.CompoundTag;
|
import net.minecraft.nbt.CompoundTag;
|
||||||
|
import net.minecraft.nbt.NbtOps;
|
||||||
import net.minecraft.server.world.ServerWorld;
|
import net.minecraft.server.world.ServerWorld;
|
||||||
import net.minecraft.util.math.BlockPos;
|
import net.minecraft.util.math.BlockPos;
|
||||||
import net.minecraft.util.registry.RegistryKey;
|
import net.minecraft.util.registry.RegistryKey;
|
||||||
|
@ -27,14 +27,10 @@ public class VirtualLocation {
|
||||||
).apply(instance, VirtualLocation::new)
|
).apply(instance, VirtualLocation::new)
|
||||||
);
|
);
|
||||||
|
|
||||||
|
private RegistryKey<World> world;
|
||||||
public final RegistryKey<World> world;
|
private int x;
|
||||||
|
private int z;
|
||||||
public final int x;
|
private int depth;
|
||||||
|
|
||||||
public final int z;
|
|
||||||
|
|
||||||
public final int depth;
|
|
||||||
|
|
||||||
public VirtualLocation(RegistryKey<World> world, int x, int z, int depth) {
|
public VirtualLocation(RegistryKey<World> world, int x, int z, int depth) {
|
||||||
this.world = world;
|
this.world = world;
|
||||||
|
@ -43,13 +39,20 @@ public class VirtualLocation {
|
||||||
this.depth = depth;
|
this.depth = depth;
|
||||||
}
|
}
|
||||||
|
|
||||||
public void fromTag(CompoundTag nbt) {
|
public void fromTag(CompoundTag tag) {
|
||||||
AnnotatedNbt.load(this, nbt);
|
VirtualLocation location = CODEC.decode(NbtOps.INSTANCE, tag).getOrThrow(false, System.err::println).getFirst();
|
||||||
|
this.x = location.x;
|
||||||
|
this.z = location.z;
|
||||||
|
this.depth = location.depth;
|
||||||
|
this.world = location.world;
|
||||||
}
|
}
|
||||||
|
|
||||||
public CompoundTag toTag(CompoundTag nbt) {
|
public CompoundTag toTag(CompoundTag tag) {
|
||||||
AnnotatedNbt.save(this, nbt);
|
CompoundTag encodedTag = (CompoundTag) CODEC.encodeStart(NbtOps.INSTANCE, this).getOrThrow(false, System.err::println);
|
||||||
return nbt;
|
for (String key : encodedTag.getKeys()) {
|
||||||
|
tag.put(key, encodedTag.get(key));
|
||||||
|
}
|
||||||
|
return tag;
|
||||||
}
|
}
|
||||||
|
|
||||||
public static VirtualLocation fromLocation(Location location) {
|
public static VirtualLocation fromLocation(Location location) {
|
||||||
|
@ -86,4 +89,20 @@ public class VirtualLocation {
|
||||||
BlockPos pos = world.getTopPosition(Heightmap.Type.WORLD_SURFACE, new BlockPos(newX, 0, newZ));
|
BlockPos pos = world.getTopPosition(Heightmap.Type.WORLD_SURFACE, new BlockPos(newX, 0, newZ));
|
||||||
return new Location(world, pos);
|
return new Location(world, pos);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public RegistryKey<World> getWorld() {
|
||||||
|
return this.world;
|
||||||
|
}
|
||||||
|
|
||||||
|
public int getX() {
|
||||||
|
return this.x;
|
||||||
|
}
|
||||||
|
|
||||||
|
public int getZ() {
|
||||||
|
return this.z;
|
||||||
|
}
|
||||||
|
|
||||||
|
public int getDepth() {
|
||||||
|
return this.depth;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue