Search in sources :

Example 6 with ExPropsPlayerSkinData

use of riskyken.armourersWorkshop.common.skin.ExPropsPlayerSkinData in project Armourers-Workshop by RiskyKen.

the class CommandSetWardrobeOption method processCommand.

@Override
public void processCommand(ICommandSender commandSender, String[] currentCommand) {
    if (currentCommand.length != 4) {
        throw new WrongUsageException(getCommandUsage(commandSender), (Object) currentCommand);
    }
    EntityPlayerMP player = getPlayer(commandSender, currentCommand[1]);
    if (player == null) {
        return;
    }
    String subOption = currentCommand[2];
    boolean value = parseBoolean(commandSender, currentCommand[3]);
    int subOptionIndex = -1;
    for (int i = 0; i < SUB_OPTIONS.length; i++) {
        if (subOption.equals(SUB_OPTIONS[i])) {
            subOptionIndex = i;
            break;
        }
    }
    if (subOptionIndex == -1) {
        throw new WrongUsageException(getCommandUsage(commandSender), (Object) currentCommand);
    }
    ExPropsPlayerSkinData playerEquipmentData = ExPropsPlayerSkinData.get(player);
    if (playerEquipmentData != null) {
        EquipmentWardrobeData ewd = playerEquipmentData.getEquipmentWardrobeData();
        if (subOptionIndex < 4) {
            ewd.armourOverride.set(subOptionIndex, !value);
        }
        if (subOptionIndex == 4) {
            ewd.headOverlay = !value;
        }
        playerEquipmentData.setSkinInfo(ewd, true);
    }
}
Also used : WrongUsageException(net.minecraft.command.WrongUsageException) EquipmentWardrobeData(riskyken.armourersWorkshop.common.skin.EquipmentWardrobeData) ExPropsPlayerSkinData(riskyken.armourersWorkshop.common.skin.ExPropsPlayerSkinData) EntityPlayerMP(net.minecraft.entity.player.EntityPlayerMP)

Aggregations

ExPropsPlayerSkinData (riskyken.armourersWorkshop.common.skin.ExPropsPlayerSkinData)6 BitSet (java.util.BitSet)1 WrongUsageException (net.minecraft.command.WrongUsageException)1 EntityPlayerMP (net.minecraft.entity.player.EntityPlayerMP)1 ChatComponentTranslation (net.minecraft.util.ChatComponentTranslation)1 ISkinType (riskyken.armourersWorkshop.api.common.skin.type.ISkinType)1 EquipmentWardrobeData (riskyken.armourersWorkshop.common.skin.EquipmentWardrobeData)1