Localization, use CommandExceptions, and other improvements

This commit is contained in:
Runemoro 2018-01-24 03:04:15 -05:00
parent df135438a2
commit ed8f57e0d9
44 changed files with 302 additions and 477 deletions

View file

@ -9,8 +9,8 @@ import org.dimdev.ddutils.StringUtils;
public final class NBTUtils { public final class NBTUtils {
@Getter private final static int NBT_COMPOUND_TAG_ID = StringUtils.simpleSearch(NBTTagCompound.NBT_TYPES, "COMPOUND"); public 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 STRING_TAG_ID = StringUtils.simpleSearch(NBTTagCompound.NBT_TYPES, "STRING");
//Arrays.binarySearch(NBTTagCompound.NBT_TYPES, "COMPOUND", new StringComparator()); does not seem to work?; //Arrays.binarySearch(NBTTagCompound.NBT_TYPES, "COMPOUND", new StringComparator()); does not seem to work?;
//netiher does Arrays.binarySearch(NBTTagCompound.NBT_TYPES, "COMPOUND", String::compareTo); //netiher does Arrays.binarySearch(NBTTagCompound.NBT_TYPES, "COMPOUND", String::compareTo);

View file

@ -1,6 +1,7 @@
package org.dimdev.dimdoors; package org.dimdev.dimdoors;
import net.minecraft.entity.player.EntityPlayerMP; import net.minecraft.entity.player.EntityPlayerMP;
import net.minecraft.util.text.TextComponentTranslation;
import org.dimdev.dimdoors.shared.ModConfig; import org.dimdev.dimdoors.shared.ModConfig;
import org.dimdev.dimdoors.shared.commands.CommandFabricConvert; import org.dimdev.dimdoors.shared.commands.CommandFabricConvert;
import org.dimdev.dimdoors.shared.commands.CommandPocket; import org.dimdev.dimdoors.shared.commands.CommandPocket;
@ -13,7 +14,6 @@ import lombok.Getter;
import net.minecraft.creativetab.CreativeTabs; import net.minecraft.creativetab.CreativeTabs;
import net.minecraft.entity.Entity; import net.minecraft.entity.Entity;
import net.minecraft.item.ItemStack; import net.minecraft.item.ItemStack;
import net.minecraft.util.text.TextComponentString;
import net.minecraftforge.fml.common.Mod; import net.minecraftforge.fml.common.Mod;
import net.minecraftforge.fml.common.SidedProxy; import net.minecraftforge.fml.common.SidedProxy;
import net.minecraftforge.fml.common.event.*; import net.minecraftforge.fml.common.event.*;
@ -85,16 +85,16 @@ public class DimDoors {
event.registerServerCommand(new CommandFabricConvert()); 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) { if (ModConfig.general.useStatusBar && entity instanceof EntityPlayerMP) {
EntityPlayerMP player = (EntityPlayerMP) entity; EntityPlayerMP player = (EntityPlayerMP) entity;
player.sendStatusMessage(new TextComponentString(text), true); player.sendStatusMessage(new TextComponentTranslation(text, translationArgs), true);
} else { } else {
chat(entity, text); chat(entity, text, translationArgs);
} }
} }
public static void chat(Entity entity, String text) { public static void chat(Entity entity, String text, Object... translationArgs) {
entity.sendMessage(new TextComponentString("[DimDoors] " + text)); entity.sendMessage(new TextComponentTranslation(text, translationArgs));
} }
} }

View file

@ -122,6 +122,5 @@ public class RenderMonolith extends RenderLiving<EntityMonolith> {
@Override @Override
protected ResourceLocation getEntityTexture(EntityMonolith monolith) { protected ResourceLocation getEntityTexture(EntityMonolith monolith) {
return monolith_textures.get(monolith.getTextureState()); return monolith_textures.get(monolith.getTextureState());
//return new ResourceLocation(DimDoors.MODID + ":textures/mobs/monolith/monolith" + monolith.getTextureState() + ".png");
} }
} }

View file

@ -35,7 +35,7 @@ public abstract class CommonProxy {
registerTileEntities(); registerTileEntities();
ModDimensions.registerDimensions(); 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); EntityRegistry.registerEgg(new ResourceLocation(DimDoors.MODID, "mob_monolith"), 0, 0xffffff);
registerRiftDestinations(); registerRiftDestinations();
} }

View file

@ -9,38 +9,26 @@ import org.dimdev.dimdoors.DimDoors;
import static net.minecraftforge.common.config.Config.*; 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) @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(); public static General general = new General();
@Comment({"Pocket Config Options", public static Pocket pockets = new Pocket();
"The following values determine the maximum sizes of different kinds of pockets. These values will only influence new worlds."}) public static World world = new World();
public static Pocket pocket = new Pocket(); public static Dungeons dungeons = new Dungeons();
@Comment("World Generation Config Options") public static Monoliths monoliths = new Monoliths();
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 Limbo limbo = new Limbo(); public static Limbo limbo = new Limbo();
public static class General { public static class General {
@Name("Base Dimension ID") @Name("Base Dimension ID")
@Comment({"Dimension ID of the first Dimensional Doors dimension. Other dimensions will use consecutive IDs.", @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.", "It strongly recommendended to leave this to the default value."})
"Default: 684"}) @RequiresWorldRestart
public int baseDimensionID = 684; public int baseDimensionID = 684;
@Name("Status Bar Messages instead of Chat") @Name("Status Bar Messages")
@Comment({"This gives clients the options to either send messages", @Comment("Use the status bar to send status messages rather than the chat.")
"through the status bar (true) or through chat (false).",
"Default: true"})
public boolean useStatusBar = true; public boolean useStatusBar = true;
@Name("Players Close Doors Behind Them") @Name("Players Close Doors Behind Them")
@ -52,40 +40,35 @@ public final class ModConfig {
public static class Pocket { public static class Pocket {
@Name("Pocket Grid Size") @Name("Pocket Grid Size")
@Comment({"Sets how many chunks apart all pockets in pocket dimensions should be placed.", @Comment("Sets how many chunks apart all pockets in pocket dimensions should be placed.")
"Default: 32"}) @RangeInt(min=4)
@RangeInt(min=4, max=32)
public int pocketGridSize = 32; public int pocketGridSize = 32;
@Name("Max Pocket Size") @Name("Max Pocket Size")
@Comment({"Sets how large a pocket can be.", @Comment("Sets how large a pocket can be.")
"Default: 15 [Minimum = 0] [Maximum = Pocket Grid Size / 2"}) @RangeInt(min=0)
public int maxPocketSize = 15; public int maxPocketSize = 15;
@Name("Private Pocket Size") @Name("Private Pocket Size")
@Comment({"Sets how large a personal pocket is when initially created.", @Comment("Sets how large a personal pocket is when initially created.")
"Default: 2"})
@RangeInt(min = 0, max = 7) @RangeInt(min = 0, max = 7)
public int initialPrivatePocketSize = 2; public int initialPrivatePocketSize = 2;
@Name("Public Pocket Size") @Name("Public Pocket Size")
@Comment({"Sets how deep a public pocket created in the overworld will be on average.", @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.", "Pockets created at a deeper depth will have larger sizes."})
"Default: 1"})
public int basePublicPocketSize = 1; public int basePublicPocketSize = 1;
@Name("Load All Schematics") @Name("Load All Schematics")
@Comment({"Forces all available pocket schematics to load on game-start even if the configured maximum sizes mean that these", @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,", "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.", "because the /pocket command can be used to force generate these pockets."})
"Default: false"})
public boolean loadAllSchematics = true; public boolean loadAllSchematics = true;
} }
public static class WorldGen { public static class World {
@Name("Rift Cluster Generation Chance") @Name("Rift Cluster Generation Chance")
@Comment({"Sets the chance (out of 1.0) that a cluster of rifts will generate in a given chunk.", @Comment("Sets the chance (out of 1.0) that a cluster of rifts will generate in a given chunk.")
"Default: 0.0002"})
@RangeDouble(min=0, max=1) @RangeDouble(min=0, max=1)
public double clusterGenerationChance = 0.0002; public double clusterGenerationChance = 0.0002;
@ -95,8 +78,7 @@ public final class ModConfig {
public int[] riftClusterDimensionTypeBlacklist = {}; public int[] riftClusterDimensionTypeBlacklist = {};
@Name("Gateway Generation Chance") @Name("Gateway Generation Chance")
@Comment({"Sets the chance (out of 1.0) that a Rift Gateway will generate in a given chunk.", @Comment("Sets the chance (out of 1.0) that a Rift Gateway will generate in a given chunk.")
"Default: 0.0015"})
@RangeDouble(min=0, max=1) @RangeDouble(min=0, max=1)
public double gatewayGenerationChance = 0.0015; public double gatewayGenerationChance = 0.0015;
@ -115,13 +97,11 @@ public final class ModConfig {
public static class Monoliths { public static class Monoliths {
@Name("Dangerous Monoliths") @Name("Dangerous Monoliths")
@Comment({"Are Monoliths in Limbo Dangerous?", @Comment("Are Monoliths in Limbo Dangerous?")
"Default: false"})
public boolean dangerousLimboMonolithsEnabled = false; public boolean dangerousLimboMonolithsEnabled = false;
@Name("Monolith Teleportation") @Name("Monolith Teleportation")
@Comment({"Is Monolith Teleportation enabled?", @Comment("Is Monolith Teleportation enabled?")
"Default: true"})
public boolean monolithTeleportationEnabled = true; public boolean monolithTeleportationEnabled = true;
} }
@ -129,17 +109,13 @@ public final class ModConfig {
@Name("Universal Limbo") @Name("Universal Limbo")
@Comment({"Sets whether players are teleported to Limbo when they die in any dimension (except 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", "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.", "affect deaths in Limbo, which can be set with the Hardcore Limbo option."})
"Default: false"})
public boolean universalLimboEnabled = false; public boolean universalLimboEnabled = false;
@Name("Hardcore Limbo") @Name("Hardcore Limbo")
@Comment({"Whether a player dying in limbo should respawn in limbo, making eternal fluid or gold dimensional doors", @Comment({"Whether a player dying in limbo should respawn in limbo, making eternal fluid or gold dimensional doors",
"the only way to get out", "the only way to get out"})
"Default: false"})
public boolean hardcoreLimboEnabled = false; public boolean hardcoreLimboEnabled = false;
} }
@SubscribeEvent @SubscribeEvent

View file

@ -1,34 +1,25 @@
package org.dimdev.dimdoors.shared.commands; 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.CommandBase;
import net.minecraft.command.CommandException; import net.minecraft.command.CommandException;
import net.minecraft.command.ICommandSender; import net.minecraft.command.ICommandSender;
import net.minecraft.command.WrongUsageException;
import net.minecraft.entity.Entity; import net.minecraft.entity.Entity;
import net.minecraft.entity.player.EntityPlayerMP;
import net.minecraft.server.MinecraftServer; import net.minecraft.server.MinecraftServer;
import net.minecraft.util.math.BlockPos; import net.minecraft.util.math.BlockPos;
import net.minecraft.util.text.TextComponentString; import net.minecraft.util.math.Vec3d;
import net.minecraftforge.common.DimensionManager; 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<String> aliases; public class CommandDimTeleport extends CommandBase {
public CommandDimTeleport() {
aliases = new ArrayList<>();
aliases.add("dimteleport");
aliases.add("dteleport");
aliases.add("dtp");
}
@Override @Override
public String getName() { public String getName() {
@ -37,55 +28,45 @@ public class CommandDimTeleport extends CommandBase { // TODO: localization, Com
@Override @Override
public String getUsage(ICommandSender sender) { public String getUsage(ICommandSender sender) {
return "dimteleport <dimension> <x> <y> <z> [yaw] [pitch]"; return "commands.dimteleport.usage";
} }
@Override @Override
public List<String> getAliases() { public List<String> getAliases() {
return aliases; return Arrays.asList("dteleport", "dtp");
} }
@Override @Override
public void execute(MinecraftServer server, ICommandSender sender, String[] args) throws CommandException { public void execute(MinecraftServer server, ICommandSender sender, String[] args) throws CommandException {
EntityPlayerMP player = getCommandSenderAsPlayer(sender);
// Check that the number of arguments is correct // Check that the number of arguments is correct
if (args.length < 4 || args.length > 6) { if (args.length < 4 || args.length > 6) {
sender.sendMessage(new TextComponentString("[DimDoors] Usage: /" + getUsage(sender))); throw new WrongUsageException("commands.dimteleport.usage");
return;
} }
// Parse arguments int dimension = parseInt(args[0]);
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;
}
// Teleport if it's a player Vec3d senderPos = sender.getPositionVector();
if (sender instanceof Entity) { CoordinateArg x = parseCoordinate(senderPos.x, args[1], true);
TeleportUtils.teleport((Entity) sender, new Location(dimension, new BlockPos(x, y, z)), yaw, pitch); CoordinateArg y = parseCoordinate(senderPos.y, args[2], false);
} else { CoordinateArg z = parseCoordinate(senderPos.z, args[3], true);
DimDoors.log.info("Not executing command /" + getName() + " because it wasn't sent by a player.");
} 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 @Override
public List<String> getTabCompletions(MinecraftServer server, ICommandSender sender, String[] args, @Nullable BlockPos targetPos) { public List<String> getTabCompletions(MinecraftServer server, ICommandSender sender, String[] args, @Nullable BlockPos targetPos) {
if (args.length == 1) { if (args.length == 1) {
return Arrays.stream(DimensionManager.getIDs()) return Arrays.stream(DimensionManager.getStaticDimensionIDs())
.map(Object::toString) .map(Object::toString)
.filter(s -> s.toLowerCase().startsWith(args[0].toLowerCase())) .filter(s -> s.toLowerCase().startsWith(args[0].toLowerCase()))
.collect(Collectors.toList()); .collect(Collectors.toList());
} else { } else {
return new ArrayList<>(); return args.length > 1 && args.length <= 4 ? getTabCompletionCoordinate(args, 1, targetPos) : Collections.emptyList();
} }
} }
} }

View file

@ -8,22 +8,12 @@ import net.minecraft.entity.player.EntityPlayerMP;
import net.minecraft.item.EnumDyeColor; import net.minecraft.item.EnumDyeColor;
import net.minecraft.server.MinecraftServer; import net.minecraft.server.MinecraftServer;
import net.minecraft.util.math.BlockPos; import net.minecraft.util.math.BlockPos;
import org.dimdev.dimdoors.DimDoors;
import org.dimdev.dimdoors.shared.blocks.BlockFabric; import org.dimdev.dimdoors.shared.blocks.BlockFabric;
import org.dimdev.pocketlib.WorldProviderPocket;
import org.dimdev.pocketlib.Pocket; import org.dimdev.pocketlib.Pocket;
import org.dimdev.pocketlib.PocketRegistry; import org.dimdev.pocketlib.PocketRegistry;
import org.dimdev.pocketlib.WorldProviderPocket;
import java.util.ArrayList;
import java.util.List;
public class CommandFabricConvert extends CommandBase { public class CommandFabricConvert extends CommandBase {
private final List<String> aliases;
public CommandFabricConvert() {
aliases = new ArrayList<>();
aliases.add("fabricconvert");
}
@Override @Override
public String getName() { public String getName() {
@ -32,45 +22,32 @@ public class CommandFabricConvert extends CommandBase {
@Override @Override
public String getUsage(ICommandSender sender) { public String getUsage(ICommandSender sender) {
return "fabricconvert"; return "commands.fabricconvert.usage";
}
@Override
public List<String> getAliases() {
return aliases;
} }
@Override @Override
public void execute(MinecraftServer server, ICommandSender sender, String[] args) throws CommandException { public void execute(MinecraftServer server, ICommandSender sender, String[] args) throws CommandException {
// Execute only if it's a player EntityPlayerMP player = getCommandSenderAsPlayer(sender);
if (sender instanceof EntityPlayerMP) {
EntityPlayerMP player = getCommandSenderAsPlayer(sender);
if (!(player.world.provider instanceof WorldProviderPocket)) { if (!(player.world.provider instanceof WorldProviderPocket)) throw new CommandException("commands.generic.dimdoors.not_in_pocket");
DimDoors.chat(player, "Current Dimension isn't a pocket dimension"); Pocket pocket = PocketRegistry.instance(player.dimension).getPocketAt(player.getPosition());
return; 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(); for (int x = 0; x < size; x++) {
int size = (pocket.getSize() + 1) * 16 - 1; 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++) { if (state.getBlock() instanceof BlockFabric) {
for (int y = 0; y < size; y++) { player.world.setBlockState(origin, state.withProperty(BlockFabric.COLOR, EnumDyeColor.BLACK));
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));
}
} }
} }
} }
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");
} }
} }

View file

@ -1,20 +1,21 @@
package org.dimdev.dimdoors.shared.commands; 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.CommandBase;
import net.minecraft.command.CommandException; import net.minecraft.command.CommandException;
import net.minecraft.command.ICommandSender; import net.minecraft.command.ICommandSender;
import net.minecraft.command.WrongUsageException;
import net.minecraft.entity.player.EntityPlayerMP; import net.minecraft.entity.player.EntityPlayerMP;
import net.minecraft.server.MinecraftServer; import net.minecraft.server.MinecraftServer;
import net.minecraft.util.math.BlockPos; 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 org.dimdev.pocketlib.Pocket;
import javax.annotation.Nullable; import javax.annotation.Nullable;
@ -24,84 +25,53 @@ import java.util.stream.Collectors;
public class CommandPocket extends CommandBase { public class CommandPocket extends CommandBase {
private final List<String> aliases;
public CommandPocket() {
aliases = new ArrayList<>();
aliases.add("pocket");
}
@Override @Override
public String getName() { public String getName() {
return "pocket"; return "pockets";
} }
@Override @Override
public String getUsage(ICommandSender sender) { public String getUsage(ICommandSender sender) {
return "pocket <group> <name> [setup]"; return "commands.pockets.usage";
} }
@Override @Override
public List<String> getAliases() { public void execute(MinecraftServer server, ICommandSender sender, String[] args) throws CommandException {
return aliases; 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 // Check that the number of arguments is correct
if (args.length < 2 || args.length > 3) { if (args.length < 2 || args.length > 3) {
sender.sendMessage(new TextComponentString("[DimDoors] Usage: /" + getUsage(sender))); throw new WrongUsageException("commands.pockets.usage");
return;
} }
// 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 group = args[0];
String name = args[1]; String name = args[1];
boolean setup = true;
if (args.length >= 3) { // Check if the schematic exists
switch (args[2]) { if (!SchematicHandler.INSTANCE.getTemplateGroups().contains(group)) {
case "true": throw new CommandException("commands.pockets.groupnotfound", group);
setup = true; } else if (!SchematicHandler.INSTANCE.getTemplateNames(group).contains(name)) {
break; throw new CommandException("commands.pockets.templatenotfound", group);
case "false":
setup = false;
break;
default:
sender.sendMessage(new TextComponentString("[DimDoors] Usage: /" + getUsage(sender)));
return;
}
} }
// Execute only if it's a player boolean setup = parseBoolean(args[3]);
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;
}
// Check if the schematic exists // Generate the schematic
if (!SchematicHandler.INSTANCE.getTemplateGroups().contains(group)) { PocketTemplate template = SchematicHandler.INSTANCE.getTemplate(group, name);
DimDoors.chat(player, "Group " + group + " not found"); Pocket pocket = PocketGenerator.generatePocketFromTemplate(WorldUtils.getDim(player.world), template, null, setup);
return;
} else if (!SchematicHandler.INSTANCE.getTemplateNames(group).contains(name)) {
DimDoors.chat(player, "Schematic " + name + " not found in group " + group);
return;
}
// Generate the schematic // Teleport the player there
PocketTemplate template = SchematicHandler.INSTANCE.getTemplate(group, name); if (RiftRegistry.instance().getPocketEntrance(pocket) != null) {
Pocket pocket = PocketGenerator.generatePocketFromTemplate(WorldUtils.getDim(player.world), template, null, setup); TileEntityRift entrance = (TileEntityRift) player.world.getTileEntity(RiftRegistry.instance().getPocketEntrance(pocket).getPos());
entrance.teleportTo(player);
// 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)));
}
} else { } 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)));
} }
} }

View file

@ -4,27 +4,17 @@ import com.flowpowered.math.vector.Vector3i;
import net.minecraft.command.CommandBase; import net.minecraft.command.CommandBase;
import net.minecraft.command.CommandException; import net.minecraft.command.CommandException;
import net.minecraft.command.ICommandSender; import net.minecraft.command.ICommandSender;
import net.minecraft.command.WrongUsageException;
import net.minecraft.entity.player.EntityPlayerMP; import net.minecraft.entity.player.EntityPlayerMP;
import net.minecraft.server.MinecraftServer; import net.minecraft.server.MinecraftServer;
import net.minecraft.util.math.BlockPos; import net.minecraft.util.math.BlockPos;
import net.minecraft.util.text.TextComponentString;
import org.dimdev.ddutils.schem.Schematic; 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.Pocket;
import org.dimdev.pocketlib.PocketRegistry; import org.dimdev.pocketlib.PocketRegistry;
import org.dimdev.dimdoors.shared.pockets.SchematicHandler;
import org.dimdev.pocketlib.WorldProviderPocket; import org.dimdev.pocketlib.WorldProviderPocket;
import java.util.ArrayList;
import java.util.List;
public class CommandSaveSchem extends CommandBase { public class CommandSaveSchem extends CommandBase {
private final List<String> aliases;
public CommandSaveSchem() {
aliases = new ArrayList<>();
aliases.add("saveschem");
}
@Override @Override
public String getName() { public String getName() {
@ -33,41 +23,28 @@ public class CommandSaveSchem extends CommandBase {
@Override @Override
public String getUsage(ICommandSender sender) { public String getUsage(ICommandSender sender) {
return "saveschem <name>"; return "commands.saveschem.usage";
}
@Override
public List<String> getAliases() {
return aliases;
} }
@Override @Override
public void execute(MinecraftServer server, ICommandSender sender, String[] args) throws CommandException { 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) { if (args.length != 1) {
sender.sendMessage(new TextComponentString("[DimDoors] Usage: /" + getUsage(sender))); throw new WrongUsageException("commands.saveschem.usage");
return;
} }
// Execute only if it's a player if (!(player.world.provider instanceof WorldProviderPocket))
if (sender instanceof EntityPlayerMP) { throw new CommandException("commands.generic.dimdoors.not_in_pocket");
EntityPlayerMP player = getCommandSenderAsPlayer(sender); 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)) { Schematic schematic = Schematic.createFromWorld(player.world, toVector3i(pocket.getOrigin()), toVector3i(pocket.getOrigin()).add(Vector3i.from((pocket.getSize() + 1) * 16 - 1)));
DimDoors.chat(player, "Current Dimension isn't a pocket dimension"); schematic.name = args[0];
return; schematic.author = player.getName();
}
Pocket pocket = PocketRegistry.instance(player.dimension).getPocketAt(player.getPosition()); SchematicHandler.INSTANCE.saveSchematic(schematic, args[0]);
Schematic schematic = Schematic.createFromWorld(player.world, toVector3i(pocket.getOrigin()), toVector3i(pocket.getOrigin()).add(Vector3i.from((pocket.getSize() + 1) * 16 - 1))); notifyCommandListener(sender, this, "commands.saveschem.success", args[0]);
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.");
}
} }
private Vector3i toVector3i(BlockPos pos) { private Vector3i toVector3i(BlockPos pos) {

View file

@ -52,7 +52,7 @@ public class EntityMonolith extends EntityFlying implements IMob {
} }
public boolean isDangerous() { 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 @Override
@ -146,7 +146,7 @@ public class EntityMonolith extends EntityFlying implements IMob {
} }
// Teleport the target player if various conditions are met // 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; aggro = 0;
Location destination = WorldProviderLimbo.getLimboSkySpawn(player); Location destination = WorldProviderLimbo.getLimboSkySpawn(player);
TeleportUtils.teleport(player, destination, 0, 0); TeleportUtils.teleport(player, destination, 0, 0);

View file

@ -1,6 +1,7 @@
package org.dimdev.dimdoors.shared.items; package org.dimdev.dimdoors.shared.items;
import net.minecraft.util.*; import net.minecraft.util.*;
import net.minecraft.util.text.TextComponentTranslation;
import net.minecraftforge.fml.relauncher.Side; import net.minecraftforge.fml.relauncher.Side;
import net.minecraftforge.fml.relauncher.SideOnly; import net.minecraftforge.fml.relauncher.SideOnly;
import org.dimdev.dimdoors.DimDoors; import org.dimdev.dimdoors.DimDoors;
@ -16,6 +17,7 @@ import net.minecraft.item.ItemStack;
import net.minecraft.util.math.RayTraceResult; import net.minecraft.util.math.RayTraceResult;
import net.minecraft.world.World; import net.minecraft.world.World;
import java.awt.*;
import java.util.List; import java.util.List;
public class ItemRiftRemover extends Item { public class ItemRiftRemover extends Item {
@ -51,7 +53,7 @@ public class ItemRiftRemover extends Item {
// TODO: render rift removing animation // TODO: render rift removing animation
stack.damageItem(10, player); 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.SUCCESS, stack);
} }
return new ActionResult<>(EnumActionResult.FAIL, stack); return new ActionResult<>(EnumActionResult.FAIL, stack);

View file

@ -6,6 +6,7 @@ import net.minecraft.init.Blocks;
import net.minecraft.nbt.NBTTagCompound; import net.minecraft.nbt.NBTTagCompound;
import net.minecraft.util.*; import net.minecraft.util.*;
import net.minecraft.util.math.BlockPos; import net.minecraft.util.math.BlockPos;
import net.minecraft.util.text.TextComponentTranslation;
import net.minecraftforge.fml.relauncher.Side; import net.minecraftforge.fml.relauncher.Side;
import net.minecraftforge.fml.relauncher.SideOnly; import net.minecraftforge.fml.relauncher.SideOnly;
import org.dimdev.ddutils.I18nUtils; import org.dimdev.ddutils.I18nUtils;
@ -56,7 +57,12 @@ public class ItemRiftSignature extends Item {
RotatedLocation target = getSource(stack); 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 // 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(ModBlocks.RIFT)) {
if (!target.getLocation().getBlockState().getBlock().equals(Blocks.AIR)) { 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? stack.damageItem(1, player); // TODO: calculate damage based on position?
clearSource(stack); 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 // 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); 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; return EnumActionResult.SUCCESS;

View file

@ -9,6 +9,7 @@ import net.minecraft.item.ItemStack;
import net.minecraft.nbt.NBTTagCompound; import net.minecraft.nbt.NBTTagCompound;
import net.minecraft.util.*; import net.minecraft.util.*;
import net.minecraft.util.math.BlockPos; import net.minecraft.util.math.BlockPos;
import net.minecraft.util.text.TextComponentTranslation;
import net.minecraft.world.World; import net.minecraft.world.World;
import net.minecraftforge.fml.relauncher.Side; import net.minecraftforge.fml.relauncher.Side;
import net.minecraftforge.fml.relauncher.SideOnly; import net.minecraftforge.fml.relauncher.SideOnly;
@ -56,7 +57,12 @@ public class ItemStabilizedRiftSignature extends Item { // TODO: common supercla
RotatedLocation target = getTarget(stack); 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 // Place a rift at the target point
if (!target.getLocation().getBlockState().getBlock().equals(ModBlocks.RIFT)) { if (!target.getLocation().getBlockState().getBlock().equals(ModBlocks.RIFT)) {
if (!target.getLocation().getBlockState().getBlock().equals(Blocks.AIR)) { if (!target.getLocation().getBlockState().getBlock().equals(Blocks.AIR)) {
@ -78,13 +84,8 @@ public class ItemStabilizedRiftSignature extends Item { // TODO: common supercla
stack.damageItem(1, player); 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); 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; return EnumActionResult.SUCCESS;

View file

@ -14,7 +14,7 @@ import java.util.Random;
public final class PocketGenerator { public final class PocketGenerator {
public static Pocket generatePocketFromTemplate(int dim, PocketTemplate pocketTemplate, VirtualLocation virtualLocation, boolean setup) { 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); PocketRegistry registry = PocketRegistry.instance(dim);
Pocket pocket = registry.newPocket(); Pocket pocket = registry.newPocket();
@ -29,7 +29,7 @@ public final class PocketGenerator {
return generatePocketFromTemplate(ModDimensions.getPrivateDim(), pocketTemplate, virtualLocation, true); 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) { public static Pocket generatePublicPocket(VirtualLocation virtualLocation, RiftDestination linkTo, LinkProperties linkProperties) {
PocketTemplate pocketTemplate = SchematicHandler.INSTANCE.getPublicPocketTemplate(); PocketTemplate pocketTemplate = SchematicHandler.INSTANCE.getPublicPocketTemplate();
Pocket pocket = generatePocketFromTemplate(ModDimensions.getPublicDim(), pocketTemplate, virtualLocation, false); 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 * @param virtualLocation The virtual location of the pockets
* @return The newly-generated dungeon pocket * @return The newly-generated dungeon pockets
*/ */
public static Pocket generateDungeonPocket(VirtualLocation virtualLocation, RiftDestination linkTo, LinkProperties linkProperties) { public static Pocket generateDungeonPocket(VirtualLocation virtualLocation, RiftDestination linkTo, LinkProperties linkProperties) {
int depth = virtualLocation.getDepth(); int depth = virtualLocation.getDepth();
float netherProbability = virtualLocation.getDim() == -1 ? 1 : (float) depth / 200; // TODO: improve nether probability float netherProbability = virtualLocation.getDim() == -1 ? 1 : (float) depth / 200; // TODO: improve nether probability
Random random = new Random(); Random random = new Random();
String group = random.nextFloat() < netherProbability ? "nether" : "ruins"; 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); Pocket pocket = generatePocketFromTemplate(ModDimensions.getDungeonDim(), pocketTemplate, virtualLocation, false);
pocketTemplate.setup(pocket, linkTo, linkProperties); pocketTemplate.setup(pocket, linkTo, linkProperties);

View file

@ -145,8 +145,6 @@ public class PocketTemplate {
} }
} }
// Link the pocket back
// Link pocket exits back // Link pocket exits back
for (TileEntityRift rift : rifts) { for (TileEntityRift rift : rifts) {
RiftDestination dest = rift.getDestination(); RiftDestination dest = rift.getDestination();

View file

@ -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 name = pocket.has("name") ? pocket.get("name").getAsString() : null;
String author = pocket.has("author") ? pocket.get("author").getAsString() : null; String author = pocket.has("author") ? pocket.get("author").getAsString() : null;
int size = pocket.get("size").getAsInt(); 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; int baseWeight = pocket.has("baseWeight") ? pocket.get("baseWeight").getAsInt() : 100;
pocketTemplates.add(new PocketTemplate(group, id, type, name, author, size, baseWeight)); 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() { public PocketTemplate getPersonalPocketTemplate() {
return getRandomTemplate("private", -1, ModConfig.pocket.initialPrivatePocketSize, true); return getRandomTemplate("private", -1, ModConfig.pockets.initialPrivatePocketSize, true);
} }
public PocketTemplate getPublicPocketTemplate() { 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) { public void saveSchematic(Schematic schematic, String id) {

View file

@ -182,7 +182,7 @@ import javax.annotation.Nonnull;
// Check that the rift has as destination // Check that the rift has as destination
if (destination == null) { if (destination == null) {
DimDoors.sendMessage(entity, "This rift has no destination!"); DimDoors.sendTranslatedMessage(entity, "rifts.unlinked");
return false; return false;
} }
@ -190,11 +190,11 @@ import javax.annotation.Nonnull;
try { try {
if (destination.teleport(new RotatedLocation(new Location(world, pos), yaw, pitch), entity)) { if (destination.teleport(new RotatedLocation(new Location(world, pos), yaw, pitch), entity)) {
VirtualLocation vloc = VirtualLocation.fromLocation(new Location(entity.world, entity.getPosition())); 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; return true;
} }
} catch (Exception e) { } 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); DimDoors.log.error("Teleporting failed with the following exception: ", e);
} }
return false; return false;
@ -204,7 +204,7 @@ import javax.annotation.Nonnull;
//if (relativeRotation) { //if (relativeRotation) {
// TeleportUtils.teleport(entity, new Location(world, pos), yaw + entity.rotationYaw - fromYaw, pitch + entity.rotationPitch - fromPitch); // TeleportUtils.teleport(entity, new Location(world, pos), yaw + entity.rotationYaw - fromYaw, pitch + entity.rotationPitch - fromPitch);
//} else { //} else {
TeleportUtils.teleport(entity, new Location(world, pos), yaw, pitch); teleportTo(entity);
//} //}
} }

View file

@ -36,7 +36,11 @@ public class EscapeDestination extends RiftDestination {
@Override @Override
public boolean teleport(RotatedLocation loc, Entity entity) { public boolean teleport(RotatedLocation loc, Entity entity) {
if (!ModDimensions.isDimDoorsPocketDimension(entity.world)) { 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; return false;
} }
UUID uuid = entity.getUniqueID(); UUID uuid = entity.getUniqueID();
@ -44,15 +48,14 @@ public class EscapeDestination extends RiftDestination {
Location destLoc = RiftRegistry.instance().getOverworldRift(uuid); Location destLoc = RiftRegistry.instance().getOverworldRift(uuid);
if (destLoc != null && destLoc.getTileEntity() instanceof TileEntityRift) { if (destLoc != null && destLoc.getTileEntity() instanceof TileEntityRift) {
//TeleportUtils.teleport(entity, new VirtualLocation(destLoc, rift.virtualLocation.getDepth()).projectToWorld()); // TODO //TeleportUtils.teleport(entity, new VirtualLocation(destLoc, rift.virtualLocation.getDepth()).projectToWorld()); // TODO
// TODO
return true; return true;
} else { } else {
if (destLoc == null) { 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 { } 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; return true;
} }
} else { } else {

View file

@ -15,7 +15,7 @@ import org.dimdev.dimdoors.shared.rifts.RiftDestination;
import org.dimdev.dimdoors.shared.rifts.TileEntityRift; import org.dimdev.dimdoors.shared.rifts.TileEntityRift;
@Getter @AllArgsConstructor @Builder(toBuilder = true) @ToString @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; @Saved protected Location target;
public GlobalDestination() {} public GlobalDestination() {}

View file

@ -28,7 +28,7 @@ public class LimboDestination extends RiftDestination {
@Override @Override
public boolean teleport(RotatedLocation loc, Entity entity) { 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; return false;
} }
} }

View file

@ -37,7 +37,7 @@ import org.dimdev.dimdoors.shared.rifts.RiftDestination;
@Override @Override
public boolean teleport(RotatedLocation loc, Entity entity) { 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; return false;
} }
} }

View file

@ -28,7 +28,7 @@ public class PocketExitMarker extends RiftDestination {
@Override @Override
public boolean teleport(RotatedLocation loc, Entity entity) { 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; return false;
} }
} }

View file

@ -46,9 +46,9 @@ public class PrivatePocketExitDestination extends RiftDestination {
} }
if (destLoc == null || !(destLoc.getTileEntity() instanceof TileEntityRift)) { if (destLoc == null || !(destLoc.getTileEntity() instanceof TileEntityRift)) {
if (destLoc == null) { 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 { } 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)); TeleportUtils.teleport(entity, WorldProviderLimbo.getLimboSkySpawn(entity));
return false; return false;

View file

@ -32,7 +32,7 @@ public class RiftRegistry extends WorldSavedData {
// Caches to avoid looping through vertices to find specific vertices // Caches to avoid looping through vertices to find specific vertices
protected Map<Location, Rift> locationMap = new HashMap<>(); protected Map<Location, Rift> locationMap = new HashMap<>();
protected Map<Pocket, PocketEntrancePointer> 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<Pocket, PocketEntrancePointer> pocketEntranceMap = new HashMap<>();
protected Map<UUID, RegistryVertex> uuidMap = new HashMap<>(); protected Map<UUID, RegistryVertex> uuidMap = new HashMap<>();
// These are stored in the main registry // These are stored in the main registry

View file

@ -74,9 +74,10 @@ import java.util.Random;
if (relativeRotation) { if (relativeRotation) {
TeleportUtils.teleport(entity, new Location(world, pos.offset(orientation, tpOffset)), orientation.getHorizontalAngle() + entity.rotationYaw - fromYaw, entity.rotationPitch - fromPitch); TeleportUtils.teleport(entity, new Location(world, pos.offset(orientation, tpOffset)), orientation.getHorizontalAngle() + entity.rotationYaw - fromYaw, entity.rotationPitch - fromPitch);
} else { } else {
TeleportUtils.teleport(entity, new Location(world, pos.offset(orientation, tpOffset)), orientation.getHorizontalAngle(), 0); teleportTo(entity);
} }
} }
@Override @Override
public void teleportTo(Entity entity) { public void teleportTo(Entity entity) {
TeleportUtils.teleport(entity, new Location(world, pos.offset(orientation, tpOffset)), orientation.getHorizontalAngle(), 0); TeleportUtils.teleport(entity, new Location(world, pos.offset(orientation, tpOffset)), orientation.getHorizontalAngle(), 0);

View file

@ -41,8 +41,9 @@ public final class SchematicConverter {
private final static int POTION_ID = 373; private final static int POTION_ID = 373;
private final static int WRITTEN_BOOK_ID = 387; 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 NBT_COMPOUND_TAG_ID = NBTUtils.NBT_COMPOUND_TAG_ID;
private final static int STRING_TAG_ID = NBTUtils.getSTRING_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) { public static Schematic convertSchematic(NBTTagCompound nbt, String schematicId, String name, String author) {
Schematic schematic = new Schematic(); Schematic schematic = new Schematic();
@ -381,8 +382,10 @@ public final class SchematicConverter {
} }
schematic.paletteMax = schematic.palette.size() - 1; schematic.paletteMax = schematic.palette.size() - 1;
DimDoors.log.info(schematicId + "," + ironDimDoors + "," + warpDoors + "," + monoliths + "," + chests + "," if (GENERATE_DUNGEON_INFO) {
+ dispensers + "," + allPistonBases + "," + tnt + "," + diamondBlocks + "," + goldBlocks + "," + ironBlocks); DimDoors.log.info(schematicId + "," + ironDimDoors + "," + warpDoors + "," + monoliths + "," + chests + ","
+ dispensers + "," + allPistonBases + "," + tnt + "," + diamondBlocks + "," + goldBlocks + "," + ironBlocks);
}
return schematic; return schematic;
} }
@ -418,8 +421,6 @@ public final class SchematicConverter {
if (location == null) { 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.")); 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); location = translateIdCrude(id);
} else {
//DimDoors.log.info("Resourcelocation succesfully translated from old ID: " + oldID + " into: " + newID + ".");
} }
return location.toString(); return location.toString();
} }

View file

@ -5,19 +5,22 @@ import net.minecraft.world.World;
import net.minecraft.world.biome.Biome; import net.minecraft.world.biome.Biome;
public abstract class BaseGateway { public abstract class BaseGateway {
public BaseGateway() {} public BaseGateway() {}
/** /**
* Generates the gateway centered on the given coordinates * Generates the gateway centered on the given coordinates
*
* @param world - the world in which to generate the 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 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 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 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); 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 * Determines whether the specified biome is a valid biome in which to generate this gateway
*
* @param biome - the biome to be checked * @param biome - the biome to be checked
* @return <code>true</code> true if the specified biome is a valid for generating this gateway, otherwise <code>false</code> * @return <code>true</code> true if the specified biome is a valid for generating this gateway, otherwise <code>false</code>
*/ */
@ -36,19 +39,20 @@ public abstract class BaseGateway {
/** /**
* Determines whether the specified world and coordinates are a valid location for generating this gateway * 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 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 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 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 z - the z-coordinate at which to center the gateway; usually where the door is placed
* @return <code>true</code> if the location is valid, otherwise <code>false</code> * @return <code>true</code> if the location is valid, otherwise <code>false</code>
*/ */
public boolean isLocationValid(World world, int x, int y, int z) public boolean isLocationValid(World world, int x, int y, int z) {
{ return isBiomeValid(world.getBiome(new BlockPos(x, y, 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 * 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 * @return an array of biome keywords to match against
*/ */
public Biome[] getBiomes() { public Biome[] getBiomes() {

View file

@ -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<Integer> blacklist;
private DimensionFilter(RangeSet<Integer> 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<Integer> parseRangeSet(String[] list) {
int index;
int start;
int end;
String startPart;
String endPart;
RangeSet<Integer> 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));
}
}

View file

@ -1,8 +1,5 @@
package org.dimdev.dimdoors.shared.world.gateways; 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.block.material.Material;
import net.minecraft.init.Blocks; import net.minecraft.init.Blocks;
import net.minecraft.util.math.BlockPos; 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.chunk.IChunkProvider;
import net.minecraft.world.gen.IChunkGenerator; import net.minecraft.world.gen.IChunkGenerator;
import net.minecraftforge.fml.common.IWorldGenerator; 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.ArrayList;
import java.util.Arrays; 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 MIN_RIFT_Y = 4;
private static final int MAX_RIFT_Y = 240; private static final int MAX_RIFT_Y = 240;
private static final int CHUNK_LENGTH = 16; 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 MAX_GATEWAY_GENERATION_ATTEMPTS = 10;
private static final int NETHER_DIMENSION_ID = -1; private static final int NETHER_DIMENSION_ID = -1;
private static final int END_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 //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 //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)) 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 && world.getBlockState(new BlockPos(x, y, z)).getBlock() != Blocks.BEDROCK
&& //<-- Stops Nether roof spawning. DO NOT REMOVE! && //<-- Stops Nether roof spawning. DO NOT REMOVE!
world.getBlockState(new BlockPos(x, y - 1, z)).getBlock() != Blocks.BEDROCK 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 - 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. //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()); 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 //and the block two levels down is opaque and has a reasonable material. Plus that we're not building
//on top of bedrock. //on top of bedrock.
return pos.getY() >= MIN_RIFT_Y && pos.getY() <= MAX_RIFT_Y return pos.getY() >= MIN_RIFT_Y && pos.getY() <= MAX_RIFT_Y
&& world.isAirBlock(pos.up()) && world.isAirBlock(pos.up())
&& world.getBlockState(pos).getBlock() != Blocks.BEDROCK && world.getBlockState(pos).getBlock() != Blocks.BEDROCK
&& //<-- Stops Nether roof spawning. DO NOT REMOVE! && world.getBlockState(pos.down()) != Blocks.BEDROCK //<-- Stops Nether roof spawning. DO NOT REMOVE!
world.getBlockState(pos.down()) != Blocks.BEDROCK && checkFoundationMaterial(world, pos.down());
&& checkFoundationMaterial(world, pos.down());
} }
private static boolean checkFoundationMaterial(World world, BlockPos pos) { 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! //We also want to avoid generating things on top of the Nether's bedrock!
Material material = world.getBlockState(pos).getMaterial(); Material material = world.getBlockState(pos).getMaterial();
return material != Material.LEAVES && material != Material.WOOD && material != Material.GOURD 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;
} }
} }

View file

@ -5,7 +5,7 @@ import net.minecraft.world.biome.Biome;
public class GatewaySandstonePillars extends BaseSchematicGateway { public class GatewaySandstonePillars extends BaseSchematicGateway {
public GatewaySandstonePillars() { public GatewaySandstonePillars() {
super("sandstonePillars"); super("sandstone_pillars");
} }
@Override @Override

View file

@ -9,7 +9,7 @@ public class GatewayTwoPillars extends BaseSchematicGateway {
private static final int GATEWAY_RADIUS = 4; private static final int GATEWAY_RADIUS = 4;
public GatewayTwoPillars() { public GatewayTwoPillars() {
super("twoPillars"); super("two_pillars");
} }
@Override @Override

View file

@ -16,7 +16,7 @@ import javax.annotation.Nullable;
import java.util.List; import java.util.List;
import java.util.Random; import java.util.Random;
public class LimboGenerator implements IChunkGenerator { public class ChunkGeneratorLimbo implements IChunkGenerator {
private Random rand; private Random rand;
@ -37,7 +37,7 @@ public class LimboGenerator implements IChunkGenerator {
double[] depthRegion; double[] depthRegion;
public LimboGenerator(World world, long seed) { public ChunkGeneratorLimbo(World world, long seed) {
this.world = world; this.world = world;
rand = new Random(seed); rand = new Random(seed);
minLimitPerlinNoise = new NoiseGeneratorOctaves(rand, 16); //base terrain minLimitPerlinNoise = new NoiseGeneratorOctaves(rand, 16); //base terrain

View file

@ -88,7 +88,7 @@ public class WorldProviderLimbo extends WorldProvider {
@Override @Override
public IChunkGenerator createChunkGenerator() { 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 public static Location getLimboSkySpawn(Entity entity) { // TODO: move this somewhere else

View file

@ -30,7 +30,6 @@ public class BiomeBlank extends Biome {
spawnableCreatureList.clear(); spawnableCreatureList.clear();
spawnableWaterCreatureList.clear(); spawnableWaterCreatureList.clear();
spawnableCaveCreatureList.clear(); spawnableCaveCreatureList.clear();
//if (monoliths) spawnableMonsterList.add(new SpawnListEntry(EntityMonolith.class, 100, 4, 4));
flowers.clear(); flowers.clear();

View file

@ -32,7 +32,7 @@ import org.dimdev.ddutils.nbt.NBTUtils;
@Override public NBTTagCompound writeToNBT(NBTTagCompound nbt) { return NBTUtils.writeToNBT(this, nbt); } @Override public NBTTagCompound writeToNBT(NBTTagCompound nbt) { return NBTUtils.writeToNBT(this, nbt); }
boolean isInBounds(BlockPos pos) { boolean isInBounds(BlockPos pos) {
// pocket bounds // pockets bounds
int gridSize = PocketRegistry.instance(dim).getGridSize(); int gridSize = PocketRegistry.instance(dim).getGridSize();
int minX = x * gridSize; int minX = x * gridSize;
int minZ = z * 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); return new BlockPos(x * gridSize * 16, 0, z * gridSize * 16);
} }
// TODO: more pocket methods // TODO: more pockets methods
} }

View file

@ -63,7 +63,7 @@ import org.dimdev.dimdoors.shared.ModConfig;
} }
public void initNewRegistry() { public void initNewRegistry() {
gridSize = ModConfig.pocket.pocketGridSize; gridSize = ModConfig.pockets.pocketGridSize;
nextID = 0; nextID = 0;
pockets = new HashMap<>(); pockets = new HashMap<>();
@ -75,7 +75,7 @@ import org.dimdev.dimdoors.shared.ModConfig;
/** /**
* Create a new blank pocket. * Create a new blank pocket.
* *
* @return The newly created pocket * @return The newly created pockets
*/ */
public Pocket newPocket() { public Pocket newPocket() {
Pocket pocket = null; 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. * @return The newly created Pocket, or null if that ID is already taken.
*/ */

View file

@ -26,12 +26,12 @@ import org.dimdev.dimdoors.shared.world.limbo.WorldProviderLimbo;
if (location.getWorld().provider instanceof WorldProviderPocket) { if (location.getWorld().provider instanceof WorldProviderPocket) {
Pocket pocket = PocketRegistry.instance(location.getDim()).getPocketAt(location.getPos()); Pocket pocket = PocketRegistry.instance(location.getDim()).getPocketAt(location.getPos());
if (pocket != null) { if (pocket != null) {
virtualLocation = pocket.getVirtualLocation(); // TODO: pocket-relative coordinates virtualLocation = pocket.getVirtualLocation(); // TODO: pockets-relative coordinates
} else { } 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 } 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 } // TODO: nether coordinate transform
if (virtualLocation == null) { if (virtualLocation == null) {
virtualLocation = new VirtualLocation(0, location.getX(), location.getZ(), 5); // TODO virtualLocation = new VirtualLocation(0, location.getX(), location.getZ(), 5); // TODO

View file

@ -1,13 +1,15 @@
package org.dimdev.pocketlib; package org.dimdev.pocketlib;
import org.dimdev.dimdoors.DimDoors;
import org.dimdev.ddutils.render.CloudRenderBlank;
import net.minecraft.entity.Entity; import net.minecraft.entity.Entity;
import net.minecraft.init.Biomes;
import net.minecraft.util.math.Vec3d; import net.minecraft.util.math.Vec3d;
import net.minecraft.world.WorldProvider; import net.minecraft.world.WorldProvider;
import net.minecraft.world.biome.BiomeProviderSingle;
import net.minecraft.world.gen.IChunkGenerator; import net.minecraft.world.gen.IChunkGenerator;
import net.minecraftforge.fml.relauncher.Side; import net.minecraftforge.fml.relauncher.Side;
import net.minecraftforge.fml.relauncher.SideOnly; import net.minecraftforge.fml.relauncher.SideOnly;
import org.dimdev.ddutils.render.CloudRenderBlank;
import org.dimdev.dimdoors.DimDoors;
import javax.annotation.Nullable; import javax.annotation.Nullable;
@ -18,6 +20,7 @@ public abstract class WorldProviderPocket extends WorldProvider {
hasSkyLight = true; hasSkyLight = true;
generateLightBrightnessTable(); generateLightBrightnessTable();
DimDoors.proxy.setCloudRenderer(this, new CloudRenderBlank()); DimDoors.proxy.setCloudRenderer(this, new CloudRenderBlank());
biomeProvider = new BiomeProviderSingle(Biomes.PLAINS);
} }
@Override @Override

View file

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

View file

@ -12,37 +12,37 @@ tile.dimensional_trapdoor.name=Transdimensional Trapdoor
tile.dimensional_portal.name=Transient Portal tile.dimensional_portal.name=Transient Portal
tile.fabric.white.name=Altered Fabric tile.fabric.white.name=Altered Fabric
tile.fabric.orange.name=Orange Colored Fabric tile.fabric.orange.name=Orange Altered Fabric
tile.fabric.magenta.name=Magenta Colored Fabric tile.fabric.magenta.name=Magenta Altered Fabric
tile.fabric.lightBlue.name=Light Blue Colored Fabric tile.fabric.lightBlue.name=Light Blue Altered Fabric
tile.fabric.yellow.name=Yellow Colored Fabric tile.fabric.yellow.name=Yellow Altered Fabric
tile.fabric.lime.name=Lime Colored Fabric tile.fabric.lime.name=Lime Altered Fabric
tile.fabric.pink.name=Pink Colored Fabric tile.fabric.pink.name=Pink Altered Fabric
tile.fabric.gray.name=Gray Colored Fabric tile.fabric.gray.name=Gray Altered Fabric
tile.fabric.silver.name=Light Grey Colored Fabric tile.fabric.silver.name=Light Grey Altered Fabric
tile.fabric.cyan.name=Cyan Colored Fabric tile.fabric.cyan.name=Cyan Altered Fabric
tile.fabric.purple.name=Purple Colored Fabric tile.fabric.purple.name=Purple Altered Fabric
tile.fabric.blue.name=Blue Colored Fabric tile.fabric.blue.name=Blue Altered Fabric
tile.fabric.brown.name=Brown Colored Fabric tile.fabric.brown.name=Brown Altered Fabric
tile.fabric.green.name=Green Colored Fabric tile.fabric.green.name=Green Altered Fabric
tile.fabric.red.name=Red Colored Fabric tile.fabric.red.name=Red Altered Fabric
tile.fabric.black.name=Fabric of Reality tile.fabric.black.name=Fabric of Reality
tile.ancient_fabric.white.name=Ancient Altered Fabric tile.ancient_fabric.white.name=Ancient Altered Fabric
tile.ancient_fabric.orange.name=Orange Colored Ancient Fabric tile.ancient_fabric.orange.name=Orange Altered Ancient Fabric
tile.ancient_fabric.magenta.name=Magenta Colored Ancient Fabric tile.ancient_fabric.magenta.name=Magenta Altered Ancient Fabric
tile.ancient_fabric.lightBlue.name=Light Blue Colored Ancient Fabric tile.ancient_fabric.lightBlue.name=Light Blue Altered Ancient Fabric
tile.ancient_fabric.yellow.name=Yellow Colored Ancient Fabric tile.ancient_fabric.yellow.name=Yellow Altered Ancient Fabric
tile.ancient_fabric.lime.name=Lime Colored Ancient Fabric tile.ancient_fabric.lime.name=Lime Altered Ancient Fabric
tile.ancient_fabric.pink.name=Pink Colored Ancient Fabric tile.ancient_fabric.pink.name=Pink Altered Ancient Fabric
tile.ancient_fabric.gray.name=Gray Colored Ancient Fabric tile.ancient_fabric.gray.name=Gray Altered Ancient Fabric
tile.ancient_fabric.silver.name=Light Grey Colored Ancient Fabric tile.ancient_fabric.silver.name=Light Grey Altered Ancient Fabric
tile.ancient_fabric.cyan.name=Cyan Colored Ancient Fabric tile.ancient_fabric.cyan.name=Cyan Altered Ancient Fabric
tile.ancient_fabric.purple.name=Purple Colored Ancient Fabric tile.ancient_fabric.purple.name=Purple Altered Ancient Fabric
tile.ancient_fabric.blue.name=Blue Colored Ancient Fabric tile.ancient_fabric.blue.name=Blue Altered Ancient Fabric
tile.ancient_fabric.brown.name=Brown Colored Ancient Fabric tile.ancient_fabric.brown.name=Brown Altered Ancient Fabric
tile.ancient_fabric.green.name=Green Colored Ancient Fabric tile.ancient_fabric.green.name=Green Altered Ancient Fabric
tile.ancient_fabric.red.name=Red Colored Ancient Fabric tile.ancient_fabric.red.name=Red Altered Ancient Fabric
tile.ancient_fabric.black.name=Ancient Fabric tile.ancient_fabric.black.name=Ancient Fabric
tile.eternal_fabric.name=Eternal 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_key=Rift Key
item.rift_signature.name=Rift Signature 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.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_configuration_tool.name=Rift Configuration Tool
item.rift_remover.name=Rift Remover item.rift_remover.name=Rift Remover
item.rift_remover.removed=Rift Removed
item.rift_blade.name=Rift Blade item.rift_blade.name=Rift Blade
item.world_thread.name=World Thread 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. info.warp_dimensional_door3=pocket dimension to exit.
entity.dimdoors.monolith.name=Monolith entity.dimdoors.monolith.name=Monolith
commands.dimteleport.usage=/dimteleport <dimension> <x> <y> <z> [yaw] [pitch]
commands.fabricconvert.usage=/fabricconvert
commands.fabricconvert.success=All fabric of reality has been converted to black.
commands.pocket.usage=/pocket <group> <name> [setup]
commands.pocket.groupnotfound=Group %s not found
commands.pocket.templatenotfound=Template %s not found
commands.saveschem.usage=/saveschem <name>
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.

View file

@ -16,12 +16,12 @@ tile.fabric.white.name=Étoffe altérée
tile.fabric.orange.name=Étoffe altérée orange tile.fabric.orange.name=Étoffe altérée orange
tile.fabric.magenta.name=Étoffe altérée magenta 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 bleule
tile.fabric.yellow.name=Étoffe altérée jaune tile.fabric.yellow.name=Étoffe altérée jaune
tile.fabric.lime.name=Étoffe altérée lime tile.fabric.lime.name=Étoffe altérée lime
tile.fabric.pink.name=Étoffe altérée rose tile.fabric.pink.name=Étoffe altérée rose
tile.fabric.gray.name=Étoffe altérée grise 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.cyan.name=Étoffe altérée cyan
tile.fabric.purple.name=Étoffe altérée mauve tile.fabric.purple.name=Étoffe altérée mauve
tile.fabric.blue.name=Étoffe altérée bleue tile.fabric.blue.name=Étoffe altérée bleue

View file

@ -21,7 +21,7 @@ tile.fabric.yellow.name=Țesut alterat galben
tile.fabric.lime.name=Țesut alterat lima tile.fabric.lime.name=Țesut alterat lima
tile.fabric.pink.name=Țesut alterat roz tile.fabric.pink.name=Țesut alterat roz
tile.fabric.gray.name=Țesut alterat gri 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.cyan.name=Țesut alterat cyan
tile.fabric.purple.name=Țesut alterat mov tile.fabric.purple.name=Țesut alterat mov
tile.fabric.blue.name=Țesut alterat albastru tile.fabric.blue.name=Țesut alterat albastru