From ed8f57e0d9a09bdb054693b8f8720a73ce8d594a Mon Sep 17 00:00:00 2001 From: Runemoro Date: Wed, 24 Jan 2018 03:04:15 -0500 Subject: [PATCH] Localization, use CommandExceptions, and other improvements --- .../java/org/dimdev/ddutils/nbt/NBTUtils.java | 4 +- .../java/org/dimdev/dimdoors/DimDoors.java | 12 +- .../dimdoors/client/RenderMonolith.java | 1 - .../dimdev/dimdoors/shared/CommonProxy.java | 2 +- .../org/dimdev/dimdoors/shared/ModConfig.java | 72 ++++-------- .../shared/commands/CommandDimTeleport.java | 75 +++++-------- .../shared/commands/CommandFabricConvert.java | 55 +++------ .../shared/commands/CommandPocket.java | 104 +++++++----------- .../shared/commands/CommandSaveSchem.java | 53 +++------ .../shared/entities/EntityMonolith.java | 4 +- .../shared/items/ItemRiftRemover.java | 4 +- .../shared/items/ItemRiftSignature.java | 15 +-- .../items/ItemStabilizedRiftSignature.java | 15 +-- .../shared/pockets/PocketGenerator.java | 12 +- .../shared/pockets/PocketTemplate.java | 2 - .../shared/pockets/SchematicHandler.java | 6 +- .../dimdoors/shared/rifts/TileEntityRift.java | 8 +- .../rifts/destinations/EscapeDestination.java | 13 ++- .../rifts/destinations/GlobalDestination.java | 2 +- .../rifts/destinations/LimboDestination.java | 2 +- .../destinations/PocketEntranceMarker.java | 2 +- .../rifts/destinations/PocketExitMarker.java | 2 +- .../PrivatePocketExitDestination.java | 4 +- .../shared/rifts/registry/RiftRegistry.java | 2 +- .../tileentities/TileEntityEntranceRift.java | 3 +- .../shared/tools/SchematicConverter.java | 13 ++- .../shared/world/gateways/BaseGateway.java | 22 ++-- .../world/gateways/DimensionFilter.java | 78 ------------- .../world/gateways/GatewayGenerator.java | 26 ++--- .../gateways/GatewaySandstonePillars.java | 2 +- .../world/gateways/GatewayTwoPillars.java | 2 +- ...enerator.java => ChunkGeneratorLimbo.java} | 4 +- .../world/limbo/WorldProviderLimbo.java | 2 +- .../world/pocketdimension/BiomeBlank.java | 1 - .../java/org/dimdev/pocketlib/Pocket.java | 4 +- .../org/dimdev/pocketlib/PocketRegistry.java | 6 +- .../org/dimdev/pocketlib/VirtualLocation.java | 6 +- .../dimdev/pocketlib/WorldProviderPocket.java | 7 +- ....schematic => sandstone_pillars.schematic} | Bin ...illars.schematic => two_pillars.schematic} | Bin .../resources/assets/dimdoors/lang/en_GB.lang | 29 ----- .../resources/assets/dimdoors/lang/en_US.lang | 97 +++++++++++----- .../resources/assets/dimdoors/lang/fr_CA.lang | 4 +- .../resources/assets/dimdoors/lang/ro_RO.lang | 2 +- 44 files changed, 302 insertions(+), 477 deletions(-) delete mode 100644 src/main/java/org/dimdev/dimdoors/shared/world/gateways/DimensionFilter.java rename src/main/java/org/dimdev/dimdoors/shared/world/limbo/{LimboGenerator.java => ChunkGeneratorLimbo.java} (98%) rename src/main/resources/assets/dimdoors/gateways/{sandstonePillars.schematic => sandstone_pillars.schematic} (100%) rename src/main/resources/assets/dimdoors/gateways/{twoPillars.schematic => two_pillars.schematic} (100%) delete mode 100644 src/main/resources/assets/dimdoors/lang/en_GB.lang diff --git a/src/main/java/org/dimdev/ddutils/nbt/NBTUtils.java b/src/main/java/org/dimdev/ddutils/nbt/NBTUtils.java index 7409731d..29497fa3 100644 --- a/src/main/java/org/dimdev/ddutils/nbt/NBTUtils.java +++ b/src/main/java/org/dimdev/ddutils/nbt/NBTUtils.java @@ -9,8 +9,8 @@ import org.dimdev.ddutils.StringUtils; public final class NBTUtils { - @Getter private final static int NBT_COMPOUND_TAG_ID = StringUtils.simpleSearch(NBTTagCompound.NBT_TYPES, "COMPOUND"); - @Getter private final static int STRING_TAG_ID = StringUtils.simpleSearch(NBTTagCompound.NBT_TYPES, "STRING"); + public final static int NBT_COMPOUND_TAG_ID = StringUtils.simpleSearch(NBTTagCompound.NBT_TYPES, "COMPOUND"); + public final static int STRING_TAG_ID = StringUtils.simpleSearch(NBTTagCompound.NBT_TYPES, "STRING"); //Arrays.binarySearch(NBTTagCompound.NBT_TYPES, "COMPOUND", new StringComparator()); does not seem to work?; //netiher does Arrays.binarySearch(NBTTagCompound.NBT_TYPES, "COMPOUND", String::compareTo); diff --git a/src/main/java/org/dimdev/dimdoors/DimDoors.java b/src/main/java/org/dimdev/dimdoors/DimDoors.java index c13812fe..aed348a0 100644 --- a/src/main/java/org/dimdev/dimdoors/DimDoors.java +++ b/src/main/java/org/dimdev/dimdoors/DimDoors.java @@ -1,6 +1,7 @@ package org.dimdev.dimdoors; import net.minecraft.entity.player.EntityPlayerMP; +import net.minecraft.util.text.TextComponentTranslation; import org.dimdev.dimdoors.shared.ModConfig; import org.dimdev.dimdoors.shared.commands.CommandFabricConvert; import org.dimdev.dimdoors.shared.commands.CommandPocket; @@ -13,7 +14,6 @@ import lombok.Getter; import net.minecraft.creativetab.CreativeTabs; import net.minecraft.entity.Entity; import net.minecraft.item.ItemStack; -import net.minecraft.util.text.TextComponentString; import net.minecraftforge.fml.common.Mod; import net.minecraftforge.fml.common.SidedProxy; import net.minecraftforge.fml.common.event.*; @@ -85,16 +85,16 @@ public class DimDoors { event.registerServerCommand(new CommandFabricConvert()); } - public static void sendMessage(Entity entity, String text) { + public static void sendTranslatedMessage(Entity entity, String text, Object... translationArgs) { if (ModConfig.general.useStatusBar && entity instanceof EntityPlayerMP) { EntityPlayerMP player = (EntityPlayerMP) entity; - player.sendStatusMessage(new TextComponentString(text), true); + player.sendStatusMessage(new TextComponentTranslation(text, translationArgs), true); } else { - chat(entity, text); + chat(entity, text, translationArgs); } } - public static void chat(Entity entity, String text) { - entity.sendMessage(new TextComponentString("[DimDoors] " + text)); + public static void chat(Entity entity, String text, Object... translationArgs) { + entity.sendMessage(new TextComponentTranslation(text, translationArgs)); } } diff --git a/src/main/java/org/dimdev/dimdoors/client/RenderMonolith.java b/src/main/java/org/dimdev/dimdoors/client/RenderMonolith.java index fec9fe77..6e8f9d0d 100644 --- a/src/main/java/org/dimdev/dimdoors/client/RenderMonolith.java +++ b/src/main/java/org/dimdev/dimdoors/client/RenderMonolith.java @@ -122,6 +122,5 @@ public class RenderMonolith extends RenderLiving { @Override protected ResourceLocation getEntityTexture(EntityMonolith monolith) { return monolith_textures.get(monolith.getTextureState()); - //return new ResourceLocation(DimDoors.MODID + ":textures/mobs/monolith/monolith" + monolith.getTextureState() + ".png"); } } diff --git a/src/main/java/org/dimdev/dimdoors/shared/CommonProxy.java b/src/main/java/org/dimdev/dimdoors/shared/CommonProxy.java index 8b1382ed..0553a00d 100644 --- a/src/main/java/org/dimdev/dimdoors/shared/CommonProxy.java +++ b/src/main/java/org/dimdev/dimdoors/shared/CommonProxy.java @@ -35,7 +35,7 @@ public abstract class CommonProxy { registerTileEntities(); ModDimensions.registerDimensions(); - EntityRegistry.registerModEntity(new ResourceLocation(DimDoors.MODID, "mob_monolith"), EntityMonolith.class, "monolith", 0, DimDoors.instance, 70, 1, true); + EntityRegistry.registerModEntity(new ResourceLocation(DimDoors.MODID, "mob_monolith"), EntityMonolith.class, "monoliths", 0, DimDoors.instance, 70, 1, true); EntityRegistry.registerEgg(new ResourceLocation(DimDoors.MODID, "mob_monolith"), 0, 0xffffff); registerRiftDestinations(); } diff --git a/src/main/java/org/dimdev/dimdoors/shared/ModConfig.java b/src/main/java/org/dimdev/dimdoors/shared/ModConfig.java index 9133bca6..b00825cd 100644 --- a/src/main/java/org/dimdev/dimdoors/shared/ModConfig.java +++ b/src/main/java/org/dimdev/dimdoors/shared/ModConfig.java @@ -9,38 +9,26 @@ import org.dimdev.dimdoors.DimDoors; import static net.minecraftforge.common.config.Config.*; -@Config(modid = DimDoors.MODID, name = DimDoors.MODID + "/" + DimDoors.MODID, category="") +@Config(modid = DimDoors.MODID, name = DimDoors.MODID, category="") @Mod.EventBusSubscriber(modid = DimDoors.MODID) -public final class ModConfig { +public final class ModConfig { // TODO: localize the rest - @Comment("General Config Options") public static General general = new General(); - @Comment({"Pocket Config Options", - "The following values determine the maximum sizes of different kinds of pockets. These values will only influence new worlds."}) - public static Pocket pocket = new Pocket(); - @Comment("World Generation Config Options") - public static WorldGen world = new WorldGen(); - @Comment({"Dungeon Config Options", - "The following options will determine the depths, wandering offsets and contents of Dungeon Pockets."}) - public static Dungeons dungeon = new Dungeons(); - @Comment({"Monolith Config Options", - "How dangerous are Monoliths"}) - public static Monoliths monolith = new Monoliths(); - @Comment({"Limbo Config Options", - "This controls various limbo aspects"}) + public static Pocket pockets = new Pocket(); + public static World world = new World(); + public static Dungeons dungeons = new Dungeons(); + public static Monoliths monoliths = new Monoliths(); public static Limbo limbo = new Limbo(); public static class General { @Name("Base Dimension ID") @Comment({"Dimension ID of the first Dimensional Doors dimension. Other dimensions will use consecutive IDs.", - "WARNING: If you change this after creating a world, you may lose these dimensions.", - "Default: 684"}) + "It strongly recommendended to leave this to the default value."}) + @RequiresWorldRestart public int baseDimensionID = 684; - @Name("Status Bar Messages instead of Chat") - @Comment({"This gives clients the options to either send messages", - "through the status bar (true) or through chat (false).", - "Default: true"}) + @Name("Status Bar Messages") + @Comment("Use the status bar to send status messages rather than the chat.") public boolean useStatusBar = true; @Name("Players Close Doors Behind Them") @@ -52,40 +40,35 @@ public final class ModConfig { public static class Pocket { @Name("Pocket Grid Size") - @Comment({"Sets how many chunks apart all pockets in pocket dimensions should be placed.", - "Default: 32"}) - @RangeInt(min=4, max=32) + @Comment("Sets how many chunks apart all pockets in pocket dimensions should be placed.") + @RangeInt(min=4) public int pocketGridSize = 32; @Name("Max Pocket Size") - @Comment({"Sets how large a pocket can be.", - "Default: 15 [Minimum = 0] [Maximum = Pocket Grid Size / 2"}) + @Comment("Sets how large a pocket can be.") + @RangeInt(min=0) public int maxPocketSize = 15; @Name("Private Pocket Size") - @Comment({"Sets how large a personal pocket is when initially created.", - "Default: 2"}) + @Comment("Sets how large a personal pocket is when initially created.") @RangeInt(min = 0, max = 7) public int initialPrivatePocketSize = 2; @Name("Public Pocket Size") @Comment({"Sets how deep a public pocket created in the overworld will be on average.", - "Pockets created at a deeper depth will have larger sizes.", - "Default: 1"}) + "Pockets created at a deeper depth will have larger sizes."}) public int basePublicPocketSize = 1; @Name("Load All Schematics") @Comment({"Forces all available pocket schematics to load on game-start even if the configured maximum sizes mean that these", "schematics will never be placed in any naturally generated pockets. This is meant for testing purposes,", - "because the /pocket command can be used to force generate these pockets.", - "Default: false"}) + "because the /pocket command can be used to force generate these pockets."}) public boolean loadAllSchematics = true; } - public static class WorldGen { + public static class World { @Name("Rift Cluster Generation Chance") - @Comment({"Sets the chance (out of 1.0) that a cluster of rifts will generate in a given chunk.", - "Default: 0.0002"}) + @Comment("Sets the chance (out of 1.0) that a cluster of rifts will generate in a given chunk.") @RangeDouble(min=0, max=1) public double clusterGenerationChance = 0.0002; @@ -95,8 +78,7 @@ public final class ModConfig { public int[] riftClusterDimensionTypeBlacklist = {}; @Name("Gateway Generation Chance") - @Comment({"Sets the chance (out of 1.0) that a Rift Gateway will generate in a given chunk.", - "Default: 0.0015"}) + @Comment("Sets the chance (out of 1.0) that a Rift Gateway will generate in a given chunk.") @RangeDouble(min=0, max=1) public double gatewayGenerationChance = 0.0015; @@ -115,13 +97,11 @@ public final class ModConfig { public static class Monoliths { @Name("Dangerous Monoliths") - @Comment({"Are Monoliths in Limbo Dangerous?", - "Default: false"}) + @Comment("Are Monoliths in Limbo Dangerous?") public boolean dangerousLimboMonolithsEnabled = false; @Name("Monolith Teleportation") - @Comment({"Is Monolith Teleportation enabled?", - "Default: true"}) + @Comment("Is Monolith Teleportation enabled?") public boolean monolithTeleportationEnabled = true; } @@ -129,17 +109,13 @@ public final class ModConfig { @Name("Universal Limbo") @Comment({"Sets whether players are teleported to Limbo when they die in any dimension (except Limbo).", "Normally, players only go to Limbo if they die in a pocket dimension. This setting will not", - "affect deaths in Limbo, which can be set with the Hardcore Limbo option.", - "Default: false"}) + "affect deaths in Limbo, which can be set with the Hardcore Limbo option."}) public boolean universalLimboEnabled = false; @Name("Hardcore Limbo") @Comment({"Whether a player dying in limbo should respawn in limbo, making eternal fluid or gold dimensional doors", - "the only way to get out", - "Default: false"}) + "the only way to get out"}) public boolean hardcoreLimboEnabled = false; - - } @SubscribeEvent diff --git a/src/main/java/org/dimdev/dimdoors/shared/commands/CommandDimTeleport.java b/src/main/java/org/dimdev/dimdoors/shared/commands/CommandDimTeleport.java index 66c7a4f7..6c4255ad 100644 --- a/src/main/java/org/dimdev/dimdoors/shared/commands/CommandDimTeleport.java +++ b/src/main/java/org/dimdev/dimdoors/shared/commands/CommandDimTeleport.java @@ -1,34 +1,25 @@ package org.dimdev.dimdoors.shared.commands; -import org.dimdev.dimdoors.DimDoors; -import org.dimdev.ddutils.Location; - -import java.util.ArrayList; -import java.util.Arrays; -import java.util.List; -import java.util.stream.Collectors; -import javax.annotation.Nullable; - -import org.dimdev.ddutils.TeleportUtils; import net.minecraft.command.CommandBase; import net.minecraft.command.CommandException; import net.minecraft.command.ICommandSender; +import net.minecraft.command.WrongUsageException; import net.minecraft.entity.Entity; +import net.minecraft.entity.player.EntityPlayerMP; import net.minecraft.server.MinecraftServer; import net.minecraft.util.math.BlockPos; -import net.minecraft.util.text.TextComponentString; +import net.minecraft.util.math.Vec3d; import net.minecraftforge.common.DimensionManager; +import org.dimdev.ddutils.Location; +import org.dimdev.ddutils.TeleportUtils; -public class CommandDimTeleport extends CommandBase { // TODO: localization, CommandException +import javax.annotation.Nullable; +import java.util.Arrays; +import java.util.Collections; +import java.util.List; +import java.util.stream.Collectors; - private final List aliases; - - public CommandDimTeleport() { - aliases = new ArrayList<>(); - aliases.add("dimteleport"); - aliases.add("dteleport"); - aliases.add("dtp"); - } +public class CommandDimTeleport extends CommandBase { @Override public String getName() { @@ -37,55 +28,45 @@ public class CommandDimTeleport extends CommandBase { // TODO: localization, Com @Override public String getUsage(ICommandSender sender) { - return "dimteleport [yaw] [pitch]"; + return "commands.dimteleport.usage"; } @Override public List getAliases() { - return aliases; + return Arrays.asList("dteleport", "dtp"); } @Override public void execute(MinecraftServer server, ICommandSender sender, String[] args) throws CommandException { + EntityPlayerMP player = getCommandSenderAsPlayer(sender); + // Check that the number of arguments is correct if (args.length < 4 || args.length > 6) { - sender.sendMessage(new TextComponentString("[DimDoors] Usage: /" + getUsage(sender))); - return; + throw new WrongUsageException("commands.dimteleport.usage"); } - // Parse arguments - int dimension, x, y, z; - int yaw = 0; - int pitch = 0; - try { - dimension = Integer.parseInt(args[0]); - x = Integer.parseInt(args[1]); - y = Integer.parseInt(args[2]); - z = Integer.parseInt(args[3]); - if (args.length >= 5) yaw = Integer.parseInt(args[4]); - if (args.length >= 6) pitch = Integer.parseInt(args[5]); - } catch (NumberFormatException e) { - sender.sendMessage(new TextComponentString("[DimDoors] Usage: /" + getUsage(sender))); - return; - } + int dimension = parseInt(args[0]); - // Teleport if it's a player - if (sender instanceof Entity) { - TeleportUtils.teleport((Entity) sender, new Location(dimension, new BlockPos(x, y, z)), yaw, pitch); - } else { - DimDoors.log.info("Not executing command /" + getName() + " because it wasn't sent by a player."); - } + Vec3d senderPos = sender.getPositionVector(); + CoordinateArg x = parseCoordinate(senderPos.x, args[1], true); + CoordinateArg y = parseCoordinate(senderPos.y, args[2], false); + CoordinateArg z = parseCoordinate(senderPos.z, args[3], true); + + CoordinateArg yaw = parseCoordinate(player.rotationYaw, args.length > 4 ? args[4] : "~", false); + CoordinateArg pitch = parseCoordinate(player.rotationPitch, args.length > 5 ? args[5] : "~", false); + + TeleportUtils.teleport(player, new Location(dimension, new BlockPos(x.getResult(), y.getResult(), z.getResult())), (float) yaw.getResult(), (float) pitch.getResult()); } @Override public List getTabCompletions(MinecraftServer server, ICommandSender sender, String[] args, @Nullable BlockPos targetPos) { if (args.length == 1) { - return Arrays.stream(DimensionManager.getIDs()) + return Arrays.stream(DimensionManager.getStaticDimensionIDs()) .map(Object::toString) .filter(s -> s.toLowerCase().startsWith(args[0].toLowerCase())) .collect(Collectors.toList()); } else { - return new ArrayList<>(); + return args.length > 1 && args.length <= 4 ? getTabCompletionCoordinate(args, 1, targetPos) : Collections.emptyList(); } } } diff --git a/src/main/java/org/dimdev/dimdoors/shared/commands/CommandFabricConvert.java b/src/main/java/org/dimdev/dimdoors/shared/commands/CommandFabricConvert.java index 6269f8cb..8e77ebca 100644 --- a/src/main/java/org/dimdev/dimdoors/shared/commands/CommandFabricConvert.java +++ b/src/main/java/org/dimdev/dimdoors/shared/commands/CommandFabricConvert.java @@ -8,22 +8,12 @@ import net.minecraft.entity.player.EntityPlayerMP; import net.minecraft.item.EnumDyeColor; import net.minecraft.server.MinecraftServer; import net.minecraft.util.math.BlockPos; -import org.dimdev.dimdoors.DimDoors; import org.dimdev.dimdoors.shared.blocks.BlockFabric; -import org.dimdev.pocketlib.WorldProviderPocket; import org.dimdev.pocketlib.Pocket; import org.dimdev.pocketlib.PocketRegistry; - -import java.util.ArrayList; -import java.util.List; +import org.dimdev.pocketlib.WorldProviderPocket; public class CommandFabricConvert extends CommandBase { - private final List aliases; - - public CommandFabricConvert() { - aliases = new ArrayList<>(); - aliases.add("fabricconvert"); - } @Override public String getName() { @@ -32,45 +22,32 @@ public class CommandFabricConvert extends CommandBase { @Override public String getUsage(ICommandSender sender) { - return "fabricconvert"; - } - - @Override - public List getAliases() { - return aliases; + return "commands.fabricconvert.usage"; } @Override public void execute(MinecraftServer server, ICommandSender sender, String[] args) throws CommandException { - // Execute only if it's a player - if (sender instanceof EntityPlayerMP) { - EntityPlayerMP player = getCommandSenderAsPlayer(sender); + EntityPlayerMP player = getCommandSenderAsPlayer(sender); - if (!(player.world.provider instanceof WorldProviderPocket)) { - DimDoors.chat(player, "Current Dimension isn't a pocket dimension"); - return; - } + if (!(player.world.provider instanceof WorldProviderPocket)) throw new CommandException("commands.generic.dimdoors.not_in_pocket"); + Pocket pocket = PocketRegistry.instance(player.dimension).getPocketAt(player.getPosition()); + if (pocket == null) throw new CommandException("commands.generic.dimdoors.not_in_pocket"); - Pocket pocket = PocketRegistry.instance(player.dimension).getPocketAt(player.getPosition()); + BlockPos origin = pocket.getOrigin(); + int size = (pocket.getSize() + 1) * 16 - 1; - BlockPos origin = pocket.getOrigin(); - int size = (pocket.getSize() + 1) * 16 - 1; + for (int x = 0; x < size; x++) { + for (int y = 0; y < size; y++) { + for (int z = 0; z < size; z++) { + IBlockState state = player.world.getBlockState(new BlockPos(origin.getX() + x, origin.getY() + y, origin.getZ() + z)); - for (int x = 0; x < size; x++) { - for (int y = 0; y < size; y++) { - for (int z = 0; z < size; z++) { - IBlockState state = player.world.getBlockState(new BlockPos(origin.getX() + x, origin.getY() + y, origin.getZ() + z)); - - if (state.getBlock() instanceof BlockFabric) { - player.world.setBlockState(origin, state.withProperty(BlockFabric.COLOR, EnumDyeColor.BLACK)); - } + if (state.getBlock() instanceof BlockFabric) { + player.world.setBlockState(origin, state.withProperty(BlockFabric.COLOR, EnumDyeColor.BLACK)); } } } - - DimDoors.chat(player, "All fabric's of reality have been converted to black."); - } else { - DimDoors.log.info("Not executing command /" + getName() + " because it wasn't sent by a player."); } + + notifyCommandListener(sender, this, "commands.fabricconvert.success"); } } diff --git a/src/main/java/org/dimdev/dimdoors/shared/commands/CommandPocket.java b/src/main/java/org/dimdev/dimdoors/shared/commands/CommandPocket.java index 23f077b4..a0e9f974 100644 --- a/src/main/java/org/dimdev/dimdoors/shared/commands/CommandPocket.java +++ b/src/main/java/org/dimdev/dimdoors/shared/commands/CommandPocket.java @@ -1,20 +1,21 @@ package org.dimdev.dimdoors.shared.commands; -import org.dimdev.dimdoors.DimDoors; -import org.dimdev.dimdoors.shared.pockets.*; -import org.dimdev.dimdoors.shared.rifts.TileEntityRift; -import org.dimdev.ddutils.Location; -import org.dimdev.ddutils.TeleportUtils; -import org.dimdev.ddutils.WorldUtils; -import org.dimdev.dimdoors.shared.rifts.registry.RiftRegistry; -import org.dimdev.dimdoors.shared.world.ModDimensions; import net.minecraft.command.CommandBase; import net.minecraft.command.CommandException; import net.minecraft.command.ICommandSender; +import net.minecraft.command.WrongUsageException; import net.minecraft.entity.player.EntityPlayerMP; import net.minecraft.server.MinecraftServer; import net.minecraft.util.math.BlockPos; -import net.minecraft.util.text.TextComponentString; +import org.dimdev.ddutils.Location; +import org.dimdev.ddutils.TeleportUtils; +import org.dimdev.ddutils.WorldUtils; +import org.dimdev.dimdoors.shared.pockets.PocketGenerator; +import org.dimdev.dimdoors.shared.pockets.PocketTemplate; +import org.dimdev.dimdoors.shared.pockets.SchematicHandler; +import org.dimdev.dimdoors.shared.rifts.TileEntityRift; +import org.dimdev.dimdoors.shared.rifts.registry.RiftRegistry; +import org.dimdev.dimdoors.shared.world.ModDimensions; import org.dimdev.pocketlib.Pocket; import javax.annotation.Nullable; @@ -24,84 +25,53 @@ import java.util.stream.Collectors; public class CommandPocket extends CommandBase { - private final List aliases; - - public CommandPocket() { - aliases = new ArrayList<>(); - aliases.add("pocket"); - } - @Override public String getName() { - return "pocket"; + return "pockets"; } @Override public String getUsage(ICommandSender sender) { - return "pocket [setup]"; + return "commands.pockets.usage"; } @Override - public List getAliases() { - return aliases; - } + public void execute(MinecraftServer server, ICommandSender sender, String[] args) throws CommandException { + EntityPlayerMP player = getCommandSenderAsPlayer(sender); - @Override - public void execute(MinecraftServer server, ICommandSender sender, String[] args) throws CommandException { // TODO: more pocket commands (replace pocket, get ID, teleport to pocket, etc.) // Check that the number of arguments is correct if (args.length < 2 || args.length > 3) { - sender.sendMessage(new TextComponentString("[DimDoors] Usage: /" + getUsage(sender))); - return; + throw new WrongUsageException("commands.pockets.usage"); } + + // Make sure the player is in a pocket world + if (!ModDimensions.isDimDoorsPocketDimension(player.world)) { + throw new CommandException("commands.generic.dimdoors.not_in_pocket_dim"); + } + String group = args[0]; String name = args[1]; - boolean setup = true; - if (args.length >= 3) { - switch (args[2]) { - case "true": - setup = true; - break; - case "false": - setup = false; - break; - default: - sender.sendMessage(new TextComponentString("[DimDoors] Usage: /" + getUsage(sender))); - return; - } + + // Check if the schematic exists + if (!SchematicHandler.INSTANCE.getTemplateGroups().contains(group)) { + throw new CommandException("commands.pockets.groupnotfound", group); + } else if (!SchematicHandler.INSTANCE.getTemplateNames(group).contains(name)) { + throw new CommandException("commands.pockets.templatenotfound", group); } - // Execute only if it's a player - if (sender instanceof EntityPlayerMP) { - EntityPlayerMP player = getCommandSenderAsPlayer(sender); - // Make sure the player is in a pocket world - if (!ModDimensions.isDimDoorsPocketDimension(player.world)) { - DimDoors.chat(player, "You must be in a pocket dimension to use this command!"); - return; - } + boolean setup = parseBoolean(args[3]); - // Check if the schematic exists - if (!SchematicHandler.INSTANCE.getTemplateGroups().contains(group)) { - DimDoors.chat(player, "Group " + group + " not found"); - return; - } else if (!SchematicHandler.INSTANCE.getTemplateNames(group).contains(name)) { - DimDoors.chat(player, "Schematic " + name + " not found in group " + group); - return; - } + // Generate the schematic + PocketTemplate template = SchematicHandler.INSTANCE.getTemplate(group, name); + Pocket pocket = PocketGenerator.generatePocketFromTemplate(WorldUtils.getDim(player.world), template, null, setup); - // Generate the schematic - PocketTemplate template = SchematicHandler.INSTANCE.getTemplate(group, name); - Pocket pocket = PocketGenerator.generatePocketFromTemplate(WorldUtils.getDim(player.world), template, null, setup); - - // Teleport the player there - if (RiftRegistry.instance().getPocketEntrance(pocket) != null) { - TileEntityRift entrance = (TileEntityRift) player.world.getTileEntity(RiftRegistry.instance().getPocketEntrance(pocket).getPos()); - entrance.teleportTo(player); - } else { - int size = (pocket.getSize() + 1) * 16; - TeleportUtils.teleport(player, new Location(player.world, pocket.getOrigin().add(size / 2, size / 2, size / 2))); - } + // Teleport the player there + if (RiftRegistry.instance().getPocketEntrance(pocket) != null) { + TileEntityRift entrance = (TileEntityRift) player.world.getTileEntity(RiftRegistry.instance().getPocketEntrance(pocket).getPos()); + entrance.teleportTo(player); } else { - DimDoors.log.info("Not executing command /" + getName() + " because it wasn't sent by a player."); + int size = (pocket.getSize() + 1) * 16; + TeleportUtils.teleport(player, new Location(player.world, pocket.getOrigin().add(size / 2, size / 2, size / 2))); } } diff --git a/src/main/java/org/dimdev/dimdoors/shared/commands/CommandSaveSchem.java b/src/main/java/org/dimdev/dimdoors/shared/commands/CommandSaveSchem.java index c98c1644..dddb8014 100644 --- a/src/main/java/org/dimdev/dimdoors/shared/commands/CommandSaveSchem.java +++ b/src/main/java/org/dimdev/dimdoors/shared/commands/CommandSaveSchem.java @@ -4,27 +4,17 @@ import com.flowpowered.math.vector.Vector3i; import net.minecraft.command.CommandBase; import net.minecraft.command.CommandException; import net.minecraft.command.ICommandSender; +import net.minecraft.command.WrongUsageException; import net.minecraft.entity.player.EntityPlayerMP; import net.minecraft.server.MinecraftServer; import net.minecraft.util.math.BlockPos; -import net.minecraft.util.text.TextComponentString; import org.dimdev.ddutils.schem.Schematic; -import org.dimdev.dimdoors.DimDoors; +import org.dimdev.dimdoors.shared.pockets.SchematicHandler; import org.dimdev.pocketlib.Pocket; import org.dimdev.pocketlib.PocketRegistry; -import org.dimdev.dimdoors.shared.pockets.SchematicHandler; import org.dimdev.pocketlib.WorldProviderPocket; -import java.util.ArrayList; -import java.util.List; - public class CommandSaveSchem extends CommandBase { - private final List aliases; - - public CommandSaveSchem() { - aliases = new ArrayList<>(); - aliases.add("saveschem"); - } @Override public String getName() { @@ -33,41 +23,28 @@ public class CommandSaveSchem extends CommandBase { @Override public String getUsage(ICommandSender sender) { - return "saveschem "; - } - - @Override - public List getAliases() { - return aliases; + return "commands.saveschem.usage"; } @Override public void execute(MinecraftServer server, ICommandSender sender, String[] args) throws CommandException { - // Check that the number of arguments is correct + EntityPlayerMP player = getCommandSenderAsPlayer(sender); + if (args.length != 1) { - sender.sendMessage(new TextComponentString("[DimDoors] Usage: /" + getUsage(sender))); - return; + throw new WrongUsageException("commands.saveschem.usage"); } - // Execute only if it's a player - if (sender instanceof EntityPlayerMP) { - EntityPlayerMP player = getCommandSenderAsPlayer(sender); + if (!(player.world.provider instanceof WorldProviderPocket)) + throw new CommandException("commands.generic.dimdoors.not_in_pocket"); + Pocket pocket = PocketRegistry.instance(player.dimension).getPocketAt(player.getPosition()); + if (pocket == null) throw new CommandException("commands.generic.dimdoors.not_in_pocket"); - if (!(player.world.provider instanceof WorldProviderPocket)) { - DimDoors.chat(player, "Current Dimension isn't a pocket dimension"); - return; - } + Schematic schematic = Schematic.createFromWorld(player.world, toVector3i(pocket.getOrigin()), toVector3i(pocket.getOrigin()).add(Vector3i.from((pocket.getSize() + 1) * 16 - 1))); + schematic.name = args[0]; + schematic.author = player.getName(); - Pocket pocket = PocketRegistry.instance(player.dimension).getPocketAt(player.getPosition()); - Schematic schematic = Schematic.createFromWorld(player.world, toVector3i(pocket.getOrigin()), toVector3i(pocket.getOrigin()).add(Vector3i.from((pocket.getSize() + 1) * 16 - 1))); - schematic.name = args[0]; - schematic.author = player.getName(); - - SchematicHandler.INSTANCE.saveSchematic(schematic, args[0]); - DimDoors.chat(player, "Pocket " + args[0] + " has been saved."); - } else { - DimDoors.log.info("Not executing command /" + getName() + " because it wasn't sent by a player."); - } + SchematicHandler.INSTANCE.saveSchematic(schematic, args[0]); + notifyCommandListener(sender, this, "commands.saveschem.success", args[0]); } private Vector3i toVector3i(BlockPos pos) { diff --git a/src/main/java/org/dimdev/dimdoors/shared/entities/EntityMonolith.java b/src/main/java/org/dimdev/dimdoors/shared/entities/EntityMonolith.java index 785a5605..f8c0cb1e 100644 --- a/src/main/java/org/dimdev/dimdoors/shared/entities/EntityMonolith.java +++ b/src/main/java/org/dimdev/dimdoors/shared/entities/EntityMonolith.java @@ -52,7 +52,7 @@ public class EntityMonolith extends EntityFlying implements IMob { } public boolean isDangerous() { - return ModConfig.monolith.monolithTeleportationEnabled && (world.provider instanceof WorldProviderLimbo || ModConfig.monolith.dangerousLimboMonolithsEnabled); + return ModConfig.monoliths.monolithTeleportationEnabled && (world.provider instanceof WorldProviderLimbo || ModConfig.monoliths.dangerousLimboMonolithsEnabled); } @Override @@ -146,7 +146,7 @@ public class EntityMonolith extends EntityFlying implements IMob { } // Teleport the target player if various conditions are met - if (aggro >= MAX_AGGRO && !world.isRemote && ModConfig.monolith.monolithTeleportationEnabled && !player.isCreative() && isDangerous()) { + if (aggro >= MAX_AGGRO && !world.isRemote && ModConfig.monoliths.monolithTeleportationEnabled && !player.isCreative() && isDangerous()) { aggro = 0; Location destination = WorldProviderLimbo.getLimboSkySpawn(player); TeleportUtils.teleport(player, destination, 0, 0); diff --git a/src/main/java/org/dimdev/dimdoors/shared/items/ItemRiftRemover.java b/src/main/java/org/dimdev/dimdoors/shared/items/ItemRiftRemover.java index e8f05be4..454e748d 100644 --- a/src/main/java/org/dimdev/dimdoors/shared/items/ItemRiftRemover.java +++ b/src/main/java/org/dimdev/dimdoors/shared/items/ItemRiftRemover.java @@ -1,6 +1,7 @@ package org.dimdev.dimdoors.shared.items; import net.minecraft.util.*; +import net.minecraft.util.text.TextComponentTranslation; import net.minecraftforge.fml.relauncher.Side; import net.minecraftforge.fml.relauncher.SideOnly; import org.dimdev.dimdoors.DimDoors; @@ -16,6 +17,7 @@ import net.minecraft.item.ItemStack; import net.minecraft.util.math.RayTraceResult; import net.minecraft.world.World; +import java.awt.*; import java.util.List; public class ItemRiftRemover extends Item { @@ -51,7 +53,7 @@ public class ItemRiftRemover extends Item { // TODO: render rift removing animation stack.damageItem(10, player); - DimDoors.sendMessage(player, "Rift Removed"); + player.sendStatusMessage(new TextComponentTranslation("item.rift_remover.removed"), true); return new ActionResult<>(EnumActionResult.SUCCESS, stack); } return new ActionResult<>(EnumActionResult.FAIL, stack); diff --git a/src/main/java/org/dimdev/dimdoors/shared/items/ItemRiftSignature.java b/src/main/java/org/dimdev/dimdoors/shared/items/ItemRiftSignature.java index 1aae1cb0..8ec86045 100644 --- a/src/main/java/org/dimdev/dimdoors/shared/items/ItemRiftSignature.java +++ b/src/main/java/org/dimdev/dimdoors/shared/items/ItemRiftSignature.java @@ -6,6 +6,7 @@ import net.minecraft.init.Blocks; import net.minecraft.nbt.NBTTagCompound; import net.minecraft.util.*; import net.minecraft.util.math.BlockPos; +import net.minecraft.util.text.TextComponentTranslation; import net.minecraftforge.fml.relauncher.Side; import net.minecraftforge.fml.relauncher.SideOnly; import org.dimdev.ddutils.I18nUtils; @@ -56,7 +57,12 @@ public class ItemRiftSignature extends Item { RotatedLocation target = getSource(stack); - if (target != null) { + if (target == null) { + // The link signature has not been used. Store its current target as the first location. + setSource(stack, new RotatedLocation(new Location(world, pos), player.rotationYaw, 0)); + player.sendStatusMessage(new TextComponentTranslation("item.rift_signature.stored"), true); + world.playSound(null, player.getPosition(), ModSounds.RIFT_START, SoundCategory.BLOCKS, 0.6f, 1); + } else { // Place a rift at the saved point TODO: check that the player still has permission if (!target.getLocation().getBlockState().getBlock().equals(ModBlocks.RIFT)) { if (!target.getLocation().getBlockState().getBlock().equals(Blocks.AIR)) { @@ -80,14 +86,9 @@ public class ItemRiftSignature extends Item { stack.damageItem(1, player); // TODO: calculate damage based on position? clearSource(stack); - DimDoors.sendMessage(player, "Rift Created"); + player.sendStatusMessage(new TextComponentTranslation("item.rift_signature.created"), true); // null = send sound to the player too, we have to do this because this code is not run client-side world.playSound(null, player.getPosition(), ModSounds.RIFT_END, SoundCategory.BLOCKS, 0.6f, 1); - } else { - // The link signature has not been used. Store its current target as the first location. - setSource(stack, new RotatedLocation(new Location(world, pos), player.rotationYaw, 0)); - DimDoors.sendMessage(player, "Location Stored in Rift Signature"); - world.playSound(null, player.getPosition(), ModSounds.RIFT_START, SoundCategory.BLOCKS, 0.6f, 1); } return EnumActionResult.SUCCESS; diff --git a/src/main/java/org/dimdev/dimdoors/shared/items/ItemStabilizedRiftSignature.java b/src/main/java/org/dimdev/dimdoors/shared/items/ItemStabilizedRiftSignature.java index 89c0b284..c1893cab 100644 --- a/src/main/java/org/dimdev/dimdoors/shared/items/ItemStabilizedRiftSignature.java +++ b/src/main/java/org/dimdev/dimdoors/shared/items/ItemStabilizedRiftSignature.java @@ -9,6 +9,7 @@ import net.minecraft.item.ItemStack; import net.minecraft.nbt.NBTTagCompound; import net.minecraft.util.*; import net.minecraft.util.math.BlockPos; +import net.minecraft.util.text.TextComponentTranslation; import net.minecraft.world.World; import net.minecraftforge.fml.relauncher.Side; import net.minecraftforge.fml.relauncher.SideOnly; @@ -56,7 +57,12 @@ public class ItemStabilizedRiftSignature extends Item { // TODO: common supercla RotatedLocation target = getTarget(stack); - if (target != null) { + if (target == null) { + // The link signature has not been used. Store its current target as the first location. + setSource(stack, new RotatedLocation(new Location(world, pos), player.rotationYaw, 0)); + player.sendStatusMessage(new TextComponentTranslation("item.stabilized_rift_signature.stored"), true); + world.playSound(null, player.getPosition(), ModSounds.RIFT_START, SoundCategory.BLOCKS, 0.6f, 1); + } else { // Place a rift at the target point if (!target.getLocation().getBlockState().getBlock().equals(ModBlocks.RIFT)) { if (!target.getLocation().getBlockState().getBlock().equals(Blocks.AIR)) { @@ -78,13 +84,8 @@ public class ItemStabilizedRiftSignature extends Item { // TODO: common supercla stack.damageItem(1, player); - DimDoors.sendMessage(player, "Rift Created"); + player.sendStatusMessage(new TextComponentTranslation("item.stabilized_rift_signature.created"), true); world.playSound(null, player.getPosition(), ModSounds.RIFT_END, SoundCategory.BLOCKS, 0.6f, 1); - } else { - // The link signature has not been used. Store its current target as the first location. - setSource(stack, new RotatedLocation(new Location(world, pos), player.rotationYaw, 0)); - DimDoors.sendMessage(player, "Location Stored in Rift Signature"); - world.playSound(null, player.getPosition(), ModSounds.RIFT_START, SoundCategory.BLOCKS, 0.6f, 1); } return EnumActionResult.SUCCESS; diff --git a/src/main/java/org/dimdev/dimdoors/shared/pockets/PocketGenerator.java b/src/main/java/org/dimdev/dimdoors/shared/pockets/PocketGenerator.java index 81f0f819..2ea57a7d 100644 --- a/src/main/java/org/dimdev/dimdoors/shared/pockets/PocketGenerator.java +++ b/src/main/java/org/dimdev/dimdoors/shared/pockets/PocketGenerator.java @@ -14,7 +14,7 @@ import java.util.Random; public final class PocketGenerator { public static Pocket generatePocketFromTemplate(int dim, PocketTemplate pocketTemplate, VirtualLocation virtualLocation, boolean setup) { - DimDoors.log.info("Generating pocket from template " + pocketTemplate.getId() + " at virtual location " + virtualLocation); + DimDoors.log.info("Generating pockets from template " + pocketTemplate.getId() + " at virtual location " + virtualLocation); PocketRegistry registry = PocketRegistry.instance(dim); Pocket pocket = registry.newPocket(); @@ -29,7 +29,7 @@ public final class PocketGenerator { return generatePocketFromTemplate(ModDimensions.getPrivateDim(), pocketTemplate, virtualLocation, true); } - // TODO: size of public pocket should increase with depth + // TODO: size of public pockets should increase with depth public static Pocket generatePublicPocket(VirtualLocation virtualLocation, RiftDestination linkTo, LinkProperties linkProperties) { PocketTemplate pocketTemplate = SchematicHandler.INSTANCE.getPublicPocketTemplate(); Pocket pocket = generatePocketFromTemplate(ModDimensions.getPublicDim(), pocketTemplate, virtualLocation, false); @@ -38,17 +38,17 @@ public final class PocketGenerator { } /** - * Create a dungeon pocket at a certain depth. + * Create a dungeon pockets at a certain depth. * - * @param virtualLocation The virtual location of the pocket - * @return The newly-generated dungeon pocket + * @param virtualLocation The virtual location of the pockets + * @return The newly-generated dungeon pockets */ public static Pocket generateDungeonPocket(VirtualLocation virtualLocation, RiftDestination linkTo, LinkProperties linkProperties) { int depth = virtualLocation.getDepth(); float netherProbability = virtualLocation.getDim() == -1 ? 1 : (float) depth / 200; // TODO: improve nether probability Random random = new Random(); String group = random.nextFloat() < netherProbability ? "nether" : "ruins"; - PocketTemplate pocketTemplate = SchematicHandler.INSTANCE.getRandomTemplate(group, depth, ModConfig.pocket.maxPocketSize, false); + PocketTemplate pocketTemplate = SchematicHandler.INSTANCE.getRandomTemplate(group, depth, ModConfig.pockets.maxPocketSize, false); Pocket pocket = generatePocketFromTemplate(ModDimensions.getDungeonDim(), pocketTemplate, virtualLocation, false); pocketTemplate.setup(pocket, linkTo, linkProperties); diff --git a/src/main/java/org/dimdev/dimdoors/shared/pockets/PocketTemplate.java b/src/main/java/org/dimdev/dimdoors/shared/pockets/PocketTemplate.java index c5715cce..7dc0a124 100644 --- a/src/main/java/org/dimdev/dimdoors/shared/pockets/PocketTemplate.java +++ b/src/main/java/org/dimdev/dimdoors/shared/pockets/PocketTemplate.java @@ -145,8 +145,6 @@ public class PocketTemplate { } } - // Link the pocket back - // Link pocket exits back for (TileEntityRift rift : rifts) { RiftDestination dest = rift.getDestination(); diff --git a/src/main/java/org/dimdev/dimdoors/shared/pockets/SchematicHandler.java b/src/main/java/org/dimdev/dimdoors/shared/pockets/SchematicHandler.java index ac4739a8..939641df 100644 --- a/src/main/java/org/dimdev/dimdoors/shared/pockets/SchematicHandler.java +++ b/src/main/java/org/dimdev/dimdoors/shared/pockets/SchematicHandler.java @@ -190,7 +190,7 @@ public class SchematicHandler { // TODO: parts of this should be moved to the or String name = pocket.has("name") ? pocket.get("name").getAsString() : null; String author = pocket.has("author") ? pocket.get("author").getAsString() : null; int size = pocket.get("size").getAsInt(); - if (ModConfig.pocket.loadAllSchematics && size > ModConfig.pocket.maxPocketSize) continue; + if (ModConfig.pockets.loadAllSchematics && size > ModConfig.pockets.maxPocketSize) continue; int baseWeight = pocket.has("baseWeight") ? pocket.get("baseWeight").getAsInt() : 100; pocketTemplates.add(new PocketTemplate(group, id, type, name, author, size, baseWeight)); } @@ -286,11 +286,11 @@ public class SchematicHandler { // TODO: parts of this should be moved to the or } public PocketTemplate getPersonalPocketTemplate() { - return getRandomTemplate("private", -1, ModConfig.pocket.initialPrivatePocketSize, true); + return getRandomTemplate("private", -1, ModConfig.pockets.initialPrivatePocketSize, true); } public PocketTemplate getPublicPocketTemplate() { - return getRandomTemplate("public", -1, ModConfig.pocket.basePublicPocketSize, true); + return getRandomTemplate("public", -1, ModConfig.pockets.basePublicPocketSize, true); } public void saveSchematic(Schematic schematic, String id) { diff --git a/src/main/java/org/dimdev/dimdoors/shared/rifts/TileEntityRift.java b/src/main/java/org/dimdev/dimdoors/shared/rifts/TileEntityRift.java index b759543c..a9109819 100644 --- a/src/main/java/org/dimdev/dimdoors/shared/rifts/TileEntityRift.java +++ b/src/main/java/org/dimdev/dimdoors/shared/rifts/TileEntityRift.java @@ -182,7 +182,7 @@ import javax.annotation.Nonnull; // Check that the rift has as destination if (destination == null) { - DimDoors.sendMessage(entity, "This rift has no destination!"); + DimDoors.sendTranslatedMessage(entity, "rifts.unlinked"); return false; } @@ -190,11 +190,11 @@ import javax.annotation.Nonnull; try { if (destination.teleport(new RotatedLocation(new Location(world, pos), yaw, pitch), entity)) { VirtualLocation vloc = VirtualLocation.fromLocation(new Location(entity.world, entity.getPosition())); - DimDoors.sendMessage(entity, "You are at x = " + vloc.getX() + ", y = ?, z = " + vloc.getZ() + ", w = " + vloc.getDepth()); + DimDoors.sendTranslatedMessage(entity, "You are at x = " + vloc.getX() + ", y = ?, z = " + vloc.getZ() + ", w = " + vloc.getDepth()); return true; } } catch (Exception e) { - DimDoors.chat(entity, "There was an exception while teleporting, please report this bug."); + DimDoors.chat(entity, "Something went wrong while trying to teleport you, please report this bug."); DimDoors.log.error("Teleporting failed with the following exception: ", e); } return false; @@ -204,7 +204,7 @@ import javax.annotation.Nonnull; //if (relativeRotation) { // TeleportUtils.teleport(entity, new Location(world, pos), yaw + entity.rotationYaw - fromYaw, pitch + entity.rotationPitch - fromPitch); //} else { - TeleportUtils.teleport(entity, new Location(world, pos), yaw, pitch); + teleportTo(entity); //} } diff --git a/src/main/java/org/dimdev/dimdoors/shared/rifts/destinations/EscapeDestination.java b/src/main/java/org/dimdev/dimdoors/shared/rifts/destinations/EscapeDestination.java index fbd10bc6..c400d24c 100644 --- a/src/main/java/org/dimdev/dimdoors/shared/rifts/destinations/EscapeDestination.java +++ b/src/main/java/org/dimdev/dimdoors/shared/rifts/destinations/EscapeDestination.java @@ -36,7 +36,11 @@ public class EscapeDestination extends RiftDestination { @Override public boolean teleport(RotatedLocation loc, Entity entity) { if (!ModDimensions.isDimDoorsPocketDimension(entity.world)) { - DimDoors.sendMessage(entity, "Can't escape from a non-pocket dimension!"); + if (entity.world.provider instanceof WorldProviderLimbo) { + DimDoors.sendTranslatedMessage(entity, "rifts.destinations.escape.cannot_escape_limbo"); + } else { + DimDoors.sendTranslatedMessage(entity, "rifts.destinations.escape.not_in_pocket_dim"); + } return false; } UUID uuid = entity.getUniqueID(); @@ -44,15 +48,14 @@ public class EscapeDestination extends RiftDestination { Location destLoc = RiftRegistry.instance().getOverworldRift(uuid); if (destLoc != null && destLoc.getTileEntity() instanceof TileEntityRift) { //TeleportUtils.teleport(entity, new VirtualLocation(destLoc, rift.virtualLocation.getDepth()).projectToWorld()); // TODO - // TODO return true; } else { if (destLoc == null) { - DimDoors.sendMessage(entity, "You didn't use a rift to enter so you ended up in Limbo!"); // TODO: better messages, localization + DimDoors.sendTranslatedMessage(entity, "rifts.destinations.escape.did_not_use_rift"); } else { - DimDoors.sendMessage(entity, "The rift you used to enter has closed so you ended up in Limbo!"); + DimDoors.sendTranslatedMessage(entity, "rifts.destinations.escape.rift_has_closed"); } - TeleportUtils.teleport(entity, WorldProviderLimbo.getLimboSkySpawn(entity)); // TODO: do we really want to spam limbo with items? + TeleportUtils.teleport(entity, WorldProviderLimbo.getLimboSkySpawn(entity)); return true; } } else { diff --git a/src/main/java/org/dimdev/dimdoors/shared/rifts/destinations/GlobalDestination.java b/src/main/java/org/dimdev/dimdoors/shared/rifts/destinations/GlobalDestination.java index 5f2c9550..3533e8c7 100644 --- a/src/main/java/org/dimdev/dimdoors/shared/rifts/destinations/GlobalDestination.java +++ b/src/main/java/org/dimdev/dimdoors/shared/rifts/destinations/GlobalDestination.java @@ -15,7 +15,7 @@ import org.dimdev.dimdoors.shared.rifts.RiftDestination; import org.dimdev.dimdoors.shared.rifts.TileEntityRift; @Getter @AllArgsConstructor @Builder(toBuilder = true) @ToString -@NBTSerializable public class GlobalDestination extends RiftDestination { // TODO: location directly in nbt like minecraft? +@NBTSerializable public class GlobalDestination extends RiftDestination { @Saved protected Location target; public GlobalDestination() {} diff --git a/src/main/java/org/dimdev/dimdoors/shared/rifts/destinations/LimboDestination.java b/src/main/java/org/dimdev/dimdoors/shared/rifts/destinations/LimboDestination.java index 679c6ac0..bcc42628 100644 --- a/src/main/java/org/dimdev/dimdoors/shared/rifts/destinations/LimboDestination.java +++ b/src/main/java/org/dimdev/dimdoors/shared/rifts/destinations/LimboDestination.java @@ -28,7 +28,7 @@ public class LimboDestination extends RiftDestination { @Override public boolean teleport(RotatedLocation loc, Entity entity) { - TeleportUtils.teleport(entity, WorldProviderLimbo.getLimboSkySpawn(entity)); // TODO: do we really want to spam Limbo with items? + TeleportUtils.teleport(entity, WorldProviderLimbo.getLimboSkySpawn(entity)); return false; } } diff --git a/src/main/java/org/dimdev/dimdoors/shared/rifts/destinations/PocketEntranceMarker.java b/src/main/java/org/dimdev/dimdoors/shared/rifts/destinations/PocketEntranceMarker.java index e1a78266..a295bb39 100644 --- a/src/main/java/org/dimdev/dimdoors/shared/rifts/destinations/PocketEntranceMarker.java +++ b/src/main/java/org/dimdev/dimdoors/shared/rifts/destinations/PocketEntranceMarker.java @@ -37,7 +37,7 @@ import org.dimdev.dimdoors.shared.rifts.RiftDestination; @Override public boolean teleport(RotatedLocation loc, Entity entity) { - if (entity instanceof EntityPlayer) DimDoors.chat(entity, "The entrance of this dungeon has not been converted. If this is a normally generated pocket, please report this bug."); + DimDoors.chat(entity, "The entrance of this dungeon has not been converted. If this is a normally generated pocket, please report this bug."); return false; } } diff --git a/src/main/java/org/dimdev/dimdoors/shared/rifts/destinations/PocketExitMarker.java b/src/main/java/org/dimdev/dimdoors/shared/rifts/destinations/PocketExitMarker.java index ab5d4bf1..8b932a5b 100644 --- a/src/main/java/org/dimdev/dimdoors/shared/rifts/destinations/PocketExitMarker.java +++ b/src/main/java/org/dimdev/dimdoors/shared/rifts/destinations/PocketExitMarker.java @@ -28,7 +28,7 @@ public class PocketExitMarker extends RiftDestination { @Override public boolean teleport(RotatedLocation loc, Entity entity) { - if (entity instanceof EntityPlayer) DimDoors.chat(entity, "The exit of this dungeon has not been linked. If this is a normally generated pocket, please report this bug."); + DimDoors.chat(entity, "The exit of this dungeon has not been linked. If this is a normally generated pocket, please report this bug."); return false; } } diff --git a/src/main/java/org/dimdev/dimdoors/shared/rifts/destinations/PrivatePocketExitDestination.java b/src/main/java/org/dimdev/dimdoors/shared/rifts/destinations/PrivatePocketExitDestination.java index c301cbb1..35c91039 100644 --- a/src/main/java/org/dimdev/dimdoors/shared/rifts/destinations/PrivatePocketExitDestination.java +++ b/src/main/java/org/dimdev/dimdoors/shared/rifts/destinations/PrivatePocketExitDestination.java @@ -46,9 +46,9 @@ public class PrivatePocketExitDestination extends RiftDestination { } if (destLoc == null || !(destLoc.getTileEntity() instanceof TileEntityRift)) { if (destLoc == null) { - DimDoors.sendMessage(entity, "You did not use a rift to enter this pocket so you ended up in limbo!"); + DimDoors.sendTranslatedMessage(entity, "rifts.destinations.private_pocket_exit.did_not_use_rift"); } else { - DimDoors.sendMessage(entity, "The rift you entered through no longer exists so you ended up in limbo!"); + DimDoors.sendTranslatedMessage(entity, "rifts.destinations.private_pocket_exit.rift_has_closed"); } TeleportUtils.teleport(entity, WorldProviderLimbo.getLimboSkySpawn(entity)); return false; diff --git a/src/main/java/org/dimdev/dimdoors/shared/rifts/registry/RiftRegistry.java b/src/main/java/org/dimdev/dimdoors/shared/rifts/registry/RiftRegistry.java index e1c558fc..bf855404 100644 --- a/src/main/java/org/dimdev/dimdoors/shared/rifts/registry/RiftRegistry.java +++ b/src/main/java/org/dimdev/dimdoors/shared/rifts/registry/RiftRegistry.java @@ -32,7 +32,7 @@ public class RiftRegistry extends WorldSavedData { // Caches to avoid looping through vertices to find specific vertices protected Map locationMap = new HashMap<>(); - protected Map pocketEntranceMap = new HashMap<>(); // TODO: We're going to want to move all pocket entrance info to the rift registry later to make PocketLib independent of DimDoors. + protected Map pocketEntranceMap = new HashMap<>(); protected Map uuidMap = new HashMap<>(); // These are stored in the main registry diff --git a/src/main/java/org/dimdev/dimdoors/shared/tileentities/TileEntityEntranceRift.java b/src/main/java/org/dimdev/dimdoors/shared/tileentities/TileEntityEntranceRift.java index 7404192f..51037d4f 100644 --- a/src/main/java/org/dimdev/dimdoors/shared/tileentities/TileEntityEntranceRift.java +++ b/src/main/java/org/dimdev/dimdoors/shared/tileentities/TileEntityEntranceRift.java @@ -74,9 +74,10 @@ import java.util.Random; if (relativeRotation) { TeleportUtils.teleport(entity, new Location(world, pos.offset(orientation, tpOffset)), orientation.getHorizontalAngle() + entity.rotationYaw - fromYaw, entity.rotationPitch - fromPitch); } else { - TeleportUtils.teleport(entity, new Location(world, pos.offset(orientation, tpOffset)), orientation.getHorizontalAngle(), 0); + teleportTo(entity); } } + @Override public void teleportTo(Entity entity) { TeleportUtils.teleport(entity, new Location(world, pos.offset(orientation, tpOffset)), orientation.getHorizontalAngle(), 0); diff --git a/src/main/java/org/dimdev/dimdoors/shared/tools/SchematicConverter.java b/src/main/java/org/dimdev/dimdoors/shared/tools/SchematicConverter.java index e4cb1745..a45a6e83 100644 --- a/src/main/java/org/dimdev/dimdoors/shared/tools/SchematicConverter.java +++ b/src/main/java/org/dimdev/dimdoors/shared/tools/SchematicConverter.java @@ -41,8 +41,9 @@ public final class SchematicConverter { private final static int POTION_ID = 373; private final static int WRITTEN_BOOK_ID = 387; - private final static int NBT_COMPOUND_TAG_ID = NBTUtils.getNBT_COMPOUND_TAG_ID(); - private final static int STRING_TAG_ID = NBTUtils.getSTRING_TAG_ID(); + private final static int NBT_COMPOUND_TAG_ID = NBTUtils.NBT_COMPOUND_TAG_ID; + private final static int STRING_TAG_ID = NBTUtils.NBT_COMPOUND_TAG_ID; + private static final boolean GENERATE_DUNGEON_INFO = false; public static Schematic convertSchematic(NBTTagCompound nbt, String schematicId, String name, String author) { Schematic schematic = new Schematic(); @@ -381,8 +382,10 @@ public final class SchematicConverter { } schematic.paletteMax = schematic.palette.size() - 1; - DimDoors.log.info(schematicId + "," + ironDimDoors + "," + warpDoors + "," + monoliths + "," + chests + "," - + dispensers + "," + allPistonBases + "," + tnt + "," + diamondBlocks + "," + goldBlocks + "," + ironBlocks); + if (GENERATE_DUNGEON_INFO) { + DimDoors.log.info(schematicId + "," + ironDimDoors + "," + warpDoors + "," + monoliths + "," + chests + "," + + dispensers + "," + allPistonBases + "," + tnt + "," + diamondBlocks + "," + goldBlocks + "," + ironBlocks); + } return schematic; } @@ -418,8 +421,6 @@ public final class SchematicConverter { if (location == null) { DimDoors.log.error("Resourcelocation of TileEntity with old ID: " + id + " was null. If you want to complain about log spam; " + (id.equals("Hopper") ? "it is very likely that it's FoamFix causing this. Please update it to at least version 0.9.0-1.12.2!" : "we have no idea what causes this, so please report it.")); location = translateIdCrude(id); - } else { - //DimDoors.log.info("Resourcelocation succesfully translated from old ID: " + oldID + " into: " + newID + "."); } return location.toString(); } diff --git a/src/main/java/org/dimdev/dimdoors/shared/world/gateways/BaseGateway.java b/src/main/java/org/dimdev/dimdoors/shared/world/gateways/BaseGateway.java index 08dac519..01d180db 100644 --- a/src/main/java/org/dimdev/dimdoors/shared/world/gateways/BaseGateway.java +++ b/src/main/java/org/dimdev/dimdoors/shared/world/gateways/BaseGateway.java @@ -5,19 +5,22 @@ import net.minecraft.world.World; import net.minecraft.world.biome.Biome; public abstract class BaseGateway { + public BaseGateway() {} /** * Generates the gateway centered on the given coordinates + * * @param world - the world in which to generate the gateway - * @param x - the x-coordinate at which to center the gateway; usually where the door is placed - * @param y - the y-coordinate of the block on which the gateway may be built - * @param z - the z-coordinate at which to center the gateway; usually where the door is placed + * @param x - the x-coordinate at which to center the gateway; usually where the door is placed + * @param y - the y-coordinate of the block on which the gateway may be built + * @param z - the z-coordinate at which to center the gateway; usually where the door is placed */ public abstract void generate(World world, int x, int y, int z); /** * Determines whether the specified biome is a valid biome in which to generate this gateway + * * @param biome - the biome to be checked * @return true true if the specified biome is a valid for generating this gateway, otherwise false */ @@ -36,19 +39,20 @@ public abstract class BaseGateway { /** * Determines whether the specified world and coordinates are a valid location for generating this gateway + * * @param world - the world in which to generate the gateway - * @param x - the x-coordinate at which to center the gateway; usually where the door is placed - * @param y - the y-coordinate of the block on which the gateway may be built - * @param z - the z-coordinate at which to center the gateway; usually where the door is placed + * @param x - the x-coordinate at which to center the gateway; usually where the door is placed + * @param y - the y-coordinate of the block on which the gateway may be built + * @param z - the z-coordinate at which to center the gateway; usually where the door is placed * @return true if the location is valid, otherwise false */ - public boolean isLocationValid(World world, int x, int y, int z) - { - return isBiomeValid(world.getBiome(new BlockPos(x,y,z))); + public boolean isLocationValid(World world, int x, int y, int z) { + return isBiomeValid(world.getBiome(new BlockPos(x, y, z))); } /** * Gets the lowercase keywords to be used in checking whether a given biome is a valid location for this gateway + * * @return an array of biome keywords to match against */ public Biome[] getBiomes() { diff --git a/src/main/java/org/dimdev/dimdoors/shared/world/gateways/DimensionFilter.java b/src/main/java/org/dimdev/dimdoors/shared/world/gateways/DimensionFilter.java deleted file mode 100644 index 7e9cdccb..00000000 --- a/src/main/java/org/dimdev/dimdoors/shared/world/gateways/DimensionFilter.java +++ /dev/null @@ -1,78 +0,0 @@ -package org.dimdev.dimdoors.shared.world.gateways; - -import com.google.common.collect.Range; -import com.google.common.collect.RangeSet; -import com.google.common.collect.TreeRangeSet; - -public class DimensionFilter { - - private final RangeSet blacklist; - - private DimensionFilter(RangeSet blacklist) { - this.blacklist = blacklist; - } - - public boolean isAccepted(int dimensionID) { - return !blacklist.contains(dimensionID); - } - - public boolean isRejected(int dimensionID) { - return blacklist.contains(dimensionID); - } - - private static RangeSet parseRangeSet(String[] list) { - int index; - int start; - int end; - String startPart; - String endPart; - RangeSet ranges = TreeRangeSet.create(); - - // Iterate over all the interval strings - for (String interval : list) { - if (interval == null) { - continue; - } - - // Strip out all whitespace characters - interval.replaceAll("\\s", ""); - if (interval.isEmpty()) { - continue; - } - // Check if the interval contains a minus sign after the first character - // That indicates that we're dealing with an interval and not a single number - if (interval.length() > 1) { - index = interval.indexOf("-", 1); - } else { - index = -1; - } - try { - if (index >= 0) { - // Parse this as a range with two values as endpoints - startPart = interval.substring(0, index); - endPart = interval.substring(index + 1); - start = Integer.parseInt(startPart); - end = Integer.parseInt(endPart); - } else { - // Parse this as a single value - start = Integer.parseInt(interval); - end = start; - } - // Add the interval to the set of intervals - ranges.add(Range.closed(start, end)); - } catch (Exception e) { - throw new IllegalArgumentException("\"" + interval + "\" is not a valid value or range for dimension IDs"); - } - } - - return ranges; - } - - public static DimensionFilter parseWhitelist(String[] list) { - return new DimensionFilter(parseRangeSet(list).complement()); - } - - public static DimensionFilter parseBlacklist(String[] list) { - return new DimensionFilter(parseRangeSet(list)); - } -} diff --git a/src/main/java/org/dimdev/dimdoors/shared/world/gateways/GatewayGenerator.java b/src/main/java/org/dimdev/dimdoors/shared/world/gateways/GatewayGenerator.java index ec0a7821..322a6822 100644 --- a/src/main/java/org/dimdev/dimdoors/shared/world/gateways/GatewayGenerator.java +++ b/src/main/java/org/dimdev/dimdoors/shared/world/gateways/GatewayGenerator.java @@ -1,8 +1,5 @@ package org.dimdev.dimdoors.shared.world.gateways; -import org.dimdev.dimdoors.shared.ModConfig; -import org.dimdev.dimdoors.shared.blocks.ModBlocks; -import org.dimdev.pocketlib.WorldProviderPocket; import net.minecraft.block.material.Material; import net.minecraft.init.Blocks; import net.minecraft.util.math.BlockPos; @@ -10,6 +7,9 @@ import net.minecraft.world.World; import net.minecraft.world.chunk.IChunkProvider; import net.minecraft.world.gen.IChunkGenerator; import net.minecraftforge.fml.common.IWorldGenerator; +import org.dimdev.dimdoors.shared.ModConfig; +import org.dimdev.dimdoors.shared.blocks.ModBlocks; +import org.dimdev.pocketlib.WorldProviderPocket; import java.util.ArrayList; import java.util.Arrays; @@ -23,7 +23,6 @@ public class GatewayGenerator implements IWorldGenerator { private static final int MIN_RIFT_Y = 4; private static final int MAX_RIFT_Y = 240; private static final int CHUNK_LENGTH = 16; - // private static final int GATEWAY_RADIUS = 4; // TODO: what did this do in the old mod? private static final int MAX_GATEWAY_GENERATION_ATTEMPTS = 10; private static final int NETHER_DIMENSION_ID = -1; private static final int END_DIMENSION_ID = 1; @@ -74,10 +73,10 @@ public class GatewayGenerator implements IWorldGenerator { //If the point is within the acceptable altitude range, the block above is empty, and we're //not building on bedrock, then generate a rift there if (y >= MIN_RIFT_Y && y <= MAX_RIFT_Y && world.isAirBlock(new BlockPos(x, y + 1, z)) - && world.getBlockState(new BlockPos(x, y, z)).getBlock() != Blocks.BEDROCK - && //<-- Stops Nether roof spawning. DO NOT REMOVE! - world.getBlockState(new BlockPos(x, y - 1, z)).getBlock() != Blocks.BEDROCK - && world.getBlockState(new BlockPos(x, y - 2, z)).getBlock() != Blocks.BEDROCK) { + && world.getBlockState(new BlockPos(x, y, z)).getBlock() != Blocks.BEDROCK + && //<-- Stops Nether roof spawning. DO NOT REMOVE! + world.getBlockState(new BlockPos(x, y - 1, z)).getBlock() != Blocks.BEDROCK + && world.getBlockState(new BlockPos(x, y - 2, z)).getBlock() != Blocks.BEDROCK) { //Create a link. If this is not the first time, create a child link and connect it to the first link. world.setBlockState(new BlockPos(x, y, z), ModBlocks.RIFT.getDefaultState()); } @@ -133,11 +132,10 @@ public class GatewayGenerator implements IWorldGenerator { //and the block two levels down is opaque and has a reasonable material. Plus that we're not building //on top of bedrock. return pos.getY() >= MIN_RIFT_Y && pos.getY() <= MAX_RIFT_Y - && world.isAirBlock(pos.up()) - && world.getBlockState(pos).getBlock() != Blocks.BEDROCK - && //<-- Stops Nether roof spawning. DO NOT REMOVE! - world.getBlockState(pos.down()) != Blocks.BEDROCK - && checkFoundationMaterial(world, pos.down()); + && world.isAirBlock(pos.up()) + && world.getBlockState(pos).getBlock() != Blocks.BEDROCK + && world.getBlockState(pos.down()) != Blocks.BEDROCK //<-- Stops Nether roof spawning. DO NOT REMOVE! + && checkFoundationMaterial(world, pos.down()); } private static boolean checkFoundationMaterial(World world, BlockPos pos) { @@ -146,6 +144,6 @@ public class GatewayGenerator implements IWorldGenerator { //We also want to avoid generating things on top of the Nether's bedrock! Material material = world.getBlockState(pos).getMaterial(); return material != Material.LEAVES && material != Material.WOOD && material != Material.GOURD - && world.isBlockNormalCube(pos, false) && world.getBlockState(pos).getBlock() != Blocks.BEDROCK; + && world.isBlockNormalCube(pos, false) && world.getBlockState(pos).getBlock() != Blocks.BEDROCK; } } diff --git a/src/main/java/org/dimdev/dimdoors/shared/world/gateways/GatewaySandstonePillars.java b/src/main/java/org/dimdev/dimdoors/shared/world/gateways/GatewaySandstonePillars.java index 1fd3bd6f..3f5b1027 100644 --- a/src/main/java/org/dimdev/dimdoors/shared/world/gateways/GatewaySandstonePillars.java +++ b/src/main/java/org/dimdev/dimdoors/shared/world/gateways/GatewaySandstonePillars.java @@ -5,7 +5,7 @@ import net.minecraft.world.biome.Biome; public class GatewaySandstonePillars extends BaseSchematicGateway { public GatewaySandstonePillars() { - super("sandstonePillars"); + super("sandstone_pillars"); } @Override diff --git a/src/main/java/org/dimdev/dimdoors/shared/world/gateways/GatewayTwoPillars.java b/src/main/java/org/dimdev/dimdoors/shared/world/gateways/GatewayTwoPillars.java index 47b4c45e..b8d2fdfb 100644 --- a/src/main/java/org/dimdev/dimdoors/shared/world/gateways/GatewayTwoPillars.java +++ b/src/main/java/org/dimdev/dimdoors/shared/world/gateways/GatewayTwoPillars.java @@ -9,7 +9,7 @@ public class GatewayTwoPillars extends BaseSchematicGateway { private static final int GATEWAY_RADIUS = 4; public GatewayTwoPillars() { - super("twoPillars"); + super("two_pillars"); } @Override diff --git a/src/main/java/org/dimdev/dimdoors/shared/world/limbo/LimboGenerator.java b/src/main/java/org/dimdev/dimdoors/shared/world/limbo/ChunkGeneratorLimbo.java similarity index 98% rename from src/main/java/org/dimdev/dimdoors/shared/world/limbo/LimboGenerator.java rename to src/main/java/org/dimdev/dimdoors/shared/world/limbo/ChunkGeneratorLimbo.java index 81ad8e64..47960478 100644 --- a/src/main/java/org/dimdev/dimdoors/shared/world/limbo/LimboGenerator.java +++ b/src/main/java/org/dimdev/dimdoors/shared/world/limbo/ChunkGeneratorLimbo.java @@ -16,7 +16,7 @@ import javax.annotation.Nullable; import java.util.List; import java.util.Random; -public class LimboGenerator implements IChunkGenerator { +public class ChunkGeneratorLimbo implements IChunkGenerator { private Random rand; @@ -37,7 +37,7 @@ public class LimboGenerator implements IChunkGenerator { double[] depthRegion; - public LimboGenerator(World world, long seed) { + public ChunkGeneratorLimbo(World world, long seed) { this.world = world; rand = new Random(seed); minLimitPerlinNoise = new NoiseGeneratorOctaves(rand, 16); //base terrain diff --git a/src/main/java/org/dimdev/dimdoors/shared/world/limbo/WorldProviderLimbo.java b/src/main/java/org/dimdev/dimdoors/shared/world/limbo/WorldProviderLimbo.java index 7dfe7170..3627b6ac 100644 --- a/src/main/java/org/dimdev/dimdoors/shared/world/limbo/WorldProviderLimbo.java +++ b/src/main/java/org/dimdev/dimdoors/shared/world/limbo/WorldProviderLimbo.java @@ -88,7 +88,7 @@ public class WorldProviderLimbo extends WorldProvider { @Override public IChunkGenerator createChunkGenerator() { - return new LimboGenerator(world, world.getSeed()); + return new ChunkGeneratorLimbo(world, world.getSeed()); } public static Location getLimboSkySpawn(Entity entity) { // TODO: move this somewhere else diff --git a/src/main/java/org/dimdev/dimdoors/shared/world/pocketdimension/BiomeBlank.java b/src/main/java/org/dimdev/dimdoors/shared/world/pocketdimension/BiomeBlank.java index a89af586..a0c2f67b 100644 --- a/src/main/java/org/dimdev/dimdoors/shared/world/pocketdimension/BiomeBlank.java +++ b/src/main/java/org/dimdev/dimdoors/shared/world/pocketdimension/BiomeBlank.java @@ -30,7 +30,6 @@ public class BiomeBlank extends Biome { spawnableCreatureList.clear(); spawnableWaterCreatureList.clear(); spawnableCaveCreatureList.clear(); - //if (monoliths) spawnableMonsterList.add(new SpawnListEntry(EntityMonolith.class, 100, 4, 4)); flowers.clear(); diff --git a/src/main/java/org/dimdev/pocketlib/Pocket.java b/src/main/java/org/dimdev/pocketlib/Pocket.java index 37a0bb73..68359b94 100644 --- a/src/main/java/org/dimdev/pocketlib/Pocket.java +++ b/src/main/java/org/dimdev/pocketlib/Pocket.java @@ -32,7 +32,7 @@ import org.dimdev.ddutils.nbt.NBTUtils; @Override public NBTTagCompound writeToNBT(NBTTagCompound nbt) { return NBTUtils.writeToNBT(this, nbt); } boolean isInBounds(BlockPos pos) { - // pocket bounds + // pockets bounds int gridSize = PocketRegistry.instance(dim).getGridSize(); int minX = x * gridSize; int minZ = z * gridSize; @@ -46,5 +46,5 @@ import org.dimdev.ddutils.nbt.NBTUtils; return new BlockPos(x * gridSize * 16, 0, z * gridSize * 16); } - // TODO: more pocket methods + // TODO: more pockets methods } diff --git a/src/main/java/org/dimdev/pocketlib/PocketRegistry.java b/src/main/java/org/dimdev/pocketlib/PocketRegistry.java index 3f979fe5..b3cd2f03 100644 --- a/src/main/java/org/dimdev/pocketlib/PocketRegistry.java +++ b/src/main/java/org/dimdev/pocketlib/PocketRegistry.java @@ -63,7 +63,7 @@ import org.dimdev.dimdoors.shared.ModConfig; } public void initNewRegistry() { - gridSize = ModConfig.pocket.pocketGridSize; + gridSize = ModConfig.pockets.pocketGridSize; nextID = 0; pockets = new HashMap<>(); @@ -75,7 +75,7 @@ import org.dimdev.dimdoors.shared.ModConfig; /** * Create a new blank pocket. * - * @return The newly created pocket + * @return The newly created pockets */ public Pocket newPocket() { Pocket pocket = null; @@ -84,7 +84,7 @@ import org.dimdev.dimdoors.shared.ModConfig; } /** - * Create a new pocket with a specific ID. + * Create a new pockets with a specific ID. * * @return The newly created Pocket, or null if that ID is already taken. */ diff --git a/src/main/java/org/dimdev/pocketlib/VirtualLocation.java b/src/main/java/org/dimdev/pocketlib/VirtualLocation.java index 2b2fc147..b537844d 100644 --- a/src/main/java/org/dimdev/pocketlib/VirtualLocation.java +++ b/src/main/java/org/dimdev/pocketlib/VirtualLocation.java @@ -26,12 +26,12 @@ import org.dimdev.dimdoors.shared.world.limbo.WorldProviderLimbo; if (location.getWorld().provider instanceof WorldProviderPocket) { Pocket pocket = PocketRegistry.instance(location.getDim()).getPocketAt(location.getPos()); if (pocket != null) { - virtualLocation = pocket.getVirtualLocation(); // TODO: pocket-relative coordinates + virtualLocation = pocket.getVirtualLocation(); // TODO: pockets-relative coordinates } else { - virtualLocation = null; // TODO: door was placed in a pocket dim but outside of a pocket... + virtualLocation = null; // TODO: door was placed in a pockets dim but outside of a pockets... } } else if (location.getWorld().provider instanceof WorldProviderLimbo) { // TODO: convert to interface on worldprovider - virtualLocation = new VirtualLocation(location.getDim(), location.getX(), location.getZ(), ModConfig.dungeon.maxDungeonDepth); + virtualLocation = new VirtualLocation(location.getDim(), location.getX(), location.getZ(), ModConfig.dungeons.maxDungeonDepth); } // TODO: nether coordinate transform if (virtualLocation == null) { virtualLocation = new VirtualLocation(0, location.getX(), location.getZ(), 5); // TODO diff --git a/src/main/java/org/dimdev/pocketlib/WorldProviderPocket.java b/src/main/java/org/dimdev/pocketlib/WorldProviderPocket.java index 5d7b5ad8..bd7bbb4d 100644 --- a/src/main/java/org/dimdev/pocketlib/WorldProviderPocket.java +++ b/src/main/java/org/dimdev/pocketlib/WorldProviderPocket.java @@ -1,13 +1,15 @@ package org.dimdev.pocketlib; -import org.dimdev.dimdoors.DimDoors; -import org.dimdev.ddutils.render.CloudRenderBlank; import net.minecraft.entity.Entity; +import net.minecraft.init.Biomes; import net.minecraft.util.math.Vec3d; import net.minecraft.world.WorldProvider; +import net.minecraft.world.biome.BiomeProviderSingle; import net.minecraft.world.gen.IChunkGenerator; import net.minecraftforge.fml.relauncher.Side; import net.minecraftforge.fml.relauncher.SideOnly; +import org.dimdev.ddutils.render.CloudRenderBlank; +import org.dimdev.dimdoors.DimDoors; import javax.annotation.Nullable; @@ -18,6 +20,7 @@ public abstract class WorldProviderPocket extends WorldProvider { hasSkyLight = true; generateLightBrightnessTable(); DimDoors.proxy.setCloudRenderer(this, new CloudRenderBlank()); + biomeProvider = new BiomeProviderSingle(Biomes.PLAINS); } @Override diff --git a/src/main/resources/assets/dimdoors/gateways/sandstonePillars.schematic b/src/main/resources/assets/dimdoors/gateways/sandstone_pillars.schematic similarity index 100% rename from src/main/resources/assets/dimdoors/gateways/sandstonePillars.schematic rename to src/main/resources/assets/dimdoors/gateways/sandstone_pillars.schematic diff --git a/src/main/resources/assets/dimdoors/gateways/twoPillars.schematic b/src/main/resources/assets/dimdoors/gateways/two_pillars.schematic similarity index 100% rename from src/main/resources/assets/dimdoors/gateways/twoPillars.schematic rename to src/main/resources/assets/dimdoors/gateways/two_pillars.schematic diff --git a/src/main/resources/assets/dimdoors/lang/en_GB.lang b/src/main/resources/assets/dimdoors/lang/en_GB.lang deleted file mode 100644 index 676075f4..00000000 --- a/src/main/resources/assets/dimdoors/lang/en_GB.lang +++ /dev/null @@ -1,29 +0,0 @@ -tile.fabric.orange.name=Orange Coloured Fabric -tile.fabric.magenta.name=Magenta Coloured Fabric -tile.fabric.lightBlue.name=Light Blue Coloured Fabric -tile.fabric.yellow.name=Yellow Coloured Fabric -tile.fabric.lime.name=Lime Coloured Fabric -tile.fabric.pink.name=Pink Coloured Fabric -tile.fabric.gray.name=Gray Coloured Fabric -tile.fabric.silver.name=Light Grey Coloured Fabric -tile.fabric.cyan.name=Cyan Coloured Fabric -tile.fabric.purple.name=Purple Coloured Fabric -tile.fabric.blue.name=Blue Coloured Fabric -tile.fabric.brown.name=Brown Coloured Fabric -tile.fabric.green.name=Green Coloured Fabric -tile.fabric.red.name=Red Coloured Fabric - -tile.ancient_fabric.orange.name=Orange Coloured Ancient Fabric -tile.ancient_fabric.magenta.name=Magenta Coloured Ancient Fabric -tile.ancient_fabric.lightBlue.name=Light Blue Coloured Ancient Fabric -tile.ancient_fabric.yellow.name=Yellow Coloured Ancient Fabric -tile.ancient_fabric.lime.name=Lime Coloured Ancient Fabric -tile.ancient_fabric.pink.name=Pink Coloured Ancient Fabric -tile.ancient_fabric.gray.name=Gray Coloured Ancient Fabric -tile.ancient_fabric.silver.name=Light Grey Coloured Ancient Fabric -tile.ancient_fabric.cyan.name=Cyan Coloured Ancient Fabric -tile.ancient_fabric.purple.name=Purple Coloured Ancient Fabric -tile.ancient_fabric.blue.name=Blue Coloured Ancient Fabric -tile.ancient_fabric.brown.name=Brown Coloured Ancient Fabric -tile.ancient_fabric.green.name=Green Coloured Ancient Fabric -tile.ancient_fabric.red.name=Red Coloured Ancient Fabric \ No newline at end of file diff --git a/src/main/resources/assets/dimdoors/lang/en_US.lang b/src/main/resources/assets/dimdoors/lang/en_US.lang index aa4b6a4c..639f74b3 100644 --- a/src/main/resources/assets/dimdoors/lang/en_US.lang +++ b/src/main/resources/assets/dimdoors/lang/en_US.lang @@ -12,37 +12,37 @@ tile.dimensional_trapdoor.name=Transdimensional Trapdoor tile.dimensional_portal.name=Transient Portal tile.fabric.white.name=Altered Fabric -tile.fabric.orange.name=Orange Colored Fabric -tile.fabric.magenta.name=Magenta Colored Fabric -tile.fabric.lightBlue.name=Light Blue Colored Fabric -tile.fabric.yellow.name=Yellow Colored Fabric -tile.fabric.lime.name=Lime Colored Fabric -tile.fabric.pink.name=Pink Colored Fabric -tile.fabric.gray.name=Gray Colored Fabric -tile.fabric.silver.name=Light Grey Colored Fabric -tile.fabric.cyan.name=Cyan Colored Fabric -tile.fabric.purple.name=Purple Colored Fabric -tile.fabric.blue.name=Blue Colored Fabric -tile.fabric.brown.name=Brown Colored Fabric -tile.fabric.green.name=Green Colored Fabric -tile.fabric.red.name=Red Colored Fabric +tile.fabric.orange.name=Orange Altered Fabric +tile.fabric.magenta.name=Magenta Altered Fabric +tile.fabric.lightBlue.name=Light Blue Altered Fabric +tile.fabric.yellow.name=Yellow Altered Fabric +tile.fabric.lime.name=Lime Altered Fabric +tile.fabric.pink.name=Pink Altered Fabric +tile.fabric.gray.name=Gray Altered Fabric +tile.fabric.silver.name=Light Grey Altered Fabric +tile.fabric.cyan.name=Cyan Altered Fabric +tile.fabric.purple.name=Purple Altered Fabric +tile.fabric.blue.name=Blue Altered Fabric +tile.fabric.brown.name=Brown Altered Fabric +tile.fabric.green.name=Green Altered Fabric +tile.fabric.red.name=Red Altered Fabric tile.fabric.black.name=Fabric of Reality tile.ancient_fabric.white.name=Ancient Altered Fabric -tile.ancient_fabric.orange.name=Orange Colored Ancient Fabric -tile.ancient_fabric.magenta.name=Magenta Colored Ancient Fabric -tile.ancient_fabric.lightBlue.name=Light Blue Colored Ancient Fabric -tile.ancient_fabric.yellow.name=Yellow Colored Ancient Fabric -tile.ancient_fabric.lime.name=Lime Colored Ancient Fabric -tile.ancient_fabric.pink.name=Pink Colored Ancient Fabric -tile.ancient_fabric.gray.name=Gray Colored Ancient Fabric -tile.ancient_fabric.silver.name=Light Grey Colored Ancient Fabric -tile.ancient_fabric.cyan.name=Cyan Colored Ancient Fabric -tile.ancient_fabric.purple.name=Purple Colored Ancient Fabric -tile.ancient_fabric.blue.name=Blue Colored Ancient Fabric -tile.ancient_fabric.brown.name=Brown Colored Ancient Fabric -tile.ancient_fabric.green.name=Green Colored Ancient Fabric -tile.ancient_fabric.red.name=Red Colored Ancient Fabric +tile.ancient_fabric.orange.name=Orange Altered Ancient Fabric +tile.ancient_fabric.magenta.name=Magenta Altered Ancient Fabric +tile.ancient_fabric.lightBlue.name=Light Blue Altered Ancient Fabric +tile.ancient_fabric.yellow.name=Yellow Altered Ancient Fabric +tile.ancient_fabric.lime.name=Lime Altered Ancient Fabric +tile.ancient_fabric.pink.name=Pink Altered Ancient Fabric +tile.ancient_fabric.gray.name=Gray Altered Ancient Fabric +tile.ancient_fabric.silver.name=Light Grey Altered Ancient Fabric +tile.ancient_fabric.cyan.name=Cyan Altered Ancient Fabric +tile.ancient_fabric.purple.name=Purple Altered Ancient Fabric +tile.ancient_fabric.blue.name=Blue Altered Ancient Fabric +tile.ancient_fabric.brown.name=Brown Altered Ancient Fabric +tile.ancient_fabric.green.name=Green Altered Ancient Fabric +tile.ancient_fabric.red.name=Red Altered Ancient Fabric tile.ancient_fabric.black.name=Ancient Fabric tile.eternal_fabric.name=Eternal Fabric @@ -60,9 +60,14 @@ item.warp_dimensional_door.name=Warp Door item.rift_key=Rift Key item.rift_signature.name=Rift Signature +item.rift_signature.stored=Location stored +item.rift_signature.created=Rift created item.stabilized_rift_signature.name=Stabilized Rift Signature +item.stabilized_rift_signature.stored=Location stored +item.stabilized_rift_signature.created=Rift created item.rift_configuration_tool.name=Rift Configuration Tool item.rift_remover.name=Rift Remover +item.rift_remover.removed=Rift Removed item.rift_blade.name=Rift Blade item.world_thread.name=World Thread @@ -113,3 +118,39 @@ info.warp_dimensional_door2=or place anywhere in a info.warp_dimensional_door3=pocket dimension to exit. entity.dimdoors.monolith.name=Monolith + +commands.dimteleport.usage=/dimteleport [yaw] [pitch] +commands.fabricconvert.usage=/fabricconvert +commands.fabricconvert.success=All fabric of reality has been converted to black. +commands.pocket.usage=/pocket [setup] +commands.pocket.groupnotfound=Group %s not found +commands.pocket.templatenotfound=Template %s not found +commands.saveschem.usage=/saveschem +commands.saveshcem.success=Pocket %s has been successfully saved +commands.generic.dimdoors.not_in_pocket_dim=You must be in a pocket dimension to use this command. +commands.generic.dimdoors.not_in_pocket=You must be in a pocket to use this command. + +rifts.unlinked=This rift has no destinations +rifts.destinations.escape.cannot_escape_limbo=Nice try, but you'll need to either die or find some eternal fabric to get out of Limbo. +rifts.destinations.escape.not_in_pocket_dim=You can't escape from a non-pocket dimension! +rifts.destinations.escape.did_not_use_rift=You didn't use a rift to enter and you ended up in Limbo! +rifts.destinations.escape.rift_has_closed=The rift you used to enter has closed and you ended up in Limbo! +rifts.destinations.private_pocket_exit.did_not_use_rift=You didn't use a rift to enter and you ended up in Limbo! +rifts.destinations.private_pocket_exit.rift_has_closed=The rift you used to enter has closed and you ended up in Limbo! + +dimdoors.general=General Options +dimdoors.general.tooltip=General configuration options for the mod. +dimdoors.general.baseDimensionID=Base Dimension ID +dimdoors.general.baseDimensionID.tooltip=Dimension ID of the first Dimensional Doors dimension. Other dimensions will use consecutive IDs. It is strongly recommended to leave this to the default value. +dimdoors.general.useStatusBar.name=Status Bar Messages +dimdoors.general.useStatusBar.comment=Use the status bar to send status messages rather than the chat. +dimdoors.pockets=Pocket Options +dimdoors.pockets.tooltip=Options that determine the spacing and maximum size of pockets in the pocket world. +dimdoors.world=Worldgen Options +dimdoors.world.tooltip=Options that determine where gateways and rift clusters can be generated and at what frequency. +dimdoors.dungeons=Dungeons Options +dimdoors.dungeons.tooltip=Options that affect the generation of pocket dungeons. +dimdoors.monoliths=Monolith Options +dimdoors.monoliths.tooltip=Options that determine how dangerous monoliths are. +dimdoors.limbo=Limbo Options +dimdoors.limbo.tooltip=Options that control various aspects of the Limbo dimension. diff --git a/src/main/resources/assets/dimdoors/lang/fr_CA.lang b/src/main/resources/assets/dimdoors/lang/fr_CA.lang index 79cc5388..3bb1f3cb 100644 --- a/src/main/resources/assets/dimdoors/lang/fr_CA.lang +++ b/src/main/resources/assets/dimdoors/lang/fr_CA.lang @@ -16,12 +16,12 @@ tile.fabric.white.name=Étoffe altérée tile.fabric.orange.name=Étoffe altérée orange tile.fabric.magenta.name=Étoffe altérée magenta -tile.fabric.lightBlue.name=Étoffe altérée bleue pale +tile.fabric.lightBlue.name=Étoffe altérée bleu pâle tile.fabric.yellow.name=Étoffe altérée jaune tile.fabric.lime.name=Étoffe altérée lime tile.fabric.pink.name=Étoffe altérée rose tile.fabric.gray.name=Étoffe altérée grise -tile.fabric.silver.name=Étoffe altérée argentée +tile.fabric.silver.name=Étoffe altérée gris pâle tile.fabric.cyan.name=Étoffe altérée cyan tile.fabric.purple.name=Étoffe altérée mauve tile.fabric.blue.name=Étoffe altérée bleue diff --git a/src/main/resources/assets/dimdoors/lang/ro_RO.lang b/src/main/resources/assets/dimdoors/lang/ro_RO.lang index ced6d796..603df335 100644 --- a/src/main/resources/assets/dimdoors/lang/ro_RO.lang +++ b/src/main/resources/assets/dimdoors/lang/ro_RO.lang @@ -21,7 +21,7 @@ tile.fabric.yellow.name=Țesut alterat galben tile.fabric.lime.name=Țesut alterat lima tile.fabric.pink.name=Țesut alterat roz tile.fabric.gray.name=Țesut alterat gri -tile.fabric.silver.name=Țesut alterat argintiu +tile.fabric.silver.name=Țesut alterat gri deschis tile.fabric.cyan.name=Țesut alterat cyan tile.fabric.purple.name=Țesut alterat mov tile.fabric.blue.name=Țesut alterat albastru