diff --git a/.github/CONTRIBUTING.md b/.github/CONTRIBUTING.md index d8ecf0c..ef40699 100644 --- a/.github/CONTRIBUTING.md +++ b/.github/CONTRIBUTING.md @@ -162,11 +162,6 @@ The build workflow takes care of the following: - Running a Gradle build, running our tests in the process and generating an aggregated code coverage report for the API modules. -- Analyzing the code on SonarQube. - > Because of - > [limitations with SonarQube](https://portal.productboard.com/sonarsource/1-sonarcloud/c/50-sonarcloud-analyzes-external-pull-request), - > pull requests originating from a fork aren't analyzed on SonarQube. - - Code style validation with Checkstyle. - Mutation and line coverage test with Pitest. - Uploading the artifacts on the action. diff --git a/.github/ISSUE_TEMPLATE/bug_report.yml b/.github/ISSUE_TEMPLATE/bug_report.yml index 6d1353b..693e35a 100644 --- a/.github/ISSUE_TEMPLATE/bug_report.yml +++ b/.github/ISSUE_TEMPLATE/bug_report.yml @@ -37,6 +37,8 @@ body: options: - Minecraft 1.19.2 - Minecraft 1.20.1 + - Minecraft 1.20.4 + - Minecraft 1.21 validations: required: true - type: input diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml index 8ac7ae7..1a120cf 100644 --- a/.github/workflows/build.yml +++ b/.github/workflows/build.yml @@ -8,7 +8,7 @@ on: types: [ opened, synchronize, reopened ] jobs: build: - uses: refinedmods/refinedarchitect/.github/workflows/build.yml@v0.11.3 + uses: refinedmods/refinedarchitect/.github/workflows/build.yml@v0.15.3 with: mutation-testing: false sonarqube: false diff --git a/.github/workflows/draft-release.yml b/.github/workflows/draft-release.yml index 196cb28..f066a48 100644 --- a/.github/workflows/draft-release.yml +++ b/.github/workflows/draft-release.yml @@ -17,7 +17,7 @@ on: type: string jobs: draft: - uses: refinedmods/refinedarchitect/.github/workflows/draft-release.yml@v0.11.3 + uses: refinedmods/refinedarchitect/.github/workflows/draft-release.yml@v0.15.3 with: release-type: ${{ inputs.release-type }} version-number-override: ${{ inputs.version-number-override }} diff --git a/.github/workflows/issue-for-unsupported-version.yml b/.github/workflows/issue-for-unsupported-version.yml index 1fc7129..fbe9339 100644 --- a/.github/workflows/issue-for-unsupported-version.yml +++ b/.github/workflows/issue-for-unsupported-version.yml @@ -4,4 +4,4 @@ on: types: [ labeled, unlabeled, reopened ] jobs: unsupported-labeler: - uses: refinedmods/refinedarchitect/.github/workflows/issue-for-unsupported-version.yml@v0.11.3 \ No newline at end of file + uses: refinedmods/refinedarchitect/.github/workflows/issue-for-unsupported-version.yml@v0.15.3 \ No newline at end of file diff --git a/.github/workflows/publish-release.yml b/.github/workflows/publish-release.yml index a9de795..371e7a4 100644 --- a/.github/workflows/publish-release.yml +++ b/.github/workflows/publish-release.yml @@ -7,7 +7,7 @@ on: - closed jobs: publish-release: - uses: refinedmods/refinedarchitect/.github/workflows/publish-release.yml@v0.11.3 + uses: refinedmods/refinedarchitect/.github/workflows/publish-release.yml@v0.15.3 secrets: inherit with: project-name: 'Ranged Pumps' diff --git a/.github/workflows/resolved-issue-locking.yml b/.github/workflows/resolved-issue-locking.yml index 8d3457d..d81c8f6 100644 --- a/.github/workflows/resolved-issue-locking.yml +++ b/.github/workflows/resolved-issue-locking.yml @@ -4,4 +4,4 @@ on: - cron: '0 0 * * *' jobs: lock: - uses: refinedmods/refinedarchitect/.github/workflows/resolved-issue-locking.yml@v0.11.3 \ No newline at end of file + uses: refinedmods/refinedarchitect/.github/workflows/resolved-issue-locking.yml@v0.15.3 \ No newline at end of file diff --git a/.github/workflows/validate-branch-name.yml b/.github/workflows/validate-branch-name.yml index b3852e5..3786119 100644 --- a/.github/workflows/validate-branch-name.yml +++ b/.github/workflows/validate-branch-name.yml @@ -2,4 +2,4 @@ name: Validate branch name on: [ pull_request ] jobs: validate-branch-name: - uses: refinedmods/refinedarchitect/.github/workflows/validate-branch-name.yml@v0.11.3 \ No newline at end of file + uses: refinedmods/refinedarchitect/.github/workflows/validate-branch-name.yml@v0.15.3 \ No newline at end of file diff --git a/.github/workflows/validate-changelog.yml b/.github/workflows/validate-changelog.yml index 58cbc6a..b74a6d5 100644 --- a/.github/workflows/validate-changelog.yml +++ b/.github/workflows/validate-changelog.yml @@ -4,6 +4,6 @@ on: types: [ opened, synchronize, reopened, ready_for_review, labeled, unlabeled ] jobs: validate-changelog: - uses: refinedmods/refinedarchitect/.github/workflows/validate-changelog.yml@v0.11.3 + uses: refinedmods/refinedarchitect/.github/workflows/validate-changelog.yml@v0.15.3 with: validation-level: 'warn' \ No newline at end of file diff --git a/.github/workflows/validate-commit-messages.yml b/.github/workflows/validate-commit-messages.yml index f08e600..cc3220c 100644 --- a/.github/workflows/validate-commit-messages.yml +++ b/.github/workflows/validate-commit-messages.yml @@ -2,4 +2,4 @@ name: Validate commit messages on: [ pull_request ] jobs: validate-commit-messages: - uses: refinedmods/refinedarchitect/.github/workflows/validate-commit-messages.yml@v0.11.3 \ No newline at end of file + uses: refinedmods/refinedarchitect/.github/workflows/validate-commit-messages.yml@v0.15.3 \ No newline at end of file diff --git a/.gitignore b/.gitignore index 1353ebd..32c9771 100644 --- a/.gitignore +++ b/.gitignore @@ -7,7 +7,7 @@ eclipse/ .nb-gradle-properties .project *.launch -runs/ +run/ *.iml *.ipr *.iws diff --git a/CHANGELOG.md b/CHANGELOG.md index 25d0a00..73ba3b3 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -7,6 +7,13 @@ to [Semantic Versioning](https://semver.org/spec/v2.0.0.html). ## [Unreleased] +## [1.3.0] - 2024-07-06 + +### Changed + +- Ported to Minecraft 1.21. +- Korean translation updated by [@gisellevonbingen](https://github.com/gisellevonbingen). + ## [1.2.0] - 2024-01-29 ### Changed @@ -146,7 +153,9 @@ to [Semantic Versioning](https://semver.org/spec/v2.0.0.html). - Initial release for Minecraft 1.10.2. -[Unreleased]: https://github.com/refinedmods/rangedpumps/compare/v1.2.0...HEAD +[Unreleased]: https://github.com/refinedmods/rangedpumps/compare/v1.3.0...HEAD + +[1.3.0]: https://github.com/refinedmods/rangedpumps/compare/v1.2.0...v1.3.0 [1.2.0]: https://github.com/refinedmods/rangedpumps/compare/v1.1.0...v1.2.0 diff --git a/build.gradle b/build.gradle index 1ba732c..0cc2816 100644 --- a/build.gradle +++ b/build.gradle @@ -1,8 +1,8 @@ -apply from: "https://raw.githubusercontent.com/refinedmods/refinedarchitect/v0.11.3/helper.gradle" +apply from: "https://raw.githubusercontent.com/refinedmods/refinedarchitect/v0.15.3/helper.gradle" group = 'com.refinedmods' -forgeProject("rangedpumps") +neoForgeProject("rangedpumps") archivesBaseName = 'rangedpumps' diff --git a/config/intellij-code-style.xml b/config/intellij-code-style.xml new file mode 100644 index 0000000..49b79c2 --- /dev/null +++ b/config/intellij-code-style.xml @@ -0,0 +1,66 @@ + + + + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/docs/pages/whats-new.html b/docs/pages/whats-new.html index a52b2eb..f0829ec 100644 --- a/docs/pages/whats-new.html +++ b/docs/pages/whats-new.html @@ -5,58 +5,61 @@
-
- -
+

Other releases

diff --git a/gradle.properties b/gradle.properties index 878bf1f..a8d260d 100644 --- a/gradle.properties +++ b/gradle.properties @@ -1,4 +1,2 @@ -# Sets default memory used for gradle commands. Can be overridden by user or command line properties. -# This is required to provide enough memory for the Minecraft decompilation process. -org.gradle.jvmargs=-Xmx3G -org.gradle.daemon=false \ No newline at end of file +# Gradle +org.gradle.jvmargs=-Xmx1G diff --git a/gradle/wrapper/gradle-wrapper.properties b/gradle/wrapper/gradle-wrapper.properties index 1af9e09..a441313 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.5-bin.zip +distributionUrl=https\://services.gradle.org/distributions/gradle-8.8-bin.zip networkTimeout=10000 validateDistributionUrl=true zipStoreBase=GRADLE_USER_HOME diff --git a/src/main/java/com/refinedmods/rangedpumps/RangedPumps.java b/src/main/java/com/refinedmods/rangedpumps/RangedPumps.java index 5b7037f..ef69dd2 100644 --- a/src/main/java/com/refinedmods/rangedpumps/RangedPumps.java +++ b/src/main/java/com/refinedmods/rangedpumps/RangedPumps.java @@ -3,7 +3,6 @@ import com.refinedmods.rangedpumps.block.PumpBlock; import com.refinedmods.rangedpumps.blockentity.PumpBlockEntity; import com.refinedmods.rangedpumps.config.ServerConfig; - import net.minecraft.core.registries.BuiltInRegistries; import net.minecraft.core.registries.Registries; import net.minecraft.network.chat.Component; @@ -15,7 +14,7 @@ import net.minecraft.world.level.block.Block; import net.minecraft.world.level.block.entity.BlockEntityType; import net.neoforged.bus.api.IEventBus; -import net.neoforged.fml.ModLoadingContext; +import net.neoforged.fml.ModContainer; import net.neoforged.fml.common.Mod; import net.neoforged.fml.config.ModConfig; import net.neoforged.neoforge.capabilities.Capabilities; @@ -40,9 +39,9 @@ public final class RangedPumps { public static final ServerConfig SERVER_CONFIG = new ServerConfig(); - public RangedPumps(final IEventBus eventBus) { + public RangedPumps(final IEventBus eventBus, final ModContainer container) { ITEMS.register("pump", () -> new BlockItem(PUMP_BLOCK.get(), new Item.Properties())); - ModLoadingContext.get().registerConfig(ModConfig.Type.SERVER, SERVER_CONFIG.getSpec()); + container.registerConfig(ModConfig.Type.SERVER, SERVER_CONFIG.getSpec()); BLOCKS.register(eventBus); ITEMS.register(eventBus); BLOCK_ENTITY_TYPES.register(eventBus); @@ -65,7 +64,7 @@ public static void onRegisterCapabilities(RegisterCapabilitiesEvent e) { public static void onRegister(RegisterEvent e) { e.register(Registries.CREATIVE_MODE_TAB, helper -> { - helper.register(new ResourceLocation(RangedPumps.ID, "general"), CreativeModeTab.builder() + helper.register(ResourceLocation.fromNamespaceAndPath(RangedPumps.ID, "general"), CreativeModeTab.builder() .title(Component.translatable("itemGroup.rangedpumps")) .icon(() -> new ItemStack(RangedPumps.PUMP_BLOCK.get())) .displayItems((params, output) -> { diff --git a/src/main/java/com/refinedmods/rangedpumps/block/PumpBlock.java b/src/main/java/com/refinedmods/rangedpumps/block/PumpBlock.java index 568f0f3..c7a5827 100644 --- a/src/main/java/com/refinedmods/rangedpumps/block/PumpBlock.java +++ b/src/main/java/com/refinedmods/rangedpumps/block/PumpBlock.java @@ -27,9 +27,12 @@ public PumpBlock() { super(Block.Properties.of().strength(1.9F).sound(SoundType.STONE)); } - @SuppressWarnings("deprecation") - public InteractionResult use(BlockState state, Level level, BlockPos pos, Player player, InteractionHand hand, - BlockHitResult hit) { + @Override + protected InteractionResult useWithoutItem(final BlockState state, + final Level level, + final BlockPos pos, + final Player player, + final BlockHitResult hitResult) { if (!level.isClientSide) { BlockEntity blockEntity = level.getBlockEntity(pos); @@ -54,7 +57,7 @@ public InteractionResult use(BlockState state, Level level, BlockPos pos, Player energy.getEnergyStored(), energy.getMaxEnergyStored())); } else { player.sendSystemMessage(Component.translatable("block." + RangedPumps.ID + ".pump.state", - pump.getTank().getFluidAmount(), pump.getTank().getFluid().getDisplayName(), + pump.getTank().getFluidAmount(), pump.getTank().getFluid().getHoverName(), energy.getEnergyStored(), energy.getMaxEnergyStored())); } } diff --git a/src/main/java/com/refinedmods/rangedpumps/blockentity/PumpBlockEntity.java b/src/main/java/com/refinedmods/rangedpumps/blockentity/PumpBlockEntity.java index 433bab4..de98307 100644 --- a/src/main/java/com/refinedmods/rangedpumps/blockentity/PumpBlockEntity.java +++ b/src/main/java/com/refinedmods/rangedpumps/blockentity/PumpBlockEntity.java @@ -10,6 +10,7 @@ import net.minecraft.core.BlockPos; import net.minecraft.core.Direction; +import net.minecraft.core.HolderLookup; import net.minecraft.core.registries.BuiltInRegistries; import net.minecraft.nbt.CompoundTag; import net.minecraft.nbt.ListTag; @@ -27,7 +28,6 @@ import net.neoforged.neoforge.energy.IEnergyStorage; import net.neoforged.neoforge.fluids.FluidStack; import net.neoforged.neoforge.fluids.FluidType; -import net.neoforged.neoforge.fluids.IFluidBlock; import net.neoforged.neoforge.fluids.capability.IFluidHandler; import net.neoforged.neoforge.fluids.capability.templates.FluidTank; @@ -157,7 +157,7 @@ public void tick() { if (RangedPumps.SERVER_CONFIG.getReplaceLiquidWithBlock()) { if (blockToReplaceLiquidsWith == null) { blockToReplaceLiquidsWith = BuiltInRegistries.BLOCK.get( - new ResourceLocation(RangedPumps.SERVER_CONFIG.getBlockIdToReplaceLiquidsWith()) + ResourceLocation.parse(RangedPumps.SERVER_CONFIG.getBlockIdToReplaceLiquidsWith()) ); } @@ -181,23 +181,15 @@ private FluidStack drainAt(BlockPos pos, IFluidHandler.FluidAction action) { BlockState frontBlockState = level.getBlockState(pos); Block frontBlock = frontBlockState.getBlock(); - if (frontBlock instanceof LiquidBlock) { - // @Volatile: Logic from LiquidBlock#pickupFluid + if (frontBlock instanceof LiquidBlock liquidBlock) { + // @Volatile: Logic from LiquidBlock#pickupBlock if (frontBlockState.getValue(LiquidBlock.LEVEL) == 0) { - Fluid fluid = ((LiquidBlock) frontBlock).getFluid(); - + Fluid fluid = liquidBlock.fluid; if (action == IFluidHandler.FluidAction.EXECUTE) { level.setBlock(pos, Blocks.AIR.defaultBlockState(), 11); } - return new FluidStack(fluid, FluidType.BUCKET_VOLUME); } - } else if (frontBlock instanceof IFluidBlock) { - IFluidBlock fluidBlock = (IFluidBlock) frontBlock; - - if (fluidBlock.canDrain(level, pos)) { - return fluidBlock.drain(level, pos, action); - } } return FluidStack.EMPTY; @@ -214,7 +206,7 @@ int getRange() { PumpState getState() { if (range > RangedPumps.SERVER_CONFIG.getRange()) { return PumpState.DONE; - } else if (level.hasNeighborSignal(worldPosition)) { + } else if (level != null && level.hasNeighborSignal(worldPosition)) { return PumpState.REDSTONE; } else if (energy.getEnergyStored() == 0) { return PumpState.ENERGY; @@ -234,8 +226,8 @@ public IEnergyStorage getEnergy() { } @Override - public void saveAdditional(CompoundTag tag) { - super.saveAdditional(tag); + public void saveAdditional(CompoundTag tag, HolderLookup.Provider provider) { + super.saveAdditional(tag, provider); tag.putInt("Energy", energy.getEnergyStored()); @@ -251,12 +243,12 @@ public void saveAdditional(CompoundTag tag) { tag.put("Surfaces", surfaces); - tank.writeToNBT(tag); + tank.writeToNBT(provider, tag); } @Override - public void load(CompoundTag tag) { - super.load(tag); + public void loadAdditional(CompoundTag tag, HolderLookup.Provider provider) { + super.loadAdditional(tag, provider); if (tag.contains("Energy")) { energy.receiveEnergy(tag.getInt("Energy"), false); @@ -278,7 +270,7 @@ public void load(CompoundTag tag) { } } - tank.readFromNBT(tag); + tank.readFromNBT(provider, tag); } private static class PumpTank extends FluidTank { diff --git a/src/main/resources/META-INF/mods.toml b/src/main/resources/META-INF/neoforge.mods.toml similarity index 100% rename from src/main/resources/META-INF/mods.toml rename to src/main/resources/META-INF/neoforge.mods.toml diff --git a/src/main/resources/assets/rangedpumps/lang/ko_kr.json b/src/main/resources/assets/rangedpumps/lang/ko_kr.json index d78a705..d483d60 100644 --- a/src/main/resources/assets/rangedpumps/lang/ko_kr.json +++ b/src/main/resources/assets/rangedpumps/lang/ko_kr.json @@ -1,11 +1,11 @@ { - "itemGroup.rangedpumps": "랜지드 펌프", + "itemGroup.rangedpumps": "Ranged Pumps", "block.rangedpumps.pump": "펌프", - "block.rangedpumps.pump.state": "%s의 %d mB - %d / %d FE", - "block.rangedpumps.pump.state_empty": "비어 있음 - %d / %d FE", + "block.rangedpumps.pump.state": "%2$s %1$d mb - %3$d / %4$d FE", + "block.rangedpumps.pump.state_empty": "비어있음 - %d / %d FE", "block.rangedpumps.pump.state.energy": "에너지가 부족합니다.", - "block.rangedpumps.pump.state.redstone": "레드스톤 신호로 인해 작동하지 않습니다.", - "block.rangedpumps.pump.state.working": "%d, %d, %d(범위: %d / %d)에서 검색 중입니다.", + "block.rangedpumps.pump.state.redstone": "레드스톤 신호로 인해 동작하지 않습니다.", + "block.rangedpumps.pump.state.working": "스캔 중 입니다: %d, %d, %d (범위: %d / 전체: %d).", "block.rangedpumps.pump.state.full": "내부 탱크가 가득 찼습니다.", - "block.rangedpumps.pump.state.done": "끝났습니다." + "block.rangedpumps.pump.state.done": "완료했습니다." } diff --git a/src/main/resources/data/rangedpumps/loot_tables/blocks/pump.json b/src/main/resources/data/rangedpumps/loot_table/blocks/pump.json similarity index 100% rename from src/main/resources/data/rangedpumps/loot_tables/blocks/pump.json rename to src/main/resources/data/rangedpumps/loot_table/blocks/pump.json diff --git a/src/main/resources/data/rangedpumps/recipes/pump.json b/src/main/resources/data/rangedpumps/recipe/pump.json similarity index 92% rename from src/main/resources/data/rangedpumps/recipes/pump.json rename to src/main/resources/data/rangedpumps/recipe/pump.json index 4c062c6..875c02d 100644 --- a/src/main/resources/data/rangedpumps/recipes/pump.json +++ b/src/main/resources/data/rangedpumps/recipe/pump.json @@ -23,6 +23,6 @@ } }, "result": { - "item": "rangedpumps:pump" + "id": "rangedpumps:pump" } } \ No newline at end of file