diff --git a/build.gradle b/build.gradle index 5f9816f..0d39801 100644 --- a/build.gradle +++ b/build.gradle @@ -45,10 +45,16 @@ loom { } processResources { - inputs.property "version", project.version - filesMatching("fabric.mod.json") { - expand "version": project.version - } + def expandProps = [ + "version": rootProject.mod_version, + "minecraft_version_range": rootProject.minecraft_version_range, + ] + + filesMatching(["fabric.mod.json"]) { + expand expandProps + } + + inputs.properties(expandProps) } tasks.withType(JavaCompile).configureEach { diff --git a/gradle.properties b/gradle.properties index 0411ca4..97b0f3d 100644 --- a/gradle.properties +++ b/gradle.properties @@ -6,6 +6,8 @@ mod_version = 0.6.0+1.20 maven_group = ru.pinkgoosik archives_base_name = artifality +minecraft_version_range = >=1.20 <1.20.2 + # Dependencies minecraft_version = 1.20.1 yarn_mappings = 1.20.1+build.10 diff --git a/src/main/java/artifality/block/CrateBlock.java b/src/main/java/artifality/block/CrateBlock.java index 88a9239..c66b18d 100644 --- a/src/main/java/artifality/block/CrateBlock.java +++ b/src/main/java/artifality/block/CrateBlock.java @@ -3,9 +3,7 @@ import static artifality.registry.ArtifalityItems.*; import artifality.block.base.BaseBlock; -import artifality.extension.ArtifactChances; import artifality.item.base.ArtifactItem; -import artifality.list.ArtifactRarity; import artifality.registry.ArtifalityItems; import net.minecraft.block.Block; import net.minecraft.block.BlockState; diff --git a/src/main/java/artifality/extension/ArtifactChances.java b/src/main/java/artifality/extension/ArtifactChances.java deleted file mode 100644 index 4ab86ff..0000000 --- a/src/main/java/artifality/extension/ArtifactChances.java +++ /dev/null @@ -1,13 +0,0 @@ -package artifality.extension; - -public interface ArtifactChances { - int artifality$getCommonAmplifier(); - int artifality$getRareAmplifier(); - int artifality$getLegendaryAmplifier(); -// int artifality$getLunarAmplifier(); - - void artifality$setCommonAmplifier(int amplifier); - void artifality$setRareAmplifier(int amplifier); - void artifality$setLegendaryAmplifier(int amplifier); -// void artifality$setLunarAmplifier(int amplifier); -} diff --git a/src/main/java/artifality/item/ArtifactSettings.java b/src/main/java/artifality/item/ArtifactSettings.java index 511da8c..6ae0700 100644 --- a/src/main/java/artifality/item/ArtifactSettings.java +++ b/src/main/java/artifality/item/ArtifactSettings.java @@ -1,12 +1,10 @@ package artifality.item; -import artifality.list.ArtifactRarity; import dev.emi.trinkets.api.client.TrinketRenderer; import net.fabricmc.fabric.api.item.v1.FabricItemSettings; public class ArtifactSettings { public final FabricItemSettings fabricItemSettings; - public ArtifactRarity rarity = ArtifactRarity.COMMON; public TrinketRenderer renderer; public boolean isCrateLoot = true; public boolean isTrinket = false; @@ -19,11 +17,6 @@ public ArtifactSettings() { fabricItemSettings = new FabricItemSettings(); } - public ArtifactSettings rarity(ArtifactRarity rarity) { - this.rarity = rarity; - return this; - } - public ArtifactSettings nonCrateItem() { this.isCrateLoot = false; return this; diff --git a/src/main/java/artifality/list/ArtifactRarity.java b/src/main/java/artifality/list/ArtifactRarity.java deleted file mode 100644 index 9c1c2b4..0000000 --- a/src/main/java/artifality/list/ArtifactRarity.java +++ /dev/null @@ -1,26 +0,0 @@ -package artifality.list; - -import java.awt.*; - -public enum ArtifactRarity { - COMMON("common", new Color(188, 188, 188)), - RARE("rare", new Color(72, 255, 130)), - LEGENDARY("legendary", new Color(255, 98, 114)), - LUNAR("lunar", new Color(131, 98, 255)); - - private final String name; - private final Color color; - - ArtifactRarity(String name, Color color) { - this.name = name; - this.color = color; - } - - public Color getColor() { - return color; - } - - public String getName() { - return name; - } -} diff --git a/src/main/java/artifality/mixin/common/extension/LightningMixinExtension.java b/src/main/java/artifality/mixin/common/LightningMixin.java similarity index 88% rename from src/main/java/artifality/mixin/common/extension/LightningMixinExtension.java rename to src/main/java/artifality/mixin/common/LightningMixin.java index 6000260..136afd6 100644 --- a/src/main/java/artifality/mixin/common/extension/LightningMixinExtension.java +++ b/src/main/java/artifality/mixin/common/LightningMixin.java @@ -1,4 +1,4 @@ -package artifality.mixin.common.extension; +package artifality.mixin.common; import artifality.extension.LightningExtension; import net.minecraft.entity.Entity; @@ -11,13 +11,13 @@ import org.spongepowered.asm.mixin.injection.callback.CallbackInfo; @Mixin(LightningEntity.class) -public abstract class LightningMixinExtension extends Entity implements LightningExtension { +public abstract class LightningMixin extends Entity implements LightningExtension { private boolean artifality$canSpawnFire = true; private boolean artifality$canChargeCreeper = true; private float artifality$damage = 0; - public LightningMixinExtension(EntityType type, World world) { + public LightningMixin(EntityType type, World world) { super(type, world); } diff --git a/src/main/java/artifality/mixin/common/extension/PlayerMixinExtension.java b/src/main/java/artifality/mixin/common/extension/PlayerMixinExtension.java deleted file mode 100644 index 9982bfb..0000000 --- a/src/main/java/artifality/mixin/common/extension/PlayerMixinExtension.java +++ /dev/null @@ -1,87 +0,0 @@ -package artifality.mixin.common.extension; - -import artifality.extension.ArtifactChances; -import net.minecraft.entity.EntityType; -import net.minecraft.entity.LivingEntity; -import net.minecraft.entity.data.DataTracker; -import net.minecraft.entity.data.TrackedData; -import net.minecraft.entity.data.TrackedDataHandlerRegistry; -import net.minecraft.entity.player.PlayerEntity; -import net.minecraft.nbt.NbtCompound; -import net.minecraft.world.World; -import org.spongepowered.asm.mixin.Mixin; -import org.spongepowered.asm.mixin.injection.At; -import org.spongepowered.asm.mixin.injection.Inject; -import org.spongepowered.asm.mixin.injection.callback.CallbackInfo; - -@Mixin(PlayerEntity.class) -public abstract class PlayerMixinExtension extends LivingEntity implements ArtifactChances { - protected PlayerMixinExtension(EntityType entityType, World world) {super(entityType, world);} - - private static final TrackedData artifality$COMMON_CHANCE = DataTracker.registerData(PlayerEntity.class, TrackedDataHandlerRegistry.INTEGER); - private static final TrackedData artifality$RARE_CHANCE = DataTracker.registerData(PlayerEntity.class, TrackedDataHandlerRegistry.INTEGER); - private static final TrackedData artifality$LEGENDARY_CHANCE = DataTracker.registerData(PlayerEntity.class, TrackedDataHandlerRegistry.INTEGER); -// private static final TrackedData artifality$LUNAR_CHANCE = DataTracker.registerData(PlayerEntity.class, TrackedDataHandlerRegistry.INTEGER); - - @Override - public int artifality$getCommonAmplifier() { - return getDataTracker().get(artifality$COMMON_CHANCE); - } - - @Override - public int artifality$getRareAmplifier() { - return getDataTracker().get(artifality$RARE_CHANCE); - } - - @Override - public int artifality$getLegendaryAmplifier() { - return getDataTracker().get(artifality$LEGENDARY_CHANCE); - } - -// public int artifality$getLunarAmplifier() { -// return getDataTracker().get(artifality$LUNAR_CHANCE); -// } - - @Override - public void artifality$setCommonAmplifier(int amplifier) { - getDataTracker().set(artifality$COMMON_CHANCE, Math.min(amplifier, 100)); - } - - @Override - public void artifality$setRareAmplifier(int amplifier) { - getDataTracker().set(artifality$RARE_CHANCE, Math.min(amplifier, 100)); - } - - @Override - public void artifality$setLegendaryAmplifier(int amplifier) { - getDataTracker().set(artifality$LEGENDARY_CHANCE, Math.min(amplifier, 100)); - } - -// public void artifality$setLunarAmplifier(int amplifier) { -// getDataTracker().set(artifality$LUNAR_CHANCE, Math.min(amplifier, 100)); -// } - - @Inject(method = "initDataTracker", at = @At("TAIL")) - void initDataTracker(CallbackInfo ci) { - getDataTracker().startTracking(artifality$COMMON_CHANCE, 15); - getDataTracker().startTracking(artifality$RARE_CHANCE, 5); - getDataTracker().startTracking(artifality$LEGENDARY_CHANCE, 3); -// getDataTracker().startTracking(artifality$LUNAR_CHANCE, 5); - } - - @Inject(method = "writeCustomDataToNbt", at = @At("TAIL")) - void writeCustomDataToNbt(NbtCompound nbt, CallbackInfo ci) { - nbt.putInt("ArtifalityCommonAmplifier", artifality$getCommonAmplifier()); - nbt.putInt("ArtifalityRareAmplifier", artifality$getRareAmplifier()); - nbt.putInt("ArtifalityLegendaryAmplifier", artifality$getLegendaryAmplifier()); -// nbt.putInt("ArtifalityLunarAmplifier", artifality$getLunarAmplifier()); - } - - @Inject(method = "readCustomDataFromNbt", at = @At("TAIL")) - void readCustomDataFromNbt(NbtCompound nbt, CallbackInfo ci) { - artifality$setCommonAmplifier(nbt.getInt("ArtifalityCommonAmplifier")); - artifality$setRareAmplifier(nbt.getInt("ArtifalityRareAmplifier")); - artifality$setLegendaryAmplifier(nbt.getInt("ArtifalityLegendaryAmplifier")); -// artifality$setLunarAmplifier(nbt.getInt("ArtifalityLunarAmplifier")); - } -} diff --git a/src/main/java/artifality/registry/ArtifactConfigs.java b/src/main/java/artifality/registry/ArtifactConfigs.java index f457b94..af892bd 100644 --- a/src/main/java/artifality/registry/ArtifactConfigs.java +++ b/src/main/java/artifality/registry/ArtifactConfigs.java @@ -2,47 +2,39 @@ import artifality.client.render.BalloonRenderer; import artifality.item.ArtifactSettings; -import artifality.list.ArtifactRarity; public class ArtifactConfigs { public static final ArtifactSettings LUNAR_CRYSTAL_WAND = new ArtifactSettings() .maxCount(1) - .tiered() - .rarity(ArtifactRarity.RARE); + .tiered(); public static final ArtifactSettings NATURE_STAFF = new ArtifactSettings() .maxCount(1) - .tiered() - .rarity(ArtifactRarity.COMMON); + .tiered(); public static final ArtifactSettings ZEUS_STAFF = new ArtifactSettings() .maxCount(1) - .tiered() - .rarity(ArtifactRarity.LEGENDARY); + .tiered(); public static final ArtifactSettings INVISIBILITY_CAPE = new ArtifactSettings() .maxCount(1) .trinket() - .tiered() - .rarity(ArtifactRarity.COMMON); + .tiered(); public static final ArtifactSettings BALLOON = new ArtifactSettings() .maxDamage(128) .tiered() .trinket() .twoModeled() - .renderer(new BalloonRenderer()) - .rarity(ArtifactRarity.RARE); + .renderer(new BalloonRenderer()); public static final ArtifactSettings HAND_FAN = new ArtifactSettings() .maxCount(1) - .tiered() - .rarity(ArtifactRarity.RARE); + .tiered(); public static final ArtifactSettings HAUNTING_SOUL = new ArtifactSettings() .maxCount(1) .tiered() - .trinket() - .rarity(ArtifactRarity.RARE); + .trinket(); } diff --git a/src/main/java/artifality/util/TooltipAppender.java b/src/main/java/artifality/util/TooltipAppender.java index fd9d4de..a80492e 100644 --- a/src/main/java/artifality/util/TooltipAppender.java +++ b/src/main/java/artifality/util/TooltipAppender.java @@ -39,7 +39,7 @@ else if(item instanceof EnchantedBookItem) { private static boolean shiftPressed(List tooltip, Item item) { if(!Screen.hasShiftDown()) { - if(!(item instanceof EnchantedBookItem && FabricLoader.getInstance().isModLoaded("enchdesc"))) { + if(!(item instanceof EnchantedBookItem && (FabricLoader.getInstance().isModLoaded("enchdesc") || FabricLoader.getInstance().isModLoaded("idwtialsimmoedm")))) { tooltip.add(Text.literal("")); tooltip.add(Text.literal(ofKey("press_shift")).formatted(Formatting.GRAY)); } diff --git a/src/main/resources/artifality.mixins.json b/src/main/resources/artifality.mixins.json index 0faec77..08a48eb 100644 --- a/src/main/resources/artifality.mixins.json +++ b/src/main/resources/artifality.mixins.json @@ -14,7 +14,7 @@ "common.TrackTargetGoalMixin", "common.VillagerMixin", "common.access.BeaconAccess", - "common.extension.LightningMixinExtension", + "common.LightningMixin", "common.extension.PlayerMixinExtension" ], "client": [ diff --git a/src/main/resources/fabric.mod.json b/src/main/resources/fabric.mod.json index 531a042..e043e1e 100644 --- a/src/main/resources/fabric.mod.json +++ b/src/main/resources/fabric.mod.json @@ -55,7 +55,7 @@ "depends": { "fabricloader": "*", "fabric-api": "*", - "minecraft": ">=1.20 <1.20.2", + "minecraft": "${minecraft_version_range}", "java": ">=17", "trinkets": "*" }