use of gregtech.api.gui.impl.ModularUIGui in project GregTech by GregTechCE.
the class UIFactory method initClientUI.
@SideOnly(Side.CLIENT)
public final void initClientUI(PacketBuffer serializedHolder, int windowId) {
E holder = readHolderFromSyncData(serializedHolder);
Minecraft minecraft = Minecraft.getMinecraft();
EntityPlayerSP entityPlayer = minecraft.player;
ModularUI<E> uiTemplate = createUITemplate(holder, entityPlayer);
uiTemplate.initWidgets();
minecraft.addScheduledTask(() -> {
minecraft.displayGuiScreen(new ModularUIGui(uiTemplate));
entityPlayer.openContainer.windowId = windowId;
});
}
use of gregtech.api.gui.impl.ModularUIGui in project GregTech by GregTechCE.
the class UIFactory method initClientUI.
@SideOnly(Side.CLIENT)
public final void initClientUI(PacketBuffer serializedHolder, int windowId, List<PacketUIWidgetUpdate> initialWidgetUpdates) {
E holder = readHolderFromSyncData(serializedHolder);
Minecraft minecraft = Minecraft.getMinecraft();
EntityPlayerSP entityPlayer = minecraft.player;
ModularUI uiTemplate = createUITemplate(holder, entityPlayer);
uiTemplate.initWidgets();
ModularUIGui modularUIGui = new ModularUIGui(uiTemplate);
modularUIGui.inventorySlots.windowId = windowId;
for (PacketUIWidgetUpdate packet : initialWidgetUpdates) {
modularUIGui.handleWidgetUpdate(packet);
}
minecraft.addScheduledTask(() -> {
minecraft.displayGuiScreen(modularUIGui);
minecraft.player.openContainer.windowId = windowId;
});
}
use of gregtech.api.gui.impl.ModularUIGui in project GregTech by GregTechCE.
the class NetworkHandler method initClient.
@SideOnly(Side.CLIENT)
private static void initClient() {
registerClientExecutor(PacketUIOpen.class, (packet, handler) -> {
UIFactory<?> uiFactory = UIFactory.FACTORY_REGISTRY.getObjectById(packet.uiFactoryId);
if (uiFactory == null) {
GTLog.logger.warn("Couldn't find UI Factory with id '{}'", packet.uiFactoryId);
} else {
uiFactory.initClientUI(packet.serializedHolder, packet.windowId, packet.initialWidgetUpdates);
}
});
registerClientExecutor(PacketUIWidgetUpdate.class, (packet, handler) -> {
GuiScreen currentScreen = Minecraft.getMinecraft().currentScreen;
if (currentScreen instanceof ModularUIGui) {
((ModularUIGui) currentScreen).handleWidgetUpdate(packet);
}
});
registerClientExecutor(PacketBlockParticle.class, (packet, handler) -> {
World world = Minecraft.getMinecraft().world;
IBlockState blockState = world.getBlockState(packet.blockPos);
ParticleManager particleManager = Minecraft.getMinecraft().effectRenderer;
((ICustomParticleBlock) blockState.getBlock()).handleCustomParticle(world, packet.blockPos, particleManager, packet.entityPos, packet.particlesAmount);
});
registerClientExecutor(PacketClipboard.class, (packet, handler) -> {
ClipboardUtil.copyToClipboard(packet.text);
});
}
Aggregations