diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml index 2ca3795..95b3be6 100644 --- a/.github/workflows/build.yml +++ b/.github/workflows/build.yml @@ -1,40 +1,45 @@ # Automatically build the project and run any configured tests for every push # and submitted pull request. This can help catch issues that only occur on -# certain platforms or Java versions, and provides a first line of defence +# certain platforms or Java versions, and provides a first line of defense # against bad commits. name: build -on: [pull_request, push] +on: [pull_request, push, workflow_dispatch] jobs: build: - strategy: - matrix: - # Use these Java versions - java: [ - 17, # Current Java LTS & minimum supported by Minecraft - ] - # and run on both Linux and Windows - os: [ubuntu-22.04, windows-2022] - runs-on: ${{ matrix.os }} + runs-on: ubuntu-latest steps: - - name: checkout repository - uses: actions/checkout@v3 - - name: validate gradle wrapper - uses: gradle/wrapper-validation-action@v1 - - name: setup jdk ${{ matrix.java }} - uses: actions/setup-java@v3 + - name: Checkout repository + uses: actions/checkout@v4 + + - name: Validate Gradle wrapper + uses: gradle/wrapper-validation-action@v2 + + - name: Setup JDK 17 + uses: actions/setup-java@v4 + with: + java-version: 17 + distribution: microsoft + + - name: Setup Gradle caches + uses: actions/cache@v4 with: - java-version: ${{ matrix.java }} - distribution: 'microsoft' - - name: make gradle wrapper executable - if: ${{ runner.os != 'Windows' }} + path: | + ~/.gradle/caches + ~/.gradle/loom-cache + ~/.gradle/wrapper + key: ${{ runner.os }}-gradle-${{ hashFiles('**/gradle-wrapper.properties') }} + restore-keys: ${{ runner.os }}-gradle + + - name: Make Gradle wrapper executable run: chmod +x ./gradlew - - name: build + + - name: Build run: ./gradlew build - - name: capture build artifacts - if: ${{ runner.os == 'Linux' && matrix.java == '17' }} # Only upload artifacts built from latest java on one OS - uses: actions/upload-artifact@v3 + + - name: Upload artifacts + uses: actions/upload-artifact@v4 with: name: Artifacts - path: build/libs/ \ No newline at end of file + path: build/libs/ diff --git a/build.gradle b/build.gradle index 1faca21..48bf070 100644 --- a/build.gradle +++ b/build.gradle @@ -1,5 +1,5 @@ plugins { - id 'fabric-loom' version '1.5-SNAPSHOT' + id 'fabric-loom' version '1.6-SNAPSHOT' id 'maven-publish' } @@ -11,22 +11,33 @@ version = project.mod_version group = project.maven_group repositories { + maven { url 'https://maven.draylar.dev/releases/' } + maven { url 'https://maven.greenhouseteam.dev/releases/' } + maven { url 'https://maven.jamieswhiteshirt.com/libs-release' } maven { url 'https://maven.shedaniel.me/' } - maven { url 'https://api.modrinth.com/maven' } maven { url 'https://maven.terraformersmc.com/' } - maven { url "https://jitpack.io" } + maven { url 'https://mvn.devos.one/releases/' } + + exclusiveContent { + forRepository { + maven { + url 'https://cursemaven.com' + } + } + filter { + includeGroup 'curse.maven' + } + } } dependencies { minecraft "com.mojang:minecraft:${project.minecraft_version}" mappings "net.fabricmc:yarn:${project.yarn_mappings}:v2" modImplementation "net.fabricmc:fabric-loader:${project.loader_version}" - modImplementation "net.fabricmc.fabric-api:fabric-api:${project.fabric_version}" - - modImplementation "maven.modrinth:farmers-delight-fabric:${project.delight_version}" - modImplementation 'com.github.draylar.omega-config:omega-config-base:1.2.3-1.18.1' - include 'com.github.draylar.omega-config:omega-config-base:1.2.3-1.18.1' + modImplementation "net.fabricmc.fabric-api:fabric-api:${project.fabric_version}" + modImplementation "vectorwing:FarmersDelight-Refabricated:${project.delight_version}" + modImplementation include("dev.draylar.omega-config:omega-config-base:${project.omega_version}") modCompileOnly "me.shedaniel:RoughlyEnoughItems-api-fabric:${project.rei_version}" modRuntimeOnly "me.shedaniel:RoughlyEnoughItems-fabric:${project.rei_version}" diff --git a/gradle.properties b/gradle.properties index d1509e1..a57e39d 100644 --- a/gradle.properties +++ b/gradle.properties @@ -16,6 +16,7 @@ archives_base_name = expandeddelight # Dependencies fabric_version=0.92.0+1.20.1 -delight_version=1.4.3 +delight_version=1.20.1-2.0.10 rei_version=12.0.684 -modmenu_version=7.2.2 \ No newline at end of file +modmenu_version=7.2.2 +omega_version=1.4.0+1.20.1 diff --git a/gradle/wrapper/gradle-wrapper.jar b/gradle/wrapper/gradle-wrapper.jar index 033e24c..e644113 100644 Binary files a/gradle/wrapper/gradle-wrapper.jar and b/gradle/wrapper/gradle-wrapper.jar differ diff --git a/gradle/wrapper/gradle-wrapper.properties b/gradle/wrapper/gradle-wrapper.properties index a80b22c..b82aa23 100644 --- a/gradle/wrapper/gradle-wrapper.properties +++ b/gradle/wrapper/gradle-wrapper.properties @@ -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 diff --git a/gradlew b/gradlew old mode 100644 new mode 100755 index fcb6fca..1aa94a4 --- a/gradlew +++ b/gradlew @@ -83,7 +83,8 @@ done # This is normally unused # shellcheck disable=SC2034 APP_BASE_NAME=${0##*/} -APP_HOME=$( cd "${APP_HOME:-./}" && pwd -P ) || exit +# Discard cd standard output in case $CDPATH is set (https://github.com/gradle/gradle/issues/25036) +APP_HOME=$( cd "${APP_HOME:-./}" > /dev/null && pwd -P ) || exit # Use the maximum available, or set MAX_FD != -1 to use that value. MAX_FD=maximum @@ -144,7 +145,7 @@ if ! "$cygwin" && ! "$darwin" && ! "$nonstop" ; then case $MAX_FD in #( max*) # In POSIX sh, ulimit -H is undefined. That's why the result is checked to see if it worked. - # shellcheck disable=SC3045 + # shellcheck disable=SC2039,SC3045 MAX_FD=$( ulimit -H -n ) || warn "Could not query maximum file descriptor limit" esac @@ -152,7 +153,7 @@ if ! "$cygwin" && ! "$darwin" && ! "$nonstop" ; then '' | soft) :;; #( *) # In POSIX sh, ulimit -n is undefined. That's why the result is checked to see if it worked. - # shellcheck disable=SC3045 + # shellcheck disable=SC2039,SC3045 ulimit -n "$MAX_FD" || warn "Could not set maximum file descriptor limit to $MAX_FD" esac @@ -201,11 +202,11 @@ fi # Add default JVM options here. You can also use JAVA_OPTS and GRADLE_OPTS to pass JVM options to this script. DEFAULT_JVM_OPTS='"-Xmx64m" "-Xms64m"' -# Collect all arguments for the java command; -# * $DEFAULT_JVM_OPTS, $JAVA_OPTS, and $GRADLE_OPTS can contain fragments of -# shell script including quotes and variable substitutions, so put them in -# double quotes to make sure that they get re-expanded; and -# * put everything else in single quotes, so that it's not re-expanded. +# Collect all arguments for the java command: +# * DEFAULT_JVM_OPTS, JAVA_OPTS, JAVA_OPTS, and optsEnvironmentVar are not allowed to contain shell fragments, +# and any embedded shellness will be escaped. +# * For example: A user cannot expect ${Hostname} to be expanded, as it is an environment variable and will be +# treated as '${Hostname}' itself on the command line. set -- \ "-Dorg.gradle.appname=$APP_BASE_NAME" \ diff --git a/gradlew.bat b/gradlew.bat index 93e3f59..25da30d 100644 --- a/gradlew.bat +++ b/gradlew.bat @@ -43,11 +43,11 @@ set JAVA_EXE=java.exe %JAVA_EXE% -version >NUL 2>&1 if %ERRORLEVEL% equ 0 goto execute -echo. -echo ERROR: JAVA_HOME is not set and no 'java' command could be found in your PATH. -echo. -echo Please set the JAVA_HOME variable in your environment to match the -echo location of your Java installation. +echo. 1>&2 +echo ERROR: JAVA_HOME is not set and no 'java' command could be found in your PATH. 1>&2 +echo. 1>&2 +echo Please set the JAVA_HOME variable in your environment to match the 1>&2 +echo location of your Java installation. 1>&2 goto fail @@ -57,11 +57,11 @@ set JAVA_EXE=%JAVA_HOME%/bin/java.exe if exist "%JAVA_EXE%" goto execute -echo. -echo ERROR: JAVA_HOME is set to an invalid directory: %JAVA_HOME% -echo. -echo Please set the JAVA_HOME variable in your environment to match the -echo location of your Java installation. +echo. 1>&2 +echo ERROR: JAVA_HOME is set to an invalid directory: %JAVA_HOME% 1>&2 +echo. 1>&2 +echo Please set the JAVA_HOME variable in your environment to match the 1>&2 +echo location of your Java installation. 1>&2 goto fail diff --git a/src/main/java/com/ianm1647/expandeddelight/block/custom/JuicerBlock.java b/src/main/java/com/ianm1647/expandeddelight/block/custom/JuicerBlock.java index 36a52db..51d8af7 100644 --- a/src/main/java/com/ianm1647/expandeddelight/block/custom/JuicerBlock.java +++ b/src/main/java/com/ianm1647/expandeddelight/block/custom/JuicerBlock.java @@ -138,8 +138,8 @@ public BlockRenderType getRenderType(BlockState state) { public void onStateReplaced(BlockState state, World world, BlockPos pos, BlockState newState, boolean moved) { if (state.getBlock() != newState.getBlock()) { BlockEntity blockEntity = world.getBlockEntity(pos); - if (blockEntity instanceof JuicerBlockEntity) { - ItemScatterer.spawn(world, pos, ((JuicerBlockEntity) blockEntity).getDroppableInventory()); + if (blockEntity instanceof JuicerBlockEntity juicerBlockEntity) { + ItemScatterer.spawn(world, pos, juicerBlockEntity.getDroppableInventory()); world.updateComparators(pos,this); } super.onStateReplaced(state, world, pos, newState, moved); @@ -150,8 +150,7 @@ public void onStateReplaced(BlockState state, World world, BlockPos pos, BlockSt public ActionResult onUse(BlockState state, World world, BlockPos pos, PlayerEntity player, Hand hand, BlockHitResult hit) { if (!world.isClient) { BlockEntity blockEntity = world.getBlockEntity(pos); - if (blockEntity instanceof JuicerBlockEntity) { - JuicerBlockEntity juicerBlockEntity = (JuicerBlockEntity) blockEntity; + if (blockEntity instanceof JuicerBlockEntity juicerBlockEntity) { ItemStack stack = juicerBlockEntity.useBottleOnJuice(player.getStackInHand(hand)); if (stack != ItemStack.EMPTY) { if (!player.getInventory().insertStack(stack)) { diff --git a/src/main/java/com/ianm1647/expandeddelight/block/entity/JuicerBlockEntity.java b/src/main/java/com/ianm1647/expandeddelight/block/entity/JuicerBlockEntity.java index a8b4df3..861beee 100644 --- a/src/main/java/com/ianm1647/expandeddelight/block/entity/JuicerBlockEntity.java +++ b/src/main/java/com/ianm1647/expandeddelight/block/entity/JuicerBlockEntity.java @@ -15,7 +15,6 @@ import net.minecraft.item.Items; import net.minecraft.nbt.NbtCompound; import net.minecraft.recipe.RecipeType; -import net.minecraft.registry.DynamicRegistryManager; import net.minecraft.screen.NamedScreenHandlerFactory; import net.minecraft.screen.PropertyDelegate; import net.minecraft.screen.ScreenHandler; @@ -99,11 +98,9 @@ public static void tick(World world, BlockPos pos, BlockState state, JuicerBlock } else { entity.resetProgress(); } - boolean dirty = false; if (!entity.getStack(3).isEmpty()) { if (!entity.getStack(2).isEmpty()) { entity.useStoredBottleOnJuice(); - dirty = true; } } } diff --git a/src/main/java/com/ianm1647/expandeddelight/data/ModWorldGenerator.java b/src/main/java/com/ianm1647/expandeddelight/data/ModWorldGenerator.java index 1f36332..211a826 100644 --- a/src/main/java/com/ianm1647/expandeddelight/data/ModWorldGenerator.java +++ b/src/main/java/com/ianm1647/expandeddelight/data/ModWorldGenerator.java @@ -21,7 +21,7 @@ protected void configure(RegistryWrapper.WrapperLookup registries, Entries entri @Override public String getName() { - return ExpandedDelight.MODID; + return ExpandedDelight.MODID + " World Generator"; } } diff --git a/src/main/java/com/ianm1647/expandeddelight/integration/rei/ExpandedDelightREI.java b/src/main/java/com/ianm1647/expandeddelight/integration/rei/ExpandedDelightREI.java index 8894b3e..a4cf30f 100644 --- a/src/main/java/com/ianm1647/expandeddelight/integration/rei/ExpandedDelightREI.java +++ b/src/main/java/com/ianm1647/expandeddelight/integration/rei/ExpandedDelightREI.java @@ -10,19 +10,17 @@ import me.shedaniel.math.Rectangle; import me.shedaniel.rei.api.client.plugins.REIClientPlugin; import me.shedaniel.rei.api.client.registry.category.CategoryRegistry; -import me.shedaniel.rei.api.client.registry.display.DisplayCategory; import me.shedaniel.rei.api.client.registry.display.DisplayRegistry; import me.shedaniel.rei.api.client.registry.screen.ScreenRegistry; import me.shedaniel.rei.api.common.category.CategoryIdentifier; -import me.shedaniel.rei.api.common.entry.EntryStack; import me.shedaniel.rei.api.common.util.EntryStacks; public class ExpandedDelightREI implements REIClientPlugin { public static final CategoryIdentifier JUICING = CategoryIdentifier.of(ExpandedDelight.MODID, "juicing"); public void registerCategories(CategoryRegistry registry) { - registry.add(new DisplayCategory[]{new JuicingRecipeCategory()}); - registry.addWorkstations(JUICING, new EntryStack[]{EntryStacks.of(BlockList.JUICER)}); + registry.add(new JuicingRecipeCategory()); + registry.addWorkstations(JUICING, EntryStacks.of(BlockList.JUICER)); } public void registerDisplays(DisplayRegistry registry) { @@ -30,6 +28,6 @@ public void registerDisplays(DisplayRegistry registry) { } public void registerScreens(ScreenRegistry registry) { - registry.registerContainerClickArea(new Rectangle(79, 35, 24, 17), JuicerScreen.class, new CategoryIdentifier[]{JUICING}); + registry.registerContainerClickArea(new Rectangle(79, 35, 24, 17), JuicerScreen.class, JUICING); } } \ No newline at end of file diff --git a/src/main/java/com/ianm1647/expandeddelight/integration/rei/juicing/JuicingRecipeCategory.java b/src/main/java/com/ianm1647/expandeddelight/integration/rei/juicing/JuicingRecipeCategory.java index c595d39..9023d67 100644 --- a/src/main/java/com/ianm1647/expandeddelight/integration/rei/juicing/JuicingRecipeCategory.java +++ b/src/main/java/com/ianm1647/expandeddelight/integration/rei/juicing/JuicingRecipeCategory.java @@ -20,7 +20,6 @@ import net.minecraft.util.Identifier; import java.util.ArrayList; -import java.util.Collection; import java.util.List; @Environment(EnvType.CLIENT) @@ -44,7 +43,7 @@ public CategoryIdentifier getCategoryIdentifier( public List setupDisplay(JuicingRecipeDisplay display, Rectangle bounds) { Point origin = bounds.getLocation(); - List widgets = new ArrayList(); + List widgets = new ArrayList<>(); widgets.add(Widgets.createRecipeBase(new Rectangle(origin.x - 10, origin.y, 160, 85))); Rectangle bgBounds = new Rectangle(origin.x - 5, origin.y + 5, 150, 75); widgets.add(Widgets.createTexturedWidget(GUI_TEXTURE, bgBounds, 10f, 4f)); @@ -53,7 +52,7 @@ public List setupDisplay(JuicingRecipeDisplay display, Rectangle bounds) if (ingredientEntries != null) { for(int i = 0; i < ingredientEntries.size(); ++i) { Point slotLoc = new Point(bgBounds.x + 38 + i / 3 * 18, bgBounds.y + 21 + i % 3 * 18); - widgets.add(Widgets.createSlot(slotLoc).entries((Collection)ingredientEntries.get(i)).markInput().disableBackground()); + widgets.add(Widgets.createSlot(slotLoc).entries(ingredientEntries.get(i)).markInput().disableBackground()); } } @@ -61,13 +60,13 @@ public List setupDisplay(JuicingRecipeDisplay display, Rectangle bounds) .entries(display.getContainerOutput()).markInput().disableBackground()); widgets.add(Widgets.createSlot(new Point(bgBounds.x + 106, bgBounds.y + 31)) - .entries((Collection)display.getOutputEntries().get(0)).markOutput().disableBackground()); + .entries(display.getOutputEntries().get(0)).markOutput().disableBackground()); widgets.add(Widgets.createSlot(new Point(bgBounds.x + 106, bgBounds.y + 56)) - .entries((Collection)display.getOutputEntries().get(0)).markOutput().disableBackground()); + .entries(display.getOutputEntries().get(0)).markOutput().disableBackground()); Arrow cookArrow = Widgets.createArrow(new Point(bgBounds.x + 68, bgBounds.y + 31)) - .animationDurationTicks((double)display.getCookTime()); + .animationDurationTicks(display.getCookTime()); widgets.add(cookArrow); diff --git a/src/main/java/com/ianm1647/expandeddelight/integration/rei/juicing/JuicingRecipeDisplay.java b/src/main/java/com/ianm1647/expandeddelight/integration/rei/juicing/JuicingRecipeDisplay.java index 3d29cc3..8e0e8d9 100644 --- a/src/main/java/com/ianm1647/expandeddelight/integration/rei/juicing/JuicingRecipeDisplay.java +++ b/src/main/java/com/ianm1647/expandeddelight/integration/rei/juicing/JuicingRecipeDisplay.java @@ -28,7 +28,7 @@ public CategoryIdentifier getCategoryIdentifier() { } public List getInputEntries() { - List inputEntryList = new ArrayList(super.getInputEntries()); + List inputEntryList = new ArrayList<>(super.getInputEntries()); inputEntryList.add(this.bottleOutput); return ImmutableList.copyOf(inputEntryList); } diff --git a/src/main/java/com/ianm1647/expandeddelight/item/ItemList.java b/src/main/java/com/ianm1647/expandeddelight/item/ItemList.java index ef6c81f..473424b 100644 --- a/src/main/java/com/ianm1647/expandeddelight/item/ItemList.java +++ b/src/main/java/com/ianm1647/expandeddelight/item/ItemList.java @@ -1,6 +1,5 @@ package com.ianm1647.expandeddelight.item; -import net.fabricmc.fabric.api.itemgroup.v1.FabricItemGroupEntries; import net.minecraft.item.Item; public class ItemList { diff --git a/src/main/java/com/ianm1647/expandeddelight/item/JuiceItem.java b/src/main/java/com/ianm1647/expandeddelight/item/JuiceItem.java index f94a522..78e038b 100644 --- a/src/main/java/com/ianm1647/expandeddelight/item/JuiceItem.java +++ b/src/main/java/com/ianm1647/expandeddelight/item/JuiceItem.java @@ -1,9 +1,9 @@ package com.ianm1647.expandeddelight.item; -import com.nhoryzon.mc.farmersdelight.item.ConsumableItem; import net.minecraft.item.Item; import net.minecraft.item.ItemStack; import net.minecraft.util.UseAction; +import vectorwing.farmersdelight.common.item.ConsumableItem; public class JuiceItem extends ConsumableItem { public JuiceItem(Item.Settings settings) { diff --git a/src/main/java/com/ianm1647/expandeddelight/registry/BlockEntityRegistry.java b/src/main/java/com/ianm1647/expandeddelight/registry/BlockEntityRegistry.java index ab08ffc..36ca90a 100644 --- a/src/main/java/com/ianm1647/expandeddelight/registry/BlockEntityRegistry.java +++ b/src/main/java/com/ianm1647/expandeddelight/registry/BlockEntityRegistry.java @@ -19,7 +19,7 @@ public static void registerBlockEntity() { JUICER = entity("juicer", JuicerBlockEntity::new, BlockList.JUICER); } - private static BlockEntityType entity(String name, Factory entity, Block block) { + private static BlockEntityType entity(String name, Factory entity, Block block) { return Registry.register(Registries.BLOCK_ENTITY_TYPE, new Identifier(ExpandedDelight.MODID, name), FabricBlockEntityTypeBuilder.create(entity, block).build(null)); } diff --git a/src/main/java/com/ianm1647/expandeddelight/registry/BlockRegistry.java b/src/main/java/com/ianm1647/expandeddelight/registry/BlockRegistry.java index f900fd6..b7fb4b5 100644 --- a/src/main/java/com/ianm1647/expandeddelight/registry/BlockRegistry.java +++ b/src/main/java/com/ianm1647/expandeddelight/registry/BlockRegistry.java @@ -7,11 +7,11 @@ import com.ianm1647.expandeddelight.block.custom.JuicerBlock; import com.ianm1647.expandeddelight.block.custom.MortarPestleBlock; import com.ianm1647.expandeddelight.world.feature.tree.CinnamonSaplingGenerator; -import com.nhoryzon.mc.farmersdelight.block.WildPatchBlock; import net.fabricmc.fabric.api.item.v1.FabricItemSettings; import net.fabricmc.fabric.api.itemgroup.v1.ItemGroupEvents; import net.fabricmc.fabric.api.object.builder.v1.block.FabricBlockSettings; import net.minecraft.block.*; +import net.minecraft.entity.effect.StatusEffects; import net.minecraft.item.BlockItem; import net.minecraft.item.Item; import net.minecraft.registry.Registries; @@ -19,6 +19,7 @@ import net.minecraft.sound.BlockSoundGroup; import net.minecraft.util.Identifier; import net.minecraft.util.math.intprovider.UniformIntProvider; +import vectorwing.farmersdelight.common.block.WildCropBlock; public class BlockRegistry { @@ -42,14 +43,15 @@ public static void registerBlocks() { new Block(blockSettings(2.0f, 3.0f, BlockSoundGroup.WOOD))); //crops + //TODO: Fix status effects BlockList.WILD_ASPARAGUS = block("wild_asparagus", - new WildPatchBlock()); + new WildCropBlock(StatusEffects.ABSORPTION, 0, FabricBlockSettings.copyOf(Blocks.TALL_GRASS))); BlockList.WILD_SWEET_POTATO = block("wild_sweet_potatoes", - new WildPatchBlock()); + new WildCropBlock(StatusEffects.ABSORPTION, 0, FabricBlockSettings.copyOf(Blocks.TALL_GRASS))); BlockList.WILD_CHILI_PEPPER = block("wild_chili_pepper", - new WildPatchBlock()); + new WildCropBlock(StatusEffects.ABSORPTION, 0, FabricBlockSettings.copyOf(Blocks.TALL_GRASS))); BlockList.WILD_PEANUTS = block("wild_peanuts", - new WildPatchBlock()); + new WildCropBlock(StatusEffects.ABSORPTION, 0, FabricBlockSettings.copyOf(Blocks.TALL_GRASS))); //ExpandedDelight.LOGGER.info("ExpandedDelight blocks loaded"); } diff --git a/src/main/java/com/ianm1647/expandeddelight/registry/ItemRegistry.java b/src/main/java/com/ianm1647/expandeddelight/registry/ItemRegistry.java index 610b32d..36203d3 100644 --- a/src/main/java/com/ianm1647/expandeddelight/registry/ItemRegistry.java +++ b/src/main/java/com/ianm1647/expandeddelight/registry/ItemRegistry.java @@ -4,7 +4,6 @@ import com.ianm1647.expandeddelight.block.BlockList; import com.ianm1647.expandeddelight.item.ItemList; import com.ianm1647.expandeddelight.item.JuiceItem; -import com.nhoryzon.mc.farmersdelight.registry.EffectsRegistry; import net.fabricmc.fabric.api.item.v1.FabricItemSettings; import net.fabricmc.fabric.api.itemgroup.v1.ItemGroupEvents; import net.minecraft.block.Block; @@ -15,6 +14,7 @@ import net.minecraft.registry.Registries; import net.minecraft.registry.Registry; import net.minecraft.util.Identifier; +import vectorwing.farmersdelight.common.registry.ModEffects; public class ItemRegistry { @@ -154,7 +154,7 @@ private static Item stew(String name, int hunger, float saturation) { Item item = Registry.register(Registries.ITEM, new Identifier(ExpandedDelight.MODID, name), new Item(new FabricItemSettings().recipeRemainder(Items.BOWL).maxCount(16) .food(new FoodComponent.Builder().hunger(hunger).saturationModifier(saturation) - .statusEffect(new StatusEffectInstance(EffectsRegistry.COMFORT.get(), 2400, 0), 1.0f).build()))); + .statusEffect(new StatusEffectInstance(ModEffects.COMFORT.get(), 2400, 0), 1.0f).build()))); ItemGroupEvents.modifyEntriesEvent(ExpandedDelight.GROUP).register(entries -> entries.add(item)); return item; } @@ -163,7 +163,7 @@ private static Item meal(String name, int hunger, float saturation) { Item item = Registry.register(Registries.ITEM, new Identifier(ExpandedDelight.MODID, name), new Item(new FabricItemSettings().recipeRemainder(Items.BOWL).maxCount(16) .food(new FoodComponent.Builder().hunger(hunger).saturationModifier(saturation) - .statusEffect(new StatusEffectInstance(EffectsRegistry.NOURISHMENT.get(), 3600, 0), 1.0f).build()))); + .statusEffect(new StatusEffectInstance(ModEffects.NOURISHMENT.get(), 3600, 0), 1.0f).build()))); ItemGroupEvents.modifyEntriesEvent(ExpandedDelight.GROUP).register(entries -> entries.add(item)); return item; } diff --git a/src/main/java/com/ianm1647/expandeddelight/registry/RecipeRegistry.java b/src/main/java/com/ianm1647/expandeddelight/registry/RecipeRegistry.java index 2746a0c..d231dc2 100644 --- a/src/main/java/com/ianm1647/expandeddelight/registry/RecipeRegistry.java +++ b/src/main/java/com/ianm1647/expandeddelight/registry/RecipeRegistry.java @@ -3,6 +3,7 @@ import com.ianm1647.expandeddelight.ExpandedDelight; import com.ianm1647.expandeddelight.util.recipe.JuicerRecipe; import com.ianm1647.expandeddelight.util.recipe.JuicerRecipeSerializer; +import net.minecraft.recipe.Recipe; import net.minecraft.recipe.RecipeSerializer; import net.minecraft.recipe.RecipeType; import net.minecraft.registry.Registries; @@ -18,11 +19,11 @@ public static void registerRecipes() { JUICER_TYPE = type("juicing", new JuicerRecipeSerializer.JuicerRecipeType()); } - public static RecipeType type(String name, RecipeType recipe) { + public static > RecipeType type(String name, RecipeType recipe) { return Registry.register(Registries.RECIPE_TYPE, new Identifier(ExpandedDelight.MODID, name), recipe); } - public static RecipeSerializer serializer(String name, RecipeSerializer recipe) { + public static > RecipeSerializer serializer(String name, RecipeSerializer recipe) { return Registry.register(Registries.RECIPE_SERIALIZER, new Identifier(ExpandedDelight.MODID, name), recipe); } } diff --git a/src/main/java/com/ianm1647/expandeddelight/registry/ScreenHandlersRegistry.java b/src/main/java/com/ianm1647/expandeddelight/registry/ScreenHandlersRegistry.java index a0596ab..6996c98 100644 --- a/src/main/java/com/ianm1647/expandeddelight/registry/ScreenHandlersRegistry.java +++ b/src/main/java/com/ianm1647/expandeddelight/registry/ScreenHandlersRegistry.java @@ -3,10 +3,10 @@ import com.ianm1647.expandeddelight.ExpandedDelight; import com.ianm1647.expandeddelight.util.inventory.screen.JuicerScreen; import com.ianm1647.expandeddelight.util.inventory.screen.JuicerScreenHandler; - -import net.fabricmc.fabric.api.client.screenhandler.v1.ScreenRegistry; -import net.fabricmc.fabric.api.screenhandler.v1.ScreenHandlerRegistry; -import net.fabricmc.fabric.api.screenhandler.v1.ScreenHandlerRegistry.SimpleClientHandlerFactory; +import net.minecraft.client.gui.screen.ingame.HandledScreens; +import net.minecraft.registry.Registries; +import net.minecraft.registry.Registry; +import net.minecraft.resource.featuretoggle.FeatureSet; import net.minecraft.screen.ScreenHandler; import net.minecraft.screen.ScreenHandlerType; import net.minecraft.util.Identifier; @@ -19,10 +19,10 @@ public static void registerHandlers() { } public static void registerScreens() { - ScreenRegistry.register(JUICER_HANDLER, JuicerScreen::new); + HandledScreens.register(JUICER_HANDLER, JuicerScreen::new); } - private static ScreenHandlerType handler(String name, SimpleClientHandlerFactory handler) { - return ScreenHandlerRegistry.registerSimple(new Identifier(ExpandedDelight.MODID, name), handler); + private static ScreenHandlerType handler(String name, ScreenHandlerType.Factory handler) { + return Registry.register(Registries.SCREEN_HANDLER, new Identifier(ExpandedDelight.MODID, name), new ScreenHandlerType<>(handler, FeatureSet.empty())); } } diff --git a/src/main/java/com/ianm1647/expandeddelight/util/LootTableUtil.java b/src/main/java/com/ianm1647/expandeddelight/util/LootTableUtil.java index 49344a9..88197ae 100644 --- a/src/main/java/com/ianm1647/expandeddelight/util/LootTableUtil.java +++ b/src/main/java/com/ianm1647/expandeddelight/util/LootTableUtil.java @@ -4,6 +4,7 @@ import net.fabricmc.fabric.api.loot.v2.LootTableEvents; import net.minecraft.item.Item; import net.minecraft.loot.LootPool; +import net.minecraft.loot.LootTables; import net.minecraft.loot.condition.RandomChanceLootCondition; import net.minecraft.loot.entry.ItemEntry; import net.minecraft.loot.function.SetCountLootFunction; @@ -12,18 +13,12 @@ import net.minecraft.util.Identifier; public class LootTableUtil { - private static final Identifier DESERT_HOUSE = table(villageHouse("desert_house")); - private static final Identifier PLAINS_HOUSE = table(villageHouse("plains_house")); - private static final Identifier SAVANNA_HOUSE = table(villageHouse("savanna_house")); - private static final Identifier SNOWY_HOUSE = table(villageHouse("snowy_house")); - private static final Identifier TAIGA_HOUSE = table(villageHouse("taiga_house")); - public static void modifyLootTables() { - lootTable(DESERT_HOUSE, ItemList.ASPARAGUS_SEEDS, 0.5f, 1.0f, 3.0f); - lootTable(DESERT_HOUSE, ItemList.ASPARAGUS, 0.25f, 1.0f, 2.0f); - lootTable(SAVANNA_HOUSE, ItemList.SWEET_POTATO, 0.5f, 1.0f, 3.0f); - lootTable(SNOWY_HOUSE, ItemList.CHILI_PEPPER, 0.5f, 1.0f, 3.0f); - lootTable(SNOWY_HOUSE, ItemList.CHILI_PEPPER_SEEDS, 0.25f, 1.0f, 2.0f); + lootTable(LootTables.VILLAGE_DESERT_HOUSE_CHEST, ItemList.ASPARAGUS_SEEDS, 0.5f, 1.0f, 3.0f); + lootTable(LootTables.VILLAGE_DESERT_HOUSE_CHEST, ItemList.ASPARAGUS, 0.25f, 1.0f, 2.0f); + lootTable(LootTables.VILLAGE_SAVANNA_HOUSE_CHEST, ItemList.SWEET_POTATO, 0.5f, 1.0f, 3.0f); + lootTable(LootTables.VILLAGE_SNOWY_HOUSE_CHEST, ItemList.CHILI_PEPPER, 0.5f, 1.0f, 3.0f); + lootTable(LootTables.VILLAGE_SNOWY_HOUSE_CHEST, ItemList.CHILI_PEPPER_SEEDS, 0.25f, 1.0f, 2.0f); } private static void lootTable(Identifier identifier, Item item, float chance, float min, float max) { @@ -38,28 +33,4 @@ private static void lootTable(Identifier identifier, Item item, float chance, fl } })); } - - private static Identifier table(String file) { - return new Identifier("minecraft", file); - } - - private static String block(String type) { - return "blocks/" + type; - } - - private static String chest(String type) { - return "chests/" + type; - } - - private static String villageHouse(String type) { - return "chests/village/village_" + type; - } - - private static String entity(String type) { - return "entities/" + type; - } - - private static String fishing(String type) { - return "gameplay/fishing/" + type; - } } diff --git a/src/main/java/com/ianm1647/expandeddelight/util/inventory/screen/JuicerScreen.java b/src/main/java/com/ianm1647/expandeddelight/util/inventory/screen/JuicerScreen.java index 26109dc..4fd8abf 100644 --- a/src/main/java/com/ianm1647/expandeddelight/util/inventory/screen/JuicerScreen.java +++ b/src/main/java/com/ianm1647/expandeddelight/util/inventory/screen/JuicerScreen.java @@ -5,12 +5,11 @@ import net.minecraft.client.gui.DrawContext; import net.minecraft.client.gui.screen.ingame.HandledScreen; import net.minecraft.client.render.GameRenderer; -import net.minecraft.client.util.math.MatrixStack; import net.minecraft.entity.player.PlayerInventory; import net.minecraft.text.Text; import net.minecraft.util.Identifier; -public class JuicerScreen extends HandledScreen { +public class JuicerScreen extends HandledScreen { private static final Identifier TEXTURE = new Identifier(ExpandedDelight.MODID, "textures/gui/juicer_gui.png"); diff --git a/src/main/java/com/ianm1647/expandeddelight/util/recipe/JuicerRecipeSerializer.java b/src/main/java/com/ianm1647/expandeddelight/util/recipe/JuicerRecipeSerializer.java index 9649da9..f7a1f1e 100644 --- a/src/main/java/com/ianm1647/expandeddelight/util/recipe/JuicerRecipeSerializer.java +++ b/src/main/java/com/ianm1647/expandeddelight/util/recipe/JuicerRecipeSerializer.java @@ -8,7 +8,6 @@ import net.minecraft.recipe.RecipeSerializer; import net.minecraft.recipe.RecipeType; import net.minecraft.recipe.ShapedRecipe; -import net.minecraft.registry.DynamicRegistryManager; import net.minecraft.util.Identifier; import net.minecraft.util.JsonHelper; import net.minecraft.util.collection.DefaultedList; diff --git a/src/main/java/com/ianm1647/expandeddelight/world/ModFeatureGeneration.java b/src/main/java/com/ianm1647/expandeddelight/world/ModFeatureGeneration.java index 34b1f43..721936f 100644 --- a/src/main/java/com/ianm1647/expandeddelight/world/ModFeatureGeneration.java +++ b/src/main/java/com/ianm1647/expandeddelight/world/ModFeatureGeneration.java @@ -5,8 +5,6 @@ import net.fabricmc.fabric.api.biome.v1.BiomeModifications; import net.fabricmc.fabric.api.biome.v1.BiomeSelectors; import net.minecraft.registry.RegistryKey; -import net.minecraft.registry.tag.BiomeTags; -import net.minecraft.world.biome.Biome; import net.minecraft.world.biome.BiomeKeys; import net.minecraft.world.gen.GenerationStep; import net.minecraft.world.gen.feature.PlacedFeature; @@ -14,29 +12,29 @@ public class ModFeatureGeneration { public static void generateFeature() { - if (ExpandedDelight.CONFIG.generateAsparagus == true) { + if (ExpandedDelight.CONFIG.generateAsparagus) { BiomeModifications.addFeature(BiomeSelectors.includeByKey(BiomeKeys.PLAINS), GenerationStep.Feature.VEGETAL_DECORATION, ModPlacedFeatures.WILD_ASPARAGUS_PLACED); } - if (ExpandedDelight.CONFIG.generateSweetPotatoes == true) { + if (ExpandedDelight.CONFIG.generateSweetPotatoes) { BiomeModifications.addFeature(BiomeSelectors.includeByKey(BiomeKeys.JUNGLE), GenerationStep.Feature.VEGETAL_DECORATION, ModPlacedFeatures.WILD_SWEET_POTATO_PLACED); } - if (ExpandedDelight.CONFIG.generateChiliPeppers == true) { + if (ExpandedDelight.CONFIG.generateChiliPeppers) { BiomeModifications.addFeature(BiomeSelectors.includeByKey(BiomeKeys.DESERT), GenerationStep.Feature.VEGETAL_DECORATION, ModPlacedFeatures.WILD_CHILI_PEPPER_PLACED); } - if (ExpandedDelight.CONFIG.generatePeanuts == true) { + if (ExpandedDelight.CONFIG.generatePeanuts) { BiomeModifications.addFeature(BiomeSelectors.includeByKey(BiomeKeys.SAVANNA), GenerationStep.Feature.VEGETAL_DECORATION, ModPlacedFeatures.WILD_PEANUTS_PLACED); } - if (ExpandedDelight.CONFIG.generateCinnamonTrees == true) { + if (ExpandedDelight.CONFIG.generateCinnamonTrees) { BiomeModifications.addFeature(BiomeSelectors.includeByKey(BiomeKeys.JUNGLE), GenerationStep.Feature.VEGETAL_DECORATION, ModPlacedFeatures.CINNAMON_TREE_PLACED); } - if (ExpandedDelight.CONFIG.generateSaltOre == true) { + if (ExpandedDelight.CONFIG.generateSaltOre) { BiomeModifications.addFeature(BiomeSelectors.includeByKey(BiomeKeys.OCEAN, BiomeKeys.COLD_OCEAN), GenerationStep.Feature.UNDERGROUND_ORES, ModPlacedFeatures.SALT_ORE_PLACED); } diff --git a/src/main/java/com/ianm1647/expandeddelight/world/feature/ModPlacedFeatures.java b/src/main/java/com/ianm1647/expandeddelight/world/feature/ModPlacedFeatures.java index 0008416..9b764fe 100644 --- a/src/main/java/com/ianm1647/expandeddelight/world/feature/ModPlacedFeatures.java +++ b/src/main/java/com/ianm1647/expandeddelight/world/feature/ModPlacedFeatures.java @@ -32,17 +32,16 @@ public static void bootstrap(Registerable context) { VegetationPlacedFeatures.treeModifiersWithWouldSurvive(PlacedFeatures.createCountExtraModifier(1, 0.025f, 1), BlockList.CINNAMON_SAPLING)); register(context, SALT_ORE_PLACED, configuredFeatureRegistryEntryLookup.getOrThrow(ModConfiguredFeatures.SALT_ORE), - ModOreFeature.modifiersWithCount(6, - HeightRangePlacementModifier.uniform(YOffset.fixed(-20), YOffset.fixed(60)))); + ModOreFeature.modifiersWithCount(6, HeightRangePlacementModifier.uniform(YOffset.fixed(-20), YOffset.fixed(60)))); register(context, WILD_ASPARAGUS_PLACED, configuredFeatureRegistryEntryLookup.getOrThrow(ModConfiguredFeatures.WILD_ASPARAGUS), - RarityFilterPlacementModifier.of(12), SquarePlacementModifier.of(), PlacedFeatures.MOTION_BLOCKING_HEIGHTMAP, BiomePlacementModifier.of()); + List.of(RarityFilterPlacementModifier.of(12), SquarePlacementModifier.of(), PlacedFeatures.MOTION_BLOCKING_HEIGHTMAP, BiomePlacementModifier.of())); register(context, WILD_SWEET_POTATO_PLACED, configuredFeatureRegistryEntryLookup.getOrThrow(ModConfiguredFeatures.WILD_SWEET_POTATO), - RarityFilterPlacementModifier.of(12), SquarePlacementModifier.of(), PlacedFeatures.MOTION_BLOCKING_HEIGHTMAP, BiomePlacementModifier.of()); + List.of(RarityFilterPlacementModifier.of(12), SquarePlacementModifier.of(), PlacedFeatures.MOTION_BLOCKING_HEIGHTMAP, BiomePlacementModifier.of())); register(context, WILD_CHILI_PEPPER_PLACED, configuredFeatureRegistryEntryLookup.getOrThrow(ModConfiguredFeatures.WILD_CHILI_PEPPER), - RarityFilterPlacementModifier.of(12), SquarePlacementModifier.of(), PlacedFeatures.MOTION_BLOCKING_HEIGHTMAP, BiomePlacementModifier.of()); + List.of(RarityFilterPlacementModifier.of(12), SquarePlacementModifier.of(), PlacedFeatures.MOTION_BLOCKING_HEIGHTMAP, BiomePlacementModifier.of())); register(context, WILD_PEANUTS_PLACED, configuredFeatureRegistryEntryLookup.getOrThrow(ModConfiguredFeatures.WILD_PEANUTS), - RarityFilterPlacementModifier.of(12), SquarePlacementModifier.of(), PlacedFeatures.MOTION_BLOCKING_HEIGHTMAP, BiomePlacementModifier.of()); + List.of(RarityFilterPlacementModifier.of(12), SquarePlacementModifier.of(), PlacedFeatures.MOTION_BLOCKING_HEIGHTMAP, BiomePlacementModifier.of())); } @@ -50,14 +49,7 @@ public static RegistryKey registerPlacedKey(String name) { return RegistryKey.of(RegistryKeys.PLACED_FEATURE, new Identifier(ExpandedDelight.MODID, name)); } - private static void register(Registerable context, RegistryKey key, RegistryEntry> configuration, - List modifiers) { - context.register(key, new PlacedFeature(configuration, List.copyOf(modifiers))); - } - - private static > void register(Registerable context, RegistryKey key, - RegistryEntry> configuration, - PlacementModifier... modifiers) { - register(context, key, configuration, List.of(modifiers)); + private static void register(Registerable context, RegistryKey key, RegistryEntry> configuration, List modifiers) { + context.register(key, new PlacedFeature(configuration, modifiers)); } } diff --git a/src/main/resources/fabric.mod.json b/src/main/resources/fabric.mod.json index cb247ac..a2d119c 100644 --- a/src/main/resources/fabric.mod.json +++ b/src/main/resources/fabric.mod.json @@ -8,8 +8,8 @@ "ianm1647" ], "contact": { - "homepage": "https://fabricmc.net/", - "sources": "https://github.com/ianm1647/expandeddelight" + "sources": "https://github.com/ianm1647/expandeddelight", + "issues": "https://github.com/ianm1647/expandeddelight/issues" }, "license": "MIT", "icon": "assets/expandeddelight/logo.png", @@ -30,10 +30,9 @@ }, "depends": { - "fabricloader": ">=0.14.21", - "fabric": "*", + "fabricloader": ">=0.14", + "fabric-api": "*", "minecraft": "~1.20", - "java": ">=17", "farmersdelight": "*" } }