One Spatial Dimension (#4570)
* Ported the "one spatial dimension" concept from pre-1.15 * Apply lighting updates after moving chunks. Mark world data as dirty when changing it. * Consolidated naming of spatial storage world/dimension. Use server light manager to update lighting info in chunk. * Save last transition information, and add ae2 spatial command to interact with spatial storage. * Formatting fixes. * Improved docs for the origin generation. Inverted condition on when the x/z axis are flipped. Also added a helper to map a plot to a region file * Remove TransitionResult since it's only used in lieu of a boolean. Rework transition to make the checks BEFORE allocating a new cell. * Removed unused imports. Co-authored-by: yueh <yueh@users.noreply.github.com>
This commit is contained in:
@@ -1,38 +0,0 @@
|
||||
/*
|
||||
* The MIT License (MIT)
|
||||
*
|
||||
* Copyright (c) 2013 AlgorithmX2
|
||||
*
|
||||
* Permission is hereby granted, free of charge, to any person obtaining a copy of
|
||||
* this software and associated documentation files (the "Software"), to deal in
|
||||
* the Software without restriction, including without limitation the rights to
|
||||
* use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of
|
||||
* the Software, and to permit persons to whom the Software is furnished to do so,
|
||||
* subject to the following conditions:
|
||||
*
|
||||
* The above copyright notice and this permission notice shall be included in all
|
||||
* copies or substantial portions of the Software.
|
||||
*
|
||||
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS
|
||||
* FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR
|
||||
* COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER
|
||||
* IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
|
||||
* CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
||||
*/
|
||||
|
||||
package appeng.api.implementations;
|
||||
|
||||
/**
|
||||
* Defines the result of performing a transition from the world into a storage
|
||||
* cell, if its possible, and what the energy usage is.
|
||||
*/
|
||||
public class TransitionResult {
|
||||
public final boolean success;
|
||||
public final double energyUsage;
|
||||
|
||||
public TransitionResult(final boolean success, final double power) {
|
||||
this.success = success;
|
||||
this.energyUsage = power;
|
||||
}
|
||||
}
|
||||
@@ -25,11 +25,8 @@ package appeng.api.implementations.items;
|
||||
|
||||
import net.minecraft.item.Item;
|
||||
import net.minecraft.item.ItemStack;
|
||||
import net.minecraft.util.RegistryKey;
|
||||
import net.minecraft.world.World;
|
||||
import net.minecraft.world.server.ServerWorld;
|
||||
|
||||
import appeng.api.implementations.TransitionResult;
|
||||
import appeng.api.util.WorldCoord;
|
||||
|
||||
/**
|
||||
@@ -52,13 +49,13 @@ public interface ISpatialStorageCell {
|
||||
int getMaxStoredDim(ItemStack is);
|
||||
|
||||
/**
|
||||
* get the currently stored Dimension id.
|
||||
* get the currently stored spatial storage plot id.
|
||||
*
|
||||
* @param is spatial storage cell
|
||||
*
|
||||
* @return dimension id or -1
|
||||
* @return plot id or -1
|
||||
*/
|
||||
RegistryKey<World> getStoredDimension(ItemStack is);
|
||||
int getAllocatedPlotId(ItemStack is);
|
||||
|
||||
/**
|
||||
* Perform a spatial swap with the contents of the cell, and the world.
|
||||
@@ -69,7 +66,7 @@ public interface ISpatialStorageCell {
|
||||
* @param max max coord
|
||||
* @param playerId owner of current grid or -1
|
||||
*
|
||||
* @return result of transition
|
||||
* @return success of transition
|
||||
*/
|
||||
TransitionResult doSpatialTransition(ItemStack is, ServerWorld w, WorldCoord min, WorldCoord max, int playerId);
|
||||
boolean doSpatialTransition(ItemStack is, ServerWorld w, WorldCoord min, WorldCoord max, int playerId);
|
||||
}
|
||||
@@ -1,51 +0,0 @@
|
||||
/*
|
||||
* This file is part of Applied Energistics 2.
|
||||
* Copyright (c) 2013 - 2017, AlgorithmX2, All rights reserved.
|
||||
*
|
||||
* Applied Energistics 2 is free software: you can redistribute it and/or modify
|
||||
* it under the terms of the GNU Lesser General Public License as published by
|
||||
* the Free Software Foundation, either version 3 of the License, or
|
||||
* (at your option) any later version.
|
||||
*
|
||||
* Applied Energistics 2 is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU Lesser General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU Lesser General Public License
|
||||
* along with Applied Energistics 2. If not, see <http://www.gnu.org/licenses/lgpl>.
|
||||
*/
|
||||
|
||||
package appeng.api.storage;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
import javax.annotation.Nullable;
|
||||
|
||||
import net.minecraft.util.RegistryKey;
|
||||
import net.minecraft.util.math.BlockPos;
|
||||
import net.minecraft.util.text.ITextComponent;
|
||||
import net.minecraft.world.World;
|
||||
import net.minecraft.world.server.ServerWorld;
|
||||
|
||||
public interface ISpatialDimension {
|
||||
ServerWorld getWorld(RegistryKey<World> cellDim);
|
||||
|
||||
@Nullable
|
||||
RegistryKey<World> createNewCellDimension(BlockPos capacity);
|
||||
|
||||
void deleteCellDimension(RegistryKey<World> cellDim);
|
||||
|
||||
boolean isCellDimension(RegistryKey<World> cellDim);
|
||||
|
||||
BlockPos getCellDimensionOrigin(RegistryKey<World> cellDim);
|
||||
|
||||
BlockPos getCellDimensionSize(RegistryKey<World> cellDim);
|
||||
|
||||
/**
|
||||
* Adds a user-facing tooltip that describes this dimension so that a player can
|
||||
* keep storage cells apart.
|
||||
*/
|
||||
void addCellDimensionTooltip(RegistryKey<World> cellDim, List<ITextComponent> lines);
|
||||
|
||||
}
|
||||
Reference in New Issue
Block a user