use of com.bluepowermod.network.message.MessageSendClientServerTemplates in project BluePower by Qmunity.
the class TileCircuitDatabase method updateEntity.
@Override
public void updateEntity() {
super.updateEntity();
if (!worldObj.isRemote) {
if (copyInventory.getStackInSlot(0) != null) {
if (curCopyProgress >= 0) {
if (++curCopyProgress > UPLOAD_AND_COPY_TIME) {
curCopyProgress = -1;
if (copy(triggeringPlayer, copyInventory.getStackInSlot(0), copyInventory.getStackInSlot(1), true)) {
copy(triggeringPlayer, copyInventory.getStackInSlot(0), copyInventory.getStackInSlot(1), false);
}
}
}
if (curUploadProgress >= 0) {
if (++curUploadProgress > UPLOAD_AND_COPY_TIME) {
curUploadProgress = -1;
if (selectedShareOption == 1 && triggeringPlayer != null)
BPNetworkHandler.INSTANCE.sendTo(new MessageCircuitDatabaseTemplate(this, copyInventory.getStackInSlot(0)), (EntityPlayerMP) triggeringPlayer);
if (selectedShareOption == 2) {
stackDatabase.saveItemStack(copyInventory.getStackInSlot(0));
BPNetworkHandler.INSTANCE.sendToAll(new MessageSendClientServerTemplates(stackDatabase.loadItemStacks()));
}
selectedShareOption = 0;
}
}
} else {
curCopyProgress = -1;
curUploadProgress = -1;
selectedShareOption = 0;
}
}
}
use of com.bluepowermod.network.message.MessageSendClientServerTemplates in project BluePower by Qmunity.
the class BlockCircuitDatabase method onBlockActivated.
@Override
public boolean onBlockActivated(World world, int x, int y, int z, EntityPlayer player, int par6, float par7, float par8, float par9) {
if (super.onBlockActivated(world, x, y, z, player, par6, par7, par8, par9)) {
TileCircuitDatabase database = (TileCircuitDatabase) world.getTileEntity(x, y, z);
database.clientCurrentTab = 0;
if (!world.isRemote) {
BPNetworkHandler.INSTANCE.sendTo(new MessageSendClientServerTemplates(new ItemStackDatabase().loadItemStacks()), (EntityPlayerMP) player);
}
return true;
} else {
return false;
}
}
Aggregations