Posted October 5, 20186 yr I have a Event Handler and I would like to register it. Does it matter in which FMLInitializationEvent I put in? Main Mod class @Mod(name = Reference.MOD_NAME, modid = Reference.MOD_ID, version = Reference.VERSION, acceptedMinecraftVersions = "1.12.2") public class GemEnchantmentMod { static { FluidRegistry.enableUniversalBucket(); } @SidedProxy(clientSide = Reference.CLIENT_PROXY, serverSide = Reference.SERVER_PROXY) public static CommonProxy proxy; public static final SimpleNetworkWrapper INSTANCE = NetworkRegistry.INSTANCE.newSimpleChannel("edm"); @Instance public static GemEnchantmentMod instance; public static GemEnchantmentModCreativeTab mainTab = new GemEnchantmentModCreativeTab("mainGemEnchantmentMod", new ItemStack(ModItems.fireGem, 1)); @EventHandler public static void PreInit(FMLPreInitializationEvent event) { } @EventHandler public static void Init(FMLInitializationEvent event) { proxy.init(); } @EventHandler public static void PostInit(FMLPostInitializationEvent event) { } } EventHandler class public class EventHandler { @SideOnly(Side.CLIENT) @SubscribeEvent(priority=EventPriority.NORMAL, receiveCanceled=true) public void onEvent(RenderGameOverlayEvent.Pre event) { if (event.getType() == ElementType.ALL) { EntityPlayer thePlayer = Minecraft.getMinecraft().player; if (thePlayer.isInsideOfMaterial(ModMaterials.ENCHANTED)) { drawFluidOverlay(ModFluids.enchantedFluid.getColor(), 0.2F); } } } /** * Draws a rectangle with the specified color */ @SideOnly(Side.CLIENT) public static void drawFluidOverlay(int parColor, float parAlpha) { int left = 0; int top = 0; int right = Minecraft.getMinecraft().displayWidth; int bottom = Minecraft.getMinecraft().displayHeight; Color color = Color.GREEN; Tessellator tessellator = Tessellator.getInstance(); BufferBuilder bufferbuilder = tessellator.getBuffer(); GlStateManager.enableBlend(); GlStateManager.disableTexture2D(); GlStateManager.tryBlendFuncSeparate(GlStateManager.SourceFactor.SRC_ALPHA, GlStateManager.DestFactor.ONE_MINUS_SRC_ALPHA, GlStateManager.SourceFactor.ONE, GlStateManager.DestFactor.ZERO); GlStateManager.color(color.getRed(), color.getGreen(), color.getBlue(), parAlpha); bufferbuilder.begin(7, DefaultVertexFormats.POSITION); bufferbuilder.pos(left, bottom, 0.0D).endVertex(); bufferbuilder.pos(right, bottom, 0.0D).endVertex(); bufferbuilder.pos(right, top, 0.0D).endVertex(); bufferbuilder.pos(left, top, 0.0D).endVertex(); tessellator.draw(); GlStateManager.enableTexture2D(); GlStateManager.disableBlend(); } } Edited October 5, 20186 yr by DeathSpawn
October 5, 20186 yr Author The event is supposed to be in the client proxy and you set client proxy to be a @EventBusSubsciber
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.