N1xx1
-
Posts
41 -
Joined
-
Last visited
Posts posted by N1xx1
-
-
Item and Block classes aren't instantiated for every item in the game or every block in the game. That's why we have ItemStacks and chunks containg an array of block ids, and that's why we have NBTTags in ItemStacks and TileEntities.
If you make a variable in your Item and do something with that, you won't be able to save it and it will conflict with all other Items of the same type.
-
-
You should use a custom spawning packet.
I don't know what's the proper way to do it, but take a look at:
cpw.mods.fml.common.registry.EntityRegistry.EntityRegistration
cpw.mods.fml.common.registry.EntityRegistry.EntityRegistration.setCustomSpawning
cpw.mods.fml.common.registry.EntityRegistry.doModEntityRegistration
-
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?
The color isn't part of the Matrix so you have to reset it manually.
Add a GL11.glColor3f(1F, 1F, 1F); just before (or after) that glPopMatrix.
-
So OpenGL works with matrix. Basically you can draw stuff and transform the matrix itself. You draw stuff using GL11.glVertex#f (where f can be either f (floats), i (ints) and d (doubles) and # can be 2, 3 or 4 (representing the number of dimensions you are working on) and other methods (GL11.glBegin and GL11.glEnd) and trasform matrix with GL11.glTranslate#f, GL11.glRotatef. You can also save your matrix to the stack in order to get back after a series of matrix transformation with GL11.glPushMatrix and GL11.glPopMatrix.
Example:
GL11.glPushMatrix(); //save the current matrix
// Your transformation here
// Your rendering here
GL11.glPopMatrix(); //revert everything
For each PushMatrix there must be a PopMatrix or the code will break and it'll start spamming a lot of openGL errors
About Tessellator, that's just a bridge beetwen OpenGL and your code. It has some useful code (transforming quads to triangles, for instance) and it uses VetrexBuffers instead of glVertex calls.
I suggest you to take a look on some openGL guides (they are universal, don't look for java specific) and at Tessellator.java itself.
-
Yep, Universal Electricity looks a nice project. And it is open source and provide an API to developers.
-
Well, this error means only two things: your MCP version is wrong or your Forge version is wrong. Try to replace everything in runtime directory and replace with the ones in the new MCP version zip.
-
That's not what I mean. I want to set up something like a language file which I can switch my mod to using. Like this: https://github.com/CovertJaguar/Railcraft-Localization
How would I, from that file apply all those language settings into my blocks and items?
Well that's the same.... You have to change the name you assing depending on translated value.
Ok, I think I'll make something later to show you what I mean.
-
Wait, if it's "public static int" you can just do TileEntityMine.myinteger and get the value.
Also, when you create a Gui you always have an TileEntity instance stored and a Container, so you have everything you need.
-
You can easily do that with a new configuration.
String translated = config.get("language", "myblock1", "My Block").value;
So you can switch beetwen different configuration files depending on Language you choose.
If you want to get current language:
FMLClientHandler.instance().getClient().gameSettings.language
-
If you want to make something like EE's PS or RP's handsaw you need a custom recipe. Take a look at IRecipe interface.
If you want to make something like a lava bucket you have to set the container item in the item. I don't remember the right method, but you can see it in lava bucket declaration.
-
You'd better use the right MCP version.
-
Has ItemTossEvent the player who dropped it? If it has you can just put the item back to player's inventory and delete the item.
-
You need a TileEntity to do that.
Basically you have to make a simple variable like "orientation" where to store the orientation. After that you should use a ISimpleBlockRender too to change the actual block orientation depending on TileEntity data.
I don't know if you can find any readytouse code, you may want to check out UE wich is public in github.
-
The problem is inside the Initialization method. The strange thing is that you're not getting any specific code of that.
I think you want to post the complete @Init method.
-
You are creating blocks before IDs are generated.
You have to do any block = new BlockYours(id) after the id was correctly assigned.
-
Well, you can do whatever you want after all mods are loaded.
-
Go on Github, fork forge, make you're changes, pull request and wait for mainteiners to approve.
Anyway, onTickInGui is fine.
-
You'd have to make:
protected List controlList = new ArrayList();
Not protected but public via Access Transformers. Then you can add everything you want to the controlList.
But you can't add custom function to that.
However you can do something.
Make this public too:
private GuiButton selectedButton = null;
Start some sort of loop (I don't know what you can do. Maybe a thread?) and check the value of selectedButton. If it's different from null and the id of the button is what you're looking for then run that function. GuiMainMenu's actionPerformed will just don't care about the id of you're button and you can do whatever you want.
Again, I'm not sure on how you can make that loop. TickInGui? Just look in JavaDocs or wait for someone to give a better answer.
-
You have to put a vanilla 1.4.2 minecraft.jar and minecraft_server.jar.
-
Put this in your block.java file
public String getTextureFile() { return "/YourMod/SpriteSheet.png"; }
Also you need to set up a proxy first.
Please, read the topic before say any random stuff.
I'm talking about custom renders, not changing block texture.
-
If your running it before compiling your mod and running it in a client as in you are running it in eclipse, you need to put the png in your minecraft.jar IN MCP with the specified path from your code (minecraft.jar/n1xx1/stuff/landpaint.png) After recompiling/reobf and trying to run it from the client/server make sure you have it in the mod file the same as it would be in the .jar
1) I'm not using eclipse. I use NetBeans.
2) I'm using my own builder that automatically make a zip file.
3) I put that zip file in the mods folder.
Anyway, I'll figure out alone.
-
Do you have the png file in the right directory.
This is what I have in the code and the file structure.
%MCP%/src/common/x/y/z/textures.png
public static String BLOCK_PNG = "/x/y/z/textures.png";
I already said I'm sure I have the texture. Actually it's not even saying "missing texture".
-
Same problem here.
It looks like a server/client problem, just like they using a wrong container.
finding other mods block/item ids?
in Modder Support
Posted
You can either use Reflections or IndustrialCraft API.
RedPower has some rules about decompiling, so you should ask Eloraam before doing anything with it.