Fix some undo/redo tile entity issues
This commit is contained in:
parent
9f8a0456e3
commit
84fa07eec9
@ -162,7 +162,7 @@ public abstract class FaweChangeSet implements ChangeSet {
|
|||||||
if (to.hasNbtData()) {
|
if (to.hasNbtData()) {
|
||||||
CompoundTag nbt = to.getNbtData();
|
CompoundTag nbt = to.getNbtData();
|
||||||
MainUtil.setPosition(nbt, x, y, z);
|
MainUtil.setPosition(nbt, x, y, z);
|
||||||
addTileRemove(nbt);
|
addTileCreate(nbt);
|
||||||
}
|
}
|
||||||
int combinedFrom = (from.getId() << 4) + from.getData();
|
int combinedFrom = (from.getId() << 4) + from.getData();
|
||||||
int combinedTo = (to.getId() << 4) + to.getData();
|
int combinedTo = (to.getId() << 4) + to.getData();
|
||||||
@ -182,7 +182,7 @@ public abstract class FaweChangeSet implements ChangeSet {
|
|||||||
if (to.hasNbtData()) {
|
if (to.hasNbtData()) {
|
||||||
CompoundTag nbt = to.getNbtData();
|
CompoundTag nbt = to.getNbtData();
|
||||||
MainUtil.setPosition(nbt, x, y, z);
|
MainUtil.setPosition(nbt, x, y, z);
|
||||||
addTileRemove(nbt);
|
addTileCreate(nbt);
|
||||||
}
|
}
|
||||||
int combinedTo = (to.getId() << 4) + to.getData();
|
int combinedTo = (to.getId() << 4) + to.getData();
|
||||||
add(x, y, z, combinedFrom, combinedTo);
|
add(x, y, z, combinedFrom, combinedTo);
|
||||||
|
@ -352,6 +352,9 @@ public class ForgeChunk_All extends CharFaweChunk<Chunk, ForgeQueue_All> {
|
|||||||
TileEntity tileEntity = nmsWorld.getTileEntity(pos);
|
TileEntity tileEntity = nmsWorld.getTileEntity(pos);
|
||||||
if (tileEntity != null) {
|
if (tileEntity != null) {
|
||||||
NBTTagCompound tag = (NBTTagCompound) ForgeQueue_All.methodFromNative.invoke(null, nativeTag);
|
NBTTagCompound tag = (NBTTagCompound) ForgeQueue_All.methodFromNative.invoke(null, nativeTag);
|
||||||
|
tag.setInteger("x", pos.getX());
|
||||||
|
tag.setInteger("y", pos.getY());
|
||||||
|
tag.setInteger("z", pos.getZ());
|
||||||
tileEntity.readFromNBT(tag); // ReadTagIntoTile
|
tileEntity.readFromNBT(tag); // ReadTagIntoTile
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -274,7 +274,7 @@ public class ForgeQueue_All extends NMSMappedFaweQueue<World, Chunk, ExtendedBlo
|
|||||||
for (Map.Entry<BlockPos, TileEntity> entry : tiles.entrySet()) {
|
for (Map.Entry<BlockPos, TileEntity> entry : tiles.entrySet()) {
|
||||||
TileEntity tile = entry.getValue();
|
TileEntity tile = entry.getValue();
|
||||||
NBTTagCompound tag = new NBTTagCompound();
|
NBTTagCompound tag = new NBTTagCompound();
|
||||||
tile.readFromNBT(tag); // readTileEntityIntoTag
|
tile.writeToNBT(tag); // readTileEntityIntoTag
|
||||||
BlockPos pos = entry.getKey();
|
BlockPos pos = entry.getKey();
|
||||||
CompoundTag nativeTag = (CompoundTag) methodToNative.invoke(null, tag);
|
CompoundTag nativeTag = (CompoundTag) methodToNative.invoke(null, tag);
|
||||||
previous.setTile(pos.getX(), pos.getY(), pos.getZ(), nativeTag);
|
previous.setTile(pos.getX(), pos.getY(), pos.getZ(), nativeTag);
|
||||||
|
@ -49,7 +49,6 @@ public class ForgePlayer extends AbstractPlayerActor {
|
|||||||
private final EntityPlayerMP player;
|
private final EntityPlayerMP player;
|
||||||
|
|
||||||
protected ForgePlayer(ForgePlatform platform, EntityPlayerMP player) {
|
protected ForgePlayer(ForgePlatform platform, EntityPlayerMP player) {
|
||||||
System.out.println("New forge player!!!!");
|
|
||||||
this.platform = platform;
|
this.platform = platform;
|
||||||
this.player = player;
|
this.player = player;
|
||||||
ThreadSafeCache.getInstance().getOnlineIds().add(getUniqueId());
|
ThreadSafeCache.getInstance().getOnlineIds().add(getUniqueId());
|
||||||
|
@ -366,6 +366,9 @@ public class ForgeChunk_All extends CharFaweChunk<Chunk, ForgeQueue_All> {
|
|||||||
TileEntity tileEntity = nmsWorld.getTileEntity(pos);
|
TileEntity tileEntity = nmsWorld.getTileEntity(pos);
|
||||||
if (tileEntity != null) {
|
if (tileEntity != null) {
|
||||||
NBTTagCompound tag = (NBTTagCompound) ForgeQueue_All.methodFromNative.invoke(null, nativeTag);
|
NBTTagCompound tag = (NBTTagCompound) ForgeQueue_All.methodFromNative.invoke(null, nativeTag);
|
||||||
|
tag.setInteger("x", pos.getX());
|
||||||
|
tag.setInteger("y", pos.getY());
|
||||||
|
tag.setInteger("z", pos.getZ());
|
||||||
tileEntity.readFromNBT(tag); // ReadTagIntoTile
|
tileEntity.readFromNBT(tag); // ReadTagIntoTile
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -274,7 +274,7 @@ public class ForgeQueue_All extends NMSMappedFaweQueue<World, Chunk, ExtendedBlo
|
|||||||
for (Map.Entry<BlockPos, TileEntity> entry : tiles.entrySet()) {
|
for (Map.Entry<BlockPos, TileEntity> entry : tiles.entrySet()) {
|
||||||
TileEntity tile = entry.getValue();
|
TileEntity tile = entry.getValue();
|
||||||
NBTTagCompound tag = new NBTTagCompound();
|
NBTTagCompound tag = new NBTTagCompound();
|
||||||
tile.readFromNBT(tag); // readTileEntityIntoTag
|
tile.writeToNBT(tag); // readTileEntityIntoTag
|
||||||
BlockPos pos = entry.getKey();
|
BlockPos pos = entry.getKey();
|
||||||
CompoundTag nativeTag = (CompoundTag) methodToNative.invoke(null, tag);
|
CompoundTag nativeTag = (CompoundTag) methodToNative.invoke(null, tag);
|
||||||
previous.setTile(pos.getX(), pos.getY(), pos.getZ(), nativeTag);
|
previous.setTile(pos.getX(), pos.getY(), pos.getZ(), nativeTag);
|
||||||
|
@ -323,6 +323,9 @@ public class ForgeChunk_All extends CharFaweChunk<Chunk, ForgeQueue_All> {
|
|||||||
TileEntity tileEntity = nmsWorld.getTileEntity(x, y, z);
|
TileEntity tileEntity = nmsWorld.getTileEntity(x, y, z);
|
||||||
if (tileEntity != null) {
|
if (tileEntity != null) {
|
||||||
NBTTagCompound tag = (NBTTagCompound) ForgeQueue_All.methodFromNative.invoke(null, nativeTag);
|
NBTTagCompound tag = (NBTTagCompound) ForgeQueue_All.methodFromNative.invoke(null, nativeTag);
|
||||||
|
tag.setInteger("x", x);
|
||||||
|
tag.setInteger("y", x);
|
||||||
|
tag.setInteger("z", x);
|
||||||
tileEntity.readFromNBT(tag); // ReadTagIntoTile
|
tileEntity.readFromNBT(tag); // ReadTagIntoTile
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -320,7 +320,7 @@ public class ForgeQueue_All extends NMSMappedFaweQueue<World, Chunk, ExtendedBlo
|
|||||||
for (Map.Entry<ChunkPosition, TileEntity> entry : tiles.entrySet()) {
|
for (Map.Entry<ChunkPosition, TileEntity> entry : tiles.entrySet()) {
|
||||||
TileEntity tile = entry.getValue();
|
TileEntity tile = entry.getValue();
|
||||||
NBTTagCompound tag = new NBTTagCompound();
|
NBTTagCompound tag = new NBTTagCompound();
|
||||||
tile.readFromNBT(tag); // readTileEntityIntoTag
|
tile.writeToNBT(tag); // readTileEntityIntoTag
|
||||||
ChunkPosition pos = entry.getKey();
|
ChunkPosition pos = entry.getKey();
|
||||||
CompoundTag nativeTag = (CompoundTag) methodToNative.invoke(null, tag);
|
CompoundTag nativeTag = (CompoundTag) methodToNative.invoke(null, tag);
|
||||||
previous.setTile(pos.chunkPosX, pos.chunkPosY, pos.chunkPosZ, nativeTag);
|
previous.setTile(pos.chunkPosX, pos.chunkPosY, pos.chunkPosZ, nativeTag);
|
||||||
|
@ -266,6 +266,9 @@ public class ForgeChunk_All extends CharFaweChunk<Chunk, ForgeQueue_All> {
|
|||||||
TileEntity tileEntity = nmsWorld.getTileEntity(pos);
|
TileEntity tileEntity = nmsWorld.getTileEntity(pos);
|
||||||
if (tileEntity != null) {
|
if (tileEntity != null) {
|
||||||
NBTTagCompound tag = (NBTTagCompound) ForgeQueue_All.methodFromNative.invoke(null, nativeTag);
|
NBTTagCompound tag = (NBTTagCompound) ForgeQueue_All.methodFromNative.invoke(null, nativeTag);
|
||||||
|
tag.setInteger("x", pos.getX());
|
||||||
|
tag.setInteger("y", pos.getY());
|
||||||
|
tag.setInteger("z", pos.getZ());
|
||||||
tileEntity.readFromNBT(tag); // ReadTagIntoTile
|
tileEntity.readFromNBT(tag); // ReadTagIntoTile
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -223,7 +223,7 @@ public class ForgeQueue_All extends NMSMappedFaweQueue<World, Chunk, ExtendedBlo
|
|||||||
for (Map.Entry<BlockPos, TileEntity> entry : tiles.entrySet()) {
|
for (Map.Entry<BlockPos, TileEntity> entry : tiles.entrySet()) {
|
||||||
TileEntity tile = entry.getValue();
|
TileEntity tile = entry.getValue();
|
||||||
NBTTagCompound tag = new NBTTagCompound();
|
NBTTagCompound tag = new NBTTagCompound();
|
||||||
tile.readFromNBT(tag); // readTileEntityIntoTag
|
tile.writeToNBT(tag); // readTileEntityIntoTag
|
||||||
BlockPos pos = entry.getKey();
|
BlockPos pos = entry.getKey();
|
||||||
CompoundTag nativeTag = (CompoundTag) methodToNative.invoke(null, tag);
|
CompoundTag nativeTag = (CompoundTag) methodToNative.invoke(null, tag);
|
||||||
previous.setTile(pos.getX(), pos.getY(), pos.getZ(), nativeTag);
|
previous.setTile(pos.getX(), pos.getY(), pos.getZ(), nativeTag);
|
||||||
|
@ -350,6 +350,9 @@ public class ForgeChunk_All extends CharFaweChunk<Chunk, ForgeQueue_All> {
|
|||||||
TileEntity tileEntity = nmsWorld.getTileEntity(pos);
|
TileEntity tileEntity = nmsWorld.getTileEntity(pos);
|
||||||
if (tileEntity != null) {
|
if (tileEntity != null) {
|
||||||
NBTTagCompound tag = (NBTTagCompound) ForgeQueue_All.methodFromNative.invoke(null, nativeTag);
|
NBTTagCompound tag = (NBTTagCompound) ForgeQueue_All.methodFromNative.invoke(null, nativeTag);
|
||||||
|
tag.setInteger("x", pos.getX());
|
||||||
|
tag.setInteger("y", pos.getY());
|
||||||
|
tag.setInteger("z", pos.getZ());
|
||||||
tileEntity.readFromNBT(tag); // ReadTagIntoTile
|
tileEntity.readFromNBT(tag); // ReadTagIntoTile
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -274,7 +274,7 @@ public class ForgeQueue_All extends NMSMappedFaweQueue<World, Chunk, ExtendedBlo
|
|||||||
for (Map.Entry<BlockPos, TileEntity> entry : tiles.entrySet()) {
|
for (Map.Entry<BlockPos, TileEntity> entry : tiles.entrySet()) {
|
||||||
TileEntity tile = entry.getValue();
|
TileEntity tile = entry.getValue();
|
||||||
NBTTagCompound tag = new NBTTagCompound();
|
NBTTagCompound tag = new NBTTagCompound();
|
||||||
tile.readFromNBT(tag); // readTileEntityIntoTag
|
tile.writeToNBT(tag); // readTileEntityIntoTag
|
||||||
BlockPos pos = entry.getKey();
|
BlockPos pos = entry.getKey();
|
||||||
CompoundTag nativeTag = (CompoundTag) methodToNative.invoke(null, tag);
|
CompoundTag nativeTag = (CompoundTag) methodToNative.invoke(null, tag);
|
||||||
previous.setTile(pos.getX(), pos.getY(), pos.getZ(), nativeTag);
|
previous.setTile(pos.getX(), pos.getY(), pos.getZ(), nativeTag);
|
||||||
|
@ -49,7 +49,6 @@ public class ForgePlayer extends AbstractPlayerActor {
|
|||||||
private final EntityPlayerMP player;
|
private final EntityPlayerMP player;
|
||||||
|
|
||||||
protected ForgePlayer(ForgePlatform platform, EntityPlayerMP player) {
|
protected ForgePlayer(ForgePlatform platform, EntityPlayerMP player) {
|
||||||
System.out.println("New forge player!!!!");
|
|
||||||
this.platform = platform;
|
this.platform = platform;
|
||||||
this.player = player;
|
this.player = player;
|
||||||
ThreadSafeCache.getInstance().getOnlineIds().add(getUniqueId());
|
ThreadSafeCache.getInstance().getOnlineIds().add(getUniqueId());
|
||||||
|
Loading…
Reference in New Issue
Block a user