Spatial rework (#3048)

* Moved all spatial cells into a single dimension instead of one dimension per cell

Each cell will now be backed by a single region file each. So  backups and restores can still be done on a per cell level.

Old cells will not be migrated.

* Moved custom cell tracking to a capability based one on the world

The size and owner of a cell is now stored inside the capabilities of the world/dimension not a custom system and we can rely on forge handling the persistence of it.

* Added the cell id to the actual item tooltip, as this is now a real identifier and not an arbitrary dimension id.

* Added vanilla banners to the whitelist

* Added unittests to the dimension manager to ensure the algorithm mapping to the correct region file

* Updated the API to conform with the new dimenion/types/biomes registration and mappings

* Fixed a couple of bugs related to world/dimension/biome registration 

* Fixed a bug when transfering certain blocks due to passing missing/incorrect blockstate
This commit is contained in:
fscan
2017-08-24 11:24:33 +02:00
committed by yueh
parent 1513ba3f6a
commit bbf4d4a9ce
21 changed files with 615 additions and 427 deletions
@@ -19,8 +19,11 @@
package appeng.tile.spatial;
import javax.annotation.Nonnull;
import net.minecraft.item.ItemStack;
import net.minecraft.nbt.NBTTagCompound;
import net.minecraft.util.EnumFacing;
import net.minecraft.world.World;
import net.minecraftforge.items.IItemHandler;
@@ -47,6 +50,7 @@ import appeng.tile.inventory.AppEngInternalInventory;
import appeng.util.IWorldCallable;
import appeng.util.Platform;
import appeng.util.inv.InvOperation;
import appeng.util.inv.WrapperFilteredItemHandler;
import appeng.util.inv.filter.IAEItemFilter;
@@ -54,12 +58,12 @@ public class TileSpatialIOPort extends AENetworkInvTile implements IWorldCallabl
{
private final AppEngInternalInventory inv = new AppEngInternalInventory( this, 2 );
private final IItemHandler invExt = new WrapperFilteredItemHandler( inv, new SpatialIOFilter() );
private YesNo lastRedstoneState = YesNo.UNDECIDED;
public TileSpatialIOPort()
{
this.getProxy().setFlags( GridFlags.REQUIRE_CHANNEL );
this.inv.setFilter( new SpatialIOFilter() );
}
@TileEvent( TileEventType.WORLD_NBT_WRITE )
@@ -143,7 +147,13 @@ public class TileSpatialIOPort extends AENetworkInvTile implements IWorldCallabl
final MENetworkEvent res = gi.postEvent( new MENetworkSpatialEvent( this, req ) );
if( !res.isCanceled() )
{
final TransitionResult tr = sc.doSpatialTransition( cell, this.world, spc.getMin(), spc.getMax(), true );
int playerId = -1;
if( getProxy().getSecurity().isAvailable() )
{
playerId = getProxy().getSecurity().getOwner();
}
final TransitionResult tr = sc.doSpatialTransition( cell, this.world, spc.getMin(), spc.getMax(), playerId );
if( tr.success )
{
energy.extractAEPower( req, Actionable.MODULATE, PowerMultiplier.CONFIG );
@@ -170,6 +180,12 @@ public class TileSpatialIOPort extends AENetworkInvTile implements IWorldCallabl
return new DimensionalCoord( this );
}
@Override
protected @Nonnull IItemHandler getItemHandlerForSide( @Nonnull EnumFacing side )
{
return this.invExt;
}
@Override
public IItemHandler getInternalInventory()
{