├── CHANGELOG.md ├── gradle └── wrapper │ ├── gradle-wrapper.jar │ └── gradle-wrapper.properties ├── src └── main │ ├── resources │ ├── assets │ │ ├── dragonloot │ │ │ ├── models │ │ │ │ ├── item │ │ │ │ │ ├── dragon_anvil.json │ │ │ │ │ ├── dragon_helmet.json │ │ │ │ │ ├── dragon_hoe.json │ │ │ │ │ ├── dragon_boots.json │ │ │ │ │ ├── dragon_pickaxe.json │ │ │ │ │ ├── dragon_scale.json │ │ │ │ │ ├── dragon_shovel.json │ │ │ │ │ ├── dragon_leggings.json │ │ │ │ │ ├── dragon_chestplate.json │ │ │ │ │ ├── dragon_trident.json │ │ │ │ │ ├── dragon_horse_armor.json │ │ │ │ │ ├── upgraded_dragon_chestplate.json │ │ │ │ │ ├── dragon_bow_pulling_0.json │ │ │ │ │ ├── dragon_bow_pulling_1.json │ │ │ │ │ ├── dragon_bow_pulling_2.json │ │ │ │ │ ├── dragon_crossbow_arrow.json │ │ │ │ │ ├── dragon_crossbow_firework.json │ │ │ │ │ ├── dragon_crossbow_pulling_0.json │ │ │ │ │ ├── dragon_crossbow_pulling_1.json │ │ │ │ │ ├── dragon_crossbow_pulling_2.json │ │ │ │ │ ├── dragon_sword_parry.json │ │ │ │ │ ├── dragon_axe.json │ │ │ │ │ ├── dragon_sword.json │ │ │ │ │ ├── dragon_trident_throwing.json │ │ │ │ │ ├── dragon_bow.json │ │ │ │ │ ├── dragon_trident_in_hand.json │ │ │ │ │ └── dragon_crossbow.json │ │ │ │ └── block │ │ │ │ │ └── dragon_anvil.json │ │ │ ├── icon.png │ │ │ ├── textures │ │ │ │ ├── item │ │ │ │ │ ├── dragon_axe.png │ │ │ │ │ ├── dragon_bow.png │ │ │ │ │ ├── dragon_hoe.png │ │ │ │ │ ├── dragon_boots.png │ │ │ │ │ ├── dragon_helmet.png │ │ │ │ │ ├── dragon_scale.png │ │ │ │ │ ├── dragon_shovel.png │ │ │ │ │ ├── dragon_sword.png │ │ │ │ │ ├── dragon_leggings.png │ │ │ │ │ ├── dragon_pickaxe.png │ │ │ │ │ ├── dragon_trident.png │ │ │ │ │ ├── dragon_chestplate.png │ │ │ │ │ ├── dragon_horse_armor.png │ │ │ │ │ ├── dragon_bow_pulling_0.png │ │ │ │ │ ├── dragon_bow_pulling_1.png │ │ │ │ │ ├── dragon_bow_pulling_2.png │ │ │ │ │ ├── dragon_crossbow_arrow.png │ │ │ │ │ ├── dragon_crossbow_standby.png │ │ │ │ │ ├── dragon_crossbow_firework.png │ │ │ │ │ ├── dragon_crossbow_pulling_0.png │ │ │ │ │ ├── dragon_crossbow_pulling_1.png │ │ │ │ │ ├── dragon_crossbow_pulling_2.png │ │ │ │ │ └── upgraded_dragon_chestplate.png │ │ │ │ ├── block │ │ │ │ │ └── dragon_anvil.png │ │ │ │ └── entity │ │ │ │ │ ├── dragon_elytra.png │ │ │ │ │ ├── dragon_trident.png │ │ │ │ │ └── dragon_helmet_3d.png │ │ │ ├── blockstates │ │ │ │ └── dragon_anvil.json │ │ │ └── lang │ │ │ │ ├── zh_cn.json │ │ │ │ ├── ko_kr.json │ │ │ │ ├── en_us.json │ │ │ │ ├── ru_ru.json │ │ │ │ └── pt_br.json │ │ └── minecraft │ │ │ └── textures │ │ │ ├── models │ │ │ └── armor │ │ │ │ ├── dragon_layer_1.png │ │ │ │ └── dragon_layer_2.png │ │ │ └── entity │ │ │ └── horse │ │ │ └── armor │ │ │ └── horse_armor_dragon.png │ ├── data │ │ ├── c │ │ │ └── tags │ │ │ │ └── items │ │ │ │ ├── axes.json │ │ │ │ ├── hoes.json │ │ │ │ ├── pickaxes.json │ │ │ │ ├── shovels.json │ │ │ │ └── swords.json │ │ ├── fabric │ │ │ └── tags │ │ │ │ └── items │ │ │ │ ├── axes.json │ │ │ │ ├── hoes.json │ │ │ │ ├── pickaxes.json │ │ │ │ ├── shovels.json │ │ │ │ └── swords.json │ │ ├── silky_spawners │ │ │ └── tags │ │ │ │ └── items │ │ │ │ └── allowed_tools.json │ │ ├── minecraft │ │ │ └── tags │ │ │ │ ├── items │ │ │ │ └── cluster_max_harvestables.json │ │ │ │ └── blocks │ │ │ │ └── anvil.json │ │ ├── stuffz │ │ │ └── uncraft_recipes │ │ │ │ ├── dragon_axe.json │ │ │ │ ├── dragon_boots.json │ │ │ │ ├── dragon_bow.json │ │ │ │ ├── dragon_hoe.json │ │ │ │ ├── dragon_sword.json │ │ │ │ ├── dragon_helmet.json │ │ │ │ ├── dragon_pickaxe.json │ │ │ │ ├── dragon_shovel.json │ │ │ │ ├── dragon_trident.json │ │ │ │ ├── dragon_chestplate.json │ │ │ │ ├── dragon_crossbow.json │ │ │ │ ├── dragon_leggings.json │ │ │ │ ├── dragon_horse_armor.json │ │ │ │ └── upgraded_dragon_chestplate.json │ │ ├── levelz │ │ │ └── item │ │ │ │ ├── armordragon.json │ │ │ │ ├── axedragon.json │ │ │ │ ├── hoedragon.json │ │ │ │ ├── tooldragon.json │ │ │ │ └── sworddragon.json │ │ ├── dragonloot │ │ │ ├── loot_tables │ │ │ │ └── blocks │ │ │ │ │ └── dragon_anvil.json │ │ │ ├── recipes │ │ │ │ ├── dragon_anvil.json │ │ │ │ ├── dragon_axe.json │ │ │ │ ├── dragon_hoe.json │ │ │ │ ├── dragon_boots.json │ │ │ │ ├── dragon_helmet.json │ │ │ │ ├── dragon_shovel.json │ │ │ │ ├── dragon_sword.json │ │ │ │ ├── dragon_leggings.json │ │ │ │ ├── dragon_pickaxe.json │ │ │ │ └── dragon_chestplate.json │ │ │ ├── tags │ │ │ │ └── items │ │ │ │ │ └── explosion_resistant.json │ │ │ └── advancements │ │ │ │ ├── dragon_recipes.json │ │ │ │ └── dragon_armor.json │ │ └── tooltiprareness │ │ │ └── tags │ │ │ └── items │ │ │ └── epic_item.json │ ├── dragonloot.aw │ ├── dragonloot.mixins.json │ └── fabric.mod.json │ └── java │ └── net │ └── dragonloot │ ├── access │ └── DragonAnvilInterface.java │ ├── init │ ├── NetworkInit.java │ ├── TagInit.java │ ├── ConfigInit.java │ ├── BlockInit.java │ ├── EntityInit.java │ ├── RenderInit.java │ ├── ModelProviderInit.java │ └── ItemInit.java │ ├── item │ ├── DragonBowItem.java │ ├── DragonScaleItem.java │ ├── DragonHoeItem.java │ ├── DragonAxeItem.java │ ├── DragonPickaxeItem.java │ ├── DragonShovelItem.java │ ├── DragonSwordItem.java │ ├── DragonCrossbowItem.java │ ├── render │ │ ├── DragonTridentItemRenderer.java │ │ └── DragonChestplateRenderer.java │ ├── DragonToolMaterial.java │ ├── DragonArmorMaterial.java │ ├── DragonArmor.java │ └── DragonTridentItem.java │ ├── block │ └── DragonAnvilBlock.java │ ├── config │ ├── ModMenuIntegration.java │ └── DragonLootConfig.java │ ├── DragonLootClient.java │ ├── DragonLootMain.java │ ├── compat │ └── recipes │ │ ├── RecipeMaterial.java │ │ ├── RecipeGenerator.java │ │ └── CompatRecipes.java │ ├── mixin │ ├── access │ │ └── ItemRendererAccess.java │ ├── RecipeManagerMixin.java │ ├── ItemEntityMixin.java │ ├── AnvilBlockMixin.java │ ├── LivingEntityMixin.java │ ├── PlayerEntityMixin.java │ ├── BowItemMixin.java │ ├── client │ │ ├── AbstractClientPlayerEntityMixin.java │ │ ├── ClientPlayerEntityMixin.java │ │ ├── PlayerEntityRendererMixin.java │ │ ├── HeadFeatureRendererMixin.java │ │ ├── ElytraFeatureRendererMixin.java │ │ ├── ItemRendererMixin.java │ │ └── HeldItemRendererMixin.java │ ├── CrossbowItemMixin.java │ ├── PlayerInventoryMixin.java │ ├── EnderDragonEntityMixin.java │ └── AnvilScreenHandlerMixin.java │ ├── network │ └── SyncPacket.java │ └── entity │ ├── model │ ├── DragonHelmetModel.java │ └── DragonElytraEntityModel.java │ ├── render │ └── DragonTridentEntityRenderer.java │ └── DragonTridentEntity.java ├── jitpack.yml ├── settings.gradle ├── .gitignore ├── README.md ├── gradle.properties ├── .github └── workflows │ ├── build.yml │ └── publish.yml ├── gradlew.bat └── gradlew /CHANGELOG.md: -------------------------------------------------------------------------------- 1 | ### Added: 2 | - 3 | ### Fixed: 4 | - 5 | ### Changed: 6 | - Updated to mc 1.20.1 -------------------------------------------------------------------------------- /gradle/wrapper/gradle-wrapper.jar: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/GitPois1x/DragonLoot/HEAD/gradle/wrapper/gradle-wrapper.jar -------------------------------------------------------------------------------- /src/main/resources/assets/dragonloot/models/item/dragon_anvil.json: -------------------------------------------------------------------------------- 1 | { 2 | "parent": "dragonloot:block/dragon_anvil" 3 | } -------------------------------------------------------------------------------- /jitpack.yml: -------------------------------------------------------------------------------- 1 | jdk: 2 | - openjdk17 3 | before_install: 4 | - sdk install java 17.0.3-tem 5 | - sdk use java 17.0.3-tem 6 | -------------------------------------------------------------------------------- /src/main/resources/data/c/tags/items/axes.json: -------------------------------------------------------------------------------- 1 | { 2 | "replace": false, 3 | "values": [ 4 | "dragonloot:dragon_axe" 5 | ] 6 | } -------------------------------------------------------------------------------- /src/main/resources/data/c/tags/items/hoes.json: -------------------------------------------------------------------------------- 1 | { 2 | "replace": false, 3 | "values": [ 4 | "dragonloot:dragon_hoe" 5 | ] 6 | } -------------------------------------------------------------------------------- /src/main/resources/data/c/tags/items/pickaxes.json: -------------------------------------------------------------------------------- 1 | { 2 | "replace": false, 3 | "values": [ 4 | "dragonloot:dragon_pickaxe" 5 | ] 6 | } -------------------------------------------------------------------------------- /src/main/resources/data/c/tags/items/shovels.json: -------------------------------------------------------------------------------- 1 | { 2 | "replace": false, 3 | "values": [ 4 | "dragonloot:dragon_shovel" 5 | ] 6 | } -------------------------------------------------------------------------------- /src/main/resources/data/c/tags/items/swords.json: -------------------------------------------------------------------------------- 1 | { 2 | "replace": false, 3 | "values": [ 4 | "dragonloot:dragon_sword" 5 | ] 6 | } -------------------------------------------------------------------------------- /src/main/resources/data/fabric/tags/items/axes.json: -------------------------------------------------------------------------------- 1 | { 2 | "replace": false, 3 | "values": [ 4 | "dragonloot:dragon_axe" 5 | ] 6 | } -------------------------------------------------------------------------------- /src/main/resources/data/fabric/tags/items/hoes.json: -------------------------------------------------------------------------------- 1 | { 2 | "replace": false, 3 | "values": [ 4 | "dragonloot:dragon_hoe" 5 | ] 6 | } -------------------------------------------------------------------------------- /src/main/resources/assets/dragonloot/icon.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/GitPois1x/DragonLoot/HEAD/src/main/resources/assets/dragonloot/icon.png -------------------------------------------------------------------------------- /src/main/resources/data/fabric/tags/items/pickaxes.json: -------------------------------------------------------------------------------- 1 | { 2 | "replace": false, 3 | "values": [ 4 | "dragonloot:dragon_pickaxe" 5 | ] 6 | } -------------------------------------------------------------------------------- /src/main/resources/data/fabric/tags/items/shovels.json: -------------------------------------------------------------------------------- 1 | { 2 | "replace": false, 3 | "values": [ 4 | "dragonloot:dragon_shovel" 5 | ] 6 | } -------------------------------------------------------------------------------- /src/main/resources/data/fabric/tags/items/swords.json: -------------------------------------------------------------------------------- 1 | { 2 | "replace": false, 3 | "values": [ 4 | "dragonloot:dragon_sword" 5 | ] 6 | } -------------------------------------------------------------------------------- /src/main/resources/data/silky_spawners/tags/items/allowed_tools.json: -------------------------------------------------------------------------------- 1 | { 2 | "replace": false, 3 | "values": [ 4 | "dragonloot:dragon_pickaxe" 5 | ] 6 | } -------------------------------------------------------------------------------- /src/main/resources/data/minecraft/tags/items/cluster_max_harvestables.json: -------------------------------------------------------------------------------- 1 | { 2 | "replace": false, 3 | "values": [ 4 | "dragonloot:dragon_pickaxe" 5 | ] 6 | } -------------------------------------------------------------------------------- /src/main/resources/data/stuffz/uncraft_recipes/dragon_axe.json: -------------------------------------------------------------------------------- 1 | { 2 | "item": "dragonloot:dragon_axe", 3 | "result": "dragonloot:dragon_scale", 4 | "count": 1 5 | } -------------------------------------------------------------------------------- /src/main/resources/data/stuffz/uncraft_recipes/dragon_boots.json: -------------------------------------------------------------------------------- 1 | { 2 | "item": "dragonloot:dragon_boots", 3 | "result": "dragonloot:dragon_scale", 4 | "count": 1 5 | } -------------------------------------------------------------------------------- /src/main/resources/data/stuffz/uncraft_recipes/dragon_bow.json: -------------------------------------------------------------------------------- 1 | { 2 | "item": "dragonloot:dragon_bow", 3 | "result": "dragonloot:dragon_scale", 4 | "count": 1 5 | } -------------------------------------------------------------------------------- /src/main/resources/data/stuffz/uncraft_recipes/dragon_hoe.json: -------------------------------------------------------------------------------- 1 | { 2 | "item": "dragonloot:dragon_hoe", 3 | "result": "dragonloot:dragon_scale", 4 | "count": 1 5 | } -------------------------------------------------------------------------------- /src/main/resources/data/stuffz/uncraft_recipes/dragon_sword.json: -------------------------------------------------------------------------------- 1 | { 2 | "item": "dragonloot:dragon_sword", 3 | "result": "dragonloot:dragon_scale", 4 | "count": 1 5 | } -------------------------------------------------------------------------------- /src/main/resources/assets/dragonloot/models/item/dragon_helmet.json: -------------------------------------------------------------------------------- 1 | { 2 | "parent": "item/generated", 3 | "textures": { 4 | "layer0": "dragonloot:item/dragon_helmet" 5 | } 6 | } -------------------------------------------------------------------------------- /src/main/resources/assets/dragonloot/models/item/dragon_hoe.json: -------------------------------------------------------------------------------- 1 | { 2 | "parent": "item/handheld", 3 | "textures": { 4 | "layer0": "dragonloot:item/dragon_hoe" 5 | } 6 | } -------------------------------------------------------------------------------- /src/main/resources/data/stuffz/uncraft_recipes/dragon_helmet.json: -------------------------------------------------------------------------------- 1 | { 2 | "item": "dragonloot:dragon_helmet", 3 | "result": "dragonloot:dragon_scale", 4 | "count": 1 5 | } -------------------------------------------------------------------------------- /src/main/resources/data/stuffz/uncraft_recipes/dragon_pickaxe.json: -------------------------------------------------------------------------------- 1 | { 2 | "item": "dragonloot:dragon_pickaxe", 3 | "result": "dragonloot:dragon_scale", 4 | "count": 1 5 | } -------------------------------------------------------------------------------- /src/main/resources/data/stuffz/uncraft_recipes/dragon_shovel.json: -------------------------------------------------------------------------------- 1 | { 2 | "item": "dragonloot:dragon_shovel", 3 | "result": "dragonloot:dragon_scale", 4 | "count": 1 5 | } -------------------------------------------------------------------------------- /src/main/resources/data/stuffz/uncraft_recipes/dragon_trident.json: -------------------------------------------------------------------------------- 1 | { 2 | "item": "dragonloot:dragon_trident", 3 | "result": "dragonloot:dragon_scale", 4 | "count": 1 5 | } -------------------------------------------------------------------------------- /src/main/resources/assets/dragonloot/models/item/dragon_boots.json: -------------------------------------------------------------------------------- 1 | { 2 | "parent": "item/generated", 3 | "textures": { 4 | "layer0": "dragonloot:item/dragon_boots" 5 | } 6 | } -------------------------------------------------------------------------------- /src/main/resources/assets/dragonloot/models/item/dragon_pickaxe.json: -------------------------------------------------------------------------------- 1 | { 2 | "parent": "item/handheld", 3 | "textures": { 4 | "layer0": "dragonloot:item/dragon_pickaxe" 5 | } 6 | } -------------------------------------------------------------------------------- /src/main/resources/assets/dragonloot/models/item/dragon_scale.json: -------------------------------------------------------------------------------- 1 | { 2 | "parent": "item/generated", 3 | "textures": { 4 | "layer0": "dragonloot:item/dragon_scale" 5 | } 6 | } -------------------------------------------------------------------------------- /src/main/resources/assets/dragonloot/models/item/dragon_shovel.json: -------------------------------------------------------------------------------- 1 | { 2 | "parent": "item/handheld", 3 | "textures": { 4 | "layer0": "dragonloot:item/dragon_shovel" 5 | } 6 | } -------------------------------------------------------------------------------- /src/main/resources/assets/dragonloot/textures/item/dragon_axe.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/GitPois1x/DragonLoot/HEAD/src/main/resources/assets/dragonloot/textures/item/dragon_axe.png -------------------------------------------------------------------------------- /src/main/resources/assets/dragonloot/textures/item/dragon_bow.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/GitPois1x/DragonLoot/HEAD/src/main/resources/assets/dragonloot/textures/item/dragon_bow.png -------------------------------------------------------------------------------- /src/main/resources/assets/dragonloot/textures/item/dragon_hoe.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/GitPois1x/DragonLoot/HEAD/src/main/resources/assets/dragonloot/textures/item/dragon_hoe.png -------------------------------------------------------------------------------- /src/main/resources/data/stuffz/uncraft_recipes/dragon_chestplate.json: -------------------------------------------------------------------------------- 1 | { 2 | "item": "dragonloot:dragon_chestplate", 3 | "result": "dragonloot:dragon_scale", 4 | "count": 1 5 | } -------------------------------------------------------------------------------- /src/main/resources/data/stuffz/uncraft_recipes/dragon_crossbow.json: -------------------------------------------------------------------------------- 1 | { 2 | "item": "dragonloot:dragon_crossbow", 3 | "result": "dragonloot:dragon_scale", 4 | "count": 1 5 | } -------------------------------------------------------------------------------- /src/main/resources/data/stuffz/uncraft_recipes/dragon_leggings.json: -------------------------------------------------------------------------------- 1 | { 2 | "item": "dragonloot:dragon_leggings", 3 | "result": "dragonloot:dragon_scale", 4 | "count": 1 5 | } -------------------------------------------------------------------------------- /src/main/resources/assets/dragonloot/models/item/dragon_leggings.json: -------------------------------------------------------------------------------- 1 | { 2 | "parent": "item/generated", 3 | "textures": { 4 | "layer0": "dragonloot:item/dragon_leggings" 5 | } 6 | } -------------------------------------------------------------------------------- /src/main/resources/assets/dragonloot/textures/block/dragon_anvil.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/GitPois1x/DragonLoot/HEAD/src/main/resources/assets/dragonloot/textures/block/dragon_anvil.png -------------------------------------------------------------------------------- /src/main/resources/assets/dragonloot/textures/item/dragon_boots.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/GitPois1x/DragonLoot/HEAD/src/main/resources/assets/dragonloot/textures/item/dragon_boots.png -------------------------------------------------------------------------------- /src/main/resources/assets/dragonloot/textures/item/dragon_helmet.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/GitPois1x/DragonLoot/HEAD/src/main/resources/assets/dragonloot/textures/item/dragon_helmet.png -------------------------------------------------------------------------------- /src/main/resources/assets/dragonloot/textures/item/dragon_scale.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/GitPois1x/DragonLoot/HEAD/src/main/resources/assets/dragonloot/textures/item/dragon_scale.png -------------------------------------------------------------------------------- /src/main/resources/assets/dragonloot/textures/item/dragon_shovel.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/GitPois1x/DragonLoot/HEAD/src/main/resources/assets/dragonloot/textures/item/dragon_shovel.png -------------------------------------------------------------------------------- /src/main/resources/assets/dragonloot/textures/item/dragon_sword.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/GitPois1x/DragonLoot/HEAD/src/main/resources/assets/dragonloot/textures/item/dragon_sword.png -------------------------------------------------------------------------------- /src/main/resources/data/stuffz/uncraft_recipes/dragon_horse_armor.json: -------------------------------------------------------------------------------- 1 | { 2 | "item": "dragonloot:dragon_horse_armor", 3 | "result": "dragonloot:dragon_scale", 4 | "count": 1 5 | } -------------------------------------------------------------------------------- /src/main/resources/assets/dragonloot/models/item/dragon_chestplate.json: -------------------------------------------------------------------------------- 1 | { 2 | "parent": "item/generated", 3 | "textures": { 4 | "layer0": "dragonloot:item/dragon_chestplate" 5 | } 6 | } -------------------------------------------------------------------------------- /src/main/resources/assets/dragonloot/models/item/dragon_trident.json: -------------------------------------------------------------------------------- 1 | { 2 | "parent": "item/generated", 3 | "textures": { 4 | "layer0": "dragonloot:item/dragon_trident" 5 | } 6 | } -------------------------------------------------------------------------------- /src/main/resources/assets/dragonloot/textures/entity/dragon_elytra.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/GitPois1x/DragonLoot/HEAD/src/main/resources/assets/dragonloot/textures/entity/dragon_elytra.png -------------------------------------------------------------------------------- /src/main/resources/assets/dragonloot/textures/entity/dragon_trident.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/GitPois1x/DragonLoot/HEAD/src/main/resources/assets/dragonloot/textures/entity/dragon_trident.png -------------------------------------------------------------------------------- /src/main/resources/assets/dragonloot/textures/item/dragon_leggings.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/GitPois1x/DragonLoot/HEAD/src/main/resources/assets/dragonloot/textures/item/dragon_leggings.png -------------------------------------------------------------------------------- /src/main/resources/assets/dragonloot/textures/item/dragon_pickaxe.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/GitPois1x/DragonLoot/HEAD/src/main/resources/assets/dragonloot/textures/item/dragon_pickaxe.png -------------------------------------------------------------------------------- /src/main/resources/assets/dragonloot/textures/item/dragon_trident.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/GitPois1x/DragonLoot/HEAD/src/main/resources/assets/dragonloot/textures/item/dragon_trident.png -------------------------------------------------------------------------------- /src/main/resources/data/levelz/item/armordragon.json: -------------------------------------------------------------------------------- 1 | { 2 | "replace": false, 3 | "skill": "defense", 4 | "level": 20, 5 | "item": "minecraft:armor", 6 | "material": "dragon" 7 | } -------------------------------------------------------------------------------- /src/main/resources/data/levelz/item/axedragon.json: -------------------------------------------------------------------------------- 1 | { 2 | "replace": false, 3 | "skill": "farming", 4 | "level": 20, 5 | "item": "minecraft:axe", 6 | "material": "dragon" 7 | } -------------------------------------------------------------------------------- /src/main/resources/data/levelz/item/hoedragon.json: -------------------------------------------------------------------------------- 1 | { 2 | "replace": false, 3 | "skill": "farming", 4 | "level": 20, 5 | "item": "minecraft:hoe", 6 | "material": "dragon" 7 | } -------------------------------------------------------------------------------- /src/main/resources/data/levelz/item/tooldragon.json: -------------------------------------------------------------------------------- 1 | { 2 | "replace": false, 3 | "skill": "mining", 4 | "level": 20, 5 | "item": "minecraft:tool", 6 | "material": "dragon" 7 | } -------------------------------------------------------------------------------- /src/main/resources/assets/dragonloot/textures/entity/dragon_helmet_3d.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/GitPois1x/DragonLoot/HEAD/src/main/resources/assets/dragonloot/textures/entity/dragon_helmet_3d.png -------------------------------------------------------------------------------- /src/main/resources/assets/dragonloot/textures/item/dragon_chestplate.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/GitPois1x/DragonLoot/HEAD/src/main/resources/assets/dragonloot/textures/item/dragon_chestplate.png -------------------------------------------------------------------------------- /src/main/resources/assets/dragonloot/textures/item/dragon_horse_armor.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/GitPois1x/DragonLoot/HEAD/src/main/resources/assets/dragonloot/textures/item/dragon_horse_armor.png -------------------------------------------------------------------------------- /src/main/resources/data/levelz/item/sworddragon.json: -------------------------------------------------------------------------------- 1 | { 2 | "replace": false, 3 | "skill": "strength", 4 | "level": 20, 5 | "item": "minecraft:sword", 6 | "material": "dragon" 7 | } -------------------------------------------------------------------------------- /src/main/resources/assets/dragonloot/models/item/dragon_horse_armor.json: -------------------------------------------------------------------------------- 1 | { 2 | "parent": "item/generated", 3 | "textures": { 4 | "layer0": "dragonloot:item/dragon_horse_armor" 5 | } 6 | } -------------------------------------------------------------------------------- /src/main/resources/assets/dragonloot/textures/item/dragon_bow_pulling_0.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/GitPois1x/DragonLoot/HEAD/src/main/resources/assets/dragonloot/textures/item/dragon_bow_pulling_0.png -------------------------------------------------------------------------------- /src/main/resources/assets/dragonloot/textures/item/dragon_bow_pulling_1.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/GitPois1x/DragonLoot/HEAD/src/main/resources/assets/dragonloot/textures/item/dragon_bow_pulling_1.png -------------------------------------------------------------------------------- /src/main/resources/assets/dragonloot/textures/item/dragon_bow_pulling_2.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/GitPois1x/DragonLoot/HEAD/src/main/resources/assets/dragonloot/textures/item/dragon_bow_pulling_2.png -------------------------------------------------------------------------------- /src/main/resources/assets/dragonloot/textures/item/dragon_crossbow_arrow.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/GitPois1x/DragonLoot/HEAD/src/main/resources/assets/dragonloot/textures/item/dragon_crossbow_arrow.png -------------------------------------------------------------------------------- /src/main/resources/assets/minecraft/textures/models/armor/dragon_layer_1.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/GitPois1x/DragonLoot/HEAD/src/main/resources/assets/minecraft/textures/models/armor/dragon_layer_1.png -------------------------------------------------------------------------------- /src/main/resources/assets/minecraft/textures/models/armor/dragon_layer_2.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/GitPois1x/DragonLoot/HEAD/src/main/resources/assets/minecraft/textures/models/armor/dragon_layer_2.png -------------------------------------------------------------------------------- /src/main/resources/data/stuffz/uncraft_recipes/upgraded_dragon_chestplate.json: -------------------------------------------------------------------------------- 1 | { 2 | "item": "dragonloot:upgraded_dragon_chestplate", 3 | "result": "dragonloot:dragon_scale", 4 | "count": 1 5 | } -------------------------------------------------------------------------------- /src/main/java/net/dragonloot/access/DragonAnvilInterface.java: -------------------------------------------------------------------------------- 1 | package net.dragonloot.access; 2 | 3 | public interface DragonAnvilInterface { 4 | 5 | public void setDragonAnvil(String string); 6 | 7 | } 8 | -------------------------------------------------------------------------------- /src/main/resources/assets/dragonloot/textures/item/dragon_crossbow_standby.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/GitPois1x/DragonLoot/HEAD/src/main/resources/assets/dragonloot/textures/item/dragon_crossbow_standby.png -------------------------------------------------------------------------------- /src/main/resources/assets/dragonloot/textures/item/dragon_crossbow_firework.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/GitPois1x/DragonLoot/HEAD/src/main/resources/assets/dragonloot/textures/item/dragon_crossbow_firework.png -------------------------------------------------------------------------------- /src/main/resources/assets/dragonloot/textures/item/dragon_crossbow_pulling_0.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/GitPois1x/DragonLoot/HEAD/src/main/resources/assets/dragonloot/textures/item/dragon_crossbow_pulling_0.png -------------------------------------------------------------------------------- /src/main/resources/assets/dragonloot/textures/item/dragon_crossbow_pulling_1.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/GitPois1x/DragonLoot/HEAD/src/main/resources/assets/dragonloot/textures/item/dragon_crossbow_pulling_1.png -------------------------------------------------------------------------------- /src/main/resources/assets/dragonloot/textures/item/dragon_crossbow_pulling_2.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/GitPois1x/DragonLoot/HEAD/src/main/resources/assets/dragonloot/textures/item/dragon_crossbow_pulling_2.png -------------------------------------------------------------------------------- /src/main/resources/assets/dragonloot/textures/item/upgraded_dragon_chestplate.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/GitPois1x/DragonLoot/HEAD/src/main/resources/assets/dragonloot/textures/item/upgraded_dragon_chestplate.png -------------------------------------------------------------------------------- /src/main/resources/assets/dragonloot/models/item/upgraded_dragon_chestplate.json: -------------------------------------------------------------------------------- 1 | { 2 | "parent": "item/generated", 3 | "textures": { 4 | "layer0": "dragonloot:item/upgraded_dragon_chestplate" 5 | } 6 | } -------------------------------------------------------------------------------- /src/main/resources/assets/dragonloot/models/item/dragon_bow_pulling_0.json: -------------------------------------------------------------------------------- 1 | { 2 | "parent": "dragonloot:item/dragon_bow", 3 | "textures": { 4 | "layer0": "dragonloot:item/dragon_bow_pulling_0" 5 | } 6 | } 7 | -------------------------------------------------------------------------------- /src/main/resources/assets/dragonloot/models/item/dragon_bow_pulling_1.json: -------------------------------------------------------------------------------- 1 | { 2 | "parent": "dragonloot:item/dragon_bow", 3 | "textures": { 4 | "layer0": "dragonloot:item/dragon_bow_pulling_1" 5 | } 6 | } 7 | -------------------------------------------------------------------------------- /src/main/resources/assets/dragonloot/models/item/dragon_bow_pulling_2.json: -------------------------------------------------------------------------------- 1 | { 2 | "parent": "dragonloot:item/dragon_bow", 3 | "textures": { 4 | "layer0": "dragonloot:item/dragon_bow_pulling_2" 5 | } 6 | } 7 | -------------------------------------------------------------------------------- /src/main/resources/assets/minecraft/textures/entity/horse/armor/horse_armor_dragon.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/GitPois1x/DragonLoot/HEAD/src/main/resources/assets/minecraft/textures/entity/horse/armor/horse_armor_dragon.png -------------------------------------------------------------------------------- /src/main/resources/assets/dragonloot/models/item/dragon_crossbow_arrow.json: -------------------------------------------------------------------------------- 1 | { 2 | "parent": "dragonloot:item/dragon_crossbow", 3 | "textures": { 4 | "layer0": "dragonloot:item/dragon_crossbow_arrow" 5 | } 6 | } 7 | -------------------------------------------------------------------------------- /src/main/resources/assets/dragonloot/models/item/dragon_crossbow_firework.json: -------------------------------------------------------------------------------- 1 | { 2 | "parent": "dragonloot:item/dragon_crossbow", 3 | "textures": { 4 | "layer0": "dragonloot:item/dragon_crossbow_firework" 5 | } 6 | } 7 | -------------------------------------------------------------------------------- /src/main/resources/assets/dragonloot/models/item/dragon_crossbow_pulling_0.json: -------------------------------------------------------------------------------- 1 | { 2 | "parent": "dragonloot:item/dragon_crossbow", 3 | "textures": { 4 | "layer0": "dragonloot:item/dragon_crossbow_pulling_0" 5 | } 6 | } 7 | -------------------------------------------------------------------------------- /src/main/resources/assets/dragonloot/models/item/dragon_crossbow_pulling_1.json: -------------------------------------------------------------------------------- 1 | { 2 | "parent": "dragonloot:item/dragon_crossbow", 3 | "textures": { 4 | "layer0": "dragonloot:item/dragon_crossbow_pulling_1" 5 | } 6 | } 7 | -------------------------------------------------------------------------------- /src/main/resources/assets/dragonloot/models/item/dragon_crossbow_pulling_2.json: -------------------------------------------------------------------------------- 1 | { 2 | "parent": "dragonloot:item/dragon_crossbow", 3 | "textures": { 4 | "layer0": "dragonloot:item/dragon_crossbow_pulling_2" 5 | } 6 | } 7 | -------------------------------------------------------------------------------- /src/main/resources/data/minecraft/tags/blocks/anvil.json: -------------------------------------------------------------------------------- 1 | { 2 | "replace": false, 3 | "values": [ 4 | "minecraft:anvil", 5 | "minecraft:chipped_anvil", 6 | "minecraft:damaged_anvil", 7 | "dragonloot:dragon_anvil" 8 | ] 9 | } -------------------------------------------------------------------------------- /gradle/wrapper/gradle-wrapper.properties: -------------------------------------------------------------------------------- 1 | distributionBase=GRADLE_USER_HOME 2 | distributionPath=wrapper/dists 3 | distributionUrl=https\://services.gradle.org/distributions/gradle-8.1.1-bin.zip 4 | zipStoreBase=GRADLE_USER_HOME 5 | zipStorePath=wrapper/dists 6 | -------------------------------------------------------------------------------- /settings.gradle: -------------------------------------------------------------------------------- 1 | pluginManagement { 2 | repositories { 3 | maven { 4 | name = 'Fabric' 5 | url = 'https://maven.fabricmc.net/' 6 | } 7 | mavenCentral() 8 | gradlePluginPortal() 9 | } 10 | } -------------------------------------------------------------------------------- /src/main/java/net/dragonloot/init/NetworkInit.java: -------------------------------------------------------------------------------- 1 | package net.dragonloot.init; 2 | 3 | import net.dragonloot.network.SyncPacket; 4 | 5 | public class NetworkInit { 6 | 7 | public static void init() { 8 | SyncPacket.init(); 9 | } 10 | 11 | } 12 | -------------------------------------------------------------------------------- /src/main/java/net/dragonloot/item/DragonBowItem.java: -------------------------------------------------------------------------------- 1 | package net.dragonloot.item; 2 | 3 | import net.minecraft.item.BowItem; 4 | 5 | public class DragonBowItem extends BowItem { 6 | 7 | public DragonBowItem(Settings settings) { 8 | super(settings); 9 | } 10 | 11 | } 12 | -------------------------------------------------------------------------------- /src/main/java/net/dragonloot/item/DragonScaleItem.java: -------------------------------------------------------------------------------- 1 | package net.dragonloot.item; 2 | 3 | import net.minecraft.item.Item; 4 | 5 | public class DragonScaleItem extends Item { 6 | 7 | public DragonScaleItem(Settings settings) { 8 | super(settings); 9 | } 10 | 11 | } 12 | -------------------------------------------------------------------------------- /src/main/java/net/dragonloot/block/DragonAnvilBlock.java: -------------------------------------------------------------------------------- 1 | package net.dragonloot.block; 2 | 3 | import net.minecraft.block.AnvilBlock; 4 | 5 | public class DragonAnvilBlock extends AnvilBlock { 6 | 7 | public DragonAnvilBlock(Settings settings) { 8 | super(settings); 9 | } 10 | 11 | } 12 | -------------------------------------------------------------------------------- /src/main/resources/data/dragonloot/loot_tables/blocks/dragon_anvil.json: -------------------------------------------------------------------------------- 1 | { 2 | "type": "minecraft:block", 3 | "pools": [ 4 | { 5 | "rolls": 1, 6 | "entries": [ 7 | { 8 | "type": "minecraft:item", 9 | "name": "dragonloot:dragon_anvil" 10 | } 11 | ] 12 | } 13 | ] 14 | } -------------------------------------------------------------------------------- /.gitignore: -------------------------------------------------------------------------------- 1 | # gradle 2 | 3 | .gradle/ 4 | build/ 5 | out/ 6 | classes/ 7 | 8 | # eclipse 9 | 10 | *.launch 11 | 12 | # idea 13 | 14 | .idea/ 15 | *.iml 16 | *.ipr 17 | *.iws 18 | 19 | # vscode 20 | 21 | .settings/ 22 | .vscode/ 23 | bin/ 24 | .classpath 25 | .project 26 | 27 | # macos 28 | 29 | *.DS_Store 30 | 31 | # fabric 32 | 33 | run/ 34 | -------------------------------------------------------------------------------- /src/main/resources/data/dragonloot/recipes/dragon_anvil.json: -------------------------------------------------------------------------------- 1 | { 2 | "type": "minecraft:smithing_transform", 3 | "base": { 4 | "item": "minecraft:anvil" 5 | }, 6 | "addition": { 7 | "item": "dragonloot:dragon_scale" 8 | }, 9 | "result": { 10 | "item": "dragonloot:dragon_anvil" 11 | }, 12 | "template": { 13 | "item": "minecraft:netherite_upgrade_smithing_template" 14 | } 15 | } -------------------------------------------------------------------------------- /src/main/resources/data/dragonloot/recipes/dragon_axe.json: -------------------------------------------------------------------------------- 1 | { 2 | "type": "minecraft:smithing_transform", 3 | "base": { 4 | "item": "minecraft:netherite_axe" 5 | }, 6 | "addition": { 7 | "item": "dragonloot:dragon_scale" 8 | }, 9 | "result": { 10 | "item": "dragonloot:dragon_axe" 11 | }, 12 | "template": { 13 | "item": "minecraft:netherite_upgrade_smithing_template" 14 | } 15 | } -------------------------------------------------------------------------------- /src/main/resources/data/dragonloot/recipes/dragon_hoe.json: -------------------------------------------------------------------------------- 1 | { 2 | "type": "minecraft:smithing_transform", 3 | "base": { 4 | "item": "minecraft:netherite_hoe" 5 | }, 6 | "addition": { 7 | "item": "dragonloot:dragon_scale" 8 | }, 9 | "result": { 10 | "item": "dragonloot:dragon_hoe" 11 | }, 12 | "template": { 13 | "item": "minecraft:netherite_upgrade_smithing_template" 14 | } 15 | } -------------------------------------------------------------------------------- /src/main/resources/data/dragonloot/recipes/dragon_boots.json: -------------------------------------------------------------------------------- 1 | { 2 | "type": "minecraft:smithing_transform", 3 | "base": { 4 | "item": "minecraft:netherite_boots" 5 | }, 6 | "addition": { 7 | "item": "dragonloot:dragon_scale" 8 | }, 9 | "result": { 10 | "item": "dragonloot:dragon_boots" 11 | }, 12 | "template": { 13 | "item": "minecraft:netherite_upgrade_smithing_template" 14 | } 15 | } -------------------------------------------------------------------------------- /src/main/resources/data/dragonloot/recipes/dragon_helmet.json: -------------------------------------------------------------------------------- 1 | { 2 | "type": "minecraft:smithing_transform", 3 | "base": { 4 | "item": "minecraft:netherite_helmet" 5 | }, 6 | "addition": { 7 | "item": "dragonloot:dragon_scale" 8 | }, 9 | "result": { 10 | "item": "dragonloot:dragon_helmet" 11 | }, 12 | "template": { 13 | "item": "minecraft:netherite_upgrade_smithing_template" 14 | } 15 | } -------------------------------------------------------------------------------- /src/main/resources/data/dragonloot/recipes/dragon_shovel.json: -------------------------------------------------------------------------------- 1 | { 2 | "type": "minecraft:smithing_transform", 3 | "base": { 4 | "item": "minecraft:netherite_shovel" 5 | }, 6 | "addition": { 7 | "item": "dragonloot:dragon_scale" 8 | }, 9 | "result": { 10 | "item": "dragonloot:dragon_shovel" 11 | }, 12 | "template": { 13 | "item": "minecraft:netherite_upgrade_smithing_template" 14 | } 15 | } -------------------------------------------------------------------------------- /src/main/resources/data/dragonloot/recipes/dragon_sword.json: -------------------------------------------------------------------------------- 1 | { 2 | "type": "minecraft:smithing_transform", 3 | "base": { 4 | "item": "minecraft:netherite_sword" 5 | }, 6 | "addition": { 7 | "item": "dragonloot:dragon_scale" 8 | }, 9 | "result": { 10 | "item": "dragonloot:dragon_sword" 11 | }, 12 | "template": { 13 | "item": "minecraft:netherite_upgrade_smithing_template" 14 | } 15 | } -------------------------------------------------------------------------------- /src/main/resources/data/dragonloot/recipes/dragon_leggings.json: -------------------------------------------------------------------------------- 1 | { 2 | "type": "minecraft:smithing_transform", 3 | "base": { 4 | "item": "minecraft:netherite_leggings" 5 | }, 6 | "addition": { 7 | "item": "dragonloot:dragon_scale" 8 | }, 9 | "result": { 10 | "item": "dragonloot:dragon_leggings" 11 | }, 12 | "template": { 13 | "item": "minecraft:netherite_upgrade_smithing_template" 14 | } 15 | } -------------------------------------------------------------------------------- /src/main/resources/data/dragonloot/recipes/dragon_pickaxe.json: -------------------------------------------------------------------------------- 1 | { 2 | "type": "minecraft:smithing_transform", 3 | "base": { 4 | "item": "minecraft:netherite_pickaxe" 5 | }, 6 | "addition": { 7 | "item": "dragonloot:dragon_scale" 8 | }, 9 | "result": { 10 | "item": "dragonloot:dragon_pickaxe" 11 | }, 12 | "template": { 13 | "item": "minecraft:netherite_upgrade_smithing_template" 14 | } 15 | } -------------------------------------------------------------------------------- /src/main/java/net/dragonloot/item/DragonHoeItem.java: -------------------------------------------------------------------------------- 1 | package net.dragonloot.item; 2 | 3 | import net.minecraft.item.HoeItem; 4 | import net.minecraft.item.ToolMaterial; 5 | 6 | public class DragonHoeItem extends HoeItem { 7 | 8 | public DragonHoeItem(ToolMaterial material, int attackDamage, float attackSpeed, Settings settings) { 9 | super(material, attackDamage, attackSpeed, settings); 10 | } 11 | 12 | } 13 | -------------------------------------------------------------------------------- /src/main/java/net/dragonloot/item/DragonAxeItem.java: -------------------------------------------------------------------------------- 1 | package net.dragonloot.item; 2 | 3 | import net.minecraft.item.AxeItem; 4 | import net.minecraft.item.ToolMaterial; 5 | 6 | public class DragonAxeItem extends AxeItem { 7 | 8 | public DragonAxeItem(ToolMaterial material, float attackDamage, float attackSpeed, Settings settings) { 9 | super(material, attackDamage, attackSpeed, settings); 10 | } 11 | 12 | } 13 | -------------------------------------------------------------------------------- /src/main/resources/data/dragonloot/recipes/dragon_chestplate.json: -------------------------------------------------------------------------------- 1 | { 2 | "type": "minecraft:smithing_transform", 3 | "base": { 4 | "item": "minecraft:netherite_chestplate" 5 | }, 6 | "addition": { 7 | "item": "dragonloot:dragon_scale" 8 | }, 9 | "result": { 10 | "item": "dragonloot:dragon_chestplate" 11 | }, 12 | "template": { 13 | "item": "minecraft:netherite_upgrade_smithing_template" 14 | } 15 | } -------------------------------------------------------------------------------- /src/main/java/net/dragonloot/item/DragonPickaxeItem.java: -------------------------------------------------------------------------------- 1 | package net.dragonloot.item; 2 | 3 | import net.minecraft.item.PickaxeItem; 4 | import net.minecraft.item.ToolMaterial; 5 | 6 | public class DragonPickaxeItem extends PickaxeItem { 7 | 8 | public DragonPickaxeItem(ToolMaterial material, int attackDamage, float attackSpeed, Settings settings) { 9 | super(material, attackDamage, attackSpeed, settings); 10 | } 11 | 12 | } 13 | -------------------------------------------------------------------------------- /src/main/java/net/dragonloot/item/DragonShovelItem.java: -------------------------------------------------------------------------------- 1 | package net.dragonloot.item; 2 | 3 | import net.minecraft.item.ShovelItem; 4 | import net.minecraft.item.ToolMaterial; 5 | 6 | public class DragonShovelItem extends ShovelItem { 7 | 8 | public DragonShovelItem(ToolMaterial material, float attackDamage, float attackSpeed, Settings settings) { 9 | super(material, attackDamage, attackSpeed, settings); 10 | } 11 | 12 | } 13 | -------------------------------------------------------------------------------- /src/main/java/net/dragonloot/item/DragonSwordItem.java: -------------------------------------------------------------------------------- 1 | package net.dragonloot.item; 2 | 3 | import net.minecraft.item.SwordItem; 4 | import net.minecraft.item.ToolMaterial; 5 | 6 | public class DragonSwordItem extends SwordItem { 7 | 8 | public DragonSwordItem(ToolMaterial toolMaterial, int attackDamage, float attackSpeed, Settings settings) { 9 | super(toolMaterial, attackDamage, attackSpeed, settings); 10 | } 11 | 12 | } 13 | -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 | # DragonLoot 2 | DragonLoot adds basically dragon upgraded items to Minecraft. 3 | 4 | ### Installation 5 | DragonLoot is a mod built for the [Fabric Loader](https://fabricmc.net/). It requires [Fabric API](https://www.curseforge.com/minecraft/mc-mods/fabric-api) and [Cloth Config API](https://www.curseforge.com/minecraft/mc-mods/cloth-config) to be installed separately; all other dependencies are installed with the mod. 6 | 7 | ### License 8 | DragonLoot is licensed under GLPv3. 9 | -------------------------------------------------------------------------------- /src/main/java/net/dragonloot/init/TagInit.java: -------------------------------------------------------------------------------- 1 | package net.dragonloot.init; 2 | 3 | import net.minecraft.item.Item; 4 | import net.minecraft.registry.RegistryKeys; 5 | import net.minecraft.registry.tag.TagKey; 6 | import net.minecraft.util.Identifier; 7 | 8 | public class TagInit { 9 | public static final TagKey NOT_DESTROYED_BY_EXPLOSION = TagKey.of(RegistryKeys.ITEM, new Identifier("dragonloot", "explosion_resistant")); 10 | 11 | public static void init() { 12 | 13 | } 14 | 15 | } 16 | -------------------------------------------------------------------------------- /src/main/resources/assets/dragonloot/blockstates/dragon_anvil.json: -------------------------------------------------------------------------------- 1 | { 2 | "variants": { 3 | "facing=east": { 4 | "model": "dragonloot:block/dragon_anvil", 5 | "y": 270 6 | }, 7 | "facing=north": { 8 | "model": "dragonloot:block/dragon_anvil", 9 | "y": 180 10 | }, 11 | "facing=south": { 12 | "model": "dragonloot:block/dragon_anvil" 13 | }, 14 | "facing=west": { 15 | "model": "dragonloot:block/dragon_anvil", 16 | "y": 90 17 | } 18 | } 19 | } -------------------------------------------------------------------------------- /src/main/java/net/dragonloot/item/DragonCrossbowItem.java: -------------------------------------------------------------------------------- 1 | package net.dragonloot.item; 2 | 3 | import net.dragonloot.init.ItemInit; 4 | import net.minecraft.item.CrossbowItem; 5 | import net.minecraft.item.ItemStack; 6 | 7 | public class DragonCrossbowItem extends CrossbowItem { 8 | 9 | public DragonCrossbowItem(Settings settings) { 10 | super(settings); 11 | } 12 | 13 | @Override 14 | public boolean isUsedOnRelease(ItemStack stack) { 15 | return stack.getItem() == ItemInit.DRAGON_CROSSBOW_ITEM; 16 | } 17 | } 18 | -------------------------------------------------------------------------------- /src/main/java/net/dragonloot/init/ConfigInit.java: -------------------------------------------------------------------------------- 1 | package net.dragonloot.init; 2 | 3 | import me.shedaniel.autoconfig.AutoConfig; 4 | import me.shedaniel.autoconfig.serializer.JanksonConfigSerializer; 5 | import net.dragonloot.config.DragonLootConfig; 6 | 7 | public class ConfigInit { 8 | public static DragonLootConfig CONFIG = new DragonLootConfig(); 9 | 10 | public static void init() { 11 | AutoConfig.register(DragonLootConfig.class, JanksonConfigSerializer::new); 12 | CONFIG = AutoConfig.getConfigHolder(DragonLootConfig.class).getConfig(); 13 | } 14 | 15 | } -------------------------------------------------------------------------------- /src/main/java/net/dragonloot/config/ModMenuIntegration.java: -------------------------------------------------------------------------------- 1 | package net.dragonloot.config; 2 | 3 | import com.terraformersmc.modmenu.api.ConfigScreenFactory; 4 | import com.terraformersmc.modmenu.api.ModMenuApi; 5 | import me.shedaniel.autoconfig.AutoConfig; 6 | import net.fabricmc.api.EnvType; 7 | import net.fabricmc.api.Environment; 8 | 9 | @Environment(EnvType.CLIENT) 10 | public class ModMenuIntegration implements ModMenuApi { 11 | 12 | @Override 13 | public ConfigScreenFactory getModConfigScreenFactory() { 14 | return parent -> AutoConfig.getConfigScreen(DragonLootConfig.class, parent).get(); 15 | } 16 | } -------------------------------------------------------------------------------- /gradle.properties: -------------------------------------------------------------------------------- 1 | # Done to increase the memory available to gradle. 2 | org.gradle.jvmargs=-Xmx1G 3 | 4 | # Fabric Properties 5 | # check these on https://fabricmc.net/use 6 | minecraft_version=1.20.1 7 | yarn_mappings=1.20.1+build.10 8 | loader_version=0.14.21 9 | 10 | # Mod Properties 11 | mod_version = 1.1.4 12 | maven_group = net.dragonloot 13 | archives_base_name = dragonloot 14 | 15 | # Dependencies 16 | # currently not on the main fabric site, check on the maven: https://maven.fabricmc.net/net/fabricmc/fabric-api/fabric-api 17 | fabric_version=0.86.0+1.20.1 18 | cloth_config_version=11.0.99 19 | mod_menu_version=7.0.0 20 | -------------------------------------------------------------------------------- /src/main/java/net/dragonloot/DragonLootClient.java: -------------------------------------------------------------------------------- 1 | package net.dragonloot; 2 | 3 | import net.dragonloot.init.ModelProviderInit; 4 | import net.dragonloot.init.NetworkInit; 5 | import net.dragonloot.init.RenderInit; 6 | import net.fabricmc.api.ClientModInitializer; 7 | import net.fabricmc.api.EnvType; 8 | import net.fabricmc.api.Environment; 9 | 10 | @Environment(EnvType.CLIENT) 11 | public class DragonLootClient implements ClientModInitializer { 12 | 13 | @Override 14 | public void onInitializeClient() { 15 | RenderInit.init(); 16 | ModelProviderInit.init(); 17 | NetworkInit.init(); 18 | } 19 | 20 | } 21 | -------------------------------------------------------------------------------- /src/main/java/net/dragonloot/DragonLootMain.java: -------------------------------------------------------------------------------- 1 | package net.dragonloot; 2 | 3 | import net.dragonloot.init.*; 4 | import net.fabricmc.api.ModInitializer; 5 | import net.minecraft.util.Identifier; 6 | 7 | public class DragonLootMain implements ModInitializer { 8 | 9 | public static Identifier ID(String path) { 10 | return new Identifier(MOD_ID, path); 11 | } 12 | 13 | private static final String MOD_ID = "dragonloot"; 14 | 15 | @Override 16 | public void onInitialize() { 17 | ConfigInit.init(); 18 | BlockInit.init(); 19 | EntityInit.init(); 20 | ItemInit.init(); 21 | TagInit.init(); 22 | } 23 | 24 | } 25 | -------------------------------------------------------------------------------- /src/main/resources/dragonloot.aw: -------------------------------------------------------------------------------- 1 | accessWidener v1 named 2 | 3 | accessible method net/minecraft/screen/AnvilScreenHandler onTakeOutput (Lnet/minecraft/entity/player/PlayerEntity;Lnet/minecraft/item/ItemStack;)V 4 | accessible method net/minecraft/screen/AnvilScreenHandler canUse (Lnet/minecraft/block/BlockState;)Z 5 | 6 | accessible field net/minecraft/entity/projectile/TridentEntity tridentStack Lnet/minecraft/item/ItemStack; 7 | accessible field net/minecraft/item/TridentItem attributeModifiers Lcom/google/common/collect/Multimap; 8 | mutable field net/minecraft/entity/attribute/EntityAttributeModifier value D 9 | accessible field net/minecraft/entity/attribute/EntityAttributeModifier value D -------------------------------------------------------------------------------- /src/main/resources/data/tooltiprareness/tags/items/epic_item.json: -------------------------------------------------------------------------------- 1 | { 2 | "replace": false, 3 | "values": [ 4 | "dragonloot:dragon_scale", 5 | "dragonloot:dragon_horse_armor", 6 | "dragonloot:dragon_helmet", 7 | "dragonloot:dragon_chestplate", 8 | "dragonloot:dragon_leggings", 9 | "dragonloot:dragon_boots", 10 | "dragonloot:upgraded_dragon_chestplate", 11 | "dragonloot:dragon_pickaxe", 12 | "dragonloot:dragon_shovel", 13 | "dragonloot:dragon_axe", 14 | "dragonloot:dragon_hoe", 15 | "dragonloot:dragon_sword", 16 | "dragonloot:dragon_bow", 17 | "dragonloot:dragon_crossbow", 18 | "dragonloot:dragon_trident" 19 | ] 20 | } -------------------------------------------------------------------------------- /src/main/resources/data/dragonloot/tags/items/explosion_resistant.json: -------------------------------------------------------------------------------- 1 | { 2 | "replace": false, 3 | "values": [ 4 | "dragonloot:dragon_scale", 5 | "dragonloot:dragon_helmet", 6 | "dragonloot:dragon_chestplate", 7 | "dragonloot:dragon_leggings", 8 | "dragonloot:dragon_boots", 9 | "dragonloot:upgraded_dragon_chestplate", 10 | "dragonloot:dragon_pickaxe", 11 | "dragonloot:dragon_shovel", 12 | "dragonloot:dragon_axe", 13 | "dragonloot:dragon_hoe", 14 | "dragonloot:dragon_sword", 15 | "dragonloot:dragon_bow", 16 | "dragonloot:dragon_crossbow", 17 | "dragonloot:dragon_trident", 18 | "dragonloot:dragon_anvil", 19 | "dragonloot:dragon_horse_armor" 20 | ] 21 | } -------------------------------------------------------------------------------- /src/main/java/net/dragonloot/compat/recipes/RecipeMaterial.java: -------------------------------------------------------------------------------- 1 | package net.dragonloot.compat.recipes; 2 | 3 | import net.minecraft.util.Identifier; 4 | 5 | public class RecipeMaterial { 6 | 7 | public Identifier baseItem; 8 | public Identifier additionItem; 9 | public String baseType; 10 | public String additionType; 11 | public Identifier output; 12 | public Identifier template; 13 | 14 | public RecipeMaterial(Identifier baseItem, Identifier additionItem, String baseType, String additionType, Identifier output, Identifier template) { 15 | this.baseItem = baseItem; 16 | this.additionItem = additionItem; 17 | this.baseType = baseType; 18 | this.additionType = additionType; 19 | this.output = output; 20 | this.template = template; 21 | } 22 | 23 | } 24 | -------------------------------------------------------------------------------- /src/main/resources/dragonloot.mixins.json: -------------------------------------------------------------------------------- 1 | { 2 | "required": true, 3 | "minVersion": "0.8", 4 | "package": "net.dragonloot.mixin", 5 | "compatibilityLevel": "JAVA_17", 6 | "mixins": [ 7 | "AnvilBlockMixin", 8 | "AnvilScreenHandlerMixin", 9 | "BowItemMixin", 10 | "CrossbowItemMixin", 11 | "EnderDragonEntityMixin", 12 | "ItemEntityMixin", 13 | "LivingEntityMixin", 14 | "PlayerEntityMixin", 15 | "PlayerInventoryMixin", 16 | "RecipeManagerMixin" 17 | ], 18 | "client": [ 19 | "client.ClientPlayerEntityMixin", 20 | "client.ElytraFeatureRendererMixin", 21 | "client.HeadFeatureRendererMixin", 22 | "client.PlayerEntityRendererMixin", 23 | "client.AbstractClientPlayerEntityMixin", 24 | "client.ItemRendererMixin", 25 | "client.HeldItemRendererMixin", 26 | "access.ItemRendererAccess" 27 | ], 28 | "injectors": { 29 | "defaultRequire": 1 30 | } 31 | } -------------------------------------------------------------------------------- /src/main/java/net/dragonloot/init/BlockInit.java: -------------------------------------------------------------------------------- 1 | package net.dragonloot.init; 2 | 3 | import net.dragonloot.block.*; 4 | import net.fabricmc.fabric.api.object.builder.v1.block.FabricBlockSettings; 5 | import net.minecraft.block.Blocks; 6 | import net.minecraft.item.BlockItem; 7 | import net.minecraft.item.Item; 8 | import net.minecraft.registry.Registries; 9 | import net.minecraft.registry.Registry; 10 | import net.minecraft.util.Identifier; 11 | 12 | public class BlockInit { 13 | 14 | public static final DragonAnvilBlock DRAGON_ANVIL_BLOCK = new DragonAnvilBlock(FabricBlockSettings.copy(Blocks.ANVIL)); 15 | 16 | public static void init() { 17 | Registry.register(Registries.ITEM, new Identifier("dragonloot", "dragon_anvil"), new BlockItem(DRAGON_ANVIL_BLOCK, new Item.Settings())); 18 | Registry.register(Registries.BLOCK, new Identifier("dragonloot", "dragon_anvil"), DRAGON_ANVIL_BLOCK); 19 | } 20 | 21 | } 22 | -------------------------------------------------------------------------------- /src/main/java/net/dragonloot/init/EntityInit.java: -------------------------------------------------------------------------------- 1 | package net.dragonloot.init; 2 | 3 | import net.dragonloot.entity.DragonTridentEntity; 4 | import net.fabricmc.fabric.api.object.builder.v1.entity.FabricEntityTypeBuilder; 5 | import net.minecraft.entity.EntityDimensions; 6 | import net.minecraft.entity.EntityType; 7 | import net.minecraft.entity.SpawnGroup; 8 | import net.minecraft.registry.Registries; 9 | import net.minecraft.registry.Registry; 10 | import net.minecraft.util.Identifier; 11 | 12 | public class EntityInit { 13 | 14 | public static final EntityType DRAGONTRIDENT_ENTITY = FabricEntityTypeBuilder.create(SpawnGroup.MISC, DragonTridentEntity::new).dimensions(EntityDimensions.fixed(0.5F, 0.5F)).build(); 15 | 16 | public static void init() { 17 | Registry.register(Registries.ENTITY_TYPE, new Identifier("dragonloot", "dragon_trident"), DRAGONTRIDENT_ENTITY); 18 | } 19 | 20 | } 21 | -------------------------------------------------------------------------------- /src/main/java/net/dragonloot/init/RenderInit.java: -------------------------------------------------------------------------------- 1 | package net.dragonloot.init; 2 | 3 | import net.dragonloot.entity.model.DragonElytraEntityModel; 4 | import net.dragonloot.entity.render.DragonTridentEntityRenderer; 5 | import net.fabricmc.fabric.api.client.rendering.v1.EntityModelLayerRegistry; 6 | import net.fabricmc.fabric.api.client.rendering.v1.EntityRendererRegistry; 7 | import net.minecraft.client.render.entity.model.EntityModelLayer; 8 | import net.minecraft.util.Identifier; 9 | 10 | public class RenderInit { 11 | public static final EntityModelLayer DRAGON_ELYTRA_LAYER = new EntityModelLayer(new Identifier("dragonloot:dragon_elytra_render_layer"), "dragon_elytra_render_layer"); 12 | 13 | public static void init() { 14 | EntityRendererRegistry.register(EntityInit.DRAGONTRIDENT_ENTITY, DragonTridentEntityRenderer::new); 15 | EntityModelLayerRegistry.registerModelLayer(DRAGON_ELYTRA_LAYER, DragonElytraEntityModel::getTexturedModelData); 16 | } 17 | } -------------------------------------------------------------------------------- /src/main/java/net/dragonloot/mixin/access/ItemRendererAccess.java: -------------------------------------------------------------------------------- 1 | package net.dragonloot.mixin.access; 2 | 3 | import org.spongepowered.asm.mixin.Mixin; 4 | import org.spongepowered.asm.mixin.gen.Invoker; 5 | 6 | import net.fabricmc.api.EnvType; 7 | import net.fabricmc.api.Environment; 8 | import net.minecraft.client.render.VertexConsumer; 9 | import net.minecraft.client.render.item.ItemModels; 10 | import net.minecraft.client.render.item.ItemRenderer; 11 | import net.minecraft.client.render.model.BakedModel; 12 | import net.minecraft.client.util.math.MatrixStack; 13 | import net.minecraft.item.ItemStack; 14 | 15 | @Environment(EnvType.CLIENT) 16 | @Mixin(ItemRenderer.class) 17 | public interface ItemRendererAccess { 18 | @Invoker("getModels") 19 | ItemModels getModelsInvoker(); 20 | 21 | @Invoker("renderBakedItemModel") 22 | void renderBakedItemModelInvoker(BakedModel model, ItemStack stack, int light, int overlay, MatrixStack matrices, VertexConsumer vertexConsumer4); 23 | } -------------------------------------------------------------------------------- /src/main/resources/data/dragonloot/advancements/dragon_recipes.json: -------------------------------------------------------------------------------- 1 | { 2 | "parent": "minecraft:recipes/root", 3 | "rewards": { 4 | "recipes": [ 5 | "dragonloot:dragon_anvil", 6 | "dragonloot:dragon_axe", 7 | "dragonloot:dragon_boots", 8 | "dragonloot:dragon_chestplate", 9 | "dragonloot:dragon_helmet", 10 | "dragonloot:dragon_hoe", 11 | "dragonloot:dragon_leggings", 12 | "dragonloot:dragon_pickaxe", 13 | "dragonloot:dragon_shovel", 14 | "dragonloot:dragon_sword" 15 | ] 16 | }, 17 | "criteria": { 18 | "dragon_recipes": { 19 | "trigger": "minecraft:inventory_changed", 20 | "conditions": { 21 | "items": [ 22 | { 23 | "items": [ 24 | "dragonloot:dragon_scale" 25 | ] 26 | } 27 | ] 28 | } 29 | } 30 | } 31 | } -------------------------------------------------------------------------------- /src/main/resources/assets/dragonloot/models/item/dragon_sword_parry.json: -------------------------------------------------------------------------------- 1 | { 2 | "credit": "Made with Blockbench, by Pois1x", 3 | "parent": "item/handheld", 4 | "textures": { 5 | "layer0": "dragonloot:item/dragon_sword" 6 | }, 7 | "display": { 8 | "thirdperson_righthand": { 9 | "rotation": [39, -25, 90], 10 | "translation": [-4.35, 3.3, 2.75], 11 | "scale": [1.7, 1.7, 0.85] 12 | }, 13 | "thirdperson_lefthand": { 14 | "rotation": [39, -25, 0], 15 | "translation": [-4.35, 3.3, 2.75], 16 | "scale": [1.7, 1.7, 0.85] 17 | }, 18 | "firstperson_righthand": { 19 | "rotation": [171, 13, 165], 20 | "translation": [-2.8, -0.5, -5.5], 21 | "scale": [2, 2, 1] 22 | }, 23 | "firstperson_lefthand": { 24 | "rotation": [171, 13, 75], 25 | "translation": [-2.8, -0.5, -5.5], 26 | "scale": [2, 2, 1] 27 | }, 28 | "ground": { 29 | "translation": [0, 4.25, 0], 30 | "scale": [1, 1, 0.5] 31 | }, 32 | "gui": { 33 | "scale": [1.22, 1.22, 1] 34 | }, 35 | "fixed": { 36 | "rotation": [0, 0, 95] 37 | } 38 | } 39 | } -------------------------------------------------------------------------------- /src/main/java/net/dragonloot/mixin/RecipeManagerMixin.java: -------------------------------------------------------------------------------- 1 | package net.dragonloot.mixin; 2 | 3 | import com.google.gson.JsonElement; 4 | 5 | import net.dragonloot.compat.recipes.RecipeGenerator; 6 | import net.minecraft.recipe.RecipeManager; 7 | import net.minecraft.resource.ResourceManager; 8 | import net.minecraft.util.Identifier; 9 | import net.minecraft.util.profiler.Profiler; 10 | import org.spongepowered.asm.mixin.Mixin; 11 | import org.spongepowered.asm.mixin.injection.At; 12 | import org.spongepowered.asm.mixin.injection.Inject; 13 | import org.spongepowered.asm.mixin.injection.callback.CallbackInfo; 14 | 15 | import java.util.Map; 16 | 17 | @Mixin(RecipeManager.class) 18 | public class RecipeManagerMixin { 19 | 20 | @Inject(method = "apply", at = @At("HEAD")) 21 | private void applyMixin(Map map, ResourceManager resourceManager, Profiler profiler, CallbackInfo info) { 22 | for (Identifier id : RecipeGenerator.RECIPES.keySet()) { 23 | map.put(id, RecipeGenerator.RECIPES.get(id)); 24 | } 25 | } 26 | 27 | } -------------------------------------------------------------------------------- /src/main/resources/assets/dragonloot/models/item/dragon_axe.json: -------------------------------------------------------------------------------- 1 | { 2 | "credit": "Made with Blockbench, by Pois1x", 3 | "parent": "item/handheld", 4 | "textures": { 5 | "layer0": "dragonloot:item/dragon_axe" 6 | }, 7 | "display": { 8 | "thirdperson_righthand": { 9 | "rotation": [16, -90, 61], 10 | "translation": [0, 5, 1], 11 | "scale": [1.7, 1.7, 0.85] 12 | }, 13 | "thirdperson_lefthand": { 14 | "rotation": [16, 90, -61], 15 | "translation": [0, 5, 1], 16 | "scale": [1.7, 1.7, 0.85] 17 | }, 18 | "firstperson_righthand": { 19 | "rotation": [-22, -90, 0], 20 | "translation": [0.5, 3.5, 1.5], 21 | "scale": [1.3, 1.3, 0.65] 22 | }, 23 | "firstperson_lefthand": { 24 | "rotation": [-22, 90, 0], 25 | "translation": [0.5, 3.5, 1.5], 26 | "scale": [1.3, 1.3, 0.65] 27 | }, 28 | "ground": { 29 | "translation": [0, 4.25, 0], 30 | "scale": [1, 1, 0.5] 31 | }, 32 | "gui": { 33 | "translation": [0.5, 0, 0], 34 | "scale": [1.76, 1.76, 1] 35 | }, 36 | "fixed": { 37 | "rotation": [0, 0, 95] 38 | } 39 | } 40 | } -------------------------------------------------------------------------------- /src/main/java/net/dragonloot/mixin/ItemEntityMixin.java: -------------------------------------------------------------------------------- 1 | package net.dragonloot.mixin; 2 | 3 | import net.minecraft.registry.tag.DamageTypeTags; 4 | import org.spongepowered.asm.mixin.Mixin; 5 | import org.spongepowered.asm.mixin.injection.Inject; 6 | import org.spongepowered.asm.mixin.injection.At; 7 | import org.spongepowered.asm.mixin.injection.callback.CallbackInfoReturnable; 8 | 9 | import net.dragonloot.init.TagInit; 10 | import net.minecraft.entity.ItemEntity; 11 | import net.minecraft.entity.damage.DamageSource; 12 | 13 | @Mixin(ItemEntity.class) 14 | public abstract class ItemEntityMixin { 15 | 16 | @Inject(method = "damage", at = @At("HEAD"), cancellable = true) 17 | private void damageMixin(DamageSource source, float amount, CallbackInfoReturnable info) { 18 | if ((Object) this instanceof ItemEntity) { 19 | if (((ItemEntity) (Object) this).getStack().isIn(TagInit.NOT_DESTROYED_BY_EXPLOSION) 20 | && source.isIn(DamageTypeTags.IS_EXPLOSION)) { 21 | info.setReturnValue(false); 22 | } 23 | } 24 | } 25 | } 26 | -------------------------------------------------------------------------------- /src/main/resources/assets/dragonloot/models/item/dragon_sword.json: -------------------------------------------------------------------------------- 1 | { 2 | "credit": "Made with Blockbench, by Pois1x", 3 | "parent": "item/handheld", 4 | "textures": { 5 | "layer0": "dragonloot:item/dragon_sword" 6 | }, 7 | "display": { 8 | "thirdperson_righthand": { 9 | "rotation": [16, -90, 61], 10 | "translation": [0, 4.75, 1.25], 11 | "scale": [1.7, 1.7, 0.85] 12 | }, 13 | "thirdperson_lefthand": { 14 | "rotation": [16, 90, -61], 15 | "translation": [0, 4.75, 1.25], 16 | "scale": [1.7, 1.7, 0.85] 17 | }, 18 | "firstperson_righthand": { 19 | "rotation": [68, 90, 0], 20 | "translation": [0.5, 3.5, 1.5], 21 | "scale": [1.3, 1.3, 0.65] 22 | }, 23 | "firstperson_lefthand": { 24 | "rotation": [68, -90, 0], 25 | "translation": [0.5, 3.5, 1.5], 26 | "scale": [1.3, 1.3, 0.65] 27 | }, 28 | "ground": { 29 | "translation": [0, 4.25, 0], 30 | "scale": [1, 1, 0.5] 31 | }, 32 | "gui": { 33 | "scale": [1.22, 1.22, 1] 34 | }, 35 | "fixed": { 36 | "rotation": [0, 0, 95] 37 | } 38 | }, 39 | "overrides": [{"predicate": {"parrying": 1},"model": "dragonloot:item/dragon_sword_parry"}] 40 | } -------------------------------------------------------------------------------- /src/main/java/net/dragonloot/mixin/AnvilBlockMixin.java: -------------------------------------------------------------------------------- 1 | package net.dragonloot.mixin; 2 | 3 | import org.spongepowered.asm.mixin.Mixin; 4 | import org.spongepowered.asm.mixin.Shadow; 5 | import org.spongepowered.asm.mixin.injection.Inject; 6 | import org.spongepowered.asm.mixin.injection.callback.CallbackInfoReturnable; 7 | import org.spongepowered.asm.mixin.injection.At; 8 | 9 | import net.dragonloot.init.BlockInit; 10 | import net.minecraft.block.AnvilBlock; 11 | import net.minecraft.block.BlockState; 12 | import net.minecraft.block.HorizontalFacingBlock; 13 | import net.minecraft.state.property.DirectionProperty; 14 | 15 | @Mixin(AnvilBlock.class) 16 | public class AnvilBlockMixin { 17 | @Shadow 18 | public static final DirectionProperty FACING; 19 | 20 | @Inject(method = "getLandingState", at = @At("HEAD"), cancellable = true) 21 | private static void getLandingStateMixin(BlockState fallingState, CallbackInfoReturnable info) { 22 | if (fallingState.isOf(BlockInit.DRAGON_ANVIL_BLOCK)) { 23 | info.setReturnValue((BlockState) BlockInit.DRAGON_ANVIL_BLOCK.getDefaultState().with(FACING, fallingState.get(FACING))); 24 | } 25 | 26 | } 27 | 28 | static { 29 | FACING = HorizontalFacingBlock.FACING; 30 | } 31 | 32 | } 33 | -------------------------------------------------------------------------------- /src/main/java/net/dragonloot/network/SyncPacket.java: -------------------------------------------------------------------------------- 1 | package net.dragonloot.network; 2 | 3 | import net.dragonloot.access.DragonAnvilInterface; 4 | import net.fabricmc.fabric.api.client.networking.v1.ClientPlayNetworking; 5 | import net.minecraft.entity.player.PlayerEntity; 6 | import net.minecraft.screen.AnvilScreenHandler; 7 | import net.minecraft.util.Identifier; 8 | 9 | public class SyncPacket { 10 | public static final Identifier ANVIL_SYNC_PACKET = new Identifier("dragonloot", "dragon_anvil_sync"); 11 | 12 | public static void init() { 13 | ClientPlayNetworking.registerGlobalReceiver(ANVIL_SYNC_PACKET, (client, handler, buffer, responseSender) -> { 14 | int entityId = buffer.readInt(); 15 | String blockString = buffer.readString(); 16 | client.execute(() -> { 17 | if (client.player.getWorld().getEntityById(entityId) != null) { 18 | PlayerEntity player = (PlayerEntity) client.player.getWorld().getEntityById(entityId); 19 | if (player.currentScreenHandler instanceof AnvilScreenHandler) { 20 | ((DragonAnvilInterface) player.currentScreenHandler).setDragonAnvil(blockString); 21 | } 22 | 23 | } 24 | }); 25 | }); 26 | 27 | } 28 | } 29 | -------------------------------------------------------------------------------- /src/main/java/net/dragonloot/item/render/DragonTridentItemRenderer.java: -------------------------------------------------------------------------------- 1 | package net.dragonloot.item.render; 2 | 3 | import net.dragonloot.DragonLootMain; 4 | import net.minecraft.client.render.VertexConsumer; 5 | import net.minecraft.client.render.VertexConsumerProvider; 6 | import net.minecraft.client.render.entity.model.TridentEntityModel; 7 | import net.minecraft.client.render.item.ItemRenderer; 8 | import net.minecraft.client.render.model.json.ModelTransformationMode; 9 | import net.minecraft.client.util.math.MatrixStack; 10 | import net.minecraft.item.ItemStack; 11 | 12 | public class DragonTridentItemRenderer { 13 | private static final TridentEntityModel modelTrident = new TridentEntityModel(TridentEntityModel.getTexturedModelData().createModel()); 14 | 15 | public static void render(ItemStack stack, ModelTransformationMode mode, MatrixStack matrices, VertexConsumerProvider vertexConsumers, int light, int overlay) { 16 | matrices.push(); 17 | matrices.scale(1.0F, -1.0F, -1.0F); 18 | VertexConsumer vertexConsumer2 = ItemRenderer.getDirectItemGlintConsumer(vertexConsumers, modelTrident.getLayer(DragonLootMain.ID("textures/entity/dragon_trident.png")), false, stack.hasGlint()); 19 | modelTrident.render(matrices, vertexConsumer2, light, overlay, 1.0F, 1.0F, 1.0F, 1.0F); 20 | matrices.pop(); 21 | } 22 | 23 | } 24 | -------------------------------------------------------------------------------- /src/main/resources/fabric.mod.json: -------------------------------------------------------------------------------- 1 | { 2 | "schemaVersion": 1, 3 | "id": "dragonloot", 4 | "version": "${version}", 5 | "name": "DragonLoot", 6 | "description": "Adds loot for the enderdragon", 7 | "authors": [ 8 | "Pois1x", 9 | "Globox_Z" 10 | ], 11 | "contact": { 12 | "homepage": "https://www.curseforge.com/minecraft/mc-mods/dragonloot", 13 | "sources": "https://github.com/GitPois1x/DragonLoot", 14 | "issues": "https://github.com/GitPois1x/DragonLoot/issues" 15 | }, 16 | "license": "GLPv3", 17 | "icon": "assets/dragonloot/icon.png", 18 | "environment": "*", 19 | "entrypoints": { 20 | "main": [ 21 | "net.dragonloot.DragonLootMain" 22 | ], 23 | "client": [ 24 | "net.dragonloot.DragonLootClient" 25 | ], 26 | "modmenu": [ 27 | "net.dragonloot.config.ModMenuIntegration" 28 | ] 29 | }, 30 | "mixins": [ 31 | "dragonloot.mixins.json" 32 | ], 33 | "depends": { 34 | "java": ">=17", 35 | "minecraft": ">=${minecraft_version}", 36 | "fabric-api": ">=${fabric_version}", 37 | "fabricloader": ">=${loader_version}", 38 | "cloth-config2": ">=${cloth_config_version}" 39 | }, 40 | "suggests": { 41 | "another-mod": "*" 42 | }, 43 | "accessWidener": "dragonloot.aw", 44 | "custom": { 45 | "mc-publish": { 46 | "modrinth": "EldwHO4Z", 47 | "curseforge": 424480 48 | } 49 | } 50 | } -------------------------------------------------------------------------------- /.github/workflows/build.yml: -------------------------------------------------------------------------------- 1 | # Automatically build the project and run any configured tests for every push 2 | # and submitted pull request. This can help catch issues that only occur on 3 | # certain platforms or Java versions, and provides a first line of defence 4 | # against bad commits. 5 | 6 | name: build 7 | on: [pull_request, push] 8 | 9 | jobs: 10 | build: 11 | strategy: 12 | matrix: 13 | # Use these Java versions 14 | java: [ 15 | 17 16 | ] 17 | # and run on both Linux and Windows 18 | os: [ubuntu-20.04, windows-latest] 19 | runs-on: ${{ matrix.os }} 20 | steps: 21 | - name: checkout repository 22 | uses: actions/checkout@v2 23 | - name: validate gradle wrapper 24 | uses: gradle/wrapper-validation-action@v1 25 | - name: setup jdk ${{ matrix.java }} 26 | uses: actions/setup-java@v1 27 | with: 28 | java-version: ${{ matrix.java }} 29 | - name: make gradle wrapper executable 30 | if: ${{ runner.os != 'Windows' }} 31 | run: chmod +x ./gradlew 32 | - name: build 33 | run: ./gradlew build 34 | - name: capture build artifacts 35 | if: ${{ runner.os == 'Linux' && matrix.java == '11' }} # Only upload artifacts built from LTS java on one OS 36 | uses: actions/upload-artifact@v2 37 | with: 38 | name: Artifacts 39 | path: build/libs/ 40 | -------------------------------------------------------------------------------- /src/main/java/net/dragonloot/mixin/LivingEntityMixin.java: -------------------------------------------------------------------------------- 1 | package net.dragonloot.mixin; 2 | 3 | import org.spongepowered.asm.mixin.Mixin; 4 | import org.spongepowered.asm.mixin.Shadow; 5 | import org.spongepowered.asm.mixin.injection.callback.CallbackInfo; 6 | import org.spongepowered.asm.mixin.injection.At; 7 | import org.spongepowered.asm.mixin.injection.Inject; 8 | 9 | import net.dragonloot.init.ItemInit; 10 | import net.minecraft.entity.Entity; 11 | import net.minecraft.entity.EntityType; 12 | import net.minecraft.entity.EquipmentSlot; 13 | import net.minecraft.entity.LivingEntity; 14 | import net.minecraft.world.World; 15 | 16 | @Mixin(LivingEntity.class) 17 | public abstract class LivingEntityMixin extends Entity { 18 | @Shadow 19 | protected int roll; 20 | 21 | public LivingEntityMixin(EntityType type, World world) { 22 | super(type, world); 23 | } 24 | 25 | @Inject(method = "tickFallFlying", at = @At(value = "INVOKE", target = "Lnet/minecraft/entity/LivingEntity;setFlag(IZ)V", ordinal = 0), cancellable = true) 26 | private void tickFallFlyingMixin(CallbackInfo info) { 27 | boolean bl = this.getFlag(7); 28 | if (bl && !this.isOnGround() && !this.hasVehicle() && ((LivingEntity) (Object) this).getEquippedStack(EquipmentSlot.CHEST).getItem() == ItemInit.UPGRADED_DRAGON_CHESTPLATE) { 29 | this.setFlag(7, true); 30 | info.cancel(); 31 | } 32 | 33 | } 34 | 35 | } -------------------------------------------------------------------------------- /src/main/resources/assets/dragonloot/models/item/dragon_trident_throwing.json: -------------------------------------------------------------------------------- 1 | { 2 | "parent": "builtin/entity", 3 | "gui_light": "front", 4 | "textures": { 5 | "particle": "dragonloot:item/dragon_trident" 6 | }, 7 | "display": { 8 | "thirdperson_righthand": { 9 | "rotation": [ 0, 90, 180 ], 10 | "translation": [ 8, -17, 9 ], 11 | "scale": [ 1, 1, 1 ] 12 | }, 13 | "thirdperson_lefthand": { 14 | "rotation": [ 0, 90, 180 ], 15 | "translation": [ 8, -17, -7 ], 16 | "scale": [ 1, 1, 1 ] 17 | }, 18 | "firstperson_righthand": { 19 | "rotation": [ 0, -90, 25 ], 20 | "translation": [ -3, 17, 1], 21 | "scale": [ 1, 1, 1 ] 22 | }, 23 | "firstperson_lefthand": { 24 | "rotation": [ 0, 90, -25 ], 25 | "translation": [ 13, 17, 1], 26 | "scale": [ 1, 1, 1 ] 27 | }, 28 | "gui": { 29 | "rotation": [ 15, -25, -5 ], 30 | "translation": [ 2, 3, 0 ], 31 | "scale": [ 0.65, 0.65, 0.65 ] 32 | }, 33 | "fixed": { 34 | "rotation": [ 0, 180, 0 ], 35 | "translation": [ -2, 4, -5], 36 | "scale":[ 0.5, 0.5, 0.5] 37 | }, 38 | "ground": { 39 | "rotation": [ 0, 0, 0 ], 40 | "translation": [ 4, 4, 2], 41 | "scale":[ 0.25, 0.25, 0.25] 42 | } 43 | } 44 | } 45 | -------------------------------------------------------------------------------- /src/main/java/net/dragonloot/mixin/PlayerEntityMixin.java: -------------------------------------------------------------------------------- 1 | package net.dragonloot.mixin; 2 | 3 | import org.spongepowered.asm.mixin.Mixin; 4 | import org.spongepowered.asm.mixin.Shadow; 5 | import org.spongepowered.asm.mixin.injection.Inject; 6 | import org.spongepowered.asm.mixin.injection.callback.CallbackInfoReturnable; 7 | import org.spongepowered.asm.mixin.injection.At; 8 | 9 | import net.dragonloot.init.ItemInit; 10 | import net.minecraft.entity.EntityType; 11 | import net.minecraft.entity.EquipmentSlot; 12 | import net.minecraft.entity.LivingEntity; 13 | import net.minecraft.entity.player.PlayerEntity; 14 | import net.minecraft.world.World; 15 | 16 | @Mixin(PlayerEntity.class) 17 | public abstract class PlayerEntityMixin extends LivingEntity { 18 | 19 | public PlayerEntityMixin(EntityType entityType, World world) { 20 | super(entityType, world); 21 | } 22 | 23 | @Inject(method = "checkFallFlying", at = @At(value = "INVOKE_ASSIGN", target = "Lnet/minecraft/entity/player/PlayerEntity;getEquippedStack(Lnet/minecraft/entity/EquipmentSlot;)Lnet/minecraft/item/ItemStack;"), cancellable = true) 24 | private void checkFallFlyingMixin(CallbackInfoReturnable info) { 25 | if (this.getEquippedStack(EquipmentSlot.CHEST).getItem() == ItemInit.UPGRADED_DRAGON_CHESTPLATE) { 26 | this.startFallFlying(); 27 | info.setReturnValue(true); 28 | } 29 | 30 | } 31 | 32 | @Shadow 33 | public void startFallFlying() { 34 | } 35 | 36 | } 37 | -------------------------------------------------------------------------------- /src/main/java/net/dragonloot/item/DragonToolMaterial.java: -------------------------------------------------------------------------------- 1 | package net.dragonloot.item; 2 | 3 | import net.dragonloot.init.ConfigInit; 4 | import net.dragonloot.init.ItemInit; 5 | import net.minecraft.item.ToolMaterial; 6 | import net.minecraft.recipe.Ingredient; 7 | 8 | public class DragonToolMaterial implements ToolMaterial { 9 | 10 | private DragonToolMaterial() { 11 | } 12 | 13 | private static DragonToolMaterial INSTANCE = null; 14 | 15 | public static DragonToolMaterial getInstance() { 16 | if (INSTANCE == null) { 17 | INSTANCE = new DragonToolMaterial(); 18 | } 19 | return INSTANCE; 20 | } 21 | 22 | @Override 23 | public int getDurability() { 24 | return 67 * ConfigInit.CONFIG.dragon_item_durability_multiplier; 25 | } 26 | 27 | @Override 28 | public float getMiningSpeedMultiplier() { 29 | return 12; 30 | } 31 | 32 | @Override 33 | public float getAttackDamage() { 34 | return ConfigInit.CONFIG.dragon_item_base_damage; 35 | } 36 | 37 | @Override 38 | public int getMiningLevel() { 39 | return 5; 40 | } 41 | 42 | @Override 43 | public int getEnchantability() { 44 | return ConfigInit.CONFIG.dragon_tool_enchantability; 45 | } 46 | 47 | @Override 48 | public Ingredient getRepairIngredient() { 49 | return Ingredient.ofItems(ItemInit.DRAGON_SCALE_ITEM); 50 | } 51 | 52 | // For LevelZ compat 53 | @Override 54 | public String toString() { 55 | return "DRAGON"; 56 | } 57 | 58 | } 59 | -------------------------------------------------------------------------------- /src/main/java/net/dragonloot/mixin/BowItemMixin.java: -------------------------------------------------------------------------------- 1 | package net.dragonloot.mixin; 2 | 3 | import net.dragonloot.item.DragonBowItem; 4 | import net.minecraft.entity.LivingEntity; 5 | import net.minecraft.entity.player.PlayerEntity; 6 | import net.minecraft.entity.projectile.PersistentProjectileEntity; 7 | import net.minecraft.item.ArrowItem; 8 | import net.minecraft.item.BowItem; 9 | import net.minecraft.item.ItemStack; 10 | import net.minecraft.world.World; 11 | import org.spongepowered.asm.mixin.Mixin; 12 | import org.spongepowered.asm.mixin.injection.At; 13 | import org.spongepowered.asm.mixin.injection.Inject; 14 | import org.spongepowered.asm.mixin.injection.callback.CallbackInfo; 15 | import org.spongepowered.asm.mixin.injection.callback.LocalCapture; 16 | 17 | @Mixin(BowItem.class) 18 | public class BowItemMixin { 19 | 20 | @Inject(method = "onStoppedUsing", at = @At(value = "INVOKE", target = "Lnet/minecraft/enchantment/EnchantmentHelper;getLevel(Lnet/minecraft/enchantment/Enchantment;Lnet/minecraft/item/ItemStack;)I", ordinal = 3), locals = LocalCapture.CAPTURE_FAILSOFT) 21 | private void onStoppedUsingMixin(ItemStack stack, World world, LivingEntity user, int remainingUseTicks, CallbackInfo info, PlayerEntity playerEntity, boolean bl, ItemStack itemStack, int i, float f, boolean bl2, ArrowItem arrowItem, PersistentProjectileEntity persistentProjectileEntity) { 22 | if (stack.getItem() instanceof DragonBowItem) { 23 | persistentProjectileEntity.setDamage(persistentProjectileEntity.getDamage() * 1.25f + 1f); 24 | } 25 | } 26 | 27 | } 28 | -------------------------------------------------------------------------------- /src/main/resources/assets/dragonloot/models/item/dragon_bow.json: -------------------------------------------------------------------------------- 1 | { 2 | "parent": "item/generated", 3 | "textures": { 4 | "layer0": "dragonloot:item/dragon_bow" 5 | }, 6 | "display": { 7 | "thirdperson_righthand": { 8 | "rotation": [ -80, 260, -40 ], 9 | "translation": [ -1, -2, 2.5 ], 10 | "scale": [ 0.9, 0.9, 0.9 ] 11 | }, 12 | "thirdperson_lefthand": { 13 | "rotation": [ -80, -280, 40 ], 14 | "translation": [ -1, -2, 2.5 ], 15 | "scale": [ 0.9, 0.9, 0.9 ] 16 | }, 17 | "firstperson_righthand": { 18 | "rotation": [ 0, -90, 25 ], 19 | "translation": [ 1.13, 3.2, 1.13], 20 | "scale": [ 0.68, 0.68, 0.68 ] 21 | }, 22 | "firstperson_lefthand": { 23 | "rotation": [ 0, 90, -25 ], 24 | "translation": [ 1.13, 3.2, 1.13], 25 | "scale": [ 0.68, 0.68, 0.68 ] 26 | } 27 | }, 28 | "overrides": [ 29 | { 30 | "predicate": { 31 | "pulling": 1 32 | }, 33 | "model": "dragonloot:item/dragon_bow_pulling_0" 34 | }, 35 | { 36 | "predicate": { 37 | "pulling": 1, 38 | "pull": 0.65 39 | }, 40 | "model": "dragonloot:item/dragon_bow_pulling_1" 41 | }, 42 | { 43 | "predicate": { 44 | "pulling": 1, 45 | "pull": 0.9 46 | }, 47 | "model": "dragonloot:item/dragon_bow_pulling_2" 48 | } 49 | ] 50 | } 51 | -------------------------------------------------------------------------------- /src/main/resources/assets/dragonloot/models/item/dragon_trident_in_hand.json: -------------------------------------------------------------------------------- 1 | { 2 | "parent": "builtin/entity", 3 | "gui_light": "front", 4 | "textures": { 5 | "particle": "dragonloot:item/dragon_trident" 6 | }, 7 | "display": { 8 | "thirdperson_righthand": { 9 | "rotation": [ 0, 60, 0 ], 10 | "translation": [ 11, 17, -2 ], 11 | "scale": [ 1, 1, 1 ] 12 | }, 13 | "thirdperson_lefthand": { 14 | "rotation": [ 0, 60, 0 ], 15 | "translation": [ 3, 17, 12 ], 16 | "scale": [ 1, 1, 1 ] 17 | }, 18 | "firstperson_righthand": { 19 | "rotation": [ 0, -90, 25 ], 20 | "translation": [ -3, 17, 1], 21 | "scale": [ 1, 1, 1 ] 22 | }, 23 | "firstperson_lefthand": { 24 | "rotation": [ 0, 90, -25 ], 25 | "translation": [ 13, 17, 1], 26 | "scale": [ 1, 1, 1 ] 27 | }, 28 | "gui": { 29 | "rotation": [ 15, -25, -5 ], 30 | "translation": [ 2, 3, 0 ], 31 | "scale": [ 0.65, 0.65, 0.65 ] 32 | }, 33 | "fixed": { 34 | "rotation": [ 0, 180, 0 ], 35 | "translation": [ -2, 4, -5], 36 | "scale":[ 0.5, 0.5, 0.5] 37 | }, 38 | "ground": { 39 | "rotation": [ 0, 0, 0 ], 40 | "translation": [ 4, 4, 2], 41 | "scale":[ 0.25, 0.25, 0.25] 42 | } 43 | }, 44 | "overrides": [ 45 | { 46 | "predicate": { 47 | "throwing": 1 48 | }, 49 | "model": "dragonloot:item/dragon_trident_throwing" 50 | } 51 | ] 52 | } 53 | -------------------------------------------------------------------------------- /src/main/java/net/dragonloot/compat/recipes/RecipeGenerator.java: -------------------------------------------------------------------------------- 1 | package net.dragonloot.compat.recipes; 2 | 3 | import java.util.HashMap; 4 | 5 | import com.google.gson.JsonObject; 6 | 7 | import net.dragonloot.DragonLootMain; 8 | import net.minecraft.util.Identifier; 9 | 10 | public class RecipeGenerator { 11 | 12 | public static HashMap SMITHING_RECIPES = new HashMap<>(); 13 | public static HashMap RECIPES = new HashMap<>(); 14 | 15 | public static JsonObject generateJson(Identifier base, Identifier addition, String baseType, String additionType, Identifier output, Identifier template) { 16 | JsonObject json = new JsonObject(); 17 | json.addProperty("type", "minecraft:smithing_transform"); 18 | 19 | JsonObject obj = new JsonObject(); 20 | obj.addProperty(baseType, base.toString()); 21 | json.add("base", obj); 22 | 23 | obj = new JsonObject(); 24 | obj.addProperty(additionType, addition.toString()); 25 | json.add("addition", obj); 26 | 27 | obj = new JsonObject(); 28 | obj.addProperty("item", output.toString()); 29 | json.add("result", obj); 30 | 31 | obj = new JsonObject(); 32 | obj.addProperty("item", template.toString()); 33 | json.add("template", obj); 34 | 35 | return json; 36 | } 37 | 38 | public static void addRecipes() { 39 | for (String key : SMITHING_RECIPES.keySet()) { 40 | RecipeMaterial material = SMITHING_RECIPES.get(key); 41 | RECIPES.put(DragonLootMain.ID(key), generateJson(material.baseItem, material.additionItem, material.baseType, material.additionType, material.output, material.template)); 42 | } 43 | } 44 | } 45 | -------------------------------------------------------------------------------- /src/main/resources/data/dragonloot/advancements/dragon_armor.json: -------------------------------------------------------------------------------- 1 | { 2 | "parent": "minecraft:nether/netherite_armor", 3 | "display": { 4 | "icon": { 5 | "item": "dragonloot:dragon_chestplate", 6 | "nbt": "{Damage:0}" 7 | }, 8 | "title": { 9 | "translate": "dragonloot.advancements.dragon_armor.title" 10 | }, 11 | "description": { 12 | "translate": "dragonloot.advancements.dragon_armor.description" 13 | }, 14 | "frame": "challenge", 15 | "show_toast": true, 16 | "announce_to_chat": true, 17 | "hidden": false 18 | }, 19 | "rewards": { 20 | "experience": 100 21 | }, 22 | "criteria": { 23 | "dragon_armor": { 24 | "trigger": "minecraft:inventory_changed", 25 | "conditions": { 26 | "items": [ 27 | { 28 | "items": [ 29 | "dragonloot:dragon_helmet" 30 | ] 31 | }, 32 | { 33 | "items": [ 34 | "dragonloot:dragon_chestplate" 35 | ] 36 | }, 37 | { 38 | "items": [ 39 | "dragonloot:dragon_leggings" 40 | ] 41 | }, 42 | { 43 | "items": [ 44 | "dragonloot:dragon_boots" 45 | ] 46 | } 47 | ] 48 | } 49 | } 50 | }, 51 | "requirements": [ 52 | [ 53 | "dragon_armor" 54 | ] 55 | ] 56 | } -------------------------------------------------------------------------------- /src/main/resources/assets/dragonloot/lang/zh_cn.json: -------------------------------------------------------------------------------- 1 | { 2 | "block.dragonloot.dragon_anvil": "龙砧", 3 | "item.dragonloot.dragon_scale": "龙鳞", 4 | 5 | "item.dragonloot.dragon_helmet": "龙鳞头盔", 6 | "item.dragonloot.dragon_chestplate": "龙鳞胸甲", 7 | "item.dragonloot.dragon_leggings": "龙鳞护腿", 8 | "item.dragonloot.dragon_boots": "龙鳞靴子", 9 | "item.dragonloot.upgraded_dragon_chestplate": "羽翼龙鳞胸甲", 10 | 11 | "item.dragonloot.dragon_pickaxe": "龙镐", 12 | "item.dragonloot.dragon_axe": "龙斧", 13 | "item.dragonloot.dragon_shovel": "龙铲", 14 | "item.dragonloot.dragon_hoe": "龙锄", 15 | "item.dragonloot.dragon_sword": "龙剑", 16 | "item.dragonloot.dragon_bow": "龙弓", 17 | "item.dragonloot.dragon_crossbow": "龙弩", 18 | 19 | "item.dragonloot.dragon_horse_armor": "龙马铠", 20 | "item.dragonloot.dragon_trident": "龙三叉戟", 21 | "entity.dragonloot.dragon_trident": "龙三叉戟", 22 | 23 | "itemGroup.dragonloot.dragonloot": "龙战利品", 24 | 25 | "text.autoconfig.dragonloot.title": "龙战利品配置", 26 | "text.autoconfig.dragonloot.option.scale_minimum_drop_amount": "龙鳞最低掉落数量", 27 | "text.autoconfig.dragonloot.option.additional_scales_per_player": "每位玩家额外龙鳞", 28 | "text.autoconfig.dragonloot.option.additional_scale_drop_chance": "额外龙鳞掉落几率", 29 | "text.autoconfig.dragonloot.option.dragon_armor_protection_helmet": "龙鳞头盔护甲值", 30 | "text.autoconfig.dragonloot.option.dragon_armor_protection_chest": "龙鳞胸甲护甲值", 31 | "text.autoconfig.dragonloot.option.dragon_armor_protection_leggings": "龙鳞护腿护甲值", 32 | "text.autoconfig.dragonloot.option.dragon_armor_protection_boots": "龙鳞靴子护甲值", 33 | "text.autoconfig.dragonloot.option.dragon_armor_durability_multiplier": "龙鳞装甲耐久度倍数", 34 | "text.autoconfig.dragonloot.option.dragon_item_durability_multiplier": "龙物品耐久度倍数", 35 | "text.autoconfig.dragonloot.option.dragon_item_base_damage": "龙物品基础伤害", 36 | 37 | "dragonloot.advancements.dragon_armor.title": "龙鳞铸造", 38 | "dragonloot.advancements.dragon_armor.description": "打造全套龙鳞装甲" 39 | } 40 | -------------------------------------------------------------------------------- /src/main/resources/assets/dragonloot/models/item/dragon_crossbow.json: -------------------------------------------------------------------------------- 1 | { 2 | "parent": "item/generated", 3 | "textures": { 4 | "layer0": "dragonloot:item/dragon_crossbow_standby" 5 | }, 6 | "display": { 7 | "thirdperson_righthand": { 8 | "rotation": [ -90, 0, -60 ], 9 | "translation": [ 2, 0.1, -3 ], 10 | "scale": [ 0.9, 0.9, 0.9 ] 11 | }, 12 | "thirdperson_lefthand": { 13 | "rotation": [ -90, 0, 30 ], 14 | "translation": [ 2, 0.1, -3 ], 15 | "scale": [ 0.9, 0.9, 0.9 ] 16 | }, 17 | "firstperson_righthand": { 18 | "rotation": [ -90, 0, -55 ], 19 | "translation": [ 1.13, 3.2, 1.13], 20 | "scale": [ 0.68, 0.68, 0.68 ] 21 | }, 22 | "firstperson_lefthand": { 23 | "rotation": [ -90, 0, 35 ], 24 | "translation": [ 1.13, 3.2, 1.13], 25 | "scale": [ 0.68, 0.68, 0.68 ] 26 | } 27 | }, 28 | "overrides": [ 29 | { 30 | "predicate": { 31 | "pulling": 1 32 | }, 33 | "model": "dragonloot:item/dragon_crossbow_pulling_0" 34 | }, 35 | { 36 | "predicate": { 37 | "pulling": 1, 38 | "pull": 0.58 39 | }, 40 | "model": "dragonloot:item/dragon_crossbow_pulling_1" 41 | }, 42 | { 43 | "predicate": { 44 | "pulling": 1, 45 | "pull": 1.0 46 | }, 47 | "model": "dragonloot:item/dragon_crossbow_pulling_2" 48 | }, 49 | { 50 | "predicate": { 51 | "charged": 1 52 | }, 53 | "model": "dragonloot:item/dragon_crossbow_arrow" 54 | }, 55 | { 56 | "predicate": { 57 | "charged": 1, 58 | "firework": 1 59 | }, 60 | "model": "dragonloot:item/dragon_crossbow_firework" 61 | } 62 | ] 63 | } 64 | -------------------------------------------------------------------------------- /src/main/java/net/dragonloot/config/DragonLootConfig.java: -------------------------------------------------------------------------------- 1 | package net.dragonloot.config; 2 | 3 | import me.shedaniel.autoconfig.ConfigData; 4 | import me.shedaniel.autoconfig.annotation.ConfigEntry; 5 | import me.shedaniel.autoconfig.annotation.Config; 6 | import me.shedaniel.cloth.clothconfig.shadowed.blue.endless.jankson.Comment; 7 | 8 | @Config(name = "dragonloot") 9 | @Config.Gui.Background("minecraft:textures/block/stone.png") 10 | public class DragonLootConfig implements ConfigData { 11 | 12 | public int scale_minimum_drop_amount = 3; 13 | public int additional_scales_per_player = 2; 14 | @Comment("0.8F = 80%") 15 | public float additional_scale_drop_chance = 0.8F; 16 | @ConfigEntry.BoundedDiscrete(min = 0, max = 20) 17 | @ConfigEntry.Gui.RequiresRestart 18 | public int dragon_armor_protection_helmet = 7; 19 | @ConfigEntry.BoundedDiscrete(min = 0, max = 20) 20 | @ConfigEntry.Gui.RequiresRestart 21 | public int dragon_armor_protection_chest = 10; 22 | @ConfigEntry.BoundedDiscrete(min = 0, max = 20) 23 | @ConfigEntry.Gui.RequiresRestart 24 | public int dragon_armor_protection_leggings = 9; 25 | @ConfigEntry.BoundedDiscrete(min = 0, max = 20) 26 | @ConfigEntry.Gui.RequiresRestart 27 | public int dragon_armor_protection_boots = 7; 28 | @ConfigEntry.Gui.RequiresRestart 29 | public float dragon_armor_toughness = 3.0F; 30 | @ConfigEntry.Gui.RequiresRestart 31 | public float dragon_armor_knockback_resistance = 1.0F; 32 | @ConfigEntry.Gui.RequiresRestart 33 | public int dragon_armor_enchantability = 15; 34 | @ConfigEntry.Gui.RequiresRestart 35 | public int dragon_armor_durability_multiplier = 37; 36 | @ConfigEntry.Gui.RequiresRestart 37 | public int dragon_item_durability_multiplier = 37; 38 | @ConfigEntry.Gui.RequiresRestart 39 | public float dragon_item_base_damage = 5F; 40 | @ConfigEntry.Gui.RequiresRestart 41 | public int dragon_tool_enchantability = 20; 42 | @ConfigEntry.Gui.RequiresRestart 43 | public boolean dragon_anvil_no_cap = true; 44 | } 45 | -------------------------------------------------------------------------------- /src/main/java/net/dragonloot/mixin/client/AbstractClientPlayerEntityMixin.java: -------------------------------------------------------------------------------- 1 | package net.dragonloot.mixin.client; 2 | 3 | import com.mojang.authlib.GameProfile; 4 | 5 | import org.spongepowered.asm.mixin.Mixin; 6 | import org.spongepowered.asm.mixin.injection.Inject; 7 | import org.spongepowered.asm.mixin.injection.callback.CallbackInfoReturnable; 8 | import org.spongepowered.asm.mixin.injection.callback.LocalCapture; 9 | import org.spongepowered.asm.mixin.injection.At; 10 | 11 | import net.dragonloot.init.ItemInit; 12 | import net.fabricmc.api.Environment; 13 | import net.fabricmc.api.EnvType; 14 | import net.minecraft.client.MinecraftClient; 15 | import net.minecraft.client.network.AbstractClientPlayerEntity; 16 | import net.minecraft.entity.player.PlayerEntity; 17 | import net.minecraft.util.math.BlockPos; 18 | import net.minecraft.util.math.MathHelper; 19 | import net.minecraft.world.World; 20 | 21 | @Environment(EnvType.CLIENT) 22 | @Mixin(AbstractClientPlayerEntity.class) 23 | public abstract class AbstractClientPlayerEntityMixin extends PlayerEntity { 24 | 25 | public AbstractClientPlayerEntityMixin(World world, BlockPos pos, float yaw, GameProfile gameProfile) { 26 | super(world, pos, yaw, gameProfile); 27 | } 28 | 29 | @SuppressWarnings("resource") 30 | @Inject(method = "getFovMultiplier", at = @At(value = "INVOKE_ASSIGN", target = "Lnet/minecraft/client/network/AbstractClientPlayerEntity;getActiveItem()Lnet/minecraft/item/ItemStack;"), locals = LocalCapture.CAPTURE_FAILSOFT, cancellable = true) 31 | private void getFovMultiplierMixin(CallbackInfoReturnable info, float f) { 32 | if (this.isUsingItem() && this.getActiveItem().getItem().equals(ItemInit.DRAGON_BOW_ITEM)) { 33 | int i = this.getItemUseTime(); 34 | float g = (float) i / 20.0f; 35 | g = g > 1.0f ? 1.0f : (g *= g); 36 | f *= 1.0f - g * 0.15f; 37 | info.setReturnValue(MathHelper.lerp(MinecraftClient.getInstance().options.getFovEffectScale().getValue().floatValue(), 1.0F, f)); 38 | } 39 | 40 | } 41 | 42 | } -------------------------------------------------------------------------------- /src/main/java/net/dragonloot/mixin/client/ClientPlayerEntityMixin.java: -------------------------------------------------------------------------------- 1 | package net.dragonloot.mixin.client; 2 | 3 | import com.mojang.authlib.GameProfile; 4 | 5 | import org.spongepowered.asm.mixin.Final; 6 | import org.spongepowered.asm.mixin.Mixin; 7 | import org.spongepowered.asm.mixin.Mutable; 8 | import org.spongepowered.asm.mixin.Shadow; 9 | import org.spongepowered.asm.mixin.injection.Inject; 10 | import org.spongepowered.asm.mixin.injection.callback.CallbackInfo; 11 | import org.spongepowered.asm.mixin.injection.At; 12 | 13 | import net.dragonloot.init.ItemInit; 14 | import net.fabricmc.api.Environment; 15 | import net.fabricmc.api.EnvType; 16 | import net.minecraft.client.network.AbstractClientPlayerEntity; 17 | import net.minecraft.client.network.ClientPlayNetworkHandler; 18 | import net.minecraft.client.network.ClientPlayerEntity; 19 | import net.minecraft.client.world.ClientWorld; 20 | import net.minecraft.entity.EquipmentSlot; 21 | import net.minecraft.item.ItemStack; 22 | import net.minecraft.network.packet.c2s.play.ClientCommandC2SPacket; 23 | 24 | @Environment(EnvType.CLIENT) 25 | @Mixin(ClientPlayerEntity.class) 26 | public abstract class ClientPlayerEntityMixin extends AbstractClientPlayerEntity { 27 | 28 | @Shadow 29 | @Mutable 30 | @Final 31 | public ClientPlayNetworkHandler networkHandler; 32 | 33 | public ClientPlayerEntityMixin(ClientWorld world, GameProfile profile) { 34 | super(world, profile); 35 | } 36 | 37 | @Inject(method = "Lnet/minecraft/client/network/ClientPlayerEntity;tickMovement()V", at = @At(value = "INVOKE_ASSIGN", target = "Lnet/minecraft/client/network/ClientPlayerEntity;getEquippedStack(Lnet/minecraft/entity/EquipmentSlot;)Lnet/minecraft/item/ItemStack;")) 38 | private void tickMovementMixin(CallbackInfo info) { 39 | ItemStack itemStack = this.getEquippedStack(EquipmentSlot.CHEST); 40 | if (itemStack.getItem() == ItemInit.UPGRADED_DRAGON_CHESTPLATE && this.checkFallFlying()) { 41 | this.networkHandler.sendPacket(new ClientCommandC2SPacket(this, ClientCommandC2SPacket.Mode.START_FALL_FLYING)); 42 | } 43 | } 44 | 45 | } 46 | -------------------------------------------------------------------------------- /src/main/java/net/dragonloot/mixin/CrossbowItemMixin.java: -------------------------------------------------------------------------------- 1 | package net.dragonloot.mixin; 2 | 3 | import net.dragonloot.init.ItemInit; 4 | import net.minecraft.entity.LivingEntity; 5 | import net.minecraft.entity.projectile.PersistentProjectileEntity; 6 | import net.minecraft.item.ArrowItem; 7 | import net.minecraft.item.CrossbowItem; 8 | import net.minecraft.item.Item; 9 | import net.minecraft.item.ItemStack; 10 | import net.minecraft.item.Items; 11 | import net.minecraft.world.World; 12 | import org.spongepowered.asm.mixin.Mixin; 13 | import org.spongepowered.asm.mixin.Shadow; 14 | import org.spongepowered.asm.mixin.injection.At; 15 | import org.spongepowered.asm.mixin.injection.Inject; 16 | import org.spongepowered.asm.mixin.injection.callback.CallbackInfoReturnable; 17 | import org.spongepowered.asm.mixin.injection.callback.LocalCapture; 18 | 19 | @Mixin(CrossbowItem.class) 20 | public class CrossbowItemMixin { 21 | 22 | @Inject(method = "createArrow", at = @At("RETURN"), locals = LocalCapture.CAPTURE_FAILSOFT, cancellable = true) 23 | private static void createArrowMixin(World world, LivingEntity entity, ItemStack crossbow, ItemStack arrow, CallbackInfoReturnable info, ArrowItem arrowItem, PersistentProjectileEntity persistentProjectileEntity) { 24 | if (crossbow.getItem() == ItemInit.DRAGON_CROSSBOW_ITEM) { 25 | persistentProjectileEntity.setDamage(persistentProjectileEntity.getDamage() * 1.25f + 1f); 26 | info.setReturnValue(persistentProjectileEntity); 27 | } 28 | } 29 | 30 | @Inject(method = "getSpeed", at = @At("HEAD"), cancellable = true) 31 | private static void getSpeedMixin(ItemStack stack, CallbackInfoReturnable info) { 32 | if (stack.getItem() == ItemInit.DRAGON_CROSSBOW_ITEM) { 33 | if (hasProjectile(stack, Items.FIREWORK_ROCKET)) { 34 | info.setReturnValue(1.6F); 35 | } else { 36 | info.setReturnValue(3.15F); 37 | } 38 | } 39 | } 40 | 41 | @Shadow 42 | public static boolean hasProjectile(ItemStack crossbow, Item projectile) { 43 | return false; 44 | } 45 | } -------------------------------------------------------------------------------- /src/main/java/net/dragonloot/mixin/PlayerInventoryMixin.java: -------------------------------------------------------------------------------- 1 | package net.dragonloot.mixin; 2 | 3 | import org.spongepowered.asm.mixin.Final; 4 | import org.spongepowered.asm.mixin.Mixin; 5 | import org.spongepowered.asm.mixin.Mutable; 6 | import org.spongepowered.asm.mixin.Shadow; 7 | import org.spongepowered.asm.mixin.injection.Inject; 8 | import org.spongepowered.asm.mixin.injection.callback.CallbackInfo; 9 | import org.spongepowered.asm.mixin.injection.At; 10 | 11 | import net.dragonloot.init.ItemInit; 12 | import net.minecraft.entity.damage.DamageSource; 13 | import net.minecraft.entity.player.PlayerEntity; 14 | import net.minecraft.entity.player.PlayerInventory; 15 | import net.minecraft.item.ItemStack; 16 | import net.minecraft.item.Items; 17 | import net.minecraft.sound.SoundEvents; 18 | import net.minecraft.util.collection.DefaultedList; 19 | 20 | @Mixin(PlayerInventory.class) 21 | public class PlayerInventoryMixin { 22 | @Shadow 23 | public final PlayerEntity player; 24 | @Shadow 25 | @Final 26 | @Mutable 27 | public final DefaultedList armor; 28 | 29 | public PlayerInventoryMixin(PlayerEntity player) { 30 | this.armor = DefaultedList.ofSize(4, ItemStack.EMPTY); 31 | this.player = player; 32 | } 33 | 34 | @Inject(method = "damageArmor", at = @At("HEAD"), cancellable = true) 35 | private void damageArmorMixin(DamageSource damageSource, float amount, int[] slots, CallbackInfo info) { 36 | ItemStack item = this.armor.get(2); 37 | if (amount > 0.0F && item.getItem().equals(ItemInit.UPGRADED_DRAGON_CHESTPLATE) && item.getDamage() == (item.getMaxDamage() - 1)) { 38 | this.armor.get(2).decrement(1); 39 | this.armor.set(2, new ItemStack(Items.ELYTRA)); 40 | this.armor.get(2).setDamage(Items.ELYTRA.getMaxDamage()); 41 | if (!this.player.isSilent()) { 42 | this.player.getWorld().playSound(this.player.getX(), this.player.getY(), this.player.getZ(), SoundEvents.ENTITY_ITEM_BREAK, this.player.getSoundCategory(), 0.8F, 0.8F + this.player.getWorld().getRandom().nextFloat() * 0.4F, false); 43 | } 44 | } 45 | } 46 | 47 | } 48 | -------------------------------------------------------------------------------- /src/main/java/net/dragonloot/mixin/client/PlayerEntityRendererMixin.java: -------------------------------------------------------------------------------- 1 | package net.dragonloot.mixin.client; 2 | 3 | import net.dragonloot.init.ItemInit; 4 | import net.fabricmc.api.Environment; 5 | import net.fabricmc.api.EnvType; 6 | import net.minecraft.client.network.AbstractClientPlayerEntity; 7 | import net.minecraft.client.render.entity.EntityRendererFactory; 8 | import net.minecraft.client.render.entity.LivingEntityRenderer; 9 | import net.minecraft.client.render.entity.PlayerEntityRenderer; 10 | import net.minecraft.client.render.entity.model.BipedEntityModel; 11 | import net.minecraft.client.render.entity.model.PlayerEntityModel; 12 | import net.minecraft.item.CrossbowItem; 13 | import net.minecraft.item.ItemStack; 14 | import net.minecraft.util.Hand; 15 | import org.spongepowered.asm.mixin.Mixin; 16 | import org.spongepowered.asm.mixin.injection.At; 17 | import org.spongepowered.asm.mixin.injection.Inject; 18 | import org.spongepowered.asm.mixin.injection.callback.CallbackInfoReturnable; 19 | 20 | @Environment(EnvType.CLIENT) 21 | @Mixin(PlayerEntityRenderer.class) 22 | public abstract class PlayerEntityRendererMixin extends LivingEntityRenderer> { 23 | 24 | public PlayerEntityRendererMixin(EntityRendererFactory.Context ctx, PlayerEntityModel model, float shadowRadius) { 25 | super(ctx, model, shadowRadius); 26 | } 27 | 28 | @Inject(method = "getArmPose", at = @At("HEAD"), cancellable = true) 29 | private static void getArmPoseMixin(AbstractClientPlayerEntity abstractClientPlayerEntity, Hand hand, CallbackInfoReturnable info) { 30 | ItemStack itemStack = abstractClientPlayerEntity.getStackInHand(hand); 31 | if (!abstractClientPlayerEntity.handSwinging && itemStack.getItem() == ItemInit.DRAGON_CROSSBOW_ITEM && CrossbowItem.isCharged(itemStack)) { 32 | info.setReturnValue(BipedEntityModel.ArmPose.CROSSBOW_HOLD); 33 | } 34 | } 35 | 36 | // @Inject(method = "", at = @At("TAIL")) 37 | // public void initMixin(CallbackInfo info) { 38 | // this.addFeature(new DragonChestplateRenderer(this)); 39 | // } 40 | 41 | } -------------------------------------------------------------------------------- /src/main/java/net/dragonloot/entity/model/DragonHelmetModel.java: -------------------------------------------------------------------------------- 1 | package net.dragonloot.entity.model; 2 | 3 | import net.minecraft.client.model.*; 4 | import net.minecraft.client.render.RenderLayer; 5 | import net.minecraft.client.render.VertexConsumer; 6 | import net.minecraft.client.util.math.MatrixStack; 7 | 8 | public class DragonHelmetModel extends Model { 9 | 10 | private final ModelPart root; 11 | private final ModelPart HornLD; 12 | private final ModelPart HornRD; 13 | private final ModelPart HornLU; 14 | 15 | public DragonHelmetModel(ModelPart root) { 16 | super(RenderLayer::getArmorCutoutNoCull); 17 | this.root = root.getChild("root"); 18 | this.HornLU = this.root.getChild("HornLU"); 19 | this.HornRD = this.root.getChild("HornRD"); 20 | this.HornLD = this.root.getChild("HornLD"); 21 | } 22 | 23 | public static TexturedModelData getTexturedModelData() { 24 | ModelData modelData = new ModelData(); 25 | ModelPartData modelPartData = modelData.getRoot(); 26 | ModelPartData modelPartData1 = modelPartData.addChild("root", ModelPartBuilder.create().uv(0, 0).cuboid(-4.0F, -8.0F, -4.0F, 8.0F, 8.0F, 8.0F, new Dilation(0.1F)).uv(0, 16).cuboid(-3.0F, -7.0F, -7.0F, 6.0F, 4.0F, 3.0F), ModelTransform.pivot(0.0F, 24.0F, 0.0F)); 27 | modelPartData1.addChild("HornLD", ModelPartBuilder.create().uv(34, 0).cuboid(-1.0F, -1.0F, 0.0F, 2.0F, 2.0F, 4.0F), ModelTransform.pivot(-3.0F, -5.0F, 3.0F)); 28 | modelPartData1.addChild("HornRD", ModelPartBuilder.create().uv(34, 0).cuboid(-2.0F, -1.0F, 0.0F, 2.0F, 2.0F, 4.0F), ModelTransform.pivot(4.0F, -5.0F, 3.0F)); 29 | modelPartData1.addChild("HornLU", ModelPartBuilder.create().uv(24, 0).cuboid(-1.0F, 0.0F, 0.0F, 2.0F, 2.0F, 6.0F).uv(24, 0).cuboid(4.8F, 0.0F, 0.0F, 2.0F, 2.0F, 6.0F), ModelTransform.pivot(-2.9F, -8.0F, 2.0F)); 30 | return TexturedModelData.of(modelData, 64, 32); 31 | } 32 | 33 | @Override 34 | public void render(MatrixStack matrices, VertexConsumer vertexConsumer, int light, int overlay, float red, float green, float blue, float alpha) { 35 | this.HornLU.pitch = 0.7854F; 36 | this.HornRD.yaw = 0.3927F; 37 | this.HornLD.yaw = -0.3927F; 38 | this.root.render(matrices, vertexConsumer, light, overlay, red, green, blue, alpha); 39 | } 40 | } 41 | -------------------------------------------------------------------------------- /src/main/java/net/dragonloot/item/DragonArmorMaterial.java: -------------------------------------------------------------------------------- 1 | package net.dragonloot.item; 2 | 3 | import net.dragonloot.init.ConfigInit; 4 | import net.dragonloot.init.ItemInit; 5 | import net.minecraft.item.ArmorItem; 6 | import net.minecraft.item.ArmorMaterial; 7 | import net.minecraft.recipe.Ingredient; 8 | import net.minecraft.sound.SoundEvent; 9 | import net.minecraft.sound.SoundEvents; 10 | 11 | public class DragonArmorMaterial implements ArmorMaterial { 12 | 13 | private DragonArmorMaterial() { 14 | } 15 | 16 | private static DragonArmorMaterial INSTANCE = null; 17 | 18 | public static DragonArmorMaterial getInstance() { 19 | if (INSTANCE == null) { 20 | INSTANCE = new DragonArmorMaterial(); 21 | } 22 | return INSTANCE; 23 | } 24 | 25 | private static final int[] BASE_DURABILITY = new int[] { 28, 32, 35, 26 }; 26 | private static final int[] PROTECTION_AMOUNTS = new int[] { ConfigInit.CONFIG.dragon_armor_protection_boots, ConfigInit.CONFIG.dragon_armor_protection_leggings, ConfigInit.CONFIG.dragon_armor_protection_chest, ConfigInit.CONFIG.dragon_armor_protection_helmet }; 27 | 28 | @Override 29 | public int getDurability(ArmorItem.Type type) { 30 | return BASE_DURABILITY[type.getEquipmentSlot().getEntitySlotId()] * ConfigInit.CONFIG.dragon_armor_durability_multiplier; 31 | } 32 | 33 | @Override 34 | public int getProtection(ArmorItem.Type type) { 35 | return PROTECTION_AMOUNTS[type.getEquipmentSlot().getEntitySlotId()]; 36 | } 37 | 38 | @Override 39 | public int getEnchantability() { 40 | return ConfigInit.CONFIG.dragon_armor_enchantability; 41 | } 42 | 43 | @Override 44 | public SoundEvent getEquipSound() { 45 | return SoundEvents.ITEM_ARMOR_EQUIP_CHAIN; 46 | } 47 | 48 | @Override 49 | public Ingredient getRepairIngredient() { 50 | return Ingredient.ofItems(ItemInit.DRAGON_SCALE_ITEM); 51 | } 52 | 53 | @Override 54 | public String getName() { 55 | return "dragon"; 56 | } 57 | 58 | @Override 59 | public float getToughness() { 60 | return ConfigInit.CONFIG.dragon_armor_toughness; 61 | } 62 | 63 | @Override 64 | public float getKnockbackResistance() { 65 | return ConfigInit.CONFIG.dragon_armor_knockback_resistance; 66 | } 67 | 68 | } -------------------------------------------------------------------------------- /src/main/java/net/dragonloot/entity/render/DragonTridentEntityRenderer.java: -------------------------------------------------------------------------------- 1 | package net.dragonloot.entity.render; 2 | 3 | import net.dragonloot.DragonLootMain; 4 | import net.dragonloot.entity.DragonTridentEntity; 5 | import net.fabricmc.api.EnvType; 6 | import net.fabricmc.api.Environment; 7 | import net.minecraft.client.render.OverlayTexture; 8 | import net.minecraft.client.render.VertexConsumer; 9 | import net.minecraft.client.render.VertexConsumerProvider; 10 | import net.minecraft.client.render.entity.EntityRenderer; 11 | import net.minecraft.client.render.entity.EntityRendererFactory; 12 | import net.minecraft.client.render.entity.model.TridentEntityModel; 13 | import net.minecraft.client.render.item.ItemRenderer; 14 | import net.minecraft.client.util.math.MatrixStack; 15 | import net.minecraft.util.Identifier; 16 | import net.minecraft.util.math.MathHelper; 17 | import net.minecraft.util.math.RotationAxis; 18 | 19 | @Environment(EnvType.CLIENT) 20 | public class DragonTridentEntityRenderer extends EntityRenderer { 21 | public static final Identifier TEXTURE = DragonLootMain.ID("textures/entity/dragon_trident.png"); 22 | private final TridentEntityModel model = new TridentEntityModel(TridentEntityModel.getTexturedModelData().createModel()); 23 | 24 | public DragonTridentEntityRenderer(EntityRendererFactory.Context context) { 25 | super(context); 26 | } 27 | 28 | @Override 29 | public void render(DragonTridentEntity tridentEntity, float f, float g, MatrixStack matrixStack, VertexConsumerProvider vertexConsumerProvider, int i) { 30 | matrixStack.push(); 31 | matrixStack.multiply(RotationAxis.POSITIVE_Y.rotationDegrees(MathHelper.lerp(g, tridentEntity.prevYaw, tridentEntity.getYaw()) - 90.0F)); 32 | matrixStack.multiply(RotationAxis.POSITIVE_Z.rotationDegrees(MathHelper.lerp(g, tridentEntity.prevPitch, tridentEntity.getPitch()) + 90.0F)); 33 | VertexConsumer vertexConsumer = ItemRenderer.getDirectItemGlintConsumer(vertexConsumerProvider, this.model.getLayer(this.getTexture(tridentEntity)), false, tridentEntity.isEnchanted()); 34 | this.model.render(matrixStack, vertexConsumer, i, OverlayTexture.DEFAULT_UV, 1.0F, 1.0F, 1.0F, 1.0F); 35 | matrixStack.pop(); 36 | super.render(tridentEntity, f, g, matrixStack, vertexConsumerProvider, i); 37 | } 38 | 39 | @Override 40 | public Identifier getTexture(DragonTridentEntity tridentEntity) { 41 | return TEXTURE; 42 | } 43 | } 44 | -------------------------------------------------------------------------------- /src/main/resources/assets/dragonloot/lang/ko_kr.json: -------------------------------------------------------------------------------- 1 | { 2 | "block.dragonloot.dragon_anvil": "드래곤 모루", 3 | "item.dragonloot.dragon_scale": "드래곤 비늘", 4 | 5 | "item.dragonloot.dragon_helmet": "드래곤 비늘 헬멧", 6 | "item.dragonloot.dragon_chestplate": "드래곤 비늘 흉갑", 7 | "item.dragonloot.dragon_leggings": "드래곤 비늘 레깅스", 8 | "item.dragonloot.dragon_boots": "드래곤 비늘 부츠", 9 | "item.dragonloot.upgraded_dragon_chestplate": "날개 달린 드래곤 비늘 흉갑", 10 | 11 | "item.dragonloot.dragon_pickaxe": "드래곤 곡괭이", 12 | "item.dragonloot.dragon_axe": "드래곤 도끼", 13 | "item.dragonloot.dragon_shovel": "드래곤 삽", 14 | "item.dragonloot.dragon_hoe": "드래곤 괭이", 15 | "item.dragonloot.dragon_sword": "드래곤 검", 16 | "item.dragonloot.dragon_bow": "드래곤 활", 17 | "item.dragonloot.dragon_crossbow": "드래곤 석궁", 18 | 19 | "item.dragonloot.dragon_horse_armor": "드래곤 말 갑옷", 20 | "item.dragonloot.dragon_trident": "드래곤 삼지창", 21 | "entity.dragonloot.dragon_trident": "드래곤 삼지창", 22 | 23 | "itemGroup.dragonloot.dragonloot": "Dragon Loot", 24 | 25 | "text.autoconfig.dragonloot.title": "DragonLoot 설정", 26 | "text.autoconfig.dragonloot.option.scale_minimum_drop_amount": "비늘 최소 드랍 개수", 27 | "text.autoconfig.dragonloot.option.additional_scales_per_player": "플레이어당 추가 비늘", 28 | "text.autoconfig.dragonloot.option.additional_scale_drop_chance": "추가 비늘 드롭율", 29 | "text.autoconfig.dragonloot.option.dragon_armor_protection_helmet": "드래곤 방어구 헬멧 방어", 30 | "text.autoconfig.dragonloot.option.dragon_armor_protection_chest": "드래곤 방어구 흉갑 방어", 31 | "text.autoconfig.dragonloot.option.dragon_armor_protection_leggings": "드래곤 방어구 레깅스 방어", 32 | "text.autoconfig.dragonloot.option.dragon_armor_protection_boots": "드래곤 방어구 부츠 방어", 33 | "text.autoconfig.dragonloot.option.dragon_armor_durability_multiplier": "드래곤 방어구 내구도 배율", 34 | "text.autoconfig.dragonloot.option.dragon_item_durability_multiplier": "드래곤 아이템 내구도 배율", 35 | "text.autoconfig.dragonloot.option.dragon_item_base_damage": "드래곤 아이템 기본 공격력", 36 | "text.autoconfig.dragonloot.option.dragon_anvil_no_cap": "드래곤 모루 제한 없음", 37 | "text.autoconfig.dragonloot.option.dragon_armor_toughness": "드래곤 방어구 방어 강도", 38 | "text.autoconfig.dragonloot.option.dragon_armor_knockback_resistance": "드래곤 방어구 밀치기 저항", 39 | "text.autoconfig.dragonloot.option.dragon_armor_enchantability": "드래곤 방어구 마법 부여", 40 | "text.autoconfig.dragonloot.option.dragon_tool_enchantability": "드래곤 도구 마법 부여", 41 | 42 | "dragonloot.advancements.dragon_armor.title": "괴수의 비늘을 이용해", 43 | "dragonloot.advancements.dragon_armor.description": "드래곤 방어구 모든 세트를 획득하세요." 44 | } -------------------------------------------------------------------------------- /src/main/java/net/dragonloot/mixin/EnderDragonEntityMixin.java: -------------------------------------------------------------------------------- 1 | package net.dragonloot.mixin; 2 | 3 | import java.util.List; 4 | 5 | import org.spongepowered.asm.mixin.Mixin; 6 | import org.spongepowered.asm.mixin.Shadow; 7 | import org.spongepowered.asm.mixin.injection.Inject; 8 | import org.spongepowered.asm.mixin.injection.callback.CallbackInfo; 9 | import org.spongepowered.asm.mixin.injection.At; 10 | 11 | import net.dragonloot.init.ConfigInit; 12 | import net.dragonloot.init.ItemInit; 13 | import net.minecraft.entity.EntityType; 14 | import net.minecraft.entity.boss.dragon.EnderDragonEntity; 15 | import net.minecraft.entity.mob.MobEntity; 16 | import net.minecraft.entity.player.PlayerEntity; 17 | import net.minecraft.item.ItemStack; 18 | import net.minecraft.predicate.entity.EntityPredicates; 19 | import net.minecraft.util.math.Box; 20 | import net.minecraft.world.World; 21 | 22 | @Mixin(EnderDragonEntity.class) 23 | public abstract class EnderDragonEntityMixin extends MobEntity { 24 | @Shadow 25 | public int ticksSinceDeath; 26 | 27 | public EnderDragonEntityMixin(EntityType entityType, World world) { 28 | super(entityType, world); 29 | } 30 | 31 | @Inject(method = "updatePostDeath", at = @At("HEAD")) 32 | protected void updatePostDeathMixin(CallbackInfo info) { 33 | if (!this.getWorld().isClient() && this.ticksSinceDeath == 150) { 34 | Box box = new Box(this.getBlockPos()); 35 | List list = this.getWorld().getEntitiesByClass(PlayerEntity.class, box.expand(128D), EntityPredicates.EXCEPT_SPECTATOR); 36 | int dragonscalebonus = 0; 37 | for (int i = 0; i < list.size(); ++i) { 38 | PlayerEntity entity = (PlayerEntity) list.get(i); 39 | if (entity instanceof PlayerEntity) { 40 | int dropBonus = ConfigInit.CONFIG.additional_scales_per_player; 41 | dragonscalebonus = dragonscalebonus + dropBonus; 42 | } 43 | } 44 | 45 | for (int i = 0; i < (ConfigInit.CONFIG.scale_minimum_drop_amount); i++) { 46 | this.dropStack(new ItemStack(ItemInit.DRAGON_SCALE_ITEM)); 47 | } 48 | for (int u = 0; u < dragonscalebonus; u++) { 49 | if (this.getWorld().getRandom().nextFloat() <= ConfigInit.CONFIG.additional_scale_drop_chance) { 50 | this.dropStack(new ItemStack(ItemInit.DRAGON_SCALE_ITEM)); 51 | } 52 | 53 | } 54 | } 55 | } 56 | 57 | } -------------------------------------------------------------------------------- /src/main/java/net/dragonloot/init/ModelProviderInit.java: -------------------------------------------------------------------------------- 1 | package net.dragonloot.init; 2 | 3 | import net.minecraft.client.item.ModelPredicateProviderRegistry; 4 | import net.minecraft.item.CrossbowItem; 5 | import net.minecraft.item.Items; 6 | import net.minecraft.util.Identifier; 7 | 8 | public class ModelProviderInit { 9 | 10 | public static void init() { 11 | ModelPredicateProviderRegistry.register(ItemInit.DRAGON_BOW_ITEM, new Identifier("pull"), (stack, world, entity, seed) -> { 12 | if (entity == null) { 13 | return 0.0F; 14 | } else { 15 | return entity.getActiveItem() != stack ? 0.0F : (float) (stack.getMaxUseTime() - entity.getItemUseTimeLeft()) / 20.0F; 16 | } 17 | }); 18 | ModelPredicateProviderRegistry.register(ItemInit.DRAGON_BOW_ITEM, new Identifier("pulling"), (itemStack, clientWorld, livingEntity, seed) -> livingEntity != null && livingEntity.isUsingItem() && livingEntity.getActiveItem() == itemStack ? 1.0F : 0.0F); 19 | ModelPredicateProviderRegistry.register(ItemInit.DRAGON_CROSSBOW_ITEM, new Identifier("pull"), (itemStack, clientWorld, livingEntity, seed) -> { 20 | if (livingEntity == null) { 21 | return 0; 22 | } else 23 | return CrossbowItem.isCharged(itemStack) ? 0.0F : (float) (itemStack.getMaxUseTime() - livingEntity.getItemUseTimeLeft()) / (float) CrossbowItem.getPullTime(itemStack); 24 | }); 25 | ModelPredicateProviderRegistry.register(ItemInit.DRAGON_CROSSBOW_ITEM, new Identifier("pulling"), (itemStack, clientWorld1, livingEntity, seed) -> livingEntity != null && livingEntity.isUsingItem() && livingEntity.getActiveItem() == itemStack && !CrossbowItem.isCharged(itemStack) ? 1.0F : 0.0F); 26 | ModelPredicateProviderRegistry.register(ItemInit.DRAGON_CROSSBOW_ITEM, new Identifier("charged"), (itemStack, clientWorld, livingEntity, seed) -> livingEntity != null && CrossbowItem.isCharged(itemStack) ? 1.0F : 0.0F); 27 | ModelPredicateProviderRegistry.register(ItemInit.DRAGON_CROSSBOW_ITEM, new Identifier("firework"), (itemStack, clientWorld, livingEntity, seed) -> livingEntity != null && CrossbowItem.isCharged(itemStack) && CrossbowItem.hasProjectile(itemStack, Items.FIREWORK_ROCKET) ? 1.0F : 0.0F); 28 | ModelPredicateProviderRegistry.register(ItemInit.DRAGON_TRIDENT_ITEM, new Identifier("throwing"), (itemStack, clientWorld, livingEntity, seed) -> livingEntity != null && livingEntity.isUsingItem() && livingEntity.getActiveItem() == itemStack ? 1.0F : 0.0F); 29 | } 30 | } -------------------------------------------------------------------------------- /src/main/java/net/dragonloot/item/render/DragonChestplateRenderer.java: -------------------------------------------------------------------------------- 1 | // package net.dragonloot.item.render; 2 | 3 | // import net.dragonloot.entity.model.DragonElytraEntityModel; 4 | // import net.dragonloot.init.ItemInit; 5 | // import net.fabricmc.api.Environment; 6 | // import net.fabricmc.api.EnvType; 7 | // import net.minecraft.client.render.OverlayTexture; 8 | // import net.minecraft.client.render.RenderLayer; 9 | // import net.minecraft.client.render.VertexConsumer; 10 | // import net.minecraft.client.render.VertexConsumerProvider; 11 | // import net.minecraft.client.render.entity.feature.FeatureRenderer; 12 | // import net.minecraft.client.render.entity.feature.FeatureRendererContext; 13 | // import net.minecraft.client.render.entity.model.EntityModel; 14 | // import net.minecraft.client.render.item.ItemRenderer; 15 | // import net.minecraft.client.util.math.MatrixStack; 16 | // import net.minecraft.entity.EquipmentSlot; 17 | // import net.minecraft.entity.LivingEntity; 18 | // import net.minecraft.item.ItemStack; 19 | // import net.minecraft.util.Identifier; 20 | 21 | // @Environment(EnvType.CLIENT) 22 | // public class DragonChestplateRenderer> extends FeatureRenderer { 23 | // private final Identifier DRAGON_ELYTRA_TEXTURE = new Identifier("dragonloot:textures/entity/dragon_elytra.png"); 24 | // private final DragonElytraEntityModel dragonElytraModel; 25 | 26 | // public DragonChestplateRenderer(FeatureRendererContext context) { 27 | // super(context); 28 | // this.dragonElytraModel = new DragonElytraEntityModel<>(DragonElytraEntityModel.getTexturedModelData().createModel()); 29 | // } 30 | 31 | // @Override 32 | // public void render(MatrixStack matrixStack, VertexConsumerProvider vertexConsumerProvider, int i, T livingEntity, float f, float g, float h, float j, float k, float l) { 33 | // ItemStack itemStack = livingEntity.getEquippedStack(EquipmentSlot.CHEST); 34 | // if (itemStack.getItem() == ItemInit.UPGRADED_DRAGON_CHESTPLATE) { 35 | // matrixStack.push(); 36 | // matrixStack.translate(0.0D, 0.0D, 0.02D); 37 | // this.getContextModel().copyStateTo(this.dragonElytraModel); 38 | // this.dragonElytraModel.setAngles(livingEntity, f, g, j, k, l); 39 | // VertexConsumer vertexConsumer = ItemRenderer.getArmorGlintConsumer(vertexConsumerProvider, RenderLayer.getArmorCutoutNoCull(DRAGON_ELYTRA_TEXTURE), false, itemStack.hasGlint()); 40 | // this.dragonElytraModel.render(matrixStack, vertexConsumer, i, OverlayTexture.DEFAULT_UV, 1.0F, 1.0F, 1.0F, 1.0F); 41 | // matrixStack.pop(); 42 | // } 43 | // } 44 | 45 | // } 46 | -------------------------------------------------------------------------------- /src/main/resources/assets/dragonloot/lang/en_us.json: -------------------------------------------------------------------------------- 1 | { 2 | "block.dragonloot.dragon_anvil": "Dragon Anvil", 3 | "item.dragonloot.dragon_scale": "Dragon Scale", 4 | 5 | "item.dragonloot.dragon_helmet": "Dragon Scale Helmet", 6 | "item.dragonloot.dragon_chestplate": "Dragon Scale Chestplate", 7 | "item.dragonloot.dragon_leggings": "Dragon Scale Leggings", 8 | "item.dragonloot.dragon_boots": "Dragon Scale Boots", 9 | "item.dragonloot.upgraded_dragon_chestplate": "Winged Dragon Scale Chestplate", 10 | 11 | "item.dragonloot.dragon_pickaxe": "Dragon Pickaxe", 12 | "item.dragonloot.dragon_axe": "Dragon Axe", 13 | "item.dragonloot.dragon_shovel": "Dragon Shovel", 14 | "item.dragonloot.dragon_hoe": "Dragon Hoe", 15 | "item.dragonloot.dragon_sword": "Dragon Sword", 16 | "item.dragonloot.dragon_bow": "Dragon Bow", 17 | "item.dragonloot.dragon_crossbow": "Dragon Crossbow", 18 | 19 | "item.dragonloot.dragon_horse_armor": "Dragon Horse Armor", 20 | "item.dragonloot.dragon_trident": "Dragon Trident", 21 | "entity.dragonloot.dragon_trident": "Dragon Trident", 22 | 23 | "itemGroup.dragonloot.dragonloot": "Dragon Loot", 24 | 25 | "text.autoconfig.dragonloot.title": "DragonLoot Config", 26 | "text.autoconfig.dragonloot.option.scale_minimum_drop_amount": "Scale minimum drop amount", 27 | "text.autoconfig.dragonloot.option.additional_scales_per_player": "Additional scales per player", 28 | "text.autoconfig.dragonloot.option.additional_scale_drop_chance": "Additional scale drop chance", 29 | "text.autoconfig.dragonloot.option.dragon_armor_protection_helmet": "Dragon Armor Helmet Protection", 30 | "text.autoconfig.dragonloot.option.dragon_armor_protection_chest": "Dragon Armor Chestplate Protection", 31 | "text.autoconfig.dragonloot.option.dragon_armor_protection_leggings": "Dragon Armor Leggings Protection", 32 | "text.autoconfig.dragonloot.option.dragon_armor_protection_boots": "Dragon Armor Boots Protection", 33 | "text.autoconfig.dragonloot.option.dragon_armor_durability_multiplier": "Dragon Armor Durability Multiplier", 34 | "text.autoconfig.dragonloot.option.dragon_item_durability_multiplier": "Dragon Item Durability Multiplier", 35 | "text.autoconfig.dragonloot.option.dragon_item_base_damage": "Dragon Item Base Damage", 36 | "text.autoconfig.dragonloot.option.dragon_anvil_no_cap": "Dragon Anvil No Cap", 37 | "text.autoconfig.dragonloot.option.dragon_armor_toughness": "Dragon Armor Toughness", 38 | "text.autoconfig.dragonloot.option.dragon_armor_knockback_resistance": "Dragon Armor Knockback Resistance", 39 | "text.autoconfig.dragonloot.option.dragon_armor_enchantability": "Dragon Armor Enchantability", 40 | 41 | "dragonloot.advancements.dragon_armor.title": "From the scales of the beast", 42 | "dragonloot.advancements.dragon_armor.description": "Get a full suit of Dragon armor" 43 | } -------------------------------------------------------------------------------- /.github/workflows/publish.yml: -------------------------------------------------------------------------------- 1 | name: publish 2 | 3 | on: 4 | workflow_dispatch 5 | 6 | jobs: 7 | build: 8 | runs-on: ubuntu-latest 9 | steps: 10 | - uses: actions/checkout@v2 11 | - name: set up JDK 17 12 | uses: actions/setup-java@v2 13 | with: 14 | distribution: 'adopt-hotspot' 15 | java-version: 17 16 | cache: 'gradle' 17 | 18 | - name: make gradle wrapper executable 19 | run: chmod +x ./gradlew 20 | - name: build files 21 | run: ./gradlew build 22 | 23 | - name: read mod name, mod version and minecraft version 24 | id: properties 25 | uses: christian-draeger/read-properties@1.1.1 26 | with: 27 | path: './gradle.properties' 28 | properties: 'archives_base_name mod_version minecraft_version' 29 | 30 | - uses: Kir-Antipov/mc-publish@v3.3 31 | with: 32 | modrinth-featured: true 33 | modrinth-unfeature-mode: subset 34 | 35 | modrinth-token: ${{ secrets.MODRINTH_TOKEN }} 36 | curseforge-token: ${{ secrets.CURSEFORGE_TOKEN }} 37 | 38 | name: '${{ steps.properties.outputs.archives_base_name }}-${{ steps.properties.outputs.mod_version }}+${{ steps.properties.outputs.minecraft_version }}' 39 | version: '${{ steps.properties.outputs.mod_version }}+${{ steps.properties.outputs.minecraft_version }}' 40 | game-versions: | 41 | ${{ steps.properties.outputs.minecraft_version }} 42 | 43 | version-type: release 44 | version-resolver: exact 45 | 46 | dependencies: | 47 | fabric-api | depends | * 48 | cloth-config | depends | * 49 | 50 | changelog-file: CHANGELOG.md 51 | 52 | retry-attempts: 2 53 | retry-delay: 10000 54 | fail-mode: fail 55 | 56 | - name: read changelog 57 | id: changelog 58 | uses: juliangruber/read-file-action@v1 59 | with: 60 | path: 'CHANGELOG.md' 61 | 62 | - name: discord webhook 63 | uses: tsickert/discord-webhook@v5.3.0 64 | with: 65 | webhook-url: ${{ secrets.WEBHOOK_URL }} 66 | embed-title: "${{ steps.properties.outputs.archives_base_name }} ${{ steps.properties.outputs.mod_version }} for Minecraft ${{ steps.properties.outputs.minecraft_version }} has been released!" 67 | embed-description: "**Changelog**```md\n${{ steps.changelog.outputs.content }}```\n**Downloads**\n<:modrinth:1110118061106798644> https://modrinth.com/mod/${{ steps.properties.outputs.archives_base_name }}\n<:curseforge:1110124796362109028> https://www.curseforge.com/minecraft/mc-mods/${{ steps.properties.outputs.archives_base_name }}" 68 | embed-footer-text: "Have fun and be blessed!" 69 | embed-color: 0xFF8000 70 | -------------------------------------------------------------------------------- /src/main/java/net/dragonloot/item/DragonArmor.java: -------------------------------------------------------------------------------- 1 | package net.dragonloot.item; 2 | 3 | import java.util.UUID; 4 | 5 | import com.google.common.collect.ImmutableMultimap; 6 | import com.google.common.collect.Multimap; 7 | import com.google.common.collect.ImmutableMultimap.Builder; 8 | 9 | import net.minecraft.block.DispenserBlock; 10 | import net.minecraft.entity.EquipmentSlot; 11 | import net.minecraft.entity.attribute.EntityAttribute; 12 | import net.minecraft.entity.attribute.EntityAttributeModifier; 13 | import net.minecraft.entity.attribute.EntityAttributes; 14 | import net.minecraft.item.ArmorItem; 15 | import net.minecraft.item.ArmorMaterial; 16 | 17 | public class DragonArmor extends ArmorItem { 18 | private static final UUID[] MODIFIERS = new UUID[] { UUID.fromString("845DB27C-C624-495F-8C9F-6020A9A58B6B"), UUID.fromString("D8499B04-0E66-4726-AB29-64469D734E0D"), UUID.fromString("9F3D476D-C118-4544-8365-64846904B48E"), UUID.fromString("2AD3F246-FEE1-4E67-B886-69FD380BB150") }; 19 | private final Multimap attributeModifiers; 20 | private final int protection; 21 | private final float toughness; 22 | protected final float knockbackResistance; 23 | protected final EquipmentSlot slot; 24 | protected final ArmorMaterial material; 25 | 26 | public DragonArmor(ArmorMaterial material, ArmorItem.Type type, Settings settings) { 27 | super(material, type, settings); 28 | this.material = material; 29 | this.slot = type.getEquipmentSlot(); 30 | this.protection = material.getProtection(type); 31 | this.toughness = material.getToughness(); 32 | this.knockbackResistance = material.getKnockbackResistance(); 33 | DispenserBlock.registerBehavior(this, DISPENSER_BEHAVIOR); 34 | Builder builder = ImmutableMultimap.builder(); 35 | UUID uUID = MODIFIERS[slot.getEntitySlotId()]; 36 | builder.put(EntityAttributes.GENERIC_ARMOR, new EntityAttributeModifier(uUID, "Armor modifier", (double) this.protection, EntityAttributeModifier.Operation.ADDITION)); 37 | builder.put(EntityAttributes.GENERIC_ARMOR_TOUGHNESS, new EntityAttributeModifier(uUID, "Armor toughness", (double) this.toughness, EntityAttributeModifier.Operation.ADDITION)); 38 | builder.put(EntityAttributes.GENERIC_KNOCKBACK_RESISTANCE, new EntityAttributeModifier(uUID, "Armor knockback resistance", (double) this.knockbackResistance / 10D, EntityAttributeModifier.Operation.ADDITION)); 39 | this.attributeModifiers = builder.build(); 40 | } 41 | 42 | @Override 43 | public Multimap getAttributeModifiers(EquipmentSlot slot) { 44 | return slot == this.slot ? this.attributeModifiers : super.getAttributeModifiers(slot); 45 | } 46 | 47 | } 48 | -------------------------------------------------------------------------------- /src/main/java/net/dragonloot/mixin/client/HeadFeatureRendererMixin.java: -------------------------------------------------------------------------------- 1 | package net.dragonloot.mixin.client; 2 | 3 | import org.spongepowered.asm.mixin.Final; 4 | import org.spongepowered.asm.mixin.Mixin; 5 | import org.spongepowered.asm.mixin.Shadow; 6 | import org.spongepowered.asm.mixin.injection.At; 7 | import org.spongepowered.asm.mixin.injection.Inject; 8 | import org.spongepowered.asm.mixin.injection.callback.CallbackInfo; 9 | 10 | import net.dragonloot.entity.model.DragonHelmetModel; 11 | import net.dragonloot.init.ItemInit; 12 | import net.fabricmc.api.Environment; 13 | import net.fabricmc.api.EnvType; 14 | import net.minecraft.client.render.OverlayTexture; 15 | import net.minecraft.client.render.VertexConsumer; 16 | import net.minecraft.client.render.VertexConsumerProvider; 17 | import net.minecraft.client.render.entity.feature.HeadFeatureRenderer; 18 | import net.minecraft.client.util.math.MatrixStack; 19 | import net.minecraft.entity.EquipmentSlot; 20 | import net.minecraft.entity.LivingEntity; 21 | import net.minecraft.item.ItemStack; 22 | import net.minecraft.util.Identifier; 23 | import net.minecraft.client.render.entity.model.ModelWithHead; 24 | import net.minecraft.client.render.item.ItemRenderer; 25 | 26 | @Environment(EnvType.CLIENT) 27 | @Mixin(HeadFeatureRenderer.class) 28 | public class HeadFeatureRendererMixin { 29 | @Shadow 30 | @Final 31 | private float scaleX; 32 | @Shadow 33 | @Final 34 | private float scaleY; 35 | @Shadow 36 | @Final 37 | private float scaleZ; 38 | 39 | private final DragonHelmetModel dragonHelmetModel = new DragonHelmetModel(DragonHelmetModel.getTexturedModelData().createModel()); 40 | 41 | @SuppressWarnings("rawtypes") 42 | @Inject(method = "render", at = @At("HEAD"), cancellable = true) 43 | private void render(MatrixStack matrixStack, VertexConsumerProvider vertexConsumerProvider, int i, LivingEntity livingEntity, float f, float g, float h, float j, float k, float l, CallbackInfo info) { 44 | ItemStack itemStack = livingEntity.getEquippedStack(EquipmentSlot.HEAD); 45 | if (!(itemStack.isEmpty()) && (itemStack.getItem() == ItemInit.DRAGON_HELMET)) { 46 | matrixStack.push(); 47 | matrixStack.scale(this.scaleX, this.scaleY, this.scaleZ); 48 | ((ModelWithHead) ((HeadFeatureRenderer) (Object) this).getContextModel()).getHead().rotate(matrixStack); 49 | matrixStack.translate(0.0D, -1.75D, 0.0D); 50 | matrixStack.scale(1.19F, 1.19F, 1.19F); 51 | VertexConsumer vertexConsumer = ItemRenderer.getArmorGlintConsumer(vertexConsumerProvider, this.dragonHelmetModel.getLayer(new Identifier("dragonloot", "textures/entity/dragon_helmet_3d.png")), false, itemStack.hasGlint()); 52 | this.dragonHelmetModel.render(matrixStack, vertexConsumer, i, OverlayTexture.DEFAULT_UV, 1.0F, 1.0F, 1.0F, 1.0F); 53 | matrixStack.pop(); 54 | info.cancel(); 55 | } 56 | } 57 | } 58 | -------------------------------------------------------------------------------- /src/main/resources/assets/dragonloot/lang/ru_ru.json: -------------------------------------------------------------------------------- 1 | { 2 | "block.dragonloot.dragon_anvil": "Драконья наковальня", 3 | "item.dragonloot.dragon_scale": "Драконья чешуя", 4 | 5 | "item.dragonloot.dragon_helmet": "Драконий шлем", 6 | "item.dragonloot.dragon_chestplate": "Драконий нагрудник", 7 | "item.dragonloot.dragon_leggings": "Драконьи поножи", 8 | "item.dragonloot.dragon_boots": "Драконьи ботинки", 9 | "item.dragonloot.upgraded_dragon_chestplate": "Улучшенный драконий нагрудник", 10 | 11 | "item.dragonloot.dragon_pickaxe": "Драконья кирка", 12 | "item.dragonloot.dragon_axe": "Драконий топор", 13 | "item.dragonloot.dragon_shovel": "Драконья лопата", 14 | "item.dragonloot.dragon_hoe": "Драконья мотыга", 15 | "item.dragonloot.dragon_sword": "Драконий меч", 16 | "item.dragonloot.dragon_bow": "Драконий лук", 17 | "item.dragonloot.dragon_crossbow": "Драконий арбалет", 18 | 19 | "item.dragonloot.dragon_horse_armor": "Драконья конская броня", 20 | "item.dragonloot.dragon_trident": "Драконий трезубец", 21 | "entity.dragonloot.dragon_trident": "Драконий трезубец", 22 | 23 | "itemGroup.dragonloot.dragonloot": "Драконья добыча", 24 | 25 | "text.autoconfig.dragonloot.title": "Настройка драконьей добычи", 26 | "text.autoconfig.dragonloot.option.scale_minimum_drop_amount": "Минимальное количество выпадающей чешуи", 27 | "text.autoconfig.dragonloot.option.additional_scales_per_player": "Дополнительное число чешуи за каждого игрока", 28 | "text.autoconfig.dragonloot.option.additional_scale_drop_chance": "Дополнительный шанс выпадения чешуи", 29 | "text.autoconfig.dragonloot.option.dragon_armor_protection_helmet": "Защита драконьего шлема", 30 | "text.autoconfig.dragonloot.option.dragon_armor_protection_chest": "Защита драконьего нагрудника", 31 | "text.autoconfig.dragonloot.option.dragon_armor_protection_leggings": "Защита драконьих поножей", 32 | "text.autoconfig.dragonloot.option.dragon_armor_protection_boots": "Защита драконьих ботинок", 33 | "text.autoconfig.dragonloot.option.dragon_armor_durability_multiplier": "Множитель прочности драконьей брони", 34 | "text.autoconfig.dragonloot.option.dragon_item_durability_multiplier": "Множитель прочности драконьих инструментов", 35 | "text.autoconfig.dragonloot.option.dragon_item_base_damage": "Базовый урон драконьих инструментов", 36 | "text.autoconfig.dragonloot.option.dragon_anvil_no_cap": "Драконья наковальня без верхней грани уровней", 37 | "text.autoconfig.dragonloot.option.dragon_armor_toughness": "Твёрдость драконьей брони", 38 | "text.autoconfig.dragonloot.option.dragon_armor_knockback_resistance": "Сопротивление отбрасыванию драконьей брони", 39 | "text.autoconfig.dragonloot.option.dragon_armor_enchantability": "Зачаровываемость драконьей брони", 40 | "text.autoconfig.dragonloot.option.dragon_tool_enchantability": "Зачаровываемость драконьих инструментов", 41 | 42 | "dragonloot.advancements.dragon_armor.title": "Из чешуи зверя", 43 | "dragonloot.advancements.dragon_armor.description": "Соберите полный комплект драконьей брони." 44 | } 45 | -------------------------------------------------------------------------------- /gradlew.bat: -------------------------------------------------------------------------------- 1 | @rem 2 | @rem Copyright 2015 the original author or authors. 3 | @rem 4 | @rem Licensed under the Apache License, Version 2.0 (the "License"); 5 | @rem you may not use this file except in compliance with the License. 6 | @rem You may obtain a copy of the License at 7 | @rem 8 | @rem https://www.apache.org/licenses/LICENSE-2.0 9 | @rem 10 | @rem Unless required by applicable law or agreed to in writing, software 11 | @rem distributed under the License is distributed on an "AS IS" BASIS, 12 | @rem WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | @rem See the License for the specific language governing permissions and 14 | @rem limitations under the License. 15 | @rem 16 | 17 | @if "%DEBUG%" == "" @echo off 18 | @rem ########################################################################## 19 | @rem 20 | @rem Gradle startup script for Windows 21 | @rem 22 | @rem ########################################################################## 23 | 24 | @rem Set local scope for the variables with windows NT shell 25 | if "%OS%"=="Windows_NT" setlocal 26 | 27 | set DIRNAME=%~dp0 28 | if "%DIRNAME%" == "" set DIRNAME=. 29 | set APP_BASE_NAME=%~n0 30 | set APP_HOME=%DIRNAME% 31 | 32 | @rem Resolve any "." and ".." in APP_HOME to make it shorter. 33 | for %%i in ("%APP_HOME%") do set APP_HOME=%%~fi 34 | 35 | @rem Add default JVM options here. You can also use JAVA_OPTS and GRADLE_OPTS to pass JVM options to this script. 36 | set DEFAULT_JVM_OPTS="-Xmx64m" "-Xms64m" 37 | 38 | @rem Find java.exe 39 | if defined JAVA_HOME goto findJavaFromJavaHome 40 | 41 | set JAVA_EXE=java.exe 42 | %JAVA_EXE% -version >NUL 2>&1 43 | if "%ERRORLEVEL%" == "0" goto execute 44 | 45 | echo. 46 | echo ERROR: JAVA_HOME is not set and no 'java' command could be found in your PATH. 47 | echo. 48 | echo Please set the JAVA_HOME variable in your environment to match the 49 | echo location of your Java installation. 50 | 51 | goto fail 52 | 53 | :findJavaFromJavaHome 54 | set JAVA_HOME=%JAVA_HOME:"=% 55 | set JAVA_EXE=%JAVA_HOME%/bin/java.exe 56 | 57 | if exist "%JAVA_EXE%" goto execute 58 | 59 | echo. 60 | echo ERROR: JAVA_HOME is set to an invalid directory: %JAVA_HOME% 61 | echo. 62 | echo Please set the JAVA_HOME variable in your environment to match the 63 | echo location of your Java installation. 64 | 65 | goto fail 66 | 67 | :execute 68 | @rem Setup the command line 69 | 70 | set CLASSPATH=%APP_HOME%\gradle\wrapper\gradle-wrapper.jar 71 | 72 | 73 | @rem Execute Gradle 74 | "%JAVA_EXE%" %DEFAULT_JVM_OPTS% %JAVA_OPTS% %GRADLE_OPTS% "-Dorg.gradle.appname=%APP_BASE_NAME%" -classpath "%CLASSPATH%" org.gradle.wrapper.GradleWrapperMain %* 75 | 76 | :end 77 | @rem End local scope for the variables with windows NT shell 78 | if "%ERRORLEVEL%"=="0" goto mainEnd 79 | 80 | :fail 81 | rem Set variable GRADLE_EXIT_CONSOLE if you need the _script_ return code instead of 82 | rem the _cmd.exe /c_ return code! 83 | if not "" == "%GRADLE_EXIT_CONSOLE%" exit 1 84 | exit /b 1 85 | 86 | :mainEnd 87 | if "%OS%"=="Windows_NT" endlocal 88 | 89 | :omega 90 | -------------------------------------------------------------------------------- /src/main/java/net/dragonloot/mixin/client/ElytraFeatureRendererMixin.java: -------------------------------------------------------------------------------- 1 | package net.dragonloot.mixin.client; 2 | 3 | import org.spongepowered.asm.mixin.Mixin; 4 | import org.spongepowered.asm.mixin.injection.Inject; 5 | import org.spongepowered.asm.mixin.injection.callback.CallbackInfo; 6 | import org.spongepowered.asm.mixin.injection.At; 7 | 8 | import net.dragonloot.entity.model.DragonElytraEntityModel; 9 | import net.dragonloot.init.ItemInit; 10 | import net.fabricmc.api.Environment; 11 | import net.fabricmc.api.EnvType; 12 | import net.minecraft.client.render.OverlayTexture; 13 | import net.minecraft.client.render.RenderLayer; 14 | import net.minecraft.client.render.VertexConsumer; 15 | import net.minecraft.client.render.VertexConsumerProvider; 16 | import net.minecraft.client.render.entity.feature.ElytraFeatureRenderer; 17 | import net.minecraft.client.render.entity.feature.FeatureRenderer; 18 | import net.minecraft.client.render.entity.feature.FeatureRendererContext; 19 | import net.minecraft.client.render.entity.model.EntityModel; 20 | import net.minecraft.client.render.item.ItemRenderer; 21 | import net.minecraft.client.util.math.MatrixStack; 22 | import net.minecraft.entity.EquipmentSlot; 23 | import net.minecraft.entity.LivingEntity; 24 | import net.minecraft.item.ItemStack; 25 | import net.minecraft.util.Identifier; 26 | 27 | @Environment(EnvType.CLIENT) 28 | @Mixin(ElytraFeatureRenderer.class) 29 | public abstract class ElytraFeatureRendererMixin> extends FeatureRenderer { 30 | private static final Identifier DRAGON_ELYTRA_TEXTURE = new Identifier("dragonloot:textures/entity/dragon_elytra.png"); 31 | private final DragonElytraEntityModel dragonElytraModel = new DragonElytraEntityModel<>(DragonElytraEntityModel.getTexturedModelData().createModel()); 32 | 33 | public ElytraFeatureRendererMixin(FeatureRendererContext context) { 34 | super(context); 35 | } 36 | 37 | @Inject(method = "render", at = @At("HEAD"), cancellable = true) 38 | private void render(MatrixStack matrixStack, VertexConsumerProvider vertexConsumerProvider, int i, T livingEntity, float f, float g, float h, float j, float k, float l, CallbackInfo info) { 39 | ItemStack itemStack = livingEntity.getEquippedStack(EquipmentSlot.CHEST); 40 | if (itemStack.getItem() == ItemInit.UPGRADED_DRAGON_CHESTPLATE) { 41 | matrixStack.push(); 42 | matrixStack.translate(0.0D, 0.0D, 0.02D); 43 | this.getContextModel().copyStateTo(this.dragonElytraModel); 44 | this.dragonElytraModel.setAngles(livingEntity, f, g, j, k, l); 45 | VertexConsumer vertexConsumer = ItemRenderer.getArmorGlintConsumer(vertexConsumerProvider, RenderLayer.getArmorCutoutNoCull(DRAGON_ELYTRA_TEXTURE), false, itemStack.hasGlint()); 46 | this.dragonElytraModel.render(matrixStack, vertexConsumer, i, OverlayTexture.DEFAULT_UV, 1.0F, 1.0F, 1.0F, 1.0F); 47 | matrixStack.pop(); 48 | info.cancel(); 49 | } 50 | } 51 | 52 | } 53 | -------------------------------------------------------------------------------- /src/main/resources/assets/dragonloot/lang/pt_br.json: -------------------------------------------------------------------------------- 1 | { 2 | "block.dragonloot.dragon_anvil": "Bigorna de Dragão", 3 | "item.dragonloot.dragon_scale": "Escama de Dragão", 4 | 5 | "item.dragonloot.dragon_helmet": "Capacete de escala de dragão", 6 | "item.dragonloot.dragon_chestplate": "Dragão Escala de Draz rígido", 7 | "item.dragonloot.dragon_leggings": "Leggings de escala de dragão", 8 | "item.dragonloot.dragon_boots": "Botas de escala de dragão", 9 | "item.dragonloot.upgraded_dragon_chestplate": "Dragão alado Placa torácica em escala", 10 | 11 | "item.dragonloot.dragon_pickaxe": "dragonPickaxe", 12 | "item.dragonloot.dragon_axe": "dragonAxe", 13 | "item.dragonloot.dragon_shovel": "dragonShovel", 14 | "item.dragonloot.dragon_hoe": "Estarragão como", 15 | "item.dragonloot.dragon_sword": "dragonSword", 16 | "item.dragonloot.dragon_bow": "Dragon Bow", 17 | "item.dragonloot.dragon_crossbow": "dragonCrossbow", 18 | 19 | "item.dragonloot.dragon_horse_armor": "Armadura de cavalo de dragão", 20 | "item.dragonloot.dragon_trident": "Dragão Trident", 21 | "entity.dragonloot.dragon_trident": "Dragão Trident", 22 | 23 | "itemGroup.dragonloot.dragonloot": "Índice de dragão", 24 | 25 | "text.autoconfig.dragonloot.title": "Dragonloot Config", 26 | "text.autoconfig.dragonloot.option.scale_minimum_drop_amount": "Escala de quantidade mínima de queda", 27 | "text.autoconfig.dragonloot.option.additional_scales_per_player": "Escalas adicionais por jogador", 28 | "text.autoconfig.dragonloot.option.additional_scale_drop_chance": "Chance de gota de escala adicional", 29 | "text.autoconfig.dragonloot.option.dragon_armor_protection_helmet": "Proteção de capacete de armadura de dragão", 30 | "text.autoconfig.dragonloot.option.dragon_armor_protection_chest": "Proteção da placa de peito de armadura de dragão", 31 | "text.autoconfig.dragonloot.option.dragon_armor_protection_leggings": "Proteção de leggings de armadura de dragão", 32 | "text.autoconfig.dragonloot.option.dragon_armor_protection_boots": "Proteção de botas de armadura de dragão", 33 | "text.autoconfig.dragonloot.option.dragon_armor_durability_multiplier": "Multiplicador de durabilidade da armadura de dragão", 34 | "text.autoconfig.dragonloot.option.dragon_item_durability_multiplier": "Multiplicador de durabilidade do item de dragão", 35 | "text.autoconfig.dragonloot.option.dragon_item_base_damage": "Dragão Item Base Dano", 36 | "text.autoconfig.dragonloot.option.dragon_anvil_no_cap": "Dragão Anvil No Cap", 37 | "text.autoconfig.dragonloot.option.dragon_armor_toughness": "Dragon Armour Toguness", 38 | "text.autoconfig.dragonloot.option.dragon_armor_knockback_resistance": "Resistência de Knockback de Armadura de Dragão", 39 | "text.autoconfig.dragonloot.option.dragon_armor_enchantability": "Encantabilidade da Armadura de Dragão", 40 | 41 | "dragonloot.advancements.dragon_armor.title": "Das escalas da besta", 42 | "dragonloot.advancements.dragon_armor.description": "Obtenha um terno completo de armadura de dragão" 43 | } -------------------------------------------------------------------------------- /src/main/resources/assets/dragonloot/models/block/dragon_anvil.json: -------------------------------------------------------------------------------- 1 | { 2 | "credit": "Made with Blockbench", 3 | "texture_size": [32, 32], 4 | "textures": { 5 | "0": "dragonloot:block/dragon_anvil", 6 | "particle": "dragonloot:block/dragon_anvil" 7 | }, 8 | "elements": [ 9 | { 10 | "from": [2, 0, 2], 11 | "to": [14, 4, 14], 12 | "faces": { 13 | "north": {"uv": [6, 0, 12, 2], "texture": "#0"}, 14 | "east": {"uv": [6, 0, 12, 2], "texture": "#0"}, 15 | "south": {"uv": [6, 0, 12, 2], "texture": "#0"}, 16 | "west": {"uv": [6, 0, 12, 2], "texture": "#0"}, 17 | "up": {"uv": [0, 0, 6, 6], "rotation": 90, "texture": "#0"}, 18 | "down": {"uv": [0, 0, 6, 6], "rotation": 270, "texture": "#0"} 19 | } 20 | }, 21 | { 22 | "from": [4, 4, 3], 23 | "to": [12, 5, 13], 24 | "faces": { 25 | "north": {"uv": [11.5, 5.5, 15.5, 6], "texture": "#0"}, 26 | "east": {"uv": [11, 5, 16, 5.5], "texture": "#0"}, 27 | "south": {"uv": [11.5, 5.5, 15.5, 6], "texture": "#0"}, 28 | "west": {"uv": [11, 5, 16, 5.5], "texture": "#0"}, 29 | "up": {"uv": [6, 2, 11, 6], "rotation": 90, "texture": "#0"}, 30 | "down": {"uv": [6, 2, 11, 6], "rotation": 270, "texture": "#0"} 31 | } 32 | }, 33 | { 34 | "from": [6, 5, 4], 35 | "to": [10, 10, 12], 36 | "faces": { 37 | "north": {"uv": [14, 2.5, 16, 5], "texture": "#0"}, 38 | "east": {"uv": [12, 0, 16, 2.5], "texture": "#0"}, 39 | "south": {"uv": [14, 2.5, 16, 5], "texture": "#0"}, 40 | "west": {"uv": [12, 0, 16, 2.5], "texture": "#0"}, 41 | "up": {"uv": [1, 2, 5, 4], "rotation": 90, "texture": "#0"}, 42 | "down": {"uv": [1, 2, 5, 4], "rotation": 270, "texture": "#0"} 43 | } 44 | }, 45 | { 46 | "from": [3, 10, 0], 47 | "to": [13, 16, 16], 48 | "faces": { 49 | "north": {"uv": [0, 10, 5, 13], "texture": "#0"}, 50 | "east": {"uv": [0, 13, 8, 16], "texture": "#0"}, 51 | "south": {"uv": [0, 10, 5, 13], "texture": "#0"}, 52 | "west": {"uv": [0, 13, 8, 16], "texture": "#0"}, 53 | "up": {"uv": [8, 11, 16, 16], "rotation": 90, "texture": "#0"}, 54 | "down": {"uv": [8, 11, 16, 16], "rotation": 270, "texture": "#0"} 55 | } 56 | } 57 | ], 58 | "display": { 59 | "thirdperson_righthand": { 60 | "rotation": [50, 50, 0], 61 | "translation": [-0.5, 1.5, -1.25], 62 | "scale": [0.35, 0.35, 0.35] 63 | }, 64 | "thirdperson_lefthand": { 65 | "rotation": [50, 50, 0], 66 | "translation": [-0.5, 1.5, -1.25], 67 | "scale": [0.35, 0.35, 0.35] 68 | }, 69 | "firstperson_righthand": { 70 | "rotation": [0, -130, 0], 71 | "translation": [0, -0.5, 0.5], 72 | "scale": [0.45, 0.45, 0.45] 73 | }, 74 | "firstperson_lefthand": { 75 | "rotation": [0, -130, 0], 76 | "translation": [0, -0.5, 0.5], 77 | "scale": [0.45, 0.45, 0.45] 78 | }, 79 | "ground": { 80 | "translation": [0, 1.75, 0], 81 | "scale": [0.3, 0.3, 0.3] 82 | }, 83 | "gui": { 84 | "rotation": [31, 50, 0], 85 | "translation": [-0.25, 0, 0], 86 | "scale": [0.65, 0.65, 0.65] 87 | }, 88 | "head": { 89 | "rotation": [0, 90, 0], 90 | "translation": [0, 14.25, 0] 91 | }, 92 | "fixed": { 93 | "rotation": [0, 90, 0], 94 | "scale": [0.5, 0.5, 0.5] 95 | } 96 | } 97 | } -------------------------------------------------------------------------------- /src/main/java/net/dragonloot/compat/recipes/CompatRecipes.java: -------------------------------------------------------------------------------- 1 | package net.dragonloot.compat.recipes; 2 | 3 | import net.dragonloot.DragonLootMain; 4 | import net.fabricmc.loader.api.FabricLoader; 5 | import net.minecraft.util.Identifier; 6 | 7 | public class CompatRecipes { 8 | 9 | private static final Identifier NETHERITE_UPGRADE_TEMPLATE = new Identifier("minecraft:netherite_upgrade_smithing_template"); 10 | 11 | public static void loadRecipes() { 12 | 13 | if (FabricLoader.getInstance().isModLoaded("netherite_plus")) { 14 | RecipeGenerator.SMITHING_RECIPES.put("dragon_horse_armor", new RecipeMaterial(new Identifier("netherite_plus", "netherite_horse_armor"), DragonLootMain.ID("dragon_scale"), "item", "item", DragonLootMain.ID("dragon_horse_armor"), NETHERITE_UPGRADE_TEMPLATE)); 15 | RecipeGenerator.SMITHING_RECIPES.put("dragon_trident", new RecipeMaterial(new Identifier("netherite_plus", "netherite_trident"), DragonLootMain.ID("dragon_scale"), "item", "item", DragonLootMain.ID("dragon_trident"), NETHERITE_UPGRADE_TEMPLATE)); 16 | RecipeGenerator.SMITHING_RECIPES.put("dragon_bow", new RecipeMaterial(new Identifier("netherite_plus", "netherite_bow"), DragonLootMain.ID("dragon_scale"), "item", "item", DragonLootMain.ID("dragon_bow"), NETHERITE_UPGRADE_TEMPLATE)); 17 | RecipeGenerator.SMITHING_RECIPES.put("dragon_crossbow", new RecipeMaterial(new Identifier("netherite_plus", "netherite_crossbow"), DragonLootMain.ID("dragon_scale"), "item", "item", DragonLootMain.ID("dragon_crossbow"), NETHERITE_UPGRADE_TEMPLATE)); 18 | RecipeGenerator.SMITHING_RECIPES.put("upgraded_dragon_chestplate", new RecipeMaterial(new Identifier("dragonloot", "dragon_chestplate"), new Identifier("netherite_plus", "netherite_elytra"), "item", "item", DragonLootMain.ID("upgraded_dragon_chestplate"), NETHERITE_UPGRADE_TEMPLATE)); 19 | } else { 20 | RecipeGenerator.SMITHING_RECIPES.put("dragon_horse_armor", new RecipeMaterial(new Identifier("minecraft", "diamond_horse_armor"), DragonLootMain.ID("dragon_scale"), "item", "item", DragonLootMain.ID("dragon_horse_armor"), NETHERITE_UPGRADE_TEMPLATE)); 21 | RecipeGenerator.SMITHING_RECIPES.put("dragon_trident", new RecipeMaterial(new Identifier("minecraft", "trident"), DragonLootMain.ID("dragon_scale"), "item", "item", DragonLootMain.ID("dragon_trident"), NETHERITE_UPGRADE_TEMPLATE)); 22 | RecipeGenerator.SMITHING_RECIPES.put("dragon_bow", new RecipeMaterial(new Identifier("minecraft", "bow"), DragonLootMain.ID("dragon_scale"), "item", "item", DragonLootMain.ID("dragon_bow"), NETHERITE_UPGRADE_TEMPLATE)); 23 | RecipeGenerator.SMITHING_RECIPES.put("dragon_crossbow", new RecipeMaterial(new Identifier("minecraft", "crossbow"), DragonLootMain.ID("dragon_scale"), "item", "item", DragonLootMain.ID("dragon_crossbow"), NETHERITE_UPGRADE_TEMPLATE)); 24 | RecipeGenerator.SMITHING_RECIPES.put("upgraded_dragon_chestplate", new RecipeMaterial(new Identifier("dragonloot", "dragon_chestplate"), new Identifier("minecraft", "elytra"), "item", "item", DragonLootMain.ID("upgraded_dragon_chestplate"), NETHERITE_UPGRADE_TEMPLATE)); 25 | 26 | } 27 | 28 | } 29 | } 30 | 31 | // {"type":"minecraft:smithing","base":{"item":"dragonloot:dragon_chestplate"},"addition":{"item":"minecraft:elytra"},"result":{"item":"dragonloot:upgraded_dragon_chestplate"}} 32 | -------------------------------------------------------------------------------- /src/main/java/net/dragonloot/mixin/AnvilScreenHandlerMixin.java: -------------------------------------------------------------------------------- 1 | package net.dragonloot.mixin; 2 | 3 | import org.spongepowered.asm.mixin.Mixin; 4 | import org.spongepowered.asm.mixin.Shadow; 5 | import org.spongepowered.asm.mixin.injection.Inject; 6 | import org.spongepowered.asm.mixin.injection.callback.CallbackInfo; 7 | import org.spongepowered.asm.mixin.injection.callback.CallbackInfoReturnable; 8 | 9 | import io.netty.buffer.Unpooled; 10 | 11 | import org.spongepowered.asm.mixin.injection.At; 12 | 13 | import net.dragonloot.access.DragonAnvilInterface; 14 | import net.dragonloot.init.BlockInit; 15 | import net.dragonloot.init.ConfigInit; 16 | import net.dragonloot.network.SyncPacket; 17 | import net.fabricmc.fabric.api.networking.v1.ServerPlayNetworking; 18 | import net.minecraft.block.BlockState; 19 | import net.minecraft.entity.player.PlayerEntity; 20 | import net.minecraft.entity.player.PlayerInventory; 21 | import net.minecraft.item.ItemStack; 22 | import net.minecraft.network.PacketByteBuf; 23 | import net.minecraft.screen.AnvilScreenHandler; 24 | import net.minecraft.screen.ForgingScreenHandler; 25 | import net.minecraft.screen.Property; 26 | import net.minecraft.screen.ScreenHandlerContext; 27 | import net.minecraft.screen.ScreenHandlerType; 28 | import net.minecraft.server.network.ServerPlayerEntity; 29 | 30 | @Mixin(AnvilScreenHandler.class) 31 | public abstract class AnvilScreenHandlerMixin extends ForgingScreenHandler implements DragonAnvilInterface { 32 | @Shadow 33 | private final Property levelCost; 34 | public boolean isDragonAnvil = false; 35 | 36 | public AnvilScreenHandlerMixin(ScreenHandlerType type, int syncId, PlayerInventory playerInventory, ScreenHandlerContext context) { 37 | super(type, syncId, playerInventory, context); 38 | this.levelCost = Property.create(); 39 | } 40 | 41 | @Inject(method = "canUse", at = @At(value = "HEAD")) 42 | private void canUseMixin(BlockState state, CallbackInfoReturnable info) { 43 | if (state.isOf(BlockInit.DRAGON_ANVIL_BLOCK)) { 44 | isDragonAnvil = true; 45 | PacketByteBuf data = new PacketByteBuf(Unpooled.buffer()); 46 | data.writeInt(player.getId()); 47 | data.writeString(state.getBlock().toString()); 48 | ServerPlayNetworking.send((ServerPlayerEntity) player, SyncPacket.ANVIL_SYNC_PACKET, data); 49 | } 50 | } 51 | 52 | @Inject(method = "onTakeOutput", at = @At(value = "INVOKE", target = "Lnet/minecraft/screen/Property;set(I)V"), cancellable = true) 53 | private void onTakeOutputMixin(PlayerEntity player, ItemStack stack, CallbackInfo info) { 54 | if (isDragonAnvil == true) { 55 | this.context.run((world, blockPos) -> { 56 | this.levelCost.set(0); 57 | world.syncWorldEvent(1030, blockPos, 0); 58 | info.cancel(); 59 | }); 60 | } 61 | } 62 | 63 | @Inject(method = "Lnet/minecraft/screen/AnvilScreenHandler;updateResult()V", at = @At(value = "INVOKE", target = "Lnet/minecraft/screen/Property;set(I)V", shift = At.Shift.AFTER)) 64 | private void updateResultMixin(CallbackInfo info) { 65 | if (this.levelCost.get() > 30 && isDragonAnvil == true && ConfigInit.CONFIG.dragon_anvil_no_cap) { 66 | this.levelCost.set(30); 67 | } 68 | } 69 | 70 | @Inject(method = "getLevelCost", at = @At(value = "HEAD"), cancellable = true) 71 | private void getLevelCostMixin(CallbackInfoReturnable info) { 72 | if (this.levelCost.get() > 30 && isDragonAnvil == true && ConfigInit.CONFIG.dragon_anvil_no_cap) { 73 | info.setReturnValue(30); 74 | } 75 | } 76 | 77 | @Override 78 | public void setDragonAnvil(String string) { 79 | if (string.equals(BlockInit.DRAGON_ANVIL_BLOCK.toString())) { 80 | isDragonAnvil = true; 81 | } 82 | } 83 | 84 | } 85 | -------------------------------------------------------------------------------- /src/main/java/net/dragonloot/entity/model/DragonElytraEntityModel.java: -------------------------------------------------------------------------------- 1 | package net.dragonloot.entity.model; 2 | 3 | import com.google.common.collect.ImmutableList; 4 | import net.fabricmc.api.EnvType; 5 | import net.fabricmc.api.Environment; 6 | import net.minecraft.client.model.*; 7 | import net.minecraft.client.network.AbstractClientPlayerEntity; 8 | import net.minecraft.client.render.entity.model.AnimalModel; 9 | import net.minecraft.entity.LivingEntity; 10 | import net.minecraft.util.math.Vec3d; 11 | 12 | @Environment(EnvType.CLIENT) 13 | public class DragonElytraEntityModel extends AnimalModel { 14 | 15 | private final ModelPart rightWing; 16 | private final ModelPart leftWing; 17 | 18 | public DragonElytraEntityModel(ModelPart root) { 19 | this.leftWing = root.getChild("left_wing"); 20 | this.rightWing = root.getChild("right_wing"); 21 | } 22 | 23 | public static TexturedModelData getTexturedModelData() { 24 | ModelData modelData = new ModelData(); 25 | ModelPartData modelPartData = modelData.getRoot(); 26 | Dilation dilation = new Dilation(1.0F); 27 | modelPartData.addChild("left_wing", ModelPartBuilder.create().uv(22, 0).cuboid(-10.0F, 0.0F, 0.0F, 20.0F, 21.0F, 2.0F, dilation), ModelTransform.of(5.0F, 0.0F, 0.0F, 0.2617994F, 0.0F, -0.2617994F)); 28 | modelPartData.addChild("right_wing", ModelPartBuilder.create().uv(22, 0).mirrored().cuboid(-10.0F, 0.0F, 0.0F, 20.0F, 21.0F, 2.0F, dilation), ModelTransform.of(-5.0F, 0.0F, 0.0F, 0.2617994F, 0.0F, 0.2617994F)); 29 | return TexturedModelData.of(modelData, 64, 32); 30 | } 31 | 32 | protected Iterable getHeadParts() { 33 | return ImmutableList.of(); 34 | } 35 | 36 | protected Iterable getBodyParts() { 37 | return ImmutableList.of(this.leftWing, this.rightWing); 38 | } 39 | 40 | public void setAngles(T livingEntity, float f, float g, float h, float i, float j) { 41 | float k = 0.2617994F; 42 | float l = -0.2617994F; 43 | float m = 0.0F; 44 | float n = 0.0F; 45 | if (livingEntity.isFallFlying()) { 46 | float o = 1.0F; 47 | Vec3d vec3d = livingEntity.getVelocity(); 48 | if (vec3d.y < 0.0D) { 49 | Vec3d vec3d2 = vec3d.normalize(); 50 | o = 1.0F - (float) Math.pow(-vec3d2.y, 1.5D); 51 | } 52 | 53 | k = o * 0.34906584F + (1.0F - o) * k; 54 | l = o * -1.5707964F + (1.0F - o) * l; 55 | } else if (livingEntity.isInSneakingPose()) { 56 | k = 0.6981317F; 57 | l = -0.7853982F; 58 | m = 3.0F; 59 | n = 0.08726646F; 60 | } 61 | 62 | this.leftWing.pivotY = m; 63 | if (livingEntity instanceof AbstractClientPlayerEntity) { 64 | AbstractClientPlayerEntity abstractClientPlayerEntity = (AbstractClientPlayerEntity) livingEntity; 65 | abstractClientPlayerEntity.elytraPitch = (float) ((double) abstractClientPlayerEntity.elytraPitch + (double) (k - abstractClientPlayerEntity.elytraPitch) * 0.1D); 66 | abstractClientPlayerEntity.elytraYaw = (float) ((double) abstractClientPlayerEntity.elytraYaw + (double) (n - abstractClientPlayerEntity.elytraYaw) * 0.1D); 67 | abstractClientPlayerEntity.elytraRoll = (float) ((double) abstractClientPlayerEntity.elytraRoll + (double) (l - abstractClientPlayerEntity.elytraRoll) * 0.1D); 68 | this.leftWing.pitch = abstractClientPlayerEntity.elytraPitch; 69 | this.leftWing.yaw = abstractClientPlayerEntity.elytraYaw; 70 | this.leftWing.roll = abstractClientPlayerEntity.elytraRoll; 71 | } else { 72 | this.leftWing.pitch = k; 73 | this.leftWing.roll = l; 74 | this.leftWing.yaw = n; 75 | } 76 | 77 | this.rightWing.yaw = -this.leftWing.yaw; 78 | this.rightWing.pivotY = this.leftWing.pivotY; 79 | this.rightWing.pitch = this.leftWing.pitch; 80 | this.rightWing.roll = -this.leftWing.roll; 81 | } 82 | } 83 | -------------------------------------------------------------------------------- /src/main/java/net/dragonloot/init/ItemInit.java: -------------------------------------------------------------------------------- 1 | package net.dragonloot.init; 2 | 3 | import net.dragonloot.DragonLootMain; 4 | import net.dragonloot.compat.recipes.CompatRecipes; 5 | import net.dragonloot.compat.recipes.RecipeGenerator; 6 | import net.dragonloot.item.*; 7 | import net.fabricmc.fabric.api.itemgroup.v1.FabricItemGroup; 8 | import net.fabricmc.fabric.api.itemgroup.v1.ItemGroupEvents; 9 | import net.minecraft.item.*; 10 | import net.minecraft.registry.Registries; 11 | import net.minecraft.registry.Registry; 12 | import net.minecraft.registry.RegistryKey; 13 | import net.minecraft.registry.RegistryKeys; 14 | import net.minecraft.text.Text; 15 | import net.minecraft.util.Identifier; 16 | 17 | public class ItemInit { 18 | 19 | public static final RegistryKey DRAGON_ITEM_GROUP = RegistryKey.of(RegistryKeys.ITEM_GROUP, DragonLootMain.ID("dragonloot")); 20 | 21 | // Items 22 | public static final Item DRAGON_SCALE_ITEM = register("dragon_scale", new DragonScaleItem(new Item.Settings().fireproof())); 23 | public static final Item DRAGON_HORSE_ARMOR_ITEM = register("dragon_horse_armor", new HorseArmorItem(18, "dragon", new Item.Settings().maxCount(1).fireproof())); 24 | // Armor 25 | public static final ArmorMaterial DRAGON_ARMOR_MATERIAL = DragonArmorMaterial.getInstance(); 26 | 27 | public static final Item DRAGON_HELMET = register("dragon_helmet", new DragonArmor(DRAGON_ARMOR_MATERIAL, ArmorItem.Type.HELMET, new Item.Settings().fireproof())); 28 | public static final Item DRAGON_CHESTPLATE = register("dragon_chestplate", new DragonArmor(DRAGON_ARMOR_MATERIAL, ArmorItem.Type.CHESTPLATE, new Item.Settings().fireproof())); 29 | public static final Item DRAGON_LEGGINGS = register("dragon_leggings", new DragonArmor(DRAGON_ARMOR_MATERIAL, ArmorItem.Type.LEGGINGS, new Item.Settings().fireproof())); 30 | public static final Item DRAGON_BOOTS = register("dragon_boots", new DragonArmor(DRAGON_ARMOR_MATERIAL, ArmorItem.Type.BOOTS, new Item.Settings().fireproof())); 31 | public static final Item UPGRADED_DRAGON_CHESTPLATE = register("upgraded_dragon_chestplate", new DragonArmor(DRAGON_ARMOR_MATERIAL, ArmorItem.Type.CHESTPLATE, new Item.Settings().fireproof())); 32 | 33 | // Tools 34 | public static final Item DRAGON_PICKAXE_ITEM = register("dragon_pickaxe", new DragonPickaxeItem(DragonToolMaterial.getInstance(), 1, -2.8f, new Item.Settings().fireproof())); 35 | public static final Item DRAGON_AXE_ITEM = register("dragon_axe", new DragonAxeItem(DragonToolMaterial.getInstance(), 5, -3f, new Item.Settings().fireproof())); 36 | public static final Item DRAGON_SHOVEL_ITEM = register("dragon_shovel", new DragonShovelItem(DragonToolMaterial.getInstance(), 1.5f, -3f, new Item.Settings().fireproof())); 37 | public static final Item DRAGON_HOE_ITEM = register("dragon_hoe", new DragonHoeItem(DragonToolMaterial.getInstance(), -4, -2f, new Item.Settings().fireproof())); 38 | 39 | // Weapons 40 | public static final Item DRAGON_SWORD_ITEM = register("dragon_sword", new DragonSwordItem(DragonToolMaterial.getInstance(), 3, -2.4f, new Item.Settings().fireproof())); 41 | public static final Item DRAGON_BOW_ITEM = register("dragon_bow", new DragonBowItem(new Item.Settings().fireproof().maxDamage(DragonToolMaterial.getInstance().getDurability()))); 42 | public static final Item DRAGON_CROSSBOW_ITEM = register("dragon_crossbow", new DragonCrossbowItem(new Item.Settings().fireproof().maxDamage(DragonToolMaterial.getInstance().getDurability()))); 43 | public static final Item DRAGON_TRIDENT_ITEM = register("dragon_trident", new DragonTridentItem(new Item.Settings().maxDamage(DragonToolMaterial.getInstance().getDurability()).fireproof())); 44 | 45 | private static Item register(String id, Item item) { 46 | return register(DragonLootMain.ID(id), item); 47 | } 48 | 49 | private static Item register(Identifier id, Item item) { 50 | ItemGroupEvents.modifyEntriesEvent(DRAGON_ITEM_GROUP).register(entries -> entries.add(item)); 51 | return Registry.register(Registries.ITEM, id, item); 52 | } 53 | 54 | public static void init() { 55 | Registry.register(Registries.ITEM_GROUP, DRAGON_ITEM_GROUP, FabricItemGroup.builder().entries((context, entries) -> entries.add(BlockInit.DRAGON_ANVIL_BLOCK)).icon(() -> new ItemStack(ItemInit.DRAGON_SCALE_ITEM)).displayName(Text.translatable("itemGroup.dragonloot.dragonloot")).build()); 56 | 57 | CompatRecipes.loadRecipes(); 58 | RecipeGenerator.addRecipes(); 59 | } 60 | } 61 | -------------------------------------------------------------------------------- /src/main/java/net/dragonloot/mixin/client/ItemRendererMixin.java: -------------------------------------------------------------------------------- 1 | package net.dragonloot.mixin.client; 2 | 3 | import net.minecraft.client.render.model.json.ModelTransformationMode; 4 | import org.jetbrains.annotations.Nullable; 5 | import org.spongepowered.asm.mixin.Mixin; 6 | import org.spongepowered.asm.mixin.Shadow; 7 | import org.spongepowered.asm.mixin.injection.At; 8 | import org.spongepowered.asm.mixin.injection.Inject; 9 | import org.spongepowered.asm.mixin.injection.callback.CallbackInfo; 10 | import org.spongepowered.asm.mixin.injection.callback.CallbackInfoReturnable; 11 | 12 | import net.dragonloot.init.ItemInit; 13 | import net.dragonloot.item.render.DragonTridentItemRenderer; 14 | import net.dragonloot.mixin.access.ItemRendererAccess; 15 | import net.fabricmc.api.Environment; 16 | import net.fabricmc.api.EnvType; 17 | import net.minecraft.client.render.RenderLayer; 18 | import net.minecraft.client.render.RenderLayers; 19 | import net.minecraft.client.render.VertexConsumer; 20 | import net.minecraft.client.render.VertexConsumerProvider; 21 | import net.minecraft.client.render.item.ItemModels; 22 | import net.minecraft.client.render.item.ItemRenderer; 23 | import net.minecraft.client.render.model.BakedModel; 24 | import net.minecraft.client.render.model.BakedModelManager; 25 | import net.minecraft.client.util.ModelIdentifier; 26 | import net.minecraft.client.util.math.MatrixStack; 27 | import net.minecraft.client.world.ClientWorld; 28 | import net.minecraft.entity.LivingEntity; 29 | import net.minecraft.item.Item; 30 | import net.minecraft.item.ItemStack; 31 | import net.minecraft.world.World; 32 | 33 | @Environment(EnvType.CLIENT) 34 | @Mixin(ItemRenderer.class) 35 | public abstract class ItemRendererMixin { 36 | @Shadow 37 | private final ItemModels models; 38 | 39 | public ItemRendererMixin(BakedModelManager baker) { 40 | this.models = new ItemModels(baker); 41 | } 42 | 43 | @Inject(method = "renderItem(Lnet/minecraft/item/ItemStack;Lnet/minecraft/client/render/model/json/ModelTransformationMode;ZLnet/minecraft/client/util/math/MatrixStack;Lnet/minecraft/client/render/VertexConsumerProvider;IILnet/minecraft/client/render/model/BakedModel;)V", at = @At(value = "HEAD"), cancellable = true) 44 | public void renderItem(ItemStack stack, ModelTransformationMode renderMode, boolean leftHanded, MatrixStack matrices, VertexConsumerProvider vertexConsumers, int light, int overlay, BakedModel model, CallbackInfo ci) { 45 | if (!stack.isEmpty() && stack.getItem() == ItemInit.DRAGON_TRIDENT_ITEM) { 46 | matrices.push(); 47 | boolean bl = renderMode == ModelTransformationMode.GUI || renderMode == ModelTransformationMode.GROUND || renderMode == ModelTransformationMode.FIXED; 48 | if (stack.getItem() == ItemInit.DRAGON_TRIDENT_ITEM && bl) { 49 | model = ((ItemRendererAccess) this).getModelsInvoker().getModelManager().getModel(new ModelIdentifier("dragonloot", "dragon_trident", "inventory")); 50 | } 51 | 52 | model.getTransformation().getTransformation(renderMode).apply(leftHanded, matrices); 53 | matrices.translate(-0.5D, -0.5D, -0.5D); 54 | if (model.isBuiltin() || stack.getItem() == ItemInit.DRAGON_TRIDENT_ITEM && !bl) { 55 | DragonTridentItemRenderer.render(stack, renderMode, matrices, vertexConsumers, light, overlay); 56 | } else { 57 | RenderLayer renderLayer = RenderLayers.getItemLayer(stack, true); 58 | VertexConsumer vertexConsumer4; 59 | vertexConsumer4 = ItemRenderer.getDirectItemGlintConsumer(vertexConsumers, renderLayer, true, stack.hasGlint()); 60 | 61 | ((ItemRendererAccess) this).renderBakedItemModelInvoker(model, stack, light, overlay, matrices, vertexConsumer4); 62 | } 63 | 64 | matrices.pop(); 65 | ci.cancel(); 66 | } 67 | } 68 | 69 | @Inject(method = "getModel", at = @At(value = "HEAD"), cancellable = true) 70 | public void getHeldItemModelMixin(ItemStack stack, @Nullable World world, @Nullable LivingEntity entity, int seed, CallbackInfoReturnable info) { 71 | Item item = stack.getItem(); 72 | BakedModel bakedModel2; 73 | if (item == ItemInit.DRAGON_TRIDENT_ITEM) { 74 | bakedModel2 = this.models.getModelManager().getModel(ItemRenderer.TRIDENT_IN_HAND); 75 | ClientWorld clientWorld = world instanceof ClientWorld ? (ClientWorld) world : null; 76 | BakedModel bakedModel3 = bakedModel2.getOverrides().apply(bakedModel2, stack, clientWorld, entity, seed); 77 | info.setReturnValue(bakedModel3 == null ? this.models.getModelManager().getMissingModel() : bakedModel3); 78 | } 79 | 80 | } 81 | } 82 | -------------------------------------------------------------------------------- /src/main/java/net/dragonloot/item/DragonTridentItem.java: -------------------------------------------------------------------------------- 1 | package net.dragonloot.item; 2 | 3 | import net.dragonloot.entity.DragonTridentEntity; 4 | import net.dragonloot.init.ConfigInit; 5 | import net.minecraft.enchantment.EnchantmentHelper; 6 | import net.minecraft.entity.LivingEntity; 7 | import net.minecraft.entity.MovementType; 8 | import net.minecraft.entity.attribute.EntityAttributes; 9 | import net.minecraft.entity.player.PlayerEntity; 10 | import net.minecraft.entity.projectile.PersistentProjectileEntity; 11 | import net.minecraft.item.ItemStack; 12 | import net.minecraft.item.TridentItem; 13 | import net.minecraft.sound.SoundCategory; 14 | import net.minecraft.sound.SoundEvent; 15 | import net.minecraft.sound.SoundEvents; 16 | import net.minecraft.stat.Stats; 17 | import net.minecraft.util.Hand; 18 | import net.minecraft.util.TypedActionResult; 19 | import net.minecraft.util.math.MathHelper; 20 | import net.minecraft.util.math.Vec3d; 21 | import net.minecraft.world.World; 22 | 23 | public class DragonTridentItem extends TridentItem { 24 | 25 | public DragonTridentItem(Settings settings) { 26 | super(settings); 27 | attributeModifiers.get(EntityAttributes.GENERIC_ATTACK_DAMAGE).forEach(modifier -> { 28 | modifier.value = modifier.getValue() + ConfigInit.CONFIG.dragon_item_base_damage / 5F; 29 | }); 30 | } 31 | 32 | @Override 33 | public void onStoppedUsing(ItemStack stack, World world, LivingEntity user, int remainingUseTicks) { 34 | if (user instanceof PlayerEntity) { 35 | PlayerEntity playerEntity = (PlayerEntity) user; 36 | int i = getMaxUseTime(stack) - remainingUseTicks; 37 | if (i >= 10) { 38 | int riptideLevel = EnchantmentHelper.getRiptide(stack); 39 | if (riptideLevel <= 0 || playerEntity.isTouchingWaterOrRain() || playerEntity.isInLava()) { 40 | if (!world.isClient) { 41 | stack.damage(1, playerEntity, (p) -> { 42 | p.sendToolBreakStatus(user.getActiveHand()); 43 | }); 44 | if (riptideLevel == 0) { 45 | DragonTridentEntity tridentEntity = new DragonTridentEntity(world, playerEntity, stack); 46 | tridentEntity.setVelocity(playerEntity, playerEntity.getPitch(), playerEntity.getYaw(), 0.0F, 2.5F + riptideLevel * 0.5F, 1.0F); 47 | if (playerEntity.isCreative()) { 48 | tridentEntity.pickupType = PersistentProjectileEntity.PickupPermission.CREATIVE_ONLY; 49 | } 50 | 51 | world.spawnEntity(tridentEntity); 52 | world.playSoundFromEntity(null, tridentEntity, SoundEvents.ITEM_TRIDENT_THROW, SoundCategory.PLAYERS, 1.0F, 1.0F); 53 | if (!playerEntity.isCreative()) { 54 | playerEntity.getInventory().removeOne(stack); 55 | } 56 | } 57 | } 58 | 59 | playerEntity.incrementStat(Stats.USED.getOrCreateStat(this)); 60 | if (riptideLevel > 0) { 61 | float f = playerEntity.getYaw(); 62 | float g = playerEntity.getPitch(); 63 | float h = -MathHelper.sin(f * 0.017453292F) * MathHelper.cos(g * 0.017453292F); 64 | float k = -MathHelper.sin(g * 0.017453292F); 65 | float l = MathHelper.cos(f * 0.017453292F) * MathHelper.cos(g * 0.017453292F); 66 | float m = MathHelper.sqrt(h * h + k * k + l * l); 67 | float n = 3.0F * ((1.0F + riptideLevel) / 4.0F); 68 | h *= n / m; 69 | k *= n / m; 70 | l *= n / m; 71 | playerEntity.addVelocity(h, k, l); 72 | playerEntity.useRiptide(20); 73 | if (playerEntity.isOnGround()) { 74 | float o = 1.1999999F; 75 | playerEntity.move(MovementType.SELF, new Vec3d(0.0D, o, 0.0D)); 76 | } 77 | 78 | SoundEvent soundEvent3; 79 | if (riptideLevel >= 3) { 80 | soundEvent3 = SoundEvents.ITEM_TRIDENT_RIPTIDE_3; 81 | } else if (riptideLevel == 2) { 82 | soundEvent3 = SoundEvents.ITEM_TRIDENT_RIPTIDE_2; 83 | } else { 84 | soundEvent3 = SoundEvents.ITEM_TRIDENT_RIPTIDE_1; 85 | } 86 | 87 | world.playSoundFromEntity(null, playerEntity, soundEvent3, SoundCategory.PLAYERS, 1.0F, 1.0F); 88 | 89 | } 90 | 91 | } 92 | } 93 | } 94 | } 95 | 96 | @Override 97 | public TypedActionResult use(World world, PlayerEntity user, Hand hand) { 98 | ItemStack itemStack = user.getStackInHand(hand); 99 | if (itemStack.getDamage() >= itemStack.getMaxDamage() - 1) { 100 | return TypedActionResult.fail(itemStack); 101 | } else if (EnchantmentHelper.getRiptide(itemStack) > 0 && !(user.isTouchingWaterOrRain() || user.isInLava())) { 102 | return TypedActionResult.fail(itemStack); 103 | } else { 104 | user.setCurrentHand(hand); 105 | return TypedActionResult.consume(itemStack); 106 | } 107 | } 108 | } 109 | -------------------------------------------------------------------------------- /src/main/java/net/dragonloot/mixin/client/HeldItemRendererMixin.java: -------------------------------------------------------------------------------- 1 | package net.dragonloot.mixin.client; 2 | 3 | import com.google.common.annotations.VisibleForTesting; 4 | import net.minecraft.client.network.ClientPlayerEntity; 5 | import net.minecraft.client.render.model.json.ModelTransformationMode; 6 | import net.minecraft.item.Items; 7 | import org.spongepowered.asm.mixin.Mixin; 8 | import org.spongepowered.asm.mixin.Shadow; 9 | import org.spongepowered.asm.mixin.injection.Inject; 10 | import org.spongepowered.asm.mixin.injection.ModifyVariable; 11 | import org.spongepowered.asm.mixin.injection.callback.CallbackInfo; 12 | import org.spongepowered.asm.mixin.injection.At; 13 | 14 | import net.fabricmc.api.Environment; 15 | import net.dragonloot.init.ItemInit; 16 | import net.dragonloot.item.DragonCrossbowItem; 17 | import net.fabricmc.api.EnvType; 18 | import net.minecraft.client.MinecraftClient; 19 | import net.minecraft.client.network.AbstractClientPlayerEntity; 20 | import net.minecraft.client.render.VertexConsumerProvider; 21 | import net.minecraft.client.render.item.HeldItemRenderer; 22 | import net.minecraft.client.render.model.json.ModelTransformation; 23 | import net.minecraft.client.util.math.MatrixStack; 24 | import net.minecraft.entity.LivingEntity; 25 | import net.minecraft.item.CrossbowItem; 26 | import net.minecraft.item.ItemStack; 27 | import net.minecraft.util.Arm; 28 | import net.minecraft.util.Hand; 29 | import net.minecraft.util.math.MathHelper; 30 | import net.minecraft.util.math.RotationAxis; 31 | 32 | @SuppressWarnings("unused") 33 | @Environment(EnvType.CLIENT) 34 | @Mixin(HeldItemRenderer.class) 35 | public class HeldItemRendererMixin { 36 | 37 | @Shadow 38 | private final MinecraftClient client; 39 | 40 | public HeldItemRendererMixin(MinecraftClient client) { 41 | this.client = client; 42 | } 43 | 44 | // To do: Crossbow render fix 45 | 46 | // @ModifyVariable(method = 47 | // "renderItem(FLnet/minecraft/client/util/math/MatrixStack;Lnet/minecraft/client/render/VertexConsumerProvider$Immediate;Lnet/minecraft/client/network/ClientPlayerEntity;I)V", 48 | // at = @At(value = "INVOKE", target = 49 | // "Lnet/minecraft/client/util/math/MatrixStack;multiply(Lnet/minecraft/util/math/Quaternion;)V"), 50 | // index = -1,print = true) 51 | // private boolean renderItemMixinOne(boolean original) { 52 | // if (client.player.getOffHandStack().getItem() == 53 | // ItemInit.DRAGON_CROSSBOW_ITEM) { 54 | // return false; 55 | // } else 56 | // return original; 57 | // } 58 | // 59 | // @ModifyVariable(method = 60 | // "Lnet/minecraft/client/render/item/HeldItemRenderer;renderItem(FLnet/minecraft/client/util/math/MatrixStack;Lnet/minecraft/client/render/VertexConsumerProvider$Immediate;Lnet/minecraft/client/network/ClientPlayerEntity;I)V", 61 | // at = @At(value = "INVOKE_ASSIGN", target = 62 | // "Lnet/minecraft/client/network/ClientPlayerEntity;getMainHandStack()Lnet/minecraft/item/ItemStack;"), 63 | // ordinal = 0) 64 | // private boolean renderItemMixinTwo(boolean original) { 65 | // if (client.player.getOffHandStack().getItem() == 66 | // ItemInit.DRAGON_CROSSBOW_ITEM 67 | // && DragonCrossbowItem.isCharged(client.player.getOffHandStack())) { 68 | // return !client.player.getMainHandStack().isEmpty(); 69 | // } else 70 | // return original; 71 | // } 72 | 73 | // @ModifyVariable(method = "getHandRenderType", at = @At(value = "RETURN"), 74 | // index = -1,print = true) 75 | // private static void getHandRenderTypeMixin(ClientPlayerEntity player, 76 | // CallbackInfoReturnable info) { 77 | // HeldItemRenderer.HandRenderType.RENDER_BOTH_HANDS; 78 | //// ItemStack itemStack = player.getMainHandStack(); 79 | //// ItemStack itemStack2 = player.getOffHandStack(); 80 | //// boolean bl = itemStack.isOf(Items.BOW) || itemStack2.isOf(Items.BOW); 81 | //// boolean bl2 = itemStack.isOf(Items.CROSSBOW) || 82 | // itemStack2.isOf(Items.CROSSBOW); 83 | //// if (!bl && !bl2) { 84 | //// return HeldItemRenderer.HandRenderType.RENDER_BOTH_HANDS; 85 | //// } else if (player.isUsingItem()) { 86 | //// return getUsingItemHandRenderType(player); 87 | //// } else { 88 | //// return isChargedCrossbow(itemStack) ? 89 | // HeldItemRenderer.HandRenderType.RENDER_MAIN_HAND_ONLY : 90 | // HeldItemRenderer.HandRenderType.RENDER_BOTH_HANDS; 91 | //// } 92 | // } 93 | 94 | @Inject(method = "renderFirstPersonItem", at = @At(value = "HEAD"), cancellable = true) 95 | private void renderFirstPersonItemMixin(AbstractClientPlayerEntity player, float tickDelta, float pitch, Hand hand, float swingProgress, ItemStack item, float equipProgress, MatrixStack matrices, VertexConsumerProvider vertexConsumers, int light, CallbackInfo info) { 96 | 97 | if (item.getItem() == ItemInit.DRAGON_CROSSBOW_ITEM) { 98 | matrices.push(); 99 | 100 | boolean bl = hand == Hand.MAIN_HAND; 101 | Arm arm = bl ? player.getMainArm() : player.getMainArm().getOpposite(); 102 | boolean bl4 = CrossbowItem.isCharged(item); 103 | boolean bl3 = arm == Arm.RIGHT; 104 | int i = bl3 ? 1 : -1; 105 | float x; 106 | float y; 107 | float w; 108 | float v; 109 | if (player.isUsingItem() && player.getItemUseTimeLeft() > 0 && player.getActiveHand() == hand) { 110 | this.applyEquipOffset(matrices, arm, equipProgress); 111 | matrices.translate((double) ((float) i * -0.4785682F), -0.0943870022892952D, 0.05731530860066414D); 112 | matrices.multiply(RotationAxis.POSITIVE_X.rotationDegrees(-11.935F)); 113 | matrices.multiply(RotationAxis.POSITIVE_Y.rotationDegrees((float) i * 65.3F)); 114 | matrices.multiply(RotationAxis.POSITIVE_Z.rotationDegrees((float) i * -9.785F)); 115 | v = (float) item.getMaxUseTime() - ((float) this.client.player.getItemUseTimeLeft() - tickDelta + 1.0F); 116 | w = v / (float) CrossbowItem.getPullTime(item); 117 | 118 | if (w > 1.0F) { 119 | w = 1.0F; 120 | } 121 | 122 | if (w > 0.1F) { 123 | x = MathHelper.sin((v - 0.1F) * 1.3F); 124 | y = w - 0.1F; 125 | float k = x * y; 126 | matrices.translate((double) (k * 0.0F), (double) (k * 0.004F), (double) (k * 0.0F)); 127 | } 128 | 129 | matrices.translate((double) (w * 0.0F), (double) (w * 0.0F), (double) (w * 0.04F)); 130 | matrices.scale(1.0F, 1.0F, 1.0F + w * 0.2F); 131 | matrices.multiply(RotationAxis.NEGATIVE_Y.rotationDegrees((float) i * 45.0F)); 132 | } else { 133 | v = -0.4F * MathHelper.sin(MathHelper.sqrt(swingProgress) * 3.1415927F); 134 | w = 0.2F * MathHelper.sin(MathHelper.sqrt(swingProgress) * 6.2831855F); 135 | x = -0.2F * MathHelper.sin(swingProgress * 3.1415927F); 136 | matrices.translate((double) ((float) i * v), (double) w, (double) x); 137 | this.applyEquipOffset(matrices, arm, equipProgress); 138 | this.applySwingOffset(matrices, arm, swingProgress); 139 | if (bl4 && swingProgress < 0.001F) { 140 | matrices.translate((double) ((float) i * -0.641864F), 0.0D, 0.0D); 141 | matrices.multiply(RotationAxis.POSITIVE_Y.rotationDegrees((float) i * 10.0F)); 142 | } 143 | } 144 | 145 | this.renderItem(player, item, bl3 ? ModelTransformationMode.FIRST_PERSON_RIGHT_HAND : ModelTransformationMode.FIRST_PERSON_LEFT_HAND, !bl3, matrices, vertexConsumers, light); 146 | matrices.pop(); 147 | info.cancel(); 148 | } 149 | } 150 | 151 | @Shadow 152 | public void renderItem(LivingEntity entity, ItemStack stack, ModelTransformationMode renderMode, boolean leftHanded, MatrixStack matrices, VertexConsumerProvider vertexConsumers, int light) { 153 | } 154 | 155 | @Shadow 156 | private void applyEquipOffset(MatrixStack matrices, Arm arm, float equipProgress) { 157 | } 158 | 159 | @Shadow 160 | private void applySwingOffset(MatrixStack matrices, Arm arm, float swingProgress) { 161 | } 162 | 163 | } 164 | -------------------------------------------------------------------------------- /gradlew: -------------------------------------------------------------------------------- 1 | #!/bin/sh 2 | 3 | # 4 | # Copyright © 2015-2021 the original authors. 5 | # 6 | # Licensed under the Apache License, Version 2.0 (the "License"); 7 | # you may not use this file except in compliance with the License. 8 | # You may obtain a copy of the License at 9 | # 10 | # https://www.apache.org/licenses/LICENSE-2.0 11 | # 12 | # Unless required by applicable law or agreed to in writing, software 13 | # distributed under the License is distributed on an "AS IS" BASIS, 14 | # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 15 | # See the License for the specific language governing permissions and 16 | # limitations under the License. 17 | # 18 | 19 | ############################################################################## 20 | # 21 | # Gradle start up script for POSIX generated by Gradle. 22 | # 23 | # Important for running: 24 | # 25 | # (1) You need a POSIX-compliant shell to run this script. If your /bin/sh is 26 | # noncompliant, but you have some other compliant shell such as ksh or 27 | # bash, then to run this script, type that shell name before the whole 28 | # command line, like: 29 | # 30 | # ksh Gradle 31 | # 32 | # Busybox and similar reduced shells will NOT work, because this script 33 | # requires all of these POSIX shell features: 34 | # * functions; 35 | # * expansions «$var», «${var}», «${var:-default}», «${var+SET}», 36 | # «${var#prefix}», «${var%suffix}», and «$( cmd )»; 37 | # * compound commands having a testable exit status, especially «case»; 38 | # * various built-in commands including «command», «set», and «ulimit». 39 | # 40 | # Important for patching: 41 | # 42 | # (2) This script targets any POSIX shell, so it avoids extensions provided 43 | # by Bash, Ksh, etc; in particular arrays are avoided. 44 | # 45 | # The "traditional" practice of packing multiple parameters into a 46 | # space-separated string is a well documented source of bugs and security 47 | # problems, so this is (mostly) avoided, by progressively accumulating 48 | # options in "$@", and eventually passing that to Java. 49 | # 50 | # Where the inherited environment variables (DEFAULT_JVM_OPTS, JAVA_OPTS, 51 | # and GRADLE_OPTS) rely on word-splitting, this is performed explicitly; 52 | # see the in-line comments for details. 53 | # 54 | # There are tweaks for specific operating systems such as AIX, CygWin, 55 | # Darwin, MinGW, and NonStop. 56 | # 57 | # (3) This script is generated from the Groovy template 58 | # https://github.com/gradle/gradle/blob/master/subprojects/plugins/src/main/resources/org/gradle/api/internal/plugins/unixStartScript.txt 59 | # within the Gradle project. 60 | # 61 | # You can find Gradle at https://github.com/gradle/gradle/. 62 | # 63 | ############################################################################## 64 | 65 | # Attempt to set APP_HOME 66 | 67 | # Resolve links: $0 may be a link 68 | app_path=$0 69 | 70 | # Need this for daisy-chained symlinks. 71 | while 72 | APP_HOME=${app_path%"${app_path##*/}"} # leaves a trailing /; empty if no leading path 73 | [ -h "$app_path" ] 74 | do 75 | ls=$( ls -ld "$app_path" ) 76 | link=${ls#*' -> '} 77 | case $link in #( 78 | /*) app_path=$link ;; #( 79 | *) app_path=$APP_HOME$link ;; 80 | esac 81 | done 82 | 83 | APP_HOME=$( cd "${APP_HOME:-./}" && pwd -P ) || exit 84 | 85 | APP_NAME="Gradle" 86 | APP_BASE_NAME=${0##*/} 87 | 88 | # Add default JVM options here. You can also use JAVA_OPTS and GRADLE_OPTS to pass JVM options to this script. 89 | DEFAULT_JVM_OPTS='"-Xmx64m" "-Xms64m"' 90 | 91 | # Use the maximum available, or set MAX_FD != -1 to use that value. 92 | MAX_FD=maximum 93 | 94 | warn () { 95 | echo "$*" 96 | } >&2 97 | 98 | die () { 99 | echo 100 | echo "$*" 101 | echo 102 | exit 1 103 | } >&2 104 | 105 | # OS specific support (must be 'true' or 'false'). 106 | cygwin=false 107 | msys=false 108 | darwin=false 109 | nonstop=false 110 | case "$( uname )" in #( 111 | CYGWIN* ) cygwin=true ;; #( 112 | Darwin* ) darwin=true ;; #( 113 | MSYS* | MINGW* ) msys=true ;; #( 114 | NONSTOP* ) nonstop=true ;; 115 | esac 116 | 117 | CLASSPATH=$APP_HOME/gradle/wrapper/gradle-wrapper.jar 118 | 119 | 120 | # Determine the Java command to use to start the JVM. 121 | if [ -n "$JAVA_HOME" ] ; then 122 | if [ -x "$JAVA_HOME/jre/sh/java" ] ; then 123 | # IBM's JDK on AIX uses strange locations for the executables 124 | JAVACMD=$JAVA_HOME/jre/sh/java 125 | else 126 | JAVACMD=$JAVA_HOME/bin/java 127 | fi 128 | if [ ! -x "$JAVACMD" ] ; then 129 | die "ERROR: JAVA_HOME is set to an invalid directory: $JAVA_HOME 130 | 131 | Please set the JAVA_HOME variable in your environment to match the 132 | location of your Java installation." 133 | fi 134 | else 135 | JAVACMD=java 136 | which java >/dev/null 2>&1 || die "ERROR: JAVA_HOME is not set and no 'java' command could be found in your PATH. 137 | 138 | Please set the JAVA_HOME variable in your environment to match the 139 | location of your Java installation." 140 | fi 141 | 142 | # Increase the maximum file descriptors if we can. 143 | if ! "$cygwin" && ! "$darwin" && ! "$nonstop" ; then 144 | case $MAX_FD in #( 145 | max*) 146 | MAX_FD=$( ulimit -H -n ) || 147 | warn "Could not query maximum file descriptor limit" 148 | esac 149 | case $MAX_FD in #( 150 | '' | soft) :;; #( 151 | *) 152 | ulimit -n "$MAX_FD" || 153 | warn "Could not set maximum file descriptor limit to $MAX_FD" 154 | esac 155 | fi 156 | 157 | # Collect all arguments for the java command, stacking in reverse order: 158 | # * args from the command line 159 | # * the main class name 160 | # * -classpath 161 | # * -D...appname settings 162 | # * --module-path (only if needed) 163 | # * DEFAULT_JVM_OPTS, JAVA_OPTS, and GRADLE_OPTS environment variables. 164 | 165 | # For Cygwin or MSYS, switch paths to Windows format before running java 166 | if "$cygwin" || "$msys" ; then 167 | APP_HOME=$( cygpath --path --mixed "$APP_HOME" ) 168 | CLASSPATH=$( cygpath --path --mixed "$CLASSPATH" ) 169 | 170 | JAVACMD=$( cygpath --unix "$JAVACMD" ) 171 | 172 | # Now convert the arguments - kludge to limit ourselves to /bin/sh 173 | for arg do 174 | if 175 | case $arg in #( 176 | -*) false ;; # don't mess with options #( 177 | /?*) t=${arg#/} t=/${t%%/*} # looks like a POSIX filepath 178 | [ -e "$t" ] ;; #( 179 | *) false ;; 180 | esac 181 | then 182 | arg=$( cygpath --path --ignore --mixed "$arg" ) 183 | fi 184 | # Roll the args list around exactly as many times as the number of 185 | # args, so each arg winds up back in the position where it started, but 186 | # possibly modified. 187 | # 188 | # NB: a `for` loop captures its iteration list before it begins, so 189 | # changing the positional parameters here affects neither the number of 190 | # iterations, nor the values presented in `arg`. 191 | shift # remove old arg 192 | set -- "$@" "$arg" # push replacement arg 193 | done 194 | fi 195 | 196 | # Collect all arguments for the java command; 197 | # * $DEFAULT_JVM_OPTS, $JAVA_OPTS, and $GRADLE_OPTS can contain fragments of 198 | # shell script including quotes and variable substitutions, so put them in 199 | # double quotes to make sure that they get re-expanded; and 200 | # * put everything else in single quotes, so that it's not re-expanded. 201 | 202 | set -- \ 203 | "-Dorg.gradle.appname=$APP_BASE_NAME" \ 204 | -classpath "$CLASSPATH" \ 205 | org.gradle.wrapper.GradleWrapperMain \ 206 | "$@" 207 | 208 | # Use "xargs" to parse quoted args. 209 | # 210 | # With -n1 it outputs one arg per line, with the quotes and backslashes removed. 211 | # 212 | # In Bash we could simply go: 213 | # 214 | # readarray ARGS < <( xargs -n1 <<<"$var" ) && 215 | # set -- "${ARGS[@]}" "$@" 216 | # 217 | # but POSIX shell has neither arrays nor command substitution, so instead we 218 | # post-process each arg (as a line of input to sed) to backslash-escape any 219 | # character that might be a shell metacharacter, then use eval to reverse 220 | # that process (while maintaining the separation between arguments), and wrap 221 | # the whole thing up as a single "set" statement. 222 | # 223 | # This will of course break if any of these variables contains a newline or 224 | # an unmatched quote. 225 | # 226 | 227 | eval "set -- $( 228 | printf '%s\n' "$DEFAULT_JVM_OPTS $JAVA_OPTS $GRADLE_OPTS" | 229 | xargs -n1 | 230 | sed ' s~[^-[:alnum:]+,./:=@_]~\\&~g; ' | 231 | tr '\n' ' ' 232 | )" '"$@"' 233 | 234 | exec "$JAVACMD" "$@" 235 | -------------------------------------------------------------------------------- /src/main/java/net/dragonloot/entity/DragonTridentEntity.java: -------------------------------------------------------------------------------- 1 | package net.dragonloot.entity; 2 | 3 | import net.dragonloot.init.EntityInit; 4 | import net.dragonloot.init.ItemInit; 5 | 6 | import net.fabricmc.api.EnvType; 7 | import net.fabricmc.api.Environment; 8 | import net.minecraft.enchantment.EnchantmentHelper; 9 | import net.minecraft.entity.Entity; 10 | import net.minecraft.entity.EntityType; 11 | import net.minecraft.entity.LightningEntity; 12 | import net.minecraft.entity.LivingEntity; 13 | import net.minecraft.entity.damage.DamageSource; 14 | import net.minecraft.entity.data.DataTracker; 15 | import net.minecraft.entity.data.TrackedData; 16 | import net.minecraft.entity.data.TrackedDataHandlerRegistry; 17 | import net.minecraft.entity.player.PlayerEntity; 18 | import net.minecraft.entity.projectile.PersistentProjectileEntity; 19 | import net.minecraft.item.ItemStack; 20 | import net.minecraft.nbt.NbtCompound; 21 | import net.minecraft.server.network.ServerPlayerEntity; 22 | import net.minecraft.server.world.ServerWorld; 23 | import net.minecraft.sound.SoundEvent; 24 | import net.minecraft.sound.SoundEvents; 25 | import net.minecraft.util.hit.EntityHitResult; 26 | import net.minecraft.util.math.BlockPos; 27 | import net.minecraft.util.math.Vec3d; 28 | import net.minecraft.world.World; 29 | import org.jetbrains.annotations.Nullable; 30 | 31 | public class DragonTridentEntity extends PersistentProjectileEntity { 32 | private static final TrackedData LOYALTY; 33 | private static final TrackedData ENCHANTED; 34 | private ItemStack tridentStack; 35 | private boolean dealtDamage; 36 | public int returnTimer; 37 | 38 | public DragonTridentEntity(EntityType entityType, World world) { 39 | super(entityType, world); 40 | this.tridentStack = new ItemStack(ItemInit.DRAGON_TRIDENT_ITEM); 41 | } 42 | 43 | public DragonTridentEntity(World world, LivingEntity owner, ItemStack stack) { 44 | super(EntityInit.DRAGONTRIDENT_ENTITY, owner, world); 45 | this.tridentStack = new ItemStack(ItemInit.DRAGON_TRIDENT_ITEM); 46 | this.tridentStack = stack.copy(); 47 | this.dataTracker.set(LOYALTY, (byte) EnchantmentHelper.getLoyalty(stack)); 48 | this.dataTracker.set(ENCHANTED, stack.hasGlint()); 49 | } 50 | 51 | @Environment(EnvType.CLIENT) 52 | public DragonTridentEntity(World world, double x, double y, double z) { 53 | super(EntityInit.DRAGONTRIDENT_ENTITY, x, y, z, world); 54 | this.tridentStack = new ItemStack(ItemInit.DRAGON_TRIDENT_ITEM); 55 | } 56 | 57 | @Override 58 | protected void initDataTracker() { 59 | super.initDataTracker(); 60 | this.dataTracker.startTracking(LOYALTY, (byte) 0); 61 | this.dataTracker.startTracking(ENCHANTED, false); 62 | } 63 | 64 | @Override 65 | public void tick() { 66 | if (this.inGroundTime > 4) { 67 | this.dealtDamage = true; 68 | } 69 | 70 | Entity entity = this.getOwner(); 71 | if ((this.dealtDamage || this.isNoClip()) && entity != null) { 72 | int i = (Byte) this.dataTracker.get(LOYALTY); 73 | if (i > 0 && !this.isOwnerAlive()) { 74 | if (!this.getWorld().isClient() && this.pickupType == PersistentProjectileEntity.PickupPermission.ALLOWED) { 75 | this.dropStack(this.asItemStack(), 0.1F); 76 | } 77 | 78 | this.discard(); 79 | } else if (i > 0) { 80 | this.setNoClip(true); 81 | Vec3d vec3d = new Vec3d(entity.getX() - this.getX(), entity.getEyeY() - this.getY(), entity.getZ() - this.getZ()); 82 | this.setPos(this.getX(), this.getY() + vec3d.y * 0.015D * (double) i, this.getZ()); 83 | if (this.getWorld().isClient()) { 84 | this.lastRenderY = this.getY(); 85 | } 86 | 87 | double d = 0.05D * (double) i; 88 | this.setVelocity(this.getVelocity().multiply(0.95D).add(vec3d.normalize().multiply(d))); 89 | if (this.returnTimer == 0) { 90 | this.playSound(SoundEvents.ITEM_TRIDENT_RETURN, 10.0F, 1.0F); 91 | } 92 | 93 | ++this.returnTimer; 94 | } 95 | } 96 | 97 | super.tick(); 98 | } 99 | 100 | private boolean isOwnerAlive() { 101 | Entity entity = this.getOwner(); 102 | if (entity != null && entity.isAlive()) { 103 | return !(entity instanceof ServerPlayerEntity) || !entity.isSpectator(); 104 | } else { 105 | return false; 106 | } 107 | } 108 | 109 | @Override 110 | protected ItemStack asItemStack() { 111 | return this.tridentStack.copy(); 112 | } 113 | 114 | @Environment(EnvType.CLIENT) 115 | public boolean isEnchanted() { 116 | return (Boolean) this.dataTracker.get(ENCHANTED); 117 | } 118 | 119 | @Override 120 | @Nullable 121 | protected EntityHitResult getEntityCollision(Vec3d currentPosition, Vec3d nextPosition) { 122 | return this.dealtDamage ? null : super.getEntityCollision(currentPosition, nextPosition); 123 | } 124 | 125 | @Override 126 | protected void onEntityHit(EntityHitResult entityHitResult) { 127 | Entity entity = entityHitResult.getEntity(); 128 | float f = 8.0F; 129 | if (entity instanceof LivingEntity) { 130 | LivingEntity livingEntity = (LivingEntity) entity; 131 | f += EnchantmentHelper.getAttackDamage(this.tridentStack, livingEntity.getGroup()); 132 | } 133 | 134 | Entity entity2 = this.getOwner(); 135 | World world = entity.getWorld(); 136 | DamageSource damageSource = world.getDamageSources().trident(this, (Entity) (entity2 == null ? this : entity2)); 137 | this.dealtDamage = true; 138 | SoundEvent soundEvent = SoundEvents.ITEM_TRIDENT_HIT; 139 | if (entity.damage(damageSource, f)) { 140 | if (entity.getType() == EntityType.ENDERMAN) { 141 | return; 142 | } 143 | 144 | if (entity instanceof LivingEntity) { 145 | LivingEntity livingEntity2 = (LivingEntity) entity; 146 | if (entity2 instanceof LivingEntity) { 147 | EnchantmentHelper.onUserDamaged(livingEntity2, entity2); 148 | EnchantmentHelper.onTargetDamaged((LivingEntity) entity2, livingEntity2); 149 | } 150 | 151 | this.onHit(livingEntity2); 152 | } 153 | } 154 | 155 | this.setVelocity(this.getVelocity().multiply(-0.01D, -0.1D, -0.01D)); 156 | float g = 1.0F; 157 | if (this.getWorld() instanceof ServerWorld && this.getWorld().isThundering() && EnchantmentHelper.hasChanneling(this.tridentStack)) { 158 | BlockPos blockPos = entity.getBlockPos(); 159 | if (this.getWorld().isSkyVisible(blockPos)) { 160 | LightningEntity lightningEntity = (LightningEntity) EntityType.LIGHTNING_BOLT.create(this.getWorld()); 161 | lightningEntity.refreshPositionAfterTeleport(Vec3d.ofBottomCenter(blockPos)); 162 | lightningEntity.setChanneler(entity2 instanceof ServerPlayerEntity ? (ServerPlayerEntity) entity2 : null); 163 | this.getWorld().spawnEntity(lightningEntity); 164 | soundEvent = SoundEvents.ITEM_TRIDENT_THUNDER; 165 | g = 5.0F; 166 | } 167 | } 168 | 169 | this.playSound(soundEvent, g, 1.0F); 170 | } 171 | 172 | @Override 173 | protected SoundEvent getHitSound() { 174 | return SoundEvents.ITEM_TRIDENT_HIT_GROUND; 175 | } 176 | 177 | @Override 178 | public void onPlayerCollision(PlayerEntity player) { 179 | Entity entity = this.getOwner(); 180 | if (entity == null || entity.getUuid() == player.getUuid()) { 181 | super.onPlayerCollision(player); 182 | } 183 | } 184 | 185 | @Override 186 | public void readCustomDataFromNbt(NbtCompound tag) { 187 | super.readCustomDataFromNbt(tag); 188 | if (tag.contains("Dragon_Trident", 10)) { 189 | this.tridentStack = ItemStack.fromNbt(tag.getCompound("Dragon_Trident")); 190 | } 191 | 192 | this.dealtDamage = tag.getBoolean("DealtDamage"); 193 | this.dataTracker.set(LOYALTY, (byte) EnchantmentHelper.getLoyalty(this.tridentStack)); 194 | } 195 | 196 | @Override 197 | public void writeCustomDataToNbt(NbtCompound tag) { 198 | super.writeCustomDataToNbt(tag); 199 | tag.put("Dragon_Trident", this.tridentStack.writeNbt(new NbtCompound())); 200 | tag.putBoolean("DealtDamage", this.dealtDamage); 201 | } 202 | 203 | @Override 204 | public void age() { 205 | int i = (Byte) this.dataTracker.get(LOYALTY); 206 | if (this.pickupType != PersistentProjectileEntity.PickupPermission.ALLOWED || i <= 0) { 207 | super.age(); 208 | } 209 | 210 | } 211 | 212 | @Override 213 | protected float getDragInWater() { 214 | return 0.99F; 215 | } 216 | 217 | @Override 218 | @Environment(EnvType.CLIENT) 219 | public boolean shouldRender(double cameraX, double cameraY, double cameraZ) { 220 | return true; 221 | } 222 | 223 | static { 224 | LOYALTY = DataTracker.registerData(DragonTridentEntity.class, TrackedDataHandlerRegistry.BYTE); 225 | ENCHANTED = DataTracker.registerData(DragonTridentEntity.class, TrackedDataHandlerRegistry.BOOLEAN); 226 | } 227 | } 228 | --------------------------------------------------------------------------------