Quote from defiant810
Ok, a couple of questions.
I am not extending BlockOre, just Block. Should I use super(int, int, material)?
Second, Eclipse does not like
public int idDropped(int i, Random random){ switch(i){ case 0: return mod_CamelOre.oreTitanium.blockID }
i have to create an instance variable inside the method and assign the block id to it, then return that, like:
public int idDropped(int i, Random random){ int tex = 0; switch(i){ case 0: tex = mod_DST.DST_BlockHull.blockID; } return tex; }
Is this still going to work?
And what exactly are you suppose to add under the switch statement to add more blocks?
And finally:
I am still getting the error where the texture is a white block with 1 black pixel on the side
1st Question's Answer: Yes. Just extends Block and use the constructor
(i, 0, material)
2nd Question's Answer: Why? I use it... What is the error?
3rd Question's Answer: No... That method is not the way to go. Just add
return mod_DST.BlockHull.blockID
4th Question's Answer: Send me your code and all the spritesheets. I'll try to fix that error for you... It pestered me for a while
1
Can someone write a guide on how to make this work with Windows 7?
I dont have time to search the interwebz for 5 hours slamming my head against the keyboard looking how to make this work.
7
The past couple of weeks, I have been working on finalizing one of my mods. And as I traversed these forums, I realized that 99% of the tutorials out there are basically copy-paste, coolie cutter code. Being a student of programming myself, I know that this method is not good for learning and remembering how to program and mod.
Therefore, I have decided to create this tutorial forum to be above the 99%, (No political puns intended). Not only am I going to teach you how to use MCP, ModLoader, ModLoaderMP, and Forge, but I also plan to teach you some actual Java programming, as to help you retain the information you pick up here. So, you dont need to have any prior programming knowledge.
I will try to check this often enough, so as whatever questions you need answered, and I will try to help you as soon as I can.
I will try to keep this updated and with new content whenever I have the time (between my mod, family, and a difficult junior year).
So, without further delay:
Installing MCP
Prerequisites
Installing Java
Select Computer from the Start menu
Choose System Properties from the context menu
Click Advanced system settings > Advanced tab
Click on Environment Variables, under System Variables, find PATH, and click on it.
In the Edit windows, modify PATH by adding the location of the class to the value for PATH. If you do not have the item PATH, you may select to add a new variable and add PATH as the name and the location of the class as the value.
Windows XP
Start -> Control Panel -> System -> Advanced
Click on Environment Variables, under System Variables, find PATH, and click on it.
In the Edit windows, modify PATH by adding the location of the class to the value for PATH. If you do not have the item PATH, you may select to add a new variable and add PATH as the name and the location of the class as the value.
Close the window.
Installing MCP
Preparing Eclipse
YOU MUST HAVE ECLIPSE, OR I WILL NOT HELP YOU WITH ERRORS. Trust me, eclipse is the best way to go when coding java. And it's free!
Now we can start to teach you Java!
Java - To be finished!
Basics
For teaching you the basics, were will be deconstructing the following code (you can enter this in eclipse in a new workspace):
Now lets break it down:
Line 1
- This line imports the java utilities library "java.util", and all classes in that library ".*" (more on libraries later)
- All java lines end with a semi-colon ";". This tells java it is done with that certain function.
Line 3
- This is called a class header, as it defines a new class (all java files (that you need to worry about) have a class)
- "public class" The public keyword tells java that the following object/primitive (more on that later) can be accessed in other classes and files. The class keyword just says that it is defining a class.
- TestClass is just the name of the class. It can be anything you want.
Line 4 - 5
- The int keyword tells java that it is defining a new int (integer), or any number without a fraction or decimals. The int i1 is being initialized (or assigned) to 1, and the int i2 is being initialized to 3.
- The double keyword tells java that it is defining a new double, or a number that can have a decimal. The double d1 is being initialized to 1.0.
Line 7
- This is a method header. Java knows you are declaring a method because it has a return type (void)
- You recognize the public keyword
- Static ties the following object to the class (I'll explain this later)
- void is the return type (what the method gives back, also more on this later), void means the method returns nothing
- main is the name of the method (main is special in that this method automatically runs when you start the program)
- A method is a group of code that runs at the same time and can return a certain object/primitive
- A primitive is a build in java variable (like int or double)
- (String[] args) are called the parameters(more details later)
Line 8 - 11
- This is a built in java method. System is the current computer system, out is a subdirectory, and println is a method. It takes the parameter "This is some text", and prints it out into the console.
- In java, all Strings (a primitive type that stored text) are closed in quotation marks.
- After the last quotation mark, you see +i1 and +d1. This adds the variables to the end of the String
- Instead of printing "This is the value of i1: +i1" (without quotations), it will print "This is the value of i1: 1" (without quotations), because it prints the value of i1, not "i1".
- The +add() is a method call. If you look at the add() method below, you will see that is returns a type of int instead of void. Because you call it in the System.out.println(), it will return in int. So like the last one, it will print "4" instead of "+add()"
Line 12
- This ending bracket closed the main() method. Add classes, methods, and loops (we will cover later) that start with a "{" must eventually end with a "}"
Line 13-15
- This is a new method called add, which takes 2 parameters
- In the main() method, you see that we are passing i1 and i2 into add()
- In add() you see that it has (int x, int y). This means that by passing in i1 and i2, you are assigning i1 to x, and i2 to y.
- Because the return type of add() is int, you need to use the return keyword to tell the method what to give back
- This method is returning x+y. Basically, i1 equals 1 and i2 equals 3, so int x and int y were assigned 1 and 3, respectively, because i1 was passed in first and x was the first int in add(). So x+y is the same as i1+i2, or 1+3. Therefore, add() in this case would return 4. So back in main(), the fourth println method would print "This is the value of i1 plus i2: 4" (without quotations)
This is the deconstruction of a basic java program. In the next section, I will go into more details and explain some more advanced ideas.
Keywords and Definitions
Definitions
Primitives
- Short for integer. This stores any number without fractions or decimals. It has a minimum value of -2,147,483,648 and a maximum value of 2,147,483,647. It must be a whole number.
- A double is any number with a decimal.
- A float is a shorter version of the double. It uses less memory and is usually used to represent small decimal numbers.
- A String stores a group of Text.
- This can store larger numbers than int, but it also uses much more memory. It has a minimum value of -9,223,372,036,854,775,808 and a maximum value of 9,223,372,036,854,775,807.
- This can only store true or false. It is also what is returned when using mathematical checks.
- Simply, it stores one single character.
- Not really a primitive, but if used as a return type, it means there is nothing being returned.
There are other primitives, but most are only different variations of number storage.
Keywords
- This tells java that the following object cannot be accessed outside of the current class. This is good for variables that are specific to a certain class.
- This tells java that the following object can be accessed outside the current class.
- This tells java that you are starting a new class.
- This tells the enclosing method that whatever follows this word is what the method should return. The return statement must match the return type.
- This binds the following object to the class. This is largely unimportant as of now.
- This tells java that the class is inheriting classes from another class. Its not important to know how it works, just that you need to know this word to mod Minecraft.
- Very similar to extends, but acts slightly differently. Also not important to go into details.
- Just tells java you are creating a new object.
- Used to break loops and statements. See the more advanced section for details.
- Loop keywords (see More Advanced)
- Conditional keywords (see More Advanced)
Conditional & Math Operators
Mathematical Operators
- ++ adds one to the variable
- -- subtracts one from the variable
- += adds the number after the statement to the variable before the statement
- -= subtracts the number after the statement from the variable before the statement
Conditional Operators
- <= returns true if the variable before the operator is less than or equal to the second
- < returns true if the variable before the operator is less than the second
- >= returns true if the variable before the operator is greater than or equal to the second
- > returns true if the variable before the operator is greater than the second
- == returns true if the two variables are exactly equal
- != returns true if the two variables are not equal
- ! returns true only if the Boolean or condition after it is false, and false if the Boolean or condition after it is true (it basically switches true/false)
Other Conditional Symbols
- || means "or", it is used in conditional statements
- && means "and", it is also used in conditional statements
More Advanced
Not finished
Conditional Statements
- Conditional statements are used to run a chunk of code only if certain criteria are met. There are 2 main statements, if and switch statements.
if
- if(variable){}
- else if(variable){}
- else{}
- If statements will run the entire group of code inside the brackets "{}", but only if the variable inside the "()" returns the proper value.
- This is when you would use the conditional operators (>=,==,<=). This is used to check the variable for a value. You can compare a variable to a value, or a variable to another variable.
- You can also use the other conditional symbols here to check more than one variable. (variable || variable) will run if either checks are true, (variable && variable) will only run if both checks are true.
- else if just checks another set of variables.
- else runs its code only if all of the other if and else if statements have not run. It takes no variables because it runs if all of the other variable checks are false.
- if you do not have a else statement at the end, java wont run any more code if none of the other statements run and the code gets to where an else statement would be (basically, you dont need an else statement).
- If using all three statements, if must be first, all else if statements (you can have an unlimited amount) must be next, and your else statement must be last
- Once java runs a chunk of code, it will leave the conditional series. (Basically, if you have an if statement and 3 else if statements, and the code runs for the if statement, java wont even check to see if the rest of the else if statements are true)
switch
Loops
4
9
I was having this very problem until I actually contacted the MCP team on irc.esper.net (their chat room)
Here is what you must do (in this order):
That should fix any problems you are having with files not appearing in the reobf folder.
Hope I helped!
1
We have the basis for our server already thought out, we just want input from those who may be willing to play on it.
We we are going to have:
What we want out of this is a playing environment reminiscent of medieval Europe, with towns that look medieval.
You can comment on these to explain why they shouldn't be there, or how to improve them, but these are mostly set in stone for the server.
Some things that are contested (ideas from the server admins or players that we may incorporate):
These are only ideas, so these have a much better chance of being changed based on replies than the first list.
Other than these sections, feel free to post ideas on what you think would make this server better. This includes plugin suggestions (we will be using very few plugins to limit server dependency), or any other idea you think should be added.
We will be using Bukkit.
If you want to see the plugins we will be using, just ask.
We will release the pricing and website as we get more ideas set and ready.
We look forward to hearing ideas from the community, even if you aren't going to play on this server.