TheGreyGhost
Members-
Posts
3280 -
Joined
-
Last visited
-
Days Won
8
Everything posted by TheGreyGhost
-
[1.10.2] Is there a simple tutorial for creating items?
TheGreyGhost replied to FrozenPeas's topic in Modder Support
Hi You might find this example project useful https://github.com/TheGreyGhost/MinecraftByExample MBE10 is probably the example you want. -TGG -
Items not being added to custom CreativeTabs
TheGreyGhost replied to iiBlake's topic in Modder Support
Hi You might find this example project useful https://github.com/TheGreyGhost/MinecraftByExample mbe08 shows how you can add items to creative tabs https://github.com/TheGreyGhost/MinecraftByExample/tree/master/src/main/java/minecraftbyexample/mbe08_creative_tab -TGG -
[1.10] Sending data with packets [SOLVED]
TheGreyGhost replied to TheTrollguy_'s topic in Modder Support
Hi You might find this example project useful https://github.com/TheGreyGhost/MinecraftByExample mbe60 has working examples of how you can send messages back and forth, triggered by items https://github.com/TheGreyGhost/MinecraftByExample/tree/master/src/main/java/minecraftbyexample/mbe60_network_messages -TGG -
[1.10.2][CLOSED]Creating Non Existing Blocks
TheGreyGhost replied to Kaneka's topic in Modder Support
Hi If you are looking for something like this: then you'll probably find RenderWorldLastEvent event useful. In the event, use the Tessellator to draw your markers, for example something along these lines, where the [x1,y1,z1] etc define the four corners of a square just in front of the face you're drawing, and you repeat this method for all faces of every cube you want to outline: public static void drawBoxWithCross(double x1, double x2, double x3, double x4, double y1, double y2, double y3, double y4, double z1, double z2, double z3, double z4) { Tessellator tessellator = Tessellator.getInstance(); WorldRenderer worldRenderer = tessellator.getWorldRenderer(); worldRenderer.startDrawing(GL11.GL_LINE_STRIP); worldRenderer.addVertex(x1, y1, z1); worldRenderer.addVertex(x2, y2, z2); worldRenderer.addVertex(x3, y3, z3); worldRenderer.addVertex(x4, y4, z4); worldRenderer.addVertex(x1, y1, z1); tessellator.draw(); worldRenderer.startDrawing(GL11.GL_LINES); worldRenderer.addVertex(x1, y1, z1); worldRenderer.addVertex(x3, y3, z3); worldRenderer.addVertex(x2, y2, z2); worldRenderer.addVertex(x4, y4, z4); tessellator.draw(); } That code was for 1.8 so it might be slightly different now, but it gives you the basic idea? -TGG -
Hi The steps I used to port my mod (on github) to a higher version: 1) create a new branch on github 2) use git to fetch your new branch into a new directory. It should have the gradle files, gradle folder, and the source and assets folders, none of the other folders like "run", "out", etc. This example project shows a setup that works for a fresh install https://github.com/TheGreyGhost/MinecraftByExample 3) update the build.gradle to have the correct version of forge in it, i.e. this section minecraft { version = "1.10.2-12.18.1.2011" runDir = "run" // the mappings can be changed at any time, and must be in the following format. // snapshot_YYYYMMDD snapshot are built nightly. // stable_# stables are built at the discretion of the MCP team. // Use non-default mappings at your own risk. they may not allways work. // simply re-run your setup task after changing the mappings to update your workspace. mappings = "snapshot_20160518" // makeObfSourceJar = false // an Srg named sources jar is made by default. uncomment this to disable. } 4) gradlew setupDecompWorkspace idea (or in your case gradlew setupDecompWorkspace eclipse) 5) Open the generated project and that's it. If that gives you trouble, I have found it sometimes helps to do this first: a) download the forge MDK for the target version b) install it into a blank directory (eg "forgetest1-9-4") c) gradlew setupDecompWorkspace idea d) Perform steps 1 - 2 above, copy the build.gradle, gradlew, gradlew.bat, gradle/wrapper into your mod's directory (overwriting the existing) e) perform steps 4 and 5 f) modify build.gradle to put your mod details back in (version number and name) -TGG
-
Hi I don't know why, that's a weird one because it seems to mean that minecraft.getRenderViewEntity() is null which is never supposed to happen on the client thread. Are you sure your mod isn't doing something weird with threads or the mod initialisation sequence, or overwriting the Minecraft.renderViewEntity? If not, I'd suggest you put a debugger break on NullPointerException or alternatively a conditional break in Minecraft.getRenderViewEntity() if the renderViewEntity is null, then trace up the stack to see if you can find out why it's null. It's likely to take a bit of detective work to track it down, I think. Failing that, you could try disabling parts of your mod's code until you find a combination that stops the crashing. -TGG
-
1.7.10 ---> 1.10.2 - Need a Bit of Assistance Please
TheGreyGhost replied to HalestormXV's topic in Modder Support
Hi You could look at this example https://github.com/TheGreyGhost/MinecraftByExample/tree/1-10-2-inprogress/src/main/java/minecraftbyexample/mbe12_item_nbt_animate It's in progress - the animation doesn't work 100% yet, but the gem does charge up and does something after the player has held the right click for a defined time. Might give you a few clues. -TGG -
Howdy After suffering a few sessions of debugging pain due to wrong side / wrong thread, I think it would be very helpful to add some sort of side / thread correctness checking to Forge - something that checks whether a method is being called from an unexpected thread, or at least gives an explicit cue. Accessing client-side objects from the server side (or vica versa) Calling methods from a side which is not used (for example - Item.onUpdate) Rendering thread calling client thread code Network thread calling client thread code or server thread code The @SideOnly annotation in Forge helps a bit but isn't checked automatically (except by running the DedicatedServer and manually testing all code branches again), and it's also not suitable for decorating your own code with. Some sort of static analysis with annotations would be best (during build, or during mod loading), but even a forge-provided assert method for coders would be very helpful. If there is broad interest I can have a go at trying to produce something (advice on where to start would be very helpful since I don't have much experience with annotations) -TGG
-
[Solved] Player move speed missing in x and z?
TheGreyGhost replied to Yagoki's topic in Modder Support
Hi I think the most robust solution might be to have your TileEntity keep track of each nearby entity's location from tick to tick, and calculate the speed from that. eg - in your TileEntity tick method (1) look for nearby entities (2) store all nearby entities in a map along with their current [x,y,z]. (3) compare the entity positions this tick with the positions from last tick -> calculate the speed. motionX, motionY, motionZ don't always give reliable answers because some entities have custom movement (like the player for example). -TGG -
[1.8.9] Rendering a circular texture in a sphere-like manner
TheGreyGhost replied to blahblahbal's topic in Modder Support
Hi Yeah it's pretty confusing that's for sure. If you want an arrow-like sphere, draw six quads, aligned with the three axes. The EntityArrow has shown you how to do the first four, rotating around the x-axis, which corresponds to the shaft of the arrow (not the direction the player is facing) Then, do the last two by rotating around the y axis. GlStateManager.rotate(90.0F, 0.0F, 1.0F, 0.0F); and then GlStateManager.rotate(180.0F, 0.0F, 1.0F, 0.0F); Alternatively, you could just draw the six quads explicitly and don't worry about the GLstateManager.rotate. i.e. with vertices [-8,-8,0] to [8,8,0] and [0,-8,-8]to[0,8,8] and [-8,0,-8]to[8,0,8] Like drawing a cube except all the faces have been moved back to the middle of the cube so that they stick through each other - similar to Draco's picture. I don't think you need to rotate the sphere depending on the way the player is looking. Why do you think that's necessary? If you want to try it - you could use Draco's suggestion i.e. calculate the cross product of the arrow's axis with the vertical vector (i.e. [0, 1, 0] ). That will give you a vector perpendicular to the arrow and parallel to the ground. -TGG -
Keen. I knew about guava because I just happened to look up MultiMap a month or so ago and stumbled on the guava library , there is a stack of useful stuff in there https://github.com/google/guava/wiki Well worth a couple of hours' browsing if you're serious about Java coding I reckon. I don't know of a better way than that - and I've never had to do it manually myself. If there are any other missing libraries, your compiler will probably tell you when you try to compile so just worry about that when it happens I reckon. There are about 60 of them.... -TGG
-
Hi I haven't started with 1.9 yet; I would suggest you should look at the vanilla stairs and/or slabs Block to see how they're different from your block; and how they're different to stairs from vanilla 1.8 You should probably also look in the json model files for anything different. -TGG
-
[1.9] what happend to ISmartItemModel ISmartBlockModel
TheGreyGhost replied to TomEVoll's topic in Modder Support
I think this is one of the things I find most frustrating about the upgrade cycle. APIs interfaces are supposed to stay stable for at least a reasonable length of time! RainWarrior goes to all the effort of designing useful interfaces for state-aware models and rendering etc, and then it becomes useless at the very next upgrade. And all our code based on the API interface has to be refactored yet again. Some parts of the Forge API have been really good for stability, rendering has not. I'm for sure hoping that ISmartItemModel and the rest are bolted onto the new vanilla so they stay useful for at least one more upgrade cycle. Depends on how burnt out RainWarrior gets I guess! -TGG -
That is part of the guava library (guava-17.0.jar) which Forge normally installs and adds to the project automatically when building the workspace. Forge uses quite a few parts of it. You could try looking to make sure that the guava-17.0.jar is in the list of libraries - might help troubleshoot - but unfortunately I don't have any other ideas (I use IntelliJ instead of Eclipse) -TGG
-
[1.8.9] Rendering a circular texture in a sphere-like manner
TheGreyGhost replied to blahblahbal's topic in Modder Support
Hi If you're trying to achieve the effect that Draco's picture shows, which is what EntityArrow does, then you can just draw the texture in several different planes like you said. RenderArrow.doRender does that. For example here for (int i = 0; i < 4; ++i) { GlStateManager.rotate(90.0F, 1.0F, 0.0F, 0.0F); GL11.glNormal3f(0.0F, 0.0F, f10); worldrenderer.startDrawingQuads(); worldrenderer.addVertexWithUV(-8.0D, -2.0D, 0.0D, (double)f2, (double)f4); worldrenderer.addVertexWithUV(8.0D, -2.0D, 0.0D, (double)f3, (double)f4); worldrenderer.addVertexWithUV(8.0D, 2.0D, 0.0D, (double)f3, (double)f5); worldrenderer.addVertexWithUV(-8.0D, 2.0D, 0.0D, (double)f2, (double)f5); tessellator.draw(); } This draws the same quad rotated four times around the x axis (i.e. rotating 90 degrees each time). If you copy this code as a basis for yours, you'll probably be able to work it out for the last plane? This link might also help if you haven't use tessellator before http://greyminecraftcoder.blogspot.com.au/2014/12/the-tessellator-and-worldrenderer-18.html and a bit more information about OpenGL here http://www.glprogramming.com/red/ -chapter 3 -TGG -
[1.8.9] Rendering a circular texture in a sphere-like manner
TheGreyGhost replied to blahblahbal's topic in Modder Support
Hi The reason that a sphere looks like a sphere, instead of like a circle, is the shading. A sphere without shading just looks like a circle. The silhouette of a sphere is always a circle regardless of which angle you look at it. The EntityFX do this by rotating the texture so that it always drawn directly facing the viewer. Normal Entities don't do that. The entities which are autogenerated from a flat 2D texture are given a "thickness" so that they look 3D. But that won't make them look round or like a sphere. Only shading will do that- either by using fancy rendering, or by making your texture shaded i.e. darker at the edges of the circle, lighter in the middle. -TGG -
Hi This tutorial project has a working example of synchronising gui and containers between client and server, which you might find useful https://github.com/TheGreyGhost/MinecraftByExample/blob/master/src/main/java/minecraftbyexample/mbe31_inventory_furnace/Notes.txt also an example of messages https://github.com/TheGreyGhost/MinecraftByExample/blob/master/src/main/java/minecraftbyexample/mbe60_network_messages/Notes.txt -TGG
-
Project 'MDKExample' is missing required library
TheGreyGhost replied to Werns's topic in Modder Support
Hi This page should help https://docs.gradle.org/current/userguide/build_environment.html and http://www.gubatron.com/blog/2014/07/29/solved-gradle-how-to-increase-the-java-compilers-available-heap-memory/ from memory, something like: gradlew -Dorg.gradle.jvmargs=-Xmx2048m -TGG -
[SOLVED][1.8.9] isItemValidForSlot Not Working?
TheGreyGhost replied to PlasmaBlazer's topic in Modder Support
Hi I'm not sure I understand; your ContainerResearchTable appears to use an ordinary slot, not a BluePrintsSlot? You might find this working example useful https://github.com/TheGreyGhost/MinecraftByExample/blob/master/src/main/java/minecraftbyexample/mbe31_inventory_furnace/Notes.txt For example the container ContainerInventoryFurnace uses a SlotFuel that only accepts burnable items for fuel slots. -TGG -
Hi I wrote a mod which does something similar; have a look in this package https://github.com/TheGreyGhost/SpeedyTools/tree/master/src/main/java/speedytools/serverside/backup FolderBackup.createBackupSave() and MinecraftSaveFolderBackups.backupWorld() An important point is to turn tell Minecraft to stop updating the save folder while you're copying commandSaveOffSilent(); commandSaveAll(); and then commandSaveOnSilent(); -TGG
-
Hi You might find this technique useful - it puts your texture into the vanilla texture sheet so you don't have to rebind every time. https://github.com/TheGreyGhost/MinecraftByExample/blob/master/src/main/java/minecraftbyexample/mbe50_entityfx/Notes.txt So long as your texture size is not too big, this should work just as fast as vanilla textures. Are you sure the slowness is coming from the texture rebind? i.e. if you don't rebind the texture, does it speed up? -TGG
-
Hi Choonster's advice is good. FYI ModelBakery.addVariantName is deprecated but it still works. If you want to use the newer method, this example project might help you along a bit https://github.com/TheGreyGhost/MinecraftByExample/blob/master/src/main/java/minecraftbyexample/mbe11_item_variants/Notes.txt -TGG
-
[SOLVED][1.8.9] Trying to add slabs with metadata.
TheGreyGhost replied to SuperGeniusZeb's topic in Modder Support
Hi Look in ItemSlab.onItemUse() to see how vanilla turns two half-slabs into a whole slab -TGG -
[1.8.9] Making a torch emit 'more' light than 15
TheGreyGhost replied to blahblahbal's topic in Modder Support
Hi For sure it's possible, just use Reflection and ASM to modify the vanilla light propagation code; but it's not easy. See World.checkLightFor(). -TGG