XFE Git
XFE Studio Git
Git 首页 全局搜索
XFE 主站 文档 NuGet

MyDimension

【Java】我的维度模组

公开
关注 0 Fork 0 Star 0
返回提交历史

XFEstudio/MyDimension

现在新增了心境群系名称翻译 在所有心境维度中,非裂罅导入、非读档已有的敌对怪物会被取消加入世界

aecd34b
XFE工作室室长 <mail@xfegzs.com>
提交于

代码差异

4 个文件 +39 -9
Modified gradle.properties +1 -1
@@ -11,7 +11,7 @@ loader_version_range=[47,)
11 11 mod_id=mydimension
12 12 mod_name=\u6211\u7684\u7ef4\u5ea6
13 13 mod_license=CC0-1.0
14 mod_version=2.2.1
14 mod_version=2.2.2
15 15 mod_group_id=com.xfestudio.mydimension
16 16 maven_group=com.xfestudio
17 17 archives_base_name=mydimension
Modified src/main/java/com/xfestudio/mydimension/MyDimensionEvents.java +20 -0
@@ -24,11 +24,13 @@ import net.minecraft.world.entity.Entity;
24 24 import net.minecraft.world.entity.LivingEntity;
25 25 import net.minecraft.world.entity.Mob;
26 26 import net.minecraft.world.entity.MobSpawnType;
27 import net.minecraft.world.entity.monster.Enemy;
27 28 import net.minecraft.world.item.ItemStack;
28 29 import net.minecraft.world.level.GameRules;
29 30 import net.minecraft.tags.FluidTags;
30 31 import net.minecraftforge.event.CommandEvent;
31 32 import net.minecraftforge.event.TickEvent;
33 import net.minecraftforge.event.entity.EntityJoinLevelEvent;
32 34 import net.minecraftforge.event.entity.living.MobSpawnEvent;
33 35 import net.minecraftforge.event.entity.player.PlayerEvent;
34 36 import net.minecraftforge.event.entity.player.PlayerInteractEvent;
@@ -71,6 +73,20 @@ public class MyDimensionEvents {
71 73 }
72 74 }
73 75
76 @SubscribeEvent(priority = EventPriority.HIGHEST)
77 public void preventBypassedHostileSpawnsInMind(EntityJoinLevelEvent event) {
78 if (event.getLevel().isClientSide() || !ModDimensions.isMindDimension(event.getLevel().dimension())) {
79 return;
80 }
81
82 if (event.getEntity() instanceof Mob mob
83 && isHostileMob(mob)
84 && !mob.getPersistentData().getBoolean(RiftItem.IMPORTED_TO_ETHEREAL_MIND)
85 && !event.loadedFromDisk()) {
86 event.setCanceled(true);
87 }
88 }
89
74 90 @SubscribeEvent
75 91 public void protectPlayersFromOtherPlayerTeleports(CommandEvent event) {
76 92 CommandSourceStack source = event.getParseResults().getContext().getSource();
@@ -243,6 +259,10 @@ public class MyDimensionEvents {
243 259 return !entity.getPersistentData().getBoolean(RiftItem.IMPORTED_TO_ETHEREAL_MIND) && !isPlayerCreatedSpawn(spawnType);
244 260 }
245 261
262 private static boolean isHostileMob(Mob entity) {
263 return entity instanceof Enemy || entity.getType().getCategory() == net.minecraft.world.entity.MobCategory.MONSTER;
264 }
265
246 266 private static boolean isPlayerCreatedSpawn(MobSpawnType spawnType) {
247 267 return spawnType == MobSpawnType.SPAWN_EGG || spawnType == MobSpawnType.BUCKET;
248 268 }
Modified src/main/resources/assets/mydimension/lang/en_us.json +5 -0
@@ -5,6 +5,11 @@
5 5 "dimension.mydimension.water_mind": "Water Mind",
6 6 "dimension.mydimension.nature_mind": "Nature Mind",
7 7 "dimension.mydimension.soaring_mind": "Soaring Mind",
8 "biome.mydimension.ethereal_mind": "Ethereal Mind",
9 "biome.mydimension.mirror_mind": "Mirror Mind",
10 "biome.mydimension.water_mind": "Water Mind",
11 "biome.mydimension.nature_mind": "Nature Mind",
12 "biome.mydimension.soaring_mind": "Soaring Mind",
8 13 "screen.mydimension.rift_actions": "Rift",
9 14 "screen.mydimension.rift_actions.travel": "Travel",
10 15 "screen.mydimension.rift_actions.mob": "Send Mob",
Modified src/main/resources/assets/mydimension/lang/zh_cn.json +13 -8
@@ -5,6 +5,11 @@
5 5 "dimension.mydimension.water_mind": "水之心境",
6 6 "dimension.mydimension.nature_mind": "自然心境",
7 7 "dimension.mydimension.soaring_mind": "翱翔心境",
8 "biome.mydimension.ethereal_mind": "空灵心境",
9 "biome.mydimension.mirror_mind": "镜之心境",
10 "biome.mydimension.water_mind": "水之心境",
11 "biome.mydimension.nature_mind": "自然心境",
12 "biome.mydimension.soaring_mind": "翱翔心境",
8 13 "screen.mydimension.rift_actions": "裂罅",
9 14 "screen.mydimension.rift_actions.travel": "前往心境",
10 15 "screen.mydimension.rift_actions.mob": "传送生物",
@@ -23,23 +28,23 @@
23 28 "action.mydimension.nature_mind": "前往自然心境",
24 29 "action.mydimension.soaring_mind": "前往翱翔心境",
25 30 "action.mydimension.shared_ethereal_mind": "前往共享空灵",
26 "action.mydimension.shared_mirror_mind": "前往共享镜",
27 "action.mydimension.shared_water_mind": "前往共享水",
31 "action.mydimension.shared_mirror_mind": "前往共享镜之",
32 "action.mydimension.shared_water_mind": "前往共享水之",
28 33 "action.mydimension.shared_nature_mind": "前往共享自然",
29 34 "action.mydimension.shared_soaring_mind": "前往共享翱翔",
30 35 "action.mydimension.send_mob_ethereal": "传送生物到空灵",
31 "action.mydimension.send_mob_mirror": "传送生物到镜",
32 "action.mydimension.send_mob_water": "传送生物到水",
36 "action.mydimension.send_mob_mirror": "传送生物到镜之",
37 "action.mydimension.send_mob_water": "传送生物到水之",
33 38 "action.mydimension.send_mob_nature": "传送生物到自然",
34 39 "action.mydimension.send_mob_soaring": "传送生物到翱翔",
35 40 "action.mydimension.send_mob_shared_ethereal": "传送生物到共享空灵",
36 "action.mydimension.send_mob_shared_mirror": "传送生物到共享镜",
37 "action.mydimension.send_mob_shared_water": "传送生物到共享水",
41 "action.mydimension.send_mob_shared_mirror": "传送生物到共享镜之",
42 "action.mydimension.send_mob_shared_water": "传送生物到共享水之",
38 43 "action.mydimension.send_mob_shared_nature": "传送生物到共享自然",
39 44 "action.mydimension.send_mob_shared_soaring": "传送生物到共享翱翔",
40 45 "action.mydimension.copy_shared_ethereal": "复制公共空灵",
41 "action.mydimension.copy_shared_mirror": "复制公共镜",
42 "action.mydimension.copy_shared_water": "复制公共水",
46 "action.mydimension.copy_shared_mirror": "复制公共镜之",
47 "action.mydimension.copy_shared_water": "复制公共水之",
43 48 "action.mydimension.copy_shared_nature": "复制公共自然",
44 49 "action.mydimension.copy_shared_soaring": "复制公共翱翔",
45 50 "action.mydimension.set_anchor": "设置传送锚点",