forked from kaboom-fabric/extras
Compare commits
2 commits
20w14infin
...
1.19
Author | SHA1 | Date | |
---|---|---|---|
4e5ef92a67 | |||
e63be0909b |
31 changed files with 363 additions and 217 deletions
26
build.gradle
26
build.gradle
|
@ -1,15 +1,11 @@
|
||||||
plugins {
|
plugins {
|
||||||
id 'fabric-loom' version '1.6-SNAPSHOT'
|
id 'fabric-loom' version '1.1-SNAPSHOT'
|
||||||
id 'maven-publish'
|
id 'maven-publish'
|
||||||
}
|
}
|
||||||
|
|
||||||
version = project.mod_version
|
version = project.mod_version
|
||||||
group = project.maven_group
|
group = project.maven_group
|
||||||
|
|
||||||
base {
|
|
||||||
archivesName = project.archives_base_name
|
|
||||||
}
|
|
||||||
|
|
||||||
repositories {
|
repositories {
|
||||||
// Add repositories to retrieve artifacts from in here.
|
// Add repositories to retrieve artifacts from in here.
|
||||||
// You should only use this when depending on other mods because
|
// You should only use this when depending on other mods because
|
||||||
|
@ -27,6 +23,14 @@ dependencies {
|
||||||
// Fabric API. This is technically optional, but you probably want it anyway.
|
// Fabric API. This is technically optional, but you probably want it anyway.
|
||||||
// modImplementation "net.fabricmc.fabric-api:fabric-api:${project.fabric_version}"
|
// modImplementation "net.fabricmc.fabric-api:fabric-api:${project.fabric_version}"
|
||||||
|
|
||||||
|
// Uncomment the following line to enable the deprecated Fabric API modules.
|
||||||
|
// These are included in the Fabric API production distribution and allow you to update your mod to the latest modules at a later more convenient time.
|
||||||
|
|
||||||
|
// modImplementation "net.fabricmc.fabric-api:fabric-api-deprecated:${project.fabric_version}"
|
||||||
|
}
|
||||||
|
|
||||||
|
base {
|
||||||
|
archivesName = project.archives_base_name
|
||||||
}
|
}
|
||||||
|
|
||||||
processResources {
|
processResources {
|
||||||
|
@ -38,7 +42,8 @@ processResources {
|
||||||
}
|
}
|
||||||
|
|
||||||
tasks.withType(JavaCompile).configureEach {
|
tasks.withType(JavaCompile).configureEach {
|
||||||
it.options.release = 8
|
// Minecraft 1.18 (1.18-pre2) upwards uses Java 17.
|
||||||
|
it.options.release = 17
|
||||||
}
|
}
|
||||||
|
|
||||||
java {
|
java {
|
||||||
|
@ -47,21 +52,20 @@ java {
|
||||||
// If you remove this line, sources will not be generated.
|
// If you remove this line, sources will not be generated.
|
||||||
withSourcesJar()
|
withSourcesJar()
|
||||||
|
|
||||||
sourceCompatibility = JavaVersion.VERSION_1_8
|
sourceCompatibility = JavaVersion.VERSION_17
|
||||||
targetCompatibility = JavaVersion.VERSION_1_8
|
targetCompatibility = JavaVersion.VERSION_17
|
||||||
}
|
}
|
||||||
|
|
||||||
jar {
|
jar {
|
||||||
from("LICENSE") {
|
from("LICENSE") {
|
||||||
rename { "${it}_${project.base.archivesName.get()}"}
|
rename { "${it}_${base.archivesName.get()}"}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// configure the maven publication
|
// configure the maven publication
|
||||||
publishing {
|
publishing {
|
||||||
publications {
|
publications {
|
||||||
create("mavenJava", MavenPublication) {
|
mavenJava(MavenPublication) {
|
||||||
artifactId = project.archives_base_name
|
|
||||||
from components.java
|
from components.java
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -3,12 +3,15 @@ org.gradle.jvmargs=-Xmx1G
|
||||||
org.gradle.parallel=true
|
org.gradle.parallel=true
|
||||||
|
|
||||||
# Fabric Properties
|
# Fabric Properties
|
||||||
# check these on https://fabricmc.net/develop
|
# check these on https://fabricmc.net/develop
|
||||||
minecraft_version=20w14infinite
|
minecraft_version=1.19.4
|
||||||
yarn_mappings=20w14infinite+build.4
|
yarn_mappings=1.19.4+build.1
|
||||||
loader_version=0.15.11
|
loader_version=0.14.17
|
||||||
|
|
||||||
# Mod Properties
|
# Mod Properties
|
||||||
mod_version=rolling
|
mod_version = rolling
|
||||||
maven_group=land.chipmunk.kaboomfabric
|
maven_group = land.chipmunk.kaboomfabric
|
||||||
archives_base_name=extras
|
archives_base_name = extras
|
||||||
|
|
||||||
|
# Dependencies
|
||||||
|
fabric_version=0.75.3+1.19.4
|
||||||
|
|
BIN
gradle/wrapper/gradle-wrapper.jar
vendored
BIN
gradle/wrapper/gradle-wrapper.jar
vendored
Binary file not shown.
3
gradle/wrapper/gradle-wrapper.properties
vendored
3
gradle/wrapper/gradle-wrapper.properties
vendored
|
@ -1,7 +1,6 @@
|
||||||
distributionBase=GRADLE_USER_HOME
|
distributionBase=GRADLE_USER_HOME
|
||||||
distributionPath=wrapper/dists
|
distributionPath=wrapper/dists
|
||||||
distributionUrl=https\://services.gradle.org/distributions/gradle-8.7-bin.zip
|
distributionUrl=https\://services.gradle.org/distributions/gradle-8.0.1-bin.zip
|
||||||
networkTimeout=10000
|
networkTimeout=10000
|
||||||
validateDistributionUrl=true
|
|
||||||
zipStoreBase=GRADLE_USER_HOME
|
zipStoreBase=GRADLE_USER_HOME
|
||||||
zipStorePath=wrapper/dists
|
zipStorePath=wrapper/dists
|
||||||
|
|
29
gradlew
vendored
29
gradlew
vendored
|
@ -83,8 +83,10 @@ done
|
||||||
# This is normally unused
|
# This is normally unused
|
||||||
# shellcheck disable=SC2034
|
# shellcheck disable=SC2034
|
||||||
APP_BASE_NAME=${0##*/}
|
APP_BASE_NAME=${0##*/}
|
||||||
# Discard cd standard output in case $CDPATH is set (https://github.com/gradle/gradle/issues/25036)
|
APP_HOME=$( cd "${APP_HOME:-./}" && pwd -P ) || exit
|
||||||
APP_HOME=$( cd "${APP_HOME:-./}" > /dev/null && pwd -P ) || exit
|
|
||||||
|
# Add default JVM options here. You can also use JAVA_OPTS and GRADLE_OPTS to pass JVM options to this script.
|
||||||
|
DEFAULT_JVM_OPTS='"-Xmx64m" "-Xms64m"'
|
||||||
|
|
||||||
# Use the maximum available, or set MAX_FD != -1 to use that value.
|
# Use the maximum available, or set MAX_FD != -1 to use that value.
|
||||||
MAX_FD=maximum
|
MAX_FD=maximum
|
||||||
|
@ -131,13 +133,10 @@ location of your Java installation."
|
||||||
fi
|
fi
|
||||||
else
|
else
|
||||||
JAVACMD=java
|
JAVACMD=java
|
||||||
if ! command -v java >/dev/null 2>&1
|
which java >/dev/null 2>&1 || die "ERROR: JAVA_HOME is not set and no 'java' command could be found in your PATH.
|
||||||
then
|
|
||||||
die "ERROR: JAVA_HOME is not set and no 'java' command could be found in your PATH.
|
|
||||||
|
|
||||||
Please set the JAVA_HOME variable in your environment to match the
|
Please set the JAVA_HOME variable in your environment to match the
|
||||||
location of your Java installation."
|
location of your Java installation."
|
||||||
fi
|
|
||||||
fi
|
fi
|
||||||
|
|
||||||
# Increase the maximum file descriptors if we can.
|
# Increase the maximum file descriptors if we can.
|
||||||
|
@ -145,7 +144,7 @@ if ! "$cygwin" && ! "$darwin" && ! "$nonstop" ; then
|
||||||
case $MAX_FD in #(
|
case $MAX_FD in #(
|
||||||
max*)
|
max*)
|
||||||
# In POSIX sh, ulimit -H is undefined. That's why the result is checked to see if it worked.
|
# In POSIX sh, ulimit -H is undefined. That's why the result is checked to see if it worked.
|
||||||
# shellcheck disable=SC2039,SC3045
|
# shellcheck disable=SC3045
|
||||||
MAX_FD=$( ulimit -H -n ) ||
|
MAX_FD=$( ulimit -H -n ) ||
|
||||||
warn "Could not query maximum file descriptor limit"
|
warn "Could not query maximum file descriptor limit"
|
||||||
esac
|
esac
|
||||||
|
@ -153,7 +152,7 @@ if ! "$cygwin" && ! "$darwin" && ! "$nonstop" ; then
|
||||||
'' | soft) :;; #(
|
'' | soft) :;; #(
|
||||||
*)
|
*)
|
||||||
# In POSIX sh, ulimit -n is undefined. That's why the result is checked to see if it worked.
|
# In POSIX sh, ulimit -n is undefined. That's why the result is checked to see if it worked.
|
||||||
# shellcheck disable=SC2039,SC3045
|
# shellcheck disable=SC3045
|
||||||
ulimit -n "$MAX_FD" ||
|
ulimit -n "$MAX_FD" ||
|
||||||
warn "Could not set maximum file descriptor limit to $MAX_FD"
|
warn "Could not set maximum file descriptor limit to $MAX_FD"
|
||||||
esac
|
esac
|
||||||
|
@ -198,15 +197,11 @@ if "$cygwin" || "$msys" ; then
|
||||||
done
|
done
|
||||||
fi
|
fi
|
||||||
|
|
||||||
|
# Collect all arguments for the java command;
|
||||||
# Add default JVM options here. You can also use JAVA_OPTS and GRADLE_OPTS to pass JVM options to this script.
|
# * $DEFAULT_JVM_OPTS, $JAVA_OPTS, and $GRADLE_OPTS can contain fragments of
|
||||||
DEFAULT_JVM_OPTS='"-Xmx64m" "-Xms64m"'
|
# shell script including quotes and variable substitutions, so put them in
|
||||||
|
# double quotes to make sure that they get re-expanded; and
|
||||||
# Collect all arguments for the java command:
|
# * put everything else in single quotes, so that it's not re-expanded.
|
||||||
# * DEFAULT_JVM_OPTS, JAVA_OPTS, JAVA_OPTS, and optsEnvironmentVar are not allowed to contain shell fragments,
|
|
||||||
# and any embedded shellness will be escaped.
|
|
||||||
# * For example: A user cannot expect ${Hostname} to be expanded, as it is an environment variable and will be
|
|
||||||
# treated as '${Hostname}' itself on the command line.
|
|
||||||
|
|
||||||
set -- \
|
set -- \
|
||||||
"-Dorg.gradle.appname=$APP_BASE_NAME" \
|
"-Dorg.gradle.appname=$APP_BASE_NAME" \
|
||||||
|
|
20
gradlew.bat
vendored
20
gradlew.bat
vendored
|
@ -43,11 +43,11 @@ set JAVA_EXE=java.exe
|
||||||
%JAVA_EXE% -version >NUL 2>&1
|
%JAVA_EXE% -version >NUL 2>&1
|
||||||
if %ERRORLEVEL% equ 0 goto execute
|
if %ERRORLEVEL% equ 0 goto execute
|
||||||
|
|
||||||
echo. 1>&2
|
echo.
|
||||||
echo ERROR: JAVA_HOME is not set and no 'java' command could be found in your PATH. 1>&2
|
echo ERROR: JAVA_HOME is not set and no 'java' command could be found in your PATH.
|
||||||
echo. 1>&2
|
echo.
|
||||||
echo Please set the JAVA_HOME variable in your environment to match the 1>&2
|
echo Please set the JAVA_HOME variable in your environment to match the
|
||||||
echo location of your Java installation. 1>&2
|
echo location of your Java installation.
|
||||||
|
|
||||||
goto fail
|
goto fail
|
||||||
|
|
||||||
|
@ -57,11 +57,11 @@ set JAVA_EXE=%JAVA_HOME%/bin/java.exe
|
||||||
|
|
||||||
if exist "%JAVA_EXE%" goto execute
|
if exist "%JAVA_EXE%" goto execute
|
||||||
|
|
||||||
echo. 1>&2
|
echo.
|
||||||
echo ERROR: JAVA_HOME is set to an invalid directory: %JAVA_HOME% 1>&2
|
echo ERROR: JAVA_HOME is set to an invalid directory: %JAVA_HOME%
|
||||||
echo. 1>&2
|
echo.
|
||||||
echo Please set the JAVA_HOME variable in your environment to match the 1>&2
|
echo Please set the JAVA_HOME variable in your environment to match the
|
||||||
echo location of your Java installation. 1>&2
|
echo location of your Java installation.
|
||||||
|
|
||||||
goto fail
|
goto fail
|
||||||
|
|
||||||
|
|
|
@ -1,13 +1,14 @@
|
||||||
package land.chipmunk.kaboomfabric.extras;
|
package land.chipmunk.kaboomfabric.extras;
|
||||||
|
|
||||||
import net.fabricmc.api.ModInitializer;
|
import net.fabricmc.api.ModInitializer;
|
||||||
import org.apache.logging.log4j.LogManager;
|
import org.slf4j.Logger;
|
||||||
import org.apache.logging.log4j.Logger;
|
import org.slf4j.LoggerFactory;
|
||||||
|
import net.minecraft.util.Formatting;
|
||||||
import com.mojang.brigadier.CommandDispatcher;
|
import com.mojang.brigadier.CommandDispatcher;
|
||||||
import land.chipmunk.kaboomfabric.extras.commands.*;
|
import land.chipmunk.kaboomfabric.extras.commands.*;
|
||||||
|
|
||||||
public class Extras implements ModInitializer {
|
public class Extras implements ModInitializer {
|
||||||
public static final Logger LOGGER = LogManager.getLogger("infinite-fixes");
|
public static final Logger LOGGER = LoggerFactory.getLogger("extras");
|
||||||
private static final char[] escapeCodes = "0123456789abcdefklmnorx".toCharArray();
|
private static final char[] escapeCodes = "0123456789abcdefklmnorx".toCharArray();
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
@ -16,7 +17,7 @@ public class Extras implements ModInitializer {
|
||||||
|
|
||||||
public static void registerCommands (CommandDispatcher dispatcher) {
|
public static void registerCommands (CommandDispatcher dispatcher) {
|
||||||
// CommandBroadcastMM.register(dispatcher);
|
// CommandBroadcastMM.register(dispatcher);
|
||||||
// CommandBroadcastVanilla.register(dispatcher);
|
CommandBroadcastVanilla.register(dispatcher);
|
||||||
CommandClearChat.register(dispatcher);
|
CommandClearChat.register(dispatcher);
|
||||||
CommandConsole.register(dispatcher);
|
CommandConsole.register(dispatcher);
|
||||||
CommandDestroyEntities.register(dispatcher);
|
CommandDestroyEntities.register(dispatcher);
|
||||||
|
@ -31,8 +32,8 @@ public class Extras implements ModInitializer {
|
||||||
// CommandSkin.register(dispatcher);
|
// CommandSkin.register(dispatcher);
|
||||||
CommandSpawn.register(dispatcher);
|
CommandSpawn.register(dispatcher);
|
||||||
CommandSpidey.register(dispatcher);
|
CommandSpidey.register(dispatcher);
|
||||||
// CommandTellraw.register(dispatcher);
|
CommandTellraw.register(dispatcher);
|
||||||
// CommandUsername.register(dispatcher);
|
CommandUsername.register(dispatcher);
|
||||||
}
|
}
|
||||||
|
|
||||||
public static String parseEscapeSequences (String string) {
|
public static String parseEscapeSequences (String string) {
|
||||||
|
@ -40,7 +41,7 @@ public class Extras implements ModInitializer {
|
||||||
|
|
||||||
for (int i = 0; i < string.length(); i++) {
|
for (int i = 0; i < string.length(); i++) {
|
||||||
char character = string.charAt(i);
|
char character = string.charAt(i);
|
||||||
if (character == '&' && string.length() > (i + 1) && validateEscapeCode(string.charAt(i + 1))) sb.append((char) 0xa7);
|
if (character == '&' && string.length() > (i + 1) && validateEscapeCode(string.charAt(i + 1))) sb.append(Formatting.FORMATTING_CODE_PREFIX);
|
||||||
else sb.append(character);
|
else sb.append(character);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -0,0 +1,41 @@
|
||||||
|
package land.chipmunk.kaboomfabric.extras.commands;
|
||||||
|
|
||||||
|
import land.chipmunk.kaboomfabric.extras.Extras;
|
||||||
|
import com.mojang.brigadier.Command;
|
||||||
|
import com.mojang.brigadier.CommandDispatcher;
|
||||||
|
import com.mojang.brigadier.context.CommandContext;
|
||||||
|
import net.minecraft.server.command.ServerCommandSource;
|
||||||
|
import net.minecraft.text.Text;
|
||||||
|
import com.mojang.brigadier.tree.LiteralCommandNode;
|
||||||
|
import static net.minecraft.server.command.CommandManager.literal;
|
||||||
|
import static net.minecraft.server.command.CommandManager.argument;
|
||||||
|
import static com.mojang.brigadier.arguments.StringArgumentType.greedyString;
|
||||||
|
import static com.mojang.brigadier.arguments.StringArgumentType.getString;
|
||||||
|
|
||||||
|
public interface CommandBroadcastVanilla {
|
||||||
|
static void register (CommandDispatcher dispatcher) {
|
||||||
|
final LiteralCommandNode node = dispatcher.register(
|
||||||
|
literal("broadcastvanilla")
|
||||||
|
.requires(CommandBroadcastVanilla::requirement)
|
||||||
|
.then(
|
||||||
|
argument("message", greedyString())
|
||||||
|
.executes(CommandBroadcastVanilla::tellrawCommand)
|
||||||
|
)
|
||||||
|
);
|
||||||
|
|
||||||
|
dispatcher.register(literal("bcv").requires(CommandBroadcastVanilla::requirement).executes(CommandTellraw::tellrawCommand).redirect(node));
|
||||||
|
}
|
||||||
|
|
||||||
|
static int tellrawCommand (CommandContext<ServerCommandSource> context) {
|
||||||
|
String string = getString(context, "message");
|
||||||
|
Text text = Text.literal(Extras.parseEscapeSequences(string));
|
||||||
|
|
||||||
|
context.getSource().sendFeedback(text, true);
|
||||||
|
|
||||||
|
return Command.SINGLE_SUCCESS;
|
||||||
|
}
|
||||||
|
|
||||||
|
static boolean requirement (ServerCommandSource source) {
|
||||||
|
return source.hasPermissionLevel(2);
|
||||||
|
}
|
||||||
|
}
|
|
@ -7,7 +7,7 @@ import com.mojang.brigadier.tree.LiteralCommandNode;
|
||||||
import static net.minecraft.server.command.CommandManager.literal;
|
import static net.minecraft.server.command.CommandManager.literal;
|
||||||
import net.minecraft.server.command.ServerCommandSource;
|
import net.minecraft.server.command.ServerCommandSource;
|
||||||
import net.minecraft.text.Text;
|
import net.minecraft.text.Text;
|
||||||
import net.minecraft.text.LiteralText;
|
import net.minecraft.text.MutableText;
|
||||||
import net.minecraft.util.Formatting;
|
import net.minecraft.util.Formatting;
|
||||||
import net.minecraft.server.network.ServerPlayerEntity;
|
import net.minecraft.server.network.ServerPlayerEntity;
|
||||||
|
|
||||||
|
@ -23,11 +23,11 @@ public interface CommandClearChat {
|
||||||
}
|
}
|
||||||
|
|
||||||
static int clearChatCommand (CommandContext<ServerCommandSource> context) {
|
static int clearChatCommand (CommandContext<ServerCommandSource> context) {
|
||||||
final Text text = new LiteralText("");
|
final MutableText text = Text.literal("");
|
||||||
for (int i = 0; i < 100; i++) text.append(new LiteralText("\n"));
|
for (int i = 0; i < 100; i++) text.append(Text.literal("\n"));
|
||||||
text.append(new LiteralText("The chat has been cleared").formatted(Formatting.DARK_GREEN));
|
text.append(Text.literal("The chat has been cleared").formatted(Formatting.DARK_GREEN));
|
||||||
|
|
||||||
for (ServerPlayerEntity player : context.getSource().getMinecraftServer().getPlayerManager().getPlayerList()) {
|
for (ServerPlayerEntity player : context.getSource().getServer().getPlayerManager().getPlayerList()) {
|
||||||
player.sendMessage(text);
|
player.sendMessage(text);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -27,13 +27,13 @@ public interface CommandConsole {
|
||||||
static int consoleCommand (CommandContext<ServerCommandSource> context) {
|
static int consoleCommand (CommandContext<ServerCommandSource> context) {
|
||||||
// ? Should I optimize this to manually create a ParseResults object, or just not wrap the say command in the first place?
|
// ? Should I optimize this to manually create a ParseResults object, or just not wrap the say command in the first place?
|
||||||
final ServerCommandSource source = context.getSource();
|
final ServerCommandSource source = context.getSource();
|
||||||
final MinecraftServer server = source.getMinecraftServer();
|
final MinecraftServer server = source.getServer();
|
||||||
final ServerCommandSource console = server.getCommandSource();
|
final ServerCommandSource console = server.getCommandSource();
|
||||||
|
|
||||||
final String command = "say " + Extras.parseEscapeSequences(getString(context, "message"));
|
final String command = "say " + Extras.parseEscapeSequences(getString(context, "message"));
|
||||||
|
|
||||||
final CommandManager commandManager = server.getCommandManager();
|
final CommandManager commandManager = server.getCommandManager();
|
||||||
commandManager.execute(console, command);
|
commandManager.execute(commandManager.getDispatcher().parse(command, source), command);
|
||||||
|
|
||||||
return Command.SINGLE_SUCCESS;
|
return Command.SINGLE_SUCCESS;
|
||||||
}
|
}
|
||||||
|
|
|
@ -11,9 +11,7 @@ import net.minecraft.entity.Entity;
|
||||||
import net.minecraft.entity.player.PlayerEntity;
|
import net.minecraft.entity.player.PlayerEntity;
|
||||||
import net.minecraft.server.command.ServerCommandSource;
|
import net.minecraft.server.command.ServerCommandSource;
|
||||||
import net.minecraft.server.MinecraftServer;
|
import net.minecraft.server.MinecraftServer;
|
||||||
import net.minecraft.text.LiteralText;
|
import net.minecraft.text.Text;
|
||||||
import land.chipmunk.kaboomfabric.extras.mixin.ServerWorldAccessor;
|
|
||||||
import land.chipmunk.kaboomfabric.extras.mixin.EntityAccessor;
|
|
||||||
|
|
||||||
// Currently broken
|
// Currently broken
|
||||||
public interface CommandDestroyEntities {
|
public interface CommandDestroyEntities {
|
||||||
|
@ -29,15 +27,15 @@ public interface CommandDestroyEntities {
|
||||||
|
|
||||||
static int destroyEntitiesCommand (CommandContext<ServerCommandSource> context) {
|
static int destroyEntitiesCommand (CommandContext<ServerCommandSource> context) {
|
||||||
final ServerCommandSource source = context.getSource();
|
final ServerCommandSource source = context.getSource();
|
||||||
final MinecraftServer server = source.getMinecraftServer();
|
final MinecraftServer server = source.getServer();
|
||||||
|
|
||||||
int entityCount = 0;
|
int entityCount = 0;
|
||||||
int worldCount = 0;
|
int worldCount = 0;
|
||||||
for (ServerWorld world : server.getWorlds()) {
|
for (ServerWorld world : server.getWorlds()) {
|
||||||
for (Entity entity : ((ServerWorldAccessor)(Object)world).entitiesById().values()) {
|
for (Entity entity : world.iterateEntities()) {
|
||||||
if (entity instanceof PlayerEntity) continue;
|
if (entity instanceof PlayerEntity) continue;
|
||||||
try {
|
try {
|
||||||
((EntityAccessor)(Object)entity).destroy();
|
entity.discard();
|
||||||
entityCount++;
|
entityCount++;
|
||||||
} catch (Exception ignored) {
|
} catch (Exception ignored) {
|
||||||
}
|
}
|
||||||
|
@ -46,11 +44,11 @@ public interface CommandDestroyEntities {
|
||||||
}
|
}
|
||||||
|
|
||||||
source.sendFeedback(
|
source.sendFeedback(
|
||||||
new LiteralText("Successfully destroyed ")
|
Text.literal("Successfully destroyed ")
|
||||||
.append(new LiteralText(String.valueOf(entityCount)))
|
.append(Text.literal(String.valueOf(entityCount)))
|
||||||
.append(new LiteralText(" entities in "))
|
.append(Text.literal(" entities in "))
|
||||||
.append(new LiteralText(String.valueOf(worldCount)))
|
.append(Text.literal(String.valueOf(worldCount)))
|
||||||
.append(new LiteralText(" worlds")),
|
.append(Text.literal(" worlds")),
|
||||||
true);
|
true);
|
||||||
|
|
||||||
return Command.SINGLE_SUCCESS;
|
return Command.SINGLE_SUCCESS;
|
||||||
|
|
|
@ -7,19 +7,19 @@ import static net.minecraft.server.command.CommandManager.literal;
|
||||||
import com.mojang.brigadier.exceptions.CommandSyntaxException;
|
import com.mojang.brigadier.exceptions.CommandSyntaxException;
|
||||||
import com.mojang.brigadier.exceptions.SimpleCommandExceptionType;
|
import com.mojang.brigadier.exceptions.SimpleCommandExceptionType;
|
||||||
import net.minecraft.server.command.ServerCommandSource;
|
import net.minecraft.server.command.ServerCommandSource;
|
||||||
import net.minecraft.text.LiteralText;
|
import net.minecraft.text.Text;
|
||||||
import net.minecraft.util.Formatting;
|
import net.minecraft.util.Formatting;
|
||||||
import net.minecraft.util.Identifier;
|
import net.minecraft.util.Identifier;
|
||||||
import net.minecraft.util.registry.Registry;
|
import net.minecraft.registry.Registries;
|
||||||
import net.minecraft.nbt.ListTag;
|
import net.minecraft.nbt.NbtList;
|
||||||
import net.minecraft.nbt.CompoundTag;
|
import net.minecraft.nbt.NbtCompound;
|
||||||
import net.minecraft.nbt.Tag;
|
import net.minecraft.nbt.NbtElement;
|
||||||
import net.minecraft.server.network.ServerPlayerEntity;
|
import net.minecraft.server.network.ServerPlayerEntity;
|
||||||
import net.minecraft.entity.player.PlayerInventory;
|
import net.minecraft.entity.player.PlayerInventory;
|
||||||
import net.minecraft.item.ItemStack;
|
import net.minecraft.item.ItemStack;
|
||||||
|
|
||||||
public abstract class CommandEnchantAll {
|
public abstract class CommandEnchantAll {
|
||||||
private static final SimpleCommandExceptionType EMPTY_ITEM_EXCEPTION = new SimpleCommandExceptionType(new LiteralText("Please hold an item in your hand to enchant it"));
|
private static final SimpleCommandExceptionType EMPTY_ITEM_EXCEPTION = new SimpleCommandExceptionType(Text.literal("Please hold an item in your hand to enchant it"));
|
||||||
|
|
||||||
public static void register (CommandDispatcher dispatcher) {
|
public static void register (CommandDispatcher dispatcher) {
|
||||||
dispatcher.register(
|
dispatcher.register(
|
||||||
|
@ -31,12 +31,12 @@ public abstract class CommandEnchantAll {
|
||||||
|
|
||||||
public static int enchantAllCommand (CommandContext<ServerCommandSource> context) throws CommandSyntaxException {
|
public static int enchantAllCommand (CommandContext<ServerCommandSource> context) throws CommandSyntaxException {
|
||||||
final ServerCommandSource source = context.getSource();
|
final ServerCommandSource source = context.getSource();
|
||||||
final ServerPlayerEntity player = source.getPlayer();
|
final ServerPlayerEntity player = source.getPlayerOrThrow();
|
||||||
final PlayerInventory inventory = player.inventory;
|
final PlayerInventory inventory = player.getInventory();
|
||||||
|
|
||||||
final ListTag enchantments = new ListTag();
|
final NbtList enchantments = new NbtList();
|
||||||
for (Identifier identifier : Registry.ENCHANTMENT.getIds()) {
|
for (Identifier identifier : Registries.ENCHANTMENT.getIds()) {
|
||||||
final CompoundTag enchantment = new CompoundTag();
|
final NbtCompound enchantment = new NbtCompound();
|
||||||
enchantment.putString("id", identifier.toString());
|
enchantment.putString("id", identifier.toString());
|
||||||
enchantment.putShort("lvl", (short) 0xFF);
|
enchantment.putShort("lvl", (short) 0xFF);
|
||||||
enchantments.add(enchantment);
|
enchantments.add(enchantment);
|
||||||
|
@ -45,15 +45,15 @@ public abstract class CommandEnchantAll {
|
||||||
final ItemStack stack = inventory.getStack(inventory.selectedSlot).copy();
|
final ItemStack stack = inventory.getStack(inventory.selectedSlot).copy();
|
||||||
if (stack.isEmpty()) throw EMPTY_ITEM_EXCEPTION.create();
|
if (stack.isEmpty()) throw EMPTY_ITEM_EXCEPTION.create();
|
||||||
|
|
||||||
CompoundTag nbt = stack.getTag();
|
NbtCompound nbt = stack.getNbt();
|
||||||
if (nbt == null) {
|
if (nbt == null) {
|
||||||
nbt = new CompoundTag();
|
nbt = new NbtCompound();
|
||||||
stack.setTag(nbt);
|
stack.setNbt(nbt);
|
||||||
}
|
}
|
||||||
stack.getTag().put("Enchantments", enchantments);
|
stack.getNbt().put("Enchantments", enchantments);
|
||||||
inventory.setStack(inventory.selectedSlot, stack);
|
inventory.setStack(inventory.selectedSlot, stack);
|
||||||
|
|
||||||
source.sendFeedback(new LiteralText("I killed Martin."), false);
|
source.sendFeedback(Text.literal("I killed Martin."), false);
|
||||||
|
|
||||||
return Command.SINGLE_SUCCESS;
|
return Command.SINGLE_SUCCESS;
|
||||||
}
|
}
|
||||||
|
|
|
@ -7,18 +7,18 @@ import com.mojang.brigadier.exceptions.CommandSyntaxException;
|
||||||
import com.mojang.brigadier.tree.LiteralCommandNode;
|
import com.mojang.brigadier.tree.LiteralCommandNode;
|
||||||
import static net.minecraft.server.command.CommandManager.literal;
|
import static net.minecraft.server.command.CommandManager.literal;
|
||||||
import static net.minecraft.server.command.CommandManager.argument;
|
import static net.minecraft.server.command.CommandManager.argument;
|
||||||
import static net.minecraft.command.arguments.EntityArgumentType.players;
|
import static net.minecraft.command.argument.EntityArgumentType.players;
|
||||||
import static net.minecraft.command.arguments.EntityArgumentType.getPlayers;
|
import static net.minecraft.command.argument.EntityArgumentType.getPlayers;
|
||||||
import net.minecraft.server.command.ServerCommandSource;
|
import net.minecraft.server.command.ServerCommandSource;
|
||||||
import net.minecraft.server.network.ServerPlayerEntity;
|
import net.minecraft.server.network.ServerPlayerEntity;
|
||||||
import net.minecraft.server.world.ServerWorld;
|
import net.minecraft.server.world.ServerWorld;
|
||||||
import net.minecraft.util.registry.Registry;
|
import net.minecraft.registry.Registries;
|
||||||
import net.minecraft.util.Identifier;
|
import net.minecraft.util.Identifier;
|
||||||
import net.minecraft.particle.ParticleEffect;
|
import net.minecraft.particle.ParticleEffect;
|
||||||
import net.minecraft.sound.SoundEvent;
|
import net.minecraft.sound.SoundEvent;
|
||||||
import net.minecraft.sound.SoundCategory;
|
import net.minecraft.sound.SoundCategory;
|
||||||
import net.minecraft.util.math.Vec3d;
|
import net.minecraft.util.math.Vec3d;
|
||||||
import net.minecraft.text.LiteralText;
|
import net.minecraft.text.Text;
|
||||||
import java.util.Collection;
|
import java.util.Collection;
|
||||||
|
|
||||||
public interface CommandJumpscare {
|
public interface CommandJumpscare {
|
||||||
|
@ -38,11 +38,11 @@ public interface CommandJumpscare {
|
||||||
static int jumpscareCommand (CommandContext<ServerCommandSource> context) throws CommandSyntaxException {
|
static int jumpscareCommand (CommandContext<ServerCommandSource> context) throws CommandSyntaxException {
|
||||||
final ServerCommandSource source = context.getSource();
|
final ServerCommandSource source = context.getSource();
|
||||||
final Collection<ServerPlayerEntity> players = getPlayers(context, "targets");
|
final Collection<ServerPlayerEntity> players = getPlayers(context, "targets");
|
||||||
final ParticleEffect particle = (ParticleEffect) Registry.PARTICLE_TYPE.get(new Identifier("minecraft", "elder_guardian"));
|
final ParticleEffect particle = (ParticleEffect) Registries.PARTICLE_TYPE.get(new Identifier("minecraft", "elder_guardian"));
|
||||||
final SoundEvent soundEvent = Registry.SOUND_EVENT.get(new Identifier("minecraft", "entity.enderman.scream"));
|
final SoundEvent soundEvent = Registries.SOUND_EVENT.get(new Identifier("minecraft", "entity.enderman.scream"));
|
||||||
|
|
||||||
for (ServerPlayerEntity player : players) {
|
for (ServerPlayerEntity player : players) {
|
||||||
final ServerWorld world = player.getServerWorld();
|
final ServerWorld world = player.getWorld();
|
||||||
final Vec3d position = player.getPos();
|
final Vec3d position = player.getPos();
|
||||||
world.<ParticleEffect>spawnParticles(player, particle, false, position.getX(), position.getY(), position.getZ(), 4, 0, 0, 0, 1);
|
world.<ParticleEffect>spawnParticles(player, particle, false, position.getX(), position.getY(), position.getZ(), 4, 0, 0, 0, 1);
|
||||||
|
|
||||||
|
@ -53,15 +53,15 @@ public interface CommandJumpscare {
|
||||||
final ServerPlayerEntity player = (ServerPlayerEntity) players.toArray()[0];
|
final ServerPlayerEntity player = (ServerPlayerEntity) players.toArray()[0];
|
||||||
|
|
||||||
source.sendFeedback(
|
source.sendFeedback(
|
||||||
new LiteralText("Successfully created jumpscare for player \"")
|
Text.literal("Successfully created jumpscare for player \"")
|
||||||
.append(new LiteralText(player.getGameProfile().getName()))
|
.append(Text.literal(player.getGameProfile().getName()))
|
||||||
.append(new LiteralText("\""))
|
.append(Text.literal("\""))
|
||||||
, true);
|
, true);
|
||||||
|
|
||||||
return Command.SINGLE_SUCCESS;
|
return Command.SINGLE_SUCCESS;
|
||||||
}
|
}
|
||||||
|
|
||||||
source.sendFeedback(new LiteralText("Successfully created jumpscare for multiple players"), true);
|
source.sendFeedback(Text.literal("Successfully created jumpscare for multiple players"), true);
|
||||||
|
|
||||||
return Command.SINGLE_SUCCESS;
|
return Command.SINGLE_SUCCESS;
|
||||||
}
|
}
|
||||||
|
|
|
@ -6,18 +6,17 @@ import com.mojang.brigadier.context.CommandContext;
|
||||||
import static net.minecraft.server.command.CommandManager.literal;
|
import static net.minecraft.server.command.CommandManager.literal;
|
||||||
import com.mojang.brigadier.exceptions.CommandSyntaxException;
|
import com.mojang.brigadier.exceptions.CommandSyntaxException;
|
||||||
import net.minecraft.server.command.ServerCommandSource;
|
import net.minecraft.server.command.ServerCommandSource;
|
||||||
|
import net.minecraft.world.World;
|
||||||
import net.minecraft.server.world.ServerWorld;
|
import net.minecraft.server.world.ServerWorld;
|
||||||
import net.minecraft.world.explosion.Explosion.DestructionType;
|
|
||||||
import net.minecraft.server.network.ServerPlayerEntity;
|
import net.minecraft.server.network.ServerPlayerEntity;
|
||||||
import net.minecraft.entity.player.PlayerInventory;
|
import net.minecraft.entity.player.PlayerInventory;
|
||||||
import net.minecraft.util.registry.Registry;
|
import net.minecraft.registry.Registries;
|
||||||
import net.minecraft.item.ItemStack;
|
import net.minecraft.item.ItemStack;
|
||||||
import net.minecraft.util.Identifier;
|
import net.minecraft.util.Identifier;
|
||||||
import net.minecraft.block.BlockState;
|
import net.minecraft.block.BlockState;
|
||||||
import net.minecraft.util.math.Vec3d;
|
import net.minecraft.util.math.Vec3d;
|
||||||
import net.minecraft.util.math.BlockPos;
|
import net.minecraft.util.math.BlockPos;
|
||||||
import net.minecraft.text.LiteralText;
|
import net.minecraft.text.Text;
|
||||||
import net.minecraft.util.Clearable;
|
|
||||||
import java.util.concurrent.ThreadLocalRandom;
|
import java.util.concurrent.ThreadLocalRandom;
|
||||||
|
|
||||||
public interface CommandKaboom {
|
public interface CommandKaboom {
|
||||||
|
@ -30,40 +29,41 @@ public interface CommandKaboom {
|
||||||
}
|
}
|
||||||
|
|
||||||
static int kaboomCommand (CommandContext<ServerCommandSource> context) throws CommandSyntaxException {
|
static int kaboomCommand (CommandContext<ServerCommandSource> context) throws CommandSyntaxException {
|
||||||
final ServerPlayerEntity player = context.getSource().getPlayer();
|
final ServerPlayerEntity player = context.getSource().getPlayerOrThrow();
|
||||||
boolean explode = ThreadLocalRandom.current().nextBoolean();
|
boolean explode = ThreadLocalRandom.current().nextBoolean();
|
||||||
|
|
||||||
if (explode) {
|
if (explode) {
|
||||||
final Vec3d position = player.getPos();
|
final Vec3d position = player.getPos();
|
||||||
final ServerWorld world = player.getServerWorld();
|
final ServerWorld world = player.getWorld();
|
||||||
final int explosionCount = 20;
|
final int explosionCount = 20;
|
||||||
final int power = 8;
|
final int power = 8;
|
||||||
|
|
||||||
world.createExplosion(player, position.getX(), position.getY(), position.getZ(), power, true, DestructionType.DESTROY);
|
world.createExplosion(player, position.getX(), position.getY(), position.getZ(), power, true, World.ExplosionSourceType.MOB);
|
||||||
|
|
||||||
|
|
||||||
final int power2 = 4;
|
final int power2 = 4;
|
||||||
final BlockState lava = Registry.BLOCK.get(new Identifier("minecraft", "lava")).getDefaultState();
|
final BlockState lava = Registries.BLOCK.get(new Identifier("minecraft", "lava")).getDefaultState();
|
||||||
|
|
||||||
for (int i = 0; i < explosionCount; i++) {
|
for (int i = 0; i < explosionCount; i++) {
|
||||||
final double posX = position.getX() + ThreadLocalRandom.current().nextInt(-15, 15);
|
final double posX = position.getX() + ThreadLocalRandom.current().nextInt(-15, 15);
|
||||||
final double posY = position.getY() + ThreadLocalRandom.current().nextInt(-6, 6);
|
final double posY = position.getY() + ThreadLocalRandom.current().nextInt(-6, 6);
|
||||||
final double posZ = position.getZ() + ThreadLocalRandom.current().nextInt(-15, 15);
|
final double posZ = position.getZ() + ThreadLocalRandom.current().nextInt(-15, 15);
|
||||||
|
|
||||||
world.createExplosion(player, posX, posY, posZ, power2, true, DestructionType.DESTROY);
|
world.createExplosion(player, posX, posY, posZ, power2, true, World.ExplosionSourceType.MOB);
|
||||||
|
|
||||||
final BlockPos blockPos = new BlockPos((int) posX, (int) posY, (int) posZ);
|
final BlockPos blockPos = new BlockPos((int) posX, (int) posY, (int) posZ);
|
||||||
if (!world.canSetBlock(blockPos)) continue;
|
if (!world.canSetBlock(blockPos)) continue;
|
||||||
Clearable.clear(world.getBlockEntity(blockPos));
|
if (world.getBlockState(blockPos).hasBlockEntity()) world.removeBlockEntity(blockPos);
|
||||||
world.setBlockState(blockPos, lava);
|
world.setBlockState(blockPos, lava);
|
||||||
}
|
}
|
||||||
|
|
||||||
player.sendMessage(new LiteralText("Forgive me :c"));
|
player.sendMessage(Text.literal("Forgive me :c"));
|
||||||
return Command.SINGLE_SUCCESS;
|
return Command.SINGLE_SUCCESS;
|
||||||
}
|
}
|
||||||
|
|
||||||
final PlayerInventory inventory = player.inventory;
|
final PlayerInventory inventory = player.getInventory();
|
||||||
inventory.setStack(inventory.selectedSlot, new ItemStack(Registry.ITEM.get(new Identifier("minecraft", "cake"))));
|
inventory.setStack(inventory.selectedSlot, new ItemStack(Registries.ITEM.get(new Identifier("minecraft", "cake"))));
|
||||||
player.sendMessage(new LiteralText("Have a nice day :)"));
|
player.sendMessage(Text.literal("Have a nice day :)"));
|
||||||
return Command.SINGLE_SUCCESS;
|
return Command.SINGLE_SUCCESS;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -7,10 +7,10 @@ import com.mojang.brigadier.exceptions.CommandSyntaxException;
|
||||||
import com.mojang.brigadier.tree.LiteralCommandNode;
|
import com.mojang.brigadier.tree.LiteralCommandNode;
|
||||||
import static net.minecraft.server.command.CommandManager.literal;
|
import static net.minecraft.server.command.CommandManager.literal;
|
||||||
import static net.minecraft.server.command.CommandManager.argument;
|
import static net.minecraft.server.command.CommandManager.argument;
|
||||||
import static net.minecraft.command.arguments.EntityArgumentType.player;
|
import static net.minecraft.command.argument.EntityArgumentType.player;
|
||||||
import static net.minecraft.command.arguments.EntityArgumentType.getPlayer;
|
import static net.minecraft.command.argument.EntityArgumentType.getPlayer;
|
||||||
import net.minecraft.server.command.ServerCommandSource;
|
import net.minecraft.server.command.ServerCommandSource;
|
||||||
import net.minecraft.text.LiteralText;
|
import net.minecraft.text.Text;
|
||||||
import net.minecraft.util.Formatting;
|
import net.minecraft.util.Formatting;
|
||||||
import net.minecraft.server.network.ServerPlayerEntity;
|
import net.minecraft.server.network.ServerPlayerEntity;
|
||||||
|
|
||||||
|
@ -32,15 +32,15 @@ public abstract class CommandPing {
|
||||||
|
|
||||||
public static int pingCommand (CommandContext<ServerCommandSource> context) throws CommandSyntaxException {
|
public static int pingCommand (CommandContext<ServerCommandSource> context) throws CommandSyntaxException {
|
||||||
final ServerCommandSource source = context.getSource();
|
final ServerCommandSource source = context.getSource();
|
||||||
final ServerPlayerEntity player = source.getPlayer();
|
final ServerPlayerEntity player = source.getPlayerOrThrow();
|
||||||
final int ping = player.pingMilliseconds;
|
final int ping = player.pingMilliseconds;
|
||||||
final Formatting highlighting = getHighlighting(ping);
|
final Formatting highlighting = getHighlighting(ping);
|
||||||
|
|
||||||
source.sendFeedback(
|
source.sendFeedback(
|
||||||
new LiteralText("Your")
|
Text.literal("Your")
|
||||||
.append(new LiteralText(" ping is "))
|
.append(Text.literal(" ping is "))
|
||||||
.append(new LiteralText(String.valueOf(ping)).formatted(highlighting))
|
.append(Text.literal(String.valueOf(ping)).formatted(highlighting))
|
||||||
.append(new LiteralText("ms.").formatted(highlighting))
|
.append(Text.literal("ms.").formatted(highlighting))
|
||||||
, false);
|
, false);
|
||||||
|
|
||||||
return Command.SINGLE_SUCCESS;
|
return Command.SINGLE_SUCCESS;
|
||||||
|
@ -53,11 +53,11 @@ public abstract class CommandPing {
|
||||||
final Formatting highlighting = getHighlighting(ping);
|
final Formatting highlighting = getHighlighting(ping);
|
||||||
|
|
||||||
source.sendFeedback(
|
source.sendFeedback(
|
||||||
new LiteralText(target.getGameProfile().getName())
|
Text.literal(target.getGameProfile().getName())
|
||||||
.append(new LiteralText("'s"))
|
.append(Text.literal("'s"))
|
||||||
.append(new LiteralText(" ping is "))
|
.append(Text.literal(" ping is "))
|
||||||
.append(new LiteralText(String.valueOf(ping)).formatted(highlighting))
|
.append(Text.literal(String.valueOf(ping)).formatted(highlighting))
|
||||||
.append(new LiteralText("ms.").formatted(highlighting))
|
.append(Text.literal("ms.").formatted(highlighting))
|
||||||
, false);
|
, false);
|
||||||
|
|
||||||
return Command.SINGLE_SUCCESS;
|
return Command.SINGLE_SUCCESS;
|
||||||
|
|
|
@ -6,16 +6,16 @@ import com.mojang.brigadier.context.CommandContext;
|
||||||
import com.mojang.brigadier.exceptions.CommandSyntaxException;
|
import com.mojang.brigadier.exceptions.CommandSyntaxException;
|
||||||
import static net.minecraft.server.command.CommandManager.literal;
|
import static net.minecraft.server.command.CommandManager.literal;
|
||||||
import static net.minecraft.server.command.CommandManager.argument;
|
import static net.minecraft.server.command.CommandManager.argument;
|
||||||
import static net.minecraft.command.arguments.EntityArgumentType.players;
|
import static net.minecraft.command.argument.EntityArgumentType.players;
|
||||||
import static net.minecraft.command.arguments.EntityArgumentType.getPlayers;
|
import static net.minecraft.command.argument.EntityArgumentType.getPlayers;
|
||||||
import net.minecraft.server.command.ServerCommandSource;
|
import net.minecraft.server.command.ServerCommandSource;
|
||||||
import net.minecraft.server.network.ServerPlayerEntity;
|
import net.minecraft.server.network.ServerPlayerEntity;
|
||||||
import net.minecraft.entity.player.PlayerInventory;
|
import net.minecraft.entity.player.PlayerInventory;
|
||||||
import net.minecraft.util.registry.Registry;
|
import net.minecraft.registry.Registries;
|
||||||
import net.minecraft.util.Identifier;
|
import net.minecraft.util.Identifier;
|
||||||
import net.minecraft.item.Item;
|
import net.minecraft.item.Item;
|
||||||
import net.minecraft.item.ItemStack;
|
import net.minecraft.item.ItemStack;
|
||||||
import net.minecraft.text.LiteralText;
|
import net.minecraft.text.Text;
|
||||||
import java.util.Collection;
|
import java.util.Collection;
|
||||||
|
|
||||||
public interface CommandPumpkin {
|
public interface CommandPumpkin {
|
||||||
|
@ -33,10 +33,10 @@ public interface CommandPumpkin {
|
||||||
static int pumpkinCommand (CommandContext<ServerCommandSource> context) throws CommandSyntaxException {
|
static int pumpkinCommand (CommandContext<ServerCommandSource> context) throws CommandSyntaxException {
|
||||||
final ServerCommandSource source = context.getSource();
|
final ServerCommandSource source = context.getSource();
|
||||||
final Collection<ServerPlayerEntity> players = getPlayers(context, "targets");
|
final Collection<ServerPlayerEntity> players = getPlayers(context, "targets");
|
||||||
final Item carvedPumpkin = Registry.ITEM.get(new Identifier("minecraft", "carved_pumpkin"));
|
final Item carvedPumpkin = Registries.ITEM.get(new Identifier("minecraft", "carved_pumpkin"));
|
||||||
|
|
||||||
for (ServerPlayerEntity player : players) {
|
for (ServerPlayerEntity player : players) {
|
||||||
final PlayerInventory inventory = player.inventory;
|
final PlayerInventory inventory = player.getInventory();
|
||||||
inventory.setStack(39, new ItemStack(carvedPumpkin));
|
inventory.setStack(39, new ItemStack(carvedPumpkin));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -44,15 +44,15 @@ public interface CommandPumpkin {
|
||||||
final ServerPlayerEntity player = (ServerPlayerEntity) players.toArray()[0];
|
final ServerPlayerEntity player = (ServerPlayerEntity) players.toArray()[0];
|
||||||
|
|
||||||
source.sendFeedback(
|
source.sendFeedback(
|
||||||
new LiteralText("Player \"")
|
Text.literal("Player \"")
|
||||||
.append(new LiteralText(player.getGameProfile().getName()))
|
.append(Text.literal(player.getGameProfile().getName()))
|
||||||
.append(new LiteralText("\" is now a pumpkin"))
|
.append(Text.literal("\" is now a pumpkin"))
|
||||||
, true);
|
, true);
|
||||||
|
|
||||||
return Command.SINGLE_SUCCESS;
|
return Command.SINGLE_SUCCESS;
|
||||||
}
|
}
|
||||||
|
|
||||||
source.sendFeedback(new LiteralText("Multiple players are now pumpkins"), true);
|
source.sendFeedback(Text.literal("Multiple players are now pumpkins"), true);
|
||||||
|
|
||||||
return Command.SINGLE_SUCCESS;
|
return Command.SINGLE_SUCCESS;
|
||||||
}
|
}
|
||||||
|
|
|
@ -6,7 +6,8 @@ import com.mojang.brigadier.context.CommandContext;
|
||||||
import com.mojang.brigadier.tree.LiteralCommandNode;
|
import com.mojang.brigadier.tree.LiteralCommandNode;
|
||||||
import static net.minecraft.server.command.CommandManager.literal;
|
import static net.minecraft.server.command.CommandManager.literal;
|
||||||
import net.minecraft.server.command.ServerCommandSource;
|
import net.minecraft.server.command.ServerCommandSource;
|
||||||
import net.minecraft.text.LiteralText;
|
import net.minecraft.text.Text;
|
||||||
|
import net.minecraft.text.MutableText;
|
||||||
import net.minecraft.util.Formatting;
|
import net.minecraft.util.Formatting;
|
||||||
import java.io.BufferedReader;
|
import java.io.BufferedReader;
|
||||||
import java.io.InputStreamReader;
|
import java.io.InputStreamReader;
|
||||||
|
@ -26,8 +27,8 @@ public abstract class CommandServerInfo {
|
||||||
|
|
||||||
private static void sendInfoMessage (ServerCommandSource source, String description, String value) {
|
private static void sendInfoMessage (ServerCommandSource source, String description, String value) {
|
||||||
source.sendFeedback(
|
source.sendFeedback(
|
||||||
new LiteralText(description).formatted(Formatting.GRAY)
|
Text.literal(description).formatted(Formatting.GRAY)
|
||||||
.append(new LiteralText(": " + value).formatted(Formatting.WHITE))
|
.append(Text.literal(": " + value).formatted(Formatting.WHITE))
|
||||||
, false);
|
, false);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -8,11 +8,10 @@ import com.mojang.brigadier.exceptions.CommandSyntaxException;
|
||||||
import static net.minecraft.server.command.CommandManager.literal;
|
import static net.minecraft.server.command.CommandManager.literal;
|
||||||
import net.minecraft.server.command.ServerCommandSource;
|
import net.minecraft.server.command.ServerCommandSource;
|
||||||
import net.minecraft.server.world.ServerWorld;
|
import net.minecraft.server.world.ServerWorld;
|
||||||
import net.minecraft.world.level.LevelProperties;
|
|
||||||
import net.minecraft.world.dimension.DimensionType;
|
|
||||||
import net.minecraft.entity.Entity;
|
import net.minecraft.entity.Entity;
|
||||||
import net.minecraft.util.math.Vec3d;
|
import net.minecraft.util.math.Vec3d;
|
||||||
import net.minecraft.text.LiteralText;
|
import net.minecraft.network.packet.s2c.play.PositionFlag;
|
||||||
|
import net.minecraft.text.Text;
|
||||||
import java.util.Set;
|
import java.util.Set;
|
||||||
import java.util.HashSet;
|
import java.util.HashSet;
|
||||||
|
|
||||||
|
@ -28,13 +27,15 @@ public interface CommandSpawn {
|
||||||
static int spawnCommand (CommandContext<ServerCommandSource> context) throws CommandSyntaxException {
|
static int spawnCommand (CommandContext<ServerCommandSource> context) throws CommandSyntaxException {
|
||||||
final ServerCommandSource source = context.getSource();
|
final ServerCommandSource source = context.getSource();
|
||||||
final Entity entity = source.getEntityOrThrow();
|
final Entity entity = source.getEntityOrThrow();
|
||||||
final ServerWorld world = source.getMinecraftServer().getWorld(DimensionType.OVERWORLD);
|
final ServerWorld world = source.getServer().getOverworld();
|
||||||
final LevelProperties properties = world.getLevelProperties();
|
|
||||||
|
|
||||||
entity.setWorld(world);
|
final Vec3d spawn = Vec3d.ofCenter(world.getSpawnPos());
|
||||||
entity.teleport(properties.getSpawnX() + 0.5, properties.getSpawnY(), properties.getSpawnZ() + 0.5);
|
final float spawnAngle = world.getSpawnAngle();
|
||||||
|
|
||||||
source.sendFeedback(new LiteralText("Successfully moved to spawn"), false);
|
final Set<PositionFlag> positionFlags = new HashSet<>();
|
||||||
|
entity.teleport(world, spawn.getX(), spawn.getY(), spawn.getZ(), positionFlags, spawnAngle, 0);
|
||||||
|
|
||||||
|
source.sendFeedback(Text.literal("Successfully moved to spawn"), false);
|
||||||
|
|
||||||
return Command.SINGLE_SUCCESS;
|
return Command.SINGLE_SUCCESS;
|
||||||
}
|
}
|
||||||
|
|
|
@ -9,12 +9,11 @@ import static net.minecraft.server.command.CommandManager.argument;
|
||||||
import net.minecraft.server.command.ServerCommandSource;
|
import net.minecraft.server.command.ServerCommandSource;
|
||||||
import net.minecraft.entity.Entity;
|
import net.minecraft.entity.Entity;
|
||||||
import net.minecraft.server.world.ServerWorld;
|
import net.minecraft.server.world.ServerWorld;
|
||||||
import net.minecraft.util.registry.Registry;
|
import net.minecraft.registry.Registries;
|
||||||
import net.minecraft.util.Identifier;
|
import net.minecraft.util.Identifier;
|
||||||
import net.minecraft.block.BlockState;
|
import net.minecraft.block.BlockState;
|
||||||
import net.minecraft.util.math.Vec3d;
|
import net.minecraft.util.math.Vec3d;
|
||||||
import net.minecraft.util.math.BlockPos;
|
import net.minecraft.util.math.BlockPos;
|
||||||
import net.minecraft.util.Clearable;
|
|
||||||
import land.chipmunk.kaboomfabric.extras.modules.block.BlockIterator;
|
import land.chipmunk.kaboomfabric.extras.modules.block.BlockIterator;
|
||||||
|
|
||||||
public abstract class CommandSpidey {
|
public abstract class CommandSpidey {
|
||||||
|
@ -30,7 +29,7 @@ public abstract class CommandSpidey {
|
||||||
final ServerCommandSource source = context.getSource();
|
final ServerCommandSource source = context.getSource();
|
||||||
final Entity entity = source.getEntityOrThrow();
|
final Entity entity = source.getEntityOrThrow();
|
||||||
final ServerWorld world = source.getWorld();
|
final ServerWorld world = source.getWorld();
|
||||||
/*
|
|
||||||
final Vec3d start = entity.getEyePos();
|
final Vec3d start = entity.getEyePos();
|
||||||
final Vec3d direction = Vec3d.fromPolar(entity.getYaw(), entity.getPitch());
|
final Vec3d direction = Vec3d.fromPolar(entity.getYaw(), entity.getPitch());
|
||||||
final int yOffset = 0;
|
final int yOffset = 0;
|
||||||
|
@ -38,16 +37,15 @@ public abstract class CommandSpidey {
|
||||||
|
|
||||||
final BlockIterator iterator = new BlockIterator(start, direction, yOffset, distance);
|
final BlockIterator iterator = new BlockIterator(start, direction, yOffset, distance);
|
||||||
|
|
||||||
final BlockState cobweb = Registry.BLOCK.get(new Identifier("minecraft", "cobweb")).getDefaultState();
|
final BlockState cobweb = Registries.BLOCK.get(new Identifier("minecraft", "cobweb")).getDefaultState();
|
||||||
|
|
||||||
while (iterator.hasNext()) {
|
while (iterator.hasNext()) {
|
||||||
BlockPos pos = iterator.next();
|
BlockPos pos = iterator.next();
|
||||||
if ((pos.getY() >= 0 && pos.getY() <= 255) || !world.getBlockState(pos).isAir()) break;
|
if (!world.isInBuildLimit(pos) || !world.getBlockState(pos).isAir()) break;
|
||||||
|
|
||||||
Clearable.clear(world.getBlockEntity(pos));
|
if (world.getBlockState(pos).hasBlockEntity()) world.removeBlockEntity(pos);
|
||||||
world.setBlockState(pos, cobweb);
|
world.setBlockState(pos, cobweb);
|
||||||
}
|
}
|
||||||
*/
|
|
||||||
|
|
||||||
return Command.SINGLE_SUCCESS;
|
return Command.SINGLE_SUCCESS;
|
||||||
}
|
}
|
||||||
|
|
|
@ -0,0 +1,45 @@
|
||||||
|
package land.chipmunk.kaboomfabric.extras.commands;
|
||||||
|
|
||||||
|
import land.chipmunk.kaboomfabric.extras.Extras;
|
||||||
|
import com.mojang.brigadier.Command;
|
||||||
|
import com.mojang.brigadier.CommandDispatcher;
|
||||||
|
import com.mojang.brigadier.context.CommandContext;
|
||||||
|
import net.minecraft.server.command.ServerCommandSource;
|
||||||
|
import net.minecraft.text.Text;
|
||||||
|
import net.minecraft.server.network.ServerPlayerEntity;
|
||||||
|
import com.mojang.brigadier.tree.LiteralCommandNode;
|
||||||
|
import static net.minecraft.server.command.CommandManager.literal;
|
||||||
|
import static net.minecraft.server.command.CommandManager.argument;
|
||||||
|
import static com.mojang.brigadier.arguments.StringArgumentType.greedyString;
|
||||||
|
import static com.mojang.brigadier.arguments.StringArgumentType.getString;
|
||||||
|
|
||||||
|
public interface CommandTellraw {
|
||||||
|
static void register (CommandDispatcher dispatcher) {
|
||||||
|
final LiteralCommandNode node = dispatcher.register(
|
||||||
|
literal("broadcastraw")
|
||||||
|
.requires(CommandTellraw::requirement)
|
||||||
|
.then(
|
||||||
|
argument("message", greedyString())
|
||||||
|
.executes(CommandTellraw::tellrawCommand)
|
||||||
|
)
|
||||||
|
);
|
||||||
|
|
||||||
|
dispatcher.register(literal("bcraw").requires(CommandTellraw::requirement).executes(CommandTellraw::tellrawCommand).redirect(node));
|
||||||
|
// No tellraw alias
|
||||||
|
}
|
||||||
|
|
||||||
|
static int tellrawCommand (CommandContext<ServerCommandSource> context) {
|
||||||
|
String string = getString(context, "message");
|
||||||
|
Text text = Text.literal(Extras.parseEscapeSequences(string));
|
||||||
|
|
||||||
|
for (ServerPlayerEntity player : context.getSource().getServer().getPlayerManager().getPlayerList()) {
|
||||||
|
player.sendMessage(text);
|
||||||
|
}
|
||||||
|
|
||||||
|
return Command.SINGLE_SUCCESS;
|
||||||
|
}
|
||||||
|
|
||||||
|
static boolean requirement (ServerCommandSource source) {
|
||||||
|
return source.hasPermissionLevel(2);
|
||||||
|
}
|
||||||
|
}
|
|
@ -0,0 +1,93 @@
|
||||||
|
package land.chipmunk.kaboomfabric.extras.commands;
|
||||||
|
|
||||||
|
import com.mojang.brigadier.Command;
|
||||||
|
import com.mojang.brigadier.CommandDispatcher;
|
||||||
|
import com.mojang.brigadier.context.CommandContext;
|
||||||
|
import com.mojang.brigadier.exceptions.CommandSyntaxException;
|
||||||
|
import com.mojang.brigadier.exceptions.SimpleCommandExceptionType;
|
||||||
|
import com.mojang.brigadier.exceptions.DynamicCommandExceptionType;
|
||||||
|
import static net.minecraft.server.command.CommandManager.literal;
|
||||||
|
import static net.minecraft.server.command.CommandManager.argument;
|
||||||
|
import static com.mojang.brigadier.arguments.StringArgumentType.greedyString;
|
||||||
|
import static com.mojang.brigadier.arguments.StringArgumentType.getString;
|
||||||
|
import com.mojang.authlib.GameProfile;
|
||||||
|
import com.mojang.authlib.properties.PropertyMap;
|
||||||
|
import com.mojang.authlib.properties.Property;
|
||||||
|
import net.minecraft.server.command.ServerCommandSource;
|
||||||
|
import net.minecraft.server.network.ServerPlayerEntity;
|
||||||
|
import net.minecraft.text.Text;
|
||||||
|
import net.minecraft.entity.player.PlayerEntity;
|
||||||
|
import net.minecraft.server.PlayerManager;
|
||||||
|
import net.minecraft.network.packet.s2c.play.PlayerRemoveS2CPacket;
|
||||||
|
import net.minecraft.network.packet.s2c.play.PlayerListS2CPacket;
|
||||||
|
import land.chipmunk.kaboomfabric.extras.Extras;
|
||||||
|
import land.chipmunk.kaboomfabric.extras.mixin.PlayerEntityAccessor;
|
||||||
|
|
||||||
|
import java.util.HashMap;
|
||||||
|
import java.util.Map;
|
||||||
|
import java.util.Collections;
|
||||||
|
|
||||||
|
public abstract class CommandUsername {
|
||||||
|
private static final DynamicCommandExceptionType ALREADY_HAVE_USERNAME_EXCEPTION = new DynamicCommandExceptionType(name -> Text.literal("You already have the username \"").append(Text.literal((String)name)).append(Text.literal("\"")));
|
||||||
|
private static final SimpleCommandExceptionType RATELIMIT_EXCEPTION = new SimpleCommandExceptionType(Text.literal("Please wait a few seconds before changing your username."));
|
||||||
|
private static final SimpleCommandExceptionType ALREADY_LOGGED_IN_EXCEPTION = new SimpleCommandExceptionType(Text.literal("A player with that username is already logged in."));
|
||||||
|
|
||||||
|
public static final Map<ServerPlayerEntity, Long> lastUsedMillis = new HashMap<>();
|
||||||
|
|
||||||
|
public static void register (CommandDispatcher dispatcher) {
|
||||||
|
dispatcher.register(
|
||||||
|
literal("username")
|
||||||
|
.requires(source -> source.hasPermissionLevel(2))
|
||||||
|
.then(
|
||||||
|
argument("username", greedyString())
|
||||||
|
.executes(CommandUsername::usernameCommand)
|
||||||
|
)
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
|
public static int usernameCommand (CommandContext<ServerCommandSource> context) throws CommandSyntaxException {
|
||||||
|
final ServerCommandSource source = context.getSource();
|
||||||
|
final ServerPlayerEntity player = source.getPlayerOrThrow();
|
||||||
|
final PlayerManager playerManager = source.getServer().getPlayerManager();
|
||||||
|
|
||||||
|
final GameProfile oldProfile = player.getGameProfile();
|
||||||
|
final PropertyMap oldProperties = oldProfile.getProperties();
|
||||||
|
|
||||||
|
final String nameColor = Extras.parseEscapeSequences(getString(context, "username"));
|
||||||
|
final String name = nameColor.substring(0, Math.min(16, nameColor.length()));
|
||||||
|
final long millis = lastUsedMillis.getOrDefault(player, 0L);
|
||||||
|
final long millisDifference = System.currentTimeMillis() - millis;
|
||||||
|
|
||||||
|
if (name.equals(oldProfile.getName())) {
|
||||||
|
throw ALREADY_HAVE_USERNAME_EXCEPTION.create(name);
|
||||||
|
}
|
||||||
|
|
||||||
|
if (millisDifference <= 2000) {
|
||||||
|
throw RATELIMIT_EXCEPTION.create();
|
||||||
|
}
|
||||||
|
|
||||||
|
for (ServerPlayerEntity other : source.getServer().getPlayerManager().getPlayerList()) {
|
||||||
|
if (!other.getGameProfile().getName().equalsIgnoreCase(name)) continue;
|
||||||
|
|
||||||
|
throw ALREADY_LOGGED_IN_EXCEPTION.create();
|
||||||
|
}
|
||||||
|
|
||||||
|
final GameProfile newProfile = new GameProfile(oldProfile.getId(), name);
|
||||||
|
final PropertyMap newProperties = newProfile.getProperties();
|
||||||
|
for (final Property property : oldProperties.values()) newProperties.put(property.getName(), property);
|
||||||
|
|
||||||
|
((PlayerEntityAccessor)(Object)player).gameProfile(newProfile);
|
||||||
|
lastUsedMillis.put(player, System.currentTimeMillis());
|
||||||
|
|
||||||
|
// Update the player's player list entry
|
||||||
|
playerManager.sendToAll(new PlayerRemoveS2CPacket(Collections.singletonList(oldProfile.getId())));
|
||||||
|
playerManager.sendToAll(PlayerListS2CPacket.entryFromPlayer(Collections.singleton(player)));
|
||||||
|
|
||||||
|
source.sendFeedback(
|
||||||
|
Text.literal("Successfully set your username to \"")
|
||||||
|
.append(Text.literal(name))
|
||||||
|
.append(Text.literal("\""))
|
||||||
|
, false);
|
||||||
|
return Command.SINGLE_SUCCESS;
|
||||||
|
}
|
||||||
|
}
|
|
@ -8,6 +8,7 @@ import org.spongepowered.asm.mixin.injection.Inject;
|
||||||
import org.spongepowered.asm.mixin.injection.callback.CallbackInfo;
|
import org.spongepowered.asm.mixin.injection.callback.CallbackInfo;
|
||||||
import net.minecraft.server.command.CommandManager;
|
import net.minecraft.server.command.CommandManager;
|
||||||
import net.minecraft.server.command.ServerCommandSource;
|
import net.minecraft.server.command.ServerCommandSource;
|
||||||
|
import net.minecraft.command.CommandRegistryAccess;
|
||||||
import com.mojang.brigadier.CommandDispatcher;
|
import com.mojang.brigadier.CommandDispatcher;
|
||||||
|
|
||||||
@Mixin(CommandManager.class)
|
@Mixin(CommandManager.class)
|
||||||
|
@ -16,7 +17,7 @@ public abstract class CommandManagerMixin {
|
||||||
private CommandDispatcher<ServerCommandSource> dispatcher;
|
private CommandDispatcher<ServerCommandSource> dispatcher;
|
||||||
|
|
||||||
@Inject(at = @At(value = "INVOKE", target = "Lcom/mojang/brigadier/CommandDispatcher;setConsumer(Lcom/mojang/brigadier/ResultConsumer;)V", remap = false), method = "<init>")
|
@Inject(at = @At(value = "INVOKE", target = "Lcom/mojang/brigadier/CommandDispatcher;setConsumer(Lcom/mojang/brigadier/ResultConsumer;)V", remap = false), method = "<init>")
|
||||||
private void init (boolean isDedicatedServer, CallbackInfo info) {
|
private void init (CommandManager.RegistrationEnvironment environment, CommandRegistryAccess commandRegistryAccess, CallbackInfo info) {
|
||||||
Extras.registerCommands(dispatcher);
|
Extras.registerCommands(dispatcher);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -1,16 +0,0 @@
|
||||||
package land.chipmunk.kaboomfabric.extras.mixin;
|
|
||||||
|
|
||||||
import org.spongepowered.asm.mixin.Mixin;
|
|
||||||
import org.spongepowered.asm.mixin.injection.At;
|
|
||||||
import org.spongepowered.asm.mixin.injection.Inject;
|
|
||||||
import org.spongepowered.asm.mixin.injection.callback.CallbackInfo;
|
|
||||||
import com.mojang.brigadier.CommandDispatcher;
|
|
||||||
import net.minecraft.server.command.ServerCommandSource;
|
|
||||||
|
|
||||||
@Mixin(net.minecraft.server.command.DebugDimCommand.class)
|
|
||||||
public abstract class DebugDimCommandMixin {
|
|
||||||
@Inject(at = @At("HEAD"), method = "register", cancellable = true)
|
|
||||||
private static void register (CommandDispatcher<ServerCommandSource> dispatcher, CallbackInfo info) {
|
|
||||||
info.cancel();
|
|
||||||
}
|
|
||||||
}
|
|
|
@ -1,9 +0,0 @@
|
||||||
package land.chipmunk.kaboomfabric.extras.mixin;
|
|
||||||
|
|
||||||
import org.spongepowered.asm.mixin.Mixin;
|
|
||||||
import org.spongepowered.asm.mixin.gen.Invoker;
|
|
||||||
|
|
||||||
@Mixin(net.minecraft.entity.Entity.class)
|
|
||||||
public interface EntityAccessor {
|
|
||||||
@Invoker("destroy") void destroy ();
|
|
||||||
}
|
|
|
@ -0,0 +1,11 @@
|
||||||
|
package land.chipmunk.kaboomfabric.extras.mixin;
|
||||||
|
|
||||||
|
import org.spongepowered.asm.mixin.Mixin;
|
||||||
|
import org.spongepowered.asm.mixin.Mutable;
|
||||||
|
import org.spongepowered.asm.mixin.gen.Accessor;
|
||||||
|
import com.mojang.authlib.GameProfile;
|
||||||
|
|
||||||
|
@Mixin(net.minecraft.entity.player.PlayerEntity.class)
|
||||||
|
public interface PlayerEntityAccessor {
|
||||||
|
@Accessor("gameProfile") @Mutable void gameProfile (GameProfile profile);
|
||||||
|
}
|
|
@ -3,15 +3,14 @@ package land.chipmunk.kaboomfabric.extras.mixin;
|
||||||
import org.spongepowered.asm.mixin.Mixin;
|
import org.spongepowered.asm.mixin.Mixin;
|
||||||
import org.spongepowered.asm.mixin.injection.At;
|
import org.spongepowered.asm.mixin.injection.At;
|
||||||
import org.spongepowered.asm.mixin.injection.Inject;
|
import org.spongepowered.asm.mixin.injection.Inject;
|
||||||
import org.spongepowered.asm.mixin.injection.callback.CallbackInfoReturnable;
|
import org.spongepowered.asm.mixin.injection.callback.CallbackInfo;
|
||||||
import com.mojang.brigadier.context.CommandContext;
|
|
||||||
import net.minecraft.server.command.ServerCommandSource;
|
import net.minecraft.server.command.ServerCommandSource;
|
||||||
import java.util.Collection;
|
import java.util.Collection;
|
||||||
|
|
||||||
@Mixin(net.minecraft.server.command.ReloadCommand.class)
|
@Mixin(net.minecraft.server.command.ReloadCommand.class)
|
||||||
public abstract class ReloadCommandMixin {
|
public abstract class ReloadCommandMixin {
|
||||||
@Inject(at = @At(value = "INVOKE", target = "Lnet/minecraft/server/MinecraftServer;reload()V"), method = "method_13530", cancellable = true)
|
@Inject(at = @At("HEAD"), method = "tryReloadDataPacks", cancellable = true)
|
||||||
private static void reload (CommandContext<ServerCommandSource> context, CallbackInfoReturnable<Integer> info) {
|
private static void tryReloadDataPacks (Collection<?> datapacks, ServerCommandSource source, CallbackInfo info) {
|
||||||
info.cancel();
|
info.cancel();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -1,11 +0,0 @@
|
||||||
package land.chipmunk.kaboomfabric.extras.mixin;
|
|
||||||
|
|
||||||
import org.spongepowered.asm.mixin.Mixin;
|
|
||||||
import org.spongepowered.asm.mixin.gen.Accessor;
|
|
||||||
import it.unimi.dsi.fastutil.ints.Int2ObjectMap;
|
|
||||||
import net.minecraft.entity.Entity;
|
|
||||||
|
|
||||||
@Mixin(net.minecraft.server.world.ServerWorld.class)
|
|
||||||
public interface ServerWorldAccessor {
|
|
||||||
@Accessor("entitiesById") Int2ObjectMap<Entity> entitiesById ();
|
|
||||||
}
|
|
|
@ -219,12 +219,9 @@ public class BlockIterator implements Iterator<BlockPos> {
|
||||||
return getPosition(direction.getZ(), position.getZ(), block.getZ());
|
return getPosition(direction.getZ(), position.getZ(), block.getZ());
|
||||||
}
|
}
|
||||||
|
|
||||||
// TODO: Backport
|
|
||||||
/*
|
|
||||||
public BlockIterator(Entity entity, int maxDistance) {
|
public BlockIterator(Entity entity, int maxDistance) {
|
||||||
this(entity.getPos(), Vec3d.fromPolar(entity.getYaw(), entity.getPitch()), entity.getEyeHeight(entity.getPose()), maxDistance);
|
this(entity.getPos(), Vec3d.fromPolar(entity.getYaw(), entity.getPitch()), entity.getEyeHeight(entity.getPose()), maxDistance);
|
||||||
}
|
}
|
||||||
*/
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Constructs the BlockIterator.
|
* Constructs the BlockIterator.
|
||||||
|
@ -234,11 +231,9 @@ public class BlockIterator implements Iterator<BlockPos> {
|
||||||
* @param entity Information from the entity is used to set up the trace
|
* @param entity Information from the entity is used to set up the trace
|
||||||
*/
|
*/
|
||||||
|
|
||||||
/*
|
|
||||||
public BlockIterator(Entity entity) {
|
public BlockIterator(Entity entity) {
|
||||||
this(entity, 0);
|
this(entity, 0);
|
||||||
}
|
}
|
||||||
*/
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Returns true if the iteration has more elements
|
* Returns true if the iteration has more elements
|
||||||
|
|
|
@ -11,9 +11,7 @@
|
||||||
"ReloadCommandMixin",
|
"ReloadCommandMixin",
|
||||||
"OpCommandMixin",
|
"OpCommandMixin",
|
||||||
"EntitySelectorMixin",
|
"EntitySelectorMixin",
|
||||||
"ServerWorldAccessor",
|
"PlayerEntityAccessor"
|
||||||
"EntityAccessor",
|
|
||||||
"DebugDimCommandMixin"
|
|
||||||
],
|
],
|
||||||
"injectors": {
|
"injectors": {
|
||||||
"defaultRequire": 1
|
"defaultRequire": 1
|
||||||
|
|
|
@ -33,11 +33,10 @@
|
||||||
],
|
],
|
||||||
|
|
||||||
"depends": {
|
"depends": {
|
||||||
"fabricloader": ">=0.15.11",
|
"fabricloader": ">=0.14.17",
|
||||||
"minecraft": "1.16-alpha.20.13.inf",
|
"minecraft": "~1.19.4",
|
||||||
"java": ">=8"
|
"java": ">=17"
|
||||||
},
|
},
|
||||||
|
|
||||||
"suggests": {
|
"suggests": {
|
||||||
"another-mod": "*"
|
"another-mod": "*"
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue