Jump to content

Recommended Posts

Posted

Hello,

 

I have been doing a great deal of Visual Basic programming for some time and recently have use of a mod for a YouTube series I wish to do. Unfortunately for me, most of the videos for modding for Minecraft seem to be focused on creating/editing/changing blocks and what I want has nothing to do with blocks.

 

I have already installed Eclipse, Forge source, made all the directories and ran Gradle and the environment seems to be properly set up. From here, though, I can't figure out what objects I need to 'attach' to to do what I want to do. I have detailed my desire below, but if the top part is too awkward, the bottom half would suffice.

 

The Mod's Point: I just want to make it so it is always dark enough, even during the 'daytime' for mobs to spawn anywhere that hasn't been manually lit up. The former part is the first way I thought of to do it, but the latter way will work better, if it is possible to mess with that.

 

Any pointers and suggestions will be most welcome,

Phicksur

 

What I want to do

 

Every 10 ticks (so as not to be checked EVERY tick to reduce lag)

  Check time of day

    If Time of Day is between 13188 and 22810 do nothing

      else change time of day to 13188

 

Also (or instead of)

  Default maximum daytime light level is set to 7, not 15.

Posted

Ok, in looking through the files, I believe where I need to be editing is in the world.java class

 

Specifically the public int getBlockLightValue_do object

 

and if I change the default return value to 7 instead of 15, that should affect the daytime base light level.

 

 

 

Can anyone tell me if I am on the right track?

Posted

Well, 1st thing after this basic stuff are events - http://www.minecraftforge.net/wiki/Event_Reference

Using those you can probably archieve most of what you desire.

 

About daytime checks - if you want it to act globally (not via block or command) you will probably want to use:

cpw.mods.fml.common.gameevent.TickEvent

Ofc. use server side one and check daytime every whetever ticks you want, note that checking daytime every tick (not every 10) is not that bad... it's all very cheap on resources. Other Tickers on the other hand shouldn't be abused - try to avoid using them, for player you can for example use PlayerEvent.

 

 

1.7.10 is no longer supported by forge, you are on your own.

Posted

Hi

 

You might want to look at    world.setSkylightSubtracted(int newSkylightSubtracted) and/or calculatedSkyLightSubtracted()

 

I think what you're proposing might work, but it probably won't be as robust as using a built-in method (with minor tweak if reqd).

 

-TGG

 

Posted

Hi

 

You might want to look at    world.setSkylightSubtracted(int newSkylightSubtracted) and/or calculatedSkyLightSubtracted()

 

I think what you're proposing might work, but it probably won't be as robust as using a built-in method (with minor tweak if reqd).

 

-TGG

Those two methods (is that the right terminology?) appear to be what calculates the light levels based on changes in the time of day, and calculating the light from a block that is being lit from direct sunlight. The former might be handy, but I believe the change in the world.java class will do what I need by preventing the light level from ever exceeding 7 due to sunlight (but still exceed 7 from other non-sun sources).

 

Ok, at this point I am lost. I have changed the world.java class and saved it, but I do not know how to actually transform it into a 'mod'. Where is the tutorial for that part?

Posted

Basically the answer is "You can't change anthing in base classes of MC", but to extend that I will add: "You can only manipulate bytecode if you know how to ASM".

 

You probably can't do that yet (as you've came from VBA), so for now stay with 1st answer.

 

I alredy pointed out - what you are trying to do is just a goal, fist you have to learn how to use API.

 

Forge is a layer over vanilla mc that hooks itself into several methods. You (and any other mod) can use those hooks - events to execute your own code when vanilla methods are called.

 

For now - learn how to setup basic mod and how to subscribe to events. Next goal is to understand the TickEvent and create one that will check if 'time == day' every tick:

What I want to do

Every 10 ticks (so as not to be checked EVERY tick to reduce lag)
  Check time of day
    If Time of Day is between 13188 and 22810 do nothing
      else change time of day to 13188

And from there you can set it to set again to start of the day when night starts.

 

Note: for this 'default light level = 7' - quite impossible without ASM (OR IS IT :OO ?!?!?)

1.7.10 is no longer supported by forge, you are on your own.

Posted

There is another way, which changes the whole skylight of the world.

Follow these instructions:

 

1. Make your new customized WorldProvider.

2. Override getSunBrightnessFactor, getSunBrightness.

  - getSunBrightnessFactor is for skylight calculation on Server&Client. Affects the light value of whole world.

  - getSunBrightness is for sky rendering on Client on day.

3. Modify the methods with your needs.

    You can return the lowest value on those functions, for you wants permanent night!

4. As TGG said, replace overworld provider with yours.

    first, unregister the overworld provider using DimensionManager.unregisterProviderType

    then DimensionManager.registerProviderType for the surface world with your new customised WorldProvider

5. Done.

 

* These thing can be possible thanks to my PR. :-)

I. Stellarium for Minecraft: Configurable Universe for Minecraft! (WIP)

II. Stellar Sky, Better Star Rendering&Sky Utility mod, had separated from Stellarium.

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.