Search in sources :

Example 1 with ICustomParticleBlock

use of gregtech.api.block.ICustomParticleBlock 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);
    });
}
Also used : IBlockState(net.minecraft.block.state.IBlockState) ICustomParticleBlock(gregtech.api.block.ICustomParticleBlock) GuiScreen(net.minecraft.client.gui.GuiScreen) ParticleManager(net.minecraft.client.particle.ParticleManager) World(net.minecraft.world.World) ModularUIGui(gregtech.api.gui.impl.ModularUIGui) SideOnly(net.minecraftforge.fml.relauncher.SideOnly)

Aggregations

ICustomParticleBlock (gregtech.api.block.ICustomParticleBlock)1 ModularUIGui (gregtech.api.gui.impl.ModularUIGui)1 IBlockState (net.minecraft.block.state.IBlockState)1 GuiScreen (net.minecraft.client.gui.GuiScreen)1 ParticleManager (net.minecraft.client.particle.ParticleManager)1 World (net.minecraft.world.World)1 SideOnly (net.minecraftforge.fml.relauncher.SideOnly)1