A few fixes
This commit is contained in:
parent
00e02bd7ea
commit
de53f20420
5 changed files with 7 additions and 30 deletions
build.gradle
src/main/java/com/zixiken/dimdoors/shared
|
@ -34,7 +34,7 @@ compileJava {
|
|||
minecraft {
|
||||
version = "1.12.2-14.23.1.2555"
|
||||
runDir = "run"
|
||||
mappings = "snapshot_20171216"
|
||||
mappings = "snapshot_20171007"
|
||||
replace '${version}', project.version
|
||||
//replace '${spongeSchematicVersion}', spongeSchematicVersion
|
||||
// makeObfSourceJar = false // an Srg named sources jar is made by default. uncomment this to disable.
|
||||
|
|
|
@ -53,7 +53,6 @@ public class VirtualLocation { // TODO: use BlockPos/Location
|
|||
return nbt;
|
||||
}
|
||||
|
||||
// TODO: move to VirtualLocation
|
||||
public static VirtualLocation fromLocation(Location location) { // TODO: reverse function too
|
||||
VirtualLocation virtualLocation = null;
|
||||
if (DimDoorDimensions.isPocketDimension(location.getDim())) {
|
||||
|
|
|
@ -117,32 +117,7 @@ public abstract class BlockDimensionalDoor extends BlockDoor implements IRiftPro
|
|||
@Override
|
||||
public void onBlockAdded(World worldIn, BlockPos pos, IBlockState state) {
|
||||
super.onBlockAdded(worldIn, pos, state);
|
||||
if (hasTileEntity(state) && !DimDoors.disableRiftSetup) { // TODO: better check for disableRiftSetup (support other plugins such as WorldEdit, support doors being placed while schematics are being placed)
|
||||
TileEntityEntranceRift rift = createNewTileEntity(worldIn, getMetaFromState(state));
|
||||
|
||||
// Set the virtual location based on where the door was placed
|
||||
VirtualLocation virtualLocation = null;
|
||||
if (DimDoorDimensions.isPocketDimension(WorldUtils.getDim(worldIn))) {
|
||||
Pocket pocket = PocketRegistry.getForDim(WorldUtils.getDim(worldIn)).getPocketFromLocation(pos.getY(), pos.getY(), pos.getZ());
|
||||
if (pocket != null) {
|
||||
virtualLocation = pocket.getVirtualLocation();
|
||||
} else {
|
||||
virtualLocation = new VirtualLocation(0, 0, 0, 0, 0); // TODO: door was placed in a pocket dim but outside of a pocket...
|
||||
}
|
||||
}
|
||||
if (virtualLocation == null) {
|
||||
virtualLocation = new VirtualLocation(WorldUtils.getDim(worldIn), pos.getX(), pos.getY(), pos.getZ(), 0);
|
||||
}
|
||||
rift.setVirtualLocation(virtualLocation);
|
||||
|
||||
// Configure the rift to its default functionality
|
||||
setupRift(rift);
|
||||
|
||||
// Set the tile entity and register it
|
||||
worldIn.setTileEntity(pos, rift);
|
||||
rift.markDirty();
|
||||
rift.register();
|
||||
}
|
||||
handleRiftPlaced(worldIn, pos, state);
|
||||
}
|
||||
|
||||
@Override
|
||||
|
|
|
@ -26,6 +26,7 @@ public class BlockDimensionalDoorPersonal extends BlockDimensionalDoor {
|
|||
|
||||
@Override
|
||||
public void setupRift(TileEntityEntranceRift rift) {
|
||||
DimDoors.log.info("Setting up the rift!");
|
||||
RiftDestination.PrivateDestination destination = RiftDestination.PrivateDestination.builder().build();
|
||||
rift.setSingleDestination(destination);
|
||||
rift.setChaosWeight(0);
|
||||
|
|
|
@ -6,8 +6,10 @@ import com.zixiken.dimdoors.shared.rifts.TileEntityRift;
|
|||
import ddutils.Location;
|
||||
import net.minecraft.block.ITileEntityProvider;
|
||||
import net.minecraft.block.state.IBlockState;
|
||||
import net.minecraft.tileentity.TileEntity;
|
||||
import net.minecraft.util.math.BlockPos;
|
||||
import net.minecraft.world.World;
|
||||
import net.minecraft.world.chunk.Chunk;
|
||||
|
||||
public interface IRiftProvider<T extends TileEntityRift> extends ITileEntityProvider {
|
||||
|
||||
|
@ -21,11 +23,11 @@ public interface IRiftProvider<T extends TileEntityRift> extends ITileEntityProv
|
|||
public T createNewTileEntity(World world, int meta);
|
||||
|
||||
public default void handleRiftPlaced(World world, BlockPos pos, IBlockState state) {
|
||||
if (hasTileEntity(state) && !DimDoors.disableRiftSetup) { // TODO: better check for disableRiftSetup (support other plugins such as WorldEdit, support doors being placed while schematics are being placed)
|
||||
if (hasTileEntity(state) && !DimDoors.disableRiftSetup) {
|
||||
T rift = createNewTileEntity(world, state.getBlock().getMetaFromState(state));
|
||||
|
||||
// Set the rift's virtual position
|
||||
rift.setVirtualLocation(VirtualLocation.fromLocation(new Location(rift.getWorld(), rift.getPos())));
|
||||
rift.setVirtualLocation(VirtualLocation.fromLocation(new Location(world, pos)));
|
||||
|
||||
// Configure the rift to its default functionality
|
||||
setupRift(rift);
|
||||
|
|
Loading…
Add table
Reference in a new issue