From 8abd350f8e0f4e5fd7180af4c3b450c73a039dcb Mon Sep 17 00:00:00 2001 From: Ivan-YFw Date: Fri, 26 Feb 2021 19:05:59 +0800 Subject: [PATCH] sync with 16 --- .../mobSpawningRestriction/ServerWorldMixin.java | 16 ++++++++++------ 1 file changed, 10 insertions(+), 6 deletions(-) diff --git a/src/main/java/me/ivan/ivancarpetaddition/mixins/rule/mobSpawningRestriction/ServerWorldMixin.java b/src/main/java/me/ivan/ivancarpetaddition/mixins/rule/mobSpawningRestriction/ServerWorldMixin.java index ad8b641..9780fef 100644 --- a/src/main/java/me/ivan/ivancarpetaddition/mixins/rule/mobSpawningRestriction/ServerWorldMixin.java +++ b/src/main/java/me/ivan/ivancarpetaddition/mixins/rule/mobSpawningRestriction/ServerWorldMixin.java @@ -18,15 +18,19 @@ public class ServerWorldMixin { private void spawnEntity(Entity entity, CallbackInfoReturnable cir) { if (IvanCarpetAdditionSettings.mobSpawningRestrictionMode.equals("blacklist")) { Set blackList = Sets.newLinkedHashSet(Arrays.asList(IvanCarpetAdditionSettings.mobBlackList.split(","))); - if (blackList.contains(entity.getName().getString().toLowerCase())) { - cir.setReturnValue(false); - } + blackList.forEach(name -> { + if (entity.getType().getTranslationKey().contains(name)) { + cir.setReturnValue(false); + } + }); } if (IvanCarpetAdditionSettings.mobSpawningRestrictionMode.equals("whitelist")) { Set whitelist = Sets.newLinkedHashSet(Arrays.asList(IvanCarpetAdditionSettings.mobWhiteList.split(","))); - if (!whitelist.contains(entity.getName().getString().toLowerCase())) { - cir.setReturnValue(false); - } + whitelist.forEach(name -> { + if (!entity.getType().getTranslationKey().contains(name)) { + cir.setReturnValue(false); + } + }); } } }