diff --git a/RebornCore/src/client/java/reborncore/client/ClientChatUtils.java b/RebornCore/src/client/java/reborncore/client/ClientChatUtils.java index 9c1dc803b..ed76ed998 100644 --- a/RebornCore/src/client/java/reborncore/client/ClientChatUtils.java +++ b/RebornCore/src/client/java/reborncore/client/ClientChatUtils.java @@ -25,8 +25,8 @@ package reborncore.client; import net.minecraft.client.MinecraftClient; -import net.minecraft.network.MessageSender; -import net.minecraft.network.MessageType; +import net.minecraft.network.message.MessageSender; +import net.minecraft.network.message.MessageType; import net.minecraft.text.Text; import net.minecraft.util.Util; import net.minecraft.util.registry.Registry; diff --git a/gradle.properties b/gradle.properties index 1cbbf0635..a51662cf8 100644 --- a/gradle.properties +++ b/gradle.properties @@ -6,13 +6,13 @@ org.gradle.jvmargs=-Xmx2G # Fabric Properties # check these on https://modmuss50.me/fabric.html - minecraft_version=1.19-pre1 - yarn_version=1.19-pre1+build.7 + minecraft_version=1.19-rc1 + yarn_version=1.19-rc1+build.2 loader_version=0.14.6 - fapi_version=0.53.1+1.19 + fapi_version=0.55.0+1.19 # Dependencies energy_version=2.2.0 - rei_version=9.0.462 + rei_version=9.0.466 trinkets_version=3.0.2 dashloader_version=2.0 diff --git a/src/client/java/techreborn/client/compat/rei/ReiPlugin.java b/src/client/java/techreborn/client/compat/rei/ReiPlugin.java index 832262b4c..ba482ff23 100644 --- a/src/client/java/techreborn/client/compat/rei/ReiPlugin.java +++ b/src/client/java/techreborn/client/compat/rei/ReiPlugin.java @@ -33,6 +33,7 @@ import me.shedaniel.rei.api.client.entry.renderer.AbstractEntryRenderer; import me.shedaniel.rei.api.client.entry.renderer.EntryRenderer; import me.shedaniel.rei.api.client.gui.AbstractRenderer; import me.shedaniel.rei.api.client.gui.widgets.Tooltip; +import me.shedaniel.rei.api.client.gui.widgets.TooltipContext; import me.shedaniel.rei.api.client.gui.widgets.Widget; import me.shedaniel.rei.api.client.gui.widgets.Widgets; import me.shedaniel.rei.api.client.plugins.REIClientPlugin; @@ -283,16 +284,15 @@ public class ReiPlugin implements REIClientPlugin { }); } - public static Widget createEnergyDisplay(Rectangle bounds, double energy, EntryAnimation animation, Function tooltipBuilder) { + public static Widget createEnergyDisplay(Rectangle bounds, double energy, EntryAnimation animation, Function tooltipBuilder) { return new EnergyEntryWidget(bounds, animation).entry( ClientEntryStacks.of(new AbstractRenderer() { @Override public void render(MatrixStack matrices, Rectangle bounds, int mouseX, int mouseY, float delta) {} @Override - @Nullable - public Tooltip getTooltip(Point mouse) { - return tooltipBuilder.apply(mouse); + public @Nullable Tooltip getTooltip(TooltipContext context) { + return tooltipBuilder.apply(context); } }) ).notFavoritesInteractable(); @@ -399,8 +399,8 @@ public class ReiPlugin implements REIClientPlugin { @Override @Nullable - public Tooltip getTooltip(EntryStack entry, Point mouse) { - return parent.getTooltip(entry, mouse); + public Tooltip getTooltip(EntryStack entry, TooltipContext context) { + return parent.getTooltip(entry, context); } } diff --git a/src/client/java/techreborn/client/compat/rei/fluidgenerator/FluidGeneratorRecipeCategory.java b/src/client/java/techreborn/client/compat/rei/fluidgenerator/FluidGeneratorRecipeCategory.java index d7bacee69..8540bbd98 100644 --- a/src/client/java/techreborn/client/compat/rei/fluidgenerator/FluidGeneratorRecipeCategory.java +++ b/src/client/java/techreborn/client/compat/rei/fluidgenerator/FluidGeneratorRecipeCategory.java @@ -25,6 +25,7 @@ package techreborn.client.compat.rei.fluidgenerator; import com.google.common.collect.Lists; +import me.shedaniel.math.Point; import me.shedaniel.math.Rectangle; import me.shedaniel.rei.api.client.ClientHelper; import me.shedaniel.rei.api.client.gui.Renderer; @@ -73,13 +74,13 @@ public class FluidGeneratorRecipeCategory implements DisplayCategory setupDisplay(FluidGeneratorRecipeDisplay recipeDisplay, Rectangle bounds) { List widgets = Lists.newArrayList(); widgets.add(Widgets.createRecipeBase(bounds)); - widgets.add(ReiPlugin.createEnergyDisplay(new Rectangle(bounds.x + 108, bounds.y + 8, 14, 50), recipeDisplay.getTotalEnergy(), ReiPlugin.EntryAnimation.upwards(5000), point -> { + widgets.add(ReiPlugin.createEnergyDisplay(new Rectangle(bounds.x + 108, bounds.y + 8, 14, 50), recipeDisplay.getTotalEnergy(), ReiPlugin.EntryAnimation.upwards(5000), tooltipContext -> { List list = Lists.newArrayList(); list.add(Text.of("Energy")); list.add(Text.translatable("techreborn.jei.recipe.generator.total", recipeDisplay.getTotalEnergy()).formatted(Formatting.GRAY)); list.add(Text.of("")); list.add(ClientHelper.getInstance().getFormattedModFromIdentifier(new Identifier("techreborn", ""))); - return Tooltip.create(point, list); + return Tooltip.create(tooltipContext.getPoint(), list); })); widgets.add(ReiPlugin.createFluidDisplay(new Rectangle(bounds.x + 16, bounds.y + 8, 16, 50), recipeDisplay.getInputEntries().get(0).get(0).cast(), ReiPlugin.EntryAnimation.downwards(5000))); widgets.add(ReiPlugin.createProgressBar(bounds.x + 76 - 16, bounds.y + 48 - 19, 5000, GuiBuilder.ProgressDirection.RIGHT)); diff --git a/src/client/java/techreborn/client/compat/rei/fluidreplicator/FluidReplicatorRecipeCategory.java b/src/client/java/techreborn/client/compat/rei/fluidreplicator/FluidReplicatorRecipeCategory.java index e4bdff7a3..ea398f71b 100644 --- a/src/client/java/techreborn/client/compat/rei/fluidreplicator/FluidReplicatorRecipeCategory.java +++ b/src/client/java/techreborn/client/compat/rei/fluidreplicator/FluidReplicatorRecipeCategory.java @@ -76,13 +76,13 @@ public class FluidReplicatorRecipeCategory implements DisplayCategory widgets = Lists.newArrayList(); widgets.add(Widgets.createRecipeBase(bounds)); - widgets.add(ReiPlugin.createEnergyDisplay(new Rectangle(bounds.x + 8, bounds.y + 8, 14, 50), recipeDisplay.getEnergy(), ReiPlugin.EntryAnimation.downwards(5000), point -> { + widgets.add(ReiPlugin.createEnergyDisplay(new Rectangle(bounds.x + 8, bounds.y + 8, 14, 50), recipeDisplay.getEnergy(), ReiPlugin.EntryAnimation.downwards(5000), tooltipContext -> { List list = Lists.newArrayList(); list.add(Text.of("Energy")); list.add(Text.translatable("techreborn.jei.recipe.running.cost", "E", recipeDisplay.getEnergy()).formatted(Formatting.GRAY)); list.add(Text.of("")); list.add(ClientHelper.getInstance().getFormattedModFromIdentifier(new Identifier("techreborn", ""))); - return Tooltip.create(point, list); + return Tooltip.create(tooltipContext.getPoint(), list); })); widgets.add(Widgets.createSlot(new Point(bounds.x + 46, bounds.y + 26)).entries(recipeDisplay.getInputEntries().get(0)).markInput()); diff --git a/src/client/java/techreborn/client/compat/rei/machine/AbstractEnergyConsumingMachineCategory.java b/src/client/java/techreborn/client/compat/rei/machine/AbstractEnergyConsumingMachineCategory.java index 70f5552e8..80c712006 100644 --- a/src/client/java/techreborn/client/compat/rei/machine/AbstractEnergyConsumingMachineCategory.java +++ b/src/client/java/techreborn/client/compat/rei/machine/AbstractEnergyConsumingMachineCategory.java @@ -49,13 +49,13 @@ public abstract class AbstractEnergyConsumingMachineCategory setupDisplay(MachineRecipeDisplay recipeDisplay, Rectangle bounds) { List widgets = Lists.newArrayList(); widgets.add(Widgets.createRecipeBase(bounds)); - widgets.add(ReiPlugin.createEnergyDisplay(new Rectangle(bounds.x + 8, bounds.y + 8, 14, 50), recipeDisplay.getEnergy(), ReiPlugin.EntryAnimation.downwards(5000), point -> { + widgets.add(ReiPlugin.createEnergyDisplay(new Rectangle(bounds.x + 8, bounds.y + 8, 14, 50), recipeDisplay.getEnergy(), ReiPlugin.EntryAnimation.downwards(5000), tooltipContext -> { List list = Lists.newArrayList(); list.add(Text.of("Energy")); list.add(Text.translatable("techreborn.jei.recipe.running.cost", "E", recipeDisplay.getEnergy()).formatted(Formatting.GRAY)); list.add(Text.of("")); list.add(ClientHelper.getInstance().getFormattedModFromIdentifier(new Identifier("techreborn", ""))); - return Tooltip.create(point, list); + return Tooltip.create(tooltipContext.getPoint(), list); })); return widgets; } diff --git a/src/client/java/techreborn/client/compat/rei/machine/GrinderCategory.java b/src/client/java/techreborn/client/compat/rei/machine/GrinderCategory.java index d09e10de2..764adfa11 100644 --- a/src/client/java/techreborn/client/compat/rei/machine/GrinderCategory.java +++ b/src/client/java/techreborn/client/compat/rei/machine/GrinderCategory.java @@ -52,13 +52,13 @@ public class GrinderCategory extends AbstractMachineCate public List setupDisplay(MachineRecipeDisplay recipeDisplay, Rectangle bounds) { List widgets = Lists.newArrayList(); widgets.add(Widgets.createRecipeBase(bounds)); - widgets.add(ReiPlugin.createEnergyDisplay(new Rectangle(bounds.x + 8, bounds.y + 18, 14, 50), recipeDisplay.getEnergy(), ReiPlugin.EntryAnimation.downwards(5000), point -> { + widgets.add(ReiPlugin.createEnergyDisplay(new Rectangle(bounds.x + 8, bounds.y + 18, 14, 50), recipeDisplay.getEnergy(), ReiPlugin.EntryAnimation.downwards(5000), tooltipContext -> { List list = Lists.newArrayList(); list.add(Text.of("Energy")); list.add(Text.translatable("techreborn.jei.recipe.running.cost", "E", recipeDisplay.getEnergy()).formatted(Formatting.GRAY)); list.add(Text.of("")); list.add(ClientHelper.getInstance().getFormattedModFromIdentifier(new Identifier("techreborn", ""))); - return Tooltip.create(point, list); + return Tooltip.create(tooltipContext.getPoint(), list); })); widgets.add(Widgets.createSlot(new Point(bounds.x + 55, bounds.y + 36)).entries(getInput(recipeDisplay, 0)).markInput()); widgets.add(Widgets.createSlot(new Point(bounds.x + 55 + 46, bounds.y + 36 - 9 - 18)).entries(getOutput(recipeDisplay, 0)).markOutput()); diff --git a/src/gametest/groovy/techreborn/test/machine/GrinderTest.groovy b/src/gametest/groovy/techreborn/test/machine/GrinderTest.groovy index fc03e74ba..f77d80637 100644 --- a/src/gametest/groovy/techreborn/test/machine/GrinderTest.groovy +++ b/src/gametest/groovy/techreborn/test/machine/GrinderTest.groovy @@ -32,7 +32,7 @@ import techreborn.test.TRGameTest import techreborn.test.TRTestContext class GrinderTest extends TRGameTest { - @GameTest(structureName = "fabric-gametest-api-v1:empty", tickLimit = 150) + @GameTest(templateName = "fabric-gametest-api-v1:empty", tickLimit = 150) def testGrind2OCs(TRTestContext context) { /** * Test that grinder with 2 overclocker upgrades grinds coal into coal dust in 116 ticks diff --git a/src/gametest/groovy/techreborn/test/machine/IronAlloyFurnaceTest.groovy b/src/gametest/groovy/techreborn/test/machine/IronAlloyFurnaceTest.groovy index aa558e4aa..2f108142f 100644 --- a/src/gametest/groovy/techreborn/test/machine/IronAlloyFurnaceTest.groovy +++ b/src/gametest/groovy/techreborn/test/machine/IronAlloyFurnaceTest.groovy @@ -34,7 +34,7 @@ import techreborn.test.TRGameTest import techreborn.test.TRTestContext class IronAlloyFurnaceTest extends TRGameTest { - @GameTest(structureName = "fabric-gametest-api-v1:empty", tickLimit = 2000) + @GameTest(templateName = "fabric-gametest-api-v1:empty", tickLimit = 2000) def testIronAlloyFurnaceElectrumAlloyIngot(TRTestContext context) { /** * Test that the Iron Alloy Furnace smelts a gold ingot and a silver ingot into an electrum alloy ingot in 200 diff --git a/src/gametest/groovy/techreborn/test/machine/IronFurnaceTest.groovy b/src/gametest/groovy/techreborn/test/machine/IronFurnaceTest.groovy index d64d7658b..2526eed95 100644 --- a/src/gametest/groovy/techreborn/test/machine/IronFurnaceTest.groovy +++ b/src/gametest/groovy/techreborn/test/machine/IronFurnaceTest.groovy @@ -35,7 +35,7 @@ import techreborn.test.TRGameTest import techreborn.test.TRTestContext class IronFurnaceTest extends TRGameTest { - @GameTest(structureName = "fabric-gametest-api-v1:empty", tickLimit = 2000) + @GameTest(templateName = "fabric-gametest-api-v1:empty", tickLimit = 2000) def testIronFurnaceSmeltRawIron(TRTestContext context) { /** * Test that the Iron Furnace smelts a raw iron ore into an iron ingot in 200 ticks @@ -49,7 +49,7 @@ class IronFurnaceTest extends TRGameTest { } } - @GameTest(structureName = "fabric-gametest-api-v1:empty", tickLimit = 2000) + @GameTest(templateName = "fabric-gametest-api-v1:empty", tickLimit = 2000) def testIronFurnaceSmeltRawIronBlock(TRTestContext context) { /** * Test that the Iron Furnace smelts a raw iron block into an iron block in 1500 ticks instead of 200 diff --git a/src/gametest/groovy/techreborn/test/recipe/RecipeSyncTests.groovy b/src/gametest/groovy/techreborn/test/recipe/RecipeSyncTests.groovy index e0ee9f194..98b6dcd09 100644 --- a/src/gametest/groovy/techreborn/test/recipe/RecipeSyncTests.groovy +++ b/src/gametest/groovy/techreborn/test/recipe/RecipeSyncTests.groovy @@ -36,7 +36,7 @@ import techreborn.test.TRTestContext * A bit of a mess, but checks that we can ser/de all recipes to and from json. */ class RecipeSyncTests extends TRGameTest { - @GameTest(structureName = "fabric-gametest-api-v1:empty", tickLimit = 150) + @GameTest(templateName = "fabric-gametest-api-v1:empty", tickLimit = 150) def testRecipes(TRTestContext context) { def recipeTypes = RecipeManager.getRecipeTypes("techreborn") diff --git a/src/main/java/techreborn/init/ModLoot.java b/src/main/java/techreborn/init/ModLoot.java index 8b4d13a8b..259ab0862 100644 --- a/src/main/java/techreborn/init/ModLoot.java +++ b/src/main/java/techreborn/init/ModLoot.java @@ -24,8 +24,7 @@ package techreborn.init; -import net.fabricmc.fabric.api.loot.v1.FabricLootPoolBuilder; -import net.fabricmc.fabric.api.loot.v1.event.LootTableLoadingCallback; +import net.fabricmc.fabric.api.loot.v2.LootTableEvents; import net.minecraft.item.ItemConvertible; import net.minecraft.item.Items; import net.minecraft.loot.LootPool; @@ -52,9 +51,9 @@ public class ModLoot { LootPoolEntry basicCircuit = makeEntry(Parts.ELECTRONIC_CIRCUIT); LootPoolEntry rubberSapling = makeEntry(TRContent.RUBBER_SAPLING, 25); - LootPool poolBasic = FabricLootPoolBuilder.builder().withEntry(copperIngot).withEntry(tinIngot) - .withEntry(leadIngot).withEntry(silverIngot).withEntry(refinedIronIngot).withEntry(advancedAlloyIngot) - .withEntry(basicFrame).withEntry(basicCircuit).withEntry(rubberSapling).rolls(UniformLootNumberProvider.create(1.0f, 2.0f)) + LootPool poolBasic = LootPool.builder().with(copperIngot).with(tinIngot) + .with(leadIngot).with(silverIngot).with(refinedIronIngot).with(advancedAlloyIngot) + .with(basicFrame).with(basicCircuit).with(rubberSapling).rolls(UniformLootNumberProvider.create(1.0f, 2.0f)) .build(); LootPoolEntry aluminumIngot = makeEntry(Ingots.ALUMINUM); @@ -67,9 +66,9 @@ public class ModLoot { LootPoolEntry advancedCircuit = makeEntry(Parts.ADVANCED_CIRCUIT); LootPoolEntry dataStorageChip = makeEntry(Parts.DATA_STORAGE_CHIP); - LootPool poolAdvanced = FabricLootPoolBuilder.builder().withEntry(aluminumIngot).withEntry(electrumIngot) - .withEntry(invarIngot).withEntry(nickelIngot).withEntry(steelIngot).withEntry(zincIngot) - .withEntry(advancedFrame).withEntry(advancedCircuit).withEntry(dataStorageChip).rolls(UniformLootNumberProvider.create(1.0f, 3.0f)) + LootPool poolAdvanced = LootPool.builder().with(aluminumIngot).with(electrumIngot) + .with(invarIngot).with(nickelIngot).with(steelIngot).with(zincIngot) + .with(advancedFrame).with(advancedCircuit).with(dataStorageChip).rolls(UniformLootNumberProvider.create(1.0f, 3.0f)) .build(); LootPoolEntry chromeIngot = makeEntry(Ingots.CHROME); @@ -82,19 +81,19 @@ public class ModLoot { LootPoolEntry industrialCircuit = makeEntry(Parts.INDUSTRIAL_CIRCUIT); LootPoolEntry energyFlowChip = makeEntry(Parts.ENERGY_FLOW_CHIP); - LootPool poolIndustrial = FabricLootPoolBuilder.builder().withEntry(chromeIngot).withEntry(iridiumIngot) - .withEntry(platinumIngot).withEntry(titaniumIngot).withEntry(tungstenIngot).withEntry(tungstensteelIngot) - .withEntry(industrialFrame).withEntry(industrialCircuit).withEntry(energyFlowChip).rolls(UniformLootNumberProvider.create(1.0f, 3.0f)) + LootPool poolIndustrial = LootPool.builder().with(chromeIngot).with(iridiumIngot) + .with(platinumIngot).with(titaniumIngot).with(tungstenIngot).with(tungstensteelIngot) + .with(industrialFrame).with(industrialCircuit).with(energyFlowChip).rolls(UniformLootNumberProvider.create(1.0f, 3.0f)) .build(); LootPoolEntry rubber = ItemEntry.builder(Parts.RUBBER).weight(10).build(); LootPoolEntry treeTap = ItemEntry.builder(TRContent.TREE_TAP).weight(10) .apply(SetDamageLootFunction.builder(UniformLootNumberProvider.create(0.0f, 0.9f))).build(); - LootPool poolFishingJunk = FabricLootPoolBuilder.builder().withEntry(rubber).withEntry(treeTap).build(); + LootPool poolFishingJunk = LootPool.builder().with(rubber).with(treeTap).build(); - LootTableLoadingCallback.EVENT.register((resourceManager, lootManager, ident, supplier, setter) -> { - String stringId = ident.toString(); + LootTableEvents.MODIFY.register((resourceManager, lootManager, id, tableBuilder, source) -> { + String stringId = id.toString(); if (!stringId.startsWith("minecraft:chests")) { return; } @@ -111,16 +110,16 @@ public class ModLoot { "minecraft:chests/village/village_weaponsmith", "minecraft:chests/village/village_armorer", "minecraft:chests/village/village_toolsmith" - -> supplier.withPool(poolBasic); + -> tableBuilder.pool(poolBasic); case "minecraft:chests/stronghold_corridor", "minecraft:chests/stronghold_crossing", "minecraft:chests/stronghold_library", "minecraft:chest/underwater_ruin_big", "minecraft:chests/pillager_outpost" - -> supplier.withPool(poolAdvanced); + -> tableBuilder.pool(poolAdvanced); case "minecraft:chests/woodland_mansion", "minecraft:chests/ancient_city" - -> supplier.withPool(poolIndustrial); + -> tableBuilder.pool(poolIndustrial); } } @@ -130,23 +129,24 @@ public class ModLoot { stringId.equals("minecraft:chests/bastion_hoglin_stable") || stringId.equals("minecraft:chests/bastion_treasure") || stringId.equals("minecraft:chests/bastion_other")) { - supplier.withPool(poolAdvanced); + tableBuilder.pool(poolAdvanced); } } if (TechRebornConfig.enableEndLoot) { if (stringId.equals("minecraft:chests/end_city_treasure")) { - supplier.withPool(poolIndustrial); + tableBuilder.pool(poolIndustrial); } } if (TechRebornConfig.enableFishingJunkLoot) { if (stringId.equals("minecraft:gameplay/fishing/junk")) { - supplier.withPool(poolFishingJunk); + tableBuilder.pool(poolFishingJunk); } } - + return; }); + } /**