Compare commits

..

12 commits

35 changed files with 522 additions and 372 deletions

2
.gitignore vendored
View file

@ -19,7 +19,7 @@ build
# other # other
eclipse eclipse
/run* run
# Files from Forge MDK # Files from Forge MDK
forge*changelog.txt forge*changelog.txt

View file

@ -16,10 +16,8 @@ version = "${mcversion}-${version_major}.${version_minor}"
group = "${author}.${modid}" group = "${author}.${modid}"
archivesBaseName = "${modid}" archivesBaseName = "${modid}"
// Mojang ships Java 17 to end users in 1.18+, so your mod should target Java 17.
java.toolchain.languageVersion = JavaLanguageVersion.of(17) java.toolchain.languageVersion = JavaLanguageVersion.of(17)
println "Java: ${System.getProperty 'java.version'}, JVM: ${System.getProperty 'java.vm.version'} (${System.getProperty 'java.vendor'}), Arch: ${System.getProperty 'os.arch'}"
minecraft { minecraft {
mappings channel: project.mcp_channel, version: project.mcp_mappings mappings channel: project.mcp_channel, version: project.mcp_mappings
@ -33,9 +31,6 @@ minecraft {
// Recommended logging level for the console // Recommended logging level for the console
property 'forge.logging.console.level', 'debug' property 'forge.logging.console.level', 'debug'
// Comma-separated list of namespaces to load gametests from. Empty = all namespaces.
// property 'forge.enabledGameTestNamespaces', modid
mods { mods {
constructionwand { constructionwand {
source sourceSets.main source sourceSets.main
@ -52,8 +47,6 @@ minecraft {
// Recommended logging level for the console // Recommended logging level for the console
property 'forge.logging.console.level', 'debug' property 'forge.logging.console.level', 'debug'
// property 'forge.enabledGameTestNamespaces', modid
mods { mods {
constructionwand { constructionwand {
source sourceSets.main source sourceSets.main
@ -61,25 +54,6 @@ minecraft {
} }
} }
// This run config launches GameTestServer and runs all registered gametests, then exits.
// By default, the server will crash when no gametests are provided.
// The gametest system is also enabled by default for other run configs under the /test command.
gameTestServer {
workingDirectory project.file('run')
property 'forge.logging.markers', 'REGISTRIES'
property 'forge.logging.console.level', 'debug'
property 'forge.enabledGameTestNamespaces', modid
mods {
examplemod {
source sourceSets.main
}
}
}
data { data {
workingDirectory project.file("run/client").canonicalPath workingDirectory project.file("run/client").canonicalPath
@ -127,9 +101,8 @@ dependencies {
version: "${project.mcversion}-${project.forgeversion}" version: "${project.mcversion}-${project.forgeversion}"
]) ])
compileOnly "mezz.jei:jei-${mcversion}-common-api:${jei_version}" compileOnly fg.deobf("mezz.jei:${jei_version}:api")
compileOnly "mezz.jei:jei-${mcversion}-forge-api:${jei_version}" runtimeOnly fg.deobf("mezz.jei:${jei_version}")
// runtimeOnly "mezz.jei:jei-${mcversion}-forge:${jei_version}"
compileOnly fg.deobf([ compileOnly fg.deobf([
group: "vazkii.botania", group: "vazkii.botania",
@ -171,7 +144,3 @@ publishing {
} }
} }
} }
tasks.withType(JavaCompile).configureEach {
options.encoding = 'UTF-8' // Use the UTF-8 charset for Java compilation
}

View file

@ -4,15 +4,15 @@ org.gradle.daemon=false
author=thetadev author=thetadev
modid=constructionwand modid=constructionwand
mcversion=1.19.1 mcversion=1.18.1
forgeversion=42.0.9 forgeversion=39.1.0
mcp_channel=official mcp_channel=official
mcp_mappings=1.19.1 mcp_mappings=1.18.1
# Source: https://maven.blamejared.com/vazkii/botania/Botania/ # Source: https://maven.blamejared.com/vazkii/botania/Botania/
botania=1.18.2-430-SNAPSHOT botania=1.18.1-429
# Source: https://dvs1.progwml6.com/files/maven/mezz/jei/ # Source: https://dvs1.progwml6.com/files/maven/mezz/jei/
jei_version=11.2.0.244 jei_version=jei-1.18.1:9.1.0.41
version_major=2 version_major=2
version_minor=8 version_minor=11

Binary file not shown.

View file

@ -1,5 +1,5 @@
distributionBase=GRADLE_USER_HOME distributionBase=GRADLE_USER_HOME
distributionPath=wrapper/dists distributionPath=wrapper/dists
distributionUrl=https\://services.gradle.org/distributions/gradle-7.4.2-bin.zip distributionUrl=https\://services.gradle.org/distributions/gradle-7.3-bin.zip
zipStoreBase=GRADLE_USER_HOME zipStoreBase=GRADLE_USER_HOME
zipStorePath=wrapper/dists zipStorePath=wrapper/dists

257
gradlew vendored
View file

@ -1,7 +1,7 @@
#!/bin/sh #!/usr/bin/env sh
# #
# Copyright © 2015-2021 the original authors. # Copyright 2015 the original author or authors.
# #
# Licensed under the Apache License, Version 2.0 (the "License"); # Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License. # you may not use this file except in compliance with the License.
@ -17,101 +17,67 @@
# #
############################################################################## ##############################################################################
# ##
# Gradle start up script for POSIX generated by Gradle. ## Gradle start up script for UN*X
# ##
# Important for running:
#
# (1) You need a POSIX-compliant shell to run this script. If your /bin/sh is
# noncompliant, but you have some other compliant shell such as ksh or
# bash, then to run this script, type that shell name before the whole
# command line, like:
#
# ksh Gradle
#
# Busybox and similar reduced shells will NOT work, because this script
# requires all of these POSIX shell features:
# * functions;
# * expansions «$var», «${var}», «${var:-default}», «${var+SET}»,
# «${var#prefix}», «${var%suffix}», and «$( cmd )»;
# * compound commands having a testable exit status, especially «case»;
# * various built-in commands including «command», «set», and «ulimit».
#
# Important for patching:
#
# (2) This script targets any POSIX shell, so it avoids extensions provided
# by Bash, Ksh, etc; in particular arrays are avoided.
#
# The "traditional" practice of packing multiple parameters into a
# space-separated string is a well documented source of bugs and security
# problems, so this is (mostly) avoided, by progressively accumulating
# options in "$@", and eventually passing that to Java.
#
# Where the inherited environment variables (DEFAULT_JVM_OPTS, JAVA_OPTS,
# and GRADLE_OPTS) rely on word-splitting, this is performed explicitly;
# see the in-line comments for details.
#
# There are tweaks for specific operating systems such as AIX, CygWin,
# Darwin, MinGW, and NonStop.
#
# (3) This script is generated from the Groovy template
# https://github.com/gradle/gradle/blob/master/subprojects/plugins/src/main/resources/org/gradle/api/internal/plugins/unixStartScript.txt
# within the Gradle project.
#
# You can find Gradle at https://github.com/gradle/gradle/.
#
############################################################################## ##############################################################################
# Attempt to set APP_HOME # Attempt to set APP_HOME
# Resolve links: $0 may be a link # Resolve links: $0 may be a link
app_path=$0 PRG="$0"
# Need this for relative symlinks.
# Need this for daisy-chained symlinks. while [ -h "$PRG" ] ; do
while ls=`ls -ld "$PRG"`
APP_HOME=${app_path%"${app_path##*/}"} # leaves a trailing /; empty if no leading path link=`expr "$ls" : '.*-> \(.*\)$'`
[ -h "$app_path" ] if expr "$link" : '/.*' > /dev/null; then
do PRG="$link"
ls=$( ls -ld "$app_path" ) else
link=${ls#*' -> '} PRG=`dirname "$PRG"`"/$link"
case $link in #( fi
/*) app_path=$link ;; #(
*) app_path=$APP_HOME$link ;;
esac
done done
SAVED="`pwd`"
APP_HOME=$( cd "${APP_HOME:-./}" && pwd -P ) || exit cd "`dirname \"$PRG\"`/" >/dev/null
APP_HOME="`pwd -P`"
cd "$SAVED" >/dev/null
APP_NAME="Gradle" APP_NAME="Gradle"
APP_BASE_NAME=${0##*/} APP_BASE_NAME=`basename "$0"`
# Add default JVM options here. You can also use JAVA_OPTS and GRADLE_OPTS to pass JVM options to this script. # 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"' 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"
warn () { warn () {
echo "$*" echo "$*"
} >&2 }
die () { die () {
echo echo
echo "$*" echo "$*"
echo echo
exit 1 exit 1
} >&2 }
# OS specific support (must be 'true' or 'false'). # OS specific support (must be 'true' or 'false').
cygwin=false cygwin=false
msys=false msys=false
darwin=false darwin=false
nonstop=false nonstop=false
case "$( uname )" in #( case "`uname`" in
CYGWIN* ) cygwin=true ;; #( CYGWIN* )
Darwin* ) darwin=true ;; #( cygwin=true
MSYS* | MINGW* ) msys=true ;; #( ;;
NONSTOP* ) nonstop=true ;; Darwin* )
darwin=true
;;
MSYS* | MINGW* )
msys=true
;;
NONSTOP* )
nonstop=true
;;
esac esac
CLASSPATH=$APP_HOME/gradle/wrapper/gradle-wrapper.jar CLASSPATH=$APP_HOME/gradle/wrapper/gradle-wrapper.jar
@ -121,9 +87,9 @@ CLASSPATH=$APP_HOME/gradle/wrapper/gradle-wrapper.jar
if [ -n "$JAVA_HOME" ] ; then if [ -n "$JAVA_HOME" ] ; then
if [ -x "$JAVA_HOME/jre/sh/java" ] ; then if [ -x "$JAVA_HOME/jre/sh/java" ] ; then
# IBM's JDK on AIX uses strange locations for the executables # IBM's JDK on AIX uses strange locations for the executables
JAVACMD=$JAVA_HOME/jre/sh/java JAVACMD="$JAVA_HOME/jre/sh/java"
else else
JAVACMD=$JAVA_HOME/bin/java JAVACMD="$JAVA_HOME/bin/java"
fi fi
if [ ! -x "$JAVACMD" ] ; then if [ ! -x "$JAVACMD" ] ; then
die "ERROR: JAVA_HOME is set to an invalid directory: $JAVA_HOME die "ERROR: JAVA_HOME is set to an invalid directory: $JAVA_HOME
@ -132,7 +98,7 @@ Please set the JAVA_HOME variable in your environment to match the
location of your Java installation." location of your Java installation."
fi fi
else else
JAVACMD=java JAVACMD="java"
which java >/dev/null 2>&1 || die "ERROR: JAVA_HOME is not set and no 'java' command could be found in your PATH. which java >/dev/null 2>&1 || 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
@ -140,95 +106,80 @@ location of your Java installation."
fi fi
# Increase the maximum file descriptors if we can. # Increase the maximum file descriptors if we can.
if ! "$cygwin" && ! "$darwin" && ! "$nonstop" ; then if [ "$cygwin" = "false" -a "$darwin" = "false" -a "$nonstop" = "false" ] ; then
case $MAX_FD in #( MAX_FD_LIMIT=`ulimit -H -n`
max*) if [ $? -eq 0 ] ; then
MAX_FD=$( ulimit -H -n ) || if [ "$MAX_FD" = "maximum" -o "$MAX_FD" = "max" ] ; then
warn "Could not query maximum file descriptor limit" MAX_FD="$MAX_FD_LIMIT"
esac fi
case $MAX_FD in #( ulimit -n $MAX_FD
'' | soft) :;; #( if [ $? -ne 0 ] ; then
*) warn "Could not set maximum file descriptor limit: $MAX_FD"
ulimit -n "$MAX_FD" || fi
warn "Could not set maximum file descriptor limit to $MAX_FD" else
esac warn "Could not query maximum file descriptor limit: $MAX_FD_LIMIT"
fi
fi fi
# Collect all arguments for the java command, stacking in reverse order: # For Darwin, add options to specify how the application appears in the dock
# * args from the command line if $darwin; then
# * the main class name GRADLE_OPTS="$GRADLE_OPTS \"-Xdock:name=$APP_NAME\" \"-Xdock:icon=$APP_HOME/media/gradle.icns\""
# * -classpath fi
# * -D...appname settings
# * --module-path (only if needed)
# * DEFAULT_JVM_OPTS, JAVA_OPTS, and GRADLE_OPTS environment variables.
# For Cygwin or MSYS, switch paths to Windows format before running java # For Cygwin or MSYS, switch paths to Windows format before running java
if "$cygwin" || "$msys" ; then if [ "$cygwin" = "true" -o "$msys" = "true" ] ; then
APP_HOME=$( cygpath --path --mixed "$APP_HOME" ) APP_HOME=`cygpath --path --mixed "$APP_HOME"`
CLASSPATH=$( cygpath --path --mixed "$CLASSPATH" ) CLASSPATH=`cygpath --path --mixed "$CLASSPATH"`
JAVACMD=$( cygpath --unix "$JAVACMD" ) JAVACMD=`cygpath --unix "$JAVACMD"`
# Now convert the arguments - kludge to limit ourselves to /bin/sh # We build the pattern for arguments to be converted via cygpath
for arg do ROOTDIRSRAW=`find -L / -maxdepth 1 -mindepth 1 -type d 2>/dev/null`
if SEP=""
case $arg in #( for dir in $ROOTDIRSRAW ; do
-*) false ;; # don't mess with options #( ROOTDIRS="$ROOTDIRS$SEP$dir"
/?*) t=${arg#/} t=/${t%%/*} # looks like a POSIX filepath SEP="|"
[ -e "$t" ] ;; #(
*) false ;;
esac
then
arg=$( cygpath --path --ignore --mixed "$arg" )
fi
# Roll the args list around exactly as many times as the number of
# args, so each arg winds up back in the position where it started, but
# possibly modified.
#
# NB: a `for` loop captures its iteration list before it begins, so
# changing the positional parameters here affects neither the number of
# iterations, nor the values presented in `arg`.
shift # remove old arg
set -- "$@" "$arg" # push replacement arg
done done
OURCYGPATTERN="(^($ROOTDIRS))"
# Add a user-defined pattern to the cygpath arguments
if [ "$GRADLE_CYGPATTERN" != "" ] ; then
OURCYGPATTERN="$OURCYGPATTERN|($GRADLE_CYGPATTERN)"
fi
# Now convert the arguments - kludge to limit ourselves to /bin/sh
i=0
for arg in "$@" ; do
CHECK=`echo "$arg"|egrep -c "$OURCYGPATTERN" -`
CHECK2=`echo "$arg"|egrep -c "^-"` ### Determine if an option
if [ $CHECK -ne 0 ] && [ $CHECK2 -eq 0 ] ; then ### Added a condition
eval `echo args$i`=`cygpath --path --ignore --mixed "$arg"`
else
eval `echo args$i`="\"$arg\""
fi
i=`expr $i + 1`
done
case $i in
0) set -- ;;
1) set -- "$args0" ;;
2) set -- "$args0" "$args1" ;;
3) set -- "$args0" "$args1" "$args2" ;;
4) set -- "$args0" "$args1" "$args2" "$args3" ;;
5) set -- "$args0" "$args1" "$args2" "$args3" "$args4" ;;
6) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" ;;
7) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" "$args6" ;;
8) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" "$args6" "$args7" ;;
9) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" "$args6" "$args7" "$args8" ;;
esac
fi fi
# Collect all arguments for the java command; # Escape application args
# * $DEFAULT_JVM_OPTS, $JAVA_OPTS, and $GRADLE_OPTS can contain fragments of save () {
# shell script including quotes and variable substitutions, so put them in for i do printf %s\\n "$i" | sed "s/'/'\\\\''/g;1s/^/'/;\$s/\$/' \\\\/" ; done
# double quotes to make sure that they get re-expanded; and echo " "
# * put everything else in single quotes, so that it's not re-expanded. }
APP_ARGS=`save "$@"`
set -- \ # Collect all arguments for the java command, following the shell quoting and substitution rules
"-Dorg.gradle.appname=$APP_BASE_NAME" \ eval set -- $DEFAULT_JVM_OPTS $JAVA_OPTS $GRADLE_OPTS "\"-Dorg.gradle.appname=$APP_BASE_NAME\"" -classpath "\"$CLASSPATH\"" org.gradle.wrapper.GradleWrapperMain "$APP_ARGS"
-classpath "$CLASSPATH" \
org.gradle.wrapper.GradleWrapperMain \
"$@"
# Use "xargs" to parse quoted args.
#
# With -n1 it outputs one arg per line, with the quotes and backslashes removed.
#
# In Bash we could simply go:
#
# readarray ARGS < <( xargs -n1 <<<"$var" ) &&
# set -- "${ARGS[@]}" "$@"
#
# but POSIX shell has neither arrays nor command substitution, so instead we
# post-process each arg (as a line of input to sed) to backslash-escape any
# character that might be a shell metacharacter, then use eval to reverse
# that process (while maintaining the separation between arguments), and wrap
# the whole thing up as a single "set" statement.
#
# This will of course break if any of these variables contains a newline or
# an unmatched quote.
#
eval "set -- $(
printf '%s\n' "$DEFAULT_JVM_OPTS $JAVA_OPTS $GRADLE_OPTS" |
xargs -n1 |
sed ' s~[^-[:alnum:]+,./:=@_]~\\&~g; ' |
tr '\n' ' '
)" '"$@"'
exec "$JAVACMD" "$@" exec "$JAVACMD" "$@"

View file

@ -1,13 +0,0 @@
# Builds
Overview of all builds of ConstructionWand and their properties.
| Build | Java version | Supported MC versions |
|--------|--------------|-----------------------|
| 1.14.4 | 8 | 1.14.4 |
| 1.15.2 | 8 | 1.15.2 |
| 1.16.1 | 8 | 1.16.1 |
| 1.16.5 | 8 | 1.16.2 - 1.16.5 |
| 1.17.1 | 16 | 1.17.1 |
| 1.18 | 17 | 1.18 |
| 1.19 | 17 | 1.19 - 1.19.2 |

View file

@ -1,11 +0,0 @@
# Testing item containers
- Install the toolbelt mod (https://www.curseforge.com/minecraft/mc-mods/tool-belt)
- Place a chest on top of a command block and enter this command:
- Get a toolbeld with 2 stacks of diamond blocks in it
The reason for this hack is that the toolbelt mod gets updated very quickly and is available for almost every
MC version supported by ConstructionWand.
```
data merge block ~ ~1 ~ {Items: [{Slot: 0, id: "toolbelt:belt", Count: 1, tag: {Items: [{Slot: 0, id: "minecraft:diamond_block", Count: 64}, {Slot: 1, id: "minecraft:diamond_block", Count: 64}]}}]}
```

View file

@ -1,6 +0,0 @@
pluginManagement {
repositories {
gradlePluginPortal()
maven { url = 'https://maven.minecraftforge.net/' }
}
}

View file

@ -15,6 +15,7 @@ import org.apache.logging.log4j.Logger;
import thetadev.constructionwand.basics.ConfigClient; import thetadev.constructionwand.basics.ConfigClient;
import thetadev.constructionwand.basics.ConfigServer; import thetadev.constructionwand.basics.ConfigServer;
import thetadev.constructionwand.basics.ModStats; import thetadev.constructionwand.basics.ModStats;
import thetadev.constructionwand.basics.ReplacementRegistry;
import thetadev.constructionwand.client.ClientEvents; import thetadev.constructionwand.client.ClientEvents;
import thetadev.constructionwand.client.RenderBlockPreview; import thetadev.constructionwand.client.RenderBlockPreview;
import thetadev.constructionwand.containers.ContainerManager; import thetadev.constructionwand.containers.ContainerManager;
@ -73,6 +74,9 @@ public class ConstructionWand
// Container registry // Container registry
ContainerRegistrar.register(); ContainerRegistrar.register();
//Replacement registry
ReplacementRegistry.init();
// Stats // Stats
ModStats.register(); ModStats.register();
} }
@ -83,6 +87,7 @@ public class ConstructionWand
MinecraftForge.EVENT_BUS.register(new ClientEvents()); MinecraftForge.EVENT_BUS.register(new ClientEvents());
event.enqueueWork(ModItems::registerModelProperties); event.enqueueWork(ModItems::registerModelProperties);
event.enqueueWork(ModItems::registerItemColors);
} }
public static ResourceLocation loc(String name) { public static ResourceLocation loc(String name) {

View file

@ -2,7 +2,6 @@ package thetadev.constructionwand.basics;
import net.minecraft.world.entity.player.Player; import net.minecraft.world.entity.player.Player;
import net.minecraftforge.event.entity.player.PlayerEvent; import net.minecraftforge.event.entity.player.PlayerEvent;
import net.minecraftforge.event.server.ServerStartingEvent;
import net.minecraftforge.eventbus.api.SubscribeEvent; import net.minecraftforge.eventbus.api.SubscribeEvent;
import net.minecraftforge.fml.common.Mod; import net.minecraftforge.fml.common.Mod;
import thetadev.constructionwand.ConstructionWand; import thetadev.constructionwand.ConstructionWand;
@ -10,14 +9,9 @@ import thetadev.constructionwand.ConstructionWand;
@Mod.EventBusSubscriber(modid = ConstructionWand.MODID) @Mod.EventBusSubscriber(modid = ConstructionWand.MODID)
public class CommonEvents public class CommonEvents
{ {
@SubscribeEvent
public static void serverStarting(ServerStartingEvent e) {
ReplacementRegistry.init();
}
@SubscribeEvent @SubscribeEvent
public static void logOut(PlayerEvent.PlayerLoggedOutEvent e) { public static void logOut(PlayerEvent.PlayerLoggedOutEvent e) {
Player player = e.getEntity(); Player player = e.getPlayer();
if(player.level.isClientSide) return; if(player.level.isClientSide) return;
ConstructionWand.instance.undoHistory.removePlayer(player); ConstructionWand.instance.undoHistory.removePlayer(player);
} }

View file

@ -4,7 +4,6 @@ import net.minecraft.resources.ResourceLocation;
import net.minecraft.world.item.Item; import net.minecraft.world.item.Item;
import net.minecraft.world.item.Tiers; import net.minecraft.world.item.Tiers;
import net.minecraftforge.common.ForgeConfigSpec; import net.minecraftforge.common.ForgeConfigSpec;
import net.minecraftforge.registries.ForgeRegistries;
import net.minecraftforge.registries.RegistryObject; import net.minecraftforge.registries.RegistryObject;
import thetadev.constructionwand.items.ModItems; import thetadev.constructionwand.items.ModItems;
@ -14,7 +13,7 @@ import java.util.List;
public class ConfigServer public class ConfigServer
{ {
public static final ForgeConfigSpec SPEC; private static final ForgeConfigSpec.Builder BUILDER = new ForgeConfigSpec.Builder();
public static final ForgeConfigSpec.IntValue LIMIT_CREATIVE; public static final ForgeConfigSpec.IntValue LIMIT_CREATIVE;
public static final ForgeConfigSpec.IntValue MAX_RANGE; public static final ForgeConfigSpec.IntValue MAX_RANGE;
@ -33,7 +32,7 @@ public class ConfigServer
private static final HashMap<ResourceLocation, WandProperties> wandProperties = new HashMap<>(); private static final HashMap<ResourceLocation, WandProperties> wandProperties = new HashMap<>();
public static WandProperties getWandProperties(Item wand) { public static WandProperties getWandProperties(Item wand) {
return wandProperties.getOrDefault(ForgeRegistries.ITEMS.getKey(wand), WandProperties.DEFAULT); return wandProperties.getOrDefault(wand.getRegistryName(), WandProperties.DEFAULT);
} }
public static class WandProperties public static class WandProperties
@ -101,41 +100,39 @@ public class ConfigServer
} }
static { static {
final var builder = new ForgeConfigSpec.Builder(); BUILDER.comment("This is the Server config for ConstructionWand.",
builder.comment("This is the Server config for ConstructionWand.",
"If you're not familiar with Forge's new split client/server config, let me explain:", "If you're not familiar with Forge's new split client/server config, let me explain:",
"Client config is stored in the /config folder and only contains client specific settings like graphics and keybinds.", "Client config is stored in the /config folder and only contains client specific settings like graphics and keybinds.",
"Mod behavior is configured in the Server config, which is world-specific and thus located", "Mod behavior is configured in the Server config, which is world-specific and thus located",
"in the /saves/myworld/serverconfig folder. If you want to change the serverconfig for all", "in the /saves/myworld/serverconfig folder. If you want to change the serverconfig for all",
"new worlds, copy the config files in the /defaultconfigs folder."); "new worlds, copy the config files in the /defaultconfigs folder.");
new WandProperties(builder, ModItems.WAND_STONE, Tiers.STONE.getUses(), 9, 0, 0, false); new WandProperties(BUILDER, ModItems.WAND_STONE, Tiers.STONE.getUses(), 9, 0, 0, false);
new WandProperties(builder, ModItems.WAND_IRON, Tiers.IRON.getUses(), 27, 2, 9, true); new WandProperties(BUILDER, ModItems.WAND_IRON, Tiers.IRON.getUses(), 27, 2, 9, true);
new WandProperties(builder, ModItems.WAND_DIAMOND, Tiers.DIAMOND.getUses(), 128, 8, 25, true); new WandProperties(BUILDER, ModItems.WAND_DIAMOND, Tiers.DIAMOND.getUses(), 128, 8, 25, true);
new WandProperties(builder, ModItems.WAND_INFINITY, 0, 1024, 16, 81, true); new WandProperties(BUILDER, ModItems.WAND_INFINITY, 0, 1024, 16, 81, true);
builder.push("misc"); BUILDER.push("misc");
builder.comment("Block limit for Infinity Wand used in creative mode"); BUILDER.comment("Block limit for Infinity Wand used in creative mode");
LIMIT_CREATIVE = builder.defineInRange("InfinityWandCreative", 2048, 1, Integer.MAX_VALUE); LIMIT_CREATIVE = BUILDER.defineInRange("InfinityWandCreative", 2048, 1, Integer.MAX_VALUE);
builder.comment("Maximum placement range (0: unlimited). Affects all wands and is meant for lag prevention, not game balancing."); BUILDER.comment("Maximum placement range (0: unlimited). Affects all wands and is meant for lag prevention, not game balancing.");
MAX_RANGE = builder.defineInRange("MaxRange", 100, 0, Integer.MAX_VALUE); MAX_RANGE = BUILDER.defineInRange("MaxRange", 100, 0, Integer.MAX_VALUE);
builder.comment("Number of operations that can be undone"); BUILDER.comment("Number of operations that can be undone");
UNDO_HISTORY = builder.defineInRange("UndoHistory", 3, 0, Integer.MAX_VALUE); UNDO_HISTORY = BUILDER.defineInRange("UndoHistory", 3, 0, Integer.MAX_VALUE);
builder.comment("Place blocks below you while falling > 10 blocks with angel core (Can be used to save you from drops/the void)"); BUILDER.comment("Place blocks below you while falling > 10 blocks with angel core (Can be used to save you from drops/the void)");
ANGEL_FALLING = builder.define("AngelFalling", false); ANGEL_FALLING = BUILDER.define("AngelFalling", false);
builder.comment("Blocks to treat equally when in Similar mode. Enter block IDs seperated by ;"); BUILDER.comment("Blocks to treat equally when in Similar mode. Enter block IDs seperated by ;");
SIMILAR_BLOCKS = builder.defineList("SimilarBlocks", Arrays.asList(SIMILAR_BLOCKS_DEFAULT), obj -> true); SIMILAR_BLOCKS = BUILDER.defineList("SimilarBlocks", Arrays.asList(SIMILAR_BLOCKS_DEFAULT), obj -> true);
builder.pop(); BUILDER.pop();
builder.push("tileentity"); BUILDER.push("tileentity");
builder.comment("White/Blacklist for Tile Entities. Allow/Prevent blocks with TEs from being placed by wand.", BUILDER.comment("White/Blacklist for Tile Entities. Allow/Prevent blocks with TEs from being placed by wand.",
"You can either add block ids like minecraft:chest or mod ids like minecraft"); "You can either add block ids like minecraft:chest or mod ids like minecraft");
TE_LIST = builder.defineList("TEList", Arrays.asList(TE_LIST_DEFAULT), obj -> true); TE_LIST = BUILDER.defineList("TEList", Arrays.asList(TE_LIST_DEFAULT), obj -> true);
builder.comment("If set to TRUE, treat TEList as a whitelist, otherwise blacklist"); BUILDER.comment("If set to TRUE, treat TEList as a whitelist, otherwise blacklist");
TE_WHITELIST = builder.define("TEWhitelist", false); TE_WHITELIST = BUILDER.define("TEWhitelist", false);
builder.pop(); BUILDER.pop();
}
SPEC = builder.build(); public static final ForgeConfigSpec SPEC = BUILDER.build();
}
} }

View file

@ -16,8 +16,6 @@ public class ReplacementRegistry
private static final HashSet<HashSet<Item>> replacements = new HashSet<>(); private static final HashSet<HashSet<Item>> replacements = new HashSet<>();
public static void init() { public static void init() {
replacements.clear();
for(Object key : ConfigServer.SIMILAR_BLOCKS.get()) { for(Object key : ConfigServer.SIMILAR_BLOCKS.get()) {
if(!(key instanceof String)) continue; if(!(key instanceof String)) continue;
HashSet<Item> set = new HashSet<>(); HashSet<Item> set = new HashSet<>();

View file

@ -20,8 +20,7 @@ import net.minecraft.world.phys.Vec3;
import net.minecraft.world.phys.shapes.VoxelShape; import net.minecraft.world.phys.shapes.VoxelShape;
import net.minecraftforge.common.MinecraftForge; import net.minecraftforge.common.MinecraftForge;
import net.minecraftforge.common.util.BlockSnapshot; import net.minecraftforge.common.util.BlockSnapshot;
import net.minecraftforge.event.level.BlockEvent; import net.minecraftforge.event.world.BlockEvent;
import net.minecraftforge.registries.ForgeRegistries;
import thetadev.constructionwand.ConstructionWand; import thetadev.constructionwand.ConstructionWand;
import thetadev.constructionwand.containers.ContainerManager; import thetadev.constructionwand.containers.ContainerManager;
import thetadev.constructionwand.items.wand.ItemWand; import thetadev.constructionwand.items.wand.ItemWand;
@ -92,7 +91,7 @@ public class WandUtil
public static boolean isTEAllowed(BlockState state) { public static boolean isTEAllowed(BlockState state) {
if(!state.hasBlockEntity()) return true; if(!state.hasBlockEntity()) return true;
ResourceLocation name = ForgeRegistries.BLOCKS.getKey(state.getBlock()); ResourceLocation name = state.getBlock().getRegistryName();
if(name == null) return false; if(name == null) return false;
String fullId = name.toString(); String fullId = name.toString();

View file

@ -1,18 +1,17 @@
package thetadev.constructionwand.basics.pool; package thetadev.constructionwand.basics.pool;
import net.minecraft.util.RandomSource;
import javax.annotation.Nullable; import javax.annotation.Nullable;
import java.util.HashMap; import java.util.HashMap;
import java.util.HashSet; import java.util.HashSet;
import java.util.Random;
public class RandomPool<T> implements IPool<T> public class RandomPool<T> implements IPool<T>
{ {
private final RandomSource rng; private final Random rng;
private final HashMap<T, Integer> elements; private final HashMap<T, Integer> elements;
private HashSet<T> pool; private HashSet<T> pool;
public RandomPool(RandomSource rng) { public RandomPool(Random rng) {
this.rng = rng; this.rng = rng;
elements = new HashMap<>(); elements = new HashMap<>();
reset(); reset();

View file

@ -26,7 +26,7 @@ public class ClientEvents
// Send state of OPT key to server // Send state of OPT key to server
@SubscribeEvent @SubscribeEvent
public void KeyEvent(InputEvent.Key event) { public void KeyEvent(InputEvent.KeyInputEvent event) {
Player player = Minecraft.getInstance().player; Player player = Minecraft.getInstance().player;
if(player == null) return; if(player == null) return;
if(WandUtil.holdingWand(player) == null) return; if(WandUtil.holdingWand(player) == null) return;
@ -42,7 +42,7 @@ public class ClientEvents
// Sneak+(OPT)+Scroll to change direction lock // Sneak+(OPT)+Scroll to change direction lock
@SubscribeEvent(priority = EventPriority.HIGHEST) @SubscribeEvent(priority = EventPriority.HIGHEST)
public void MouseScrollEvent(InputEvent.MouseScrollingEvent event) { public void MouseScrollEvent(InputEvent.MouseScrollEvent event) {
Player player = Minecraft.getInstance().player; Player player = Minecraft.getInstance().player;
double scroll = event.getScrollDelta(); double scroll = event.getScrollDelta();
@ -60,7 +60,7 @@ public class ClientEvents
// Sneak+(OPT)+Left click wand to change core // Sneak+(OPT)+Left click wand to change core
@SubscribeEvent @SubscribeEvent
public void onLeftClickEmpty(PlayerInteractEvent.LeftClickEmpty event) { public void onLeftClickEmpty(PlayerInteractEvent.LeftClickEmpty event) {
Player player = event.getEntity(); Player player = event.getPlayer();
if(player == null || !modeKeyCombDown(player)) return; if(player == null || !modeKeyCombDown(player)) return;
@ -77,7 +77,7 @@ public class ClientEvents
public void onRightClickItem(PlayerInteractEvent.RightClickItem event) { public void onRightClickItem(PlayerInteractEvent.RightClickItem event) {
if(event.getSide().isServer()) return; if(event.getSide().isServer()) return;
Player player = event.getEntity(); Player player = event.getPlayer();
if(player == null || !guiKeyCombDown(player)) return; if(player == null || !guiKeyCombDown(player)) return;
ItemStack wand = event.getItemStack(); ItemStack wand = event.getItemStack();

View file

@ -12,7 +12,7 @@ import net.minecraft.world.item.ItemStack;
import net.minecraft.world.phys.AABB; import net.minecraft.world.phys.AABB;
import net.minecraft.world.phys.BlockHitResult; import net.minecraft.world.phys.BlockHitResult;
import net.minecraft.world.phys.HitResult; import net.minecraft.world.phys.HitResult;
import net.minecraftforge.client.event.RenderHighlightEvent; import net.minecraftforge.client.event.DrawSelectionEvent;
import net.minecraftforge.eventbus.api.SubscribeEvent; import net.minecraftforge.eventbus.api.SubscribeEvent;
import thetadev.constructionwand.basics.WandUtil; import thetadev.constructionwand.basics.WandUtil;
import thetadev.constructionwand.items.wand.ItemWand; import thetadev.constructionwand.items.wand.ItemWand;
@ -22,11 +22,11 @@ import java.util.Set;
public class RenderBlockPreview public class RenderBlockPreview
{ {
public WandJob wandJob; private WandJob wandJob;
public Set<BlockPos> undoBlocks; public Set<BlockPos> undoBlocks;
@SubscribeEvent @SubscribeEvent
public void renderBlockHighlight(RenderHighlightEvent.Block event) { public void renderBlockHighlight(DrawSelectionEvent.HighlightBlock event) {
if(event.getTarget().getType() != HitResult.Type.BLOCK) return; if(event.getTarget().getType() != HitResult.Type.BLOCK) return;
BlockHitResult rtr = event.getTarget(); BlockHitResult rtr = event.getTarget();
@ -39,7 +39,11 @@ public class RenderBlockPreview
if(wand == null) return; if(wand == null) return;
if(!(player.isCrouching() && ClientEvents.isOptKeyDown())) { if(!(player.isCrouching() && ClientEvents.isOptKeyDown())) {
if(wandJob == null || !compareRTR(wandJob.rayTraceResult, rtr) || !(wandJob.wand.equals(wand))) { // Use cached wandJob for previews of the same target pos/dir
// Exception: always update if blockCount < 2 to prevent 1-block previews when block updates
// from the last placement are lagging
if(wandJob == null || !compareRTR(wandJob.rayTraceResult, rtr) || !(wandJob.wand.equals(wand))
|| wandJob.blockCount() < 2) {
wandJob = ItemWand.getWandJob(player, player.level, rtr, wand); wandJob = ItemWand.getWandJob(player, player.level, rtr, wand);
} }
blocks = wandJob.getBlockPositions(); blocks = wandJob.getBlockPositions();
@ -55,7 +59,7 @@ public class RenderBlockPreview
MultiBufferSource buffer = event.getMultiBufferSource(); MultiBufferSource buffer = event.getMultiBufferSource();
VertexConsumer lineBuilder = buffer.getBuffer(RenderType.LINES); VertexConsumer lineBuilder = buffer.getBuffer(RenderType.LINES);
double partialTicks = event.getPartialTick(); double partialTicks = event.getPartialTicks();
double d0 = player.xOld + (player.getX() - player.xOld) * partialTicks; double d0 = player.xOld + (player.getX() - player.xOld) * partialTicks;
double d1 = player.yOld + player.getEyeHeight() + (player.getY() - player.yOld) * partialTicks; double d1 = player.yOld + player.getEyeHeight() + (player.getY() - player.yOld) * partialTicks;
double d2 = player.zOld + (player.getZ() - player.zOld) * partialTicks; double d2 = player.zOld + (player.getZ() - player.zOld) * partialTicks;

View file

@ -5,6 +5,8 @@ import net.minecraft.client.Minecraft;
import net.minecraft.client.gui.components.Button; import net.minecraft.client.gui.components.Button;
import net.minecraft.client.gui.screens.Screen; import net.minecraft.client.gui.screens.Screen;
import net.minecraft.network.chat.Component; import net.minecraft.network.chat.Component;
import net.minecraft.network.chat.TextComponent;
import net.minecraft.network.chat.TranslatableComponent;
import net.minecraft.world.item.ItemStack; import net.minecraft.world.item.ItemStack;
import thetadev.constructionwand.ConstructionWand; import thetadev.constructionwand.ConstructionWand;
import thetadev.constructionwand.basics.option.IOption; import thetadev.constructionwand.basics.option.IOption;
@ -29,7 +31,7 @@ public class ScreenWand extends Screen
private static final int FIELD_HEIGHT = N_ROWS * (BUTTON_HEIGHT + SPACING_HEIGHT) - SPACING_HEIGHT; private static final int FIELD_HEIGHT = N_ROWS * (BUTTON_HEIGHT + SPACING_HEIGHT) - SPACING_HEIGHT;
public ScreenWand(ItemStack wand) { public ScreenWand(ItemStack wand) {
super(Component.literal("ScreenWand")); super(new TextComponent("ScreenWand"));
this.wand = wand; this.wand = wand;
wandOptions = new WandOptions(wand); wandOptions = new WandOptions(wand);
} }
@ -56,15 +58,13 @@ public class ScreenWand extends Screen
if (Minecraft.getInstance().options.keyInventory.matches(keyCode, scanCode)) { if (Minecraft.getInstance().options.keyInventory.matches(keyCode, scanCode)) {
this.onClose(); this.onClose();
return true; return true;
} } else {
else {
return super.keyPressed(keyCode, scanCode, modifiers); return super.keyPressed(keyCode, scanCode, modifiers);
} }
} }
private void createButton(int cx, int cy, IOption<?> option) { private void createButton(int cx, int cy, IOption<?> option) {
Button button = new Button(getX(cx), getY(cy), BUTTON_WIDTH, BUTTON_HEIGHT, Button button = new Button(getX(cx), getY(cy), BUTTON_WIDTH, BUTTON_HEIGHT, getButtonLabel(option), bt -> clickButton(bt, option), (bt, ms, x, y) -> drawTooltip(ms, x, y, option));
getButtonLabel(option), bt -> clickButton(bt, option), (bt, ms, x, y) -> drawTooltip(ms, x, y, option));
button.active = option.isEnabled(); button.active = option.isEnabled();
addRenderableWidget(button); addRenderableWidget(button);
} }
@ -77,7 +77,7 @@ public class ScreenWand extends Screen
private void drawTooltip(PoseStack matrixStack, int mouseX, int mouseY, IOption<?> option) { private void drawTooltip(PoseStack matrixStack, int mouseX, int mouseY, IOption<?> option) {
if(isMouseOver(mouseX, mouseY)) { if(isMouseOver(mouseX, mouseY)) {
renderTooltip(matrixStack, Component.translatable(option.getDescTranslation()), mouseX, mouseY); renderTooltip(matrixStack, new TranslatableComponent(option.getDescTranslation()), mouseX, mouseY);
} }
} }
@ -90,6 +90,6 @@ public class ScreenWand extends Screen
} }
private Component getButtonLabel(IOption<?> option) { private Component getButtonLabel(IOption<?> option) {
return Component.translatable(option.getKeyTranslation()).append(Component.translatable(option.getValueTranslation())); return new TranslatableComponent(option.getKeyTranslation()).append(new TranslatableComponent(option.getValueTranslation()));
} }
} }

View file

@ -1,11 +1,10 @@
package thetadev.constructionwand.data; package thetadev.constructionwand.data;
import net.minecraft.advancements.critereon.ItemPredicate; import net.minecraft.advancements.critereon.ItemPredicate;
import net.minecraft.tags.TagKey; import net.minecraft.tags.Tag;
import net.minecraft.world.item.Item; import net.minecraft.world.item.Item;
import net.minecraft.world.item.crafting.Ingredient; import net.minecraft.world.item.crafting.Ingredient;
import net.minecraft.world.level.ItemLike; import net.minecraft.world.level.ItemLike;
import net.minecraftforge.registries.ForgeRegistries;
public class Inp public class Inp
{ {
@ -20,10 +19,10 @@ public class Inp
} }
public static Inp fromItem(ItemLike in) { public static Inp fromItem(ItemLike in) {
return new Inp(ForgeRegistries.ITEMS.getKey(in.asItem()).getPath(), Ingredient.of(in), ItemPredicate.Builder.item().of(in).build()); return new Inp(in.asItem().getRegistryName().getPath(), Ingredient.of(in), ItemPredicate.Builder.item().of(in).build());
} }
public static Inp fromTag(TagKey<Item> in) { public static Inp fromTag(Tag.Named<Item> in) {
return new Inp(in.location().getPath(), Ingredient.of(in), ItemPredicate.Builder.item().of(in).build()); return new Inp(in.getName().getPath(), Ingredient.of(in), ItemPredicate.Builder.item().of(in).build());
} }
} }

View file

@ -5,7 +5,6 @@ import net.minecraft.world.item.BlockItem;
import net.minecraft.world.item.Item; import net.minecraft.world.item.Item;
import net.minecraftforge.client.model.generators.ItemModelProvider; import net.minecraftforge.client.model.generators.ItemModelProvider;
import net.minecraftforge.common.data.ExistingFileHelper; import net.minecraftforge.common.data.ExistingFileHelper;
import net.minecraftforge.registries.ForgeRegistries;
import net.minecraftforge.registries.RegistryObject; import net.minecraftforge.registries.RegistryObject;
import thetadev.constructionwand.ConstructionWand; import thetadev.constructionwand.ConstructionWand;
import thetadev.constructionwand.items.ModItems; import thetadev.constructionwand.items.ModItems;
@ -22,7 +21,7 @@ public class ItemModelGenerator extends ItemModelProvider
protected void registerModels() { protected void registerModels() {
for(RegistryObject<Item> itemObject : ModItems.ITEMS.getEntries()) { for(RegistryObject<Item> itemObject : ModItems.ITEMS.getEntries()) {
Item item = itemObject.get(); Item item = itemObject.get();
String name = ForgeRegistries.ITEMS.getKey(item).getPath(); String name = item.getRegistryName().getPath();
if(item instanceof ICustomItemModel) if(item instanceof ICustomItemModel)
((ICustomItemModel) item).generateCustomItemModel(this, name); ((ICustomItemModel) item).generateCustomItemModel(this, name);

View file

@ -2,9 +2,9 @@ package thetadev.constructionwand.data;
import net.minecraft.data.DataGenerator; import net.minecraft.data.DataGenerator;
import net.minecraftforge.common.data.ExistingFileHelper; import net.minecraftforge.common.data.ExistingFileHelper;
import net.minecraftforge.data.event.GatherDataEvent;
import net.minecraftforge.eventbus.api.SubscribeEvent; import net.minecraftforge.eventbus.api.SubscribeEvent;
import net.minecraftforge.fml.common.Mod; import net.minecraftforge.fml.common.Mod;
import net.minecraftforge.forge.event.lifecycle.GatherDataEvent;
@Mod.EventBusSubscriber(bus = Mod.EventBusSubscriber.Bus.MOD) @Mod.EventBusSubscriber(bus = Mod.EventBusSubscriber.Bus.MOD)
public class ModData public class ModData
@ -15,11 +15,11 @@ public class ModData
ExistingFileHelper fileHelper = event.getExistingFileHelper(); ExistingFileHelper fileHelper = event.getExistingFileHelper();
if(event.includeServer()) { if(event.includeServer()) {
generator.addProvider(true, new RecipeGenerator(generator)); generator.addProvider(new RecipeGenerator(generator));
} }
if(event.includeClient()) { if(event.includeClient()) {
generator.addProvider(true, new ItemModelGenerator(generator, fileHelper)); generator.addProvider(new ItemModelGenerator(generator, fileHelper));
} }
} }
} }

View file

@ -7,12 +7,11 @@ import mezz.jei.api.constants.VanillaTypes;
import mezz.jei.api.registration.IRecipeRegistration; import mezz.jei.api.registration.IRecipeRegistration;
import net.minecraft.ChatFormatting; import net.minecraft.ChatFormatting;
import net.minecraft.network.chat.Component; import net.minecraft.network.chat.Component;
import net.minecraft.network.chat.TranslatableComponent;
import net.minecraft.resources.ResourceLocation; import net.minecraft.resources.ResourceLocation;
import net.minecraft.world.item.Item; import net.minecraft.world.item.Item;
import net.minecraft.world.item.ItemStack; import net.minecraft.world.item.ItemStack;
import net.minecraftforge.registries.ForgeRegistries;
import net.minecraftforge.registries.RegistryObject; import net.minecraftforge.registries.RegistryObject;
import org.jetbrains.annotations.NotNull;
import thetadev.constructionwand.ConstructionWand; import thetadev.constructionwand.ConstructionWand;
import thetadev.constructionwand.basics.ConfigClient; import thetadev.constructionwand.basics.ConfigClient;
import thetadev.constructionwand.basics.ConfigServer; import thetadev.constructionwand.basics.ConfigServer;
@ -35,12 +34,12 @@ public class ConstructionWandJeiPlugin implements IModPlugin
private Component keyComboComponent(boolean shiftOpt, Component optkeyComponent) { private Component keyComboComponent(boolean shiftOpt, Component optkeyComponent) {
String key = shiftOpt ? "sneak_opt" : "sneak"; String key = shiftOpt ? "sneak_opt" : "sneak";
return Component.translatable(baseKey + "key." + key, optkeyComponent).withStyle(ChatFormatting.BLUE); return new TranslatableComponent(baseKey + "key." + key, optkeyComponent).withStyle(ChatFormatting.BLUE);
} }
@Override @Override
public void registerRecipes(@NotNull IRecipeRegistration registration) { public void registerRecipes(IRecipeRegistration registration) {
Component optkeyComponent = Component.translatable(InputConstants.getKey(ConfigClient.OPT_KEY.get(), -1).getName()) Component optkeyComponent = new TranslatableComponent(InputConstants.getKey(ConfigClient.OPT_KEY.get(), -1).getName())
.withStyle(ChatFormatting.BLUE); .withStyle(ChatFormatting.BLUE);
Component wandModeComponent = keyComboComponent(ConfigClient.SHIFTOPT_MODE.get(), optkeyComponent); Component wandModeComponent = keyComboComponent(ConfigClient.SHIFTOPT_MODE.get(), optkeyComponent);
Component wandGuiComponent = keyComboComponent(ConfigClient.SHIFTOPT_GUI.get(), optkeyComponent); Component wandGuiComponent = keyComboComponent(ConfigClient.SHIFTOPT_GUI.get(), optkeyComponent);
@ -50,19 +49,21 @@ public class ConstructionWandJeiPlugin implements IModPlugin
ConfigServer.WandProperties wandProperties = ConfigServer.getWandProperties(wand); ConfigServer.WandProperties wandProperties = ConfigServer.getWandProperties(wand);
String durabilityKey = wand == ModItems.WAND_INFINITY.get() ? "unlimited" : "limited"; String durabilityKey = wand == ModItems.WAND_INFINITY.get() ? "unlimited" : "limited";
Component durabilityComponent = Component.translatable(baseKey + "durability." + durabilityKey, wandProperties.getDurability()); Component durabilityComponent = new TranslatableComponent(baseKey + "durability." + durabilityKey, wandProperties.getDurability());
registration.addIngredientInfo(new ItemStack(wand), VanillaTypes.ITEM_STACK, registration.addIngredientInfo(new ItemStack(wand), VanillaTypes.ITEM,
Component.translatable(baseKey + "wand", baseKeyItem + ForgeRegistries.ITEMS.getKey(wand).getPath(), new TranslatableComponent(baseKey + "wand",
wandProperties.getLimit(), durabilityComponent, optkeyComponent, wandModeComponent, wandGuiComponent) new TranslatableComponent(baseKeyItem + wand.getRegistryName().getPath()),
wandProperties.getLimit(), durabilityComponent,
optkeyComponent, wandModeComponent, wandGuiComponent)
); );
} }
for(RegistryObject<Item> coreSupplier : ModItems.CORES) { for(RegistryObject<Item> coreSupplier : ModItems.CORES) {
Item core = coreSupplier.get(); Item core = coreSupplier.get();
registration.addIngredientInfo(new ItemStack(core), VanillaTypes.ITEM_STACK, registration.addIngredientInfo(new ItemStack(core), VanillaTypes.ITEM,
Component.translatable(baseKey + ForgeRegistries.ITEMS.getKey(core).getPath()) new TranslatableComponent(baseKey + core.getRegistryName().getPath()),
.append(Component.translatable(baseKey + "core", wandModeComponent)) new TranslatableComponent(baseKey + "core", wandModeComponent)
); );
} }
} }

View file

@ -1,18 +1,18 @@
package thetadev.constructionwand.items; package thetadev.constructionwand.items;
import net.minecraft.client.Minecraft;
import net.minecraft.client.color.item.ItemColors;
import net.minecraft.client.renderer.item.ItemProperties; import net.minecraft.client.renderer.item.ItemProperties;
import net.minecraft.world.item.CreativeModeTab; import net.minecraft.world.item.CreativeModeTab;
import net.minecraft.world.item.Item; import net.minecraft.world.item.Item;
import net.minecraft.world.item.Tiers; import net.minecraft.world.item.Tiers;
import net.minecraft.world.item.crafting.RecipeSerializer;
import net.minecraftforge.api.distmarker.Dist; import net.minecraftforge.api.distmarker.Dist;
import net.minecraftforge.api.distmarker.OnlyIn; import net.minecraftforge.api.distmarker.OnlyIn;
import net.minecraftforge.client.event.RegisterColorHandlersEvent; import net.minecraftforge.event.RegistryEvent;
import net.minecraftforge.eventbus.api.SubscribeEvent; import net.minecraftforge.eventbus.api.SubscribeEvent;
import net.minecraftforge.fml.common.Mod; import net.minecraftforge.fml.common.Mod;
import net.minecraftforge.registries.DeferredRegister; import net.minecraftforge.registries.*;
import net.minecraftforge.registries.ForgeRegistries;
import net.minecraftforge.registries.RegisterEvent;
import net.minecraftforge.registries.RegistryObject;
import thetadev.constructionwand.ConstructionWand; import thetadev.constructionwand.ConstructionWand;
import thetadev.constructionwand.basics.option.WandOptions; import thetadev.constructionwand.basics.option.WandOptions;
import thetadev.constructionwand.crafting.RecipeWandUpgrade; import thetadev.constructionwand.crafting.RecipeWandUpgrade;
@ -50,10 +50,9 @@ public class ModItems
} }
@SubscribeEvent @SubscribeEvent
public static void registerRecipeSerializers(RegisterEvent event) { public static void registerRecipeSerializers(RegistryEvent.Register<RecipeSerializer<?>> event) {
event.register(ForgeRegistries.Keys.RECIPE_SERIALIZERS, registry -> { IForgeRegistry<RecipeSerializer<?>> r = event.getRegistry();
registry.register("wand_upgrade", RecipeWandUpgrade.SERIALIZER); register(r, "wand_upgrade", RecipeWandUpgrade.SERIALIZER);
});
} }
@OnlyIn(Dist.CLIENT) @OnlyIn(Dist.CLIENT)
@ -69,12 +68,17 @@ public class ModItems
} }
@OnlyIn(Dist.CLIENT) @OnlyIn(Dist.CLIENT)
@SubscribeEvent public static void registerItemColors() {
public static void registerItemColors(RegisterColorHandlersEvent.Item event) { ItemColors colors = Minecraft.getInstance().getItemColors();
for(RegistryObject<Item> itemSupplier : WANDS) { for(RegistryObject<Item> itemSupplier : WANDS) {
Item item = itemSupplier.get(); Item item = itemSupplier.get();
event.register((stack, layer) -> (layer == 1 && stack.getItem() instanceof ItemWand) ? colors.register((stack, layer) -> (layer == 1 && stack.getItem() instanceof ItemWand) ?
new WandOptions(stack).cores.get().getColor() : -1, item); new WandOptions(stack).cores.get().getColor() : -1, item);
} }
} }
private static <V extends IForgeRegistryEntry<V>> void register(IForgeRegistry<V> reg, String name, IForgeRegistryEntry<V> thing) {
reg.register(thing.setRegistryName(ConstructionWand.loc(name)));
}
} }

View file

@ -2,6 +2,7 @@ package thetadev.constructionwand.items.core;
import net.minecraft.ChatFormatting; import net.minecraft.ChatFormatting;
import net.minecraft.network.chat.Component; import net.minecraft.network.chat.Component;
import net.minecraft.network.chat.TranslatableComponent;
import net.minecraft.world.item.Item; import net.minecraft.world.item.Item;
import net.minecraft.world.item.ItemStack; import net.minecraft.world.item.ItemStack;
import net.minecraft.world.item.TooltipFlag; import net.minecraft.world.item.TooltipFlag;
@ -22,12 +23,9 @@ public abstract class ItemCore extends Item implements IWandCore
@OnlyIn(Dist.CLIENT) @OnlyIn(Dist.CLIENT)
public void appendHoverText(@Nonnull ItemStack itemstack, Level worldIn, @Nonnull List<Component> lines, @Nonnull TooltipFlag extraInfo) { public void appendHoverText(@Nonnull ItemStack itemstack, Level worldIn, @Nonnull List<Component> lines, @Nonnull TooltipFlag extraInfo) {
lines.add( lines.add(new TranslatableComponent(ConstructionWand.MODID + ".option.cores." + getRegistryName().toString() + ".desc")
Component.translatable(ConstructionWand.MODID + ".option.cores." + getRegistryName().toString() + ".desc") .withStyle(ChatFormatting.GRAY));
.withStyle(ChatFormatting.GRAY) lines.add(new TranslatableComponent(ConstructionWand.MODID + ".tooltip.core_tip")
); .withStyle(ChatFormatting.AQUA));
lines.add(
Component.translatable(ConstructionWand.MODID + ".tooltip.core_tip").withStyle(ChatFormatting.AQUA)
);
} }
} }

View file

@ -1,7 +1,5 @@
package thetadev.constructionwand.items.core; package thetadev.constructionwand.items.core;
import net.minecraft.resources.ResourceLocation;
import thetadev.constructionwand.ConstructionWand;
import thetadev.constructionwand.api.IWandAction; import thetadev.constructionwand.api.IWandAction;
import thetadev.constructionwand.wand.action.ActionAngel; import thetadev.constructionwand.wand.action.ActionAngel;
@ -20,9 +18,4 @@ public class ItemCoreAngel extends ItemCore
public IWandAction getWandAction() { public IWandAction getWandAction() {
return new ActionAngel(); return new ActionAngel();
} }
@Override
public ResourceLocation getRegistryName() {
return ConstructionWand.loc("core_angel");
}
} }

View file

@ -1,7 +1,5 @@
package thetadev.constructionwand.items.core; package thetadev.constructionwand.items.core;
import net.minecraft.resources.ResourceLocation;
import thetadev.constructionwand.ConstructionWand;
import thetadev.constructionwand.api.IWandAction; import thetadev.constructionwand.api.IWandAction;
import thetadev.constructionwand.wand.action.ActionDestruction; import thetadev.constructionwand.wand.action.ActionDestruction;
@ -20,9 +18,4 @@ public class ItemCoreDestruction extends ItemCore
public IWandAction getWandAction() { public IWandAction getWandAction() {
return new ActionDestruction(); return new ActionDestruction();
} }
@Override
public ResourceLocation getRegistryName() {
return ConstructionWand.loc("core_destruction");
}
} }

View file

@ -3,6 +3,8 @@ package thetadev.constructionwand.items.wand;
import net.minecraft.ChatFormatting; import net.minecraft.ChatFormatting;
import net.minecraft.client.gui.screens.Screen; import net.minecraft.client.gui.screens.Screen;
import net.minecraft.network.chat.Component; import net.minecraft.network.chat.Component;
import net.minecraft.network.chat.TextComponent;
import net.minecraft.network.chat.TranslatableComponent;
import net.minecraft.world.InteractionHand; import net.minecraft.world.InteractionHand;
import net.minecraft.world.InteractionResult; import net.minecraft.world.InteractionResult;
import net.minecraft.world.InteractionResultHolder; import net.minecraft.world.InteractionResultHolder;
@ -105,35 +107,35 @@ public abstract class ItemWand extends Item implements ICustomItemModel
if(Screen.hasShiftDown()) { if(Screen.hasShiftDown()) {
for(int i = 1; i < options.allOptions.length; i++) { for(int i = 1; i < options.allOptions.length; i++) {
IOption<?> opt = options.allOptions[i]; IOption<?> opt = options.allOptions[i];
lines.add(Component.translatable(opt.getKeyTranslation()).withStyle(ChatFormatting.AQUA) lines.add(new TranslatableComponent(opt.getKeyTranslation()).withStyle(ChatFormatting.AQUA)
.append(Component.translatable(opt.getValueTranslation()).withStyle(ChatFormatting.GRAY)) .append(new TranslatableComponent(opt.getValueTranslation()).withStyle(ChatFormatting.GRAY))
); );
} }
if(!options.cores.getUpgrades().isEmpty()) { if(!options.cores.getUpgrades().isEmpty()) {
lines.add(Component.literal("")); lines.add(new TextComponent(""));
lines.add(Component.translatable(langTooltip + "cores").withStyle(ChatFormatting.GRAY)); lines.add(new TranslatableComponent(langTooltip + "cores").withStyle(ChatFormatting.GRAY));
for(IWandCore core : options.cores.getUpgrades()) { for(IWandCore core : options.cores.getUpgrades()) {
lines.add(Component.translatable(options.cores.getKeyTranslation() + "." + core.getRegistryName().toString())); lines.add(new TranslatableComponent(options.cores.getKeyTranslation() + "." + core.getRegistryName().toString()));
} }
} }
} }
// Default tooltip: show block limit + active wand core // Default tooltip: show block limit + active wand core
else { else {
IOption<?> opt = options.allOptions[0]; IOption<?> opt = options.allOptions[0];
lines.add(Component.translatable(langTooltip + "blocks", limit).withStyle(ChatFormatting.GRAY)); lines.add(new TranslatableComponent(langTooltip + "blocks", limit).withStyle(ChatFormatting.GRAY));
lines.add(Component.translatable(opt.getKeyTranslation()).withStyle(ChatFormatting.AQUA) lines.add(new TranslatableComponent(opt.getKeyTranslation()).withStyle(ChatFormatting.AQUA)
.append(Component.translatable(opt.getValueTranslation()).withStyle(ChatFormatting.WHITE))); .append(new TranslatableComponent(opt.getValueTranslation()).withStyle(ChatFormatting.WHITE)));
lines.add(Component.translatable(langTooltip + "shift").withStyle(ChatFormatting.AQUA)); lines.add(new TranslatableComponent(langTooltip + "shift").withStyle(ChatFormatting.AQUA));
} }
} }
public static void optionMessage(Player player, IOption<?> option) { public static void optionMessage(Player player, IOption<?> option) {
player.displayClientMessage( player.displayClientMessage(
Component.translatable(option.getKeyTranslation()).withStyle(ChatFormatting.AQUA) new TranslatableComponent(option.getKeyTranslation()).withStyle(ChatFormatting.AQUA)
.append(Component.translatable(option.getValueTranslation()).withStyle(ChatFormatting.WHITE)) .append(new TranslatableComponent(option.getValueTranslation()).withStyle(ChatFormatting.WHITE))
.append(Component.literal(" - ").withStyle(ChatFormatting.GRAY)) .append(new TextComponent(" - ").withStyle(ChatFormatting.GRAY))
.append(Component.translatable(option.getDescTranslation()).withStyle(ChatFormatting.WHITE)) .append(new TranslatableComponent(option.getDescTranslation()).withStyle(ChatFormatting.WHITE))
, true); , true);
} }

View file

@ -1,8 +1,8 @@
package thetadev.constructionwand.wand; package thetadev.constructionwand.wand;
import net.minecraft.core.BlockPos; import net.minecraft.core.BlockPos;
import net.minecraft.server.level.ServerPlayer;
import net.minecraft.sounds.SoundSource; import net.minecraft.sounds.SoundSource;
import net.minecraft.world.InteractionHand;
import net.minecraft.world.entity.player.Player; import net.minecraft.world.entity.player.Player;
import net.minecraft.world.item.BlockItem; import net.minecraft.world.item.BlockItem;
import net.minecraft.world.item.Item; import net.minecraft.world.item.Item;
@ -87,6 +87,10 @@ public class WandJob
return placeSnapshots.stream().map(ISnapshot::getPos).collect(Collectors.toSet()); return placeSnapshots.stream().map(ISnapshot::getPos).collect(Collectors.toSet());
} }
public int blockCount() {
return placeSnapshots.size();
}
public boolean doIt() { public boolean doIt() {
ArrayList<ISnapshot> executed = new ArrayList<>(); ArrayList<ISnapshot> executed = new ArrayList<>();
@ -99,7 +103,7 @@ public class WandJob
// If the item cant be taken, undo the placement // If the item cant be taken, undo the placement
if(wandSupplier.takeItemStack(snapshot.getRequiredItems()) == 0) { if(wandSupplier.takeItemStack(snapshot.getRequiredItems()) == 0) {
executed.add(snapshot); executed.add(snapshot);
wand.hurt(1, player.getRandom(), (ServerPlayer) player); wand.hurtAndBreak(1, player, e -> e.broadcastBreakEvent(InteractionHand.MAIN_HAND));
} }
else { else {
ConstructionWand.LOGGER.info("Item could not be taken. Remove block: " + ConstructionWand.LOGGER.info("Item could not be taken. Remove block: " +

View file

@ -6,8 +6,6 @@ import net.minecraft.world.item.BlockItem;
import net.minecraft.world.item.ItemStack; import net.minecraft.world.item.ItemStack;
import net.minecraft.world.item.context.BlockPlaceContext; import net.minecraft.world.item.context.BlockPlaceContext;
import net.minecraft.world.level.Level; import net.minecraft.world.level.Level;
import net.minecraft.world.level.block.Block;
import net.minecraft.world.level.block.Blocks;
import net.minecraft.world.level.block.state.BlockState; import net.minecraft.world.level.block.state.BlockState;
import net.minecraft.world.level.block.state.properties.BlockStateProperties; import net.minecraft.world.level.block.state.properties.BlockStateProperties;
import net.minecraft.world.level.block.state.properties.Property; import net.minecraft.world.level.block.state.properties.Property;
@ -100,7 +98,7 @@ public class PlaceSnapshot implements ISnapshot
// Can block be placed? // Can block be placed?
BlockState blockState = item.getBlock().getStateForPlacement(ctx); BlockState blockState = item.getBlock().getStateForPlacement(ctx);
if(blockState == null) return null; if(blockState == null || !blockState.canSurvive(world, pos)) return null;
// Forbidden Tile Entity? // Forbidden Tile Entity?
if(!WandUtil.isTEAllowed(blockState)) return null; if(!WandUtil.isTEAllowed(blockState)) return null;
@ -108,11 +106,6 @@ public class PlaceSnapshot implements ISnapshot
// No entities colliding? // No entities colliding?
if(WandUtil.entitiesCollidingWithBlock(world, blockState, pos)) return null; if(WandUtil.entitiesCollidingWithBlock(world, blockState, pos)) return null;
// Adjust blockstate to neighbors
// TODO: verify that
blockState = Block.updateFromNeighbourShapes(blockState, world, pos);
if(blockState.getBlock() == Blocks.AIR || !blockState.canSurvive(world, pos)) return null;
// Copy block properties from supporting block // Copy block properties from supporting block
if(targetMode && supportingBlock != null) { if(targetMode && supportingBlock != null) {
// Block properties to be copied (alignment/rotation properties) // Block properties to be copied (alignment/rotation properties)

View file

@ -1,5 +1,5 @@
modLoader = "javafml" modLoader = "javafml"
loaderVersion = "[41,)" loaderVersion = "[38,)"
license = "MIT License" license = "MIT License"
[[mods]] [[mods]]
modId="constructionwand" modId="constructionwand"
@ -20,12 +20,12 @@ This is my first minecraft mod. May the odds be ever in your favor.
[[dependencies.constructionwand]] [[dependencies.constructionwand]]
modId="forge" modId="forge"
mandatory = true mandatory = true
versionRange = "[41,)" versionRange = "[38,)"
ordering = "NONE" ordering = "NONE"
side="BOTH" side="BOTH"
[[dependencies.constructionwand]] [[dependencies.constructionwand]]
modId="minecraft" modId="minecraft"
mandatory = true mandatory = true
versionRange = "[1.19, 1.20)" versionRange = "[1.18, 1.19)"
ordering = "NONE" ordering = "NONE"
side="BOTH" side="BOTH"

View file

@ -0,0 +1,70 @@
{
"item.constructionwand.stone_wand": "Varinha de pedra",
"item.constructionwand.iron_wand": "Varinha de ferro",
"item.constructionwand.diamond_wand": "diamondWand",
"item.constructionwand.infinity_wand": "Varinha infinita",
"item.constructionwand.core_angel": "Angel Wand Core",
"item.constructionwand.core_destruction": "Destruction Wand Core",
"constructionwand.tooltip.blocks": "Max. %d blocos",
"constructionwand.tooltip.shift": "Pressione Shift]",
"constructionwand.tooltip.cores": "Núcleos de varinhas:",
"constructionwand.tooltip.core_tip": "Combine o núcleo com sua varinha em uma grade de criação",
"constructionwand.option.cores": "",
"constructionwand.option.cores.constructionwand:default": "Núcleo de construção",
"constructionwand.option.cores.constructionwand:default.desc": "Estender seu prédio do lado de frente para você",
"constructionwand.option.cores.constructionwand:core_angel": "§6angelCore",
"constructionwand.option.cores.constructionwand:core_angel.desc": "Coloque atrás dos quarteirões e no meio do ar",
"constructionwand.option.cores.constructionwand:core_destruction": "§cNúcleo de destruição",
"constructionwand.option.cores.constructionwand:core_destruction.desc": "Destrói blocos do lado de frente para você",
"constructionwand.option.lock": "Restrição: ",
"constructionwand.option.lock.horizontal": "§aEsquerda direita",
"constructionwand.option.lock.horizontal.desc": "Construa uma coluna horizontal em frente ao bloco original",
"constructionwand.option.lock.vertical": "§aCima baixo",
"constructionwand.option.lock.vertical.desc": "Construa uma coluna vertical em frente ao bloco original",
"constructionwand.option.lock.northsouth": "§6Norte Sul",
"constructionwand.option.lock.northsouth.desc": "Construa uma linha na direção N/s no topo do bloco original",
"constructionwand.option.lock.eastwest": "§6Leste Oeste",
"constructionwand.option.lock.eastwest.desc": "Construa uma linha na direção E/W no topo do bloco original",
"constructionwand.option.lock.nolock": "§cNenhum",
"constructionwand.option.lock.nolock.desc": "Estender de qualquer lado do bloco original",
"constructionwand.option.direction": "Direção: ",
"constructionwand.option.direction.target": "§6Alvo",
"constructionwand.option.direction.target.desc": "Coloque blocos com a mesma direção que o bloco de destino",
"constructionwand.option.direction.player": "§aJogadora",
"constructionwand.option.direction.player.desc": "Coloque blocos de frente para o jogador",
"constructionwand.option.replace": "Substituição: ",
"constructionwand.option.replace.yes": "§aSim",
"constructionwand.option.replace.yes.desc": "Substitua certos blocos como fluidos, neve e capim alto",
"constructionwand.option.replace.no": "§cNão",
"constructionwand.option.replace.no.desc": "Não substitua blocos",
"constructionwand.option.match": "Coincidindo: ",
"constructionwand.option.match.exact": "§aExata",
"constructionwand.option.match.exact.desc": "Estender apenas blocos que são exatamente iguais",
"constructionwand.option.match.similar": "§6Semelhante",
"constructionwand.option.match.similar.desc": "Tratar blocos semelhantes (tipos de sujeira/grama) igualmente",
"constructionwand.option.match.any": "§cAlguma",
"constructionwand.option.match.any.desc": "Estender qualquer bloco",
"constructionwand.option.random": "Aleatório: ",
"constructionwand.option.random.yes": "§aSim",
"constructionwand.option.random.yes.desc": "Coloque blocos aleatórios presentes em seu hotbar",
"constructionwand.option.random.no": "§cNão",
"constructionwand.option.random.no.desc": "Não randomize blocos colocados",
"constructionwand.description.wand": "o %1$s pode colocar até %2$d bloqueios ao lado de um prédio de frente para você e dura %3$s.\n\nCalma %5$s e role para alterar a restrição de posicionamento (horizontal, vertical, norte/sul, leste/oeste, sem fechadura).\n\nAbra a tela de opção com %6$s§9+Clique com o botão direito do mouse§0.\n\n§5§nDESFAZER§0§r\nMantendo pressionada §9Esgueirar-se+§0%4$s Enquanto olha para um bloco, mostrará os últimos blocos que você colocou com uma borda verde ao redor deles. §9Esgueirar-se+§0%4$s§9+Certa clicando§0 Qualquer um deles desfazerá a operação, oferecendo todos os itens de volta.Se você usou o núcleo de destruição, ele restaurará os blocos.\n\n§5§nRECIPIENTES§0§r\nCaixas Shulker, pacotes e muitos contêineres de outros mods podem fornecer blocos de construção para a varinha.\n\n§5§nPrioridade imediata§0§r\nTer blocos em sua mão os colocará em vez do bloco que você está olhando.",
"constructionwand.description.durability.limited": "por %d blocos",
"constructionwand.description.durability.unlimited": "para todo sempre",
"constructionwand.description.key.sneak": "Esgueirar-se",
"constructionwand.description.key.sneak_opt": "Esgueirar-se+%s",
"constructionwand.description.core": "§5§nINSTALAÇÃO§0§r\nColoque seu novo núcleo junto com sua varinha em uma grade de criação para instalá -la.Para alternar entre núcleos, mantenha pressionado %s e o clique esquerdo, esvazie o espaço com sua varinha ou use a tela de opção.",
"constructionwand.description.core_angel": "O núcleo do anjo coloca um bloco no lado oposto do bloco (ou fileira de blocos) que você está enfrentando.A distância máxima depende da camada de varinha.Clique com o botão direito do mouse em espaço vazio para colocar um bloco no ar.Para fazer isso, você precisará ter o bloco que deseja colocar em sua mão.",
"constructionwand.description.core_destruction": "O núcleo de destruição destrói blocos (sem entidades de ladrilhos) do lado de frente para você.O número máximo de blocos depende da camada de varinha.Blocos destruídos desaparecem no vazio, você pode usar o recurso de desfazer se cometer um erro.",
"stat.constructionwand.use_wand": "Blocos colocados usando varinha"
}

View file

@ -0,0 +1,70 @@
{
"item.constructionwand.stone_wand": "Каменный жезл",
"item.constructionwand.iron_wand": "Железный жезл",
"item.constructionwand.diamond_wand": "Алмазный жезл",
"item.constructionwand.infinity_wand": "Бесконечный жезл",
"item.constructionwand.core_angel": "Ангельское ядро для жезла",
"item.constructionwand.core_destruction": "Ядро разрушения для жезла",
"constructionwand.tooltip.blocks": "Максимум %d блоков",
"constructionwand.tooltip.shift": "Нажмите [SHIFT]",
"constructionwand.tooltip.cores": "Ядер жезла:",
"constructionwand.tooltip.core_tip": "Объедините ядро со своим жезлом в сетке создания.",
"constructionwand.option.cores": "",
"constructionwand.option.cores.constructionwand:default": "Ядро строительства",
"constructionwand.option.cores.constructionwand:default.desc": "Расширяйте свои строения на стороне, обращённой к Вам.",
"constructionwand.option.cores.constructionwand:core_angel": "§6Ангельское ядро",
"constructionwand.option.cores.constructionwand:core_angel.desc": "Размещает за блоками и в воздухе.",
"constructionwand.option.cores.constructionwand:core_destruction": "§cЯдро разрушения",
"constructionwand.option.cores.constructionwand:core_destruction.desc": "Уничтожает блоки на стороне, обращённой к Вам.",
"constructionwand.option.lock": "Ограничение: ",
"constructionwand.option.lock.horizontal": "§aВлево/Вправо",
"constructionwand.option.lock.horizontal.desc": "Строить горизонтальную колонну перед основным блоком.",
"constructionwand.option.lock.vertical": "§aВверх/Вниз",
"constructionwand.option.lock.vertical.desc": "Строить вертикальную колонну перед основным блоком.",
"constructionwand.option.lock.northsouth": "§6Север/Юг",
"constructionwand.option.lock.northsouth.desc": "Строить ряд в С/Ю направлении непосредственно за основным блоком.",
"constructionwand.option.lock.eastwest": "§6Восток/Запад",
"constructionwand.option.lock.eastwest.desc": "Строить ряд в В/З направлении непосредственно за основным блоком.",
"constructionwand.option.lock.nolock": "§cНичего",
"constructionwand.option.lock.nolock.desc": "Расширять с любой стороны основного блока.",
"constructionwand.option.direction": "Направление: ",
"constructionwand.option.direction.target": "§6Цель",
"constructionwand.option.direction.target.desc": "Размещать блоки с таким же направлением как целевой блок.",
"constructionwand.option.direction.player": "§aИгрок",
"constructionwand.option.direction.player.desc": "Размещать блоки, обращённые к игроку.",
"constructionwand.option.replace": "Замена: ",
"constructionwand.option.replace.yes": "§aДа",
"constructionwand.option.replace.yes.desc": "Заменять некоторые блоки как жидкости, снег и высокорослая трава.",
"constructionwand.option.replace.no": "§cНет",
"constructionwand.option.replace.no.desc": "Не заменять блоки.",
"constructionwand.option.match": "Совпадение: ",
"constructionwand.option.match.exact": "§aТочное",
"constructionwand.option.match.exact.desc": "Расширять только абсолютно одинаковые блоки.",
"constructionwand.option.match.similar": "§6Похожее",
"constructionwand.option.match.similar.desc": "Подносить аналогичные блоки (пример: земля/трава) поровну.",
"constructionwand.option.match.any": "§cНикакое",
"constructionwand.option.match.any.desc": "Расширять любой блок.",
"constructionwand.option.random": "Случайно: ",
"constructionwand.option.random.yes": "§aДа",
"constructionwand.option.random.yes.desc": "Размещать случайные блоки, имеющиеся в Вашей горячей панели.",
"constructionwand.option.random.no": "§cНет",
"constructionwand.option.random.no.desc": "Не располагать блоки в случайном порядке.",
"constructionwand.description.wand": "%1$s может размещать до %2$d блоков сбоку от строения, обращённое к Вам и его хватит на %3$s блоков.\n\nУдерживайте %5$s и прокрутите колёсиком для изменения ограничения по размещении (Горизонтально, Вертикально, Север/Юг, Восток/Запад, Без ограничивания).\n\nОткройте экран настроек при помощи %6$s§9+щелчок правой кнопкой мыши§0.\n\n§5§nОТМЕНА§0§r\nУдерживайте §9Приседание+§0%4$s пока смотрите на блоки, установленные Вами, они будут выделены зелёным контуром. §9Приседание+§0%4$s§9+щелчок правой кнопкой мыши§0 на любой из них отменит операцию, вернув Вам все предметы обратно. Если использовать Ядро разрушения, то он вернёт блоки.\n\n§5§nКОНТЕЙНЕР§0§r\nШалкеровые ящики, мешки и множество контейнеров из других модов могут предоставлять строительные блоки в жезл.\n\n§5§nПРИОРИТЕТ ЛЕВОЙ РУКИ§0§r\nЕсли у Вас в левой руке находятся блоки, то они будут размещаться вместо блока, на который Вы смотрите.",
"constructionwand.description.durability.limited": "на %d блоков",
"constructionwand.description.durability.unlimited": "вечно",
"constructionwand.description.key.sneak": "Приседание",
"constructionwand.description.key.sneak_opt": "Приседание+%s",
"constructionwand.description.core": "§5§nУСТАНОВКА§0§r\nПоложите своё новое ядро вместе со своим жезлом в сетку создания для его установки. Для того, чтобы переключаться между ядрами, удерживайте %s и нажмите левую кнопку мыши по пустому пространству с жезлом в руке или используйте экран настроек.",
"constructionwand.description.core_angel": "Ангельское ядро размещает блоки на противоположной стороне блока (или ряда блоков), обращённые к Вам. Максимальное расстояние зависит от уровня жезла. Щелчок правой кнопкой мыши по пустому воздуху разместит блок в воздухе. Чтобы это сделать, Вам нужно иметь необходимые блоки в левой руке, чтобы разместить их.",
"constructionwand.description.core_destruction": "Ядро разрушения разрушает блоки (не функциональные блоки), обращённые к Вам. Максимально количество блоков зависит от уровня жезла. Разрушенные блоки исчезают в пустоту, можно использовать функцию отмены в случае допущенной ошибки.",
"stat.constructionwand.use_wand": "Блоки, размещённые при помощи Жезла"
}

View file

@ -0,0 +1,70 @@
{
"item.constructionwand.stone_wand": "Taş Asa",
"item.constructionwand.iron_wand": "Demir Asa",
"item.constructionwand.diamond_wand": "Elmas Asa",
"item.constructionwand.infinity_wand": "Sonsuzluk Asası",
"item.constructionwand.core_angel": "Melek Asa Çekirdeği",
"item.constructionwand.core_destruction": "Yıkım Asa Çekirdeği",
"constructionwand.tooltip.blocks": "Maks. %d blok",
"constructionwand.tooltip.shift": "[SHIFT] bas",
"constructionwand.tooltip.cores": "Asa çekirdekleri:",
"constructionwand.tooltip.core_tip": "Çekirdeği asanızla birlikte üretim ızgarasında birleştirin",
"constructionwand.option.cores": "",
"constructionwand.option.cores.constructionwand:default": "İnşa Çekirdeği",
"constructionwand.option.cores.constructionwand:default.desc": "Yapınızın size bakan tarafını uzatır",
"constructionwand.option.cores.constructionwand:core_angel": "§6Melek Çekirdeği",
"constructionwand.option.cores.constructionwand:core_angel.desc": "Blokların arkasına ve havaya yerleştirir",
"constructionwand.option.cores.constructionwand:core_destruction": "§cYıkım Çekirdeği",
"constructionwand.option.cores.constructionwand:core_destruction.desc": "Size bakan taraftaki blokları yok eder",
"constructionwand.option.lock": "Sınırlama: ",
"constructionwand.option.lock.horizontal": "§aSol/Sağ",
"constructionwand.option.lock.horizontal.desc": "Orijinal bloğun önüne yatay bir sütun oluşturur",
"constructionwand.option.lock.vertical": "§aYukarı/Aşağı",
"constructionwand.option.lock.vertical.desc": "Orijinal bloğun önünde dikey bir sütun oluşturur",
"constructionwand.option.lock.northsouth": "§6Kuzey/Güney",
"constructionwand.option.lock.northsouth.desc": "Orijinal bloğun üstüne K/G yönünde bir sıra oluşturun",
"constructionwand.option.lock.eastwest": "§6Doğu/Batı",
"constructionwand.option.lock.eastwest.desc": "Orijinal bloğun üstüne D/B yönünde bir sıra oluşturur",
"constructionwand.option.lock.nolock": "§cYok",
"constructionwand.option.lock.nolock.desc": "Orijinal bloğun herhangi bir tarafından uzatır",
"constructionwand.option.direction": "Yön: ",
"constructionwand.option.direction.target": "§6Hedef",
"constructionwand.option.direction.target.desc": "Blokları hedef blokla aynı yönde yerleştirir",
"constructionwand.option.direction.player": "§aOyuncu",
"constructionwand.option.direction.player.desc": "Blokları oyuncuya bakacak şekilde yerleştirir",
"constructionwand.option.replace": "Değiştirme: ",
"constructionwand.option.replace.yes": "§aEvet",
"constructionwand.option.replace.yes.desc": "Sıvılar, kar ve uzun otlar gibi belirli blokları değiştirir",
"constructionwand.option.replace.no": "§cHayır",
"constructionwand.option.replace.no.desc": "Blokları değiştirmez",
"constructionwand.option.match": "Eşleşen: ",
"constructionwand.option.match.exact": "§aAynı",
"constructionwand.option.match.exact.desc": "Yalnızca tamamen aynı olan blokları uzatır",
"constructionwand.option.match.similar": "§6Benzer",
"constructionwand.option.match.similar.desc": "Benzer bloklara (toprak/çimen türleri) eşit davranır",
"constructionwand.option.match.any": "§cHerhangi",
"constructionwand.option.match.any.desc": "Herhangi bir bloğu uzatır",
"constructionwand.option.random": "Rastgele: ",
"constructionwand.option.random.yes": "§aEvet",
"constructionwand.option.random.yes.desc": "Hotbar'ınızdan rastgele bloklar yerleştirir",
"constructionwand.option.random.no": "§cHayır",
"constructionwand.option.random.no.desc": "Yerleştirilen blokları rastgeleleştirmez",
"constructionwand.description.wand": "%1$s, bir yapının size bakan tarafına en fazla %2$d blok yerleştirebilir ve %3$s dayanıklılığı vardır.\n\n%5$s tuşunu basılı tutun ve yerleştirme sınırlamasını değiştirmek için kaydırın (Yatay, Dikey, Kuzey/Güney, Doğu/Batı, Kilitsiz).\n\n%6$s§9+Sağ tıklama ile seçenek ekranınıın§0.\n\n§5§nGERİ ALMA§0§r\nBir bloğa bakarken §9Eğil+§0%4$s tuşunu basılı tuttuğunuzda, yerleştirdiğiniz son bloklar, çevresinde yeşil bir çerçeveyle gösterilecektir. §9Eğil+§0%4$s§9+Bunlardan herhangi birine sağ tıklama§0 işlemi geri alacak ve tüm öğeleri size geri verecektir. Yıkım çekirdeğini kullandıysanız blokları geri koyacaktır.\n\n§5§nKONTEYNERLER§0§r\nShulker kutuları, paketler ve diğer modlardan birçok konteyner, asa için yapı taşları sağlar.\n\n§5§nBOŞTAKİ EL ÖNCELİĞݧ0§r\nBoştaki elinizde blok olduğunda, baktığınız blok yerine boştaki elinizdekini yerleştirirsiniz.",
"constructionwand.description.durability.limited": "%d blok için",
"constructionwand.description.durability.unlimited": "sonsuza kadar",
"constructionwand.description.key.sneak": "Eğil",
"constructionwand.description.key.sneak_opt": "Eğil+%s",
"constructionwand.description.core": "§5§nKURULUM§0§r\nTakmak için yeni çekirdeğinizi asanızla birlikte bir üretim ızgarasına koyun. Çekirdekler arasında geçiş yapmak için %s tuşunu basılı tutun ve asanızla boş alana sol tıklayın veya seçenek ekranını kullanın",
"constructionwand.description.core_angel": "Melek çekirdeği, karşı karşıya olduğunuz bloğun (veya blok sırasının) karşı tarafına bir blok yerleştirir. Maksimum mesafe asa seviyesine bağlıdır. Havada bir blok yerleştirmek için boş alana sağ tıklayın. Bunu yapmak için, yerleştirmek istediğiniz bloğu boştaki elinize almalısınız.",
"constructionwand.description.core_destruction": "Yıkım çekirdeği, size bakan taraftaki blokları (tile entities haricinde) yok eder. Maksimum blok sayısı asa seviyesine bağlıdır. Yok edilen bloklar boşluğa kaybolur, hata yaptıysanız geri alma özelliğini kullanabilirsiniz.",
"stat.constructionwand.use_wand": "Asa kullanılarak yerleştirilen bloklar"
}

View file

@ -0,0 +1,70 @@
{
"item.constructionwand.stone_wand": "石制手杖",
"item.constructionwand.iron_wand": "铁制手杖",
"item.constructionwand.diamond_wand": "钻石手杖",
"item.constructionwand.infinity_wand": "无尽手杖",
"item.constructionwand.core_angel": "天使手杖核心",
"item.constructionwand.core_destruction": "破坏手杖核心",
"constructionwand.tooltip.blocks": "最多放置%d个方块",
"constructionwand.tooltip.shift": "按 [SHIFT]",
"constructionwand.tooltip.cores": "手杖核心:",
"constructionwand.tooltip.core_tip": "将手杖核心与手杖组合在一起",
"constructionwand.option.cores": "",
"constructionwand.option.cores.constructionwand:default": "建筑核心",
"constructionwand.option.cores.constructionwand:default.desc": "在面向你的一侧放置方块",
"constructionwand.option.cores.constructionwand:core_angel": "§6天使核心",
"constructionwand.option.cores.constructionwand:core_angel.desc": "在面向你的方块的背面放置方块,还可以悬空放置方块",
"constructionwand.option.cores.constructionwand:core_destruction": "§c毁灭核心",
"constructionwand.option.cores.constructionwand:core_destruction.desc": "破坏面向你一侧的方块",
"constructionwand.option.lock": "锁定: ",
"constructionwand.option.lock.horizontal": "§a左 / 右",
"constructionwand.option.lock.horizontal.desc": "在起始方块的前面延伸一行水平方块",
"constructionwand.option.lock.vertical": "§a上 / 下",
"constructionwand.option.lock.vertical.desc": "在起始方块的前面延伸一列竖直方块",
"constructionwand.option.lock.northsouth": "§6南 / 北",
"constructionwand.option.lock.northsouth.desc": "在起始方块的上面,向南 / 北方向延伸一行",
"constructionwand.option.lock.eastwest": "§6东 / 西",
"constructionwand.option.lock.eastwest.desc": "在起始方块的上面,向东 / 西方向延伸一行",
"constructionwand.option.lock.nolock": "§c无",
"constructionwand.option.lock.nolock.desc": "从原始块的任意一面延伸",
"constructionwand.option.direction": "方向: ",
"constructionwand.option.direction.target": "§6目标",
"constructionwand.option.direction.target.desc": "放置与的方块方向与目标方块的方向相同",
"constructionwand.option.direction.player": "§a玩家",
"constructionwand.option.direction.player.desc": "放置的方块面向玩家",
"constructionwand.option.replace": "替换: ",
"constructionwand.option.replace.yes": "§a是",
"constructionwand.option.replace.yes.desc": "替换某些方块,如液体、雪、高草丛",
"constructionwand.option.replace.no": "§c否",
"constructionwand.option.replace.no.desc": "不替换方块",
"constructionwand.option.match": "匹配: ",
"constructionwand.option.match.exact": "§a精确",
"constructionwand.option.match.exact.desc": "仅放置完全相同的方块",
"constructionwand.option.match.similar": "§6模糊",
"constructionwand.option.match.similar.desc": "相似的方块被认为是相同的(草方块 / 泥土类型)",
"constructionwand.option.match.any": "§c任意",
"constructionwand.option.match.any.desc": "放置任何方块",
"constructionwand.option.random": "随机: ",
"constructionwand.option.random.yes": "§a是",
"constructionwand.option.random.yes.desc": "随机放置快捷栏中的方块",
"constructionwand.option.random.no": "§c否",
"constructionwand.option.random.no.desc": "不会随机放置方块",
"constructionwand.description.wand": "%1$s可以在建筑物面向你的一侧放置最多%2$d个方块持续时间为%3$s。\n\n按住%5$s并滚动以更改放置限制水平、垂直、北/南、东/西、无锁定)。\n\n在选项配置GUI上打开%6$s§9+右键单击§0。\n\n§5§nUNDO§0§r\n在查看方块时向下折叠§9Sneak+§0%4$s将显示你放置的最后一个方块,并在其周围加上绿色边框。§9潜行+§0%4$s§9+右键单击其中任何一个方块将撤消操作,并将所有以此法放置的方块重返至玩家背包。如果你使用了破坏核心,它将恢复方块。\n\n§5§n容器§0§r\n潜影盒、收纳袋和许多其它模组存在于玩家背包内的容器都可以为建筑手杖提供构建所需的方块。\n\n§5§非即时优先级§0§r\n如果玩家在使用手杖时副手栏持有所需方块将被放置,而不是只是在你的手里放着。",
"constructionwand.description.durability.limited": "需要%d方块",
"constructionwand.description.durability.unlimited": "无限",
"constructionwand.description.key.sneak": "潜行",
"constructionwand.description.key.sneak_opt": "潜行+%s",
"constructionwand.description.core": "§5§n安装§0§r\n将新的手杖核心与你的手杖一起放入工作台中进行组装。如果你想要在核心功能之间切换,请按住%s并用手杖左键单击空地或使用手杖的选项配置GUI。",
"constructionwand.description.core_angel": "天使核心可将一个方块放置在你所面对的方块(或一排方块)的对面。最大距离取决于手杖材质。在空地上手持手杖并单击鼠标右键即可在空中放置方块。要做到这一点。你需要将想要被在空中放置的方块放在你的副手栏中。",
"constructionwand.description.core_destruction": "毁灭核心会破坏面向你一侧的方块(破坏时被破坏的方块不可存在实体)。最大破坏方块数取决于手杖材质。被使用毁灭核心破坏的方块会消失。如果你只是不小心使用了毁灭核心。可以使用“撤消”功能以撤回被破坏并消失的物品返回原处。",
"stat.constructionwand.use_wand": "使用建筑手杖所放置的方块"
}

View file

@ -1,8 +1,6 @@
{ {
"pack": { "pack": {
"description": "ConstructionWand resources", "description": "ConstructionWand resources",
"pack_format": 9, "pack_format": 8
"forge:resource_pack_format": 9,
"forge:data_pack_format": 10
} }
} }