diff --git a/gradle.properties b/gradle.properties index b63835e8..954d2914 100644 --- a/gradle.properties +++ b/gradle.properties @@ -6,6 +6,6 @@ versions_minecraft=1.20.1 versions_minecraft_range=[1.20.1,1.21) versions_forge=47.1.0 versions_forge_range=[47.1.0,) -versions_mod=1.9.1 -versions_mlib=5.0.0 -versions_mlib_range=[5.0.0,6.0.0) \ No newline at end of file +versions_mod=1.9.2 +versions_mlib=5.1.0 +versions_mlib_range=[5.1.0,6.0.0) \ No newline at end of file diff --git a/libs/majrusz-library-1.20.1-5.0.0.jar b/libs/majrusz-library-1.20.1-5.1.0.jar similarity index 74% rename from libs/majrusz-library-1.20.1-5.0.0.jar rename to libs/majrusz-library-1.20.1-5.1.0.jar index 44c40410..4224edaf 100644 Binary files a/libs/majrusz-library-1.20.1-5.0.0.jar and b/libs/majrusz-library-1.20.1-5.1.0.jar differ diff --git a/src/main/java/com/majruszsenchantments/Registries.java b/src/main/java/com/majruszsenchantments/Registries.java index af4a1a0f..b05583a4 100644 --- a/src/main/java/com/majruszsenchantments/Registries.java +++ b/src/main/java/com/majruszsenchantments/Registries.java @@ -15,8 +15,6 @@ import net.minecraft.world.item.SwordItem; import net.minecraft.world.item.enchantment.Enchantment; import net.minecraft.world.item.enchantment.EnchantmentCategory; -import net.minecraftforge.api.distmarker.Dist; -import net.minecraftforge.fml.DistExecutor; import net.minecraftforge.fml.config.ModConfig; import net.minecraftforge.registries.DeferredRegister; import net.minecraftforge.registries.ForgeRegistries; @@ -27,7 +25,6 @@ public class Registries { // Configs public static final ConfigHandler SERVER_CONFIG = HELPER.createConfig( ModConfig.Type.SERVER ); - public static final ConfigHandler CLIENT_CONFIG = HELPER.createConfig( ModConfig.Type.CLIENT ); static { ModConfigs.init( SERVER_CONFIG, Groups.ENCHANTMENT ).name( "Enchantments" ); @@ -90,8 +87,6 @@ public static String getLocationString( String register ) { } public static void initialize() { - DistExecutor.unsafeRunWhenOn( Dist.CLIENT, ()->RegistriesClient::initialize ); - HELPER.register(); } diff --git a/src/main/java/com/majruszsenchantments/RegistriesClient.java b/src/main/java/com/majruszsenchantments/RegistriesClient.java deleted file mode 100644 index baa48efd..00000000 --- a/src/main/java/com/majruszsenchantments/RegistriesClient.java +++ /dev/null @@ -1,69 +0,0 @@ -package com.majruszsenchantments; - -import com.mlib.Utility; -import com.mlib.config.BooleanConfig; -import net.minecraft.client.multiplayer.ClientLevel; -import net.minecraft.client.renderer.item.ItemProperties; -import net.minecraft.resources.ResourceLocation; -import net.minecraft.world.entity.LivingEntity; -import net.minecraft.world.item.ItemStack; -import net.minecraft.world.item.Items; -import net.minecraft.world.item.enchantment.Enchantment; -import net.minecraft.world.item.enchantment.EnchantmentHelper; -import net.minecraftforge.api.distmarker.Dist; -import net.minecraftforge.api.distmarker.OnlyIn; -import net.minecraftforge.fml.event.lifecycle.FMLClientSetupEvent; -import net.minecraftforge.fml.javafmlmod.FMLJavaModLoadingContext; - -import java.util.Map; - -@OnlyIn( Dist.CLIENT ) -public class RegistriesClient { - static BooleanConfig UNIQUE_BOOK_TEXTURE; - - public static void initialize() { - UNIQUE_BOOK_TEXTURE = new BooleanConfig( true ); - UNIQUE_BOOK_TEXTURE.name( "unique_book_texture" ) - .comment( "Should the Enchanted Book has a different texture when it has any of the new enchantments on it (disabling it may fix some bugs with other mods)?" ) - .requiresWorldRestart( true ); - - Registries.CLIENT_CONFIG.addConfig( UNIQUE_BOOK_TEXTURE ); - FMLJavaModLoadingContext.get().getModEventBus().addListener( RegistriesClient::register ); - } - - private static void register( final FMLClientSetupEvent event ) { - if( UNIQUE_BOOK_TEXTURE.isEnabled() ) { - event.enqueueWork( ()->{ - ItemProperties.register( Items.ENCHANTED_BOOK, new ResourceLocation( "book_type" ), RegistriesClient::enchantmentBookPredicate ); - } ); - } - } - - private static float enchantmentBookPredicate( ItemStack itemStack, ClientLevel clientWorld, LivingEntity entity, int i ) { - Map< Enchantment, Integer > enchantments = EnchantmentHelper.getEnchantments( itemStack ); - - boolean hasWonderfulEnchantments = false; - boolean hasOtherEnchantments = false; - for( Map.Entry< Enchantment, Integer > enchantmentPair : enchantments.entrySet() ) { - ResourceLocation enchantmentLocation = Utility.getRegistryKey( enchantmentPair.getKey() ); - if( enchantmentLocation == null ) - continue; - - String enchantmentName = enchantmentLocation.getNamespace(); - if( enchantmentName.contains( "majruszsenchantments" ) ) { - hasWonderfulEnchantments = true; - } else { - hasOtherEnchantments = true; - } - - if( hasWonderfulEnchantments && hasOtherEnchantments ) - break; - } - - if( hasWonderfulEnchantments ) { - return hasOtherEnchantments ? 2.0f : 1.0f; - } - - return 0.0f; - } -} diff --git a/src/main/java/com/majruszsenchantments/curses/FatigueCurse.java b/src/main/java/com/majruszsenchantments/curses/FatigueCurse.java index 1ba1ae7d..d0945acf 100644 --- a/src/main/java/com/majruszsenchantments/curses/FatigueCurse.java +++ b/src/main/java/com/majruszsenchantments/curses/FatigueCurse.java @@ -87,7 +87,7 @@ public Handler() { } private void reduceMiningSpeed( OnBreakSpeed.Data data ) { - data.event.setNewSpeed( data.event.getNewSpeed() * this.getItemMultiplier( this.miningMultiplier, data.player ) ); + data.newSpeed *= this.getItemMultiplier( this.miningMultiplier, data.player ); } private void reduceAttackSpeed( OnEquipmentChanged.Data data ) { diff --git a/src/main/java/com/majruszsenchantments/enchantments/DeathWishEnchantment.java b/src/main/java/com/majruszsenchantments/enchantments/DeathWishEnchantment.java index 7c2a0564..8d39580e 100644 --- a/src/main/java/com/majruszsenchantments/enchantments/DeathWishEnchantment.java +++ b/src/main/java/com/majruszsenchantments/enchantments/DeathWishEnchantment.java @@ -2,16 +2,16 @@ import com.majruszsenchantments.Registries; import com.mlib.EquipmentSlots; -import com.mlib.modhelper.AutoInstance; import com.mlib.config.ConfigGroup; -import com.mlib.config.DoubleRangeConfig; -import com.mlib.enchantments.CustomEnchantment; -import com.mlib.entities.EntityHelper; -import com.mlib.contexts.base.Condition; -import com.mlib.contexts.base.ModConfigs; +import com.mlib.config.ValueRangeConfig; import com.mlib.contexts.OnEnchantmentAvailabilityCheck; import com.mlib.contexts.OnPreDamaged; +import com.mlib.contexts.base.Condition; +import com.mlib.contexts.base.ModConfigs; +import com.mlib.enchantments.CustomEnchantment; +import com.mlib.entities.EntityHelper; import com.mlib.math.Range; +import com.mlib.modhelper.AutoInstance; import java.util.function.Supplier; @@ -26,8 +26,8 @@ public DeathWishEnchantment() { @AutoInstance public static class Handler { - final DoubleRangeConfig damageMultiplier = new DoubleRangeConfig( new Range<>( 1.0, 2.0 ), new Range<>( 1.0, 10.0 ) ); - final DoubleRangeConfig vulnerabilityMultiplier = new DoubleRangeConfig( new Range<>( 0.7, 1.2 ), new Range<>( 0.0, 10.0 ) ); + final ValueRangeConfig< Double > damageMultiplier = new ValueRangeConfig<>( new Range<>( 1.0, 2.0 ), new Range<>( 1.0, 10.0 ) ); + final ValueRangeConfig< Double > vulnerabilityMultiplier = new ValueRangeConfig<>( new Range<>( 0.7, 1.2 ), new Range<>( 0.0, 10.0 ) ); final Supplier< DeathWishEnchantment > enchantment = Registries.DEATH_WISH; public Handler() { @@ -43,18 +43,18 @@ public Handler() { OnPreDamaged.listen( this::increaseDamageDealt ) .addCondition( Condition.hasEnchantment( this.enchantment, data->data.attacker ) ) .addConfig( this.damageMultiplier.name( "DamageMultiplier" ) - .comment( "Multiplies the damage dealt according to the missing health ratio.\nIn other words, the lower the health ratio, the more 'to' value is taken into account." ) + .comment( "Multiplies the damage dealt according to the missing health ratio." ) ).insertTo( group ); OnPreDamaged.listen( this::increaseDamageReceived ) .addCondition( Condition.hasEnchantment( this.enchantment, data->data.target ) ) .addConfig( this.vulnerabilityMultiplier.name( "VulnerabilityMultiplier" ) - .comment( "Multiplies the damage taken according to the health ratio.\nIn other words, the higher the health ratio, the more 'to' value is taken into account." ) + .comment( "Multiplies the damage taken according to the health ratio." ) ).insertTo( group ); } private void increaseDamageDealt( OnPreDamaged.Data data ) { - float damageMultiplier = this.damageMultiplier.lerp( ( float )EntityHelper.getMissingHealthRatio( data.attacker ) ) - 1.0f; + float damageMultiplier = this.damageMultiplier.get().lerp( ( float )EntityHelper.getMissingHealthRatio( data.attacker ) ) - 1.0f; data.extraDamage += data.damage * damageMultiplier; if( damageMultiplier > 0.01f ) { @@ -63,7 +63,7 @@ private void increaseDamageDealt( OnPreDamaged.Data data ) { } private void increaseDamageReceived( OnPreDamaged.Data data ) { - float damageMultiplier = this.vulnerabilityMultiplier.lerp( ( float )EntityHelper.getHealthRatio( data.target ) ) - 1.0f; + float damageMultiplier = this.vulnerabilityMultiplier.get().lerp( ( float )EntityHelper.getHealthRatio( data.target ) ) - 1.0f; data.extraDamage += data.damage * damageMultiplier; } diff --git a/src/main/java/com/majruszsenchantments/enchantments/DodgeEnchantment.java b/src/main/java/com/majruszsenchantments/enchantments/DodgeEnchantment.java index 9150b464..02f778bd 100644 --- a/src/main/java/com/majruszsenchantments/enchantments/DodgeEnchantment.java +++ b/src/main/java/com/majruszsenchantments/enchantments/DodgeEnchantment.java @@ -49,6 +49,7 @@ public Handler() { .addCondition( Condition.hasEnchantment( this.enchantment, data->data.target ) ) .addCondition( OnPreDamaged.dealtAnyDamage() ) .addCondition( OnPreDamaged.willTakeFullDamage() ) + .addCondition( Condition.predicate( data->data.attacker != null ) ) .addCondition( Condition.predicate( this::tryToDodge ) ) .addConfig( this.chance.name( "chance" ).comment( "Chance to completely ignore the damage per enchantment level." ) ) .insertTo( group ); diff --git a/src/main/resources/assets/majruszsenchantments/lang/ja_jp.json b/src/main/resources/assets/majruszsenchantments/lang/ja_jp.json new file mode 100644 index 00000000..c67a78d1 --- /dev/null +++ b/src/main/resources/assets/majruszsenchantments/lang/ja_jp.json @@ -0,0 +1,119 @@ +{ + "enchantment.majruszsenchantments.absorber": "吸収体", + "enchantment.majruszsenchantments.absorber.desc": "盾の耐久性を犠牲にする代わりに、あらゆるマイナス効果を吸収します。", + "enchantment.majruszsenchantments.absorber.description": "盾の耐久性を犠牲にする代わりに、あらゆるマイナス効果を吸収します。", + + "enchantment.majruszsenchantments.death_wish": "死の願望", + "enchantment.majruszsenchantments.death_wish.desc": "失われた体力の割合に応じて与えるダメージが増加します。", + "enchantment.majruszsenchantments.death_wish.description": "失った体力の割合に応じて与えるダメージが増加します。", + + "enchantment.majruszsenchantments.dodge": "回避", + "enchantment.majruszsenchantments.dodge.desc": "あらゆるダメージを完全に回避する機会を与えます。", + "enchantment.majruszsenchantments.dodge.description": "あらゆるダメージを完全に回避する機会を与えます。", + + "enchantment.majruszsenchantments.enlightenment": "啓発", + "enchantment.majruszsenchantments.enlightenment.desc": "あらゆるソースから獲得できる経験値が増加します。", + "enchantment.majruszsenchantments.enlightenment.description": "あらゆるソースから得られる経験値が増加します。", + + "enchantment.majruszsenchantments.fishing_fanatic": "フィッシングマニア", + "enchantment.majruszsenchantments.fishing_fanatic.desc": "釣りで追加のアイテムを釣れるチャンスが与えられます。", + "enchantment.majruszsenchantments.fishing_fanatic.description": "釣りで追加のアイテムを釣れるチャンスが与えられます。", + "enchantment.majruszsenchantments.fishing_fanatic.level_up": "釣りに夢中になってしまったね!", + "enchantment.majruszsenchantments.fishing_fanatic.true": "真のフィシングマニア", + + "enchantment.majruszsenchantments.fuse_cutter": "ヒューズカッター", + "enchantment.majruszsenchantments.fuse_cutter.desc": "近くで爆発が起きても、ブロックは破壊されず、ダメージもありません。", + "enchantment.majruszsenchantments.fuse_cutter.description": "近くで爆発が起きても、ブロックは破壊されず、ダメージもありません。", + + "enchantment.majruszsenchantments.gold_fuelled": "ゴールド・フュエルド", + "enchantment.majruszsenchantments.gold_fuelled.desc": "壊れそうになった金の道具や防具を、金のインゴット1個で完全に修理します。", + "enchantment.majruszsenchantments.gold_fuelled.description": "壊れそうになった金の道具や防具を、金のインゴット1個で完全に修理します。", + + "enchantment.majruszsenchantments.harvester": "収穫機", + "enchantment.majruszsenchantments.harvester.desc": "右クリックで収穫ができるようになり、近くの作物を栽培できるようになりました。", + "enchantment.majruszsenchantments.harvester.description": "右クリックで収穫ができるようになり、近くの作物を栽培できるようになりました。", + + "enchantment.majruszsenchantments.horse_frost_walker": "フロストライダー", + "enchantment.majruszsenchantments.horse_frost_walker.desc": "馬に乗って水の上を歩くと氷の道ができます。", + "enchantment.majruszsenchantments.horse_frost_walker.description": "馬に乗って水の上を歩くと氷の道ができます。", + + "enchantment.majruszsenchantments.horse_protection": "アーマードキャラバン", + "enchantment.majruszsenchantments.horse_protection.desc": "馬が受けるダメージを軽減されます。", + "enchantment.majruszsenchantments.horse_protection.description": "馬が受けるダメージを軽減されます。", + + "enchantment.majruszsenchantments.horse_swiftness": "素早さ", + "enchantment.majruszsenchantments.horse_swiftness.desc": "馬の移動速度が速くなります。", + "enchantment.majruszsenchantments.horse_swiftness.description": "馬の移動速度が速くなります。", + + "enchantment.majruszsenchantments.hunter": "猟師", + "enchantment.majruszsenchantments.hunter.desc": "モブのドロップ量が増加し、距離に応じてダメージが増加します。", + "enchantment.majruszsenchantments.hunter.description": "モブのドロップ量が増加し、距離に応じてダメージが増加します。", + + "enchantment.majruszsenchantments.immortality": "不死身", + "enchantment.majruszsenchantments.immortality.desc": "盾を犠牲にする代わりに、致命的な打撃での死を欺きます。", + "enchantment.majruszsenchantments.immortality.description": "盾を犠牲にする代わりに、致命的な打撃での死を欺きます。", + + "enchantment.majruszsenchantments.leech": "リーチ", + "enchantment.majruszsenchantments.leech.desc": "敵からプラス効果、体力、満腹度を奪う機会があります。", + "enchantment.majruszsenchantments.leech.description": "敵からプラス効果、体力、満腹度を奪う機会があります。", + + "enchantment.majruszsenchantments.magic_protection": "マジックプロテクション", + "enchantment.majruszsenchantments.magic_protection.desc": "エヴォーカー、ガーディアン、負傷のポーションなどの魔法ダメージから守ります。", + "enchantment.majruszsenchantments.magic_protection.description": "エヴォーカー、ガーディアン、負傷のポーションなどの魔法ダメージから守ります。", + + "enchantment.majruszsenchantments.misanthropy": "人嫌い", + "enchantment.majruszsenchantments.misanthropy.desc": "村人、ピリジャー‌、ウィッチや他のプレイヤーに対するダメージが増加します。", + "enchantment.majruszsenchantments.misanthropy.description": "村人、ピリジャー‌、ウィッチや他のプレイヤーに対するダメージが増加します。", + + "enchantment.majruszsenchantments.repulsion": "反発", + "enchantment.majruszsenchantments.repulsion.desc": "モブの攻撃をガードした際にモブをノックバックさせます。", + "enchantment.majruszsenchantments.repulsion.description": "モブの攻撃をガードした際にモブをノックバックさせます。", + + "enchantment.majruszsenchantments.sixth_sense": "第六感", + "enchantment.majruszsenchantments.sixth_sense.desc": "プレイヤーが近くで忍び込んでいる場合、何らかの音を出ている近くのモブを表示します。", + "enchantment.majruszsenchantments.sixth_sense.description": "プレイヤーが近くで忍び込んでいる場合、何らかの音を出ている近くのモブを表示します。", + + "enchantment.majruszsenchantments.smelter": "製錬所", + "enchantment.majruszsenchantments.smelter.desc": "破壊されたブロックは自動的に製錬されます。", + "enchantment.majruszsenchantments.smelter.description": "破壊されたブロックは自動的に製錬されます。", + + "enchantment.majruszsenchantments.telekinesis": "念力", + "enchantment.majruszsenchantments.telekinesis.desc": "獲得したアイテムをプレイヤーのインベントリに直接追加します。", + "enchantment.majruszsenchantments.telekinesis.description": "獲得したアイテムをプレイヤーのインベントリに直接追加します。", + + "enchantment.majruszsenchantments.breaking_curse": "呪いの破戒", + "enchantment.majruszsenchantments.breaking_curse.desc": "アイテムの壊れる速度が速くなります。", + "enchantment.majruszsenchantments.breaking_curse.description": "アイテムの壊れる速度が速くなります。", + + "enchantment.majruszsenchantments.corrosion_curse": "腐食の呪縛", + "enchantment.majruszsenchantments.corrosion_curse.desc": "水中では防具を徐々に破壊し、使用者にダメージを与えます。", + "enchantment.majruszsenchantments.corrosion_curse.description": "水中では防具を徐々に破壊し、使用者にダメージを与えます。", + + "enchantment.majruszsenchantments.fatigue_curse": "疲労の呪縛", + "enchantment.majruszsenchantments.fatigue_curse.desc": "プレイヤーの移動速度とアイテムの使用時間を効果的に減少させます。", + "enchantment.majruszsenchantments.fatigue_curse.description": "プレイヤーの移動速度とアイテムの使用時間を効果的に減少させます。", + + "enchantment.majruszsenchantments.incompatibility_curse": "相容れない呪い", + "enchantment.majruszsenchantments.incompatibility_curse.desc": "アイテムにエンチャントをすることが出来なくなります。", + "enchantment.majruszsenchantments.incompatibility_curse.description": "アイテムにエンチャントをすることが出来なくなります。", + + "enchantment.majruszsenchantments.slippery_curse": "滑りやすい呪い", + "enchantment.majruszsenchantments.slippery_curse.desc": "時々、アイテムを手元から落としてしまうことがあります。", + "enchantment.majruszsenchantments.slippery_curse.description": "時々、アイテムを手元から落としてしまうことがあります。", + + "enchantment.majruszsenchantments.vampirism_curse": "吸血鬼の呪い", + "enchantment.majruszsenchantments.vampirism_curse.desc": "昼間はプレイヤーを弱体化し、燃えますが、リーチエンチャントは強くなります。", + "enchantment.majruszsenchantments.vampirism_curse.description": "昼間はプレイヤーを弱体化し、燃えますが、リーチエンチャントは強くなります。", + "enchantment.majruszsenchantments.vampirism_curse.block_sleep": "眠る必要性を全く感じない...", + + "advancements.majruszsenchantments.scholar.title": "学者", + "advancements.majruszsenchantments.scholar.description": "すべての防具でEnlightenment IIを獲得する", + "advancements.majruszsenchantments.nothing_can_stop_me.title": "誰にも止める事が出来ない", + "advancements.majruszsenchantments.nothing_can_stop_me.description": "雨が降っている間にフィッシングマニアの次のレベルを取得しましょう", + "advancements.majruszsenchantments.fishing_fanatic.title": "やあ、なかなかいいね!", + "advancements.majruszsenchantments.fishing_fanatic.description": "フィッシングマニアの最初のレベルを取得する", + "advancements.majruszsenchantments.fishing_fanatic_true.title": "そうですね...私は依存しています", + "advancements.majruszsenchantments.fishing_fanatic_true.description": "フィッシングマニアのレベル8を取得", + "advancements.majruszsenchantments.fishing_fanatic_extreme.title": "究極のフィッシング", + "advancements.majruszsenchantments.fishing_fanatic_extreme.description": "最高の釣りのエンチャントを1本の釣竿で手に入れよう" +} diff --git a/src/main/resources/assets/majruszsenchantments/models/item/majrusz_book.json b/src/main/resources/assets/majruszsenchantments/models/item/majrusz_book.json deleted file mode 100644 index 5c5bf189..00000000 --- a/src/main/resources/assets/majruszsenchantments/models/item/majrusz_book.json +++ /dev/null @@ -1,6 +0,0 @@ -{ - "parent": "item/generated", - "textures": { - "layer0": "majruszsenchantments:item/majrusz_book" - } -} \ No newline at end of file diff --git a/src/main/resources/assets/majruszsenchantments/models/item/majrusz_book_combined.json b/src/main/resources/assets/majruszsenchantments/models/item/majrusz_book_combined.json deleted file mode 100644 index e447b40c..00000000 --- a/src/main/resources/assets/majruszsenchantments/models/item/majrusz_book_combined.json +++ /dev/null @@ -1,6 +0,0 @@ -{ - "parent": "item/generated", - "textures": { - "layer0": "majruszsenchantments:item/majrusz_book_combined" - } -} \ No newline at end of file diff --git a/src/main/resources/assets/majruszsenchantments/textures/item/majrusz_book.png b/src/main/resources/assets/majruszsenchantments/textures/item/majrusz_book.png deleted file mode 100644 index 1594ed82..00000000 Binary files a/src/main/resources/assets/majruszsenchantments/textures/item/majrusz_book.png and /dev/null differ diff --git a/src/main/resources/assets/majruszsenchantments/textures/item/majrusz_book_combined.png b/src/main/resources/assets/majruszsenchantments/textures/item/majrusz_book_combined.png deleted file mode 100644 index 0a69fe04..00000000 Binary files a/src/main/resources/assets/majruszsenchantments/textures/item/majrusz_book_combined.png and /dev/null differ diff --git a/src/main/resources/assets/minecraft/models/item/enchanted_book.json b/src/main/resources/assets/minecraft/models/item/enchanted_book.json deleted file mode 100644 index 66b981e5..00000000 --- a/src/main/resources/assets/minecraft/models/item/enchanted_book.json +++ /dev/null @@ -1,11 +0,0 @@ -{ - "parent": "item/generated", - "textures": { - "layer0": "item/enchanted_book" - }, - "overrides": [ - { "predicate": { "book_type": 0.0 }, "model": "item/enchanted_book" }, - { "predicate": { "book_type": 1.0 }, "model": "majruszsenchantments:item/majrusz_book" }, - { "predicate": { "book_type": 2.0 }, "model": "majruszsenchantments:item/majrusz_book_combined" } - ] -} \ No newline at end of file diff --git a/src/main/resources/logo.png b/src/main/resources/logo.png index 6cbc6633..32513f39 100644 Binary files a/src/main/resources/logo.png and b/src/main/resources/logo.png differ