Skip to content

Commit

Permalink
Fixed Villager levelup issues. Closes #239
Browse files Browse the repository at this point in the history
  • Loading branch information
GirafiStudios committed May 14, 2021
1 parent b673980 commit e9b19e4
Show file tree
Hide file tree
Showing 3 changed files with 3 additions and 5 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@ protected boolean shouldExecute(@Nonnull ServerWorld world, @Nonnull VillagerEnt
@Override
protected void startExecuting(@Nonnull ServerWorld world, @Nonnull VillagerEntity entity, long gameTime) {
if (entity instanceof AtumVillagerEntity) {
entity.setVillagerData(((AtumVillagerEntity) entity).getAtumVillagerData().withProfession(AtumVillagerProfession.NONE.get()));
((AtumVillagerEntity) entity).setAtumVillagerData(((AtumVillagerEntity) entity).getAtumVillagerData().withProfession(AtumVillagerProfession.NONE.get()));
entity.resetBrain(world);
}
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@ public class AtumVillagerData extends VillagerData { //Same as vanilla VillagerD
public AtumVillagerData(AtumVillagerProfession profession, int level, Race race) {
super(null, null, level);
this.profession = profession;
this.level = level;
this.level = Math.max(1, level);
this.race = race;
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -216,7 +216,7 @@ public Entity changeDimension(@Nonnull ServerWorld server, @Nonnull ITeleporter
@Deprecated
//Use getAtumVillagerData
public VillagerData getVillagerData() {
return null;
return getAtumVillagerData();
}

public AtumVillagerData getAtumVillagerData() {
Expand All @@ -227,8 +227,6 @@ public AtumVillagerData getAtumVillagerData() {
public void setVillagerData(@Nonnull VillagerData data) {
if (data instanceof AtumVillagerData) {
this.setAtumVillagerData((AtumVillagerData) data);
} else {
Atum.LOG.debug("VillagerData present, but shouldn't be.");
}
//Ignore places where vanilla sets villager data
}
Expand Down

0 comments on commit e9b19e4

Please sign in to comment.