From c9933f4a493b807472b411b275aa08331d0b4902 Mon Sep 17 00:00:00 2001 From: Badtz Date: Sat, 2 Mar 2024 13:48:39 -0800 Subject: [PATCH] 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