Search in sources :

Example 1 with StructureTagMessage

use of com.wuest.prefab.Proxy.Messages.StructureTagMessage in project MC-Prefab by Brian-Wuest.

the class GuiStartHouseChooser method actionPerformed.

/**
 * Called by the controls from the buttonList when activated. (Mouse pressed for buttons)
 */
@Override
protected void actionPerformed(GuiButton button) throws IOException {
    if (button == this.btnCancel || button == this.btnVisualize || button == this.btnBuild) {
        this.houseConfiguration.addBed = this.serverConfiguration.addBed && this.btnAddBed.isChecked();
        this.houseConfiguration.addChest = this.serverConfiguration.addChests && this.btnAddChest.isChecked();
        this.houseConfiguration.addChestContents = this.allowItemsInChestAndFurnace ? this.serverConfiguration.addChestContents && this.btnAddChestContents.isChecked() : false;
        this.houseConfiguration.addCraftingTable = this.serverConfiguration.addCraftingTable && this.btnAddCraftingTable.isChecked();
        this.houseConfiguration.addFurnace = this.serverConfiguration.addFurnace && this.btnAddFurnace.isChecked();
        this.houseConfiguration.addFarm = this.serverConfiguration.addFarm && this.btnAddFarm.isChecked();
        this.houseConfiguration.addMineShaft = this.serverConfiguration.addMineshaft && this.btnAddMineShaft.isChecked();
        this.houseConfiguration.addTorches = this.serverConfiguration.addTorches && this.btnAddTorches.isChecked();
        this.houseConfiguration.isCeilingFlat = this.btnIsCeilingFlat.isChecked();
        this.houseConfiguration.ceilingBlock = ModConfiguration.CeilingFloorBlockType.ValueOf(this.btnCeilingBlock.getValueInt());
        this.houseConfiguration.floorBlock = ModConfiguration.CeilingFloorBlockType.ValueOf(this.btnFloorBlock.getValueInt());
        this.houseConfiguration.wallWoodType = ModConfiguration.WallBlockType.ValueOf(this.btnWallWoodType.getValueInt());
        this.houseConfiguration.houseDepth = this.btnHouseDepth.getValueInt();
        this.houseConfiguration.houseWidth = this.btnHouseWidth.getValueInt();
        this.houseConfiguration.houseStyle = this.houseConfiguration.houseStyle;
        this.houseConfiguration.houseFacing = this.mc.player.getHorizontalFacing().getOpposite();
    }
    if (button == this.btnCancel) {
        this.mc.displayGuiScreen(null);
    } else if (button == this.btnBuild) {
        Prefab.network.sendToServer(new StructureTagMessage(houseConfiguration.WriteToNBTTagCompound(), EnumStructureConfiguration.StartHouse));
        this.mc.displayGuiScreen(null);
    } else if (button == this.btnHouseStyle) {
        int id = this.houseConfiguration.houseStyle.getValue() + 1;
        this.houseConfiguration.houseStyle = HouseConfiguration.HouseStyle.ValueOf(id);
        // Skip the loft if it's not enabled.
        if (this.houseConfiguration.houseStyle == HouseStyle.LOFT && !this.serverConfiguration.enableLoftHouse) {
            id = this.houseConfiguration.houseStyle.getValue() + 1;
            this.houseConfiguration.houseStyle = HouseConfiguration.HouseStyle.ValueOf(id);
        }
        this.btnHouseStyle.displayString = this.houseConfiguration.houseStyle.getDisplayName();
        // Set the default glass colors for this style.
        if (this.houseConfiguration.houseStyle == HouseConfiguration.HouseStyle.HOBBIT) {
            this.houseConfiguration.glassColor = EnumDyeColor.GREEN;
            this.btnGlassColor.displayString = GuiLangKeys.translateDye(EnumDyeColor.GREEN);
        } else if (this.houseConfiguration.houseStyle == HouseConfiguration.HouseStyle.LOFT) {
            this.houseConfiguration.glassColor = EnumDyeColor.BLACK;
            this.btnGlassColor.displayString = GuiLangKeys.translateDye(EnumDyeColor.BLACK);
        } else {
            this.houseConfiguration.glassColor = EnumDyeColor.CYAN;
            this.btnGlassColor.displayString = GuiLangKeys.translateDye(EnumDyeColor.CYAN);
        }
        if (this.houseConfiguration.houseStyle == HouseConfiguration.HouseStyle.DESERT || this.houseConfiguration.houseStyle == HouseConfiguration.HouseStyle.SNOWY) {
            this.tabBlockTypes.visible = false;
        } else {
            this.tabBlockTypes.visible = true;
        }
    } else if (button == this.btnGlassColor) {
        this.houseConfiguration.glassColor = EnumDyeColor.byMetadata(this.houseConfiguration.glassColor.getMetadata() + 1);
        this.btnGlassColor.displayString = GuiLangKeys.translateDye(this.houseConfiguration.glassColor);
    } else if (button == this.btnVisualize) {
        StructureAlternateStart structure = StructureAlternateStart.CreateInstance(this.houseConfiguration.houseStyle.getStructureLocation(), StructureAlternateStart.class);
        StructureRenderHandler.setStructure(structure, EnumFacing.NORTH, this.houseConfiguration);
        this.mc.displayGuiScreen(null);
    }
}
Also used : StructureAlternateStart(com.wuest.prefab.StructureGen.CustomStructures.StructureAlternateStart) StructureTagMessage(com.wuest.prefab.Proxy.Messages.StructureTagMessage)

Aggregations

StructureTagMessage (com.wuest.prefab.Proxy.Messages.StructureTagMessage)1 StructureAlternateStart (com.wuest.prefab.StructureGen.CustomStructures.StructureAlternateStart)1