Skip to content

Commit

Permalink
Add the coral death rule
Browse files Browse the repository at this point in the history
Fixes #46
  • Loading branch information
haykam821 authored and Gegy committed Mar 12, 2023
1 parent a1f17b6 commit 16af1f2
Show file tree
Hide file tree
Showing 3 changed files with 6 additions and 0 deletions.
1 change: 1 addition & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -39,6 +39,7 @@ Leukocyte provides various rules that can be applied within authorities. These r
- `fluid_flow` controls whether fluids flow
- `ice_melt` controls whether ice and frosted ice melt
- `snow_fall` controls whether snow can form on surfaces during snowfall
- `coral_death` controls whether coral and coral fan blocks can die
- `throw_projectiles` controls whether players can throw eggs, snowballs, or tridents
- `shear_entities` controls whether entities such as sheep and mooshrooms can be sheared by players and dispensers

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -47,6 +47,7 @@ public final class ProtectionRule {
public static final ProtectionRule FLUID_FLOW = register("fluid_flow");
public static final ProtectionRule ICE_MELT = register("ice_melt");
public static final ProtectionRule SNOW_FALL = register("snow_fall");
public static final ProtectionRule CORAL_DEATH = register("coral_death");

public static final ProtectionRule SPAWN_ANIMALS = register("spawn_animals");
public static final ProtectionRule SPAWN_MONSTERS = register("spawn_monsters");
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,7 @@
import xyz.nucleoid.stimuli.event.block.BlockDropItemsEvent;
import xyz.nucleoid.stimuli.event.block.BlockPlaceEvent;
import xyz.nucleoid.stimuli.event.block.BlockUseEvent;
import xyz.nucleoid.stimuli.event.block.CoralDeathEvent;
import xyz.nucleoid.stimuli.event.block.DispenserActivateEvent;
import xyz.nucleoid.stimuli.event.entity.EntityShearEvent;
import xyz.nucleoid.stimuli.event.entity.EntitySpawnEvent;
Expand Down Expand Up @@ -197,5 +198,8 @@ private void applyWorldRules(ProtectionRuleMap rules, EventRegistrar events) {

this.forRule(events, rules.test(ProtectionRule.SNOW_FALL))
.applySimple(SnowFallEvent.EVENT, rule -> (world, pos) -> rule);

this.forRule(events, rules.test(ProtectionRule.CORAL_DEATH))
.applySimple(CoralDeathEvent.EVENT, rule -> (world, pos, from, to) -> rule);
}
}

0 comments on commit 16af1f2

Please sign in to comment.