Forge really should have always supported the concept of an "exact spawn". Individual world providers can still

change this behaviour of course, but for default maps it makes sense to support it as a config option.
This commit is contained in:
cpw 2015-04-03 10:31:25 -04:00
parent e837b2e2cd
commit 38b9febfe5
2 changed files with 20 additions and 13 deletions

View File

@ -51,11 +51,11 @@
+ private IRenderHandler skyRenderer = null;
+ private IRenderHandler cloudRenderer = null;
+ private IRenderHandler weatherRenderer = null;
+
+
+ /**
+ * Sets the providers current dimension ID, used in default getSaveFolder()
+ * Added to allow default providers to be registered for multiple dimensions.
+ *
+ *
+ * @param dim Dimension ID
+ */
+ public void setDimension(int dim)
@ -105,7 +105,7 @@
+ else if (this instanceof WorldProviderHell)
+ {
+ return "Leaving the Nether";
+ }
+ }
+ return null;
+ }
+
@ -168,7 +168,7 @@
+ int spawnFuzz = field_76577_b.getSpawnFuzz();
+ int spawnFuzzHalf = spawnFuzz / 2;
+
+ if (!field_76576_e && !isAdventure)
+ if (!field_76576_e && !isAdventure && net.minecraftforge.common.ForgeModContainer.defaultHasSpawnFuzz)
+ {
+ chunkcoordinates.field_71574_a += this.field_76579_a.field_73012_v.nextInt(spawnFuzz) - spawnFuzzHalf;
+ chunkcoordinates.field_71573_c += this.field_76579_a.field_73012_v.nextInt(spawnFuzz) - spawnFuzzHalf;
@ -177,10 +177,10 @@
+
+ return chunkcoordinates;
+ }
+
+
+ /**
+ * Determine if the cusor on the map should 'spin' when rendered, like it does for the player in the nether.
+ *
+ *
+ * @param entity The entity holding the map, playername, or frame-ENTITYID
+ * @param x X Position
+ * @param y Y Position
@ -194,7 +194,7 @@
+
+ /**
+ * Determines the dimension the player will be respawned in, typically this brings them back to the overworld.
+ *
+ *
+ * @param player The player that is respawning
+ * @return The dimension to respawn the player in
+ */
@ -214,20 +214,20 @@
+ {
+ return field_76579_a.field_73008_k < 4;
+ }
+
+
+ /**
+ * The current sun brightness factor for this dimension.
+ * 0.0f means no light at all, and 1.0f means maximum sunlight.
+ * This will be used for the "calculateSkylightSubtracted"
+ * which is for Sky light value calculation.
+ *
+ *
+ * @return The current brightness factor
+ * */
+ public float getSunBrightnessFactor(float par1)
+ {
+ return field_76579_a.getSunBrightnessFactor(par1);
+ }
+
+
+ /**
+ * Calculates the current moon phase factor.
+ * This factor is effective for slimes.
@ -258,7 +258,7 @@
+ {
+ return field_76579_a.getSunBrightnessBody(par1);
+ }
+
+
+ /**
+ * Gets the Star Brightness for rendering sky.
+ * */

View File

@ -68,6 +68,7 @@ public class ForgeModContainer extends DummyModContainer implements WorldAccessC
public static boolean shouldSortRecipies = true;
public static boolean disableVersionCheck = false;
public static int defaultSpawnFuzz = 20;
public static boolean defaultHasSpawnFuzz = true;
private static Configuration config;
@ -225,6 +226,12 @@ public class ForgeModContainer extends DummyModContainer implements WorldAccessC
defaultSpawnFuzz = prop.getInt(20);
propOrder.add(prop.getName());
prop = config.get(Configuration.CATEGORY_GENERAL, "spawnHasFuzz", Boolean.TRUE,
"If the overworld has ANY spawn fuzz at all. If not, the spawn will always be the exact same location.");
prop.setLanguageKey("forge.configgui.hasspawnfuzz").setRequiresWorldRestart(false);
defaultHasSpawnFuzz = prop.getBoolean(Boolean.TRUE);
propOrder.add(prop.getName());
config.setCategoryPropertyOrder(CATEGORY_GENERAL, propOrder);
if (config.hasChanged())
@ -253,7 +260,7 @@ public class ForgeModContainer extends DummyModContainer implements WorldAccessC
}
}
}
@SubscribeEvent
public void playerLogin(PlayerEvent.PlayerLoggedInEvent event)
{
@ -280,7 +287,7 @@ public class ForgeModContainer extends DummyModContainer implements WorldAccessC
MinecraftForge.EVENT_BUS.register(MinecraftForge.INTERNAL_HANDLER);
ForgeChunkManager.captureConfig(evt.getModConfigurationDirectory());
FMLCommonHandler.instance().bus().register(this);
if (!ForgeModContainer.disableVersionCheck)
{
ForgeVersion.startVersionCheck();