use of net.minecraftforge.eventbus.api.SubscribeEvent in project MC-Prefab by Brian-Wuest.
the class ModEventHandler method onPlayerLoginEvent.
/**
* This event occurs when a player logs in. This is used to send server configuration to the client.
*
* @param event The event object.
*/
@SubscribeEvent
public static void onPlayerLoginEvent(PlayerLoggedInEvent event) {
if (!event.getPlayer().level.isClientSide) {
CompoundTag tag = CommonProxy.proxyConfiguration.serverConfiguration.ToNBTTagCompound();
Prefab.network.sendTo(new ConfigSyncMessage(tag), ((ServerPlayer) event.getPlayer()).connection.connection, NetworkDirection.PLAY_TO_CLIENT);
Prefab.LOGGER.info("Sent config to '" + event.getPlayer().getDisplayName().getString() + "'.");
}
}
use of net.minecraftforge.eventbus.api.SubscribeEvent in project Ceramics by KnightMiner.
the class ClientEvents method setupClient.
@SubscribeEvent
static void setupClient(FMLClientSetupEvent event) {
RenderType cutout = RenderType.getCutout();
RenderTypeLookup.setRenderLayer(Registration.TERRACOTTA_GAUGE.get(), cutout);
RenderTypeLookup.setRenderLayer(Registration.PORCELAIN_GAUGE.get(), cutout);
RenderTypeLookup.setRenderLayer(Registration.TERRACOTTA_CISTERN.get(), cutout);
Registration.COLORED_CISTERN.forEach(cistern -> RenderTypeLookup.setRenderLayer(cistern, cutout));
RenderTypeLookup.setRenderLayer(Registration.TERRACOTTA_FAUCET.get(), cutout);
RenderTypeLookup.setRenderLayer(Registration.TERRACOTTA_CHANNEL.get(), cutout);
ScreenManager.registerFactory(Registration.KILN_CONTAINER.get(), KilnScreen::new);
ClientRegistry.bindTileEntityRenderer(Registration.CISTERN_TILE_ENTITY.get(), CisternTileEntityRenderer::new);
ClientRegistry.bindTileEntityRenderer(Registration.FAUCET_TILE_ENTITY.get(), FaucetTileEntityRenderer::new);
ClientRegistry.bindTileEntityRenderer(Registration.CHANNEL_TILE_ENTITY.get(), ChannelTileEntityRenderer::new);
}
Aggregations