Skip to content

Commit 81a3557

Browse files
committed
Commands mapping updated.
Signed-off-by: Pavel Erokhin (MairwunNx) <[email protected]>
1 parent af4e4b8 commit 81a3557

File tree

11 files changed

+70
-73
lines changed

11 files changed

+70
-73
lines changed

src/main/kotlin/com/mairwunnx/projectessentials/core/impl/vanilla/commands/CloneCommand.kt

+4-1
Original file line numberDiff line numberDiff line change
@@ -372,7 +372,10 @@ internal object CloneCommand : VanillaCommandBase() {
372372
} else if (!blockstate.isOpaqueCube(
373373
serverworld,
374374
blockpos2
375-
) && !blockstate.func_224756_o(serverworld, blockpos2)
375+
) && !blockstate.isCollisionShapeOpaque(
376+
serverworld,
377+
blockpos2
378+
)
376379
) {
377380
list2.add(
378381
BlockInfo(blockpos3, blockstate, null as CompoundNBT?)

src/main/kotlin/com/mairwunnx/projectessentials/core/impl/vanilla/commands/DataPackCommand.kt

+7-8
Original file line numberDiff line numberDiff line change
@@ -105,16 +105,15 @@ internal object DataPackCommand : VanillaCommandBase() {
105105
enablePack(
106106
p_198292_0_.source,
107107
parsePackInfo(p_198292_0_, "name", true),
108-
object :
109-
IHandler {
108+
object : IHandler {
110109
override fun apply(
111110
p_apply_1_: MutableList<ResourcePackInfo>,
112111
p_apply_2_: ResourcePackInfo
113112
) {
114-
p_apply_2_.priority.func_198993_a(
113+
p_apply_2_.priority.insert(
115114
p_apply_1_,
116115
p_apply_2_,
117-
{ p_198304_0_ -> p_198304_0_ },
116+
{ p_198304_0_: ResourcePackInfo? -> p_198304_0_ },
118117
false
119118
)
120119
}
@@ -292,7 +291,7 @@ internal object DataPackCommand : VanillaCommandBase() {
292291
source.sendFeedback(
293292
TranslationTextComponent(
294293
"commands.datapack.enable.success",
295-
pack.func_195794_a(true)
294+
pack.getChatLink(true)
296295
), true
297296
)
298297
source.server.reload()
@@ -320,7 +319,7 @@ internal object DataPackCommand : VanillaCommandBase() {
320319
source.sendFeedback(
321320
TranslationTextComponent(
322321
"commands.datapack.disable.success",
323-
pack.func_195794_a(true)
322+
pack.getChatLink(true)
324323
), true
325324
)
326325
source.server.reload()
@@ -359,7 +358,7 @@ internal object DataPackCommand : VanillaCommandBase() {
359358
TextComponentUtils.makeList(
360359
resourcepacklist.availablePacks
361360
) { p_198293_0_ ->
362-
p_198293_0_.func_195794_a(false)
361+
p_198293_0_.getChatLink(false)
363362
}
364363
), false
365364
)
@@ -389,7 +388,7 @@ internal object DataPackCommand : VanillaCommandBase() {
389388
TextComponentUtils.makeList(
390389
resourcepacklist.enabledPacks
391390
) { p_198306_0_ ->
392-
p_198306_0_.func_195794_a(true)
391+
p_198306_0_.getChatLink(true)
393392
}
394393
), false
395394
)

src/main/kotlin/com/mairwunnx/projectessentials/core/impl/vanilla/commands/DebugCommand.kt

+26-25
Original file line numberDiff line numberDiff line change
@@ -40,17 +40,18 @@ import java.text.SimpleDateFormat
4040
import java.util.*
4141

4242
internal object DebugCommand : VanillaCommandBase() {
43-
private val field_225390_a = LogManager.getLogger()
43+
private val LOGGER = LogManager.getLogger()
44+
private val JAR_FILESYSTEM_PROVIDER =
45+
FileSystemProvider.installedProviders().stream().filter { p_225386_0_: FileSystemProvider ->
46+
p_225386_0_.scheme.equals("jar", ignoreCase = true)
47+
}.findFirst().orElse(null as FileSystemProvider?)
48+
4449
private val NOT_RUNNING_EXCEPTION = SimpleCommandExceptionType(
4550
TranslationTextComponent("commands.debug.notRunning")
4651
)
4752
private val ALREADY_RUNNING_EXCEPTION = SimpleCommandExceptionType(
4853
TranslationTextComponent("commands.debug.alreadyRunning")
4954
)
50-
private val field_225391_d =
51-
FileSystemProvider.installedProviders().stream().filter { p_225386_0_ ->
52-
p_225386_0_.scheme.equals("jar", ignoreCase = true)
53-
}.findFirst().orElse(null as FileSystemProvider?)
5455

5556
private var aliases =
5657
configuration.take().aliases.debug + "debug"
@@ -75,7 +76,7 @@ internal object DebugCommand : VanillaCommandBase() {
7576
}
7677
).then(
7778
Commands.literal("report").executes { p_225388_0_ ->
78-
func_225389_c(p_225388_0_.source)
79+
writeDebugReport(p_225388_0_.source)
7980
}
8081
)
8182
)
@@ -110,10 +111,9 @@ internal object DebugCommand : VanillaCommandBase() {
110111
@Throws(CommandSyntaxException::class)
111112
private fun startDebug(source: CommandSource): Int {
112113
checkPermissions(source)
113-
114114
val minecraftserver = source.server
115115
val debugprofiler = minecraftserver.profiler
116-
return if (debugprofiler.func_219899_d().isEnabled) {
116+
return if (debugprofiler.fixedProfiler.isEnabled) {
117117
throw ALREADY_RUNNING_EXCEPTION.create()
118118
} else {
119119
minecraftserver.enableProfiling()
@@ -133,10 +133,10 @@ internal object DebugCommand : VanillaCommandBase() {
133133

134134
val minecraftserver = source.server
135135
val debugprofiler = minecraftserver.profiler
136-
return if (!debugprofiler.func_219899_d().isEnabled) {
136+
return if (!debugprofiler.fixedProfiler.isEnabled) {
137137
throw NOT_RUNNING_EXCEPTION.create()
138138
} else {
139-
val iprofileresult = debugprofiler.func_219899_d().func_219938_b()
139+
val iprofileresult = debugprofiler.fixedProfiler.disable()
140140
val file1 = File(
141141
minecraftserver.getFile("debug"),
142142
"profile-results-" + SimpleDateFormat("yyyy-MM-dd_HH.mm.ss").format(Date()) + ".txt"
@@ -146,45 +146,46 @@ internal object DebugCommand : VanillaCommandBase() {
146146
val f1 = iprofileresult.ticksSpend().toFloat() / f
147147
source.sendFeedback(
148148
TranslationTextComponent(
149-
"commands.debug.stopped", String.format(
150-
Locale.ROOT, "%.2f", f
151-
), iprofileresult.ticksSpend(), String.format("%.2f", f1)
149+
"commands.debug.stopped",
150+
String.format(Locale.ROOT, "%.2f", f),
151+
iprofileresult.ticksSpend(),
152+
String.format("%.2f", f1)
152153
), true
153154
)
154155
MathHelper.floor(f1)
155156
}
156157
}
157158

158-
private fun func_225389_c(p_225389_0_: CommandSource): Int {
159+
private fun writeDebugReport(p_225389_0_: CommandSource): Int {
159160
checkPermissions(p_225389_0_)
160161

161162
val minecraftserver = p_225389_0_.server
162-
val s = "debug-report-" + SimpleDateFormat("yyyy-MM-dd_HH.mm.ss").format(Date())
163+
val s =
164+
"debug-report-" + SimpleDateFormat("yyyy-MM-dd_HH.mm.ss").format(Date())
163165
return try {
164166
val path1 = minecraftserver.getFile("debug").toPath()
165167
Files.createDirectories(path1)
166-
if (!SharedConstants.developmentMode && field_225391_d != null) {
168+
if (!SharedConstants.developmentMode && JAR_FILESYSTEM_PROVIDER != null) {
167169
val path2 = path1.resolve("$s.zip")
168-
field_225391_d.newFileSystem(
170+
JAR_FILESYSTEM_PROVIDER.newFileSystem(
169171
path2,
170-
ImmutableMap.of<String, String?>("create", "true")
171-
).use { filesystem ->
172-
minecraftserver.func_223711_a(filesystem.getPath("/"))
173-
}
172+
ImmutableMap.of("create", "true")
173+
).use { filesystem -> minecraftserver.dumpDebugInfo(filesystem.getPath("/")) }
174174
} else {
175175
val path = path1.resolve(s)
176-
minecraftserver.func_223711_a(path)
176+
minecraftserver.dumpDebugInfo(path)
177177
}
178178
p_225389_0_.sendFeedback(
179179
TranslationTextComponent("commands.debug.reportSaved", s),
180180
false
181181
)
182182
1
183183
} catch (ioexception: IOException) {
184-
field_225390_a.error("Failed to save debug dump", ioexception as Throwable)
185-
p_225389_0_.sendErrorMessage(
186-
TranslationTextComponent("commands.debug.reportFailed")
184+
LOGGER.error(
185+
"Failed to save debug dump",
186+
ioexception as Throwable
187187
)
188+
p_225389_0_.sendErrorMessage(TranslationTextComponent("commands.debug.reportFailed"))
188189
0
189190
}
190191
}

src/main/kotlin/com/mairwunnx/projectessentials/core/impl/vanilla/commands/ExperienceCommand.kt

+1-1
Original file line numberDiff line numberDiff line change
@@ -309,7 +309,7 @@ internal object ExperienceCommand : VanillaCommandBase() {
309309
obj.addExperienceLevel(levels)
310310
},
311311
BiPredicate<ServerPlayerEntity, Int> { p_198425_0_, p_198425_1_ ->
312-
p_198425_0_.func_195399_b(p_198425_1_)
312+
p_198425_0_.setExperienceLevel(p_198425_1_)
313313
true
314314
},
315315
ToIntFunction<ServerPlayerEntity> { it.experienceLevel }

src/main/kotlin/com/mairwunnx/projectessentials/core/impl/vanilla/commands/FunctionCommand.kt

+1-1
Original file line numberDiff line numberDiff line change
@@ -51,7 +51,7 @@ internal object FunctionCommand : VanillaCommandBase() {
5151
aliases.forEach { command ->
5252
dispatcher.register(
5353
Commands.literal(command).then(
54-
Commands.argument("name", FunctionArgument.func_200021_a()).suggests(
54+
Commands.argument("name", FunctionArgument.function()).suggests(
5555
FUNCTION_SUGGESTER
5656
).executes { p_198479_0_ ->
5757
executeFunctions(

src/main/kotlin/com/mairwunnx/projectessentials/core/impl/vanilla/commands/GameRuleCommand.kt

+20-21
Original file line numberDiff line numberDiff line change
@@ -43,18 +43,21 @@ internal object GameRuleCommand : VanillaCommandBase() {
4343

4444
aliases.forEach { command ->
4545
val literalargumentbuilder = Commands.literal(command)
46-
func_223590_a(object : IRuleEntryVisitor {
47-
override fun <T : RuleValue<T>> func_223481_a(
48-
p_223481_1_: RuleKey<T>, p_223481_2_: RuleType<T>
46+
visitAll(object : IRuleEntryVisitor {
47+
override fun <T : RuleValue<T>?> visit(
48+
key: RuleKey<T>,
49+
type: RuleType<T>
4950
) {
5051
literalargumentbuilder.then(
51-
Commands.literal(p_223481_1_.func_223576_a()).executes { p_223483_1_ ->
52-
func_223486_b(p_223483_1_.source, p_223481_1_)
53-
}.then(
54-
p_223481_2_.func_223581_a("value").executes { p_223482_1_ ->
55-
func_223485_b(p_223482_1_, p_223481_1_)
56-
}
57-
)
52+
Commands.literal(key.name)
53+
.executes { p_223483_1_: CommandContext<CommandSource> ->
54+
func_223486_b(p_223483_1_.source, key)
55+
}.then(
56+
type.createArgument("value")
57+
.executes { p_223482_1_: CommandContext<CommandSource> ->
58+
func_223485_b(p_223482_1_, key)
59+
}
60+
)
5861
)
5962
}
6063
})
@@ -87,39 +90,35 @@ internal object GameRuleCommand : VanillaCommandBase() {
8790
}
8891
}
8992

90-
private fun <T : RuleValue<T>> func_223485_b(
93+
private fun <T : RuleValue<T>?> func_223485_b(
9194
p_223485_0_: CommandContext<CommandSource>,
9295
p_223485_1_: RuleKey<T>
9396
): Int {
94-
checkPermissions(p_223485_0_.source)
95-
9697
val commandsource = p_223485_0_.source
9798
val t = commandsource.server.gameRules[p_223485_1_]
98-
t.func_223554_b(p_223485_0_, "value")
99+
t!!.updateValue(p_223485_0_, "value")
99100
commandsource.sendFeedback(
100101
TranslationTextComponent(
101102
"commands.gamerule.set",
102-
p_223485_1_.func_223576_a(),
103+
p_223485_1_.name,
103104
t.toString()
104105
), true
105106
)
106-
return t.func_223557_c()
107+
return t.intValue()
107108
}
108109

109-
private fun <T : RuleValue<T>> func_223486_b(
110+
private fun <T : RuleValue<T>?> func_223486_b(
110111
p_223486_0_: CommandSource,
111112
p_223486_1_: RuleKey<T>
112113
): Int {
113-
checkPermissions(p_223486_0_)
114-
115114
val t = p_223486_0_.server.gameRules[p_223486_1_]
116115
p_223486_0_.sendFeedback(
117116
TranslationTextComponent(
118117
"commands.gamerule.query",
119-
p_223486_1_.func_223576_a(),
118+
p_223486_1_.name,
120119
t.toString()
121120
), false
122121
)
123-
return t.func_223557_c()
122+
return t!!.intValue()
124123
}
125124
}

src/main/kotlin/com/mairwunnx/projectessentials/core/impl/vanilla/commands/GiveCommand.kt

+1-3
Original file line numberDiff line numberDiff line change
@@ -127,9 +127,7 @@ internal object GiveCommand : VanillaCommandBase() {
127127
itementity1?.makeFakeItem()
128128
serverplayerentity.world.playSound(
129129
null as PlayerEntity?,
130-
serverplayerentity.func_226277_ct_(),
131-
serverplayerentity.func_226278_cu_(),
132-
serverplayerentity.func_226281_cx_(),
130+
serverplayerentity.posX, serverplayerentity.posY, serverplayerentity.posZ,
133131
SoundEvents.ENTITY_ITEM_PICKUP,
134132
SoundCategory.PLAYERS,
135133
0.2f,

src/main/kotlin/com/mairwunnx/projectessentials/core/impl/vanilla/commands/PlaySoundCommand.kt

+6-6
Original file line numberDiff line numberDiff line change
@@ -208,19 +208,19 @@ internal object PlaySoundCommand : VanillaCommandBase() {
208208
}
209209

210210
serverplayerentity = iterator.next() as ServerPlayerEntity
211-
val d1 = pos.x - serverplayerentity.func_226277_ct_()
212-
val d2 = pos.y - serverplayerentity.func_226278_cu_()
213-
val d3 = pos.z - serverplayerentity.func_226281_cx_()
211+
val d1 = pos.x - serverplayerentity.posX
212+
val d2 = pos.y - serverplayerentity.posY
213+
val d3 = pos.z - serverplayerentity.posZ
214214
val d4 = d1 * d1 + d2 * d2 + d3 * d3
215215
vec3d = pos
216216
f = volume
217217
if (d4 <= d0) break
218218
if (minVolume > 0.0f) {
219219
val d5 = MathHelper.sqrt(d4).toDouble()
220220
vec3d = Vec3d(
221-
serverplayerentity.func_226277_ct_() + d1 / d5 * 2.0,
222-
serverplayerentity.func_226278_cu_() + d2 / d5 * 2.0,
223-
serverplayerentity.func_226281_cx_() + d3 / d5 * 2.0
221+
serverplayerentity.posX + d1 / d5 * 2.0,
222+
serverplayerentity.posY + d2 / d5 * 2.0,
223+
serverplayerentity.posZ + d3 / d5 * 2.0
224224
)
225225
f = minVolume
226226
break

src/main/kotlin/com/mairwunnx/projectessentials/core/impl/vanilla/commands/ScheduleCommand.kt

+1-1
Original file line numberDiff line numberDiff line change
@@ -57,7 +57,7 @@ internal object ScheduleCommand : VanillaCommandBase() {
5757
Commands.literal("schedule").then(
5858
Commands.literal("function").then(
5959
Commands.argument(
60-
"function", FunctionArgument.func_200021_a()
60+
"function", FunctionArgument.function()
6161
).suggests(FunctionCommand.FUNCTION_SUGGESTER).then(
6262
Commands.argument(
6363
"time", TimeArgument.func_218091_a()

src/main/kotlin/com/mairwunnx/projectessentials/core/impl/vanilla/commands/SpawnPointCommand.kt

+1-1
Original file line numberDiff line numberDiff line change
@@ -109,7 +109,7 @@ internal object SpawnPointCommand : VanillaCommandBase() {
109109

110110
for (serverplayerentity in targets) {
111111
@Suppress("DEPRECATION")
112-
serverplayerentity.func_226560_a_(pos, true, false)
112+
serverplayerentity.setRespawnPosition(pos, true, false)
113113
}
114114

115115
if (targets.size == 1) {

src/main/kotlin/com/mairwunnx/projectessentials/core/impl/vanilla/commands/SummonCommand.kt

+2-5
Original file line numberDiff line numberDiff line change
@@ -84,16 +84,13 @@ internal object SummonCommand : VanillaCommandBase() {
8484
)
8585
}.then(
8686
Commands.argument(
87-
"nbt", NBTCompoundTagArgument.func_218043_a()
87+
"nbt", NBTCompoundTagArgument.nbt()
8888
).executes { p_198739_0_ ->
8989
summonEntity(
9090
p_198739_0_.source,
9191
EntitySummonArgument.getEntityId(p_198739_0_, "entity"),
9292
Vec3Argument.getVec3(p_198739_0_, "pos"),
93-
NBTCompoundTagArgument.func_218042_a(
94-
p_198739_0_,
95-
"nbt"
96-
),
93+
NBTCompoundTagArgument.getNbt(p_198739_0_, "nbt"),
9794
false
9895
)
9996
}

0 commit comments

Comments
 (0)