Run source format

This commit is contained in:
fullwall 2022-02-28 17:01:59 +08:00
parent b31f1a351c
commit dfb63084b2
3 changed files with 10 additions and 13 deletions

View File

@ -141,7 +141,7 @@ public class AStarNavigationStrategy extends AbstractPathStrategy {
} }
Location loc = npc.getEntity().getLocation(NPC_LOCATION); Location loc = npc.getEntity().getLocation(NPC_LOCATION);
/* Proper door movement - gets stuck on corners at times /* Proper door movement - gets stuck on corners at times
Block block = currLoc.getWorld().getBlockAt(vector.getBlockX(), vector.getBlockY(), vector.getBlockZ()); Block block = currLoc.getWorld().getBlockAt(vector.getBlockX(), vector.getBlockY(), vector.getBlockZ());
if (MinecraftBlockExaminer.isDoor(block.getType())) { if (MinecraftBlockExaminer.isDoor(block.getType())) {
Door door = (Door) block.getState().getData(); Door door = (Door) block.getState().getData();

View File

@ -30,7 +30,7 @@ public class VillagerProfession extends Trait {
public void load(DataKey key) throws NPCLoadException { public void load(DataKey key) throws NPCLoadException {
try { try {
profession = Profession.valueOf(key.getString("")); profession = Profession.valueOf(key.getString(""));
if (profession.name().equals("NORMAL")) { if ("NORMAL".equals(profession.name())) {
profession = Profession.FARMER; profession = Profession.FARMER;
} }
} catch (IllegalArgumentException ex) { } catch (IllegalArgumentException ex) {
@ -40,6 +40,8 @@ public class VillagerProfession extends Trait {
@Override @Override
public void onSpawn() { public void onSpawn() {
if (!npc.isSpawned())
return;
if (npc.getEntity() instanceof Villager) { if (npc.getEntity() instanceof Villager) {
((Villager) npc.getEntity()).setProfession(profession); ((Villager) npc.getEntity()).setProfession(profession);
} else if (npc.getEntity() instanceof ZombieVillager) { } else if (npc.getEntity() instanceof ZombieVillager) {
@ -53,15 +55,11 @@ public class VillagerProfession extends Trait {
} }
public void setProfession(Profession profession) { public void setProfession(Profession profession) {
if (profession.name().equals("NORMAL")) { if ("NORMAL".equals(profession.name())) {
profession = Profession.FARMER; profession = Profession.FARMER;
} }
this.profession = profession; this.profession = profession;
if (npc.getEntity() instanceof Villager) { onSpawn();
((Villager) npc.getEntity()).setProfession(profession);
} else if (npc.getEntity() instanceof ZombieVillager) {
((ZombieVillager) npc.getEntity()).setVillagerProfession(profession);
}
} }
@Override @Override

View File

@ -19,7 +19,8 @@ public class EmptyChannel extends AbstractChannel {
static { static {
Map<String, Version> versionMap = Version.identify(); Map<String, Version> versionMap = Version.identify();
Version nettyVersion = versionMap.get("netty-common"); Version nettyVersion = versionMap.get("netty-common");
if (nettyVersion == null) nettyVersion = versionMap.get("netty-all"); if (nettyVersion == null)
nettyVersion = versionMap.get("netty-all");
if (nettyVersion != null) { if (nettyVersion != null) {
String[] split = nettyVersion.artifactVersion().split("\\."); String[] split = nettyVersion.artifactVersion().split("\\.");
@ -31,10 +32,8 @@ public class EmptyChannel extends AbstractChannel {
if (major > 4 || minor > 1 || revision > 24) { if (major > 4 || minor > 1 || revision > 24) {
updatedNetty = true; updatedNetty = true;
} }
} } catch (ArrayIndexOutOfBoundsException ignored) {
catch (ArrayIndexOutOfBoundsException ignored) { } catch (NumberFormatException ignored) {
}
catch (NumberFormatException ignored) {
} }
} }
} }