Skip to content

Commit

Permalink
wrong vcs version
Browse files Browse the repository at this point in the history
  • Loading branch information
btwonion committed Jun 14, 2024
1 parent 3ba22e7 commit b724ca4
Show file tree
Hide file tree
Showing 21 changed files with 58 additions and 57 deletions.
2 changes: 1 addition & 1 deletion settings.gradle.kts
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@ extensions.configure<StonecutterSettings> {
centralScript = "build.gradle.kts"
shared {
versions("1.20.1", "1.20.4", "1.20.6", "1.21")
vcsVersion = "1.20.6"
vcsVersion = "1.21"
}
create(":telekinesis-fabric")
}
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@
public class AbstractMinecartMixin {

/*? <=1.20.2 {*/
@ModifyExpressionValue(
/*@ModifyExpressionValue(
method = "destroy",
at = @At(
value = "INVOKE",
Expand All @@ -25,5 +25,5 @@ private Item redirectMinecartDrops(
) {
return MixinHelper.modifyExpressionValueOldVehicle(original, damageSource);
}
/*?}*/
*//*?}*/
}
Original file line number Diff line number Diff line change
Expand Up @@ -96,7 +96,7 @@ private static void checkForPlayerBreak(
method = "tryDropExperience",
at = @At(
value = "INVOKE",
target = /*? if >=1.21 {*//* "Lnet/minecraft/world/item/enchantment/EnchantmentHelper;processBlockExperience(Lnet/minecraft/server/level/ServerLevel;Lnet/minecraft/world/item/ItemStack;I)I" *//*?} else {*/ "Lnet/minecraft/util/valueproviders/IntProvider;sample(Lnet/minecraft/util/RandomSource;)I" /*?}*/
target = /*? if >=1.21 {*/ "Lnet/minecraft/world/item/enchantment/EnchantmentHelper;processBlockExperience(Lnet/minecraft/server/level/ServerLevel;Lnet/minecraft/world/item/ItemStack;I)I" /*?} else {*/ /*"Lnet/minecraft/util/valueproviders/IntProvider;sample(Lnet/minecraft/util/RandomSource;)I" *//*?}*/
)
)
private int modifyExp(
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@
@Mixin(Boat.class)
public class BoatMixin {
/*? <=1.20.2 {*/
@ModifyExpressionValue(
/*@ModifyExpressionValue(
method = "destroy(Lnet/minecraft/world/damagesource/DamageSource;)V",
at = @At(
value = "INVOKE",
Expand All @@ -24,5 +24,5 @@ private Item changeDroppedItem(
) {
return MixinHelper.modifyExpressionValueOldVehicle(original, damageSource);
}
/*?}*/
*//*?}*/
}
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@
public abstract class ChestBoatMixin {

/*? if >1.20.2 {*/
/*@WrapOperation(
@WrapOperation(
method = "destroy(Lnet/minecraft/world/damagesource/DamageSource;)V",
at = @At(
value = "INVOKE",
Expand All @@ -28,7 +28,7 @@ private void checkForPlayer(
) {
MixinHelper.prepareVehicleServerPlayer(instance, item, original, source);
}
*//*?}*/
/*?}*/

// TODO: boat inventory does still not work!!! as well as furnaces!!
}
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
package dev.nyon.telekinesis.mixins;

/*? if <1.21 {*/
import dev.nyon.telekinesis.MainKt;
/*import dev.nyon.telekinesis.MainKt;
import dev.nyon.telekinesis.TelekinesisEnchantment;
import net.minecraft.core.Registry;
import net.minecraft.core.registries.BuiltInRegistries;
Expand All @@ -11,15 +11,15 @@
import org.spongepowered.asm.mixin.injection.At;
import org.spongepowered.asm.mixin.injection.Inject;
import org.spongepowered.asm.mixin.injection.callback.CallbackInfoReturnable;
/*?}*/
*//*?}*/
import net.minecraft.world.item.enchantment.Enchantments;
import org.spongepowered.asm.mixin.Mixin;

@Mixin(Enchantments.class)
public abstract class EnchantmentsMixin {

/*? if <1.21 {*/
@Unique
/*@Unique
private static boolean isTelekinesisRegistered = false;
@Inject(
Expand All @@ -37,5 +37,5 @@ private static void registerTelekinesis(
Registry.register(BuiltInRegistries.ENCHANTMENT, new ResourceLocation("telekinesis", "telekinesis"), MainKt.getTelekinesis());
}
}
/*?}*/
*//*?}*/
}
Original file line number Diff line number Diff line change
Expand Up @@ -22,13 +22,13 @@ public class EnderManMixin {
public boolean redirectEquipmentDrop(
EnderMan instance,
ItemStack itemStack,
/*? if >=1.21 {*//*
/*? if >=1.21 {*/
ServerLevel serverLevel,
DamageSource damageSource,
boolean bl
*//*?} else {*/
DamageSource damageSource, int looting, boolean hitByPlayer
/*?}*/
/*?} else {*/
/*DamageSource damageSource, int looting, boolean hitByPlayer
*//*?}*/
) {
return MixinHelper.entityCustomDeathLootSingle(damageSource, itemStack);
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -35,17 +35,17 @@ public abstract class LivingEntityMixin {
method = "dropExperience",
at = @At(
value = "INVOKE",
target = /*? if >=1.21 {*/ /*"Lnet/minecraft/world/entity/LivingEntity;getExperienceReward(Lnet/minecraft/server/level/ServerLevel;Lnet/minecraft/world/entity/Entity;)I" *//*?} else {*/ "Lnet/minecraft/world/entity/LivingEntity;getExperienceReward()I" /*?}*/
target = /*? if >=1.21 {*/ "Lnet/minecraft/world/entity/LivingEntity;getExperienceReward(Lnet/minecraft/server/level/ServerLevel;Lnet/minecraft/world/entity/Entity;)I" /*?} else {*/ /*"Lnet/minecraft/world/entity/LivingEntity;getExperienceReward()I" *//*?}*/
)
)
public int redirectExp(
int original
/*? if >=1.21*//* , Entity entity */
/*? if >=1.21*/ , Entity entity
) {
/*? if >=1.21 {*//*
/*? if >=1.21 {*/
if (!(entity instanceof ServerPlayer player)) return original;
*//*?} else {*/
ServerPlayer player = threadLocal.get();
/*?} else {*/
/*ServerPlayer player = threadLocal.get();
return MixinHelper.modifyExpressionValuePlayerExp(player, original);
}
Expand Down Expand Up @@ -76,7 +76,7 @@ public Consumer<ItemStack> redirectCommonDrops(
};
}
/*? if <1.21 {*/
/^? if <1.21 {^/
@WrapOperation(
method = "dropAllDeathLoot",
at = @At(
Expand All @@ -102,5 +102,6 @@ private void cachePlayer(
threadLocal.set(previous);
}
}
/*?}*/
/^?}^/
}
*/
Original file line number Diff line number Diff line change
Expand Up @@ -7,16 +7,16 @@
import org.spongepowered.asm.mixin.Mixin;

/*? if >1.20.2 {*/
/*import net.minecraft.world.damagesource.DamageSource;
import net.minecraft.world.damagesource.DamageSource;
import net.minecraft.world.item.Item;
import org.spongepowered.asm.mixin.injection.At;
*//*?}*/
/*?}*/

@Mixin(MinecartTNT.class)
public class MinecartTNTMixin {

/*? if >1.20.2 {*/
/*@WrapOperation(
@WrapOperation(
method = "destroy(Lnet/minecraft/world/damagesource/DamageSource;)V",
at = @At(
value = "INVOKE",
Expand All @@ -31,5 +31,5 @@ private void checkForPlayer(
) {
MixinHelper.prepareVehicleServerPlayer(instance, dropItem, original, source);
}
*//*?}*/
/*?}*/
}
Original file line number Diff line number Diff line change
Expand Up @@ -22,13 +22,13 @@ public class MobMixin {
public boolean modifyCustomDeathLoot(
Mob instance,
ItemStack itemStack,
/*? if >=1.21 {*/ /*ServerLevel serverLevel, DamageSource damageSource, boolean bl *//*?} else {*/ DamageSource damageSource, int looting, boolean hitByPlayer /*?}*/
/*? if >=1.21 {*/ ServerLevel serverLevel, DamageSource damageSource, boolean bl /*?} else {*/ /*DamageSource damageSource, int looting, boolean hitByPlayer *//*?}*/
) {
return MixinHelper.entityCustomDeathLootSingle(damageSource, itemStack);
}

/*? if >=1.21 {*/
/*@WrapWithCondition(
@WrapWithCondition(
method = "dropPreservedEquipment(Ljava/util/function/Predicate;)Ljava/util/Set;",
at = @At(
value = "INVOKE",
Expand All @@ -41,5 +41,5 @@ public boolean modifyCustomDeathLoot(
) {
return MixinHelper.entityDropEquipmentSingle(instance, itemStack);
}
*//*?}*/
/*?}*/
}
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ public class PiglinMixin {
)
public List<ItemStack> redirectDrops(
List<ItemStack> original,
/*? if >=1.21 {*/ /*ServerLevel serverLevel, DamageSource damageSource, boolean bl *//*?} else {*/ DamageSource damageSource, int looting, boolean hitByPlayer /*?}*/
/*? if >=1.21 {*/ ServerLevel serverLevel, DamageSource damageSource, boolean bl /*?} else {*/ /*DamageSource damageSource, int looting, boolean hitByPlayer *//*?}*/
) {
return MixinHelper.entityCustomDeathLootMultiple(damageSource, original);
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@
@Mixin(Player.class)
public class PlayerMixin {

/*? if >=1.20.5 {*//*@Shadow*//*?} else {*/ @Unique /*?}*/
/*? if >=1.20.5 {*/@Shadow/*?} else {*/ /*@Unique *//*?}*/
@Final
Inventory inventory;
@Unique
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@
public class SweetBerryBushBlockMixin {

@WrapWithCondition(
method = /*? >1.20.5 {*/ /*"useWithoutItem" *//*?} else {*/ "use" /*?}*/,
method = /*? >1.20.5 {*/ "useWithoutItem" /*?} else {*/ /*"use" *//*?}*/,
at = @At(
value = "INVOKE",
target = "Lnet/minecraft/world/level/block/SweetBerryBushBlock;popResource(Lnet/minecraft/world/level/Level;Lnet/minecraft/core/BlockPos;Lnet/minecraft/world/item/ItemStack;)V"
Expand All @@ -32,7 +32,7 @@ private boolean manipulateBerryDrops(
Level _level,
BlockPos _blockPos,
Player player,
/*? if <=1.20.4*/ InteractionHand hand,
/*? if <=1.20.4*/ /*InteractionHand hand,*/
BlockHitResult blockHitResult
) {
if (!(player instanceof ServerPlayer serverPlayer)) return true;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
import dev.nyon.telekinesis.utils.MixinHelper;
import net.minecraft.server.level.ServerPlayer;
import net.minecraft.world.damagesource.DamageSource;
/*? if >=1.20.4*/ /*import net.minecraft.world.entity.vehicle.VehicleEntity;*/
/*? if >=1.20.4*/ import net.minecraft.world.entity.vehicle.VehicleEntity;
import net.minecraft.world.item.Item;
import net.minecraft.world.item.ItemStack;
import org.spongepowered.asm.mixin.Mixin;
Expand All @@ -18,7 +18,7 @@
@Pseudo
@Mixin(targets = "net.minecraft.world.entity.vehicle.VehicleEntity")
public class VehicleEntityMixin {
/*? if >=1.20.4 {*//*
/*? if >=1.20.4 {*/
@WrapOperation(
method = "destroy(Lnet/minecraft/world/damagesource/DamageSource;)V",
at = @At(
Expand Down Expand Up @@ -51,5 +51,5 @@ private boolean replaceDropItem(

return MixinHelper.wrapWithConditionPlayerItemSingle(player, itemStack);
}
*//*?}*/
/*?}*/
}
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ public abstract class WitherBossMixin {
)
)
protected void redirectEquipmentDrop(
Args args, /*? if >=1.21 {*/ /*ServerLevel serverLevel, DamageSource damageSource, boolean bl *//*?} else {*/ DamageSource damageSource, int looting, boolean hitByPlayer /*?}*/
Args args, /*? if >=1.21 {*/ ServerLevel serverLevel, DamageSource damageSource, boolean bl /*?} else {*/ /*DamageSource damageSource, int looting, boolean hitByPlayer *//*?}*/
) {
ItemLike original = args.get(0);

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -9,10 +9,10 @@
import net.minecraft.world.entity.LivingEntity;
import net.minecraft.world.entity.Shearable;
import net.minecraft.world.entity.player.Player;
/*? if >=1.20.4 {*//*
/*? if >=1.20.4 {*/
import net.minecraft.world.entity.vehicle.VehicleEntity;
import net.minecraft.world.item.Item;
*//*?}*/
/*?}*/
import net.minecraft.world.item.Item;
import net.minecraft.world.item.ItemStack;
import org.apache.commons.lang3.mutable.MutableInt;
Expand Down Expand Up @@ -97,7 +97,7 @@ public static boolean entityCustomDeathLootSingle(
.invoke(mutableList,
new MutableInt(0),
player,
Objects.requireNonNullElseGet(/*? if >=1.21 {*//*source.getWeaponItem() *//*?} else {*/ player.getMainHandItem() /*?}*/, player::getMainHandItem)
Objects.requireNonNullElseGet(/*? if >=1.21 {*/source.getWeaponItem() /*?} else {*/ /*player.getMainHandItem() *//*?}*/, player::getMainHandItem)
);

return !mutableList.isEmpty();
Expand All @@ -116,13 +116,13 @@ public static List<ItemStack> entityCustomDeathLootMultiple(
.invoke(mutableList,
new MutableInt(0),
player,
Objects.requireNonNullElseGet(/*? if >=1.21 {*//*source.getWeaponItem() *//*?} else {*/ player.getMainHandItem() /*?}*/, player::getMainHandItem)
Objects.requireNonNullElseGet(/*? if >=1.21 {*/source.getWeaponItem() /*?} else {*/ /*player.getMainHandItem() *//*?}*/, player::getMainHandItem)
);

return mutableList;
}

/*? if >=1.20.4 {*//*
/*? if >=1.20.4 {*/
public static void prepareVehicleServerPlayer(
VehicleEntity instance,
Item item,
Expand All @@ -142,7 +142,7 @@ public static void prepareVehicleServerPlayer(
threadLocal.set(previous);
}
}
*//*?}*/
/*?}*/

public static void prepareShearableServerPlayer(
Shearable instance,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ object DropEvent {
@Suppress("unused")
private val listener = event.register { items, exp, player, tool ->
if (config.needSneak && !player.isCrouching) return@register
if (config.needEnchantment && /*? if >=1.21 {*/ /*!EnchantmentHelper.hasTag(tool, telekinesisEffectId)*//*?} else {*/ EnchantmentHelper.getItemEnchantmentLevel(telekinesis, tool) == 0 /*?}*/) return@register
if (config.needEnchantment && /*? if >=1.21 {*/ !EnchantmentHelper.hasTag(tool, telekinesisEffectId)/*?} else {*/ /*EnchantmentHelper.getItemEnchantmentLevel(telekinesis, tool) == 0 *//*?}*/) return@register

if (config.itemsAllowed) items.removeIf(player::addItem)
if (config.expAllowed) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ import net.fabricmc.loader.api.FabricLoader
import dev.nyon.telekinesis.config.config as internalConfig

//? if <=1.20.6
lateinit var telekinesis: TelekinesisEnchantment
/*lateinit var telekinesis: TelekinesisEnchantment*/

fun init() {
config(FabricLoader.getInstance().configDir.resolve("telekinesis.json"), 1, Config()) { _, _ -> null }
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,14 +5,14 @@ import net.minecraft.network.chat.Component
import net.minecraft.world.item.enchantment.Enchantment
import net.minecraft.world.entity.EquipmentSlot
/*? if >=1.21 {*/
/*

import net.minecraft.core.registries.Registries
import net.minecraft.resources.ResourceLocation
import net.minecraft.tags.TagKey

val telekinesisEffectId: TagKey<Enchantment> = TagKey.create(Registries.ENCHANTMENT, ResourceLocation.fromNamespaceAndPath("telekinesis", "auto_move"))
val telekinesisEnchantmentId: ResourceLocation = ResourceLocation.fromNamespaceAndPath("telekinesis", "telekinesis")
*//*?}*/
/*?}*/

/*? if <1.21 && >=1.20.5 {*/
/*import net.fabricmc.fabric.api.tag.convention.v2.ConventionalItemTags
Expand All @@ -39,7 +39,7 @@ import net.minecraft.world.item.enchantment.EnchantmentCategory
Component.translatable("enchantment.telekinesis.telekinesis.name").withStyle(ChatFormatting.GRAY)
}
*//*?} elif <1.20.5 {*/
class TelekinesisEnchantment : Enchantment(
/*class TelekinesisEnchantment : Enchantment(
Rarity.RARE, EnchantmentCategory.BREAKABLE, listOf(EquipmentSlot.OFFHAND, EquipmentSlot.MAINHAND).toTypedArray()
) {
override fun getMinLevel(): Int = 1
Expand All @@ -54,4 +54,4 @@ class TelekinesisEnchantment : Enchantment(
override fun getFullname(i: Int): Component =
Component.translatable("enchantment.telekinesis.telekinesis.name").withStyle(ChatFormatting.GRAY)
}
/*?}*/
*//*?}*/
Loading

0 comments on commit b724ca4

Please sign in to comment.