Bug fixes

- Fix crash when monolith spawner is placed
 - Fix client crash when walking on eternal fabric
 - Fix ancient fabric being generated in Limbo rather than eternal fabric
This commit is contained in:
Runemoro 2017-12-31 09:49:47 -05:00
parent 90d86f8e03
commit 0533f2007b
8 changed files with 18 additions and 19 deletions

View file

@ -25,8 +25,6 @@ repositories {
mavenCentral() mavenCentral()
} }
genIntellijRuns {}
minecraft { minecraft {
runDir = "run" runDir = "run"
version = "1.12.2-14.23.1.2555" version = "1.12.2-14.23.1.2555"

View file

@ -1,6 +1,5 @@
package org.dimdev.dimdoors.shared; package org.dimdev.dimdoors.shared;
import org.dimdev.ddutils.nbt.INBTStorable;
import org.dimdev.dimdoors.shared.pockets.Pocket; import org.dimdev.dimdoors.shared.pockets.Pocket;
import org.dimdev.dimdoors.shared.pockets.PocketRegistry; import org.dimdev.dimdoors.shared.pockets.PocketRegistry;
import org.dimdev.ddutils.Location; import org.dimdev.ddutils.Location;
@ -9,14 +8,14 @@ import lombok.AllArgsConstructor;
import lombok.Builder; import lombok.Builder;
import lombok.ToString; import lombok.ToString;
import lombok.Value; import lombok.Value;
import net.minecraft.nbt.NBTTagCompound;
import net.minecraft.util.EnumFacing; import net.minecraft.util.EnumFacing;
import net.minecraft.util.math.BlockPos; import net.minecraft.util.math.BlockPos;
import org.dimdev.dimdoors.shared.world.limbodimension.WorldProviderLimbo;
import java.util.Random; import java.util.Random;
@Value @ToString @AllArgsConstructor @Builder(toBuilder = true) @Value @ToString @AllArgsConstructor @Builder(toBuilder = true)
public class VirtualLocation { // TODO: use BlockPos/Location public class VirtualLocation {
Location location; Location location;
int depth; int depth;
@ -34,7 +33,7 @@ public class VirtualLocation { // TODO: use BlockPos/Location
public int getY() { return location.getY(); } public int getY() { return location.getY(); }
public int getZ() { return location.getZ(); } public int getZ() { return location.getZ(); }
public static VirtualLocation fromLocation(Location location) { // TODO: reverse function too public static VirtualLocation fromLocation(Location location) {
VirtualLocation virtualLocation = null; VirtualLocation virtualLocation = null;
if (DimDoorDimensions.isPocketDimension(location.getDim())) { if (DimDoorDimensions.isPocketDimension(location.getDim())) {
Pocket pocket = PocketRegistry.getForDim(location.getDim()).getPocketAt(location.getPos()); Pocket pocket = PocketRegistry.getForDim(location.getDim()).getPocketAt(location.getPos());
@ -43,6 +42,8 @@ public class VirtualLocation { // TODO: use BlockPos/Location
} else { } else {
virtualLocation = new VirtualLocation(0, 0, 0, 0, 0); // TODO: door was placed in a pocket dim but outside of a pocket... virtualLocation = new VirtualLocation(0, 0, 0, 0, 0); // TODO: door was placed in a pocket dim but outside of a pocket...
} }
} else if (location.getWorld().provider instanceof WorldProviderLimbo) {
virtualLocation = new VirtualLocation(location, DDConfig.getMaxDungeonDepth());
} }
if (virtualLocation == null) { if (virtualLocation == null) {
virtualLocation = new VirtualLocation(location, 0); virtualLocation = new VirtualLocation(location, 0);
@ -50,7 +51,7 @@ public class VirtualLocation { // TODO: use BlockPos/Location
return virtualLocation; return virtualLocation;
} }
// TODO: world-seed based transformations and pocket selections? // TODO: world-seed based transformations and pocket selections
public VirtualLocation transformDepth(int depth) { // TODO: Config option for block ratio between depths (see video of removed features) public VirtualLocation transformDepth(int depth) { // TODO: Config option for block ratio between depths (see video of removed features)
Random random = new Random(); Random random = new Random();
int depthDiff = Math.abs(this.depth - depth); int depthDiff = Math.abs(this.depth - depth);

View file

@ -1,5 +1,6 @@
package org.dimdev.dimdoors.shared.entities; package org.dimdev.dimdoors.shared.entities;
import net.minecraft.block.Block;
import org.dimdev.dimdoors.shared.sound.ModSounds; import org.dimdev.dimdoors.shared.sound.ModSounds;
import org.dimdev.dimdoors.shared.DDConfig; import org.dimdev.dimdoors.shared.DDConfig;
import org.dimdev.ddutils.Location; import org.dimdev.ddutils.Location;
@ -73,7 +74,7 @@ public class EntityMonolith extends EntityFlying implements IMob {
@Override @Override
public AxisAlignedBB getCollisionBoundingBox() { public AxisAlignedBB getCollisionBoundingBox() {
return null; return Block.NULL_AABB; // TODO: Is this right? Why check if it intersects anything if it is?
} }
@Override @Override
@ -275,7 +276,7 @@ public class EntityMonolith extends EntityFlying implements IMob {
if (list.size() > 0) { if (list.size() > 0) {
return false; return false;
} }
} else if (world.provider instanceof WorldProviderPublicPocket) { } else if (world.provider instanceof WorldProviderPublicPocket) { // TODO
if (list.size() > 5 || world.canBlockSeeSky(new BlockPos(posX, posY, posZ))) { if (list.size() > 5 || world.canBlockSeeSky(new BlockPos(posX, posY, posZ))) {
return false; return false;
} }

View file

@ -26,7 +26,7 @@ import java.util.*;
private static final String DATA_NAME = DimDoors.MODID + "_rifts"; private static final String DATA_NAME = DimDoors.MODID + "_rifts";
@Getter private static final int DATA_VERSION = 0; // IMPORTANT: Update this and upgradeRegistry when making changes. @Getter private static final int DATA_VERSION = 0; // IMPORTANT: Update this and upgradeRegistry when making changes.
@SavedToNBT @Getter /*package-private*/ /*final*/ Map<Location, RiftInfo> rifts = new HashMap<>(); // TODO: store relative locations too (better location class supporting relative, etc) @SavedToNBT @Getter /*package-private*/ /*final*/ Map<Location, RiftInfo> rifts = new HashMap<>(); // TODO: convert to a static directed graph, but store links per-world
@SavedToNBT @Getter /*package-private*/ /*final*/ Map<String, Location> privatePocketEntrances = new HashMap<>(); // Player UUID -> last rift used to exit pocket TODO: split into PrivatePocketRiftRegistry subclass @SavedToNBT @Getter /*package-private*/ /*final*/ Map<String, Location> privatePocketEntrances = new HashMap<>(); // Player UUID -> last rift used to exit pocket TODO: split into PrivatePocketRiftRegistry subclass
@SavedToNBT @Getter /*package-private*/ /*final*/ Map<String, List<Location>> privatePocketEntranceLists = new HashMap<>(); // Player UUID -> private pocket entrances TODO: split into PrivatePocketRiftRegistry subclass @SavedToNBT @Getter /*package-private*/ /*final*/ Map<String, List<Location>> privatePocketEntranceLists = new HashMap<>(); // Player UUID -> private pocket entrances TODO: split into PrivatePocketRiftRegistry subclass
@SavedToNBT @Getter /*package-private*/ /*final*/ Map<String, Location> privatePocketExits = new HashMap<>(); // Player UUID -> last rift used to enter pocket @SavedToNBT @Getter /*package-private*/ /*final*/ Map<String, Location> privatePocketExits = new HashMap<>(); // Player UUID -> last rift used to enter pocket
@ -87,7 +87,7 @@ import java.util.*;
} }
public void initNewRegistry() { public void initNewRegistry() {
// TODO // Nothing to do
} }
@Override @Override

View file

@ -264,7 +264,7 @@ public class LimboGenerator implements IChunkGenerator {
ModBlocks.FABRIC.getDefaultState().withProperty(BlockFabric.TYPE, BlockFabric.EnumType.UNRAVELED)); ModBlocks.FABRIC.getDefaultState().withProperty(BlockFabric.TYPE, BlockFabric.EnumType.UNRAVELED));
} else if (yCoord < 6) { } else if (yCoord < 6) {
primer.setBlockState(xCoord, yCoord, zCoord, primer.setBlockState(xCoord, yCoord, zCoord,
ModBlocks.FABRIC.getDefaultState().withProperty(BlockFabric.TYPE, BlockFabric.EnumType.ANCIENT)); ModBlocks.FABRIC.getDefaultState().withProperty(BlockFabric.TYPE, BlockFabric.EnumType.ETERNAL));
} }
} }

View file

@ -37,11 +37,9 @@ public class WorldProviderLimbo extends WorldProvider {
@Override @Override
protected void generateLightBrightnessTable() { protected void generateLightBrightnessTable() {
float modifier = 0.0F; for (int i = 0; i <= 15; ++i) {
float var3 = 1.0F - i / 15.0F;
for (int steps = 0; steps <= 15; ++steps) { lightBrightnessTable[i] = (0.0F + var3) / (var3 * 3.0F + 1.0F) * 1.0F * 3;
float var3 = 1.0F - steps / 15.0F;
lightBrightnessTable[steps] = ((0.0F + var3) / (var3 * 3.0F + 1.0F) * (1.0F - modifier) + modifier) * 3;
} }
} }

View file

@ -21,10 +21,11 @@ public class WorldProviderPersonalPocket extends WorldProviderPocket {
return EnumPocketType.PRIVATE; return EnumPocketType.PRIVATE;
} }
// TODO: disable this to allow dark places in public pockets
@Override @Override
protected void generateLightBrightnessTable() { protected void generateLightBrightnessTable() {
for (int i = 0; i <= 15; ++i) { for (int i = 0; i <= 15; ++i) {
lightBrightnessTable[i] = 15; lightBrightnessTable[i] = 1;
} }
} }