Jump to content

Recommended Posts

Posted

Well, energy is simply an amount that goes up and down.

You'll need:

  • Storage: how much something can possibly have
  • I/O: How much can enter/leave a suitable storage
  • Generator: A way to get this energy
  • Transport: How to move this energy from point A to point B

 

I would recommend you create your "own API"; make Interfaces that handle each of these points separately (IEnergyStorage, IEnergyInput, IEnergyOutput etc), then create abstract classes that implement these classes, and then, finally create your proper classes, that extend the abstract class. It's a bit extra work, but leaves you with a clean workspace with easy-to-use classes.

Also previously known as eAndPi.

"Pi, is there a station coming up where we can board your train of thought?" -Kronnn

Published Mods: Underworld

Handy links: Vic_'s Forge events Own WIP Tutorials.

Posted

I dont know most of the terms you just explaned

 

if you mean

  • Storage: how much something can possibly have
  • I/O: How much can enter/leave a suitable storage
  • Generator: A way to get this energy
  • Transport: How to move this energy from point A to point B

 

then that's not java-related but explaining what you might want to do.

Posted

You don't have the Java knowledge necessary to even have someone help you with this.

Apparently I'm a complete and utter jerk and come to this forum just like to make fun of people, be confrontational, and make your personal life miserable.  If you think this is the case, JUST REPORT ME.  Otherwise you're just going to get reported when you reply to my posts and point it out, because odds are, I was trying to be nice.

 

Exception: If you do not understand Java, I WILL NOT HELP YOU and your thread will get locked.

 

DO NOT PM ME WITH PROBLEMS. No help will be given.

Posted

If somone just shows me the exect code i can just replicate it then learn it. I learn from people showing me

 

I would Google java tutorials, and learn how classes, inheritance, and interfaces work before trying to dive into complex minecraft modding. You seriously won't learn anything copying other people's code without knowledge of those things.

Posted

This forum is not about providing drop-in copy-paste solutions. This forum should help people understand why they are having a problem and how to solve it and why X and Y solves it.

Then they do not have to ask next time.

If you do not agree with this mentality then yes by all means, please get off this forum.

Apparently I'm a complete and utter jerk and come to this forum just like to make fun of people, be confrontational, and make your personal life miserable.  If you think this is the case, JUST REPORT ME.  Otherwise you're just going to get reported when you reply to my posts and point it out, because odds are, I was trying to be nice.

 

Exception: If you do not understand Java, I WILL NOT HELP YOU and your thread will get locked.

 

DO NOT PM ME WITH PROBLEMS. No help will be given.

Posted

Dude im not learning anything if i go watch tutorials. I dont have time. i have school too you know?

 

Then honestly, you should probably forget it and focus on school. When you get older you might have a shot at learning how to write java/make mods.

 

*edit: And I didn't mean to WATCH tutorials. Video tutorials are kinda crap for writing code. You need a txt tutorial.

Posted

Dude i got cofh api but now all i need to make is a generator and im stuck. So basicly its not java needed now i need to find out how to use it in blocks

 

write code, post it, along with errors, ask for help. No one is going to just write the code for you, especially when you don't know basic java terms like interfaces.

Posted

Well theres no way im going to learn if there is no documentation

Dude i got cofh api but now all i need to make is a generator and im stuck. So basicly its not java needed now i need to find out how to use it in blocks

No documentation? Then what is this?

Or that?

Here, found a few more pieces: 1, 2, 3.

That's all random classes found in the... public GitHub repo. Don't come here and say there's no documentation. How would anyone have made anything using the CoFH API if there was no documentation?

Also previously known as eAndPi.

"Pi, is there a station coming up where we can board your train of thought?" -Kronnn

Published Mods: Underworld

Handy links: Vic_'s Forge events Own WIP Tutorials.

Posted

A class can extend a single other class. It can also implement several other Interfaces.

An Interface is very similar to a regular class, in some points:

  • An interface can contain any number of methods.
  • An interface is written in a file with a .java extension, with the name of the interface matching the name of the file.
  • The byte code of an interface appears in a .class file.
  • Interfaces appear in packages, and their corresponding bytecode file must be in a directory structure that matches the package name.

However, the key differences are:

  • You cannot instantiate an interface.
  • An interface does not contain any constructors.
  • All of the methods in an interface are abstract.
  • An interface cannot contain instance fields. The only fields that can appear in an interface must be declared both static and final.
  • An interface is not extended by a class; it is implemented by a class.
  • An interface can extend multiple interfaces.

 

To describe what an Interface is, in layman's terms: An interface provide methods that has to exist in whatever class implements it. If class MyCustomClass implements ICustomInterface, which has a method called myCustomMethod, then MyCustomClass must have a method in it with the same name, and same variables. However, that is all. An interface cannot be used to do anything, only make sure that the methods that actually do the stuff, exists in the class.

Interfaces create methods without any body. Just name & variables, like this:

static boolean hasEnergy(int energy);

It is up to the one creating the class to actually make the hasEnergy method return anything.

Also previously known as eAndPi.

"Pi, is there a station coming up where we can board your train of thought?" -Kronnn

Published Mods: Underworld

Handy links: Vic_'s Forge events Own WIP Tutorials.

Posted

An interface cannot contain instance fields. The only fields that can appear in an interface must be declared both static and final.

 

In C# you can, but really all that means is that the interface is declaring an explicit getter/setter.  I know this because I did it not to long ago.

 

e.g.

public interface ISomeThing {
    public someField {
        get; set;
    }
}

 

But yes, you can't do that in Java.  You'd have to declare it as a

getField()

and

setField(v)

methods and supply the field itself in the implementation.

Apparently I'm a complete and utter jerk and come to this forum just like to make fun of people, be confrontational, and make your personal life miserable.  If you think this is the case, JUST REPORT ME.  Otherwise you're just going to get reported when you reply to my posts and point it out, because odds are, I was trying to be nice.

 

Exception: If you do not understand Java, I WILL NOT HELP YOU and your thread will get locked.

 

DO NOT PM ME WITH PROBLEMS. No help will be given.

Guest
This topic is now closed to further replies.

Announcements



×
×
  • Create New...

Important Information

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