05-02-2014, 03:53 PM
Hello again!
When I previously said that tile entities were working, I said it because they didn't crash the sim anymore and comparators appeared to be working. However though there was still a bug, so I'll explain the timeline taking off from my last post. That bug is that there were tileEntities getting duplicated when going to the sim and back.
First, comparators work, hoppers don't, why? They weren't loaded properly, I loaded them in the chunk and in the world. So it disregarded my imported tileEntities and created new ones when they were updated. I noticed they would be put into world by chunk, so I removed the part of putting them into the world.
Then, when debugging I noticed no tile entities were sent back at all. I commented out the tickEntities of World, which would remove tileEntities is they were invalid. Same result still. At this time I was at a pause and needed some time to think, whilst also casually reading through the ins and outs of the minecraft code, after which I stumbled upon onChunkLoad. So then I called it when loading it in my own ChunkProvider class.
After doing so, still got the same effect. I noticed that Chunk would just store TileEntities in a chunkTileEntityMap and a few things can do wrong. Instead, I just run onChunkLoad right after instancing.
Now, I believe that the tileEntities that are loaded, are loaded in properly, that because TileEntities don't duplicate anymore. However, not all of them are loaded, as you can see here in this simple hopper clock:
Going into the Sim
Coming back from the Sim:
As you may notice, the item disappears from into the hoppers. So that's the next problem to tackle. Anyway, some progress has been made, so just wanted to let that know for the ones following this.
When I previously said that tile entities were working, I said it because they didn't crash the sim anymore and comparators appeared to be working. However though there was still a bug, so I'll explain the timeline taking off from my last post. That bug is that there were tileEntities getting duplicated when going to the sim and back.
First, comparators work, hoppers don't, why? They weren't loaded properly, I loaded them in the chunk and in the world. So it disregarded my imported tileEntities and created new ones when they were updated. I noticed they would be put into world by chunk, so I removed the part of putting them into the world.
Then, when debugging I noticed no tile entities were sent back at all. I commented out the tickEntities of World, which would remove tileEntities is they were invalid. Same result still. At this time I was at a pause and needed some time to think, whilst also casually reading through the ins and outs of the minecraft code, after which I stumbled upon onChunkLoad. So then I called it when loading it in my own ChunkProvider class.
After doing so, still got the same effect. I noticed that Chunk would just store TileEntities in a chunkTileEntityMap and a few things can do wrong. Instead, I just run onChunkLoad right after instancing.
Now, I believe that the tileEntities that are loaded, are loaded in properly, that because TileEntities don't duplicate anymore. However, not all of them are loaded, as you can see here in this simple hopper clock:
Going into the Sim
Code:
TAG_Compound("Schematic"): 9 entries
{
TAG_Short("Height"): 3
TAG_Short("Length"): 2
TAG_Short("Width"): 3
TAG_List("Entities"): 0 entries of type TAG_Byte
}
TAG_List("TileEntities"): 4 entries of type TAG_Compound
TAG_Compound: 5 entries
{
TAG_String("id"): Comparator
TAG_Int("OutputSignal"): 1
TAG_Int("x"): 1
TAG_Int("y"): 1
TAG_Int("z"): 1
}
TAG_Compound: 6 entries
{
TAG_List("Items"): 1 entries of type TAG_Compound
TAG_Compound: 4 entries
{
TAG_String("id"): minecraft:redstone_torch
TAG_Short("Damage"): 0
TAG_Byte("Count"): 1
TAG_Byte("Slot"): 0
}
}
TAG_String("id"): Hopper
TAG_Int("TransferCooldown"): 6
TAG_Int("x"): 2
TAG_Int("y"): 1
TAG_Int("z"): 1
}
TAG_Compound: 6 entries
{
TAG_List("Items"): 0 entries of type TAG_Byte
}
TAG_String("id"): Hopper
TAG_Int("TransferCooldown"): 6
TAG_Int("x"): 2
TAG_Int("y"): 1
TAG_Int("z"): 0
}
TAG_Compound: 5 entries
{
TAG_String("id"): Comparator
TAG_Int("OutputSignal"): 0
TAG_Int("x"): 1
TAG_Int("y"): 1
TAG_Int("z"): 0
}
}
TAG_String("Materials"): Alpha
TAG_Byte_Array("Data"): [18 bytes]
TAG_Byte_Array("Biomes"): [6 bytes]
TAG_Byte_Array("Blocks"): [18 bytes]
}
Coming back from the Sim:
Code:
TAG_Compound("Schematic"): 7 entries
{
TAG_Short("Height"): 3
TAG_Short("Length"): 2
TAG_Short("Width"): 3
TAG_String("Materials"): Alpha
TAG_Byte_Array("Data"): [18 bytes]
TAG_Byte_Array("Blocks"): [18 bytes]
TAG_List("TileEntities"): 4 entries of type TAG_Compound
TAG_Compound: 5 entries
{
TAG_String("id"): Comparator
TAG_Int("OutputSignal"): 1
TAG_Int("z"): 1
TAG_Int("y"): 1
TAG_Int("x"): 1
}
TAG_Compound: 6 entries
{
TAG_List("Items"): 0 entries of type TAG_End
}
TAG_String("id"): Hopper
TAG_Int("TransferCooldown"): 5
TAG_Int("z"): 1
TAG_Int("y"): 1
TAG_Int("x"): 2
}
TAG_Compound: 6 entries
{
TAG_List("Items"): 0 entries of type TAG_End
}
TAG_String("id"): Hopper
TAG_Int("TransferCooldown"): 5
TAG_Int("z"): 0
TAG_Int("y"): 1
TAG_Int("x"): 2
}
TAG_Compound: 5 entries
{
TAG_String("id"): Comparator
TAG_Int("OutputSignal"): 0
TAG_Int("z"): 0
TAG_Int("y"): 1
TAG_Int("x"): 1
}
}
}
As you may notice, the item disappears from into the hoppers. So that's the next problem to tackle. Anyway, some progress has been made, so just wanted to let that know for the ones following this.