From 8560eb444ea5a44d977321721315d3205d0d678a Mon Sep 17 00:00:00 2001 From: cheaterpaul Date: Thu, 14 Mar 2024 13:36:59 +0100 Subject: [PATCH] move different crossbow arrows into arrow behaviors - craft special arrows with oils now there are the following arrows: - normal - bleeding - garlic - spitfire - teleport - vampire killer --- .../api/items/IVampirismCrossbowArrow.java | 56 +++++++ .../models/item/crossbow_arrow_bleeding.json | 3 + .../models/item/crossbow_arrow_garlic.json | 3 + .../weapontable/bleeding_arrow_1.json} | 4 +- .../weapontable/bleeding_arrow_2.json} | 16 +- .../recipes/weapontable/bleeding_arrow_3.json | 41 +++++ .../recipes/weapontable/garlic_arrow_1.json | 41 +++++ .../recipes/weapontable/garlic_arrow_2.json | 41 +++++ .../recipes/weapontable/garlic_arrow_3.json | 41 +++++ .../recipes/weapontable/spitfire_arrow_1.json | 41 +++++ .../recipes/weapontable/spitfire_arrow_2.json | 41 +++++ .../recipes/weapontable/spitfire_arrow_3.json | 41 +++++ .../weapontable/vampire_killer_arrow_1.json | 41 +++++ .../weapontable/vampire_killer_arrow_2.json | 41 +++++ .../weapontable/vampire_killer_arrow_3.json | 41 +++++ .../minecraft/recipes/bleeding_arrow_1.json | 19 +++ .../minecraft/recipes/bleeding_arrow_2.json | 23 +++ .../minecraft/recipes/bleeding_arrow_3.json | 26 +++ .../minecraft/recipes/garlic_arrow_1.json | 19 +++ .../minecraft/recipes/garlic_arrow_2.json | 23 +++ .../minecraft/recipes/garlic_arrow_3.json | 26 +++ .../minecraft/recipes/spitfire_arrow_1.json | 19 +++ .../minecraft/recipes/spitfire_arrow_2.json | 23 +++ .../recipes/spitfire_arrow_3.json} | 5 +- .../recipes/vampire_killer_arrow_1.json | 19 +++ .../recipes/vampire_killer_arrow_2.json | 23 +++ .../recipes/vampire_killer_arrow_3.json | 26 +++ .../recipes/alchemy_table/bleeding_oil.json | 34 ++++ .../recipes/alchemy_table/garlic_oil.json | 34 ++++ .../recipes/alchemy_table/spitfire_oil.json | 34 ++++ .../alchemy_table/vampire_killer_oil.json | 21 +++ .../data/vampirism/recipes/bleeding_oil.json | 19 +++ .../crossbow_arrow_vampire_killer.json | 29 ---- .../data/vampirism/recipes/garlic_oil.json | 19 +++ .../data/vampirism/recipes/spitfire_oil.json | 19 +++ .../vampirism/recipes/vampire_killer_oil.json | 19 +++ .../vampirism/tags/items/crossbow_arrow.json | 5 +- .../vampirism/client/core/ModItemsRender.java | 4 +- .../de/teamlapen/vampirism/core/ModItems.java | 11 +- .../de/teamlapen/vampirism/core/ModOils.java | 4 + .../data/provider/ItemModelGenerator.java | 2 + .../data/provider/RecipesProvider.java | 19 ++- .../vampirism/data/provider/TagProvider.java | 2 +- .../vampirism/entity/CrossbowArrowEntity.java | 8 +- .../vampirism/items/CrossbowArrowItem.java | 154 ++++-------------- .../crossbow/arrow/BleedingBehavior.java | 47 ++++++ .../items/crossbow/arrow/GarlicBehavior.java | 44 +++++ .../items/crossbow/arrow/NormalBehavior.java | 42 +++++ .../crossbow/arrow/SpitfireBehavior.java | 71 ++++++++ .../crossbow/arrow/TeleportBehavior.java | 66 ++++++++ .../crossbow/arrow/VampireKillerBehavior.java | 60 +++++++ .../vampirism/misc/VampirismCreativeTab.java | 2 + .../mixin/accessor/EntityAccessor.java | 4 + .../de/teamlapen/vampirism/util/Helper.java | 3 +- .../assets/vampirism/lang/en_us.json | 12 +- 55 files changed, 1351 insertions(+), 180 deletions(-) create mode 100644 src/generated/resources/assets/vampirism/models/item/crossbow_arrow_bleeding.json create mode 100644 src/generated/resources/assets/vampirism/models/item/crossbow_arrow_garlic.json rename src/generated/resources/data/{vampirism/advancements/recipes/weapontable/crossbow_arrow_spitfire.json => minecraft/advancements/recipes/weapontable/bleeding_arrow_1.json} (88%) rename src/generated/resources/data/{vampirism/advancements/recipes/weapontable/crossbow_arrow_vampire_killer.json => minecraft/advancements/recipes/weapontable/bleeding_arrow_2.json} (67%) create mode 100644 src/generated/resources/data/minecraft/advancements/recipes/weapontable/bleeding_arrow_3.json create mode 100644 src/generated/resources/data/minecraft/advancements/recipes/weapontable/garlic_arrow_1.json create mode 100644 src/generated/resources/data/minecraft/advancements/recipes/weapontable/garlic_arrow_2.json create mode 100644 src/generated/resources/data/minecraft/advancements/recipes/weapontable/garlic_arrow_3.json create mode 100644 src/generated/resources/data/minecraft/advancements/recipes/weapontable/spitfire_arrow_1.json create mode 100644 src/generated/resources/data/minecraft/advancements/recipes/weapontable/spitfire_arrow_2.json create mode 100644 src/generated/resources/data/minecraft/advancements/recipes/weapontable/spitfire_arrow_3.json create mode 100644 src/generated/resources/data/minecraft/advancements/recipes/weapontable/vampire_killer_arrow_1.json create mode 100644 src/generated/resources/data/minecraft/advancements/recipes/weapontable/vampire_killer_arrow_2.json create mode 100644 src/generated/resources/data/minecraft/advancements/recipes/weapontable/vampire_killer_arrow_3.json create mode 100644 src/generated/resources/data/minecraft/recipes/bleeding_arrow_1.json create mode 100644 src/generated/resources/data/minecraft/recipes/bleeding_arrow_2.json create mode 100644 src/generated/resources/data/minecraft/recipes/bleeding_arrow_3.json create mode 100644 src/generated/resources/data/minecraft/recipes/garlic_arrow_1.json create mode 100644 src/generated/resources/data/minecraft/recipes/garlic_arrow_2.json create mode 100644 src/generated/resources/data/minecraft/recipes/garlic_arrow_3.json create mode 100644 src/generated/resources/data/minecraft/recipes/spitfire_arrow_1.json create mode 100644 src/generated/resources/data/minecraft/recipes/spitfire_arrow_2.json rename src/generated/resources/data/{vampirism/recipes/crossbow_arrow_spitfire.json => minecraft/recipes/spitfire_arrow_3.json} (74%) create mode 100644 src/generated/resources/data/minecraft/recipes/vampire_killer_arrow_1.json create mode 100644 src/generated/resources/data/minecraft/recipes/vampire_killer_arrow_2.json create mode 100644 src/generated/resources/data/minecraft/recipes/vampire_killer_arrow_3.json create mode 100644 src/generated/resources/data/vampirism/advancements/recipes/alchemy_table/bleeding_oil.json create mode 100644 src/generated/resources/data/vampirism/advancements/recipes/alchemy_table/garlic_oil.json create mode 100644 src/generated/resources/data/vampirism/advancements/recipes/alchemy_table/spitfire_oil.json create mode 100644 src/generated/resources/data/vampirism/advancements/recipes/alchemy_table/vampire_killer_oil.json create mode 100644 src/generated/resources/data/vampirism/recipes/bleeding_oil.json delete mode 100644 src/generated/resources/data/vampirism/recipes/crossbow_arrow_vampire_killer.json create mode 100644 src/generated/resources/data/vampirism/recipes/garlic_oil.json create mode 100644 src/generated/resources/data/vampirism/recipes/spitfire_oil.json create mode 100644 src/generated/resources/data/vampirism/recipes/vampire_killer_oil.json create mode 100644 src/main/java/de/teamlapen/vampirism/items/crossbow/arrow/BleedingBehavior.java create mode 100644 src/main/java/de/teamlapen/vampirism/items/crossbow/arrow/GarlicBehavior.java create mode 100644 src/main/java/de/teamlapen/vampirism/items/crossbow/arrow/NormalBehavior.java create mode 100644 src/main/java/de/teamlapen/vampirism/items/crossbow/arrow/SpitfireBehavior.java create mode 100644 src/main/java/de/teamlapen/vampirism/items/crossbow/arrow/TeleportBehavior.java create mode 100644 src/main/java/de/teamlapen/vampirism/items/crossbow/arrow/VampireKillerBehavior.java diff --git a/src/api/java/de/teamlapen/vampirism/api/items/IVampirismCrossbowArrow.java b/src/api/java/de/teamlapen/vampirism/api/items/IVampirismCrossbowArrow.java index 562c68ffdd..c96272fac6 100644 --- a/src/api/java/de/teamlapen/vampirism/api/items/IVampirismCrossbowArrow.java +++ b/src/api/java/de/teamlapen/vampirism/api/items/IVampirismCrossbowArrow.java @@ -3,13 +3,19 @@ import de.teamlapen.vampirism.api.VReference; import de.teamlapen.vampirism.api.entity.factions.IFaction; import net.minecraft.core.BlockPos; +import net.minecraft.core.Direction; +import net.minecraft.network.chat.Component; import net.minecraft.world.entity.Entity; import net.minecraft.world.entity.LivingEntity; import net.minecraft.world.entity.projectile.AbstractArrow; import net.minecraft.world.item.ItemStack; +import net.minecraft.world.item.TooltipFlag; +import net.minecraft.world.level.Level; import org.jetbrains.annotations.NotNull; import org.jetbrains.annotations.Nullable; +import java.util.List; + public interface IVampirismCrossbowArrow extends IFactionExclusiveItem { @Nullable @@ -18,9 +24,59 @@ default IFaction getExclusiveFaction(@NotNull ItemStack stack) { return VReference.HUNTER_FACTION; } + /** + * @return If an arrow of this type can be used in an infinite crossbow + */ boolean isCanBeInfinite(); + /** + * Called when the {@link IVampirismCrossbowArrow} hits a block + * + * @param arrow The itemstack of the shot arrow + * @param blockPos The position of the hit block + * @param arrowEntity The arrow entity + * @param shootingEntity The shooting entity. Can be the arrow entity itself + */ void onHitBlock(ItemStack arrow, BlockPos blockPos, IEntityCrossbowArrow arrowEntity, @Nullable Entity shootingEntity); + default void onHitBlock(ItemStack arrow, BlockPos blockPos, IEntityCrossbowArrow arrowEntity, @Nullable Entity shootingEntity, Direction direction) { + onHitBlock(arrow, blockPos, arrowEntity, shootingEntity); + } + + /** + * Called when the {@link IVampirismCrossbowArrow} hits an entity + * + * @param arrow The itemstack of the shot arrow + * @param entity The hit entity + * @param arrowEntity The arrow entity + * @param shootingEntity The shooting entity. Can be the arrow entity itself + */ void onHitEntity(ItemStack arrow, LivingEntity entity, IEntityCrossbowArrow arrowEntity, Entity shootingEntity); + + interface ICrossbowArrowBehavior { + + int color(); + + default void onHitEntity(ItemStack arrow, LivingEntity entity, AbstractArrow arrowEntity, Entity shootingEntity) { + + } + + default void onHitBlock(ItemStack arrow, @NotNull BlockPos blockPos, AbstractArrow arrowEntity, @Nullable Entity shootingEntity, Direction up) { + + } + + void appendHoverText(ItemStack itemStack, @Nullable Level world, List textComponents, TooltipFlag tooltipFlag); + + boolean canBeInfinite(); + + default AbstractArrow.Pickup pickupBehavior() { + return AbstractArrow.Pickup.CREATIVE_ONLY; + } + + float baseDamage(@NotNull Level level, @NotNull ItemStack stack, @Nullable LivingEntity shooter); + + default void modifyArrow(@NotNull Level level, @NotNull ItemStack stack, @Nullable LivingEntity shooter, @NotNull AbstractArrow arrow) { + + } + } } diff --git a/src/generated/resources/assets/vampirism/models/item/crossbow_arrow_bleeding.json b/src/generated/resources/assets/vampirism/models/item/crossbow_arrow_bleeding.json new file mode 100644 index 0000000000..ae8d214883 --- /dev/null +++ b/src/generated/resources/assets/vampirism/models/item/crossbow_arrow_bleeding.json @@ -0,0 +1,3 @@ +{ + "parent": "vampirism:item/crossbow_arrow" +} \ No newline at end of file diff --git a/src/generated/resources/assets/vampirism/models/item/crossbow_arrow_garlic.json b/src/generated/resources/assets/vampirism/models/item/crossbow_arrow_garlic.json new file mode 100644 index 0000000000..ae8d214883 --- /dev/null +++ b/src/generated/resources/assets/vampirism/models/item/crossbow_arrow_garlic.json @@ -0,0 +1,3 @@ +{ + "parent": "vampirism:item/crossbow_arrow" +} \ No newline at end of file diff --git a/src/generated/resources/data/vampirism/advancements/recipes/weapontable/crossbow_arrow_spitfire.json b/src/generated/resources/data/minecraft/advancements/recipes/weapontable/bleeding_arrow_1.json similarity index 88% rename from src/generated/resources/data/vampirism/advancements/recipes/weapontable/crossbow_arrow_spitfire.json rename to src/generated/resources/data/minecraft/advancements/recipes/weapontable/bleeding_arrow_1.json index d029755701..0d0b6f6b99 100644 --- a/src/generated/resources/data/vampirism/advancements/recipes/weapontable/crossbow_arrow_spitfire.json +++ b/src/generated/resources/data/minecraft/advancements/recipes/weapontable/bleeding_arrow_1.json @@ -21,7 +21,7 @@ }, "has_the_recipe": { "conditions": { - "recipe": "vampirism:crossbow_arrow_spitfire" + "recipe": "minecraft:bleeding_arrow_1" }, "trigger": "minecraft:recipe_unlocked" } @@ -35,7 +35,7 @@ ], "rewards": { "recipes": [ - "vampirism:crossbow_arrow_spitfire" + "minecraft:bleeding_arrow_1" ] } } \ No newline at end of file diff --git a/src/generated/resources/data/vampirism/advancements/recipes/weapontable/crossbow_arrow_vampire_killer.json b/src/generated/resources/data/minecraft/advancements/recipes/weapontable/bleeding_arrow_2.json similarity index 67% rename from src/generated/resources/data/vampirism/advancements/recipes/weapontable/crossbow_arrow_vampire_killer.json rename to src/generated/resources/data/minecraft/advancements/recipes/weapontable/bleeding_arrow_2.json index 1023c813c9..92acb62b49 100644 --- a/src/generated/resources/data/vampirism/advancements/recipes/weapontable/crossbow_arrow_vampire_killer.json +++ b/src/generated/resources/data/minecraft/advancements/recipes/weapontable/bleeding_arrow_2.json @@ -13,19 +13,15 @@ }, "trigger": "minecraft:inventory_changed" }, - "has_garlic": { + "has_skill": { "conditions": { - "items": [ - { - "tag": "forge:crops/garlic" - } - ] + "skill": "vampirism:weapon_table" }, - "trigger": "minecraft:inventory_changed" + "trigger": "vampirism:skill_unlocked" }, "has_the_recipe": { "conditions": { - "recipe": "vampirism:crossbow_arrow_vampire_killer" + "recipe": "minecraft:bleeding_arrow_2" }, "trigger": "minecraft:recipe_unlocked" } @@ -33,13 +29,13 @@ "requirements": [ [ "has_the_recipe", - "has_garlic", + "has_skill", "has_crossbow_arrow_normal" ] ], "rewards": { "recipes": [ - "vampirism:crossbow_arrow_vampire_killer" + "minecraft:bleeding_arrow_2" ] } } \ No newline at end of file diff --git a/src/generated/resources/data/minecraft/advancements/recipes/weapontable/bleeding_arrow_3.json b/src/generated/resources/data/minecraft/advancements/recipes/weapontable/bleeding_arrow_3.json new file mode 100644 index 0000000000..520c44a564 --- /dev/null +++ b/src/generated/resources/data/minecraft/advancements/recipes/weapontable/bleeding_arrow_3.json @@ -0,0 +1,41 @@ +{ + "parent": "minecraft:recipes/root", + "criteria": { + "has_crossbow_arrow_normal": { + "conditions": { + "items": [ + { + "items": [ + "vampirism:crossbow_arrow_normal" + ] + } + ] + }, + "trigger": "minecraft:inventory_changed" + }, + "has_skill": { + "conditions": { + "skill": "vampirism:weapon_table" + }, + "trigger": "vampirism:skill_unlocked" + }, + "has_the_recipe": { + "conditions": { + "recipe": "minecraft:bleeding_arrow_3" + }, + "trigger": "minecraft:recipe_unlocked" + } + }, + "requirements": [ + [ + "has_the_recipe", + "has_skill", + "has_crossbow_arrow_normal" + ] + ], + "rewards": { + "recipes": [ + "minecraft:bleeding_arrow_3" + ] + } +} \ No newline at end of file diff --git a/src/generated/resources/data/minecraft/advancements/recipes/weapontable/garlic_arrow_1.json b/src/generated/resources/data/minecraft/advancements/recipes/weapontable/garlic_arrow_1.json new file mode 100644 index 0000000000..cf39337241 --- /dev/null +++ b/src/generated/resources/data/minecraft/advancements/recipes/weapontable/garlic_arrow_1.json @@ -0,0 +1,41 @@ +{ + "parent": "minecraft:recipes/root", + "criteria": { + "has_crossbow_arrow_normal": { + "conditions": { + "items": [ + { + "items": [ + "vampirism:crossbow_arrow_normal" + ] + } + ] + }, + "trigger": "minecraft:inventory_changed" + }, + "has_skill": { + "conditions": { + "skill": "vampirism:weapon_table" + }, + "trigger": "vampirism:skill_unlocked" + }, + "has_the_recipe": { + "conditions": { + "recipe": "minecraft:garlic_arrow_1" + }, + "trigger": "minecraft:recipe_unlocked" + } + }, + "requirements": [ + [ + "has_the_recipe", + "has_skill", + "has_crossbow_arrow_normal" + ] + ], + "rewards": { + "recipes": [ + "minecraft:garlic_arrow_1" + ] + } +} \ No newline at end of file diff --git a/src/generated/resources/data/minecraft/advancements/recipes/weapontable/garlic_arrow_2.json b/src/generated/resources/data/minecraft/advancements/recipes/weapontable/garlic_arrow_2.json new file mode 100644 index 0000000000..43d8426037 --- /dev/null +++ b/src/generated/resources/data/minecraft/advancements/recipes/weapontable/garlic_arrow_2.json @@ -0,0 +1,41 @@ +{ + "parent": "minecraft:recipes/root", + "criteria": { + "has_crossbow_arrow_normal": { + "conditions": { + "items": [ + { + "items": [ + "vampirism:crossbow_arrow_normal" + ] + } + ] + }, + "trigger": "minecraft:inventory_changed" + }, + "has_skill": { + "conditions": { + "skill": "vampirism:weapon_table" + }, + "trigger": "vampirism:skill_unlocked" + }, + "has_the_recipe": { + "conditions": { + "recipe": "minecraft:garlic_arrow_2" + }, + "trigger": "minecraft:recipe_unlocked" + } + }, + "requirements": [ + [ + "has_the_recipe", + "has_skill", + "has_crossbow_arrow_normal" + ] + ], + "rewards": { + "recipes": [ + "minecraft:garlic_arrow_2" + ] + } +} \ No newline at end of file diff --git a/src/generated/resources/data/minecraft/advancements/recipes/weapontable/garlic_arrow_3.json b/src/generated/resources/data/minecraft/advancements/recipes/weapontable/garlic_arrow_3.json new file mode 100644 index 0000000000..2c0fd376d3 --- /dev/null +++ b/src/generated/resources/data/minecraft/advancements/recipes/weapontable/garlic_arrow_3.json @@ -0,0 +1,41 @@ +{ + "parent": "minecraft:recipes/root", + "criteria": { + "has_crossbow_arrow_normal": { + "conditions": { + "items": [ + { + "items": [ + "vampirism:crossbow_arrow_normal" + ] + } + ] + }, + "trigger": "minecraft:inventory_changed" + }, + "has_skill": { + "conditions": { + "skill": "vampirism:weapon_table" + }, + "trigger": "vampirism:skill_unlocked" + }, + "has_the_recipe": { + "conditions": { + "recipe": "minecraft:garlic_arrow_3" + }, + "trigger": "minecraft:recipe_unlocked" + } + }, + "requirements": [ + [ + "has_the_recipe", + "has_skill", + "has_crossbow_arrow_normal" + ] + ], + "rewards": { + "recipes": [ + "minecraft:garlic_arrow_3" + ] + } +} \ No newline at end of file diff --git a/src/generated/resources/data/minecraft/advancements/recipes/weapontable/spitfire_arrow_1.json b/src/generated/resources/data/minecraft/advancements/recipes/weapontable/spitfire_arrow_1.json new file mode 100644 index 0000000000..945a3ff8db --- /dev/null +++ b/src/generated/resources/data/minecraft/advancements/recipes/weapontable/spitfire_arrow_1.json @@ -0,0 +1,41 @@ +{ + "parent": "minecraft:recipes/root", + "criteria": { + "has_crossbow_arrow_normal": { + "conditions": { + "items": [ + { + "items": [ + "vampirism:crossbow_arrow_normal" + ] + } + ] + }, + "trigger": "minecraft:inventory_changed" + }, + "has_skill": { + "conditions": { + "skill": "vampirism:weapon_table" + }, + "trigger": "vampirism:skill_unlocked" + }, + "has_the_recipe": { + "conditions": { + "recipe": "minecraft:spitfire_arrow_1" + }, + "trigger": "minecraft:recipe_unlocked" + } + }, + "requirements": [ + [ + "has_the_recipe", + "has_skill", + "has_crossbow_arrow_normal" + ] + ], + "rewards": { + "recipes": [ + "minecraft:spitfire_arrow_1" + ] + } +} \ No newline at end of file diff --git a/src/generated/resources/data/minecraft/advancements/recipes/weapontable/spitfire_arrow_2.json b/src/generated/resources/data/minecraft/advancements/recipes/weapontable/spitfire_arrow_2.json new file mode 100644 index 0000000000..79e1280e92 --- /dev/null +++ b/src/generated/resources/data/minecraft/advancements/recipes/weapontable/spitfire_arrow_2.json @@ -0,0 +1,41 @@ +{ + "parent": "minecraft:recipes/root", + "criteria": { + "has_crossbow_arrow_normal": { + "conditions": { + "items": [ + { + "items": [ + "vampirism:crossbow_arrow_normal" + ] + } + ] + }, + "trigger": "minecraft:inventory_changed" + }, + "has_skill": { + "conditions": { + "skill": "vampirism:weapon_table" + }, + "trigger": "vampirism:skill_unlocked" + }, + "has_the_recipe": { + "conditions": { + "recipe": "minecraft:spitfire_arrow_2" + }, + "trigger": "minecraft:recipe_unlocked" + } + }, + "requirements": [ + [ + "has_the_recipe", + "has_skill", + "has_crossbow_arrow_normal" + ] + ], + "rewards": { + "recipes": [ + "minecraft:spitfire_arrow_2" + ] + } +} \ No newline at end of file diff --git a/src/generated/resources/data/minecraft/advancements/recipes/weapontable/spitfire_arrow_3.json b/src/generated/resources/data/minecraft/advancements/recipes/weapontable/spitfire_arrow_3.json new file mode 100644 index 0000000000..277a57c5b5 --- /dev/null +++ b/src/generated/resources/data/minecraft/advancements/recipes/weapontable/spitfire_arrow_3.json @@ -0,0 +1,41 @@ +{ + "parent": "minecraft:recipes/root", + "criteria": { + "has_crossbow_arrow_normal": { + "conditions": { + "items": [ + { + "items": [ + "vampirism:crossbow_arrow_normal" + ] + } + ] + }, + "trigger": "minecraft:inventory_changed" + }, + "has_skill": { + "conditions": { + "skill": "vampirism:weapon_table" + }, + "trigger": "vampirism:skill_unlocked" + }, + "has_the_recipe": { + "conditions": { + "recipe": "minecraft:spitfire_arrow_3" + }, + "trigger": "minecraft:recipe_unlocked" + } + }, + "requirements": [ + [ + "has_the_recipe", + "has_skill", + "has_crossbow_arrow_normal" + ] + ], + "rewards": { + "recipes": [ + "minecraft:spitfire_arrow_3" + ] + } +} \ No newline at end of file diff --git a/src/generated/resources/data/minecraft/advancements/recipes/weapontable/vampire_killer_arrow_1.json b/src/generated/resources/data/minecraft/advancements/recipes/weapontable/vampire_killer_arrow_1.json new file mode 100644 index 0000000000..ff5efacc3a --- /dev/null +++ b/src/generated/resources/data/minecraft/advancements/recipes/weapontable/vampire_killer_arrow_1.json @@ -0,0 +1,41 @@ +{ + "parent": "minecraft:recipes/root", + "criteria": { + "has_crossbow_arrow_normal": { + "conditions": { + "items": [ + { + "items": [ + "vampirism:crossbow_arrow_normal" + ] + } + ] + }, + "trigger": "minecraft:inventory_changed" + }, + "has_skill": { + "conditions": { + "skill": "vampirism:weapon_table" + }, + "trigger": "vampirism:skill_unlocked" + }, + "has_the_recipe": { + "conditions": { + "recipe": "minecraft:vampire_killer_arrow_1" + }, + "trigger": "minecraft:recipe_unlocked" + } + }, + "requirements": [ + [ + "has_the_recipe", + "has_skill", + "has_crossbow_arrow_normal" + ] + ], + "rewards": { + "recipes": [ + "minecraft:vampire_killer_arrow_1" + ] + } +} \ No newline at end of file diff --git a/src/generated/resources/data/minecraft/advancements/recipes/weapontable/vampire_killer_arrow_2.json b/src/generated/resources/data/minecraft/advancements/recipes/weapontable/vampire_killer_arrow_2.json new file mode 100644 index 0000000000..1656b5bfe6 --- /dev/null +++ b/src/generated/resources/data/minecraft/advancements/recipes/weapontable/vampire_killer_arrow_2.json @@ -0,0 +1,41 @@ +{ + "parent": "minecraft:recipes/root", + "criteria": { + "has_crossbow_arrow_normal": { + "conditions": { + "items": [ + { + "items": [ + "vampirism:crossbow_arrow_normal" + ] + } + ] + }, + "trigger": "minecraft:inventory_changed" + }, + "has_skill": { + "conditions": { + "skill": "vampirism:weapon_table" + }, + "trigger": "vampirism:skill_unlocked" + }, + "has_the_recipe": { + "conditions": { + "recipe": "minecraft:vampire_killer_arrow_2" + }, + "trigger": "minecraft:recipe_unlocked" + } + }, + "requirements": [ + [ + "has_the_recipe", + "has_skill", + "has_crossbow_arrow_normal" + ] + ], + "rewards": { + "recipes": [ + "minecraft:vampire_killer_arrow_2" + ] + } +} \ No newline at end of file diff --git a/src/generated/resources/data/minecraft/advancements/recipes/weapontable/vampire_killer_arrow_3.json b/src/generated/resources/data/minecraft/advancements/recipes/weapontable/vampire_killer_arrow_3.json new file mode 100644 index 0000000000..5c5969670d --- /dev/null +++ b/src/generated/resources/data/minecraft/advancements/recipes/weapontable/vampire_killer_arrow_3.json @@ -0,0 +1,41 @@ +{ + "parent": "minecraft:recipes/root", + "criteria": { + "has_crossbow_arrow_normal": { + "conditions": { + "items": [ + { + "items": [ + "vampirism:crossbow_arrow_normal" + ] + } + ] + }, + "trigger": "minecraft:inventory_changed" + }, + "has_skill": { + "conditions": { + "skill": "vampirism:weapon_table" + }, + "trigger": "vampirism:skill_unlocked" + }, + "has_the_recipe": { + "conditions": { + "recipe": "minecraft:vampire_killer_arrow_3" + }, + "trigger": "minecraft:recipe_unlocked" + } + }, + "requirements": [ + [ + "has_the_recipe", + "has_skill", + "has_crossbow_arrow_normal" + ] + ], + "rewards": { + "recipes": [ + "minecraft:vampire_killer_arrow_3" + ] + } +} \ No newline at end of file diff --git a/src/generated/resources/data/minecraft/recipes/bleeding_arrow_1.json b/src/generated/resources/data/minecraft/recipes/bleeding_arrow_1.json new file mode 100644 index 0000000000..adfe47253c --- /dev/null +++ b/src/generated/resources/data/minecraft/recipes/bleeding_arrow_1.json @@ -0,0 +1,19 @@ +{ + "type": "vampirism:shapeless_crafting_weapontable", + "category": "equipment", + "ingredients": [ + { + "item": "vampirism:crossbow_arrow_normal" + }, + { + "type": "neoforge:nbt", + "item": "vampirism:oil_bottle", + "strict": true, + "tag": "{oil:\"vampirism:bleeding\"}" + } + ], + "lava": 1, + "result": { + "item": "vampirism:crossbow_arrow_bleeding" + } +} \ No newline at end of file diff --git a/src/generated/resources/data/minecraft/recipes/bleeding_arrow_2.json b/src/generated/resources/data/minecraft/recipes/bleeding_arrow_2.json new file mode 100644 index 0000000000..eedb3570e5 --- /dev/null +++ b/src/generated/resources/data/minecraft/recipes/bleeding_arrow_2.json @@ -0,0 +1,23 @@ +{ + "type": "vampirism:shapeless_crafting_weapontable", + "category": "equipment", + "ingredients": [ + { + "item": "vampirism:crossbow_arrow_normal" + }, + { + "item": "vampirism:crossbow_arrow_normal" + }, + { + "type": "neoforge:nbt", + "item": "vampirism:oil_bottle", + "strict": true, + "tag": "{oil:\"vampirism:bleeding\"}" + } + ], + "lava": 1, + "result": { + "count": 2, + "item": "vampirism:crossbow_arrow_bleeding" + } +} \ No newline at end of file diff --git a/src/generated/resources/data/minecraft/recipes/bleeding_arrow_3.json b/src/generated/resources/data/minecraft/recipes/bleeding_arrow_3.json new file mode 100644 index 0000000000..88463bb83f --- /dev/null +++ b/src/generated/resources/data/minecraft/recipes/bleeding_arrow_3.json @@ -0,0 +1,26 @@ +{ + "type": "vampirism:shapeless_crafting_weapontable", + "category": "equipment", + "ingredients": [ + { + "item": "vampirism:crossbow_arrow_normal" + }, + { + "item": "vampirism:crossbow_arrow_normal" + }, + { + "item": "vampirism:crossbow_arrow_normal" + }, + { + "type": "neoforge:nbt", + "item": "vampirism:oil_bottle", + "strict": true, + "tag": "{oil:\"vampirism:bleeding\"}" + } + ], + "lava": 1, + "result": { + "count": 3, + "item": "vampirism:crossbow_arrow_bleeding" + } +} \ No newline at end of file diff --git a/src/generated/resources/data/minecraft/recipes/garlic_arrow_1.json b/src/generated/resources/data/minecraft/recipes/garlic_arrow_1.json new file mode 100644 index 0000000000..ad34402bbf --- /dev/null +++ b/src/generated/resources/data/minecraft/recipes/garlic_arrow_1.json @@ -0,0 +1,19 @@ +{ + "type": "vampirism:shapeless_crafting_weapontable", + "category": "equipment", + "ingredients": [ + { + "item": "vampirism:crossbow_arrow_normal" + }, + { + "type": "neoforge:nbt", + "item": "vampirism:oil_bottle", + "strict": true, + "tag": "{oil:\"vampirism:garlic\"}" + } + ], + "lava": 1, + "result": { + "item": "vampirism:crossbow_arrow_garlic" + } +} \ No newline at end of file diff --git a/src/generated/resources/data/minecraft/recipes/garlic_arrow_2.json b/src/generated/resources/data/minecraft/recipes/garlic_arrow_2.json new file mode 100644 index 0000000000..07594b8981 --- /dev/null +++ b/src/generated/resources/data/minecraft/recipes/garlic_arrow_2.json @@ -0,0 +1,23 @@ +{ + "type": "vampirism:shapeless_crafting_weapontable", + "category": "equipment", + "ingredients": [ + { + "item": "vampirism:crossbow_arrow_normal" + }, + { + "item": "vampirism:crossbow_arrow_normal" + }, + { + "type": "neoforge:nbt", + "item": "vampirism:oil_bottle", + "strict": true, + "tag": "{oil:\"vampirism:garlic\"}" + } + ], + "lava": 1, + "result": { + "count": 2, + "item": "vampirism:crossbow_arrow_garlic" + } +} \ No newline at end of file diff --git a/src/generated/resources/data/minecraft/recipes/garlic_arrow_3.json b/src/generated/resources/data/minecraft/recipes/garlic_arrow_3.json new file mode 100644 index 0000000000..b5e5307795 --- /dev/null +++ b/src/generated/resources/data/minecraft/recipes/garlic_arrow_3.json @@ -0,0 +1,26 @@ +{ + "type": "vampirism:shapeless_crafting_weapontable", + "category": "equipment", + "ingredients": [ + { + "item": "vampirism:crossbow_arrow_normal" + }, + { + "item": "vampirism:crossbow_arrow_normal" + }, + { + "item": "vampirism:crossbow_arrow_normal" + }, + { + "type": "neoforge:nbt", + "item": "vampirism:oil_bottle", + "strict": true, + "tag": "{oil:\"vampirism:garlic\"}" + } + ], + "lava": 1, + "result": { + "count": 3, + "item": "vampirism:crossbow_arrow_garlic" + } +} \ No newline at end of file diff --git a/src/generated/resources/data/minecraft/recipes/spitfire_arrow_1.json b/src/generated/resources/data/minecraft/recipes/spitfire_arrow_1.json new file mode 100644 index 0000000000..0f8f665410 --- /dev/null +++ b/src/generated/resources/data/minecraft/recipes/spitfire_arrow_1.json @@ -0,0 +1,19 @@ +{ + "type": "vampirism:shapeless_crafting_weapontable", + "category": "equipment", + "ingredients": [ + { + "item": "vampirism:crossbow_arrow_normal" + }, + { + "type": "neoforge:nbt", + "item": "vampirism:oil_bottle", + "strict": true, + "tag": "{oil:\"vampirism:spitfire\"}" + } + ], + "lava": 1, + "result": { + "item": "vampirism:crossbow_arrow_spitfire" + } +} \ No newline at end of file diff --git a/src/generated/resources/data/minecraft/recipes/spitfire_arrow_2.json b/src/generated/resources/data/minecraft/recipes/spitfire_arrow_2.json new file mode 100644 index 0000000000..acb67b9029 --- /dev/null +++ b/src/generated/resources/data/minecraft/recipes/spitfire_arrow_2.json @@ -0,0 +1,23 @@ +{ + "type": "vampirism:shapeless_crafting_weapontable", + "category": "equipment", + "ingredients": [ + { + "item": "vampirism:crossbow_arrow_normal" + }, + { + "item": "vampirism:crossbow_arrow_normal" + }, + { + "type": "neoforge:nbt", + "item": "vampirism:oil_bottle", + "strict": true, + "tag": "{oil:\"vampirism:spitfire\"}" + } + ], + "lava": 1, + "result": { + "count": 2, + "item": "vampirism:crossbow_arrow_spitfire" + } +} \ No newline at end of file diff --git a/src/generated/resources/data/vampirism/recipes/crossbow_arrow_spitfire.json b/src/generated/resources/data/minecraft/recipes/spitfire_arrow_3.json similarity index 74% rename from src/generated/resources/data/vampirism/recipes/crossbow_arrow_spitfire.json rename to src/generated/resources/data/minecraft/recipes/spitfire_arrow_3.json index 061bfd62ce..9a107bbd99 100644 --- a/src/generated/resources/data/vampirism/recipes/crossbow_arrow_spitfire.json +++ b/src/generated/resources/data/minecraft/recipes/spitfire_arrow_3.json @@ -12,7 +12,10 @@ "item": "vampirism:crossbow_arrow_normal" }, { - "item": "vampirism:item_alchemical_fire" + "type": "neoforge:nbt", + "item": "vampirism:oil_bottle", + "strict": true, + "tag": "{oil:\"vampirism:spitfire\"}" } ], "lava": 1, diff --git a/src/generated/resources/data/minecraft/recipes/vampire_killer_arrow_1.json b/src/generated/resources/data/minecraft/recipes/vampire_killer_arrow_1.json new file mode 100644 index 0000000000..b4205f419f --- /dev/null +++ b/src/generated/resources/data/minecraft/recipes/vampire_killer_arrow_1.json @@ -0,0 +1,19 @@ +{ + "type": "vampirism:shapeless_crafting_weapontable", + "category": "equipment", + "ingredients": [ + { + "item": "vampirism:crossbow_arrow_normal" + }, + { + "type": "neoforge:nbt", + "item": "vampirism:oil_bottle", + "strict": true, + "tag": "{oil:\"vampirism:vampire_killer\"}" + } + ], + "lava": 1, + "result": { + "item": "vampirism:crossbow_arrow_vampire_killer" + } +} \ No newline at end of file diff --git a/src/generated/resources/data/minecraft/recipes/vampire_killer_arrow_2.json b/src/generated/resources/data/minecraft/recipes/vampire_killer_arrow_2.json new file mode 100644 index 0000000000..87b7faceb5 --- /dev/null +++ b/src/generated/resources/data/minecraft/recipes/vampire_killer_arrow_2.json @@ -0,0 +1,23 @@ +{ + "type": "vampirism:shapeless_crafting_weapontable", + "category": "equipment", + "ingredients": [ + { + "item": "vampirism:crossbow_arrow_normal" + }, + { + "item": "vampirism:crossbow_arrow_normal" + }, + { + "type": "neoforge:nbt", + "item": "vampirism:oil_bottle", + "strict": true, + "tag": "{oil:\"vampirism:vampire_killer\"}" + } + ], + "lava": 1, + "result": { + "count": 2, + "item": "vampirism:crossbow_arrow_vampire_killer" + } +} \ No newline at end of file diff --git a/src/generated/resources/data/minecraft/recipes/vampire_killer_arrow_3.json b/src/generated/resources/data/minecraft/recipes/vampire_killer_arrow_3.json new file mode 100644 index 0000000000..1aa2651378 --- /dev/null +++ b/src/generated/resources/data/minecraft/recipes/vampire_killer_arrow_3.json @@ -0,0 +1,26 @@ +{ + "type": "vampirism:shapeless_crafting_weapontable", + "category": "equipment", + "ingredients": [ + { + "item": "vampirism:crossbow_arrow_normal" + }, + { + "item": "vampirism:crossbow_arrow_normal" + }, + { + "item": "vampirism:crossbow_arrow_normal" + }, + { + "type": "neoforge:nbt", + "item": "vampirism:oil_bottle", + "strict": true, + "tag": "{oil:\"vampirism:vampire_killer\"}" + } + ], + "lava": 1, + "result": { + "count": 3, + "item": "vampirism:crossbow_arrow_vampire_killer" + } +} \ No newline at end of file diff --git a/src/generated/resources/data/vampirism/advancements/recipes/alchemy_table/bleeding_oil.json b/src/generated/resources/data/vampirism/advancements/recipes/alchemy_table/bleeding_oil.json new file mode 100644 index 0000000000..aa56584a68 --- /dev/null +++ b/src/generated/resources/data/vampirism/advancements/recipes/alchemy_table/bleeding_oil.json @@ -0,0 +1,34 @@ +{ + "parent": "minecraft:recipes/root", + "criteria": { + "has_bottles": { + "conditions": { + "items": [ + { + "items": [ + "vampirism:oil_bottle" + ] + } + ] + }, + "trigger": "minecraft:inventory_changed" + }, + "has_the_recipe": { + "conditions": { + "recipe": "vampirism:bleeding_oil" + }, + "trigger": "minecraft:recipe_unlocked" + } + }, + "requirements": [ + [ + "has_the_recipe", + "has_bottles" + ] + ], + "rewards": { + "recipes": [ + "vampirism:bleeding_oil" + ] + } +} \ No newline at end of file diff --git a/src/generated/resources/data/vampirism/advancements/recipes/alchemy_table/garlic_oil.json b/src/generated/resources/data/vampirism/advancements/recipes/alchemy_table/garlic_oil.json new file mode 100644 index 0000000000..856e21a0e6 --- /dev/null +++ b/src/generated/resources/data/vampirism/advancements/recipes/alchemy_table/garlic_oil.json @@ -0,0 +1,34 @@ +{ + "parent": "minecraft:recipes/root", + "criteria": { + "has_bottles": { + "conditions": { + "items": [ + { + "items": [ + "vampirism:oil_bottle" + ] + } + ] + }, + "trigger": "minecraft:inventory_changed" + }, + "has_the_recipe": { + "conditions": { + "recipe": "vampirism:garlic_oil" + }, + "trigger": "minecraft:recipe_unlocked" + } + }, + "requirements": [ + [ + "has_the_recipe", + "has_bottles" + ] + ], + "rewards": { + "recipes": [ + "vampirism:garlic_oil" + ] + } +} \ No newline at end of file diff --git a/src/generated/resources/data/vampirism/advancements/recipes/alchemy_table/spitfire_oil.json b/src/generated/resources/data/vampirism/advancements/recipes/alchemy_table/spitfire_oil.json new file mode 100644 index 0000000000..03d494867e --- /dev/null +++ b/src/generated/resources/data/vampirism/advancements/recipes/alchemy_table/spitfire_oil.json @@ -0,0 +1,34 @@ +{ + "parent": "minecraft:recipes/root", + "criteria": { + "has_bottles": { + "conditions": { + "items": [ + { + "items": [ + "vampirism:oil_bottle" + ] + } + ] + }, + "trigger": "minecraft:inventory_changed" + }, + "has_the_recipe": { + "conditions": { + "recipe": "vampirism:spitfire_oil" + }, + "trigger": "minecraft:recipe_unlocked" + } + }, + "requirements": [ + [ + "has_the_recipe", + "has_bottles" + ] + ], + "rewards": { + "recipes": [ + "vampirism:spitfire_oil" + ] + } +} \ No newline at end of file diff --git a/src/generated/resources/data/vampirism/advancements/recipes/alchemy_table/vampire_killer_oil.json b/src/generated/resources/data/vampirism/advancements/recipes/alchemy_table/vampire_killer_oil.json new file mode 100644 index 0000000000..149d745def --- /dev/null +++ b/src/generated/resources/data/vampirism/advancements/recipes/alchemy_table/vampire_killer_oil.json @@ -0,0 +1,21 @@ +{ + "parent": "minecraft:recipes/root", + "criteria": { + "has_the_recipe": { + "conditions": { + "recipe": "vampirism:vampire_killer_oil" + }, + "trigger": "minecraft:recipe_unlocked" + } + }, + "requirements": [ + [ + "has_the_recipe" + ] + ], + "rewards": { + "recipes": [ + "vampirism:vampire_killer_oil" + ] + } +} \ No newline at end of file diff --git a/src/generated/resources/data/vampirism/recipes/bleeding_oil.json b/src/generated/resources/data/vampirism/recipes/bleeding_oil.json new file mode 100644 index 0000000000..c8ac152635 --- /dev/null +++ b/src/generated/resources/data/vampirism/recipes/bleeding_oil.json @@ -0,0 +1,19 @@ +{ + "type": "vampirism:alchemical_table", + "ingredient": { + "type": "neoforge:nbt", + "item": "vampirism:oil_bottle", + "strict": true, + "tag": "{oil:\"vampirism:plant\"}" + }, + "input": { + "item": "minecraft:amethyst_shard" + }, + "result": { + "Count": 1, + "id": "vampirism:oil_bottle", + "tag": { + "oil": "vampirism:bleeding" + } + } +} \ No newline at end of file diff --git a/src/generated/resources/data/vampirism/recipes/crossbow_arrow_vampire_killer.json b/src/generated/resources/data/vampirism/recipes/crossbow_arrow_vampire_killer.json deleted file mode 100644 index 59b493223f..0000000000 --- a/src/generated/resources/data/vampirism/recipes/crossbow_arrow_vampire_killer.json +++ /dev/null @@ -1,29 +0,0 @@ -{ - "type": "vampirism:shaped_crafting_weapontable", - "category": "equipment", - "key": { - "W": { - "item": "minecraft:feather" - }, - "X": { - "tag": "forge:crops/garlic" - }, - "Y": { - "tag": "forge:ingots/gold" - }, - "Z": { - "tag": "forge:rods/wooden" - } - }, - "lava": 1, - "pattern": [ - " X ", - "XYX", - " Z ", - " W " - ], - "result": { - "count": 3, - "item": "vampirism:crossbow_arrow_vampire_killer" - } -} \ No newline at end of file diff --git a/src/generated/resources/data/vampirism/recipes/garlic_oil.json b/src/generated/resources/data/vampirism/recipes/garlic_oil.json new file mode 100644 index 0000000000..a5ca75256f --- /dev/null +++ b/src/generated/resources/data/vampirism/recipes/garlic_oil.json @@ -0,0 +1,19 @@ +{ + "type": "vampirism:alchemical_table", + "ingredient": { + "type": "neoforge:nbt", + "item": "vampirism:oil_bottle", + "strict": true, + "tag": "{oil:\"vampirism:plant\"}" + }, + "input": { + "tag": "forge:crops/garlic" + }, + "result": { + "Count": 1, + "id": "vampirism:oil_bottle", + "tag": { + "oil": "vampirism:garlic" + } + } +} \ No newline at end of file diff --git a/src/generated/resources/data/vampirism/recipes/spitfire_oil.json b/src/generated/resources/data/vampirism/recipes/spitfire_oil.json new file mode 100644 index 0000000000..faeefdcdec --- /dev/null +++ b/src/generated/resources/data/vampirism/recipes/spitfire_oil.json @@ -0,0 +1,19 @@ +{ + "type": "vampirism:alchemical_table", + "ingredient": { + "type": "neoforge:nbt", + "item": "vampirism:oil_bottle", + "strict": true, + "tag": "{oil:\"vampirism:plant\"}" + }, + "input": { + "item": "vampirism:item_alchemical_fire" + }, + "result": { + "Count": 1, + "id": "vampirism:oil_bottle", + "tag": { + "oil": "vampirism:spitfire" + } + } +} \ No newline at end of file diff --git a/src/generated/resources/data/vampirism/recipes/vampire_killer_oil.json b/src/generated/resources/data/vampirism/recipes/vampire_killer_oil.json new file mode 100644 index 0000000000..a70154112b --- /dev/null +++ b/src/generated/resources/data/vampirism/recipes/vampire_killer_oil.json @@ -0,0 +1,19 @@ +{ + "type": "vampirism:alchemical_table", + "ingredient": { + "type": "neoforge:nbt", + "item": "vampirism:oil_bottle", + "strict": true, + "tag": "{oil:\"vampirism:garlic\"}" + }, + "input": { + "tag": "vampirism:holy_water" + }, + "result": { + "Count": 1, + "id": "vampirism:oil_bottle", + "tag": { + "oil": "vampirism:vampire_killer" + } + } +} \ No newline at end of file diff --git a/src/generated/resources/data/vampirism/tags/items/crossbow_arrow.json b/src/generated/resources/data/vampirism/tags/items/crossbow_arrow.json index dd4f49a233..62f3d5fdc4 100644 --- a/src/generated/resources/data/vampirism/tags/items/crossbow_arrow.json +++ b/src/generated/resources/data/vampirism/tags/items/crossbow_arrow.json @@ -2,6 +2,9 @@ "values": [ "vampirism:crossbow_arrow_normal", "vampirism:crossbow_arrow_spitfire", - "vampirism:crossbow_arrow_vampire_killer" + "vampirism:crossbow_arrow_vampire_killer", + "vampirism:crossbow_arrow_teleport", + "vampirism:crossbow_arrow_bleeding", + "vampirism:crossbow_arrow_garlic" ] } \ No newline at end of file diff --git a/src/main/java/de/teamlapen/vampirism/client/core/ModItemsRender.java b/src/main/java/de/teamlapen/vampirism/client/core/ModItemsRender.java index 8a029535e8..b471f1cd1e 100755 --- a/src/main/java/de/teamlapen/vampirism/client/core/ModItemsRender.java +++ b/src/main/java/de/teamlapen/vampirism/client/core/ModItemsRender.java @@ -50,10 +50,10 @@ static void registerColors(RegisterColorHandlersEvent.@NotNull Item event) { //Crossbow arrow event.register((stack, tintIndex) -> { if (tintIndex == 1) { - return ((CrossbowArrowItem) stack.getItem()).getType().color; + return ((CrossbowArrowItem) stack.getItem()).tintIndex(); } return 0xFFFFFF; - }, ModItems.CROSSBOW_ARROW_NORMAL.get(), ModItems.CROSSBOW_ARROW_VAMPIRE_KILLER.get(), ModItems.CROSSBOW_ARROW_SPITFIRE.get(), ModItems.CROSSBOW_ARROW_TELEPORT.get()); + }, ModItems.CROSSBOW_ARROW_NORMAL.get(), ModItems.CROSSBOW_ARROW_VAMPIRE_KILLER.get(), ModItems.CROSSBOW_ARROW_SPITFIRE.get(), ModItems.CROSSBOW_ARROW_TELEPORT.get(), ModItems.CROSSBOW_ARROW_BLEEDING.get(), ModItems.CROSSBOW_ARROW_GARLIC.get()); event.register((state, tintIndex) -> { return 0x1E1F1F; }, ModBlocks.DARK_SPRUCE_LEAVES.get()); diff --git a/src/main/java/de/teamlapen/vampirism/core/ModItems.java b/src/main/java/de/teamlapen/vampirism/core/ModItems.java index 3a721f1be5..9093374cab 100755 --- a/src/main/java/de/teamlapen/vampirism/core/ModItems.java +++ b/src/main/java/de/teamlapen/vampirism/core/ModItems.java @@ -12,6 +12,7 @@ import de.teamlapen.vampirism.items.crossbow.DoubleCrossbowItem; import de.teamlapen.vampirism.items.crossbow.SingleCrossbowItem; import de.teamlapen.vampirism.items.crossbow.TechCrossbowItem; +import de.teamlapen.vampirism.items.crossbow.arrow.*; import de.teamlapen.vampirism.misc.VampirismCreativeTab; import de.teamlapen.vampirism.misc.VampirismDispenseBoatBehavior; import net.minecraft.ChatFormatting; @@ -85,10 +86,12 @@ public class ModItems { public static final DeferredItem BLOOD_INFUSED_IRON_INGOT = register("blood_infused_iron_ingot", () -> new Item(props())); public static final DeferredItem BLOOD_INFUSED_ENHANCED_IRON_INGOT = register("blood_infused_enhanced_iron_ingot", () -> new Item(props())); - public static final DeferredItem CROSSBOW_ARROW_NORMAL = register("crossbow_arrow_normal", () -> new CrossbowArrowItem(CrossbowArrowItem.EnumArrowType.NORMAL)); - public static final DeferredItem CROSSBOW_ARROW_SPITFIRE = register("crossbow_arrow_spitfire", () -> new CrossbowArrowItem(CrossbowArrowItem.EnumArrowType.SPITFIRE)); - public static final DeferredItem CROSSBOW_ARROW_VAMPIRE_KILLER = register("crossbow_arrow_vampire_killer", () -> new CrossbowArrowItem(CrossbowArrowItem.EnumArrowType.VAMPIRE_KILLER)); - public static final DeferredItem CROSSBOW_ARROW_TELEPORT = register("crossbow_arrow_teleport", () -> new CrossbowArrowItem(CrossbowArrowItem.EnumArrowType.TELEPORT)); + public static final DeferredItem CROSSBOW_ARROW_NORMAL = register("crossbow_arrow_normal", () -> new CrossbowArrowItem(new NormalBehavior(), new Item.Properties())); + public static final DeferredItem CROSSBOW_ARROW_SPITFIRE = register("crossbow_arrow_spitfire", () -> new CrossbowArrowItem(new SpitfireBehavior(), new Item.Properties())); + public static final DeferredItem CROSSBOW_ARROW_VAMPIRE_KILLER = register("crossbow_arrow_vampire_killer", () -> new CrossbowArrowItem(new VampireKillerBehavior(), new Item.Properties())); + public static final DeferredItem CROSSBOW_ARROW_TELEPORT = register("crossbow_arrow_teleport", () -> new CrossbowArrowItem(new TeleportBehavior(), new Item.Properties())); + public static final DeferredItem CROSSBOW_ARROW_BLEEDING = register("crossbow_arrow_bleeding", () -> new CrossbowArrowItem(new BleedingBehavior(), new Item.Properties())); + public static final DeferredItem CROSSBOW_ARROW_GARLIC = register("crossbow_arrow_garlic", () -> new CrossbowArrowItem(new GarlicBehavior(), new Item.Properties())); public static final DeferredItem ENHANCED_CROSSBOW = register("enhanced_crossbow", () -> new SingleCrossbowItem(props().durability(930), 1.5F, 15, Tiers.IRON, HunterSkills.MASTER_CRAFTSMANSHIP)); public static final DeferredItem ENHANCED_DOUBLE_CROSSBOW = register("enhanced_double_crossbow", () -> new DoubleCrossbowItem(props().durability(930),1.5F, 15, Tiers.IRON, HunterSkills.MASTER_CRAFTSMANSHIP)); diff --git a/src/main/java/de/teamlapen/vampirism/core/ModOils.java b/src/main/java/de/teamlapen/vampirism/core/ModOils.java index b6d32ddb2d..daaa3ee237 100644 --- a/src/main/java/de/teamlapen/vampirism/core/ModOils.java +++ b/src/main/java/de/teamlapen/vampirism/core/ModOils.java @@ -36,6 +36,10 @@ public class ModOils { public static final DeferredHolder SMELT = OILS.register("smelt", () -> new SmeltingOil(0x123456, 30)); public static final DeferredHolder TELEPORT = OILS.register("teleport", () -> new Oil(0x0b4d42)); public static final DeferredHolder EVASION = OILS.register("evasion", () -> new EvasionOil(0x888800, 60)); + public static final DeferredHolder GARLIC = OILS.register("garlic", () -> new Oil(0xffffff)); + public static final DeferredHolder SPITFIRE = OILS.register("spitfire", () -> new Oil(0xFF2211)); + public static final DeferredHolder VAMPIRE_KILLER = OILS.register("vampire_killer", () -> new Oil(0x7A0073)); + public static final DeferredHolder BLEEDING = OILS.register("bleeding", () -> new Oil(11141120)); static void register(IEventBus bus) { OILS.register(bus); diff --git a/src/main/java/de/teamlapen/vampirism/data/provider/ItemModelGenerator.java b/src/main/java/de/teamlapen/vampirism/data/provider/ItemModelGenerator.java index 7b8244e215..9269f9820e 100644 --- a/src/main/java/de/teamlapen/vampirism/data/provider/ItemModelGenerator.java +++ b/src/main/java/de/teamlapen/vampirism/data/provider/ItemModelGenerator.java @@ -215,6 +215,8 @@ protected void registerModels() { withExistingParent(ModItems.CROSSBOW_ARROW_SPITFIRE.get(), modLoc("item/crossbow_arrow")); withExistingParent(ModItems.CROSSBOW_ARROW_VAMPIRE_KILLER.get(), modLoc("item/crossbow_arrow")); withExistingParent(ModItems.CROSSBOW_ARROW_TELEPORT.get(), modLoc("item/crossbow_arrow")); + withExistingParent(ModItems.CROSSBOW_ARROW_BLEEDING.get(), modLoc("item/crossbow_arrow")); + withExistingParent(ModItems.CROSSBOW_ARROW_GARLIC.get(), modLoc("item/crossbow_arrow")); item(ModItems.ARMOR_OF_SWIFTNESS_CHEST_NORMAL.get(), modLoc("item/armor_of_swiftness_chest_normal"), modLoc("item/armor_of_swiftness_chest_normal_overlay")); item(ModItems.ARMOR_OF_SWIFTNESS_CHEST_ENHANCED.get(), modLoc("item/armor_of_swiftness_chest_enhanced"), modLoc("item/armor_of_swiftness_chest_enhanced_overlay")); diff --git a/src/main/java/de/teamlapen/vampirism/data/provider/RecipesProvider.java b/src/main/java/de/teamlapen/vampirism/data/provider/RecipesProvider.java index 214279740f..f69d827346 100644 --- a/src/main/java/de/teamlapen/vampirism/data/provider/RecipesProvider.java +++ b/src/main/java/de/teamlapen/vampirism/data/provider/RecipesProvider.java @@ -58,6 +58,7 @@ public RecipesProvider(@NotNull PackOutput packOutput, CompletableFuture) item).onHitBlock(arrowStack, (blockRayTraceResult).getBlockPos(), this, getOwner()); + ((IVampirismCrossbowArrow) item).onHitBlock(arrowStack, (blockRayTraceResult).getBlockPos(), this, getOwner(), blockRayTraceResult.getDirection()); } super.onHitBlock(blockRayTraceResult); } diff --git a/src/main/java/de/teamlapen/vampirism/items/CrossbowArrowItem.java b/src/main/java/de/teamlapen/vampirism/items/CrossbowArrowItem.java index 0ee8673722..8ff3ee664f 100644 --- a/src/main/java/de/teamlapen/vampirism/items/CrossbowArrowItem.java +++ b/src/main/java/de/teamlapen/vampirism/items/CrossbowArrowItem.java @@ -30,162 +30,70 @@ import java.util.List; -/** - * Ammo for the crossbows. Has different subtypes with different base damage/names/special effects. - */ public class CrossbowArrowItem extends ArrowItem implements IVampirismCrossbowArrow { - private final EnumArrowType type; + private final ICrossbowArrowBehavior behavior; - public CrossbowArrowItem(EnumArrowType type) { - super(new Properties()); - this.type = type; + public CrossbowArrowItem(ICrossbowArrowBehavior behavior, Properties properties) { + super(properties); + this.behavior = behavior; } @Override - public void appendHoverText(ItemStack itemStack, @Nullable Level world, List textComponents, TooltipFlag tooltipFlag) { - switch (type) { - case SPITFIRE -> textComponents.add(Component.translatable("item.vampirism.crossbow_arrow_spitfire.tooltip").withStyle(ChatFormatting.GRAY)); - case VAMPIRE_KILLER -> textComponents.add(Component.translatable("item.vampirism.crossbow_arrow_vampire_killer.tooltip").withStyle(ChatFormatting.GRAY)); - case TELEPORT -> textComponents.add(Component.translatable("item.vampirism.crossbow_arrow_teleport.tooltip").withStyle(ChatFormatting.GRAY)); - } + public void appendHoverText(@NotNull ItemStack itemStack, @Nullable Level world, @NotNull List textComponents, @NotNull TooltipFlag tooltipFlag) { + this.behavior.appendHoverText(itemStack, world, textComponents, tooltipFlag); } @NotNull @Override public AbstractArrow createArrow(@NotNull Level level, @NotNull ItemStack stack, @NotNull LivingEntity entity) { - CrossbowArrowEntity arrowEntity = new CrossbowArrowEntity(level, entity, stack); - arrowEntity.setEffectsFromItem(stack); - arrowEntity.setBaseDamage(type.baseDamage * VampirismConfig.BALANCE.crossbowDamageMult.get()); - if (this.type == EnumArrowType.SPITFIRE) { - arrowEntity.setSecondsOnFire(100); - } - if (entity instanceof Player) { - arrowEntity.pickup = type == EnumArrowType.NORMAL ? AbstractArrow.Pickup.ALLOWED : AbstractArrow.Pickup.DISALLOWED; - } - return arrowEntity; + return createArrow(level, stack, entity, entity.position()); } @NotNull public AbstractArrow createArrow(@NotNull Level level, @NotNull ItemStack stack, @NotNull Position position) { + return createArrow(level, stack, null, position); + } + + @NotNull + public AbstractArrow createArrow(@NotNull Level level, @NotNull ItemStack stack, @Nullable LivingEntity shooter, Position position) { CrossbowArrowEntity arrowEntity = new CrossbowArrowEntity(level, position.x(), position.y(), position.z(), stack); - arrowEntity.setEffectsFromItem(stack); - arrowEntity.setBaseDamage(type.baseDamage * VampirismConfig.BALANCE.crossbowDamageMult.get()); - if (this.type == EnumArrowType.SPITFIRE) { - arrowEntity.setSecondsOnFire(100); + arrowEntity.setBaseDamage(this.behavior.baseDamage(level, stack, shooter) * VampirismConfig.BALANCE.crossbowDamageMult.get()); + this.behavior.modifyArrow(level, stack, shooter, arrowEntity); + if (shooter instanceof Player || shooter == null) { + arrowEntity.pickup = this.behavior.pickupBehavior(); + } else { + arrowEntity.pickup = AbstractArrow.Pickup.DISALLOWED; } - arrowEntity.pickup = type == EnumArrowType.NORMAL ? AbstractArrow.Pickup.ALLOWED : AbstractArrow.Pickup.DISALLOWED; return arrowEntity; } - public EnumArrowType getType() { - return type; + public ICrossbowArrowBehavior getBehavior() { + return this.behavior; + } + + public int tintIndex() { + return this.behavior.color(); } - /** - * @return If an arrow of this type can be used in an infinite crossbow - */ @Override public boolean isCanBeInfinite() { - return type == EnumArrowType.NORMAL || VampirismConfig.BALANCE.allowInfiniteSpecialArrows.get(); + return this.behavior.canBeInfinite(); } - /** - * Called when the {@link CrossbowArrowEntity} hits a block - * - * @param arrow The itemstack of the shot arrow - * @param blockPos The position of the hit block - * @param arrowEntity The arrow entity - * @param shootingEntity The shooting entity. Can be the arrow entity itself - */ @Override public void onHitBlock(ItemStack arrow, @NotNull BlockPos blockPos, IEntityCrossbowArrow arrowEntity, @Nullable Entity shootingEntity) { - CrossbowArrowEntity entity = (CrossbowArrowEntity) arrowEntity; - switch (type) { - case SPITFIRE -> { - for (int dx = -1; dx < 2; dx++) { - for (int dy = -2; dy < 2; dy++) { - for (int dz = -1; dz < 2; dz++) { - BlockPos pos = blockPos.offset(dx, dy, dz); - BlockState blockState = entity.getCommandSenderWorld().getBlockState(pos); - if (blockState.canBeReplaced() && entity.getCommandSenderWorld().getBlockState(pos.below()).isFaceSturdy(entity.getCommandSenderWorld(), pos.below(), Direction.UP) && (entity).getRNG().nextInt(4) != 0) { - entity.getCommandSenderWorld().setBlockAndUpdate(pos, ModBlocks.ALCHEMICAL_FIRE.get().defaultBlockState()); - } - } - } - } - } - case TELEPORT -> { - if (shootingEntity != null) { - if (!shootingEntity.level().isClientSide && shootingEntity.isAlive()) { - if (shootingEntity instanceof ServerPlayer player) { - if (player.connection.connection.isConnected() && player.level() == entity.level() && !player.isSleeping()) { - - if (player.isPassenger()) { - player.stopRiding(); - } - - player.teleportTo(blockPos.getX(), blockPos.getY(), blockPos.getZ()); - player.fallDistance = 0.0F; - DamageHandler.hurtVanilla(player, DamageSources::fall, 1); - } - } else { - shootingEntity.teleportTo(blockPos.getX(), blockPos.getY(), blockPos.getZ()); - shootingEntity.fallDistance = 0.0F; - } - } - } - } - } + this.behavior.onHitBlock(arrow, blockPos, (AbstractArrow) arrowEntity, shootingEntity, Direction.UP); } - /** - * Called when the {@link CrossbowArrowEntity} hits an entity - * - * @param arrow The itemstack of the shot arrow - * @param entity The hit entity - * @param arrowEntity The arrow entity - * @param shootingEntity The shooting entity. Can be the arrow entity itself - */ @Override - public void onHitEntity(ItemStack arrow, LivingEntity entity, IEntityCrossbowArrow arrowEntity, Entity shootingEntity) { - if (type == EnumArrowType.VAMPIRE_KILLER) { - if (entity instanceof IVampireMob) { - float max = entity.getMaxHealth(); - if (max < VampirismConfig.BALANCE.arrowVampireKillerMaxHealth.get()) { - DamageHandler.hurtVanilla(entity, damageSources -> damageSources.arrow((AbstractArrow) arrowEntity, shootingEntity), max); - - } - } - } + public void onHitBlock(ItemStack arrow, @NotNull BlockPos blockPos, IEntityCrossbowArrow arrowEntity, @Nullable Entity shootingEntity, @NotNull Direction direction) { + this.behavior.onHitBlock(arrow, blockPos, (AbstractArrow) arrowEntity, shootingEntity, direction); } - - public enum EnumArrowType implements StringRepresentable { - NORMAL("normal", 2.0, 0xFFFFFF), - VAMPIRE_KILLER("vampire_killer", 0.5, 0x7A0073), - SPITFIRE("spitfire", 0.5, 0xFF2211), - TELEPORT("teleport", 0.5, 0x0b4d42); - - public final int color; - final String name; - final double baseDamage; - - EnumArrowType(String name, double baseDamage, int color) { - this.name = name; - this.baseDamage = baseDamage; - this.color = color; - } - - public @NotNull String getName() { - return this.getSerializedName(); - } - - @NotNull - @Override - public String getSerializedName() { - return name; - } + @Override + public void onHitEntity(ItemStack arrow, LivingEntity shooter, IEntityCrossbowArrow arrowEntity, Entity shootingEntity) { + this.behavior.onHitEntity(arrow, shooter, (AbstractArrow) arrowEntity, shootingEntity); } } diff --git a/src/main/java/de/teamlapen/vampirism/items/crossbow/arrow/BleedingBehavior.java b/src/main/java/de/teamlapen/vampirism/items/crossbow/arrow/BleedingBehavior.java new file mode 100644 index 0000000000..2794ecc1da --- /dev/null +++ b/src/main/java/de/teamlapen/vampirism/items/crossbow/arrow/BleedingBehavior.java @@ -0,0 +1,47 @@ +package de.teamlapen.vampirism.items.crossbow.arrow; + +import de.teamlapen.vampirism.api.items.IVampirismCrossbowArrow; +import de.teamlapen.vampirism.config.VampirismConfig; +import de.teamlapen.vampirism.core.ModEffects; +import net.minecraft.ChatFormatting; +import net.minecraft.core.BlockPos; +import net.minecraft.network.chat.Component; +import net.minecraft.world.effect.MobEffect; +import net.minecraft.world.effect.MobEffectInstance; +import net.minecraft.world.entity.Entity; +import net.minecraft.world.entity.LivingEntity; +import net.minecraft.world.entity.projectile.AbstractArrow; +import net.minecraft.world.item.ItemStack; +import net.minecraft.world.item.TooltipFlag; +import net.minecraft.world.level.Level; +import org.jetbrains.annotations.NotNull; +import org.jetbrains.annotations.Nullable; + +import java.util.List; + +public class BleedingBehavior implements IVampirismCrossbowArrow.ICrossbowArrowBehavior { + @Override + public int color() { + return 11141120; + } + + @Override + public void onHitEntity(ItemStack arrow, LivingEntity hitEntity, AbstractArrow arrowEntity, Entity shootingEntity) { + hitEntity.addEffect(new MobEffectInstance(ModEffects.BLEEDING.get(), 40, 0, false, false)); + } + + @Override + public void appendHoverText(ItemStack itemStack, @Nullable Level world, List textComponents, TooltipFlag tooltipFlag) { + textComponents.add(Component.translatable("item.vampirism.crossbow_arrow_bleeding.tooltip").withStyle(ChatFormatting.GRAY)); + } + + @Override + public boolean canBeInfinite() { + return VampirismConfig.BALANCE.allowInfiniteSpecialArrows.get(); + } + + @Override + public float baseDamage(@NotNull Level level, @NotNull ItemStack stack, @Nullable LivingEntity shooter) { + return 0.5f; + } +} diff --git a/src/main/java/de/teamlapen/vampirism/items/crossbow/arrow/GarlicBehavior.java b/src/main/java/de/teamlapen/vampirism/items/crossbow/arrow/GarlicBehavior.java new file mode 100644 index 0000000000..5d44607b43 --- /dev/null +++ b/src/main/java/de/teamlapen/vampirism/items/crossbow/arrow/GarlicBehavior.java @@ -0,0 +1,44 @@ +package de.teamlapen.vampirism.items.crossbow.arrow; + +import de.teamlapen.vampirism.api.items.IVampirismCrossbowArrow; +import de.teamlapen.vampirism.config.VampirismConfig; +import de.teamlapen.vampirism.core.ModEffects; +import net.minecraft.network.chat.Component; +import net.minecraft.world.effect.MobEffectInstance; +import net.minecraft.world.entity.Entity; +import net.minecraft.world.entity.LivingEntity; +import net.minecraft.world.entity.projectile.AbstractArrow; +import net.minecraft.world.item.ItemStack; +import net.minecraft.world.item.TooltipFlag; +import net.minecraft.world.level.Level; +import org.jetbrains.annotations.NotNull; +import org.jetbrains.annotations.Nullable; + +import java.util.List; + +public class GarlicBehavior implements IVampirismCrossbowArrow.ICrossbowArrowBehavior { + @Override + public int color() { + return 0xffffff; + } + + @Override + public void appendHoverText(ItemStack itemStack, @Nullable Level world, List textComponents, TooltipFlag tooltipFlag) { + + } + + @Override + public void onHitEntity(ItemStack arrow, LivingEntity entity, AbstractArrow arrowEntity, Entity shootingEntity) { + entity.addEffect(new MobEffectInstance(ModEffects.GARLIC.get(), 40, 1)); + } + + @Override + public boolean canBeInfinite() { + return VampirismConfig.BALANCE.allowInfiniteSpecialArrows.get(); + } + + @Override + public float baseDamage(@NotNull Level level, @NotNull ItemStack stack, @Nullable LivingEntity shooter) { + return 1; + } +} diff --git a/src/main/java/de/teamlapen/vampirism/items/crossbow/arrow/NormalBehavior.java b/src/main/java/de/teamlapen/vampirism/items/crossbow/arrow/NormalBehavior.java new file mode 100644 index 0000000000..b596376b6e --- /dev/null +++ b/src/main/java/de/teamlapen/vampirism/items/crossbow/arrow/NormalBehavior.java @@ -0,0 +1,42 @@ +package de.teamlapen.vampirism.items.crossbow.arrow; + +import de.teamlapen.vampirism.api.items.IVampirismCrossbowArrow; +import net.minecraft.core.BlockPos; +import net.minecraft.network.chat.Component; +import net.minecraft.world.entity.Entity; +import net.minecraft.world.entity.LivingEntity; +import net.minecraft.world.entity.projectile.AbstractArrow; +import net.minecraft.world.item.ItemStack; +import net.minecraft.world.item.TooltipFlag; +import net.minecraft.world.level.Level; +import org.jetbrains.annotations.NotNull; +import org.jetbrains.annotations.Nullable; + +import java.util.List; + +public class NormalBehavior implements IVampirismCrossbowArrow.ICrossbowArrowBehavior{ + @Override + public int color() { + return 0xFFFFFF; + } + + @Override + public void appendHoverText(ItemStack itemStack, @Nullable Level world, List textComponents, TooltipFlag tooltipFlag) { + + } + + @Override + public AbstractArrow.Pickup pickupBehavior() { + return AbstractArrow.Pickup.ALLOWED; + } + + @Override + public boolean canBeInfinite() { + return true; + } + + @Override + public float baseDamage(@NotNull Level level, @NotNull ItemStack stack, @Nullable LivingEntity shooter) { + return 2; + } +} diff --git a/src/main/java/de/teamlapen/vampirism/items/crossbow/arrow/SpitfireBehavior.java b/src/main/java/de/teamlapen/vampirism/items/crossbow/arrow/SpitfireBehavior.java new file mode 100644 index 0000000000..f8f4731afd --- /dev/null +++ b/src/main/java/de/teamlapen/vampirism/items/crossbow/arrow/SpitfireBehavior.java @@ -0,0 +1,71 @@ +package de.teamlapen.vampirism.items.crossbow.arrow; + +import de.teamlapen.vampirism.api.items.IVampirismCrossbowArrow; +import de.teamlapen.vampirism.config.VampirismConfig; +import de.teamlapen.vampirism.core.ModBlocks; +import de.teamlapen.vampirism.mixin.accessor.EntityAccessor; +import net.minecraft.ChatFormatting; +import net.minecraft.advancements.CriteriaTriggers; +import net.minecraft.core.BlockPos; +import net.minecraft.core.Direction; +import net.minecraft.network.chat.Component; +import net.minecraft.server.level.ServerPlayer; +import net.minecraft.sounds.SoundEvents; +import net.minecraft.sounds.SoundSource; +import net.minecraft.world.InteractionResult; +import net.minecraft.world.entity.Entity; +import net.minecraft.world.entity.LivingEntity; +import net.minecraft.world.entity.projectile.AbstractArrow; +import net.minecraft.world.item.ItemStack; +import net.minecraft.world.item.TooltipFlag; +import net.minecraft.world.level.Level; +import net.minecraft.world.level.block.*; +import net.minecraft.world.level.block.state.BlockState; +import net.minecraft.world.level.gameevent.GameEvent; +import org.jetbrains.annotations.NotNull; +import org.jetbrains.annotations.Nullable; + +import java.util.List; + +public class SpitfireBehavior implements IVampirismCrossbowArrow.ICrossbowArrowBehavior { + @Override + public int color() { + return 0xFF2211; + } + + @Override + public void onHitBlock(ItemStack arrow, @NotNull BlockPos blockpos, AbstractArrow arrowEntity, @Nullable Entity shootingEntity, Direction direction) { + Level level = arrowEntity.level(); + BlockState blockstate = level.getBlockState(blockpos); + if (!CampfireBlock.canLight(blockstate) && !CandleBlock.canLight(blockstate) && !CandleCakeBlock.canLight(blockstate)) { + BlockPos blockpos1 = blockpos.relative(direction); + if (BaseFireBlock.canBePlacedAt(level, blockpos1, direction)) { + BlockState blockstate1 = BaseFireBlock.getState(level, blockpos1); + if (blockstate1.getBlock() instanceof BaseFireBlock) { + blockstate1 = ModBlocks.ALCHEMICAL_FIRE.get().defaultBlockState(); + } + level.setBlock(blockpos1, blockstate1, 11); + } + } + } + + @Override + public void appendHoverText(ItemStack itemStack, @Nullable Level world, List textComponents, TooltipFlag tooltipFlag) { + textComponents.add(Component.translatable("item.vampirism.crossbow_arrow_spitfire.tooltip").withStyle(ChatFormatting.GRAY)); + } + + @Override + public boolean canBeInfinite() { + return VampirismConfig.BALANCE.allowInfiniteSpecialArrows.get(); + } + + @Override + public float baseDamage(@NotNull Level level, @NotNull ItemStack stack, @Nullable LivingEntity shooter) { + return 0.5f; + } + + @Override + public void modifyArrow(@NotNull Level level, @NotNull ItemStack stack, @Nullable LivingEntity shooter, @NotNull AbstractArrow arrow) { + arrow.setSecondsOnFire(100); + } +} diff --git a/src/main/java/de/teamlapen/vampirism/items/crossbow/arrow/TeleportBehavior.java b/src/main/java/de/teamlapen/vampirism/items/crossbow/arrow/TeleportBehavior.java new file mode 100644 index 0000000000..962032d2ed --- /dev/null +++ b/src/main/java/de/teamlapen/vampirism/items/crossbow/arrow/TeleportBehavior.java @@ -0,0 +1,66 @@ +package de.teamlapen.vampirism.items.crossbow.arrow; + +import de.teamlapen.vampirism.api.items.IVampirismCrossbowArrow; +import de.teamlapen.vampirism.config.VampirismConfig; +import de.teamlapen.vampirism.util.DamageHandler; +import net.minecraft.ChatFormatting; +import net.minecraft.core.BlockPos; +import net.minecraft.core.Direction; +import net.minecraft.network.chat.Component; +import net.minecraft.server.level.ServerPlayer; +import net.minecraft.world.damagesource.DamageSources; +import net.minecraft.world.entity.Entity; +import net.minecraft.world.entity.LivingEntity; +import net.minecraft.world.entity.projectile.AbstractArrow; +import net.minecraft.world.item.ItemStack; +import net.minecraft.world.item.TooltipFlag; +import net.minecraft.world.level.Level; +import org.jetbrains.annotations.NotNull; +import org.jetbrains.annotations.Nullable; + +import java.util.List; + +public class TeleportBehavior implements IVampirismCrossbowArrow.ICrossbowArrowBehavior{ + @Override + public int color() { + return 0x0b4d42; + } + + @Override + public void onHitBlock(ItemStack arrow, @NotNull BlockPos blockPos, AbstractArrow arrowEntity, @Nullable Entity shootingEntity, Direction up) { + if (shootingEntity != null) { + if (!shootingEntity.level().isClientSide && shootingEntity.isAlive()) { + if (shootingEntity instanceof ServerPlayer player) { + if (player.connection.connection.isConnected() && player.level() == arrowEntity.level() && !player.isSleeping()) { + + if (player.isPassenger()) { + player.stopRiding(); + } + + player.teleportTo(blockPos.getX(), blockPos.getY(), blockPos.getZ()); + player.fallDistance = 0.0F; + DamageHandler.hurtVanilla(player, DamageSources::fall, 1); + } + } else { + shootingEntity.teleportTo(blockPos.getX(), blockPos.getY(), blockPos.getZ()); + shootingEntity.fallDistance = 0.0F; + } + } + } + } + + @Override + public void appendHoverText(ItemStack itemStack, @Nullable Level world, List textComponents, TooltipFlag tooltipFlag) { + textComponents.add(Component.translatable("item.vampirism.crossbow_arrow_teleport.tooltip").withStyle(ChatFormatting.GRAY)); + } + + @Override + public boolean canBeInfinite() { + return VampirismConfig.BALANCE.allowInfiniteSpecialArrows.get(); + } + + @Override + public float baseDamage(@NotNull Level level, @NotNull ItemStack stack, @Nullable LivingEntity shooter) { + return 0.5f; + } +} diff --git a/src/main/java/de/teamlapen/vampirism/items/crossbow/arrow/VampireKillerBehavior.java b/src/main/java/de/teamlapen/vampirism/items/crossbow/arrow/VampireKillerBehavior.java new file mode 100644 index 0000000000..b83bf1ed6e --- /dev/null +++ b/src/main/java/de/teamlapen/vampirism/items/crossbow/arrow/VampireKillerBehavior.java @@ -0,0 +1,60 @@ +package de.teamlapen.vampirism.items.crossbow.arrow; + +import de.teamlapen.vampirism.api.entity.vampire.IVampireMob; +import de.teamlapen.vampirism.api.items.IVampireFinisher; +import de.teamlapen.vampirism.api.items.IVampirismCrossbowArrow; +import de.teamlapen.vampirism.config.VampirismConfig; +import de.teamlapen.vampirism.core.ModItems; +import de.teamlapen.vampirism.items.StakeItem; +import de.teamlapen.vampirism.util.DamageHandler; +import de.teamlapen.vampirism.util.Helper; +import net.minecraft.ChatFormatting; +import net.minecraft.network.chat.Component; +import net.minecraft.world.entity.Entity; +import net.minecraft.world.entity.LivingEntity; +import net.minecraft.world.entity.player.Player; +import net.minecraft.world.entity.projectile.AbstractArrow; +import net.minecraft.world.item.Item; +import net.minecraft.world.item.ItemStack; +import net.minecraft.world.item.TooltipFlag; +import net.minecraft.world.level.Level; +import org.jetbrains.annotations.NotNull; +import org.jetbrains.annotations.Nullable; + +import java.util.List; + +public class VampireKillerBehavior implements IVampirismCrossbowArrow.ICrossbowArrowBehavior, IVampireFinisher { + @Override + public int color() { + return 0x7A0073; + } + + @Override + public void onHitEntity(ItemStack arrow, LivingEntity entity, AbstractArrow arrowEntity, Entity shootingEntity) { + if (entity instanceof IVampireMob || (entity instanceof Player player && Helper.isVampire(player))) { + if(shootingEntity instanceof LivingEntity shooter && StakeItem.canKillInstant(entity, shooter)) { + DamageHandler.hurtModded(entity, s -> s.stake(shooter), 10000F); + } + } + } + + @Override + public void appendHoverText(ItemStack itemStack, @Nullable Level world, List textComponents, TooltipFlag tooltipFlag) { + textComponents.add(Component.translatable("item.vampirism.crossbow_arrow_vampire_killer.tooltip").withStyle(ChatFormatting.GRAY)); + } + + @Override + public boolean canBeInfinite() { + return VampirismConfig.BALANCE.allowInfiniteSpecialArrows.get(); + } + + @Override + public float baseDamage(@NotNull Level level, @NotNull ItemStack stack, @Nullable LivingEntity shooter) { + return 0.5f; + } + + @Override + public @NotNull Item asItem() { + return ModItems.CROSSBOW_ARROW_VAMPIRE_KILLER.get(); + } +} diff --git a/src/main/java/de/teamlapen/vampirism/misc/VampirismCreativeTab.java b/src/main/java/de/teamlapen/vampirism/misc/VampirismCreativeTab.java index 2bfe65aa26..841aefecd8 100644 --- a/src/main/java/de/teamlapen/vampirism/misc/VampirismCreativeTab.java +++ b/src/main/java/de/teamlapen/vampirism/misc/VampirismCreativeTab.java @@ -338,8 +338,10 @@ private void addWeapons() { addItem(CROSSBOW_ARROW_NORMAL); addItem(CROSSBOW_ARROW_SPITFIRE); + addItem(CROSSBOW_ARROW_GARLIC); addItem(CROSSBOW_ARROW_VAMPIRE_KILLER); addItem(CROSSBOW_ARROW_TELEPORT); + addItem(CROSSBOW_ARROW_BLEEDING); addItem(ARROW_CLIP); addItem(PITCHFORK); diff --git a/src/main/java/de/teamlapen/vampirism/mixin/accessor/EntityAccessor.java b/src/main/java/de/teamlapen/vampirism/mixin/accessor/EntityAccessor.java index 1ebe5eeb4d..485cddfcb0 100644 --- a/src/main/java/de/teamlapen/vampirism/mixin/accessor/EntityAccessor.java +++ b/src/main/java/de/teamlapen/vampirism/mixin/accessor/EntityAccessor.java @@ -1,5 +1,6 @@ package de.teamlapen.vampirism.mixin.accessor; +import net.minecraft.util.RandomSource; import net.minecraft.world.entity.Entity; import net.minecraft.world.entity.EntityDimensions; import net.minecraft.world.phys.Vec3; @@ -24,4 +25,7 @@ public interface EntityAccessor { @Accessor("dimensions") void setDimensions(EntityDimensions dimensions); + + @Accessor("random") + RandomSource getRandom(); } diff --git a/src/main/java/de/teamlapen/vampirism/util/Helper.java b/src/main/java/de/teamlapen/vampirism/util/Helper.java index 4a4c922f32..f2ecac2b48 100644 --- a/src/main/java/de/teamlapen/vampirism/util/Helper.java +++ b/src/main/java/de/teamlapen/vampirism/util/Helper.java @@ -14,6 +14,7 @@ import de.teamlapen.vampirism.api.entity.player.vampire.IVampirePlayer; import de.teamlapen.vampirism.api.entity.vampire.IVampire; import de.teamlapen.vampirism.api.items.IFactionLevelItem; +import de.teamlapen.vampirism.api.items.IVampireFinisher; import de.teamlapen.vampirism.config.VampirismConfig; import de.teamlapen.vampirism.core.ModTags; import de.teamlapen.vampirism.entity.CrossbowArrowEntity; @@ -292,7 +293,7 @@ public static boolean canKillVampires(@NotNull DamageSource source) { //Maybe use all IVampireFinisher?? return source.getDirectEntity() instanceof IHunterMob || ((LivingEntity) source.getDirectEntity()).getMainHandItem().getItem() instanceof StakeItem; } else if (source.getDirectEntity() instanceof CrossbowArrowEntity) { - return ((CrossbowArrowEntity) source.getDirectEntity()).getArrowType() == CrossbowArrowItem.EnumArrowType.VAMPIRE_KILLER; + return ((CrossbowArrowEntity) source.getDirectEntity()).getArrowType() instanceof IVampireFinisher; } return false; } diff --git a/src/main/resources/assets/vampirism/lang/en_us.json b/src/main/resources/assets/vampirism/lang/en_us.json index 75fddd530e..5f1ce1380e 100644 --- a/src/main/resources/assets/vampirism/lang/en_us.json +++ b/src/main/resources/assets/vampirism/lang/en_us.json @@ -883,9 +883,12 @@ "item.vampirism.basic_tech_crossbow": "Semi-Auto Crossbow", "item.vampirism.enhanced_tech_crossbow": "Enhanced Semi-Auto Crossbow", "item.vampirism.crossbow_arrow_vampire_killer": "Vampire Killer Quarrel", - "item.vampirism.crossbow_arrow_spitfire": "Spitfire", + "item.vampirism.crossbow_arrow_spitfire": "Spitfire Quarrel", "item.vampirism.crossbow_arrow_normal": "Quarrel", "item.vampirism.crossbow_arrow_teleport": "Teleport Quarrel", + "item.vampirism.crossbow_arrow_bleeding": "Bleeding Quarrel", + "item.vampirism.crossbow_arrow_disable": "Disable Quarrel", + "item.vampirism.crossbow_arrow_garlic": "Garlic Quarrel", "item.vampirism.stake": "Stake", "item.vampirism.blood_bottle": "Blood Bottle", "item.vampirism.blood_potion": "Blood Potion", @@ -1009,6 +1012,8 @@ "item.vampirism.crossbow_arrow_vampire_killer.tooltip": "Instantly kills low level vampire NPCs.", "item.vampirism.crossbow_arrow_spitfire.tooltip": "Creates a alchemical fire on impact", "item.vampirism.crossbow_arrow_teleport.tooltip": "Teleports the shooter on impact", + "item.vampirism.crossbow_arrow_bleeding.tooltip": "Applies bleeding effect on impact", + "item.vampirism.crossbow_arrow_garlic.tooltip": "Applies garlic effect on impact", "item.vampirism.tech_crossbow_ammo_package.tooltip": "Can be used to fill a %s", "item.vampirism.item.tier.normal": "Normal", "item.vampirism.item.tier.enhanced": "Enhanced", @@ -1477,6 +1482,11 @@ "oil.vampirism.smelt": "Smelting", "oil.vampirism.teleport": "Teleport", "oil.vampirism.evasion": "Evasion", + "oil.vampirism.garlic": "Garlic", + "oil.vampirism.spitfire": "Spitfire", + "oil.vampirism.vampire_killer": "Vampire Killer", + "oil.vampirism.bleeding": "Bleeding", + "oil.vampirism.disable": "Disable", "__commend": "Oil description", "oil.vampirism.smelt.desc": "Can be used on Pickaxes to auto smelt destroyed blocks", "oil.vampirism.evasion.desc": "Increases evasion chances when applied to armor",