Search in sources :

Example 1 with StructureInstantBridge

use of com.wuest.prefab.StructureGen.CustomStructures.StructureInstantBridge in project MC-Prefab by Brian-Wuest.

the class GuiInstantBridge method actionPerformed.

/**
 * Called by the controls from the buttonList when activated. (Mouse pressed for buttons)
 */
@Override
protected void actionPerformed(GuiButton button) throws IOException {
    int sliderValue = this.sldrBridgeLength.getValueInt();
    if (sliderValue > 75) {
        sliderValue = 75;
    } else if (sliderValue < 25) {
        sliderValue = 25;
    }
    this.configuration.bridgeLength = sliderValue;
    sliderValue = this.sldrInteriorHeight.getValueInt();
    if (sliderValue > 8) {
        sliderValue = 8;
    } else if (sliderValue < 3) {
        sliderValue = 3;
    }
    this.configuration.interiorHeight = sliderValue;
    this.configuration.houseFacing = player.getHorizontalFacing().getOpposite();
    this.configuration.pos = this.pos;
    this.performCancelOrBuildOrHouseFacing(this.configuration, button);
    if (button == this.chckIncludeRoof) {
        this.configuration.includeRoof = this.chckIncludeRoof.isChecked();
        this.sldrInteriorHeight.enabled = this.configuration.includeRoof;
    }
    if (button == this.btnMaterialType) {
        this.configuration.bridgeMaterial = EnumBridgeMaterial.getMaterialByNumber(this.configuration.bridgeMaterial.getNumber() + 1);
        this.btnMaterialType.displayString = this.configuration.bridgeMaterial.getTranslatedName();
    } else if (button == this.btnVisualize) {
        StructureInstantBridge structure = new StructureInstantBridge();
        structure.getClearSpace().getShape().setDirection(EnumFacing.SOUTH);
        structure.setupStructure(this.configuration, this.pos);
        StructureRenderHandler.setStructure(structure, EnumFacing.SOUTH, this.configuration);
        this.mc.displayGuiScreen(null);
    }
}
Also used : StructureInstantBridge(com.wuest.prefab.StructureGen.CustomStructures.StructureInstantBridge)

Example 2 with StructureInstantBridge

use of com.wuest.prefab.StructureGen.CustomStructures.StructureInstantBridge in project MC-Prefab by Brian-Wuest.

the class InstantBridgeConfiguration method ConfigurationSpecificBuildStructure.

@Override
protected void ConfigurationSpecificBuildStructure(EntityPlayer player, World world, BlockPos hitBlockPos) {
    StructureInstantBridge structure = StructureInstantBridge.CreateInstance();
    if (structure.BuildStructure(this, world, hitBlockPos, EnumFacing.NORTH, player)) {
        ItemStack usedItemStack = player.getHeldItemMainhand();
        if (!(usedItemStack.getItem() instanceof ItemInstantBridge)) {
            usedItemStack = player.getHeldItemOffhand();
        }
        usedItemStack.damageItem(1, player);
        player.inventoryContainer.detectAndSendChanges();
    }
}
Also used : ItemInstantBridge(com.wuest.prefab.Items.Structures.ItemInstantBridge) StructureInstantBridge(com.wuest.prefab.StructureGen.CustomStructures.StructureInstantBridge) ItemStack(net.minecraft.item.ItemStack)

Aggregations

StructureInstantBridge (com.wuest.prefab.StructureGen.CustomStructures.StructureInstantBridge)2 ItemInstantBridge (com.wuest.prefab.Items.Structures.ItemInstantBridge)1 ItemStack (net.minecraft.item.ItemStack)1