Search in sources :

Example 1 with FakeModularUIContainerClipboard

use of gregtech.common.gui.impl.FakeModularUIContainerClipboard in project GregTech by GregTechCEu.

the class MetaTileEntityClipboard method createFakeGui.

public void createFakeGui() {
    // Basically just the original function from the PluginBehavior, but with a lot of now useless stuff stripped out.
    try {
        GregFakePlayer fakePlayer = new GregFakePlayer(this.getWorld());
        fakePlayer.setHeldItem(EnumHand.MAIN_HAND, this.getClipboard());
        ModularUI ui = this.createUI(fakePlayer);
        ModularUI.Builder builder = new ModularUI.Builder(ui.backgroundPath, ui.getWidth(), ui.getHeight());
        builder.shouldColor(false);
        List<Widget> widgets = new ArrayList<>(ui.guiWidgets.values());
        for (Widget widget : widgets) {
            builder.widget(widget);
        }
        ui = builder.build(ui.holder, ui.entityPlayer);
        FakeModularUIContainerClipboard fakeModularUIContainer = new FakeModularUIContainerClipboard(ui, this);
        this.guiContainerCache = fakeModularUIContainer;
        if (getWorld().isRemote)
            this.guiCache = new FakeModularGui(ui, fakeModularUIContainer);
        this.writeCustomData(CREATE_FAKE_UI, buffer -> {
        });
    } catch (Exception e) {
        GTLog.logger.error(e);
    }
}
Also used : ModularUI(gregtech.api.gui.ModularUI) Widget(gregtech.api.gui.Widget) ArrayList(java.util.ArrayList) FakeModularGui(gregtech.api.gui.impl.FakeModularGui) GregFakePlayer(gregtech.api.util.GregFakePlayer) FakeModularUIContainerClipboard(gregtech.common.gui.impl.FakeModularUIContainerClipboard)

Aggregations

ModularUI (gregtech.api.gui.ModularUI)1 Widget (gregtech.api.gui.Widget)1 FakeModularGui (gregtech.api.gui.impl.FakeModularGui)1 GregFakePlayer (gregtech.api.util.GregFakePlayer)1 FakeModularUIContainerClipboard (gregtech.common.gui.impl.FakeModularUIContainerClipboard)1 ArrayList (java.util.ArrayList)1