fix CI not building

This commit is contained in:
yrsegal@gmail.com 2022-06-07 19:21:57 -04:00
parent 811adff148
commit e246d31926
6 changed files with 25 additions and 18 deletions

View file

@ -1,5 +1,6 @@
package at.petrak.hexcasting.common.blocks; package at.petrak.hexcasting.common.blocks;
import at.petrak.hexcasting.annotations.SoftImplement;
import at.petrak.hexcasting.api.misc.FrozenColorizer; import at.petrak.hexcasting.api.misc.FrozenColorizer;
import at.petrak.hexcasting.common.blocks.entity.BlockEntityConjured; import at.petrak.hexcasting.common.blocks.entity.BlockEntityConjured;
import at.petrak.hexcasting.xplat.IForgeLikeBlock; import at.petrak.hexcasting.xplat.IForgeLikeBlock;
@ -110,9 +111,16 @@ public class BlockConjured extends Block implements EntityBlock, IForgeLikeBlock
// NO-OP // NO-OP
} }
@Override
@SoftImplement("forge")
public boolean addLandingEffects(BlockState state1, ServerLevel worldserver, BlockPos pos, BlockState state2, 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); BlockEntity tile = worldserver.getBlockEntity(pos);
if (tile instanceof BlockEntityConjured bec) { if (tile instanceof BlockEntityConjured bec) {
bec.landParticle(entity, numberOfParticles); bec.landParticle(entity, numberOfParticles);

View file

@ -87,7 +87,7 @@ public class BlockConjuredLight extends BlockConjured implements SimpleWaterlogg
} }
@Override @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) { LivingEntity entity, int numberOfParticles) {
return true; return true;
} }

View file

@ -1,5 +1,6 @@
package at.petrak.hexcasting.common.blocks.akashic; 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.DatumType;
import at.petrak.hexcasting.api.spell.SpellDatum; import at.petrak.hexcasting.api.spell.SpellDatum;
import at.petrak.hexcasting.common.items.ItemScroll; 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()); return this.defaultBlockState().setValue(FACING, ctx.getHorizontalDirection().getOpposite());
} }
@Override @SoftImplement("forge")
public float getEnchantPowerBonus(BlockState state, LevelReader level, BlockPos pos) { 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 @Override

View file

@ -1,6 +1,5 @@
package at.petrak.hexcasting.xplat; package at.petrak.hexcasting.xplat;
import at.petrak.hexcasting.annotations.SoftImplement;
import net.minecraft.core.BlockPos; import net.minecraft.core.BlockPos;
import net.minecraft.server.level.ServerLevel; import net.minecraft.server.level.ServerLevel;
import net.minecraft.world.entity.LivingEntity; 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. * 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 { public interface IForgeLikeBlock {
@SoftImplement("forge") default boolean addLandingEffects(BlockState state, ServerLevel level, BlockPos pos, LivingEntity entity, int numberOfParticles) {
default boolean addLandingEffects(BlockState state1, ServerLevel level, BlockPos pos, BlockState state2, LivingEntity entity, int numberOfParticles) {
return false; return false;
} }
/** default boolean hasEnchantPowerBonus(BlockState state, LevelReader level, BlockPos pos) {
* On Fabric, this method's return value doesn't matter - it's only checked for whether it's greater than 0. return false;
* 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;
} }
} }

View file

@ -17,7 +17,7 @@ public class FabricEnchantmentTableBlockMixin {
BlockState state = level.getBlockState(blockPos.offset(blockPos2)); BlockState state = level.getBlockState(blockPos.offset(blockPos2));
if (state.getBlock() instanceof IForgeLikeBlock forgeLike) { if (state.getBlock() instanceof IForgeLikeBlock forgeLike) {
boolean emptyBetween = level.isEmptyBlock(blockPos.offset(blockPos2.getX() / 2, blockPos2.getY(), blockPos2.getZ() / 2)); 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));
} }
} }
} }

View file

@ -26,7 +26,7 @@ public class FabricLivingEntityMixin {
float dist = (float) Mth.ceil(entity.fallDistance - 3.0F); float dist = (float) Mth.ceil(entity.fallDistance - 3.0F);
double e = Math.min(0.2F + dist / 15.0F, 2.5D); double e = Math.min(0.2F + dist / 15.0F, 2.5D);
int i = (int)(150.0D * e); 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; hex$cachedParticleState = state;
return Blocks.AIR.defaultBlockState(); return Blocks.AIR.defaultBlockState();
} }