From e9b7509e3e3f99ac7a7b407a0db7876167e8a9a2 Mon Sep 17 00:00:00 2001 From: JuliaLange Date: Fri, 1 Mar 2024 23:54:30 -0800 Subject: [PATCH 1/5] Greed implemented and replaces looting --- .../me/woach/bone/effects/BoneEffect.java | 21 +++++++++++++++++++ .../me/woach/bone/effects/GreedEffect.java | 9 ++++++-- .../woach/bone/mixin/greedMimicsLooting.java | 20 ++++++++++++++++++ .../resources/assets/bone/lang/en_us.json | 2 +- src/main/resources/bone.mixins.json | 3 ++- .../resources/data/bone/bones/pillager.json | 4 ++-- 6 files changed, 53 insertions(+), 6 deletions(-) create mode 100644 src/main/java/me/woach/bone/effects/BoneEffect.java create mode 100644 src/main/java/me/woach/bone/mixin/greedMimicsLooting.java diff --git a/src/main/java/me/woach/bone/effects/BoneEffect.java b/src/main/java/me/woach/bone/effects/BoneEffect.java new file mode 100644 index 0000000..5889c24 --- /dev/null +++ b/src/main/java/me/woach/bone/effects/BoneEffect.java @@ -0,0 +1,21 @@ +package me.woach.bone.effects; + +import net.minecraft.enchantment.Enchantment; +import net.minecraft.enchantment.EnchantmentTarget; +import net.minecraft.entity.EquipmentSlot; + +public abstract class BoneEffect extends Enchantment { + protected BoneEffect(Rarity weight, EnchantmentTarget target, EquipmentSlot... slotTypes) { + super(weight, target, slotTypes); + } + + @Override + public boolean isAvailableForEnchantedBookOffer() { + return false; + } + + @Override + public boolean isAvailableForRandomSelection() { + return false; + } +} diff --git a/src/main/java/me/woach/bone/effects/GreedEffect.java b/src/main/java/me/woach/bone/effects/GreedEffect.java index 9018b73..4ab97aa 100644 --- a/src/main/java/me/woach/bone/effects/GreedEffect.java +++ b/src/main/java/me/woach/bone/effects/GreedEffect.java @@ -2,10 +2,15 @@ import net.minecraft.enchantment.Enchantment; import net.minecraft.enchantment.EnchantmentTarget; +import net.minecraft.enchantment.Enchantments; import net.minecraft.entity.EquipmentSlot; -public class GreedEffect extends Enchantment { +public class GreedEffect extends BoneEffect { protected GreedEffect() { - super(Rarity.RARE, EnchantmentTarget.WEAPON, new EquipmentSlot[]{EquipmentSlot.MAINHAND}); + super(Rarity.RARE, EnchantmentTarget.WEAPON, EquipmentSlot.MAINHAND); + } + @Override + public boolean canAccept(Enchantment other) { + return super.canAccept(other) && other != Enchantments.LOOTING; } } diff --git a/src/main/java/me/woach/bone/mixin/greedMimicsLooting.java b/src/main/java/me/woach/bone/mixin/greedMimicsLooting.java new file mode 100644 index 0000000..90469f2 --- /dev/null +++ b/src/main/java/me/woach/bone/mixin/greedMimicsLooting.java @@ -0,0 +1,20 @@ +package me.woach.bone.mixin; + +import me.woach.bone.effects.BoneEffectRegistry; +import net.minecraft.enchantment.EnchantmentHelper; +import net.minecraft.entity.LivingEntity; +import org.spongepowered.asm.mixin.Mixin; +import org.spongepowered.asm.mixin.injection.At; +import org.spongepowered.asm.mixin.injection.Inject; +import org.spongepowered.asm.mixin.injection.callback.CallbackInfoReturnable; + +@Mixin(EnchantmentHelper.class) +public class greedMimicsLooting { + + @Inject(method = "getLooting", at = @At("RETURN"), cancellable = true) + private static void useGreed(LivingEntity entity, CallbackInfoReturnable cir) { + int greedLevel = EnchantmentHelper.getEquipmentLevel(BoneEffectRegistry.GREED.get(), entity); + if (greedLevel > cir.getReturnValue()) + cir.setReturnValue(greedLevel); + } +} diff --git a/src/main/resources/assets/bone/lang/en_us.json b/src/main/resources/assets/bone/lang/en_us.json index 16c4801..9bfae2f 100644 --- a/src/main/resources/assets/bone/lang/en_us.json +++ b/src/main/resources/assets/bone/lang/en_us.json @@ -24,5 +24,5 @@ "item.bone.bone": "Bone", "itemGroup.bone.bone": "Bone", "item.bone.tier": "Tier %s", - "enchantment.minecraft.looting": "Greed" + "enchantment.bone.greed": "Greed" } \ No newline at end of file diff --git a/src/main/resources/bone.mixins.json b/src/main/resources/bone.mixins.json index 50a035f..576dc09 100644 --- a/src/main/resources/bone.mixins.json +++ b/src/main/resources/bone.mixins.json @@ -5,7 +5,8 @@ "mixins": [ "LootPoolAccessor", "EntitiesDropBones", - "FirePowersBoneForge" + "FirePowersBoneForge", + "greedMimicsLooting" ], "injectors": { "defaultRequire": 1 diff --git a/src/main/resources/data/bone/bones/pillager.json b/src/main/resources/data/bone/bones/pillager.json index 356d410..704ae23 100644 --- a/src/main/resources/data/bone/bones/pillager.json +++ b/src/main/resources/data/bone/bones/pillager.json @@ -1,6 +1,6 @@ { "enabled": true, "chance": 125, - "effect": "minecraft:looting", - "entity": "minecraft:entities/pillager" + "effect": "bone:greed", + "entity": "minecraft:pillager" } \ No newline at end of file From 343c7b66ef2e6eb8612c1bda60de529230f38e52 Mon Sep 17 00:00:00 2001 From: JuliaLange Date: Fri, 1 Mar 2024 23:54:50 -0800 Subject: [PATCH 2/5] Clean unused imports --- src/main/java/me/woach/bone/Bone.java | 12 +++++------- .../java/me/woach/bone/block/BlocksRegistry.java | 4 ++-- .../java/me/woach/bone/block/BoneFireBlock.java | 7 +------ .../bone/block/entity/BoneForgeBlockEntity.java | 3 ++- .../woach/bone/effects/BoneEffectRegistry.java | 4 ---- .../java/me/woach/bone/items/EssenceItem.java | 4 ++-- .../java/me/woach/bone/items/ItemsRegistry.java | 16 ++++------------ .../me/woach/bone/mixin/EntitiesDropBones.java | 4 ---- 8 files changed, 16 insertions(+), 38 deletions(-) diff --git a/src/main/java/me/woach/bone/Bone.java b/src/main/java/me/woach/bone/Bone.java index 4379897..03fc9b6 100644 --- a/src/main/java/me/woach/bone/Bone.java +++ b/src/main/java/me/woach/bone/Bone.java @@ -2,24 +2,22 @@ import me.woach.bone.block.BlocksRegistry; import me.woach.bone.block.entity.BlockEntityTypesRegistry; +import me.woach.bone.bonedata.BoneReloader; import me.woach.bone.effects.BoneEffectRegistry; import me.woach.bone.items.ItemsRegistry; +import net.fabricmc.api.ModInitializer; import net.fabricmc.fabric.api.itemgroup.v1.FabricItemGroup; import net.minecraft.item.ItemGroup; import net.minecraft.item.ItemStack; import net.minecraft.registry.Registries; +import net.minecraft.registry.Registry; +import net.minecraft.registry.RegistryKey; import net.minecraft.registry.RegistryKeys; import net.minecraft.text.Text; +import net.minecraft.util.Identifier; import org.slf4j.Logger; import org.slf4j.LoggerFactory; -import me.woach.bone.bonedata.BoneReloader; -import net.minecraft.registry.RegistryKey; - -import net.fabricmc.api.ModInitializer; -import net.minecraft.registry.Registry; -import net.minecraft.util.Identifier; - public class Bone implements ModInitializer { public static final Logger LOGGER = LoggerFactory.getLogger("Bone"); public static Identifier getId(String path) { diff --git a/src/main/java/me/woach/bone/block/BlocksRegistry.java b/src/main/java/me/woach/bone/block/BlocksRegistry.java index 4002ded..1b5b1c8 100644 --- a/src/main/java/me/woach/bone/block/BlocksRegistry.java +++ b/src/main/java/me/woach/bone/block/BlocksRegistry.java @@ -1,7 +1,5 @@ package me.woach.bone.block; -import java.util.function.Supplier; - import me.woach.bone.Bone; import net.fabricmc.fabric.api.object.builder.v1.block.FabricBlockSettings; import net.minecraft.block.Block; @@ -9,6 +7,8 @@ import net.minecraft.registry.Registry; import net.minecraft.sound.BlockSoundGroup; +import java.util.function.Supplier; + public enum BlocksRegistry { BONE_FORGE_BLOCK("bone_forge", BoneForgeBlock::new), BONE_FIRE_BLOCK("bone_fire", BoneFireBlock::new), diff --git a/src/main/java/me/woach/bone/block/BoneFireBlock.java b/src/main/java/me/woach/bone/block/BoneFireBlock.java index ba9c34b..fa0733e 100644 --- a/src/main/java/me/woach/bone/block/BoneFireBlock.java +++ b/src/main/java/me/woach/bone/block/BoneFireBlock.java @@ -3,12 +3,7 @@ import me.woach.bone.block.entity.BlockEntityTypesRegistry; import me.woach.bone.block.entity.BoneForgeBlockEntity; import me.woach.bone.items.EssenceItem; -import net.minecraft.block.AbstractBlock; -import net.minecraft.block.Block; -import net.minecraft.block.BlockState; -import net.minecraft.block.Blocks; -import net.minecraft.block.MapColor; -import net.minecraft.block.ShapeContext; +import net.minecraft.block.*; import net.minecraft.block.entity.BlockEntity; import net.minecraft.block.piston.PistonBehavior; import net.minecraft.entity.Entity; diff --git a/src/main/java/me/woach/bone/block/entity/BoneForgeBlockEntity.java b/src/main/java/me/woach/bone/block/entity/BoneForgeBlockEntity.java index d65325f..3632939 100644 --- a/src/main/java/me/woach/bone/block/entity/BoneForgeBlockEntity.java +++ b/src/main/java/me/woach/bone/block/entity/BoneForgeBlockEntity.java @@ -16,7 +16,8 @@ import net.minecraft.entity.player.PlayerEntity; import net.minecraft.inventory.Inventories; import net.minecraft.inventory.Inventory; -import net.minecraft.item.*; +import net.minecraft.item.Item; +import net.minecraft.item.ItemStack; import net.minecraft.nbt.NbtCompound; import net.minecraft.network.PacketByteBuf; import net.minecraft.server.network.ServerPlayerEntity; diff --git a/src/main/java/me/woach/bone/effects/BoneEffectRegistry.java b/src/main/java/me/woach/bone/effects/BoneEffectRegistry.java index 948c629..cc9b45d 100644 --- a/src/main/java/me/woach/bone/effects/BoneEffectRegistry.java +++ b/src/main/java/me/woach/bone/effects/BoneEffectRegistry.java @@ -2,10 +2,6 @@ import me.woach.bone.Bone; import net.minecraft.enchantment.Enchantment; -import net.minecraft.enchantment.EnchantmentTarget; -import net.minecraft.enchantment.Enchantments; -import net.minecraft.enchantment.LuckEnchantment; -import net.minecraft.entity.EquipmentSlot; import net.minecraft.registry.Registries; import net.minecraft.registry.Registry; diff --git a/src/main/java/me/woach/bone/items/EssenceItem.java b/src/main/java/me/woach/bone/items/EssenceItem.java index 53bf366..ce6d857 100644 --- a/src/main/java/me/woach/bone/items/EssenceItem.java +++ b/src/main/java/me/woach/bone/items/EssenceItem.java @@ -1,7 +1,5 @@ package me.woach.bone.items; -import java.util.List; - import net.fabricmc.fabric.api.item.v1.FabricItemSettings; import net.minecraft.client.item.TooltipContext; import net.minecraft.item.Item; @@ -13,6 +11,8 @@ import net.minecraft.util.StringIdentifiable; import net.minecraft.world.World; +import java.util.List; + public class EssenceItem extends Item { public EssenceItem() { super(new FabricItemSettings().maxCount(16).rarity(Rarity.EPIC)); diff --git a/src/main/java/me/woach/bone/items/ItemsRegistry.java b/src/main/java/me/woach/bone/items/ItemsRegistry.java index 4202d00..a4e2019 100644 --- a/src/main/java/me/woach/bone/items/ItemsRegistry.java +++ b/src/main/java/me/woach/bone/items/ItemsRegistry.java @@ -1,8 +1,5 @@ package me.woach.bone.items; -import java.util.Arrays; -import java.util.function.Supplier; - import me.woach.bone.Bone; import me.woach.bone.block.BlocksRegistry; import me.woach.bone.material.BonesteelArmorMaterial; @@ -10,21 +7,16 @@ import net.fabricmc.fabric.api.item.v1.FabricItemSettings; import net.fabricmc.fabric.api.itemgroup.v1.ItemGroupEvents; import net.minecraft.data.client.BlockStateVariantMap.QuadFunction; -import net.minecraft.item.ArmorItem; +import net.minecraft.item.*; import net.minecraft.item.ArmorItem.Type; -import net.minecraft.item.AxeItem; -import net.minecraft.item.BlockItem; -import net.minecraft.item.HoeItem; -import net.minecraft.item.Item; -import net.minecraft.item.PickaxeItem; -import net.minecraft.item.ShovelItem; -import net.minecraft.item.SwordItem; -import net.minecraft.item.ToolMaterial; import net.minecraft.registry.Registries; import net.minecraft.registry.Registry; import net.minecraft.util.Rarity; import org.jetbrains.annotations.Nullable; +import java.util.Arrays; +import java.util.function.Supplier; + public enum ItemsRegistry { BONE_ITEM("bone", BoneItem::new), BONE_FORGE_BLOCK_ITEM("bone_forge", () -> new BlockItem(BlocksRegistry.BONE_FORGE_BLOCK.get(), diff --git a/src/main/java/me/woach/bone/mixin/EntitiesDropBones.java b/src/main/java/me/woach/bone/mixin/EntitiesDropBones.java index f37a7f9..b9bcc91 100644 --- a/src/main/java/me/woach/bone/mixin/EntitiesDropBones.java +++ b/src/main/java/me/woach/bone/mixin/EntitiesDropBones.java @@ -3,15 +3,11 @@ import me.woach.bone.bonedata.AbstractBone; import me.woach.bone.bonedata.BoneRegistry; import net.minecraft.enchantment.EnchantmentHelper; -import net.minecraft.enchantment.Enchantments; import net.minecraft.entity.Entity; import net.minecraft.entity.EntityType; import net.minecraft.entity.LivingEntity; import net.minecraft.entity.damage.DamageSource; import net.minecraft.entity.player.PlayerEntity; -import net.minecraft.nbt.NbtCompound; -import net.minecraft.nbt.NbtElement; -import net.minecraft.nbt.NbtList; import net.minecraft.util.Identifier; import net.minecraft.world.World; import org.jetbrains.annotations.Nullable; From 1c1d417d7ff8099fe355391e892f54cc39d8a5d8 Mon Sep 17 00:00:00 2001 From: JuliaLange Date: Sat, 2 Mar 2024 03:15:23 -0800 Subject: [PATCH 3/5] Adds Hog Effect Hog effect causes item use ticks to skip on food items. This was the only way I could find to implement it, as you don't have access to enchantments on Item or ItemStack, and intercepting calls to ItemStack.getMaxUseTime proved fruitless. The Every (5 - HOG_LEVEL) ticks are skipped, meaning at HOG_LEVEL 3 every other tick is skipped, halfing the duration of eating. --- .../bone/effects/BoneEffectRegistry.java | 3 +- .../java/me/woach/bone/effects/HogEffect.java | 11 +++++ .../woach/bone/mixin/hogDecreasesEating.java | 41 +++++++++++++++++++ .../resources/assets/bone/lang/en_us.json | 3 +- src/main/resources/bone.mixins.json | 3 +- src/main/resources/data/bone/bones/pig.json | 2 +- 6 files changed, 59 insertions(+), 4 deletions(-) create mode 100644 src/main/java/me/woach/bone/effects/HogEffect.java create mode 100644 src/main/java/me/woach/bone/mixin/hogDecreasesEating.java diff --git a/src/main/java/me/woach/bone/effects/BoneEffectRegistry.java b/src/main/java/me/woach/bone/effects/BoneEffectRegistry.java index cc9b45d..9ea0039 100644 --- a/src/main/java/me/woach/bone/effects/BoneEffectRegistry.java +++ b/src/main/java/me/woach/bone/effects/BoneEffectRegistry.java @@ -8,7 +8,8 @@ import java.util.function.Supplier; public enum BoneEffectRegistry { - GREED("greed", GreedEffect::new); + GREED("greed", GreedEffect::new), + HOG("hog", HogEffect::new); private final String path; private final Supplier effectSupplier; diff --git a/src/main/java/me/woach/bone/effects/HogEffect.java b/src/main/java/me/woach/bone/effects/HogEffect.java new file mode 100644 index 0000000..08098d6 --- /dev/null +++ b/src/main/java/me/woach/bone/effects/HogEffect.java @@ -0,0 +1,11 @@ +package me.woach.bone.effects; + +import net.minecraft.enchantment.EnchantmentTarget; +import net.minecraft.entity.EquipmentSlot; + +public class HogEffect extends BoneEffect{ + + protected HogEffect() { + super(Rarity.RARE, EnchantmentTarget.ARMOR_HEAD, EquipmentSlot.HEAD); + } +} diff --git a/src/main/java/me/woach/bone/mixin/hogDecreasesEating.java b/src/main/java/me/woach/bone/mixin/hogDecreasesEating.java new file mode 100644 index 0000000..898e45f --- /dev/null +++ b/src/main/java/me/woach/bone/mixin/hogDecreasesEating.java @@ -0,0 +1,41 @@ +package me.woach.bone.mixin; + +import me.woach.bone.Bone; +import me.woach.bone.effects.BoneEffectRegistry; +import net.minecraft.enchantment.EnchantmentHelper; +import net.minecraft.entity.Entity; +import net.minecraft.entity.EntityType; +import net.minecraft.entity.EquipmentSlot; +import net.minecraft.entity.LivingEntity; +import net.minecraft.item.ItemStack; +import net.minecraft.world.World; +import org.spongepowered.asm.mixin.Mixin; +import org.spongepowered.asm.mixin.Shadow; +import org.spongepowered.asm.mixin.injection.At; +import org.spongepowered.asm.mixin.injection.Inject; +import org.spongepowered.asm.mixin.injection.callback.CallbackInfo; + +@Mixin(LivingEntity.class) +public abstract class hogDecreasesEating extends Entity { + + @Shadow public abstract ItemStack getEquippedStack(EquipmentSlot var1); + + @Shadow protected int itemUseTimeLeft; + + public hogDecreasesEating(EntityType type, World world) { + super(type, world); + } + + @Inject(method = "tickItemStackUsage", at = @At("HEAD")) + private void extraTicksOnFoodWithHog(ItemStack stack, CallbackInfo ci) { + if (stack.isFood()) { + ItemStack helmet = this.getEquippedStack(EquipmentSlot.HEAD); + int hogLevel = EnchantmentHelper.getLevel(BoneEffectRegistry.HOG.get(), helmet); + if (hogLevel != 0) { + if (this.itemUseTimeLeft % (5 - hogLevel) == 0) { + this.itemUseTimeLeft -= 1; + } + } + } + } +} diff --git a/src/main/resources/assets/bone/lang/en_us.json b/src/main/resources/assets/bone/lang/en_us.json index 9bfae2f..0dab33d 100644 --- a/src/main/resources/assets/bone/lang/en_us.json +++ b/src/main/resources/assets/bone/lang/en_us.json @@ -24,5 +24,6 @@ "item.bone.bone": "Bone", "itemGroup.bone.bone": "Bone", "item.bone.tier": "Tier %s", - "enchantment.bone.greed": "Greed" + "enchantment.bone.greed": "Greed", + "enchantment.bone.hog": "Hog" } \ No newline at end of file diff --git a/src/main/resources/bone.mixins.json b/src/main/resources/bone.mixins.json index 576dc09..84ea057 100644 --- a/src/main/resources/bone.mixins.json +++ b/src/main/resources/bone.mixins.json @@ -6,7 +6,8 @@ "LootPoolAccessor", "EntitiesDropBones", "FirePowersBoneForge", - "greedMimicsLooting" + "greedMimicsLooting", + "hogDecreasesEating" ], "injectors": { "defaultRequire": 1 diff --git a/src/main/resources/data/bone/bones/pig.json b/src/main/resources/data/bone/bones/pig.json index e7c77d3..c34376a 100644 --- a/src/main/resources/data/bone/bones/pig.json +++ b/src/main/resources/data/bone/bones/pig.json @@ -1,6 +1,6 @@ { "enabled": true, "chance": 125, - "effect": "minecraft:looting", + "effect": "bone:hog", "entity": "minecraft:pig" } \ No newline at end of file From 6a3d4aac1361af5866acbe0ffc40722ad9dce67d Mon Sep 17 00:00:00 2001 From: Badtz Date: Sat, 2 Mar 2024 11:17:29 -0800 Subject: [PATCH 4/5] remove kotlin --- build.gradle | 7 ------- gradle.properties | 1 - src/main/resources/fabric.mod.json | 5 ++--- 3 files changed, 2 insertions(+), 11 deletions(-) diff --git a/build.gradle b/build.gradle index e6b8c87..dffefad 100644 --- a/build.gradle +++ b/build.gradle @@ -1,7 +1,6 @@ plugins { id 'fabric-loom' version '1.3-SNAPSHOT' id 'maven-publish' - id "org.jetbrains.kotlin.jvm" version "1.9.10" } version = project.mod_version @@ -60,7 +59,6 @@ dependencies { // Fabric API. This is technically optional, but you probably want it anyway. modImplementation "net.fabricmc.fabric-api:fabric-api:${project.fabric_version}" - modImplementation "net.fabricmc:fabric-language-kotlin:${project.fabric_kotlin_version}" // Uncomment the following line to enable the deprecated Fabric API modules. // These are included in the Fabric API production distribution and allow you to update your mod to the latest modules at a later more convenient time. @@ -79,11 +77,6 @@ tasks.withType(JavaCompile).configureEach { it.options.release = 17 } -tasks.withType(org.jetbrains.kotlin.gradle.tasks.KotlinCompile).all { - kotlinOptions { - jvmTarget = 17 - } -} task copyTask(type: Copy) { from 'build/libs' diff --git a/gradle.properties b/gradle.properties index 8250335..9351cb9 100644 --- a/gradle.properties +++ b/gradle.properties @@ -7,7 +7,6 @@ org.gradle.parallel=true minecraft_version=1.20.1 yarn_mappings=1.20.1+build.10 loader_version=0.14.22 -fabric_kotlin_version=1.10.10+kotlin.1.9.10 # Mod Properties mod_version=1.0.0 diff --git a/src/main/resources/fabric.mod.json b/src/main/resources/fabric.mod.json index f6ad2ec..0539cd4 100644 --- a/src/main/resources/fabric.mod.json +++ b/src/main/resources/fabric.mod.json @@ -30,10 +30,9 @@ "fabricloader": ">=0.14.22", "minecraft": "~1.20.1", "java": ">=17", - "fabric-api": "*", - "fabric-language-kotlin": ">=1.9.10" + "fabric-api": "*" }, "suggests": { "another-mod": "*" } -} +} \ No newline at end of file From c9933f4a493b807472b411b275aa08331d0b4902 Mon Sep 17 00:00:00 2001 From: Badtz Date: Sat, 2 Mar 2024 13:48:39 -0800 Subject: [PATCH 5/5] add firey --- .../me/woach/bone/block/BoneFireBlock.java | 21 ++++++++++++----- .../bone/effects/BoneEffectRegistry.java | 5 ++-- .../me/woach/bone/effects/FieryEffect.java | 23 +++++++++++++++++++ .../resources/assets/bone/lang/en_us.json | 3 ++- src/main/resources/data/bone/bones/bat.json | 2 +- src/main/resources/data/bone/bones/blaze.json | 6 +++++ .../resources/data/bone/bones/blaze.json.wip | 6 ----- .../resources/data/bone/bones/cat.json.wip | 2 +- .../data/bone/bones/chicken.json.wip | 2 +- .../resources/data/bone/bones/cow.json.wip | 2 +- .../data/bone/bones/creeper.json.wip | 2 +- .../resources/data/bone/bones/ocelot.json.wip | 2 +- .../data/bone/bones/skeleton.json.wip | 2 +- .../data/bone/bones/villager.json.wip | 2 +- .../resources/data/bone/bones/wolf.json.wip | 2 +- .../resources/data/bone/bones/zombie.json.wip | 2 +- 16 files changed, 59 insertions(+), 25 deletions(-) create mode 100644 src/main/java/me/woach/bone/effects/FieryEffect.java create mode 100644 src/main/resources/data/bone/bones/blaze.json delete mode 100644 src/main/resources/data/bone/bones/blaze.json.wip diff --git a/src/main/java/me/woach/bone/block/BoneFireBlock.java b/src/main/java/me/woach/bone/block/BoneFireBlock.java index fa0733e..5146b48 100644 --- a/src/main/java/me/woach/bone/block/BoneFireBlock.java +++ b/src/main/java/me/woach/bone/block/BoneFireBlock.java @@ -3,7 +3,12 @@ import me.woach.bone.block.entity.BlockEntityTypesRegistry; import me.woach.bone.block.entity.BoneForgeBlockEntity; import me.woach.bone.items.EssenceItem; -import net.minecraft.block.*; +import net.minecraft.block.AbstractBlock; +import net.minecraft.block.Block; +import net.minecraft.block.BlockState; +import net.minecraft.block.Blocks; +import net.minecraft.block.MapColor; +import net.minecraft.block.ShapeContext; import net.minecraft.block.entity.BlockEntity; import net.minecraft.block.piston.PistonBehavior; import net.minecraft.entity.Entity; @@ -27,8 +32,10 @@ public class BoneFireBlock extends Block { private final float damage; public BoneFireBlock() { - super(AbstractBlock.Settings.create().mapColor(MapColor.LICHEN_GREEN).replaceable().noCollision().breakInstantly() - .luminance(state -> 15).sounds(BlockSoundGroup.WOOL).pistonBehavior(PistonBehavior.DESTROY).nonOpaque()); + super(AbstractBlock.Settings.create().mapColor(MapColor.LICHEN_GREEN).replaceable().noCollision() + .breakInstantly() + .luminance(state -> 15).sounds(BlockSoundGroup.WOOL).pistonBehavior(PistonBehavior.DESTROY) + .nonOpaque()); this.damage = 2; setDefaultState(getStateManager().getDefaultState().with(TYPE, EssenceItem.Types.EMPTY)); } @@ -51,12 +58,13 @@ protected void appendProperties(StateManager.Builder builder) public VoxelShape getOutlineShape(BlockState state, BlockView world, BlockPos pos, ShapeContext context) { return Block.createCuboidShape(0.0, 0.0, 0.0, 16.0, 1.0, 16.0); } + @Override public boolean canPlaceAt(BlockState state, WorldView world, BlockPos pos) { - return world.getBlockState(pos.down()).isSolidBlock(world,pos); + return world.getBlockState(pos.down()).isSolidBlock(world, pos); } - public static void setEssenceState(World world, BlockPos pos, EssenceItem.Types essence) { + public static void setEssenceState(World world, BlockPos pos, EssenceItem.Types essence) { switch (essence) { case JORD: case AEGIR: @@ -80,7 +88,8 @@ public static void essenceCollision(World world, BlockPos pos, Entity entity) { // Update bone forge to match BlockEntity aboveFire = world.getBlockEntity(pos.up()); - if (aboveFire != null && aboveFire.getType().equals(BlockEntityTypesRegistry.BONE_FORGE_BLOCK_ENTITY.get())) { + if (aboveFire != null + && aboveFire.getType().equals(BlockEntityTypesRegistry.BONE_FORGE_BLOCK_ENTITY.get())) { BoneForgeBlockEntity forge = (BoneForgeBlockEntity) aboveFire; forge.attemptToForge(); diff --git a/src/main/java/me/woach/bone/effects/BoneEffectRegistry.java b/src/main/java/me/woach/bone/effects/BoneEffectRegistry.java index 9ea0039..f152855 100644 --- a/src/main/java/me/woach/bone/effects/BoneEffectRegistry.java +++ b/src/main/java/me/woach/bone/effects/BoneEffectRegistry.java @@ -1,14 +1,15 @@ package me.woach.bone.effects; +import java.util.function.Supplier; + import me.woach.bone.Bone; import net.minecraft.enchantment.Enchantment; import net.minecraft.registry.Registries; import net.minecraft.registry.Registry; -import java.util.function.Supplier; - public enum BoneEffectRegistry { GREED("greed", GreedEffect::new), + FIERY("firey", FieryEffect::new), HOG("hog", HogEffect::new); private final String path; diff --git a/src/main/java/me/woach/bone/effects/FieryEffect.java b/src/main/java/me/woach/bone/effects/FieryEffect.java new file mode 100644 index 0000000..09f840f --- /dev/null +++ b/src/main/java/me/woach/bone/effects/FieryEffect.java @@ -0,0 +1,23 @@ +package me.woach.bone.effects; + +import net.minecraft.enchantment.EnchantmentTarget; +import net.minecraft.entity.Entity; +import net.minecraft.entity.EquipmentSlot; +import net.minecraft.entity.LivingEntity; + +public class FieryEffect extends BoneEffect { + + protected FieryEffect() { + super(Rarity.RARE, EnchantmentTarget.WEAPON, EquipmentSlot.MAINHAND); + } + + @Override + public void onTargetDamaged(LivingEntity user, Entity target, int level) { + if (target instanceof LivingEntity) { + target.setFireTicks(4 * 20 * level); + } + + super.onTargetDamaged(user, target, level); + } + +} diff --git a/src/main/resources/assets/bone/lang/en_us.json b/src/main/resources/assets/bone/lang/en_us.json index 0dab33d..a361aa8 100644 --- a/src/main/resources/assets/bone/lang/en_us.json +++ b/src/main/resources/assets/bone/lang/en_us.json @@ -25,5 +25,6 @@ "itemGroup.bone.bone": "Bone", "item.bone.tier": "Tier %s", "enchantment.bone.greed": "Greed", - "enchantment.bone.hog": "Hog" + "enchantment.bone.hog": "Hog", + "enchantment.bone.firey": "Firey" } \ No newline at end of file diff --git a/src/main/resources/data/bone/bones/bat.json b/src/main/resources/data/bone/bones/bat.json index a70134a..fc5634e 100644 --- a/src/main/resources/data/bone/bones/bat.json +++ b/src/main/resources/data/bone/bones/bat.json @@ -1,5 +1,5 @@ { "enabled": true, "effect": "bone:sonar", - "entity": "minecraft:entities/bat" + "entity": "minecraft/bat" } \ No newline at end of file diff --git a/src/main/resources/data/bone/bones/blaze.json b/src/main/resources/data/bone/bones/blaze.json new file mode 100644 index 0000000..5dada2a --- /dev/null +++ b/src/main/resources/data/bone/bones/blaze.json @@ -0,0 +1,6 @@ +{ + "enabled": true, + "chance": 125, + "effect": "bone:firey", + "entity": "minecraft:blaze" +} \ No newline at end of file diff --git a/src/main/resources/data/bone/bones/blaze.json.wip b/src/main/resources/data/bone/bones/blaze.json.wip deleted file mode 100644 index ad00633..0000000 --- a/src/main/resources/data/bone/bones/blaze.json.wip +++ /dev/null @@ -1,6 +0,0 @@ -{ - "enabled": true, - "chance": 0.125, - "effect": "bone:fiery", - "entity": "minecraft:entities/blaze" -} \ No newline at end of file diff --git a/src/main/resources/data/bone/bones/cat.json.wip b/src/main/resources/data/bone/bones/cat.json.wip index 064b142..a882da5 100644 --- a/src/main/resources/data/bone/bones/cat.json.wip +++ b/src/main/resources/data/bone/bones/cat.json.wip @@ -2,5 +2,5 @@ "enabled": true, "chance": 0.125, "effect": "bone:feline_grace", - "entity": "minecraft:entities/cat" + "entity": "minecraft:cat" } \ No newline at end of file diff --git a/src/main/resources/data/bone/bones/chicken.json.wip b/src/main/resources/data/bone/bones/chicken.json.wip index c91be17..5f0928e 100644 --- a/src/main/resources/data/bone/bones/chicken.json.wip +++ b/src/main/resources/data/bone/bones/chicken.json.wip @@ -2,5 +2,5 @@ "enabled": true, "chance": 0.125, "effect": "bone:glide", - "entity": "minecraft:entities/chicken" + "entity": "minecraft:chicken" } \ No newline at end of file diff --git a/src/main/resources/data/bone/bones/cow.json.wip b/src/main/resources/data/bone/bones/cow.json.wip index ff71fd8..7f69f4a 100644 --- a/src/main/resources/data/bone/bones/cow.json.wip +++ b/src/main/resources/data/bone/bones/cow.json.wip @@ -2,5 +2,5 @@ "enabled": true, "chance": 0.125, "effect": "bone:green_thumb", - "entity": "minecraft:entities/cow" + "entity": "minecraft:cow" } \ No newline at end of file diff --git a/src/main/resources/data/bone/bones/creeper.json.wip b/src/main/resources/data/bone/bones/creeper.json.wip index 10a912d..acbeded 100644 --- a/src/main/resources/data/bone/bones/creeper.json.wip +++ b/src/main/resources/data/bone/bones/creeper.json.wip @@ -2,5 +2,5 @@ "enabled": true, "chance": 0.125, "effect": "bone:exploding", - "entity": "minecraft:entities/creeper" + "entity": "minecraft:creeper" } \ No newline at end of file diff --git a/src/main/resources/data/bone/bones/ocelot.json.wip b/src/main/resources/data/bone/bones/ocelot.json.wip index 1db3015..cbd683d 100644 --- a/src/main/resources/data/bone/bones/ocelot.json.wip +++ b/src/main/resources/data/bone/bones/ocelot.json.wip @@ -2,5 +2,5 @@ "enabled": true, "chance": 0.125, "effect": "bone:feline_grace", - "entity": "minecraft:entities/ocelot" + "entity": "minecraft:ocelot" } \ No newline at end of file diff --git a/src/main/resources/data/bone/bones/skeleton.json.wip b/src/main/resources/data/bone/bones/skeleton.json.wip index 5f28faa..db5eed9 100644 --- a/src/main/resources/data/bone/bones/skeleton.json.wip +++ b/src/main/resources/data/bone/bones/skeleton.json.wip @@ -2,5 +2,5 @@ "enabled": true, "chance": 0.125, "effect": "bone:draw_weight", - "entity": "minecraft:entities/skeleton" + "entity": "minecraft:skeleton" } \ No newline at end of file diff --git a/src/main/resources/data/bone/bones/villager.json.wip b/src/main/resources/data/bone/bones/villager.json.wip index 5e32af3..a82996c 100644 --- a/src/main/resources/data/bone/bones/villager.json.wip +++ b/src/main/resources/data/bone/bones/villager.json.wip @@ -2,5 +2,5 @@ "enabled": true, "chance": 0.125, "effect": "bone:villager", - "entity": "minecraft:entities/villager" + "entity": "minecraft:villager" } \ No newline at end of file diff --git a/src/main/resources/data/bone/bones/wolf.json.wip b/src/main/resources/data/bone/bones/wolf.json.wip index 6b6a41b..03fef76 100644 --- a/src/main/resources/data/bone/bones/wolf.json.wip +++ b/src/main/resources/data/bone/bones/wolf.json.wip @@ -2,5 +2,5 @@ "enabled": true, "chance": 0.125, "effect": "bone:hungry", - "entity": "minecraft:entities/wolf" + "entity": "minecraft:wolf" } \ No newline at end of file diff --git a/src/main/resources/data/bone/bones/zombie.json.wip b/src/main/resources/data/bone/bones/zombie.json.wip index 1464334..2450780 100644 --- a/src/main/resources/data/bone/bones/zombie.json.wip +++ b/src/main/resources/data/bone/bones/zombie.json.wip @@ -2,5 +2,5 @@ "enabled": true, "chance": 0.125, "effect": "bone:curse_of_the_fallen", - "entity": "minecraft:entities/zombie" + "entity": "minecraft:zombie" } \ No newline at end of file