Compare commits
9 Commits
Author | SHA1 | Date | |
---|---|---|---|
493d9f46e1 | |||
3fbb838550 | |||
3d74cf7a7b | |||
e1eef02be4 | |||
897c1e5975 | |||
5094c033a3 | |||
05c1bf8029 | |||
db1d4b2df2 | |||
8f0c9fdf56 |
22
README.md
22
README.md
@ -2,19 +2,25 @@
|
|||||||
Started as a Fabric port of [structure-item-mod](https://github.com/QuImUfu/structure-item-mod).
|
Started as a Fabric port of [structure-item-mod](https://github.com/QuImUfu/structure-item-mod).
|
||||||
Currently, the only supported version of the mod
|
Currently, the only supported version of the mod
|
||||||
|
|
||||||
## Example Usage
|
Usage:
|
||||||
|
-------
|
||||||
|
This is an item capable of placing structures on right click:
|
||||||
```
|
```
|
||||||
/give User structure_item:item{offset: [I; 0, 5, 0],structure: "structure:mine",allowedOn: "minecraft:stone",blacklist:["minecraft:bedrock"], replaceEntities:0, placeEntities:0} 1
|
structure_item:item{offset:{X:0,Y:5,Z:0},structure:"structure:mine",allowedOn:"minecraft:stone",blacklist:["minecraft:bedrock"],replaceEntities:0,placeEntities:0}
|
||||||
```
|
```
|
||||||
And tada, you have an item capable of placing structures on right click.
|
If the clicked block is Stone, no Bedrock and no entity is in the way, it will place the structure "structure:mine" excluding (potentially) saved Entities moved up by 5 blocks. (The low coordinate corner will start 5 blocks above the block you would have placed if this item were a block).
|
||||||
If the clicked block is Stone and neither Diamond blocks nor Bedrock is in the way, it will place the structure "structure:mine" moved up by 5 blocks. (The low coordinate corner will start 5 blocks above the block you would have placed if this item were a block). Blocks (non structure voids) delete intersecting entities.
|
|
||||||
If you leave out "structure", it won't work.
|
If you leave out "structure", it won't work.
|
||||||
If you leave out "offset", it will place the structure at the block you clicked at, expanding in your view direction, up and to both sides. if you look up or down, it'll place the structure centered above or below the block you clicked at.
|
If you leave out "offset", it will place the structure at the block you clicked at, expanding in your view direction, up and to both sides. if you look up or down, it'll place the structure centred above or below the block you clicked at.
|
||||||
If you leave out "blacklist", it will replace anything.
|
If you leave out "blacklist", it will replace anything.
|
||||||
If you leave out "allowedOn", it will allow "placement" on any block.
|
If you leave out "allowedOn", it will allow "placement" on any block.
|
||||||
If you leave out "replaceEntities" or set it to 1, entities in the way will be deleted.
|
If you leave out "replaceEntities" or set it to 1, it will allow placement even if non player entities are in the way of blocks (non structure voids). Those will get deleted.
|
||||||
If you leave out "placeEntities" or set it to 1, entities saved in the structure will be placed.
|
If you leave out "placeEntities" or set it to 1, entities saved in the structure will be placed.
|
||||||
|
|
||||||
Any errors made by the creators will be displayed in chat, any errors made by the user will produce a fat massage in the middle of the screen.
|
Error handling:
|
||||||
|
---------------
|
||||||
|
Errors made by the items' creator will be displayed in Chat, any errors made by the user will produce a fat massage in the middle of the screen.
|
||||||
|
|
||||||
If you use this mod, you may want to change the model of the item (currently = stick) and fix the language file.
|
Model & Localization:
|
||||||
|
---------------------
|
||||||
|
If you use this mod, you may want to change the model of the item (currently = stick) and edit the language file.
|
91
build.gradle
91
build.gradle
@ -1,79 +1,92 @@
|
|||||||
plugins {
|
plugins {
|
||||||
id 'fabric-loom' version '0.6-SNAPSHOT'
|
id "com.modrinth.minotaur" version "2.+"
|
||||||
|
id 'fabric-loom' version '1.9-SNAPSHOT'
|
||||||
id 'maven-publish'
|
id 'maven-publish'
|
||||||
}
|
}
|
||||||
|
|
||||||
sourceCompatibility = JavaVersion.VERSION_1_8
|
|
||||||
targetCompatibility = JavaVersion.VERSION_1_8
|
|
||||||
|
|
||||||
archivesBaseName = project.archives_base_name
|
|
||||||
version = project.mod_version
|
version = project.mod_version
|
||||||
group = project.maven_group
|
group = project.maven_group
|
||||||
|
|
||||||
minecraft {
|
base {
|
||||||
|
archivesName = project.archives_base_name
|
||||||
|
}
|
||||||
|
|
||||||
|
repositories {
|
||||||
|
// Add repositories to retrieve artifacts from in here.
|
||||||
|
// You should only use this when depending on other mods because
|
||||||
|
// Loom adds the essential maven repositories to download Minecraft and libraries from automatically.
|
||||||
|
// See https://docs.gradle.org/current/userguide/declaring_repositories.html
|
||||||
|
// for more information about repositories.
|
||||||
|
mavenCentral()
|
||||||
}
|
}
|
||||||
|
|
||||||
dependencies {
|
dependencies {
|
||||||
//to change the versions see the gradle.properties file
|
// To change the versions see the gradle.properties file
|
||||||
minecraft "com.mojang:minecraft:${project.minecraft_version}"
|
minecraft "com.mojang:minecraft:${project.minecraft_version}"
|
||||||
mappings "net.fabricmc:yarn:${project.yarn_mappings}:v2"
|
mappings "net.fabricmc:yarn:${project.yarn_mappings}:v2"
|
||||||
modImplementation "net.fabricmc:fabric-loader:${project.loader_version}"
|
modImplementation "net.fabricmc:fabric-loader:${project.loader_version}"
|
||||||
|
|
||||||
|
// Fabric API. This is technically optional, but you probably want it anyway.
|
||||||
modImplementation "net.fabricmc.fabric-api:fabric-api:${project.fabric_version}"
|
modImplementation "net.fabricmc.fabric-api:fabric-api:${project.fabric_version}"
|
||||||
|
|
||||||
|
// Uncomment the following line to enable the deprecated Fabric API modules.
|
||||||
|
// These are included in the Fabric API production distribution and allow you to update your mod to the latest modules at a later more convenient time.
|
||||||
|
include 'net.objecthunter:exp4j:0.4.8'
|
||||||
|
implementation 'net.objecthunter:exp4j:0.4.8'
|
||||||
|
// modImplementation "net.fabricmc.fabric-api:fabric-api-deprecated:${project.fabric_version}"
|
||||||
}
|
}
|
||||||
|
|
||||||
processResources {
|
processResources {
|
||||||
inputs.property "version", project.version
|
inputs.property "version", project.version
|
||||||
|
|
||||||
from(sourceSets.main.resources.srcDirs) {
|
filesMatching("fabric.mod.json") {
|
||||||
include "fabric.mod.json"
|
|
||||||
expand "version": project.version
|
expand "version": project.version
|
||||||
}
|
}
|
||||||
|
|
||||||
from(sourceSets.main.resources.srcDirs) {
|
|
||||||
exclude "fabric.mod.json"
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
// ensure that the encoding is set to UTF-8, no matter what the system default is
|
tasks.withType(JavaCompile).configureEach {
|
||||||
// this fixes some edge cases with special characters not displaying correctly
|
it.options.release = 21
|
||||||
// see http://yodaconditions.net/blog/fix-for-java-file-encoding-problems-with-gradle.html
|
|
||||||
tasks.withType(JavaCompile) {
|
|
||||||
options.encoding = "UTF-8"
|
|
||||||
}
|
}
|
||||||
|
|
||||||
// Loom will automatically attach sourcesJar to a RemapSourcesJar task and to the "build" task
|
java {
|
||||||
// if it is present.
|
// Loom will automatically attach sourcesJar to a RemapSourcesJar task and to the "build" task
|
||||||
// If you remove this task, sources will not be generated.
|
// if it is present.
|
||||||
task sourcesJar(type: Jar, dependsOn: classes) {
|
// If you remove this line, sources will not be generated.
|
||||||
classifier = "sources"
|
withSourcesJar()
|
||||||
from sourceSets.main.allSource
|
|
||||||
|
sourceCompatibility = JavaVersion.VERSION_21
|
||||||
|
targetCompatibility = JavaVersion.VERSION_21
|
||||||
}
|
}
|
||||||
|
|
||||||
jar {
|
jar {
|
||||||
from "LICENSE"
|
from("LICENSE") {
|
||||||
|
rename { "${it}_${project.archivesBaseName}"}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
import com.modrinth.minotaur.dependencies.ModDependency
|
||||||
|
|
||||||
|
modrinth {
|
||||||
|
projectId = 'lwR0Ovmu' // The ID of your Modrinth project. Slugs will not work.
|
||||||
|
uploadFile = remapJar // Tells Minotaur to use the remapped jar
|
||||||
|
versionType = "beta"
|
||||||
|
dependencies = [
|
||||||
|
new ModDependency('P7dR8mSH', 'required'), //required dependency on Fabric API
|
||||||
|
]
|
||||||
|
}
|
||||||
// configure the maven publication
|
// configure the maven publication
|
||||||
publishing {
|
publishing {
|
||||||
publications {
|
publications {
|
||||||
mavenJava(MavenPublication) {
|
mavenJava(MavenPublication) {
|
||||||
// add all the jars that should be included when publishing to maven
|
from components.java
|
||||||
artifact(jar) {
|
|
||||||
builtBy remapJar
|
|
||||||
}
|
|
||||||
artifact("${project.buildDir.absolutePath}/libs/${archivesBaseName}-${project.version}.jar"){
|
|
||||||
builtBy remapJar
|
|
||||||
}
|
|
||||||
artifact(sourcesJar) {
|
|
||||||
builtBy remapSourcesJar
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// select the repositories you want to publish to
|
// See https://docs.gradle.org/current/userguide/publishing_maven.html for information on how to set up publishing.
|
||||||
repositories {
|
repositories {
|
||||||
// uncomment to publish to the local maven
|
// Add repositories to publish to here.
|
||||||
// mavenLocal()
|
// Notice: This block does NOT have the same function as the block in the top level.
|
||||||
|
// The repositories here will be used for publishing your artifact, not for
|
||||||
|
// retrieving dependencies.
|
||||||
}
|
}
|
||||||
}
|
}
|
@ -1,15 +1,15 @@
|
|||||||
org.gradle.jvmargs = -Xmx1G
|
org.gradle.jvmargs = -Xmx1G
|
||||||
|
|
||||||
#Fabric properties
|
#Fabric properties
|
||||||
minecraft_version=1.16.5
|
minecraft_version=1.21.4
|
||||||
yarn_mappings=1.16.5+build.6
|
yarn_mappings=1.21.4+build.7
|
||||||
loader_version=0.11.3
|
loader_version=0.16.9
|
||||||
|
|
||||||
#Fabric api
|
# Fabric API
|
||||||
fabric_version=0.32.5+1.16
|
fabric_version=0.114.0+1.21.4
|
||||||
|
|
||||||
#Mod properties
|
#Mod properties
|
||||||
mod_version = 0.8.1
|
mod_version = 0.9.7
|
||||||
maven_group = quimufu.structure_item
|
maven_group = quimufu.structure_item
|
||||||
archives_base_name = structure_item
|
archives_base_name = structure_item
|
||||||
|
|
||||||
|
BIN
gradle/wrapper/gradle-wrapper.jar
vendored
BIN
gradle/wrapper/gradle-wrapper.jar
vendored
Binary file not shown.
4
gradle/wrapper/gradle-wrapper.properties
vendored
4
gradle/wrapper/gradle-wrapper.properties
vendored
@ -1,5 +1,7 @@
|
|||||||
distributionBase=GRADLE_USER_HOME
|
distributionBase=GRADLE_USER_HOME
|
||||||
distributionPath=wrapper/dists
|
distributionPath=wrapper/dists
|
||||||
distributionUrl=https\://services.gradle.org/distributions/gradle-5.5.1-bin.zip
|
distributionUrl=https\://services.gradle.org/distributions/gradle-8.12-bin.zip
|
||||||
|
networkTimeout=10000
|
||||||
|
validateDistributionUrl=true
|
||||||
zipStoreBase=GRADLE_USER_HOME
|
zipStoreBase=GRADLE_USER_HOME
|
||||||
zipStorePath=wrapper/dists
|
zipStorePath=wrapper/dists
|
||||||
|
298
gradlew
vendored
298
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.
|
||||||
@ -15,80 +15,116 @@
|
|||||||
# See the License for the specific language governing permissions and
|
# See the License for the specific language governing permissions and
|
||||||
# limitations under the License.
|
# limitations under the License.
|
||||||
#
|
#
|
||||||
|
# SPDX-License-Identifier: Apache-2.0
|
||||||
|
#
|
||||||
|
|
||||||
##############################################################################
|
##############################################################################
|
||||||
##
|
#
|
||||||
## 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/HEAD/platforms/jvm/plugins-application/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="`pwd -P`"
|
|
||||||
cd "$SAVED" >/dev/null
|
|
||||||
|
|
||||||
APP_NAME="Gradle"
|
# This is normally unused
|
||||||
APP_BASE_NAME=`basename "$0"`
|
# shellcheck disable=SC2034
|
||||||
|
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.
|
# Discard cd standard output in case $CDPATH is set (https://github.com/gradle/gradle/issues/25036)
|
||||||
DEFAULT_JVM_OPTS='"-Xmx64m" "-Xms64m"'
|
APP_HOME=$( cd -P "${APP_HOME:-./}" > /dev/null && printf '%s
|
||||||
|
' "$PWD" ) || exit
|
||||||
|
|
||||||
# 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
|
|
||||||
;;
|
|
||||||
MINGW* )
|
|
||||||
msys=true
|
|
||||||
;;
|
|
||||||
NONSTOP* )
|
|
||||||
nonstop=true
|
|
||||||
;;
|
|
||||||
esac
|
esac
|
||||||
|
|
||||||
CLASSPATH=$APP_HOME/gradle/wrapper/gradle-wrapper.jar
|
CLASSPATH=$APP_HOME/gradle/wrapper/gradle-wrapper.jar
|
||||||
|
|
||||||
|
|
||||||
# Determine the Java command to use to start the JVM.
|
# Determine the Java command to use to start the JVM.
|
||||||
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
|
||||||
@ -97,92 +133,120 @@ 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.
|
if ! command -v java >/dev/null 2>&1
|
||||||
|
then
|
||||||
|
die "ERROR: JAVA_HOME is not set and no 'java' command could be found in your PATH.
|
||||||
|
|
||||||
Please set the JAVA_HOME variable in your environment to match the
|
Please set the JAVA_HOME variable in your environment to match the
|
||||||
location of your Java installation."
|
location of your Java installation."
|
||||||
|
fi
|
||||||
fi
|
fi
|
||||||
|
|
||||||
# Increase the maximum file descriptors if we can.
|
# Increase the maximum file descriptors if we can.
|
||||||
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
|
# In POSIX sh, ulimit -H is undefined. That's why the result is checked to see if it worked.
|
||||||
MAX_FD="$MAX_FD_LIMIT"
|
# shellcheck disable=SC2039,SC3045
|
||||||
fi
|
MAX_FD=$( ulimit -H -n ) ||
|
||||||
ulimit -n $MAX_FD
|
warn "Could not query maximum file descriptor limit"
|
||||||
if [ $? -ne 0 ] ; then
|
esac
|
||||||
warn "Could not set maximum file descriptor limit: $MAX_FD"
|
case $MAX_FD in #(
|
||||||
fi
|
'' | soft) :;; #(
|
||||||
else
|
*)
|
||||||
warn "Could not query maximum file descriptor limit: $MAX_FD_LIMIT"
|
# In POSIX sh, ulimit -n is undefined. That's why the result is checked to see if it worked.
|
||||||
fi
|
# shellcheck disable=SC2039,SC3045
|
||||||
fi
|
ulimit -n "$MAX_FD" ||
|
||||||
|
warn "Could not set maximum file descriptor limit to $MAX_FD"
|
||||||
# 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, switch paths to Windows format before running java
|
|
||||||
if $cygwin ; 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=$((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" )
|
||||||
|
|
||||||
# by default we should be in the correct project dir, but when run from Finder on Mac, the cwd is wrong
|
JAVACMD=$( cygpath --unix "$JAVACMD" )
|
||||||
if [ "$(uname)" = "Darwin" ] && [ "$HOME" = "$PWD" ]; then
|
|
||||||
cd "$(dirname "$0")"
|
# 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
|
fi
|
||||||
|
|
||||||
|
|
||||||
|
# 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"'
|
||||||
|
|
||||||
|
# Collect all arguments for the java command:
|
||||||
|
# * DEFAULT_JVM_OPTS, JAVA_OPTS, JAVA_OPTS, and optsEnvironmentVar are not allowed to contain shell fragments,
|
||||||
|
# and any embedded shellness will be escaped.
|
||||||
|
# * For example: A user cannot expect ${Hostname} to be expanded, as it is an environment variable and will be
|
||||||
|
# treated as '${Hostname}' itself on the command line.
|
||||||
|
|
||||||
|
set -- \
|
||||||
|
"-Dorg.gradle.appname=$APP_BASE_NAME" \
|
||||||
|
-classpath "$CLASSPATH" \
|
||||||
|
org.gradle.wrapper.GradleWrapperMain \
|
||||||
|
"$@"
|
||||||
|
|
||||||
|
# Stop when "xargs" is not available.
|
||||||
|
if ! command -v xargs >/dev/null 2>&1
|
||||||
|
then
|
||||||
|
die "xargs is not available"
|
||||||
|
fi
|
||||||
|
|
||||||
|
# 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" "$@"
|
||||||
|
60
gradlew.bat
vendored
60
gradlew.bat
vendored
@ -13,8 +13,10 @@
|
|||||||
@rem See the License for the specific language governing permissions and
|
@rem See the License for the specific language governing permissions and
|
||||||
@rem limitations under the License.
|
@rem limitations under the License.
|
||||||
@rem
|
@rem
|
||||||
|
@rem SPDX-License-Identifier: Apache-2.0
|
||||||
|
@rem
|
||||||
|
|
||||||
@if "%DEBUG%" == "" @echo off
|
@if "%DEBUG%"=="" @echo off
|
||||||
@rem ##########################################################################
|
@rem ##########################################################################
|
||||||
@rem
|
@rem
|
||||||
@rem Gradle startup script for Windows
|
@rem Gradle startup script for Windows
|
||||||
@ -25,10 +27,14 @@
|
|||||||
if "%OS%"=="Windows_NT" setlocal
|
if "%OS%"=="Windows_NT" setlocal
|
||||||
|
|
||||||
set DIRNAME=%~dp0
|
set DIRNAME=%~dp0
|
||||||
if "%DIRNAME%" == "" set DIRNAME=.
|
if "%DIRNAME%"=="" set DIRNAME=.
|
||||||
|
@rem This is normally unused
|
||||||
set APP_BASE_NAME=%~n0
|
set APP_BASE_NAME=%~n0
|
||||||
set APP_HOME=%DIRNAME%
|
set APP_HOME=%DIRNAME%
|
||||||
|
|
||||||
|
@rem Resolve any "." and ".." in APP_HOME to make it shorter.
|
||||||
|
for %%i in ("%APP_HOME%") do set APP_HOME=%%~fi
|
||||||
|
|
||||||
@rem Add default JVM options here. You can also use JAVA_OPTS and GRADLE_OPTS to pass JVM options to this script.
|
@rem Add default JVM options here. You can also use JAVA_OPTS and GRADLE_OPTS to pass JVM options to this script.
|
||||||
set DEFAULT_JVM_OPTS="-Xmx64m" "-Xms64m"
|
set DEFAULT_JVM_OPTS="-Xmx64m" "-Xms64m"
|
||||||
|
|
||||||
@ -37,13 +43,13 @@ if defined JAVA_HOME goto findJavaFromJavaHome
|
|||||||
|
|
||||||
set JAVA_EXE=java.exe
|
set JAVA_EXE=java.exe
|
||||||
%JAVA_EXE% -version >NUL 2>&1
|
%JAVA_EXE% -version >NUL 2>&1
|
||||||
if "%ERRORLEVEL%" == "0" goto init
|
if %ERRORLEVEL% equ 0 goto execute
|
||||||
|
|
||||||
echo.
|
echo. 1>&2
|
||||||
echo ERROR: JAVA_HOME is not set and no 'java' command could be found in your PATH.
|
echo ERROR: JAVA_HOME is not set and no 'java' command could be found in your PATH. 1>&2
|
||||||
echo.
|
echo. 1>&2
|
||||||
echo Please set the JAVA_HOME variable in your environment to match the
|
echo Please set the JAVA_HOME variable in your environment to match the 1>&2
|
||||||
echo location of your Java installation.
|
echo location of your Java installation. 1>&2
|
||||||
|
|
||||||
goto fail
|
goto fail
|
||||||
|
|
||||||
@ -51,48 +57,36 @@ goto fail
|
|||||||
set JAVA_HOME=%JAVA_HOME:"=%
|
set JAVA_HOME=%JAVA_HOME:"=%
|
||||||
set JAVA_EXE=%JAVA_HOME%/bin/java.exe
|
set JAVA_EXE=%JAVA_HOME%/bin/java.exe
|
||||||
|
|
||||||
if exist "%JAVA_EXE%" goto init
|
if exist "%JAVA_EXE%" goto execute
|
||||||
|
|
||||||
echo.
|
echo. 1>&2
|
||||||
echo ERROR: JAVA_HOME is set to an invalid directory: %JAVA_HOME%
|
echo ERROR: JAVA_HOME is set to an invalid directory: %JAVA_HOME% 1>&2
|
||||||
echo.
|
echo. 1>&2
|
||||||
echo Please set the JAVA_HOME variable in your environment to match the
|
echo Please set the JAVA_HOME variable in your environment to match the 1>&2
|
||||||
echo location of your Java installation.
|
echo location of your Java installation. 1>&2
|
||||||
|
|
||||||
goto fail
|
goto fail
|
||||||
|
|
||||||
:init
|
|
||||||
@rem Get command-line arguments, handling Windows variants
|
|
||||||
|
|
||||||
if not "%OS%" == "Windows_NT" goto win9xME_args
|
|
||||||
|
|
||||||
:win9xME_args
|
|
||||||
@rem Slurp the command line arguments.
|
|
||||||
set CMD_LINE_ARGS=
|
|
||||||
set _SKIP=2
|
|
||||||
|
|
||||||
:win9xME_args_slurp
|
|
||||||
if "x%~1" == "x" goto execute
|
|
||||||
|
|
||||||
set CMD_LINE_ARGS=%*
|
|
||||||
|
|
||||||
:execute
|
:execute
|
||||||
@rem Setup the command line
|
@rem Setup the command line
|
||||||
|
|
||||||
set CLASSPATH=%APP_HOME%\gradle\wrapper\gradle-wrapper.jar
|
set CLASSPATH=%APP_HOME%\gradle\wrapper\gradle-wrapper.jar
|
||||||
|
|
||||||
|
|
||||||
@rem Execute Gradle
|
@rem Execute Gradle
|
||||||
"%JAVA_EXE%" %DEFAULT_JVM_OPTS% %JAVA_OPTS% %GRADLE_OPTS% "-Dorg.gradle.appname=%APP_BASE_NAME%" -classpath "%CLASSPATH%" org.gradle.wrapper.GradleWrapperMain %CMD_LINE_ARGS%
|
"%JAVA_EXE%" %DEFAULT_JVM_OPTS% %JAVA_OPTS% %GRADLE_OPTS% "-Dorg.gradle.appname=%APP_BASE_NAME%" -classpath "%CLASSPATH%" org.gradle.wrapper.GradleWrapperMain %*
|
||||||
|
|
||||||
:end
|
:end
|
||||||
@rem End local scope for the variables with windows NT shell
|
@rem End local scope for the variables with windows NT shell
|
||||||
if "%ERRORLEVEL%"=="0" goto mainEnd
|
if %ERRORLEVEL% equ 0 goto mainEnd
|
||||||
|
|
||||||
:fail
|
:fail
|
||||||
rem Set variable GRADLE_EXIT_CONSOLE if you need the _script_ return code instead of
|
rem Set variable GRADLE_EXIT_CONSOLE if you need the _script_ return code instead of
|
||||||
rem the _cmd.exe /c_ return code!
|
rem the _cmd.exe /c_ return code!
|
||||||
if not "" == "%GRADLE_EXIT_CONSOLE%" exit 1
|
set EXIT_CODE=%ERRORLEVEL%
|
||||||
exit /b 1
|
if %EXIT_CODE% equ 0 set EXIT_CODE=1
|
||||||
|
if not ""=="%GRADLE_EXIT_CONSOLE%" exit %EXIT_CODE%
|
||||||
|
exit /b %EXIT_CODE%
|
||||||
|
|
||||||
:mainEnd
|
:mainEnd
|
||||||
if "%OS%"=="Windows_NT" endlocal
|
if "%OS%"=="Windows_NT" endlocal
|
||||||
|
@ -2,91 +2,137 @@ package quimufu.structure_item;
|
|||||||
|
|
||||||
import com.google.common.collect.Lists;
|
import com.google.common.collect.Lists;
|
||||||
import net.minecraft.block.Block;
|
import net.minecraft.block.Block;
|
||||||
import net.minecraft.client.item.TooltipContext;
|
import net.minecraft.component.DataComponentTypes;
|
||||||
|
import net.minecraft.component.type.NbtComponent;
|
||||||
import net.minecraft.item.Item;
|
import net.minecraft.item.Item;
|
||||||
import net.minecraft.item.ItemGroup;
|
|
||||||
import net.minecraft.item.ItemStack;
|
import net.minecraft.item.ItemStack;
|
||||||
import net.minecraft.item.ItemUsageContext;
|
import net.minecraft.item.ItemUsageContext;
|
||||||
import net.minecraft.nbt.CompoundTag;
|
import net.minecraft.item.tooltip.TooltipType;
|
||||||
import net.minecraft.nbt.ListTag;
|
import net.minecraft.nbt.NbtCompound;
|
||||||
|
import net.minecraft.nbt.NbtElement;
|
||||||
import net.minecraft.nbt.NbtHelper;
|
import net.minecraft.nbt.NbtHelper;
|
||||||
import net.minecraft.nbt.Tag;
|
import net.minecraft.nbt.NbtList;
|
||||||
|
import net.minecraft.network.packet.s2c.play.SubtitleS2CPacket;
|
||||||
import net.minecraft.network.packet.s2c.play.TitleS2CPacket;
|
import net.minecraft.network.packet.s2c.play.TitleS2CPacket;
|
||||||
|
import net.minecraft.registry.DefaultedRegistry;
|
||||||
|
import net.minecraft.registry.Registries;
|
||||||
import net.minecraft.server.network.ServerPlayNetworkHandler;
|
import net.minecraft.server.network.ServerPlayNetworkHandler;
|
||||||
import net.minecraft.server.network.ServerPlayerEntity;
|
import net.minecraft.server.network.ServerPlayerEntity;
|
||||||
import net.minecraft.server.world.ServerWorld;
|
import net.minecraft.server.world.ServerWorld;
|
||||||
import net.minecraft.structure.Structure;
|
import net.minecraft.structure.StructureTemplate;
|
||||||
import net.minecraft.text.LiteralText;
|
|
||||||
import net.minecraft.text.Text;
|
import net.minecraft.text.Text;
|
||||||
import net.minecraft.text.TranslatableText;
|
|
||||||
import net.minecraft.util.*;
|
import net.minecraft.util.*;
|
||||||
import net.minecraft.util.math.BlockPos;
|
import net.minecraft.util.math.BlockPos;
|
||||||
import net.minecraft.util.math.Direction;
|
import net.minecraft.util.math.Direction;
|
||||||
import net.minecraft.util.registry.DefaultedRegistry;
|
import net.minecraft.util.math.Vec3i;
|
||||||
import net.minecraft.util.registry.Registry;
|
|
||||||
import net.minecraft.world.World;
|
import net.minecraft.world.World;
|
||||||
|
import org.jetbrains.annotations.NotNull;
|
||||||
|
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
|
import java.util.Optional;
|
||||||
|
|
||||||
import static quimufu.structure_item.StructureItemMod.LOGGER;
|
import static quimufu.structure_item.StructureItemMod.LOGGER;
|
||||||
|
|
||||||
public class MyItem extends Item {
|
public class MyItem extends Item {
|
||||||
static Item.Settings p = (new Item.Settings()).group(ItemGroup.REDSTONE).maxCount(1);
|
|
||||||
|
|
||||||
public MyItem() {
|
public MyItem(Item.Settings p) {
|
||||||
super(p);
|
super(p);
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void appendTooltip(ItemStack itemStack, World world, List<Text> texts, TooltipContext tooltipFlag) {
|
public void appendTooltip(ItemStack itemStack, Item.TooltipContext context, List<Text> texts, TooltipType tooltipFlag) {
|
||||||
if (!itemStack.hasTag() || !itemStack.getTag().contains("structure", 8)) {
|
NbtComponent nbtComponent = itemStack.get(DataComponentTypes.CUSTOM_DATA);
|
||||||
texts.add((new TranslatableText("item.structure_item.item.tooltip.tag.invalid")).formatted(Formatting.RED));
|
if (nbtComponent == null || nbtComponent.isEmpty() || !nbtComponent.getNbt().contains("structure", 8)) {
|
||||||
|
texts.add((Text.translatable("item.structure_item.item.tooltip.tag.invalid")).formatted(Formatting.RED));
|
||||||
} else {
|
} else {
|
||||||
CompoundTag tag = itemStack.getTag();
|
NbtCompound tag = nbtComponent.getNbt();
|
||||||
if (tooltipFlag.isAdvanced()) {
|
if (tooltipFlag.isAdvanced()) {
|
||||||
texts.add(new TranslatableText("item.structure_item.item.tooltip.structure"));
|
texts.add(Text.translatable("item.structure_item.item.tooltip.structure"));
|
||||||
texts.add(new LiteralText(" " + tag.getString("structure")));
|
texts.add(Text.literal(" " + tag.getString("structure")));
|
||||||
if (tag.contains("allowedOn", 8)) {
|
if (tag.contains("allowedOn", 8)) {
|
||||||
texts.add(new TranslatableText("item.structure_item.item.tooltip.allowed.on"));
|
texts.add(Text.translatable("item.structure_item.item.tooltip.allowed.on"));
|
||||||
texts.add(new LiteralText(" " + tag.getString("allowedOn")));
|
texts.add(Text.literal(" " + tag.getString("allowedOn")));
|
||||||
}
|
}
|
||||||
if (tag.contains("offset", 10)) {
|
if (tag.contains("offset", 10)) {
|
||||||
BlockPos offset = NbtHelper.toBlockPos(tag.getCompound("offset"));
|
|
||||||
texts.add(new TranslatableText("item.structure_item.item.tooltip.fixed.offset"));
|
BlockPos offset = toBlockPosNewOrOld(tag, "offset");
|
||||||
Text c = new TranslatableText("item.structure_item.item.tooltip.xyz",
|
texts.add(Text.translatable("item.structure_item.item.tooltip.fixed.offset"));
|
||||||
new LiteralText(String.valueOf(offset.getX())),
|
Text c = Text.translatable("item.structure_item.item.tooltip.xyz",
|
||||||
new LiteralText(String.valueOf(offset.getY())),
|
Text.literal(String.valueOf(offset.getX())),
|
||||||
new LiteralText(String.valueOf(offset.getZ())));
|
Text.literal(String.valueOf(offset.getY())),
|
||||||
|
Text.literal(String.valueOf(offset.getZ())));
|
||||||
texts.add(c);
|
texts.add(c);
|
||||||
|
} else if (tag.contains("offsetV2", 10)) {
|
||||||
|
|
||||||
|
NbtCompound offsetV2 = tag.getCompound("offsetV2");
|
||||||
|
|
||||||
|
texts.add(Text.translatable("item.structure_item.item.tooltip.v2.offset"));
|
||||||
|
texts.add(Text.translatable("item.structure_item.item.tooltip.xFuncOff",
|
||||||
|
Text.literal(String.valueOf(offsetV2.get("x")))));
|
||||||
|
texts.add(Text.translatable("item.structure_item.item.tooltip.yFuncOff",
|
||||||
|
Text.literal(String.valueOf(offsetV2.get("y")))));
|
||||||
|
texts.add(Text.translatable("item.structure_item.item.tooltip.zFuncOff",
|
||||||
|
Text.literal(String.valueOf(offsetV2.get("z")))));
|
||||||
} else {
|
} else {
|
||||||
texts.add(new TranslatableText("item.structure_item.item.tooltip.dynamic.offset"));
|
texts.add(Text.translatable("item.structure_item.item.tooltip.dynamic.offset"));
|
||||||
}
|
}
|
||||||
if (tag.contains("blacklist", 9)) {
|
if (tag.contains("blacklist", 9)) {
|
||||||
texts.add(new TranslatableText("item.structure_item.item.tooltip.blacklist"));
|
texts.add(Text.translatable("item.structure_item.item.tooltip.blacklist"));
|
||||||
ListTag bl = tag.getList("blacklist", 8);
|
NbtList bl = tag.getList("blacklist", 8);
|
||||||
int i = 0;
|
int i = 0;
|
||||||
for ( Tag entry : bl) {
|
for (NbtElement entry : bl) {
|
||||||
texts.add(new LiteralText(" " + entry.asString()));
|
texts.add(Text.literal(" " + entry.asString()));
|
||||||
i++;
|
i++;
|
||||||
if (i == 4) {
|
if (i == 4) {
|
||||||
texts.add(new TranslatableText("item.structure_item.item.tooltip.blacklist.more",
|
texts.add(Text.translatable("item.structure_item.item.tooltip.blacklist.more",
|
||||||
new LiteralText(String.valueOf(bl.size() - i))));
|
Text.literal(String.valueOf(bl.size() - i))));
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
} else if (tag.contains("whitelist", 9)) {
|
||||||
|
texts.add(Text.translatable("item.structure_item.item.tooltip.whitelist"));
|
||||||
|
NbtList bl = tag.getList("whitelist", 8);
|
||||||
|
int i = 0;
|
||||||
|
for (NbtElement entry : bl) {
|
||||||
|
texts.add(Text.literal(" " + entry.asString()));
|
||||||
|
i++;
|
||||||
|
if (i == 4) {
|
||||||
|
texts.add(Text.translatable("item.structure_item.item.tooltip.whitelist.more",
|
||||||
|
Text.literal(String.valueOf(bl.size() - i))));
|
||||||
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if (!tag.contains("replaceEntities", 99) || tag.getBoolean("replaceEntities")) {
|
if (!tag.contains("replaceEntities", 99) || tag.getBoolean("replaceEntities")) {
|
||||||
texts.add(new TranslatableText("item.structure_item.item.tooltip.replaceEntities"));
|
texts.add(Text.translatable("item.structure_item.item.tooltip.replaceEntities"));
|
||||||
} else {
|
} else {
|
||||||
texts.add(new TranslatableText("item.structure_item.item.tooltip.doNotReplaceEntities"));
|
texts.add(Text.translatable("item.structure_item.item.tooltip.doNotReplaceEntities"));
|
||||||
}
|
}
|
||||||
if (!tag.contains("placeEntities", 99) || tag.getBoolean("placeEntities")) {
|
if (!tag.contains("placeEntities", 99) || tag.getBoolean("placeEntities")) {
|
||||||
texts.add(new TranslatableText("item.structure_item.item.tooltip.placeEntities"));
|
texts.add(Text.translatable("item.structure_item.item.tooltip.placeEntities"));
|
||||||
} else {
|
} else {
|
||||||
texts.add(new TranslatableText("item.structure_item.item.tooltip.doNotPlaceEntities"));
|
texts.add(Text.translatable("item.structure_item.item.tooltip.doNotPlaceEntities"));
|
||||||
}
|
}
|
||||||
|
if (tag.contains("rotate", NbtElement.STRING_TYPE)) {
|
||||||
|
texts.add(Text.translatable("item.structure_item.item.tooltip.dynamic.rotation"));
|
||||||
|
texts.add(Text.translatable("item.structure_item.item.tooltip.dynamic.rotation.value",
|
||||||
|
Text.translatable("item.structure_item.item.tooltip.dynamic.dir." + tag.getString("rotate"))));
|
||||||
|
} else {
|
||||||
|
texts.add(Text.translatable("item.structure_item.item.tooltip.fixed.rotation"));
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
private static @NotNull BlockPos toBlockPosNewOrOld(NbtCompound tag, String key) {
|
||||||
|
return NbtHelper.toBlockPos(tag, key).orElseGet(() -> toBlockPosOld(tag.getCompound(key)));
|
||||||
|
}
|
||||||
|
|
||||||
|
public static BlockPos toBlockPosOld(NbtCompound nbt) {
|
||||||
|
return new BlockPos(nbt.getInt("X"), nbt.getInt("Y"), nbt.getInt("Z"));
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
@ -98,10 +144,11 @@ public class MyItem extends Item {
|
|||||||
} else {
|
} else {
|
||||||
player = null;
|
player = null;
|
||||||
}
|
}
|
||||||
CompoundTag tag = c.getStack().getTag();
|
NbtCompound tag;
|
||||||
if (tag == null) {
|
NbtComponent nbtComponent = c.getStack().get(DataComponentTypes.CUSTOM_DATA);
|
||||||
TranslatableText message =
|
if (nbtComponent == null || (tag = nbtComponent.getNbt()) == null) {
|
||||||
new TranslatableText("items.structure.spawner.no.tag");
|
Text message =
|
||||||
|
Text.translatable("items.structure.spawner.no.tag");
|
||||||
sendPlayerChat(player, message);
|
sendPlayerChat(player, message);
|
||||||
return ActionResult.FAIL;
|
return ActionResult.FAIL;
|
||||||
}
|
}
|
||||||
@ -110,9 +157,9 @@ public class MyItem extends Item {
|
|||||||
String allowedOn = tag.getString("allowedOn");
|
String allowedOn = tag.getString("allowedOn");
|
||||||
allowed = getBlock(allowedOn);
|
allowed = getBlock(allowedOn);
|
||||||
if (allowed == null) {
|
if (allowed == null) {
|
||||||
TranslatableText message =
|
Text message =
|
||||||
new TranslatableText("items.structure.spawner.invalid.block",
|
Text.translatable("items.structure.spawner.invalid.block",
|
||||||
new LiteralText(allowedOn));
|
Text.literal(allowedOn));
|
||||||
sendPlayerChat(player, message);
|
sendPlayerChat(player, message);
|
||||||
return ActionResult.FAIL;
|
return ActionResult.FAIL;
|
||||||
}
|
}
|
||||||
@ -120,51 +167,90 @@ public class MyItem extends Item {
|
|||||||
Block current = c.getWorld().getBlockState(c.getBlockPos()).getBlock();
|
Block current = c.getWorld().getBlockState(c.getBlockPos()).getBlock();
|
||||||
|
|
||||||
if (allowed != null && !current.equals(allowed)) {
|
if (allowed != null && !current.equals(allowed)) {
|
||||||
Text currentName = new TranslatableText(current.getTranslationKey());
|
Text currentName = Text.translatable(current.getTranslationKey());
|
||||||
Text allowedName = new TranslatableText(allowed.getTranslationKey());
|
Text allowedName = Text.translatable(allowed.getTranslationKey());
|
||||||
TranslatableText message =
|
Text message =
|
||||||
new TranslatableText("items.structure.spawner.invalid.block.clicked",
|
Text.translatable("items.structure.spawner.invalid.block.clicked",
|
||||||
currentName, allowedName);
|
currentName, allowedName);
|
||||||
sendPlayer(player, message);
|
sendPlayer(player, message);
|
||||||
return ActionResult.FAIL;
|
return ActionResult.FAIL;
|
||||||
}
|
}
|
||||||
if (!tag.contains("structure", 8)) {
|
if (!tag.contains("structure", 8)) {
|
||||||
LOGGER.info("No structure name set");
|
LOGGER.info("No structure name set");
|
||||||
TranslatableText message =
|
Text message =
|
||||||
new TranslatableText("items.structure.spawner.no.structure");
|
Text.translatable("items.structure.spawner.no.structure");
|
||||||
sendPlayerChat(player, message);
|
sendPlayerChat(player, message);
|
||||||
return ActionResult.FAIL;
|
return ActionResult.FAIL;
|
||||||
}
|
}
|
||||||
String structureName = tag.getString("structure");
|
String structureName = tag.getString("structure");
|
||||||
Identifier structureResourceID = Identifier.tryParse(structureName);
|
Identifier structureResourceID = Identifier.tryParse(structureName);
|
||||||
if (structureResourceID == null) {
|
if (structureResourceID == null) {
|
||||||
TranslatableText message =
|
Text message =
|
||||||
new TranslatableText("items.structure.spawner.invalid.structure.name");
|
Text.translatable("items.structure.spawner.invalid.structure.name");
|
||||||
sendPlayerChat(player, message);
|
sendPlayerChat(player, message);
|
||||||
return ActionResult.FAIL;
|
return ActionResult.FAIL;
|
||||||
}
|
}
|
||||||
Structure x = ((ServerWorld) c.getWorld()).getStructureManager().getStructure(structureResourceID);
|
Optional<StructureTemplate> optionalStructureTemplate = ((ServerWorld) c.getWorld()).getStructureTemplateManager().getTemplate(structureResourceID);
|
||||||
if (x == null) {
|
if (optionalStructureTemplate.isEmpty()) {
|
||||||
TranslatableText message =
|
Text message =
|
||||||
new TranslatableText("items.structure.spawner.structure.nonexistent",
|
Text.translatable("items.structure.spawner.structure.nonexistent",
|
||||||
new LiteralText(structureResourceID.toString()));
|
Text.literal(structureResourceID.toString()));
|
||||||
sendPlayerChat(player, message);
|
sendPlayerChat(player, message);
|
||||||
return ActionResult.FAIL;
|
return ActionResult.FAIL;
|
||||||
}
|
}
|
||||||
|
StructureTemplate structureTemplate = optionalStructureTemplate.get();
|
||||||
|
|
||||||
|
BlockRotation rotation = BlockRotation.NONE;
|
||||||
|
if (tag.contains("rotate", NbtElement.STRING_TYPE)) {
|
||||||
|
String defaultOrientation = tag.getString("rotate");
|
||||||
|
|
||||||
|
Direction defaultDir = Direction.byName(defaultOrientation);
|
||||||
|
Direction currentDir = c.getSide();
|
||||||
|
|
||||||
|
if (defaultDir == null) {
|
||||||
|
Text message =
|
||||||
|
Text.translatable("items.structure.spawner.invalid.rotate",
|
||||||
|
Text.literal(defaultOrientation));
|
||||||
|
sendPlayerChat(player, message);
|
||||||
|
} else {
|
||||||
|
rotation = getRotationBetween(defaultDir, currentDir);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
BlockPos loc = c.getBlockPos().offset(c.getSide());
|
BlockPos loc = c.getBlockPos().offset(c.getSide());
|
||||||
if (tag.contains("offset", 10)) {
|
if (tag.contains("offset", 10)) {
|
||||||
BlockPos offset = NbtHelper.toBlockPos(tag.getCompound("offset"));
|
BlockPos offset = toBlockPosNewOrOld(tag, "offset");
|
||||||
loc = loc.add(offset);
|
loc = loc.add(offset);
|
||||||
} else if (c.getPlayer() != null) {
|
|
||||||
Direction direction = Direction.getEntityFacingOrder(c.getPlayer())[0];
|
Vec3i size = structureTemplate.getSize();
|
||||||
BlockPos size = x.getSize();
|
switch (rotation) {
|
||||||
loc = loc.add(getDirectionalOffset(direction, size));
|
case CLOCKWISE_90 -> loc = loc.add(new Vec3i(size.getX() - 1, 0, 0));
|
||||||
|
case CLOCKWISE_180 -> loc = loc.add(new Vec3i(size.getX() - 1, 0, size.getZ() - 1));
|
||||||
|
case COUNTERCLOCKWISE_90 -> loc = loc.add(new Vec3i(0, 0, size.getZ() - 1));
|
||||||
|
}
|
||||||
|
} else if (tag.contains("offsetV2", 10)) {
|
||||||
|
Direction direction = c.getSide().getOpposite();
|
||||||
|
try {
|
||||||
|
StructureOffsetSettings offset = StructureOffsetSettings.ofTag(tag.getCompound("offsetV2"));
|
||||||
|
offset.setRotation(rotation);
|
||||||
|
Vec3i size = structureTemplate.getSize();
|
||||||
|
loc = loc.add(offset.getEffective(direction, size));
|
||||||
|
} catch (Exception e) {
|
||||||
|
Text message =
|
||||||
|
Text.translatable("items.structure.spawner.invalid.offsetV2",
|
||||||
|
Text.literal(tag.getCompound("offsetV2").asString()), e.getMessage());
|
||||||
|
sendPlayerChat(player, message);
|
||||||
|
}
|
||||||
} else {
|
} else {
|
||||||
LOGGER.info("No player & no offset");
|
Direction direction = c.getSide().getOpposite();
|
||||||
|
StructureOffsetSettings offset = StructureOffsetSettings.dynamic();
|
||||||
|
offset.setRotation(rotation);
|
||||||
|
Vec3i size = structureTemplate.getSize();
|
||||||
|
loc = loc.add(offset.getEffective(direction, size));
|
||||||
}
|
}
|
||||||
|
|
||||||
MyPlacementSettings ps = (new MyPlacementSettings());
|
MyPlacementSettings ps = new MyPlacementSettings();
|
||||||
if (tag.contains("replaceEntities", 99)) {
|
if (tag.contains("replaceEntities", 99)) {
|
||||||
ps.setReplaceEntities(tag.getBoolean("replaceEntities"));
|
ps.setReplaceEntities(tag.getBoolean("replaceEntities"));
|
||||||
}
|
}
|
||||||
@ -172,95 +258,101 @@ public class MyItem extends Item {
|
|||||||
ps.setIgnoreEntities(!tag.getBoolean("placeEntities"));
|
ps.setIgnoreEntities(!tag.getBoolean("placeEntities"));
|
||||||
}
|
}
|
||||||
if (tag.contains("blacklist", 9)) {
|
if (tag.contains("blacklist", 9)) {
|
||||||
ListTag bl = tag.getList("blacklist", 8);
|
NbtList bl = tag.getList("blacklist", 8);
|
||||||
List<Block> blacklist = Lists.newArrayList();
|
List<Block> blacklist = Lists.newArrayList();
|
||||||
for (Tag b : bl) {
|
for (NbtElement b : bl) {
|
||||||
Block block = getBlock(b.asString());
|
Block block = getBlock(b.asString());
|
||||||
if (block != null) {
|
if (block != null) {
|
||||||
blacklist.add(block);
|
blacklist.add(block);
|
||||||
} else {
|
} else {
|
||||||
TranslatableText message =
|
Text message =
|
||||||
new TranslatableText("items.structure.spawner.invalid.block",
|
Text.translatable("items.structure.spawner.invalid.block",
|
||||||
new LiteralText(b.asString()));
|
Text.literal(b.asString()));
|
||||||
sendPlayerChat(player, message);
|
sendPlayerChat(player, message);
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
ps.forbidOverwrite(blacklist);
|
ps.forbidOverwrite(blacklist);
|
||||||
|
} else if (tag.contains("whitelist", 9)) {
|
||||||
|
NbtList bl = tag.getList("whitelist", 8);
|
||||||
|
List<Block> whitelist = Lists.newArrayList();
|
||||||
|
for (NbtElement b : bl) {
|
||||||
|
Block block = getBlock(b.asString());
|
||||||
|
if (block != null) {
|
||||||
|
whitelist.add(block);
|
||||||
|
} else {
|
||||||
|
Text message =
|
||||||
|
Text.translatable("items.structure.spawner.invalid.block",
|
||||||
|
Text.literal(b.asString()));
|
||||||
|
sendPlayerChat(player, message);
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
ps.overwriteOnly(whitelist);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
ps.setWorld(c.getWorld())
|
ps.setWorld(c.getWorld())
|
||||||
.setSize(x.getSize())
|
.setSize(structureTemplate.getSize())
|
||||||
.setMirror(BlockMirror.NONE)
|
.setMirror(BlockMirror.NONE)
|
||||||
.setRotation(BlockRotation.NONE)
|
.setRotation(rotation);
|
||||||
.setChunkPosition(null);
|
|
||||||
boolean success = false;
|
|
||||||
try {
|
try {
|
||||||
if(x.place((ServerWorld)c.getWorld(), loc, loc, ps, c.getWorld().getRandom(), 2))
|
if (structureTemplate.place((ServerWorld) c.getWorld(), loc, BlockPos.ORIGIN, ps, c.getWorld().getRandom(), 2)) {
|
||||||
success = true;
|
c.getStack().decrement(1);
|
||||||
} catch (NullPointerException ignored) {
|
return ActionResult.SUCCESS;
|
||||||
|
}
|
||||||
|
} catch (PlacementNotAllowedException placementNotAllowedException) {
|
||||||
|
Text message =
|
||||||
|
Text.translatable("items.structure.spawner.invalid.location.reason",
|
||||||
|
placementNotAllowedException.getName(),
|
||||||
|
Text.literal(String.valueOf(placementNotAllowedException.getPos().getX())),
|
||||||
|
Text.literal(String.valueOf(placementNotAllowedException.getPos().getY())),
|
||||||
|
Text.literal(String.valueOf(placementNotAllowedException.getPos().getZ())));
|
||||||
|
sendPlayer(player, message);
|
||||||
|
return ActionResult.FAIL;
|
||||||
}
|
}
|
||||||
if (success) {
|
Text message =
|
||||||
c.getStack().decrement(1);
|
Text.translatable("items.structure.spawner.invalid.location");
|
||||||
return ActionResult.SUCCESS;
|
|
||||||
}
|
|
||||||
TranslatableText message =
|
|
||||||
new TranslatableText("items.structure.spawner.invalid.location");
|
|
||||||
sendPlayer(player, message);
|
sendPlayer(player, message);
|
||||||
return ActionResult.FAIL;
|
return ActionResult.FAIL;
|
||||||
}
|
}
|
||||||
return ActionResult.FAIL;
|
return ActionResult.FAIL;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
private BlockRotation getRotationBetween(Direction from, Direction to) {
|
||||||
|
if (to == Direction.DOWN || to == Direction.UP) {
|
||||||
|
return BlockRotation.NONE;
|
||||||
|
}
|
||||||
|
if (from.getOpposite() == to) {
|
||||||
|
return BlockRotation.CLOCKWISE_180;
|
||||||
|
}
|
||||||
|
if (from.rotateYClockwise() == to) {
|
||||||
|
return BlockRotation.CLOCKWISE_90;
|
||||||
|
}
|
||||||
|
if (from.rotateYCounterclockwise() == to) {
|
||||||
|
return BlockRotation.COUNTERCLOCKWISE_90;
|
||||||
|
}
|
||||||
|
return BlockRotation.NONE;
|
||||||
|
}
|
||||||
|
|
||||||
private static void sendPlayer(ServerPlayerEntity player, Text message) {
|
private static void sendPlayer(ServerPlayerEntity player, Text message) {
|
||||||
if (player == null)
|
if (player == null)
|
||||||
return;
|
return;
|
||||||
ServerPlayNetworkHandler connection = player.networkHandler;
|
ServerPlayNetworkHandler connection = player.networkHandler;
|
||||||
TitleS2CPacket packet = new TitleS2CPacket(TitleS2CPacket.Action.SUBTITLE, message);
|
SubtitleS2CPacket packet = new SubtitleS2CPacket(message);
|
||||||
connection.sendPacket(packet);
|
|
||||||
packet = new TitleS2CPacket(TitleS2CPacket.Action.TITLE, new LiteralText(""));
|
|
||||||
connection.sendPacket(packet);
|
connection.sendPacket(packet);
|
||||||
|
TitleS2CPacket titleS2CPacket = new TitleS2CPacket(Text.literal(""));
|
||||||
|
connection.sendPacket(titleS2CPacket);
|
||||||
}
|
}
|
||||||
|
|
||||||
private static void sendPlayerChat(ServerPlayerEntity player, Text message) {
|
private static void sendPlayerChat(ServerPlayerEntity player, Text message) {
|
||||||
if (player != null)
|
if (player != null)
|
||||||
player.sendMessage(message, false);
|
player.sendMessage(message, false);
|
||||||
LOGGER.info(message.asString());
|
|
||||||
}
|
|
||||||
|
|
||||||
private BlockPos getDirectionalOffset(Direction direction, BlockPos size) {
|
|
||||||
BlockPos loc = new BlockPos(0, 0, 0);
|
|
||||||
switch (direction) {
|
|
||||||
case WEST:
|
|
||||||
loc = loc.offset(Direction.NORTH, size.getZ() / 2);
|
|
||||||
loc = loc.offset(Direction.WEST, size.getX() - 1);
|
|
||||||
break;
|
|
||||||
case EAST: //positive x
|
|
||||||
loc = loc.offset(Direction.NORTH, size.getZ() / 2);
|
|
||||||
break;
|
|
||||||
case NORTH:
|
|
||||||
loc = loc.offset(Direction.NORTH, size.getZ() - 1);
|
|
||||||
loc = loc.offset(Direction.WEST, size.getX() / 2);
|
|
||||||
break;
|
|
||||||
case SOUTH: //positive z
|
|
||||||
loc = loc.offset(Direction.WEST, size.getX() / 2);
|
|
||||||
break;
|
|
||||||
case UP: //positive y
|
|
||||||
loc = loc.offset(Direction.NORTH, size.getZ() / 2);
|
|
||||||
loc = loc.offset(Direction.WEST, size.getX() / 2);
|
|
||||||
loc = loc.offset(Direction.UP);
|
|
||||||
break;
|
|
||||||
case DOWN:
|
|
||||||
loc = loc.offset(Direction.NORTH, size.getZ() / 2);
|
|
||||||
loc = loc.offset(Direction.WEST, size.getX() / 2);
|
|
||||||
loc = loc.offset(Direction.DOWN, size.getY());
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
return loc;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
private Block getBlock(String loc) {
|
private Block getBlock(String loc) {
|
||||||
Identifier location = Identifier.tryParse(loc);
|
Identifier location = Identifier.tryParse(loc);
|
||||||
DefaultedRegistry<Block> blocks = Registry.BLOCK;
|
DefaultedRegistry<Block> blocks = Registries.BLOCK;
|
||||||
if (location == null) {
|
if (location == null) {
|
||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
|
@ -4,27 +4,41 @@ import com.google.common.collect.Lists;
|
|||||||
import net.minecraft.block.Block;
|
import net.minecraft.block.Block;
|
||||||
import net.minecraft.entity.Entity;
|
import net.minecraft.entity.Entity;
|
||||||
import net.minecraft.entity.player.PlayerEntity;
|
import net.minecraft.entity.player.PlayerEntity;
|
||||||
import net.minecraft.structure.Structure;
|
import net.minecraft.server.world.ServerWorld;
|
||||||
import net.minecraft.structure.StructurePlacementData;
|
import net.minecraft.structure.StructurePlacementData;
|
||||||
|
import net.minecraft.structure.StructureTemplate;
|
||||||
|
import net.minecraft.structure.processor.BlockIgnoreStructureProcessor;
|
||||||
|
import net.minecraft.structure.processor.StructureProcessor;
|
||||||
|
import net.minecraft.structure.processor.StructureProcessorType;
|
||||||
|
import net.minecraft.util.math.BlockBox;
|
||||||
import net.minecraft.util.math.BlockPos;
|
import net.minecraft.util.math.BlockPos;
|
||||||
import net.minecraft.util.math.Box;
|
import net.minecraft.util.math.Box;
|
||||||
|
import net.minecraft.util.math.Vec3i;
|
||||||
import net.minecraft.world.World;
|
import net.minecraft.world.World;
|
||||||
|
import net.minecraft.world.WorldView;
|
||||||
|
import org.jetbrains.annotations.Nullable;
|
||||||
|
|
||||||
import java.util.ArrayList;
|
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
|
|
||||||
public class MyPlacementSettings extends StructurePlacementData {
|
public class MyPlacementSettings extends StructurePlacementData {
|
||||||
private List<Block> blacklist;
|
private List<Block> blacklist;
|
||||||
|
private List<Block> whitelist;
|
||||||
private World world;
|
private World world;
|
||||||
private BlockPos size;
|
private Vec3i size;
|
||||||
private boolean replaceEntities = true;
|
private boolean replaceEntities = true;
|
||||||
|
|
||||||
|
public MyPlacementSettings() {
|
||||||
|
addProcessor(BlockIgnoreStructureProcessor.IGNORE_STRUCTURE_BLOCKS);
|
||||||
|
addProcessor(new CheckingStructureProcess());
|
||||||
|
}
|
||||||
|
|
||||||
public void forbidOverwrite(List<Block> blocks) {
|
public void forbidOverwrite(List<Block> blocks) {
|
||||||
if (blocks.size() == 0) {
|
if (blocks.isEmpty()) {
|
||||||
blacklist = null;
|
blacklist = null;
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
blacklist = Lists.newArrayList(blocks);
|
blacklist = Lists.newArrayList(blocks);
|
||||||
|
this.whitelist = null;
|
||||||
}
|
}
|
||||||
|
|
||||||
public MyPlacementSettings setWorld(World w) {
|
public MyPlacementSettings setWorld(World w) {
|
||||||
@ -32,69 +46,11 @@ public class MyPlacementSettings extends StructurePlacementData {
|
|||||||
return this;
|
return this;
|
||||||
}
|
}
|
||||||
|
|
||||||
public MyPlacementSettings setSize(BlockPos p) {
|
public MyPlacementSettings setSize(Vec3i p) {
|
||||||
size = p;
|
size = p;
|
||||||
return this;
|
return this;
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
|
||||||
public Structure.PalettedBlockInfoList getRandomBlockInfos(List<Structure.PalettedBlockInfoList> blocks, BlockPos pos) {
|
|
||||||
if (world == null || pos == null || size == null) {
|
|
||||||
return super.getRandomBlockInfos(blocks, pos);
|
|
||||||
}
|
|
||||||
|
|
||||||
List<Structure.PalettedBlockInfoList> eligibleStructures;
|
|
||||||
eligibleStructures = getEligibleStructures(blocks, pos);
|
|
||||||
if (eligibleStructures.size() == 0)
|
|
||||||
return null;
|
|
||||||
Structure.PalettedBlockInfoList randomBlockInfos = super.getRandomBlockInfos(eligibleStructures, pos);
|
|
||||||
List<Structure.StructureBlockInfo> locs = randomBlockInfos.getAll();
|
|
||||||
if (!locs.isEmpty()) {
|
|
||||||
List<Entity> entitiesWithinAABB = world.getNonSpectatingEntities(Entity.class, new Box(pos,pos.add(size)));
|
|
||||||
for (Structure.StructureBlockInfo blockInfo : locs) {
|
|
||||||
BlockPos posToClean = blockInfo.pos.add(pos);
|
|
||||||
for (Entity e : entitiesWithinAABB) {
|
|
||||||
if (!(e instanceof PlayerEntity) && e.getBoundingBox().intersects(new Box(posToClean))) {
|
|
||||||
e.remove();
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
return randomBlockInfos;
|
|
||||||
}
|
|
||||||
|
|
||||||
private List<Structure.PalettedBlockInfoList> getEligibleStructures(List<Structure.PalettedBlockInfoList> blocks, BlockPos pos) {
|
|
||||||
List<Structure.PalettedBlockInfoList> eligibleStructures = new ArrayList<>();
|
|
||||||
if (blacklist == null && shouldReplaceEntities()) {
|
|
||||||
eligibleStructures = blocks;
|
|
||||||
} else {
|
|
||||||
for (Structure.PalettedBlockInfoList struct : blocks) {
|
|
||||||
if (isValid(struct, pos)) {
|
|
||||||
eligibleStructures.add(struct);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
return eligibleStructures;
|
|
||||||
}
|
|
||||||
|
|
||||||
private boolean isValid(Structure.PalettedBlockInfoList struct, BlockPos pos) {
|
|
||||||
List<Entity> entitiesWithinAABB = world.getNonSpectatingEntities(shouldReplaceEntities()?PlayerEntity.class:Entity.class, new Box(pos,pos.add(size)));
|
|
||||||
for (Structure.StructureBlockInfo bi : struct.getAll()) {
|
|
||||||
BlockPos posToCheck = bi.pos.add(pos);
|
|
||||||
if (World.isValid(posToCheck)) {
|
|
||||||
for (Entity e : entitiesWithinAABB) {
|
|
||||||
if (e.getBoundingBox().intersects(new Box(posToCheck))) {
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
Block blockToCheck = world.getBlockState(posToCheck).getBlock();
|
|
||||||
if(blacklist.contains(blockToCheck))
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
return true;
|
|
||||||
}
|
|
||||||
|
|
||||||
public boolean shouldReplaceEntities() {
|
public boolean shouldReplaceEntities() {
|
||||||
return replaceEntities;
|
return replaceEntities;
|
||||||
}
|
}
|
||||||
@ -102,4 +58,51 @@ public class MyPlacementSettings extends StructurePlacementData {
|
|||||||
public void setReplaceEntities(boolean replaceEntities) {
|
public void setReplaceEntities(boolean replaceEntities) {
|
||||||
this.replaceEntities = replaceEntities;
|
this.replaceEntities = replaceEntities;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public void overwriteOnly(List<Block> whitelist) {
|
||||||
|
if (whitelist.isEmpty()) {
|
||||||
|
this.whitelist = null;
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
this.whitelist = Lists.newArrayList(whitelist);
|
||||||
|
this.blacklist = null;
|
||||||
|
}
|
||||||
|
|
||||||
|
public class CheckingStructureProcess extends StructureProcessor {
|
||||||
|
|
||||||
|
List<? extends Entity> entitiesWithinAABB;
|
||||||
|
|
||||||
|
@Nullable
|
||||||
|
@Override
|
||||||
|
public StructureTemplate.StructureBlockInfo process(WorldView world, BlockPos pos, BlockPos pivot, StructureTemplate.StructureBlockInfo originalBlockInfo, StructureTemplate.StructureBlockInfo currentBlockInfo, StructurePlacementData data) {
|
||||||
|
if (entitiesWithinAABB == null) {
|
||||||
|
if (shouldReplaceEntities()) {
|
||||||
|
entitiesWithinAABB = ((ServerWorld) world).getNonSpectatingEntities(PlayerEntity.class, Box.enclosing(pos.subtract(size), pos.add(size)));
|
||||||
|
} else {
|
||||||
|
entitiesWithinAABB = ((ServerWorld) world).getNonSpectatingEntities(Entity.class, Box.enclosing(pos.subtract(size), pos.add(size)));
|
||||||
|
}
|
||||||
|
}
|
||||||
|
BlockPos posToCheck;
|
||||||
|
if (currentBlockInfo != null && World.isValid(posToCheck = currentBlockInfo.pos())) {
|
||||||
|
for (Entity e : entitiesWithinAABB) {
|
||||||
|
if (e.getBoundingBox().intersects(new Box(posToCheck))) {
|
||||||
|
throw new PlacementNotAllowedException(e.getName(), posToCheck);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
Block blockToCheck = world.getBlockState(posToCheck).getBlock();
|
||||||
|
if (blacklist != null && blacklist.contains(blockToCheck)) {
|
||||||
|
throw new PlacementNotAllowedException(blockToCheck.getName(), posToCheck);
|
||||||
|
}
|
||||||
|
if (whitelist != null && !whitelist.contains(blockToCheck)) {
|
||||||
|
throw new PlacementNotAllowedException(blockToCheck.getName(), posToCheck);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return currentBlockInfo;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
protected StructureProcessorType<?> getType() {
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
@ -0,0 +1,22 @@
|
|||||||
|
package quimufu.structure_item;
|
||||||
|
|
||||||
|
import net.minecraft.text.Text;
|
||||||
|
import net.minecraft.util.math.BlockPos;
|
||||||
|
|
||||||
|
public class PlacementNotAllowedException extends RuntimeException {
|
||||||
|
private final Text name;
|
||||||
|
private final BlockPos pos;
|
||||||
|
|
||||||
|
public PlacementNotAllowedException(Text name, BlockPos pos) {
|
||||||
|
this.name = name;
|
||||||
|
this.pos = pos;
|
||||||
|
}
|
||||||
|
|
||||||
|
public BlockPos getPos() {
|
||||||
|
return pos;
|
||||||
|
}
|
||||||
|
|
||||||
|
public Text getName() {
|
||||||
|
return name;
|
||||||
|
}
|
||||||
|
}
|
@ -2,7 +2,13 @@ package quimufu.structure_item;
|
|||||||
|
|
||||||
import net.fabricmc.api.ModInitializer;
|
import net.fabricmc.api.ModInitializer;
|
||||||
import net.minecraft.item.Item;
|
import net.minecraft.item.Item;
|
||||||
import net.minecraft.util.registry.Registry;
|
import net.minecraft.item.Items;
|
||||||
|
import net.minecraft.registry.Registries;
|
||||||
|
import net.minecraft.registry.Registry;
|
||||||
|
import net.minecraft.registry.RegistryKey;
|
||||||
|
import net.minecraft.registry.RegistryKeys;
|
||||||
|
import net.minecraft.util.Identifier;
|
||||||
|
import net.minecraft.util.Rarity;
|
||||||
import org.apache.logging.log4j.Level;
|
import org.apache.logging.log4j.Level;
|
||||||
import org.apache.logging.log4j.LogManager;
|
import org.apache.logging.log4j.LogManager;
|
||||||
import org.apache.logging.log4j.Logger;
|
import org.apache.logging.log4j.Logger;
|
||||||
@ -14,12 +20,18 @@ public class StructureItemMod implements ModInitializer {
|
|||||||
|
|
||||||
public static final String MOD_ID = "structure_item";
|
public static final String MOD_ID = "structure_item";
|
||||||
public static final String MOD_NAME = "Structure Item Mod (Fabric)";
|
public static final String MOD_NAME = "Structure Item Mod (Fabric)";
|
||||||
public static final Item item = new MyItem();
|
public static final Item ITEM = Items.register(
|
||||||
|
RegistryKey.of(RegistryKeys.ITEM, Identifier.of(MOD_ID, "item")),
|
||||||
|
MyItem::new,
|
||||||
|
new Item.Settings()
|
||||||
|
.fireproof()
|
||||||
|
.rarity(Rarity.RARE)
|
||||||
|
.maxCount(1)
|
||||||
|
);
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void onInitialize() {
|
public void onInitialize() {
|
||||||
log(Level.INFO, "Initializing");
|
log(Level.INFO, "Initializing");
|
||||||
Registry.register(Registry.ITEM, MOD_ID + ":item", item);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public static void log(Level level, String message) {
|
public static void log(Level level, String message) {
|
||||||
|
@ -0,0 +1,180 @@
|
|||||||
|
package quimufu.structure_item;
|
||||||
|
|
||||||
|
import net.minecraft.nbt.NbtCompound;
|
||||||
|
import net.minecraft.util.BlockRotation;
|
||||||
|
import net.minecraft.util.math.BlockPos;
|
||||||
|
import net.minecraft.util.math.Direction;
|
||||||
|
import net.minecraft.util.math.MathHelper;
|
||||||
|
import net.minecraft.util.math.Vec3i;
|
||||||
|
import net.objecthunter.exp4j.Expression;
|
||||||
|
import net.objecthunter.exp4j.ExpressionBuilder;
|
||||||
|
import net.objecthunter.exp4j.function.Function;
|
||||||
|
|
||||||
|
import java.util.Arrays;
|
||||||
|
import java.util.Map;
|
||||||
|
|
||||||
|
public class StructureOffsetSettings {
|
||||||
|
|
||||||
|
Expression[] xyz = new Expression[3];
|
||||||
|
String[] xyzS = new String[3];
|
||||||
|
boolean[] rel = new boolean[3];
|
||||||
|
static Function DIR_SELECT = new Function("dirSelect", 7) {
|
||||||
|
@Override
|
||||||
|
public double apply(double... args) {
|
||||||
|
return args[(int) (Math.round(args[0]) + 1L)];
|
||||||
|
}
|
||||||
|
};
|
||||||
|
private BlockRotation rotation;
|
||||||
|
|
||||||
|
public static StructureOffsetSettings ofTag(NbtCompound offsetTag) {
|
||||||
|
StructureOffsetSettings settings = new StructureOffsetSettings();
|
||||||
|
String x1 = offsetTag.getString("x");
|
||||||
|
unwrap(x1, settings, 0);
|
||||||
|
String y1 = offsetTag.getString("y");
|
||||||
|
unwrap(y1, settings, 1);
|
||||||
|
String z1 = offsetTag.getString("z");
|
||||||
|
unwrap(z1, settings, 2);
|
||||||
|
return settings;
|
||||||
|
}
|
||||||
|
|
||||||
|
private static void unwrap(String expr, StructureOffsetSettings settings, int x) {
|
||||||
|
if (expr.startsWith("~")) {
|
||||||
|
settings.rel[x] = true;
|
||||||
|
expr = expr.substring(1);
|
||||||
|
}
|
||||||
|
if (expr.isBlank()) {
|
||||||
|
expr = "0";
|
||||||
|
}
|
||||||
|
settings.xyzS[x] = expr;
|
||||||
|
settings.xyz[x] = new ExpressionBuilder(expr)
|
||||||
|
.variables("sizeX", "sizeY", "sizeZ", "dir")
|
||||||
|
.function(DIR_SELECT)
|
||||||
|
.build();
|
||||||
|
}
|
||||||
|
|
||||||
|
public static StructureOffsetSettings dynamic() {
|
||||||
|
StructureOffsetSettings settings = new StructureOffsetSettings();
|
||||||
|
for (int i = 0; i < 3; i++) {
|
||||||
|
settings.xyz[i] = new ExpressionBuilder("0").build();
|
||||||
|
settings.xyzS[i] = "0";
|
||||||
|
}
|
||||||
|
Arrays.fill(settings.rel, true);
|
||||||
|
return settings;
|
||||||
|
}
|
||||||
|
|
||||||
|
public Vec3i getEffective(Direction direction, Vec3i size) {
|
||||||
|
int[] xyzI = new int[3];
|
||||||
|
for (int i = 0; i < 3; i++) {
|
||||||
|
xyz[i].setVariables(Map.of("sizeX", (double) size.getX(),
|
||||||
|
"sizeY", (double) size.getY(),
|
||||||
|
"sizeZ", (double) size.getZ(),
|
||||||
|
"dir", (double) direction.getId()
|
||||||
|
));
|
||||||
|
xyzI[i] = MathHelper.floor(xyz[i].evaluate());
|
||||||
|
}
|
||||||
|
Vec3i dynamicOffset = getDirectionalOffset(direction, size);
|
||||||
|
|
||||||
|
int[] xyzDynamicI = {dynamicOffset.getX(), dynamicOffset.getY(), dynamicOffset.getZ()};
|
||||||
|
for (int i = 0; i < 3; i++) {
|
||||||
|
if (rel[i]) {
|
||||||
|
xyzI[i] += xyzDynamicI[i];
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return new Vec3i(xyzI[0], xyzI[1], xyzI[2]);
|
||||||
|
}
|
||||||
|
|
||||||
|
private Vec3i getDirectionalOffset(Direction direction, Vec3i size) {
|
||||||
|
BlockPos loc = new BlockPos(0, 0, 0);
|
||||||
|
switch (rotation) {
|
||||||
|
case NONE:
|
||||||
|
switch (direction) {
|
||||||
|
case WEST:
|
||||||
|
loc = loc.offset(Direction.NORTH, size.getZ() / 2);
|
||||||
|
return loc.offset(Direction.WEST, size.getX() - 1);
|
||||||
|
case EAST://positive x
|
||||||
|
return loc.offset(Direction.NORTH, size.getZ() / 2);
|
||||||
|
case NORTH:
|
||||||
|
loc = loc.offset(Direction.NORTH, size.getZ() - 1);
|
||||||
|
return loc.offset(Direction.WEST, size.getX() / 2);
|
||||||
|
case SOUTH://positive z
|
||||||
|
return loc.offset(Direction.WEST, size.getX() / 2);
|
||||||
|
case UP://positive y
|
||||||
|
loc = loc.offset(Direction.NORTH, size.getZ() / 2);
|
||||||
|
loc = loc.offset(Direction.WEST, size.getX() / 2);
|
||||||
|
return loc.offset(Direction.UP);
|
||||||
|
case DOWN:
|
||||||
|
loc = loc.offset(Direction.NORTH, size.getZ() / 2);
|
||||||
|
loc = loc.offset(Direction.WEST, size.getX() / 2);
|
||||||
|
return loc.offset(Direction.DOWN, size.getY());
|
||||||
|
}
|
||||||
|
case CLOCKWISE_90:
|
||||||
|
switch (direction) {
|
||||||
|
case WEST:
|
||||||
|
return loc.offset(Direction.NORTH, size.getX() / 2);
|
||||||
|
case EAST://positive x
|
||||||
|
loc = loc.offset(Direction.NORTH, size.getX() / 2);
|
||||||
|
return loc.offset(Direction.EAST, size.getZ() - 1);
|
||||||
|
case NORTH:
|
||||||
|
loc = loc.offset(Direction.NORTH, size.getX() - 1);
|
||||||
|
return loc.offset(Direction.EAST, size.getZ() / 2);
|
||||||
|
case SOUTH://positive z
|
||||||
|
return loc.offset(Direction.EAST, size.getZ() / 2);
|
||||||
|
case UP://positive y
|
||||||
|
loc = loc.offset(Direction.NORTH, size.getX() / 2);
|
||||||
|
loc = loc.offset(Direction.EAST, size.getZ() / 2);
|
||||||
|
return loc.offset(Direction.UP);
|
||||||
|
case DOWN:
|
||||||
|
loc = loc.offset(Direction.NORTH, size.getX() / 2);
|
||||||
|
loc = loc.offset(Direction.EAST, size.getZ() / 2);
|
||||||
|
return loc.offset(Direction.DOWN, size.getY());
|
||||||
|
}
|
||||||
|
case CLOCKWISE_180:
|
||||||
|
switch (direction) {
|
||||||
|
case WEST:
|
||||||
|
return loc.offset(Direction.SOUTH, size.getX() / 2);
|
||||||
|
case EAST://positive x
|
||||||
|
loc = loc.offset(Direction.SOUTH, size.getZ() / 2);
|
||||||
|
return loc.offset(Direction.EAST, size.getX() - 1);
|
||||||
|
case NORTH:
|
||||||
|
return loc.offset(Direction.EAST, size.getX() / 2);
|
||||||
|
case SOUTH://positive z
|
||||||
|
loc = loc.offset(Direction.EAST, size.getX() / 2);
|
||||||
|
return loc.offset(Direction.SOUTH, size.getZ() - 1);
|
||||||
|
case UP://positive y
|
||||||
|
loc = loc.offset(Direction.SOUTH, size.getZ() / 2);
|
||||||
|
loc = loc.offset(Direction.EAST, size.getX() / 2);
|
||||||
|
return loc.offset(Direction.UP);
|
||||||
|
case DOWN:
|
||||||
|
loc = loc.offset(Direction.SOUTH, size.getZ() / 2);
|
||||||
|
loc = loc.offset(Direction.EAST, size.getX() / 2);
|
||||||
|
return loc.offset(Direction.DOWN, size.getY());
|
||||||
|
}
|
||||||
|
case COUNTERCLOCKWISE_90:
|
||||||
|
switch (direction) {
|
||||||
|
case WEST:
|
||||||
|
loc = loc.offset(Direction.SOUTH, size.getX() / 2);
|
||||||
|
return loc.offset(Direction.WEST, size.getZ() - 1);
|
||||||
|
case EAST://positive x
|
||||||
|
return loc.offset(Direction.SOUTH, size.getX() / 2);
|
||||||
|
case NORTH:
|
||||||
|
return loc.offset(Direction.WEST, size.getZ() / 2);
|
||||||
|
case SOUTH://positive z
|
||||||
|
loc = loc.offset(Direction.SOUTH, size.getX() - 1);
|
||||||
|
return loc.offset(Direction.WEST, size.getZ() / 2);
|
||||||
|
case UP://positive y
|
||||||
|
loc = loc.offset(Direction.SOUTH, size.getX() / 2);
|
||||||
|
loc = loc.offset(Direction.WEST, size.getZ() / 2);
|
||||||
|
return loc.offset(Direction.UP);
|
||||||
|
case DOWN:
|
||||||
|
loc = loc.offset(Direction.SOUTH, size.getX() / 2);
|
||||||
|
loc = loc.offset(Direction.WEST, size.getZ() / 2);
|
||||||
|
return loc.offset(Direction.DOWN, size.getY());
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return loc;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setRotation(BlockRotation rotation) {
|
||||||
|
this.rotation = rotation;
|
||||||
|
}
|
||||||
|
}
|
6
src/main/resources/assets/structure_item/items/item.json
Normal file
6
src/main/resources/assets/structure_item/items/item.json
Normal file
@ -0,0 +1,6 @@
|
|||||||
|
{
|
||||||
|
"model": {
|
||||||
|
"type": "minecraft:model",
|
||||||
|
"model": "structure_item:item/item"
|
||||||
|
}
|
||||||
|
}
|
@ -1,9 +1,12 @@
|
|||||||
{
|
{
|
||||||
"items.structure.spawner.invalid.block.clicked": "Digga %s is net %s, maan.",
|
"items.structure.spawner.invalid.block.clicked": "Can only be placed on %2$s, not %1$s.",
|
||||||
|
"items.structure.spawner.invalid.location.reason": "%s is in the way at %s, %s, %s!",
|
||||||
"items.structure.spawner.invalid.location": "Something is in the way!",
|
"items.structure.spawner.invalid.location": "Something is in the way!",
|
||||||
"items.structure.spawner.invalid.structure.name": "Invalid structure name",
|
"items.structure.spawner.invalid.structure.name": "Invalid structure name",
|
||||||
"items.structure.spawner.structure.nonexistent": "Structure: %s does not exist",
|
"items.structure.spawner.structure.nonexistent": "Structure: %s does not exist",
|
||||||
"items.structure.spawner.invalid.block": "Block %s invalid",
|
"items.structure.spawner.invalid.block": "Block %s invalid",
|
||||||
|
"items.structure.spawner.invalid.offsetV2": "offsetV2 tag %s invalid: %s",
|
||||||
|
"items.structure.spawner.invalid.rotate": "rotate tag invalid direction: %s",
|
||||||
"items.structure.spawner.no.tag": "Item has no NBT tag",
|
"items.structure.spawner.no.tag": "Item has no NBT tag",
|
||||||
"items.structure.spawner.no.structure": "Item has no String \"structure\": tag",
|
"items.structure.spawner.no.structure": "Item has no String \"structure\": tag",
|
||||||
"item.structure_item.item": "Structure Spawner",
|
"item.structure_item.item": "Structure Spawner",
|
||||||
@ -11,12 +14,25 @@
|
|||||||
"item.structure_item.item.tooltip.structure": "Places down: ",
|
"item.structure_item.item.tooltip.structure": "Places down: ",
|
||||||
"item.structure_item.item.tooltip.allowed.on": "Can be placed on: ",
|
"item.structure_item.item.tooltip.allowed.on": "Can be placed on: ",
|
||||||
"item.structure_item.item.tooltip.fixed.offset": "Offset:",
|
"item.structure_item.item.tooltip.fixed.offset": "Offset:",
|
||||||
|
"item.structure_item.item.tooltip.v2.offset": "Advanced offset:",
|
||||||
"item.structure_item.item.tooltip.xyz":" x: %s y: %s z: %s",
|
"item.structure_item.item.tooltip.xyz":" x: %s y: %s z: %s",
|
||||||
|
"item.structure_item.item.tooltip.xFuncOff":" x: %s",
|
||||||
|
"item.structure_item.item.tooltip.yFuncOff":" y: %s",
|
||||||
|
"item.structure_item.item.tooltip.zFuncOff":" z: %s",
|
||||||
"item.structure_item.item.tooltip.dynamic.offset": "Dynamic offset",
|
"item.structure_item.item.tooltip.dynamic.offset": "Dynamic offset",
|
||||||
"item.structure_item.item.tooltip.blacklist": "Blacklist:",
|
"item.structure_item.item.tooltip.blacklist": "Blacklist:",
|
||||||
"item.structure_item.item.tooltip.blacklist.more": " And %s more...",
|
"item.structure_item.item.tooltip.blacklist.more": " And %s more...",
|
||||||
|
"item.structure_item.item.tooltip.whitelist": "Whitelist:",
|
||||||
|
"item.structure_item.item.tooltip.whitelist.more": " And %s more...",
|
||||||
"item.structure_item.item.tooltip.replaceEntities": "Deletes Entities in the way",
|
"item.structure_item.item.tooltip.replaceEntities": "Deletes Entities in the way",
|
||||||
"item.structure_item.item.tooltip.doNotReplaceEntities": "Doesn't allow placement with Entities in the way",
|
"item.structure_item.item.tooltip.doNotReplaceEntities": "Doesn't allow placement with entities in the way",
|
||||||
"item.structure_item.item.tooltip.placeEntities": "Places contained Entities",
|
"item.structure_item.item.tooltip.placeEntities": "Places contained Entities",
|
||||||
"item.structure_item.item.tooltip.doNotPlaceEntities": "Doesn't place contained Entities"
|
"item.structure_item.item.tooltip.doNotPlaceEntities": "Doesn't place contained entities",
|
||||||
|
"item.structure_item.item.tooltip.dynamic.rotation": "Rotated dynamically",
|
||||||
|
"item.structure_item.item.tooltip.dynamic.rotation.value": "Player is standing %s of structure ",
|
||||||
|
"item.structure_item.item.tooltip.dynamic.dir.north": "north",
|
||||||
|
"item.structure_item.item.tooltip.dynamic.dir.south": "south",
|
||||||
|
"item.structure_item.item.tooltip.dynamic.dir.east": "east",
|
||||||
|
"item.structure_item.item.tooltip.dynamic.dir.west": "west",
|
||||||
|
"item.structure_item.item.tooltip.fixed.rotation": "Fixed rotation"
|
||||||
}
|
}
|
||||||
|
@ -1,6 +1,6 @@
|
|||||||
{
|
{
|
||||||
"parent": "item/handheld",
|
"parent": "minecraft:item/handheld",
|
||||||
"textures": {
|
"textures": {
|
||||||
"layer0": "item/stick"
|
"layer0": "minecraft:item/stick"
|
||||||
}
|
}
|
||||||
}
|
}
|
@ -21,7 +21,7 @@
|
|||||||
},
|
},
|
||||||
"mixins": [],
|
"mixins": [],
|
||||||
"depends": {
|
"depends": {
|
||||||
"fabricloader": ">=0.4.0",
|
"fabricloader": ">=0.14",
|
||||||
"fabric": "*"
|
"fabric": "*"
|
||||||
}
|
}
|
||||||
}
|
}
|
Loading…
x
Reference in New Issue
Block a user