Skip to content

Commit

Permalink
~ Change: Egg auto hatch now use tag.
Browse files Browse the repository at this point in the history
  • Loading branch information
FaeWulf committed Oct 8, 2024
1 parent 24177a4 commit 7cace4f
Show file tree
Hide file tree
Showing 3 changed files with 13 additions and 5 deletions.
6 changes: 4 additions & 2 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@

- Goat drops wool and mutton.
- Shear can be used on `Saplings`, `Bamboo`, `Vine` and `Sugar cane` to prevent it from growing.
- Use the clock will show current time.
- Using the clock will show current time.
- Reverse phantom spawn condition.
- Slime chunk detector: Holding a `Slime Ball`, `Slime Block`, or items with the `diversity:slime_detector` tag will
emit
Expand All @@ -19,10 +19,11 @@
- `Bonemeal small flower` now requires dirt with tag `diversity:rich_soil`to be bonemealed. Default contains `Mycelium`.
- `Torch lights target on fire` now use the tag `diversity:flame_weapon`, default list contains `torch` and
`soul_torch`.
- Added swing animation for some feature use the right-click event.
- Added swing animation for some feature uses the right-click event.
- Rework Bone meal coral, small flower to prevent hard conflict.
- `Fox buries Item` now buries item from its mouth, if not then use loot table (bury random items).
- `Bigger bookshelf radius for enchanting table` feature now toggleable.
- `Egg auto hatch` now only hatch on blocks have the tag `diversity:egg_hatchable`, default list contains `hay_block`.

### Removed

Expand All @@ -32,4 +33,5 @@

- Fixed issue with `Easy Shulkerboxes` compatibility.
- Duplicate Text Display on named Shulker.
- `No anvil xp limit` crash.
- Missing command in forge/neoforge.
Original file line number Diff line number Diff line change
Expand Up @@ -11,13 +11,13 @@
import net.minecraft.world.item.ItemStack;
import net.minecraft.world.item.Items;
import net.minecraft.world.level.Level;
import net.minecraft.world.level.block.Blocks;
import net.minecraft.world.level.block.state.BlockState;
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;
import xyz.faewulf.diversity.util.compare;
import xyz.faewulf.diversity.util.config.ModConfigs;

@Mixin(ItemEntity.class)
Expand All @@ -29,7 +29,7 @@ public onGroundEggAutoHatch(EntityType<?> type, Level world) {
super(type, world);
}

@Inject(method = "tick", at = @At(value = "INVOKE", target = "Lnet/minecraft/world/entity/item/ItemEntity;discard()V", ordinal = 1, shift = At.Shift.BEFORE))
@Inject(method = "tick", at = @At(value = "INVOKE", target = "Lnet/minecraft/world/entity/item/ItemEntity;discard()V", ordinal = 1))
private void tickInject(CallbackInfo ci) {

if (!ModConfigs.chicken_egg_despawn_tryhatch)
Expand All @@ -43,7 +43,7 @@ private void tickInject(CallbackInfo ci) {
BlockState blockState = this.level().getBlockState(this.blockPosition().below());

//hatch on haybale only
if (blockState.getBlock() != Blocks.HAY_BLOCK)
if (!compare.isHasTag(blockState.getBlock(), "diversity:egg_hatchable"))
return;

int count = this.getItem().getCount();
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
{
"replace": false,
"values": [
"minecraft:hay_block"
]
}

0 comments on commit 7cace4f

Please sign in to comment.