Compare commits

...
Author SHA1 Message Date
Martin Robertz d5c4e9217b update 2024-05-06 18:28:40 +02:00
LuluTheDog 6610499e7c 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
2024-05-06 18:27:49 +02:00
Martin Robertz ebcca54ad4 update 2024-03-24 13:12:23 +01:00
Abdiel Kavash 89237f644a Optimize Alf Portal logic (#49) 2024-03-24 08:17:05 +01:00
Martin Robertz 052041f846 update 2024-03-08 18:24:33 +01:00
Glease 8f1d0abbeb fix elv portal treating lexicon as illegal item (#47) 2024-03-07 11:04:18 +01:00
8 changed files with 122 additions and 18 deletions

No files matched your search

+4 -4
View File
@@ -5,12 +5,12 @@ dependencies {
compile('thaumcraft:Thaumcraft:1.7.10-4.2.3.5:dev')
compileOnly('com.github.GTNewHorizons:Railcraft:9.15.5:api') {transitive=false}
compileOnly('com.github.GTNewHorizons:StorageDrawers:1.13.3-GTNH:api') {transitive=false}
compileOnly('com.github.GTNewHorizons:Railcraft:9.15.8:api') {transitive=false}
compileOnly('com.github.GTNewHorizons:StorageDrawers:1.13.5-GTNH:api') {transitive=false}
compileOnly('com.github.GTNewHorizons:ForgeMultipart:1.4.8:dev') {transitive=false}
compileOnly('com.github.GTNewHorizons:NotEnoughItems:2.5.19-GTNH:dev')
compileOnly('com.github.GTNewHorizons:NotEnoughItems:2.6.0-GTNH:dev')
compileOnly('com.github.GTNewHorizons:BuildCraft:7.1.39:api') {transitive=false}
compile('com.github.GTNewHorizons:GTNHLib:0.2.7:dev')
compile('com.github.GTNewHorizons:GTNHLib:0.2.11:dev')
compileOnly('curse.maven:cofh-lib-220333:2388748')
compileOnly('curse.maven:minefactory-reloaded-66672:2366150')
+1 -1
View File
@@ -117,7 +117,7 @@ minimizeShadowedDependencies = true
# If disabled, won't rename the shadowed classes.
relocateShadowedDependencies = true
# Adds the GTNH maven, CurseMaven, IC2/Player maven, and some more well-known 1.7.10 repositories.
# Adds the GTNH maven, CurseMaven, Modrinth, and some more well-known 1.7.10 repositories.
includeWellKnownRepositories = true
# Change these to your Maven coordinates if you want to publish to a custom Maven repository instead of the default GTNH Maven.
Binary file not shown.
+1 -1
View File
@@ -1,6 +1,6 @@
distributionBase=GRADLE_USER_HOME
distributionPath=wrapper/dists
distributionUrl=https\://services.gradle.org/distributions/gradle-8.6-bin.zip
distributionUrl=https\://services.gradle.org/distributions/gradle-8.7-bin.zip
networkTimeout=10000
validateDistributionUrl=true
zipStoreBase=GRADLE_USER_HOME
+1 -1
View File
@@ -17,7 +17,7 @@ pluginManagement {
}
plugins {
id 'com.gtnewhorizons.gtnhsettingsconvention' version '1.0.14'
id 'com.gtnewhorizons.gtnhsettingsconvention' version '1.0.22'
}
@@ -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());
}
@@ -10,7 +10,9 @@
*/
package vazkii.botania.common.block.tile;
import java.util.ArrayDeque;
import java.util.ArrayList;
import java.util.Deque;
import java.util.List;
import net.minecraft.block.Block;
@@ -63,11 +65,14 @@ public class TileAlfPortal extends TileMod {
private static final String TAG_TICKS_OPEN = "ticksOpen";
private static final String TAG_TICKS_SINCE_LAST_ITEM = "ticksSinceLastItem";
private static final String TAG_STACK_COUNT = "stackCount";
private static final String TAG_STACK_COUNT = "stackCount"; // Input stacks
private static final String TAG_OUTPUT_COUNT = "outputStackCount";
private static final String TAG_STACK = "portalStack";
private static final String TAG_OUTPUT_STACK = "outputStack";
private static final String TAG_PORTAL_FLAG = "_elvenPortal";
List<ItemStack> stacksIn = new ArrayList();
List<ItemStack> stacksIn = new ArrayList<>();
Deque<ItemStack> stacksOut = new ArrayDeque<>();
public int ticksOpen = 0;
int ticksSinceLastItem = 0;
@@ -153,8 +158,10 @@ public class TileAlfPortal extends TileMod {
}
if(ticksSinceLastItem >= 4) {
if(!worldObj.isRemote)
if(!worldObj.isRemote) {
resolveRecipes();
spawnOutput();
}
}
}
} else closeNow = false;
@@ -178,6 +185,11 @@ public class TileAlfPortal extends TileMod {
}
private boolean validateItemUsage(ItemStack inputStack) {
if (inputStack.getItem() instanceof ILexicon) {
// lexicon does not formally have a recipe and is handled in a special branch
// in resolveRecipe(), therefore it needs a special branch here as well
return true;
}
for(RecipeElvenTrade recipe : BotaniaAPI.elvenTradeRecipes) {
for(Object o : recipe.getInputs()) {
if(o instanceof String) {
@@ -239,12 +251,16 @@ public class TileAlfPortal extends TileMod {
}
void resolveRecipes() {
if (stacksIn.isEmpty()) {
return;
}
int i = 0;
for(ItemStack stack : stacksIn) {
if(stack != null && stack.getItem() instanceof ILexicon) {
((ILexicon) stack.getItem()).unlockKnowledge(stack, BotaniaAPI.elvenKnowledge);
ItemLexicon.setForcedPage(stack, LexiconData.elvenMessage.getUnlocalizedName());
spawnItem(stack);
addOutput(stack);
stacksIn.remove(i);
return;
}
@@ -253,9 +269,48 @@ public class TileAlfPortal extends TileMod {
for(RecipeElvenTrade recipe : BotaniaAPI.elvenTradeRecipes) {
if(recipe.matches(stacksIn, false)) {
recipe.matches(stacksIn, true);
spawnItem(recipe.getOutput().copy());
break;
ItemStack output = recipe.getOutput().copy();
int stackSize = output.stackSize;
output.stackSize = 0;
while (recipe.matches(stacksIn, true)) {
output.stackSize += stackSize;
}
addOutput(output);
if (stacksIn.isEmpty()) break;
}
}
}
void addOutput(ItemStack stack) {
if (stack == null) {
return;
}
if (stacksOut.isEmpty()) {
stacksOut.addLast(stack);
return;
}
ItemStack lastStack = stacksOut.getLast();
if (stack.isItemEqual(lastStack)) {
lastStack.stackSize += stack.stackSize;
} else {
stacksOut.addLast(stack);
}
}
void spawnOutput() {
if (!stacksOut.isEmpty()) {
ItemStack stack = stacksOut.getFirst();
if (stack.stackSize > 1) {
--stack.stackSize;
stack = stack.copy();
stack.stackSize = 1;
spawnItem(stack);
} else if (stack.stackSize == 1) {
stacksOut.removeFirst();
spawnItem(stack);
} else {
stacksOut.removeFirst();
}
}
}
@@ -279,6 +334,15 @@ public class TileAlfPortal extends TileMod {
cmp.setTag(TAG_STACK + i, stackcmp);
i++;
}
cmp.setInteger(TAG_OUTPUT_COUNT, stacksOut.size());
i = 0;
for(ItemStack stack : stacksOut) {
NBTTagCompound stackcmp = new NBTTagCompound();
stack.writeToNBT(stackcmp);
cmp.setTag(TAG_OUTPUT_STACK + i, stackcmp);
i++;
}
}
@Override
@@ -292,6 +356,14 @@ public class TileAlfPortal extends TileMod {
ItemStack stack = ItemStack.loadItemStackFromNBT(stackcmp);
stacksIn.add(stack);
}
count = cmp.getInteger(TAG_OUTPUT_COUNT);
stacksOut.clear();
for(int i = 0; i < count; i++) {
NBTTagCompound stackcmp = cmp.getCompoundTag(TAG_OUTPUT_STACK + i);
ItemStack stack = ItemStack.loadItemStackFromNBT(stackcmp);
stacksOut.addLast(stack);
}
}
@Override
@@ -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();