use of com.wuest.prefab.structures.items.ItemBasicStructure in project MC-Prefab by Brian-Wuest.
the class GuiBasicStructure method Initialize.
@Override
protected void Initialize() {
super.Initialize();
// Get the structure configuration for this itemstack.
ItemStack stack = ItemBasicStructure.getBasicStructureItemInHand(this.player);
if (stack != null) {
ItemBasicStructure item = (ItemBasicStructure) stack.getItem();
this.configuration = this.specificConfiguration = ClientEventHandler.playerConfig.getClientConfig(item.structureType.getName(), BasicStructureConfiguration.class);
this.specificConfiguration.basicStructureName = item.structureType;
if (this.specificConfiguration.chosenOption.getClass() != item.structureType.getBaseOption().getClass()) {
this.availableOptions = item.structureType.getBaseOption().getSpecificOptions(true);
this.specificConfiguration.chosenOption = this.availableOptions.get(0);
} else {
this.availableOptions = this.specificConfiguration.chosenOption.getSpecificOptions(true);
}
this.structureImageLocation = this.specificConfiguration.chosenOption.getPictureLocation();
}
this.configuration.pos = this.pos;
this.configuration.houseFacing = this.houseFacing;
this.selectedStructure = StructureBasic.CreateInstance(this.specificConfiguration.chosenOption.getAssetLocation(), StructureBasic.class);
this.updatedRenderedStructure();
if (this.availableOptions.size() > 1 || this.specificConfiguration.basicStructureName.shouldShowConfigurationOptions()) {
this.showConfigurationOptions = true;
}
if (!this.showConfigurationOptions) {
this.InitializeStandardButtons();
} else {
this.modifiedInitialXAxis = 215;
this.modifiedInitialYAxis = 117;
this.imagePanelWidth = 285;
// Get the upper left hand corner of the GUI box.
Tuple<Integer, Integer> adjustedXYValue = this.getAdjustedXYValue();
int grayBoxX = adjustedXYValue.getFirst();
int grayBoxY = adjustedXYValue.getSecond();
// Create the buttons.
int x = grayBoxX + 8;
int y = grayBoxY + 45;
if (this.availableOptions.size() > 1) {
this.btnStructureOptions = this.createAndAddButton(x, y, 100, 20, this.specificConfiguration.chosenOption.getTranslationString(), GuiLangKeys.translateString(GuiLangKeys.BUILDING_OPTIONS));
this.btnStructureOptions.visible = true;
y += 45;
} else if (this.btnStructureOptions != null) {
this.btnStructureOptions.visible = false;
}
this.btnBedColor = this.createAndAddDyeButton(x, y, 90, 20, this.specificConfiguration.bedColor, GuiLangKeys.translateString(GuiLangKeys.GUI_STRUCTURE_BED_COLOR));
this.btnBedColor.visible = false;
this.btnGlassColor = this.createAndAddFullDyeButton(x, y, 90, 20, this.specificConfiguration.glassColor, GuiLangKeys.translateString(GuiLangKeys.GUI_STRUCTURE_GLASS));
this.btnGlassColor.visible = false;
// Create the standard buttons.
this.btnVisualize = this.createAndAddCustomButton(grayBoxX + 24, grayBoxY + 177, 90, 20, GuiLangKeys.GUI_BUTTON_PREVIEW);
this.btnBuild = this.createAndAddCustomButton(grayBoxX + 310, grayBoxY + 177, 90, 20, GuiLangKeys.GUI_BUTTON_BUILD);
this.btnCancel = this.createAndAddButton(grayBoxX + 154, grayBoxY + 177, 90, 20, GuiLangKeys.GUI_BUTTON_CANCEL);
}
}
use of com.wuest.prefab.structures.items.ItemBasicStructure in project MC-Prefab by Brian-Wuest.
the class ClientEventHandler method checkIfStackIsCorrectGui.
public static boolean checkIfStackIsCorrectGui(StructureTagMessage.EnumStructureConfiguration currentConfiguration, ItemStack stack) {
GuiStructure mainHandGui = ClientProxy.ModGuis.get(stack.getItem());
mainHandGui.init();
if (currentConfiguration == mainHandGui.configurationEnum) {
if (currentConfiguration == StructureTagMessage.EnumStructureConfiguration.Basic) {
ItemBasicStructure item = (ItemBasicStructure) stack.getItem();
BasicStructureConfiguration.EnumBasicStructureName basicStructureName = ((BasicStructureConfiguration) StructureRenderHandler.currentConfiguration).basicStructureName;
return item.structureType == basicStructureName;
} else {
return true;
}
}
return false;
}
Aggregations