Some schematic fixes
This commit is contained in:
parent
2a5774d477
commit
43c606c687
10 changed files with 65 additions and 97 deletions
|
@ -224,7 +224,7 @@ public class MazeBuilder
|
||||||
extBlockStorage = new ExtendedBlockStorage(cY << 4, !world.provider.hasNoSky);
|
extBlockStorage = new ExtendedBlockStorage(cY << 4, !world.provider.hasNoSky);
|
||||||
chunk.getBlockStorageArray()[cY] = extBlockStorage;
|
chunk.getBlockStorageArray()[cY] = extBlockStorage;
|
||||||
}
|
}
|
||||||
extBlockStorage.setExtBlockID(localX, y & 15, localZ, block);
|
extBlockStorage.func_150818_a(localX, y & 15, localZ, block);
|
||||||
extBlockStorage.setExtBlockMetadata(localX, y & 15, localZ, metadata);
|
extBlockStorage.setExtBlockMetadata(localX, y & 15, localZ, metadata);
|
||||||
chunk.setChunkModified();
|
chunk.setChunkModified();
|
||||||
}
|
}
|
||||||
|
|
|
@ -9,6 +9,8 @@ import java.util.Map;
|
||||||
import java.util.Map.Entry;
|
import java.util.Map.Entry;
|
||||||
import java.util.Random;
|
import java.util.Random;
|
||||||
import java.util.TreeMap;
|
import java.util.TreeMap;
|
||||||
|
|
||||||
|
import StevenDimDoors.mod_pocketDim.mod_pocketDim;
|
||||||
import net.minecraft.block.Block;
|
import net.minecraft.block.Block;
|
||||||
import net.minecraft.entity.Entity;
|
import net.minecraft.entity.Entity;
|
||||||
import net.minecraft.init.Blocks;
|
import net.minecraft.init.Blocks;
|
||||||
|
@ -37,15 +39,6 @@ import StevenDimDoors.mod_pocketDim.util.Point4D;
|
||||||
|
|
||||||
public class DungeonSchematic extends Schematic {
|
public class DungeonSchematic extends Schematic {
|
||||||
|
|
||||||
private static final short MAX_VANILLA_BLOCK_ID = 173;
|
|
||||||
private static final short STANDARD_FABRIC_OF_REALITY_ID = 1973;
|
|
||||||
private static final short STANDARD_ETERNAL_FABRIC_ID = 220;
|
|
||||||
private static final short STANDARD_WARP_DOOR_ID = 1975;
|
|
||||||
private static final short STANDARD_DIMENSIONAL_DOOR_ID = 1970;
|
|
||||||
private static final short STANDARD_TRANSIENT_DOOR_ID = 1979;
|
|
||||||
|
|
||||||
private static final short MONOLITH_SPAWN_MARKER_ID = (short) Block.endPortalFrame.blockID;
|
|
||||||
private static final short EXIT_DOOR_MARKER_ID = (short) Block.sandStone.blockID;
|
|
||||||
private static final int NETHER_DIMENSION_ID = -1;
|
private static final int NETHER_DIMENSION_ID = -1;
|
||||||
|
|
||||||
private int orientation;
|
private int orientation;
|
||||||
|
@ -53,18 +46,17 @@ public class DungeonSchematic extends Schematic {
|
||||||
private ArrayList<Point3D> exitDoorLocations;
|
private ArrayList<Point3D> exitDoorLocations;
|
||||||
private ArrayList<Point3D> dimensionalDoorLocations;
|
private ArrayList<Point3D> dimensionalDoorLocations;
|
||||||
private ArrayList<Point3D> monolithSpawnLocations;
|
private ArrayList<Point3D> monolithSpawnLocations;
|
||||||
|
private ArrayList<Block> modBlockFilterExceptions;
|
||||||
private static final short[] MOD_BLOCK_FILTER_EXCEPTIONS = new short[] {
|
|
||||||
STANDARD_FABRIC_OF_REALITY_ID,
|
|
||||||
STANDARD_ETERNAL_FABRIC_ID,
|
|
||||||
STANDARD_WARP_DOOR_ID,
|
|
||||||
STANDARD_DIMENSIONAL_DOOR_ID,
|
|
||||||
STANDARD_TRANSIENT_DOOR_ID
|
|
||||||
};
|
|
||||||
|
|
||||||
private DungeonSchematic(Schematic source)
|
private DungeonSchematic(Schematic source)
|
||||||
{
|
{
|
||||||
super(source);
|
super(source);
|
||||||
|
modBlockFilterExceptions = new ArrayList<Block>(5);
|
||||||
|
modBlockFilterExceptions.add(mod_pocketDim.blockDimWall);
|
||||||
|
modBlockFilterExceptions.add(mod_pocketDim.blockDimWallPerm);
|
||||||
|
modBlockFilterExceptions.add(mod_pocketDim.warpDoor);
|
||||||
|
modBlockFilterExceptions.add(mod_pocketDim.dimensionalDoor);
|
||||||
|
modBlockFilterExceptions.add(mod_pocketDim.transientDoor);
|
||||||
}
|
}
|
||||||
|
|
||||||
public int getOrientation()
|
public int getOrientation()
|
||||||
|
@ -109,8 +101,8 @@ public class DungeonSchematic extends Schematic {
|
||||||
public void applyImportFilters(DDProperties properties)
|
public void applyImportFilters(DDProperties properties)
|
||||||
{
|
{
|
||||||
//Search for special blocks (warp doors, dim doors, and end portal frames that mark Monolith spawn points)
|
//Search for special blocks (warp doors, dim doors, and end portal frames that mark Monolith spawn points)
|
||||||
SpecialBlockFinder finder = new SpecialBlockFinder(STANDARD_WARP_DOOR_ID, STANDARD_DIMENSIONAL_DOOR_ID,
|
SpecialBlockFinder finder = new SpecialBlockFinder(mod_pocketDim.warpDoor, mod_pocketDim.dimensionalDoor,
|
||||||
MONOLITH_SPAWN_MARKER_ID, EXIT_DOOR_MARKER_ID);
|
Blocks.end_portal_frame, Blocks.sandstone);
|
||||||
applyFilter(finder);
|
applyFilter(finder);
|
||||||
|
|
||||||
//Flip the entrance's orientation to get the dungeon's orientation
|
//Flip the entrance's orientation to get the dungeon's orientation
|
||||||
|
@ -123,19 +115,10 @@ public class DungeonSchematic extends Schematic {
|
||||||
|
|
||||||
//Filter out mod blocks except some of our own
|
//Filter out mod blocks except some of our own
|
||||||
CompoundFilter standardizer = new CompoundFilter();
|
CompoundFilter standardizer = new CompoundFilter();
|
||||||
standardizer.addFilter(new ModBlockFilter(MAX_VANILLA_BLOCK_ID, MOD_BLOCK_FILTER_EXCEPTIONS,
|
standardizer.addFilter(new ModBlockFilter(modBlockFilterExceptions,
|
||||||
(short) properties.FabricBlockID, (byte) 0));
|
mod_pocketDim.blockDimWall, (byte) 0));
|
||||||
|
|
||||||
//Also convert standard DD block IDs to local versions
|
//Also convert standard DD block IDs to local versions
|
||||||
Map<Short, Short> mapping = getAssignedToStandardIDMapping(properties);
|
|
||||||
|
|
||||||
for (Entry<Short, Short> entry : mapping.entrySet())
|
|
||||||
{
|
|
||||||
if (entry.getKey() != entry.getValue())
|
|
||||||
{
|
|
||||||
standardizer.addFilter(new ReplacementFilter(entry.getValue(), entry.getKey()));
|
|
||||||
}
|
|
||||||
}
|
|
||||||
applyFilter(standardizer);
|
applyFilter(standardizer);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -144,36 +127,15 @@ public class DungeonSchematic extends Schematic {
|
||||||
//Check if some block IDs assigned by Forge differ from our standard IDs
|
//Check if some block IDs assigned by Forge differ from our standard IDs
|
||||||
//If so, change the IDs to standard values
|
//If so, change the IDs to standard values
|
||||||
CompoundFilter standardizer = new CompoundFilter();
|
CompoundFilter standardizer = new CompoundFilter();
|
||||||
Map<Short, Short> mapping = getAssignedToStandardIDMapping(properties);
|
|
||||||
|
|
||||||
for (Entry<Short, Short> entry : mapping.entrySet())
|
|
||||||
{
|
|
||||||
if (entry.getKey() != entry.getValue())
|
|
||||||
{
|
|
||||||
standardizer.addFilter(new ReplacementFilter(entry.getKey(), entry.getValue()));
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
//Filter out mod blocks except some of our own
|
//Filter out mod blocks except some of our own
|
||||||
//This comes after ID standardization because the mod block filter relies on standardized IDs
|
//This comes after ID standardization because the mod block filter relies on standardized IDs
|
||||||
standardizer.addFilter(new ModBlockFilter(MAX_VANILLA_BLOCK_ID, MOD_BLOCK_FILTER_EXCEPTIONS,
|
standardizer.addFilter(new ModBlockFilter(modBlockFilterExceptions,
|
||||||
STANDARD_FABRIC_OF_REALITY_ID, (byte) 0));
|
mod_pocketDim.blockDimWall, (byte) 0));
|
||||||
|
|
||||||
applyFilter(standardizer);
|
applyFilter(standardizer);
|
||||||
}
|
}
|
||||||
|
|
||||||
private static Map<Short, Short> getAssignedToStandardIDMapping(DDProperties properties)
|
|
||||||
{
|
|
||||||
//If we ever need this broadly or support other mods, this should be moved to a separate class
|
|
||||||
TreeMap<Short, Short> mapping = new TreeMap<Short, Short>();
|
|
||||||
mapping.put((short) properties.FabricBlockID, STANDARD_FABRIC_OF_REALITY_ID);
|
|
||||||
mapping.put((short) properties.PermaFabricBlockID, STANDARD_ETERNAL_FABRIC_ID);
|
|
||||||
mapping.put((short) properties.WarpDoorID, STANDARD_WARP_DOOR_ID);
|
|
||||||
mapping.put((short) properties.DimensionalDoorID, STANDARD_DIMENSIONAL_DOOR_ID);
|
|
||||||
mapping.put((short) properties.TransientDoorID, STANDARD_TRANSIENT_DOOR_ID);
|
|
||||||
return mapping;
|
|
||||||
}
|
|
||||||
|
|
||||||
public static DungeonSchematic copyFromWorld(World world, int x, int y, int z, short width, short height, short length, boolean doCompactBounds)
|
public static DungeonSchematic copyFromWorld(World world, int x, int y, int z, short width, short height, short length, boolean doCompactBounds)
|
||||||
{
|
{
|
||||||
return new DungeonSchematic(Schematic.copyFromWorld(world, x, y, z, width, height, length, doCompactBounds));
|
return new DungeonSchematic(Schematic.copyFromWorld(world, x, y, z, width, height, length, doCompactBounds));
|
||||||
|
|
|
@ -3,33 +3,33 @@ package StevenDimDoors.mod_pocketDim.dungeon;
|
||||||
import net.minecraft.block.Block;
|
import net.minecraft.block.Block;
|
||||||
import StevenDimDoors.mod_pocketDim.schematic.SchematicFilter;
|
import StevenDimDoors.mod_pocketDim.schematic.SchematicFilter;
|
||||||
|
|
||||||
|
import java.util.List;
|
||||||
|
|
||||||
public class ModBlockFilter extends SchematicFilter {
|
public class ModBlockFilter extends SchematicFilter {
|
||||||
|
|
||||||
private short maxVanillaBlockID;
|
private List<Block> exceptions;
|
||||||
private short[] exceptions;
|
|
||||||
private Block replacementBlock;
|
private Block replacementBlock;
|
||||||
private byte replacementMetadata;
|
private byte replacementMetadata;
|
||||||
|
|
||||||
public ModBlockFilter(short maxVanillaBlockID, short[] exceptions, Block replacementBlock, byte replacementMetadata)
|
public ModBlockFilter(List<Block> exceptions, Block replacementBlock, byte replacementMetadata)
|
||||||
{
|
{
|
||||||
super("ModBlockFilter");
|
super("ModBlockFilter");
|
||||||
this.maxVanillaBlockID = maxVanillaBlockID;
|
|
||||||
this.exceptions = exceptions;
|
this.exceptions = exceptions;
|
||||||
this.replacementBlock = replacementBlock;
|
this.replacementBlock = replacementBlock;
|
||||||
this.replacementMetadata = replacementMetadata;
|
this.replacementMetadata = replacementMetadata;
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
protected boolean applyToBlock(int index, short[] blocks, byte[] metadata)
|
protected boolean applyToBlock(int index, Block[] blocks, byte[] metadata)
|
||||||
{
|
{
|
||||||
int k;
|
int k;
|
||||||
short currentID = blocks[index];
|
Block current = blocks[index];
|
||||||
if (currentID > maxVanillaBlockID || (currentID != 0 && Block.blocksList[currentID] == null))
|
if (!Block.blockRegistry.getNameForObject(current).startsWith("minecraft:"))
|
||||||
{
|
{
|
||||||
//This might be a mod block. Check if an exception exists.
|
//This might be a mod block. Check if an exception exists.
|
||||||
for (k = 0; k < exceptions.length; k++)
|
for (k = 0; k < exceptions.size(); k++)
|
||||||
{
|
{
|
||||||
if (currentID == exceptions[k])
|
if (current == exceptions.get(k))
|
||||||
{
|
{
|
||||||
//Exception found, not considered a mod block
|
//Exception found, not considered a mod block
|
||||||
return false;
|
return false;
|
||||||
|
|
|
@ -5,13 +5,14 @@ import java.util.ArrayList;
|
||||||
import StevenDimDoors.mod_pocketDim.Point3D;
|
import StevenDimDoors.mod_pocketDim.Point3D;
|
||||||
import StevenDimDoors.mod_pocketDim.schematic.Schematic;
|
import StevenDimDoors.mod_pocketDim.schematic.Schematic;
|
||||||
import StevenDimDoors.mod_pocketDim.schematic.SchematicFilter;
|
import StevenDimDoors.mod_pocketDim.schematic.SchematicFilter;
|
||||||
|
import net.minecraft.block.Block;
|
||||||
|
|
||||||
public class SpecialBlockFinder extends SchematicFilter {
|
public class SpecialBlockFinder extends SchematicFilter {
|
||||||
|
|
||||||
private short warpDoorID;
|
private Block warpDoor;
|
||||||
private short dimensionalDoorID;
|
private Block dimensionalDoor;
|
||||||
private short monolithSpawnMarkerID;
|
private Block monolithSpawnMarker;
|
||||||
private short exitMarkerID;
|
private Block exitMarker;
|
||||||
private int entranceOrientation;
|
private int entranceOrientation;
|
||||||
private Schematic schematic;
|
private Schematic schematic;
|
||||||
private Point3D entranceDoorLocation;
|
private Point3D entranceDoorLocation;
|
||||||
|
@ -19,13 +20,13 @@ public class SpecialBlockFinder extends SchematicFilter {
|
||||||
private ArrayList<Point3D> dimensionalDoorLocations;
|
private ArrayList<Point3D> dimensionalDoorLocations;
|
||||||
private ArrayList<Point3D> monolithSpawnLocations;
|
private ArrayList<Point3D> monolithSpawnLocations;
|
||||||
|
|
||||||
public SpecialBlockFinder(short warpDoorID, short dimensionalDoorID, short monolithSpawnMarkerID, short exitMarkerID)
|
public SpecialBlockFinder(Block warpDoor, Block dimensionalDoor, Block monolithSpawn, Block exitDoor)
|
||||||
{
|
{
|
||||||
super("SpecialBlockFinder");
|
super("SpecialBlockFinder");
|
||||||
this.warpDoorID = warpDoorID;
|
this.warpDoor = warpDoor;
|
||||||
this.dimensionalDoorID = dimensionalDoorID;
|
this.dimensionalDoor = dimensionalDoor;
|
||||||
this.monolithSpawnMarkerID = monolithSpawnMarkerID;
|
this.monolithSpawnMarker = monolithSpawn;
|
||||||
this.exitMarkerID = exitMarkerID;
|
this.exitMarker = exitDoor;
|
||||||
this.entranceDoorLocation = null;
|
this.entranceDoorLocation = null;
|
||||||
this.entranceOrientation = 0;
|
this.entranceOrientation = 0;
|
||||||
this.exitDoorLocations = new ArrayList<Point3D>();
|
this.exitDoorLocations = new ArrayList<Point3D>();
|
||||||
|
@ -55,27 +56,27 @@ public class SpecialBlockFinder extends SchematicFilter {
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
protected boolean initialize(Schematic schematic, short[] blocks, byte[] metadata)
|
protected boolean initialize(Schematic schematic, Block[] blocks, byte[] metadata)
|
||||||
{
|
{
|
||||||
this.schematic = schematic;
|
this.schematic = schematic;
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
protected boolean applyToBlock(int index, short[] blocks, byte[] metadata)
|
protected boolean applyToBlock(int index, Block[] blocks, byte[] metadata)
|
||||||
{
|
{
|
||||||
int indexBelow;
|
int indexBelow;
|
||||||
int indexDoubleBelow;
|
int indexDoubleBelow;
|
||||||
|
|
||||||
if (blocks[index] == monolithSpawnMarkerID)
|
if (blocks[index] == monolithSpawnMarker)
|
||||||
{
|
{
|
||||||
monolithSpawnLocations.add(schematic.calculatePoint(index));
|
monolithSpawnLocations.add(schematic.calculatePoint(index));
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
if (blocks[index] == dimensionalDoorID)
|
if (blocks[index] == dimensionalDoor)
|
||||||
{
|
{
|
||||||
indexBelow = schematic.calculateIndexBelow(index);
|
indexBelow = schematic.calculateIndexBelow(index);
|
||||||
if (indexBelow >= 0 && blocks[indexBelow] == dimensionalDoorID)
|
if (indexBelow >= 0 && blocks[indexBelow] == dimensionalDoor)
|
||||||
{
|
{
|
||||||
dimensionalDoorLocations.add(schematic.calculatePoint(index));
|
dimensionalDoorLocations.add(schematic.calculatePoint(index));
|
||||||
return true;
|
return true;
|
||||||
|
@ -85,13 +86,13 @@ public class SpecialBlockFinder extends SchematicFilter {
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if (blocks[index] == warpDoorID)
|
if (blocks[index] == warpDoor)
|
||||||
{
|
{
|
||||||
indexBelow = schematic.calculateIndexBelow(index);
|
indexBelow = schematic.calculateIndexBelow(index);
|
||||||
if (indexBelow >= 0 && blocks[indexBelow] == warpDoorID)
|
if (indexBelow >= 0 && blocks[indexBelow] == warpDoor)
|
||||||
{
|
{
|
||||||
indexDoubleBelow = schematic.calculateIndexBelow(indexBelow);
|
indexDoubleBelow = schematic.calculateIndexBelow(indexBelow);
|
||||||
if (indexDoubleBelow >= 0 && blocks[indexDoubleBelow] == exitMarkerID)
|
if (indexDoubleBelow >= 0 && blocks[indexDoubleBelow] == exitMarker)
|
||||||
{
|
{
|
||||||
exitDoorLocations.add(schematic.calculatePoint(index));
|
exitDoorLocations.add(schematic.calculatePoint(index));
|
||||||
return true;
|
return true;
|
||||||
|
|
|
@ -39,7 +39,7 @@ public class ChunkBlockSetter implements IBlockSetter
|
||||||
extBlockStorage = new ExtendedBlockStorage(cY << 4, !world.provider.hasNoSky);
|
extBlockStorage = new ExtendedBlockStorage(cY << 4, !world.provider.hasNoSky);
|
||||||
chunk.getBlockStorageArray()[cY] = extBlockStorage;
|
chunk.getBlockStorageArray()[cY] = extBlockStorage;
|
||||||
}
|
}
|
||||||
extBlockStorage.setExtBlockID(localX, y & 15, localZ, block);
|
extBlockStorage.func_150818_a(localX, y & 15, localZ, block);
|
||||||
extBlockStorage.setExtBlockMetadata(localX, y & 15, localZ, metadata);
|
extBlockStorage.setExtBlockMetadata(localX, y & 15, localZ, metadata);
|
||||||
chunk.setChunkModified();
|
chunk.setChunkModified();
|
||||||
}
|
}
|
||||||
|
|
|
@ -1,5 +1,7 @@
|
||||||
package StevenDimDoors.mod_pocketDim.schematic;
|
package StevenDimDoors.mod_pocketDim.schematic;
|
||||||
|
|
||||||
|
import net.minecraft.block.Block;
|
||||||
|
|
||||||
import java.util.ArrayList;
|
import java.util.ArrayList;
|
||||||
|
|
||||||
public class CompoundFilter extends SchematicFilter {
|
public class CompoundFilter extends SchematicFilter {
|
||||||
|
@ -18,7 +20,7 @@ public class CompoundFilter extends SchematicFilter {
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
protected boolean initialize(Schematic schematic, short[] blocks, byte[] metadata)
|
protected boolean initialize(Schematic schematic,Block[] blocks, byte[] metadata)
|
||||||
{
|
{
|
||||||
for (SchematicFilter filter : filters)
|
for (SchematicFilter filter : filters)
|
||||||
{
|
{
|
||||||
|
@ -44,7 +46,7 @@ public class CompoundFilter extends SchematicFilter {
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
protected boolean applyToBlock(int index, short[] blocks, byte[] metadata)
|
protected boolean applyToBlock(int index, Block[] blocks, byte[] metadata)
|
||||||
{
|
{
|
||||||
for (SchematicFilter filter : filters)
|
for (SchematicFilter filter : filters)
|
||||||
{
|
{
|
||||||
|
|
|
@ -400,7 +400,7 @@ public class Schematic {
|
||||||
count = tileEntities.tagCount();
|
count = tileEntities.tagCount();
|
||||||
for (index = 0; index < count; index++)
|
for (index = 0; index < count; index++)
|
||||||
{
|
{
|
||||||
NBTTagCompound tileTag = (NBTTagCompound) tileEntities.tagAt(index);
|
NBTTagCompound tileTag = (NBTTagCompound) tileEntities.getCompoundTagAt(index);
|
||||||
//Rewrite its location to be in world coordinates
|
//Rewrite its location to be in world coordinates
|
||||||
dx = tileTag.getInteger("x") + x;
|
dx = tileTag.getInteger("x") + x;
|
||||||
dy = tileTag.getInteger("y") + y;
|
dy = tileTag.getInteger("y") + y;
|
||||||
|
@ -409,7 +409,7 @@ public class Schematic {
|
||||||
tileTag.setInteger("y", dy);
|
tileTag.setInteger("y", dy);
|
||||||
tileTag.setInteger("z", dz);
|
tileTag.setInteger("z", dz);
|
||||||
//Load the tile entity and put it in the world
|
//Load the tile entity and put it in the world
|
||||||
world.setBlockTileEntity(dx, dy, dz, TileEntity.createAndLoadEntity(tileTag));
|
world.setTileEntity(dx, dy, dz, TileEntity.createAndLoadEntity(tileTag));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -1,5 +1,7 @@
|
||||||
package StevenDimDoors.mod_pocketDim.schematic;
|
package StevenDimDoors.mod_pocketDim.schematic;
|
||||||
|
|
||||||
|
import net.minecraft.block.Block;
|
||||||
|
|
||||||
public class SchematicFilter {
|
public class SchematicFilter {
|
||||||
|
|
||||||
private String name;
|
private String name;
|
||||||
|
@ -14,7 +16,7 @@ public class SchematicFilter {
|
||||||
return name;
|
return name;
|
||||||
}
|
}
|
||||||
|
|
||||||
public boolean apply(Schematic schematic, short[] blocks, byte[] metadata)
|
public boolean apply(Schematic schematic, Block[] blocks, byte[] metadata)
|
||||||
{
|
{
|
||||||
if (!initialize(schematic, blocks, metadata))
|
if (!initialize(schematic, blocks, metadata))
|
||||||
return false;
|
return false;
|
||||||
|
@ -28,12 +30,12 @@ public class SchematicFilter {
|
||||||
return finish();
|
return finish();
|
||||||
}
|
}
|
||||||
|
|
||||||
protected boolean initialize(Schematic schematic, short[] blocks, byte[] metadata)
|
protected boolean initialize(Schematic schematic, Block[] blocks, byte[] metadata)
|
||||||
{
|
{
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
protected boolean applyToBlock(int index, short[] blocks, byte[] metadata)
|
protected boolean applyToBlock(int index, Block[] blocks, byte[] metadata)
|
||||||
{
|
{
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
|
@ -1,5 +1,6 @@
|
||||||
package StevenDimDoors.mod_pocketDim.schematic;
|
package StevenDimDoors.mod_pocketDim.schematic;
|
||||||
|
|
||||||
|
import net.minecraft.block.Block;
|
||||||
import net.minecraft.nbt.NBTTagCompound;
|
import net.minecraft.nbt.NBTTagCompound;
|
||||||
import net.minecraft.nbt.NBTTagList;
|
import net.minecraft.nbt.NBTTagList;
|
||||||
import net.minecraft.tileentity.TileEntity;
|
import net.minecraft.tileentity.TileEntity;
|
||||||
|
@ -11,14 +12,14 @@ public class WorldCopyOperation extends WorldOperation
|
||||||
private int originY;
|
private int originY;
|
||||||
private int originZ;
|
private int originZ;
|
||||||
private int index;
|
private int index;
|
||||||
private short[] blockIDs;
|
private Block[] blocks;
|
||||||
private byte[] metadata;
|
private byte[] metadata;
|
||||||
private NBTTagList tileEntities;
|
private NBTTagList tileEntities;
|
||||||
|
|
||||||
public WorldCopyOperation()
|
public WorldCopyOperation()
|
||||||
{
|
{
|
||||||
super("WorldCopyOperation");
|
super("WorldCopyOperation");
|
||||||
blockIDs = null;
|
blocks = null;
|
||||||
metadata = null;
|
metadata = null;
|
||||||
tileEntities = null;
|
tileEntities = null;
|
||||||
}
|
}
|
||||||
|
@ -30,7 +31,7 @@ public class WorldCopyOperation extends WorldOperation
|
||||||
originX = x;
|
originX = x;
|
||||||
originY = y;
|
originY = y;
|
||||||
originZ = z;
|
originZ = z;
|
||||||
blockIDs = new short[width * height * length];
|
blocks = new Block[width * height * length];
|
||||||
metadata = new byte[width * height * length];
|
metadata = new byte[width * height * length];
|
||||||
tileEntities = new NBTTagList();
|
tileEntities = new NBTTagList();
|
||||||
return true;
|
return true;
|
||||||
|
@ -39,7 +40,7 @@ public class WorldCopyOperation extends WorldOperation
|
||||||
@Override
|
@Override
|
||||||
protected boolean applyToBlock(World world, int x, int y, int z)
|
protected boolean applyToBlock(World world, int x, int y, int z)
|
||||||
{
|
{
|
||||||
blockIDs[index] = (short) world.getBlockId(x, y, z);
|
blocks[index] = world.getBlock(x, y, z);
|
||||||
metadata[index] = (byte) world.getBlockMetadata(x, y, z);
|
metadata[index] = (byte) world.getBlockMetadata(x, y, z);
|
||||||
|
|
||||||
TileEntity tileEntity = world.getTileEntity(x, y, z);
|
TileEntity tileEntity = world.getTileEntity(x, y, z);
|
||||||
|
@ -59,9 +60,9 @@ public class WorldCopyOperation extends WorldOperation
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
public short[] getBlockIDs()
|
public Block[] getBlocks()
|
||||||
{
|
{
|
||||||
return blockIDs;
|
return blocks;
|
||||||
}
|
}
|
||||||
|
|
||||||
public byte[] getMetadata()
|
public byte[] getMetadata()
|
||||||
|
|
|
@ -547,7 +547,7 @@ public class PocketBuilder
|
||||||
extBlockStorage = new ExtendedBlockStorage(cY << 4, !world.provider.hasNoSky);
|
extBlockStorage = new ExtendedBlockStorage(cY << 4, !world.provider.hasNoSky);
|
||||||
chunk.getBlockStorageArray()[cY] = extBlockStorage;
|
chunk.getBlockStorageArray()[cY] = extBlockStorage;
|
||||||
}
|
}
|
||||||
extBlockStorage.setExtBlockID(localX, y & 15, localZ, block);
|
extBlockStorage.func_150818_a(localX, y & 15, localZ, block);
|
||||||
extBlockStorage.setExtBlockMetadata(localX, y & 15, localZ, metadata);
|
extBlockStorage.setExtBlockMetadata(localX, y & 15, localZ, metadata);
|
||||||
chunk.setChunkModified();
|
chunk.setChunkModified();
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue