File tree 1 file changed +2
-3
lines changed
common/src/main/java/com/mrbysco/justenoughprofessions
1 file changed +2
-3
lines changed Original file line number Diff line number Diff line change 2
2
3
3
import com .mrbysco .justenoughprofessions .platform .Services ;
4
4
import net .minecraft .client .Minecraft ;
5
+ import net .minecraft .client .multiplayer .ClientLevel ;
5
6
import net .minecraft .nbt .CompoundTag ;
6
7
import net .minecraft .world .entity .EntityType ;
7
8
import net .minecraft .world .entity .npc .Villager ;
8
9
import net .minecraft .world .entity .npc .VillagerProfession ;
9
- import net .minecraft .world .level .Level ;
10
10
import org .jetbrains .annotations .Nullable ;
11
11
12
12
import java .util .Objects ;
@@ -20,8 +20,7 @@ public static Villager getVillagerEntity(VillagerProfession profession) {
20
20
if (cachedVillager == null ) {
21
21
CompoundTag nbt = new CompoundTag ();
22
22
nbt .putString ("id" , Objects .requireNonNull (Services .PLATFORM .getEntityKey (EntityType .VILLAGER )).toString ());
23
- Minecraft mc = Minecraft .getInstance ();
24
- Level level = mc .hasSingleplayerServer () && mc .getSingleplayerServer () != null ? mc .getSingleplayerServer ().getAllLevels ().iterator ().next () : mc .level ;
23
+ ClientLevel level = Minecraft .getInstance ().level ;
25
24
if (level != null ) {
26
25
Villager villager = (Villager ) EntityType .loadEntityRecursive (nbt , level , Function .identity ());
27
26
if (villager != null ) {
You can’t perform that action at this time.
0 commit comments