Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Importing BAPI into minecraft forge #118

Closed
wants to merge 5 commits into from
Closed

Importing BAPI into minecraft forge #118

wants to merge 5 commits into from

Conversation

batlefield
Copy link

This API allowed you to allow custom plant placing options and allso some biome controling options

@LexManos
Copy link
Member

Please re-work your code to follow the coding style of the rest of minecraft, also, providing a sample mod would be most useful. As well as a full explanation of what you're trying to achieve.

@tambry
Copy link

tambry commented Aug 15, 2012

I like this and I have wanted this but apperantly yeah coding style is off.

@batlefield
Copy link
Author

I'll fix the coding style ASAP and what am I trying to achieve is import my API into forge, for more information you can visit my website(http://www2.arnes.si/~pmati/BAPI.html) or for some old examples of the API usage visit http://www2.arnes.si/~pmati/BAPIm.html

@batlefield
Copy link
Author

This is the last commit that I have planned, please tell me if you need more information or any help about it.

@psxlover
Copy link

I believe that forge is using four spaces per ident while you've used two. Also forge has spaces after "if"s and "else"s are on lines of their own.

@LexManos
Copy link
Member

4 spaces
braces on newlines
etc..
When in doubt, run astyle over your code with the config forge ships.

@batlefield
Copy link
Author

I couldn't find any other astyle configs than the one inside forge/fml/conf so I used that one and I hope this is what you were looking for.

EDIT: This is weird, I just pushed twice and it doesn't show up

EDIT2: It's Ok now, the commit is showing up

@LexManos
Copy link
Member

Taking a quick glance at it:
You need to look into the AccessTransformer, Any edits taht simply change the access level, such as your BiomeGenBase hook should be moved to Forge's AT config, to save the base edits.
Also, Is your NBTManager really nessasary? Could that simply not be made into World events?
And you should really annotate with @OverRide when you are overriding a function. For ease of development when things change.

Your callbacks should be in the form of (world, x, y, z) not (id, metadata)

As for your biome stuff, could things not be done externally to keep the base edits down?
EXA: The MapGenVillage is a static List, you could easily edit that externally and not require base edits.

@batlefield
Copy link
Author

For access transformer I added these lines at the bottom of the file

BiomeGenBase

public vj.a(Ljava/lang/Float, Ljava/lang/Float;) # setTemperatureRainfall()
public vj.b(Ljava/lang/Float, Ljava/lang/Float;) # setMinMaxHeight()
public vj.m() # setDisableRain()

But when I did that I got this exception
java.lang.RuntimeException: Invalid config file line public vj.a(Ljava/lang/Float, Ljava/lang/float;) # setTemperatureRainfall()
at cpw.mods.fml.common.asm.transformers.AccessTransformer$1.processLine(AccessTransformer.java:137)
at com.google.common.io.CharStreams.readLines(CharStreams.java:361)
at com.google.common.io.Resources.readLines(Resources.java:118)
at cpw.mods.fml.common.asm.transformers.AccessTransformer.readMapFile(AccessTransformer.java:116)
at cpw.mods.fml.common.asm.transformers.AccessTransformer.(AccessTransformer.java:99)
at net.minecraftforge.transformers.ForgeAccessTransformer.(ForgeAccessTransformer.java:11)
at sun.reflect.NativeConstructorAccessorImpl.newInstance0(Native Method)
at sun.reflect.NativeConstructorAccessorImpl.newInstance(Unknown Source)
at sun.reflect.DelegatingConstructorAccessorImpl.newInstance(Unknown Source)
at java.lang.reflect.Constructor.newInstance(Unknown Source)
at java.lang.Class.newInstance0(Unknown Source)
at java.lang.Class.newInstance(Unknown Source)
at cpw.mods.fml.relauncher.RelaunchClassLoader.registerTransformer(RelaunchClassLoader.java:48)
at cpw.mods.fml.relauncher.RelaunchLibraryManager.handleLaunch(RelaunchLibraryManager.java:218)
at cpw.mods.fml.relauncher.FMLRelauncher.setupHome(FMLRelauncher.java:141)
at cpw.mods.fml.relauncher.FMLRelauncher.relaunchClient(FMLRelauncher.java:91)
at cpw.mods.fml.relauncher.FMLRelauncher.handleClientRelaunch(FMLRelauncher.java:39)
at net.minecraft.client.Minecraft.main(Minecraft.java:1988)
at Start.main(Start.java:29)

I can remove the NBTHelper, but it's a Helper that just helps you, althought I can remove it and create two new events for player save/load event, that would make me drop the save handler, but edit ServerConfigurationManager what would be better, but I have no idea how to create a patch out of that, since there allready is a patch for it.

Where haven't I used @OverRide ?

You are probably reffering to BlockFlower right? Well I tried that in BAPI V1.1.0 and it showed up as a fail because every here and there when generating new chunks or new world it crashed with NPE if I remember correctly, thats the time when I cahnged it to provide only id and metadata.

When adding directly to that static list I get this exception
cpw.mods.fml.common.LoaderException: java.lang.UnsupportedOperationException
at cpw.mods.fml.common.LoadController.transition(LoadController.java:106)
at cpw.mods.fml.common.Loader.initializeMods(Loader.java:569)
at cpw.mods.fml.client.FMLClientHandler.finishMinecraftLoading(FMLClientHandler.java:217)
at net.minecraft.client.Minecraft.startGame(Minecraft.java:348)
at net.minecraft.client.Minecraft.run(Minecraft.java:637)
at java.lang.Thread.run(Unknown Source)
Caused by: java.lang.UnsupportedOperationException
at java.util.AbstractList.add(Unknown Source)
at java.util.AbstractList.add(Unknown Source)
at net.minecraftforge.common.BiomeManager.setVillageCanSpawnInBiome(BiomeManager.java:61)
at net.minecraft.src.mod_Test.load(mod_Test.java:28)
at cpw.mods.fml.common.modloader.ModLoaderModContainer.init(ModLoaderModContainer.java:545)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(Unknown Source)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source)
at java.lang.reflect.Method.invoke(Unknown Source)
at com.google.common.eventbus.EventHandler.handleEvent(EventHandler.java:69)
at com.google.common.eventbus.SynchronizedEventHandler.handleEvent(SynchronizedEventHandler.java:45)
at com.google.common.eventbus.EventBus.dispatch(EventBus.java:317)
at com.google.common.eventbus.EventBus.dispatchQueuedEvents(EventBus.java:300)
at com.google.common.eventbus.EventBus.post(EventBus.java:268)
at cpw.mods.fml.common.LoadController.propogateStateMessage(LoadController.java:128)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(Unknown Source)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source)
at java.lang.reflect.Method.invoke(Unknown Source)
at com.google.common.eventbus.EventHandler.handleEvent(EventHandler.java:69)
at com.google.common.eventbus.SynchronizedEventHandler.handleEvent(SynchronizedEventHandler.java:45)
at com.google.common.eventbus.EventBus.dispatch(EventBus.java:317)
at com.google.common.eventbus.EventBus.dispatchQueuedEvents(EventBus.java:300)
at com.google.common.eventbus.EventBus.post(EventBus.java:268)
at cpw.mods.fml.common.LoadController.distributeStateMessage(LoadController.java:83)
at cpw.mods.fml.common.Loader.initializeMods(Loader.java:568)

@LexManos
Copy link
Member

http://docs.oracle.com/javase/specs/jvms/se5.0/html/ClassFile.doc.html#84645
For information on the proper format of signatures, also be aware of the difference between a Float and a float.
When i doubt, you can always use MCPBot on espernet to get the signature, or the srg file.

Yes I was reffering to Flower for the Override, and having mentioned that NPE concerns me.
There should be no possible way sending in more info would cause a NPE.

Don't ADD to the list, SET the list to something that just happens to be the contents of the old list, plus more.

@batlefield
Copy link
Author

Ok so I have everything worked out, but the ServerConfigurationManager patch, the problem is I need to merge the two patches together, but I don't have the knowledge to do so, any adwise?

@MrTJP
Copy link

MrTJP commented Aug 17, 2012

If I'm understanding correctly, you want to merge 2 of your patches together? Use the GUI app or the merge command.

On Aug 16, 2012, at 7:51 PM, batlefield notifications@github.com wrote:

Ok so I have everything worked out, but the ServerConfigurationManager patch, the problem is I need to merge the two patches together, but I don't have the knowledge to do so, any adwise?


Reply to this email directly or view it on GitHub.

@batlefield
Copy link
Author

So I edited my events and also inside the BlockFlower I don't override any other methods so I don't really need @OverRide. Allso I made MapGenVillage unedited.

@LexManos
Copy link
Member

As long as you use the git setup, and update_patches scripts you should be fine.
Typical workflow for working on forge
Git checkout
setup
Do work in forge/eclipse
update_patches
push.

Anyways, also please go through and cleanup your current patches, I see one in there still that simply is superfluousimports.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

5 participants