mirror of
https://github.com/Ellpeck/NaturesAura.git
synced 2024-12-22 14:59:22 +01:00
make this whole thing work way better with that new patchouli feature I just added
This commit is contained in:
parent
3ba3c064fc
commit
0ff2f5198d
5 changed files with 55 additions and 52 deletions
|
@ -38,7 +38,7 @@ repositories {
|
|||
}
|
||||
|
||||
dependencies {
|
||||
compile "vazkii.patchouli:Patchouli:1.0-18.92"
|
||||
compile "vazkii.patchouli:Patchouli:1.0-18.93"
|
||||
|
||||
deobfCompile "mezz.jei:jei_1.12.2:4.14.4.267"
|
||||
deobfCompile "com.azanor.baubles:Baubles:1.12-1.5.2"
|
||||
|
|
|
@ -4,6 +4,8 @@ import de.ellpeck.naturesaura.compat.crafttweaker.CraftTweakerCompat;
|
|||
import de.ellpeck.naturesaura.compat.patchouli.PatchouliCompat;
|
||||
import net.minecraftforge.common.MinecraftForge;
|
||||
import net.minecraftforge.fml.common.Loader;
|
||||
import net.minecraftforge.fml.relauncher.Side;
|
||||
import net.minecraftforge.fml.relauncher.SideOnly;
|
||||
|
||||
public final class Compat {
|
||||
|
||||
|
@ -22,6 +24,10 @@ public final class Compat {
|
|||
PatchouliCompat.preInit();
|
||||
}
|
||||
|
||||
public static void preInitClient() {
|
||||
PatchouliCompat.preInitClient();
|
||||
}
|
||||
|
||||
public static void postInit() {
|
||||
if (craftTweaker && mtLib)
|
||||
CraftTweakerCompat.postInit();
|
||||
|
|
|
@ -13,9 +13,12 @@ import net.minecraft.client.renderer.RenderHelper;
|
|||
import net.minecraft.entity.player.EntityPlayer;
|
||||
import net.minecraft.util.ResourceLocation;
|
||||
import net.minecraft.util.text.TextFormatting;
|
||||
import net.minecraftforge.common.MinecraftForge;
|
||||
import net.minecraftforge.fml.client.config.GuiUtils;
|
||||
import net.minecraftforge.fml.common.eventhandler.SubscribeEvent;
|
||||
import net.minecraftforge.fml.relauncher.Side;
|
||||
import net.minecraftforge.fml.relauncher.SideOnly;
|
||||
import vazkii.patchouli.api.BookDrawScreenEvent;
|
||||
import vazkii.patchouli.api.PatchouliAPI;
|
||||
|
||||
import java.time.LocalDateTime;
|
||||
|
@ -30,59 +33,57 @@ public final class PatchouliCompat {
|
|||
PatchouliAPI.instance.setConfigFlag(NaturesAura.MOD_ID + ":rf_converter", ModConfig.enabledFeatures.rfConverter);
|
||||
}
|
||||
|
||||
public static void preInitClient() {
|
||||
MinecraftForge.EVENT_BUS.register(new PatchouliCompat());
|
||||
}
|
||||
|
||||
@SubscribeEvent
|
||||
@SideOnly(Side.CLIENT)
|
||||
public static void onGuiRender(GuiScreen gui, int mouseX, int mouseY) {
|
||||
boolean display = false;
|
||||
try {
|
||||
ResourceLocation open = PatchouliAPI.instance.getOpenBookGui();
|
||||
display = open != null && open.equals(BOOK);
|
||||
} catch (Throwable ignored) {
|
||||
// TODO remove this once Patchouli update is out long enough
|
||||
public void onBookDraw(BookDrawScreenEvent event) {
|
||||
if (event.book == null || !event.book.equals(BOOK))
|
||||
return;
|
||||
LocalDateTime now = LocalDateTime.now();
|
||||
if (now.getMonth() == Month.MAY && now.getDayOfMonth() == 21) {
|
||||
int x = event.gui.width / 2 + 272 / 2 - 16;
|
||||
int y = event.gui.height / 2 - 180 / 2 - 26;
|
||||
|
||||
RenderHelper.disableStandardItemLighting();
|
||||
GlStateManager.color(1, 1, 1, 1);
|
||||
event.gui.mc.getTextureManager().bindTexture(ClientEvents.BOOK_GUI);
|
||||
Gui.drawModalRectWithCustomSizedTexture(x, y, 469, 0, 43, 42, 512, 256);
|
||||
|
||||
if (event.mouseX >= x && event.mouseY >= y && event.mouseX < x + 43 && event.mouseY < y + 42)
|
||||
GuiUtils.drawHoveringText(
|
||||
Collections.singletonList(TextFormatting.GOLD + "It's the author Ellpeck's birthday!"),
|
||||
event.mouseX, event.mouseY, event.gui.width, event.gui.height, 0, event.gui.mc.fontRenderer);
|
||||
}
|
||||
if (display) {
|
||||
LocalDateTime now = LocalDateTime.now();
|
||||
if (now.getMonth() == Month.MAY && now.getDayOfMonth() == 21) {
|
||||
int x = gui.width / 2 + 272 / 2 - 16;
|
||||
int y = gui.height / 2 - 180 / 2 - 26;
|
||||
|
||||
RenderHelper.disableStandardItemLighting();
|
||||
GlStateManager.color(1, 1, 1, 1);
|
||||
gui.mc.getTextureManager().bindTexture(ClientEvents.BOOK_GUI);
|
||||
Gui.drawModalRectWithCustomSizedTexture(x, y, 469, 0, 43, 42, 512, 256);
|
||||
String name = event.gui.mc.player.getName();
|
||||
FancyInfo info = SupporterFancyHandler.FANCY_INFOS.get(name);
|
||||
if (info != null) {
|
||||
int x = event.gui.width / 2 - 272 / 2 + 20;
|
||||
int y = event.gui.height / 2 + 180 / 2;
|
||||
|
||||
if (mouseX >= x && mouseY >= y && mouseX < x + 43 && mouseY < y + 42)
|
||||
GuiUtils.drawHoveringText(
|
||||
Collections.singletonList(TextFormatting.GOLD + "It's the author Ellpeck's birthday!"),
|
||||
mouseX, mouseY, gui.width, gui.height, 0, gui.mc.fontRenderer);
|
||||
RenderHelper.disableStandardItemLighting();
|
||||
GlStateManager.color(1, 1, 1, 1);
|
||||
event.gui.mc.getTextureManager().bindTexture(ClientEvents.BOOK_GUI);
|
||||
|
||||
Gui.drawModalRectWithCustomSizedTexture(x, y, 496, 44, 16, 18, 512, 256);
|
||||
if (info.tier == 1) {
|
||||
Gui.drawModalRectWithCustomSizedTexture(x, y, 496 - 16, 44, 16, 18, 512, 256);
|
||||
} else {
|
||||
float r = ((info.color >> 16) & 255) / 255F;
|
||||
float g = ((info.color >> 8) & 255) / 255F;
|
||||
float b = (info.color & 255) / 255F;
|
||||
GlStateManager.color(r, g, b);
|
||||
Gui.drawModalRectWithCustomSizedTexture(x, y, 496 - 32, 44, 16, 18, 512, 256);
|
||||
}
|
||||
|
||||
String name = gui.mc.player.getName();
|
||||
FancyInfo info = SupporterFancyHandler.FANCY_INFOS.get(name);
|
||||
if (info != null) {
|
||||
int x = gui.width / 2 - 272 / 2 + 20;
|
||||
int y = gui.height / 2 + 180 / 2;
|
||||
if (event.mouseX >= x && event.mouseY >= y && event.mouseX < x + 16 && event.mouseY < y + 18)
|
||||
GuiUtils.drawHoveringText(
|
||||
Collections.singletonList(TextFormatting.YELLOW + "Thanks for your support, " + name + "!"),
|
||||
event.mouseX, event.mouseY, event.gui.width, event.gui.height, 0, event.gui.mc.fontRenderer);
|
||||
|
||||
RenderHelper.disableStandardItemLighting();
|
||||
GlStateManager.color(1, 1, 1, 1);
|
||||
gui.mc.getTextureManager().bindTexture(ClientEvents.BOOK_GUI);
|
||||
|
||||
Gui.drawModalRectWithCustomSizedTexture(x, y, 496, 44, 16, 18, 512, 256);
|
||||
if (info.tier == 1) {
|
||||
Gui.drawModalRectWithCustomSizedTexture(x, y, 496 - 16, 44, 16, 18, 512, 256);
|
||||
} else {
|
||||
float r = ((info.color >> 16) & 255) / 255F;
|
||||
float g = ((info.color >> 8) & 255) / 255F;
|
||||
float b = (info.color & 255) / 255F;
|
||||
GlStateManager.color(r, g, b);
|
||||
Gui.drawModalRectWithCustomSizedTexture(x, y, 496 - 32, 44, 16, 18, 512, 256);
|
||||
}
|
||||
|
||||
if (mouseX >= x && mouseY >= y && mouseX < x + 16 && mouseY < y + 18)
|
||||
GuiUtils.drawHoveringText(
|
||||
Collections.singletonList(TextFormatting.YELLOW + "Thanks for your support, " + name + "!"),
|
||||
mouseX, mouseY, gui.width, gui.height, 0, gui.mc.fontRenderer);
|
||||
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -102,11 +102,6 @@ public class ClientEvents {
|
|||
mc.profiler.endSection();
|
||||
}
|
||||
|
||||
@SubscribeEvent
|
||||
public void onGuiRender(GuiScreenEvent.DrawScreenEvent.Post event) {
|
||||
PatchouliCompat.onGuiRender(event.getGui(), event.getMouseX(), event.getMouseY());
|
||||
}
|
||||
|
||||
@SubscribeEvent
|
||||
public void onRenderLast(RenderWorldLastEvent event) {
|
||||
Minecraft mc = Minecraft.getMinecraft();
|
||||
|
|
|
@ -37,6 +37,7 @@ public class ClientProxy implements IProxy {
|
|||
@Override
|
||||
public void preInit(FMLPreInitializationEvent event) {
|
||||
MinecraftForge.EVENT_BUS.register(new ClientEvents());
|
||||
Compat.preInitClient();
|
||||
}
|
||||
|
||||
@Override
|
||||
|
|
Loading…
Reference in a new issue