use of net.minecraftforge.fml.common.eventhandler.SubscribeEvent in project RFToolsDimensions by McJty.
the class ForgeEventHandlers method onOreGenEvent.
@SubscribeEvent
public void onOreGenEvent(OreGenEvent.GenerateMinable event) {
World world = event.getWorld();
if (world == null) {
return;
}
WorldProvider provider = world.provider;
if (!(provider instanceof GenericWorldProvider))
return;
DimensionInformation information = ((GenericWorldProvider) provider).getDimensionInformation();
if (information != null && information.hasFeatureType(FeatureType.FEATURE_CLEAN)) {
event.setResult(Event.Result.DENY);
}
}
use of net.minecraftforge.fml.common.eventhandler.SubscribeEvent in project Gaspunk by Ladysnake.
the class GasRecipeDeserializer method loadRecipes.
@SubscribeEvent
public static void loadRecipes(RegistryEvent.Register<IRecipe> event) {
ModContainer gaspunkContainer = Loader.instance().activeModContainer();
Loader.instance().getActiveModList().forEach(GasRecipeDeserializer::loadRecipes);
Loader.instance().setActiveModContainer(gaspunkContainer);
File configFolder = new File(GasPunk.lib.getConfigFolder(), GasPunk.MOD_ID + "/custom_recipes");
// if the config folder was just created or couldn't be created, no need to search it
if (!configFolder.mkdirs() && configFolder.exists()) {
JsonContext context = new JsonContext(GasPunk.MOD_ID);
try {
Files.walk(configFolder.toPath()).forEach(path -> loadRecipes(configFolder.toPath(), path, context));
} catch (IOException e) {
e.printStackTrace();
}
}
}
use of net.minecraftforge.fml.common.eventhandler.SubscribeEvent in project Gaspunk by Ladysnake.
the class ModItems method registerRenders.
@SideOnly(Side.CLIENT)
@SubscribeEvent
public static void registerRenders(ModelRegistryEvent event) {
ModelLoader.setCustomModelResourceLocation(EMPTY_SYRINGE, 0, new ModelResourceLocation(new ResourceLocation("pathos:empty_syringe"), "inventory"));
ModelLoader.setCustomModelResourceLocation(FILLED_SYRINGE, 0, new ModelResourceLocation(new ResourceLocation("pathos:filled_syringe"), "inventory"));
}
use of net.minecraftforge.fml.common.eventhandler.SubscribeEvent in project MorePlanets by SteveKunG.
the class ClientEventHandler method onRenderGameOverlay.
@SubscribeEvent
@SideOnly(Side.CLIENT)
public void onRenderGameOverlay(RenderGameOverlayEvent event) {
if (event.getType().equals(RenderGameOverlayEvent.ElementType.ALL)) {
if (this.mc.gameSettings.thirdPersonView == 0) {
if (this.mc.player.isPotionActive(MPPotions.INFECTED_CRYSTALLIZE)) {
Tessellator tessellator = Tessellator.getInstance();
BufferBuilder worldrenderer = tessellator.getBuffer();
GlStateManager.color(1.0F, 1.0F, 1.0F, 0.9F);
GlStateManager.depthFunc(519);
GlStateManager.depthMask(false);
GlStateManager.enableBlend();
GlStateManager.tryBlendFuncSeparate(770, 771, 1, 0);
float f = 1.0F;
for (int i = 0; i < 2; ++i) {
GlStateManager.pushMatrix();
TextureAtlasSprite textureatlassprite = this.mc.getTextureMapBlocks().getAtlasSprite("moreplanets:blocks/infected_crystallize");
this.mc.getTextureManager().bindTexture(TextureMap.LOCATION_BLOCKS_TEXTURE);
float f1 = textureatlassprite.getMinU();
float f2 = textureatlassprite.getMaxU();
float f3 = textureatlassprite.getMinV();
float f4 = textureatlassprite.getMaxV();
float f5 = (0.0F - f) / 2.0F;
float f6 = f5 + f;
float f7 = 0.0F - f / 2.0F;
float f8 = f7 + f;
float f9 = -0.5F;
GlStateManager.translate(-(i * 2 - 1) * 0.24F, -0.3F, 0.0F);
GlStateManager.rotate((i * 2 - 1) * 10.0F, 0.0F, 1.0F, 0.0F);
worldrenderer.begin(7, DefaultVertexFormats.POSITION_TEX);
worldrenderer.pos(f5, f7, f9).tex(f2, f4).endVertex();
worldrenderer.pos(f6, f7, f9).tex(f1, f4).endVertex();
worldrenderer.pos(f6, f8, f9).tex(f1, f3).endVertex();
worldrenderer.pos(f5, f8, f9).tex(f2, f3).endVertex();
tessellator.draw();
GlStateManager.popMatrix();
}
GlStateManager.color(1.0F, 1.0F, 1.0F, 1.0F);
GlStateManager.disableBlend();
GlStateManager.depthMask(true);
GlStateManager.depthFunc(515);
}
if (this.isEntityInsideBlock(ChalosBlocks.CHEESE_OF_MILK_GAS_BLOCK)) {
this.renderOverlay("cheese_of_milk_gas", this.mc.player.getBrightness(), 0.75F, event.getPartialTicks(), -0.25D);
}
if (this.isEntityInsideBlock(NibiruBlocks.HELIUM_GAS_BLOCK)) {
this.renderOverlay("helium_gas", this.mc.player.getBrightness(), 0.75F, event.getPartialTicks(), -0.25D);
}
}
}
}
use of net.minecraftforge.fml.common.eventhandler.SubscribeEvent in project MorePlanets by SteveKunG.
the class ClientEventHandler method onClientTick.
@SubscribeEvent
@SideOnly(Side.CLIENT)
public void onClientTick(ClientTickEvent event) {
if (MorePlanetsCore.isObfuscatedEnvironment()) {
if (Keyboard.isKeyDown(Keyboard.KEY_F7)) {
try {
// used for real time debugging item description
Object proxy = Class.forName("mezz.jei.JustEnoughItems").getDeclaredMethod("getProxy").invoke(Class.forName("mezz.jei.startup.ProxyCommonClient"));
Field pluginsField = proxy.getClass().getDeclaredField("plugins");
pluginsField.setAccessible(true);
Class<?> starter = Class.forName("mezz.jei.startup.JeiStarter");
Object obj = starter.newInstance();
Method method = obj.getClass().getDeclaredMethod("start", List.class);
method.invoke(obj, (ArrayList<Object>) pluginsField.get(proxy));
} catch (Exception e) {
e.printStackTrace();
}
}
if (Keyboard.isKeyDown(Keyboard.KEY_NUMPAD5) && !this.mc.player.getHeldItemMainhand().isEmpty()) {
this.mc.displayGuiScreen(new GuiGetItemName());
}
}
if (ClientEventHandler.loadRenderers) {
if (--this.loadRendererTick == 0) {
MPLog.debug("Reload renderer");
this.mc.renderGlobal.loadRenderers();
this.loadRendererTick = 30;
ClientEventHandler.loadRenderers = false;
}
}
if (this.mc.player != null) {
if (ConfigManagerMP.enableStartedPlanet && this.mc.player.dimension == -1 && this.mc.currentScreen instanceof GuiGameOver && !(this.mc.currentScreen instanceof GuiGameOverMP)) {
this.mc.displayGuiScreen(new GuiGameOverMP());
}
}
if (this.mc.currentScreen instanceof GuiMainMenu) {
ClientEventHandler.receiverRenderPos.clear();
ClientEventHandler.wasteRenderPos.clear();
ClientEventHandler.entityId.clear();
ClientEventHandler.bossList.clear();
ClientEventHandler.itemRendererTicks = 0;
}
if (event.phase == Phase.START) {
ClientEventHandler.itemRendererTicks++;
this.partialTicks++;
WeatherRendererNibiru.INSTANCE.runRenderTick();
CloudRendererNibiru.INSTANCE.runRenderTick();
}
}
Aggregations