返回提交历史
Modified
build.gradle
+29
-0
Modified
src/main/java/com/xfestudio/mydimension/client/RiftActionScreen.java
+15
-6
Modified
src/main/java/com/xfestudio/mydimension/world/MindInstances.java
+8
-0
Added
src/main/java/com/xfestudio/mydimension/world/PrivateMindFeature.java
+12
-0
Added
src/main/resources/mydimension_private_minds_enabled.txt
+1
-0
XFEstudio/MyDimension
发布公共和私有双版
9bb7f00
代码差异
5 个文件
+65
-6
@@ -209,10 +209,39 @@ jar {
209
209
finalizedBy 'reobfJar'
210
210
}
211
211
212
tasks.register('jarNoPrivate', Jar) {
213
archiveClassifier = 'no-private'
214
from sourceSets.main.output
215
exclude 'mydimension_private_minds_enabled.txt'
216
exclude 'data/mydimension/dimension/p*.json'
217
manifest {
218
attributes([
219
'Specification-Title' : mod_id,
220
'Specification-Vendor' : mod_authors,
221
'Specification-Version' : '1',
222
'Implementation-Title' : "${project.name}-no-private",
223
'Implementation-Version' : project.version,
224
'Implementation-Vendor' : mod_authors,
225
'Implementation-Timestamp': new Date().format("yyyy-MM-dd'T'HH:mm:ssZ")
226
])
227
}
228
dependsOn tasks.named('classes')
229
finalizedBy 'reobfJarNoPrivate'
230
}
231
232
reobf {
233
jarNoPrivate {}
234
}
235
236
tasks.named('assemble') {
237
dependsOn tasks.named('jarNoPrivate')
238
}
239
212
240
publishing {
213
241
publications {
214
242
register('mavenJava', MavenPublication) {
215
243
artifact jar
244
artifact tasks.named('jarNoPrivate')
216
245
}
217
246
}
218
247
repositories {
@@ -7,6 +7,7 @@ import com.xfestudio.mydimension.network.ModNetwork;
7
7
import com.xfestudio.mydimension.network.SetRiftActionPacket;
8
8
import com.xfestudio.mydimension.registry.ModItems;
9
9
import com.xfestudio.mydimension.world.ModDimensions;
10
import com.xfestudio.mydimension.world.PrivateMindFeature;
10
11
import net.minecraft.client.Minecraft;
11
12
import net.minecraft.client.gui.Font;
12
13
import net.minecraft.client.gui.GuiGraphics;
@@ -34,6 +35,7 @@ public class RiftActionScreen extends Screen {
34
35
private Page page = Page.TRAVEL_PRIVATE;
35
36
private boolean inMindDimension;
36
37
private boolean creative;
38
private boolean privateMindsEnabled;
37
39
38
40
public RiftActionScreen() {
39
41
super(Component.translatable("screen.mydimension.rift_actions"));
@@ -43,6 +45,7 @@ public class RiftActionScreen extends Screen {
43
45
protected void init() {
44
46
inMindDimension = minecraft != null && minecraft.player != null && ModDimensions.isMindDimension(minecraft.player.level().dimension());
45
47
creative = minecraft != null && minecraft.player != null && minecraft.player.isCreative();
48
privateMindsEnabled = PrivateMindFeature.isEnabled();
46
49
47
50
int centerX = width / 2;
48
51
int centerY = height / 2;
@@ -77,12 +80,18 @@ public class RiftActionScreen extends Screen {
77
80
}
78
81
79
82
private List<Page> visiblePages() {
80
List<Page> pages = new ArrayList<>(List.of(Page.TRAVEL_PRIVATE, Page.TRAVEL_SHARED, Page.MOB_PRIVATE, Page.MOB_SHARED));
81
if (creative) {
83
List<Page> pages = privateMindsEnabled
84
? new ArrayList<>(List.of(Page.TRAVEL_PRIVATE, Page.TRAVEL_SHARED, Page.MOB_PRIVATE, Page.MOB_SHARED))
85
: new ArrayList<>(List.of(Page.TRAVEL_SHARED, Page.MOB_SHARED));
86
87
if (privateMindsEnabled && creative) {
82
88
pages.add(Page.COPY_SHARED);
83
} else if (page == Page.COPY_SHARED) {
84
page = Page.TRAVEL_PRIVATE;
85
89
}
90
91
if (!pages.contains(page)) {
92
page = pages.get(0);
93
}
94
86
95
return pages;
87
96
}
88
97
@@ -135,7 +144,7 @@ public class RiftActionScreen extends Screen {
135
144
136
145
private RiftAction getSelectedAction() {
137
146
if (minecraft == null || minecraft.player == null) {
138
return RiftAction.ETHEREAL_MIND;
147
return privateMindsEnabled ? RiftAction.ETHEREAL_MIND : RiftAction.SHARED_ETHEREAL_MIND;
139
148
}
140
149
141
150
ItemStack mainHand = minecraft.player.getMainHandItem();
@@ -144,7 +153,7 @@ public class RiftActionScreen extends Screen {
144
153
}
145
154
146
155
ItemStack offHand = minecraft.player.getOffhandItem();
147
return offHand.is(ModItems.RIFT.get()) ? RiftItem.getSelectedAction(offHand) : RiftAction.ETHEREAL_MIND;
156
return offHand.is(ModItems.RIFT.get()) ? RiftItem.getSelectedAction(offHand) : (privateMindsEnabled ? RiftAction.ETHEREAL_MIND : RiftAction.SHARED_ETHEREAL_MIND);
148
157
}
149
158
150
159
private void select(RiftAction action) {
@@ -28,6 +28,10 @@ public class MindInstances {
28
28
private static final String GENERATED_DATAPACK_NAME = "mydimension_dynamic_player_minds";
29
29
30
30
public static ResourceKey<Level> dimensionFor(ServerPlayer player, ResourceKey<Level> baseDimension) {
31
if (!PrivateMindFeature.isEnabled()) {
32
return baseDimension;
33
}
34
31
35
int slot = slotFor(player);
32
36
if (slot < 0 || slot >= MAX_PLAYER_SLOTS) {
33
37
return baseDimension;
@@ -44,6 +48,10 @@ public class MindInstances {
44
48
}
45
49
46
50
public static int slotFor(ServerPlayer player) {
51
if (!PrivateMindFeature.isEnabled()) {
52
return -1;
53
}
54
47
55
MinecraftServer server = player.getServer();
48
56
MindInstanceData data = data(server);
49
57
int slot = data.slotFor(player.getUUID());
@@ -0,0 +1,12 @@
1
package com.xfestudio.mydimension.world;
2
3
public final class PrivateMindFeature {
4
private static final boolean ENABLED = PrivateMindFeature.class.getResource("/mydimension_private_minds_enabled.txt") != null;
5
6
private PrivateMindFeature() {
7
}
8
9
public static boolean isEnabled() {
10
return ENABLED;
11
}
12
}
@@ -0,0 +1 @@
1
enabled