Skip to content

Commit

Permalink
Add nitwit and fix a bug in villager spawning
Browse files Browse the repository at this point in the history
Version number up
  • Loading branch information
bensku committed Nov 24, 2016
1 parent bc28158 commit c3c26b2
Show file tree
Hide file tree
Showing 4 changed files with 19 additions and 7 deletions.
2 changes: 1 addition & 1 deletion gradle.properties
Original file line number Diff line number Diff line change
@@ -1,3 +1,3 @@
groupid=ch.njol
name=skript
version=2.2-dev21c
version=2.2-dev22
12 changes: 9 additions & 3 deletions src/main/java/ch/njol/skript/entity/VillagerData.java
Original file line number Diff line number Diff line change
Expand Up @@ -49,19 +49,25 @@ public class VillagerData extends EntityData<Villager> {

static {
// professions in order!
// FARMER(0), LIBRARIAN(1), PRIEST(2), BLACKSMITH(3), BUTCHER(4);
register(VillagerData.class, "villager", Villager.class, 0,
"villager", "farmer", "librarian", "priest", "blacksmith", "butcher");
// NORMAL(-1), FARMER(0), LIBRARIAN(1), PRIEST(2), BLACKSMITH(3), BUTCHER(4), NITWIT(5);

Variables.yggdrasil.registerSingleClass(Profession.class, "Villager.Profession");

if (Skript.isRunningMinecraft(1, 10)) { // Post 1.10: Not all professions go for villagers
register(VillagerData.class, "villager", Villager.class, 0,
"normal", "villager", "farmer", "librarian", "priest", "blacksmith", "butcher", "nitwit");
// Normal is for zombie villagers, but needs to be here, since someone thought changing first element in enum was good idea :(

professions = new ArrayList<>();
for (Profession prof : Profession.values()) {
if (!prof.isZombie())
professions.add(prof);
}
} else { // Pre 1.10: method Profession#isZombie() doesn't exist
register(VillagerData.class, "villager", Villager.class, 0,
"villager", "farmer", "librarian", "priest", "blacksmith", "butcher", "nitwit");
// Normal is for zombie villagers, but needs to be here, since someone thought changing first element in enum was good idea :(

List<Profession> prof = Arrays.asList(Profession.values());
assert prof != null;
professions = prof;
Expand Down
4 changes: 2 additions & 2 deletions src/main/java/ch/njol/skript/entity/ZombieVillagerData.java
Original file line number Diff line number Diff line change
Expand Up @@ -40,12 +40,12 @@ public class ZombieVillagerData extends EntityData<ZombieVillager> {
static {
if (villagerSupport)
register(ZombieVillagerData.class, "zombie villager", ZombieVillager.class, 0,
"zombie villager", "zombie farmer", "zombie librarian", "zombie priest", "zombie blacksmith", "zombie butcher");
"zombie villager", "zombie farmer", "zombie librarian", "zombie priest", "zombie blacksmith", "zombie butcher", "zombie nitwit");


}

private Villager.Profession profession = Villager.Profession.FARMER;
private Villager.Profession profession = Villager.Profession.NORMAL;

public ZombieVillagerData() {}

Expand Down
8 changes: 7 additions & 1 deletion src/main/resources/lang/english.lang
Original file line number Diff line number Diff line change
Expand Up @@ -691,7 +691,10 @@ entities:
pattern: <age> [black]smith(|1¦s)|(4¦)[black]smith (kid(|1¦s)|child(|1¦ren))
butcher:
name: butcher¦s
pattern: <age> butcher(|1¦s)|(4¦)butcher (kid(|1¦s)|child(|1¦ren))
pattern: <age> butcher(|1¦s)|(4¦)butcher (kid(|1¦s)|child(|1¦ren))
nitwit:
name: nitwit¦s
pattern: <age> nitwit(|1¦s)|(4¦)nitwit (kid(|1¦s)|child(|1¦ren))
witch:
name: witch¦es
pattern: witch(|1¦es)
Expand Down Expand Up @@ -844,6 +847,9 @@ entities:
zombie butcher:
name: zombie butcher¦s
pattern: zombie butcher(|1¦s)
zombie nitwit:
name: zombie nitwit¦s
pattern: zombie nitwit(|1¦s)
evoker:
name: evoker¦s
pattern: evoker(|1¦s)
Expand Down

0 comments on commit c3c26b2

Please sign in to comment.