From 61615a61cc228b2c44cfdb58eac29d884baeade4 Mon Sep 17 00:00:00 2001 From: Ruben Taelman Date: Thu, 26 Dec 2024 15:53:03 +0100 Subject: [PATCH] Update to MC 1.12.4 --- build.gradle | 7 +++--- .../src/main/groovy/multiloader-common.gradle | 1 + .../groovy/multiloader-loader-common.gradle | 2 +- .../groovy/multiloader-loader-neoforge.gradle | 6 ++--- gradle.properties | 20 ++++++++-------- gradle/wrapper/gradle-wrapper.properties | 2 +- .../cyclops/flopper/block/BlockFlopper.java | 23 ++++++++----------- .../flopper/block/BlockFlopperConfig.java | 5 ++-- .../blockentity/BlockEntityFlopper.java | 4 ++-- .../assets/flopper/items/flopper.json | 6 +++++ .../data/flopper/recipe/flopper.json | 9 +++----- .../src/main/resources/flopper.accesswidener | 5 ++++ .../block/BlockFlopperConfigFabric.java | 3 +-- .../flopper/block/BlockFlopperFabric.java | 17 +++++++------- .../BlockEntityFlopperConfigFabric.java | 6 ++--- .../blockentity/BlockEntityFlopperFabric.java | 4 ++-- .../org/cyclops/flopper/FlopperForge.java | 5 ++-- .../block/BlockFlopperConfigForge.java | 3 +-- .../flopper/block/BlockFlopperForge.java | 17 +++++++------- .../BlockEntityFlopperConfigForge.java | 2 +- .../blockentity/BlockEntityFlopperForge.java | 4 ++-- .../data/flopper/recipe/flopper.json | 19 --------------- .../org/cyclops/flopper/FlopperNeoForge.java | 8 +++---- .../block/BlockFlopperConfigNeoForge.java | 7 +++--- .../flopper/block/BlockFlopperNeoForge.java | 17 +++++++------- .../BlockEntityFlopperConfigNeoForge.java | 6 ++--- .../BlockEntityFlopperNeoForge.java | 4 ++-- .../flopper/proxy/ClientProxyNeoForge.java | 4 ++-- .../flopper/proxy/CommonProxyNeoForge.java | 4 ++-- .../data/flopper/recipe/flopper.json | 19 --------------- 30 files changed, 102 insertions(+), 137 deletions(-) create mode 100644 loader-common/src/main/resources/assets/flopper/items/flopper.json rename {loader-fabric => loader-common}/src/main/resources/data/flopper/recipe/flopper.json (63%) delete mode 100644 loader-forge/src/main/resources/data/flopper/recipe/flopper.json delete mode 100644 loader-neoforge/src/main/resources/data/flopper/recipe/flopper.json diff --git a/build.gradle b/build.gradle index f16b815..084fd0e 100644 --- a/build.gradle +++ b/build.gradle @@ -3,8 +3,9 @@ plugins { id 'com.diffplug.spotless' version '6.25.0' apply false id 'com.modrinth.minotaur' version '2.+' apply false - id 'fabric-loom' version '1.7-SNAPSHOT' apply false - id 'net.neoforged.moddev' version '0.1.110' apply false - id 'net.neoforged.gradle.userdev' version '7.0.145' apply false + id 'fabric-loom' version '1.9-SNAPSHOT' apply false + id 'net.neoforged.moddev' version '2.0.61-beta' apply false + id 'net.neoforged.gradle.userdev' version '7.0.171' apply false // id 'net.minecraftforge.gradle' version '[6.0.24,6.2)' apply false // Don't load yet to fix DiffPatch conflict issue between FG and NG } + diff --git a/buildSrc/src/main/groovy/multiloader-common.gradle b/buildSrc/src/main/groovy/multiloader-common.gradle index c7c7797..e13610c 100644 --- a/buildSrc/src/main/groovy/multiloader-common.gradle +++ b/buildSrc/src/main/groovy/multiloader-common.gradle @@ -73,6 +73,7 @@ java { withSourcesJar() withJavadocJar() } +compileJava.options.compilerArgs << "-Xmaxerrs" << "9999" repositories { mavenLocal() diff --git a/buildSrc/src/main/groovy/multiloader-loader-common.gradle b/buildSrc/src/main/groovy/multiloader-loader-common.gradle index 36d488f..7670936 100644 --- a/buildSrc/src/main/groovy/multiloader-loader-common.gradle +++ b/buildSrc/src/main/groovy/multiloader-loader-common.gradle @@ -10,7 +10,7 @@ neoForge { // Automatically enable AccessTransformers if the file exists def at = file('src/main/resources/META-INF/accesstransformer.cfg') if (at.exists()) { - accessTransformers.add(at.absolutePath) + accessTransformers.from(at.absolutePath) } parchment { minecraftVersion = parchment_minecraft_version diff --git a/buildSrc/src/main/groovy/multiloader-loader-neoforge.gradle b/buildSrc/src/main/groovy/multiloader-loader-neoforge.gradle index af521fd..2d98cb9 100644 --- a/buildSrc/src/main/groovy/multiloader-loader-neoforge.gradle +++ b/buildSrc/src/main/groovy/multiloader-loader-neoforge.gradle @@ -64,15 +64,15 @@ runs { server { systemProperty 'neoforge.enabledGameTestNamespaces', "cyclopscore,${mod_id}" - programArgument '--nogui' + argument '--nogui' } gameTestServer { systemProperty 'neoforge.enabledGameTestNamespaces', "cyclopscore,${mod_id}" } - data { - programArguments.addAll '--mod', mod_id, '--all', '--output', file('src/generated/resources/').getAbsolutePath(), '--existing', file('src/main/resources/').getAbsolutePath() + clientData { + arguments.addAll '--mod', mod_id, '--all', '--output', file('src/generated/resources/').getAbsolutePath(), '--existing', file('src/main/resources/').getAbsolutePath() } } diff --git a/gradle.properties b/gradle.properties index c51f582..8c831e4 100644 --- a/gradle.properties +++ b/gradle.properties @@ -4,7 +4,7 @@ group=org.cyclops.flopper java_version=21 # Common -minecraft_version=1.21.1 +minecraft_version=1.21.4 mod_name=Flopper mod_author=rubensworks (aka kroeser) mod_id=flopper @@ -14,25 +14,25 @@ issue_tracker_url=https://github.com/CyclopsMC/Flopper/issues display_url=https://www.curseforge.com/minecraft/mc-mods/flopper description=The Flopper is an early-game block to move around fluids, just like the Hopper does for items. fingerprint=bd0353b3e8a2810d60dd584e256e364bc3bedd44 -neo_form_version=1.21-20240613.152323 -parchment_version=2024.06.23 -parchment_minecraft_version=1.21 +neo_form_version=1.21.4-20241203.161809 +parchment_version=2024.12.07 +parchment_minecraft_version=1.21.4 curseforge_project_id=290404 modrinth_project_id=aTMAqQMY # Fabric -fabric_version=0.102.1+1.21.1 -fabric_loader_version=0.15.11 +fabric_version=0.112.2+1.21.4 +fabric_loader_version=0.16.9 # Dependencies -fabric_forgeconfigapiport_version=21.1.0 +fabric_forgeconfigapiport_version=21.4.1 # NeoForge -neoforge_version=21.1.2 +neoforge_version=21.4.33-beta neoforge_loader_version_range=[4,) neoforge_update_json_url=https://raw.githubusercontent.com/CyclopsMC/Versions/master/neoforge_update/flopper.json # Forge -forge_version=52.0.24 +forge_version=54.0.7 forge_loader_version_range=[2,) forge_update_json_url=https://raw.githubusercontent.com/CyclopsMC/Versions/master/forge_update/flopper.json @@ -42,4 +42,4 @@ org.gradle.daemon=false org.gradle.caching=true # Common dependencies -cyclopscore_version=1.25.2-634 +cyclopscore_version=1.25.5-689 diff --git a/gradle/wrapper/gradle-wrapper.properties b/gradle/wrapper/gradle-wrapper.properties index 2617362..21d5e09 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.8-bin.zip +distributionUrl=https\://services.gradle.org/distributions/gradle-8.11-bin.zip networkTimeout=10000 zipStoreBase=GRADLE_USER_HOME zipStorePath=wrapper/dists diff --git a/loader-common/src/main/java/org/cyclops/flopper/block/BlockFlopper.java b/loader-common/src/main/java/org/cyclops/flopper/block/BlockFlopper.java index 158739d..37935b5 100644 --- a/loader-common/src/main/java/org/cyclops/flopper/block/BlockFlopper.java +++ b/loader-common/src/main/java/org/cyclops/flopper/block/BlockFlopper.java @@ -5,11 +5,7 @@ import net.minecraft.world.item.context.BlockPlaceContext; import net.minecraft.world.level.BlockGetter; import net.minecraft.world.level.Level; -import net.minecraft.world.level.block.BaseEntityBlock; -import net.minecraft.world.level.block.Block; -import net.minecraft.world.level.block.Mirror; -import net.minecraft.world.level.block.RenderShape; -import net.minecraft.world.level.block.Rotation; +import net.minecraft.world.level.block.*; import net.minecraft.world.level.block.entity.BlockEntity; import net.minecraft.world.level.block.entity.BlockEntityTicker; import net.minecraft.world.level.block.entity.BlockEntityType; @@ -18,14 +14,15 @@ import net.minecraft.world.level.block.state.StateDefinition; import net.minecraft.world.level.block.state.properties.BlockStateProperties; import net.minecraft.world.level.block.state.properties.BooleanProperty; -import net.minecraft.world.level.block.state.properties.DirectionProperty; +import net.minecraft.world.level.block.state.properties.EnumProperty; import net.minecraft.world.level.pathfinder.PathComputationType; +import net.minecraft.world.level.redstone.Orientation; import net.minecraft.world.phys.shapes.BooleanOp; import net.minecraft.world.phys.shapes.CollisionContext; import net.minecraft.world.phys.shapes.Shapes; import net.minecraft.world.phys.shapes.VoxelShape; -import org.cyclops.cyclopscore.block.BlockWithEntityCommon; -import org.cyclops.cyclopscore.blockentity.CyclopsBlockEntityCommon; +import org.cyclops.cyclopscore.block.BlockWithEntity; +import org.cyclops.cyclopscore.blockentity.CyclopsBlockEntity; import org.cyclops.cyclopscore.helper.IModHelpers; import org.cyclops.flopper.RegistryEntries; import org.cyclops.flopper.blockentity.BlockEntityFlopper; @@ -37,9 +34,9 @@ * Fluid hopper block. * @author rubensworks */ -public abstract class BlockFlopper extends BlockWithEntityCommon { +public abstract class BlockFlopper extends BlockWithEntity { - public static final DirectionProperty FACING = BlockStateProperties.FACING_HOPPER; + public static final EnumProperty FACING = BlockStateProperties.FACING_HOPPER; public static final BooleanProperty ENABLED = BlockStateProperties.ENABLED; // Copied from HopperBlock, to avoid conflicts with other mods messing with the hopper @@ -59,7 +56,7 @@ public abstract class BlockFlopper extends BlockWithEntityCommon { private static final VoxelShape SOUTH_INTERACTION_SHAPE = Shapes.or(INSIDE, Block.box(6.0, 8.0, 12.0, 10.0, 10.0, 16.0)); private static final VoxelShape WEST_INTERACTION_SHAPE = Shapes.or(INSIDE, Block.box(0.0, 8.0, 6.0, 4.0, 10.0, 10.0)); - public BlockFlopper(BlockBehaviour.Properties properties, BiFunction blockEntitySupplier) { + public BlockFlopper(BlockBehaviour.Properties properties, BiFunction blockEntitySupplier) { super(properties, blockEntitySupplier); this.registerDefaultState(this.stateDefinition.any() .setValue(FACING, Direction.DOWN) @@ -135,8 +132,8 @@ public void onPlace(BlockState state, Level worldIn, BlockPos pos, BlockState ol } @Override - public void neighborChanged(BlockState state, Level worldIn, BlockPos pos, Block blockIn, BlockPos fromPos, boolean isMoving) { - super.neighborChanged(state, worldIn, pos, blockIn, fromPos, isMoving); + public void neighborChanged(BlockState state, Level worldIn, BlockPos pos, Block neighbourBlock, @Nullable Orientation orientation, boolean isMoving) { + super.neighborChanged(state, worldIn, pos, neighbourBlock, orientation, isMoving); this.updateState(worldIn, pos, state); } diff --git a/loader-common/src/main/java/org/cyclops/flopper/block/BlockFlopperConfig.java b/loader-common/src/main/java/org/cyclops/flopper/block/BlockFlopperConfig.java index 9b09499..8028406 100644 --- a/loader-common/src/main/java/org/cyclops/flopper/block/BlockFlopperConfig.java +++ b/loader-common/src/main/java/org/cyclops/flopper/block/BlockFlopperConfig.java @@ -1,12 +1,13 @@ package org.cyclops.flopper.block; import net.minecraft.world.level.block.Block; +import net.minecraft.world.level.block.state.BlockBehaviour; import org.cyclops.cyclopscore.config.ConfigurablePropertyCommon; import org.cyclops.cyclopscore.config.ModConfigLocation; import org.cyclops.cyclopscore.config.extendedconfig.BlockConfigCommon; import org.cyclops.cyclopscore.init.IModBase; -import java.util.function.Function; +import java.util.function.BiFunction; /** * Config for the {@link BlockFlopper}. @@ -48,7 +49,7 @@ public class BlockFlopperConfig extends BlockConfigCommon @ConfigurablePropertyCommon(category = "machine", comment = "If a status message with the flopper contents should be shown to the player on right click without an item.", isCommandable = true) public static boolean showContentsStatusMessageOnClick = true; - public BlockFlopperConfig(M mod, Function, ? extends Block> blockConstructor) { + public BlockFlopperConfig(M mod, BiFunction, BlockBehaviour.Properties, ? extends Block> blockConstructor) { super( mod, "flopper", diff --git a/loader-common/src/main/java/org/cyclops/flopper/blockentity/BlockEntityFlopper.java b/loader-common/src/main/java/org/cyclops/flopper/blockentity/BlockEntityFlopper.java index 85658ff..21db6c0 100644 --- a/loader-common/src/main/java/org/cyclops/flopper/blockentity/BlockEntityFlopper.java +++ b/loader-common/src/main/java/org/cyclops/flopper/blockentity/BlockEntityFlopper.java @@ -5,7 +5,7 @@ import net.minecraft.world.level.Level; import net.minecraft.world.level.block.state.BlockState; import org.cyclops.cyclopscore.blockentity.BlockEntityTickerDelayed; -import org.cyclops.cyclopscore.blockentity.CyclopsBlockEntityCommon; +import org.cyclops.cyclopscore.blockentity.CyclopsBlockEntity; import org.cyclops.cyclopscore.helper.IModHelpers; import org.cyclops.cyclopscore.persist.nbt.NBTPersist; import org.cyclops.flopper.RegistryEntries; @@ -16,7 +16,7 @@ * Fluid hopper tile. * @author rubensworks */ -public abstract class BlockEntityFlopper extends CyclopsBlockEntityCommon { +public abstract class BlockEntityFlopper extends CyclopsBlockEntity { @NBTPersist private int transferCooldown = -1; diff --git a/loader-common/src/main/resources/assets/flopper/items/flopper.json b/loader-common/src/main/resources/assets/flopper/items/flopper.json new file mode 100644 index 0000000..8a2d1c7 --- /dev/null +++ b/loader-common/src/main/resources/assets/flopper/items/flopper.json @@ -0,0 +1,6 @@ +{ + "model": { + "type": "minecraft:model", + "model": "flopper:item/flopper" + } +} \ No newline at end of file diff --git a/loader-fabric/src/main/resources/data/flopper/recipe/flopper.json b/loader-common/src/main/resources/data/flopper/recipe/flopper.json similarity index 63% rename from loader-fabric/src/main/resources/data/flopper/recipe/flopper.json rename to loader-common/src/main/resources/data/flopper/recipe/flopper.json index 4624c85..ebf0ac9 100644 --- a/loader-fabric/src/main/resources/data/flopper/recipe/flopper.json +++ b/loader-common/src/main/resources/data/flopper/recipe/flopper.json @@ -6,14 +6,11 @@ " I " ], "key": { - "I": { - "tag": "c:ingots/iron" - }, - "B": { - "item": "minecraft:bucket" - } + "I": "#c:ingots/iron", + "B": "minecraft:bucket" }, "result": { + "count": 1, "id": "flopper:flopper" } } \ No newline at end of file diff --git a/loader-common/src/main/resources/flopper.accesswidener b/loader-common/src/main/resources/flopper.accesswidener index 5056c0a..1804b76 100644 --- a/loader-common/src/main/resources/flopper.accesswidener +++ b/loader-common/src/main/resources/flopper.accesswidener @@ -1,4 +1,9 @@ accessWidener v1 named +# BlockEntityType +accessible class net/minecraft/world/level/block/entity/BlockEntityType +accessible method net/minecraft/world/level/block/entity/BlockEntityType (Lnet/minecraft/world/level/block/entity/BlockEntityType$BlockEntitySupplier;Ljava/util/Set;)V +accessible class net/minecraft/world/level/block/entity/BlockEntityType$BlockEntitySupplier + # ArgumentTypeInfos accessible field net/minecraft/world/level/block/LiquidBlock fluid Lnet/minecraft/world/level/material/FlowingFluid; diff --git a/loader-fabric/src/main/java/org/cyclops/flopper/block/BlockFlopperConfigFabric.java b/loader-fabric/src/main/java/org/cyclops/flopper/block/BlockFlopperConfigFabric.java index 5bb1a10..22958b4 100644 --- a/loader-fabric/src/main/java/org/cyclops/flopper/block/BlockFlopperConfigFabric.java +++ b/loader-fabric/src/main/java/org/cyclops/flopper/block/BlockFlopperConfigFabric.java @@ -1,7 +1,6 @@ package org.cyclops.flopper.block; import net.fabricmc.fabric.api.transfer.v1.fluid.FluidConstants; -import net.minecraft.world.level.block.Block; import net.minecraft.world.level.block.SoundType; import net.minecraft.world.level.material.MapColor; import org.cyclops.cyclopscore.config.ConfigurablePropertyCommon; @@ -29,7 +28,7 @@ public class BlockFlopperConfigFabric extends BlockFlopperConfig new BlockFlopperFabric(Block.Properties.of() + (eConfig, properties) -> new BlockFlopperFabric(properties .mapColor(MapColor.STONE) .strength(3.0F, 4.8F) .sound(SoundType.METAL), BlockEntityFlopperFabric::new) diff --git a/loader-fabric/src/main/java/org/cyclops/flopper/block/BlockFlopperFabric.java b/loader-fabric/src/main/java/org/cyclops/flopper/block/BlockFlopperFabric.java index be2b953..d664d8b 100644 --- a/loader-fabric/src/main/java/org/cyclops/flopper/block/BlockFlopperFabric.java +++ b/loader-fabric/src/main/java/org/cyclops/flopper/block/BlockFlopperFabric.java @@ -11,7 +11,6 @@ import net.minecraft.network.chat.Component; import net.minecraft.world.InteractionHand; import net.minecraft.world.InteractionResult; -import net.minecraft.world.ItemInteractionResult; import net.minecraft.world.entity.player.Player; import net.minecraft.world.item.ItemStack; import net.minecraft.world.level.Level; @@ -19,7 +18,7 @@ import net.minecraft.world.level.block.state.BlockBehaviour; import net.minecraft.world.level.block.state.BlockState; import net.minecraft.world.phys.BlockHitResult; -import org.cyclops.cyclopscore.blockentity.CyclopsBlockEntityCommon; +import org.cyclops.cyclopscore.blockentity.CyclopsBlockEntity; import org.cyclops.cyclopscore.helper.IFluidHelpersFabric; import org.cyclops.flopper.FlopperFabric; import org.cyclops.flopper.blockentity.BlockEntityFlopperFabric; @@ -32,7 +31,7 @@ public class BlockFlopperFabric extends BlockFlopper { public static final MapCodec CODEC = BlockBehaviour.simpleCodec(properties -> new BlockFlopperFabric(properties, BlockEntityFlopperFabric::new)); - public BlockFlopperFabric(Properties properties, BiFunction blockEntitySupplier) { + public BlockFlopperFabric(Properties properties, BiFunction blockEntitySupplier) { super(properties, blockEntitySupplier); } @@ -68,8 +67,8 @@ protected InteractionResult useWithoutItem(BlockState blockState, Level level, B } @Override - protected ItemInteractionResult useItemOn(ItemStack itemStack, BlockState blockState, Level level, BlockPos pos, Player player, InteractionHand hand, BlockHitResult rayTraceResult) { - ItemInteractionResult activatedSuper = super.useItemOn(itemStack, blockState, level, pos, player, hand, rayTraceResult); + protected InteractionResult useItemOn(ItemStack itemStack, BlockState blockState, Level level, BlockPos pos, Player player, InteractionHand hand, BlockHitResult rayTraceResult) { + InteractionResult activatedSuper = super.useItemOn(itemStack, blockState, level, pos, player, hand, rayTraceResult); if (activatedSuper.consumesAction()) { return activatedSuper; } @@ -84,15 +83,15 @@ protected ItemInteractionResult useItemOn(ItemStack itemStack, BlockState blockS && (movedSimulate = fh.moveFluid(storageItem, storageFlopper, fh.getBucketVolume(), player, true)) > 0) { // Move fluid from the item into the tank if not sneaking fh.moveFluid(storageItem, storageFlopper, movedSimulate, player, false); - return ItemInteractionResult.SUCCESS; + return InteractionResult.SUCCESS; } else if (player.isCrouching() && (movedSimulate = fh.moveFluid(storageFlopper, storageItem, fh.getBucketVolume(), player, true)) > 0) { // Move fluid from the tank into the item if sneaking fh.moveFluid(storageFlopper, storageItem, movedSimulate, player, false); - return ItemInteractionResult.SUCCESS; + return InteractionResult.SUCCESS; } - return ItemInteractionResult.PASS_TO_DEFAULT_BLOCK_INTERACTION; + return InteractionResult.PASS; } - return ItemInteractionResult.PASS_TO_DEFAULT_BLOCK_INTERACTION; + return InteractionResult.PASS; } } diff --git a/loader-fabric/src/main/java/org/cyclops/flopper/blockentity/BlockEntityFlopperConfigFabric.java b/loader-fabric/src/main/java/org/cyclops/flopper/blockentity/BlockEntityFlopperConfigFabric.java index 885ddca..dac03d3 100644 --- a/loader-fabric/src/main/java/org/cyclops/flopper/blockentity/BlockEntityFlopperConfigFabric.java +++ b/loader-fabric/src/main/java/org/cyclops/flopper/blockentity/BlockEntityFlopperConfigFabric.java @@ -17,13 +17,13 @@ public BlockEntityFlopperConfigFabric() { super( FlopperFabric._instance, (eConfig) -> new BlockEntityType<>(BlockEntityFlopperFabric::new, - Sets.newHashSet(RegistryEntries.BLOCK_FLOPPER.value()), null) + Sets.newHashSet(RegistryEntries.BLOCK_FLOPPER.value())) ); } @Override - public void onForgeRegistered() { - super.onForgeRegistered(); + public void onRegistryRegistered() { + super.onRegistryRegistered(); // Fluid capability FluidStorage.SIDED.registerForBlockEntity((blockEntity, direction) -> blockEntity.getTank(), getInstance()); diff --git a/loader-fabric/src/main/java/org/cyclops/flopper/blockentity/BlockEntityFlopperFabric.java b/loader-fabric/src/main/java/org/cyclops/flopper/blockentity/BlockEntityFlopperFabric.java index 524b44a..1e75729 100644 --- a/loader-fabric/src/main/java/org/cyclops/flopper/blockentity/BlockEntityFlopperFabric.java +++ b/loader-fabric/src/main/java/org/cyclops/flopper/blockentity/BlockEntityFlopperFabric.java @@ -110,7 +110,7 @@ protected boolean pushFluidsToWorld() { } } if (BlockFlopperConfig.worldPullPushNeighbourEvents) { - level.neighborChanged(worldPosition, Blocks.AIR, worldPosition); + level.neighborChanged(worldPosition, Blocks.AIR, null); } return true; } @@ -144,7 +144,7 @@ protected boolean pullFluidsFromWorld() { } } if (BlockFlopperConfig.worldPullPushNeighbourEvents) { - level.neighborChanged(worldPosition, Blocks.AIR, worldPosition); + level.neighborChanged(worldPosition, Blocks.AIR, null); } return true; } diff --git a/loader-forge/src/main/java/org/cyclops/flopper/FlopperForge.java b/loader-forge/src/main/java/org/cyclops/flopper/FlopperForge.java index cf8571e..1914eba 100644 --- a/loader-forge/src/main/java/org/cyclops/flopper/FlopperForge.java +++ b/loader-forge/src/main/java/org/cyclops/flopper/FlopperForge.java @@ -3,6 +3,7 @@ import net.minecraft.world.item.CreativeModeTab; import net.minecraft.world.item.ItemStack; import net.minecraftforge.fml.common.Mod; +import net.minecraftforge.fml.javafmlmod.FMLJavaModLoadingContext; import org.cyclops.cyclopscore.config.ConfigHandlerCommon; import org.cyclops.cyclopscore.init.ModBaseForge; import org.cyclops.cyclopscore.proxy.CommonProxyForge; @@ -25,8 +26,8 @@ public class FlopperForge extends ModBaseForge { */ public static FlopperForge _instance; - public FlopperForge() { - super(Reference.MOD_ID, (instance) -> _instance = instance); + public FlopperForge(FMLJavaModLoadingContext context) { + super(Reference.MOD_ID, (instance) -> _instance = instance, context); } @Override diff --git a/loader-forge/src/main/java/org/cyclops/flopper/block/BlockFlopperConfigForge.java b/loader-forge/src/main/java/org/cyclops/flopper/block/BlockFlopperConfigForge.java index ebf5b6b..694b452 100644 --- a/loader-forge/src/main/java/org/cyclops/flopper/block/BlockFlopperConfigForge.java +++ b/loader-forge/src/main/java/org/cyclops/flopper/block/BlockFlopperConfigForge.java @@ -1,6 +1,5 @@ package org.cyclops.flopper.block; -import net.minecraft.world.level.block.Block; import net.minecraft.world.level.block.SoundType; import net.minecraft.world.level.material.MapColor; import org.cyclops.cyclopscore.init.ModBaseForge; @@ -17,7 +16,7 @@ public class BlockFlopperConfigForge extends BlockFlopperConfig> public BlockFlopperConfigForge() { super( FlopperForge._instance, - eConfig -> new BlockFlopperForge(Block.Properties.of() + (eConfig, properties) -> new BlockFlopperForge(properties .mapColor(MapColor.STONE) .strength(3.0F, 4.8F) .sound(SoundType.METAL), BlockEntityFlopperForge::new) diff --git a/loader-forge/src/main/java/org/cyclops/flopper/block/BlockFlopperForge.java b/loader-forge/src/main/java/org/cyclops/flopper/block/BlockFlopperForge.java index ae55885..b3f6f5d 100644 --- a/loader-forge/src/main/java/org/cyclops/flopper/block/BlockFlopperForge.java +++ b/loader-forge/src/main/java/org/cyclops/flopper/block/BlockFlopperForge.java @@ -7,7 +7,6 @@ import net.minecraft.sounds.SoundSource; import net.minecraft.world.InteractionHand; import net.minecraft.world.InteractionResult; -import net.minecraft.world.ItemInteractionResult; import net.minecraft.world.entity.player.Player; import net.minecraft.world.item.BucketItem; import net.minecraft.world.item.ItemStack; @@ -30,7 +29,7 @@ import net.minecraftforge.fluids.capability.IFluidHandlerItem; import net.minecraftforge.fluids.capability.wrappers.FluidBucketWrapper; import net.minecraftforge.items.ItemHandlerHelper; -import org.cyclops.cyclopscore.blockentity.CyclopsBlockEntityCommon; +import org.cyclops.cyclopscore.blockentity.CyclopsBlockEntity; import org.cyclops.flopper.FlopperForge; import org.cyclops.flopper.blockentity.BlockEntityFlopperForge; import org.jetbrains.annotations.NotNull; @@ -45,7 +44,7 @@ public class BlockFlopperForge extends BlockFlopper { public static final MapCodec CODEC = BlockBehaviour.simpleCodec(properties -> new BlockFlopperForge(properties, BlockEntityFlopperForge::new)); - public BlockFlopperForge(Properties properties, BiFunction blockEntitySupplier) { + public BlockFlopperForge(Properties properties, BiFunction blockEntitySupplier) { super(properties, blockEntitySupplier); MinecraftForge.EVENT_BUS.register(this); } @@ -84,8 +83,8 @@ protected InteractionResult useWithoutItem(BlockState blockState, Level level, B } @Override - protected ItemInteractionResult useItemOn(ItemStack itemStack, BlockState blockState, Level level, BlockPos pos, Player player, InteractionHand hand, BlockHitResult rayTraceResult) { - ItemInteractionResult activatedSuper = super.useItemOn(itemStack, blockState, level, pos, player, hand, rayTraceResult); + protected InteractionResult useItemOn(ItemStack itemStack, BlockState blockState, Level level, BlockPos pos, Player player, InteractionHand hand, BlockHitResult rayTraceResult) { + InteractionResult activatedSuper = super.useItemOn(itemStack, blockState, level, pos, player, hand, rayTraceResult); if (activatedSuper.consumesAction()) { return activatedSuper; } @@ -103,7 +102,7 @@ && tryEmptyContainer(itemStack, fluidHandler, bucketVolume, player, false).isSuc FlopperForge._instance.getModHelpers().getInventoryHelpers().tryReAddToStack(player, itemStack, drainedItem, hand); } } - return ItemInteractionResult.SUCCESS; + return InteractionResult.SUCCESS; } else if (player.isCrouching() && tryFillContainer(itemStack, fluidHandler, bucketVolume, player, false).isSuccess()) { // Move fluid from the tank into the item if sneaking @@ -114,11 +113,11 @@ && tryFillContainer(itemStack, fluidHandler, bucketVolume, player, false).isSucc FlopperForge._instance.getModHelpers().getInventoryHelpers().tryReAddToStack(player, itemStack, filledItem, hand); } } - return ItemInteractionResult.SUCCESS; + return InteractionResult.SUCCESS; } - return ItemInteractionResult.PASS_TO_DEFAULT_BLOCK_INTERACTION; + return InteractionResult.PASS; }) - .orElse(ItemInteractionResult.PASS_TO_DEFAULT_BLOCK_INTERACTION); + .orElse(InteractionResult.PASS); } // A modified/fixed version of FluidUtil#tryEmptyContainer diff --git a/loader-forge/src/main/java/org/cyclops/flopper/blockentity/BlockEntityFlopperConfigForge.java b/loader-forge/src/main/java/org/cyclops/flopper/blockentity/BlockEntityFlopperConfigForge.java index 1e85019..8385cec 100644 --- a/loader-forge/src/main/java/org/cyclops/flopper/blockentity/BlockEntityFlopperConfigForge.java +++ b/loader-forge/src/main/java/org/cyclops/flopper/blockentity/BlockEntityFlopperConfigForge.java @@ -16,7 +16,7 @@ public BlockEntityFlopperConfigForge() { super( FlopperForge._instance, (eConfig) -> new BlockEntityType<>(BlockEntityFlopperForge::new, - Sets.newHashSet(RegistryEntries.BLOCK_FLOPPER.value()), null) + Sets.newHashSet(RegistryEntries.BLOCK_FLOPPER.value())) ); } diff --git a/loader-forge/src/main/java/org/cyclops/flopper/blockentity/BlockEntityFlopperForge.java b/loader-forge/src/main/java/org/cyclops/flopper/blockentity/BlockEntityFlopperForge.java index 112cfb1..481f4b5 100644 --- a/loader-forge/src/main/java/org/cyclops/flopper/blockentity/BlockEntityFlopperForge.java +++ b/loader-forge/src/main/java/org/cyclops/flopper/blockentity/BlockEntityFlopperForge.java @@ -107,7 +107,7 @@ protected boolean pushFluidsToWorld() { } } if (BlockFlopperConfig.worldPullPushNeighbourEvents) { - level.neighborChanged(worldPosition, Blocks.AIR, worldPosition); + level.neighborChanged(worldPosition, Blocks.AIR, null); } return true; } @@ -143,7 +143,7 @@ protected boolean pullFluidsFromWorld() { } } if (BlockFlopperConfig.worldPullPushNeighbourEvents) { - level.neighborChanged(worldPosition, Blocks.AIR, worldPosition); + level.neighborChanged(worldPosition, Blocks.AIR, null); } return true; } diff --git a/loader-forge/src/main/resources/data/flopper/recipe/flopper.json b/loader-forge/src/main/resources/data/flopper/recipe/flopper.json deleted file mode 100644 index 537e509..0000000 --- a/loader-forge/src/main/resources/data/flopper/recipe/flopper.json +++ /dev/null @@ -1,19 +0,0 @@ -{ - "type": "minecraft:crafting_shaped", - "category": "redstone", - "pattern": [ - "IBI", - " I " - ], - "key": { - "I": { - "tag": "forge:ingots/iron" - }, - "B": { - "item": "minecraft:bucket" - } - }, - "result": { - "id": "flopper:flopper" - } -} \ No newline at end of file diff --git a/loader-neoforge/src/main/java/org/cyclops/flopper/FlopperNeoForge.java b/loader-neoforge/src/main/java/org/cyclops/flopper/FlopperNeoForge.java index f83470f..2a6c854 100644 --- a/loader-neoforge/src/main/java/org/cyclops/flopper/FlopperNeoForge.java +++ b/loader-neoforge/src/main/java/org/cyclops/flopper/FlopperNeoForge.java @@ -5,8 +5,8 @@ import net.neoforged.bus.api.IEventBus; import net.neoforged.fml.common.Mod; import org.apache.logging.log4j.Level; -import org.cyclops.cyclopscore.config.ConfigHandler; -import org.cyclops.cyclopscore.init.ModBaseVersionable; +import org.cyclops.cyclopscore.config.ConfigHandlerCommon; +import org.cyclops.cyclopscore.init.ModBaseNeoForge; import org.cyclops.cyclopscore.proxy.IClientProxy; import org.cyclops.cyclopscore.proxy.ICommonProxy; import org.cyclops.flopper.block.BlockFlopperConfigNeoForge; @@ -20,7 +20,7 @@ * */ @Mod(Reference.MOD_ID) -public class FlopperNeoForge extends ModBaseVersionable { +public class FlopperNeoForge extends ModBaseNeoForge { /** * The unique instance of this mod. @@ -53,7 +53,7 @@ protected CreativeModeTab.Builder constructDefaultCreativeModeTab(CreativeModeTa } @Override - protected void onConfigsRegister(ConfigHandler configHandler) { + protected void onConfigsRegister(ConfigHandlerCommon configHandler) { super.onConfigsRegister(configHandler); configHandler.addConfigurable(new GeneralConfig(this)); diff --git a/loader-neoforge/src/main/java/org/cyclops/flopper/block/BlockFlopperConfigNeoForge.java b/loader-neoforge/src/main/java/org/cyclops/flopper/block/BlockFlopperConfigNeoForge.java index 4ecff82..3fa48ac 100644 --- a/loader-neoforge/src/main/java/org/cyclops/flopper/block/BlockFlopperConfigNeoForge.java +++ b/loader-neoforge/src/main/java/org/cyclops/flopper/block/BlockFlopperConfigNeoForge.java @@ -1,9 +1,8 @@ package org.cyclops.flopper.block; -import net.minecraft.world.level.block.Block; import net.minecraft.world.level.block.SoundType; import net.minecraft.world.level.material.MapColor; -import org.cyclops.cyclopscore.init.ModBase; +import org.cyclops.cyclopscore.init.ModBaseNeoForge; import org.cyclops.flopper.FlopperNeoForge; import org.cyclops.flopper.blockentity.BlockEntityFlopperNeoForge; @@ -12,12 +11,12 @@ * @author rubensworks * */ -public class BlockFlopperConfigNeoForge extends BlockFlopperConfig> { +public class BlockFlopperConfigNeoForge extends BlockFlopperConfig> { public BlockFlopperConfigNeoForge() { super( FlopperNeoForge._instance, - eConfig -> new BlockFlopperNeoForge(Block.Properties.of() + (eConfig, properties) -> new BlockFlopperNeoForge(properties .mapColor(MapColor.STONE) .strength(3.0F, 4.8F) .sound(SoundType.METAL), BlockEntityFlopperNeoForge::new) diff --git a/loader-neoforge/src/main/java/org/cyclops/flopper/block/BlockFlopperNeoForge.java b/loader-neoforge/src/main/java/org/cyclops/flopper/block/BlockFlopperNeoForge.java index 6321a64..e1e9c23 100644 --- a/loader-neoforge/src/main/java/org/cyclops/flopper/block/BlockFlopperNeoForge.java +++ b/loader-neoforge/src/main/java/org/cyclops/flopper/block/BlockFlopperNeoForge.java @@ -7,7 +7,6 @@ import net.minecraft.sounds.SoundSource; import net.minecraft.world.InteractionHand; import net.minecraft.world.InteractionResult; -import net.minecraft.world.ItemInteractionResult; import net.minecraft.world.entity.player.Player; import net.minecraft.world.item.ItemStack; import net.minecraft.world.level.Level; @@ -25,7 +24,7 @@ import net.neoforged.neoforge.fluids.FluidStack; import net.neoforged.neoforge.fluids.FluidUtil; import net.neoforged.neoforge.fluids.capability.IFluidHandler; -import org.cyclops.cyclopscore.blockentity.CyclopsBlockEntityCommon; +import org.cyclops.cyclopscore.blockentity.CyclopsBlockEntity; import org.cyclops.cyclopscore.helper.IFluidHelpersNeoForge; import org.cyclops.flopper.FlopperNeoForge; import org.cyclops.flopper.blockentity.BlockEntityFlopperNeoForge; @@ -40,7 +39,7 @@ public class BlockFlopperNeoForge extends BlockFlopper { public static final MapCodec CODEC = BlockBehaviour.simpleCodec(properties -> new BlockFlopperNeoForge(properties, BlockEntityFlopperNeoForge::new)); - public BlockFlopperNeoForge(Properties properties, BiFunction blockEntitySupplier) { + public BlockFlopperNeoForge(Properties properties, BiFunction blockEntitySupplier) { super(properties, blockEntitySupplier); NeoForge.EVENT_BUS.register(this); } @@ -79,8 +78,8 @@ protected InteractionResult useWithoutItem(BlockState blockState, Level level, B } @Override - protected ItemInteractionResult useItemOn(ItemStack itemStack, BlockState blockState, Level level, BlockPos pos, Player player, InteractionHand hand, BlockHitResult rayTraceResult) { - ItemInteractionResult activatedSuper = super.useItemOn(itemStack, blockState, level, pos, player, hand, rayTraceResult); + protected InteractionResult useItemOn(ItemStack itemStack, BlockState blockState, Level level, BlockPos pos, Player player, InteractionHand hand, BlockHitResult rayTraceResult) { + InteractionResult activatedSuper = super.useItemOn(itemStack, blockState, level, pos, player, hand, rayTraceResult); if (activatedSuper.consumesAction()) { return activatedSuper; } @@ -98,7 +97,7 @@ && tryEmptyContainer(itemStack, fluidHandler, fh.getBucketVolume(), player, fals FlopperNeoForge._instance.getModHelpers().getInventoryHelpers().tryReAddToStack(player, itemStack, drainedItem, hand); } } - return ItemInteractionResult.SUCCESS; + return InteractionResult.SUCCESS; } else if (player.isCrouching() && FluidUtil.tryFillContainer(itemStack, fluidHandler, fh.getBucketVolume(), player, false).isSuccess()) { // Move fluid from the tank into the item if sneaking @@ -109,11 +108,11 @@ && tryEmptyContainer(itemStack, fluidHandler, fh.getBucketVolume(), player, fals FlopperNeoForge._instance.getModHelpers().getInventoryHelpers().tryReAddToStack(player, itemStack, filledItem, hand); } } - return ItemInteractionResult.SUCCESS; + return InteractionResult.SUCCESS; } - return ItemInteractionResult.PASS_TO_DEFAULT_BLOCK_INTERACTION; + return InteractionResult.PASS; }) - .orElse(ItemInteractionResult.PASS_TO_DEFAULT_BLOCK_INTERACTION); + .orElse(InteractionResult.PASS); } // A modified/fixed version of FluidUtil#tryEmptyContainer diff --git a/loader-neoforge/src/main/java/org/cyclops/flopper/blockentity/BlockEntityFlopperConfigNeoForge.java b/loader-neoforge/src/main/java/org/cyclops/flopper/blockentity/BlockEntityFlopperConfigNeoForge.java index 6967ac7..66c63ef 100644 --- a/loader-neoforge/src/main/java/org/cyclops/flopper/blockentity/BlockEntityFlopperConfigNeoForge.java +++ b/loader-neoforge/src/main/java/org/cyclops/flopper/blockentity/BlockEntityFlopperConfigNeoForge.java @@ -4,7 +4,7 @@ import net.minecraft.world.level.block.entity.BlockEntityType; import net.neoforged.neoforge.capabilities.Capabilities; import net.neoforged.neoforge.capabilities.RegisterCapabilitiesEvent; -import org.cyclops.cyclopscore.init.ModBase; +import org.cyclops.cyclopscore.init.ModBaseNeoForge; import org.cyclops.flopper.FlopperNeoForge; import org.cyclops.flopper.RegistryEntries; import org.cyclops.flopper.block.BlockFlopperConfig; @@ -13,12 +13,12 @@ /** * @author rubensworks */ -public class BlockEntityFlopperConfigNeoForge extends BlockEntityFlopperConfig> { +public class BlockEntityFlopperConfigNeoForge extends BlockEntityFlopperConfig> { public BlockEntityFlopperConfigNeoForge() { super( FlopperNeoForge._instance, (eConfig) -> new BlockEntityType<>(BlockEntityFlopperNeoForge::new, - Sets.newHashSet(RegistryEntries.BLOCK_FLOPPER.value()), null) + Sets.newHashSet(RegistryEntries.BLOCK_FLOPPER.value())) ); FlopperNeoForge._instance.getModEventBus().addListener(this::registerCapabilities); } diff --git a/loader-neoforge/src/main/java/org/cyclops/flopper/blockentity/BlockEntityFlopperNeoForge.java b/loader-neoforge/src/main/java/org/cyclops/flopper/blockentity/BlockEntityFlopperNeoForge.java index 3ce360f..e2d3fce 100644 --- a/loader-neoforge/src/main/java/org/cyclops/flopper/blockentity/BlockEntityFlopperNeoForge.java +++ b/loader-neoforge/src/main/java/org/cyclops/flopper/blockentity/BlockEntityFlopperNeoForge.java @@ -103,7 +103,7 @@ protected boolean pushFluidsToWorld() { } } if (BlockFlopperConfig.worldPullPushNeighbourEvents) { - level.neighborChanged(worldPosition, Blocks.AIR, worldPosition); + level.neighborChanged(worldPosition, Blocks.AIR, null); } return true; } @@ -139,7 +139,7 @@ protected boolean pullFluidsFromWorld() { } } if (BlockFlopperConfig.worldPullPushNeighbourEvents) { - level.neighborChanged(worldPosition, Blocks.AIR, worldPosition); + level.neighborChanged(worldPosition, Blocks.AIR, null); } return true; } diff --git a/loader-neoforge/src/main/java/org/cyclops/flopper/proxy/ClientProxyNeoForge.java b/loader-neoforge/src/main/java/org/cyclops/flopper/proxy/ClientProxyNeoForge.java index 82a64f7..93437a3 100644 --- a/loader-neoforge/src/main/java/org/cyclops/flopper/proxy/ClientProxyNeoForge.java +++ b/loader-neoforge/src/main/java/org/cyclops/flopper/proxy/ClientProxyNeoForge.java @@ -1,6 +1,6 @@ package org.cyclops.flopper.proxy; -import org.cyclops.cyclopscore.init.ModBase; +import org.cyclops.cyclopscore.init.ModBaseNeoForge; import org.cyclops.cyclopscore.proxy.ClientProxyComponent; import org.cyclops.flopper.FlopperNeoForge; @@ -17,7 +17,7 @@ public ClientProxyNeoForge() { } @Override - public ModBase getMod() { + public ModBaseNeoForge getMod() { return FlopperNeoForge._instance; } diff --git a/loader-neoforge/src/main/java/org/cyclops/flopper/proxy/CommonProxyNeoForge.java b/loader-neoforge/src/main/java/org/cyclops/flopper/proxy/CommonProxyNeoForge.java index 2bafec3..61c50a3 100644 --- a/loader-neoforge/src/main/java/org/cyclops/flopper/proxy/CommonProxyNeoForge.java +++ b/loader-neoforge/src/main/java/org/cyclops/flopper/proxy/CommonProxyNeoForge.java @@ -1,6 +1,6 @@ package org.cyclops.flopper.proxy; -import org.cyclops.cyclopscore.init.ModBase; +import org.cyclops.cyclopscore.init.ModBaseNeoForge; import org.cyclops.cyclopscore.proxy.CommonProxyComponent; import org.cyclops.flopper.FlopperNeoForge; @@ -12,7 +12,7 @@ public class CommonProxyNeoForge extends CommonProxyComponent { @Override - public ModBase getMod() { + public ModBaseNeoForge getMod() { return FlopperNeoForge._instance; } diff --git a/loader-neoforge/src/main/resources/data/flopper/recipe/flopper.json b/loader-neoforge/src/main/resources/data/flopper/recipe/flopper.json deleted file mode 100644 index 4624c85..0000000 --- a/loader-neoforge/src/main/resources/data/flopper/recipe/flopper.json +++ /dev/null @@ -1,19 +0,0 @@ -{ - "type": "minecraft:crafting_shaped", - "category": "redstone", - "pattern": [ - "IBI", - " I " - ], - "key": { - "I": { - "tag": "c:ingots/iron" - }, - "B": { - "item": "minecraft:bucket" - } - }, - "result": { - "id": "flopper:flopper" - } -} \ No newline at end of file