mirror of
https://github.com/GTNewHorizons/Botania.git
synced 2026-10-26 14:24:22 +00:00
Added GoG Skybox support for all dimensions (#42)
* Added GoG Skybox support for all dimensions - Added a boolean to toggle the feature to the config - Added an int array to contain the dimension you would like to recieve the Skybox -Changed the GoG Skybox render check to include above changes Basically this allows you to display the Garden of Glass in any dimension you wish, instead of just in the overworld. I like to use this to have the skybox in my personal void dimension. * Changed dimension ID to HashSet - Changed the dimension ID handling from int[] to a HashSet of Integers -Added loadPropIntSet() Im sorry if there is better ways to handle the loading of the IDs from the file, this is what i was able to come up with, if theres a way to directly save a set to file please do tell
This commit is contained in:
1 parent
ebcca54ad4
commit
6610499e7c
2 files changed
+36
-4
No files matched your search
@@ -16,13 +16,21 @@ import net.minecraftforge.client.event.RenderWorldLastEvent;
|
||||
import vazkii.botania.common.core.handler.ConfigHandler;
|
||||
import vazkii.botania.common.world.WorldTypeSkyblock;
|
||||
import cpw.mods.fml.common.eventhandler.SubscribeEvent;
|
||||
import java.util.stream.IntStream;
|
||||
|
||||
public final class SkyblockRenderEvents {
|
||||
|
||||
@SubscribeEvent
|
||||
public void onRender(RenderWorldLastEvent event) {
|
||||
World world = Minecraft.getMinecraft().theWorld;
|
||||
if(ConfigHandler.enableFancySkybox && world.provider.dimensionId == 0 && (ConfigHandler.enableFancySkyboxInNormalWorlds || WorldTypeSkyblock.isWorldSkyblock(Minecraft.getMinecraft().theWorld))) {
|
||||
|
||||
boolean renderFancySkybox = ConfigHandler.enableFancySkybox && (
|
||||
(ConfigHandler.enableFancySkyboxInNormalWorlds && (world.provider.dimensionId == 0) ) ||
|
||||
(ConfigHandler.enableFancySkyboxInDimension && ConfigHandler.fancySkyboxDimensions.contains(world.provider.dimensionId)) ||
|
||||
(WorldTypeSkyblock.isWorldSkyblock(Minecraft.getMinecraft().theWorld))
|
||||
);
|
||||
|
||||
if(renderFancySkybox) {
|
||||
if(!(world.provider.getSkyRenderer() instanceof SkyblockSkyRenderer))
|
||||
world.provider.setSkyRenderer(new SkyblockSkyRenderer());
|
||||
}
|
||||
|
||||
@@ -11,10 +11,13 @@
|
||||
package vazkii.botania.common.core.handler;
|
||||
|
||||
import java.io.File;
|
||||
import java.util.ArrayList;
|
||||
import java.util.HashMap;
|
||||
import java.util.Arrays;
|
||||
import java.util.HashSet;
|
||||
import java.util.List;
|
||||
import java.util.HashMap;
|
||||
import java.util.Map;
|
||||
import java.util.ArrayList;
|
||||
import java.util.stream.Collectors;
|
||||
|
||||
import net.minecraft.entity.player.EntityPlayer;
|
||||
import net.minecraft.potion.Potion;
|
||||
@@ -66,6 +69,8 @@ public final class ConfigHandler {
|
||||
public static boolean enableArmorModels = true;
|
||||
public static boolean enableFancySkybox = true;
|
||||
public static boolean enableFancySkyboxInNormalWorlds = false;
|
||||
public static boolean enableFancySkyboxInDimension = false;
|
||||
public static HashSet<Integer> fancySkyboxDimensions = new HashSet<Integer>() {};
|
||||
|
||||
public static int manaBarHeight = 29;
|
||||
public static int flightBarHeight = 49;
|
||||
@@ -197,7 +202,13 @@ public final class ConfigHandler {
|
||||
|
||||
desc = "Set this to true to enable the fancy skybox in non Garden of Glass worlds. (Does not require Garden of Glass loaded to use, needs 'fancySkybox.enable' to be true as well)";
|
||||
enableFancySkyboxInNormalWorlds = loadPropBool("fancySkybox.normalWorlds", desc, enableFancySkyboxInNormalWorlds);
|
||||
|
||||
|
||||
desc = "Set this to true to enable the fancy skybox in custom dimension. (Does not require Garden of Glass loaded to use, needs 'fancySkybox.enable' to be true as well)";
|
||||
enableFancySkyboxInDimension = loadPropBool("fancySkybox.customDim", desc, enableFancySkyboxInDimension);
|
||||
|
||||
desc = "The ID of the dimension to use";
|
||||
fancySkyboxDimensions = loadPropIntSet("fancySkybox.customDimID", desc, fancySkyboxDimensions);
|
||||
|
||||
desc = "The height of the mana display bar in above the XP bar. You can change this if you have a mod that changes where the XP bar is.";
|
||||
manaBarHeight = loadPropInt("manaBar.height", desc, manaBarHeight);
|
||||
|
||||
@@ -364,6 +375,19 @@ public final class ConfigHandler {
|
||||
return prop.getIntList();
|
||||
}
|
||||
|
||||
public static HashSet<Integer> loadPropIntSet(String propName, String desc, HashSet<Integer> intSet) {
|
||||
int[] defaultValues = intSet.stream().mapToInt(Number::intValue).toArray();
|
||||
Property prop = config.get(Configuration.CATEGORY_GENERAL, propName, defaultValues);
|
||||
prop.comment = desc;
|
||||
|
||||
if(adaptor != null)
|
||||
adaptor.adaptPropertyIntArray(prop, prop.getIntList());
|
||||
|
||||
return Arrays.stream(prop.getIntList())
|
||||
.boxed()
|
||||
.collect(Collectors.toCollection(HashSet::new));
|
||||
}
|
||||
|
||||
public static int loadPropPotionId(String propName, int default_) {
|
||||
if(!verifiedPotionArray)
|
||||
verifyPotionArray();
|
||||
|
||||
Reference in new issue
Block a user