Jump to content

CraftedCart

Members
  • Posts

    22
  • Joined

  • Last visited

Everything posted by CraftedCart

  1. I have a mod set up and it works fine when running :runClient with Gradle. The issue I have though, is that when running :build , the build terminates at :extractRangemapReplacedMain . This only seems to happen for one of my mods though. That depends on another mod which builds just fine. I've tried running gradle clean , deleting ~/.gradle, as well as deleting my mod's .gradle and build folders. Doing neither helped. Forge Vesion: 1.9.4-12.17.0.1990 gradle build output: build.gradle : settings.gradle :
  2. Hi there. I would like to draw on top of inventory screens, however I have one issue. Items in inventories draw above my overlay. Here, I'm darkening the screen (Eventually, I plan to draw useful stuff on top of the inventory GUI, rather than just darkening the screen, so please don't tell me to not bother darkening it). Notice how the chest draws on top of my overlay. I hook into RenderTickEvent to draw on top of inventories @SubscribeEvent public void tickEvent(TickEvent.RenderTickEvent e) { if (e.phase == TickEvent.Phase.END) { UIUtils.calcStuff(); drawOverlay(); } } public void drawOverlay() { Minecraft mc = Minecraft.getMinecraft(); if (mc.currentScreen instanceof GuiContainer) { //A container GUI is open drawContainerOverlay(mc, (GuiContainer) mc.currentScreen); //This draws the overlay } }
  3. It seems that messing with the GL Matrix stuffs it up... Any advice anyone? Doing GL11.glMatrixMode(GL11.GL_PROJECTION); after drawing works, but only when the Minecraft window is small. Otherwise, the window is just a solid colour.
  4. I do re-enable Texture2D GuiUtils.setup(false); rootComponent.onUpdate(); GL11.glColor4d(1, 1, 1, 1); GlStateManager.enableTexture2D(); // <<<< This line here! GL11.glEnable(GL11.GL_BLEND); GL11.glMatrixMode(GL11.GL_PROJECTION); int guiScale = new ScaledResolution(Minecraft.getMinecraft(), Minecraft.getMinecraft().displayWidth, Minecraft.getMinecraft().displayHeight).getScaleFactor(); GL11.glScaled(guiScale, guiScale, guiScale); As for seeing the whole class... (There's several) Well... I made a custom GUI system. I'll show you the main parts. All of the drawing is done with the GuiUtils class The other main classes are UIRootComponent, UIComponent and GuiGameOverlay Here are the 4 files (You asked for the whole thing. It's rather large!): https://gist.github.com/CraftedCart/e53f6465e60fff6ed45d
  5. Hi there! I have an overlay (Hooked into RenderGameOverlayEvent) and have tried drawing a simple semi-transparent white rectangle Unfortunatly, the rectangle is opaque (not 50% transparent), and items become invisble in my hotbar, and when I open my inventory screen Showing NEI crashes with a message to do with drawing items. Here's the NEI crash stack in case if it helps at net.minecraft.item.ItemStack.getMetadata(ItemStack.java:280) at net.minecraft.client.renderer.ItemModelMesher.getMetadata(ItemModelMesher.java:70) at net.minecraft.client.renderer.ItemModelMesher.getItemModel(ItemModelMesher.java:43) at net.minecraft.client.renderer.entity.RenderItem.renderItemIntoGUI(RenderItem.java:360) at codechicken.nei.guihook.GuiContainerManager.drawItem(GuiContainerManager.java:210) at codechicken.nei.guihook.GuiContainerManager.drawItem(GuiContainerManager.java:178) at codechicken.nei.ItemPanel.draw(ItemPanel.java:129) at codechicken.nei.LayoutManager.renderObjects(LayoutManager.java:197) at codechicken.nei.guihook.GuiContainerManager.renderObjects(GuiContainerManager.java:389) at net.minecraft.client.gui.inventory.GuiContainer.drawScreen(GuiContainer.java:135) at net.minecraftforge.client.ForgeHooksClient.drawScreen(ForgeHooksClient.java:470) Transparency works on the shadow at the bottom of the white rectangle, and it also works if I clear the screen before drawing anything. Here's the code for the overlay GuiUtils.setup(false); rootComponent.onUpdate(); GL11.glColor4d(1, 1, 1, 1); GlStateManager.enableTexture2D(); GL11.glEnable(GL11.GL_BLEND); GL11.glMatrixMode(GL11.GL_PROJECTION); int guiScale = new ScaledResolution(Minecraft.getMinecraft(), Minecraft.getMinecraft().displayWidth, Minecraft.getMinecraft().displayHeight).getScaleFactor(); GL11.glScaled(guiScale, guiScale, guiScale); rootComponent.onUpdate() draws the UI Here's GuiUtils.setup() public static void setup(boolean clearBuffer) { GL11.glMatrixMode(GL11.GL_PROJECTION); GL11.glLoadIdentity(); GL11.glOrtho(0, Display.getWidth(), Display.getHeight(), 0, 10000, -10000); GL11.glMatrixMode(GL11.GL_MODELVIEW); if (clearBuffer) { GL11.glClear(GL11.GL_COLOR_BUFFER_BIT | GL11.GL_DEPTH_BUFFER_BIT); } GL11.glShadeModel(GL11.GL_SMOOTH); GL11.glEnable(GL11.GL_LINE_SMOOTH); GlStateManager.enableBlend(); GlStateManager.disableTexture2D(); GlStateManager.tryBlendFuncSeparate(770, 771, 1, 0); GlStateManager.color(1, 1, 1, 1); TextureImpl.bindNone(); }
  6. Ah, I probably should have said that I packaged the code into a .jar (IntelliJ's Build > Build Artifact) when it was running in the dev environment, and that the dev environment read from that jar, rather than reading from the soruce.
  7. TL;DR A plugin system which adds Jars to the classloader can call several Minecraft methods when running from within IntelliJ Idea, however it errors when running it in standard Forge (when the mod jar is dropped in the mods folder) Hi there! I'm trying to develop a plugin system for my mod, however I'm very confused as to why it works when I run / debug it from IntelliJ Idea, but it doesn't work when I put the mod jar in my mods folder, and the plugin in the mods/CraftedCart/MFFClientPlugins folder. The plugin loads, however it errors whenever I try to use several Minecraft methods. GLStateManager seems to be broken. It couldn't pushMatrix or translate BlockPos also seems to be broken. It errors when I try to getX() Here's the error for the getX() method ( testMFFPlugin is the plugin, and it's trying to draw a TESR ). Caused by: java.lang.NoSuchMethodError: net.minecraft.util.BlockPos.getX()I The whole stack: 10:19:29] [Client thread/INFO] [sTDERR]: [java.lang.Throwable$WrappedPrintStream:println:748]: java.lang.reflect.InvocationTargetException [10:19:29] [Client thread/INFO] [sTDERR]: [java.lang.Throwable$WrappedPrintStream:println:748]: at sun.reflect.GeneratedMethodAccessor8.invoke(Unknown Source) [10:19:29] [Client thread/INFO] [sTDERR]: [java.lang.Throwable$WrappedPrintStream:println:748]: at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43) [10:19:29] [Client thread/INFO] [sTDERR]: [java.lang.Throwable$WrappedPrintStream:println:748]: at java.lang.reflect.Method.invoke(Method.java:497) [10:19:29] [Client thread/INFO] [sTDERR]: [java.lang.Throwable$WrappedPrintStream:println:748]: at io.github.craftedcart.MFF.client.render.blocks.TERendererFFProjector.func_180535_a(TERendererFFProjector.java:37) [10:19:29] [Client thread/INFO] [sTDERR]: [java.lang.Throwable$WrappedPrintStream:println:748]: at net.minecraft.client.renderer.tileentity.TileEntityRendererDispatcher.func_178469_a(SourceFile:114) [10:19:29] [Client thread/INFO] [sTDERR]: [java.lang.Throwable$WrappedPrintStream:println:748]: at net.minecraft.client.renderer.tileentity.TileEntityRendererDispatcher.func_180546_a(SourceFile:102) [10:19:29] [Client thread/INFO] [sTDERR]: [java.lang.Throwable$WrappedPrintStream:println:748]: at net.minecraft.client.renderer.RenderGlobal.func_180446_a(RenderGlobal.java:655) [10:19:29] [Client thread/INFO] [sTDERR]: [java.lang.Throwable$WrappedPrintStream:println:748]: at net.minecraft.client.renderer.EntityRenderer.func_175068_a(EntityRenderer.java:1294) [10:19:29] [Client thread/INFO] [sTDERR]: [java.lang.Throwable$WrappedPrintStream:println:748]: at net.minecraft.client.renderer.EntityRenderer.func_78471_a(EntityRenderer.java:1207) [10:19:29] [Client thread/INFO] [sTDERR]: [java.lang.Throwable$WrappedPrintStream:println:748]: at net.minecraft.client.renderer.EntityRenderer.func_78480_b(EntityRenderer.java:1032) [10:19:29] [Client thread/INFO] [sTDERR]: [java.lang.Throwable$WrappedPrintStream:println:748]: at net.minecraft.client.Minecraft.func_71411_J(Minecraft.java:1048) [10:19:29] [Client thread/INFO] [sTDERR]: [java.lang.Throwable$WrappedPrintStream:println:748]: at net.minecraft.client.Minecraft.func_99999_d(Minecraft.java:345) [10:19:29] [Client thread/INFO] [sTDERR]: [java.lang.Throwable$WrappedPrintStream:println:748]: at net.minecraft.client.main.Main.main(SourceFile:120) [10:19:29] [Client thread/INFO] [sTDERR]: [java.lang.Throwable$WrappedPrintStream:println:748]: at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) [10:19:29] [Client thread/INFO] [sTDERR]: [java.lang.Throwable$WrappedPrintStream:println:748]: at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62) [10:19:29] [Client thread/INFO] [sTDERR]: [java.lang.Throwable$WrappedPrintStream:println:748]: at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43) [10:19:29] [Client thread/INFO] [sTDERR]: [java.lang.Throwable$WrappedPrintStream:println:748]: at java.lang.reflect.Method.invoke(Method.java:497) [10:19:29] [Client thread/INFO] [sTDERR]: [java.lang.Throwable$WrappedPrintStream:println:748]: at net.minecraft.launchwrapper.Launch.launch(Launch.java:135) [10:19:29] [Client thread/INFO] [sTDERR]: [java.lang.Throwable$WrappedPrintStream:println:748]: at net.minecraft.launchwrapper.Launch.main(Launch.java:28) [10:19:29] [Client thread/INFO] [sTDERR]: [java.lang.Throwable$WrappedPrintStream:println:748]: Caused by: java.lang.NoSuchMethodError: net.minecraft.util.BlockPos.getX()I [10:19:29] [Client thread/INFO] [sTDERR]: [java.lang.Throwable$WrappedPrintStream:println:748]: at io.github.craftedcart.TestMFFPlugin.TestMFFPluginBase.renderTEFFProjector(TestMFFPluginBase.java:65) [10:19:29] [Client thread/INFO] [sTDERR]: [java.lang.Throwable$WrappedPrintStream:println:748]: ... 19 more FramebufferStatus 0x0000 at beginHand FramebufferStatus 0x0000 at pre endHand GL error 0x0502: Invalid operation at renderCompositeFinal The details of how plugins are loaded: 1: Plugins are added to the class loader LaunchClassLoader loader = (LaunchClassLoader) DependencyUtils.class.getClassLoader(); //DependencyUtils is one of my classes loader.addURL(file.toURI().toURL()); //In this case, the file variable would be the mods/CraftedCart/MFFClientPlugins/testMFFPlugin.jar file 2: Plugins are searched for an @MFFClientPlugin annotation using Reflections (Note the extra s on the end of that. It's an external library) Reflections reflections = new Reflections(); clientPlugins = reflections.getTypesAnnotatedWith(MFFClientPlugin.class); 3: The load() method is called on all plugins using Reflection for (Class clazz : clientPlugins) { Method loadMethod = clazz.getMethod("load"); loadMethod.invoke(clazz.newInstance()); } In the test plugin, it would set 2 variables (The method to call when rendering the TESR, and its class) The TESR then uses Reflection to invoke the method on that class
  8. Hi there! I have a TileEntitySpecialRenderer set up and I would like it to render stuff quite far outside it's bounding box. The only issue is that if the block isn't in view, it gets culled and the stuff outside disappears. How would I make it so that it doesn't get culled? Thanks.
  9. Hi there. The mod I'm working on requires another jar file to function properly (slick-util.jar). I have it set up so that if the file mods/CraftedCart/slick-util.jar doesn't exist, my mod will download it before doing anything else (in pre-init). The only issue I have now is how do I load the .jar file. I am aware of the Loader and ModDiscoverer classes, however I have no idea how to use them, or if they will help. (Oh, and slick-util.jar isn't a mod, but it works if I throw it into the mods folder) EDIT: Nevermind, found it whilst looking through CodeChickenCore File depsPath = new File(Minecraft.getMinecraft().mcDataDir.getAbsolutePath(), "mods/CraftedCart"); LaunchClassLoader loader = (LaunchClassLoader) DependencyUtils.class.getClassLoader(); loader.addURL(new File(depsPath, "slick-util.jar").toURI().toURL()); As far as I can tell, my DependencyUtils class can be replaced with another one of your own classes. The example above will load mods/CraftedCart/slick-util.jar
  10. Are they for 1.7? I can't seem to find them in 1.8. I did manage to find worldObj.isBlockLoaded() however
  11. Hi. I have a TileEntity which sets blocks, however I'm running into a problem where if it tries to place a block in an unloaded chunk (I think), a large, oddly shaped wall appears in that unloaded area, before the chunk is loaded and the wall is removed. Minecraft also appears to slow to a crawl while this happens. Chunks take a really long time to load, and I get Can't keep up messages several times in the console. How would I check if a block is in a loaded chunk, before trying to place it? Here are some screenshots:
  12. I guess I could draw a thin cuboid, however I kinda wanted a way to dynamically change the colour of the gradient dynamically (Interpolation). Do you know of any way to do that (eg, is there a way to use a procedurally generated texture?) Also the glow in the screenshot is quite nice. Does anyone have any idea how to implement that?
  13. Hi. I'm trying to make it so that when given 2 positions in the world (BlockPos), as well as 2 colours, I can draw a line between the 2 points with a gradient. I know you can draw faces with the Tessellator, but I'm looking for something like this (Xycraft, where there are no visible faces): Thanks
  14. Ah, thanks - That did get it to render as an item. As for the TESR code, it's pretty much the same as this , but adapted to work with a TESR, rather than on an entity http://jabelarminecraft.blogspot.co.uk/p/minecraft-forge-172-quick-tips-gl11-and.html
  15. I've set up a block with a TileEntitySpecialRenderer which renders fine when I place it in the world, however I have no idea how to make it render in an inventory (It's currently a block with the missing texture in an inventory). How would I do this? If it's not possible, then how do I make it so that a block renders as a 2D item in an inventory? Thanks
×
×
  • Create New...

Important Information

By using this site, you agree to our Terms of Use.