From e246d31926deaa75d77db51632f92f3a063d7373 Mon Sep 17 00:00:00 2001 From: "yrsegal@gmail.com" Date: Tue, 7 Jun 2022 19:21:57 -0400 Subject: [PATCH] fix CI not building --- .../hexcasting/common/blocks/BlockConjured.java | 12 ++++++++++-- .../common/blocks/BlockConjuredLight.java | 2 +- .../blocks/akashic/BlockAkashicBookshelf.java | 10 ++++++++-- .../petrak/hexcasting/xplat/IForgeLikeBlock.java | 15 ++++----------- .../mixin/FabricEnchantmentTableBlockMixin.java | 2 +- .../fabric/mixin/FabricLivingEntityMixin.java | 2 +- 6 files changed, 25 insertions(+), 18 deletions(-) diff --git a/Common/src/main/java/at/petrak/hexcasting/common/blocks/BlockConjured.java b/Common/src/main/java/at/petrak/hexcasting/common/blocks/BlockConjured.java index 23b56ec1..0f4b5ae3 100644 --- a/Common/src/main/java/at/petrak/hexcasting/common/blocks/BlockConjured.java +++ b/Common/src/main/java/at/petrak/hexcasting/common/blocks/BlockConjured.java @@ -1,5 +1,6 @@ package at.petrak.hexcasting.common.blocks; +import at.petrak.hexcasting.annotations.SoftImplement; import at.petrak.hexcasting.api.misc.FrozenColorizer; import at.petrak.hexcasting.common.blocks.entity.BlockEntityConjured; import at.petrak.hexcasting.xplat.IForgeLikeBlock; @@ -110,9 +111,16 @@ public class BlockConjured extends Block implements EntityBlock, IForgeLikeBlock // NO-OP } - @Override + + @SoftImplement("forge") public boolean addLandingEffects(BlockState state1, ServerLevel worldserver, BlockPos pos, BlockState state2, - LivingEntity entity, int numberOfParticles) { + LivingEntity entity, int numberOfParticles) { + return addLandingEffects(state1, worldserver, pos, entity, numberOfParticles); + } + + @Override + public boolean addLandingEffects(BlockState state, ServerLevel worldserver, BlockPos pos, + LivingEntity entity, int numberOfParticles) { BlockEntity tile = worldserver.getBlockEntity(pos); if (tile instanceof BlockEntityConjured bec) { bec.landParticle(entity, numberOfParticles); diff --git a/Common/src/main/java/at/petrak/hexcasting/common/blocks/BlockConjuredLight.java b/Common/src/main/java/at/petrak/hexcasting/common/blocks/BlockConjuredLight.java index 5e5a652b..ea64c691 100644 --- a/Common/src/main/java/at/petrak/hexcasting/common/blocks/BlockConjuredLight.java +++ b/Common/src/main/java/at/petrak/hexcasting/common/blocks/BlockConjuredLight.java @@ -87,7 +87,7 @@ public class BlockConjuredLight extends BlockConjured implements SimpleWaterlogg } @Override - public boolean addLandingEffects(BlockState state1, ServerLevel worldserver, BlockPos pos, BlockState state2, + public boolean addLandingEffects(BlockState state, ServerLevel worldserver, BlockPos pos, LivingEntity entity, int numberOfParticles) { return true; } diff --git a/Common/src/main/java/at/petrak/hexcasting/common/blocks/akashic/BlockAkashicBookshelf.java b/Common/src/main/java/at/petrak/hexcasting/common/blocks/akashic/BlockAkashicBookshelf.java index 6e21e7bb..4531383e 100644 --- a/Common/src/main/java/at/petrak/hexcasting/common/blocks/akashic/BlockAkashicBookshelf.java +++ b/Common/src/main/java/at/petrak/hexcasting/common/blocks/akashic/BlockAkashicBookshelf.java @@ -1,5 +1,6 @@ package at.petrak.hexcasting.common.blocks.akashic; +import at.petrak.hexcasting.annotations.SoftImplement; import at.petrak.hexcasting.api.spell.DatumType; import at.petrak.hexcasting.api.spell.SpellDatum; import at.petrak.hexcasting.common.items.ItemScroll; @@ -115,9 +116,14 @@ public class BlockAkashicBookshelf extends BlockAkashicFloodfiller implements En return this.defaultBlockState().setValue(FACING, ctx.getHorizontalDirection().getOpposite()); } - @Override + @SoftImplement("forge") public float getEnchantPowerBonus(BlockState state, LevelReader level, BlockPos pos) { - return 1; + return hasEnchantPowerBonus(state, level, pos) ? 1 : 0; + } + + @Override + public boolean hasEnchantPowerBonus(BlockState state, LevelReader level, BlockPos pos) { + return true; } @Override diff --git a/Common/src/main/java/at/petrak/hexcasting/xplat/IForgeLikeBlock.java b/Common/src/main/java/at/petrak/hexcasting/xplat/IForgeLikeBlock.java index 0e25b8ec..e94bd547 100644 --- a/Common/src/main/java/at/petrak/hexcasting/xplat/IForgeLikeBlock.java +++ b/Common/src/main/java/at/petrak/hexcasting/xplat/IForgeLikeBlock.java @@ -1,6 +1,5 @@ package at.petrak.hexcasting.xplat; -import at.petrak.hexcasting.annotations.SoftImplement; import net.minecraft.core.BlockPos; import net.minecraft.server.level.ServerLevel; import net.minecraft.world.entity.LivingEntity; @@ -9,20 +8,14 @@ import net.minecraft.world.level.block.state.BlockState; /** * An interface that mimics some methods of IForgeBlock. - * Fabric implementation will use mixins to achieve the same effect. + * Fabric implementation will use mixins to achieve the same effects. */ public interface IForgeLikeBlock { - @SoftImplement("forge") - default boolean addLandingEffects(BlockState state1, ServerLevel level, BlockPos pos, BlockState state2, LivingEntity entity, int numberOfParticles) { + default boolean addLandingEffects(BlockState state, ServerLevel level, BlockPos pos, LivingEntity entity, int numberOfParticles) { return false; } - /** - * On Fabric, this method's return value doesn't matter - it's only checked for whether it's greater than 0. - * Implementing boosts the way Forge does would... not be worth the effort. - */ - @SoftImplement("forge") - default float getEnchantPowerBonus(BlockState state, LevelReader level, BlockPos pos) { - return 0; + default boolean hasEnchantPowerBonus(BlockState state, LevelReader level, BlockPos pos) { + return false; } } diff --git a/Fabric/src/main/java/at/petrak/hexcasting/fabric/mixin/FabricEnchantmentTableBlockMixin.java b/Fabric/src/main/java/at/petrak/hexcasting/fabric/mixin/FabricEnchantmentTableBlockMixin.java index 036eb22c..09bc4ac8 100644 --- a/Fabric/src/main/java/at/petrak/hexcasting/fabric/mixin/FabricEnchantmentTableBlockMixin.java +++ b/Fabric/src/main/java/at/petrak/hexcasting/fabric/mixin/FabricEnchantmentTableBlockMixin.java @@ -17,7 +17,7 @@ public class FabricEnchantmentTableBlockMixin { BlockState state = level.getBlockState(blockPos.offset(blockPos2)); if (state.getBlock() instanceof IForgeLikeBlock forgeLike) { boolean emptyBetween = level.isEmptyBlock(blockPos.offset(blockPos2.getX() / 2, blockPos2.getY(), blockPos2.getZ() / 2)); - cir.setReturnValue(emptyBetween && forgeLike.getEnchantPowerBonus(state, level, blockPos) > 0); + cir.setReturnValue(emptyBetween && forgeLike.hasEnchantPowerBonus(state, level, blockPos)); } } } diff --git a/Fabric/src/main/java/at/petrak/hexcasting/fabric/mixin/FabricLivingEntityMixin.java b/Fabric/src/main/java/at/petrak/hexcasting/fabric/mixin/FabricLivingEntityMixin.java index 8a9d315a..68c1f4d1 100644 --- a/Fabric/src/main/java/at/petrak/hexcasting/fabric/mixin/FabricLivingEntityMixin.java +++ b/Fabric/src/main/java/at/petrak/hexcasting/fabric/mixin/FabricLivingEntityMixin.java @@ -26,7 +26,7 @@ public class FabricLivingEntityMixin { float dist = (float) Mth.ceil(entity.fallDistance - 3.0F); double e = Math.min(0.2F + dist / 15.0F, 2.5D); int i = (int)(150.0D * e); - if (forgeLike.addLandingEffects(state, (ServerLevel) entity.level, pos, state, entity, i)) { + if (forgeLike.addLandingEffects(state, (ServerLevel) entity.level, pos, entity, i)) { hex$cachedParticleState = state; return Blocks.AIR.defaultBlockState(); }