Search in sources :

Example 1 with SkinProperties

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

the class GuiArmourer method updateScreen.

@Override
public void updateScreen() {
    super.updateScreen();
    if (tileEntity.loadedArmourItem) {
        // got new settings from the server, update the tabs
        tileEntity.loadedArmourItem = false;
        SkinProperties skinProperties = tileEntity.getSkinProps();
        tabMain.resetValues(skinProperties);
        tabSkinSettings.resetValues(skinProperties);
        skinTypeUpdate(tileEntity.getSkinType());
    }
}
Also used : SkinProperties(riskyken.armourersWorkshop.common.skin.data.SkinProperties)

Example 2 with SkinProperties

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

the class GuiTabArmourerMain method keyTyped.

@Override
public boolean keyTyped(char c, int keycode) {
    if (!textItemName.textboxKeyTyped(c, keycode)) {
        return super.keyTyped(c, keycode);
    } else {
        SkinProperties skinProps = tileEntity.getSkinProps();
        String sendText = textItemName.getText().trim();
        if (fidgCount < 3) {
            if (sendText.equalsIgnoreCase("fidget spinner")) {
                sendText = fidgMessage[fidgCount];
                fidgCount++;
            }
        }
        String oldText = skinProps.getPropertyString(Skin.KEY_CUSTOM_NAME, "");
        if (!sendText.equals(oldText)) {
            skinProps.setProperty(Skin.KEY_CUSTOM_NAME, sendText);
            PacketHandler.networkWrapper.sendToServer(new MessageClientGuiSetArmourerSkinProps(skinProps));
            return true;
        }
    }
    return false;
}
Also used : MessageClientGuiSetArmourerSkinProps(riskyken.armourersWorkshop.common.network.messages.client.MessageClientGuiSetArmourerSkinProps) SkinProperties(riskyken.armourersWorkshop.common.skin.data.SkinProperties)

Example 3 with SkinProperties

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

the class GuiTabArmourerSkinSettings method initGui.

@Override
public void initGui(int xPos, int yPos, int width, int height) {
    super.initGui(xPos, yPos, width, height);
    String guiName = tileEntity.getInventoryName();
    buttonList.clear();
    SkinProperties skinProps = tileEntity.getSkinProps();
    checkBlockGlowing = new GuiCheckBox(15, 10, 20, GuiHelper.getLocalizedControlName(guiName, "glowing"), SkinProperties.PROP_BLOCK_GLOWING.getValue(skinProps));
    checkBlockLadder = new GuiCheckBox(15, 10, 35, GuiHelper.getLocalizedControlName(guiName, "ladder"), SkinProperties.PROP_BLOCK_LADDER.getValue(skinProps));
    checkBlockNoCollision = new GuiCheckBox(15, 10, 50, GuiHelper.getLocalizedControlName(guiName, "noCollision"), SkinProperties.PROP_BLOCK_NO_COLLISION.getValue(skinProps));
    checkBlockSeat = new GuiCheckBox(15, 10, 65, GuiHelper.getLocalizedControlName(guiName, "seat"), SkinProperties.PROP_BLOCK_SEAT.getValue(skinProps));
    checkBlockMultiblock = new GuiCheckBox(15, 10, 80, GuiHelper.getLocalizedControlName(guiName, "multiblock"), SkinProperties.PROP_BLOCK_MULTIBLOCK.getValue(skinProps));
    checkBlockBed = new GuiCheckBox(15, 22, 95, GuiHelper.getLocalizedControlName(guiName, "bed"), SkinProperties.PROP_BLOCK_BED.getValue(skinProps));
    checkBlockEnderInventory = new GuiCheckBox(15, 10, 110, GuiHelper.getLocalizedControlName(guiName, "enderInventory"), SkinProperties.PROP_BLOCK_ENDER_INVENTORY.getValue(skinProps));
    checkBlockInventory = new GuiCheckBox(15, 10, 125, GuiHelper.getLocalizedControlName(guiName, "inventory"), SkinProperties.PROP_BLOCK_INVENTORY.getValue(skinProps));
    if (!checkBlockMultiblock.isChecked()) {
        checkBlockBed.enabled = false;
        checkBlockBed.setIsChecked(false);
    } else {
        checkBlockBed.enabled = true;
    }
    // TODO remove to re-enable beds
    checkBlockBed.enabled = false;
    checkBlockEnderInventory.enabled = !checkBlockInventory.isChecked();
    checkBlockInventory.enabled = !checkBlockEnderInventory.isChecked();
    if (checkBlockInventory.isChecked()) {
        checkBlockEnderInventory.setIsChecked(false);
    }
    if (checkBlockEnderInventory.isChecked()) {
        checkBlockInventory.setIsChecked(false);
    }
    inventorySize = new GuiInventorySize(10, 158, 9, 6);
    inventorySize.setSrc(TEXTURE, 176, 0);
    inventorySize.setSelection(SkinProperties.PROP_BLOCK_INVENTORY_WIDTH.getValue(skinProps), SkinProperties.PROP_BLOCK_INVENTORY_HEIGHT.getValue(skinProps));
    sliderWingIdleSpeed = new GuiCustomSlider(15, 10, 45, 154, 10, "", "ms", 200D, 10000D, SkinProperties.PROP_WINGS_IDLE_SPEED.getValue(skinProps), false, true, this);
    sliderWingFlyingSpeed = new GuiCustomSlider(15, 10, 65, 154, 10, "", "ms", 200D, 10000D, SkinProperties.PROP_WINGS_FLYING_SPEED.getValue(skinProps), false, true, this);
    sliderWingMinAngle = new GuiCustomSlider(15, 10, 85, 154, 10, "", DEGREE, -180D, 180D, SkinProperties.PROP_WINGS_MIN_ANGLE.getValue(skinProps), false, true, this);
    sliderWingMaxAngle = new GuiCustomSlider(15, 10, 105, 154, 10, "", DEGREE, -180D, 180D, SkinProperties.PROP_WINGS_MAX_ANGLE.getValue(skinProps), false, true, this);
    sliderWingIdleSpeed.setFineTuneButtons(true);
    sliderWingFlyingSpeed.setFineTuneButtons(true);
    sliderWingMinAngle.setFineTuneButtons(true);
    sliderWingMaxAngle.setFineTuneButtons(true);
    checkArmourOverrideBodyPart = new GuiCheckBox(15, 10, 20, GuiHelper.getLocalizedControlName(guiName, "overrideBodyPart"), SkinProperties.PROP_ARMOUR_OVERRIDE.getValue(skinProps));
    checkArmourHideOverlay = new GuiCheckBox(15, 10, 35, GuiHelper.getLocalizedControlName(guiName, "hideOverlay"), SkinProperties.PROP_ARMOUR_HIDE_OVERLAY.getValue(skinProps));
    MovementType skinMovmentType = MovementType.valueOf(SkinProperties.PROP_WINGS_MOVMENT_TYPE.getValue(skinProps));
    dropDownList = new GuiDropDownList(0, 10, 125, 50, "", this);
    for (int i = 0; i < MovementType.values().length; i++) {
        MovementType movementType = MovementType.values()[i];
        String unlocalizedName = "movmentType." + LibModInfo.ID.toLowerCase() + ":" + movementType.name().toLowerCase();
        String localizedName = StatCollector.translateToLocal(unlocalizedName);
        dropDownList.addListItem(localizedName, movementType.name(), true);
        if (movementType == skinMovmentType) {
            dropDownList.setListSelectedIndex(i);
        }
    }
    buttonList.add(checkBlockGlowing);
    buttonList.add(checkBlockLadder);
    buttonList.add(checkBlockNoCollision);
    buttonList.add(checkBlockSeat);
    buttonList.add(checkBlockMultiblock);
    buttonList.add(checkBlockBed);
    buttonList.add(checkBlockInventory);
    buttonList.add(checkBlockEnderInventory);
    buttonList.add(inventorySize);
    buttonList.add(sliderWingIdleSpeed);
    buttonList.add(sliderWingFlyingSpeed);
    buttonList.add(sliderWingMinAngle);
    buttonList.add(sliderWingMaxAngle);
    buttonList.add(checkArmourOverrideBodyPart);
    buttonList.add(checkArmourHideOverlay);
    buttonList.add(dropDownList);
}
Also used : GuiDropDownList(riskyken.armourersWorkshop.client.gui.controls.GuiDropDownList) GuiInventorySize(riskyken.armourersWorkshop.client.gui.controls.GuiInventorySize) GuiCustomSlider(riskyken.armourersWorkshop.client.gui.controls.GuiCustomSlider) GuiCheckBox(riskyken.armourersWorkshop.client.gui.controls.GuiCheckBox) SkinProperties(riskyken.armourersWorkshop.common.skin.data.SkinProperties) MovementType(riskyken.armourersWorkshop.common.skin.type.wings.SkinWings.MovementType)

Example 4 with SkinProperties

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

the class GuiTabArmourerSkinSettings method onChangeSliderValue.

@Override
public void onChangeSliderValue(GuiSlider slider) {
    if (!resetting) {
        SkinProperties skinProps = tileEntity.getSkinProps();
        SkinProperties.PROP_WINGS_IDLE_SPEED.setValue(skinProps, (double) Math.round(sliderWingIdleSpeed.getValue()));
        SkinProperties.PROP_WINGS_FLYING_SPEED.setValue(skinProps, (double) Math.round(sliderWingFlyingSpeed.getValue()));
        SkinProperties.PROP_WINGS_MIN_ANGLE.setValue(skinProps, (double) Math.round(sliderWingMinAngle.getValue()));
        SkinProperties.PROP_WINGS_MAX_ANGLE.setValue(skinProps, (double) Math.round(sliderWingMaxAngle.getValue()));
        PacketHandler.networkWrapper.sendToServer(new MessageClientGuiSetArmourerSkinProps(skinProps));
    }
}
Also used : MessageClientGuiSetArmourerSkinProps(riskyken.armourersWorkshop.common.network.messages.client.MessageClientGuiSetArmourerSkinProps) SkinProperties(riskyken.armourersWorkshop.common.skin.data.SkinProperties)

Example 5 with SkinProperties

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

the class GuiTabArmourerSkinSettings method onDropDownListChanged.

@Override
public void onDropDownListChanged(GuiDropDownList dropDownList) {
    SkinProperties skinProps = tileEntity.getSkinProps();
    SkinProperties.PROP_WINGS_MOVMENT_TYPE.setValue(skinProps, dropDownList.getListSelectedItem().tag);
    ModLogger.log("Setting skin movment type to: " + dropDownList.getListSelectedItem().tag);
    PacketHandler.networkWrapper.sendToServer(new MessageClientGuiSetArmourerSkinProps(skinProps));
}
Also used : MessageClientGuiSetArmourerSkinProps(riskyken.armourersWorkshop.common.network.messages.client.MessageClientGuiSetArmourerSkinProps) SkinProperties(riskyken.armourersWorkshop.common.skin.data.SkinProperties)

Aggregations

SkinProperties (riskyken.armourersWorkshop.common.skin.data.SkinProperties)16 MessageClientGuiSetArmourerSkinProps (riskyken.armourersWorkshop.common.network.messages.client.MessageClientGuiSetArmourerSkinProps)4 Skin (riskyken.armourersWorkshop.common.skin.data.Skin)3 IOException (java.io.IOException)2 ItemStack (net.minecraft.item.ItemStack)2 ISkinType (riskyken.armourersWorkshop.api.common.skin.type.ISkinType)2 NewerFileVersionException (riskyken.armourersWorkshop.common.exception.NewerFileVersionException)2 ItemSkin (riskyken.armourersWorkshop.common.items.ItemSkin)2 GameProfile (com.mojang.authlib.GameProfile)1 ArrayList (java.util.ArrayList)1 NBTTagCompound (net.minecraft.nbt.NBTTagCompound)1 ChatComponentText (net.minecraft.util.ChatComponentText)1 GuiCheckBox (riskyken.armourersWorkshop.client.gui.controls.GuiCheckBox)1 GuiCustomSlider (riskyken.armourersWorkshop.client.gui.controls.GuiCustomSlider)1 GuiDropDownList (riskyken.armourersWorkshop.client.gui.controls.GuiDropDownList)1 GuiInventorySize (riskyken.armourersWorkshop.client.gui.controls.GuiInventorySize)1 PlayerTexture (riskyken.armourersWorkshop.client.texture.PlayerTexture)1 InvalidCubeTypeException (riskyken.armourersWorkshop.common.exception.InvalidCubeTypeException)1 SkinSaveException (riskyken.armourersWorkshop.common.exception.SkinSaveException)1 ModInventory (riskyken.armourersWorkshop.common.inventory.ModInventory)1