Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 6 additions & 0 deletions SubstrateCS/Source/AnvilWorld.cs
Original file line number Diff line number Diff line change
Expand Up @@ -169,6 +169,12 @@ public override void Save ()
}
}

public override void SaveBlocks() {
foreach (KeyValuePair<string, RegionChunkManager> cm in _chunkMgrs) {
cm.Value.Save();
}
}

/// <summary>
/// Gets the <see cref="ChunkCache"/> currently managing chunks in the default dimension.
/// </summary>
Expand Down
17 changes: 15 additions & 2 deletions SubstrateCS/Source/BlockInfo.cs
Original file line number Diff line number Diff line change
Expand Up @@ -184,6 +184,11 @@ public static class BlockType
public const int CARPET = 171;
public const int HARDENED_CLAY = 172;
public const int COAL_BLOCK = 173;
public const int CONCRETE = 251;
public const int CONCRETE_POWDER = 252;
public const int SEA_LANTERN = 169;
public const int STANDING_BANNER = 176;
public const int WALL_BANNER = 177;
}

/// <summary>
Expand Down Expand Up @@ -729,10 +734,13 @@ public bool TestData (int data)
public static BlockInfoEx Dropper;
public static BlockInfo StainedClay;
public static BlockInfo StainedGlassPane;
public static BlockInfo AcaciaWood;
public static BlockInfo HayBlock;
public static BlockInfo Carpet;
public static BlockInfo HardenedClay;
public static BlockInfo CoalBlock;
public static BlockInfoEx StandingBanner;
public static BlockInfoEx WallBanner;

static BlockInfo ()
{
Expand Down Expand Up @@ -906,10 +914,13 @@ static BlockInfo ()
Dropper = (BlockInfoEx)new BlockInfoEx(158, "Dropper").SetTick(10);
StainedClay = new BlockInfo(159, "Stained Clay");
StainedGlassPane = new BlockInfo(160, "Stained Glass Pane").SetOpacity(0);
AcaciaWood = new BlockInfo(162, "Acacia Wood");
HayBlock = new BlockInfo(170, "Hay Block");
Carpet = new BlockInfo(171, "Carpet").SetOpacity(0);
HardenedClay = new BlockInfo(172, "Hardened Clay");
CoalBlock = new BlockInfo(173, "Block of Coal");
WallBanner = new BlockInfoEx(BlockType.WALL_BANNER, "Wall Banner");
StandingBanner = new BlockInfoEx(BlockType.STANDING_BANNER, "Standing Banner");

for (int i = 0; i < MAX_BLOCKS; i++) {
if (_blockTable[i] == null) {
Expand Down Expand Up @@ -951,8 +962,8 @@ static BlockInfo ()
Chest.SetTileEntity("Chest");
Furnace.SetTileEntity("Furnace");
BurningFurnace.SetTileEntity("Furnace");
SignPost.SetTileEntity("Sign");
WallSign.SetTileEntity("Sign");
SignPost.SetTileEntity("minecraft:sign");
WallSign.SetTileEntity("minecraft:sign");
EnchantmentTable.SetTileEntity("EnchantTable");
BrewingStand.SetTileEntity("Cauldron");
EndPortal.SetTileEntity("Airportal");
Expand All @@ -962,6 +973,8 @@ static BlockInfo ()
TrappedChest.SetTileEntity("Chest");
Hopper.SetTileEntity("Hopper");
Dropper.SetTileEntity("Dropper");
StandingBanner.SetTileEntity("minecraft:banner");
WallBanner.SetTileEntity("minecraft:banner");

// Set Data Limits

Expand Down
17 changes: 17 additions & 0 deletions SubstrateCS/Source/BlockManager.cs
Original file line number Diff line number Diff line change
Expand Up @@ -98,6 +98,23 @@ public bool AutoTileTick
set { _autoTileTick = value; }
}

public int ChunkXLog {
get {
return chunkXLog;
}
}
public int ChunkYLog {
get {
return chunkYLog;
}
}

public int ChunkZLog {
get {
return chunkZLog;
}
}

/// <summary>
/// Constructs a new <see cref="BlockManager"/> instance on top of the given <see cref="IChunkManager"/>.
/// </summary>
Expand Down
2 changes: 1 addition & 1 deletion SubstrateCS/Source/Core/BlockLight.cs
Original file line number Diff line number Diff line change
Expand Up @@ -861,7 +861,7 @@ private void TestSkyLight (IBoundedLitBlockCollection chunk, int x1, int y1, int

private IBoundedLitBlockCollection OnResolveNeighbor (int relX, int relY, int relZ)
{
if (ResolveNeighbor != null) {
if (ResolveNeighbor != null && relX >= 0 && relY >= 0 && relZ >= 0) {
IBoundedLitBlockCollection n = ResolveNeighbor(relX, relY, relZ);

if (n == null) {
Expand Down
14 changes: 14 additions & 0 deletions SubstrateCS/Source/Data.cs
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@ public enum WoodType
OAK = 0,
SPRUCE = 1,
BIRCH = 2,
JUNGLE = 3,
}

public enum LeafType
Expand Down Expand Up @@ -217,6 +218,16 @@ public enum WallSignOrientation
SOUTH = 5,
}

public enum StoneType {
STONE = 0,
GRANITE = 1,
POLISHED_GRANITE = 2,
DIORITE = 3,
POLISHED_DORITE = 4,
ANDESITE = 5,
POLISHED_ANDESITE = 6
}

public enum FurnaceOrientation
{
EAST = 2,
Expand Down Expand Up @@ -247,6 +258,8 @@ public enum SlabType
COBBLESTONE = 3,
BRICK = 4,
STONE_BRICK = 5,
NETHER_BRICK = 6,
QUARTZ = 7
}

[Flags]
Expand Down Expand Up @@ -343,6 +356,7 @@ public enum StoneBrickType
NORMAL = 0,
MOSSY = 1,
CRACKED = 2,
CHISELED = 3,
}

public enum HugeMushroomType
Expand Down
24 changes: 15 additions & 9 deletions SubstrateCS/Source/Item.cs
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ public class Item : INbtObject<Item>, ICopyable<Item>
{
private static readonly SchemaNodeCompound _schema = new SchemaNodeCompound("")
{
new SchemaNodeScaler("id", TagType.TAG_SHORT),
new SchemaNodeScaler("id", TagType.TAG_STRING),
new SchemaNodeScaler("Damage", TagType.TAG_SHORT),
new SchemaNodeScaler("Count", TagType.TAG_BYTE),
new SchemaNodeCompound("tag", new SchemaNodeCompound("") {
Expand All @@ -25,7 +25,7 @@ public class Item : INbtObject<Item>, ICopyable<Item>

private TagNodeCompound _source;

private short _id;
private string _id;
private byte _count;
private short _damage;

Expand All @@ -44,10 +44,10 @@ public Item ()
/// Constructs an <see cref="Item"/> instance representing the given item id.
/// </summary>
/// <param name="id">An item id.</param>
public Item (int id)
public Item (string id)
: this()
{
_id = (short)id;
_id = id;
}

#region Properties
Expand All @@ -57,16 +57,22 @@ public Item (int id)
/// </summary>
public ItemInfo Info
{
get { return ItemInfo.ItemTable[_id]; }
get {
ItemInfo itemInfo;
if (ItemInfo.StrTable.TryGetValue(_id, out itemInfo)) {
return itemInfo;
}
return null;
}
}

/// <summary>
/// Gets or sets the current type (id) of the item.
/// </summary>
public int ID
public string ID
{
get { return _id; }
set { _id = (short)value; }
set { _id = value; }
}

/// <summary>
Expand Down Expand Up @@ -149,7 +155,7 @@ public Item LoadTree (TagNode tree)

_enchantments.Clear();

_id = ctree["id"].ToTagShort();
_id = ctree["id"].ToTagString();
_count = ctree["Count"].ToTagByte();
_damage = ctree["Damage"].ToTagShort();

Expand Down Expand Up @@ -183,7 +189,7 @@ public Item LoadTreeSafe (TagNode tree)
public TagNode BuildTree ()
{
TagNodeCompound tree = new TagNodeCompound();
tree["id"] = new TagNodeShort(_id);
tree["id"] = new TagNodeString(_id);
tree["Count"] = new TagNodeByte(_count);
tree["Damage"] = new TagNodeShort(_damage);

Expand Down
Loading