Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 2 additions & 0 deletions src/main/java/com/mmyzd/nmsot/SpawningEntry.java
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,7 @@ public class SpawningEntry {
public World world;
public Block block;
public Entity entity;
public boolean fromSpawner;

public void init(LivingSpawnEvent.CheckSpawn event) {
x = (int) Math.floor(event.getX());
Expand All @@ -26,6 +27,7 @@ public void init(LivingSpawnEvent.CheckSpawn event) {
block = blockState.getBlock();
damage = block.damageDropped(blockState);
entity = event.getEntity();
fromSpawner = event.isSpawner();
}

}
2 changes: 2 additions & 0 deletions src/main/java/com/mmyzd/nmsot/rule/RuleSet.java
Original file line number Diff line number Diff line change
Expand Up @@ -187,6 +187,8 @@ Rule factor(LinkedList<Character> s) throws Exception {
rule = new RuleLight(s);
} else if (getTokenEqualsIgnoreCase(s, "daytime")) {
rule = new RuleDayTime(s);
} else if (getTokenEqualsIgnoreCase(s, "spawner")) {
rule = new RuleSpawner();
}
}
if (rule == null)
Expand Down
12 changes: 12 additions & 0 deletions src/main/java/com/mmyzd/nmsot/rule/RuleSpawner.java
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
package com.mmyzd.nmsot.rule;

import com.mmyzd.nmsot.SpawningEntry;

public class RuleSpawner extends Rule {

@Override
public boolean apply(SpawningEntry entry) {
return entry.fromSpawner;
}

}