Jump to content

[1.12.2] How to add biome to custom dimension?


lyghtningwither

Recommended Posts

So I was working on adding my custom dimension, didn't get any errors, and found a command that let me change dimensions. Everything was going well. But then I realized that I needed to add my custom biome, the Ice Sheets, to that dimension and I had no idea to do that. I've spent an hour today looking at the forums for how to do that, but I had no luck. I'm on Forge version 1.12.2 and all help would be appreciated. Any further questions, just reply. Thank you!

I like programming. I also have a lot of problems with programming. So I came here on this forum so that I could get my problems solved.

 

Thank you to everyone who has helped me on the forum! You will be appreciated.

Link to comment
Share on other sites

What version of Minecraft is this?

Edited by lyghtningwither

I like programming. I also have a lot of problems with programming. So I came here on this forum so that I could get my problems solved.

 

Thank you to everyone who has helped me on the forum! You will be appreciated.

Link to comment
Share on other sites

I copied your entire "build.gradle" file from your repository, tried it again and it still didn't work. See attached photo.

Capture.JPG

I like programming. I also have a lot of problems with programming. So I came here on this forum so that I could get my problems solved.

 

Thank you to everyone who has helped me on the forum! You will be appreciated.

Link to comment
Share on other sites

Thanks, I did what the tutorial said, and it worked! Just one more thing. I can't get it to have a day/night cycle. It's just endless blackness. Do you have any ideas on how to do this? You know, the Ice age would still have a Sun and a moon and stars and everything like that.

Here's my code for the dimension world provider:

 

package com.lyghtningwither.honeyfunmods.world.dimensions;

import com.lyghtningwither.honeyfunmods.init.DimensionInit;

import net.minecraft.util.math.BlockPos;
import net.minecraft.util.math.Vec3d;
import net.minecraft.world.DimensionType;
import net.minecraft.world.WorldProvider;
import net.minecraft.world.chunk.Chunk;
import net.minecraft.world.gen.IChunkGenerator;
import net.minecraftforge.fml.relauncher.Side;
import net.minecraftforge.fml.relauncher.SideOnly;

public class IceWorldProvider extends WorldProvider {

	@Override
	protected void init() {
		// TODO Auto-generated method stub
		super.init();
		this.hasSkyLight = true;
		
	}
	
	@Override
	public float calculateCelestialAngle(long worldTime, float partialTicks) {
		// TODO Auto-generated method stub
		return 0.50f;
	}
	
	@Override
	protected void generateLightBrightnessTable() {
		
		float f = 0.0f;
		for(int i = 0; i<= 15; i++) {
			
			float f1 = 1.0f - (float) i / 15.0f;
			this.lightBrightnessTable[i] = (1.0f - f1) / (f1 * 3.0f + 1.0f) * 1.0f + 0.0f;
			this.lightBrightnessTable[i] *= 0.3f;
		}
	}
	
	@Override
	public DimensionType getDimensionType() {
		
		return DimensionInit.iceDimensionType;
	}
	
	@Override
	public double getMovementFactor() {
		
		return 30.0D;
	}
	
	@Override
	public IChunkGenerator createChunkGenerator() {
		
		return new ChunkGeneratorIce(world);
	}
	
	@Override
	public boolean isSurfaceWorld() {
		
		return false;
	}
	
	@Override
	public boolean canRespawnHere() {
		
		return false;
	}
	
	@Override
	@SideOnly(Side.CLIENT)
	public Vec3d getFogColor(float par1, float par2) {
		
		return new Vec3d(0.0D, 0.0D, 0.0D);
	}
	
	@Override
	@SideOnly(Side.CLIENT)
	public boolean doesXZShowFog(int x, int z) {
		
		return true;
	}
	
	@Override
	public boolean canDoLightning(Chunk chunk) {
		
		return true;
	}
	
	@Override
	public boolean canBlockFreeze(BlockPos pos, boolean byWater) {
		
		return false;
	}
	
	@Override
	public boolean canDoRainSnowIce(Chunk chunk) {
		
		return true;
	}
	
	@Override
	public boolean canSnowAt(BlockPos pos, boolean checkLight) {

		return true;
	}
}

Again, if you have any further questions, please respond to this. Thanks!

I like programming. I also have a lot of problems with programming. So I came here on this forum so that I could get my problems solved.

 

Thank you to everyone who has helped me on the forum! You will be appreciated.

Link to comment
Share on other sites

Aaaaand here's the dimension. See, no sunlight!

I do "this.hasSkyLight = true" in the script above. Still not doing the day/night cycle! Please help. Thank you!

2018-03-14_19.33.40.png

I like programming. I also have a lot of problems with programming. So I came here on this forum so that I could get my problems solved.

 

Thank you to everyone who has helped me on the forum! You will be appreciated.

Link to comment
Share on other sites

Thanks, that worked. But there still are problems. First of all, the dimension is stuck on midnight. The moon isn't moving at all. Second, when I try using the command "/time set day," the game crashes after a few moments. Attached is the crash report.

 

 

Thank you!

crash-2018-03-15_16.15.41-server.txt

I like programming. I also have a lot of problems with programming. So I came here on this forum so that I could get my problems solved.

 

Thank you to everyone who has helped me on the forum! You will be appreciated.

Link to comment
Share on other sites

Wait, oops, sorry, it was an "exception generating a new chunk." Sorry. I was just confused because the crash happened right after I had entered a "/time set day" command. Sorry!

I like programming. I also have a lot of problems with programming. So I came here on this forum so that I could get my problems solved.

 

Thank you to everyone who has helped me on the forum! You will be appreciated.

Link to comment
Share on other sites

How do you make it actually go around? Do I remove calculateCelestialAngle(), or do I do something with the parameters of calculateCelestialAngle()?

I like programming. I also have a lot of problems with programming. So I came here on this forum so that I could get my problems solved.

 

Thank you to everyone who has helped me on the forum! You will be appreciated.

Link to comment
Share on other sites

Look at how the overworld handles it.

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.

Link to comment
Share on other sites

Where is the code for the overworld? How do you get to it? (i'm a big noob to Eclipse)

Edited by lyghtningwither

I like programming. I also have a lot of problems with programming. So I came here on this forum so that I could get my problems solved.

 

Thank you to everyone who has helped me on the forum! You will be appreciated.

Link to comment
Share on other sites

15 hours ago, lyghtningwither said:

Where is the code for the overworld? How do you get to it? (i'm a big noob to Eclipse)

Assuming you ran the full gradlew setupDecompWorkspace when you were setting up your workspace, then you should have all the source available as a Referenced Library in your project. So if you go to the Package Explorer pane you can navigate to the referenced libraries and find one (usually the first in the list) there should be one called forgeSrc and you can go into that to find all the net.minecraft and net.minecraftforge packages with code.

 

That is for generally browsing the code. However, you can also find specific stuff. For example, your code extends WorldProvider. So if you want to see the code for that, you just click somewhere in the word or select it and then right-click and select Open Declaration. That will open up the source for that.

 

Now the overworld probably extends WorldProvider so to find all the code that extends that, select the word and right-click and select Open Type Hierarchy. That will open up a pane that will show you all the classes derived from it, and also all the methods in it and inherited by it. You can then double-click on one of the derived classes to open up its source.

 

So specifically for this case I would:

1) Open up your world provider class

2) Go to top of the class where you extend WorldProvider, right click on the world "WorldProvider" and select Open Type Hierarchy.

3) A pane will pop up that shows that there are derived classes and one of them is called WorldProviderSurface. You can guess that that is probably the overrworld. So double-click that in the hierarchy window, and that will open the source.

4) You'll find that the WorldProviderSurface doesn't override very many methods. You're interested in the celestial angle, which isn't overridden. So you will want to go up the hierarchy. So double-click the WorldProvider class in the hierarchy window.

5) Scroll through the code, or use Control-F, to find the calculateCelestialAngle() code.

 

Basically using these techniques of selecting, using Type Hierarchy, you can quickly navigate through the parent and children classes.

 

One other tip, when you bring up the Type Hierarchy it will also list all the fields and methods in the selected class. However, there is a toggle option (one of the small icons) where you can have it list all inherited methods. If that was on, you also can find the calculateCelestialAngle() method there and immediately see if it has overrides.

Check out my tutorials here: http://jabelarminecraft.blogspot.com/

Link to comment
Share on other sites

I looked in the super implementation code, and it's this:

int i = (int)(worldTime % 24000L);
        float f = ((float)i + partialTicks) / 24000.0F - 0.25F;

        if (f < 0.0F)
        {
            ++f;
        }

        if (f > 1.0F)
        {
            --f;
        }

        float f1 = 1.0F - (float)((Math.cos((double)f * Math.PI) + 1.0D) / 2.0D);
        f = f + (f1 - f) / 3.0F;
        return f;

Is this the correct code? Please respond quickly.

I like programming. I also have a lot of problems with programming. So I came here on this forum so that I could get my problems solved.

 

Thank you to everyone who has helped me on the forum! You will be appreciated.

Link to comment
Share on other sites

WorldProviderSurface has no calculateCelestialAngle. By default, it says in the world provider the code above, and WorldProviderSurvace does not override it, so it is the correct code. (I just found out how to access the whole Minecraft library, so I looked in it till I found WorldProvideSurface.)

 

So when I wondered whether you had to just delete calculateCelestialAngle, I was right. But I was also right in the way that you had to change something. Weird!

 

Edited by lyghtningwither

I like programming. I also have a lot of problems with programming. So I came here on this forum so that I could get my problems solved.

 

Thank you to everyone who has helped me on the forum! You will be appreciated.

Link to comment
Share on other sites

3 hours ago, jabelar said:

Assuming you ran the full gradlew setupDecompWorkspace when you were setting up your workspace, then you should have all the source available as a Referenced Library in your project. So if you go to the Package Explorer pane you can navigate to the referenced libraries and find one (usually the first in the list) there should be one called forgeSrc and you can go into that to find all the net.minecraft and net.minecraftforge packages with code.

 

That is for generally browsing the code. However, you can also find specific stuff. For example, your code extends WorldProvider. So if you want to see the code for that, you just click somewhere in the word or select it and then right-click and select Open Declaration. That will open up the source for that.

 

Now the overworld probably extends WorldProvider so to find all the code that extends that, select the word and right-click and select Open Type Hierarchy. That will open up a pane that will show you all the classes derived from it, and also all the methods in it and inherited by it. You can then double-click on one of the derived classes to open up its source.

 

So specifically for this case I would:

1) Open up your world provider class

2) Go to top of the class where you extend WorldProvider, right click on the world "WorldProvider" and select Open Type Hierarchy.

3) A pane will pop up that shows that there are derived classes and one of them is called WorldProviderSurface. You can guess that that is probably the overrworld. So double-click that in the hierarchy window, and that will open the source.

4) You'll find that the WorldProviderSurface doesn't override very many methods. You're interested in the celestial angle, which isn't overridden. So you will want to go up the hierarchy. So double-click the WorldProvider class in the hierarchy window.

5) Scroll through the code, or use Control-F, to find the calculateCelestialAngle() code.

 

Basically using these techniques of selecting, using Type Hierarchy, you can quickly navigate through the parent and children classes.

 

One other tip, when you bring up the Type Hierarchy it will also list all the fields and methods in the selected class. However, there is a toggle option (one of the small icons) where you can have it list all inherited methods. If that was on, you also can find the calculateCelestialAngle() method there and immediately see if it has overrides.

You can also hold down "control" (or "command" on Mac) in order to get the declaration of a function.

I like programming. I also have a lot of problems with programming. So I came here on this forum so that I could get my problems solved.

 

Thank you to everyone who has helped me on the forum! You will be appreciated.

Link to comment
Share on other sites

So yeah, so as you've found the WorldProvider class already does a celestial angle implementation and the WorldProviderSurface doesn't override it. So if you don't override it, then you'll get the same implementation.

 

You should go through your other methods as well and confirm whether you really want to override them. The WorldProviderSurface really doesn't override much, so mostly you shouldn't override unless you specifically want it different than the overworld.

 

The good thing is now you've learned how to find the source code, that is really the key to learning modding -- inspecting how vanilla does things. In addition to the Type Hierarchy, I strongly suggest you learn to use the Call Hierarchy which is really useful in Eclipse. The Call Hierarchy shows you everywhere a method, field or constructor is called and so it can give you great confidence in the proper use of methods.

Check out my tutorials here: http://jabelarminecraft.blogspot.com/

Link to comment
Share on other sites

Thank you! Well, I think that my dimension is about finished. Thank you, everybody, for your help.

I like programming. I also have a lot of problems with programming. So I came here on this forum so that I could get my problems solved.

 

Thank you to everyone who has helped me on the forum! You will be appreciated.

Link to comment
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.

Guest
Unfortunately, your content contains terms that we do not allow. Please edit your content to remove the highlighted words below.
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

Announcements



×
×
  • Create New...

Important Information

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