mirror of
https://github.com/GTNewHorizons/Botania.git
synced 2026-11-18 19:29:31 +00:00
Clean up more old stuff, make lexica open and close animation work again
This commit is contained in:
1 parent
4af6e06e48
commit
8fb418f12d
11 files changed
+5
-183
No files matched your search
@@ -127,11 +127,6 @@ public class DummyMethodHandler implements IInternalMethodHandler {
|
||||
return null;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean isBuildcraftPipe(TileEntity tile) {
|
||||
return false;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void breakOnAllCursors(PlayerEntity player, Item item, ItemStack stack, BlockPos pos, Direction side) {}
|
||||
|
||||
|
||||
@@ -84,8 +84,6 @@ public interface IInternalMethodHandler {
|
||||
|
||||
public ResourceLocation getDefaultBossBarTexture();
|
||||
|
||||
public boolean isBuildcraftPipe(TileEntity tile);
|
||||
|
||||
public void sparkleFX(World world, double x, double y, double z, float r, float g, float b, float size, int m);
|
||||
|
||||
public long getWorldElapsedTicks();
|
||||
|
||||
@@ -28,6 +28,7 @@ import vazkii.botania.common.core.handler.ManaNetworkHandler;
|
||||
import vazkii.botania.common.core.helper.PlayerHelper;
|
||||
import vazkii.botania.common.item.ModItems;
|
||||
import vazkii.botania.common.lib.LibMisc;
|
||||
import vazkii.patchouli.client.book.gui.GuiBook;
|
||||
|
||||
@Mod.EventBusSubscriber(value = Dist.CLIENT, modid = LibMisc.MOD_ID)
|
||||
public final class ClientTickHandler {
|
||||
@@ -88,7 +89,7 @@ public final class ClientTickHandler {
|
||||
}
|
||||
|
||||
int ticksToOpen = 10;
|
||||
if(gui instanceof GuiLexicon) {
|
||||
if(gui instanceof GuiBook && ((GuiBook) gui).book.getBookItem().getItem() == ModItems.lexicon) {
|
||||
if(ticksWithLexicaOpen < 0)
|
||||
ticksWithLexicaOpen = 0;
|
||||
if(ticksWithLexicaOpen < ticksToOpen)
|
||||
|
||||
@@ -28,6 +28,7 @@ import vazkii.botania.common.item.ItemLexicon;
|
||||
import vazkii.botania.common.item.ModItems;
|
||||
import vazkii.botania.common.lexicon.page.PageText;
|
||||
import vazkii.botania.common.lib.LibMisc;
|
||||
import vazkii.patchouli.client.book.gui.GuiBook;
|
||||
|
||||
// Hacky way to render 3D lexicon, will be reevaluated in the future.
|
||||
@Mod.EventBusSubscriber(value = Dist.CLIENT, modid = LibMisc.MOD_ID)
|
||||
@@ -92,7 +93,8 @@ public class RenderLexicon {
|
||||
|
||||
float ticks = ClientTickHandler.ticksWithLexicaOpen;
|
||||
if(ticks > 0 && ticks < 10) {
|
||||
if(Minecraft.getInstance().currentScreen instanceof GuiLexicon)
|
||||
if(Minecraft.getInstance().currentScreen instanceof GuiBook
|
||||
&& ((GuiBook) Minecraft.getInstance().currentScreen).book.getBookItem().getItem() == ModItems.lexicon)
|
||||
ticks += partialTicks;
|
||||
else ticks -= partialTicks;
|
||||
}
|
||||
|
||||
@@ -10,31 +10,17 @@
|
||||
*/
|
||||
package vazkii.botania.client.core.handler;
|
||||
|
||||
import net.minecraft.client.Minecraft;
|
||||
import net.minecraft.client.gui.FontRenderer;
|
||||
import net.minecraft.client.gui.AbstractGui;
|
||||
import net.minecraft.client.gui.screen.Screen;
|
||||
import net.minecraft.client.renderer.BufferBuilder;
|
||||
import com.mojang.blaze3d.platform.GlStateManager;
|
||||
import net.minecraft.client.renderer.Tessellator;
|
||||
import net.minecraft.client.renderer.vertex.DefaultVertexFormats;
|
||||
import net.minecraft.client.resources.I18n;
|
||||
import net.minecraft.entity.player.PlayerInventory;
|
||||
import net.minecraft.item.ItemStack;
|
||||
import net.minecraft.util.text.TextFormatting;
|
||||
import net.minecraftforge.client.event.RenderTooltipEvent;
|
||||
import net.minecraftforge.eventbus.api.SubscribeEvent;
|
||||
import net.minecraftforge.fml.common.Mod;
|
||||
import net.minecraftforge.api.distmarker.Dist;
|
||||
import org.lwjgl.opengl.GL11;
|
||||
import vazkii.botania.api.lexicon.ILexicon;
|
||||
import vazkii.botania.api.lexicon.LexiconRecipeMappings;
|
||||
import vazkii.botania.api.lexicon.LexiconRecipeMappings.EntryData;
|
||||
import vazkii.botania.api.mana.IManaTooltipDisplay;
|
||||
import vazkii.botania.common.Botania;
|
||||
import vazkii.botania.common.core.handler.ConfigHandler;
|
||||
import vazkii.botania.common.item.ItemLexicon;
|
||||
import vazkii.botania.common.item.ModItems;
|
||||
import vazkii.botania.common.item.equipment.tool.terrasteel.ItemTerraPick;
|
||||
import vazkii.botania.common.lib.LibMisc;
|
||||
|
||||
@@ -43,15 +29,12 @@ import java.awt.Color;
|
||||
@Mod.EventBusSubscriber(value = Dist.CLIENT, modid = LibMisc.MOD_ID)
|
||||
public final class TooltipAdditionDisplayHandler {
|
||||
|
||||
private static float lexiconLookupTime = 0F;
|
||||
|
||||
@SubscribeEvent
|
||||
public static void onToolTipRender(RenderTooltipEvent.PostText evt) {
|
||||
if(evt.getStack().isEmpty())
|
||||
return;
|
||||
|
||||
ItemStack stack = evt.getStack();
|
||||
Minecraft mc = Minecraft.getInstance();
|
||||
int width = evt.getWidth();
|
||||
int height = 3;
|
||||
int tooltipX = evt.getX();
|
||||
@@ -62,85 +45,6 @@ public final class TooltipAdditionDisplayHandler {
|
||||
drawTerraPick(stack, tooltipX, tooltipY, width, height, font);
|
||||
else if(stack.getItem() instanceof IManaTooltipDisplay)
|
||||
drawManaBar(stack, (IManaTooltipDisplay) stack.getItem(), tooltipX, tooltipY, width, height);
|
||||
|
||||
EntryData data = LexiconRecipeMappings.getDataForStack(stack);
|
||||
if(mc.player != null && data != null) {
|
||||
int lexSlot = -1;
|
||||
ItemStack lexiconStack = ItemStack.EMPTY;
|
||||
|
||||
for(int i = 0; i < PlayerInventory.getHotbarSize(); i++) {
|
||||
ItemStack stackAt = mc.player.inventory.getStackInSlot(i);
|
||||
if(!stackAt.isEmpty() && stackAt.getItem() instanceof ILexicon && ((ILexicon) stackAt.getItem()).isKnowledgeUnlocked(stackAt, data.entry.getKnowledgeType())) {
|
||||
lexiconStack = stackAt;
|
||||
lexSlot = i;
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
if(lexSlot > -1) {
|
||||
int x = tooltipX - 34;
|
||||
GlStateManager.disableDepthTest();
|
||||
|
||||
AbstractGui.fill(x - 4, tooltipY - 4, x + 20, tooltipY + 26, 0x44000000);
|
||||
AbstractGui.fill(x - 6, tooltipY - 6, x + 22, tooltipY + 28, 0x44000000);
|
||||
|
||||
if(ConfigHandler.CLIENT.useShiftForQuickLookup.get() ? Screen.hasShiftDown() : Screen.hasControlDown()) {
|
||||
lexiconLookupTime += ClientTickHandler.delta;
|
||||
|
||||
int cx = x + 8;
|
||||
int cy = tooltipY + 8;
|
||||
float r = 12;
|
||||
float time = 20F;
|
||||
float angles = lexiconLookupTime / time * 360F;
|
||||
|
||||
GlStateManager.disableLighting();
|
||||
GlStateManager.disableTexture();
|
||||
GlStateManager.shadeModel(GL11.GL_SMOOTH);
|
||||
GlStateManager.enableBlend();
|
||||
GlStateManager.blendFunc(GL11.GL_SRC_ALPHA, GL11.GL_ONE_MINUS_SRC_ALPHA);
|
||||
|
||||
BufferBuilder buf = Tessellator.getInstance().getBuffer();
|
||||
buf.begin(GL11.GL_TRIANGLE_FAN, DefaultVertexFormats.POSITION_COLOR);
|
||||
|
||||
float a = 0.5F + 0.2F * ((float) Math.cos((double) (ClientTickHandler.ticksInGame + ClientTickHandler.partialTicks) / 10) * 0.5F + 0.5F);
|
||||
buf.pos(cx, cy, 0).color(0F, 0.5F, 0F, a).endVertex();
|
||||
|
||||
for(float i = angles; i > 0; i--) {
|
||||
double rad = (i - 90) / 180F * Math.PI;
|
||||
buf.pos(cx + Math.cos(rad) * r, cy + Math.sin(rad) * r, 0).color(0F, 1F, 0F, 1F).endVertex();
|
||||
}
|
||||
|
||||
buf.pos(cx, cy, 0).color(0F, 1F, 0F, 0F).endVertex();
|
||||
Tessellator.getInstance().draw();
|
||||
|
||||
GlStateManager.disableBlend();
|
||||
GlStateManager.enableTexture();
|
||||
GlStateManager.shadeModel(GL11.GL_FLAT);
|
||||
|
||||
if(lexiconLookupTime >= time) {
|
||||
mc.player.inventory.currentItem = lexSlot;
|
||||
Botania.proxy.setEntryToOpen(data.entry);
|
||||
Botania.proxy.setLexiconStack(lexiconStack);
|
||||
mc.player.closeScreen();
|
||||
// todo 1.14 remove all this
|
||||
|
||||
}
|
||||
} else lexiconLookupTime = 0F;
|
||||
|
||||
mc.getItemRenderer().renderItemIntoGUI(new ItemStack(ModItems.lexicon), x, tooltipY);
|
||||
GlStateManager.disableLighting();
|
||||
|
||||
font.drawStringWithShadow("?", x + 10, tooltipY + 8, 0xFFFFFFFF);
|
||||
GlStateManager.scalef(0.5F, 0.5F, 1F);
|
||||
boolean mac = Minecraft.IS_RUNNING_ON_MAC;
|
||||
|
||||
mc.fontRenderer.drawStringWithShadow(TextFormatting.BOLD + (ConfigHandler.CLIENT.useShiftForQuickLookup.get() ? "Shift" : mac ? "Cmd" : "Ctrl"), (x + 10) * 2 - 16, (tooltipY + 8) * 2 + 20, 0xFFFFFFFF);
|
||||
GlStateManager.scalef(2F, 2F, 1F);
|
||||
|
||||
|
||||
GlStateManager.enableDepthTest();
|
||||
} else lexiconLookupTime = 0F;
|
||||
} else lexiconLookupTime = 0F;
|
||||
}
|
||||
|
||||
private static void drawTerraPick(ItemStack stack, int mouseX, int mouseY, int width, int height, FontRenderer font) {
|
||||
|
||||
@@ -1,39 +0,0 @@
|
||||
/**
|
||||
* This class was created by <Vazkii>. It's distributed as
|
||||
* part of the Botania Mod. Get the Source Code in github:
|
||||
* https://github.com/Vazkii/Botania
|
||||
*
|
||||
* Botania is Open Source and distributed under the
|
||||
* Botania License: http://botaniamod.net/license.php
|
||||
*
|
||||
* File Created @ [Jun 27, 2014, 1:50:49 AM (GMT)]
|
||||
*/
|
||||
package vazkii.botania.client.core.proxy;
|
||||
|
||||
import net.minecraft.client.Minecraft;
|
||||
import net.minecraft.client.gui.screen.Screen;
|
||||
import net.minecraftforge.fml.client.IModGuiFactory;
|
||||
import vazkii.botania.client.gui.GuiBotaniaConfig;
|
||||
|
||||
import java.util.Set;
|
||||
|
||||
public class GuiFactory implements IModGuiFactory {
|
||||
|
||||
@Override
|
||||
public void initialize(Minecraft minecraftInstance) {}
|
||||
|
||||
@Override
|
||||
public boolean hasConfigGui() {
|
||||
return true;
|
||||
}
|
||||
|
||||
@Override
|
||||
public Screen createConfigGui(Screen parentScreen) {
|
||||
return new GuiBotaniaConfig(parentScreen);
|
||||
}
|
||||
|
||||
@Override
|
||||
public Set<RuntimeOptionCategoryElement> runtimeGuiCategories() {
|
||||
return null;
|
||||
}
|
||||
}
|
||||
@@ -1,23 +0,0 @@
|
||||
/**
|
||||
* This class was created by <Vazkii>. It's distributed as
|
||||
* part of the Botania Mod. Get the Source Code in github:
|
||||
* https://github.com/Vazkii/Botania
|
||||
*
|
||||
* Botania is Open Source and distributed under the
|
||||
* Botania License: http://botaniamod.net/license.php
|
||||
*
|
||||
* File Created @ [Jun 27, 2014, 1:52:33 AM (GMT)]
|
||||
*/
|
||||
package vazkii.botania.client.gui;
|
||||
|
||||
import net.minecraft.client.gui.screen.Screen;
|
||||
|
||||
// todo 1.13
|
||||
public class GuiBotaniaConfig extends /*GuiConfig*/ Screen {
|
||||
|
||||
public GuiBotaniaConfig(Screen parentScreen) {
|
||||
super(parentScreen.getTitle());
|
||||
// super(parentScreen, new ConfigElement(ConfigHandler.config.getCategory(Configuration.CATEGORY_GENERAL)).getChildElements(), LibMisc.MOD_ID, false, false, GuiConfig.getAbridgedConfigPath(ConfigHandler.config.toString()));
|
||||
}
|
||||
|
||||
}
|
||||
@@ -15,7 +15,6 @@ import com.mojang.blaze3d.platform.GlStateManager;
|
||||
import net.minecraft.client.resources.I18n;
|
||||
import net.minecraft.util.text.TextFormatting;
|
||||
import vazkii.botania.client.core.helper.RenderHelper;
|
||||
import vazkii.botania.client.gui.GuiBotaniaConfig;
|
||||
import vazkii.botania.client.gui.lexicon.GuiLexicon;
|
||||
|
||||
import javax.annotation.Nonnull;
|
||||
|
||||
@@ -288,17 +288,10 @@ public class Botania {
|
||||
|
||||
/* todo 1.13
|
||||
public void init(FMLInitializationEvent event) {
|
||||
NetworkRegistry.INSTANCE.registerGuiHandler(Botania.instance, new GuiHandler());
|
||||
|
||||
FMLInterModComms.sendMessage("projecte", "interdictionblacklist", EntityManaBurst.class.getCanonicalName());
|
||||
|
||||
for(Block b : new Block[]{ ModBlocks.manaGlass, ModBlocks.elfGlass, ModBlocks.bifrostPerm })
|
||||
FMLInterModComms.sendMessage("chiselsandbits", "ignoreblocklogic", b.getRegistryName().toString());
|
||||
|
||||
|
||||
|
||||
if(Botania.bcApiLoaded)
|
||||
new StatementAPIPlugin();
|
||||
}
|
||||
*/
|
||||
|
||||
|
||||
@@ -169,11 +169,6 @@ public class InternalMethodHandler extends DummyMethodHandler {
|
||||
return LibMisc.PASSIVE_FLOWER_DECAY;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean isBuildcraftPipe(TileEntity tile) {
|
||||
return false; // tile instanceof IPipeTile; todo buildcraft
|
||||
}
|
||||
|
||||
@Override
|
||||
public void breakOnAllCursors(PlayerEntity player, Item item, ItemStack stack, BlockPos pos, Direction side) {
|
||||
ItemLokiRing.breakOnAllCursors(player, item, stack, pos, side);
|
||||
|
||||
@@ -526,9 +526,6 @@ public class EntityManaBurst extends ThrowableEntity implements IManaBurst {
|
||||
|| block instanceof LeavesBlock)
|
||||
return;
|
||||
|
||||
if(BotaniaAPI.internalHandler.isBuildcraftPipe(tile))
|
||||
return;
|
||||
|
||||
BlockPos coords = getBurstSourceBlockPos();
|
||||
if(tile != null && !tile.getPos().equals(coords))
|
||||
collidedTile = tile;
|
||||
|
||||
Reference in new issue
Block a user