-
Notifications
You must be signed in to change notification settings - Fork 13
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
(Merged commits due to large file) Update logs: Updated to v0.1.4.4 - HUD inhanced; now hour settings, alpha and brightness settings are available. - Removed; Now 1 hour is always 60 minute. - Added Progress Messages on World loading. - Fixed periods of moon&planets. Updated to v0.1.4.5 - Updated for Stellar API v0.1.3.3 Updated to v0.1.4.6 - Added tooltips for overlays. - Added HUD element for Client Settings Configurations. - Fixed issue #29 (stars drawn on the moon.) - Added equator, ecliptic and horizon. Simple Fix before release
- Loading branch information
Showing
152 changed files
with
6,429 additions
and
9,951 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Binary file not shown.
Binary file not shown.
Binary file renamed
BIN
+153 KB
libsrcs/Stellar API-0.1.3.1-sources.jar → libsrcs/Stellar API-0.1.3.4-sources.jar
Binary file not shown.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,119 +1,6 @@ | ||
package stellarium; | ||
|
||
import java.lang.reflect.Field; | ||
import java.lang.reflect.Modifier; | ||
|
||
import com.google.common.base.Throwables; | ||
|
||
import cpw.mods.fml.common.ObfuscationReflectionHelper; | ||
import cpw.mods.fml.common.eventhandler.SubscribeEvent; | ||
import cpw.mods.fml.relauncher.ReflectionHelper; | ||
import net.minecraft.world.World; | ||
import net.minecraft.world.WorldProvider; | ||
import net.minecraftforge.client.IRenderHandler; | ||
import net.minecraftforge.event.world.WorldEvent; | ||
import stellarapi.api.ICelestialCoordinate; | ||
import stellarapi.api.ISkyEffect; | ||
import stellarapi.api.StellarAPIReference; | ||
import stellarapi.api.helper.WorldProviderReplaceHelper; | ||
import stellarium.api.StellarSkyAPI; | ||
import stellarium.render.SkyRenderCelestial; | ||
import stellarium.stellars.DefaultCelestialHelper; | ||
import stellarium.stellars.StellarManager; | ||
import stellarium.stellars.layer.CelestialManager; | ||
import stellarium.world.StellarDimensionManager; | ||
|
||
public class StellarForgeEventHook { | ||
|
||
private static Field providerField = ReflectionHelper.findField(World.class, | ||
ObfuscationReflectionHelper.remapFieldNames(World.class.getName(), "provider", "field_73011_w")); | ||
|
||
static { | ||
try { | ||
Field modifiersField = Field.class.getDeclaredField("modifiers"); | ||
modifiersField.setAccessible(true); | ||
modifiersField.setInt(providerField, providerField.getModifiers() & ~ Modifier.FINAL); | ||
} catch(Exception exc) { | ||
Throwables.propagate(exc); | ||
} | ||
} | ||
|
||
@SubscribeEvent | ||
public void onWorldLoad(WorldEvent.Load e) | ||
{ | ||
StellarManager manager; | ||
if(!StellarManager.hasManager(e.world, e.world.isRemote)) { | ||
manager = StellarManager.loadOrCreateManager(e.world); | ||
} else manager = StellarManager.getManager(e.world.isRemote); | ||
|
||
if(manager.getCelestialManager() == null && (!e.world.isRemote || !manager.getSettings().serverEnabled)) | ||
setupManager(e.world, manager); | ||
|
||
String dimName = e.world.provider.getDimensionName(); | ||
if(!e.world.isRemote || !StellarSky.proxy.commonSettings.serverEnabled) | ||
if(StellarSky.proxy.dimensionSettings.hasSubConfig(dimName)) { | ||
StellarDimensionManager dimManager = StellarDimensionManager.loadOrCreate(e.world, manager, dimName); | ||
setupDimension(e.world, manager, dimManager); | ||
} | ||
|
||
if(e.world.isRemote) { | ||
if(mark) { | ||
handleNotHaveModOnServer(e.world); | ||
mark = false; | ||
} else if(StellarSky.proxy.commonSettings.serverEnabled) | ||
StellarSky.instance.getNetworkManager().queryInformation(e.world); | ||
} | ||
} | ||
|
||
public static void setupManager(World world, StellarManager manager) { | ||
if(world.isRemote) | ||
manager.setup(StellarSky.proxy.getClientCelestialManager().copy()); | ||
else manager.setup(new CelestialManager(false)); | ||
} | ||
|
||
public static void setupDimension(World world, StellarManager manager, StellarDimensionManager dimManager) { | ||
dimManager.setup(); | ||
|
||
StellarAPIReference.resetSkyEffect(world); | ||
StellarAPIReference.constructCelestials(world); | ||
|
||
ICelestialCoordinate coordinate = StellarAPIReference.getCoordinate(world); | ||
ISkyEffect skyEffect = StellarAPIReference.getSkyEffect(world); | ||
|
||
if(manager.getSettings().serverEnabled && dimManager.getSettings().doesPatchProvider()) { | ||
DefaultCelestialHelper helper = new DefaultCelestialHelper((float)dimManager.getSettings().getSunlightMultiplier(), 1.0f, | ||
dimManager.getSuns().get(0), dimManager.getMoons().get(0), coordinate, skyEffect); | ||
WorldProvider newProvider = StellarSkyAPI.getReplacedWorldProvider(world, world.provider, helper); | ||
new WorldProviderReplaceHelper().patchWorldProviderWith(world, newProvider); | ||
} | ||
|
||
if(world.isRemote) | ||
{ | ||
IRenderHandler renderer = StellarSkyAPI.getRendererFor(dimManager.getSettings().getSkyRendererType(), new SkyRenderCelestial(manager)); | ||
world.provider.setSkyRenderer(renderer); | ||
} | ||
} | ||
|
||
private static boolean mark = false; | ||
|
||
private static void handleNotHaveModOnServer(World world) { | ||
StellarManager manager = StellarManager.loadOrCreateManager(world); | ||
manager.handleServerWithoutMod(); | ||
|
||
if(manager.getCelestialManager() == null) | ||
{ | ||
StellarForgeEventHook.setupManager(world, manager); | ||
|
||
String dimName = world.provider.getDimensionName(); | ||
if(StellarSky.proxy.dimensionSettings.hasSubConfig(dimName)) { | ||
StellarDimensionManager dimManager = StellarDimensionManager.loadOrCreate(world, manager, dimName); | ||
StellarForgeEventHook.setupDimension(world, manager, dimManager); | ||
} | ||
} | ||
} | ||
|
||
public static void markNotHave() { | ||
mark = true; | ||
} | ||
|
||
|
||
} |
Oops, something went wrong.