Flandre923
103 words
1 minutes
24 无冷却漏斗

24 无冷却漏斗#


@Mixin(HopperBlockEntity.class)
public abstract class HopperBlockEntityMixin {

    @Inject(at = @At("RETURN"), method = "tryMoveItems")
    private static void init1(Level level, BlockPos pos, BlockState state, HopperBlockEntity blockEntity, BooleanSupplier validator, CallbackInfoReturnable<Boolean> cir) {
        int k = BlockEnchantmentStorage.getLevel(Enchantments.QUICK_CHARGE,pos);//漏斗的快速装填
//		System.out.println("传递一次");
        if(k>0){
//			System.out.println("设置冷却");
            blockEntity.setCooldown(0); // 重置冷却
        }
    }

    @Inject(at = @At("HEAD"), method = "ejectItems",cancellable = true)
    private static void init2(Level level, BlockPos pos, HopperBlockEntity blockEntity, CallbackInfoReturnable<Boolean> cir){
        int k = BlockEnchantmentStorage.getLevel(Enchantments.BINDING_CURSE,pos);//漏斗的绑定诅咒
        if(k>0){
            System.out.println("取消传递!");
            cir.cancel();
        }
    }
}
24 无冷却漏斗
https://fuwari.vercel.app/posts/minecraft1_21_0/24_无冷却漏斗/
Author
Flandre923
Published at
2024-08-24