consumer, BlockState brokenBlock, ServerLevel level, BlockPos blockPos, Player player, ItemStack breakingItem
- * ) {
- * if (!(player instanceof ServerPlayer _serverPlayer)) {
- * instance.forEach(consumer);
- * return;
- * }
- * boolean hasTelekinesis = TelekinesisUtils.handleTelekinesis(
- * TelekinesisPolicy.MobDrops,
- * _serverPlayer,
- * breakingItem,
- * serverPlayer -> instance.forEach(item -> {
- * if (!serverPlayer.addItem(item)) consumer.accept(item);
- * })
- * );
- *
- * if (!hasTelekinesis) instance.forEach(consumer);
- * }
- * @WrapWithCondition( method = "getDrops",
- * at = @At(
- * value = "INVOKE",
- * target = "Lnet/minecraft/world/level/block/state/BlockState;spawnAfterBreak(Lnet/minecraft/server/level/ServerLevel;Lnet/minecraft/core/BlockPos;Lnet/minecraft/world/item/ItemStack;Z)V"
- * )
- * )
- * private static boolean redirectAfterDrops(
- * BlockState instance,
- * ServerLevel world,
- * BlockPos pos,
- * ItemStack tool,
- * boolean dropExperience,
- * BlockState brokenBlock,
- * ServerLevel level,
- * BlockPos blockPos,
- * Player _player,
- * ItemStack breakingItem
- * ) {
- * if (!(_player instanceof ServerPlayer _serverPlayer)) return true;
- *
- * Block block = brokenBlock.getBlock();
- * if (EnchantmentHelper.hasSilkTouch(breakingItem)) return true;
- * boolean hasTelekinesis = TelekinesisUtils.handleTelekinesisBlock(
- * TelekinesisPolicy.ExpDrops,
- * _serverPlayer,
- * breakingItem,
- * player -> {
- * int expToAdd = 0;
- * if (block instanceof DropExperienceBlock expBlock)
- * expToAdd = ((DropExperienceBlockAccessor) expBlock).getXpRange().sample(level.random);
- * if (block instanceof RedStoneOreBlock) expToAdd = 1 + level.random.nextInt(5);
- * if (block instanceof SculkCatalystBlock catalystBlock)
- * expToAdd = ((CatalystBlockAccessor) catalystBlock).getXpRange().sample(level.random);
- * if (block instanceof SculkSensorBlock || block instanceof SculkShriekerBlock)
- * expToAdd = ConstantInt.of(5).sample(level.random);
- * if (block instanceof SpawnerBlock) expToAdd = level.random.nextInt(15) + level.random.nextInt(15);
- * if (block instanceof InfestedBlock infestedBlock)
- * infestedBlock.spawnAfterBreak(brokenBlock, level, blockPos, breakingItem, true);
- * PlayerUtils.addExpToPlayer(player, expToAdd);
- * });
- *
- * return !hasTelekinesis;
- * }
- * }
- */
\ No newline at end of file
diff --git a/telekinesis-fabric/src/main/java/dev/nyon/telekinesis/mixins/compat/levelz/BlockMixinMixin.java b/telekinesis-fabric/src/main/java/dev/nyon/telekinesis/mixins/compat/levelz/BlockMixinMixin.java
deleted file mode 100644
index 70f155f..0000000
--- a/telekinesis-fabric/src/main/java/dev/nyon/telekinesis/mixins/compat/levelz/BlockMixinMixin.java
+++ /dev/null
@@ -1,88 +0,0 @@
-package dev.nyon.telekinesis.mixins.compat.levelz;
-
-/*
-@Pseudo
-@Mixin(
- value = Block.class,
- priority = 1500
-)
-public abstract class BlockMixinMixin {
- @Unique
- private static @Nullable ServerPlayer serverPlayer;
-
- @TargetHandler(
- mixin = "net.levelz.mixin.block.BlockMixin",
- name = "getDroppedStacksMixin"
- )
- @WrapWithCondition(
- method = "@MixinSquared:Handler",
- at = @At(
- value = "INVOKE",
- target = "net/minecraft/world/level/block/Block.popResource (Lnet/minecraft/world/level/Level;Lnet/minecraft/core/BlockPos;Lnet/minecraft/world/item/ItemStack;)V"
- )
- )
- private static boolean redirectDroppedStacks(
- Level world,
- BlockPos pos,
- ItemStack stack,
- BlockState state,
- ServerLevel world1,
- BlockPos pos1,
- @Nullable BlockEntity blockEntity,
- @Nullable Entity entity,
- ItemStack tool,
- CallbackInfoReturnable> info,
- LootParams.Builder builder
- ) {
- if (!(entity instanceof ServerPlayer _serverPlayer)) return true;
- final var hasTelekinesis = TelekinesisUtils.handleTelekinesis(TelekinesisPolicy.BlockDrops,
- _serverPlayer,
- tool,
- serverPlayer -> {
- if (!_serverPlayer.addItem(stack)) Block.popResource(world, pos, stack);
- }
- );
- return !hasTelekinesis;
- }
-
- @TargetHandler(
- mixin = "net.levelz.mixin.block.BlockMixin",
- name = "dropExperienceMixin"
- )
- @WrapWithCondition(
- method = "@MixinSquared:Handler",
- at = @At(
- value = "INVOKE",
- target = "net/levelz/entity/LevelExperienceOrbEntity.spawn (Lnet/minecraft/server/level/ServerLevel;Lnet/minecraft/world/phys/Vec3;I)V"
- )
- )
- private static boolean redirectExp(
- ServerLevel world,
- Vec3 pos,
- int amount
- ) {
- final var hasTelekinesis = TelekinesisUtils.handleTelekinesis(TelekinesisPolicy.ExpDrops,
- serverPlayer,
- null,
- serverPlayer -> ((PlayerSyncAccess) serverPlayer).addLevelExperience(amount)
- );
- return !hasTelekinesis;
- }
-
- @Inject(
- method = "playerWillDestroy",
- at = { @At("HEAD") }
- )
- private void onDestroy(
- Level world,
- BlockPos pos,
- BlockState state,
- Player player,
- CallbackInfo info
- ) {
- if (!world.isClientSide) {
- serverPlayer = (ServerPlayer) player;
- }
- }
-}
-*/
\ No newline at end of file
diff --git a/telekinesis-fabric/src/main/java/dev/nyon/telekinesis/mixins/compat/levelz/EnderDragonEntityMixinMixin.java b/telekinesis-fabric/src/main/java/dev/nyon/telekinesis/mixins/compat/levelz/EnderDragonEntityMixinMixin.java
deleted file mode 100644
index 4d19f98..0000000
--- a/telekinesis-fabric/src/main/java/dev/nyon/telekinesis/mixins/compat/levelz/EnderDragonEntityMixinMixin.java
+++ /dev/null
@@ -1,55 +0,0 @@
-package dev.nyon.telekinesis.mixins.compat.levelz;
-
-/*
- * @Pseudo
- * @Mixin( value = EnderDragon.class,
- * priority = 1500
- * )
- * public class EnderDragonEntityMixinMixin {
- * @Unique final EnderDragon instance = (EnderDragon) (Object) this;
- * @TargetHandler( mixin = "net.levelz.mixin.entity.EnderDragonEntityMixin",
- * name = "updatePostDeathMixin"
- * )
- * @WrapWithCondition( method = "@MixinSquared:Handler",
- * at = @At(
- * value = "INVOKE",
- * target = "net/levelz/entity/LevelExperienceOrbEntity.spawn (Lnet/minecraft/server/level/ServerLevel;Lnet/minecraft/world/phys/Vec3;I)V"
- * )
- * )
- * private boolean redirectExp(
- * ServerLevel world,
- * Vec3 pos,
- * int amount
- * ) {
- * if (!(instance.getLastAttacker() instanceof ServerPlayer _serverPlayer)) return true;
- * final var hasTelekinesis = TelekinesisUtils.handleTelekinesis(TelekinesisPolicy.ExpDrops,
- * _serverPlayer,
- * null,
- * serverPlayer -> ((PlayerSyncAccess) serverPlayer).addLevelExperience(amount)
- * );
- * return !hasTelekinesis;
- * }
- * @TargetHandler( mixin = "net.levelz.mixin.entity.EnderDragonEntityMixin",
- * name = "updatePostDeathXPMixin"
- * )
- * @WrapWithCondition( method = "@MixinSquared:Handler",
- * at = @At(
- * value = "INVOKE",
- * target = "net/levelz/entity/LevelExperienceOrbEntity.spawn (Lnet/minecraft/server/level/ServerLevel;Lnet/minecraft/world/phys/Vec3;I)V"
- * )
- * )
- * private boolean redirectExp1(
- * ServerLevel world,
- * Vec3 pos,
- * int amount
- * ) {
- * if (!(instance.getLastAttacker() instanceof ServerPlayer _serverPlayer)) return true;
- * final var hasTelekinesis = TelekinesisUtils.handleTelekinesis(TelekinesisPolicy.ExpDrops,
- * _serverPlayer,
- * null,
- * serverPlayer -> ((PlayerSyncAccess) serverPlayer).addLevelExperience(amount)
- * );
- * return !hasTelekinesis;
- * }
- * }
- */
diff --git a/telekinesis-fabric/src/main/java/dev/nyon/telekinesis/mixins/compat/levelz/FishingBobberEntityMixinMixin.java b/telekinesis-fabric/src/main/java/dev/nyon/telekinesis/mixins/compat/levelz/FishingBobberEntityMixinMixin.java
deleted file mode 100644
index 39235fd..0000000
--- a/telekinesis-fabric/src/main/java/dev/nyon/telekinesis/mixins/compat/levelz/FishingBobberEntityMixinMixin.java
+++ /dev/null
@@ -1,36 +0,0 @@
-package dev.nyon.telekinesis.mixins.compat.levelz;
-
-/*
- * @Pseudo
- * @Mixin( value = FishingHook.class,
- * priority = 1500
- * )
- * public abstract class FishingBobberEntityMixinMixin {
- * @Shadow
- * @Nullable public abstract Player getPlayerOwner();
- * @TargetHandler( mixin = "net.levelz.mixin.entity.FishingBobberEntityMixin",
- * name = "useMixin"
- * )
- * @WrapWithCondition( method = "@MixinSquared:Handler",
- * at = @At(
- * value = "INVOKE",
- * target = "net/levelz/entity/LevelExperienceOrbEntity.spawn (Lnet/minecraft/server/level/ServerLevel;Lnet/minecraft/world/phys/Vec3;I)V"
- * )
- * )
- * private boolean redirectExp(
- * ServerLevel world,
- * Vec3 pos,
- * int amount,
- * ItemStack usedItem,
- * CallbackInfoReturnable info
- * ) {
- * if (!(getPlayerOwner() instanceof ServerPlayer _serverPlayer)) return true;
- * final var hasTelekinesis = TelekinesisUtils.handleTelekinesis(TelekinesisPolicy.ExpDrops,
- * _serverPlayer,
- * usedItem,
- * serverPlayer -> ((PlayerSyncAccess) serverPlayer).addLevelExperience(amount)
- * );
- * return !hasTelekinesis;
- * }
- * }
- */
diff --git a/telekinesis-fabric/src/main/java/dev/nyon/telekinesis/mixins/compat/levelz/LevelExperienceOrbAccessor.java b/telekinesis-fabric/src/main/java/dev/nyon/telekinesis/mixins/compat/levelz/LevelExperienceOrbAccessor.java
deleted file mode 100644
index b070c36..0000000
--- a/telekinesis-fabric/src/main/java/dev/nyon/telekinesis/mixins/compat/levelz/LevelExperienceOrbAccessor.java
+++ /dev/null
@@ -1,9 +0,0 @@
-package dev.nyon.telekinesis.mixins.compat.levelz;
-
-/*
- * @Pseudo
- * @Mixin(LevelExperienceOrbEntity.class) public interface LevelExperienceOrbAccessor {
- * @Accessor Player getTarget();
- * @Invoker("getClumpedMap") Map invokeGetClumpedMap();
- * }
- */
\ No newline at end of file
diff --git a/telekinesis-fabric/src/main/java/dev/nyon/telekinesis/mixins/compat/levelz/LevelExperienceOrbEntityMixin.java b/telekinesis-fabric/src/main/java/dev/nyon/telekinesis/mixins/compat/levelz/LevelExperienceOrbEntityMixin.java
deleted file mode 100644
index 2e62593..0000000
--- a/telekinesis-fabric/src/main/java/dev/nyon/telekinesis/mixins/compat/levelz/LevelExperienceOrbEntityMixin.java
+++ /dev/null
@@ -1,34 +0,0 @@
-package dev.nyon.telekinesis.mixins.compat.levelz;
-
-/*
- * @Pseudo
- * @Mixin(net.levelz.entity.LevelExperienceOrbEntity.class) public class LevelExperienceOrbEntityMixin {
- * @WrapWithCondition( method = "spawn",
- * at = @At(
- * value = "INVOKE",
- * target = "Lnet/minecraft/server/level/ServerLevel;addFreshEntity(Lnet/minecraft/world/entity/Entity;)Z"
- * )
- * )
- * private static boolean redirectSpawnOnTelekinesis(
- * ServerLevel level,
- * Entity entity
- * ) {
- * if (!(entity instanceof LevelExperienceOrbEntity expOrb)) return true;
- *
- * Player target = ((LevelExperienceOrbAccessor) expOrb).getTarget();
- * if (target == null || target.distanceToSqr(expOrb) > 64.0) {
- * target = level.getNearestPlayer(expOrb, 8.0);
- * }
- * if (!(target instanceof ServerPlayer _serverPlayer)) return true;
- *
- * final var hasTelekinesis = TelekinesisUtils.handleTelekinesis(
- * TelekinesisPolicy.ExpDrops,
- * _serverPlayer,
- * null,
- * serverPlayer -> ((LevelExperienceOrbAccessor) expOrb).invokeGetClumpedMap()
- * .forEach((value, amount) -> ((PlayerSyncAccess) serverPlayer).addLevelExperience(value * amount))
- * );
- * return !hasTelekinesis;
- * }
- * }
- */
\ No newline at end of file
diff --git a/telekinesis-fabric/src/main/java/dev/nyon/telekinesis/mixins/compat/levelz/LevelZMixinPlugin.java b/telekinesis-fabric/src/main/java/dev/nyon/telekinesis/mixins/compat/levelz/LevelZMixinPlugin.java
deleted file mode 100644
index 680ca49..0000000
--- a/telekinesis-fabric/src/main/java/dev/nyon/telekinesis/mixins/compat/levelz/LevelZMixinPlugin.java
+++ /dev/null
@@ -1,61 +0,0 @@
-package dev.nyon.telekinesis.mixins.compat.levelz;
-
-import net.fabricmc.loader.api.FabricLoader;
-import org.objectweb.asm.tree.ClassNode;
-import org.spongepowered.asm.mixin.extensibility.IMixinConfigPlugin;
-import org.spongepowered.asm.mixin.extensibility.IMixinInfo;
-
-import java.util.List;
-import java.util.Set;
-
-@SuppressWarnings("unused")
-public class LevelZMixinPlugin implements IMixinConfigPlugin {
- @Override
- public void onLoad(String mixinPackage) {
-
- }
-
- @Override
- public String getRefMapperConfig() {
- return null;
- }
-
- @Override
- public boolean shouldApplyMixin(
- String targetClassName,
- String mixinClassName
- ) {
- return FabricLoader.getInstance()
- .isModLoaded("levelz");
- }
-
- @Override
- public void acceptTargets(
- Set myTargets,
- Set otherTargets
- ) {
- }
-
- @Override
- public List getMixins() {
- return null;
- }
-
- @Override
- public void preApply(
- String targetClassName,
- ClassNode targetClass,
- String mixinClassName,
- IMixinInfo mixinInfo
- ) {
- }
-
- @Override
- public void postApply(
- String targetClassName,
- ClassNode targetClass,
- String mixinClassName,
- IMixinInfo mixinInfo
- ) {
- }
-}
diff --git a/telekinesis-fabric/src/main/java/dev/nyon/telekinesis/mixins/compat/levelz/LivingEntityMixinMixin.java b/telekinesis-fabric/src/main/java/dev/nyon/telekinesis/mixins/compat/levelz/LivingEntityMixinMixin.java
deleted file mode 100644
index e40ac1d..0000000
--- a/telekinesis-fabric/src/main/java/dev/nyon/telekinesis/mixins/compat/levelz/LivingEntityMixinMixin.java
+++ /dev/null
@@ -1,35 +0,0 @@
-package dev.nyon.telekinesis.mixins.compat.levelz;
-
-/*
- * @Pseudo
- * @Mixin( value = LivingEntity.class,
- * priority = 1500
- * )
- * public class LivingEntityMixinMixin {
- * @Unique final LivingEntity instance = (LivingEntity) (Object) this;
- * @TargetHandler( mixin = "net.levelz.mixin.entity.LivingEntityMixin",
- * name = "dropXpMixin"
- * )
- * @WrapWithCondition( method = "@MixinSquared:Handler",
- * at = @At(
- * value = "INVOKE",
- * target = "net/levelz/entity/LevelExperienceOrbEntity.spawn (Lnet/minecraft/server/level/ServerLevel;Lnet/minecraft/world/phys/Vec3;I)V"
- * )
- * )
- * protected boolean redirectLevelZExpDrop(
- * ServerLevel world,
- * Vec3 pos,
- * int amount
- * ) {
- * if (!(instance.getLastAttacker() instanceof ServerPlayer _serverPlayer)) return true;
- * System.out.println("wtf" + amount);
- * System.out.println(amount);
- * final var hasTelekinesis = TelekinesisUtils.handleTelekinesis(TelekinesisPolicy.ExpDrops,
- * _serverPlayer,
- * null,
- * serverPlayer -> ((PlayerSyncAccess) serverPlayer).addLevelExperience(amount)
- * );
- * return !hasTelekinesis;
- * }
- * }
- */
\ No newline at end of file
diff --git a/telekinesis-fabric/src/main/java/dev/nyon/telekinesis/mixins/compat/levelz/PlantBlockMixinMixin.java b/telekinesis-fabric/src/main/java/dev/nyon/telekinesis/mixins/compat/levelz/PlantBlockMixinMixin.java
deleted file mode 100644
index 4b5704e..0000000
--- a/telekinesis-fabric/src/main/java/dev/nyon/telekinesis/mixins/compat/levelz/PlantBlockMixinMixin.java
+++ /dev/null
@@ -1,39 +0,0 @@
-package dev.nyon.telekinesis.mixins.compat.levelz;
-
-/*
- * @Pseudo
- * @Mixin( value = BushBlock.class,
- * priority = 1500
- * )
- * public class PlantBlockMixinMixin extends Block {
- *
- * public PlantBlockMixinMixin(Properties properties) {
- * super(properties);
- * }
- * @WrapWithCondition( method = "playerWillDestroy(Lnet/minecraft/world/level/Level;Lnet/minecraft/core/BlockPos;Lnet/minecraft/world/level/block/state/BlockState;Lnet/minecraft/world/entity/player/Player;)V",
- * at = @At(
- * value = "INVOKE",
- * target = "net/minecraft/world/level/block/Block.popResource (Lnet/minecraft/world/level/Level;Lnet/minecraft/core/BlockPos;Lnet/minecraft/world/item/ItemStack;)V"
- * )
- * )
- * private boolean checkTelekinesisAndRedirect(
- * Level world,
- * BlockPos pos,
- * ItemStack stack,
- * Level world1,
- * BlockPos pos1,
- * BlockState state,
- * Player player
- * ) {
- * if (!(player instanceof ServerPlayer _serverPlayer)) return true;
- * final var hasTelekinesis = TelekinesisUtils.handleTelekinesis(TelekinesisPolicy.BlockDrops,
- * _serverPlayer,
- * null,
- * serverPlayer -> {
- * if (!serverPlayer.addItem(stack)) Block.popResource(world, pos, stack);
- * }
- * );
- * return !hasTelekinesis;
- * }
- * }
- */
\ No newline at end of file
diff --git a/telekinesis-fabric/src/main/java/dev/nyon/telekinesis/mixins/compat/treeharvester/TreeCutEventsMixin.java b/telekinesis-fabric/src/main/java/dev/nyon/telekinesis/mixins/compat/treeharvester/TreeCutEventsMixin.java
deleted file mode 100644
index 2da886a..0000000
--- a/telekinesis-fabric/src/main/java/dev/nyon/telekinesis/mixins/compat/treeharvester/TreeCutEventsMixin.java
+++ /dev/null
@@ -1,44 +0,0 @@
-package dev.nyon.telekinesis.mixins.compat.treeharvester;
-
-/*
-@Pseudo
-@Mixin(targets = "com.natamus.treeharvester_common_fabric.events.TreeCutEvents")
-public class TreeCutEventsMixin {
-
- @Redirect(
- method = "onTreeHarvest",
- at = @At(
- value = "INVOKE",
- target = "Lcom/natamus/collective_common_fabric/functions/BlockFunctions;dropBlock(Lnet/minecraft/world/level/Level;Lnet/minecraft/core/BlockPos;)V"
- )
- )
- private static void redirectDrop(
- Level level,
- BlockPos blockPos,
- Level _level,
- Player player,
- BlockPos bpos,
- BlockState state,
- BlockEntity blockEntity
- ) {
- if ((EnchantmentHelper.getItemEnchantmentLevel(
- MainKt.getTelekinesis(),
- player.getItemInHand(InteractionHand.MAIN_HAND)
- ) == 0 && !TelekinesisConfigKt.getConfig()
- .getOnByDefault()) || !TelekinesisConfigKt.getConfig()
- .getBlockDrops() || !(level instanceof ServerLevel serverLevel)) return;
-
- BlockState blockState = level.getBlockState(blockPos);
- BlockEntity tileEntity = level.getBlockEntity(blockPos);
-
- List drops = Block.getDrops(blockState, serverLevel, blockPos, tileEntity);
-
- drops.forEach(item -> {
- if (!player.addItem(item)) Block.popResource(serverLevel, blockPos, item);
- });
-
- serverLevel.setBlock(blockPos, Blocks.AIR.defaultBlockState(), 3);
- }
-}
-
- */
\ No newline at end of file
diff --git a/telekinesis-fabric/src/main/java/dev/nyon/telekinesis/mixins/compat/treeharvester/TreeHarvesterMixinPlugin.java b/telekinesis-fabric/src/main/java/dev/nyon/telekinesis/mixins/compat/treeharvester/TreeHarvesterMixinPlugin.java
deleted file mode 100644
index e1d653f..0000000
--- a/telekinesis-fabric/src/main/java/dev/nyon/telekinesis/mixins/compat/treeharvester/TreeHarvesterMixinPlugin.java
+++ /dev/null
@@ -1,60 +0,0 @@
-package dev.nyon.telekinesis.mixins.compat.treeharvester;
-
-import net.fabricmc.loader.api.FabricLoader;
-import org.objectweb.asm.tree.ClassNode;
-import org.spongepowered.asm.mixin.extensibility.IMixinConfigPlugin;
-import org.spongepowered.asm.mixin.extensibility.IMixinInfo;
-
-import java.util.List;
-import java.util.Set;
-
-@SuppressWarnings("unused")
-public class TreeHarvesterMixinPlugin implements IMixinConfigPlugin {
- @Override
- public void onLoad(String mixinPackage) {
- }
-
- @Override
- public String getRefMapperConfig() {
- return null;
- }
-
- @Override
- public boolean shouldApplyMixin(
- String targetClassName,
- String mixinClassName
- ) {
- return FabricLoader.getInstance()
- .isModLoaded("treeharvester");
- }
-
- @Override
- public void acceptTargets(
- Set myTargets,
- Set otherTargets
- ) {
- }
-
- @Override
- public List getMixins() {
- return null;
- }
-
- @Override
- public void preApply(
- String targetClassName,
- ClassNode targetClass,
- String mixinClassName,
- IMixinInfo mixinInfo
- ) {
- }
-
- @Override
- public void postApply(
- String targetClassName,
- ClassNode targetClass,
- String mixinClassName,
- IMixinInfo mixinInfo
- ) {
- }
-}
diff --git a/telekinesis-fabric/src/main/java/dev/nyon/telekinesis/utils/EntityUtils.java b/telekinesis-fabric/src/main/java/dev/nyon/telekinesis/utils/EntityUtils.java
deleted file mode 100644
index f06e1a9..0000000
--- a/telekinesis-fabric/src/main/java/dev/nyon/telekinesis/utils/EntityUtils.java
+++ /dev/null
@@ -1,65 +0,0 @@
-package dev.nyon.telekinesis.utils;
-
-import dev.nyon.telekinesis.TelekinesisPolicy;
-import net.minecraft.server.level.ServerPlayer;
-import net.minecraft.world.damagesource.DamageSource;
-import net.minecraft.world.entity.LivingEntity;
-import net.minecraft.world.item.Item;
-import net.minecraft.world.item.ItemStack;
-import net.minecraft.world.level.ItemLike;
-
-import java.util.concurrent.atomic.AtomicReference;
-
-public class EntityUtils {
-
- public static boolean spawnAtLocationInject(
- LivingEntity entity,
- ItemLike item
- ) {
- return spawnAtLocationInject(
- entity,
- item.asItem()
- .getDefaultInstance()
- );
- }
-
- public static boolean spawnAtLocationInject(
- LivingEntity entity,
- ItemStack item
- ) {
- final var attacker = entity.getLastAttacker();
-
- return spawnAtLocationAttacker(attacker, item);
- }
-
- public static boolean spawnAtLocationAttacker(LivingEntity attacker, ItemStack item) {
- if (!(attacker instanceof ServerPlayer serverPlayer)) return true;
-
- boolean hasTelekinesis = TelekinesisUtils.handleTelekinesis(TelekinesisPolicy.MobDrops,
- serverPlayer,
- serverPlayer.getMainHandItem(),
- player -> {
- if (!player.addItem(item)) attacker.spawnAtLocation(item);
- }
- );
-
- return !hasTelekinesis;
- }
-
- public static Item getDropItemInject(
- Item original,
- DamageSource source
- ) {
- final var attacker = source.getEntity();
- if (!(attacker instanceof ServerPlayer)) return original;
-
- AtomicReference- toReturn = new AtomicReference<>(original);
-
- TelekinesisUtils.handleTelekinesis(TelekinesisPolicy.VehicleDrops, source, player -> {
- if (player.addItem(original.asItem()
- .getDefaultInstance())) toReturn.set(ItemStack.EMPTY.getItem());
- });
-
- return toReturn.get();
- }
-}
diff --git a/telekinesis-fabric/src/main/java/dev/nyon/telekinesis/utils/PlayerUtils.java b/telekinesis-fabric/src/main/java/dev/nyon/telekinesis/utils/PlayerUtils.java
deleted file mode 100644
index e6ad9ba..0000000
--- a/telekinesis-fabric/src/main/java/dev/nyon/telekinesis/utils/PlayerUtils.java
+++ /dev/null
@@ -1,33 +0,0 @@
-package dev.nyon.telekinesis.utils;
-
-import net.minecraft.world.entity.EquipmentSlot;
-import net.minecraft.world.entity.player.Player;
-import net.minecraft.world.item.ItemStack;
-import net.minecraft.world.item.enchantment.EnchantmentHelper;
-import net.minecraft.world.item.enchantment.Enchantments;
-
-import java.util.Map;
-
-public class PlayerUtils {
- public static void addExpToPlayer(
- Player player,
- Integer exp
- ) {
- var remainingExp = repairPlayerItems(player, exp);
- if (remainingExp > 0) player.giveExperiencePoints(remainingExp);
- }
-
- private static int repairPlayerItems(
- Player player,
- Integer exp
- ) {
- Map.Entry entry = EnchantmentHelper.getRandomItemWith(Enchantments.MENDING, player, ItemStack::isDamaged);
- if (entry != null) {
- ItemStack itemStack = entry.getValue();
- int j = Math.min(exp * 2, itemStack.getDamageValue());
- itemStack.setDamageValue(itemStack.getDamageValue() - j);
- int k = exp - j * 2;
- return k > 0 ? repairPlayerItems(player, k) : 0;
- } else return exp;
- }
-}
diff --git a/telekinesis-fabric/src/main/java/dev/nyon/telekinesis/utils/TelekinesisUtils.java b/telekinesis-fabric/src/main/java/dev/nyon/telekinesis/utils/TelekinesisUtils.java
deleted file mode 100644
index 0be0142..0000000
--- a/telekinesis-fabric/src/main/java/dev/nyon/telekinesis/utils/TelekinesisUtils.java
+++ /dev/null
@@ -1,94 +0,0 @@
-package dev.nyon.telekinesis.utils;
-
-import dev.nyon.telekinesis.MainKt;
-import dev.nyon.telekinesis.TelekinesisConfigKt;
-import dev.nyon.telekinesis.TelekinesisPolicy;
-import net.minecraft.server.level.ServerPlayer;
-import net.minecraft.world.damagesource.DamageSource;
-import net.minecraft.world.entity.Entity;
-import net.minecraft.world.entity.LivingEntity;
-import net.minecraft.world.item.ItemStack;
-import net.minecraft.world.item.enchantment.EnchantmentHelper;
-import org.jetbrains.annotations.Nullable;
-
-import java.util.function.Consumer;
-
-public class TelekinesisUtils {
-
- public static boolean handleTelekinesisBlock(
- TelekinesisPolicy neededPolicy,
- Entity entity,
- ItemStack tool,
- Consumer consumer
- ) {
- if (!(entity instanceof ServerPlayer serverPlayer)) return false;
- return handleTelekinesis(neededPolicy, serverPlayer, tool, consumer);
- }
-
- public static boolean handleTelekinesis(
- TelekinesisPolicy neededPolicy,
- LivingEntity target,
- Consumer consumer
- ) {
- LivingEntity attacker = target.getLastAttacker();
- if (attacker == null) return false;
- if (!(attacker instanceof ServerPlayer serverPlayer)) return false;
- return handleTelekinesis(neededPolicy, serverPlayer, null, consumer);
- }
-
- public static boolean handleTelekinesis(
- TelekinesisPolicy neededPolicy,
- DamageSource source,
- Consumer consumer
- ) {
- if (source == null) return false;
- Entity attacker = source.getEntity();
- if (attacker == null) return false;
- if (!(attacker instanceof ServerPlayer serverPlayer)) return false;
- return handleTelekinesis(neededPolicy, serverPlayer, null, consumer);
- }
-
-
- public static boolean handleTelekinesis(
- TelekinesisPolicy neededPolicy,
- ServerPlayer player,
- @Nullable ItemStack itemStack,
- Consumer consumer
- ) {
- if (!neededPolicy.isEnabled()) return false;
- if (!playerMeetsConditions(neededPolicy, player, itemStack)) return false;
-
- consumer.accept(player);
- return true;
- }
-
- private static boolean playerMeetsConditions(
- TelekinesisPolicy policy,
- ServerPlayer player,
- @Nullable ItemStack itemStack
- ) {
- boolean conditionsMet = false;
-
- boolean isEnabledByDefault = TelekinesisConfigKt.getConfig()
- .getOnByDefault();
-
- boolean hasArmorTelekinesis = player.getInventory().armor.stream()
- .allMatch(item -> EnchantmentHelper.getItemEnchantmentLevel(MainKt.getTelekinesis(), item) > 0);
- boolean hasMainHandTelekinesis = (itemStack != null && EnchantmentHelper.getItemEnchantmentLevel(MainKt.getTelekinesis(),
- itemStack
- ) > 0) || EnchantmentHelper.getItemEnchantmentLevel(MainKt.getTelekinesis(), player.getMainHandItem()) > 0;
- boolean hasOffHandTelekinesis = EnchantmentHelper.getItemEnchantmentLevel(MainKt.getTelekinesis(), player.getOffhandItem()) > 0;
-
- if (isEnabledByDefault) conditionsMet = true;
- else switch (policy) {
- case ExpDrops -> conditionsMet = hasArmorTelekinesis || hasMainHandTelekinesis || hasOffHandTelekinesis;
- case MobDrops, ShearingDrops, VehicleDrops, FishingDrops -> conditionsMet = hasMainHandTelekinesis || hasOffHandTelekinesis;
- case BlockDrops -> conditionsMet = hasMainHandTelekinesis;
- }
-
- if (TelekinesisConfigKt.getConfig()
- .getOnlyOnSneak() && !player.isCrouching()) conditionsMet = false;
-
- return conditionsMet;
- }
-}
diff --git a/telekinesis-fabric/src/main/kotlin/dev/nyon/telekinesis/Main.kt b/telekinesis-fabric/src/main/kotlin/dev/nyon/telekinesis/Main.kt
deleted file mode 100644
index 6c67387..0000000
--- a/telekinesis-fabric/src/main/kotlin/dev/nyon/telekinesis/Main.kt
+++ /dev/null
@@ -1,12 +0,0 @@
-@file:Suppress("unused")
-
-package dev.nyon.telekinesis
-
-import net.minecraft.server.MinecraftServer
-
-var server: MinecraftServer? = null
-lateinit var telekinesis: TelekinesisEnchantment
-
-fun init() {
- loadConfig()
-}
diff --git a/telekinesis-fabric/src/main/kotlin/dev/nyon/telekinesis/TelekinesisConfig.kt b/telekinesis-fabric/src/main/kotlin/dev/nyon/telekinesis/TelekinesisConfig.kt
deleted file mode 100644
index 1e6f973..0000000
--- a/telekinesis-fabric/src/main/kotlin/dev/nyon/telekinesis/TelekinesisConfig.kt
+++ /dev/null
@@ -1,76 +0,0 @@
-package dev.nyon.telekinesis
-
-import com.akuleshov7.ktoml.Toml
-import com.akuleshov7.ktoml.annotations.TomlComments
-import kotlinx.serialization.Serializable
-import kotlinx.serialization.decodeFromString
-import net.fabricmc.loader.api.FabricLoader
-import java.nio.file.Path
-import kotlin.io.path.createFile
-import kotlin.io.path.exists
-import kotlin.io.path.readText
-import kotlin.io.path.writeText
-
-@Serializable
-data class TelekinesisConfig(
- @TomlComments(
- "Uncomment the following values if you want to change them:",
- "",
- "Decides whether telekinesis can be used without the enchantment."
- )
- var onByDefault: Boolean = false,
- @TomlComments(
- "Decides whether players should be required to sneak to use telekinesis."
- )
- var onlyOnSneak: Boolean = false,
- @TomlComments(
- "Decides whether to add the enchantment to the game."
- )
- var enchantment: Boolean = true,
- @TomlComments(
- "Decides whether telekinesis can be used for block drops."
- )
- var blockDrops: Boolean = true,
- @TomlComments(
- "Decides whether telekinesis can be used for exp drops."
- )
- var expDrops: Boolean = true,
- @TomlComments(
- "Decides whether telekinesis can be used for mob drops."
- )
- var mobDrops: Boolean = true,
- @TomlComments(
- "Decides whether telekinesis can be used for vehicle drops."
- )
- var vehicleDrops: Boolean = true,
- @TomlComments(
- "Decides whether telekinesis can be used for shearing drops."
- )
- var shearingDrops: Boolean = true,
- @TomlComments(
- "Decides whether telekinesis can be used for fishing drops."
- )
- var fishingDrops: Boolean = true
-)
-
-var config: TelekinesisConfig = TelekinesisConfig()
-lateinit var configPath: Path
-
-fun saveConfig() = configPath.writeText(Toml.encodeToString(TelekinesisConfig.serializer(), config))
-
-fun loadConfig() {
- configPath =
- FabricLoader.getInstance().configDir.toAbsolutePath().resolve("telekinesis.toml")
- .also { if (!it.exists()) it.createFile() }
-
- if (configPath.readText().isEmpty()) {
- saveConfig()
- return
- }
-
- try {
- config = Toml.decodeFromString(configPath.readText())
- } catch (e: Exception) {
- saveConfig()
- }
-}
diff --git a/telekinesis-fabric/src/main/kotlin/dev/nyon/telekinesis/TelekinesisConfigScreen.kt b/telekinesis-fabric/src/main/kotlin/dev/nyon/telekinesis/TelekinesisConfigScreen.kt
deleted file mode 100644
index b0b1986..0000000
--- a/telekinesis-fabric/src/main/kotlin/dev/nyon/telekinesis/TelekinesisConfigScreen.kt
+++ /dev/null
@@ -1,138 +0,0 @@
-package dev.nyon.telekinesis
-
-import dev.isxander.yacl3.api.ConfigCategory
-import dev.isxander.yacl3.api.Option
-import dev.isxander.yacl3.api.OptionDescription
-import dev.isxander.yacl3.api.YetAnotherConfigLib
-import dev.isxander.yacl3.api.controller.TickBoxControllerBuilder
-import net.minecraft.client.gui.screens.Screen
-import net.minecraft.network.chat.Component
-
-fun generateConfigScreen(parent: Screen? = null): Screen {
- val configScreenBuilder = YetAnotherConfigLib.createBuilder()
- configScreenBuilder.title(Component.translatable("menu.telekinesis.name"))
- configScreenBuilder.appendOptionCategory()
- configScreenBuilder.save { saveConfig() }
- val configScreen = configScreenBuilder.build()
- return configScreen.generateScreen(parent)
-}
-
-fun YetAnotherConfigLib.Builder.appendOptionCategory() {
- this.category(
- ConfigCategory.createBuilder()
- .name(Component.translatable("menu.telekinesis.config.general"))
- .option(
- Option.createBuilder()
- .name(Component.translatable("menu.telekinesis.config.general.onbydefault"))
- .description(
- OptionDescription
- .of(Component.translatable("menu.telekinesis.config.general.onbydefault.description"))
- )
- .binding(config.onByDefault, { config.onByDefault }, { config.onByDefault = it })
- .controller {
- TickBoxControllerBuilder.create(it)
- }.build()
- )
- .option(
- Option.createBuilder()
- .name(Component.translatable("menu.telekinesis.config.general.onlywhilesneaking"))
- .description(
- OptionDescription
- .of(
- Component.translatable("menu.telekinesis.config.general.onlywhilesneaking.description")
- )
- )
- .binding(config.onlyOnSneak, { config.onlyOnSneak }, { config.onlyOnSneak = it })
- .controller {
- TickBoxControllerBuilder.create(it)
- }.build()
- )
- .option(
- Option.createBuilder()
- .name(Component.translatable("menu.telekinesis.config.general.enchantment"))
- .description(
- OptionDescription.of(
- Component.translatable("menu.telekinesis.config.general.enchantment.description1"),
- Component.translatable("menu.telekinesis.config.general.enchantment.description2")
- )
- )
- .binding(config.enchantment, { config.enchantment }, { config.enchantment = it })
- .controller {
- TickBoxControllerBuilder.create(it)
- }.build()
- )
- .option(
- Option.createBuilder()
- .name(Component.translatable("menu.telekinesis.config.general.blockdrops"))
- .description(
- OptionDescription
- .of(Component.translatable("menu.telekinesis.config.general.blockdrops.description"))
- )
- .binding(config.blockDrops, { config.blockDrops }, { config.blockDrops = it })
- .controller {
- TickBoxControllerBuilder.create(it)
- }.build()
- )
- .option(
- Option.createBuilder()
- .name(Component.translatable("menu.telekinesis.config.general.expdrops"))
- .description(
- OptionDescription
- .of(Component.translatable("menu.telekinesis.config.general.expdrops.description"))
- )
- .binding(config.expDrops, { config.expDrops }, { config.expDrops = it })
- .controller {
- TickBoxControllerBuilder.create(it)
- }.build()
- )
- .option(
- Option.createBuilder()
- .name(Component.translatable("menu.telekinesis.config.general.mobdrops"))
- .description(
- OptionDescription
- .of(Component.translatable("menu.telekinesis.config.general.mobdrops.description"))
- )
- .binding(config.mobDrops, { config.mobDrops }, { config.mobDrops = it })
- .controller {
- TickBoxControllerBuilder.create(it)
- }.build()
- )
- .option(
- Option.createBuilder()
- .name(Component.translatable("menu.telekinesis.config.general.vehicledrops"))
- .description(
- OptionDescription
- .of(Component.translatable("menu.telekinesis.config.general.vehicledrops.description"))
- )
- .binding(config.vehicleDrops, { config.vehicleDrops }, { config.vehicleDrops = it })
- .controller {
- TickBoxControllerBuilder.create(it)
- }.build()
- )
- .option(
- Option.createBuilder()
- .name(Component.translatable("menu.telekinesis.config.general.shearingdrops"))
- .description(
- OptionDescription
- .of(Component.translatable("menu.telekinesis.config.general.shearingdrops.description"))
- )
- .binding(config.shearingDrops, { config.shearingDrops }, { config.shearingDrops = it })
- .controller {
- TickBoxControllerBuilder.create(it)
- }.build()
- )
- .option(
- Option.createBuilder()
- .name(Component.translatable("menu.telekinesis.config.general.fishingdrops"))
- .description(
- OptionDescription
- .of(Component.translatable("menu.telekinesis.config.general.fishingdrops.description"))
- )
- .binding(config.fishingDrops, { config.fishingDrops }, { config.fishingDrops = it })
- .controller {
- TickBoxControllerBuilder.create(it)
- }.build()
- )
- .build()
- )
-}
diff --git a/telekinesis-fabric/src/main/kotlin/dev/nyon/telekinesis/TelekinesisEnchantment.kt b/telekinesis-fabric/src/main/kotlin/dev/nyon/telekinesis/TelekinesisEnchantment.kt
deleted file mode 100644
index 899024c..0000000
--- a/telekinesis-fabric/src/main/kotlin/dev/nyon/telekinesis/TelekinesisEnchantment.kt
+++ /dev/null
@@ -1,49 +0,0 @@
-package dev.nyon.telekinesis
-
-import net.minecraft.network.chat.Component
-import net.minecraft.network.chat.Style
-import net.minecraft.world.item.enchantment.Enchantment
-import net.minecraft.world.entity.EquipmentSlot
-/*? >1.20.5 {*//*
-import net.minecraft.tags.ItemTags
-*//*?} else {*/
-import net.minecraft.world.damagesource.DamageSource
-import net.minecraft.world.entity.MobType
-import net.minecraft.world.item.enchantment.EnchantmentCategory
-/*?}*/
-
-
-
-/*? >1.20.5 {*//*
-class TelekinesisEnchantment : Enchantment(
- definition(
- ItemTags.DURABILITY_ENCHANTABLE,
- 2,
- 1,
- dynamicCost(25, 25),
- dynamicCost(75, 25),
- 5,
- *EquipmentSlot.entries.toTypedArray()
- )
-) {
- override fun getFullname(i: Int): Component =
- Component.translatable("enchantment.telekinesis.telekinesis.name").withStyle(Style.EMPTY.withColor(0xFFB64C))
-}
-*//*?} else {*/
-class TelekinesisEnchantment : Enchantment(
- Rarity.RARE, EnchantmentCategory.BREAKABLE, listOf(EquipmentSlot.OFFHAND, EquipmentSlot.MAINHAND).toTypedArray()
-) {
-
- override fun getMinLevel(): Int = 1
- override fun getMaxLevel(): Int = 1
-
- override fun getMinCost(i: Int): Int = 25
- override fun getMaxCost(i: Int): Int = 50
-
- override fun getDamageProtection(i: Int, damageSource: DamageSource): Int = 0
- override fun getDamageBonus(i: Int, mobType: MobType): Float = 0F
-
- override fun getFullname(i: Int): Component =
- Component.translatable("enchantment.telekinesis.telekinesis.name").withStyle(Style.EMPTY.withColor(0xFFB64C))
-}
-/*?}*/
diff --git a/telekinesis-fabric/src/main/kotlin/dev/nyon/telekinesis/TelekinesisPolicy.kt b/telekinesis-fabric/src/main/kotlin/dev/nyon/telekinesis/TelekinesisPolicy.kt
deleted file mode 100644
index 3c8e44c..0000000
--- a/telekinesis-fabric/src/main/kotlin/dev/nyon/telekinesis/TelekinesisPolicy.kt
+++ /dev/null
@@ -1,20 +0,0 @@
-package dev.nyon.telekinesis
-
-enum class TelekinesisPolicy {
- BlockDrops,
- ExpDrops,
- MobDrops,
- VehicleDrops,
- ShearingDrops,
- FishingDrops;
-
- fun isEnabled(): Boolean =
- when (this) {
- BlockDrops -> config.blockDrops
- ExpDrops -> config.expDrops
- MobDrops -> config.mobDrops
- VehicleDrops -> config.vehicleDrops
- ShearingDrops -> config.shearingDrops
- FishingDrops -> config.fishingDrops
- }
-}
diff --git a/telekinesis-fabric/src/main/resources/assets/telekinesis/lang/de_de.json b/telekinesis-fabric/src/main/resources/assets/telekinesis/lang/de_de.json
deleted file mode 100644
index 880f4a2..0000000
--- a/telekinesis-fabric/src/main/resources/assets/telekinesis/lang/de_de.json
+++ /dev/null
@@ -1,24 +0,0 @@
-{
- "menu.telekinesis.name": "telekinesis",
- "menu.telekinesis.config.general": "Allgemein",
- "menu.telekinesis.config.general.onbydefault": "Immer an",
- "menu.telekinesis.config.general.onbydefault.description": "Entscheidet, ob Telekinesis immer an sein sollte, auch ohne das Enchantment.",
- "menu.telekinesis.config.general.onlywhilesneaking": "Nur beim sneaken",
- "menu.telekinesis.config.general.onlywhilesneaking.description": "Entscheidet, ob Telekinesis nur funktionieren sollte, wenn man sneakt.",
- "menu.telekinesis.config.general.enchantment": "Enchantment",
- "menu.telekinesis.config.general.enchantment.description1": "Entscheidet, ob das Enchantment registriert werden soll.",
- "menu.telekinesis.config.general.enchantment.description2": "Benötigt einen Neustart des Spiels!",
- "menu.telekinesis.config.general.blockdrops": "Drops von Blöcken",
- "menu.telekinesis.config.general.blockdrops.description": "Entscheidet, ob Telekinesis für Drops von Blöcken funktionieren soll.",
- "menu.telekinesis.config.general.expdrops": "XP drops",
- "menu.telekinesis.config.general.expdrops.description": "Entscheidet, ob Telekinesis für XP Drops funktionieren soll.",
- "menu.telekinesis.config.general.mobdrops": "Drops von Mobs",
- "menu.telekinesis.config.general.mobdrops.description": "Entscheidet, ob Telekinesis für Drops von Mobs funktionieren soll.",
- "menu.telekinesis.config.general.vehicledrops": "Drops von Fahrzeugen",
- "menu.telekinesis.config.general.vehicledrops.description": "Entscheidet, ob Telekinesis für Drops von Fahrzeugen funktionieren soll.",
- "menu.telekinesis.config.general.shearingdrops": "Drops vom Scheren",
- "menu.telekinesis.config.general.shearingdrops.description": "Entscheidet ob Telekinesis für Drops vom Scheren funktionieren soll.",
- "menu.telekinesis.config.general.fishingdrops": "Drops vom Fischen",
- "menu.telekinesis.config.general.fishingdrops.description": "Entscheidet ob Telekinesis für Drops vom Fischen funktionieren soll.",
- "enchantment.telekinesis.telekinesis.name": "Telekinesis"
-}
\ No newline at end of file
diff --git a/telekinesis-fabric/src/main/resources/assets/telekinesis/lang/en_us.json b/telekinesis-fabric/src/main/resources/assets/telekinesis/lang/en_us.json
deleted file mode 100644
index 192a511..0000000
--- a/telekinesis-fabric/src/main/resources/assets/telekinesis/lang/en_us.json
+++ /dev/null
@@ -1,24 +0,0 @@
-{
- "menu.telekinesis.name": "telekinesis",
- "menu.telekinesis.config.general": "General",
- "menu.telekinesis.config.general.onbydefault": "On By Default",
- "menu.telekinesis.config.general.onbydefault.description": "Decides whether telekinesis can be used without the enchantment.",
- "menu.telekinesis.config.general.onlywhilesneaking": "Only while sneaking",
- "menu.telekinesis.config.general.onlywhilesneaking.description": "Decides whether players should be required to sneak to use telekinesis.",
- "menu.telekinesis.config.general.enchantment": "Enchantment",
- "menu.telekinesis.config.general.enchantment.description1": "Decides whether to add the enchantment to the game.",
- "menu.telekinesis.config.general.enchantment.description2": "Requires a restart to work!",
- "menu.telekinesis.config.general.blockdrops": "Block drops",
- "menu.telekinesis.config.general.blockdrops.description": "Decides whether telekinesis can be used for block drops.",
- "menu.telekinesis.config.general.expdrops": "Exp drops",
- "menu.telekinesis.config.general.expdrops.description": "Decides whether telekinesis can be used for exp drops.",
- "menu.telekinesis.config.general.mobdrops": "Mob drops",
- "menu.telekinesis.config.general.mobdrops.description": "Decides whether telekinesis can be used for mob drops.",
- "menu.telekinesis.config.general.vehicledrops": "Vehicle drops",
- "menu.telekinesis.config.general.vehicledrops.description": "Decides whether telekinesis can be used for vehicle drops.",
- "menu.telekinesis.config.general.shearingdrops": "Shearing drops",
- "menu.telekinesis.config.general.shearingdrops.description": "Decides whether telekinesis can be used for shearing drops.",
- "menu.telekinesis.config.general.fishingdrops": "Fishing drops",
- "menu.telekinesis.config.general.fishingdrops.description": "Decides whether telekinesis can be used for fishing drops.",
- "enchantment.telekinesis.telekinesis.name": "Telekinesis"
-}
\ No newline at end of file
diff --git a/telekinesis-fabric/src/main/resources/compat.betternether.mixins.json b/telekinesis-fabric/src/main/resources/compat.betternether.mixins.json
deleted file mode 100644
index f6e04f8..0000000
--- a/telekinesis-fabric/src/main/resources/compat.betternether.mixins.json
+++ /dev/null
@@ -1,15 +0,0 @@
-{
- "required": true,
- "minVersion": "0.8",
- "plugin": "dev.nyon.telekinesis.mixins.compat.betternether.BetterNetherMixinPlugin",
- "package": "dev.nyon.telekinesis.mixins.compat.betternether",
- "compatibilityLevel": "JAVA_17",
- "client": [
- ],
- "injectors": {
- "defaultRequire": 1
- },
- "mixins": [
- "RubyFireMixin"
- ]
-}
\ No newline at end of file
diff --git a/telekinesis-fabric/src/main/resources/compat.levelz.mixins.json b/telekinesis-fabric/src/main/resources/compat.levelz.mixins.json
deleted file mode 100644
index 1ffe7fc..0000000
--- a/telekinesis-fabric/src/main/resources/compat.levelz.mixins.json
+++ /dev/null
@@ -1,21 +0,0 @@
-{
- "required": true,
- "minVersion": "0.8",
- "plugin": "dev.nyon.telekinesis.mixins.compat.levelz.LevelZMixinPlugin",
- "package": "dev.nyon.telekinesis.mixins.compat.levelz",
- "compatibilityLevel": "JAVA_17",
- "client": [
- ],
- "injectors": {
- "defaultRequire": 1
- },
- "mixins": [
- "BlockMixinMixin",
- "EnderDragonEntityMixinMixin",
- "FishingBobberEntityMixinMixin",
- "LevelExperienceOrbAccessor",
- "LevelExperienceOrbEntityMixin",
- "LivingEntityMixinMixin",
- "PlantBlockMixinMixin"
- ]
-}
\ No newline at end of file
diff --git a/telekinesis-fabric/src/main/resources/compat.treeharvester.mixins.json b/telekinesis-fabric/src/main/resources/compat.treeharvester.mixins.json
deleted file mode 100644
index 6e3a838..0000000
--- a/telekinesis-fabric/src/main/resources/compat.treeharvester.mixins.json
+++ /dev/null
@@ -1,13 +0,0 @@
-{
- "required": true,
- "minVersion": "0.8",
- "plugin": "dev.nyon.telekinesis.mixins.compat.treeharvester.TreeHarvesterMixinPlugin",
- "package": "dev.nyon.telekinesis.mixins.compat.treeharvester",
- "compatibilityLevel": "JAVA_17",
- "client": [
- "TreeCutEventsMixin"
- ],
- "injectors": {
- "defaultRequire": 1
- }
-}
\ No newline at end of file
diff --git a/telekinesis-fabric/src/main/resources/fabric.mod.json b/telekinesis-fabric/src/main/resources/fabric.mod.json
deleted file mode 100644
index 5a0749f..0000000
--- a/telekinesis-fabric/src/main/resources/fabric.mod.json
+++ /dev/null
@@ -1,53 +0,0 @@
-{
- "schemaVersion": 1,
- "id": "${id}",
- "name": "${name}",
- "description": "${description}",
- "contact": {
- "issues": "https://github.com/btwonion/telekinesis/issues",
- "sources": "https://github.com/btwonion/telekinesis"
- },
- "icon": "assets/telekinesis/icon.png",
- "authors": [
- "btwonion"
- ],
- "contributors": [],
- "license": [
- "GNU General Public License v3.0"
- ],
- "version": "${version}",
- "environment": "*",
- "depends": {
- "fabric-language-kotlin": ">=1.10.20+kotlin.1.9.24",
- "yet_another_config_lib_v3": "*",
- "minecraft": "${mc}"
- },
- "suggests": {
- "modmenu": "*"
- },
- "entrypoints": {
- "main": [
- {
- "adapter": "kotlin",
- "value": "dev.nyon.telekinesis.MainKt::init"
- }
- ],
- "modmenu": [
- {
- "adapter": "kotlin",
- "value": "dev.nyon.telekinesis.ModMenuImpl"
- }
- ]
- },
- "mixins": [
- "telekinesis.mixins.json"
- ],
- "accessWidener": "telekinesis.accesswidener",
- "custom": {
- "modmenu": {
- "links": {
- "modmenu.discord": "https://discord.gg/pmHTtZnMd3"
- }
- }
- }
-}
diff --git a/telekinesis-fabric/src/main/resources/telekinesis.accesswidener b/telekinesis-fabric/src/main/resources/telekinesis.accesswidener
deleted file mode 100644
index 09fb9bf..0000000
--- a/telekinesis-fabric/src/main/resources/telekinesis.accesswidener
+++ /dev/null
@@ -1,3 +0,0 @@
-accessWidener v2 named
-
-accessible method net/minecraft/world/level/block/InfestedBlock spawnAfterBreak (Lnet/minecraft/world/level/block/state/BlockState;Lnet/minecraft/server/level/ServerLevel;Lnet/minecraft/core/BlockPos;Lnet/minecraft/world/item/ItemStack;Z)V
\ No newline at end of file
diff --git a/telekinesis-fabric/src/main/resources/telekinesis.mixins.json b/telekinesis-fabric/src/main/resources/telekinesis.mixins.json
deleted file mode 100644
index 4c5bf60..0000000
--- a/telekinesis-fabric/src/main/resources/telekinesis.mixins.json
+++ /dev/null
@@ -1,36 +0,0 @@
-{
- "required": true,
- "minVersion": "0.8",
- "package": "dev.nyon.telekinesis.mixins",
- "compatibilityLevel": "JAVA_17",
- "mixins": [
- "AbstractChestedHorseMixin",
- "AbstractHorseMixin",
- "AbstractMinecartMixin",
- "AllayMixin",
- "BlockMixin",
- "BoatMixin",
- "CatalystBlockAccessor",
- "ChestBoatMixin",
- "DropExperienceBlockAccessor",
- "EnchantmentsMixin",
- "EnderManMixin",
- "FishingHookMixin",
- "InventoryMixin",
- "LivingEntityMixin",
- "MinecartTNTMixin",
- "MinecraftServerMixin",
- "MobMixin",
- "PiglinMixin",
- "PigMixin",
- "SheepMixin",
- "SnowgolemMixin",
- "StriderMixin",
- "SweetBerryBushBlockMixin",
- "VehicleEntityMixin",
- "WitherBossMixin"
- ],
- "injectors": {
- "defaultRequire": 1
- }
-}
diff --git a/telekinesis-fabric/stonecutter.gradle.kts b/telekinesis-fabric/stonecutter.gradle.kts
deleted file mode 100644
index 495263e..0000000
--- a/telekinesis-fabric/stonecutter.gradle.kts
+++ /dev/null
@@ -1,16 +0,0 @@
-plugins {
- id("dev.kikugie.stonecutter")
-}
-stonecutter active "1.20.1" /* [SC] DO NOT EDIT */
-
-stonecutter registerChiseled
- tasks.register("buildAllVersions", stonecutter.chiseled) {
- group = "mod"
- ofTask("build")
- }
-
-stonecutter registerChiseled
- tasks.register("releaseAllVersions", stonecutter.chiseled) {
- group = "mod"
- ofTask("releaseMod")
- }
diff --git a/telekinesis-paper/build.gradle.kts b/telekinesis-paper/build.gradle.kts
deleted file mode 100644
index ae1fb0a..0000000
--- a/telekinesis-paper/build.gradle.kts
+++ /dev/null
@@ -1,142 +0,0 @@
-import org.jetbrains.kotlin.gradle.tasks.KotlinCompile
-import java.nio.file.Path
-import kotlin.io.path.notExists
-import kotlin.io.path.readText
-
-plugins {
- kotlin("jvm")
- kotlin("plugin.serialization")
-
- id("com.modrinth.minotaur")
- id("com.github.breadmoirai.github-release")
-
- id("io.papermc.paperweight.userdev")
- id("xyz.jpenilla.run-paper") version "2.1.0"
-
- `maven-publish`
- signing
-}
-
-group = "dev.nyon"
-val majorVersion = "2.3.2"
-val mcVersion = "1.20.2"
-version = "$majorVersion-$mcVersion"
-description = "Adds an telekinesis enchantment to minecraft"
-val projectAuthors = listOf("btwonion")
-val githubRepo = "btwonion/telekinesis"
-
-repositories {
- mavenCentral()
-}
-
-dependencies {
- paperweight.paperDevBundle("$mcVersion-R0.1-SNAPSHOT")
- implementation("com.akuleshov7:ktoml-core-jvm:0.5.0")
-}
-
-tasks {
- register("releasePlugin") {
- group = "publishing"
-
- dependsOn("modrinthSyncBody")
- dependsOn("modrinth")
- dependsOn("publish")
- dependsOn("githubRelease")
- }
-
- processResources {
- val props = mapOf(
- "name" to "telekinesis",
- "version" to "'${project.version}'",
- "main" to "dev.nyon.telekinesis.Main",
- "description" to project.description,
- "website" to "https://nyon.dev/discord",
- "apiVersion" to "'1.20'",
- "authors" to projectAuthors.joinToString("\n - ", "\n - "),
- "foliaSupported" to true,
- "loader" to "dev.nyon.telekinesis.PaperLoader"
- )
-
- inputs.properties(props)
- filesMatching("paper-plugin.yml") {
- expand(props)
- }
- }
-
- assemble {
- dependsOn(reobfJar)
- }
-
- withType {
- options.encoding = "UTF-8"
- options.release.set(17)
- }
-
- withType {
- kotlinOptions.jvmTarget = "17"
- }
-
- runPaper.folia.registerTask()
- runServer {
- minecraftVersion("1.20.1")
- }
-}
-
-val changelogFile: Path = rootDir.toPath().resolve("changelogs/paper-$version.md")
-val changelogText = if (changelogFile.notExists()) "" else changelogFile.readText()
-val projectVersionName = "paper-${project.version}"
-
-modrinth {
- token.set(findProperty("modrinth.token")?.toString())
- projectId.set("LLfA8jAD")
- versionNumber.set(projectVersionName)
- versionName.set(projectVersionName)
- versionType.set("release")
- uploadFile.set(tasks.reobfJar.get().outputJar)
- gameVersions.set(listOf("1.20.2"))
- loaders.set(listOf("paper", "folia"))
- changelog.set(changelogText)
- syncBodyFrom.set(file("../README.md").readText())
-}
-
-githubRelease {
- token(findProperty("github.token")?.toString())
-
- val split = githubRepo.split("/")
- owner = split[0]
- repo = split[1]
- releaseName = projectVersionName
- tagName = projectVersionName
- body = changelogText
- targetCommitish = "master"
- setReleaseAssets(tasks.reobfJar.get().outputJar)
-}
-
-publishing {
- repositories {
- maven {
- name = "nyon"
- url = uri("https://repo.nyon.dev/releases")
- credentials(PasswordCredentials::class)
- authentication {
- create("basic")
- }
- }
- }
- publications {
- create("maven") {
- groupId = "dev.nyon"
- artifactId = "telekinesis-paper"
- version = project.version.toString()
- from(components["java"])
- }
- }
-}
-
-signing {
- sign(publishing.publications)
-}
-
-java {
- withSourcesJar()
-}
\ No newline at end of file
diff --git a/telekinesis-paper/src/main/java/dev/nyon/telekinesis/PaperLoader.java b/telekinesis-paper/src/main/java/dev/nyon/telekinesis/PaperLoader.java
deleted file mode 100644
index a281941..0000000
--- a/telekinesis-paper/src/main/java/dev/nyon/telekinesis/PaperLoader.java
+++ /dev/null
@@ -1,22 +0,0 @@
-package dev.nyon.telekinesis;
-
-import io.papermc.paper.plugin.loader.PluginClasspathBuilder;
-import io.papermc.paper.plugin.loader.PluginLoader;
-import io.papermc.paper.plugin.loader.library.impl.MavenLibraryResolver;
-import org.eclipse.aether.artifact.DefaultArtifact;
-import org.eclipse.aether.graph.Dependency;
-import org.eclipse.aether.repository.RemoteRepository;
-import org.jetbrains.annotations.NotNull;
-
-@SuppressWarnings("UnstableApiUsage")
-public class PaperLoader implements PluginLoader {
- @Override
- public void classloader(@NotNull PluginClasspathBuilder classpathBuilder) {
- MavenLibraryResolver resolver = new MavenLibraryResolver();
- resolver.addDependency(new Dependency(new DefaultArtifact("org.jetbrains.kotlin:kotlin-stdlib:1.9.0"), null));
- resolver.addDependency(new Dependency(new DefaultArtifact("com.akuleshov7:ktoml-core-jvm:0.5.0"), null));
- resolver.addRepository(new RemoteRepository.Builder("central", "default", "https://repo1.maven.org/maven2/").build());
-
- classpathBuilder.addLibrary(resolver);
- }
-}
\ No newline at end of file
diff --git a/telekinesis-paper/src/main/kotlin/dev/nyon/telekinesis/Main.kt b/telekinesis-paper/src/main/kotlin/dev/nyon/telekinesis/Main.kt
deleted file mode 100644
index 1d7e1f4..0000000
--- a/telekinesis-paper/src/main/kotlin/dev/nyon/telekinesis/Main.kt
+++ /dev/null
@@ -1,82 +0,0 @@
-package dev.nyon.telekinesis
-
-import dev.nyon.telekinesis.listeners.initBlockListeners
-import dev.nyon.telekinesis.listeners.initMobListeners
-import net.minecraft.core.Holder
-import net.minecraft.core.MappedRegistry
-import net.minecraft.core.Registry
-import net.minecraft.core.registries.Registries
-import net.minecraft.resources.ResourceLocation
-import org.bukkit.Bukkit
-import org.bukkit.craftbukkit.v1_20_R2.CraftServer
-import org.bukkit.enchantments.Enchantment
-import org.bukkit.plugin.java.JavaPlugin
-import kotlin.io.path.createFile
-import kotlin.io.path.exists
-
-val bukkitEnchantment: Enchantment = BukkitTelekinesis()
-val telekinesis = TelekinesisEnchantment()
-
-class Main : JavaPlugin() {
- companion object {
- lateinit var INSTANCE: Main; private set
- }
-
- override fun onLoad() {
- INSTANCE = this
- configPath = Bukkit.getPluginsFolder().toPath().resolve("telekinesis.toml")
- .also { if (!it.exists()) it.createFile() }
- loadConfig()
- if (dev.nyon.telekinesis.config.enchantment) {
- addToBukkitRegistry()
- addToMinecraftRegistry()
- }
- }
-
- override fun onEnable() {
- initBlockListeners()
- initMobListeners()
- }
-}
-
-private fun addToBukkitRegistry() {
- val field = Enchantment::class.java.getDeclaredField("acceptingNew")
- field.isAccessible = true
- field.set(null, true)
- Enchantment.registerEnchantment(BukkitTelekinesis())
- field.set(null, false)
- field.isAccessible = true
-}
-
-// Check the values with: https://mappings.cephx.dev/
-@Suppress("unchecked_cast")
-private fun addToMinecraftRegistry() {
- val server = (Bukkit.getServer() as CraftServer).server
- val enchantmentRegistry = server.registryAccess().registryOrThrow(Registries.ENCHANTMENT) as MappedRegistry
- val enchantmentRegistryClass = enchantmentRegistry.javaClass
- val frozenField = enchantmentRegistryClass.getDeclaredField("l") // l - frozen MappedRegistry
- frozenField.isAccessible = true
- frozenField.set(enchantmentRegistry, false)
-
- Registry.register(
- enchantmentRegistry,
- ResourceLocation("telekinesis", "telekinesis"),
- telekinesis
- )
-
- frozenField.set(enchantmentRegistry, true)
- frozenField.isAccessible = false
-
- val byValueField = enchantmentRegistryClass.getDeclaredField("h") // h - byValue MappedRegistry
- byValueField.isAccessible = true
- val byValueMap =
- byValueField.get(enchantmentRegistry) as Map<*, Holder.Reference<*>>
- val value = byValueMap[telekinesis]!!
- val method = value.javaClass.getDeclaredMethod("b", Any::class.java)
- method.isAccessible = true
- method.invoke(value, telekinesis) // b - bindValue Holder$Reference
- method.isAccessible = false
- byValueField.isAccessible = false
-}
-
-val Plugin by lazy { Main.INSTANCE }
\ No newline at end of file
diff --git a/telekinesis-paper/src/main/kotlin/dev/nyon/telekinesis/TelekinesisConfig.kt b/telekinesis-paper/src/main/kotlin/dev/nyon/telekinesis/TelekinesisConfig.kt
deleted file mode 100644
index 93a396f..0000000
--- a/telekinesis-paper/src/main/kotlin/dev/nyon/telekinesis/TelekinesisConfig.kt
+++ /dev/null
@@ -1,75 +0,0 @@
-package dev.nyon.telekinesis
-
-import com.akuleshov7.ktoml.Toml
-import com.akuleshov7.ktoml.TomlInputConfig
-import com.akuleshov7.ktoml.annotations.TomlComments
-import kotlinx.serialization.Serializable
-import kotlinx.serialization.decodeFromString
-import java.nio.file.Path
-import kotlin.io.path.notExists
-import kotlin.io.path.readText
-import kotlin.io.path.writeText
-
-@Serializable
-data class TelekinesisConfig(
- @TomlComments(
- "Uncomment the following values if you want to change them:",
- "",
- "Decides whether telekinesis can be used without the enchantment."
- )
- var onByDefault: Boolean = false,
- var onByDefaultPermissionRequirement: String? = null,
- @TomlComments(
- "Uncomment this to block functionality for those who don't have the required permission.",
- "onByDefaultPermissionRequirement = 'permission'",
- "",
- "Decides whether players should be required to sneak to use telekinesis."
- )
- var onlyOnSneak: Boolean = false,
- @TomlComments(
- "Decides whether telekinesis can be used for block drops."
- )
- var blockDrops: Boolean = true,
- var blockDropsPermissionRequirement: String? = null,
- @TomlComments(
- "blockDropsPermissionRequirement = 'permission'",
- "",
- "Decides whether telekinesis can be used for exp drops."
- )
- var expDrops: Boolean = true,
- var expDropsPermissionRequirement: String? = null,
- @TomlComments(
- "expDropsPermissionRequirement = 'permission'",
- "",
- "Decides whether telekinesis can be used for entity drops."
- )
- var entityDrops: Boolean = true,
- var entityDropsPermissionRequirement: String? = null,
- @TomlComments(
- "entityDropsPermissionRequirement = 'permission'",
- "",
- "Decides whether to add the enchantment to the game."
- )
- var enchantment: Boolean = true,
-)
-
-var config: TelekinesisConfig = TelekinesisConfig()
-lateinit var configPath: Path
-val toml = Toml(
- inputConfig = TomlInputConfig(ignoreUnknownNames = true)
-)
-
-fun saveConfig() = configPath.writeText(toml.encodeToString(TelekinesisConfig.serializer(), config))
-
-fun loadConfig() {
- if (configPath.notExists() || configPath.readText().isEmpty()) {
- saveConfig()
- return
- }
-
- try {
- config = toml.decodeFromString(configPath.readText())
- } catch (e: Exception) {
- saveConfig()
- }
-}
diff --git a/telekinesis-paper/src/main/kotlin/dev/nyon/telekinesis/TelekinesisEnchantment.kt b/telekinesis-paper/src/main/kotlin/dev/nyon/telekinesis/TelekinesisEnchantment.kt
deleted file mode 100644
index 3d4b664..0000000
--- a/telekinesis-paper/src/main/kotlin/dev/nyon/telekinesis/TelekinesisEnchantment.kt
+++ /dev/null
@@ -1,72 +0,0 @@
-package dev.nyon.telekinesis
-
-import io.papermc.paper.enchantments.EnchantmentRarity
-import net.kyori.adventure.text.format.TextColor
-import net.minecraft.network.chat.Component
-import net.minecraft.network.chat.Style
-import net.minecraft.world.damagesource.DamageSource
-import net.minecraft.world.entity.EquipmentSlot
-import net.minecraft.world.entity.MobType
-import net.minecraft.world.item.enchantment.Enchantment
-import net.minecraft.world.item.enchantment.EnchantmentCategory
-import org.bukkit.NamespacedKey
-import org.bukkit.enchantments.EnchantmentTarget
-import org.bukkit.entity.EntityCategory
-import org.bukkit.inventory.ItemStack
-
-/**
- * The telekinesis enchantment model
- */
-class TelekinesisEnchantment : Enchantment(
- Rarity.RARE, EnchantmentCategory.BREAKABLE, listOf(EquipmentSlot.OFFHAND, EquipmentSlot.MAINHAND).toTypedArray()
-) {
-
- override fun getMinLevel(): Int = 1
- override fun getMaxLevel(): Int = 1
-
- override fun getMinCost(i: Int): Int = 30
- override fun getMaxCost(i: Int): Int = 30
-
- override fun getDamageProtection(i: Int, damageSource: DamageSource): Int = 0
- override fun getDamageBonus(i: Int, mobType: MobType): Float = 0F
-
- override fun getFullname(i: Int): Component =
- Component.literal("Telekinesis").withStyle(Style.EMPTY.withColor(0xFFB64C))
-}
-
-class BukkitTelekinesis : org.bukkit.enchantments.Enchantment(NamespacedKey("telekinesis", "telekinesis")) {
- override fun translationKey(): String = "telekinesis.telekinesis"
-
- @Deprecated("Deprecated in Java", ReplaceWith("\"Telekinesis\""))
- override fun getName(): String = "Telekinesis"
-
- override fun getMaxLevel(): Int = 1
-
- override fun getStartLevel(): Int = 1
-
- override fun getItemTarget(): EnchantmentTarget = EnchantmentTarget.BREAKABLE
-
- override fun isTreasure(): Boolean = false
-
- override fun isCursed(): Boolean = false
-
- override fun conflictsWith(other: org.bukkit.enchantments.Enchantment): Boolean = false
-
- override fun canEnchantItem(item: ItemStack): Boolean = true
-
- override fun displayName(level: Int): net.kyori.adventure.text.Component =
- net.kyori.adventure.text.Component.text("Telekinesis").color(
- TextColor.color(0xFFB64C)
- )
-
- override fun isTradeable(): Boolean = true
-
- override fun isDiscoverable(): Boolean = true
-
- override fun getRarity(): EnchantmentRarity = EnchantmentRarity.RARE
-
- override fun getDamageIncrease(level: Int, entityCategory: EntityCategory): Float = 0.0f
-
- override fun getActiveSlots(): MutableSet =
- mutableSetOf(org.bukkit.inventory.EquipmentSlot.OFF_HAND, org.bukkit.inventory.EquipmentSlot.HAND)
-}
diff --git a/telekinesis-paper/src/main/kotlin/dev/nyon/telekinesis/TelekinesisPolicy.kt b/telekinesis-paper/src/main/kotlin/dev/nyon/telekinesis/TelekinesisPolicy.kt
deleted file mode 100644
index ff4b071..0000000
--- a/telekinesis-paper/src/main/kotlin/dev/nyon/telekinesis/TelekinesisPolicy.kt
+++ /dev/null
@@ -1,19 +0,0 @@
-package dev.nyon.telekinesis
-
-enum class TelekinesisPolicy {
- BlockDrops,
- ExpDrops,
- EntityDrops;
-
- fun isEnabled(): Boolean = when (this) {
- BlockDrops -> config.blockDrops
- ExpDrops -> config.expDrops
- EntityDrops -> config.entityDrops
- }
-
- fun associatedPermission(): String? = when (this) {
- BlockDrops -> config.blockDropsPermissionRequirement
- ExpDrops -> config.expDropsPermissionRequirement
- EntityDrops -> config.entityDropsPermissionRequirement
- }
-}
\ No newline at end of file
diff --git a/telekinesis-paper/src/main/kotlin/dev/nyon/telekinesis/listeners/BlockListeners.kt b/telekinesis-paper/src/main/kotlin/dev/nyon/telekinesis/listeners/BlockListeners.kt
deleted file mode 100644
index 50031a0..0000000
--- a/telekinesis-paper/src/main/kotlin/dev/nyon/telekinesis/listeners/BlockListeners.kt
+++ /dev/null
@@ -1,30 +0,0 @@
-package dev.nyon.telekinesis.listeners
-
-import dev.nyon.telekinesis.TelekinesisPolicy
-import dev.nyon.telekinesis.util.handleTelekinesis
-import dev.nyon.telekinesis.util.listen
-import org.bukkit.event.block.BlockBreakEvent
-import org.bukkit.event.block.BlockDropItemEvent
-
-fun initBlockListeners() {
- dropEvent
- blockBreakEvent
-}
-
-val dropEvent = listen {
- player.handleTelekinesis(TelekinesisPolicy.BlockDrops, player.inventory.itemInMainHand) {
- val copy = mutableListOf(items).flatten()
- items.clear()
- copy.forEach {
- val result = inventory.addItem(it.itemStack)
- if (result.isNotEmpty()) items.add(it)
- }
- }
-}
-
-val blockBreakEvent = listen {
- player.handleTelekinesis(TelekinesisPolicy.ExpDrops, null) {
- giveExp(expToDrop)
- expToDrop = 0
- }
-}
\ No newline at end of file
diff --git a/telekinesis-paper/src/main/kotlin/dev/nyon/telekinesis/listeners/MobListeners.kt b/telekinesis-paper/src/main/kotlin/dev/nyon/telekinesis/listeners/MobListeners.kt
deleted file mode 100644
index 590dfc2..0000000
--- a/telekinesis-paper/src/main/kotlin/dev/nyon/telekinesis/listeners/MobListeners.kt
+++ /dev/null
@@ -1,34 +0,0 @@
-package dev.nyon.telekinesis.listeners
-
-import dev.nyon.telekinesis.TelekinesisPolicy
-import dev.nyon.telekinesis.util.handleTelekinesis
-import dev.nyon.telekinesis.util.listen
-import org.bukkit.event.entity.EntityDeathEvent
-
-fun initMobListeners() {
- mobDie
- mobExpDie
-}
-
-val mobDie = listen {
- println(entityType.name)
- val killer = this.entity.killer ?: return@listen
-
- killer.handleTelekinesis(TelekinesisPolicy.EntityDrops, null) {
- val copy = mutableListOf(drops).flatten()
- drops.clear()
- copy.forEach {
- val result = inventory.addItem(it)
- if (result.isNotEmpty()) drops.add(it)
- }
- }
-}
-
-val mobExpDie = listen {
- val killer = this.entity.killer ?: return@listen
-
- killer.handleTelekinesis(TelekinesisPolicy.ExpDrops, null) {
- giveExp(droppedExp, true)
- droppedExp = 0
- }
-}
\ No newline at end of file
diff --git a/telekinesis-paper/src/main/kotlin/dev/nyon/telekinesis/util/Listeners.kt b/telekinesis-paper/src/main/kotlin/dev/nyon/telekinesis/util/Listeners.kt
deleted file mode 100644
index 2bee9b3..0000000
--- a/telekinesis-paper/src/main/kotlin/dev/nyon/telekinesis/util/Listeners.kt
+++ /dev/null
@@ -1,25 +0,0 @@
-package dev.nyon.telekinesis.util
-
-import dev.nyon.telekinesis.Plugin
-import org.bukkit.Bukkit
-import org.bukkit.event.Event
-import org.bukkit.event.EventPriority
-import org.bukkit.event.Listener
-
-abstract class SingleListener : Listener {
- abstract fun onEvent(event: T)
-}
-
-inline fun listen(crossinline eventCallback: T.() -> Unit) {
- val listener = object : SingleListener() {
- override fun onEvent(event: T) = eventCallback(event)
- }
- Bukkit.getPluginManager()
- .registerEvent(
- T::class.java,
- listener,
- EventPriority.NORMAL,
- { _, event -> listener.onEvent(event as T) },
- Plugin
- )
-}
\ No newline at end of file
diff --git a/telekinesis-paper/src/main/kotlin/dev/nyon/telekinesis/util/TelekinesisCheck.kt b/telekinesis-paper/src/main/kotlin/dev/nyon/telekinesis/util/TelekinesisCheck.kt
deleted file mode 100644
index e8a2a34..0000000
--- a/telekinesis-paper/src/main/kotlin/dev/nyon/telekinesis/util/TelekinesisCheck.kt
+++ /dev/null
@@ -1,45 +0,0 @@
-package dev.nyon.telekinesis.util
-
-import dev.nyon.telekinesis.TelekinesisPolicy
-import dev.nyon.telekinesis.bukkitEnchantment
-import dev.nyon.telekinesis.config
-import org.bukkit.entity.Player
-import org.bukkit.inventory.ItemStack
-
-fun ItemStack.hasTelekinesis(): Boolean = hasItemMeta() && itemMeta.enchants.contains(bukkitEnchantment)
-
-fun Player.handleTelekinesis(policy: TelekinesisPolicy, itemStack: ItemStack?, callback: Player.() -> Unit): Boolean {
- if (!policy.isEnabled()) return false
- if (!meetCondition(policy, itemStack)) return false
-
- callback()
- return true
-}
-
-private fun Player.meetCondition(policy: TelekinesisPolicy, itemStack: ItemStack?): Boolean {
- fun Player.hasPermission(policy: TelekinesisPolicy): Boolean {
- val permission = policy.associatedPermission()
- return permission == null || this@hasPermission.hasPermission(permission)
- }
-
- var conditionsMet: Boolean
-
- val isEnabledByDefault = config.onByDefault &&
- (config.onByDefaultPermissionRequirement == null || hasPermission(config.onByDefaultPermissionRequirement!!))
-
- val hasArmorTelekinesis: Boolean = inventory.armorContents.all { it?.hasTelekinesis() == true }
- val hasMainHandTelekinesis =
- itemStack != null && itemStack.hasTelekinesis() || inventory.itemInMainHand.hasTelekinesis()
- val hasOffHandTelekinesis = inventory.itemInOffHand.hasTelekinesis()
-
- conditionsMet = if (isEnabledByDefault) true else when (policy) {
- TelekinesisPolicy.ExpDrops -> hasArmorTelekinesis || hasMainHandTelekinesis || hasOffHandTelekinesis
- TelekinesisPolicy.EntityDrops -> hasMainHandTelekinesis || hasOffHandTelekinesis
- TelekinesisPolicy.BlockDrops -> hasMainHandTelekinesis
- }
-
- if (!hasPermission(policy)) conditionsMet = false
- if (config.onlyOnSneak && !isSneaking) conditionsMet = false
-
- return conditionsMet
-}
\ No newline at end of file
diff --git a/telekinesis-paper/src/main/resources/paper-plugin.yml b/telekinesis-paper/src/main/resources/paper-plugin.yml
deleted file mode 100644
index 724feb6..0000000
--- a/telekinesis-paper/src/main/resources/paper-plugin.yml
+++ /dev/null
@@ -1,9 +0,0 @@
-name: $name
-version: $version
-main: $main
-description: $description
-authors: $authors
-website: $website
-api-version: $apiVersion
-folia-supported: $foliaSupported
-loader: $loader
\ No newline at end of file
diff --git a/telekinesis-fabric/versions/1.20.1/gradle.properties b/versions/1.20.1/gradle.properties
similarity index 83%
rename from telekinesis-fabric/versions/1.20.1/gradle.properties
rename to versions/1.20.1/gradle.properties
index 68beccc..86e91d5 100644
--- a/telekinesis-fabric/versions/1.20.1/gradle.properties
+++ b/versions/1.20.1/gradle.properties
@@ -2,7 +2,7 @@ mcVersion=1.20.1
mcVersionRange=>=1.20 <=1.20.3
supportedMcVersions=1.20,1.20.1
-deps.parchment=1.20.1:2023.09.03
+deps.parchment=
deps.fapi=0.92.1+1.20.1
deps.yacl=3.4.2+1.20.1-fabric
deps.modMenu=7.2.2
diff --git a/telekinesis-fabric/versions/1.20.4/gradle.properties b/versions/1.20.4/gradle.properties
similarity index 83%
rename from telekinesis-fabric/versions/1.20.4/gradle.properties
rename to versions/1.20.4/gradle.properties
index 60732ac..b9ea1db 100644
--- a/telekinesis-fabric/versions/1.20.4/gradle.properties
+++ b/versions/1.20.4/gradle.properties
@@ -2,7 +2,7 @@ mcVersion=1.20.4
mcVersionRange=>=1.20.3 <=1.20.4
supportedMcVersions=1.20.4
-deps.parchment=1.20.4:2024.04.14
+deps.parchment=
deps.fapi=0.97.0+1.20.4
deps.yacl=3.4.2+1.20.4-fabric
deps.modMenu=9.2.0-beta.2
diff --git a/telekinesis-fabric/versions/1.20.6/gradle.properties b/versions/1.20.6/gradle.properties
similarity index 72%
rename from telekinesis-fabric/versions/1.20.6/gradle.properties
rename to versions/1.20.6/gradle.properties
index 7a02cb9..a530c60 100644
--- a/telekinesis-fabric/versions/1.20.6/gradle.properties
+++ b/versions/1.20.6/gradle.properties
@@ -2,8 +2,8 @@ mcVersion=1.20.6
mcVersionRange=>=1.20.5 <=1.20.6
supportedMcVersions=1.20.5,1.20.6
-deps.parchment=1.20.6:2024.05.01
-deps.fapi=0.97.8+1.20.6
+deps.parchment=
+deps.fapi=0.100.0+1.20.6
deps.yacl=3.4.2+1.20.5-fabric
deps.modMenu=10.0.0-beta.1
diff --git a/versions/1.21/gradle.properties b/versions/1.21/gradle.properties
new file mode 100644
index 0000000..6f14645
--- /dev/null
+++ b/versions/1.21/gradle.properties
@@ -0,0 +1,10 @@
+mcVersion=1.21
+mcVersionRange=>=1.20.6 <=1.21
+supportedMcVersions=1.21
+
+deps.parchment=
+deps.fapi=0.100.1+1.21
+deps.yacl=3.5.0+1.21-fabric
+deps.modMenu=11.0.0-beta.1
+
+javaVer=21