Skip to content

Commit 314146e

Browse files
committed
Add "delay" meta for MOB_SPAWNER
1 parent a7b6d8c commit 314146e

3 files changed

Lines changed: 20 additions & 4 deletions

File tree

src/main/java/com/laytonsmith/abstraction/MCCreatureSpawner.java

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -4,8 +4,8 @@
44
import com.laytonsmith.abstraction.enums.MCEntityType;
55

66
public interface MCCreatureSpawner extends MCBlockState {
7-
87
MCEntityType getSpawnedType();
9-
108
void setSpawnedType(MCEntityType type);
9+
int getDelay();
10+
void setDelay(int delay);
1111
}

src/main/java/com/laytonsmith/abstraction/bukkit/BukkitMCCreatureSpawner.java

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -25,4 +25,15 @@ public void setSpawnedType(MCEntityType type) {
2525
cs.setSpawnedType(((BukkitMCEntityType) type).getConcrete());
2626
cs.update();
2727
}
28+
29+
@Override
30+
public int getDelay() {
31+
return cs.getDelay();
32+
}
33+
34+
@Override
35+
public void setDelay(int delay) {
36+
cs.setDelay(delay);
37+
cs.update();
38+
}
2839
}

src/main/java/com/laytonsmith/core/ObjectGenerator.java

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -400,6 +400,7 @@ public Construct itemMeta(MCItemStack is, Target t) {
400400
} else if(bs instanceof MCCreatureSpawner) {
401401
MCCreatureSpawner mccs = (MCCreatureSpawner) bs;
402402
ma.set("spawntype", mccs.getSpawnedType().name());
403+
ma.set("delay", new CInt(mccs.getDelay(), t), t);
403404
} else if(bs instanceof MCBrewingStand) {
404405
MCBrewingStand brewStand = (MCBrewingStand) bs;
405406
ma.set("brewtime", new CInt(brewStand.getBrewingTime(), t), t);
@@ -679,12 +680,16 @@ public MCItemMeta itemMeta(Construct c, MCMaterial mat, Target t) throws ConfigR
679680
banner.update();
680681
bsm.setBlockState(banner);
681682
} else if(bs instanceof MCCreatureSpawner) {
683+
MCCreatureSpawner mccs = (MCCreatureSpawner) bs;
682684
if(ma.containsKey("spawntype")) {
683-
MCCreatureSpawner mccs = (MCCreatureSpawner) bs;
684685
MCEntityType type = MCEntityType.valueOf(ma.get("spawntype", t).val().toUpperCase());
685686
mccs.setSpawnedType(type);
686-
bsm.setBlockState(bs);
687687
}
688+
if(ma.containsKey("delay")) {
689+
int delay = Static.getInt32(ma.get("delay", t), t);
690+
mccs.setDelay(delay);
691+
}
692+
bsm.setBlockState(bs);
688693
} else if(bs instanceof MCBrewingStand) {
689694
MCBrewingStand brewStand = (MCBrewingStand) bs;
690695
if(ma.containsKey("brewtime")) {

0 commit comments

Comments
 (0)