Config localization and tile entity simplification

This commit is contained in:
Runemoro 2018-03-27 16:17:15 -04:00
parent 8cd3b8606c
commit 31c0f9c676
18 changed files with 163 additions and 129 deletions

View file

@ -76,6 +76,6 @@ public class Location implements Serializable {
@Override @Override
public int hashCode() { public int hashCode() {
return pos.hashCode() * 31 + dim; // TODO return pos.hashCode() * 31 + dim;
} }
} }

View file

@ -243,6 +243,10 @@ public class Schematic {
} }
} }
if (value != null) { if (value != null) {
// property is IProperty<?>, value is Comparable<?>, and the ?s refer to the same type because
// IProperty<T>.getAllowedValues() returns Collection<T>, but the compiler doesn't keep track of
// this, so casting to raw types:
//noinspection unchecked,RedundantCast,rawtypes
chosenState = chosenState.withProperty((IProperty) property, (Comparable) value); chosenState = chosenState.withProperty((IProperty) property, (Comparable) value);
} }
} }
@ -368,7 +372,6 @@ public class Schematic {
adjustedEntityNBT.setUniqueId("UUID", UUID.randomUUID()); adjustedEntityNBT.setUniqueId("UUID", UUID.randomUUID());
Entity entity = EntityList.createEntityFromNBT(adjustedEntityNBT, world); Entity entity = EntityList.createEntityFromNBT(adjustedEntityNBT, world);
// TODO: check if it is in pocket bounds
world.spawnEntity(entity); world.spawnEntity(entity);
} }
} }
@ -425,8 +428,6 @@ public class Schematic {
} }
setTime += System.nanoTime() - setStart; setTime += System.nanoTime() - setStart;
long relightStart = System.nanoTime(); long relightStart = System.nanoTime();
// TODO: It's possible to relight a whole region at once, and immediately using this, according
// TODO: to Foghrye4: https://hastebin.com/hociqufabe.java
cube.setInitialLightingDone(false); cube.setInitialLightingDone(false);
relightTime += System.nanoTime() - relightStart; relightTime += System.nanoTime() - relightStart;
cube.markDirty(); cube.markDirty();

View file

@ -33,13 +33,12 @@ public class DimDoors {
public static final String MODNAME = "Dimensional Doors"; public static final String MODNAME = "Dimensional Doors";
public static final String MCVERSIONS = "[1.12,1.13)"; public static final String MCVERSIONS = "[1.12,1.13)";
public static final String VERSION = "${version}"; public static final String VERSION = "${version}";
// TODO: make the forge version here change depending on a field in build.gradle
public static final String DEPENDENCIES = "required-after:forge@[14.21.0.2320,);after:csb_ench_table"; public static final String DEPENDENCIES = "required-after:forge@[14.21.0.2320,);after:csb_ench_table";
// after:csb_ench_table as a workaround for https://github.com/crazysnailboy/EnchantingTable/issues/7 // after:csb_ench_table as a workaround for https://github.com/crazysnailboy/EnchantingTable/issues/7
@Mod.Instance(DimDoors.MODID) @Mod.Instance(DimDoors.MODID)
public static DimDoors instance; public static DimDoors instance;
public static Logger log; // TODO: make non-static? public static Logger log;
@SidedProxy(clientSide = "org.dimdev.dimdoors.client.ClientProxy", @SidedProxy(clientSide = "org.dimdev.dimdoors.client.ClientProxy",
serverSide = "org.dimdev.dimdoors.server.ServerProxy") serverSide = "org.dimdev.dimdoors.server.ServerProxy")
@ -86,11 +85,9 @@ public class DimDoors {
} }
public static void sendTranslatedMessage(Entity entity, String text, Object... translationArgs) { public static void sendTranslatedMessage(Entity entity, String text, Object... translationArgs) {
if (ModConfig.general.useStatusBar && entity instanceof EntityPlayerMP) { if (entity instanceof EntityPlayerMP) {
EntityPlayerMP player = (EntityPlayerMP) entity; EntityPlayerMP player = (EntityPlayerMP) entity;
player.sendStatusMessage(new TextComponentTranslation(text, translationArgs), true); player.sendStatusMessage(new TextComponentTranslation(text, translationArgs), ModConfig.general.useStatusBar);
} else {
chat(entity, text, translationArgs);
} }
} }

View file

@ -41,12 +41,7 @@ public class TileEntityEntranceRiftRenderer extends TileEntitySpecialRenderer<Ti
GlStateManager.pushMatrix(); GlStateManager.pushMatrix();
GlStateManager.translate(x, y, z); GlStateManager.translate(x, y, z);
//x = ActiveRenderInfo.getPosition().xCoord;
//y = ActiveRenderInfo.getPosition().yCoord;
//z = ActiveRenderInfo.getPosition().zCoord;
GlStateManager.rotate(180.0F - 90 * rotation.getHorizontalIndex(), 0.0F, 1.0F, 0.0F); GlStateManager.rotate(180.0F - 90 * rotation.getHorizontalIndex(), 0.0F, 1.0F, 0.0F);
// GlStateManager.rotate((float)(-90 * rotation), 0.0F, 0.0F, 1.0F);
GlStateManager.translate(0.007F, .25F, 0F); GlStateManager.translate(0.007F, .25F, 0F);
@ -102,7 +97,6 @@ public class TileEntityEntranceRiftRenderer extends TileEntitySpecialRenderer<Ti
@Override @Override
public void render(TileEntityEntranceRift entrance, double x, double y, double z, float partialTicks, int destroyStage, float alpha) { public void render(TileEntityEntranceRift entrance, double x, double y, double z, float partialTicks, int destroyStage, float alpha) {
if (entrance.shouldRender) {
Vec3d offset = new Vec3d(entrance.orientation.getOpposite().getDirectionVec()).scale( Vec3d offset = new Vec3d(entrance.orientation.getOpposite().getDirectionVec()).scale(
entrance.orientation == EnumFacing.NORTH || entrance.orientation == EnumFacing.NORTH ||
entrance.orientation == EnumFacing.WEST || entrance.orientation == EnumFacing.WEST ||
@ -117,6 +111,7 @@ public class TileEntityEntranceRiftRenderer extends TileEntitySpecialRenderer<Ti
entrance.extendLeft + entrance.extendRight, entrance.extendLeft + entrance.extendRight,
entrance.extendDown + entrance.extendUp, entrance.extendDown + entrance.extendUp,
getColors(entrance)); getColors(entrance));
if (entrance.lockStatus >= 1) { if (entrance.lockStatus >= 1) {
for (int i = 0; i < 1 + entrance.lockStatus; i++) { for (int i = 0; i < 1 + entrance.lockStatus; i++) {
renderKeyHole(entrance, x, y, z, i); renderKeyHole(entrance, x, y, z, i);
@ -124,4 +119,3 @@ public class TileEntityEntranceRiftRenderer extends TileEntitySpecialRenderer<Ti
} }
} }
} }
}

View file

@ -11,10 +11,10 @@ import static net.minecraftforge.common.config.Config.*;
@Config(modid = DimDoors.MODID, name = 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 { // TODO: localize the rest public final class ModConfig {
public static General general = new General(); public static General general = new General();
public static Pocket pockets = new Pocket(); public static Pockets pockets = new Pockets();
public static World world = new World(); public static World world = new World();
public static Dungeons dungeons = new Dungeons(); public static Dungeons dungeons = new Dungeons();
public static Monoliths monoliths = new Monoliths(); public static Monoliths monoliths = new Monoliths();
@ -22,104 +22,98 @@ public final class ModConfig { // TODO: localize the rest
public static class General { public static class General {
@Name("baseDimensionID") @Name("baseDimensionID")
@Comment({"Dimension ID of the first Dimensional Doors dimension. Other dimensions will use consecutive IDs.", @LangKey("dimdoors.general.baseDimensionID")
"It is strongly recommendended not to change this value. Only change it if it conflicts with other mods."})
@RequiresWorldRestart @RequiresWorldRestart
public int baseDimensionID = 684; public int baseDimensionID = 684;
@Name("useStatusBar") @Name("useStatusBar")
@Comment("When true, the status bar is used to relay status messages to the player, instead of the chat.") @LangKey("dimdoors.general.useStatusBar")
public boolean useStatusBar = true; public boolean useStatusBar = true;
@Name("closeDoorBehind") @Name("closeDoorBehind")
@Comment("When true, Dimensional Doors will automatically close when the player enters their portal.") @LangKey("dimdoors.general.closeDoorBehind")
public boolean closeDoorBehind = true; public boolean closeDoorBehind = true;
@Name("closeDoorBehind") @Name("teleportOffset")
@Comment("Distance in blocks to teleport the player in front of the dimensional door.") @LangKey("dimdoors.general.teleportOffset")
@RangeDouble(min = 0.5, max = 3) @RangeDouble(min = 0, max = 3)
public double teleportOffset = 1; public double teleportOffset = 0.5;
@Name("riftBoundingBoxInCreative")
@LangKey("dimdoors.general.riftBoundingBoxInCreative")
public boolean riftBoundingBoxInCreative;
} }
public static class Pocket { public static class Pockets {
@Name("A_pocketGridSize") @Name("pocketGridSize")
@Comment("Sets how many chunks apart all pockets in any pocket dimensions should be placed.") @LangKey("dimdoors.pockets.pocketGridSize")
@RangeInt(min = 4) @RangeInt(min = 4)
public int pocketGridSize = 32; public int pocketGridSize = 32;
@Name("B_maxPocketSize") @Name("maxPocketSize")
@Comment({"Sets the maximum size of any pocket. A 'maxPocketSize' of 'x' will allow for pockets up to (x + 1) * (x + 1) chunks.", @LangKey("dimdoors.pockets.maxPocketSize")
"If this is set to any value bigger than 'pocketGridSize / 2', the value of 'pocketGridSize / 2' will be used instead."})
@RangeInt(min = 0) @RangeInt(min = 0)
public int maxPocketSize = 15; public int maxPocketSize = 15;
@Name("C_privatePocketSize") @Name("privatePocketSize")
@Comment({"Sets the minimum size of a newly created Private Pocket.", @LangKey("dimdoors.pockets.privatePocketSize")
"If this is set to any value bigger than 'maxPocketSize', the value of 'maxPocketSize' will be used instead."})
@RangeInt(min = 0, max = 7) @RangeInt(min = 0, max = 7)
public int privatePocketSize = 2; public int privatePocketSize = 2;
@Name("D_publicPocketSize") @Name("publicPocketSize")
@Comment({"Sets the minimum size of a newly created Public Pocket.", @LangKey("dimdoors.pockets.publicPocketSize")
"If this is set to any value bigger than 'privatePocketSize', the value of 'privatePocketSize' will be used instead."})
@RangeInt(min = 0) @RangeInt(min = 0)
public int publicPocketSize = 1; public int publicPocketSize = 1;
@Name("Z_loadAllSchematics") @Name("loadAllSchematics")
@Comment({"When true, all available Pocket Schematics will be loaded on game-start, even if the gridSize and pocketSize ", @LangKey("dimdoors.pockets.loadAllSchematics")
"configuration fields would exclude these schematics from being used in 'naturally generated' pockets.",
"The /pocket command can be used to force-generate these pockets for dungeon building- or testing-purposes."})
public boolean loadAllSchematics = false; public boolean loadAllSchematics = false;
} }
public static class World { public static class World {
@Name("A_clusterGenChance") @Name("clusterGenChance")
@Comment("Sets the chance (out of 1.0) that a cluster of Rift Scars will generate in a given chunk.") @LangKey("dimdoors.world.clusterGenChance")
@RangeDouble(min = 0.0, max = 1.0) @RangeDouble(min = 0.0, max = 1.0)
public double clusterGenChance = 0.0002; public double clusterGenChance = 0.0002;
@Name("A_gatewayGenChance") @Name("gatewayGenChance")
@Comment("Sets the chance (out of 1.0) that a Transient Portal gateway will generate in a given chunk.") @LangKey("dimdoors.world.gatewayGenChance")
@RangeDouble(min = 0.0, max = 1.0) @RangeDouble(min = 0.0, max = 1.0)
public double gatewayGenChance = 0.0015; public double gatewayGenChance = 0.0015;
@Name("B_clusterDimBlacklist") @Name("clusterDimBlacklist")
@Comment({"Dimension Blacklist for the generation of Rift Scar clusters. Add a dimension ID here to prevent generation in certain dimensions.", @LangKey("dimdoors.world.clusterDimBlacklist")
"Default: []"})
public int[] clusterDimBlacklist = {}; public int[] clusterDimBlacklist = {};
@Name("B_gatewayDimBlacklist") @Name("gatewayDimBlacklist")
@Comment({"Dimension Blacklist for the generation of Transient Portal gateways. Add a dimension ID here to prevent generation in certain dimensions.", @LangKey("dimdoors.world.gatewayDimBlacklist")
"Default: []"})
public int[] gatewayDimBlacklist = {}; public int[] gatewayDimBlacklist = {};
} }
public static class Dungeons { public static class Dungeons {
@Name("maxDungeonDepth") @Name("maxDungeonDepth")
@Comment({"The depth at which limbo is located. If a Rift reaches any deeper than this while searching for a new ", @LangKey("dimdoors.dungeons.maxDungeonDepth")
"destination, the player trying to enter the Rift will be sent straight to Limbo."}) @RangeInt(min = 5)
@RangeInt(min = 100) public int maxDungeonDepth = 50;
public int maxDungeonDepth = 2000;
} }
public static class Monoliths { public static class Monoliths {
@Name("dangerousLimboMonoliths") @Name("dangerousLimboMonoliths")
@Comment("When true, Monoliths in Limbo attack the player and deal damage.") @LangKey("dimdoors.monoliths.dangerousLimboMonoliths")
public boolean dangerousLimboMonoliths = false; public boolean dangerousLimboMonoliths = false;
@Name("monolithTeleportation") @Name("monolithTeleportation")
@Comment("When true, being exposed to the gaze of Monoliths for too long, will cause the player to be teleported to the void above Limbo.") @LangKey("dimdoors.monoliths.monolithTeleportation")
public boolean monolithTeleportation = true; public boolean monolithTeleportation = true;
} }
public static class Limbo { public static class Limbo {
@Name("universalLimbo") @Name("universalLimbo")
@Comment({"When true, players are also teleported to Limbo when they die in any non-Pocket Dimension (except Limbo itself).", @LangKey("dimdoors.limbo.universalLimbo")
"Otherwise, players only go to Limbo if they die in a Pocket Dimension."})
public boolean universalLimbo = false; public boolean universalLimbo = false;
@Name("hardcoreLimbo") @Name("hardcoreLimbo")
@Comment("When true, a player dying in Limbo will respawn in Limbo, making Eternal Fluid or Golden Dimensional Doors the only way to escape Limbo.") @LangKey("dimdoors.limbo.hardcoreLimbo")
public boolean hardcoreLimbo = false; public boolean hardcoreLimbo = false;
} }

View file

@ -119,7 +119,9 @@ public abstract class BlockDimensionalDoor extends BlockDoor implements IRiftPro
public TileEntityEntranceRift createNewTileEntity(World world, int meta) { public TileEntityEntranceRift createNewTileEntity(World world, int meta) {
TileEntityEntranceRift rift = new TileEntityEntranceRift(); TileEntityEntranceRift rift = new TileEntityEntranceRift();
rift.orientation = getStateFromMeta(meta).getValue(BlockDoor.FACING).getOpposite(); rift.orientation = getStateFromMeta(meta).getValue(BlockDoor.FACING).getOpposite();
if (DimDoors.proxy.isClient()) {
rift.extendUp += 1; rift.extendUp += 1;
}
return rift; return rift;
} }
@ -132,7 +134,7 @@ public abstract class BlockDimensionalDoor extends BlockDoor implements IRiftPro
if (rift == null) { if (rift == null) {
DimDoors.log.error("Rift tile entity was null when breaking block at " + new Location(world, pos) + ", please report this error."); DimDoors.log.error("Rift tile entity was null when breaking block at " + new Location(world, pos) + ", please report this error.");
} }
if (rift.isPlaceRiftOnBreak() || rift.isRegistered() && RiftRegistry.instance().getSources(new Location(rift.getWorld(), rift.getPos())).size() > 0 && !rift.isAlwaysDelete()) { if (rift.isLeaveScarWhenClosed() || rift.isRegistered() && RiftRegistry.instance().getSources(new Location(rift.getWorld(), rift.getPos())).size() > 0 && !rift.isAlwaysDelete()) {
world.setBlockState(pos, ModBlocks.RIFT.getDefaultState()); world.setBlockState(pos, ModBlocks.RIFT.getDefaultState());
// This isn't run when we change the block from within block break // This isn't run when we change the block from within block break
TileEntityFloatingRift newRift = (TileEntityFloatingRift) world.getTileEntity(pos); TileEntityFloatingRift newRift = (TileEntityFloatingRift) world.getTileEntity(pos);

View file

@ -62,8 +62,10 @@ public class BlockDimensionalPortal extends BlockDimensionalDoor { // TODO: conv
public TileEntityEntranceRift createNewTileEntity(World world, int meta) { public TileEntityEntranceRift createNewTileEntity(World world, int meta) {
TileEntityEntranceRift rift = new TileEntityEntranceRift(); TileEntityEntranceRift rift = new TileEntityEntranceRift();
rift.orientation = getStateFromMeta(meta).getValue(BlockDoor.FACING).getOpposite(); rift.orientation = getStateFromMeta(meta).getValue(BlockDoor.FACING).getOpposite();
if (DimDoors.proxy.isClient()) {
rift.extendUp += 1; rift.extendUp += 1;
rift.pushIn = 0.5; rift.pushIn = 0.5;
}
return rift; return rift;
} }
} }

View file

@ -2,9 +2,12 @@ package org.dimdev.dimdoors.shared.blocks;
import java.util.*; import java.util.*;
import net.minecraft.client.entity.EntityPlayerSP;
import net.minecraft.tileentity.TileEntity; import net.minecraft.tileentity.TileEntity;
import net.minecraft.util.math.AxisAlignedBB;
import org.dimdev.dimdoors.DimDoors; import org.dimdev.dimdoors.DimDoors;
import org.dimdev.dimdoors.client.ParticleRiftEffect; import org.dimdev.dimdoors.client.ParticleRiftEffect;
import org.dimdev.dimdoors.shared.ModConfig;
import org.dimdev.dimdoors.shared.items.ModItems; import org.dimdev.dimdoors.shared.items.ModItems;
import org.dimdev.dimdoors.shared.tileentities.TileEntityFloatingRift; import org.dimdev.dimdoors.shared.tileentities.TileEntityFloatingRift;
import org.dimdev.ddutils.blocks.BlockSpecialAir; import org.dimdev.ddutils.blocks.BlockSpecialAir;
@ -57,8 +60,15 @@ public class BlockFloatingRift extends BlockSpecialAir implements ITileEntityPro
} }
@Override @Override
public boolean onBlockActivated(World world, BlockPos pos, IBlockState state, EntityPlayer player, EnumHand hand, EnumFacing facing, float hitX, float hitY, float hitZ) { @SuppressWarnings("deprecation")
return false; // TODO public AxisAlignedBB getCollisionBoundingBox(IBlockState blockState, IBlockAccess world, BlockPos pos) {
if (ModConfig.general.riftBoundingBoxInCreative) {
EntityPlayer player = DimDoors.proxy.getLocalPlayer();
if (player != null && player.isCreative()) {
return blockState.getBoundingBox(world, pos);
}
}
return null;
} }
@Override @Override

View file

@ -57,16 +57,16 @@ public class PocketTemplate {
} }
} }
public static void replacePlaceholders(Schematic parSchematic) { // TODO: it should be possible to place a schematic without replacing placeholders public static void replacePlaceholders(Schematic schematic) { // TODO: rift inheritance rather than placeholders
// Replace placeholders (some schematics will contain them) // Replace placeholders (some schematics will contain them)
List<NBTTagCompound> tileEntities = new ArrayList<>(); List<NBTTagCompound> tileEntities = new ArrayList<>();
for (NBTTagCompound tileEntityNBT : parSchematic.tileEntities) { for (NBTTagCompound tileEntityNBT : schematic.tileEntities) {
if (tileEntityNBT.hasKey("placeholder")) { if (tileEntityNBT.hasKey("placeholder")) {
int x = tileEntityNBT.getInteger("x"); int x = tileEntityNBT.getInteger("x");
int y = tileEntityNBT.getInteger("y"); int y = tileEntityNBT.getInteger("y");
int z = tileEntityNBT.getInteger("z"); int z = tileEntityNBT.getInteger("z");
IBlockState state = parSchematic.palette.get(parSchematic.blockData[x][y][z]); IBlockState state = schematic.palette.get(schematic.blockData[x][y][z]);
NBTTagCompound newNBT; NBTTagCompound newNBT;
switch (tileEntityNBT.getString("placeholder")) { switch (tileEntityNBT.getString("placeholder")) {
@ -115,11 +115,11 @@ public class PocketTemplate {
tileEntities.add(tileEntityNBT); tileEntities.add(tileEntityNBT);
} }
} }
parSchematic.tileEntities = tileEntities; schematic.tileEntities = tileEntities;
List<NBTTagCompound> entities = new ArrayList<>(); List<NBTTagCompound> entities = new ArrayList<>();
for (NBTTagCompound entitiesNBT : parSchematic.entities) { for (NBTTagCompound entitiesNBT : schematic.entities) {
if (entitiesNBT.hasKey("placeholder")) { if (entitiesNBT.hasKey("placeholder")) {
double x = entitiesNBT.getDouble("x"); double x = entitiesNBT.getDouble("x");
double y = entitiesNBT.getDouble("y"); double y = entitiesNBT.getDouble("y");
@ -143,7 +143,7 @@ public class PocketTemplate {
entities.add(entitiesNBT); entities.add(entitiesNBT);
} }
} }
parSchematic.entities = entities; schematic.entities = entities;
} }
public void place(Pocket pocket) { public void place(Pocket pocket) {
@ -241,7 +241,7 @@ public class PocketTemplate {
if (linkProperties != null) rift.setProperties(linkProperties); if (linkProperties != null) rift.setProperties(linkProperties);
rift.setDestination(rift.getProperties() == null || !rift.getProperties().oneWay ? linkTo : null); rift.setDestination(rift.getProperties() == null || !rift.getProperties().oneWay ? linkTo : null);
if (rift instanceof TileEntityEntranceRift && !rift.isAlwaysDelete()) { if (rift instanceof TileEntityEntranceRift && !rift.isAlwaysDelete()) {
((TileEntityEntranceRift) rift).setPlaceRiftOnBreak(true); // We modified the door's state ((TileEntityEntranceRift) rift).setLeaveScarWhenClosed(true); // We modified the door's state
} }
} }
} }

View file

@ -7,7 +7,6 @@ import net.minecraft.nbt.NBTTagCompound;
import net.minecraft.network.NetworkManager; import net.minecraft.network.NetworkManager;
import net.minecraft.network.play.server.SPacketUpdateTileEntity; import net.minecraft.network.play.server.SPacketUpdateTileEntity;
import net.minecraft.tileentity.TileEntity; import net.minecraft.tileentity.TileEntity;
import net.minecraft.util.ITickable;
import net.minecraftforge.common.DimensionManager; import net.minecraftforge.common.DimensionManager;
import net.minecraftforge.fml.relauncher.Side; import net.minecraftforge.fml.relauncher.Side;
import net.minecraftforge.fml.relauncher.SideOnly; import net.minecraftforge.fml.relauncher.SideOnly;
@ -23,7 +22,7 @@ import org.dimdev.dimdoors.shared.rifts.registry.RiftRegistry;
import javax.annotation.Nonnull; import javax.annotation.Nonnull;
@NBTSerializable public abstract class TileEntityRift extends TileEntity implements ITickable { // TODO: implement ITeleportSource and ITeleportDestination @NBTSerializable public abstract class TileEntityRift extends TileEntity { // TODO: implement ITeleportSource and ITeleportDestination
/*@Saved*/ @Nonnull @Getter protected RiftDestination destination; // How the rift acts as a source /*@Saved*/ @Nonnull @Getter protected RiftDestination destination; // How the rift acts as a source
@Saved @Getter protected LinkProperties properties; // How the rift acts as a target, and properties that affect how it can link to other rifts @Saved @Getter protected LinkProperties properties; // How the rift acts as a target, and properties that affect how it can link to other rifts

View file

@ -5,6 +5,8 @@ import net.minecraft.entity.EntityLiving;
import net.minecraft.util.math.BlockPos; import net.minecraft.util.math.BlockPos;
import net.minecraft.util.math.Vec3d; import net.minecraft.util.math.Vec3d;
import net.minecraft.world.World; import net.minecraft.world.World;
import net.minecraftforge.fml.relauncher.Side;
import net.minecraftforge.fml.relauncher.SideOnly;
import org.dimdev.ddutils.WorldUtils; import org.dimdev.ddutils.WorldUtils;
import org.dimdev.ddutils.nbt.NBTUtils; import org.dimdev.ddutils.nbt.NBTUtils;
import org.dimdev.annotatednbt.Saved; import org.dimdev.annotatednbt.Saved;
@ -20,20 +22,20 @@ import net.minecraft.util.EnumFacing;
import java.util.Random; import java.util.Random;
// TODO: merge horizontal and vertical entrances' render code into one, and support custom sizes
@NBTSerializable public class TileEntityEntranceRift extends TileEntityRift { @NBTSerializable public class TileEntityEntranceRift extends TileEntityRift {
@Saved @Getter /*package-private*/ boolean placeRiftOnBreak = false; @Saved @Getter protected boolean leaveScarWhenClosed = false;
@Saved @Getter /*package-private*/ boolean closeAfterPassThrough = false; @Saved @Getter protected boolean closeAfterPassThrough = false; // TODO: doesn't make sense lore-wise for doors, split into separate tile entity
@Saved @Getter public boolean shouldRender = true;
@Saved @Getter public byte lockStatus = 0;
// Set by the block TODO: get rid of these, calculate client-side! // Set by the block on tile entity creation, can't get from the block, it's not necessarily a door
@Saved public EnumFacing orientation; public EnumFacing orientation;
@Saved public double extendUp = 0.5; // Use += to set these.
@Saved public double extendDown = 0.5; // Render info, use += to change these on block tile entity creation
@Saved public double extendLeft = 0.5; @SideOnly(Side.CLIENT) public double extendUp = 0.5;
@Saved public double extendRight = 0.5; @SideOnly(Side.CLIENT) public double extendDown = 0.5;
@Saved public double pushIn = 0.01; @SideOnly(Side.CLIENT) public double extendLeft = 0.5;
@SideOnly(Side.CLIENT) public double extendRight = 0.5;
@SideOnly(Side.CLIENT) public double pushIn = 0.01;
@SideOnly(Side.CLIENT) public byte lockStatus = 0; // TODO
@Override @Override
public void copyFrom(TileEntityRift oldRift) { public void copyFrom(TileEntityRift oldRift) {
@ -42,22 +44,13 @@ import java.util.Random;
TileEntityEntranceRift oldEntranceRift = (TileEntityEntranceRift) oldRift; TileEntityEntranceRift oldEntranceRift = (TileEntityEntranceRift) oldRift;
closeAfterPassThrough = oldEntranceRift.closeAfterPassThrough; closeAfterPassThrough = oldEntranceRift.closeAfterPassThrough;
} }
placeRiftOnBreak = true; leaveScarWhenClosed = true;
} }
@Override public void readFromNBT(NBTTagCompound nbt) { super.readFromNBT(nbt); NBTUtils.readFromNBT(this, nbt); } @Override public void readFromNBT(NBTTagCompound nbt) { super.readFromNBT(nbt); NBTUtils.readFromNBT(this, nbt); }
@Override public NBTTagCompound writeToNBT(NBTTagCompound nbt) { @Override public NBTTagCompound writeToNBT(NBTTagCompound nbt) { nbt = super.writeToNBT(nbt); return NBTUtils.writeToNBT(this, nbt); }
nbt = super.writeToNBT(nbt);
return NBTUtils.writeToNBT(this, nbt);
}
@Override public void setLeaveScarWhenClosed(boolean leaveScarWhenClosed) { this.leaveScarWhenClosed = leaveScarWhenClosed; markDirty(); }
public void update() {
}
public void setPlaceRiftOnBreak(boolean placeRiftOnBreak) { this.placeRiftOnBreak = placeRiftOnBreak; markDirty(); }
public void setShouldRender(boolean shouldRender) { this.shouldRender = shouldRender; markDirty(); }
public void setLockStatus(byte lockStatus) { this.lockStatus = lockStatus; markDirty(); } public void setLockStatus(byte lockStatus) { this.lockStatus = lockStatus; markDirty(); }
public void setCloseAfterPassThrough(boolean closeAfterPassThrough) { this.closeAfterPassThrough = closeAfterPassThrough; markDirty(); } public void setCloseAfterPassThrough(boolean closeAfterPassThrough) { this.closeAfterPassThrough = closeAfterPassThrough; markDirty(); }
@ -65,7 +58,7 @@ import java.util.Random;
public boolean teleport(Entity entity) { public boolean teleport(Entity entity) {
boolean status = super.teleport(entity); boolean status = super.teleport(entity);
if (riftStateChanged && !alwaysDelete) { if (riftStateChanged && !alwaysDelete) {
placeRiftOnBreak = true; leaveScarWhenClosed = true;
markDirty(); markDirty();
} }
return status; return status;
@ -73,7 +66,7 @@ import java.util.Random;
@Override @Override
public void teleportTo(Entity entity, float fromYaw, float fromPitch) { // TODO: teleportOffset for all rifts instead? public void teleportTo(Entity entity, float fromYaw, float fromPitch) { // TODO: teleportOffset for all rifts instead?
Vec3d targetPos = new Vec3d(pos).addVector(0.5, 0, 0.5).add(new Vec3d(orientation.getDirectionVec()).scale(ModConfig.general.teleportOffset)); Vec3d targetPos = new Vec3d(pos).addVector(0.5, 0, 0.5).add(new Vec3d(orientation.getDirectionVec()).scale(ModConfig.general.teleportOffset + 0.5));
if (relativeRotation) { if (relativeRotation) {
float yaw = getDestinationYaw(entity.rotationYaw) + entity.rotationYaw - fromYaw; float yaw = getDestinationYaw(entity.rotationYaw) + entity.rotationYaw - fromYaw;
float pitch = entity instanceof EntityLiving ? entity.rotationPitch : getDestinationPitch(entity.rotationPitch) + entity.rotationPitch - fromPitch; float pitch = entity instanceof EntityLiving ? entity.rotationPitch : getDestinationPitch(entity.rotationPitch) + entity.rotationPitch - fromPitch;
@ -86,7 +79,7 @@ import java.util.Random;
@Override @Override
public void teleportTo(Entity entity) { public void teleportTo(Entity entity) {
Vec3d targetPos = new Vec3d(pos).add(new Vec3d(orientation.getDirectionVec()).scale(ModConfig.general.teleportOffset)); Vec3d targetPos = new Vec3d(pos).add(new Vec3d(orientation.getDirectionVec()).scale(ModConfig.general.teleportOffset + 0.5));
TeleportUtils.teleport(entity, WorldUtils.getDim(world), targetPos.x, targetPos.y, targetPos.z, orientation.getHorizontalAngle(), 0); TeleportUtils.teleport(entity, WorldUtils.getDim(world), targetPos.x, targetPos.y, targetPos.z, orientation.getHorizontalAngle(), 0);
} }
@ -130,11 +123,13 @@ import java.util.Random;
return orientation.getOpposite().getFrontOffsetY() * 90; return orientation.getOpposite().getFrontOffsetY() * 90;
} }
@Override public float getDestinationYaw(float entityYaw) { @Override
public float getDestinationYaw(float entityYaw) {
return orientation.getHorizontalAngle(); return orientation.getHorizontalAngle();
} }
@Override public float getDestinationPitch(float entityPitch) { @Override
public float getDestinationPitch(float entityPitch) {
return 0; return 0;
} }
} }

View file

@ -156,7 +156,7 @@ public final class SchematicGenerator {
.build()); .build());
rift.setProperties(link); rift.setProperties(link);
rift.setPlaceRiftOnBreak(true); rift.setLeaveScarWhenClosed(true);
NBTTagCompound tileNBT = rift.serializeNBT(); NBTTagCompound tileNBT = rift.serializeNBT();
tileNBT.setInteger("x", (size - 1) / 2); tileNBT.setInteger("x", (size - 1) / 2);
tileNBT.setInteger("y", 5); tileNBT.setInteger("y", 5);

View file

@ -12,9 +12,9 @@ import org.dimdev.ddutils.nbt.NBTUtils;
@NBTSerializable public class Pocket implements INBTStorable { @NBTSerializable public class Pocket implements INBTStorable {
@Saved @Getter protected int id; @Saved @Getter protected int id;
@Saved @Getter protected int x; // Grid x TODO: rename to gridX and gridY, or just convert to non-grid dependant coordinates @Saved @Getter protected int x; // Grid x TODO: convert to non-grid dependant coordinates
@Saved @Getter protected int z; // Grid y @Saved @Getter protected int z; // Grid y
@Saved @Getter @Setter protected int size; // TODO: size = sizeInChunks - 1 ???!!! TODO: non chunk-based size, better bounds such as minX, minZ, maxX, maxZ, etc. @Saved @Getter @Setter protected int size; // TODO: non chunk-based size, better bounds such as minX, minZ, maxX, maxZ, etc.
@Saved @Getter @Setter protected VirtualLocation virtualLocation; @Saved @Getter @Setter protected VirtualLocation virtualLocation;
@Getter int dim; // Not saved @Getter int dim; // Not saved

View file

@ -141,15 +141,55 @@ dimdoors.general=General Options
dimdoors.general.tooltip=General configuration options for the mod dimdoors.general.tooltip=General configuration options for the mod
dimdoors.general.baseDimensionID=Base Dimension ID 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.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=Status Bar Messages
dimdoors.general.useStatusBar.comment=Whether to use the status bar to send messages rather than the chat. dimdoors.general.useStatusBar.tooltip=Whether to use the status bar to send messages rather than the chat.
dimdoors.general.closeDoorBehind=Close Door Behind
dimdoors.general.closeDoorBehind.tooltip=When true, Dimensional Doors will automatically close when the player enters their portal.
dimdoors.general.teleportOffset=Teleport Offset
dimdoors.general.teleportOffset.tooltip=Distance in blocks to teleport the player in front of the dimensional door.
dimdoors.general.riftBoundingBoxInCreative=Rift Bounding Box in Creative
dimdoors.general.riftBoundingBoxInCreative.tooltip=When true, shows the bounding boxes of floating rifts when the player is in creative.
dimdoors.pockets=Pocket Dimension Options dimdoors.pockets=Pocket Dimension Options
dimdoors.pockets.tooltip=Options that determine the spacing and maximum size of pockets in the pocket world dimdoors.pockets.tooltip=Options that determine the spacing and maximum size of pockets in the pocket world
dimdoors.world=Worldgen Options dimdoors.pockets.pocketGridSize=Pocket Grid Size
dimdoors.pockets.pocketGridSize.tooltip=Sets how many chunks apart all pockets in any pocket dimensions should be placed.
dimdoors.pockets.maxPocketSize=Maximum Pocket Size
dimdoors.pockets.maxPocketSize.tooltip=Sets the maximum size of any pocket. A size of x will allow for pockets up to (x + 1) * (x + 1) chunks. If this is set to any value bigger than pocketGridSize / 2, the value of pocketGridSize / 2 will be used instead.
dimdoors.pockets.privatePocketSize=Private Pocket Size
dimdoors.pockets.privatePocketSize.tooltip=Sets the minimum size of a newly created Private Pocket. If this is set to any value bigger than maxPocketSize, the value of maxPocketSize will be used instead.
dimdoors.pockets.publicPocketSize=Public Pocket Size
dimdoors.pockets.publicPocketSize.tooltip=Sets the minimum size of a newly created Public Pocket. If this is set to any value bigger than privatePocketSize, the value of privatePocketSize will be used instead.
dimdoors.pockets.loadAllSchematics=Load All Schematics
dimdoors.pockets.loadAllSchematics.tooltip= When true, all available Pocket Schematics will be loaded on game-start, even if the gridSize and pocketSize configuration fields would exclude these schematics from being used in 'naturally generated' pockets. The /pocket command can be used to force-generate these pockets for dungeon building or testing purposes.
dimdoors.world=World Generation Options
dimdoors.world.tooltip=Options that determine where dimensional gateways and rift clusters can be generated and at what frequency dimdoors.world.tooltip=Options that determine where dimensional gateways and rift clusters can be generated and at what frequency
dimdoors.world.clusterGenChance=Cluster Generation Chance
dimdoors.world.clusterGenChance.tooltip=Sets the chance (out of 1.0) that a cluster of Rift Scars will generate in a given chunk.
dimdoors.world.gatewayGenChance=Gateway generation chance
dimdoors.world.gatewayGenChance.tooltip=Sets the chance (out of 1.0) that a Transient Portal gateway will generate in a given chunk.
dimdoors.world.clusterDimBlacklist=Cluster Dimension Blacklist
dimdoors.world.clusterDimBlacklist.tooltip=Dimension Blacklist for the generation of Rift Scar clusters. Add a dimension ID here to prevent generation in certain dimensions.
dimdoors.world.gatewayDimBlacklist=Gateway Dimension Blacklist
dimdoors.world.gatewayDimBlacklist.tooltip=Dimension Blacklist for the generation of Transient Portal gateways. Add a dimension ID here to prevent generation in certain dimensions.
dimdoors.dungeons=Dungeon Options dimdoors.dungeons=Dungeon Options
dimdoors.dungeons.tooltip=Options that affect the generation of pocket dungeons dimdoors.dungeons.tooltip=Options that affect the generation of pocket dungeons
dimdoors.dungeons.maxDungeonDepth.tooltip=Maximum Dungeon Depth
dimdoors.dungeons.maxDungeonDepth.tooltip=The depth at which limbo is located. If a Rift reaches any deeper than this while searching for a new destination, the player trying to enter the Rift will be sent straight to Limbo.
dimdoors.monoliths=Monolith Options dimdoors.monoliths=Monolith Options
dimdoors.monoliths.tooltip=Options that determine how dangerous monoliths are dimdoors.monoliths.tooltip=Options that determine how dangerous monoliths are
dimdoors.monoliths.dangerousLimboMonoliths=Dangerous Limbo Monoliths
dimdoors.monoliths.dangerousLimboMonoliths.tooltip=When true, Monoliths in Limbo attack the player and deal damage.
dimdoors.monoliths.monolithTeleportation=Monolith Teleportation
dimdoors.monoliths.monolithTeleportation.tooltip=When true, being exposed to the gaze of Monoliths for too long, will cause the player to be teleported to the void above Limbo.
dimdoors.limbo=Limbo Options dimdoors.limbo=Limbo Options
dimdoors.limbo.tooltip=Options that control various aspects of the Limbo dimension dimdoors.limbo.tooltip=Options that control various aspects of the Limbo dimension
dimdoors.limbo.universalLimbo=Universal Limbo
dimdoors.limbo.universalLimbo.tooltip=When true, players are also teleported to Limbo when they die in any non-Pocket Dimension (except Limbo itself). Otherwise, players only go to Limbo if they die in a Pocket Dimension.
dimdoors.limbo.hardcoreLimbo=Hardcore Limbo
dimdoors.limbo.hardcoreLimbo.tooltip=When true, a player dying in Limbo will respawn in Limbo, making Eternal Fluid or Golden Dimensional Doors the only way to escape Limbo.

Binary file not shown.

After

Width:  |  Height:  |  Size: 2.3 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 3.2 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 16 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 16 KiB