From 43be31d2ac5c8d390579edd4faa5817e91fc4b1a Mon Sep 17 00:00:00 2001 From: Alkalus <3060479+draknyte1@users.noreply.github.com> Date: Sun, 23 Jan 2022 17:41:06 +0000 Subject: Added framework for custom bees. Boosted drops of Dragon Metal from Chaos Dragons. Fixed https://github.com/GTNewHorizons/GT-New-Horizons-Modpack/issues/9556. --- .../java/gtPlusPlus/core/util/reflect/ReflectionUtils.java | 12 ++++++++++++ 1 file changed, 12 insertions(+) (limited to 'src/main/java/gtPlusPlus/core/util') diff --git a/src/main/java/gtPlusPlus/core/util/reflect/ReflectionUtils.java b/src/main/java/gtPlusPlus/core/util/reflect/ReflectionUtils.java index 92804d72ec..6ccd19019a 100644 --- a/src/main/java/gtPlusPlus/core/util/reflect/ReflectionUtils.java +++ b/src/main/java/gtPlusPlus/core/util/reflect/ReflectionUtils.java @@ -1086,5 +1086,17 @@ public class ReflectionUtils { return null; } + public static Enum getEnum(Class sgtbees, String name) { + if (sgtbees.isEnum()) { + Object[] aValues = sgtbees.getEnumConstants(); + for (Object o : aValues) { + if (o.toString().toLowerCase().equals(name.toLowerCase())) { + return (Enum) o; + } + } + } + return null; + } + } -- cgit From 3d46d957637c60aeecb59065da2328401f27949d Mon Sep 17 00:00:00 2001 From: Alkalus <3060479+draknyte1@users.noreply.github.com> Date: Sun, 23 Jan 2022 20:07:04 +0000 Subject: Added some bees and shit. Added Force. Updated how GT++ material components get localized. --- src/main/java/gtPlusPlus/core/util/reflect/ReflectionUtils.java | 9 +++++++++ 1 file changed, 9 insertions(+) (limited to 'src/main/java/gtPlusPlus/core/util') diff --git a/src/main/java/gtPlusPlus/core/util/reflect/ReflectionUtils.java b/src/main/java/gtPlusPlus/core/util/reflect/ReflectionUtils.java index 6ccd19019a..48cdb18d7c 100644 --- a/src/main/java/gtPlusPlus/core/util/reflect/ReflectionUtils.java +++ b/src/main/java/gtPlusPlus/core/util/reflect/ReflectionUtils.java @@ -362,6 +362,15 @@ public class ReflectionUtils { return loaded > 0; } + + public static void loadClass(String aClassName) { + try { + Class.forName(aClassName, true, ReflectionUtils.class.getClassLoader()); + } + catch (ClassNotFoundException e) { + e.printStackTrace(); + } + } -- cgit From 143a76dd8b380f85dad4fee6359b5a17022feccb Mon Sep 17 00:00:00 2001 From: Alkalus <3060479+draknyte1@users.noreply.github.com> Date: Sat, 29 Jan 2022 13:07:43 +0000 Subject: Added Mob Mentality. Added perks to sleeping. Added Magic Feather. --- src/main/java/gtPlusPlus/core/util/math/MathUtils.java | 13 +++++++++++++ 1 file changed, 13 insertions(+) (limited to 'src/main/java/gtPlusPlus/core/util') diff --git a/src/main/java/gtPlusPlus/core/util/math/MathUtils.java b/src/main/java/gtPlusPlus/core/util/math/MathUtils.java index 7573e0d51c..ef5db6e4e0 100644 --- a/src/main/java/gtPlusPlus/core/util/math/MathUtils.java +++ b/src/main/java/gtPlusPlus/core/util/math/MathUtils.java @@ -135,6 +135,19 @@ public class MathUtils { public static double findPercentage(final double current, final double max){ return Math.round(((current / max) * 100) * 100.00) / 100.00; } + + /** + * Returns a percentage. + * The returned number is the % of X in Y. + * Supports Floats. + * + * @param current Current value. + * @param max Maximim value. Must be greater than min. + * @return double between min and max, inclusive. + */ + public static float findPercentage(final float current, final float max){ + return (float) (Math.round(((current / max) * 100) * 100.00) / 100.00); + } public static int findPercentageOfInt(long input, float percentage){ return (int)(input*(percentage/100.0f)); -- cgit From e7fb530caf15236026808ffaecaf1b2cae140776 Mon Sep 17 00:00:00 2001 From: Alkalus <3060479+draknyte1@users.noreply.github.com> Date: Sat, 29 Jan 2022 13:33:21 +0000 Subject: Re-allow removal of debuffs when sleeping. Localized chat strings. --- src/main/java/gtPlusPlus/core/util/minecraft/PlayerUtils.java | 5 +++++ 1 file changed, 5 insertions(+) (limited to 'src/main/java/gtPlusPlus/core/util') diff --git a/src/main/java/gtPlusPlus/core/util/minecraft/PlayerUtils.java b/src/main/java/gtPlusPlus/core/util/minecraft/PlayerUtils.java index 24ffa295b7..f2be723726 100644 --- a/src/main/java/gtPlusPlus/core/util/minecraft/PlayerUtils.java +++ b/src/main/java/gtPlusPlus/core/util/minecraft/PlayerUtils.java @@ -14,6 +14,7 @@ import net.minecraft.item.Item; import net.minecraft.item.ItemStack; import net.minecraft.server.MinecraftServer; import net.minecraft.util.ChunkCoordinates; +import net.minecraft.util.IChatComponent; import net.minecraft.world.World; import net.minecraftforge.common.util.FakePlayer; @@ -34,6 +35,10 @@ public class PlayerUtils { public static void messagePlayer(final EntityPlayer P, final String S){ gregtech.api.util.GT_Utility.sendChatToPlayer(P, S); } + + public static void messagePlayer(final EntityPlayer P, final IChatComponent S){ + P.addChatComponentMessage(S); + } public static EntityPlayer getPlayer(final String name){ try{ -- cgit