Skip to content

Commit

Permalink
add firey
Browse files Browse the repository at this point in the history
  • Loading branch information
Badtz committed Mar 2, 2024
1 parent 6a3d4aa commit c9933f4
Show file tree
Hide file tree
Showing 16 changed files with 59 additions and 25 deletions.
21 changes: 15 additions & 6 deletions src/main/java/me/woach/bone/block/BoneFireBlock.java
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand All @@ -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));
}
Expand All @@ -51,12 +58,13 @@ protected void appendProperties(StateManager.Builder<Block, BlockState> 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:
Expand All @@ -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();
Expand Down
5 changes: 3 additions & 2 deletions src/main/java/me/woach/bone/effects/BoneEffectRegistry.java
Original file line number Diff line number Diff line change
@@ -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;
Expand Down
23 changes: 23 additions & 0 deletions src/main/java/me/woach/bone/effects/FieryEffect.java
Original file line number Diff line number Diff line change
@@ -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);
}

}
3 changes: 2 additions & 1 deletion src/main/resources/assets/bone/lang/en_us.json
Original file line number Diff line number Diff line change
Expand Up @@ -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"
}
2 changes: 1 addition & 1 deletion src/main/resources/data/bone/bones/bat.json
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
{
"enabled": true,
"effect": "bone:sonar",
"entity": "minecraft:entities/bat"
"entity": "minecraft/bat"
}
6 changes: 6 additions & 0 deletions src/main/resources/data/bone/bones/blaze.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
{
"enabled": true,
"chance": 125,
"effect": "bone:firey",
"entity": "minecraft:blaze"
}
6 changes: 0 additions & 6 deletions src/main/resources/data/bone/bones/blaze.json.wip

This file was deleted.

2 changes: 1 addition & 1 deletion src/main/resources/data/bone/bones/cat.json.wip
Original file line number Diff line number Diff line change
Expand Up @@ -2,5 +2,5 @@
"enabled": true,
"chance": 0.125,
"effect": "bone:feline_grace",
"entity": "minecraft:entities/cat"
"entity": "minecraft:cat"
}
2 changes: 1 addition & 1 deletion src/main/resources/data/bone/bones/chicken.json.wip
Original file line number Diff line number Diff line change
Expand Up @@ -2,5 +2,5 @@
"enabled": true,
"chance": 0.125,
"effect": "bone:glide",
"entity": "minecraft:entities/chicken"
"entity": "minecraft:chicken"
}
2 changes: 1 addition & 1 deletion src/main/resources/data/bone/bones/cow.json.wip
Original file line number Diff line number Diff line change
Expand Up @@ -2,5 +2,5 @@
"enabled": true,
"chance": 0.125,
"effect": "bone:green_thumb",
"entity": "minecraft:entities/cow"
"entity": "minecraft:cow"
}
2 changes: 1 addition & 1 deletion src/main/resources/data/bone/bones/creeper.json.wip
Original file line number Diff line number Diff line change
Expand Up @@ -2,5 +2,5 @@
"enabled": true,
"chance": 0.125,
"effect": "bone:exploding",
"entity": "minecraft:entities/creeper"
"entity": "minecraft:creeper"
}
2 changes: 1 addition & 1 deletion src/main/resources/data/bone/bones/ocelot.json.wip
Original file line number Diff line number Diff line change
Expand Up @@ -2,5 +2,5 @@
"enabled": true,
"chance": 0.125,
"effect": "bone:feline_grace",
"entity": "minecraft:entities/ocelot"
"entity": "minecraft:ocelot"
}
2 changes: 1 addition & 1 deletion src/main/resources/data/bone/bones/skeleton.json.wip
Original file line number Diff line number Diff line change
Expand Up @@ -2,5 +2,5 @@
"enabled": true,
"chance": 0.125,
"effect": "bone:draw_weight",
"entity": "minecraft:entities/skeleton"
"entity": "minecraft:skeleton"
}
2 changes: 1 addition & 1 deletion src/main/resources/data/bone/bones/villager.json.wip
Original file line number Diff line number Diff line change
Expand Up @@ -2,5 +2,5 @@
"enabled": true,
"chance": 0.125,
"effect": "bone:villager",
"entity": "minecraft:entities/villager"
"entity": "minecraft:villager"
}
2 changes: 1 addition & 1 deletion src/main/resources/data/bone/bones/wolf.json.wip
Original file line number Diff line number Diff line change
Expand Up @@ -2,5 +2,5 @@
"enabled": true,
"chance": 0.125,
"effect": "bone:hungry",
"entity": "minecraft:entities/wolf"
"entity": "minecraft:wolf"
}
2 changes: 1 addition & 1 deletion src/main/resources/data/bone/bones/zombie.json.wip
Original file line number Diff line number Diff line change
Expand Up @@ -2,5 +2,5 @@
"enabled": true,
"chance": 0.125,
"effect": "bone:curse_of_the_fallen",
"entity": "minecraft:entities/zombie"
"entity": "minecraft:zombie"
}

0 comments on commit c9933f4

Please sign in to comment.