Everything posted by OmniSapien
-
Viewports in OpenGL
Just wondering, does anyone know how viewports work in OpenGL? If so, please post whatever information you can about them. I understand the concept well but I don't completely understand the implication methods. Are they part of the matrix? Are they independent? Do all things instantly get place into the viewport or do only render calls made after the viewport declaration get placed in the viewport? I've tested with them a little bit and all sorts of visual errors are being thrown my way so I don't think I'll be learning much about the semantics that way anytime soon. Any help is greatly appreciated! Thank you all in advance!
-
Block Rendering
Look at the code for the Brewing Stand's TileEntity-specific renderer, that's where you'll find what you need.
-
Rendering Only a Model
Thanks for the concern Mazetar And yes I did figure out what my issue was - the ModelBoxes were being loaded after the first render call had been made to the ModelRenderer therefore the OpenGL Display List's were being compiled before the Model was properly created. The fix isn't easy, seeing as the compile variable and the method for compiling models are both private in ModelRenderer, but I've made a workaround
-
Rendering Only a Model
I need help rendering a model without a TileEntity, Entity, or anything else. Does anyone know if there is a class with a method somewhere in the Minecraft code that renders ONLY a given model with a texture without requiring anything along the lines of an Entity? If not, can someone point me in the direction of how to accomplish this? Any help at all would be greatly appreciated. Thank you in advance!!!
-
A couple questions :) (GUI, CustomRendering, TileEntity)
For your GUI issues: http://www.minecraftforge.net/wiki/Containers_and_GUIs - that's a tutorial on that kind of stuff. For your custom model for blocks, just use the bindTileEntitySpecialRenderer(Class <? extends TileEntity>, TileEntitySpecialRenderer) method in client registry. If you need any specification, feel free to ask Also, you can look at the code for the EE3 Calcinator by Pahimar in github for custom block models. A lot of the minecraft code I've learned from the open source mod, EE3, so it's a good piece of code to look at in general.
-
How can I make it so an item is only used when it is in the Inventory Hotbar?
Simply have a TickHandler check the player inventory at the hotbar's slot id's and if one of them is your item, apply the desired effect.
-
A Basic Explanation of session.lock
Can anyone explain to me how session.lock works and how to avoid getting it to throw an Exception? I've been having a lot of issues lately because I am saving data into a custom file in the current world's save file. If a stack trace is needed, it is below: [iNFO] [sTDERR] net.minecraft.world.MinecraftException: The save is being accessed from another location, aborting [iNFO] [sTDERR] at net.minecraft.world.storage.SaveHandler.checkSessionLock(SaveHandler.java:104) [iNFO] [sTDERR] at net.minecraft.world.World.checkSessionLock(World.java:4001) [iNFO] [sTDERR] at net.minecraft.world.chunk.storage.AnvilChunkLoader.saveChunk(AnvilChunkLoader.java:120) [iNFO] [sTDERR] at net.minecraft.world.gen.ChunkProviderServer.safeSaveChunk(ChunkProviderServer.java:232) [iNFO] [sTDERR] at net.minecraft.world.gen.ChunkProviderServer.unload100OldestChunks(ChunkProviderServer.java:328) [iNFO] [sTDERR] at net.minecraft.world.WorldServer.tick(WorldServer.java:166) [iNFO] [sTDERR] at net.minecraft.server.MinecraftServer.updateTimeLightAndEntities(MinecraftServer.java:668) [iNFO] [sTDERR] at net.minecraft.server.MinecraftServer.tick(MinecraftServer.java:598) [iNFO] [sTDERR] at net.minecraft.server.integrated.IntegratedServer.tick(IntegratedServer.java:123) [iNFO] [sTDERR] at net.minecraft.server.MinecraftServer.run(MinecraftServer.java:497) [iNFO] [sTDERR] at net.minecraft.server.ThreadMinecraftServer.run(ThreadMinecraftServer.java:16)
-
Session Lock Issues
I've created a system that creates an NBTTagCompound and saves it in a file in the current save file. Every time a player logs in, it reads from the NBTTagCompound in the file. Every time a player logs out, it writes the NBTTagCompound to the file. If there is no file when it attempts to read the file, it runs the writing method to create a new file with a blank NBTTagCompound. However, while this system works quite well for me, the chunk data will not save due to a session lock error. The error is below. net.minecraft.world.MinecraftException: The save is being accessed from another location, aborting [iNFO] [sTDERR] at net.minecraft.world.storage.SaveHandler.checkSessionLock(SaveHandler.java:104) [iNFO] [sTDERR] at net.minecraft.world.World.checkSessionLock(World.java:4001) [iNFO] [sTDERR] at net.minecraft.world.chunk.storage.AnvilChunkLoader.saveChunk(AnvilChunkLoader.java:120) [iNFO] [sTDERR] at net.minecraft.world.gen.ChunkProviderServer.safeSaveChunk(ChunkProviderServer.java:232) [iNFO] [sTDERR] at net.minecraft.world.gen.ChunkProviderServer.unload100OldestChunks(ChunkProviderServer.java:328) [iNFO] [sTDERR] at net.minecraft.world.WorldServer.tick(WorldServer.java:166) [iNFO] [sTDERR] at net.minecraft.server.MinecraftServer.updateTimeLightAndEntities(MinecraftServer.java:668) [iNFO] [sTDERR] at net.minecraft.server.MinecraftServer.tick(MinecraftServer.java:598) [iNFO] [sTDERR] at net.minecraft.server.integrated.IntegratedServer.tick(IntegratedServer.java:123) [iNFO] [sTDERR] at net.minecraft.server.MinecraftServer.run(MinecraftServer.java:497) [iNFO] [sTDERR] at net.minecraft.server.ThreadMinecraftServer.run(ThreadMinecraftServer.java:16) Does anyone know how to fix this? I've only found one thing relating to this, which is a tutorial by Mithion about saving NBT to files, but it dates back to 1.2.5 and his methods are not working. Thank you in advance for any response!
-
Is there a way to get the path to the current worlds folder?
Haha I had the exact same problem just this morning I figured it out though, so don't worry. Explanation via words: First, you're going to need to get the server instance from ModLoader ( ModLoader.getMinecraftServerInstance() ). Then, you're going to need to get the folder name of the server instance ( .getFolderName() ). Store that for later. Next, get the ISaveFormat from the server instance ( .getActiveAnvilConverter() ). After that, obtain the SaveHandler from the ISaveFormat and give it the folder name we stored earlier as well as a boolean as to whether or not to mkdirs for the player folder (I just use false) ( .getSaveLoader(folderName, false) ). Then, just get the saveDirectory from the SaveHandler ( .getSaveDirectory() ). Explanation via code: MinecraftServer mcServerInstance = ModLoader.getMinecraftServerInstance(); String folderName = mcServerInstance.getFolderName(); ISaveFormat saveFormat = mcServerInstance.getActiveAnvilConverter(); SaveHandler saveHandler = (SaveHandler)saveFormat.getSaveLoader(folderName, false); // You will have to typecast here File saveDir = saveHandler.getSaveDirectory(); Hope this helps! Ask any questions if you have them and I'll try to answer them.
-
Is there a way to detect when a player logs off?
Thank you so much! I've been searching for it for quite a while
-
Is there a way to detect when a player logs off?
I basically need to know when a player logs off of a world or when a server shuts down (singleplayer) and was wondering how to go about this. If you are wondering why I need to know when a player logs off or when a server shuts down, it's because I need to be able to save some NBT data when either of these events occur. Thank you for any help!
-
Is it possible to make armor invisible?
I'm not sure about the on the fly part, but you can make an armor invisible, just change the texture file to all alpha.
-
Forge custom surface generation (Like pumpkins)?
Here's a tutorial I used to learn world gen - I haven't used these skills in a while though, so the tutorial might be outdated - http://wuppy29.blogspot.com/2012/08/forge-modding-132.html Just click on ore generation. If your going to want a similar system to pumpkins, you will probably want to select a random x and z coordinate pair then add some small random values to them each time you place a new block. That way you will have a sort of group of your block spawned. To assure that they lie on top of Grass, use a loop to start the random block's Y position at 0 and progressively increment it until the block at that position is Grass. Then, place your block at a Y position 1 greater than that.
-
Different ways to save to NBT
Thank you for the very quick reply! Btw, I thought your username looked familiar, I'm quite a fan of your CameraCraft mod - Especially the ability to colorshift your pictures. Anyway, I've tried using the method in Entity getEntityData(), but the data I insert into the NBTTagCompound is carried over across saves. It still appears to be Player specific, which is what I want, but it is not World specific, such as inventories and experience. Do you by chance know the reason for this? Thank you in advance!
-
Different ways to save to NBT
Thank you for your reply! Do you know of any example code I can look at that demonstrates this accurately? I tried a bunch of different styles of writing and reading in the CompressedStreamTools and all result in the same phenomenon. If it helps you to know what I am attempting to achieve, I am trying to add an attribute to each Player that is Player and World specific - similar to inventories, experience levels, etc. However, I am still glad to learn anything I can about this topic in general, so any information would be greatly appreciated! Thank you once again for your reply!
-
How to update forge
Go to http://www.minecraftforge.net/forum/ (the home page of this site), click Releases, choose the topic with the version of Forge you want (Probably 6.5.0 for Minecraft 1.4.6), then click the universal link. If you actually want to mod yourself with forge, I recommend you look up Wuppy's tutorial on Youtube. His channel name is wuppygaming.
-
Different ways to save to NBT
I was wondering how many different ways there are to save NBT data. I am aware that TileEntities and Entities all have NBT components, but I was wondering if there is a way to save NBT data without having to create a background entity. Is there perhaps an interface for storing custom NBT data? Thank your reply in advance!
-
How to make the ItemName to have Color?
I believe that the answer is to add the getRarity(ItemStack) method in your class that extends Item. I recommend that you also look at EnumRarity to find the rarity, or item name's color, that you want.
-
Gui Help
I don't know too much about GUI's and things involved with the creation of them, but I believe that the reason your method is running twice may be caused by the fact that some methods are run by the client AND the server - not independently.
-
How do I add an item to players inventory?
Use the addItemStackToInventory(/* Your ItemStack Here */) method in InventoryPlayer.
-
How can I make the crop disappear when the farmland was broken?
No problem, glad I could help
-
How can I make the crop disappear when the farmland was broken?
I haven't tested this method myself, but my first thought would be to have your crop block check the ID of the block beneath it in the onNeighborBlockChange method. If it's soil, tell it to do nothing; if it's not soil, tell it to break. Hopefully this helps
-
Very Basic Explanation of the OpenGL
Oh, that makes sense thank you . So then how would I create a 2D overlay on the screen like the hotbar or your inventory when opened? I learn best by code, so if you could supply a small sample of something simple like a square that would be much appreciated. Thank you once again for the response, N1xx1.
-
How to properly create living entities?
I can't point you to a tutorial, but I've created a few living entities that do render normally with working AIs so if you can supply some of the code you're using to register and spawn your entity in the world I can hopefully find what you're missing
-
Very Basic Explanation of the OpenGL
Thank you so much! I think I'm sort of getting it now . However, I am somewhat confused on what I'm doing incorrect in this bit of code. I basically have an Item set up to call the rendering method when right clicked. The code is this: { GL11.glPushMatrix(); GL11.glColor3f(0F, 1F, 0F); GL11.glVertex2f(x, y); GL11.glVertex2f(x+10F, y); GL11.glVertex2f(x+10F, y+10F); GL11.glVertex2f(x, y+10F); GL11.glPopMatrix(); } where x and y are floats preset to 10F. When run, all it appears to do is make the sky green. Am I just making a really n00bish mistake?
IPS spam blocked by CleanTalk.