From 21f9564208926fe1de552e16c4df43be450b61e5 Mon Sep 17 00:00:00 2001 From: GDCloud Date: Thu, 2 Feb 2023 21:07:10 +0100 Subject: Add Block & textures --- .../java/common/blocks/Block_LapotronicEnergyUnit.java | 8 ++++++++ .../textures/blocks/ReallyUltimateEnergyUnit_side.png | Bin 275 -> 200 bytes .../textures/blocks/ReallyUltimateEnergyUnit_top.png | Bin 259 -> 190 bytes 3 files changed, 8 insertions(+) diff --git a/src/main/java/common/blocks/Block_LapotronicEnergyUnit.java b/src/main/java/common/blocks/Block_LapotronicEnergyUnit.java index b9c930d545..ff7e273a7b 100644 --- a/src/main/java/common/blocks/Block_LapotronicEnergyUnit.java +++ b/src/main/java/common/blocks/Block_LapotronicEnergyUnit.java @@ -64,6 +64,8 @@ public class Block_LapotronicEnergyUnit extends BaseGTUpdateableBlock { private IIcon iconLapoUVTop; private IIcon iconUltimateSide; private IIcon iconUltimateTop; + private IIcon iconUltimateExtremeSide; + private IIcon iconUltimateExtremeTop; private Block_LapotronicEnergyUnit() { super(Material.iron); @@ -100,6 +102,8 @@ public class Block_LapotronicEnergyUnit extends BaseGTUpdateableBlock { iconUltimateSide = ir.registerIcon("kekztech:UltimateEnergyUnit_side"); iconUltimateTop = ir.registerIcon("kekztech:UltimateEnergyUnit_top"); + iconUltimateExtremeSide = ir.registerIcon("kekztech:ReallyUltimateEnergyUnit_side"); + iconUltimateExtremeTop = ir.registerIcon("kekztech:ReallyUltimateEnergyUnit_top"); } @Override @@ -117,6 +121,8 @@ public class Block_LapotronicEnergyUnit extends BaseGTUpdateableBlock { par3List.add(new ItemStack(par1, 1, 4)); // Ultimate battery par3List.add(new ItemStack(par1, 1, 5)); + // UEV Cap + par3List.add(new ItemStack(par1, 1, 8)); } @Override @@ -138,6 +144,8 @@ public class Block_LapotronicEnergyUnit extends BaseGTUpdateableBlock { return (side < 2) ? iconLapoEmptyTop : iconLapoEmptySide; case 7: return (side < 2) ? iconLapoEVTop : iconLapoEVSide; + case 8: + return (side < 2) ? iconUltimateExtremeTop : iconUltimateExtremeSide; default: return iconUltimateTop; } diff --git a/src/main/resources/assets/kekztech/textures/blocks/ReallyUltimateEnergyUnit_side.png b/src/main/resources/assets/kekztech/textures/blocks/ReallyUltimateEnergyUnit_side.png index 15a89994a1..d2e362dba9 100644 Binary files a/src/main/resources/assets/kekztech/textures/blocks/ReallyUltimateEnergyUnit_side.png and b/src/main/resources/assets/kekztech/textures/blocks/ReallyUltimateEnergyUnit_side.png differ diff --git a/src/main/resources/assets/kekztech/textures/blocks/ReallyUltimateEnergyUnit_top.png b/src/main/resources/assets/kekztech/textures/blocks/ReallyUltimateEnergyUnit_top.png index ff2f1e826d..def607dde8 100644 Binary files a/src/main/resources/assets/kekztech/textures/blocks/ReallyUltimateEnergyUnit_top.png and b/src/main/resources/assets/kekztech/textures/blocks/ReallyUltimateEnergyUnit_top.png differ -- cgit From de6b528905ec1c2a6294505073c350f20ce05924 Mon Sep 17 00:00:00 2001 From: GDCloud Date: Thu, 2 Feb 2023 21:11:15 +0100 Subject: Localization --- src/main/resources/assets/kekztech/lang/en_US.lang | 3 +++ 1 file changed, 3 insertions(+) diff --git a/src/main/resources/assets/kekztech/lang/en_US.lang b/src/main/resources/assets/kekztech/lang/en_US.lang index 0e0245ae8e..54ed1f6870 100644 --- a/src/main/resources/assets/kekztech/lang/en_US.lang +++ b/src/main/resources/assets/kekztech/lang/en_US.lang @@ -143,6 +143,7 @@ tile.kekztech_lapotronicenergyunit_block.4.name=Lapotronic Capacitor (UV) tile.kekztech_lapotronicenergyunit_block.5.name=Ultimate Capacitor (UHV) tile.kekztech_lapotronicenergyunit_block.6.name=Empty Capacitor (-) tile.kekztech_lapotronicenergyunit_block.7.name=Lapotron Capacitor (EV) +tile.kekztech_lapotronicenergyunit_block.8.name=Ultimate Extreme Capacitor (UEV) tile.kekztech_lapotronicenergyunit_block.desc=Part of the Lapotronic Super Capacitor # -------- Thaumium Reinforced Jar: Block @@ -190,3 +191,5 @@ achievement.tile.kekztech_lapotronicenergyunit_block.4.desc=Pickup this item to achievement.tile.kekztech_lapotronicenergyunit_block.4=Lapotronic Capacitor (UV) achievement.tile.kekztech_lapotronicenergyunit_block.5.desc=Pickup this item to see the recipe in NEI achievement.tile.kekztech_lapotronicenergyunit_block.5=Ultimate Capacitor (UHV) +achievement.tile.kekztech_lapotronicenergyunit_block.8.desc=Beyond the ranks of Gods +achievement.tile.kekztech_lapotronicenergyunit_block.8=Ultimate Capacitor (UEV) -- cgit From 322e11461b2a5cdd381fcb643c8f1178d8f63c2a Mon Sep 17 00:00:00 2001 From: GDCloud Date: Thu, 2 Feb 2023 21:19:35 +0100 Subject: Insert UEV Cap stuff --- .../java/common/itemBlocks/IB_LapotronicEnergyUnit.java | 15 +++++++++++++++ 1 file changed, 15 insertions(+) diff --git a/src/main/java/common/itemBlocks/IB_LapotronicEnergyUnit.java b/src/main/java/common/itemBlocks/IB_LapotronicEnergyUnit.java index 370dfb0a11..fecfce2bc9 100644 --- a/src/main/java/common/itemBlocks/IB_LapotronicEnergyUnit.java +++ b/src/main/java/common/itemBlocks/IB_LapotronicEnergyUnit.java @@ -44,12 +44,20 @@ public class IB_LapotronicEnergyUnit extends ItemBlock { private static BigInteger UHV_cap_eu_per_tick = LSC_wireless_eu_cap.divide(BigInteger.valueOf(LSC_time_between_wireless_rebalance_in_ticks)); + // 6 Quadrillion EU. + public static BigInteger UEV_wireless_eu_cap = BigInteger.valueOf(100 * 60 * pow(10, 12)); + + // 1 Trillion EU/t + private static BigInteger UEV_cap_eu_per_tick = + UEV_wireless_eu_cap.divide(BigInteger.valueOf(LSC_time_between_wireless_rebalance_in_ticks)); + public static long EV_cap_storage = 60_000_000L; public static long IV_cap_storage = 600_000_000L; public static long LuV_cap_storage = 6_000_000_000L; public static long ZPM_cap_storage = 60_000_000_000L; public static long UV_cap_storage = 600_000_000_000L; public static long UHV_cap_storage = Long.MAX_VALUE; + public static long UEV_cap_storage = Long.MAX_VALUE; @SuppressWarnings("unchecked") @Override @@ -86,6 +94,13 @@ public class IB_LapotronicEnergyUnit extends ItemBlock { lines.add("Capacity: " + EnumChatFormatting.RED + GT_Utility.formatNumbers(EV_cap_storage) + EnumChatFormatting.GRAY + " EU"); break; + case 8: + lines.add("Capacity: " + EnumChatFormatting.RED + GT_Utility.formatNumbers(UEV_cap_storage) + + EnumChatFormatting.GRAY + "EU"); + lines.add("Supports up to " + EnumChatFormatting.RED + GT_Utility.formatNumbers(UEV_cap_eu_per_tick) + + EnumChatFormatting.GRAY + "EU/t of wireless transfer per " + GT_Values.TIER_COLORS[10] + + GT_Values.VN[10] + EnumChatFormatting.GRAY + " capacitor."); + break; } } } -- cgit From 79b1212b00cb16aeaf14a548aced73b3337bed3d Mon Sep 17 00:00:00 2001 From: GDCloud Date: Thu, 2 Feb 2023 21:26:10 +0100 Subject: First attempt --- .../GTMTE_LapotronicSuperCapacitor.java | 46 ++++++++++++++-------- 1 file changed, 29 insertions(+), 17 deletions(-) diff --git a/src/main/java/common/tileentities/GTMTE_LapotronicSuperCapacitor.java b/src/main/java/common/tileentities/GTMTE_LapotronicSuperCapacitor.java index a020502bad..cf261dec3d 100644 --- a/src/main/java/common/tileentities/GTMTE_LapotronicSuperCapacitor.java +++ b/src/main/java/common/tileentities/GTMTE_LapotronicSuperCapacitor.java @@ -70,6 +70,7 @@ public class GTMTE_LapotronicSuperCapacitor private final Queue energyOutputValues = new LinkedList<>(); private long max_passive_drain_eu_per_tick_per_uhv_cap = 1_000_000; + private long max_passive_drain_eu_per_tick_per_uev_cap = 100_000_000; private enum Capacitor { IV(2, BigInteger.valueOf(IV_cap_storage)), @@ -77,6 +78,7 @@ public class GTMTE_LapotronicSuperCapacitor ZPM(4, BigInteger.valueOf(ZPM_cap_storage)), UV(5, BigInteger.valueOf(UV_cap_storage)), UHV(6, MAX_LONG), + UEV(7, MAX_LONG), None(0, BigInteger.ZERO), EV(1, BigInteger.valueOf(EV_cap_storage)); @@ -300,7 +302,7 @@ public class GTMTE_LapotronicSuperCapacitor * Count the amount of capacitors of each tier in each slot. * Index = meta - 1 */ - private final int[] capacitors = new int[7]; + private final int[] capacitors = new int[8]; private BigInteger capacity = BigInteger.ZERO; private BigInteger stored = BigInteger.ZERO; @@ -395,16 +397,21 @@ public class GTMTE_LapotronicSuperCapacitor private int getUHVCapacitorCount() { return capacitors[4]; } + private int getUEVCapacitorCount() { + return capacitors[7]; + } @Override protected GT_Multiblock_Tooltip_Builder createTooltip() { final GT_Multiblock_Tooltip_Builder tt = new GT_Multiblock_Tooltip_Builder(); tt.addMachineType("Energy Storage") - .addInfo("Loses energy equal to 1% of the total capacity every 24 hours. Capped") - .addInfo("at " + EnumChatFormatting.RED + .addInfo("Loses energy equal to 1% of the total capacity every 24 hours.") + .addInfo("Capped at " + EnumChatFormatting.RED + GT_Utility.formatNumbers(max_passive_drain_eu_per_tick_per_uhv_cap) + EnumChatFormatting.GRAY - + "EU/t passive loss per " + GT_Values.TIER_COLORS[9] + GT_Values.VN[9] - + EnumChatFormatting.GRAY + " capacitor.") + + " EU/t passive loss per " + GT_Values.TIER_COLORS[9] + GT_Values.VN[9] + + EnumChatFormatting.GRAY + " capacitor and ") + .addInfo( EnumChatFormatting.RED + GT_Utility.formatNumbers(max_passive_drain_eu_per_tick_per_uev_cap) + EnumChatFormatting.GRAY + " EU/t passive loss per " + + GT_Values.TIER_COLORS[10] + GT_Values.VN[10] + EnumChatFormatting.GRAY + " capacitor.") .addInfo("Passive loss is multiplied by the number of maintenance issues present.") .addSeparator() .addInfo("Glass shell has to be Tier - 3 of the highest capacitor tier.") @@ -415,12 +422,12 @@ public class GTMTE_LapotronicSuperCapacitor .addSeparator() .addInfo("Wireless mode can be enabled by right clicking with a screwdriver.") .addInfo("This mode can only be enabled if you have a " + GT_Values.TIER_COLORS[9] + GT_Values.VN[9] - + EnumChatFormatting.GRAY + " capacitor in the multiblock.") + + EnumChatFormatting.GRAY + " or " + GT_Values.TIER_COLORS[10] + GT_Values.VN[10] + EnumChatFormatting.GRAY + " capacitor in the multiblock.") .addInfo("When enabled every " + EnumChatFormatting.BLUE + GT_Utility.formatNumbers(LSC_time_between_wireless_rebalance_in_ticks) + EnumChatFormatting.GRAY + " ticks the LSC will attempt to re-balance against your") - .addInfo("wireless EU network. If there is less than " + EnumChatFormatting.RED - + GT_Utility.formatNumbers(LSC_wireless_eu_cap) + EnumChatFormatting.GRAY + "EU in the LSC") + .addInfo("wireless EU network. If there is less than " + GT_Values.TIER_COLORS[9] + + GT_Utility.formatNumbers(LSC_wireless_eu_cap) + EnumChatFormatting.GRAY + "(" + GT_Values.TIER_COLORS[10] + GT_Values.VN[9] + EnumChatFormatting.GRAY + ")" + " or " + GT_Values.TIER_COLORS[10] + GT_Utility.formatNumbers(UEV_wireless_eu_cap) + EnumChatFormatting.GRAY + "(" + GT_Values.TIER_COLORS[10] + GT_Values.VN[10] + EnumChatFormatting.GRAY + ")" + "EU in the LSC") .addInfo("it will withdraw from the network and add to the LSC. If there is more it will add") .addInfo("the EU to the network and remove it from the LSC.") .addSeparator() @@ -551,13 +558,14 @@ public class GTMTE_LapotronicSuperCapacitor } // Check if enough (more than 50%) non-empty caps - if (capacitors[5] + if (capacitors[6] > capacitors[0] + capacitors[1] + capacitors[2] + capacitors[3] + getUHVCapacitorCount() - + capacitors[6]) return false; + + capacitors[6] + + getUEVCapacitorCount()) return false; // Calculate total capacity capacity = BigInteger.ZERO; @@ -684,7 +692,7 @@ public class GTMTE_LapotronicSuperCapacitor } } - if (getUHVCapacitorCount() <= 0) { + if (getUHVCapacitorCount() <= 0 && getUEVCapacitorCount() <= 0) { wireless_mode = false; } @@ -697,7 +705,7 @@ public class GTMTE_LapotronicSuperCapacitor // Find difference. BigInteger transferred_eu = - stored.subtract(LSC_wireless_eu_cap.multiply(BigInteger.valueOf(getUHVCapacitorCount()))); + stored.subtract((LSC_wireless_eu_cap.multiply(BigInteger.valueOf(getUHVCapacitorCount()))).add(UEV_wireless_eu_cap.multiply(BigInteger.valueOf(getUEVCapacitorCount())))); if (transferred_eu.signum() == 1) { inputLastTick += transferred_eu.longValue(); @@ -708,7 +716,7 @@ public class GTMTE_LapotronicSuperCapacitor // If that difference can be added then do so. if (addEUToGlobalEnergyMap(global_energy_user_uuid, transferred_eu)) { // If it succeeds there was sufficient energy so set the internal capacity as such. - stored = LSC_wireless_eu_cap.multiply(BigInteger.valueOf(getUHVCapacitorCount())); + stored = LSC_wireless_eu_cap.multiply(BigInteger.valueOf(getUHVCapacitorCount())).add(UEV_wireless_eu_cap.multiply(BigInteger.valueOf(getUEVCapacitorCount()))); } } @@ -758,13 +766,16 @@ public class GTMTE_LapotronicSuperCapacitor long temp_capacity_divided = capacity.divide(BigInteger.valueOf(100L * 86400L * 20L)).longValue(); - // Passive loss is multiplied by number of UHV caps. Minimum of 1 otherwise loss is 0 for non-UHV caps + // Passive loss is multiplied by number of UHV/UEV caps. Minimum of 1 otherwise loss is 0 for non-UHV/UEV caps // calculations. long uhv_cap_multiplier = min(temp_capacity_divided, max_passive_drain_eu_per_tick_per_uhv_cap * max(1, getUHVCapacitorCount())); + long uev_cap_multiplier = + min(temp_capacity_divided, max_passive_drain_eu_per_tick_per_uev_cap * max(1, getUEVCapacitorCount())); + // Passive loss is multiplied by number of maintenance issues. - long total_passive_loss = uhv_cap_multiplier * (getIdealStatus() - repairStatus + 1); + long total_passive_loss = (uhv_cap_multiplier + uev_cap_multiplier) * (getIdealStatus() - repairStatus + 1); // Maximum of 100,000 EU/t drained per UHV cell. The logic is 1% of EU capacity should be drained every 86400 // seconds (1 day). @@ -936,14 +947,15 @@ public class GTMTE_LapotronicSuperCapacitor @Override public void onScrewdriverRightClick(byte aSide, EntityPlayer aPlayer, float aX, float aY, float aZ) { - if (getUHVCapacitorCount() != 0) { + if (getUHVCapacitorCount() != 0 || getUEVCapacitorCount() != 0) { wireless_mode = !wireless_mode; GT_Utility.sendChatToPlayer(aPlayer, "Wireless network mode " + (wireless_mode ? "enabled." : "disabled.")); } else { GT_Utility.sendChatToPlayer( aPlayer, "Wireless mode cannot be enabled without at least 1 " + GT_Values.TIER_COLORS[9] + GT_Values.VN[9] - + EnumChatFormatting.RESET + " capacitor."); + + EnumChatFormatting.RESET + " or " + GT_Values.TIER_COLORS[10] + GT_Values.VN[10] + + EnumChatFormatting.RESET + " capacitor."); wireless_mode = false; } } -- cgit From 0e683242448990f70d46b0742293a9e79996811b Mon Sep 17 00:00:00 2001 From: GDCloud Date: Thu, 2 Feb 2023 21:27:13 +0100 Subject: Spotless --- .../common/itemBlocks/IB_LapotronicEnergyUnit.java | 8 +++---- .../GTMTE_LapotronicSuperCapacitor.java | 25 +++++++++++++++------- 2 files changed, 21 insertions(+), 12 deletions(-) diff --git a/src/main/java/common/itemBlocks/IB_LapotronicEnergyUnit.java b/src/main/java/common/itemBlocks/IB_LapotronicEnergyUnit.java index fecfce2bc9..8414b34006 100644 --- a/src/main/java/common/itemBlocks/IB_LapotronicEnergyUnit.java +++ b/src/main/java/common/itemBlocks/IB_LapotronicEnergyUnit.java @@ -49,7 +49,7 @@ public class IB_LapotronicEnergyUnit extends ItemBlock { // 1 Trillion EU/t private static BigInteger UEV_cap_eu_per_tick = - UEV_wireless_eu_cap.divide(BigInteger.valueOf(LSC_time_between_wireless_rebalance_in_ticks)); + UEV_wireless_eu_cap.divide(BigInteger.valueOf(LSC_time_between_wireless_rebalance_in_ticks)); public static long EV_cap_storage = 60_000_000L; public static long IV_cap_storage = 600_000_000L; @@ -96,10 +96,10 @@ public class IB_LapotronicEnergyUnit extends ItemBlock { break; case 8: lines.add("Capacity: " + EnumChatFormatting.RED + GT_Utility.formatNumbers(UEV_cap_storage) - + EnumChatFormatting.GRAY + "EU"); + + EnumChatFormatting.GRAY + "EU"); lines.add("Supports up to " + EnumChatFormatting.RED + GT_Utility.formatNumbers(UEV_cap_eu_per_tick) - + EnumChatFormatting.GRAY + "EU/t of wireless transfer per " + GT_Values.TIER_COLORS[10] - + GT_Values.VN[10] + EnumChatFormatting.GRAY + " capacitor."); + + EnumChatFormatting.GRAY + "EU/t of wireless transfer per " + GT_Values.TIER_COLORS[10] + + GT_Values.VN[10] + EnumChatFormatting.GRAY + " capacitor."); break; } } diff --git a/src/main/java/common/tileentities/GTMTE_LapotronicSuperCapacitor.java b/src/main/java/common/tileentities/GTMTE_LapotronicSuperCapacitor.java index cf261dec3d..9cb106be49 100644 --- a/src/main/java/common/tileentities/GTMTE_LapotronicSuperCapacitor.java +++ b/src/main/java/common/tileentities/GTMTE_LapotronicSuperCapacitor.java @@ -397,6 +397,7 @@ public class GTMTE_LapotronicSuperCapacitor private int getUHVCapacitorCount() { return capacitors[4]; } + private int getUEVCapacitorCount() { return capacitors[7]; } @@ -410,8 +411,9 @@ public class GTMTE_LapotronicSuperCapacitor + GT_Utility.formatNumbers(max_passive_drain_eu_per_tick_per_uhv_cap) + EnumChatFormatting.GRAY + " EU/t passive loss per " + GT_Values.TIER_COLORS[9] + GT_Values.VN[9] + EnumChatFormatting.GRAY + " capacitor and ") - .addInfo( EnumChatFormatting.RED + GT_Utility.formatNumbers(max_passive_drain_eu_per_tick_per_uev_cap) + EnumChatFormatting.GRAY + " EU/t passive loss per " - + GT_Values.TIER_COLORS[10] + GT_Values.VN[10] + EnumChatFormatting.GRAY + " capacitor.") + .addInfo(EnumChatFormatting.RED + GT_Utility.formatNumbers(max_passive_drain_eu_per_tick_per_uev_cap) + + EnumChatFormatting.GRAY + " EU/t passive loss per " + GT_Values.TIER_COLORS[10] + + GT_Values.VN[10] + EnumChatFormatting.GRAY + " capacitor.") .addInfo("Passive loss is multiplied by the number of maintenance issues present.") .addSeparator() .addInfo("Glass shell has to be Tier - 3 of the highest capacitor tier.") @@ -422,12 +424,17 @@ public class GTMTE_LapotronicSuperCapacitor .addSeparator() .addInfo("Wireless mode can be enabled by right clicking with a screwdriver.") .addInfo("This mode can only be enabled if you have a " + GT_Values.TIER_COLORS[9] + GT_Values.VN[9] - + EnumChatFormatting.GRAY + " or " + GT_Values.TIER_COLORS[10] + GT_Values.VN[10] + EnumChatFormatting.GRAY + " capacitor in the multiblock.") + + EnumChatFormatting.GRAY + " or " + GT_Values.TIER_COLORS[10] + GT_Values.VN[10] + + EnumChatFormatting.GRAY + " capacitor in the multiblock.") .addInfo("When enabled every " + EnumChatFormatting.BLUE + GT_Utility.formatNumbers(LSC_time_between_wireless_rebalance_in_ticks) + EnumChatFormatting.GRAY + " ticks the LSC will attempt to re-balance against your") .addInfo("wireless EU network. If there is less than " + GT_Values.TIER_COLORS[9] - + GT_Utility.formatNumbers(LSC_wireless_eu_cap) + EnumChatFormatting.GRAY + "(" + GT_Values.TIER_COLORS[10] + GT_Values.VN[9] + EnumChatFormatting.GRAY + ")" + " or " + GT_Values.TIER_COLORS[10] + GT_Utility.formatNumbers(UEV_wireless_eu_cap) + EnumChatFormatting.GRAY + "(" + GT_Values.TIER_COLORS[10] + GT_Values.VN[10] + EnumChatFormatting.GRAY + ")" + "EU in the LSC") + + GT_Utility.formatNumbers(LSC_wireless_eu_cap) + EnumChatFormatting.GRAY + "(" + + GT_Values.TIER_COLORS[10] + GT_Values.VN[9] + EnumChatFormatting.GRAY + ")" + " or " + + GT_Values.TIER_COLORS[10] + GT_Utility.formatNumbers(UEV_wireless_eu_cap) + + EnumChatFormatting.GRAY + "(" + GT_Values.TIER_COLORS[10] + GT_Values.VN[10] + + EnumChatFormatting.GRAY + ")" + "EU in the LSC") .addInfo("it will withdraw from the network and add to the LSC. If there is more it will add") .addInfo("the EU to the network and remove it from the LSC.") .addSeparator() @@ -705,7 +712,8 @@ public class GTMTE_LapotronicSuperCapacitor // Find difference. BigInteger transferred_eu = - stored.subtract((LSC_wireless_eu_cap.multiply(BigInteger.valueOf(getUHVCapacitorCount()))).add(UEV_wireless_eu_cap.multiply(BigInteger.valueOf(getUEVCapacitorCount())))); + stored.subtract((LSC_wireless_eu_cap.multiply(BigInteger.valueOf(getUHVCapacitorCount()))) + .add(UEV_wireless_eu_cap.multiply(BigInteger.valueOf(getUEVCapacitorCount())))); if (transferred_eu.signum() == 1) { inputLastTick += transferred_eu.longValue(); @@ -716,7 +724,8 @@ public class GTMTE_LapotronicSuperCapacitor // If that difference can be added then do so. if (addEUToGlobalEnergyMap(global_energy_user_uuid, transferred_eu)) { // If it succeeds there was sufficient energy so set the internal capacity as such. - stored = LSC_wireless_eu_cap.multiply(BigInteger.valueOf(getUHVCapacitorCount())).add(UEV_wireless_eu_cap.multiply(BigInteger.valueOf(getUEVCapacitorCount()))); + stored = LSC_wireless_eu_cap.multiply(BigInteger.valueOf(getUHVCapacitorCount())) + .add(UEV_wireless_eu_cap.multiply(BigInteger.valueOf(getUEVCapacitorCount()))); } } @@ -772,7 +781,7 @@ public class GTMTE_LapotronicSuperCapacitor min(temp_capacity_divided, max_passive_drain_eu_per_tick_per_uhv_cap * max(1, getUHVCapacitorCount())); long uev_cap_multiplier = - min(temp_capacity_divided, max_passive_drain_eu_per_tick_per_uev_cap * max(1, getUEVCapacitorCount())); + min(temp_capacity_divided, max_passive_drain_eu_per_tick_per_uev_cap * max(1, getUEVCapacitorCount())); // Passive loss is multiplied by number of maintenance issues. long total_passive_loss = (uhv_cap_multiplier + uev_cap_multiplier) * (getIdealStatus() - repairStatus + 1); @@ -955,7 +964,7 @@ public class GTMTE_LapotronicSuperCapacitor aPlayer, "Wireless mode cannot be enabled without at least 1 " + GT_Values.TIER_COLORS[9] + GT_Values.VN[9] + EnumChatFormatting.RESET + " or " + GT_Values.TIER_COLORS[10] + GT_Values.VN[10] - + EnumChatFormatting.RESET + " capacitor."); + + EnumChatFormatting.RESET + " capacitor."); wireless_mode = false; } } -- cgit From 20ef1212161d01560ed9e8ab41fba1dd59a3d6d8 Mon Sep 17 00:00:00 2001 From: GDCloud Date: Thu, 2 Feb 2023 21:40:38 +0100 Subject: Tooltips --- .../common/tileentities/GTMTE_LapotronicSuperCapacitor.java | 11 +++++++---- 1 file changed, 7 insertions(+), 4 deletions(-) diff --git a/src/main/java/common/tileentities/GTMTE_LapotronicSuperCapacitor.java b/src/main/java/common/tileentities/GTMTE_LapotronicSuperCapacitor.java index 9cb106be49..ef4aab8db4 100644 --- a/src/main/java/common/tileentities/GTMTE_LapotronicSuperCapacitor.java +++ b/src/main/java/common/tileentities/GTMTE_LapotronicSuperCapacitor.java @@ -429,12 +429,12 @@ public class GTMTE_LapotronicSuperCapacitor .addInfo("When enabled every " + EnumChatFormatting.BLUE + GT_Utility.formatNumbers(LSC_time_between_wireless_rebalance_in_ticks) + EnumChatFormatting.GRAY + " ticks the LSC will attempt to re-balance against your") - .addInfo("wireless EU network. If there is less than " + GT_Values.TIER_COLORS[9] + .addInfo("wireless EU network. If there is less than " + EnumChatFormatting.RED + GT_Utility.formatNumbers(LSC_wireless_eu_cap) + EnumChatFormatting.GRAY + "(" - + GT_Values.TIER_COLORS[10] + GT_Values.VN[9] + EnumChatFormatting.GRAY + ")" + " or " - + GT_Values.TIER_COLORS[10] + GT_Utility.formatNumbers(UEV_wireless_eu_cap) + + GT_Values.TIER_COLORS[9] + GT_Values.VN[9] + EnumChatFormatting.GRAY + ")" + " or " + + EnumChatFormatting.RED + GT_Utility.formatNumbers(UEV_wireless_eu_cap) + EnumChatFormatting.GRAY + "(" + GT_Values.TIER_COLORS[10] + GT_Values.VN[10] - + EnumChatFormatting.GRAY + ")" + "EU in the LSC") + + EnumChatFormatting.GRAY + ")" + " EU in the LSC") .addInfo("it will withdraw from the network and add to the LSC. If there is more it will add") .addInfo("the EU to the network and remove it from the LSC.") .addSeparator() @@ -446,6 +446,7 @@ public class GTMTE_LapotronicSuperCapacitor "Lapotronic Capacitor (" + GT_Values.TIER_COLORS[4] + GT_Values.VN[4] + EnumChatFormatting.GRAY + "-" + GT_Values.TIER_COLORS[8] + GT_Values.VN[8] + EnumChatFormatting.GRAY + "), Ultimate Capacitor (" + GT_Values.TIER_COLORS[9] + GT_Values.VN[9] + + EnumChatFormatting.GRAY + "-" + GT_Values.TIER_COLORS[9] + GT_Values.VN[9] + EnumChatFormatting.GRAY + ")", "Center 3x(1-47)x3 above base (9-423 blocks)") .addStructureInfo( @@ -854,6 +855,8 @@ public class GTMTE_LapotronicSuperCapacitor : EnumChatFormatting.RED + "disabled" + EnumChatFormatting.RESET)); ll.add(GT_Values.TIER_COLORS[9] + GT_Values.VN[9] + EnumChatFormatting.RESET + " Capacitors detected: " + getUHVCapacitorCount()); + ll.add(GT_Values.TIER_COLORS[10] + GT_Values.VN[10] + EnumChatFormatting.RESET + " Capacitors detected: " + + getUEVCapacitorCount()); ll.add("Total wireless EU: " + EnumChatFormatting.RED + GT_Utility.formatNumbers(getUserEU(global_energy_user_uuid))); ll.add("---------------------------------------------"); -- cgit From b9f8b3ae072c2b50b38abbc12a0b3417124db005 Mon Sep 17 00:00:00 2001 From: GDCloud Date: Fri, 3 Feb 2023 00:07:51 +0100 Subject: new texture --- .../textures/blocks/ReallyUltimateEnergyUnit_side.png | Bin 200 -> 488 bytes .../textures/blocks/ReallyUltimateEnergyUnit_top.png | Bin 190 -> 227 bytes 2 files changed, 0 insertions(+), 0 deletions(-) diff --git a/src/main/resources/assets/kekztech/textures/blocks/ReallyUltimateEnergyUnit_side.png b/src/main/resources/assets/kekztech/textures/blocks/ReallyUltimateEnergyUnit_side.png index d2e362dba9..ae861e1d8a 100644 Binary files a/src/main/resources/assets/kekztech/textures/blocks/ReallyUltimateEnergyUnit_side.png and b/src/main/resources/assets/kekztech/textures/blocks/ReallyUltimateEnergyUnit_side.png differ diff --git a/src/main/resources/assets/kekztech/textures/blocks/ReallyUltimateEnergyUnit_top.png b/src/main/resources/assets/kekztech/textures/blocks/ReallyUltimateEnergyUnit_top.png index def607dde8..61ecab2e40 100644 Binary files a/src/main/resources/assets/kekztech/textures/blocks/ReallyUltimateEnergyUnit_top.png and b/src/main/resources/assets/kekztech/textures/blocks/ReallyUltimateEnergyUnit_top.png differ -- cgit From d5f9b910087e76530e787bebbe3ffcebc0cc8417 Mon Sep 17 00:00:00 2001 From: GDCloud Date: Fri, 3 Feb 2023 00:08:02 +0100 Subject: fixes --- .../GTMTE_LapotronicSuperCapacitor.java | 22 +++++++++++----------- 1 file changed, 11 insertions(+), 11 deletions(-) diff --git a/src/main/java/common/tileentities/GTMTE_LapotronicSuperCapacitor.java b/src/main/java/common/tileentities/GTMTE_LapotronicSuperCapacitor.java index ef4aab8db4..bd7788b768 100644 --- a/src/main/java/common/tileentities/GTMTE_LapotronicSuperCapacitor.java +++ b/src/main/java/common/tileentities/GTMTE_LapotronicSuperCapacitor.java @@ -5,7 +5,6 @@ import static common.itemBlocks.IB_LapotronicEnergyUnit.*; import static gregtech.api.enums.GT_HatchElement.Maintenance; import static gregtech.api.util.GT_StructureUtility.buildHatchAdder; import static gregtech.api.util.GT_StructureUtility.filterByMTEClass; -import static java.lang.Math.max; import static java.lang.Math.min; import com.github.bartimaeusnek.bartworks.API.BorosilicateGlass; @@ -78,9 +77,10 @@ public class GTMTE_LapotronicSuperCapacitor ZPM(4, BigInteger.valueOf(ZPM_cap_storage)), UV(5, BigInteger.valueOf(UV_cap_storage)), UHV(6, MAX_LONG), - UEV(7, MAX_LONG), None(0, BigInteger.ZERO), - EV(1, BigInteger.valueOf(EV_cap_storage)); + EV(1, BigInteger.valueOf(EV_cap_storage)), + UEV(7, MAX_LONG), + ; private final int minimalGlassTier; private final BigInteger providedCapacity; @@ -429,7 +429,8 @@ public class GTMTE_LapotronicSuperCapacitor .addInfo("When enabled every " + EnumChatFormatting.BLUE + GT_Utility.formatNumbers(LSC_time_between_wireless_rebalance_in_ticks) + EnumChatFormatting.GRAY + " ticks the LSC will attempt to re-balance against your") - .addInfo("wireless EU network. If there is less than " + EnumChatFormatting.RED + .addInfo("wireless EU network.") + .addInfo("If there is less than " + EnumChatFormatting.RED + GT_Utility.formatNumbers(LSC_wireless_eu_cap) + EnumChatFormatting.GRAY + "(" + GT_Values.TIER_COLORS[9] + GT_Values.VN[9] + EnumChatFormatting.GRAY + ")" + " or " + EnumChatFormatting.RED + GT_Utility.formatNumbers(UEV_wireless_eu_cap) @@ -446,7 +447,7 @@ public class GTMTE_LapotronicSuperCapacitor "Lapotronic Capacitor (" + GT_Values.TIER_COLORS[4] + GT_Values.VN[4] + EnumChatFormatting.GRAY + "-" + GT_Values.TIER_COLORS[8] + GT_Values.VN[8] + EnumChatFormatting.GRAY + "), Ultimate Capacitor (" + GT_Values.TIER_COLORS[9] + GT_Values.VN[9] - + EnumChatFormatting.GRAY + "-" + GT_Values.TIER_COLORS[9] + GT_Values.VN[9] + + EnumChatFormatting.GRAY + "-" + GT_Values.TIER_COLORS[10] + GT_Values.VN[10] + EnumChatFormatting.GRAY + ")", "Center 3x(1-47)x3 above base (9-423 blocks)") .addStructureInfo( @@ -778,14 +779,13 @@ public class GTMTE_LapotronicSuperCapacitor // Passive loss is multiplied by number of UHV/UEV caps. Minimum of 1 otherwise loss is 0 for non-UHV/UEV caps // calculations. - long uhv_cap_multiplier = - min(temp_capacity_divided, max_passive_drain_eu_per_tick_per_uhv_cap * max(1, getUHVCapacitorCount())); - - long uev_cap_multiplier = - min(temp_capacity_divided, max_passive_drain_eu_per_tick_per_uev_cap * max(1, getUEVCapacitorCount())); + if (getUHVCapacitorCount() != 0 || getUEVCapacitorCount() != 0) { + temp_capacity_divided = getUHVCapacitorCount() * max_passive_drain_eu_per_tick_per_uhv_cap + + getUEVCapacitorCount() * max_passive_drain_eu_per_tick_per_uev_cap; + } // Passive loss is multiplied by number of maintenance issues. - long total_passive_loss = (uhv_cap_multiplier + uev_cap_multiplier) * (getIdealStatus() - repairStatus + 1); + long total_passive_loss = temp_capacity_divided * (getIdealStatus() - repairStatus + 1); // Maximum of 100,000 EU/t drained per UHV cell. The logic is 1% of EU capacity should be drained every 86400 // seconds (1 day). -- cgit From 46a2307cb41647565f2534b44f2c2ba28ab94431 Mon Sep 17 00:00:00 2001 From: GDCloud Date: Fri, 3 Feb 2023 22:59:50 +0100 Subject: bump dep --- dependencies.gradle | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/dependencies.gradle b/dependencies.gradle index 511a159cfa..cfdbc2fed8 100644 --- a/dependencies.gradle +++ b/dependencies.gradle @@ -1,7 +1,7 @@ // Add your dependencies here dependencies { - compile 'com.github.GTNewHorizons:GT5-Unofficial:5.09.41.158:dev' + compile 'com.github.GTNewHorizons:GT5-Unofficial:5.09.41.266:dev' compile 'com.github.GTNewHorizons:TecTech:5.0.52:dev' compile 'com.github.GTNewHorizons:bartworks:0.5.119:dev' compile 'com.github.GTNewHorizons:StructureLib:1.1.12:dev' -- cgit From e6476eeac14391e6f9b1bdeb2e9cbf5236784434 Mon Sep 17 00:00:00 2001 From: GDCloud Date: Fri, 3 Feb 2023 23:00:14 +0100 Subject: recipes --- src/main/java/common/Recipes.java | 53 +++++++++++++++++++++++++++++++++++++++ 1 file changed, 53 insertions(+) diff --git a/src/main/java/common/Recipes.java b/src/main/java/common/Recipes.java index 19977d37c3..8e396b74a1 100644 --- a/src/main/java/common/Recipes.java +++ b/src/main/java/common/Recipes.java @@ -924,6 +924,53 @@ public class Recipes { 6400, BW_Util.getMachineVoltageFromTier(8)); + // Extremely Ultimate Capacitor (UEV) + TT_recipeAdder.addResearchableAssemblylineRecipe( + new ItemStack(Blocks.lscLapotronicEnergyUnit, 1, 5), + 1200000, + 128, + 8000000, + 16, + new Object[] { + GT_OreDictUnificator.get(OrePrefixes.frameGt, Materials.Infinity, 4), + GT_OreDictUnificator.get(OrePrefixes.screw, Materials.Infinity, 24), + GT_OreDictUnificator.get(OrePrefixes.plateDouble, Materials.InfinityCatalyst, 32L), + GT_OreDictUnificator.get(OrePrefixes.plateDouble, Materials.InfinityCatalyst, 32L), + new Object[] {OrePrefixes.circuit.get(Materials.Optical), 1}, + new Object[] {OrePrefixes.circuit.get(Materials.Optical), 1}, + new Object[] {OrePrefixes.circuit.get(Materials.Optical), 1}, + new Object[] {OrePrefixes.circuit.get(Materials.Optical), 1}, + ItemList.ZPM3.get(8L), + ItemList.Field_Generator_UEV.get(4), + ItemList.Circuit_Wafer_PPIC.get(64), + ItemList.Circuit_Wafer_PPIC.get(64), + ItemList.Circuit_Wafer_SoC2.get(64), + ItemList.Circuit_Parts_DiodeXSMD.get(64), + GT_OreDictUnificator.get(OrePrefixes.wireGt04, Materials.SuperconductorUEV, 64) + }, + new FluidStack[] { + new FluidStack(solderUEV, 9216), + Materials.Quantium.getMolten(18432), + Materials.Naquadria.getMolten(18432), + Materials.SuperCoolant.getFluid(64000) + }, + new ItemStack(Blocks.lscLapotronicEnergyUnit, 1, 8), + 250 * 20, + 6_400_000); + + // UEV Capacitor alt recipe + GT_Values.RA.addAssemblerRecipe( + new ItemStack[] { + ItemList.ZPM4.get(1), + GT_OreDictUnificator.get(OrePrefixes.frameGt, Materials.Infinity, 4), + GT_OreDictUnificator.get(OrePrefixes.screw, Materials.Infinity, 24), + GT_Utility.getIntegratedCircuit(6) + }, + null, + new ItemStack(Blocks.lscLapotronicEnergyUnit, 1, 8), + 640 * 20, + BW_Util.getMachineVoltageFromTier(9)); + // Capacitor recycling GT_Values.RA.addUnboxingRecipe( new ItemStack(Blocks.lscLapotronicEnergyUnit, 1, 7), @@ -961,6 +1008,12 @@ public class Recipes { GT_OreDictUnificator.get(OrePrefixes.screw, Materials.CosmicNeutronium, 24), 1200, 32); + GT_Values.RA.addUnboxingRecipe( + new ItemStack(Blocks.lscLapotronicEnergyUnit, 1, 8), + ItemList.ZPM4.get(1L), + GT_OreDictUnificator.get(OrePrefixes.screw, Materials.Infinity, 24), + 1200, + 32); } /*private static void registerRecipes_SpaceElevator() { -- cgit From eab1afe11ddd894fef8ba618deda9926e09edab7 Mon Sep 17 00:00:00 2001 From: GDCloud Date: Sun, 5 Feb 2023 00:11:56 +0100 Subject: name fix --- src/main/resources/assets/kekztech/lang/en_US.lang | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/main/resources/assets/kekztech/lang/en_US.lang b/src/main/resources/assets/kekztech/lang/en_US.lang index 54ed1f6870..bd7639fb73 100644 --- a/src/main/resources/assets/kekztech/lang/en_US.lang +++ b/src/main/resources/assets/kekztech/lang/en_US.lang @@ -143,7 +143,7 @@ tile.kekztech_lapotronicenergyunit_block.4.name=Lapotronic Capacitor (UV) tile.kekztech_lapotronicenergyunit_block.5.name=Ultimate Capacitor (UHV) tile.kekztech_lapotronicenergyunit_block.6.name=Empty Capacitor (-) tile.kekztech_lapotronicenergyunit_block.7.name=Lapotron Capacitor (EV) -tile.kekztech_lapotronicenergyunit_block.8.name=Ultimate Extreme Capacitor (UEV) +tile.kekztech_lapotronicenergyunit_block.8.name=Extremely Ultimate Capacitor (UEV) tile.kekztech_lapotronicenergyunit_block.desc=Part of the Lapotronic Super Capacitor # -------- Thaumium Reinforced Jar: Block -- cgit From 71278e8c7889aecb092468dc3d0fb1350aaef77d Mon Sep 17 00:00:00 2001 From: GDCloud Date: Sun, 5 Feb 2023 04:27:24 +0100 Subject: buildscript fix (praying it works) --- build.gradle | 840 ++++++++++++++++++------------- dependencies.gradle | 2 +- gradle/wrapper/gradle-wrapper.properties | 3 +- settings.gradle | 18 + 4 files changed, 512 insertions(+), 351 deletions(-) diff --git a/build.gradle b/build.gradle index 2dc32c9f20..447de38414 100644 --- a/build.gradle +++ b/build.gradle @@ -1,4 +1,4 @@ -//version: 1673027205 +//version: 1675268365 /* DO NOT CHANGE THIS FILE! Also, you may replace this file at any time if there is an update available. @@ -6,24 +6,27 @@ */ +import com.diffplug.blowdryer.Blowdryer import com.github.jengelman.gradle.plugins.shadow.tasks.ConfigureShadowRelocation import com.github.jengelman.gradle.plugins.shadow.tasks.ShadowJar +import com.gtnewhorizons.retrofuturagradle.mcp.ReobfuscatedJar import com.matthewprenger.cursegradle.CurseArtifact import com.matthewprenger.cursegradle.CurseRelation import com.modrinth.minotaur.dependencies.ModDependency import com.modrinth.minotaur.dependencies.VersionDependency import org.gradle.internal.logging.text.StyledTextOutput.Style import org.gradle.internal.logging.text.StyledTextOutputFactory +import org.jetbrains.gradle.ext.* import java.nio.file.Files import java.nio.file.Paths import java.util.concurrent.TimeUnit import java.util.zip.ZipEntry -import java.util.zip.ZipInputStream import java.util.zip.ZipOutputStream buildscript { repositories { + mavenLocal() mavenCentral() maven { @@ -31,9 +34,10 @@ buildscript { url 'https://maven.minecraftforge.net' } maven { - // GTNH ForgeGradle and ASM Fork - name = "GTNH Maven" - url = "http://jenkins.usrv.eu:8081/nexus/content/groups/public/" + // GTNH RetroFuturaGradle and ASM Fork + name "GTNH Maven" + url "http://jenkins.usrv.eu:8081/nexus/content/groups/public/" + allowInsecureProtocol = true } maven { name 'sonatype' @@ -44,76 +48,41 @@ buildscript { url 'https://repo1.maven.org/maven2/' } } - dependencies { - //Overwrite the current ASM version to fix shading newer than java 8 applicatations. - classpath 'org.ow2.asm:asm-debug-all-custom:5.0.3' - classpath 'net.minecraftforge.gradle:ForgeGradle:1.2.13' - } } plugins { id 'java-library' - id 'idea' + id "org.jetbrains.gradle.plugin.idea-ext" version "1.1.7" id 'eclipse' id 'scala' id 'maven-publish' - id 'org.jetbrains.kotlin.jvm' version '1.5.30' apply false - id 'org.jetbrains.kotlin.kapt' version '1.5.30' apply false - id 'com.google.devtools.ksp' version '1.5.30-1.0.0' apply false - id 'org.ajoberstar.grgit' version '4.1.1' - id 'com.github.johnrengelman.shadow' version '4.0.4' - id 'com.palantir.git-version' version '0.13.0' apply false - id 'de.undercouch.download' version '5.0.1' - id 'com.github.gmazzo.buildconfig' version '3.0.3' apply false + id 'org.jetbrains.kotlin.jvm' version '1.8.0' apply false + id 'org.jetbrains.kotlin.kapt' version '1.8.0' apply false + id 'com.google.devtools.ksp' version '1.8.0-1.0.9' apply false + id 'org.ajoberstar.grgit' version '4.1.1' // 4.1.1 is the last jvm8 supporting version ,unused, available for addon.gradle + id 'com.github.johnrengelman.shadow' version '7.1.2' apply false + id 'com.palantir.git-version' version '0.13.0' apply false // 0.13.0 is the last jvm8 supporting version + id 'de.undercouch.download' version '5.3.0' + id 'com.github.gmazzo.buildconfig' version '3.1.0' apply false // Unused, available for addon.gradle id 'com.diffplug.spotless' version '6.7.2' apply false id 'com.modrinth.minotaur' version '2.+' apply false id 'com.matthewprenger.cursegradle' version '1.4.0' apply false + id 'com.gtnewhorizons.retrofuturagradle' version '1.1.4' } boolean settingsupdated = verifySettingsGradle() settingsupdated = verifyGitAttributes() || settingsupdated if (settingsupdated) throw new GradleException("Settings has been updated, please re-run task.") -dependencies { - implementation 'com.diffplug:blowdryer:1.6.0' -} - -apply plugin: 'com.diffplug.blowdryer' - if (project.file('.git/HEAD').isFile()) { apply plugin: 'com.palantir.git-version' } def out = services.get(StyledTextOutputFactory).create('an-output') -apply plugin: 'forge' - def projectJavaVersion = JavaLanguageVersion.of(8) -java { - toolchain { - languageVersion.set(projectJavaVersion) - } -} - -idea { - module { - inheritOutputDirs = true - downloadJavadoc = true - downloadSources = true - } -} - boolean disableSpotless = project.hasProperty("disableSpotless") ? project.disableSpotless.toBoolean() : false -if (!disableSpotless) { - apply plugin: 'com.diffplug.spotless' - apply from: Blowdryer.file('spotless.gradle') -} - -if (JavaVersion.current() != JavaVersion.VERSION_1_8) { - throw new GradleException("This project requires Java 8, but it's running on " + JavaVersion.current()) -} - checkPropertyExists("modName") checkPropertyExists("modId") checkPropertyExists("modGroup") @@ -121,10 +90,7 @@ checkPropertyExists("autoUpdateBuildScript") checkPropertyExists("minecraftVersion") checkPropertyExists("forgeVersion") checkPropertyExists("replaceGradleTokenInFile") -checkPropertyExists("gradleTokenModId") -checkPropertyExists("gradleTokenModName") checkPropertyExists("gradleTokenVersion") -checkPropertyExists("gradleTokenGroupName") checkPropertyExists("apiPackage") checkPropertyExists("accessTransformersFile") checkPropertyExists("usesMixins") @@ -135,6 +101,8 @@ checkPropertyExists("containsMixinsAndOrCoreModOnly") checkPropertyExists("usesShadowedDependencies") checkPropertyExists("developmentEnvironmentUserName") +propertyDefaultIfUnset("generateGradleTokenClass", "") +propertyDefaultIfUnset("includeWellKnownRepositories", true) propertyDefaultIfUnset("noPublishedSources", false) propertyDefaultIfUnset("usesMixinDebug", project.usesMixins) propertyDefaultIfUnset("forceEnableMixins", false) @@ -144,14 +112,110 @@ propertyDefaultIfUnset("modrinthProjectId", "") propertyDefaultIfUnset("modrinthRelations", "") propertyDefaultIfUnset("curseForgeProjectId", "") propertyDefaultIfUnset("curseForgeRelations", "") +propertyDefaultIfUnset("minimizeShadowedDependencies", true) +propertyDefaultIfUnset("relocateShadowedDependencies", true) +// Deprecated properties (kept for backwards compat) +propertyDefaultIfUnset("gradleTokenModId", "") +propertyDefaultIfUnset("gradleTokenModName", "") +propertyDefaultIfUnset("gradleTokenGroupName", "") + +propertyDefaultIfUnset("enableModernJavaSyntax", false) // On by default for new projects only +propertyDefaultIfUnset("enableGenericInjection", false) // On by default for new projects only + +project.extensions.add(Blowdryer, "Blowdryer", Blowdryer) // Make blowdryer available in "apply from:" scripts +if (!disableSpotless) { + apply plugin: 'com.diffplug.spotless' + apply from: Blowdryer.file('spotless.gradle') +} String javaSourceDir = "src/main/java/" String scalaSourceDir = "src/main/scala/" String kotlinSourceDir = "src/main/kotlin/" +if (usesShadowedDependencies.toBoolean()) { + apply plugin: "com.github.johnrengelman.shadow" +} + +java { + toolchain { + if (enableModernJavaSyntax.toBoolean()) { + languageVersion.set(JavaLanguageVersion.of(17)) + } else { + languageVersion.set(projectJavaVersion) + } + vendor.set(JvmVendorSpec.ADOPTIUM) + } + if (!noPublishedSources) { + withSourcesJar() + } +} + +pluginManager.withPlugin('org.jetbrains.kotlin.jvm') { + // If Kotlin is enabled in the project + kotlin { + jvmToolchain(8) + } + // Kotlin hacks our source sets, so we hack Kotlin's tasks + def disabledKotlinTaskList = [ + "kaptGenerateStubsMcLauncherKotlin", + "kaptGenerateStubsPatchedMcKotlin", + "kaptGenerateStubsInjectedTagsKotlin", + "compileMcLauncherKotlin", + "compilePatchedMcKotlin", + "compileInjectedTagsKotlin", + "kaptMcLauncherKotlin", + "kaptPatchedMcKotlin", + "kaptInjectedTagsKotlin", + "kspMcLauncherKotlin", + "kspPatchedMcKotlin", + "kspInjectedTagsKotlin", + ] + tasks.configureEach { task -> + if (task.name in disabledKotlinTaskList) { + task.enabled = false + } + } +} + +configurations { + create("runtimeOnlyNonPublishable") { + description = "Runtime only dependencies that are not published alongside the jar" + canBeConsumed = false + canBeResolved = false + } +} -final String modGroupPath = modGroup.toString().replaceAll("\\.", "/") -final String apiPackagePath = apiPackage.toString().replaceAll("\\.", "/") +if (enableModernJavaSyntax.toBoolean()) { + dependencies { + annotationProcessor 'com.github.bsideup.jabel:jabel-javac-plugin:1.0.0' + compileOnly('com.github.bsideup.jabel:jabel-javac-plugin:1.0.0') { + transitive = false // We only care about the 1 annotation class + } + } + + tasks.withType(JavaCompile).configureEach { + if (it.name in ["compileMcLauncherJava", "compilePatchedMcJava"]) { + return + } + sourceCompatibility = 17 // for the IDE support + options.release.set(8) + + javaCompiler.set(javaToolchains.compilerFor { + languageVersion.set(JavaLanguageVersion.of(17)) + vendor.set(JvmVendorSpec.ADOPTIUM) + }) + } +} + +eclipse { + classpath { + downloadSources = true + downloadJavadoc = true + } +} + +final String modGroupPath = modGroup.toString().replace('.' as char, '/' as char) +final String apiPackagePath = apiPackage.toString().replace('.' as char, '/' as char) String targetPackageJava = javaSourceDir + modGroupPath String targetPackageScala = scalaSourceDir + modGroupPath @@ -174,6 +238,27 @@ if (accessTransformersFile) { if (!getFile(targetFile).exists()) { throw new GradleException("Could not resolve \"accessTransformersFile\"! Could not find " + targetFile) } + tasks.deobfuscateMergedJarToSrg.accessTransformerFiles.from(targetFile) + tasks.srgifyBinpatchedJar.accessTransformerFiles.from(targetFile) +} else { + boolean atsFound = false + for (File at : sourceSets.getByName("main").resources.files) { + if (at.name.toLowerCase().endsWith("_at.cfg")) { + atsFound = true + tasks.deobfuscateMergedJarToSrg.accessTransformerFiles.from(at) + tasks.srgifyBinpatchedJar.accessTransformerFiles.from(at) + } + } + for (File at : sourceSets.getByName("api").resources.files) { + if (at.name.toLowerCase().endsWith("_at.cfg")) { + atsFound = true + tasks.deobfuscateMergedJarToSrg.accessTransformerFiles.from(at) + tasks.srgifyBinpatchedJar.accessTransformerFiles.from(at) + } + } + if (atsFound) { + logger.warn("Found and added access transformers in the resources folder, please configure gradle.properties to explicitly mention them by name") + } } if (usesMixins.toBoolean()) { @@ -212,7 +297,7 @@ if (coreModClass) { } } -configurations.all { +configurations.configureEach { resolutionStrategy.cacheChangingModulesFor(0, TimeUnit.SECONDS) // Make sure GregTech build won't time out @@ -243,7 +328,7 @@ catch (Exception ignored) { versionOverride = 'NO-GIT-TAG-SET' identifiedVersion = versionOverride } -version = minecraftVersion + '-' + identifiedVersion +version = identifiedVersion ext { modVersion = identifiedVersion } @@ -252,63 +337,79 @@ if (identifiedVersion == versionOverride) { out.style(Style.Failure).text('Override version to ').style(Style.Identifier).text(modVersion).style(Style.Failure).println('!\7') } -group = modGroup +group = "com.github.GTNewHorizons" if (project.hasProperty("customArchiveBaseName") && customArchiveBaseName) { archivesBaseName = customArchiveBaseName } else { archivesBaseName = modId } -def arguments = [] -def jvmArguments = [] - -if (usesMixins.toBoolean() || forceEnableMixins.toBoolean()) { - arguments += [ - "--tweakClass org.spongepowered.asm.launch.MixinTweaker" - ] - if (usesMixinDebug.toBoolean()) { - jvmArguments += [ - "-Dmixin.debug.countInjections=true", - "-Dmixin.debug.verbose=true", - "-Dmixin.debug.export=true" - ] - } -} minecraft { - version = minecraftVersion + '-' + forgeVersion + '-' + minecraftVersion - runDir = 'run' - if (replaceGradleTokenInFile) { for (f in replaceGradleTokenInFile.split(',')) { - replaceIn f - } - if (gradleTokenModId) { - replace gradleTokenModId, modId - } - if (gradleTokenModName) { - replace gradleTokenModName, modName + tagReplacementFiles.add f } - if (gradleTokenVersion) { - replace gradleTokenVersion, modVersion - } - if (gradleTokenGroupName) { - replace gradleTokenGroupName, modGroup + } + if (gradleTokenModId) { + injectedTags.put gradleTokenModId, modId + } + if (gradleTokenModName) { + injectedTags.put gradleTokenModName, modName + } + if (gradleTokenVersion) { + injectedTags.put gradleTokenVersion, modVersion + } + if (gradleTokenGroupName) { + injectedTags.put gradleTokenGroupName, modGroup + } + if (enableGenericInjection.toBoolean()) { + injectMissingGenerics.set(true) + } + + // Enable assertions in the current mod + extraRunJvmArguments.add("-ea:${modGroup}") + + if (usesMixins.toBoolean() || forceEnableMixins.toBoolean()) { + extraTweakClasses.add("org.spongepowered.asm.launch.MixinTweaker") + + if (usesMixinDebug.toBoolean()) { + extraRunJvmArguments.addAll([ + "-Dmixin.debug.countInjections=true", + "-Dmixin.debug.verbose=true", + "-Dmixin.debug.export=true" + ]) } } - clientIntellijRun { - args(arguments) - jvmArgs(jvmArguments) + // Blowdryer is present in some old mod builds, do not propagate it further as a dependency + // IC2 has no reobf jars in its Maven + groupsToExcludeFromAutoReobfMapping.addAll(["com.diffplug", "com.diffplug.durian", "net.industrial-craft"]) +} + +if (generateGradleTokenClass) { + tasks.injectTags.outputClassName.set(generateGradleTokenClass) +} - if (developmentEnvironmentUserName) { - args("--username", developmentEnvironmentUserName) +// Custom reobf auto-mappings +configurations.configureEach { + dependencies.configureEach { dep -> + if (dep instanceof org.gradle.api.artifacts.ExternalModuleDependency) { + if (dep.group == "net.industrial-craft" && dep.name == "industrialcraft-2") { + // https://www.curseforge.com/minecraft/mc-mods/industrial-craft/files/2353971 + project.dependencies.reobfJarConfiguration("curse.maven:ic2-242638:2353971") + } } } +} - serverIntellijRun { - args(arguments) - jvmArgs(jvmArguments) +// Ensure tests have access to minecraft classes +sourceSets { + test { + java { + compileClasspath += sourceSets.patchedMc.output + sourceSets.mcLauncher.output + runtimeClasspath += sourceSets.patchedMc.output + sourceSets.mcLauncher.output + } } } @@ -316,15 +417,49 @@ if (file('addon.gradle').exists()) { apply from: 'addon.gradle' } +// Allow unsafe repos but warn +repositories.configureEach { repo -> + if (repo instanceof org.gradle.api.artifacts.repositories.UrlArtifactRepository) { + if (repo.getUrl() != null && repo.getUrl().getScheme() == "http" && !repo.allowInsecureProtocol) { + logger.warn("Deprecated: Allowing insecure connections for repo '${repo.name}' - add 'allowInsecureProtocol = true'") + repo.allowInsecureProtocol = true + } + } +} + apply from: 'repositories.gradle' configurations { - // TODO: remove Compile after all uses are refactored to Implementation - for (config in [shadowImplementation, shadowCompile, shadeCompile]) { - compileClasspath.extendsFrom(config) - runtimeClasspath.extendsFrom(config) - testCompileClasspath.extendsFrom(config) - testRuntimeClasspath.extendsFrom(config) + for (config in [compileClasspath, runtimeClasspath, testCompileClasspath, testRuntimeClasspath]) { + config.extendsFrom(runtimeOnlyNonPublishable) + if (usesShadowedDependencies.toBoolean()) { + config.extendsFrom(shadowImplementation) + // TODO: remove Compile after all uses are refactored to Implementation + config.extendsFrom(shadeCompile) + config.extendsFrom(shadowCompile) + } + } + // A "bag-of-dependencies"-style configuration for backwards compatibility, gets put in "api" + create("compile") { + description = "Deprecated: use api or implementation instead, gets put in api" + canBeConsumed = false + canBeResolved = false + visible = false + } + create("testCompile") { + description = "Deprecated: use testImplementation instead" + canBeConsumed = false + canBeResolved = false + visible = false + } + api.extendsFrom(compile) + testImplementation.extendsFrom(testCompile) +} + +afterEvaluate { + if (!configurations.compile.allDependencies.empty || !configurations.testCompile.allDependencies.empty) { + logger.warn("This project uses deprecated `compile` dependencies, please migrate to using `api` and `implementation`") + logger.warn("For more details, see https://github.com/GTNewHorizons/ExampleMod1.7.10/blob/master/dependencies.gradle") } } @@ -332,12 +467,16 @@ repositories { maven { name 'Overmind forge repo mirror' url 'https://gregtech.overminddl1.com/' + mavenContent { + excludeGroup("net.minecraftforge") // missing the `universal` artefact + } + } + maven { + name = "GTNH Maven" + url = "http://jenkins.usrv.eu:8081/nexus/content/groups/public/" + allowInsecureProtocol = true } if (usesMixins.toBoolean() || forceEnableMixins.toBoolean()) { - maven { - name = "GTNH Maven" - url = "http://jenkins.usrv.eu:8081/nexus/content/groups/public/" - } if (usesMixinDebug.toBoolean()) { maven { name = "Fabric Maven" @@ -345,6 +484,35 @@ repositories { } } } + if (includeWellKnownRepositories.toBoolean()) { + maven { + name "CurseMaven" + url "https://cursemaven.com" + content { + includeGroup "curse.maven" + } + } + maven { + name = "ic2" + url = "https://maven.ic2.player.to/" + metadataSources { + mavenPom() + artifact() + } + } + maven { + name = "ic2-mirror" + url = "https://maven2.ic2.player.to/" + metadataSources { + mavenPom() + artifact() + } + } + maven { + name "MMD Maven" + url "https://maven.mcmoddev.com/" + } + } } dependencies { @@ -352,31 +520,42 @@ dependencies { annotationProcessor('org.ow2.asm:asm-debug-all:5.0.3') annotationProcessor('com.google.guava:guava:24.1.1-jre') annotationProcessor('com.google.code.gson:gson:2.8.6') - annotationProcessor('com.gtnewhorizon:gtnhmixins:2.1.3:processor') + annotationProcessor('com.gtnewhorizon:gtnhmixins:2.1.10:processor') if (usesMixinDebug.toBoolean()) { - runtimeClasspath('org.jetbrains:intellij-fernflower:1.2.1.16') - testRuntimeClasspath('org.jetbrains:intellij-fernflower:1.2.1.16') + runtimeOnlyNonPublishable('org.jetbrains:intellij-fernflower:1.2.1.16') } } if (usesMixins.toBoolean() || forceEnableMixins.toBoolean()) { - compile('com.gtnewhorizon:gtnhmixins:2.1.3') + implementation('com.gtnewhorizon:gtnhmixins:2.1.10') + } +} + +pluginManager.withPlugin('org.jetbrains.kotlin.kapt') { + if (usesMixins.toBoolean()) { + dependencies { + kapt('com.gtnewhorizon:gtnhmixins:2.1.10:processor') + } } } apply from: 'dependencies.gradle' def mixingConfigRefMap = 'mixins.' + modId + '.refmap.json' -def refMap = "${tasks.compileJava.temporaryDir}" + File.separator + mixingConfigRefMap -def mixinSrg = "${tasks.reobf.temporaryDir}" + File.separator + "mixins.srg" - -task generateAssets { - if (usesMixins.toBoolean()) { +def mixinTmpDir = buildDir.path + File.separator + 'tmp' + File.separator + 'mixins' +def refMap = "${mixinTmpDir}" + File.separator + mixingConfigRefMap +def mixinSrg = "${mixinTmpDir}" + File.separator + "mixins.srg" + +tasks.register('generateAssets') { + group = "GTNH Buildscript" + description = "Generates a mixin config file at /src/main/resources/mixins.modid.json if needed" + onlyIf { usesMixins.toBoolean() } + doLast { def mixinConfigFile = getFile("/src/main/resources/mixins." + modId + ".json") if (!mixinConfigFile.exists()) { def mixinPluginLine = "" - if(!mixinPlugin.isEmpty()) { + if (!mixinPlugin.isEmpty()) { // We might not have a mixin plugin if we're using early/late mixins - mixinPluginLine += """\n "plugin": "${modGroup}.${mixinPlugin}", """ + mixinPluginLine += """\n "plugin": "${modGroup}.${mixinPlugin}", """ } mixinConfigFile.text = """{ @@ -395,105 +574,58 @@ task generateAssets { } } -task relocateShadowJar(type: ConfigureShadowRelocation) { - target = tasks.shadowJar - prefix = modGroup + ".shadow" -} - -shadowJar { - project.configurations.shadeCompile.each { dep -> - from(project.zipTree(dep)) { - exclude 'META-INF', 'META-INF/**' - } +if (usesMixins.toBoolean()) { + tasks.named("reobfJar", ReobfuscatedJar).configure { + extraSrgFiles.from(mixinSrg) } - manifest { - attributes(getManifestAttributes()) + tasks.named("processResources").configure { + dependsOn("generateAssets") } - minimize() // This will only allow shading for actually used classes - configurations = [ - project.configurations.shadowImplementation, - project.configurations.shadowCompile - ] - dependsOn(relocateShadowJar) -} - -jar { - project.configurations.shadeCompile.each { dep -> - from(project.zipTree(dep)) { - exclude 'META-INF', 'META-INF/**' + tasks.named("compileJava", JavaCompile).configure { + doFirst { + new File(mixinTmpDir).mkdirs() } + options.compilerArgs += [ + "-AreobfSrgFile=${tasks.reobfJar.srg.get().asFile}", + "-AoutSrgFile=${mixinSrg}", + "-AoutRefMapFile=${refMap}", + // Elan: from what I understand they are just some linter configs so you get some warning on how to properly code + "-XDenableSunApiLintControl", + "-XDignore.symbol.file" + ] } - manifest { - attributes(getManifestAttributes()) - } - - if (usesShadowedDependencies.toBoolean()) { - dependsOn(shadowJar) - enabled = false - } -} - -reobf { - if (usesMixins.toBoolean()) { - addExtraSrgFile mixinSrg - } -} - -afterEvaluate { - if (usesMixins.toBoolean()) { - tasks.compileJava { - options.compilerArgs += [ - "-AreobfSrgFile=${tasks.reobf.srg}", - "-AoutSrgFile=${mixinSrg}", - "-AoutRefMapFile=${refMap}", - // Elan: from what I understand they are just some linter configs so you get some warning on how to properly code - "-XDenableSunApiLintControl", - "-XDignore.symbol.file" - ] + pluginManager.withPlugin('org.jetbrains.kotlin.kapt') { + kapt { + correctErr