use of riskyken.armourersWorkshop.common.tileentities.TileEntitySkinLibrary in project Armourers-Workshop by RiskyKen.
the class MessageClientGuiLoadSaveArmour method onMessage.
@Override
public IMessage onMessage(MessageClientGuiLoadSaveArmour message, MessageContext ctx) {
EntityPlayerMP player = ctx.getServerHandler().playerEntity;
if (player == null) {
return null;
}
Container container = player.openContainer;
if (container != null && container instanceof ContainerArmourLibrary) {
TileEntitySkinLibrary te = ((ContainerArmourLibrary) container).getTileEntity();
switch(message.packetType) {
case CLIENT_SAVE:
te.sendArmourToClient(message.filename, message.filePath, player);
break;
case SERVER_LOAD:
te.loadArmour(message.filename, message.filePath, player, message.trackFile);
break;
case SERVER_SAVE:
te.saveArmour(message.filename, message.filePath, player, message.publicList);
break;
default:
break;
}
}
return null;
}
use of riskyken.armourersWorkshop.common.tileentities.TileEntitySkinLibrary in project Armourers-Workshop by RiskyKen.
the class SkinUploadHelper method gotSkinPartFromClient.
public static void gotSkinPartFromClient(int skinId, byte packetId, byte[] skinData, EntityPlayerMP player) {
boolean lastPacket = skinData.length < MAX_PACKET_SIZE;
byte[] oldSkinData = unfinishedSkins.get(skinId);
byte[] newSkinData = null;
if (oldSkinData != null) {
newSkinData = ArrayUtils.addAll(oldSkinData, skinData);
unfinishedSkins.remove(skinId);
} else {
newSkinData = skinData;
}
if (!lastPacket) {
unfinishedSkins.put(skinId, newSkinData);
} else {
Skin skin = ByteBufHelper.convertByteArrayToSkin(newSkinData);
ModLogger.log("Downloaded skin " + skin + " from client " + player);
Container container = player.openContainer;
if (!ConfigHandler.allowClientsToUploadSkins) {
return;
}
if (container != null && container instanceof ContainerArmourLibrary) {
TileEntitySkinLibrary te = ((ContainerArmourLibrary) container).getTileEntity();
te.loadArmour(skin, player);
}
}
}
Aggregations