mirror of
https://github.com/Theta-Dev/ConstructionWand.git
synced 2025-04-21 00:50:04 +02:00
Compare commits
3 commits
1.18
...
1.18.2-2.7
Author | SHA1 | Date | |
---|---|---|---|
83d880cb2e | |||
5f0cc62dbc | |||
|
fc20293906 |
24 changed files with 257 additions and 218 deletions
|
@ -104,14 +104,12 @@ dependencies {
|
||||||
compileOnly fg.deobf("mezz.jei:${jei_version}:api")
|
compileOnly fg.deobf("mezz.jei:${jei_version}:api")
|
||||||
runtimeOnly fg.deobf("mezz.jei:${jei_version}")
|
runtimeOnly fg.deobf("mezz.jei:${jei_version}")
|
||||||
|
|
||||||
/*
|
|
||||||
compileOnly fg.deobf([
|
compileOnly fg.deobf([
|
||||||
group: "vazkii.botania",
|
group: "vazkii.botania",
|
||||||
name: "Botania",
|
name: "Botania",
|
||||||
version: "${project.botania}",
|
version: "${project.botania}",
|
||||||
classifier: "api"
|
classifier: "api"
|
||||||
])
|
])
|
||||||
*/
|
|
||||||
}
|
}
|
||||||
|
|
||||||
jar {
|
jar {
|
||||||
|
@ -146,3 +144,7 @@ publishing {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
tasks.withType(JavaCompile).configureEach {
|
||||||
|
options.encoding = 'UTF-8' // Use the UTF-8 charset for Java compilation
|
||||||
|
}
|
||||||
|
|
|
@ -4,15 +4,15 @@ org.gradle.daemon=false
|
||||||
author=thetadev
|
author=thetadev
|
||||||
modid=constructionwand
|
modid=constructionwand
|
||||||
|
|
||||||
mcversion=1.18.1
|
mcversion=1.18.2
|
||||||
forgeversion=39.0.0
|
forgeversion=40.0.15
|
||||||
mcp_channel=official
|
mcp_channel=official
|
||||||
mcp_mappings=1.18.1
|
mcp_mappings=1.18.2
|
||||||
|
|
||||||
# Source: https://maven.blamejared.com/vazkii/botania/Botania/
|
# Source: https://maven.blamejared.com/vazkii/botania/Botania/
|
||||||
# botania=1.16.2-405
|
botania=1.18.2-430-SNAPSHOT
|
||||||
# Source: https://dvs1.progwml6.com/files/maven/mezz/jei/
|
# Source: https://dvs1.progwml6.com/files/maven/mezz/jei/
|
||||||
jei_version=jei-1.18.1:9.1.0.41
|
jei_version=jei-1.18.2:9.5.0.132
|
||||||
|
|
||||||
version_major=2
|
version_major=2
|
||||||
version_minor=6
|
version_minor=7
|
2
gradle/wrapper/gradle-wrapper.properties
vendored
2
gradle/wrapper/gradle-wrapper.properties
vendored
|
@ -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.3-bin.zip
|
distributionUrl=https\://services.gradle.org/distributions/gradle-7.4-bin.zip
|
||||||
zipStoreBase=GRADLE_USER_HOME
|
zipStoreBase=GRADLE_USER_HOME
|
||||||
zipStorePath=wrapper/dists
|
zipStorePath=wrapper/dists
|
||||||
|
|
269
gradlew
vendored
269
gradlew
vendored
|
@ -1,7 +1,7 @@
|
||||||
#!/usr/bin/env sh
|
#!/bin/sh
|
||||||
|
|
||||||
#
|
#
|
||||||
# Copyright 2015 the original author or authors.
|
# Copyright © 2015-2021 the original 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,67 +17,101 @@
|
||||||
#
|
#
|
||||||
|
|
||||||
##############################################################################
|
##############################################################################
|
||||||
##
|
#
|
||||||
## Gradle start up script for UN*X
|
# Gradle start up script for POSIX generated by Gradle.
|
||||||
##
|
#
|
||||||
|
# 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
|
||||||
PRG="$0"
|
app_path=$0
|
||||||
# Need this for relative symlinks.
|
|
||||||
while [ -h "$PRG" ] ; do
|
# Need this for daisy-chained symlinks.
|
||||||
ls=`ls -ld "$PRG"`
|
while
|
||||||
link=`expr "$ls" : '.*-> \(.*\)$'`
|
APP_HOME=${app_path%"${app_path##*/}"} # leaves a trailing /; empty if no leading path
|
||||||
if expr "$link" : '/.*' > /dev/null; then
|
[ -h "$app_path" ]
|
||||||
PRG="$link"
|
do
|
||||||
else
|
ls=$( ls -ld "$app_path" )
|
||||||
PRG=`dirname "$PRG"`"/$link"
|
link=${ls#*' -> '}
|
||||||
fi
|
case $link in #(
|
||||||
|
/*) app_path=$link ;; #(
|
||||||
|
*) app_path=$APP_HOME$link ;;
|
||||||
|
esac
|
||||||
done
|
done
|
||||||
SAVED="`pwd`"
|
|
||||||
cd "`dirname \"$PRG\"`/" >/dev/null
|
APP_HOME=$( cd "${APP_HOME:-./}" && pwd -P ) || exit
|
||||||
APP_HOME="`pwd -P`"
|
|
||||||
cd "$SAVED" >/dev/null
|
|
||||||
|
|
||||||
APP_NAME="Gradle"
|
APP_NAME="Gradle"
|
||||||
APP_BASE_NAME=`basename "$0"`
|
APP_BASE_NAME=${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* ) cygwin=true ;; #(
|
||||||
cygwin=true
|
Darwin* ) darwin=true ;; #(
|
||||||
;;
|
MSYS* | MINGW* ) msys=true ;; #(
|
||||||
Darwin* )
|
NONSTOP* ) nonstop=true ;;
|
||||||
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
|
||||||
|
@ -87,9 +121,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
|
||||||
|
@ -98,7 +132,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
|
||||||
|
@ -106,80 +140,95 @@ 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" = "false" -a "$darwin" = "false" -a "$nonstop" = "false" ] ; then
|
if ! "$cygwin" && ! "$darwin" && ! "$nonstop" ; then
|
||||||
MAX_FD_LIMIT=`ulimit -H -n`
|
case $MAX_FD in #(
|
||||||
if [ $? -eq 0 ] ; then
|
max*)
|
||||||
if [ "$MAX_FD" = "maximum" -o "$MAX_FD" = "max" ] ; then
|
MAX_FD=$( ulimit -H -n ) ||
|
||||||
MAX_FD="$MAX_FD_LIMIT"
|
warn "Could not query maximum file descriptor limit"
|
||||||
fi
|
esac
|
||||||
ulimit -n $MAX_FD
|
case $MAX_FD in #(
|
||||||
if [ $? -ne 0 ] ; then
|
'' | soft) :;; #(
|
||||||
warn "Could not set maximum file descriptor limit: $MAX_FD"
|
*)
|
||||||
fi
|
ulimit -n "$MAX_FD" ||
|
||||||
else
|
warn "Could not set maximum file descriptor limit to $MAX_FD"
|
||||||
warn "Could not query maximum file descriptor limit: $MAX_FD_LIMIT"
|
|
||||||
fi
|
|
||||||
fi
|
|
||||||
|
|
||||||
# For Darwin, add options to specify how the application appears in the dock
|
|
||||||
if $darwin; then
|
|
||||||
GRADLE_OPTS="$GRADLE_OPTS \"-Xdock:name=$APP_NAME\" \"-Xdock:icon=$APP_HOME/media/gradle.icns\""
|
|
||||||
fi
|
|
||||||
|
|
||||||
# For Cygwin or MSYS, switch paths to Windows format before running java
|
|
||||||
if [ "$cygwin" = "true" -o "$msys" = "true" ] ; then
|
|
||||||
APP_HOME=`cygpath --path --mixed "$APP_HOME"`
|
|
||||||
CLASSPATH=`cygpath --path --mixed "$CLASSPATH"`
|
|
||||||
|
|
||||||
JAVACMD=`cygpath --unix "$JAVACMD"`
|
|
||||||
|
|
||||||
# We build the pattern for arguments to be converted via cygpath
|
|
||||||
ROOTDIRSRAW=`find -L / -maxdepth 1 -mindepth 1 -type d 2>/dev/null`
|
|
||||||
SEP=""
|
|
||||||
for dir in $ROOTDIRSRAW ; do
|
|
||||||
ROOTDIRS="$ROOTDIRS$SEP$dir"
|
|
||||||
SEP="|"
|
|
||||||
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
|
esac
|
||||||
fi
|
fi
|
||||||
|
|
||||||
# Escape application args
|
# Collect all arguments for the java command, stacking in reverse order:
|
||||||
save () {
|
# * args from the command line
|
||||||
for i do printf %s\\n "$i" | sed "s/'/'\\\\''/g;1s/^/'/;\$s/\$/' \\\\/" ; done
|
# * the main class name
|
||||||
echo " "
|
# * -classpath
|
||||||
}
|
# * -D...appname settings
|
||||||
APP_ARGS=`save "$@"`
|
# * --module-path (only if needed)
|
||||||
|
# * DEFAULT_JVM_OPTS, JAVA_OPTS, and GRADLE_OPTS environment variables.
|
||||||
|
|
||||||
# Collect all arguments for the java command, following the shell quoting and substitution rules
|
# For Cygwin or MSYS, switch paths to Windows format before running java
|
||||||
eval set -- $DEFAULT_JVM_OPTS $JAVA_OPTS $GRADLE_OPTS "\"-Dorg.gradle.appname=$APP_BASE_NAME\"" -classpath "\"$CLASSPATH\"" org.gradle.wrapper.GradleWrapperMain "$APP_ARGS"
|
if "$cygwin" || "$msys" ; then
|
||||||
|
APP_HOME=$( cygpath --path --mixed "$APP_HOME" )
|
||||||
|
CLASSPATH=$( cygpath --path --mixed "$CLASSPATH" )
|
||||||
|
|
||||||
|
JAVACMD=$( cygpath --unix "$JAVACMD" )
|
||||||
|
|
||||||
|
# Now convert the arguments - kludge to limit ourselves to /bin/sh
|
||||||
|
for arg do
|
||||||
|
if
|
||||||
|
case $arg in #(
|
||||||
|
-*) false ;; # don't mess with options #(
|
||||||
|
/?*) t=${arg#/} t=/${t%%/*} # looks like a POSIX filepath
|
||||||
|
[ -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
|
||||||
|
fi
|
||||||
|
|
||||||
|
# Collect all arguments for the java command;
|
||||||
|
# * $DEFAULT_JVM_OPTS, $JAVA_OPTS, and $GRADLE_OPTS can contain fragments of
|
||||||
|
# shell script including quotes and variable substitutions, so put them in
|
||||||
|
# double quotes to make sure that they get re-expanded; and
|
||||||
|
# * put everything else in single quotes, so that it's not re-expanded.
|
||||||
|
|
||||||
|
set -- \
|
||||||
|
"-Dorg.gradle.appname=$APP_BASE_NAME" \
|
||||||
|
-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" "$@"
|
||||||
|
|
|
@ -53,6 +53,9 @@ public class ConstructionWand
|
||||||
FMLJavaModLoadingContext.get().getModEventBus().addListener(this::clientSetup);
|
FMLJavaModLoadingContext.get().getModEventBus().addListener(this::clientSetup);
|
||||||
MinecraftForge.EVENT_BUS.register(this);
|
MinecraftForge.EVENT_BUS.register(this);
|
||||||
|
|
||||||
|
// Register Item DeferredRegister
|
||||||
|
ModItems.ITEMS.register(FMLJavaModLoadingContext.get().getModEventBus());
|
||||||
|
|
||||||
// Config setup
|
// Config setup
|
||||||
ModLoadingContext.get().registerConfig(ModConfig.Type.SERVER, ConfigServer.SPEC);
|
ModLoadingContext.get().registerConfig(ModConfig.Type.SERVER, ConfigServer.SPEC);
|
||||||
ModLoadingContext.get().registerConfig(ModConfig.Type.CLIENT, ConfigClient.SPEC);
|
ModLoadingContext.get().registerConfig(ModConfig.Type.CLIENT, ConfigClient.SPEC);
|
||||||
|
|
|
@ -1,8 +1,10 @@
|
||||||
package thetadev.constructionwand.basics;
|
package thetadev.constructionwand.basics;
|
||||||
|
|
||||||
|
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.RegistryObject;
|
||||||
import thetadev.constructionwand.items.ModItems;
|
import thetadev.constructionwand.items.ModItems;
|
||||||
|
|
||||||
import java.util.Arrays;
|
import java.util.Arrays;
|
||||||
|
@ -27,10 +29,10 @@ public class ConfigServer
|
||||||
public static final ForgeConfigSpec.ConfigValue<List<?>> TE_LIST;
|
public static final ForgeConfigSpec.ConfigValue<List<?>> TE_LIST;
|
||||||
private static final String[] TE_LIST_DEFAULT = {"chiselsandbits"};
|
private static final String[] TE_LIST_DEFAULT = {"chiselsandbits"};
|
||||||
|
|
||||||
private static final HashMap<Item, 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(wand, WandProperties.DEFAULT);
|
return wandProperties.getOrDefault(wand.getRegistryName(), WandProperties.DEFAULT);
|
||||||
}
|
}
|
||||||
|
|
||||||
public static class WandProperties
|
public static class WandProperties
|
||||||
|
@ -53,9 +55,10 @@ public class ConfigServer
|
||||||
this.upgradeable = upgradeable;
|
this.upgradeable = upgradeable;
|
||||||
}
|
}
|
||||||
|
|
||||||
public WandProperties(ForgeConfigSpec.Builder builder, Item wand, int defDurability, int defLimit,
|
public WandProperties(ForgeConfigSpec.Builder builder, RegistryObject<Item> wandSupplier, int defDurability, int defLimit,
|
||||||
int defAngel, int defDestruction, boolean defUpgradeable) {
|
int defAngel, int defDestruction, boolean defUpgradeable) {
|
||||||
builder.push(wand.getRegistryName().getPath());
|
ResourceLocation registryName = wandSupplier.getId();
|
||||||
|
builder.push(registryName.getPath());
|
||||||
|
|
||||||
if(defDurability > 0) {
|
if(defDurability > 0) {
|
||||||
builder.comment("Wand durability");
|
builder.comment("Wand durability");
|
||||||
|
@ -72,7 +75,7 @@ public class ConfigServer
|
||||||
upgradeable = builder.define("upgradeable", defUpgradeable);
|
upgradeable = builder.define("upgradeable", defUpgradeable);
|
||||||
builder.pop();
|
builder.pop();
|
||||||
|
|
||||||
wandProperties.put(wand, this);
|
wandProperties.put(registryName, this);
|
||||||
}
|
}
|
||||||
|
|
||||||
public int getDurability() {
|
public int getDurability() {
|
||||||
|
|
|
@ -160,7 +160,7 @@ public class WandUtil
|
||||||
List<ItemStack> inventory = WandUtil.getFullInv(player);
|
List<ItemStack> inventory = WandUtil.getFullInv(player);
|
||||||
|
|
||||||
for(ItemStack stack : inventory) {
|
for(ItemStack stack : inventory) {
|
||||||
if(stack == null) continue;
|
if(stack == null || stack.isEmpty()) continue;
|
||||||
|
|
||||||
if(WandUtil.stackEquals(stack, item)) {
|
if(WandUtil.stackEquals(stack, item)) {
|
||||||
total += stack.getCount();
|
total += stack.getCount();
|
||||||
|
|
|
@ -1,6 +1,8 @@
|
||||||
package thetadev.constructionwand.containers;
|
package thetadev.constructionwand.containers;
|
||||||
|
|
||||||
|
import net.minecraftforge.fml.ModList;
|
||||||
import thetadev.constructionwand.ConstructionWand;
|
import thetadev.constructionwand.ConstructionWand;
|
||||||
|
import thetadev.constructionwand.containers.handlers.HandlerBotania;
|
||||||
import thetadev.constructionwand.containers.handlers.HandlerBundle;
|
import thetadev.constructionwand.containers.handlers.HandlerBundle;
|
||||||
import thetadev.constructionwand.containers.handlers.HandlerCapability;
|
import thetadev.constructionwand.containers.handlers.HandlerCapability;
|
||||||
import thetadev.constructionwand.containers.handlers.HandlerShulkerbox;
|
import thetadev.constructionwand.containers.handlers.HandlerShulkerbox;
|
||||||
|
@ -12,13 +14,9 @@ public class ContainerRegistrar
|
||||||
ConstructionWand.instance.containerManager.register(new HandlerShulkerbox());
|
ConstructionWand.instance.containerManager.register(new HandlerShulkerbox());
|
||||||
ConstructionWand.instance.containerManager.register(new HandlerBundle());
|
ConstructionWand.instance.containerManager.register(new HandlerBundle());
|
||||||
|
|
||||||
/*
|
|
||||||
TODO: Reenable this when Botania gets ported to 1.17
|
|
||||||
|
|
||||||
if(ModList.get().isLoaded("botania")) {
|
if(ModList.get().isLoaded("botania")) {
|
||||||
ConstructionWand.instance.containerManager.register(new HandlerBotania());
|
ConstructionWand.instance.containerManager.register(new HandlerBotania());
|
||||||
ConstructionWand.LOGGER.info("Botania integration added");
|
ConstructionWand.LOGGER.info("Botania integration added");
|
||||||
}
|
}
|
||||||
*/
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -1,25 +1,28 @@
|
||||||
/*
|
|
||||||
TODO: Reenable this when Botania gets ported to 1.17
|
|
||||||
|
|
||||||
package thetadev.constructionwand.containers.handlers;
|
package thetadev.constructionwand.containers.handlers;
|
||||||
|
|
||||||
import net.minecraft.world.level.block.Block;
|
|
||||||
import net.minecraft.world.entity.player.Player;
|
import net.minecraft.world.entity.player.Player;
|
||||||
import net.minecraft.world.item.ItemStack;
|
import net.minecraft.world.item.ItemStack;
|
||||||
|
import net.minecraft.world.level.block.Block;
|
||||||
import thetadev.constructionwand.api.IContainerHandler;
|
import thetadev.constructionwand.api.IContainerHandler;
|
||||||
|
import vazkii.botania.api.BotaniaForgeCapabilities;
|
||||||
import vazkii.botania.api.item.IBlockProvider;
|
import vazkii.botania.api.item.IBlockProvider;
|
||||||
|
|
||||||
|
import java.util.Optional;
|
||||||
|
|
||||||
public class HandlerBotania implements IContainerHandler
|
public class HandlerBotania implements IContainerHandler
|
||||||
{
|
{
|
||||||
@Override
|
@Override
|
||||||
public boolean matches(Player player, ItemStack itemStack, ItemStack inventoryStack) {
|
public boolean matches(Player player, ItemStack itemStack, ItemStack inventoryStack) {
|
||||||
return inventoryStack != null && inventoryStack.getCount() == 1 && inventoryStack.getItem() instanceof IBlockProvider;
|
return inventoryStack != null && inventoryStack.getCapability(BotaniaForgeCapabilities.BLOCK_PROVIDER).isPresent();
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public int countItems(Player player, ItemStack itemStack, ItemStack inventoryStack) {
|
public int countItems(Player player, ItemStack itemStack, ItemStack inventoryStack) {
|
||||||
IBlockProvider prov = (IBlockProvider) inventoryStack.getItem();
|
Optional<IBlockProvider> provOptional = inventoryStack.getCapability(BotaniaForgeCapabilities.BLOCK_PROVIDER).resolve();
|
||||||
int provCount = prov.getBlockCount(player, itemStack, inventoryStack, Block.byItem(itemStack.getItem()));
|
if(provOptional.isEmpty()) return 0;
|
||||||
|
|
||||||
|
IBlockProvider prov = provOptional.get();
|
||||||
|
int provCount = prov.getBlockCount(player, inventoryStack, Block.byItem(itemStack.getItem()));
|
||||||
if(provCount == -1)
|
if(provCount == -1)
|
||||||
return Integer.MAX_VALUE;
|
return Integer.MAX_VALUE;
|
||||||
return provCount;
|
return provCount;
|
||||||
|
@ -27,10 +30,12 @@ public class HandlerBotania implements IContainerHandler
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public int useItems(Player player, ItemStack itemStack, ItemStack inventoryStack, int count) {
|
public int useItems(Player player, ItemStack itemStack, ItemStack inventoryStack, int count) {
|
||||||
IBlockProvider prov = (IBlockProvider) inventoryStack.getItem();
|
Optional<IBlockProvider> provOptional = inventoryStack.getCapability(BotaniaForgeCapabilities.BLOCK_PROVIDER).resolve();
|
||||||
if(prov.provideBlock(player, itemStack, inventoryStack, Block.byItem(itemStack.getItem()), true))
|
if(provOptional.isEmpty()) return 0;
|
||||||
|
|
||||||
|
IBlockProvider prov = provOptional.get();
|
||||||
|
if(prov.provideBlock(player, inventoryStack, Block.byItem(itemStack.getItem()), true))
|
||||||
return 0;
|
return 0;
|
||||||
return count;
|
return count;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
*/
|
|
|
@ -1,7 +1,7 @@
|
||||||
package thetadev.constructionwand.data;
|
package thetadev.constructionwand.data;
|
||||||
|
|
||||||
import net.minecraft.advancements.critereon.ItemPredicate;
|
import net.minecraft.advancements.critereon.ItemPredicate;
|
||||||
import net.minecraft.tags.Tag;
|
import net.minecraft.tags.TagKey;
|
||||||
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;
|
||||||
|
@ -22,7 +22,7 @@ public class Inp
|
||||||
return new Inp(in.asItem().getRegistryName().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(Tag.Named<Item> in) {
|
public static Inp fromTag(TagKey<Item> in) {
|
||||||
return new Inp(in.getName().getPath(), Ingredient.of(in), ItemPredicate.Builder.item().of(in).build());
|
return new Inp(in.location().getPath(), Ingredient.of(in), ItemPredicate.Builder.item().of(in).build());
|
||||||
}
|
}
|
||||||
}
|
}
|
|
@ -5,6 +5,7 @@ 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.RegistryObject;
|
||||||
import thetadev.constructionwand.ConstructionWand;
|
import thetadev.constructionwand.ConstructionWand;
|
||||||
import thetadev.constructionwand.items.ModItems;
|
import thetadev.constructionwand.items.ModItems;
|
||||||
|
|
||||||
|
@ -18,7 +19,8 @@ public class ItemModelGenerator extends ItemModelProvider
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
protected void registerModels() {
|
protected void registerModels() {
|
||||||
for(Item item : ModItems.ALL_ITEMS) {
|
for(RegistryObject<Item> itemObject : ModItems.ITEMS.getEntries()) {
|
||||||
|
Item item = itemObject.get();
|
||||||
String name = item.getRegistryName().getPath();
|
String name = item.getRegistryName().getPath();
|
||||||
|
|
||||||
if(item instanceof ICustomItemModel)
|
if(item instanceof ICustomItemModel)
|
||||||
|
|
|
@ -27,13 +27,13 @@ public class RecipeGenerator extends RecipeProvider
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
protected void buildCraftingRecipes(@Nonnull Consumer<FinishedRecipe> consumer) {
|
protected void buildCraftingRecipes(@Nonnull Consumer<FinishedRecipe> consumer) {
|
||||||
wandRecipe(consumer, ModItems.WAND_STONE, Inp.fromTag(ItemTags.STONE_TOOL_MATERIALS));
|
wandRecipe(consumer, ModItems.WAND_STONE.get(), Inp.fromTag(ItemTags.STONE_TOOL_MATERIALS));
|
||||||
wandRecipe(consumer, ModItems.WAND_IRON, Inp.fromTag(Tags.Items.INGOTS_IRON));
|
wandRecipe(consumer, ModItems.WAND_IRON.get(), Inp.fromTag(Tags.Items.INGOTS_IRON));
|
||||||
wandRecipe(consumer, ModItems.WAND_DIAMOND, Inp.fromTag(Tags.Items.GEMS_DIAMOND));
|
wandRecipe(consumer, ModItems.WAND_DIAMOND.get(), Inp.fromTag(Tags.Items.GEMS_DIAMOND));
|
||||||
wandRecipe(consumer, ModItems.WAND_INFINITY, Inp.fromTag(Tags.Items.NETHER_STARS));
|
wandRecipe(consumer, ModItems.WAND_INFINITY.get(), Inp.fromTag(Tags.Items.NETHER_STARS));
|
||||||
|
|
||||||
coreRecipe(consumer, ModItems.CORE_ANGEL, Inp.fromTag(Tags.Items.FEATHERS), Inp.fromTag(Tags.Items.INGOTS_GOLD));
|
coreRecipe(consumer, ModItems.CORE_ANGEL.get(), Inp.fromTag(Tags.Items.FEATHERS), Inp.fromTag(Tags.Items.INGOTS_GOLD));
|
||||||
coreRecipe(consumer, ModItems.CORE_DESTRUCTION, Inp.fromTag(Tags.Items.STORAGE_BLOCKS_DIAMOND), Inp.fromItem(Items.DIAMOND_PICKAXE));
|
coreRecipe(consumer, ModItems.CORE_DESTRUCTION.get(), Inp.fromTag(Tags.Items.STORAGE_BLOCKS_DIAMOND), Inp.fromItem(Items.DIAMOND_PICKAXE));
|
||||||
|
|
||||||
specialRecipe(consumer, RecipeWandUpgrade.SERIALIZER);
|
specialRecipe(consumer, RecipeWandUpgrade.SERIALIZER);
|
||||||
}
|
}
|
||||||
|
|
|
@ -11,6 +11,7 @@ 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.RegistryObject;
|
||||||
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;
|
||||||
|
@ -43,10 +44,11 @@ public class ConstructionWandJeiPlugin implements IModPlugin
|
||||||
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);
|
||||||
|
|
||||||
for(Item wand : ModItems.WANDS) {
|
for(RegistryObject<Item> wandSupplier : ModItems.WANDS) {
|
||||||
|
Item wand = wandSupplier.get();
|
||||||
ConfigServer.WandProperties wandProperties = ConfigServer.getWandProperties(wand);
|
ConfigServer.WandProperties wandProperties = ConfigServer.getWandProperties(wand);
|
||||||
|
|
||||||
String durabilityKey = wand == ModItems.WAND_INFINITY ? "unlimited" : "limited";
|
String durabilityKey = wand == ModItems.WAND_INFINITY.get() ? "unlimited" : "limited";
|
||||||
Component durabilityComponent = new TranslatableComponent(baseKey + "durability." + durabilityKey, wandProperties.getDurability());
|
Component durabilityComponent = new TranslatableComponent(baseKey + "durability." + durabilityKey, wandProperties.getDurability());
|
||||||
|
|
||||||
registration.addIngredientInfo(new ItemStack(wand), VanillaTypes.ITEM,
|
registration.addIngredientInfo(new ItemStack(wand), VanillaTypes.ITEM,
|
||||||
|
@ -57,7 +59,8 @@ public class ConstructionWandJeiPlugin implements IModPlugin
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
for(Item core : ModItems.CORES) {
|
for(RegistryObject<Item> coreSupplier : ModItems.CORES) {
|
||||||
|
Item core = coreSupplier.get();
|
||||||
registration.addIngredientInfo(new ItemStack(core), VanillaTypes.ITEM,
|
registration.addIngredientInfo(new ItemStack(core), VanillaTypes.ITEM,
|
||||||
new TranslatableComponent(baseKey + core.getRegistryName().getPath()),
|
new TranslatableComponent(baseKey + core.getRegistryName().getPath()),
|
||||||
new TranslatableComponent(baseKey + "core", wandModeComponent)
|
new TranslatableComponent(baseKey + "core", wandModeComponent)
|
||||||
|
|
|
@ -1,12 +0,0 @@
|
||||||
package thetadev.constructionwand.items;
|
|
||||||
|
|
||||||
import net.minecraft.world.item.Item;
|
|
||||||
import thetadev.constructionwand.ConstructionWand;
|
|
||||||
|
|
||||||
public class ItemBase extends Item
|
|
||||||
{
|
|
||||||
public ItemBase(String name, Properties properties) {
|
|
||||||
super(properties);
|
|
||||||
setRegistryName(ConstructionWand.MODID, name);
|
|
||||||
}
|
|
||||||
}
|
|
|
@ -12,8 +12,11 @@ import net.minecraftforge.api.distmarker.OnlyIn;
|
||||||
import net.minecraftforge.event.RegistryEvent;
|
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.ForgeRegistries;
|
||||||
import net.minecraftforge.registries.IForgeRegistry;
|
import net.minecraftforge.registries.IForgeRegistry;
|
||||||
import net.minecraftforge.registries.IForgeRegistryEntry;
|
import net.minecraftforge.registries.IForgeRegistryEntry;
|
||||||
|
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;
|
||||||
|
@ -23,38 +26,24 @@ import thetadev.constructionwand.items.wand.ItemWand;
|
||||||
import thetadev.constructionwand.items.wand.ItemWandBasic;
|
import thetadev.constructionwand.items.wand.ItemWandBasic;
|
||||||
import thetadev.constructionwand.items.wand.ItemWandInfinity;
|
import thetadev.constructionwand.items.wand.ItemWandInfinity;
|
||||||
|
|
||||||
import java.util.Arrays;
|
|
||||||
import java.util.HashSet;
|
|
||||||
|
|
||||||
@Mod.EventBusSubscriber(modid = ConstructionWand.MODID, bus = Mod.EventBusSubscriber.Bus.MOD)
|
@Mod.EventBusSubscriber(modid = ConstructionWand.MODID, bus = Mod.EventBusSubscriber.Bus.MOD)
|
||||||
public class ModItems
|
public class ModItems
|
||||||
{
|
{
|
||||||
|
public static final DeferredRegister<Item> ITEMS = DeferredRegister.create(ForgeRegistries.ITEMS, ConstructionWand.MODID);
|
||||||
|
|
||||||
// Wands
|
// Wands
|
||||||
public static final Item WAND_STONE = new ItemWandBasic("stone_wand", propWand(), Tiers.STONE);
|
public static final RegistryObject<Item> WAND_STONE = ITEMS.register("stone_wand", () -> new ItemWandBasic(propWand(), Tiers.STONE));
|
||||||
public static final Item WAND_IRON = new ItemWandBasic("iron_wand", propWand(), Tiers.IRON);
|
public static final RegistryObject<Item> WAND_IRON = ITEMS.register("iron_wand", () -> new ItemWandBasic(propWand(), Tiers.IRON));
|
||||||
public static final Item WAND_DIAMOND = new ItemWandBasic("diamond_wand", propWand(), Tiers.DIAMOND);
|
public static final RegistryObject<Item> WAND_DIAMOND = ITEMS.register("diamond_wand", () -> new ItemWandBasic(propWand(), Tiers.DIAMOND));
|
||||||
public static final Item WAND_INFINITY = new ItemWandInfinity("infinity_wand", propWand());
|
public static final RegistryObject<Item> WAND_INFINITY = ITEMS.register("infinity_wand", () -> new ItemWandInfinity(propWand()));
|
||||||
|
|
||||||
// Cores
|
// Cores
|
||||||
public static final Item CORE_ANGEL = new ItemCoreAngel("core_angel", propUpgrade());
|
public static final RegistryObject<Item> CORE_ANGEL = ITEMS.register("core_angel", () -> new ItemCoreAngel(propUpgrade()));
|
||||||
public static final Item CORE_DESTRUCTION = new ItemCoreDestruction("core_destruction", propUpgrade());
|
public static final RegistryObject<Item> CORE_DESTRUCTION = ITEMS.register("core_destruction", () -> new ItemCoreDestruction(propUpgrade()));
|
||||||
|
|
||||||
// Collections
|
// Collections
|
||||||
public static final Item[] WANDS = {WAND_STONE, WAND_IRON, WAND_DIAMOND, WAND_INFINITY};
|
public static final RegistryObject<Item>[] WANDS = new RegistryObject[] {WAND_STONE, WAND_IRON, WAND_DIAMOND, WAND_INFINITY};
|
||||||
public static final Item[] CORES = {CORE_ANGEL, CORE_DESTRUCTION};
|
public static final RegistryObject<Item>[] CORES = new RegistryObject[] {CORE_ANGEL, CORE_DESTRUCTION};
|
||||||
public static final HashSet<Item> ALL_ITEMS = new HashSet<>();
|
|
||||||
|
|
||||||
|
|
||||||
@SubscribeEvent
|
|
||||||
public static void registerItems(RegistryEvent.Register<Item> event) {
|
|
||||||
IForgeRegistry<Item> r = event.getRegistry();
|
|
||||||
|
|
||||||
r.registerAll(WANDS);
|
|
||||||
ALL_ITEMS.addAll(Arrays.asList(WANDS));
|
|
||||||
|
|
||||||
registerItem(r, CORE_ANGEL);
|
|
||||||
registerItem(r, CORE_DESTRUCTION);
|
|
||||||
}
|
|
||||||
|
|
||||||
public static Item.Properties propWand() {
|
public static Item.Properties propWand() {
|
||||||
return new Item.Properties().tab(CreativeModeTab.TAB_TOOLS);
|
return new Item.Properties().tab(CreativeModeTab.TAB_TOOLS);
|
||||||
|
@ -64,11 +53,6 @@ public class ModItems
|
||||||
return new Item.Properties().tab(CreativeModeTab.TAB_MISC).stacksTo(1);
|
return new Item.Properties().tab(CreativeModeTab.TAB_MISC).stacksTo(1);
|
||||||
}
|
}
|
||||||
|
|
||||||
private static void registerItem(IForgeRegistry<Item> reg, Item item) {
|
|
||||||
reg.register(item);
|
|
||||||
ALL_ITEMS.add(item);
|
|
||||||
}
|
|
||||||
|
|
||||||
@SubscribeEvent
|
@SubscribeEvent
|
||||||
public static void registerRecipeSerializers(RegistryEvent.Register<RecipeSerializer<?>> event) {
|
public static void registerRecipeSerializers(RegistryEvent.Register<RecipeSerializer<?>> event) {
|
||||||
IForgeRegistry<RecipeSerializer<?>> r = event.getRegistry();
|
IForgeRegistry<RecipeSerializer<?>> r = event.getRegistry();
|
||||||
|
@ -77,7 +61,8 @@ public class ModItems
|
||||||
|
|
||||||
@OnlyIn(Dist.CLIENT)
|
@OnlyIn(Dist.CLIENT)
|
||||||
public static void registerModelProperties() {
|
public static void registerModelProperties() {
|
||||||
for(Item item : WANDS) {
|
for(RegistryObject<Item> itemSupplier : WANDS) {
|
||||||
|
Item item = itemSupplier.get();
|
||||||
ItemProperties.register(
|
ItemProperties.register(
|
||||||
item, ConstructionWand.loc("using_core"),
|
item, ConstructionWand.loc("using_core"),
|
||||||
(stack, world, entity, n) -> entity == null || !(stack.getItem() instanceof ItemWand) ? 0 :
|
(stack, world, entity, n) -> entity == null || !(stack.getItem() instanceof ItemWand) ? 0 :
|
||||||
|
@ -90,7 +75,8 @@ public class ModItems
|
||||||
public static void registerItemColors() {
|
public static void registerItemColors() {
|
||||||
ItemColors colors = Minecraft.getInstance().getItemColors();
|
ItemColors colors = Minecraft.getInstance().getItemColors();
|
||||||
|
|
||||||
for(Item item : WANDS) {
|
for(RegistryObject<Item> itemSupplier : WANDS) {
|
||||||
|
Item item = itemSupplier.get();
|
||||||
colors.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);
|
||||||
}
|
}
|
||||||
|
|
|
@ -3,6 +3,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.network.chat.TranslatableComponent;
|
||||||
|
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;
|
||||||
import net.minecraft.world.level.Level;
|
import net.minecraft.world.level.Level;
|
||||||
|
@ -10,15 +11,14 @@ import net.minecraftforge.api.distmarker.Dist;
|
||||||
import net.minecraftforge.api.distmarker.OnlyIn;
|
import net.minecraftforge.api.distmarker.OnlyIn;
|
||||||
import thetadev.constructionwand.ConstructionWand;
|
import thetadev.constructionwand.ConstructionWand;
|
||||||
import thetadev.constructionwand.api.IWandCore;
|
import thetadev.constructionwand.api.IWandCore;
|
||||||
import thetadev.constructionwand.items.ItemBase;
|
|
||||||
|
|
||||||
import javax.annotation.Nonnull;
|
import javax.annotation.Nonnull;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
|
|
||||||
public abstract class ItemCore extends ItemBase implements IWandCore
|
public abstract class ItemCore extends Item implements IWandCore
|
||||||
{
|
{
|
||||||
public ItemCore(String name, Properties properties) {
|
public ItemCore(Properties properties) {
|
||||||
super(name, properties);
|
super(properties);
|
||||||
}
|
}
|
||||||
|
|
||||||
@OnlyIn(Dist.CLIENT)
|
@OnlyIn(Dist.CLIENT)
|
||||||
|
|
|
@ -5,8 +5,8 @@ import thetadev.constructionwand.wand.action.ActionAngel;
|
||||||
|
|
||||||
public class ItemCoreAngel extends ItemCore
|
public class ItemCoreAngel extends ItemCore
|
||||||
{
|
{
|
||||||
public ItemCoreAngel(String name, Properties properties) {
|
public ItemCoreAngel(Properties properties) {
|
||||||
super(name, properties);
|
super(properties);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
|
|
@ -5,8 +5,8 @@ import thetadev.constructionwand.wand.action.ActionDestruction;
|
||||||
|
|
||||||
public class ItemCoreDestruction extends ItemCore
|
public class ItemCoreDestruction extends ItemCore
|
||||||
{
|
{
|
||||||
public ItemCoreDestruction(String name, Properties properties) {
|
public ItemCoreDestruction(Properties properties) {
|
||||||
super(name, properties);
|
super(properties);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
|
|
@ -9,6 +9,7 @@ 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;
|
||||||
import net.minecraft.world.entity.player.Player;
|
import net.minecraft.world.entity.player.Player;
|
||||||
|
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;
|
||||||
import net.minecraft.world.item.context.UseOnContext;
|
import net.minecraft.world.item.context.UseOnContext;
|
||||||
|
@ -25,17 +26,16 @@ import thetadev.constructionwand.basics.option.IOption;
|
||||||
import thetadev.constructionwand.basics.option.WandOptions;
|
import thetadev.constructionwand.basics.option.WandOptions;
|
||||||
import thetadev.constructionwand.data.ICustomItemModel;
|
import thetadev.constructionwand.data.ICustomItemModel;
|
||||||
import thetadev.constructionwand.data.ItemModelGenerator;
|
import thetadev.constructionwand.data.ItemModelGenerator;
|
||||||
import thetadev.constructionwand.items.ItemBase;
|
|
||||||
import thetadev.constructionwand.wand.WandJob;
|
import thetadev.constructionwand.wand.WandJob;
|
||||||
|
|
||||||
import javax.annotation.Nonnull;
|
import javax.annotation.Nonnull;
|
||||||
import javax.annotation.Nullable;
|
import javax.annotation.Nullable;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
|
|
||||||
public abstract class ItemWand extends ItemBase implements ICustomItemModel
|
public abstract class ItemWand extends Item implements ICustomItemModel
|
||||||
{
|
{
|
||||||
public ItemWand(String name, Properties properties) {
|
public ItemWand(Properties properties) {
|
||||||
super(name, properties);
|
super(properties);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Nonnull
|
@Nonnull
|
||||||
|
|
|
@ -10,8 +10,8 @@ public class ItemWandBasic extends ItemWand
|
||||||
{
|
{
|
||||||
private final Tier tier;
|
private final Tier tier;
|
||||||
|
|
||||||
public ItemWandBasic(String name, Properties properties, Tier tier) {
|
public ItemWandBasic(Properties properties, Tier tier) {
|
||||||
super(name, properties.durability(tier.getUses()));
|
super(properties.durability(tier.getUses()));
|
||||||
this.tier = tier;
|
this.tier = tier;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -3,7 +3,7 @@ package thetadev.constructionwand.items.wand;
|
||||||
|
|
||||||
public class ItemWandInfinity extends ItemWand
|
public class ItemWandInfinity extends ItemWand
|
||||||
{
|
{
|
||||||
public ItemWandInfinity(String name, Properties properties) {
|
public ItemWandInfinity(Properties properties) {
|
||||||
super(name, properties.stacksTo(1).fireResistant());
|
super(properties.stacksTo(1).fireResistant());
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -74,7 +74,7 @@ public class WandJob
|
||||||
public void getSnapshots() {
|
public void getSnapshots() {
|
||||||
int limit;
|
int limit;
|
||||||
// Infinity wand gets enhanced limit in creative mode
|
// Infinity wand gets enhanced limit in creative mode
|
||||||
if(player.isCreative() && wandItem == ModItems.WAND_INFINITY) limit = ConfigServer.LIMIT_CREATIVE.get();
|
if(player.isCreative() && wandItem == ModItems.WAND_INFINITY.get()) limit = ConfigServer.LIMIT_CREATIVE.get();
|
||||||
else limit = Math.min(wandItem.remainingDurability(wand), wandAction.getLimit(wand));
|
else limit = Math.min(wandItem.remainingDurability(wand), wandAction.getLimit(wand));
|
||||||
|
|
||||||
if(rayTraceResult.getType() == HitResult.Type.BLOCK)
|
if(rayTraceResult.getType() == HitResult.Type.BLOCK)
|
||||||
|
|
|
@ -1,5 +1,5 @@
|
||||||
modLoader = "javafml"
|
modLoader = "javafml"
|
||||||
loaderVersion = "[38,)"
|
loaderVersion = "[40,)"
|
||||||
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 = "[38,)"
|
versionRange = "[40,)"
|
||||||
ordering = "NONE"
|
ordering = "NONE"
|
||||||
side="BOTH"
|
side="BOTH"
|
||||||
[[dependencies.constructionwand]]
|
[[dependencies.constructionwand]]
|
||||||
modId="minecraft"
|
modId="minecraft"
|
||||||
mandatory = true
|
mandatory = true
|
||||||
versionRange = "[1.18, 1.19)"
|
versionRange = "[1.18.2, 1.19)"
|
||||||
ordering = "NONE"
|
ordering = "NONE"
|
||||||
side="BOTH"
|
side="BOTH"
|
||||||
|
|
|
@ -1,6 +1,6 @@
|
||||||
{
|
{
|
||||||
"pack": {
|
"pack": {
|
||||||
"description": "ConstructionWand resources",
|
"description": "ConstructionWand resources",
|
||||||
"pack_format": 8
|
"pack_format": 9
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
Loading…
Add table
Reference in a new issue