mirror of
https://github.com/Ellpeck/ActuallyAdditions.git
synced 2024-11-22 15:18:34 +01:00
Revert the fix, tried to fix it another way
This commit is contained in:
parent
85428e885d
commit
ab0adfa25b
3 changed files with 33 additions and 44 deletions
|
@ -33,6 +33,8 @@ public class VanillaPacketSyncer{
|
||||||
}
|
}
|
||||||
|
|
||||||
public static void sendTileToPlayer(TileEntity tile, EntityPlayerMP player){
|
public static void sendTileToPlayer(TileEntity tile, EntityPlayerMP player){
|
||||||
|
if(player.getEntityWorld().getTileEntity(tile.getPos()) == tile){
|
||||||
player.playerNetServerHandler.sendPacket(tile.getDescriptionPacket());
|
player.playerNetServerHandler.sendPacket(tile.getDescriptionPacket());
|
||||||
}
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -39,8 +39,6 @@ public class TileEntityAtomicReconstructor extends TileEntityInventoryBase imple
|
||||||
private boolean activateOnceWithSignal;
|
private boolean activateOnceWithSignal;
|
||||||
private int oldEnergy;
|
private int oldEnergy;
|
||||||
|
|
||||||
public boolean syncSlotsNextTime;
|
|
||||||
|
|
||||||
public TileEntityAtomicReconstructor(){
|
public TileEntityAtomicReconstructor(){
|
||||||
super(1, "reconstructor");
|
super(1, "reconstructor");
|
||||||
}
|
}
|
||||||
|
@ -111,12 +109,11 @@ public class TileEntityAtomicReconstructor extends TileEntityInventoryBase imple
|
||||||
super.writeSyncableNBT(compound, sync);
|
super.writeSyncableNBT(compound, sync);
|
||||||
compound.setInteger("CurrentTime", this.currentTime);
|
compound.setInteger("CurrentTime", this.currentTime);
|
||||||
this.storage.writeToNBT(compound);
|
this.storage.writeToNBT(compound);
|
||||||
|
|
||||||
if(this.syncSlotsNextTime){
|
|
||||||
this.writeSlotsToCompound(compound);
|
|
||||||
compound.setBoolean("ShouldSync", true);
|
|
||||||
this.syncSlotsNextTime = false;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public boolean shouldSyncSlots(){
|
||||||
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
@ -124,22 +121,16 @@ public class TileEntityAtomicReconstructor extends TileEntityInventoryBase imple
|
||||||
super.readSyncableNBT(compound, sync);
|
super.readSyncableNBT(compound, sync);
|
||||||
this.currentTime = compound.getInteger("CurrentTime");
|
this.currentTime = compound.getInteger("CurrentTime");
|
||||||
this.storage.readFromNBT(compound);
|
this.storage.readFromNBT(compound);
|
||||||
|
|
||||||
if(compound.getBoolean("ShouldSync")){
|
|
||||||
this.readSlotsFromCompound(compound);
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void setInventorySlotContents(int i, ItemStack stack){
|
public void setInventorySlotContents(int i, ItemStack stack){
|
||||||
super.setInventorySlotContents(i, stack);
|
super.setInventorySlotContents(i, stack);
|
||||||
this.syncSlotsNextTime = true;
|
|
||||||
this.sendUpdate();
|
this.sendUpdate();
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public ItemStack decrStackSize(int i, int j){
|
public ItemStack decrStackSize(int i, int j){
|
||||||
this.syncSlotsNextTime = true;
|
|
||||||
this.sendUpdate();
|
this.sendUpdate();
|
||||||
return super.decrStackSize(i, j);
|
return super.decrStackSize(i, j);
|
||||||
}
|
}
|
||||||
|
|
|
@ -41,20 +41,7 @@ public abstract class TileEntityInventoryBase extends TileEntityBase implements
|
||||||
@Override
|
@Override
|
||||||
public void writeSyncableNBT(NBTTagCompound compound, boolean isForSync){
|
public void writeSyncableNBT(NBTTagCompound compound, boolean isForSync){
|
||||||
super.writeSyncableNBT(compound, isForSync);
|
super.writeSyncableNBT(compound, isForSync);
|
||||||
if(!isForSync){
|
if(!isForSync || this.shouldSyncSlots()){
|
||||||
this.writeSlotsToCompound(compound);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public void readSyncableNBT(NBTTagCompound compound, boolean isForSync){
|
|
||||||
super.readSyncableNBT(compound, isForSync);
|
|
||||||
if(!isForSync){
|
|
||||||
this.readSlotsFromCompound(compound);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
public void writeSlotsToCompound(NBTTagCompound compound){
|
|
||||||
if(this.slots.length > 0){
|
if(this.slots.length > 0){
|
||||||
NBTTagList tagList = new NBTTagList();
|
NBTTagList tagList = new NBTTagList();
|
||||||
for(int currentIndex = 0; currentIndex < slots.length; currentIndex++){
|
for(int currentIndex = 0; currentIndex < slots.length; currentIndex++){
|
||||||
|
@ -68,8 +55,16 @@ public abstract class TileEntityInventoryBase extends TileEntityBase implements
|
||||||
compound.setTag("Items", tagList);
|
compound.setTag("Items", tagList);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
public void readSlotsFromCompound(NBTTagCompound compound){
|
public boolean shouldSyncSlots(){
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void readSyncableNBT(NBTTagCompound compound, boolean isForSync){
|
||||||
|
super.readSyncableNBT(compound, isForSync);
|
||||||
|
if(!isForSync || this.shouldSyncSlots()){
|
||||||
if(this.slots.length > 0){
|
if(this.slots.length > 0){
|
||||||
NBTTagList tagList = compound.getTagList("Items", 10);
|
NBTTagList tagList = compound.getTagList("Items", 10);
|
||||||
for(int i = 0; i < tagList.tagCount(); i++){
|
for(int i = 0; i < tagList.tagCount(); i++){
|
||||||
|
@ -81,6 +76,7 @@ public abstract class TileEntityInventoryBase extends TileEntityBase implements
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public int getInventoryStackLimit(){
|
public int getInventoryStackLimit(){
|
||||||
|
|
Loading…
Reference in a new issue