Move to official class names

- also updated buildscript to 1.17
- some remap corruption from compilation errors in flw/next
This commit is contained in:
simibubi 2021-11-02 00:08:20 +01:00
parent 8f1fd1c94e
commit 741fa401d8
1212 changed files with 19450 additions and 18462 deletions

View file

@ -19,6 +19,7 @@ apply plugin: 'net.minecraftforge.gradle'
apply plugin: 'eclipse' apply plugin: 'eclipse'
apply plugin: 'maven-publish' apply plugin: 'maven-publish'
apply plugin: 'org.spongepowered.mixin' apply plugin: 'org.spongepowered.mixin'
apply from: 'https://raw.githubusercontent.com/SizableShrimp/Forge-Class-Remapper/main/classremapper.gradle'
boolean dev = System.getenv('RELEASE') == null || System.getenv('RELEASE').equals('false'); boolean dev = System.getenv('RELEASE') == null || System.getenv('RELEASE').equals('false');
@ -29,7 +30,7 @@ version = "mc${minecraft_version}_v${mod_version}" + (dev && !buildnumber.equals
group = 'com.simibubi.create' group = 'com.simibubi.create'
archivesBaseName = 'create' archivesBaseName = 'create'
java.toolchain.languageVersion = JavaLanguageVersion.of(8) java.toolchain.languageVersion = JavaLanguageVersion.of(16)
minecraft { minecraft {
mappings channel: 'official', version: "${minecraft_version}" mappings channel: 'official', version: "${minecraft_version}"
@ -107,7 +108,7 @@ repositories {
maven { maven {
// Location of the maven for vazkii's mods // Location of the maven for vazkii's mods
name = "blamejared" name = "blamejared"
url = "http://maven.blamejared.com/" url = "https://maven.blamejared.com/"
} }
maven { maven {
// Location of the maven for mixed mappings, Registrate, and Flywheel // Location of the maven for mixed mappings, Registrate, and Flywheel
@ -122,7 +123,7 @@ repositories {
} }
maven { maven {
//location of the maven for dynamic trees //location of the maven for dynamic trees
url "http://harleyoconnor.com/maven" url "https://harleyoconnor.com/maven"
} }
} }
@ -133,7 +134,7 @@ configurations {
dependencies { dependencies {
minecraft "net.minecraftforge:forge:${minecraft_version}-${forge_version}" minecraft "net.minecraftforge:forge:${minecraft_version}-${forge_version}"
def registrate = "com.tterrag.registrate:Registrate:MC1.16.5-${registrate_version}" def registrate = "com.tterrag.registrate:Registrate:${registrate_version}"
implementation fg.deobf(registrate) implementation fg.deobf(registrate)
shade registrate shade registrate
@ -143,16 +144,11 @@ dependencies {
implementation fg.deobf("com.jozufozu.flywheel:Flywheel:${flywheel_version}") implementation fg.deobf("com.jozufozu.flywheel:Flywheel:${flywheel_version}")
} }
// Compile against the JEI API but do not include it at runtime compileOnly fg.deobf("mezz.jei:jei-${minecraft_version}:${jei_version}:api")
compileOnly fg.deobf("mezz.jei:jei-1.16.5:${jei_version}:api") runtimeOnly fg.deobf("mezz.jei:jei-${minecraft_version}:${jei_version}")
// At runtime, use the full JEI jar
runtimeOnly fg.deobf("mezz.jei:jei-1.16.5:${jei_version}")
// implementation fg.deobf("curse.maven:druidcraft-340991:3101903") // implementation fg.deobf("curse.maven:druidcraft-340991:3101903")
implementation fg.deobf("com.ferreusveritas.dynamictrees:DynamicTrees-1.16.5:0.10.0-Beta12.1") // implementation fg.deobf("com.ferreusveritas.dynamictrees:DynamicTrees-1.16.5:0.10.0-Beta12.1")
// i'll leave this here commented for easier testing
// runtimeOnly fg.deobf("vazkii.arl:AutoRegLib:1.4-35.69") // runtimeOnly fg.deobf("vazkii.arl:AutoRegLib:1.4-35.69")
// runtimeOnly fg.deobf("vazkii.quark:Quark:r2.0-212.984") // runtimeOnly fg.deobf("vazkii.quark:Quark:r2.0-212.984")
// runtimeOnly fg.deobf("slimeknights.mantle:Mantle:1.16.5-1.6.115") // runtimeOnly fg.deobf("slimeknights.mantle:Mantle:1.16.5-1.6.115")
@ -254,24 +250,22 @@ String getChangelogText() {
// changelog debugging // changelog debugging
// new File("changelog.html").write getChangelogText() // new File("changelog.html").write getChangelogText()
// tasks.curseforge.enabled = !dev && project.hasProperty('simi_curseforge_key')
tasks.curseforge.enabled = !dev && project.hasProperty('simi_curseforge_key') // curseforge {
// if (project.hasProperty('simi_curseforge_key')) {
curseforge { // apiKey = project.simi_curseforge_key
if (project.hasProperty('simi_curseforge_key')) { // }
apiKey = project.simi_curseforge_key //
} // project {
// id = project.projectId
project { // changelog = System.getenv('CHANGELOG') == null || System.getenv('CHANGELOG').equals('none') ? getChangelogText() : System.getenv('CHANGELOG')
id = project.projectId // changelogType = 'html'
changelog = System.getenv('CHANGELOG') == null || System.getenv('CHANGELOG').equals('none') ? getChangelogText() : System.getenv('CHANGELOG') // releaseType = project.curse_type
changelogType = 'html' // mainArtifact(shadowJar) {
releaseType = project.curse_type // displayName = "Create - ${version}"
mainArtifact(shadowJar) { // }
displayName = "Create - ${version}" // relations {
} // optionalDependency 'jei'
relations { // }
optionalDependency 'jei' // }
} // }
}
}

View file

@ -5,19 +5,19 @@ org.gradle.daemon = false
# mod version info # mod version info
mod_version = 0.3.2f mod_version = 0.3.2f
minecraft_version = 1.16.5 minecraft_version = 1.17.1
forge_version = 36.2.0 forge_version = 37.0.104
# build dependency versions # build dependency versions
forgegradle_version = 4.1.+ forgegradle_version = 5.1.+
mixingradle_version = 0.7-SNAPSHOT mixingradle_version = 0.7-SNAPSHOT
shadow_version = 6.1.0 shadow_version = 6.1.0
cursegradle_version = 1.4.0 cursegradle_version = 1.4.0
# dependency versions # dependency versions
registrate_version = 1.0.10 registrate_version = MC1.17.1-1.0.13
flywheel_version = 1.16-0.2.3.44 flywheel_version = 1.17-0.3.0.9
jei_version = 7.7.1.116 jei_version = 8.1.0.31
# curseforge information # curseforge information
projectId = 328085 projectId = 328085

Binary file not shown.

View file

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

269
gradlew vendored
View file

@ -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
;;
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" "$@"

View file

@ -9,8 +9,8 @@ import com.simibubi.create.content.contraptions.processing.burner.BlazeBurnerBlo
import com.simibubi.create.foundation.utility.Iterate; import com.simibubi.create.foundation.utility.Iterate;
import com.simibubi.create.foundation.utility.Lang; import com.simibubi.create.foundation.utility.Lang;
import net.minecraft.item.DyeColor; import net.minecraft.world.item.DyeColor;
import net.minecraft.util.Direction; import net.minecraft.core.Direction;
public class AllBlockPartials { public class AllBlockPartials {

View file

@ -177,30 +177,30 @@ import com.simibubi.create.foundation.worldgen.OxidizingBlock;
import com.tterrag.registrate.providers.RegistrateRecipeProvider; import com.tterrag.registrate.providers.RegistrateRecipeProvider;
import com.tterrag.registrate.util.entry.BlockEntry; import com.tterrag.registrate.util.entry.BlockEntry;
import net.minecraft.block.AbstractBlock; import net.minecraft.world.level.block.state.BlockBehaviour;
import net.minecraft.block.Block; import net.minecraft.world.level.block.Block;
import net.minecraft.block.Blocks; import net.minecraft.world.level.block.Blocks;
import net.minecraft.block.SoundType; import net.minecraft.world.level.block.SoundType;
import net.minecraft.block.material.MaterialColor; import net.minecraft.world.level.material.MaterialColor;
import net.minecraft.client.renderer.RenderType; import net.minecraft.client.renderer.RenderType;
import net.minecraft.data.ShapedRecipeBuilder; import net.minecraft.data.recipes.ShapedRecipeBuilder;
import net.minecraft.item.DyeColor; import net.minecraft.world.item.DyeColor;
import net.minecraft.item.Item; import net.minecraft.world.item.Item;
import net.minecraft.item.Rarity; import net.minecraft.world.item.Rarity;
import net.minecraft.loot.ConstantRange; import net.minecraft.world.level.storage.loot.ConstantIntValue;
import net.minecraft.loot.ItemLootEntry; import net.minecraft.world.level.storage.loot.entries.LootItem;
import net.minecraft.loot.LootPool; import net.minecraft.world.level.storage.loot.LootPool;
import net.minecraft.loot.LootTable; import net.minecraft.world.level.storage.loot.LootTable;
import net.minecraft.loot.LootTable.Builder; import net.minecraft.world.level.storage.loot.LootTable.Builder;
import net.minecraft.loot.conditions.ILootCondition.IBuilder; import net.minecraft.world.level.storage.loot.predicates.LootItemCondition.Builder;
import net.minecraft.loot.conditions.SurvivesExplosion; import net.minecraft.world.level.storage.loot.predicates.ExplosionCondition;
import net.minecraft.loot.functions.CopyName; import net.minecraft.world.level.storage.loot.functions.CopyNameFunction;
import net.minecraft.loot.functions.CopyNbt; import net.minecraft.world.level.storage.loot.functions.CopyNbtFunction;
import net.minecraft.state.properties.PistonType; import net.minecraft.world.level.block.state.properties.PistonType;
import net.minecraft.tags.BlockTags; import net.minecraft.tags.BlockTags;
import net.minecraft.tags.ItemTags; import net.minecraft.tags.ItemTags;
import net.minecraft.util.Direction.AxisDirection; import net.minecraft.core.Direction.AxisDirection;
import net.minecraft.util.ResourceLocation; import net.minecraft.resources.ResourceLocation;
import net.minecraftforge.client.model.generators.ConfiguredModel; import net.minecraftforge.client.model.generators.ConfiguredModel;
import net.minecraftforge.client.model.generators.ModelFile; import net.minecraftforge.client.model.generators.ModelFile;
import net.minecraftforge.common.Tags; import net.minecraftforge.common.Tags;
@ -223,13 +223,13 @@ public class AllBlocks {
.blockstate((ctx, prov) -> prov.simpleBlock(ctx.getEntry(), AssetLookup.partialBaseModel(ctx, prov))) .blockstate((ctx, prov) -> prov.simpleBlock(ctx.getEntry(), AssetLookup.partialBaseModel(ctx, prov)))
.loot((lt, block) -> { .loot((lt, block) -> {
Builder builder = LootTable.lootTable(); Builder builder = LootTable.lootTable();
IBuilder survivesExplosion = SurvivesExplosion.survivesExplosion(); Builder survivesExplosion = ExplosionCondition.survivesExplosion();
lt.add(block, builder.withPool(LootPool.lootPool() lt.add(block, builder.withPool(LootPool.lootPool()
.when(survivesExplosion) .when(survivesExplosion)
.setRolls(ConstantRange.exactly(1)) .setRolls(ConstantIntValue.exactly(1))
.add(ItemLootEntry.lootTableItem(AllBlocks.SCHEMATICANNON.get() .add(LootItem.lootTableItem(AllBlocks.SCHEMATICANNON.get()
.asItem()) .asItem())
.apply(CopyNbt.copyData(CopyNbt.Source.BLOCK_ENTITY) .apply(CopyNbtFunction.copyData(CopyNbtFunction.DataSource.BLOCK_ENTITY)
.copy("Options", "BlockEntityTag.Options"))))); .copy("Options", "BlockEntityTag.Options")))));
}) })
.item() .item()
@ -291,7 +291,7 @@ public class AllBlocks {
public static final BlockEntry<GearboxBlock> GEARBOX = REGISTRATE.block("gearbox", GearboxBlock::new) public static final BlockEntry<GearboxBlock> GEARBOX = REGISTRATE.block("gearbox", GearboxBlock::new)
.initialProperties(SharedProperties::stone) .initialProperties(SharedProperties::stone)
.properties(AbstractBlock.Properties::noOcclusion) .properties(BlockBehaviour.Properties::noOcclusion)
.transform(BlockStressDefaults.setNoImpact()) .transform(BlockStressDefaults.setNoImpact())
.onRegister(CreateRegistrate.connectedTextures(new EncasedCTBehaviour(AllSpriteShifts.ANDESITE_CASING))) .onRegister(CreateRegistrate.connectedTextures(new EncasedCTBehaviour(AllSpriteShifts.ANDESITE_CASING)))
.onRegister(CreateRegistrate.casingConnectivity((block, cc) -> cc.make(block, AllSpriteShifts.ANDESITE_CASING, .onRegister(CreateRegistrate.casingConnectivity((block, cc) -> cc.make(block, AllSpriteShifts.ANDESITE_CASING,
@ -303,7 +303,7 @@ public class AllBlocks {
public static final BlockEntry<ClutchBlock> CLUTCH = REGISTRATE.block("clutch", ClutchBlock::new) public static final BlockEntry<ClutchBlock> CLUTCH = REGISTRATE.block("clutch", ClutchBlock::new)
.initialProperties(SharedProperties::stone) .initialProperties(SharedProperties::stone)
.properties(AbstractBlock.Properties::noOcclusion) .properties(BlockBehaviour.Properties::noOcclusion)
.transform(BlockStressDefaults.setNoImpact()) .transform(BlockStressDefaults.setNoImpact())
.blockstate((c, p) -> BlockStateGen.axisBlock(c, p, AssetLookup.forPowered(c, p))) .blockstate((c, p) -> BlockStateGen.axisBlock(c, p, AssetLookup.forPowered(c, p)))
.item() .item()
@ -312,7 +312,7 @@ public class AllBlocks {
public static final BlockEntry<GearshiftBlock> GEARSHIFT = REGISTRATE.block("gearshift", GearshiftBlock::new) public static final BlockEntry<GearshiftBlock> GEARSHIFT = REGISTRATE.block("gearshift", GearshiftBlock::new)
.initialProperties(SharedProperties::stone) .initialProperties(SharedProperties::stone)
.properties(AbstractBlock.Properties::noOcclusion) .properties(BlockBehaviour.Properties::noOcclusion)
.transform(BlockStressDefaults.setNoImpact()) .transform(BlockStressDefaults.setNoImpact())
.blockstate((c, p) -> BlockStateGen.axisBlock(c, p, AssetLookup.forPowered(c, p))) .blockstate((c, p) -> BlockStateGen.axisBlock(c, p, AssetLookup.forPowered(c, p)))
.item() .item()
@ -322,7 +322,7 @@ public class AllBlocks {
public static final BlockEntry<EncasedBeltBlock> ENCASED_CHAIN_DRIVE = public static final BlockEntry<EncasedBeltBlock> ENCASED_CHAIN_DRIVE =
REGISTRATE.block("encased_chain_drive", EncasedBeltBlock::new) REGISTRATE.block("encased_chain_drive", EncasedBeltBlock::new)
.initialProperties(SharedProperties::stone) .initialProperties(SharedProperties::stone)
.properties(AbstractBlock.Properties::noOcclusion) .properties(BlockBehaviour.Properties::noOcclusion)
.transform(BlockStressDefaults.setNoImpact()) .transform(BlockStressDefaults.setNoImpact())
.blockstate((c, p) -> new EncasedBeltGenerator((state, suffix) -> p.models() .blockstate((c, p) -> new EncasedBeltGenerator((state, suffix) -> p.models()
.getExistingFile(p.modLoc("block/" + c.getName() + "/" + suffix))).generate(c, p)) .getExistingFile(p.modLoc("block/" + c.getName() + "/" + suffix))).generate(c, p))
@ -333,7 +333,7 @@ public class AllBlocks {
public static final BlockEntry<AdjustablePulleyBlock> ADJUSTABLE_CHAIN_GEARSHIFT = public static final BlockEntry<AdjustablePulleyBlock> ADJUSTABLE_CHAIN_GEARSHIFT =
REGISTRATE.block("adjustable_chain_gearshift", AdjustablePulleyBlock::new) REGISTRATE.block("adjustable_chain_gearshift", AdjustablePulleyBlock::new)
.initialProperties(SharedProperties::stone) .initialProperties(SharedProperties::stone)
.properties(AbstractBlock.Properties::noOcclusion) .properties(BlockBehaviour.Properties::noOcclusion)
.transform(BlockStressDefaults.setNoImpact()) .transform(BlockStressDefaults.setNoImpact())
.blockstate((c, p) -> new EncasedBeltGenerator((state, suffix) -> { .blockstate((c, p) -> new EncasedBeltGenerator((state, suffix) -> {
String powered = state.getValue(AdjustablePulleyBlock.POWERED) ? "_powered" : ""; String powered = state.getValue(AdjustablePulleyBlock.POWERED) ? "_powered" : "";
@ -370,7 +370,7 @@ public class AllBlocks {
public static final BlockEntry<WaterWheelBlock> WATER_WHEEL = REGISTRATE.block("water_wheel", WaterWheelBlock::new) public static final BlockEntry<WaterWheelBlock> WATER_WHEEL = REGISTRATE.block("water_wheel", WaterWheelBlock::new)
.initialProperties(SharedProperties::wooden) .initialProperties(SharedProperties::wooden)
.properties(AbstractBlock.Properties::noOcclusion) .properties(BlockBehaviour.Properties::noOcclusion)
.blockstate(BlockStateGen.directionalBlockProviderIgnoresWaterlogged(false)) .blockstate(BlockStateGen.directionalBlockProviderIgnoresWaterlogged(false))
.addLayer(() -> RenderType::cutoutMipped) .addLayer(() -> RenderType::cutoutMipped)
.transform(BlockStressDefaults.setCapacity(16.0)) .transform(BlockStressDefaults.setCapacity(16.0))
@ -436,7 +436,7 @@ public class AllBlocks {
public static final BlockEntry<CrushingWheelBlock> CRUSHING_WHEEL = public static final BlockEntry<CrushingWheelBlock> CRUSHING_WHEEL =
REGISTRATE.block("crushing_wheel", CrushingWheelBlock::new) REGISTRATE.block("crushing_wheel", CrushingWheelBlock::new)
.initialProperties(SharedProperties::stone) .initialProperties(SharedProperties::stone)
.properties(AbstractBlock.Properties::noOcclusion) .properties(BlockBehaviour.Properties::noOcclusion)
.blockstate(BlockStateGen.axisBlockProvider(false)) .blockstate(BlockStateGen.axisBlockProvider(false))
.addLayer(() -> RenderType::cutoutMipped) .addLayer(() -> RenderType::cutoutMipped)
.transform(BlockStressDefaults.setImpact(8.0)) .transform(BlockStressDefaults.setImpact(8.0))
@ -456,7 +456,7 @@ public class AllBlocks {
public static final BlockEntry<MechanicalPressBlock> MECHANICAL_PRESS = public static final BlockEntry<MechanicalPressBlock> MECHANICAL_PRESS =
REGISTRATE.block("mechanical_press", MechanicalPressBlock::new) REGISTRATE.block("mechanical_press", MechanicalPressBlock::new)
.initialProperties(SharedProperties::stone) .initialProperties(SharedProperties::stone)
.properties(AbstractBlock.Properties::noOcclusion) .properties(BlockBehaviour.Properties::noOcclusion)
.blockstate(BlockStateGen.horizontalBlockProvider(true)) .blockstate(BlockStateGen.horizontalBlockProvider(true))
.transform(BlockStressDefaults.setImpact(8.0)) .transform(BlockStressDefaults.setImpact(8.0))
.item(AssemblyOperatorBlockItem::new) .item(AssemblyOperatorBlockItem::new)
@ -466,7 +466,7 @@ public class AllBlocks {
public static final BlockEntry<MechanicalMixerBlock> MECHANICAL_MIXER = public static final BlockEntry<MechanicalMixerBlock> MECHANICAL_MIXER =
REGISTRATE.block("mechanical_mixer", MechanicalMixerBlock::new) REGISTRATE.block("mechanical_mixer", MechanicalMixerBlock::new)
.initialProperties(SharedProperties::stone) .initialProperties(SharedProperties::stone)
.properties(AbstractBlock.Properties::noOcclusion) .properties(BlockBehaviour.Properties::noOcclusion)
.blockstate((c, p) -> p.simpleBlock(c.getEntry(), AssetLookup.partialBaseModel(c, p))) .blockstate((c, p) -> p.simpleBlock(c.getEntry(), AssetLookup.partialBaseModel(c, p)))
.addLayer(() -> RenderType::cutoutMipped) .addLayer(() -> RenderType::cutoutMipped)
.transform(BlockStressDefaults.setImpact(4.0)) .transform(BlockStressDefaults.setImpact(4.0))
@ -523,7 +523,7 @@ public class AllBlocks {
public static final BlockEntry<EjectorBlock> WEIGHTED_EJECTOR = public static final BlockEntry<EjectorBlock> WEIGHTED_EJECTOR =
REGISTRATE.block("weighted_ejector", EjectorBlock::new) REGISTRATE.block("weighted_ejector", EjectorBlock::new)
.initialProperties(SharedProperties::stone) .initialProperties(SharedProperties::stone)
.properties(AbstractBlock.Properties::noOcclusion) .properties(BlockBehaviour.Properties::noOcclusion)
.blockstate((c, p) -> p.horizontalBlock(c.getEntry(), AssetLookup.partialBaseModel(c, p), 180)) .blockstate((c, p) -> p.horizontalBlock(c.getEntry(), AssetLookup.partialBaseModel(c, p), 180))
.transform(BlockStressDefaults.setImpact(2.0)) .transform(BlockStressDefaults.setImpact(2.0))
.item(EjectorItem::new) .item(EjectorItem::new)
@ -588,7 +588,7 @@ public class AllBlocks {
public static final BlockEntry<EncasedPipeBlock> ENCASED_FLUID_PIPE = public static final BlockEntry<EncasedPipeBlock> ENCASED_FLUID_PIPE =
REGISTRATE.block("encased_fluid_pipe", EncasedPipeBlock::new) REGISTRATE.block("encased_fluid_pipe", EncasedPipeBlock::new)
.initialProperties(SharedProperties::softMetal) .initialProperties(SharedProperties::softMetal)
.properties(AbstractBlock.Properties::noOcclusion) .properties(BlockBehaviour.Properties::noOcclusion)
.blockstate(BlockStateGen.encasedPipe()) .blockstate(BlockStateGen.encasedPipe())
.onRegister(CreateRegistrate.connectedTextures(new EncasedCTBehaviour(AllSpriteShifts.COPPER_CASING))) .onRegister(CreateRegistrate.connectedTextures(new EncasedCTBehaviour(AllSpriteShifts.COPPER_CASING)))
.onRegister(CreateRegistrate.casingConnectivity((block, cc) -> cc.make(block, AllSpriteShifts.COPPER_CASING, .onRegister(CreateRegistrate.casingConnectivity((block, cc) -> cc.make(block, AllSpriteShifts.COPPER_CASING,
@ -657,7 +657,7 @@ public class AllBlocks {
public static final BlockEntry<FluidTankBlock> FLUID_TANK = REGISTRATE.block("fluid_tank", FluidTankBlock::regular) public static final BlockEntry<FluidTankBlock> FLUID_TANK = REGISTRATE.block("fluid_tank", FluidTankBlock::regular)
.initialProperties(SharedProperties::softMetal) .initialProperties(SharedProperties::softMetal)
.properties(AbstractBlock.Properties::noOcclusion) .properties(BlockBehaviour.Properties::noOcclusion)
.blockstate(new FluidTankGenerator()::generate) .blockstate(new FluidTankGenerator()::generate)
.onRegister(CreateRegistrate.blockModel(() -> FluidTankModel::standard)) .onRegister(CreateRegistrate.blockModel(() -> FluidTankModel::standard))
.addLayer(() -> RenderType::cutoutMipped) .addLayer(() -> RenderType::cutoutMipped)
@ -670,7 +670,7 @@ public class AllBlocks {
REGISTRATE.block("creative_fluid_tank", FluidTankBlock::creative) REGISTRATE.block("creative_fluid_tank", FluidTankBlock::creative)
.initialProperties(SharedProperties::softMetal) .initialProperties(SharedProperties::softMetal)
.tag(AllBlockTags.SAFE_NBT.tag) .tag(AllBlockTags.SAFE_NBT.tag)
.properties(AbstractBlock.Properties::noOcclusion) .properties(BlockBehaviour.Properties::noOcclusion)
.blockstate(new FluidTankGenerator("creative_")::generate) .blockstate(new FluidTankGenerator("creative_")::generate)
.onRegister(CreateRegistrate.blockModel(() -> FluidTankModel::creative)) .onRegister(CreateRegistrate.blockModel(() -> FluidTankModel::creative))
.addLayer(() -> RenderType::cutoutMipped) .addLayer(() -> RenderType::cutoutMipped)
@ -748,7 +748,7 @@ public class AllBlocks {
public static final BlockEntry<GantryCarriageBlock> GANTRY_CARRIAGE = public static final BlockEntry<GantryCarriageBlock> GANTRY_CARRIAGE =
REGISTRATE.block("gantry_carriage", GantryCarriageBlock::new) REGISTRATE.block("gantry_carriage", GantryCarriageBlock::new)
.initialProperties(SharedProperties::stone) .initialProperties(SharedProperties::stone)
.properties(AbstractBlock.Properties::noOcclusion) .properties(BlockBehaviour.Properties::noOcclusion)
.blockstate(BlockStateGen.directionalAxisBlockProvider()) .blockstate(BlockStateGen.directionalAxisBlockProvider())
.item() .item()
.transform(customItemModel()) .transform(customItemModel())
@ -827,7 +827,7 @@ public class AllBlocks {
public static final BlockEntry<CartAssemblerBlock> CART_ASSEMBLER = public static final BlockEntry<CartAssemblerBlock> CART_ASSEMBLER =
REGISTRATE.block("cart_assembler", CartAssemblerBlock::new) REGISTRATE.block("cart_assembler", CartAssemblerBlock::new)
.initialProperties(SharedProperties::stone) .initialProperties(SharedProperties::stone)
.properties(AbstractBlock.Properties::noOcclusion) .properties(BlockBehaviour.Properties::noOcclusion)
.blockstate(BlockStateGen.cartAssembler()) .blockstate(BlockStateGen.cartAssembler())
.addLayer(() -> RenderType::cutoutMipped) .addLayer(() -> RenderType::cutoutMipped)
.tag(BlockTags.RAILS, AllBlockTags.SAFE_NBT.tag) .tag(BlockTags.RAILS, AllBlockTags.SAFE_NBT.tag)
@ -838,7 +838,7 @@ public class AllBlocks {
public static final BlockEntry<ReinforcedRailBlock> REINFORCED_RAIL = public static final BlockEntry<ReinforcedRailBlock> REINFORCED_RAIL =
REGISTRATE.block("reinforced_rail", ReinforcedRailBlock::new) REGISTRATE.block("reinforced_rail", ReinforcedRailBlock::new)
.initialProperties(SharedProperties::stone) .initialProperties(SharedProperties::stone)
.properties(AbstractBlock.Properties::noOcclusion) .properties(BlockBehaviour.Properties::noOcclusion)
.blockstate(BlockStateGen.reinforcedRail()) .blockstate(BlockStateGen.reinforcedRail())
.addLayer(() -> RenderType::cutoutMipped) .addLayer(() -> RenderType::cutoutMipped)
.tag(BlockTags.RAILS) .tag(BlockTags.RAILS)
@ -901,7 +901,7 @@ public class AllBlocks {
public static final BlockEntry<StickerBlock> STICKER = REGISTRATE.block("sticker", StickerBlock::new) public static final BlockEntry<StickerBlock> STICKER = REGISTRATE.block("sticker", StickerBlock::new)
.initialProperties(SharedProperties::stone) .initialProperties(SharedProperties::stone)
.properties(AbstractBlock.Properties::noOcclusion) .properties(BlockBehaviour.Properties::noOcclusion)
.addLayer(() -> RenderType::cutoutMipped) .addLayer(() -> RenderType::cutoutMipped)
.blockstate((c, p) -> p.directionalBlock(c.get(), AssetLookup.forPowered(c, p))) .blockstate((c, p) -> p.directionalBlock(c.get(), AssetLookup.forPowered(c, p)))
.item() .item()
@ -1010,7 +1010,7 @@ public class AllBlocks {
public static final BlockEntry<SailBlock> SAIL_FRAME = REGISTRATE.block("sail_frame", p -> SailBlock.frame(p)) public static final BlockEntry<SailBlock> SAIL_FRAME = REGISTRATE.block("sail_frame", p -> SailBlock.frame(p))
.initialProperties(SharedProperties::wooden) .initialProperties(SharedProperties::wooden)
.properties(AbstractBlock.Properties::noOcclusion) .properties(BlockBehaviour.Properties::noOcclusion)
.blockstate(BlockStateGen.directionalBlockProvider(false)) .blockstate(BlockStateGen.directionalBlockProvider(false))
.tag(AllBlockTags.WINDMILL_SAILS.tag) .tag(AllBlockTags.WINDMILL_SAILS.tag)
.tag(AllBlockTags.FAN_TRANSPARENT.tag) .tag(AllBlockTags.FAN_TRANSPARENT.tag)
@ -1019,7 +1019,7 @@ public class AllBlocks {
public static final BlockEntry<SailBlock> SAIL = REGISTRATE.block("white_sail", p -> SailBlock.withCanvas(p, DyeColor.WHITE)) public static final BlockEntry<SailBlock> SAIL = REGISTRATE.block("white_sail", p -> SailBlock.withCanvas(p, DyeColor.WHITE))
.initialProperties(SharedProperties::wooden) .initialProperties(SharedProperties::wooden)
.properties(AbstractBlock.Properties::noOcclusion) .properties(BlockBehaviour.Properties::noOcclusion)
.blockstate(BlockStateGen.directionalBlockProvider(false)) .blockstate(BlockStateGen.directionalBlockProvider(false))
.tag(AllBlockTags.WINDMILL_SAILS.tag) .tag(AllBlockTags.WINDMILL_SAILS.tag)
.simpleItem() .simpleItem()
@ -1031,7 +1031,7 @@ public class AllBlocks {
} }
String colourName = colour.getSerializedName(); String colourName = colour.getSerializedName();
return REGISTRATE.block(colourName + "_sail", p -> SailBlock.withCanvas(p, colour)) return REGISTRATE.block(colourName + "_sail", p -> SailBlock.withCanvas(p, colour))
.properties(AbstractBlock.Properties::noOcclusion) .properties(BlockBehaviour.Properties::noOcclusion)
.initialProperties(SharedProperties::wooden) .initialProperties(SharedProperties::wooden)
.blockstate((c, p) -> p.directionalBlock(c.get(), p.models() .blockstate((c, p) -> p.directionalBlock(c.get(), p.models()
.withExistingParent(colourName + "_sail", p.modLoc("block/white_sail")) .withExistingParent(colourName + "_sail", p.modLoc("block/white_sail"))
@ -1070,7 +1070,7 @@ public class AllBlocks {
public static final BlockEntry<MechanicalCrafterBlock> MECHANICAL_CRAFTER = public static final BlockEntry<MechanicalCrafterBlock> MECHANICAL_CRAFTER =
REGISTRATE.block("mechanical_crafter", MechanicalCrafterBlock::new) REGISTRATE.block("mechanical_crafter", MechanicalCrafterBlock::new)
.initialProperties(SharedProperties::softMetal) .initialProperties(SharedProperties::softMetal)
.properties(AbstractBlock.Properties::noOcclusion) .properties(BlockBehaviour.Properties::noOcclusion)
.blockstate(BlockStateGen.horizontalBlockProvider(true)) .blockstate(BlockStateGen.horizontalBlockProvider(true))
.transform(BlockStressDefaults.setImpact(2.0)) .transform(BlockStressDefaults.setImpact(2.0))
.onRegister(CreateRegistrate.connectedTextures(new CrafterCTBehaviour())) .onRegister(CreateRegistrate.connectedTextures(new CrafterCTBehaviour()))
@ -1083,7 +1083,7 @@ public class AllBlocks {
REGISTRATE.block("sequenced_gearshift", SequencedGearshiftBlock::new) REGISTRATE.block("sequenced_gearshift", SequencedGearshiftBlock::new)
.initialProperties(SharedProperties::stone) .initialProperties(SharedProperties::stone)
.tag(AllBlockTags.SAFE_NBT.tag) .tag(AllBlockTags.SAFE_NBT.tag)
.properties(AbstractBlock.Properties::noOcclusion) .properties(BlockBehaviour.Properties::noOcclusion)
.transform(BlockStressDefaults.setNoImpact()) .transform(BlockStressDefaults.setNoImpact())
.blockstate(new SequencedGearshiftGenerator()::generate) .blockstate(new SequencedGearshiftGenerator()::generate)
.item() .item()
@ -1092,7 +1092,7 @@ public class AllBlocks {
public static final BlockEntry<FlywheelBlock> FLYWHEEL = REGISTRATE.block("flywheel", FlywheelBlock::new) public static final BlockEntry<FlywheelBlock> FLYWHEEL = REGISTRATE.block("flywheel", FlywheelBlock::new)
.initialProperties(SharedProperties::softMetal) .initialProperties(SharedProperties::softMetal)
.properties(AbstractBlock.Properties::noOcclusion) .properties(BlockBehaviour.Properties::noOcclusion)
.transform(BlockStressDefaults.setNoImpact()) .transform(BlockStressDefaults.setNoImpact())
.blockstate(new FlywheelGenerator()::generate) .blockstate(new FlywheelGenerator()::generate)
.item() .item()
@ -1325,15 +1325,15 @@ public class AllBlocks {
.transform(BlockStressDefaults.setImpact(4.0)) .transform(BlockStressDefaults.setImpact(4.0))
.loot((lt, block) -> { .loot((lt, block) -> {
Builder builder = LootTable.lootTable(); Builder builder = LootTable.lootTable();
IBuilder survivesExplosion = SurvivesExplosion.survivesExplosion(); Builder survivesExplosion = ExplosionCondition.survivesExplosion();
lt.add(block, builder.withPool(LootPool.lootPool() lt.add(block, builder.withPool(LootPool.lootPool()
.when(survivesExplosion) .when(survivesExplosion)
.setRolls(ConstantRange.exactly(1)) .setRolls(ConstantIntValue.exactly(1))
.add(ItemLootEntry.lootTableItem(AllItems.COPPER_BACKTANK.get()) .add(LootItem.lootTableItem(AllItems.COPPER_BACKTANK.get())
.apply(CopyName.copyName(CopyName.Source.BLOCK_ENTITY)) .apply(CopyNameFunction.copyName(CopyNameFunction.NameSource.BLOCK_ENTITY))
.apply(CopyNbt.copyData(CopyNbt.Source.BLOCK_ENTITY) .apply(CopyNbtFunction.copyData(CopyNbtFunction.DataSource.BLOCK_ENTITY)
.copy("Air", "Air")) .copy("Air", "Air"))
.apply(CopyNbt.copyData(CopyNbt.Source.BLOCK_ENTITY) .apply(CopyNbtFunction.copyData(CopyNbtFunction.DataSource.BLOCK_ENTITY)
.copy("Enchantments", "Enchantments"))))); .copy("Enchantments", "Enchantments")))));
}) })
.register(); .register();
@ -1358,13 +1358,13 @@ public class AllBlocks {
.addLayer(() -> RenderType::cutoutMipped) .addLayer(() -> RenderType::cutoutMipped)
.loot((lt, block) -> { .loot((lt, block) -> {
Builder builder = LootTable.lootTable(); Builder builder = LootTable.lootTable();
IBuilder survivesExplosion = SurvivesExplosion.survivesExplosion(); Builder survivesExplosion = ExplosionCondition.survivesExplosion();
lt.add(block, builder.withPool(LootPool.lootPool() lt.add(block, builder.withPool(LootPool.lootPool()
.when(survivesExplosion) .when(survivesExplosion)
.setRolls(ConstantRange.exactly(1)) .setRolls(ConstantIntValue.exactly(1))
.add(ItemLootEntry.lootTableItem(block) .add(LootItem.lootTableItem(block)
.apply(CopyName.copyName(CopyName.Source.BLOCK_ENTITY)) .apply(CopyNameFunction.copyName(CopyNameFunction.NameSource.BLOCK_ENTITY))
.apply(CopyNbt.copyData(CopyNbt.Source.BLOCK_ENTITY) .apply(CopyNbtFunction.copyData(CopyNbtFunction.DataSource.BLOCK_ENTITY)
.copy("Inventory", "Inventory"))))); .copy("Inventory", "Inventory")))));
}) })
.blockstate((c, p) -> { .blockstate((c, p) -> {

View file

@ -21,9 +21,9 @@ import com.tterrag.registrate.builders.ContainerBuilder.ScreenFactory;
import com.tterrag.registrate.util.entry.ContainerEntry; import com.tterrag.registrate.util.entry.ContainerEntry;
import com.tterrag.registrate.util.nullness.NonNullSupplier; import com.tterrag.registrate.util.nullness.NonNullSupplier;
import net.minecraft.client.gui.IHasContainer; import net.minecraft.client.gui.screens.inventory.MenuAccess;
import net.minecraft.client.gui.screen.Screen; import net.minecraft.client.gui.screens.Screen;
import net.minecraft.inventory.container.Container; import net.minecraft.world.inventory.AbstractContainerMenu;
public class AllContainerTypes { public class AllContainerTypes {
@ -51,7 +51,7 @@ public class AllContainerTypes {
public static final ContainerEntry<ToolboxContainer> TOOLBOX = public static final ContainerEntry<ToolboxContainer> TOOLBOX =
register("toolbox", ToolboxContainer::new, () -> ToolboxScreen::new); register("toolbox", ToolboxContainer::new, () -> ToolboxScreen::new);
private static <C extends Container, S extends Screen & IHasContainer<C>> ContainerEntry<C> register(String name, ForgeContainerFactory<C> factory, NonNullSupplier<ScreenFactory<C, S>> screenFactory) { private static <C extends AbstractContainerMenu, S extends Screen & MenuAccess<C>> ContainerEntry<C> register(String name, ForgeContainerFactory<C> factory, NonNullSupplier<ScreenFactory<C, S>> screenFactory) {
return Create.registrate().container(name, factory, screenFactory).register(); return Create.registrate().container(name, factory, screenFactory).register();
} }

View file

@ -5,24 +5,24 @@ import com.simibubi.create.content.curiosities.weapons.PotatoRecoveryEnchantment
import com.simibubi.create.foundation.data.CreateRegistrate; import com.simibubi.create.foundation.data.CreateRegistrate;
import com.tterrag.registrate.util.entry.RegistryEntry; import com.tterrag.registrate.util.entry.RegistryEntry;
import net.minecraft.enchantment.Enchantment.Rarity; import net.minecraft.world.item.enchantment.Enchantment.Rarity;
import net.minecraft.enchantment.EnchantmentType; import net.minecraft.world.item.enchantment.EnchantmentCategory;
import net.minecraft.inventory.EquipmentSlotType; import net.minecraft.world.entity.EquipmentSlot;
public class AllEnchantments { public class AllEnchantments {
private static final CreateRegistrate REGISTRATE = Create.registrate(); private static final CreateRegistrate REGISTRATE = Create.registrate();
public static final RegistryEntry<PotatoRecoveryEnchantment> POTATO_RECOVERY = REGISTRATE.object("potato_recovery") public static final RegistryEntry<PotatoRecoveryEnchantment> POTATO_RECOVERY = REGISTRATE.object("potato_recovery")
.enchantment(EnchantmentType.BOW, PotatoRecoveryEnchantment::new) .enchantment(EnchantmentCategory.BOW, PotatoRecoveryEnchantment::new)
.addSlots(EquipmentSlotType.MAINHAND, EquipmentSlotType.OFFHAND) .addSlots(EquipmentSlot.MAINHAND, EquipmentSlot.OFFHAND)
.lang("Potato Recovery") .lang("Potato Recovery")
.rarity(Rarity.UNCOMMON) .rarity(Rarity.UNCOMMON)
.register(); .register();
public static final RegistryEntry<CapacityEnchantment> CAPACITY = REGISTRATE.object("capacity") public static final RegistryEntry<CapacityEnchantment> CAPACITY = REGISTRATE.object("capacity")
.enchantment(EnchantmentType.ARMOR_CHEST, CapacityEnchantment::new) .enchantment(EnchantmentCategory.ARMOR_CHEST, CapacityEnchantment::new)
.addSlots(EquipmentSlotType.CHEST) .addSlots(EquipmentSlot.CHEST)
.lang("Capacity") .lang("Capacity")
.rarity(Rarity.COMMON) .rarity(Rarity.COMMON)
.register(); .register();

View file

@ -20,10 +20,10 @@ import com.tterrag.registrate.util.entry.EntityEntry;
import com.tterrag.registrate.util.nullness.NonNullConsumer; import com.tterrag.registrate.util.nullness.NonNullConsumer;
import com.tterrag.registrate.util.nullness.NonNullSupplier; import com.tterrag.registrate.util.nullness.NonNullSupplier;
import net.minecraft.entity.Entity; import net.minecraft.world.entity.Entity;
import net.minecraft.entity.EntityClassification; import net.minecraft.world.entity.MobCategory;
import net.minecraft.entity.EntityType; import net.minecraft.world.entity.EntityType;
import net.minecraft.entity.EntityType.IFactory; import net.minecraft.world.entity.EntityType.EntityFactory;
import net.minecraftforge.fml.client.registry.IRenderFactory; import net.minecraftforge.fml.client.registry.IRenderFactory;
public class AllEntityTypes { public class AllEntityTypes {
@ -37,31 +37,31 @@ public class AllEntityTypes {
GantryContraptionEntity::new, () -> ContraptionEntityRenderer::new, 10, 40, false); GantryContraptionEntity::new, () -> ContraptionEntityRenderer::new, 10, 40, false);
public static final EntityEntry<SuperGlueEntity> SUPER_GLUE = public static final EntityEntry<SuperGlueEntity> SUPER_GLUE =
register("super_glue", SuperGlueEntity::new, () -> SuperGlueRenderer::new, EntityClassification.MISC, 10, register("super_glue", SuperGlueEntity::new, () -> SuperGlueRenderer::new, MobCategory.MISC, 10,
Integer.MAX_VALUE, false, true, SuperGlueEntity::build).instance(() -> GlueInstance::new) Integer.MAX_VALUE, false, true, SuperGlueEntity::build).instance(() -> GlueInstance::new)
.register(); .register();
public static final EntityEntry<BlueprintEntity> CRAFTING_BLUEPRINT = public static final EntityEntry<BlueprintEntity> CRAFTING_BLUEPRINT =
register("crafting_blueprint", BlueprintEntity::new, () -> BlueprintRenderer::new, EntityClassification.MISC, register("crafting_blueprint", BlueprintEntity::new, () -> BlueprintRenderer::new, MobCategory.MISC,
10, Integer.MAX_VALUE, false, true, BlueprintEntity::build).register(); 10, Integer.MAX_VALUE, false, true, BlueprintEntity::build).register();
public static final EntityEntry<PotatoProjectileEntity> POTATO_PROJECTILE = public static final EntityEntry<PotatoProjectileEntity> POTATO_PROJECTILE =
register("potato_projectile", PotatoProjectileEntity::new, () -> PotatoProjectileRenderer::new, register("potato_projectile", PotatoProjectileEntity::new, () -> PotatoProjectileRenderer::new,
EntityClassification.MISC, 4, 20, true, false, PotatoProjectileEntity::build).register(); MobCategory.MISC, 4, 20, true, false, PotatoProjectileEntity::build).register();
public static final EntityEntry<SeatEntity> SEAT = register("seat", SeatEntity::new, () -> SeatEntity.Render::new, public static final EntityEntry<SeatEntity> SEAT = register("seat", SeatEntity::new, () -> SeatEntity.Render::new,
EntityClassification.MISC, 0, Integer.MAX_VALUE, false, true, SeatEntity::build).register(); MobCategory.MISC, 0, Integer.MAX_VALUE, false, true, SeatEntity::build).register();
// //
private static <T extends Entity> EntityEntry<T> contraption(String name, IFactory<T> factory, private static <T extends Entity> EntityEntry<T> contraption(String name, EntityFactory<T> factory,
NonNullSupplier<IRenderFactory<? super T>> renderer, int range, int updateFrequency, boolean sendVelocity) { NonNullSupplier<IRenderFactory<? super T>> renderer, int range, int updateFrequency, boolean sendVelocity) {
return register(name, factory, renderer, EntityClassification.MISC, range, updateFrequency, sendVelocity, true, return register(name, factory, renderer, MobCategory.MISC, range, updateFrequency, sendVelocity, true,
AbstractContraptionEntity::build).register(); AbstractContraptionEntity::build).register();
} }
private static <T extends Entity> CreateEntityBuilder<T, ?> register(String name, IFactory<T> factory, private static <T extends Entity> CreateEntityBuilder<T, ?> register(String name, EntityFactory<T> factory,
NonNullSupplier<IRenderFactory<? super T>> renderer, EntityClassification group, int range, int updateFrequency, NonNullSupplier<IRenderFactory<? super T>> renderer, MobCategory group, int range, int updateFrequency,
boolean sendVelocity, boolean immuneToFire, NonNullConsumer<EntityType.Builder<T>> propertyBuilder) { boolean sendVelocity, boolean immuneToFire, NonNullConsumer<EntityType.Builder<T>> propertyBuilder) {
String id = Lang.asId(name); String id = Lang.asId(name);
return (CreateEntityBuilder<T, ?>) Create.registrate() return (CreateEntityBuilder<T, ?>) Create.registrate()

View file

@ -10,18 +10,20 @@ import com.simibubi.create.content.palettes.AllPaletteBlocks;
import com.simibubi.create.foundation.data.CreateRegistrate; import com.simibubi.create.foundation.data.CreateRegistrate;
import com.tterrag.registrate.util.entry.FluidEntry; import com.tterrag.registrate.util.entry.FluidEntry;
import net.minecraft.block.BlockState; import net.minecraft.world.level.block.state.BlockState;
import net.minecraft.client.renderer.RenderType; import net.minecraft.client.renderer.RenderType;
import net.minecraft.client.renderer.RenderTypeLookup; import net.minecraft.client.renderer.ItemBlockRenderTypes;
import net.minecraft.fluid.Fluid; import net.minecraft.world.level.material.Fluid;
import net.minecraft.fluid.FluidState; import net.minecraft.world.level.material.FluidState;
import net.minecraft.util.math.BlockPos; import net.minecraft.core.BlockPos;
import net.minecraft.world.IBlockDisplayReader; import net.minecraft.world.level.BlockAndTintGetter;
import net.minecraftforge.api.distmarker.Dist; import net.minecraftforge.api.distmarker.Dist;
import net.minecraftforge.api.distmarker.OnlyIn; import net.minecraftforge.api.distmarker.OnlyIn;
import net.minecraftforge.fluids.FluidAttributes; import net.minecraftforge.fluids.FluidAttributes;
import net.minecraftforge.fluids.ForgeFlowingFluid; import net.minecraftforge.fluids.ForgeFlowingFluid;
import net.minecraftforge.fluids.FluidAttributes.Builder;
public class AllFluids { public class AllFluids {
private static final CreateRegistrate REGISTRATE = Create.registrate(); private static final CreateRegistrate REGISTRATE = Create.registrate();
@ -73,8 +75,8 @@ public class AllFluids {
@OnlyIn(Dist.CLIENT) @OnlyIn(Dist.CLIENT)
private static void makeTranslucent(FluidEntry<?> entry) { private static void makeTranslucent(FluidEntry<?> entry) {
ForgeFlowingFluid fluid = entry.get(); ForgeFlowingFluid fluid = entry.get();
RenderTypeLookup.setRenderLayer(fluid, RenderType.translucent()); ItemBlockRenderTypes.setRenderLayer(fluid, RenderType.translucent());
RenderTypeLookup.setRenderLayer(fluid.getSource(), RenderType.translucent()); ItemBlockRenderTypes.setRenderLayer(fluid.getSource(), RenderType.translucent());
} }
@Nullable @Nullable
@ -102,7 +104,7 @@ public class AllFluids {
} }
@Override @Override
public int getColor(IBlockDisplayReader world, BlockPos pos) { public int getColor(BlockAndTintGetter world, BlockPos pos) {
return 0x00ffffff; return 0x00ffffff;
} }

View file

@ -12,9 +12,9 @@ import com.simibubi.create.content.contraptions.components.structureMovement.int
import com.simibubi.create.content.contraptions.components.structureMovement.interaction.LeverMovingInteraction; import com.simibubi.create.content.contraptions.components.structureMovement.interaction.LeverMovingInteraction;
import com.simibubi.create.content.contraptions.components.structureMovement.interaction.TrapdoorMovingInteraction; import com.simibubi.create.content.contraptions.components.structureMovement.interaction.TrapdoorMovingInteraction;
import net.minecraft.block.Block; import net.minecraft.world.level.block.Block;
import net.minecraft.block.Blocks; import net.minecraft.world.level.block.Blocks;
import net.minecraft.util.ResourceLocation; import net.minecraft.resources.ResourceLocation;
public class AllInteractionBehaviours { public class AllInteractionBehaviours {
private static final HashMap<ResourceLocation, Supplier<MovingInteractionBehaviour>> INTERACT_BEHAVIOURS = private static final HashMap<ResourceLocation, Supplier<MovingInteractionBehaviour>> INTERACT_BEHAVIOURS =

View file

@ -56,13 +56,13 @@ import com.simibubi.create.foundation.item.TagDependentIngredientItem;
import com.simibubi.create.foundation.item.TooltipHelper; import com.simibubi.create.foundation.item.TooltipHelper;
import com.tterrag.registrate.util.entry.ItemEntry; import com.tterrag.registrate.util.entry.ItemEntry;
import net.minecraft.item.BlockItem; import net.minecraft.world.item.BlockItem;
import net.minecraft.item.Food; import net.minecraft.world.food.FoodProperties;
import net.minecraft.item.Item; import net.minecraft.world.item.Item;
import net.minecraft.item.Rarity; import net.minecraft.world.item.Rarity;
import net.minecraft.tags.ITag; import net.minecraft.tags.Tag;
import net.minecraft.tags.ItemTags; import net.minecraft.tags.ItemTags;
import net.minecraft.util.ResourceLocation; import net.minecraft.resources.ResourceLocation;
import net.minecraftforge.common.Tags; import net.minecraftforge.common.Tags;
public class AllItems { public class AllItems {
@ -115,26 +115,26 @@ public class AllItems {
.register(); .register();
public static final ItemEntry<Item> BAR_OF_CHOCOLATE = REGISTRATE.item("bar_of_chocolate", Item::new) public static final ItemEntry<Item> BAR_OF_CHOCOLATE = REGISTRATE.item("bar_of_chocolate", Item::new)
.properties(p -> p.food(new Food.Builder().nutrition(6) .properties(p -> p.food(new FoodProperties.Builder().nutrition(6)
.saturationMod(0.3F) .saturationMod(0.3F)
.build())) .build()))
.lang("Bar of Chocolate") .lang("Bar of Chocolate")
.register(); .register();
public static final ItemEntry<Item> SWEET_ROLL = REGISTRATE.item("sweet_roll", Item::new) public static final ItemEntry<Item> SWEET_ROLL = REGISTRATE.item("sweet_roll", Item::new)
.properties(p -> p.food(new Food.Builder().nutrition(6) .properties(p -> p.food(new FoodProperties.Builder().nutrition(6)
.saturationMod(0.8F) .saturationMod(0.8F)
.build())) .build()))
.register(); .register();
public static final ItemEntry<Item> CHOCOLATE_BERRIES = REGISTRATE.item("chocolate_glazed_berries", Item::new) public static final ItemEntry<Item> CHOCOLATE_BERRIES = REGISTRATE.item("chocolate_glazed_berries", Item::new)
.properties(p -> p.food(new Food.Builder().nutrition(7) .properties(p -> p.food(new FoodProperties.Builder().nutrition(7)
.saturationMod(0.8F) .saturationMod(0.8F)
.build())) .build()))
.register(); .register();
public static final ItemEntry<Item> HONEYED_APPLE = REGISTRATE.item("honeyed_apple", Item::new) public static final ItemEntry<Item> HONEYED_APPLE = REGISTRATE.item("honeyed_apple", Item::new)
.properties(p -> p.food(new Food.Builder().nutrition(8) .properties(p -> p.food(new FoodProperties.Builder().nutrition(8)
.saturationMod(0.8F) .saturationMod(0.8F)
.build())) .build()))
.register(); .register();
@ -359,7 +359,7 @@ public class AllItems {
// } // }
@SafeVarargs @SafeVarargs
private static ItemEntry<Item> taggedIngredient(String name, ITag.INamedTag<Item>... tags) { private static ItemEntry<Item> taggedIngredient(String name, Tag.Named<Item>... tags) {
return REGISTRATE.item(name, Item::new) return REGISTRATE.item(name, Item::new)
.tag(tags) .tag(tags)
.register(); .register();

View file

@ -3,8 +3,8 @@ package com.simibubi.create;
import org.lwjgl.glfw.GLFW; import org.lwjgl.glfw.GLFW;
import net.minecraft.client.Minecraft; import net.minecraft.client.Minecraft;
import net.minecraft.client.gui.screen.Screen; import net.minecraft.client.gui.screens.Screen;
import net.minecraft.client.settings.KeyBinding; import net.minecraft.client.KeyMapping;
import net.minecraftforge.fml.client.registry.ClientRegistry; import net.minecraftforge.fml.client.registry.ClientRegistry;
public enum AllKeys { public enum AllKeys {
@ -15,7 +15,7 @@ public enum AllKeys {
; ;
private KeyBinding keybind; private KeyMapping keybind;
private String description; private String description;
private int key; private int key;
private boolean modifiable; private boolean modifiable;
@ -28,7 +28,7 @@ public enum AllKeys {
public static void register() { public static void register() {
for (AllKeys key : values()) { for (AllKeys key : values()) {
key.keybind = new KeyBinding(key.description, key.key, Create.NAME); key.keybind = new KeyMapping(key.description, key.key, Create.NAME);
if (!key.modifiable) if (!key.modifiable)
continue; continue;
@ -36,7 +36,7 @@ public enum AllKeys {
} }
} }
public KeyBinding getKeybind() { public KeyMapping getKeybind() {
return keybind; return keybind;
} }

View file

@ -11,10 +11,10 @@ import com.simibubi.create.content.contraptions.components.actors.dispenser.Drop
import com.simibubi.create.content.contraptions.components.structureMovement.MovementBehaviour; import com.simibubi.create.content.contraptions.components.structureMovement.MovementBehaviour;
import com.tterrag.registrate.util.nullness.NonNullConsumer; import com.tterrag.registrate.util.nullness.NonNullConsumer;
import net.minecraft.block.Block; import net.minecraft.world.level.block.Block;
import net.minecraft.block.BlockState; import net.minecraft.world.level.block.state.BlockState;
import net.minecraft.block.Blocks; import net.minecraft.world.level.block.Blocks;
import net.minecraft.util.ResourceLocation; import net.minecraft.resources.ResourceLocation;
public class AllMovementBehaviours { public class AllMovementBehaviours {
private static final HashMap<ResourceLocation, MovementBehaviour> MOVEMENT_BEHAVIOURS = new HashMap<>(); private static final HashMap<ResourceLocation, MovementBehaviour> MOVEMENT_BEHAVIOURS = new HashMap<>();

View file

@ -14,10 +14,10 @@ import com.simibubi.create.content.curiosities.bell.SoulParticle;
import com.simibubi.create.foundation.utility.Lang; import com.simibubi.create.foundation.utility.Lang;
import net.minecraft.client.Minecraft; import net.minecraft.client.Minecraft;
import net.minecraft.client.particle.ParticleManager; import net.minecraft.client.particle.ParticleEngine;
import net.minecraft.particles.IParticleData; import net.minecraft.core.particles.ParticleOptions;
import net.minecraft.particles.ParticleType; import net.minecraft.core.particles.ParticleType;
import net.minecraft.util.ResourceLocation; import net.minecraft.resources.ResourceLocation;
import net.minecraftforge.api.distmarker.Dist; import net.minecraftforge.api.distmarker.Dist;
import net.minecraftforge.api.distmarker.OnlyIn; import net.minecraftforge.api.distmarker.OnlyIn;
import net.minecraftforge.client.event.ParticleFactoryRegisterEvent; import net.minecraftforge.client.event.ParticleFactoryRegisterEvent;
@ -42,7 +42,7 @@ public enum AllParticleTypes {
private ParticleEntry<?> entry; private ParticleEntry<?> entry;
<D extends IParticleData> AllParticleTypes(Supplier<? extends ICustomParticleData<D>> typeFactory) { <D extends ParticleOptions> AllParticleTypes(Supplier<? extends ICustomParticleData<D>> typeFactory) {
String asId = Lang.asId(this.name()); String asId = Lang.asId(this.name());
entry = new ParticleEntry<>(new ResourceLocation(Create.ID, asId), typeFactory); entry = new ParticleEntry<>(new ResourceLocation(Create.ID, asId), typeFactory);
} }
@ -54,7 +54,7 @@ public enum AllParticleTypes {
@OnlyIn(Dist.CLIENT) @OnlyIn(Dist.CLIENT)
public static void registerFactories(ParticleFactoryRegisterEvent event) { public static void registerFactories(ParticleFactoryRegisterEvent event) {
ParticleManager particles = Minecraft.getInstance().particleEngine; ParticleEngine particles = Minecraft.getInstance().particleEngine;
for (AllParticleTypes particle : values()) for (AllParticleTypes particle : values())
particle.entry.registerFactory(particles); particle.entry.registerFactory(particles);
} }
@ -67,7 +67,7 @@ public enum AllParticleTypes {
return Lang.asId(name()); return Lang.asId(name());
} }
private class ParticleEntry<D extends IParticleData> { private class ParticleEntry<D extends ParticleOptions> {
Supplier<? extends ICustomParticleData<D>> typeFactory; Supplier<? extends ICustomParticleData<D>> typeFactory;
ParticleType<D> type; ParticleType<D> type;
ResourceLocation id; ResourceLocation id;
@ -91,7 +91,7 @@ public enum AllParticleTypes {
} }
@OnlyIn(Dist.CLIENT) @OnlyIn(Dist.CLIENT)
void registerFactory(ParticleManager particles) { void registerFactory(ParticleEngine particles) {
typeFactory.get() typeFactory.get()
.register(getOrCreateType(), particles); .register(getOrCreateType(), particles);
} }

View file

@ -24,15 +24,15 @@ import com.simibubi.create.content.curiosities.tools.SandPaperPolishingRecipe;
import com.simibubi.create.foundation.utility.Lang; import com.simibubi.create.foundation.utility.Lang;
import com.simibubi.create.foundation.utility.recipe.IRecipeTypeInfo; import com.simibubi.create.foundation.utility.recipe.IRecipeTypeInfo;
import net.minecraft.inventory.IInventory; import net.minecraft.world.Container;
import net.minecraft.item.crafting.IRecipe; import net.minecraft.world.item.crafting.Recipe;
import net.minecraft.item.crafting.IRecipeSerializer; import net.minecraft.world.item.crafting.RecipeSerializer;
import net.minecraft.item.crafting.IRecipeType; import net.minecraft.world.item.crafting.RecipeType;
import net.minecraft.item.crafting.ShapedRecipe; import net.minecraft.world.item.crafting.ShapedRecipe;
import net.minecraft.item.crafting.SpecialRecipeSerializer; import net.minecraft.world.item.crafting.SimpleRecipeSerializer;
import net.minecraft.util.ResourceLocation; import net.minecraft.resources.ResourceLocation;
import net.minecraft.util.registry.Registry; import net.minecraft.core.Registry;
import net.minecraft.world.World; import net.minecraft.world.level.Level;
import net.minecraftforge.event.RegistryEvent; import net.minecraftforge.event.RegistryEvent;
public enum AllRecipeTypes implements IRecipeTypeInfo { public enum AllRecipeTypes implements IRecipeTypeInfo {
@ -54,27 +54,27 @@ public enum AllRecipeTypes implements IRecipeTypeInfo {
MECHANICAL_CRAFTING(MechanicalCraftingRecipe.Serializer::new), MECHANICAL_CRAFTING(MechanicalCraftingRecipe.Serializer::new),
SEQUENCED_ASSEMBLY(SequencedAssemblyRecipeSerializer::new), SEQUENCED_ASSEMBLY(SequencedAssemblyRecipeSerializer::new),
TOOLBOX_DYEING(() -> new SpecialRecipeSerializer<>(ToolboxDyeingRecipe::new), IRecipeType.CRAFTING); TOOLBOX_DYEING(() -> new SimpleRecipeSerializer<>(ToolboxDyeingRecipe::new), RecipeType.CRAFTING);
; ;
private ResourceLocation id; private ResourceLocation id;
private Supplier<IRecipeSerializer<?>> serializerSupplier; private Supplier<RecipeSerializer<?>> serializerSupplier;
private Supplier<IRecipeType<?>> typeSupplier; private Supplier<RecipeType<?>> typeSupplier;
private IRecipeSerializer<?> serializer; private RecipeSerializer<?> serializer;
private IRecipeType<?> type; private RecipeType<?> type;
AllRecipeTypes(Supplier<IRecipeSerializer<?>> serializerSupplier, Supplier<IRecipeType<?>> typeSupplier) { AllRecipeTypes(Supplier<RecipeSerializer<?>> serializerSupplier, Supplier<RecipeType<?>> typeSupplier) {
this.id = Create.asResource(Lang.asId(name())); this.id = Create.asResource(Lang.asId(name()));
this.serializerSupplier = serializerSupplier; this.serializerSupplier = serializerSupplier;
this.typeSupplier = typeSupplier; this.typeSupplier = typeSupplier;
} }
AllRecipeTypes(Supplier<IRecipeSerializer<?>> serializerSupplier, IRecipeType<?> existingType) { AllRecipeTypes(Supplier<RecipeSerializer<?>> serializerSupplier, RecipeType<?> existingType) {
this(serializerSupplier, () -> existingType); this(serializerSupplier, () -> existingType);
} }
AllRecipeTypes(Supplier<IRecipeSerializer<?>> serializerSupplier) { AllRecipeTypes(Supplier<RecipeSerializer<?>> serializerSupplier) {
this.id = Create.asResource(Lang.asId(name())); this.id = Create.asResource(Lang.asId(name()));
this.serializerSupplier = serializerSupplier; this.serializerSupplier = serializerSupplier;
this.typeSupplier = () -> simpleType(id); this.typeSupplier = () -> simpleType(id);
@ -91,22 +91,22 @@ public enum AllRecipeTypes implements IRecipeTypeInfo {
@SuppressWarnings("unchecked") @SuppressWarnings("unchecked")
@Override @Override
public <T extends IRecipeSerializer<?>> T getSerializer() { public <T extends RecipeSerializer<?>> T getSerializer() {
return (T) serializer; return (T) serializer;
} }
@SuppressWarnings("unchecked") @SuppressWarnings("unchecked")
@Override @Override
public <T extends IRecipeType<?>> T getType() { public <T extends RecipeType<?>> T getType() {
return (T) type; return (T) type;
} }
public <C extends IInventory, T extends IRecipe<C>> Optional<T> find(C inv, World world) { public <C extends Container, T extends Recipe<C>> Optional<T> find(C inv, Level world) {
return world.getRecipeManager() return world.getRecipeManager()
.getRecipeFor(getType(), inv, world); .getRecipeFor(getType(), inv, world);
} }
public static void register(RegistryEvent.Register<IRecipeSerializer<?>> event) { public static void register(RegistryEvent.Register<RecipeSerializer<?>> event) {
ShapedRecipe.setCraftingSize(9, 9); ShapedRecipe.setCraftingSize(9, 9);
for (AllRecipeTypes r : AllRecipeTypes.values()) { for (AllRecipeTypes r : AllRecipeTypes.values()) {
@ -118,13 +118,13 @@ public enum AllRecipeTypes implements IRecipeTypeInfo {
} }
} }
private static Supplier<IRecipeSerializer<?>> processingSerializer(ProcessingRecipeFactory<?> factory) { private static Supplier<RecipeSerializer<?>> processingSerializer(ProcessingRecipeFactory<?> factory) {
return () -> new ProcessingRecipeSerializer<>(factory); return () -> new ProcessingRecipeSerializer<>(factory);
} }
public static <T extends IRecipe<?>> IRecipeType<T> simpleType(ResourceLocation id) { public static <T extends Recipe<?>> RecipeType<T> simpleType(ResourceLocation id) {
String stringId = id.toString(); String stringId = id.toString();
return Registry.register(Registry.RECIPE_TYPE, id, new IRecipeType<T>() { return Registry.register(Registry.RECIPE_TYPE, id, new RecipeType<T>() {
@Override @Override
public String toString() { public String toString() {
return stringId; return stringId;

View file

@ -1,23 +1,24 @@
package com.simibubi.create; package com.simibubi.create;
import static net.minecraft.util.Direction.NORTH; import static net.minecraft.util.Direction.NORTH;
import static net.minecraft.util.Direction.SOUTH; import staticnet.minecraft.core.Directionn.SOUTH;
import static net.minecraft.util.Direction.UP; import static net.minecraft.util.Direction.UP;
import java.util.function.BiFunction; import javanet.minecraft.core.Direction
import com.simibubi.create.content.logistics.block.chute.ChuteShapes; import com.simibubi.create.content.logistics.block.chute.ChuteShapes;
import com.simibubi.create.foundation.utility.VoxelShaper; import com.simibubi.create.foundation.utility.VoxelShaper;
import net.minecraft.block.Block; import net.minecraft.world.level.block.Block;
import net.minecraft.block.Blocks; import net.minecraft.world.level.block.Blocks;
import net.minecraft.block.DirectionalBlock; import net.minecraft.world.level.block.DirectionalBlock;
import net.minecraft.block.PistonHeadBlock; import net.minecraft.world.level.block.piston.PistonHeadBlock;
import net.minecraft.util.Direction; import net.minecraft.util.Direction;
import net.minecraft.util.Direction.Axis; import net.minecraft.core.Direction.Axis;
import net.minecraft.util.math.shapes.IBooleanFunction; import net.minecraft.world.phys.shapes.BooleanOp;
import net.minecraft.util.math.shapes.VoxelShape; import net.minecraft.world.phys.shapes.VoxelShape;
import net.minecraft.util.math.shapes.VoxelShapes; import net.minecraft.world.phys.shapes.Shapes;
import java.util.function.BiFunction;
public class AllShapes { public class AllShapes {
@ -161,7 +162,7 @@ public class AllShapes {
HEATER_BLOCK_SPECIAL_COLLISION_SHAPE = shape(0, 0, 0, 16, 4, 16).build(), HEATER_BLOCK_SPECIAL_COLLISION_SHAPE = shape(0, 0, 0, 16, 4, 16).build(),
CRUSHING_WHEEL_COLLISION_SHAPE = cuboid(0, 0, 0, 16, 16, 16), SEAT = cuboid(0, 0, 0, 16, 8, 16), CRUSHING_WHEEL_COLLISION_SHAPE = cuboid(0, 0, 0, 16, 16, 16), SEAT = cuboid(0, 0, 0, 16, 8, 16),
SEAT_COLLISION = cuboid(0, 0, 0, 16, 6, 16), SEAT_COLLISION = cuboid(0, 0, 0, 16, 6, 16),
MECHANICAL_PROCESSOR_SHAPE = shape(VoxelShapes.block()).erase(4, 0, 4, 12, 16, 12) MECHANICAL_PROCESSOR_SHAPE = shape(Shapes.block()).erase(4, 0, 4, 12, 16, 12)
.build(), .build(),
TURNTABLE_SHAPE = shape(1, 4, 1, 15, 8, 15).add(5, 0, 5, 11, 4, 11) TURNTABLE_SHAPE = shape(1, 4, 1, 15, 8, 15).add(5, 0, 5, 11, 4, 11)
.build(), .build(),
@ -251,7 +252,7 @@ public class AllShapes {
} }
public Builder add(VoxelShape shape) { public Builder add(VoxelShape shape) {
this.shape = VoxelShapes.or(this.shape, shape); this.shape = Shapes.or(this.shape, shape);
return this; return this;
} }
@ -260,7 +261,7 @@ public class AllShapes {
} }
public Builder erase(double x1, double y1, double z1, double x2, double y2, double z2) { public Builder erase(double x1, double y1, double z1, double x2, double y2, double z2) {
this.shape = VoxelShapes.join(shape, cuboid(x1, y1, z1, x2, y2, z2), IBooleanFunction.ONLY_FIRST); this.shape = Shapes.join(shape, cuboid(x1, y1, z1, x2, y2, z2), BooleanOp.ONLY_FIRST);
return this; return this;
} }

View file

@ -15,17 +15,17 @@ import com.simibubi.create.foundation.utility.Couple;
import com.simibubi.create.foundation.utility.Pair; import com.simibubi.create.foundation.utility.Pair;
import net.minecraft.data.DataGenerator; import net.minecraft.data.DataGenerator;
import net.minecraft.data.DirectoryCache; import net.minecraft.data.HashCache;
import net.minecraft.data.IDataProvider; import net.minecraft.data.DataProvider;
import net.minecraft.entity.Entity; import net.minecraft.world.entity.Entity;
import net.minecraft.entity.player.PlayerEntity; import net.minecraft.world.entity.player.Player;
import net.minecraft.util.ResourceLocation; import net.minecraft.resources.ResourceLocation;
import net.minecraft.util.SoundCategory; import net.minecraft.sounds.SoundSource;
import net.minecraft.util.SoundEvent; import net.minecraft.sounds.SoundEvent;
import net.minecraft.util.SoundEvents; import net.minecraft.sounds.SoundEvents;
import net.minecraft.util.math.BlockPos; import net.minecraft.core.BlockPos;
import net.minecraft.util.math.vector.Vector3d; import net.minecraft.world.phys.Vec3;
import net.minecraft.world.World; import net.minecraft.world.level.Level;
import net.minecraftforge.event.RegistryEvent; import net.minecraftforge.event.RegistryEvent;
import net.minecraftforge.registries.IForgeRegistry; import net.minecraftforge.registries.IForgeRegistry;
@ -37,193 +37,193 @@ public class AllSoundEvents {
SCHEMATICANNON_LAUNCH_BLOCK = create("schematicannon_launch_block").subtitle("Schematicannon fires") SCHEMATICANNON_LAUNCH_BLOCK = create("schematicannon_launch_block").subtitle("Schematicannon fires")
.playExisting(SoundEvents.GENERIC_EXPLODE, .1f, 1.1f) .playExisting(SoundEvents.GENERIC_EXPLODE, .1f, 1.1f)
.category(SoundCategory.BLOCKS) .category(SoundSource.BLOCKS)
.build(), .build(),
SCHEMATICANNON_FINISH = create("schematicannon_finish").subtitle("Schematicannon dings") SCHEMATICANNON_FINISH = create("schematicannon_finish").subtitle("Schematicannon dings")
.playExisting(SoundEvents.NOTE_BLOCK_BELL, 1, .7f) .playExisting(SoundEvents.NOTE_BLOCK_BELL, 1, .7f)
.category(SoundCategory.BLOCKS) .category(SoundSource.BLOCKS)
.build(), .build(),
DEPOT_SLIDE = create("depot_slide").subtitle("Item slides") DEPOT_SLIDE = create("depot_slide").subtitle("Item slides")
.playExisting(SoundEvents.SAND_BREAK, .125f, 1.5f) .playExisting(SoundEvents.SAND_BREAK, .125f, 1.5f)
.category(SoundCategory.BLOCKS) .category(SoundSource.BLOCKS)
.build(), .build(),
DEPOT_PLOP = create("depot_plop").subtitle("Item lands") DEPOT_PLOP = create("depot_plop").subtitle("Item lands")
.playExisting(SoundEvents.ITEM_FRAME_ADD_ITEM, .25f, 1.25f) .playExisting(SoundEvents.ITEM_FRAME_ADD_ITEM, .25f, 1.25f)
.category(SoundCategory.BLOCKS) .category(SoundSource.BLOCKS)
.build(), .build(),
FUNNEL_FLAP = create("funnel_flap").subtitle("Funnel flaps") FUNNEL_FLAP = create("funnel_flap").subtitle("Funnel flaps")
.playExisting(SoundEvents.ITEM_FRAME_ROTATE_ITEM, .125f, 1.5f) .playExisting(SoundEvents.ITEM_FRAME_ROTATE_ITEM, .125f, 1.5f)
.playExisting(SoundEvents.WOOL_BREAK, .0425f, .75f) .playExisting(SoundEvents.WOOL_BREAK, .0425f, .75f)
.category(SoundCategory.BLOCKS) .category(SoundSource.BLOCKS)
.build(), .build(),
SLIME_ADDED = create("slime_added").subtitle("Slime squishes") SLIME_ADDED = create("slime_added").subtitle("Slime squishes")
.playExisting(SoundEvents.SLIME_BLOCK_PLACE) .playExisting(SoundEvents.SLIME_BLOCK_PLACE)
.category(SoundCategory.BLOCKS) .category(SoundSource.BLOCKS)
.build(), .build(),
MECHANICAL_PRESS_ACTIVATION = create("mechanical_press_activation").subtitle("Mechanical Press clangs") MECHANICAL_PRESS_ACTIVATION = create("mechanical_press_activation").subtitle("Mechanical Press clangs")
.playExisting(SoundEvents.ANVIL_LAND, .125f, 1f) .playExisting(SoundEvents.ANVIL_LAND, .125f, 1f)
.playExisting(SoundEvents.ITEM_BREAK, .5f, 1f) .playExisting(SoundEvents.ITEM_BREAK, .5f, 1f)
.category(SoundCategory.BLOCKS) .category(SoundSource.BLOCKS)
.build(), .build(),
MECHANICAL_PRESS_ACTIVATION_ON_BELT = MECHANICAL_PRESS_ACTIVATION_ON_BELT =
create("mechanical_press_activation_belt").subtitle("Mechanical Press bonks") create("mechanical_press_activation_belt").subtitle("Mechanical Press bonks")
.playExisting(SoundEvents.WOOL_HIT, .75f, 1f) .playExisting(SoundEvents.WOOL_HIT, .75f, 1f)
.playExisting(SoundEvents.ITEM_BREAK, .15f, .75f) .playExisting(SoundEvents.ITEM_BREAK, .15f, .75f)
.category(SoundCategory.BLOCKS) .category(SoundSource.BLOCKS)
.build(), .build(),
MIXING = create("mixing").subtitle("Mixing noises") MIXING = create("mixing").subtitle("Mixing noises")
.playExisting(SoundEvents.GILDED_BLACKSTONE_BREAK, .125f, .5f) .playExisting(SoundEvents.GILDED_BLACKSTONE_BREAK, .125f, .5f)
.playExisting(SoundEvents.NETHERRACK_BREAK, .125f, .5f) .playExisting(SoundEvents.NETHERRACK_BREAK, .125f, .5f)
.category(SoundCategory.BLOCKS) .category(SoundSource.BLOCKS)
.build(), .build(),
CRANKING = create("cranking").subtitle("Hand Crank turns") CRANKING = create("cranking").subtitle("Hand Crank turns")
.playExisting(SoundEvents.WOOD_PLACE, .075f, .5f) .playExisting(SoundEvents.WOOD_PLACE, .075f, .5f)
.playExisting(SoundEvents.WOODEN_BUTTON_CLICK_OFF, .025f, .5f) .playExisting(SoundEvents.WOODEN_BUTTON_CLICK_OFF, .025f, .5f)
.category(SoundCategory.BLOCKS) .category(SoundSource.BLOCKS)
.build(), .build(),
WORLDSHAPER_PLACE = create("worldshaper_place").subtitle("Worldshaper zaps") WORLDSHAPER_PLACE = create("worldshaper_place").subtitle("Worldshaper zaps")
.playExisting(SoundEvents.NOTE_BLOCK_BASEDRUM) .playExisting(SoundEvents.NOTE_BLOCK_BASEDRUM)
.category(SoundCategory.PLAYERS) .category(SoundSource.PLAYERS)
.build(), .build(),
SCROLL_VALUE = create("scroll_value").subtitle("Scroll-input clicks") SCROLL_VALUE = create("scroll_value").subtitle("Scroll-input clicks")
.playExisting(SoundEvents.NOTE_BLOCK_HAT, .124f, 1f) .playExisting(SoundEvents.NOTE_BLOCK_HAT, .124f, 1f)
.category(SoundCategory.PLAYERS) .category(SoundSource.PLAYERS)
.build(), .build(),
CONFIRM = create("confirm").subtitle("Affirmative ding") CONFIRM = create("confirm").subtitle("Affirmative ding")
.playExisting(SoundEvents.NOTE_BLOCK_BELL, 0.5f, 0.8f) .playExisting(SoundEvents.NOTE_BLOCK_BELL, 0.5f, 0.8f)
.category(SoundCategory.PLAYERS) .category(SoundSource.PLAYERS)
.build(), .build(),
DENY = create("deny").subtitle("Declining boop") DENY = create("deny").subtitle("Declining boop")
.playExisting(SoundEvents.NOTE_BLOCK_BASS, 1f, 0.5f) .playExisting(SoundEvents.NOTE_BLOCK_BASS, 1f, 0.5f)
.category(SoundCategory.PLAYERS) .category(SoundSource.PLAYERS)
.build(), .build(),
COGS = create("cogs").subtitle("Cogwheels rumble") COGS = create("cogs").subtitle("Cogwheels rumble")
.category(SoundCategory.BLOCKS) .category(SoundSource.BLOCKS)
.build(), .build(),
FWOOMP = create("fwoomp").subtitle("Potato Launcher fwoomps") FWOOMP = create("fwoomp").subtitle("Potato Launcher fwoomps")
.category(SoundCategory.PLAYERS) .category(SoundSource.PLAYERS)
.build(), .build(),
POTATO_HIT = create("potato_hit").subtitle("Vegetable impacts") POTATO_HIT = create("potato_hit").subtitle("Vegetable impacts")
.playExisting(SoundEvents.ITEM_FRAME_BREAK, .75f, .75f) .playExisting(SoundEvents.ITEM_FRAME_BREAK, .75f, .75f)
.playExisting(SoundEvents.WEEPING_VINES_BREAK, .75f, 1.25f) .playExisting(SoundEvents.WEEPING_VINES_BREAK, .75f, 1.25f)
.category(SoundCategory.PLAYERS) .category(SoundSource.PLAYERS)
.build(), .build(),
CONTRAPTION_ASSEMBLE = create("contraption_assemble").subtitle("Contraption moves") CONTRAPTION_ASSEMBLE = create("contraption_assemble").subtitle("Contraption moves")
.playExisting(SoundEvents.WOODEN_TRAPDOOR_OPEN, .5f, .5f) .playExisting(SoundEvents.WOODEN_TRAPDOOR_OPEN, .5f, .5f)
.playExisting(SoundEvents.CHEST_OPEN, .045f, .74f) .playExisting(SoundEvents.CHEST_OPEN, .045f, .74f)
.category(SoundCategory.BLOCKS) .category(SoundSource.BLOCKS)
.build(), .build(),
CONTRAPTION_DISASSEMBLE = create("contraption_disassemble").subtitle("Contraption stops") CONTRAPTION_DISASSEMBLE = create("contraption_disassemble").subtitle("Contraption stops")
.playExisting(SoundEvents.IRON_TRAPDOOR_CLOSE, .35f, .75f) .playExisting(SoundEvents.IRON_TRAPDOOR_CLOSE, .35f, .75f)
.category(SoundCategory.BLOCKS) .category(SoundSource.BLOCKS)
.build(), .build(),
WRENCH_ROTATE = create("wrench_rotate").subtitle("Wrench used") WRENCH_ROTATE = create("wrench_rotate").subtitle("Wrench used")
.playExisting(SoundEvents.WOODEN_TRAPDOOR_CLOSE, .25f, 1.25f) .playExisting(SoundEvents.WOODEN_TRAPDOOR_CLOSE, .25f, 1.25f)
.category(SoundCategory.BLOCKS) .category(SoundSource.BLOCKS)
.build(), .build(),
WRENCH_REMOVE = create("wrench_remove").subtitle("Component breaks") WRENCH_REMOVE = create("wrench_remove").subtitle("Component breaks")
.playExisting(SoundEvents.ITEM_PICKUP, .25f, .75f) .playExisting(SoundEvents.ITEM_PICKUP, .25f, .75f)
.playExisting(SoundEvents.NETHERITE_BLOCK_HIT, .25f, .75f) .playExisting(SoundEvents.NETHERITE_BLOCK_HIT, .25f, .75f)
.category(SoundCategory.BLOCKS) .category(SoundSource.BLOCKS)
.build(), .build(),
CRAFTER_CLICK = create("crafter_click").subtitle("Crafter clicks") CRAFTER_CLICK = create("crafter_click").subtitle("Crafter clicks")
.playExisting(SoundEvents.NETHERITE_BLOCK_HIT, .25f, 1) .playExisting(SoundEvents.NETHERITE_BLOCK_HIT, .25f, 1)
.playExisting(SoundEvents.WOODEN_TRAPDOOR_OPEN, .125f, 1) .playExisting(SoundEvents.WOODEN_TRAPDOOR_OPEN, .125f, 1)
.category(SoundCategory.BLOCKS) .category(SoundSource.BLOCKS)
.build(), .build(),
CRAFTER_CRAFT = create("crafter_craft").subtitle("Crafter crafts") CRAFTER_CRAFT = create("crafter_craft").subtitle("Crafter crafts")
.playExisting(SoundEvents.ITEM_BREAK, .125f, .75f) .playExisting(SoundEvents.ITEM_BREAK, .125f, .75f)
.category(SoundCategory.BLOCKS) .category(SoundSource.BLOCKS)
.build(), .build(),
COPPER_ARMOR_EQUIP = create("copper_armor_equip").subtitle("Diving equipment clinks") COPPER_ARMOR_EQUIP = create("copper_armor_equip").subtitle("Diving equipment clinks")
.playExisting(SoundEvents.ARMOR_EQUIP_GOLD, 1f, 1f) .playExisting(SoundEvents.ARMOR_EQUIP_GOLD, 1f, 1f)
.category(SoundCategory.PLAYERS) .category(SoundSource.PLAYERS)
.build(), .build(),
AUTO_POLISH = create("deployer_polish").subtitle("Deployer applies polish") AUTO_POLISH = create("deployer_polish").subtitle("Deployer applies polish")
.playExisting(SoundEvents.UI_STONECUTTER_TAKE_RESULT, 1f, 1f) .playExisting(SoundEvents.UI_STONECUTTER_TAKE_RESULT, 1f, 1f)
.category(SoundCategory.BLOCKS) .category(SoundSource.BLOCKS)
.build(), .build(),
CONTROLLER_CLICK = create("controller_click").subtitle("Controller clicks") CONTROLLER_CLICK = create("controller_click").subtitle("Controller clicks")
.playExisting(SoundEvents.ITEM_FRAME_ADD_ITEM, .35f, 1f) .playExisting(SoundEvents.ITEM_FRAME_ADD_ITEM, .35f, 1f)
.category(SoundCategory.BLOCKS) .category(SoundSource.BLOCKS)
.build(), .build(),
CONTROLLER_PUT = create("controller_put").subtitle("Controller thumps") CONTROLLER_PUT = create("controller_put").subtitle("Controller thumps")
.playExisting(SoundEvents.BOOK_PUT, 1f, 1f) .playExisting(SoundEvents.BOOK_PUT, 1f, 1f)
.category(SoundCategory.BLOCKS) .category(SoundSource.BLOCKS)
.build(), .build(),
CONTROLLER_TAKE = create("controller_take").subtitle("Lectern empties") CONTROLLER_TAKE = create("controller_take").subtitle("Lectern empties")
.playExisting(SoundEvents.ITEM_FRAME_REMOVE_ITEM, 1f, 1f) .playExisting(SoundEvents.ITEM_FRAME_REMOVE_ITEM, 1f, 1f)
.category(SoundCategory.BLOCKS) .category(SoundSource.BLOCKS)
.build(), .build(),
SAW_ACTIVATE_WOOD = create("saw_activate_wood").subtitle("Mechanical Saw activates") SAW_ACTIVATE_WOOD = create("saw_activate_wood").subtitle("Mechanical Saw activates")
.playExisting(SoundEvents.BOAT_PADDLE_LAND, .75f, 1.5f) .playExisting(SoundEvents.BOAT_PADDLE_LAND, .75f, 1.5f)
.category(SoundCategory.BLOCKS) .category(SoundSource.BLOCKS)
.build(), .build(),
SAW_ACTIVATE_STONE = create("saw_activate_stone").subtitle("Mechanical Saw activates") SAW_ACTIVATE_STONE = create("saw_activate_stone").subtitle("Mechanical Saw activates")
.playExisting(SoundEvents.UI_STONECUTTER_TAKE_RESULT, .125f, 1.25f) .playExisting(SoundEvents.UI_STONECUTTER_TAKE_RESULT, .125f, 1.25f)
.category(SoundCategory.BLOCKS) .category(SoundSource.BLOCKS)
.build(), .build(),
BLAZE_MUNCH = create("blaze_munch").subtitle("Blaze Burner munches") BLAZE_MUNCH = create("blaze_munch").subtitle("Blaze Burner munches")
.playExisting(SoundEvents.GENERIC_EAT, .5f, 1f) .playExisting(SoundEvents.GENERIC_EAT, .5f, 1f)
.category(SoundCategory.BLOCKS) .category(SoundSource.BLOCKS)
.build(), .build(),
CRUSHING_1 = create("crushing_1").subtitle("Crushing noises") CRUSHING_1 = create("crushing_1").subtitle("Crushing noises")
.playExisting(SoundEvents.NETHERRACK_HIT) .playExisting(SoundEvents.NETHERRACK_HIT)
.category(SoundCategory.BLOCKS) .category(SoundSource.BLOCKS)
.build(), .build(),
CRUSHING_2 = create("crushing_2").noSubtitle() CRUSHING_2 = create("crushing_2").noSubtitle()
.playExisting(SoundEvents.GRAVEL_PLACE) .playExisting(SoundEvents.GRAVEL_PLACE)
.category(SoundCategory.BLOCKS) .category(SoundSource.BLOCKS)
.build(), .build(),
CRUSHING_3 = create("crushing_3").noSubtitle() CRUSHING_3 = create("crushing_3").noSubtitle()
.playExisting(SoundEvents.NETHERITE_BLOCK_BREAK) .playExisting(SoundEvents.NETHERITE_BLOCK_BREAK)
.category(SoundCategory.BLOCKS) .category(SoundSource.BLOCKS)
.build(), .build(),
PECULIAR_BELL_USE = create("peculiar_bell_use").subtitle("Peculiar Bell tolls") PECULIAR_BELL_USE = create("peculiar_bell_use").subtitle("Peculiar Bell tolls")
.playExisting(SoundEvents.BELL_BLOCK) .playExisting(SoundEvents.BELL_BLOCK)
.category(SoundCategory.BLOCKS) .category(SoundSource.BLOCKS)
.build(), .build(),
HAUNTED_BELL_CONVERT = create("haunted_bell_convert").subtitle("Haunted Bell awakens") HAUNTED_BELL_CONVERT = create("haunted_bell_convert").subtitle("Haunted Bell awakens")
.category(SoundCategory.BLOCKS) .category(SoundSource.BLOCKS)
.build(), .build(),
HAUNTED_BELL_USE = create("haunted_bell_use").subtitle("Haunted Bell tolls") HAUNTED_BELL_USE = create("haunted_bell_use").subtitle("Haunted Bell tolls")
.category(SoundCategory.BLOCKS) .category(SoundSource.BLOCKS)
.build(); .build();
public static SoundEntryBuilder create(String id) { public static SoundEntryBuilder create(String id) {
@ -263,7 +263,7 @@ public class AllSoundEvents {
// //
// } // }
private static class SoundEntryProvider implements IDataProvider { private static class SoundEntryProvider implements DataProvider {
private DataGenerator generator; private DataGenerator generator;
@ -272,7 +272,7 @@ public class AllSoundEvents {
} }
@Override @Override
public void run(DirectoryCache cache) throws IOException { public void run(HashCache cache) throws IOException {
generate(generator.getOutputFolder(), cache); generate(generator.getOutputFolder(), cache);
} }
@ -281,7 +281,7 @@ public class AllSoundEvents {
return "Create's Custom Sounds"; return "Create's Custom Sounds";
} }
public void generate(Path path, DirectoryCache cache) { public void generate(Path path, HashCache cache) {
Gson GSON = (new GsonBuilder()).setPrettyPrinting() Gson GSON = (new GsonBuilder()).setPrettyPrinting()
.disableHtmlEscaping() .disableHtmlEscaping()
.create(); .create();
@ -296,7 +296,7 @@ public class AllSoundEvents {
entry.getValue() entry.getValue()
.write(json); .write(json);
}); });
IDataProvider.save(GSON, cache, json, path.resolve("sounds.json")); DataProvider.save(GSON, cache, json, path.resolve("sounds.json"));
} catch (IOException e) { } catch (IOException e) {
e.printStackTrace(); e.printStackTrace();
@ -309,7 +309,7 @@ public class AllSoundEvents {
protected String id; protected String id;
protected String subtitle = "unregistered"; protected String subtitle = "unregistered";
protected SoundCategory category = SoundCategory.BLOCKS; protected SoundSource category = SoundSource.BLOCKS;
List<Pair<SoundEvent, Couple<Float>>> wrappedEvents; List<Pair<SoundEvent, Couple<Float>>> wrappedEvents;
public SoundEntryBuilder(String id) { public SoundEntryBuilder(String id) {
@ -327,7 +327,7 @@ public class AllSoundEvents {
return this; return this;
} }
public SoundEntryBuilder category(SoundCategory category) { public SoundEntryBuilder category(SoundSource category) {
this.category = category; this.category = category;
return this; return this;
} }
@ -354,9 +354,9 @@ public class AllSoundEvents {
protected String id; protected String id;
protected String subtitle; protected String subtitle;
protected SoundCategory category; protected SoundSource category;
public SoundEntry(String id, String subtitle, SoundCategory category) { public SoundEntry(String id, String subtitle, SoundSource category) {
this.id = id; this.id = id;
this.subtitle = subtitle; this.subtitle = subtitle;
this.category = category; this.category = category;
@ -390,15 +390,15 @@ public class AllSoundEvents {
return subtitle; return subtitle;
} }
public void playOnServer(World world, BlockPos pos) { public void playOnServer(Level world, BlockPos pos) {
playOnServer(world, pos, 1, 1); playOnServer(world, pos, 1, 1);
} }
public void playOnServer(World world, BlockPos pos, float volume, float pitch) { public void playOnServer(Level world, BlockPos pos, float volume, float pitch) {
play(world, null, pos, volume, pitch); play(world, null, pos, volume, pitch);
} }
public void play(World world, PlayerEntity entity, BlockPos pos) { public void play(Level world, Player entity, BlockPos pos) {
play(world, entity, pos, 1, 1); play(world, entity, pos, 1, 1);
} }
@ -411,25 +411,25 @@ public class AllSoundEvents {
play(entity.level, null, entity.blockPosition(), volume, pitch); play(entity.level, null, entity.blockPosition(), volume, pitch);
} }
public void play(World world, PlayerEntity entity, BlockPos pos, float volume, float pitch) { public void play(Level world, Player entity, BlockPos pos, float volume, float pitch) {
play(world, entity, pos.getX(), pos.getY(), pos.getZ(), volume, pitch); play(world, entity, pos.getX(), pos.getY(), pos.getZ(), volume, pitch);
} }
public void play(World world, PlayerEntity entity, Vector3d pos, float volume, float pitch) { public void play(Level world, Player entity, Vec3 pos, float volume, float pitch) {
play(world, entity, pos.x(), pos.y(), pos.z(), volume, pitch); play(world, entity, pos.x(), pos.y(), pos.z(), volume, pitch);
} }
public abstract void play(World world, PlayerEntity entity, double x, double y, double z, float volume, float pitch); public abstract void play(Level world, Player entity, double x, double y, double z, float volume, float pitch);
public void playAt(World world, BlockPos pos, float volume, float pitch, boolean fade) { public void playAt(Level world, BlockPos pos, float volume, float pitch, boolean fade) {
playAt(world, pos.getX() + .5, pos.getY() + .5, pos.getZ() + .5, volume, pitch, fade); playAt(world, pos.getX() + .5, pos.getY() + .5, pos.getZ() + .5, volume, pitch, fade);
} }
public void playAt(World world, Vector3d pos, float volume, float pitch, boolean fade) { public void playAt(Level world, Vec3 pos, float volume, float pitch, boolean fade) {
playAt(world, pos.x(), pos.y(), pos.z(), volume, pitch, fade); playAt(world, pos.x(), pos.y(), pos.z(), volume, pitch, fade);
} }
public abstract void playAt(World world, double x, double y, double z, float volume, float pitch, boolean fade); public abstract void playAt(Level world, double x, double y, double z, float volume, float pitch, boolean fade);
} }
@ -439,7 +439,7 @@ public class AllSoundEvents {
private List<Pair<SoundEvent, Couple<Float>>> compiledEvents; private List<Pair<SoundEvent, Couple<Float>>> compiledEvents;
public WrappedSoundEntry(String id, String subtitle, List<Pair<SoundEvent, Couple<Float>>> wrappedEvents, public WrappedSoundEntry(String id, String subtitle, List<Pair<SoundEvent, Couple<Float>>> wrappedEvents,
SoundCategory category) { SoundSource category) {
super(id, subtitle, category); super(id, subtitle, category);
this.wrappedEvents = wrappedEvents; this.wrappedEvents = wrappedEvents;
compiledEvents = Lists.newArrayList(); compiledEvents = Lists.newArrayList();
@ -491,7 +491,7 @@ public class AllSoundEvents {
} }
@Override @Override
public void play(World world, PlayerEntity entity, double x, double y, double z, float volume, float pitch) { public void play(Level world, Player entity, double x, double y, double z, float volume, float pitch) {
for (Pair<SoundEvent, Couple<Float>> pair : compiledEvents) { for (Pair<SoundEvent, Couple<Float>> pair : compiledEvents) {
Couple<Float> volPitch = pair.getSecond(); Couple<Float> volPitch = pair.getSecond();
world.playSound(entity, x, y, z, pair.getFirst(), category, volPitch.getFirst() * volume, world.playSound(entity, x, y, z, pair.getFirst(), category, volPitch.getFirst() * volume,
@ -500,7 +500,7 @@ public class AllSoundEvents {
} }
@Override @Override
public void playAt(World world, double x, double y, double z, float volume, float pitch, boolean fade) { public void playAt(Level world, double x, double y, double z, float volume, float pitch, boolean fade) {
for (Pair<SoundEvent, Couple<Float>> pair : compiledEvents) { for (Pair<SoundEvent, Couple<Float>> pair : compiledEvents) {
Couple<Float> volPitch = pair.getSecond(); Couple<Float> volPitch = pair.getSecond();
world.playLocalSound(x, y, z, pair.getFirst(), category, volPitch.getFirst() * volume, world.playLocalSound(x, y, z, pair.getFirst(), category, volPitch.getFirst() * volume,
@ -513,7 +513,7 @@ public class AllSoundEvents {
protected SoundEvent event; protected SoundEvent event;
public CustomSoundEntry(String id, String subtitle, SoundCategory category) { public CustomSoundEntry(String id, String subtitle, SoundSource category) {
super(id, subtitle, category); super(id, subtitle, category);
} }
@ -544,12 +544,12 @@ public class AllSoundEvents {
} }
@Override @Override
public void play(World world, PlayerEntity entity, double x, double y, double z, float volume, float pitch) { public void play(Level world, Player entity, double x, double y, double z, float volume, float pitch) {
world.playSound(entity, x, y, z, event, category, volume, pitch); world.playSound(entity, x, y, z, event, category, volume, pitch);
} }
@Override @Override
public void playAt(World world, double x, double y, double z, float volume, float pitch, boolean fade) { public void playAt(Level world, double x, double y, double z, float volume, float pitch, boolean fade) {
world.playLocalSound(x, y, z, event, category, volume, pitch, fade); world.playLocalSound(x, y, z, event, category, volume, pitch, fade);
} }

View file

@ -1,7 +1,7 @@
package com.simibubi.create; package com.simibubi.create;
import net.minecraft.client.Minecraft; import net.minecraft.client.Minecraft;
import net.minecraft.util.ResourceLocation; import net.minecraft.resources.ResourceLocation;
public enum AllSpecialTextures { public enum AllSpecialTextures {

View file

@ -18,8 +18,8 @@ import com.simibubi.create.foundation.block.render.SpriteShiftEntry;
import com.simibubi.create.foundation.block.render.SpriteShifter; import com.simibubi.create.foundation.block.render.SpriteShifter;
import com.simibubi.create.foundation.utility.Lang; import com.simibubi.create.foundation.utility.Lang;
import net.minecraft.block.WoodType; import net.minecraft.world.level.block.state.properties.WoodType;
import net.minecraft.item.DyeColor; import net.minecraft.world.item.DyeColor;
public class AllSpriteShifts { public class AllSpriteShifts {

View file

@ -3,7 +3,7 @@ package com.simibubi.create;
import com.jozufozu.flywheel.core.AtlasStitcher; import com.jozufozu.flywheel.core.AtlasStitcher;
import com.jozufozu.flywheel.core.StitchedSprite; import com.jozufozu.flywheel.core.StitchedSprite;
import net.minecraft.util.ResourceLocation; import net.minecraft.resources.ResourceLocation;
public class AllStitchedTextures { public class AllStitchedTextures {

View file

@ -13,19 +13,19 @@ import com.tterrag.registrate.builders.ItemBuilder;
import com.tterrag.registrate.providers.ProviderType; import com.tterrag.registrate.providers.ProviderType;
import com.tterrag.registrate.util.nullness.NonNullFunction; import com.tterrag.registrate.util.nullness.NonNullFunction;
import net.minecraft.block.Block; import net.minecraft.world.level.block.Block;
import net.minecraft.block.BlockState; import net.minecraft.world.level.block.state.BlockState;
import net.minecraft.block.Blocks; import net.minecraft.world.level.block.Blocks;
import net.minecraft.fluid.Fluid; import net.minecraft.world.level.material.Fluid;
import net.minecraft.item.BlockItem; import net.minecraft.world.item.BlockItem;
import net.minecraft.item.Item; import net.minecraft.world.item.Item;
import net.minecraft.item.ItemStack; import net.minecraft.world.item.ItemStack;
import net.minecraft.item.Items; import net.minecraft.world.item.Items;
import net.minecraft.tags.BlockTags; import net.minecraft.tags.BlockTags;
import net.minecraft.tags.FluidTags; import net.minecraft.tags.FluidTags;
import net.minecraft.tags.ITag; import net.minecraft.tags.Tag;
import net.minecraft.tags.ItemTags; import net.minecraft.tags.ItemTags;
import net.minecraft.util.ResourceLocation; import net.minecraft.resources.ResourceLocation;
import net.minecraftforge.common.Tags; import net.minecraftforge.common.Tags;
public class AllTags { public class AllTags {
@ -33,24 +33,24 @@ public class AllTags {
private static final CreateRegistrate REGISTRATE = Create.registrate() private static final CreateRegistrate REGISTRATE = Create.registrate()
.itemGroup(() -> Create.BASE_CREATIVE_TAB); .itemGroup(() -> Create.BASE_CREATIVE_TAB);
public static <T> ITag.INamedTag<T> tag(Function<ResourceLocation, ITag.INamedTag<T>> wrapperFactory, String namespace, public static <T> Tag.Named<T> tag(Function<ResourceLocation, Tag.Named<T>> wrapperFactory, String namespace,
String path) { String path) {
return wrapperFactory.apply(new ResourceLocation(namespace, path)); return wrapperFactory.apply(new ResourceLocation(namespace, path));
} }
public static <T> ITag.INamedTag<T> forgeTag(Function<ResourceLocation, ITag.INamedTag<T>> wrapperFactory, String path) { public static <T> Tag.Named<T> forgeTag(Function<ResourceLocation, Tag.Named<T>> wrapperFactory, String path) {
return tag(wrapperFactory, "forge", path); return tag(wrapperFactory, "forge", path);
} }
public static ITag.INamedTag<Block> forgeBlockTag(String path) { public static Tag.Named<Block> forgeBlockTag(String path) {
return forgeTag(BlockTags::createOptional, path); return forgeTag(BlockTags::createOptional, path);
} }
public static ITag.INamedTag<Item> forgeItemTag(String path) { public static Tag.Named<Item> forgeItemTag(String path) {
return forgeTag(ItemTags::createOptional, path); return forgeTag(ItemTags::createOptional, path);
} }
public static ITag.INamedTag<Fluid> forgeFluidTag(String path) { public static Tag.Named<Fluid> forgeFluidTag(String path) {
return forgeTag(FluidTags::createOptional, path); return forgeTag(FluidTags::createOptional, path);
} }
@ -105,7 +105,7 @@ public class AllTags {
; ;
public final ITag.INamedTag<Block> tag; public final Tag.Named<Block> tag;
AllBlockTags() { AllBlockTags() {
this(MOD); this(MOD);
@ -148,7 +148,7 @@ public class AllTags {
.add(values)); .add(values));
} }
public void includeIn(ITag.INamedTag<Block> parent) { public void includeIn(Tag.Named<Block> parent) {
REGISTRATE.addDataGenerator(ProviderType.BLOCK_TAGS, prov -> prov.tag(parent) REGISTRATE.addDataGenerator(ProviderType.BLOCK_TAGS, prov -> prov.tag(parent)
.addTag(tag)); .addTag(tag));
} }
@ -157,7 +157,7 @@ public class AllTags {
includeIn(parent.tag); includeIn(parent.tag);
} }
public void includeAll(ITag.INamedTag<Block> child) { public void includeAll(Tag.Named<Block> child) {
REGISTRATE.addDataGenerator(ProviderType.BLOCK_TAGS, prov -> prov.tag(tag) REGISTRATE.addDataGenerator(ProviderType.BLOCK_TAGS, prov -> prov.tag(tag)
.addTag(child)); .addTag(child));
} }
@ -179,7 +179,7 @@ public class AllTags {
; ;
public final ITag.INamedTag<Item> tag; public final Tag.Named<Item> tag;
AllItemTags() { AllItemTags() {
this(MOD); this(MOD);
@ -218,7 +218,7 @@ public class AllTags {
.add(values)); .add(values));
} }
public void includeIn(ITag.INamedTag<Item> parent) { public void includeIn(Tag.Named<Item> parent) {
REGISTRATE.addDataGenerator(ProviderType.ITEM_TAGS, prov -> prov.tag(parent) REGISTRATE.addDataGenerator(ProviderType.ITEM_TAGS, prov -> prov.tag(parent)
.addTag(tag)); .addTag(tag));
} }
@ -227,7 +227,7 @@ public class AllTags {
includeIn(parent.tag); includeIn(parent.tag);
} }
public void includeAll(ITag.INamedTag<Item> child) { public void includeAll(Tag.Named<Item> child) {
REGISTRATE.addDataGenerator(ProviderType.ITEM_TAGS, prov -> prov.tag(tag) REGISTRATE.addDataGenerator(ProviderType.ITEM_TAGS, prov -> prov.tag(tag)
.addTag(child)); .addTag(child));
} }
@ -242,7 +242,7 @@ public class AllTags {
; ;
public final ITag.INamedTag<Fluid> tag; public final Tag.Named<Fluid> tag;
AllFluidTags() { AllFluidTags() {
this(MOD); this(MOD);
@ -281,7 +281,7 @@ public class AllTags {
.add(values)); .add(values));
} }
public void includeIn(ITag.INamedTag<Fluid> parent) { public void includeIn(Tag.Named<Fluid> parent) {
REGISTRATE.addDataGenerator(ProviderType.FLUID_TAGS, prov -> prov.tag(parent) REGISTRATE.addDataGenerator(ProviderType.FLUID_TAGS, prov -> prov.tag(parent)
.addTag(tag)); .addTag(tag));
} }
@ -290,7 +290,7 @@ public class AllTags {
includeIn(parent.tag); includeIn(parent.tag);
} }
public void includeAll(ITag.INamedTag<Fluid> child) { public void includeAll(Tag.Named<Fluid> child) {
REGISTRATE.addDataGenerator(ProviderType.FLUID_TAGS, prov -> prov.tag(tag) REGISTRATE.addDataGenerator(ProviderType.FLUID_TAGS, prov -> prov.tag(tag)
.addTag(child)); .addTag(child));
} }

View file

@ -35,13 +35,13 @@ import com.simibubi.create.foundation.worldgen.AllWorldFeatures;
import com.tterrag.registrate.util.NonNullLazyValue; import com.tterrag.registrate.util.NonNullLazyValue;
import net.minecraft.data.DataGenerator; import net.minecraft.data.DataGenerator;
import net.minecraft.item.ItemGroup; import net.minecraft.world.item.CreativeModeTab;
import net.minecraft.item.crafting.IRecipeSerializer; import net.minecraft.world.item.crafting.RecipeSerializer;
import net.minecraft.particles.ParticleType; import net.minecraft.core.particles.ParticleType;
import net.minecraft.util.ResourceLocation; import net.minecraft.resources.ResourceLocation;
import net.minecraft.util.SoundEvent; import net.minecraft.sounds.SoundEvent;
import net.minecraft.world.gen.feature.Feature; import net.minecraft.world.level.levelgen.feature.Feature;
import net.minecraft.world.gen.placement.Placement; import net.minecraft.world.level.levelgen.placement.FeatureDecorator;
import net.minecraftforge.api.distmarker.Dist; import net.minecraftforge.api.distmarker.Dist;
import net.minecraftforge.common.ForgeMod; import net.minecraftforge.common.ForgeMod;
import net.minecraftforge.common.MinecraftForge; import net.minecraftforge.common.MinecraftForge;
@ -68,8 +68,8 @@ public class Create {
.disableHtmlEscaping() .disableHtmlEscaping()
.create(); .create();
public static final ItemGroup BASE_CREATIVE_TAB = new CreateItemGroup(); public static final CreativeModeTab BASE_CREATIVE_TAB = new CreateItemGroup();
public static final ItemGroup PALETTES_CREATIVE_TAB = new PalettesItemGroup(); public static final CreativeModeTab PALETTES_CREATIVE_TAB = new PalettesItemGroup();
public static final ServerSchematicLoader SCHEMATIC_RECEIVER = new ServerSchematicLoader(); public static final ServerSchematicLoader SCHEMATIC_RECEIVER = new ServerSchematicLoader();
public static final RedstoneLinkNetworkHandler REDSTONE_LINK_NETWORK_HANDLER = new RedstoneLinkNetworkHandler(); public static final RedstoneLinkNetworkHandler REDSTONE_LINK_NETWORK_HANDLER = new RedstoneLinkNetworkHandler();
@ -112,8 +112,8 @@ public class Create {
modEventBus.addListener(Create::init); modEventBus.addListener(Create::init);
modEventBus.addGenericListener(Feature.class, AllWorldFeatures::registerOreFeatures); modEventBus.addGenericListener(Feature.class, AllWorldFeatures::registerOreFeatures);
modEventBus.addGenericListener(Placement.class, AllWorldFeatures::registerDecoratorFeatures); modEventBus.addGenericListener(FeatureDecorator.class, AllWorldFeatures::registerDecoratorFeatures);
modEventBus.addGenericListener(IRecipeSerializer.class, AllRecipeTypes::register); modEventBus.addGenericListener(RecipeSerializer.class, AllRecipeTypes::register);
modEventBus.addGenericListener(ParticleType.class, AllParticleTypes::register); modEventBus.addGenericListener(ParticleType.class, AllParticleTypes::register);
modEventBus.addGenericListener(SoundEvent.class, AllSoundEvents::register); modEventBus.addGenericListener(SoundEvent.class, AllSoundEvents::register);
modEventBus.addListener(AllConfigs::onLoad); modEventBus.addListener(AllConfigs::onLoad);

View file

@ -26,18 +26,18 @@ import com.simibubi.create.foundation.utility.ghost.GhostBlocks;
import com.simibubi.create.foundation.utility.outliner.Outliner; import com.simibubi.create.foundation.utility.outliner.Outliner;
import net.minecraft.client.Minecraft; import net.minecraft.client.Minecraft;
import net.minecraft.client.gui.screen.Screen; import net.minecraft.client.gui.screens.Screen;
import net.minecraft.client.renderer.entity.EntityRendererManager; import net.minecraft.client.renderer.entity.EntityRenderDispatcher;
import net.minecraft.client.settings.GraphicsFanciness; import net.minecraft.client.GraphicsStatus;
import net.minecraft.resources.IReloadableResourceManager; import net.minecraft.server.packs.resources.ReloadableResourceManager;
import net.minecraft.resources.IResourceManager; import net.minecraft.server.packs.resources.ResourceManager;
import net.minecraft.util.text.ChatType; import net.minecraft.network.chat.ChatType;
import net.minecraft.util.text.IFormattableTextComponent; import net.minecraft.network.chat.MutableComponent;
import net.minecraft.util.text.StringTextComponent; import net.minecraft.network.chat.TextComponent;
import net.minecraft.util.text.TextComponentUtils; import net.minecraft.network.chat.ComponentUtils;
import net.minecraft.util.text.TextFormatting; import net.minecraft.ChatFormatting;
import net.minecraft.util.text.event.ClickEvent; import net.minecraft.network.chat.ClickEvent;
import net.minecraft.util.text.event.HoverEvent; import net.minecraft.network.chat.HoverEvent;
import net.minecraftforge.eventbus.api.IEventBus; import net.minecraftforge.eventbus.api.IEventBus;
import net.minecraftforge.fml.event.lifecycle.FMLClientSetupEvent; import net.minecraftforge.fml.event.lifecycle.FMLClientSetupEvent;
@ -46,7 +46,7 @@ public class CreateClient {
public static final SuperByteBufferCache BUFFER_CACHE = new SuperByteBufferCache(); public static final SuperByteBufferCache BUFFER_CACHE = new SuperByteBufferCache();
public static final Outliner OUTLINER = new Outliner(); public static final Outliner OUTLINER = new Outliner();
public static final GhostBlocks GHOST_BLOCKS = new GhostBlocks(); public static final GhostBlocks GHOST_BLOCKS = new GhostBlocks();
public static final Screen EMPTY_SCREEN = new Screen(new StringTextComponent("")) {}; public static final Screen EMPTY_SCREEN = new Screen(new TextComponent("")) {};
public static final ModelSwapper MODEL_SWAPPER = new ModelSwapper(); public static final ModelSwapper MODEL_SWAPPER = new ModelSwapper();
public static final CasingConnectivity CASING_CONNECTIVITY = new CasingConnectivity(); public static final CasingConnectivity CASING_CONNECTIVITY = new CasingConnectivity();
@ -80,9 +80,9 @@ public class CreateClient {
// null during datagen // null during datagen
if (mc == null) return; if (mc == null) return;
IResourceManager resourceManager = mc.getResourceManager(); ResourceManager resourceManager = mc.getResourceManager();
if (resourceManager instanceof IReloadableResourceManager) if (resourceManager instanceof ReloadableResourceManager)
((IReloadableResourceManager) resourceManager).registerReloadListener(RESOURCE_RELOAD_LISTENER); ((ReloadableResourceManager) resourceManager).registerReloadListener(RESOURCE_RELOAD_LISTENER);
} }
public static void clientInit(final FMLClientSetupEvent event) { public static void clientInit(final FMLClientSetupEvent event) {
@ -106,7 +106,7 @@ public class CreateClient {
}); });
} }
protected static void registerLayerRenderers(EntityRendererManager renderManager) { protected static void registerLayerRenderers(EntityRenderDispatcher renderManager) {
CopperBacktankArmorLayer.registerOnAll(renderManager); CopperBacktankArmorLayer.registerOnAll(renderManager);
} }
@ -121,20 +121,20 @@ public class CreateClient {
if (mc.player == null) if (mc.player == null)
return; return;
if (mc.options.graphicsMode != GraphicsFanciness.FABULOUS) if (mc.options.graphicsMode != GraphicsStatus.FABULOUS)
return; return;
if (AllConfigs.CLIENT.ignoreFabulousWarning.get()) if (AllConfigs.CLIENT.ignoreFabulousWarning.get())
return; return;
IFormattableTextComponent text = TextComponentUtils.wrapInSquareBrackets(new StringTextComponent("WARN")) MutableComponent text = ComponentUtils.wrapInSquareBrackets(new TextComponent("WARN"))
.withStyle(TextFormatting.GOLD) .withStyle(ChatFormatting.GOLD)
.append(new StringTextComponent( .append(new TextComponent(
" Some of Create's visual features will not be available while Fabulous graphics are enabled!")) " Some of Create's visual features will not be available while Fabulous graphics are enabled!"))
.withStyle(style -> style .withStyle(style -> style
.withClickEvent(new ClickEvent(ClickEvent.Action.RUN_COMMAND, "/create dismissFabulousWarning")) .withClickEvent(new ClickEvent(ClickEvent.Action.RUN_COMMAND, "/create dismissFabulousWarning"))
.withHoverEvent(new HoverEvent(HoverEvent.Action.SHOW_TEXT, .withHoverEvent(new HoverEvent(HoverEvent.Action.SHOW_TEXT,
new StringTextComponent("Click here to disable this warning")))); new TextComponent("Click here to disable this warning"))));
mc.gui.handleChat(ChatType.CHAT, text, mc.player.getUUID()); mc.gui.handleChat(ChatType.CHAT, text, mc.player.getUUID());
} }

View file

@ -7,9 +7,9 @@ import com.simibubi.create.Create;
import com.simibubi.create.compat.tconstruct.SpoutCasting; import com.simibubi.create.compat.tconstruct.SpoutCasting;
import com.simibubi.create.content.contraptions.fluids.actors.SpoutTileEntity; import com.simibubi.create.content.contraptions.fluids.actors.SpoutTileEntity;
import net.minecraft.util.ResourceLocation; import net.minecraft.resources.ResourceLocation;
import net.minecraft.util.math.BlockPos; import net.minecraft.core.BlockPos;
import net.minecraft.world.World; import net.minecraft.world.level.Level;
import net.minecraftforge.fluids.FluidStack; import net.minecraftforge.fluids.FluidStack;
public abstract class BlockSpoutingBehaviour { public abstract class BlockSpoutingBehaviour {
@ -42,7 +42,7 @@ public abstract class BlockSpoutingBehaviour {
* @param simulate whether the spout is testing or actually performing this behaviour * @param simulate whether the spout is testing or actually performing this behaviour
* @return amount filled into the block, 0 to idle/cancel * @return amount filled into the block, 0 to idle/cancel
*/ */
public abstract int fillBlock(World world, BlockPos pos, SpoutTileEntity spout, FluidStack availableFluid, public abstract int fillBlock(Level world, BlockPos pos, SpoutTileEntity spout, FluidStack availableFluid,
boolean simulate); boolean simulate);
public static void register() { public static void register() {

View file

@ -7,7 +7,7 @@ import com.simibubi.create.foundation.tileEntity.SmartTileEntity;
import com.simibubi.create.foundation.tileEntity.TileEntityBehaviour; import com.simibubi.create.foundation.tileEntity.TileEntityBehaviour;
import com.simibubi.create.foundation.tileEntity.behaviour.BehaviourType; import com.simibubi.create.foundation.tileEntity.behaviour.BehaviourType;
import net.minecraft.block.BlockState; import net.minecraft.world.level.block.state.BlockState;
import net.minecraftforge.eventbus.api.GenericEvent; import net.minecraftforge.eventbus.api.GenericEvent;
/** /**

View file

@ -12,11 +12,11 @@ import com.simibubi.create.foundation.utility.AbstractBlockBreakQueue;
import net.minecraft.block.Block; import net.minecraft.block.Block;
import net.minecraft.block.BlockState; import net.minecraft.block.BlockState;
import net.minecraft.entity.player.PlayerEntity; import net.minecraft.world.entity.player.Player;
import net.minecraft.item.ItemStack; import net.minecraft.world.item.ItemStack;
import net.minecraft.util.Direction; import net.minecraft.util.Direction;
import net.minecraft.util.math.BlockPos; import net.minecraft.core.BlockPos;
import net.minecraft.world.World; import net.minecraft.world.level.Level;
public class DynamicTree extends AbstractBlockBreakQueue { public class DynamicTree extends AbstractBlockBreakQueue {
private BlockPos startCutPos; private BlockPos startCutPos;
@ -26,7 +26,7 @@ public class DynamicTree extends AbstractBlockBreakQueue {
} }
@Override @Override
public void destroyBlocks(World world, ItemStack toDamage, @Nullable PlayerEntity playerEntity, BiConsumer<BlockPos, ItemStack> drop) { public void destroyBlocks(Level world, ItemStack toDamage, @Nullable Player playerEntity, BiConsumer<BlockPos, ItemStack> drop) {
BranchBlock start = TreeHelper.getBranch(world.getBlockState(startCutPos)); BranchBlock start = TreeHelper.getBranch(world.getBlockState(startCutPos));
if (start == null) //if start is null, it was not a branch if (start == null) //if start is null, it was not a branch
start = setBranchToShellMuse(world, world.getBlockState(startCutPos)); //we check for a trunk shell instead start = setBranchToShellMuse(world, world.getBlockState(startCutPos)); //we check for a trunk shell instead

View file

@ -7,8 +7,8 @@ import com.simibubi.create.foundation.networking.AllPackets;
import mezz.jei.api.gui.IRecipeLayout; import mezz.jei.api.gui.IRecipeLayout;
import mezz.jei.api.recipe.transfer.IRecipeTransferError; import mezz.jei.api.recipe.transfer.IRecipeTransferError;
import mezz.jei.api.recipe.transfer.IRecipeTransferHandler; import mezz.jei.api.recipe.transfer.IRecipeTransferHandler;
import net.minecraft.entity.player.PlayerEntity; import net.minecraft.world.entity.player.Player;
import net.minecraft.item.crafting.IRecipe; import net.minecraft.world.item.crafting.Recipe;
public class BlueprintTransferHandler implements IRecipeTransferHandler<BlueprintContainer> { public class BlueprintTransferHandler implements IRecipeTransferHandler<BlueprintContainer> {
@ -19,12 +19,12 @@ public class BlueprintTransferHandler implements IRecipeTransferHandler<Blueprin
@Override @Override
public IRecipeTransferError transferRecipe(BlueprintContainer container, Object recipe, IRecipeLayout recipeLayout, public IRecipeTransferError transferRecipe(BlueprintContainer container, Object recipe, IRecipeLayout recipeLayout,
PlayerEntity player, boolean maxTransfer, boolean doTransfer) { Player player, boolean maxTransfer, boolean doTransfer) {
if (!(recipe instanceof IRecipe)) if (!(recipe instanceof Recipe))
return null; return null;
if (!doTransfer) if (!doTransfer)
return null; return null;
IRecipe<?> iRecipe = (IRecipe<?>) recipe; Recipe<?> iRecipe = (Recipe<?>) recipe;
// Continued server-side in BlueprintItem.assignCompleteRecipe() // Continued server-side in BlueprintItem.assignCompleteRecipe()
AllPackets.channel.sendToServer(new BlueprintAssignCompleteRecipePacket(iRecipe.getId())); AllPackets.channel.sendToServer(new BlueprintAssignCompleteRecipePacket(iRecipe.getId()));
return null; return null;

View file

@ -8,10 +8,10 @@ import com.simibubi.create.content.contraptions.processing.ProcessingRecipe;
import com.simibubi.create.content.contraptions.processing.ProcessingRecipeBuilder; import com.simibubi.create.content.contraptions.processing.ProcessingRecipeBuilder;
import com.simibubi.create.content.contraptions.processing.ProcessingRecipeBuilder.ProcessingRecipeParams; import com.simibubi.create.content.contraptions.processing.ProcessingRecipeBuilder.ProcessingRecipeParams;
import net.minecraft.item.ItemStack; import net.minecraft.world.item.ItemStack;
import net.minecraft.item.crafting.Ingredient; import net.minecraft.world.item.crafting.Ingredient;
import net.minecraft.util.ResourceLocation; import net.minecraft.resources.ResourceLocation;
import net.minecraft.world.World; import net.minecraft.world.level.Level;
import net.minecraftforge.items.wrapper.RecipeWrapper; import net.minecraftforge.items.wrapper.RecipeWrapper;
/** /**
@ -35,7 +35,7 @@ public class ConversionRecipe extends ProcessingRecipe<RecipeWrapper> {
} }
@Override @Override
public boolean matches(RecipeWrapper inv, World worldIn) { public boolean matches(RecipeWrapper inv, Level worldIn) {
return false; return false;
} }

View file

@ -64,15 +64,15 @@ import mezz.jei.api.registration.IRecipeRegistration;
import mezz.jei.api.registration.IRecipeTransferRegistration; import mezz.jei.api.registration.IRecipeTransferRegistration;
import mezz.jei.api.runtime.IIngredientManager; import mezz.jei.api.runtime.IIngredientManager;
import net.minecraft.client.Minecraft; import net.minecraft.client.Minecraft;
import net.minecraft.item.ItemStack; import net.minecraft.world.item.ItemStack;
import net.minecraft.item.Items; import net.minecraft.world.item.Items;
import net.minecraft.item.crafting.ICraftingRecipe; import net.minecraft.world.item.crafting.CraftingRecipe;
import net.minecraft.item.crafting.IRecipe; import net.minecraft.world.item.crafting.Recipe;
import net.minecraft.item.crafting.IRecipeSerializer; import net.minecraft.world.item.crafting.RecipeSerializer;
import net.minecraft.item.crafting.IRecipeType; import net.minecraft.world.item.crafting.RecipeType;
import net.minecraft.item.crafting.ShapedRecipe; import net.minecraft.world.item.crafting.ShapedRecipe;
import net.minecraft.util.IItemProvider; import net.minecraft.world.level.ItemLike;
import net.minecraft.util.ResourceLocation; import net.minecraft.resources.ResourceLocation;
import net.minecraftforge.fml.ModList; import net.minecraftforge.fml.ModList;
@JeiPlugin @JeiPlugin
@ -102,14 +102,14 @@ public class CreateJEI implements IModPlugin {
.catalystStack(ProcessingViaFanCategory.getFan("fan_washing")) .catalystStack(ProcessingViaFanCategory.getFan("fan_washing"))
.build(), .build(),
smoking = register("fan_smoking", FanSmokingCategory::new).recipes(() -> IRecipeType.SMOKING) smoking = register("fan_smoking", FanSmokingCategory::new).recipes(() -> RecipeType.SMOKING)
.catalystStack(ProcessingViaFanCategory.getFan("fan_smoking")) .catalystStack(ProcessingViaFanCategory.getFan("fan_smoking"))
.build(), .build(),
blasting = register("fan_blasting", FanBlastingCategory::new) blasting = register("fan_blasting", FanBlastingCategory::new)
.recipesExcluding(() -> IRecipeType.SMELTING, () -> IRecipeType.BLASTING) .recipesExcluding(() -> RecipeType.SMELTING, () -> RecipeType.BLASTING)
.recipes(() -> IRecipeType.BLASTING) .recipes(() -> RecipeType.BLASTING)
.removeRecipes(() -> IRecipeType.SMOKING) .removeRecipes(() -> RecipeType.SMOKING)
.catalystStack(ProcessingViaFanCategory.getFan("fan_blasting")) .catalystStack(ProcessingViaFanCategory.getFan("fan_blasting"))
.build(), .build(),
@ -123,7 +123,7 @@ public class CreateJEI implements IModPlugin {
.build(), .build(),
autoShapeless = register("automatic_shapeless", MixingCategory::autoShapeless) autoShapeless = register("automatic_shapeless", MixingCategory::autoShapeless)
.recipes(r -> r.getSerializer() == IRecipeSerializer.SHAPELESS_RECIPE && r.getIngredients() .recipes(r -> r.getSerializer() == RecipeSerializer.SHAPELESS_RECIPE && r.getIngredients()
.size() > 1 && !MechanicalPressTileEntity.canCompress(r), .size() > 1 && !MechanicalPressTileEntity.canCompress(r),
BasinRecipe::convertShapeless) BasinRecipe::convertShapeless)
.catalyst(AllBlocks.MECHANICAL_MIXER::get) .catalyst(AllBlocks.MECHANICAL_MIXER::get)
@ -142,7 +142,7 @@ public class CreateJEI implements IModPlugin {
.build(), .build(),
blockCutting = register("block_cutting", () -> new BlockCuttingCategory(Items.STONE_BRICK_STAIRS)) blockCutting = register("block_cutting", () -> new BlockCuttingCategory(Items.STONE_BRICK_STAIRS))
.recipeList(() -> CondensedBlockCuttingRecipe.condenseRecipes(findRecipesByType(IRecipeType.STONECUTTING))) .recipeList(() -> CondensedBlockCuttingRecipe.condenseRecipes(findRecipesByType(RecipeType.STONECUTTING)))
.catalyst(AllBlocks.MECHANICAL_SAW::get) .catalyst(AllBlocks.MECHANICAL_SAW::get)
.enableWhen(c -> c.allowStonecuttingOnSaw) .enableWhen(c -> c.allowStonecuttingOnSaw)
.build(), .build(),
@ -161,7 +161,7 @@ public class CreateJEI implements IModPlugin {
.build(), .build(),
autoSquare = register("automatic_packing", PackingCategory::autoSquare) autoSquare = register("automatic_packing", PackingCategory::autoSquare)
.recipes(r -> (r instanceof ICraftingRecipe) && MechanicalPressTileEntity.canCompress(r), .recipes(r -> (r instanceof CraftingRecipe) && MechanicalPressTileEntity.canCompress(r),
BasinRecipe::convertShapeless) BasinRecipe::convertShapeless)
.catalyst(AllBlocks.MECHANICAL_PRESS::get) .catalyst(AllBlocks.MECHANICAL_PRESS::get)
.catalyst(AllBlocks.BASIN::get) .catalyst(AllBlocks.BASIN::get)
@ -198,10 +198,10 @@ public class CreateJEI implements IModPlugin {
.build(), .build(),
autoShaped = register("automatic_shaped", MechanicalCraftingCategory::new) autoShaped = register("automatic_shaped", MechanicalCraftingCategory::new)
.recipes(r -> r.getSerializer() == IRecipeSerializer.SHAPELESS_RECIPE && r.getIngredients() .recipes(r -> r.getSerializer() == RecipeSerializer.SHAPELESS_RECIPE && r.getIngredients()
.size() == 1) .size() == 1)
.recipes( .recipes(
r -> (r.getType() == IRecipeType.CRAFTING && r.getType() != AllRecipeTypes.MECHANICAL_CRAFTING.getType()) r -> (r.getType() == RecipeType.CRAFTING && r.getType() != AllRecipeTypes.MECHANICAL_CRAFTING.getType())
&& (r instanceof ShapedRecipe)) && (r instanceof ShapedRecipe))
.catalyst(AllBlocks.MECHANICAL_CRAFTER::get) .catalyst(AllBlocks.MECHANICAL_CRAFTER::get)
.enableWhen(c -> c.allowRegularCraftingInCrafter) .enableWhen(c -> c.allowRegularCraftingInCrafter)
@ -212,7 +212,7 @@ public class CreateJEI implements IModPlugin {
.catalyst(AllBlocks.MECHANICAL_CRAFTER::get) .catalyst(AllBlocks.MECHANICAL_CRAFTER::get)
.build(); .build();
private <T extends IRecipe<?>> CategoryBuilder<T> register(String name, private <T extends Recipe<?>> CategoryBuilder<T> register(String name,
Supplier<CreateRecipeCategory<T>> supplier) { Supplier<CreateRecipeCategory<T>> supplier) {
return new CategoryBuilder<T>(name, supplier); return new CategoryBuilder<T>(name, supplier);
} }
@ -261,9 +261,9 @@ public class CreateJEI implements IModPlugin {
registration.addGhostIngredientHandler(BlueprintScreen.class, new GhostIngredientHandler()); registration.addGhostIngredientHandler(BlueprintScreen.class, new GhostIngredientHandler());
} }
private class CategoryBuilder<T extends IRecipe<?>> { private class CategoryBuilder<T extends Recipe<?>> {
private CreateRecipeCategory<T> category; private CreateRecipeCategory<T> category;
private List<Consumer<List<IRecipe<?>>>> recipeListConsumers = new ArrayList<>(); private List<Consumer<List<Recipe<?>>>> recipeListConsumers = new ArrayList<>();
private Predicate<CRecipes> pred; private Predicate<CRecipes> pred;
public CategoryBuilder(String name, Supplier<CreateRecipeCategory<T>> category) { public CategoryBuilder(String name, Supplier<CreateRecipeCategory<T>> category) {
@ -276,7 +276,7 @@ public class CreateJEI implements IModPlugin {
return recipes(recipeTypeEntry::getType); return recipes(recipeTypeEntry::getType);
} }
public CategoryBuilder<T> recipes(Supplier<IRecipeType<? extends T>> recipeType) { public CategoryBuilder<T> recipes(Supplier<RecipeType<? extends T>> recipeType) {
return recipes(r -> r.getType() == recipeType.get()); return recipes(r -> r.getType() == recipeType.get());
} }
@ -286,22 +286,22 @@ public class CreateJEI implements IModPlugin {
.equals(serializer)); .equals(serializer));
} }
public CategoryBuilder<T> recipes(Predicate<IRecipe<?>> pred) { public CategoryBuilder<T> recipes(Predicate<Recipe<?>> pred) {
return recipeList(() -> findRecipes(pred)); return recipeList(() -> findRecipes(pred));
} }
public CategoryBuilder<T> recipes(Predicate<IRecipe<?>> pred, Function<IRecipe<?>, T> converter) { public CategoryBuilder<T> recipes(Predicate<Recipe<?>> pred, Function<Recipe<?>, T> converter) {
return recipeList(() -> findRecipes(pred), converter); return recipeList(() -> findRecipes(pred), converter);
} }
public CategoryBuilder<T> recipeList(Supplier<List<? extends IRecipe<?>>> list) { public CategoryBuilder<T> recipeList(Supplier<List<? extends Recipe<?>>> list) {
return recipeList(list, null); return recipeList(list, null);
} }
public CategoryBuilder<T> recipeList(Supplier<List<? extends IRecipe<?>>> list, public CategoryBuilder<T> recipeList(Supplier<List<? extends Recipe<?>>> list,
Function<IRecipe<?>, T> converter) { Function<Recipe<?>, T> converter) {
recipeListConsumers.add(recipes -> { recipeListConsumers.add(recipes -> {
List<? extends IRecipe<?>> toAdd = list.get(); List<? extends Recipe<?>> toAdd = list.get();
if (converter != null) if (converter != null)
toAdd = toAdd.stream() toAdd = toAdd.stream()
.map(converter) .map(converter)
@ -311,22 +311,22 @@ public class CreateJEI implements IModPlugin {
return this; return this;
} }
public CategoryBuilder<T> recipesExcluding(Supplier<IRecipeType<? extends T>> recipeType, public CategoryBuilder<T> recipesExcluding(Supplier<RecipeType<? extends T>> recipeType,
Supplier<IRecipeType<? extends T>> excluded) { Supplier<RecipeType<? extends T>> excluded) {
recipeListConsumers.add(recipes -> { recipeListConsumers.add(recipes -> {
recipes.addAll(findRecipesByTypeExcluding(recipeType.get(), excluded.get())); recipes.addAll(findRecipesByTypeExcluding(recipeType.get(), excluded.get()));
}); });
return this; return this;
} }
public CategoryBuilder<T> removeRecipes(Supplier<IRecipeType<? extends T>> recipeType) { public CategoryBuilder<T> removeRecipes(Supplier<RecipeType<? extends T>> recipeType) {
recipeListConsumers.add(recipes -> { recipeListConsumers.add(recipes -> {
removeRecipesByType(recipes, recipeType.get()); removeRecipesByType(recipes, recipeType.get());
}); });
return this; return this;
} }
public CategoryBuilder<T> catalyst(Supplier<IItemProvider> supplier) { public CategoryBuilder<T> catalyst(Supplier<ItemLike> supplier) {
return catalystStack(() -> new ItemStack(supplier.get() return catalystStack(() -> new ItemStack(supplier.get()
.asItem())); .asItem()));
} }
@ -350,8 +350,8 @@ public class CreateJEI implements IModPlugin {
public CreateRecipeCategory<T> build() { public CreateRecipeCategory<T> build() {
if (pred.test(AllConfigs.SERVER.recipes)) if (pred.test(AllConfigs.SERVER.recipes))
category.recipes.add(() -> { category.recipes.add(() -> {
List<IRecipe<?>> recipes = new ArrayList<>(); List<Recipe<?>> recipes = new ArrayList<>();
for (Consumer<List<IRecipe<?>>> consumer : recipeListConsumers) for (Consumer<List<Recipe<?>>> consumer : recipeListConsumers)
consumer.accept(recipes); consumer.accept(recipes);
return recipes; return recipes;
}); });
@ -361,7 +361,7 @@ public class CreateJEI implements IModPlugin {
} }
public static List<IRecipe<?>> findRecipes(Predicate<IRecipe<?>> predicate) { public static List<Recipe<?>> findRecipes(Predicate<Recipe<?>> predicate) {
return Minecraft.getInstance().level.getRecipeManager() return Minecraft.getInstance().level.getRecipeManager()
.getRecipes() .getRecipes()
.stream() .stream()
@ -369,34 +369,34 @@ public class CreateJEI implements IModPlugin {
.collect(Collectors.toList()); .collect(Collectors.toList());
} }
public static List<IRecipe<?>> findRecipesByType(IRecipeType<?> type) { public static List<Recipe<?>> findRecipesByType(RecipeType<?> type) {
return findRecipes(recipe -> recipe.getType() == type); return findRecipes(recipe -> recipe.getType() == type);
} }
public static List<IRecipe<?>> findRecipesByTypeExcluding(IRecipeType<?> type, IRecipeType<?> excludingType) { public static List<Recipe<?>> findRecipesByTypeExcluding(RecipeType<?> type, RecipeType<?> excludingType) {
List<IRecipe<?>> byType = findRecipesByType(type); List<Recipe<?>> byType = findRecipesByType(type);
removeRecipesByType(byType, excludingType); removeRecipesByType(byType, excludingType);
return byType; return byType;
} }
public static List<IRecipe<?>> findRecipesByTypeExcluding(IRecipeType<?> type, IRecipeType<?>... excludingTypes) { public static List<Recipe<?>> findRecipesByTypeExcluding(RecipeType<?> type, RecipeType<?>... excludingTypes) {
List<IRecipe<?>> byType = findRecipesByType(type); List<Recipe<?>> byType = findRecipesByType(type);
for (IRecipeType<?> excludingType : excludingTypes) for (RecipeType<?> excludingType : excludingTypes)
removeRecipesByType(byType, excludingType); removeRecipesByType(byType, excludingType);
return byType; return byType;
} }
public static void removeRecipesByType(List<IRecipe<?>> recipes, IRecipeType<?> type) { public static void removeRecipesByType(List<Recipe<?>> recipes, RecipeType<?> type) {
List<IRecipe<?>> byType = findRecipesByType(type); List<Recipe<?>> byType = findRecipesByType(type);
recipes.removeIf(recipe -> { recipes.removeIf(recipe -> {
for (IRecipe<?> r : byType) for (Recipe<?> r : byType)
if (doInputsMatch(recipe, r)) if (doInputsMatch(recipe, r))
return true; return true;
return false; return false;
}); });
} }
public static boolean doInputsMatch(IRecipe<?> recipe1, IRecipe<?> recipe2) { public static boolean doInputsMatch(Recipe<?> recipe1, Recipe<?> recipe2) {
ItemStack[] matchingStacks = recipe1.getIngredients() ItemStack[] matchingStacks = recipe1.getIngredients()
.get(0) .get(0)
.getItems(); .getItems();

View file

@ -2,13 +2,13 @@ package com.simibubi.create.compat.jei;
import java.util.function.Supplier; import java.util.function.Supplier;
import com.mojang.blaze3d.matrix.MatrixStack; import com.mojang.blaze3d.vertex.PoseStack;
import com.mojang.blaze3d.systems.RenderSystem; import com.mojang.blaze3d.systems.RenderSystem;
import com.simibubi.create.foundation.gui.GuiGameElement; import com.simibubi.create.foundation.gui.GuiGameElement;
import mezz.jei.api.gui.drawable.IDrawable; import mezz.jei.api.gui.drawable.IDrawable;
import net.minecraft.client.renderer.RenderHelper; import com.mojang.blaze3d.platform.Lighting;
import net.minecraft.item.ItemStack; import net.minecraft.world.item.ItemStack;
public class DoubleItemIcon implements IDrawable { public class DoubleItemIcon implements IDrawable {
@ -33,13 +33,13 @@ public class DoubleItemIcon implements IDrawable {
} }
@Override @Override
public void draw(MatrixStack matrixStack, int xOffset, int yOffset) { public void draw(PoseStack matrixStack, int xOffset, int yOffset) {
if (primaryStack == null) { if (primaryStack == null) {
primaryStack = primarySupplier.get(); primaryStack = primarySupplier.get();
secondaryStack = secondarySupplier.get(); secondaryStack = secondarySupplier.get();
} }
RenderHelper.turnBackOn(); Lighting.turnBackOn();
RenderSystem.color4f(1, 1, 1, 1); RenderSystem.color4f(1, 1, 1, 1);
RenderSystem.enableDepthTest(); RenderSystem.enableDepthTest();
matrixStack.pushPose(); matrixStack.pushPose();

View file

@ -1,6 +1,6 @@
package com.simibubi.create.compat.jei; package com.simibubi.create.compat.jei;
import com.mojang.blaze3d.matrix.MatrixStack; import com.mojang.blaze3d.vertex.PoseStack;
import mezz.jei.api.gui.drawable.IDrawable; import mezz.jei.api.gui.drawable.IDrawable;
@ -25,6 +25,6 @@ public class EmptyBackground implements IDrawable {
} }
@Override @Override
public void draw(MatrixStack matrixStack, int xOffset, int yOffset) {} public void draw(PoseStack matrixStack, int xOffset, int yOffset) {}
} }

View file

@ -13,9 +13,11 @@ import com.simibubi.create.foundation.networking.AllPackets;
import mcp.MethodsReturnNonnullByDefault; import mcp.MethodsReturnNonnullByDefault;
import mezz.jei.api.gui.handlers.IGhostIngredientHandler; import mezz.jei.api.gui.handlers.IGhostIngredientHandler;
import net.minecraft.client.renderer.Rectangle2d; import net.minecraft.client.renderer.Rect2i;
import net.minecraft.inventory.container.Slot; import net.minecraft.world.inventory.Slot;
import net.minecraft.item.ItemStack; import net.minecraft.world.item.ItemStack;
import mezz.jei.api.gui.handlers.IGhostIngredientHandler.Target;
@MethodsReturnNonnullByDefault @MethodsReturnNonnullByDefault
@ParametersAreNonnullByDefault @ParametersAreNonnullByDefault
@ -52,7 +54,7 @@ public class GhostIngredientHandler<T extends GhostItemContainer<?>>
private static class GhostTarget<I, T extends GhostItemContainer<?>> implements Target<I> { private static class GhostTarget<I, T extends GhostItemContainer<?>> implements Target<I> {
private final Rectangle2d area; private final Rect2i area;
private final AbstractSimiContainerScreen<T> gui; private final AbstractSimiContainerScreen<T> gui;
private final int slotIndex; private final int slotIndex;
private final boolean isAttributeFilter; private final boolean isAttributeFilter;
@ -62,11 +64,11 @@ public class GhostIngredientHandler<T extends GhostItemContainer<?>>
this.slotIndex = slotIndex; this.slotIndex = slotIndex;
this.isAttributeFilter = isAttributeFilter; this.isAttributeFilter = isAttributeFilter;
Slot slot = gui.getMenu().slots.get(slotIndex + 36); Slot slot = gui.getMenu().slots.get(slotIndex + 36);
this.area = new Rectangle2d(gui.getGuiLeft() + slot.x, gui.getGuiTop() + slot.y, 16, 16); this.area = new Rect2i(gui.getGuiLeft() + slot.x, gui.getGuiTop() + slot.y, 16, 16);
} }
@Override @Override
public Rectangle2d getArea() { public Rect2i getArea() {
return area; return area;
} }

View file

@ -1,10 +1,10 @@
package com.simibubi.create.compat.jei; package com.simibubi.create.compat.jei;
import com.mojang.blaze3d.matrix.MatrixStack; import com.mojang.blaze3d.vertex.PoseStack;
import com.simibubi.create.foundation.gui.AllGuiTextures; import com.simibubi.create.foundation.gui.AllGuiTextures;
import mezz.jei.api.gui.drawable.IDrawable; import mezz.jei.api.gui.drawable.IDrawable;
import net.minecraft.client.gui.AbstractGui; import net.minecraft.client.gui.GuiComponent;
public class ScreenResourceWrapper implements IDrawable { public class ScreenResourceWrapper implements IDrawable {
@ -25,9 +25,9 @@ public class ScreenResourceWrapper implements IDrawable {
} }
@Override @Override
public void draw(MatrixStack matrixStack, int xOffset, int yOffset) { public void draw(PoseStack matrixStack, int xOffset, int yOffset) {
resource.bind(); resource.bind();
AbstractGui.blit(matrixStack, xOffset, yOffset, 0, resource.startX, resource.startY, resource.width, GuiComponent.blit(matrixStack, xOffset, yOffset, 0, resource.startX, resource.startY, resource.width,
resource.height, 256, 256); resource.height, 256, 256);
} }

View file

@ -5,7 +5,7 @@ import java.util.List;
import com.simibubi.create.foundation.gui.AbstractSimiContainerScreen; import com.simibubi.create.foundation.gui.AbstractSimiContainerScreen;
import mezz.jei.api.gui.handlers.IGuiContainerHandler; import mezz.jei.api.gui.handlers.IGuiContainerHandler;
import net.minecraft.client.renderer.Rectangle2d; import net.minecraft.client.renderer.Rect2i;
/** /**
* Allows a {@link AbstractSimiContainerScreen} to specify an area in getExtraArea() that will be avoided by JEI * Allows a {@link AbstractSimiContainerScreen} to specify an area in getExtraArea() that will be avoided by JEI
@ -15,7 +15,7 @@ import net.minecraft.client.renderer.Rectangle2d;
public class SlotMover implements IGuiContainerHandler<AbstractSimiContainerScreen<?>> { public class SlotMover implements IGuiContainerHandler<AbstractSimiContainerScreen<?>> {
@Override @Override
public List<Rectangle2d> getGuiExtraAreas(AbstractSimiContainerScreen<?> containerScreen) { public List<Rect2i> getGuiExtraAreas(AbstractSimiContainerScreen<?> containerScreen) {
return containerScreen.getExtraAreas(); return containerScreen.getExtraAreas();
} }
} }

View file

@ -6,7 +6,7 @@ import java.util.stream.Collectors;
import org.apache.commons.lang3.mutable.MutableInt; import org.apache.commons.lang3.mutable.MutableInt;
import com.mojang.blaze3d.matrix.MatrixStack; import com.mojang.blaze3d.vertex.PoseStack;
import com.simibubi.create.AllBlocks; import com.simibubi.create.AllBlocks;
import com.simibubi.create.AllItems; import com.simibubi.create.AllItems;
import com.simibubi.create.content.contraptions.processing.BasinRecipe; import com.simibubi.create.content.contraptions.processing.BasinRecipe;
@ -25,9 +25,9 @@ import mezz.jei.api.gui.ingredient.IGuiFluidStackGroup;
import mezz.jei.api.gui.ingredient.IGuiItemStackGroup; import mezz.jei.api.gui.ingredient.IGuiItemStackGroup;
import mezz.jei.api.ingredients.IIngredients; import mezz.jei.api.ingredients.IIngredients;
import net.minecraft.client.Minecraft; import net.minecraft.client.Minecraft;
import net.minecraft.item.ItemStack; import net.minecraft.world.item.ItemStack;
import net.minecraft.item.crafting.Ingredient; import net.minecraft.world.item.crafting.Ingredient;
import net.minecraft.util.NonNullList; import net.minecraft.core.NonNullList;
import net.minecraftforge.fluids.FluidStack; import net.minecraftforge.fluids.FluidStack;
public class BasinCategory extends CreateRecipeCategory<BasinRecipe> { public class BasinCategory extends CreateRecipeCategory<BasinRecipe> {
@ -146,7 +146,7 @@ public class BasinCategory extends CreateRecipeCategory<BasinRecipe> {
} }
@Override @Override
public void draw(BasinRecipe recipe, MatrixStack matrixStack, double mouseX, double mouseY) { public void draw(BasinRecipe recipe, PoseStack matrixStack, double mouseX, double mouseY) {
List<Pair<Ingredient, MutableInt>> actualIngredients = ItemHelper.condenseIngredients(recipe.getIngredients()); List<Pair<Ingredient, MutableInt>> actualIngredients = ItemHelper.condenseIngredients(recipe.getIngredients());
int size = actualIngredients.size() + recipe.getFluidIngredients() int size = actualIngredients.size() + recipe.getFluidIngredients()

View file

@ -4,7 +4,7 @@ import java.util.ArrayList;
import java.util.Arrays; import java.util.Arrays;
import java.util.List; import java.util.List;
import com.mojang.blaze3d.matrix.MatrixStack; import com.mojang.blaze3d.vertex.PoseStack;
import com.simibubi.create.AllBlocks; import com.simibubi.create.AllBlocks;
import com.simibubi.create.compat.jei.category.BlockCuttingCategory.CondensedBlockCuttingRecipe; import com.simibubi.create.compat.jei.category.BlockCuttingCategory.CondensedBlockCuttingRecipe;
import com.simibubi.create.compat.jei.category.animations.AnimatedSaw; import com.simibubi.create.compat.jei.category.animations.AnimatedSaw;
@ -15,12 +15,12 @@ import mezz.jei.api.constants.VanillaTypes;
import mezz.jei.api.gui.IRecipeLayout; import mezz.jei.api.gui.IRecipeLayout;
import mezz.jei.api.gui.ingredient.IGuiItemStackGroup; import mezz.jei.api.gui.ingredient.IGuiItemStackGroup;
import mezz.jei.api.ingredients.IIngredients; import mezz.jei.api.ingredients.IIngredients;
import net.minecraft.item.Item; import net.minecraft.world.item.Item;
import net.minecraft.item.ItemStack; import net.minecraft.world.item.ItemStack;
import net.minecraft.item.crafting.IRecipe; import net.minecraft.world.item.crafting.Recipe;
import net.minecraft.item.crafting.Ingredient; import net.minecraft.world.item.crafting.Ingredient;
import net.minecraft.item.crafting.StonecuttingRecipe; import net.minecraft.world.item.crafting.StonecutterRecipe;
import net.minecraft.util.ResourceLocation; import net.minecraft.resources.ResourceLocation;
public class BlockCuttingCategory extends CreateRecipeCategory<CondensedBlockCuttingRecipe> { public class BlockCuttingCategory extends CreateRecipeCategory<CondensedBlockCuttingRecipe> {
@ -58,7 +58,7 @@ public class BlockCuttingCategory extends CreateRecipeCategory<CondensedBlockCut
} }
@Override @Override
public void draw(CondensedBlockCuttingRecipe recipe, MatrixStack matrixStack, double mouseX, double mouseY) { public void draw(CondensedBlockCuttingRecipe recipe, PoseStack matrixStack, double mouseX, double mouseY) {
AllGuiTextures.JEI_SLOT.draw(matrixStack, 4, 4); AllGuiTextures.JEI_SLOT.draw(matrixStack, 4, 4);
int size = Math.min(recipe.getOutputs().size(), 15); int size = Math.min(recipe.getOutputs().size(), 15);
for (int i = 0; i < size; i++) { for (int i = 0; i < size; i++) {
@ -71,7 +71,7 @@ public class BlockCuttingCategory extends CreateRecipeCategory<CondensedBlockCut
saw.draw(matrixStack, 33, 37); saw.draw(matrixStack, 33, 37);
} }
public static class CondensedBlockCuttingRecipe extends StonecuttingRecipe { public static class CondensedBlockCuttingRecipe extends StonecutterRecipe {
List<ItemStack> outputs = new ArrayList<>(); List<ItemStack> outputs = new ArrayList<>();
@ -104,9 +104,9 @@ public class BlockCuttingCategory extends CreateRecipeCategory<CondensedBlockCut
return result; return result;
} }
public static List<CondensedBlockCuttingRecipe> condenseRecipes(List<IRecipe<?>> stoneCuttingRecipes) { public static List<CondensedBlockCuttingRecipe> condenseRecipes(List<Recipe<?>> stoneCuttingRecipes) {
List<CondensedBlockCuttingRecipe> condensed = new ArrayList<>(); List<CondensedBlockCuttingRecipe> condensed = new ArrayList<>();
Recipes: for (IRecipe<?> recipe : stoneCuttingRecipes) { Recipes: for (Recipe<?> recipe : stoneCuttingRecipes) {
Ingredient i1 = recipe.getIngredients().get(0); Ingredient i1 = recipe.getIngredients().get(0);
for (CondensedBlockCuttingRecipe condensedRecipe : condensed) { for (CondensedBlockCuttingRecipe condensedRecipe : condensed) {
if (ItemHelper.matchIngredients(i1, condensedRecipe.getIngredients().get(0))) { if (ItemHelper.matchIngredients(i1, condensedRecipe.getIngredients().get(0))) {

View file

@ -20,18 +20,18 @@ import mezz.jei.api.gui.drawable.IDrawable;
import mezz.jei.api.gui.ingredient.IGuiFluidStackGroup; import mezz.jei.api.gui.ingredient.IGuiFluidStackGroup;
import mezz.jei.api.gui.ingredient.IGuiItemStackGroup; import mezz.jei.api.gui.ingredient.IGuiItemStackGroup;
import mezz.jei.api.recipe.category.IRecipeCategory; import mezz.jei.api.recipe.category.IRecipeCategory;
import net.minecraft.item.ItemStack; import net.minecraft.world.item.ItemStack;
import net.minecraft.item.crafting.IRecipe; import net.minecraft.world.item.crafting.Recipe;
import net.minecraft.util.IItemProvider; import net.minecraft.world.level.ItemLike;
import net.minecraft.util.ResourceLocation; import net.minecraft.resources.ResourceLocation;
import net.minecraft.util.text.ITextComponent; import net.minecraft.network.chat.Component;
import net.minecraft.util.text.StringTextComponent; import net.minecraft.network.chat.TextComponent;
import net.minecraft.util.text.TextFormatting; import net.minecraft.ChatFormatting;
import net.minecraftforge.fluids.FluidStack; import net.minecraftforge.fluids.FluidStack;
public abstract class CreateRecipeCategory<T extends IRecipe<?>> implements IRecipeCategory<T> { public abstract class CreateRecipeCategory<T extends Recipe<?>> implements IRecipeCategory<T> {
public final List<Supplier<List<? extends IRecipe<?>>>> recipes = new ArrayList<>(); public final List<Supplier<List<? extends Recipe<?>>>> recipes = new ArrayList<>();
public final List<Supplier<? extends Object>> recipeCatalysts = new ArrayList<>(); public final List<Supplier<? extends Object>> recipeCatalysts = new ArrayList<>();
protected ResourceLocation uid; protected ResourceLocation uid;
@ -70,7 +70,7 @@ public abstract class CreateRecipeCategory<T extends IRecipe<?>> implements IRec
return icon; return icon;
} }
public static AllGuiTextures getRenderedSlot(IRecipe<?> recipe, int index) { public static AllGuiTextures getRenderedSlot(Recipe<?> recipe, int index) {
AllGuiTextures jeiSlot = AllGuiTextures.JEI_SLOT; AllGuiTextures jeiSlot = AllGuiTextures.JEI_SLOT;
if (!(recipe instanceof ProcessingRecipe)) if (!(recipe instanceof ProcessingRecipe))
return jeiSlot; return jeiSlot;
@ -89,11 +89,11 @@ public abstract class CreateRecipeCategory<T extends IRecipe<?>> implements IRec
return new EmptyBackground(width, height); return new EmptyBackground(width, height);
} }
public static IDrawable doubleItemIcon(IItemProvider item1, IItemProvider item2) { public static IDrawable doubleItemIcon(ItemLike item1, ItemLike item2) {
return new DoubleItemIcon(() -> new ItemStack(item1), () -> new ItemStack(item2)); return new DoubleItemIcon(() -> new ItemStack(item1), () -> new ItemStack(item2));
} }
public static IDrawable itemIcon(IItemProvider item) { public static IDrawable itemIcon(ItemLike item) {
return new DoubleItemIcon(() -> new ItemStack(item), () -> ItemStack.EMPTY); return new DoubleItemIcon(() -> new ItemStack(item), () -> ItemStack.EMPTY);
} }
@ -111,7 +111,7 @@ public abstract class CreateRecipeCategory<T extends IRecipe<?>> implements IRec
float chance = output.getChance(); float chance = output.getChance();
if (chance != 1) if (chance != 1)
tooltip.add(1, Lang.translate("recipe.processing.chance", chance < 0.01 ? "<1" : (int) (chance * 100)) tooltip.add(1, Lang.translate("recipe.processing.chance", chance < 0.01 ? "<1" : (int) (chance * 100))
.withStyle(TextFormatting.GOLD)); .withStyle(ChatFormatting.GOLD));
}); });
} }
@ -145,26 +145,26 @@ public abstract class CreateRecipeCategory<T extends IRecipe<?>> implements IRec
if (fluid.getFluid() if (fluid.getFluid()
.isSame(AllFluids.POTION.get())) { .isSame(AllFluids.POTION.get())) {
ITextComponent name = fluid.getDisplayName(); Component name = fluid.getDisplayName();
if (tooltip.isEmpty()) if (tooltip.isEmpty())
tooltip.add(0, name); tooltip.add(0, name);
else else
tooltip.set(0, name); tooltip.set(0, name);
ArrayList<ITextComponent> potionTooltip = new ArrayList<>(); ArrayList<Component> potionTooltip = new ArrayList<>();
PotionFluidHandler.addPotionTooltip(fluid, potionTooltip, 1); PotionFluidHandler.addPotionTooltip(fluid, potionTooltip, 1);
tooltip.addAll(1, potionTooltip.stream() tooltip.addAll(1, potionTooltip.stream()
.collect(Collectors.toList())); .collect(Collectors.toList()));
} }
int amount = amounts.get(index != -1 ? 0 : slotIndex); int amount = amounts.get(index != -1 ? 0 : slotIndex);
ITextComponent text = (Lang.translate("generic.unit.millibuckets", amount)).withStyle(TextFormatting.GOLD); Component text = (Lang.translate("generic.unit.millibuckets", amount)).withStyle(ChatFormatting.GOLD);
if (tooltip.isEmpty()) if (tooltip.isEmpty())
tooltip.add(0, text); tooltip.add(0, text);
else { else {
List<ITextComponent> siblings = tooltip.get(0) List<Component> siblings = tooltip.get(0)
.getSiblings(); .getSiblings();
siblings.add(new StringTextComponent(" ")); siblings.add(new TextComponent(" "));
siblings.add(text); siblings.add(text);
} }
}); });

View file

@ -3,7 +3,7 @@ package com.simibubi.create.compat.jei.category;
import java.util.Arrays; import java.util.Arrays;
import java.util.List; import java.util.List;
import com.mojang.blaze3d.matrix.MatrixStack; import com.mojang.blaze3d.vertex.PoseStack;
import com.simibubi.create.AllBlocks; import com.simibubi.create.AllBlocks;
import com.simibubi.create.AllItems; import com.simibubi.create.AllItems;
import com.simibubi.create.compat.jei.category.animations.AnimatedCrushingWheels; import com.simibubi.create.compat.jei.category.animations.AnimatedCrushingWheels;
@ -56,7 +56,7 @@ public class CrushingCategory extends CreateRecipeCategory<AbstractCrushingRecip
} }
@Override @Override
public void draw(AbstractCrushingRecipe recipe, MatrixStack matrixStack, double mouseX, double mouseY) { public void draw(AbstractCrushingRecipe recipe, PoseStack matrixStack, double mouseX, double mouseY) {
List<ProcessingOutput> results = recipe.getRollableResults(); List<ProcessingOutput> results = recipe.getRollableResults();
AllGuiTextures.JEI_SLOT.draw(matrixStack, 50, 2); AllGuiTextures.JEI_SLOT.draw(matrixStack, 50, 2);
AllGuiTextures.JEI_DOWN_ARROW.draw(matrixStack, 72, 7); AllGuiTextures.JEI_DOWN_ARROW.draw(matrixStack, 72, 7);

View file

@ -3,7 +3,7 @@ package com.simibubi.create.compat.jei.category;
import java.util.Arrays; import java.util.Arrays;
import java.util.stream.Collectors; import java.util.stream.Collectors;
import com.mojang.blaze3d.matrix.MatrixStack; import com.mojang.blaze3d.vertex.PoseStack;
import com.simibubi.create.AllBlocks; import com.simibubi.create.AllBlocks;
import com.simibubi.create.compat.jei.category.animations.AnimatedDeployer; import com.simibubi.create.compat.jei.category.animations.AnimatedDeployer;
import com.simibubi.create.content.contraptions.components.deployer.DeployerApplicationRecipe; import com.simibubi.create.content.contraptions.components.deployer.DeployerApplicationRecipe;
@ -15,7 +15,7 @@ import mezz.jei.api.constants.VanillaTypes;
import mezz.jei.api.gui.IRecipeLayout; import mezz.jei.api.gui.IRecipeLayout;
import mezz.jei.api.gui.ingredient.IGuiItemStackGroup; import mezz.jei.api.gui.ingredient.IGuiItemStackGroup;
import mezz.jei.api.ingredients.IIngredients; import mezz.jei.api.ingredients.IIngredients;
import net.minecraft.util.text.TextFormatting; import net.minecraft.ChatFormatting;
public class DeployingCategory extends CreateRecipeCategory<DeployerApplicationRecipe> { public class DeployingCategory extends CreateRecipeCategory<DeployerApplicationRecipe> {
@ -63,7 +63,7 @@ public class DeployingCategory extends CreateRecipeCategory<DeployerApplicationR
if (slotIndex != 1) if (slotIndex != 1)
return; return;
tooltip.add(1, Lang.translate("recipe.deploying.not_consumed") tooltip.add(1, Lang.translate("recipe.deploying.not_consumed")
.withStyle(TextFormatting.GOLD)); .withStyle(ChatFormatting.GOLD));
}); });
} }
@ -71,7 +71,7 @@ public class DeployingCategory extends CreateRecipeCategory<DeployerApplicationR
} }
@Override @Override
public void draw(DeployerApplicationRecipe recipe, MatrixStack matrixStack, double mouseX, double mouseY) { public void draw(DeployerApplicationRecipe recipe, PoseStack matrixStack, double mouseX, double mouseY) {
AllGuiTextures.JEI_SLOT.draw(matrixStack, 50, 4); AllGuiTextures.JEI_SLOT.draw(matrixStack, 50, 4);
AllGuiTextures.JEI_SLOT.draw(matrixStack, 26, 50); AllGuiTextures.JEI_SLOT.draw(matrixStack, 26, 50);
getRenderedSlot(recipe, 0).draw(matrixStack, 131, 50); getRenderedSlot(recipe, 0).draw(matrixStack, 131, 50);

View file

@ -1,12 +1,12 @@
package com.simibubi.create.compat.jei.category; package com.simibubi.create.compat.jei.category;
import com.mojang.blaze3d.matrix.MatrixStack; import com.mojang.blaze3d.vertex.PoseStack;
import com.simibubi.create.AllItems; import com.simibubi.create.AllItems;
import com.simibubi.create.foundation.gui.GuiGameElement; import com.simibubi.create.foundation.gui.GuiGameElement;
import net.minecraft.fluid.Fluids; import net.minecraft.world.level.material.Fluids;
import net.minecraft.item.Items; import net.minecraft.world.item.Items;
import net.minecraft.item.crafting.AbstractCookingRecipe; import net.minecraft.world.item.crafting.AbstractCookingRecipe;
public class FanBlastingCategory extends ProcessingViaFanCategory<AbstractCookingRecipe> { public class FanBlastingCategory extends ProcessingViaFanCategory<AbstractCookingRecipe> {
@ -20,7 +20,7 @@ public class FanBlastingCategory extends ProcessingViaFanCategory<AbstractCookin
} }
@Override @Override
public void renderAttachedBlock(MatrixStack matrixStack) { public void renderAttachedBlock(PoseStack matrixStack) {
matrixStack.pushPose(); matrixStack.pushPose();
GuiGameElement.of(Fluids.LAVA) GuiGameElement.of(Fluids.LAVA)

View file

@ -1,12 +1,12 @@
package com.simibubi.create.compat.jei.category; package com.simibubi.create.compat.jei.category;
import com.mojang.blaze3d.matrix.MatrixStack; import com.mojang.blaze3d.vertex.PoseStack;
import com.simibubi.create.AllItems; import com.simibubi.create.AllItems;
import com.simibubi.create.foundation.gui.GuiGameElement; import com.simibubi.create.foundation.gui.GuiGameElement;
import net.minecraft.block.Blocks; import net.minecraft.world.level.block.Blocks;
import net.minecraft.item.Items; import net.minecraft.world.item.Items;
import net.minecraft.item.crafting.SmokingRecipe; import net.minecraft.world.item.crafting.SmokingRecipe;
public class FanSmokingCategory extends ProcessingViaFanCategory<SmokingRecipe> { public class FanSmokingCategory extends ProcessingViaFanCategory<SmokingRecipe> {
@ -20,7 +20,7 @@ public class FanSmokingCategory extends ProcessingViaFanCategory<SmokingRecipe>
} }
@Override @Override
public void renderAttachedBlock(MatrixStack matrixStack) { public void renderAttachedBlock(PoseStack matrixStack) {
GuiGameElement.of(Blocks.FIRE.defaultBlockState()) GuiGameElement.of(Blocks.FIRE.defaultBlockState())
.scale(24) .scale(24)
.atLocal(0, 0, 2) .atLocal(0, 0, 2)

View file

@ -3,7 +3,7 @@ package com.simibubi.create.compat.jei.category;
import java.util.Arrays; import java.util.Arrays;
import java.util.List; import java.util.List;
import com.mojang.blaze3d.matrix.MatrixStack; import com.mojang.blaze3d.vertex.PoseStack;
import com.simibubi.create.AllItems; import com.simibubi.create.AllItems;
import com.simibubi.create.content.contraptions.components.fan.SplashingRecipe; import com.simibubi.create.content.contraptions.components.fan.SplashingRecipe;
import com.simibubi.create.content.contraptions.processing.ProcessingOutput; import com.simibubi.create.content.contraptions.processing.ProcessingOutput;
@ -14,8 +14,8 @@ import mezz.jei.api.constants.VanillaTypes;
import mezz.jei.api.gui.IRecipeLayout; import mezz.jei.api.gui.IRecipeLayout;
import mezz.jei.api.gui.ingredient.IGuiItemStackGroup; import mezz.jei.api.gui.ingredient.IGuiItemStackGroup;
import mezz.jei.api.ingredients.IIngredients; import mezz.jei.api.ingredients.IIngredients;
import net.minecraft.fluid.Fluids; import net.minecraft.world.level.material.Fluids;
import net.minecraft.item.Items; import net.minecraft.world.item.Items;
public class FanWashingCategory extends ProcessingViaFanCategory<SplashingRecipe> { public class FanWashingCategory extends ProcessingViaFanCategory<SplashingRecipe> {
@ -58,7 +58,7 @@ public class FanWashingCategory extends ProcessingViaFanCategory<SplashingRecipe
} }
@Override @Override
protected void renderWidgets(MatrixStack matrixStack, SplashingRecipe recipe, double mouseX, double mouseY) { protected void renderWidgets(PoseStack matrixStack, SplashingRecipe recipe, double mouseX, double mouseY) {
int size = recipe.getRollableResultsAsItemStacks() int size = recipe.getRollableResultsAsItemStacks()
.size(); .size();
@ -80,12 +80,12 @@ public class FanWashingCategory extends ProcessingViaFanCategory<SplashingRecipe
} }
@Override @Override
protected void translateFan(MatrixStack ms) { protected void translateFan(PoseStack ms) {
ms.translate(56 + 4, 33, 0); ms.translate(56 + 4, 33, 0);
} }
@Override @Override
public void renderAttachedBlock(MatrixStack matrixStack) { public void renderAttachedBlock(PoseStack matrixStack) {
matrixStack.pushPose(); matrixStack.pushPose();
GuiGameElement.of(Fluids.WATER) GuiGameElement.of(Fluids.WATER)

View file

@ -6,7 +6,7 @@ import java.util.Collections;
import java.util.List; import java.util.List;
import com.google.common.collect.ImmutableList; import com.google.common.collect.ImmutableList;
import com.mojang.blaze3d.matrix.MatrixStack; import com.mojang.blaze3d.vertex.PoseStack;
import com.simibubi.create.AllBlocks; import com.simibubi.create.AllBlocks;
import com.simibubi.create.Create; import com.simibubi.create.Create;
import com.simibubi.create.compat.jei.category.animations.AnimatedItemDrain; import com.simibubi.create.compat.jei.category.animations.AnimatedItemDrain;
@ -21,11 +21,11 @@ import mezz.jei.api.gui.ingredient.IGuiFluidStackGroup;
import mezz.jei.api.gui.ingredient.IGuiItemStackGroup; import mezz.jei.api.gui.ingredient.IGuiItemStackGroup;
import mezz.jei.api.ingredients.IIngredients; import mezz.jei.api.ingredients.IIngredients;
import mezz.jei.api.runtime.IIngredientManager; import mezz.jei.api.runtime.IIngredientManager;
import net.minecraft.item.ItemStack; import net.minecraft.world.item.ItemStack;
import net.minecraft.item.Items; import net.minecraft.world.item.Items;
import net.minecraft.item.PotionItem; import net.minecraft.world.item.PotionItem;
import net.minecraft.item.crafting.Ingredient; import net.minecraft.world.item.crafting.Ingredient;
import net.minecraft.util.ResourceLocation; import net.minecraft.resources.ResourceLocation;
import net.minecraftforge.common.util.LazyOptional; import net.minecraftforge.common.util.LazyOptional;
import net.minecraftforge.fluids.FluidStack; import net.minecraftforge.fluids.FluidStack;
import net.minecraftforge.fluids.capability.CapabilityFluidHandler; import net.minecraftforge.fluids.capability.CapabilityFluidHandler;
@ -127,7 +127,7 @@ public class ItemDrainCategory extends CreateRecipeCategory<EmptyingRecipe> {
} }
@Override @Override
public void draw(EmptyingRecipe recipe, MatrixStack matrixStack, double mouseX, double mouseY) { public void draw(EmptyingRecipe recipe, PoseStack matrixStack, double mouseX, double mouseY) {
AllGuiTextures.JEI_SLOT.draw(matrixStack, 131, 7); AllGuiTextures.JEI_SLOT.draw(matrixStack, 131, 7);
AllGuiTextures.JEI_SLOT.draw(matrixStack, 26, 7); AllGuiTextures.JEI_SLOT.draw(matrixStack, 26, 7);
getRenderedSlot(recipe, 0).draw(matrixStack, 131, 26); getRenderedSlot(recipe, 0).draw(matrixStack, 131, 26);

View file

@ -4,7 +4,7 @@ import java.util.ArrayList;
import java.util.Arrays; import java.util.Arrays;
import java.util.List; import java.util.List;
import com.mojang.blaze3d.matrix.MatrixStack; import com.mojang.blaze3d.vertex.PoseStack;
import com.mojang.blaze3d.systems.RenderSystem; import com.mojang.blaze3d.systems.RenderSystem;
import com.simibubi.create.AllBlocks; import com.simibubi.create.AllBlocks;
import com.simibubi.create.compat.jei.category.animations.AnimatedCrafter; import com.simibubi.create.compat.jei.category.animations.AnimatedCrafter;
@ -16,21 +16,21 @@ import mezz.jei.api.gui.ingredient.IGuiItemStackGroup;
import mezz.jei.api.ingredients.IIngredientRenderer; import mezz.jei.api.ingredients.IIngredientRenderer;
import mezz.jei.api.ingredients.IIngredients; import mezz.jei.api.ingredients.IIngredients;
import net.minecraft.client.Minecraft; import net.minecraft.client.Minecraft;
import net.minecraft.client.gui.FontRenderer; import net.minecraft.client.gui.Font;
import net.minecraft.client.renderer.ItemRenderer; import net.minecraft.client.renderer.entity.ItemRenderer;
import net.minecraft.client.renderer.RenderHelper; import com.mojang.blaze3d.platform.Lighting;
import net.minecraft.client.util.ITooltipFlag; import net.minecraft.world.item.TooltipFlag;
import net.minecraft.entity.player.PlayerEntity; import net.minecraft.world.entity.player.Player;
import net.minecraft.item.ItemStack; import net.minecraft.world.item.ItemStack;
import net.minecraft.item.crafting.ICraftingRecipe; import net.minecraft.world.item.crafting.CraftingRecipe;
import net.minecraft.item.crafting.Ingredient; import net.minecraft.world.item.crafting.Ingredient;
import net.minecraft.item.crafting.ShapedRecipe; import net.minecraft.world.item.crafting.ShapedRecipe;
import net.minecraft.util.NonNullList; import net.minecraft.core.NonNullList;
import net.minecraft.util.text.ITextComponent; import net.minecraft.network.chat.Component;
import net.minecraft.util.text.TextFormatting; import net.minecraft.ChatFormatting;
import net.minecraft.util.text.TranslationTextComponent; import net.minecraft.network.chat.TranslatableComponent;
public class MechanicalCraftingCategory extends CreateRecipeCategory<ICraftingRecipe> { public class MechanicalCraftingCategory extends CreateRecipeCategory<CraftingRecipe> {
private final AnimatedCrafter crafter = new AnimatedCrafter(); private final AnimatedCrafter crafter = new AnimatedCrafter();
@ -39,13 +39,13 @@ public class MechanicalCraftingCategory extends CreateRecipeCategory<ICraftingRe
} }
@Override @Override
public void setIngredients(ICraftingRecipe recipe, IIngredients ingredients) { public void setIngredients(CraftingRecipe recipe, IIngredients ingredients) {
ingredients.setInputIngredients(recipe.getIngredients()); ingredients.setInputIngredients(recipe.getIngredients());
ingredients.setOutput(VanillaTypes.ITEM, recipe.getResultItem()); ingredients.setOutput(VanillaTypes.ITEM, recipe.getResultItem());
} }
@Override @Override
public void setRecipe(IRecipeLayout recipeLayout, ICraftingRecipe recipe, IIngredients ingredients) { public void setRecipe(IRecipeLayout recipeLayout, CraftingRecipe recipe, IIngredients ingredients) {
IGuiItemStackGroup itemStacks = recipeLayout.getItemStacks(); IGuiItemStackGroup itemStacks = recipeLayout.getItemStacks();
NonNullList<Ingredient> recipeIngredients = recipe.getIngredients(); NonNullList<Ingredient> recipeIngredients = recipe.getIngredients();
@ -73,30 +73,30 @@ public class MechanicalCraftingCategory extends CreateRecipeCategory<ICraftingRe
static int maxSize = 100; static int maxSize = 100;
public static float getScale(ICraftingRecipe recipe) { public static float getScale(CraftingRecipe recipe) {
int w = getWidth(recipe); int w = getWidth(recipe);
int h = getHeight(recipe); int h = getHeight(recipe);
return Math.min(1, maxSize / (19f * Math.max(w, h))); return Math.min(1, maxSize / (19f * Math.max(w, h)));
} }
public static int getYPadding(ICraftingRecipe recipe) { public static int getYPadding(CraftingRecipe recipe) {
return 3 + 50 - (int) (getScale(recipe) * getHeight(recipe) * 19 * .5); return 3 + 50 - (int) (getScale(recipe) * getHeight(recipe) * 19 * .5);
} }
public static int getXPadding(ICraftingRecipe recipe) { public static int getXPadding(CraftingRecipe recipe) {
return 3 + 50 - (int) (getScale(recipe) * getWidth(recipe) * 19 * .5); return 3 + 50 - (int) (getScale(recipe) * getWidth(recipe) * 19 * .5);
} }
private static int getWidth(ICraftingRecipe recipe) { private static int getWidth(CraftingRecipe recipe) {
return recipe instanceof ShapedRecipe ? ((ShapedRecipe) recipe).getWidth() : 1; return recipe instanceof ShapedRecipe ? ((ShapedRecipe) recipe).getWidth() : 1;
} }
private static int getHeight(ICraftingRecipe recipe) { private static int getHeight(CraftingRecipe recipe) {
return recipe instanceof ShapedRecipe ? ((ShapedRecipe) recipe).getHeight() : 1; return recipe instanceof ShapedRecipe ? ((ShapedRecipe) recipe).getHeight() : 1;
} }
@Override @Override
public void draw(ICraftingRecipe recipe, MatrixStack matrixStack, double mouseX, double mouseY) { public void draw(CraftingRecipe recipe, PoseStack matrixStack, double mouseX, double mouseY) {
matrixStack.pushPose(); matrixStack.pushPose();
float scale = getScale(recipe); float scale = getScale(recipe);
matrixStack.translate(getXPadding(recipe), getYPadding(recipe), 0); matrixStack.translate(getXPadding(recipe), getYPadding(recipe), 0);
@ -122,7 +122,7 @@ public class MechanicalCraftingCategory extends CreateRecipeCategory<ICraftingRe
matrixStack.pushPose(); matrixStack.pushPose();
matrixStack.translate(0, 0, 300); matrixStack.translate(0, 0, 300);
RenderHelper.turnOff(); Lighting.turnOff();
int amount = 0; int amount = 0;
for (Ingredient ingredient : recipe.getIngredients()) { for (Ingredient ingredient : recipe.getIngredients()) {
if (Ingredient.EMPTY == ingredient) if (Ingredient.EMPTY == ingredient)
@ -135,20 +135,20 @@ public class MechanicalCraftingCategory extends CreateRecipeCategory<ICraftingRe
} }
@Override @Override
public Class<? extends ICraftingRecipe> getRecipeClass() { public Class<? extends CraftingRecipe> getRecipeClass() {
return ICraftingRecipe.class; return CraftingRecipe.class;
} }
private static final class CrafterIngredientRenderer implements IIngredientRenderer<ItemStack> { private static final class CrafterIngredientRenderer implements IIngredientRenderer<ItemStack> {
private final ICraftingRecipe recipe; private final CraftingRecipe recipe;
public CrafterIngredientRenderer(ICraftingRecipe recipe) { public CrafterIngredientRenderer(CraftingRecipe recipe) {
this.recipe = recipe; this.recipe = recipe;
} }
@Override @Override
public void render(MatrixStack matrixStack, int xPosition, int yPosition, ItemStack ingredient) { public void render(PoseStack matrixStack, int xPosition, int yPosition, ItemStack ingredient) {
matrixStack.pushPose(); matrixStack.pushPose();
matrixStack.translate(xPosition, yPosition, 0); matrixStack.translate(xPosition, yPosition, 0);
float scale = getScale(recipe); float scale = getScale(recipe);
@ -158,14 +158,14 @@ public class MechanicalCraftingCategory extends CreateRecipeCategory<ICraftingRe
RenderSystem.pushMatrix(); RenderSystem.pushMatrix();
RenderSystem.multMatrix(matrixStack.last().pose()); RenderSystem.multMatrix(matrixStack.last().pose());
RenderSystem.enableDepthTest(); RenderSystem.enableDepthTest();
RenderHelper.turnBackOn(); Lighting.turnBackOn();
Minecraft minecraft = Minecraft.getInstance(); Minecraft minecraft = Minecraft.getInstance();
FontRenderer font = getFontRenderer(minecraft, ingredient); Font font = getFontRenderer(minecraft, ingredient);
ItemRenderer itemRenderer = minecraft.getItemRenderer(); ItemRenderer itemRenderer = minecraft.getItemRenderer();
itemRenderer.renderAndDecorateItem(null, ingredient, 0, 0); itemRenderer.renderAndDecorateItem(null, ingredient, 0, 0);
itemRenderer.renderGuiItemDecorations(font, ingredient, 0, 0, null); itemRenderer.renderGuiItemDecorations(font, ingredient, 0, 0, null);
RenderSystem.disableBlend(); RenderSystem.disableBlend();
RenderHelper.turnOff(); Lighting.turnOff();
RenderSystem.popMatrix(); RenderSystem.popMatrix();
} }
@ -173,15 +173,15 @@ public class MechanicalCraftingCategory extends CreateRecipeCategory<ICraftingRe
} }
@Override @Override
public List<ITextComponent> getTooltip(ItemStack ingredient, ITooltipFlag tooltipFlag) { public List<Component> getTooltip(ItemStack ingredient, TooltipFlag tooltipFlag) {
Minecraft minecraft = Minecraft.getInstance(); Minecraft minecraft = Minecraft.getInstance();
PlayerEntity player = minecraft.player; Player player = minecraft.player;
try { try {
return ingredient.getTooltipLines(player, tooltipFlag); return ingredient.getTooltipLines(player, tooltipFlag);
} catch (RuntimeException | LinkageError e) { } catch (RuntimeException | LinkageError e) {
List<ITextComponent> list = new ArrayList<>(); List<Component> list = new ArrayList<>();
TranslationTextComponent crash = new TranslationTextComponent("jei.tooltip.error.crash"); TranslatableComponent crash = new TranslatableComponent("jei.tooltip.error.crash");
list.add(crash.withStyle(TextFormatting.RED)); list.add(crash.withStyle(ChatFormatting.RED));
return list; return list;
} }
} }

View file

@ -3,7 +3,7 @@ package com.simibubi.create.compat.jei.category;
import java.util.Arrays; import java.util.Arrays;
import java.util.List; import java.util.List;
import com.mojang.blaze3d.matrix.MatrixStack; import com.mojang.blaze3d.vertex.PoseStack;
import com.simibubi.create.AllBlocks; import com.simibubi.create.AllBlocks;
import com.simibubi.create.AllItems; import com.simibubi.create.AllItems;
import com.simibubi.create.compat.jei.category.animations.AnimatedMillstone; import com.simibubi.create.compat.jei.category.animations.AnimatedMillstone;
@ -58,7 +58,7 @@ public class MillingCategory extends CreateRecipeCategory<AbstractCrushingRecipe
} }
@Override @Override
public void draw(AbstractCrushingRecipe recipe, MatrixStack matrixStack, double mouseX, double mouseY) { public void draw(AbstractCrushingRecipe recipe, PoseStack matrixStack, double mouseX, double mouseY) {
int size = recipe.getRollableResultsAsItemStacks() int size = recipe.getRollableResultsAsItemStacks()
.size(); .size();

View file

@ -1,15 +1,15 @@
package com.simibubi.create.compat.jei.category; package com.simibubi.create.compat.jei.category;
import com.mojang.blaze3d.matrix.MatrixStack; import com.mojang.blaze3d.vertex.PoseStack;
import com.simibubi.create.AllBlocks; import com.simibubi.create.AllBlocks;
import com.simibubi.create.compat.jei.category.animations.AnimatedBlazeBurner; import com.simibubi.create.compat.jei.category.animations.AnimatedBlazeBurner;
import com.simibubi.create.compat.jei.category.animations.AnimatedMixer; import com.simibubi.create.compat.jei.category.animations.AnimatedMixer;
import com.simibubi.create.content.contraptions.processing.BasinRecipe; import com.simibubi.create.content.contraptions.processing.BasinRecipe;
import com.simibubi.create.content.contraptions.processing.HeatCondition; import com.simibubi.create.content.contraptions.processing.HeatCondition;
import net.minecraft.block.Blocks; import net.minecraft.world.level.block.Blocks;
import net.minecraft.item.Items; import net.minecraft.world.item.Items;
import net.minecraft.util.IItemProvider; import net.minecraft.world.level.ItemLike;
public class MixingCategory extends BasinCategory { public class MixingCategory extends BasinCategory {
@ -33,14 +33,14 @@ public class MixingCategory extends BasinCategory {
return new MixingCategory(MixingType.AUTO_BREWING, Blocks.BREWING_STAND, 103); return new MixingCategory(MixingType.AUTO_BREWING, Blocks.BREWING_STAND, 103);
} }
protected MixingCategory(MixingType type, IItemProvider secondaryItem, int height) { protected MixingCategory(MixingType type, ItemLike secondaryItem, int height) {
super(type != MixingType.AUTO_SHAPELESS, doubleItemIcon(AllBlocks.MECHANICAL_MIXER.get(), secondaryItem), super(type != MixingType.AUTO_SHAPELESS, doubleItemIcon(AllBlocks.MECHANICAL_MIXER.get(), secondaryItem),
emptyBackground(177, height)); emptyBackground(177, height));
this.type = type; this.type = type;
} }
@Override @Override
public void draw(BasinRecipe recipe, MatrixStack matrixStack, double mouseX, double mouseY) { public void draw(BasinRecipe recipe, PoseStack matrixStack, double mouseX, double mouseY) {
super.draw(recipe, matrixStack, mouseX, mouseY); super.draw(recipe, matrixStack, mouseX, mouseY);
HeatCondition requiredHeat = recipe.getRequiredHeat(); HeatCondition requiredHeat = recipe.getRequiredHeat();
if (requiredHeat != HeatCondition.NONE) if (requiredHeat != HeatCondition.NONE)

View file

@ -4,7 +4,7 @@ import java.util.ArrayList;
import java.util.Arrays; import java.util.Arrays;
import java.util.List; import java.util.List;
import com.mojang.blaze3d.matrix.MatrixStack; import com.mojang.blaze3d.vertex.PoseStack;
import com.simibubi.create.AllBlocks; import com.simibubi.create.AllBlocks;
import com.simibubi.create.AllItems; import com.simibubi.create.AllItems;
import com.simibubi.create.compat.jei.ConversionRecipe; import com.simibubi.create.compat.jei.ConversionRecipe;
@ -53,7 +53,7 @@ public class MysteriousItemConversionCategory extends CreateRecipeCategory<Conve
} }
@Override @Override
public void draw(ConversionRecipe recipe, MatrixStack matrixStack, double mouseX, double mouseY) { public void draw(ConversionRecipe recipe, PoseStack matrixStack, double mouseX, double mouseY) {
AllGuiTextures.JEI_SLOT.draw(matrixStack, 26, 16); AllGuiTextures.JEI_SLOT.draw(matrixStack, 26, 16);
AllGuiTextures.JEI_SLOT.draw(matrixStack, 131, 16); AllGuiTextures.JEI_SLOT.draw(matrixStack, 131, 16);
AllGuiTextures.JEI_LONG_ARROW.draw(matrixStack, 52, 20); AllGuiTextures.JEI_LONG_ARROW.draw(matrixStack, 52, 20);

View file

@ -2,7 +2,7 @@ package com.simibubi.create.compat.jei.category;
import java.util.Arrays; import java.util.Arrays;
import com.mojang.blaze3d.matrix.MatrixStack; import com.mojang.blaze3d.vertex.PoseStack;
import com.simibubi.create.AllBlocks; import com.simibubi.create.AllBlocks;
import com.simibubi.create.compat.jei.category.animations.AnimatedBlazeBurner; import com.simibubi.create.compat.jei.category.animations.AnimatedBlazeBurner;
import com.simibubi.create.compat.jei.category.animations.AnimatedPress; import com.simibubi.create.compat.jei.category.animations.AnimatedPress;
@ -13,10 +13,10 @@ import com.simibubi.create.foundation.gui.AllGuiTextures;
import mezz.jei.api.gui.IRecipeLayout; import mezz.jei.api.gui.IRecipeLayout;
import mezz.jei.api.gui.ingredient.IGuiItemStackGroup; import mezz.jei.api.gui.ingredient.IGuiItemStackGroup;
import mezz.jei.api.ingredients.IIngredients; import mezz.jei.api.ingredients.IIngredients;
import net.minecraft.block.Blocks; import net.minecraft.world.level.block.Blocks;
import net.minecraft.item.crafting.Ingredient; import net.minecraft.world.item.crafting.Ingredient;
import net.minecraft.util.IItemProvider; import net.minecraft.world.level.ItemLike;
import net.minecraft.util.NonNullList; import net.minecraft.core.NonNullList;
public class PackingCategory extends BasinCategory { public class PackingCategory extends BasinCategory {
@ -36,7 +36,7 @@ public class PackingCategory extends BasinCategory {
return new PackingCategory(PackingType.AUTO_SQUARE, Blocks.CRAFTING_TABLE, 85); return new PackingCategory(PackingType.AUTO_SQUARE, Blocks.CRAFTING_TABLE, 85);
} }
protected PackingCategory(PackingType type, IItemProvider icon, int height) { protected PackingCategory(PackingType type, ItemLike icon, int height) {
super(type != PackingType.AUTO_SQUARE, doubleItemIcon(AllBlocks.MECHANICAL_PRESS.get(), icon), super(type != PackingType.AUTO_SQUARE, doubleItemIcon(AllBlocks.MECHANICAL_PRESS.get(), icon),
emptyBackground(177, height)); emptyBackground(177, height));
this.type = type; this.type = type;
@ -67,7 +67,7 @@ public class PackingCategory extends BasinCategory {
} }
@Override @Override
public void draw(BasinRecipe recipe, MatrixStack matrixStack, double mouseX, double mouseY) { public void draw(BasinRecipe recipe, PoseStack matrixStack, double mouseX, double mouseY) {
if (type == PackingType.COMPACTING) { if (type == PackingType.COMPACTING) {
super.draw(recipe, matrixStack, mouseX, mouseY); super.draw(recipe, matrixStack, mouseX, mouseY);

View file

@ -3,7 +3,7 @@ package com.simibubi.create.compat.jei.category;
import java.util.Arrays; import java.util.Arrays;
import java.util.List; import java.util.List;
import com.mojang.blaze3d.matrix.MatrixStack; import com.mojang.blaze3d.vertex.PoseStack;
import com.simibubi.create.AllItems; import com.simibubi.create.AllItems;
import com.simibubi.create.content.contraptions.processing.ProcessingOutput; import com.simibubi.create.content.contraptions.processing.ProcessingOutput;
import com.simibubi.create.content.curiosities.tools.SandPaperPolishingRecipe; import com.simibubi.create.content.curiosities.tools.SandPaperPolishingRecipe;
@ -14,10 +14,10 @@ import mezz.jei.api.constants.VanillaTypes;
import mezz.jei.api.gui.IRecipeLayout; import mezz.jei.api.gui.IRecipeLayout;
import mezz.jei.api.gui.ingredient.IGuiItemStackGroup; import mezz.jei.api.gui.ingredient.IGuiItemStackGroup;
import mezz.jei.api.ingredients.IIngredients; import mezz.jei.api.ingredients.IIngredients;
import net.minecraft.item.ItemStack; import net.minecraft.world.item.ItemStack;
import net.minecraft.item.crafting.Ingredient; import net.minecraft.world.item.crafting.Ingredient;
import net.minecraft.nbt.CompoundNBT; import net.minecraft.nbt.CompoundTag;
import net.minecraft.util.NonNullList; import net.minecraft.core.NonNullList;
public class PolishingCategory extends CreateRecipeCategory<SandPaperPolishingRecipe> { public class PolishingCategory extends CreateRecipeCategory<SandPaperPolishingRecipe> {
@ -56,7 +56,7 @@ public class PolishingCategory extends CreateRecipeCategory<SandPaperPolishingRe
} }
@Override @Override
public void draw(SandPaperPolishingRecipe recipe, MatrixStack matrixStack, double mouseX, double mouseY) { public void draw(SandPaperPolishingRecipe recipe, PoseStack matrixStack, double mouseX, double mouseY) {
AllGuiTextures.JEI_SLOT.draw(matrixStack, 26, 28); AllGuiTextures.JEI_SLOT.draw(matrixStack, 26, 28);
getRenderedSlot(recipe, 0).draw(matrixStack, 131, 28); getRenderedSlot(recipe, 0).draw(matrixStack, 131, 28);
AllGuiTextures.JEI_SHADOW.draw(matrixStack, 61, 21); AllGuiTextures.JEI_SHADOW.draw(matrixStack, 61, 21);
@ -69,7 +69,7 @@ public class PolishingCategory extends CreateRecipeCategory<SandPaperPolishingRe
return; return;
CompoundNBT tag = renderedSandpaper.getOrCreateTag(); CompoundTag tag = renderedSandpaper.getOrCreateTag();
tag.put("Polishing", matchingStacks[0].serializeNBT()); tag.put("Polishing", matchingStacks[0].serializeNBT());
tag.putBoolean("JEI", true); tag.putBoolean("JEI", true);
GuiGameElement.of(renderedSandpaper) GuiGameElement.of(renderedSandpaper)

View file

@ -3,7 +3,7 @@ package com.simibubi.create.compat.jei.category;
import java.util.Arrays; import java.util.Arrays;
import java.util.List; import java.util.List;
import com.mojang.blaze3d.matrix.MatrixStack; import com.mojang.blaze3d.vertex.PoseStack;
import com.simibubi.create.AllBlocks; import com.simibubi.create.AllBlocks;
import com.simibubi.create.AllItems; import com.simibubi.create.AllItems;
import com.simibubi.create.compat.jei.category.animations.AnimatedPress; import com.simibubi.create.compat.jei.category.animations.AnimatedPress;
@ -54,7 +54,7 @@ public class PressingCategory extends CreateRecipeCategory<PressingRecipe> {
} }
@Override @Override
public void draw(PressingRecipe recipe, MatrixStack matrixStack, double mouseX, double mouseY) { public void draw(PressingRecipe recipe, PoseStack matrixStack, double mouseX, double mouseY) {
AllGuiTextures.JEI_SLOT.draw(matrixStack, 26, 50); AllGuiTextures.JEI_SLOT.draw(matrixStack, 26, 50);
getRenderedSlot(recipe, 0).draw(matrixStack, 131, 50); getRenderedSlot(recipe, 0).draw(matrixStack, 131, 50);
if (recipe.getRollableResults() if (recipe.getRollableResults()

View file

@ -5,7 +5,7 @@ import java.util.function.Supplier;
import javax.annotation.Nullable; import javax.annotation.Nullable;
import com.mojang.blaze3d.matrix.MatrixStack; import com.mojang.blaze3d.vertex.PoseStack;
import com.simibubi.create.AllBlockPartials; import com.simibubi.create.AllBlockPartials;
import com.simibubi.create.AllBlocks; import com.simibubi.create.AllBlocks;
import com.simibubi.create.compat.jei.category.animations.AnimatedKinetics; import com.simibubi.create.compat.jei.category.animations.AnimatedKinetics;
@ -17,11 +17,11 @@ import mezz.jei.api.gui.IRecipeLayout;
import mezz.jei.api.gui.drawable.IDrawable; import mezz.jei.api.gui.drawable.IDrawable;
import mezz.jei.api.gui.ingredient.IGuiItemStackGroup; import mezz.jei.api.gui.ingredient.IGuiItemStackGroup;
import mezz.jei.api.ingredients.IIngredients; import mezz.jei.api.ingredients.IIngredients;
import net.minecraft.item.ItemStack; import net.minecraft.world.item.ItemStack;
import net.minecraft.item.crafting.IRecipe; import net.minecraft.world.item.crafting.Recipe;
import net.minecraft.util.math.vector.Vector3f; import com.mojang.math.Vector3f;
public abstract class ProcessingViaFanCategory<T extends IRecipe<?>> extends CreateRecipeCategory<T> { public abstract class ProcessingViaFanCategory<T extends Recipe<?>> extends CreateRecipeCategory<T> {
public ProcessingViaFanCategory(IDrawable icon) { public ProcessingViaFanCategory(IDrawable icon) {
this(177, icon); this(177, icon);
@ -54,7 +54,7 @@ public abstract class ProcessingViaFanCategory<T extends IRecipe<?>> extends Cre
itemStacks.set(1, recipe.getResultItem()); itemStacks.set(1, recipe.getResultItem());
} }
protected void renderWidgets(MatrixStack matrixStack, T recipe, double mouseX, double mouseY) { protected void renderWidgets(PoseStack matrixStack, T recipe, double mouseX, double mouseY) {
AllGuiTextures.JEI_SLOT.draw(matrixStack, 20, 47); AllGuiTextures.JEI_SLOT.draw(matrixStack, 20, 47);
AllGuiTextures.JEI_SLOT.draw(matrixStack, 139, 47); AllGuiTextures.JEI_SLOT.draw(matrixStack, 139, 47);
AllGuiTextures.JEI_SHADOW.draw(matrixStack, 47, 29); AllGuiTextures.JEI_SHADOW.draw(matrixStack, 47, 29);
@ -63,7 +63,7 @@ public abstract class ProcessingViaFanCategory<T extends IRecipe<?>> extends Cre
} }
@Override @Override
public void draw(@Nullable T recipe, @Nullable MatrixStack matrixStack, double mouseX, double mouseY) { public void draw(@Nullable T recipe, @Nullable PoseStack matrixStack, double mouseX, double mouseY) {
if (matrixStack == null) if (matrixStack == null)
return; return;
renderWidgets(matrixStack, recipe, mouseX, mouseY); renderWidgets(matrixStack, recipe, mouseX, mouseY);
@ -89,10 +89,10 @@ public abstract class ProcessingViaFanCategory<T extends IRecipe<?>> extends Cre
matrixStack.popPose(); matrixStack.popPose();
} }
protected void translateFan(MatrixStack matrixStack) { protected void translateFan(PoseStack matrixStack) {
matrixStack.translate(56, 33, 0); matrixStack.translate(56, 33, 0);
} }
public abstract void renderAttachedBlock(MatrixStack matrixStack); public abstract void renderAttachedBlock(PoseStack matrixStack);
} }

View file

@ -3,7 +3,7 @@ package com.simibubi.create.compat.jei.category;
import java.util.Arrays; import java.util.Arrays;
import java.util.List; import java.util.List;
import com.mojang.blaze3d.matrix.MatrixStack; import com.mojang.blaze3d.vertex.PoseStack;
import com.simibubi.create.AllBlocks; import com.simibubi.create.AllBlocks;
import com.simibubi.create.compat.jei.category.animations.AnimatedSaw; import com.simibubi.create.compat.jei.category.animations.AnimatedSaw;
import com.simibubi.create.content.contraptions.components.saw.CuttingRecipe; import com.simibubi.create.content.contraptions.components.saw.CuttingRecipe;
@ -14,7 +14,7 @@ import mezz.jei.api.constants.VanillaTypes;
import mezz.jei.api.gui.IRecipeLayout; import mezz.jei.api.gui.IRecipeLayout;
import mezz.jei.api.gui.ingredient.IGuiItemStackGroup; import mezz.jei.api.gui.ingredient.IGuiItemStackGroup;
import mezz.jei.api.ingredients.IIngredients; import mezz.jei.api.ingredients.IIngredients;
import net.minecraft.item.Items; import net.minecraft.world.item.Items;
public class SawingCategory extends CreateRecipeCategory<CuttingRecipe> { public class SawingCategory extends CreateRecipeCategory<CuttingRecipe> {
@ -57,7 +57,7 @@ public class SawingCategory extends CreateRecipeCategory<CuttingRecipe> {
} }
@Override @Override
public void draw(CuttingRecipe recipe, MatrixStack matrixStack, double mouseX, double mouseY) { public void draw(CuttingRecipe recipe, PoseStack matrixStack, double mouseX, double mouseY) {
AllGuiTextures.JEI_SLOT.draw(matrixStack, 43, 4); AllGuiTextures.JEI_SLOT.draw(matrixStack, 43, 4);
int size = recipe.getRollableResults() int size = recipe.getRollableResults()
.size(); .size();

View file

@ -8,7 +8,7 @@ import java.util.Map;
import java.util.stream.Collectors; import java.util.stream.Collectors;
import com.google.common.collect.ImmutableList; import com.google.common.collect.ImmutableList;
import com.mojang.blaze3d.matrix.MatrixStack; import com.mojang.blaze3d.vertex.PoseStack;
import com.mojang.blaze3d.systems.RenderSystem; import com.mojang.blaze3d.systems.RenderSystem;
import com.simibubi.create.AllItems; import com.simibubi.create.AllItems;
import com.simibubi.create.compat.jei.EmptyBackground; import com.simibubi.create.compat.jei.EmptyBackground;
@ -26,14 +26,14 @@ import mezz.jei.api.gui.ingredient.IGuiFluidStackGroup;
import mezz.jei.api.gui.ingredient.IGuiItemStackGroup; import mezz.jei.api.gui.ingredient.IGuiItemStackGroup;
import mezz.jei.api.ingredients.IIngredients; import mezz.jei.api.ingredients.IIngredients;
import net.minecraft.client.Minecraft; import net.minecraft.client.Minecraft;
import net.minecraft.client.gui.FontRenderer; import net.minecraft.client.gui.Font;
import net.minecraft.item.ItemStack; import net.minecraft.world.item.ItemStack;
import net.minecraft.item.crafting.Ingredient; import net.minecraft.world.item.crafting.Ingredient;
import net.minecraft.util.ResourceLocation; import net.minecraft.resources.ResourceLocation;
import net.minecraft.util.text.ITextComponent; import net.minecraft.network.chat.Component;
import net.minecraft.util.text.StringTextComponent; import net.minecraft.network.chat.TextComponent;
import net.minecraft.util.text.TextFormatting; import net.minecraft.ChatFormatting;
import net.minecraft.util.text.TranslationTextComponent; import net.minecraft.network.chat.TranslatableComponent;
public class SequencedAssemblyCategory extends CreateRecipeCategory<SequencedAssemblyRecipe> { public class SequencedAssemblyCategory extends CreateRecipeCategory<SequencedAssemblyRecipe> {
@ -107,7 +107,7 @@ public class SequencedAssemblyCategory extends CreateRecipeCategory<SequencedAss
float chance = recipe.getOutputChance(); float chance = recipe.getOutputChance();
if (chance != 1) if (chance != 1)
tooltip.add(1, Lang.translate("recipe.processing.chance", chance < 0.01 ? "<1" : (int) (chance * 100)) tooltip.add(1, Lang.translate("recipe.processing.chance", chance < 0.01 ? "<1" : (int) (chance * 100))
.withStyle(TextFormatting.GOLD)); .withStyle(ChatFormatting.GOLD));
}); });
} }
@ -125,8 +125,8 @@ public class SequencedAssemblyCategory extends CreateRecipeCategory<SequencedAss
final String[] romans = { "I", "II", "III", "IV", "V", "VI", "-" }; final String[] romans = { "I", "II", "III", "IV", "V", "VI", "-" };
@Override @Override
public void draw(SequencedAssemblyRecipe recipe, MatrixStack matrixStack, double mouseX, double mouseY) { public void draw(SequencedAssemblyRecipe recipe, PoseStack matrixStack, double mouseX, double mouseY) {
FontRenderer font = Minecraft.getInstance().font; Font font = Minecraft.getInstance().font;
matrixStack.pushPose(); matrixStack.pushPose();
matrixStack.translate(0, 15, 0); matrixStack.translate(0, 15, 0);
@ -137,7 +137,7 @@ public class SequencedAssemblyCategory extends CreateRecipeCategory<SequencedAss
AllGuiTextures.JEI_LONG_ARROW.draw(matrixStack, 52 + xOffset, 79); AllGuiTextures.JEI_LONG_ARROW.draw(matrixStack, 52 + xOffset, 79);
if (!singleOutput) { if (!singleOutput) {
AllGuiTextures.JEI_CHANCE_SLOT.draw(matrixStack, 150 + xOffset, 75); AllGuiTextures.JEI_CHANCE_SLOT.draw(matrixStack, 150 + xOffset, 75);
ITextComponent component = new StringTextComponent("?").withStyle(TextFormatting.BOLD); Component component = new TextComponent("?").withStyle(ChatFormatting.BOLD);
font.drawShadow(matrixStack, component, font.width(component) / -2 + 8 + 150 + xOffset, 2 + 78, font.drawShadow(matrixStack, component, font.width(component) / -2 + 8 + 150 + xOffset, 2 + 78,
0xefefef); 0xefefef);
} }
@ -148,7 +148,7 @@ public class SequencedAssemblyCategory extends CreateRecipeCategory<SequencedAss
RenderSystem.color4f(.65f, .65f, .65f, 1); RenderSystem.color4f(.65f, .65f, .65f, 1);
AllIcons.I_REFRESH.draw(matrixStack, 50 + xOffset, 75); AllIcons.I_REFRESH.draw(matrixStack, 50 + xOffset, 75);
RenderSystem.color4f(1, 1, 1, 1); RenderSystem.color4f(1, 1, 1, 1);
ITextComponent repeat = new StringTextComponent("x" + recipe.getLoops()); Component repeat = new TextComponent("x" + recipe.getLoops());
font.draw(matrixStack, repeat, 66 + xOffset, 80, 0x888888); font.draw(matrixStack, repeat, 66 + xOffset, 80, 0x888888);
matrixStack.popPose(); matrixStack.popPose();
} }
@ -168,7 +168,7 @@ public class SequencedAssemblyCategory extends CreateRecipeCategory<SequencedAss
SequencedRecipe<?> sequencedRecipe = sequence.get(i); SequencedRecipe<?> sequencedRecipe = sequence.get(i);
SequencedAssemblySubCategory subCategory = getSubCategory(sequencedRecipe); SequencedAssemblySubCategory subCategory = getSubCategory(sequencedRecipe);
int subWidth = subCategory.getWidth(); int subWidth = subCategory.getWidth();
StringTextComponent component = new StringTextComponent("" + romans[Math.min(i, 6)]); TextComponent component = new TextComponent("" + romans[Math.min(i, 6)]);
font.draw(matrixStack, component, font.width(component) / -2 + subWidth / 2, 2, 0x888888); font.draw(matrixStack, component, font.width(component) / -2 + subWidth / 2, 2, 0x888888);
subCategory.draw(sequencedRecipe, matrixStack, mouseX, mouseY, i); subCategory.draw(sequencedRecipe, matrixStack, mouseX, mouseY, i);
matrixStack.translate(subWidth + margin, 0, 0); matrixStack.translate(subWidth + margin, 0, 0);
@ -177,10 +177,10 @@ public class SequencedAssemblyCategory extends CreateRecipeCategory<SequencedAss
} }
@Override @Override
public List<ITextComponent> getTooltipStrings(SequencedAssemblyRecipe recipe, double mouseX, double mouseY) { public List<Component> getTooltipStrings(SequencedAssemblyRecipe recipe, double mouseX, double mouseY) {
List<ITextComponent> tooltip = new ArrayList<ITextComponent>(); List<Component> tooltip = new ArrayList<Component>();
TranslationTextComponent junk = Lang.translate("recipe.assembly.junk"); TranslatableComponent junk = Lang.translate("recipe.assembly.junk");
boolean singleOutput = recipe.getOutputChance() == 1; boolean singleOutput = recipe.getOutputChance() == 1;
boolean willRepeat = recipe.getLoops() > 1; boolean willRepeat = recipe.getLoops() > 1;
@ -194,7 +194,7 @@ public class SequencedAssemblyCategory extends CreateRecipeCategory<SequencedAss
float chance = recipe.getOutputChance(); float chance = recipe.getOutputChance();
tooltip.add(junk); tooltip.add(junk);
tooltip.add(Lang.translate("recipe.processing.chance", chance < 0.01 ? "<1" : 100 - (int) (chance * 100)) tooltip.add(Lang.translate("recipe.processing.chance", chance < 0.01 ? "<1" : 100 - (int) (chance * 100))
.withStyle(TextFormatting.GOLD)); .withStyle(ChatFormatting.GOLD));
return tooltip; return tooltip;
} }
@ -225,7 +225,7 @@ public class SequencedAssemblyCategory extends CreateRecipeCategory<SequencedAss
tooltip.add(sequencedRecipe.getAsAssemblyRecipe() tooltip.add(sequencedRecipe.getAsAssemblyRecipe()
.getDescriptionForAssembly() .getDescriptionForAssembly()
.plainCopy() .plainCopy()
.withStyle(TextFormatting.DARK_GREEN)); .withStyle(ChatFormatting.DARK_GREEN));
return tooltip; return tooltip;
} }
relativeX -= subCategory.getWidth() + margin; relativeX -= subCategory.getWidth() + margin;

View file

@ -7,7 +7,7 @@ import java.util.List;
import java.util.stream.Collectors; import java.util.stream.Collectors;
import com.google.common.collect.ImmutableList; import com.google.common.collect.ImmutableList;
import com.mojang.blaze3d.matrix.MatrixStack; import com.mojang.blaze3d.vertex.PoseStack;
import com.simibubi.create.AllBlocks; import com.simibubi.create.AllBlocks;
import com.simibubi.create.Create; import com.simibubi.create.Create;
import com.simibubi.create.compat.jei.category.animations.AnimatedSpout; import com.simibubi.create.compat.jei.category.animations.AnimatedSpout;
@ -24,11 +24,11 @@ import mezz.jei.api.gui.ingredient.IGuiFluidStackGroup;
import mezz.jei.api.gui.ingredient.IGuiItemStackGroup; import mezz.jei.api.gui.ingredient.IGuiItemStackGroup;
import mezz.jei.api.ingredients.IIngredients; import mezz.jei.api.ingredients.IIngredients;
import mezz.jei.api.runtime.IIngredientManager; import mezz.jei.api.runtime.IIngredientManager;
import net.minecraft.item.ItemStack; import net.minecraft.world.item.ItemStack;
import net.minecraft.item.Items; import net.minecraft.world.item.Items;
import net.minecraft.item.PotionItem; import net.minecraft.world.item.PotionItem;
import net.minecraft.item.crafting.Ingredient; import net.minecraft.world.item.crafting.Ingredient;
import net.minecraft.util.ResourceLocation; import net.minecraft.resources.ResourceLocation;
import net.minecraftforge.common.util.LazyOptional; import net.minecraftforge.common.util.LazyOptional;
import net.minecraftforge.fluids.FluidStack; import net.minecraftforge.fluids.FluidStack;
import net.minecraftforge.fluids.capability.CapabilityFluidHandler; import net.minecraftforge.fluids.capability.CapabilityFluidHandler;
@ -143,7 +143,7 @@ public class SpoutCategory extends CreateRecipeCategory<FillingRecipe> {
} }
@Override @Override
public void draw(FillingRecipe recipe, MatrixStack matrixStack, double mouseX, double mouseY) { public void draw(FillingRecipe recipe, PoseStack matrixStack, double mouseX, double mouseY) {
AllGuiTextures.JEI_SLOT.draw(matrixStack, 26, 31); AllGuiTextures.JEI_SLOT.draw(matrixStack, 26, 31);
AllGuiTextures.JEI_SLOT.draw(matrixStack, 26, 50); AllGuiTextures.JEI_SLOT.draw(matrixStack, 26, 50);
getRenderedSlot(recipe, 0).draw(matrixStack, 131, 50); getRenderedSlot(recipe, 0).draw(matrixStack, 131, 50);

View file

@ -1,14 +1,14 @@
package com.simibubi.create.compat.jei.category.animations; package com.simibubi.create.compat.jei.category.animations;
import com.jozufozu.flywheel.core.PartialModel; import com.jozufozu.flywheel.core.PartialModel;
import com.mojang.blaze3d.matrix.MatrixStack; import com.mojang.blaze3d.vertex.PoseStack;
import com.simibubi.create.AllBlockPartials; import com.simibubi.create.AllBlockPartials;
import com.simibubi.create.AllBlocks; import com.simibubi.create.AllBlocks;
import com.simibubi.create.content.contraptions.processing.burner.BlazeBurnerBlock.HeatLevel; import com.simibubi.create.content.contraptions.processing.burner.BlazeBurnerBlock.HeatLevel;
import com.simibubi.create.foundation.utility.AnimationTickHolder; import com.simibubi.create.foundation.utility.AnimationTickHolder;
import net.minecraft.util.math.MathHelper; import net.minecraft.util.Mth;
import net.minecraft.util.math.vector.Vector3f; import com.mojang.math.Vector3f;
public class AnimatedBlazeBurner extends AnimatedKinetics { public class AnimatedBlazeBurner extends AnimatedKinetics {
@ -19,7 +19,7 @@ public class AnimatedBlazeBurner extends AnimatedKinetics {
return this; return this;
} }
public void draw(MatrixStack matrixStack, int xOffset, int yOffset) { public void draw(PoseStack matrixStack, int xOffset, int yOffset) {
matrixStack.pushPose(); matrixStack.pushPose();
matrixStack.translate(xOffset, yOffset, 200); matrixStack.translate(xOffset, yOffset, 200);
matrixStack.mulPose(Vector3f.XP.rotationDegrees(-15.5f)); matrixStack.mulPose(Vector3f.XP.rotationDegrees(-15.5f));
@ -31,7 +31,7 @@ public class AnimatedBlazeBurner extends AnimatedKinetics {
.scale(scale) .scale(scale)
.render(matrixStack); .render(matrixStack);
float offset = (MathHelper.sin(AnimationTickHolder.getRenderTime() / 16f) + 0.5f) / 16f; float offset = (Mth.sin(AnimationTickHolder.getRenderTime() / 16f) + 0.5f) / 16f;
PartialModel blaze = AllBlockPartials.BLAZES.get(heatLevel); PartialModel blaze = AllBlockPartials.BLAZES.get(heatLevel);
blockElement(blaze) blockElement(blaze)
.atLocal(1, 1.65 + offset, 1) .atLocal(1, 1.65 + offset, 1)

View file

@ -1,14 +1,14 @@
package com.simibubi.create.compat.jei.category.animations; package com.simibubi.create.compat.jei.category.animations;
import com.jozufozu.flywheel.util.transform.MatrixTransformStack; import com.jozufozu.flywheel.util.transform.MatrixTransformStack;
import com.mojang.blaze3d.matrix.MatrixStack; import com.mojang.blaze3d.vertex.PoseStack;
import com.simibubi.create.AllBlocks; import com.simibubi.create.AllBlocks;
import com.simibubi.create.foundation.gui.AllGuiTextures; import com.simibubi.create.foundation.gui.AllGuiTextures;
public class AnimatedCrafter extends AnimatedKinetics { public class AnimatedCrafter extends AnimatedKinetics {
@Override @Override
public void draw(MatrixStack matrixStack, int xOffset, int yOffset) { public void draw(PoseStack matrixStack, int xOffset, int yOffset) {
matrixStack.pushPose(); matrixStack.pushPose();
matrixStack.translate(xOffset, yOffset, 0); matrixStack.translate(xOffset, yOffset, 0);
AllGuiTextures.JEI_SHADOW.draw(matrixStack, -16, 13); AllGuiTextures.JEI_SHADOW.draw(matrixStack, -16, 13);

View file

@ -1,12 +1,12 @@
package com.simibubi.create.compat.jei.category.animations; package com.simibubi.create.compat.jei.category.animations;
import com.mojang.blaze3d.matrix.MatrixStack; import com.mojang.blaze3d.vertex.PoseStack;
import com.simibubi.create.AllBlocks; import com.simibubi.create.AllBlocks;
import net.minecraft.block.BlockState; import net.minecraft.world.level.block.state.BlockState;
import net.minecraft.state.properties.BlockStateProperties; import net.minecraft.world.level.block.state.properties.BlockStateProperties;
import net.minecraft.util.Direction.Axis; import net.minecraft.core.Direction.Axis;
import net.minecraft.util.math.vector.Vector3f; import com.mojang.math.Vector3f;
public class AnimatedCrushingWheels extends AnimatedKinetics { public class AnimatedCrushingWheels extends AnimatedKinetics {
@ -14,7 +14,7 @@ public class AnimatedCrushingWheels extends AnimatedKinetics {
.setValue(BlockStateProperties.AXIS, Axis.X); .setValue(BlockStateProperties.AXIS, Axis.X);
@Override @Override
public void draw(MatrixStack matrixStack, int xOffset, int yOffset) { public void draw(PoseStack matrixStack, int xOffset, int yOffset) {
matrixStack.pushPose(); matrixStack.pushPose();
matrixStack.translate(xOffset, yOffset, 100); matrixStack.translate(xOffset, yOffset, 100);
matrixStack.mulPose(Vector3f.YP.rotationDegrees(-22.5f)); matrixStack.mulPose(Vector3f.YP.rotationDegrees(-22.5f));

View file

@ -1,19 +1,19 @@
package com.simibubi.create.compat.jei.category.animations; package com.simibubi.create.compat.jei.category.animations;
import com.mojang.blaze3d.matrix.MatrixStack; import com.mojang.blaze3d.vertex.PoseStack;
import com.simibubi.create.AllBlockPartials; import com.simibubi.create.AllBlockPartials;
import com.simibubi.create.AllBlocks; import com.simibubi.create.AllBlocks;
import com.simibubi.create.content.contraptions.components.deployer.DeployerBlock; import com.simibubi.create.content.contraptions.components.deployer.DeployerBlock;
import com.simibubi.create.foundation.utility.AnimationTickHolder; import com.simibubi.create.foundation.utility.AnimationTickHolder;
import net.minecraft.util.Direction; import net.minecraft.core.Direction;
import net.minecraft.util.Direction.Axis; import net.minecraft.core.Direction.Axis;
import net.minecraft.util.math.vector.Vector3f; import com.mojang.math.Vector3f;
public class AnimatedDeployer extends AnimatedKinetics { public class AnimatedDeployer extends AnimatedKinetics {
@Override @Override
public void draw(MatrixStack matrixStack, int xOffset, int yOffset) { public void draw(PoseStack matrixStack, int xOffset, int yOffset) {
matrixStack.pushPose(); matrixStack.pushPose();
matrixStack.translate(xOffset, yOffset, 100); matrixStack.translate(xOffset, yOffset, 100);
matrixStack.mulPose(Vector3f.XP.rotationDegrees(-15.5f)); matrixStack.mulPose(Vector3f.XP.rotationDegrees(-15.5f));

View file

@ -1,13 +1,13 @@
package com.simibubi.create.compat.jei.category.animations; package com.simibubi.create.compat.jei.category.animations;
import com.mojang.blaze3d.matrix.MatrixStack; import com.mojang.blaze3d.vertex.PoseStack;
import com.simibubi.create.AllBlocks; import com.simibubi.create.AllBlocks;
import com.simibubi.create.foundation.fluid.FluidRenderer; import com.simibubi.create.foundation.fluid.FluidRenderer;
import net.minecraft.client.renderer.IRenderTypeBuffer; import net.minecraft.client.renderer.MultiBufferSource;
import net.minecraft.client.renderer.IRenderTypeBuffer.Impl; import net.minecraft.client.renderer.MultiBufferSource.BufferSource;
import net.minecraft.client.renderer.Tessellator; import com.mojang.blaze3d.vertex.Tesselator;
import net.minecraft.util.math.vector.Vector3f; import com.mojang.math.Vector3f;
import net.minecraftforge.fluids.FluidStack; import net.minecraftforge.fluids.FluidStack;
public class AnimatedItemDrain extends AnimatedKinetics { public class AnimatedItemDrain extends AnimatedKinetics {
@ -20,7 +20,7 @@ public class AnimatedItemDrain extends AnimatedKinetics {
} }
@Override @Override
public void draw(MatrixStack matrixStack, int xOffset, int yOffset) { public void draw(PoseStack matrixStack, int xOffset, int yOffset) {
matrixStack.pushPose(); matrixStack.pushPose();
matrixStack.translate(xOffset, yOffset, 100); matrixStack.translate(xOffset, yOffset, 100);
matrixStack.mulPose(Vector3f.XP.rotationDegrees(-15.5f)); matrixStack.mulPose(Vector3f.XP.rotationDegrees(-15.5f));
@ -31,9 +31,9 @@ public class AnimatedItemDrain extends AnimatedKinetics {
.scale(scale) .scale(scale)
.render(matrixStack); .render(matrixStack);
Impl buffer = IRenderTypeBuffer.immediate(Tessellator.getInstance() BufferSource buffer = MultiBufferSource.immediate(Tesselator.getInstance()
.getBuilder()); .getBuilder());
MatrixStack ms = new MatrixStack(); PoseStack ms = new PoseStack();
ms.scale(scale, -scale, scale); ms.scale(scale, -scale, scale);
float from = 2/16f; float from = 2/16f;
float to = 1f - from; float to = 1f - from;

View file

@ -9,9 +9,9 @@ import com.simibubi.create.foundation.gui.ILightingSettings;
import com.simibubi.create.foundation.utility.AnimationTickHolder; import com.simibubi.create.foundation.utility.AnimationTickHolder;
import mezz.jei.api.gui.drawable.IDrawable; import mezz.jei.api.gui.drawable.IDrawable;
import net.minecraft.block.BlockState; import net.minecraft.world.level.block.state.BlockState;
import net.minecraft.state.properties.BlockStateProperties; import net.minecraft.world.level.block.state.properties.BlockStateProperties;
import net.minecraft.util.Direction.Axis; import net.minecraft.core.Direction.Axis;
public abstract class AnimatedKinetics implements IDrawable { public abstract class AnimatedKinetics implements IDrawable {

View file

@ -1,6 +1,6 @@
package com.simibubi.create.compat.jei.category.animations; package com.simibubi.create.compat.jei.category.animations;
import com.mojang.blaze3d.matrix.MatrixStack; import com.mojang.blaze3d.vertex.PoseStack;
import com.simibubi.create.AllBlockPartials; import com.simibubi.create.AllBlockPartials;
import com.simibubi.create.AllBlocks; import com.simibubi.create.AllBlocks;
import com.simibubi.create.foundation.gui.AllGuiTextures; import com.simibubi.create.foundation.gui.AllGuiTextures;
@ -8,7 +8,7 @@ import com.simibubi.create.foundation.gui.AllGuiTextures;
public class AnimatedMillstone extends AnimatedKinetics { public class AnimatedMillstone extends AnimatedKinetics {
@Override @Override
public void draw(MatrixStack matrixStack, int xOffset, int yOffset) { public void draw(PoseStack matrixStack, int xOffset, int yOffset) {
matrixStack.pushPose(); matrixStack.pushPose();
matrixStack.translate(xOffset, yOffset, 0); matrixStack.translate(xOffset, yOffset, 0);
AllGuiTextures.JEI_SHADOW.draw(matrixStack, -16, 13); AllGuiTextures.JEI_SHADOW.draw(matrixStack, -16, 13);

View file

@ -1,17 +1,17 @@
package com.simibubi.create.compat.jei.category.animations; package com.simibubi.create.compat.jei.category.animations;
import com.mojang.blaze3d.matrix.MatrixStack; import com.mojang.blaze3d.vertex.PoseStack;
import com.simibubi.create.AllBlockPartials; import com.simibubi.create.AllBlockPartials;
import com.simibubi.create.AllBlocks; import com.simibubi.create.AllBlocks;
import com.simibubi.create.foundation.utility.AnimationTickHolder; import com.simibubi.create.foundation.utility.AnimationTickHolder;
import net.minecraft.util.math.MathHelper; import net.minecraft.util.Mth;
import net.minecraft.util.math.vector.Vector3f; import com.mojang.math.Vector3f;
public class AnimatedMixer extends AnimatedKinetics { public class AnimatedMixer extends AnimatedKinetics {
@Override @Override
public void draw(MatrixStack matrixStack, int xOffset, int yOffset) { public void draw(PoseStack matrixStack, int xOffset, int yOffset) {
matrixStack.pushPose(); matrixStack.pushPose();
matrixStack.translate(xOffset, yOffset, 200); matrixStack.translate(xOffset, yOffset, 200);
matrixStack.mulPose(Vector3f.XP.rotationDegrees(-15.5f)); matrixStack.mulPose(Vector3f.XP.rotationDegrees(-15.5f));
@ -29,7 +29,7 @@ public class AnimatedMixer extends AnimatedKinetics {
.scale(scale) .scale(scale)
.render(matrixStack); .render(matrixStack);
float animation = ((MathHelper.sin(AnimationTickHolder.getRenderTime() / 32f) + 1) / 5) + .5f; float animation = ((Mth.sin(AnimationTickHolder.getRenderTime() / 32f) + 1) / 5) + .5f;
blockElement(AllBlockPartials.MECHANICAL_MIXER_POLE) blockElement(AllBlockPartials.MECHANICAL_MIXER_POLE)
.atLocal(0, animation, 0) .atLocal(0, animation, 0)

View file

@ -1,12 +1,12 @@
package com.simibubi.create.compat.jei.category.animations; package com.simibubi.create.compat.jei.category.animations;
import com.mojang.blaze3d.matrix.MatrixStack; import com.mojang.blaze3d.vertex.PoseStack;
import com.simibubi.create.AllBlockPartials; import com.simibubi.create.AllBlockPartials;
import com.simibubi.create.AllBlocks; import com.simibubi.create.AllBlocks;
import com.simibubi.create.foundation.utility.AnimationTickHolder; import com.simibubi.create.foundation.utility.AnimationTickHolder;
import net.minecraft.util.Direction.Axis; import net.minecraft.core.Direction.Axis;
import net.minecraft.util.math.vector.Vector3f; import com.mojang.math.Vector3f;
public class AnimatedPress extends AnimatedKinetics { public class AnimatedPress extends AnimatedKinetics {
@ -17,7 +17,7 @@ public class AnimatedPress extends AnimatedKinetics {
} }
@Override @Override
public void draw(MatrixStack matrixStack, int xOffset, int yOffset) { public void draw(PoseStack matrixStack, int xOffset, int yOffset) {
matrixStack.pushPose(); matrixStack.pushPose();
matrixStack.translate(xOffset, yOffset, 200); matrixStack.translate(xOffset, yOffset, 200);
matrixStack.mulPose(Vector3f.XP.rotationDegrees(-15.5f)); matrixStack.mulPose(Vector3f.XP.rotationDegrees(-15.5f));

View file

@ -1,18 +1,18 @@
package com.simibubi.create.compat.jei.category.animations; package com.simibubi.create.compat.jei.category.animations;
import com.mojang.blaze3d.matrix.MatrixStack; import com.mojang.blaze3d.vertex.PoseStack;
import com.simibubi.create.AllBlockPartials; import com.simibubi.create.AllBlockPartials;
import com.simibubi.create.AllBlocks; import com.simibubi.create.AllBlocks;
import com.simibubi.create.content.contraptions.components.saw.SawBlock; import com.simibubi.create.content.contraptions.components.saw.SawBlock;
import net.minecraft.util.Direction; import net.minecraft.core.Direction;
import net.minecraft.util.Direction.Axis; import net.minecraft.core.Direction.Axis;
import net.minecraft.util.math.vector.Vector3f; import com.mojang.math.Vector3f;
public class AnimatedSaw extends AnimatedKinetics { public class AnimatedSaw extends AnimatedKinetics {
@Override @Override
public void draw(MatrixStack matrixStack, int xOffset, int yOffset) { public void draw(PoseStack matrixStack, int xOffset, int yOffset) {
matrixStack.pushPose(); matrixStack.pushPose();
matrixStack.translate(xOffset, yOffset, 0); matrixStack.translate(xOffset, yOffset, 0);
matrixStack.translate(0, 0, 200); matrixStack.translate(0, 0, 200);

View file

@ -2,17 +2,17 @@ package com.simibubi.create.compat.jei.category.animations;
import java.util.List; import java.util.List;
import com.mojang.blaze3d.matrix.MatrixStack; import com.mojang.blaze3d.vertex.PoseStack;
import com.simibubi.create.AllBlockPartials; import com.simibubi.create.AllBlockPartials;
import com.simibubi.create.AllBlocks; import com.simibubi.create.AllBlocks;
import com.simibubi.create.foundation.fluid.FluidRenderer; import com.simibubi.create.foundation.fluid.FluidRenderer;
import com.simibubi.create.foundation.utility.AnimationTickHolder; import com.simibubi.create.foundation.utility.AnimationTickHolder;
import net.minecraft.client.renderer.IRenderTypeBuffer; import net.minecraft.client.renderer.MultiBufferSource;
import net.minecraft.client.renderer.IRenderTypeBuffer.Impl; import net.minecraft.client.renderer.MultiBufferSource.BufferSource;
import net.minecraft.client.renderer.Tessellator; import com.mojang.blaze3d.vertex.Tesselator;
import net.minecraft.util.math.MathHelper; import net.minecraft.util.Mth;
import net.minecraft.util.math.vector.Vector3f; import com.mojang.math.Vector3f;
import net.minecraftforge.fluids.FluidStack; import net.minecraftforge.fluids.FluidStack;
public class AnimatedSpout extends AnimatedKinetics { public class AnimatedSpout extends AnimatedKinetics {
@ -25,7 +25,7 @@ public class AnimatedSpout extends AnimatedKinetics {
} }
@Override @Override
public void draw(MatrixStack matrixStack, int xOffset, int yOffset) { public void draw(PoseStack matrixStack, int xOffset, int yOffset) {
matrixStack.pushPose(); matrixStack.pushPose();
matrixStack.translate(xOffset, yOffset, 100); matrixStack.translate(xOffset, yOffset, 100);
matrixStack.mulPose(Vector3f.XP.rotationDegrees(-15.5f)); matrixStack.mulPose(Vector3f.XP.rotationDegrees(-15.5f));
@ -37,7 +37,7 @@ public class AnimatedSpout extends AnimatedKinetics {
.render(matrixStack); .render(matrixStack);
float cycle = (AnimationTickHolder.getRenderTime() - offset * 8) % 30; float cycle = (AnimationTickHolder.getRenderTime() - offset * 8) % 30;
float squeeze = cycle < 20 ? MathHelper.sin((float) (cycle / 20f * Math.PI)) : 0; float squeeze = cycle < 20 ? Mth.sin((float) (cycle / 20f * Math.PI)) : 0;
squeeze *= 20; squeeze *= 20;
matrixStack.pushPose(); matrixStack.pushPose();
@ -62,7 +62,7 @@ public class AnimatedSpout extends AnimatedKinetics {
.scale(scale) .scale(scale)
.render(matrixStack); .render(matrixStack);
Impl buffer = IRenderTypeBuffer.immediate(Tessellator.getInstance() BufferSource buffer = MultiBufferSource.immediate(Tesselator.getInstance()
.getBuilder()); .getBuilder());
matrixStack.pushPose(); matrixStack.pushPose();
matrixStack.scale(16, -16, 16); matrixStack.scale(16, -16, 16);

View file

@ -4,7 +4,7 @@ import java.util.Arrays;
import java.util.Collections; import java.util.Collections;
import com.google.common.collect.ImmutableList; import com.google.common.collect.ImmutableList;
import com.mojang.blaze3d.matrix.MatrixStack; import com.mojang.blaze3d.vertex.PoseStack;
import com.simibubi.create.compat.jei.category.CreateRecipeCategory; import com.simibubi.create.compat.jei.category.CreateRecipeCategory;
import com.simibubi.create.compat.jei.category.animations.AnimatedDeployer; import com.simibubi.create.compat.jei.category.animations.AnimatedDeployer;
import com.simibubi.create.compat.jei.category.animations.AnimatedPress; import com.simibubi.create.compat.jei.category.animations.AnimatedPress;
@ -19,7 +19,7 @@ import com.simibubi.create.foundation.utility.Lang;
import mezz.jei.api.gui.ingredient.IGuiFluidStackGroup; import mezz.jei.api.gui.ingredient.IGuiFluidStackGroup;
import mezz.jei.api.gui.ingredient.IGuiItemStackGroup; import mezz.jei.api.gui.ingredient.IGuiItemStackGroup;
import net.minecraft.util.text.TextFormatting; import net.minecraft.ChatFormatting;
public abstract class SequencedAssemblySubCategory { public abstract class SequencedAssemblySubCategory {
@ -41,7 +41,7 @@ public abstract class SequencedAssemblySubCategory {
return 0; return 0;
} }
public abstract void draw(SequencedRecipe<?> recipe, MatrixStack ms, double mouseX, double mouseY, int index); public abstract void draw(SequencedRecipe<?> recipe, PoseStack ms, double mouseX, double mouseY, int index);
public static class AssemblyPressing extends SequencedAssemblySubCategory { public static class AssemblyPressing extends SequencedAssemblySubCategory {
@ -53,7 +53,7 @@ public abstract class SequencedAssemblySubCategory {
} }
@Override @Override
public void draw(SequencedRecipe<?> recipe, MatrixStack ms, double mouseX, double mouseY, int index) { public void draw(SequencedRecipe<?> recipe, PoseStack ms, double mouseX, double mouseY, int index) {
press.offset = index; press.offset = index;
ms.pushPose(); ms.pushPose();
ms.translate(-5, 50, 0); ms.translate(-5, 50, 0);
@ -87,7 +87,7 @@ public abstract class SequencedAssemblySubCategory {
} }
@Override @Override
public void draw(SequencedRecipe<?> recipe, MatrixStack ms, double mouseX, double mouseY, int index) { public void draw(SequencedRecipe<?> recipe, PoseStack ms, double mouseX, double mouseY, int index) {
spout.offset = index; spout.offset = index;
AllGuiTextures.JEI_SLOT.draw(ms, 3, 14); AllGuiTextures.JEI_SLOT.draw(ms, 3, 14);
ms.pushPose(); ms.pushPose();
@ -128,7 +128,7 @@ public abstract class SequencedAssemblySubCategory {
if (slotIndex != index) if (slotIndex != index)
return; return;
tooltip.add(1, Lang.translate("recipe.deploying.not_consumed") tooltip.add(1, Lang.translate("recipe.deploying.not_consumed")
.withStyle(TextFormatting.GOLD)); .withStyle(ChatFormatting.GOLD));
}); });
} }
@ -136,7 +136,7 @@ public abstract class SequencedAssemblySubCategory {
} }
@Override @Override
public void draw(SequencedRecipe<?> recipe, MatrixStack ms, double mouseX, double mouseY, int index) { public void draw(SequencedRecipe<?> recipe, PoseStack ms, double mouseX, double mouseY, int index) {
deployer.offset = index; deployer.offset = index;
ms.pushPose(); ms.pushPose();
ms.translate(-7, 50, 0); ms.translate(-7, 50, 0);
@ -158,7 +158,7 @@ public abstract class SequencedAssemblySubCategory {
} }
@Override @Override
public void draw(SequencedRecipe<?> recipe, MatrixStack ms, double mouseX, double mouseY, int index) { public void draw(SequencedRecipe<?> recipe, PoseStack ms, double mouseX, double mouseY, int index) {
ms.pushPose(); ms.pushPose();
ms.translate(0, 51.5f, 0); ms.translate(0, 51.5f, 0);
ms.scale(.6f, .6f, .6f); ms.scale(.6f, .6f, .6f);

View file

@ -6,11 +6,11 @@ import com.simibubi.create.content.contraptions.fluids.actors.SpoutTileEntity;
import com.simibubi.create.foundation.config.AllConfigs; import com.simibubi.create.foundation.config.AllConfigs;
import com.simibubi.create.foundation.fluid.FluidHelper; import com.simibubi.create.foundation.fluid.FluidHelper;
import net.minecraft.tileentity.TileEntity; import net.minecraft.world.level.block.entity.BlockEntity;
import net.minecraft.util.Direction; import net.minecraft.core.Direction;
import net.minecraft.util.ResourceLocation; import net.minecraft.resources.ResourceLocation;
import net.minecraft.util.math.BlockPos; import net.minecraft.core.BlockPos;
import net.minecraft.world.World; import net.minecraft.world.level.Level;
import net.minecraftforge.fluids.FluidStack; import net.minecraftforge.fluids.FluidStack;
import net.minecraftforge.fluids.capability.CapabilityFluidHandler; import net.minecraftforge.fluids.capability.CapabilityFluidHandler;
import net.minecraftforge.fluids.capability.IFluidHandler; import net.minecraftforge.fluids.capability.IFluidHandler;
@ -24,12 +24,12 @@ public class SpoutCasting extends BlockSpoutingBehaviour {
ResourceLocation BASIN = new ResourceLocation("tconstruct", "basin"); ResourceLocation BASIN = new ResourceLocation("tconstruct", "basin");
@Override @Override
public int fillBlock(World level, BlockPos pos, SpoutTileEntity spout, FluidStack availableFluid, public int fillBlock(Level level, BlockPos pos, SpoutTileEntity spout, FluidStack availableFluid,
boolean simulate) { boolean simulate) {
if (!enabled()) if (!enabled())
return 0; return 0;
TileEntity te = level.getBlockEntity(pos); BlockEntity te = level.getBlockEntity(pos);
if (te == null) if (te == null)
return 0; return 0;

View file

@ -3,10 +3,10 @@ package com.simibubi.create.content;
import com.simibubi.create.Create; import com.simibubi.create.Create;
import com.simibubi.create.foundation.item.ItemDescription.Palette; import com.simibubi.create.foundation.item.ItemDescription.Palette;
import net.minecraft.block.Block; import net.minecraft.world.level.block.Block;
import net.minecraft.item.BlockItem; import net.minecraft.world.item.BlockItem;
import net.minecraft.item.Item; import net.minecraft.world.item.Item;
import net.minecraft.item.ItemStack; import net.minecraft.world.item.ItemStack;
public enum AllSections { public enum AllSections {

View file

@ -5,7 +5,7 @@ import java.util.EnumSet;
import com.simibubi.create.AllBlocks; import com.simibubi.create.AllBlocks;
import com.simibubi.create.foundation.item.CreateItemGroupBase; import com.simibubi.create.foundation.item.CreateItemGroupBase;
import net.minecraft.item.ItemStack; import net.minecraft.world.item.ItemStack;
public class CreateItemGroup extends CreateItemGroupBase { public class CreateItemGroup extends CreateItemGroupBase {

View file

@ -8,19 +8,19 @@ import com.simibubi.create.foundation.config.AllConfigs;
import com.simibubi.create.foundation.utility.Color; import com.simibubi.create.foundation.utility.Color;
import com.simibubi.create.foundation.utility.VecHelper; import com.simibubi.create.foundation.utility.VecHelper;
import net.minecraft.block.BlockState; import net.minecraft.world.level.block.state.BlockState;
import net.minecraft.client.Minecraft; import net.minecraft.client.Minecraft;
import net.minecraft.client.world.ClientWorld; import net.minecraft.client.multiplayer.ClientLevel;
import net.minecraft.tileentity.TileEntity; import net.minecraft.world.level.block.entity.BlockEntity;
import net.minecraft.util.Direction; import net.minecraft.core.Direction;
import net.minecraft.util.Direction.Axis; import net.minecraft.core.Direction.Axis;
import net.minecraft.util.Direction.AxisDirection; import net.minecraft.core.Direction.AxisDirection;
import net.minecraft.util.math.BlockPos; import net.minecraft.core.BlockPos;
import net.minecraft.util.math.BlockRayTraceResult; import net.minecraft.world.phys.BlockHitResult;
import net.minecraft.util.math.RayTraceResult; import net.minecraft.world.phys.HitResult;
import net.minecraft.util.math.shapes.VoxelShape; import net.minecraft.world.phys.shapes.VoxelShape;
import net.minecraft.util.math.vector.Vector3d; import net.minecraft.world.phys.Vec3;
import net.minecraft.world.World; import net.minecraft.world.level.Level;
public class KineticDebugger { public class KineticDebugger {
@ -37,7 +37,7 @@ public class KineticDebugger {
if (te == null) if (te == null)
return; return;
World world = Minecraft.getInstance().level; Level world = Minecraft.getInstance().level;
BlockPos toOutline = te.hasSource() ? te.source : te.getBlockPos(); BlockPos toOutline = te.hasSource() ? te.source : te.getBlockPos();
BlockState state = te.getBlockState(); BlockState state = te.getBlockState();
VoxelShape shape = world.getBlockState(toOutline) VoxelShape shape = world.getBlockState(toOutline)
@ -51,9 +51,9 @@ public class KineticDebugger {
if (state.getBlock() instanceof IRotate) { if (state.getBlock() instanceof IRotate) {
Axis axis = ((IRotate) state.getBlock()).getRotationAxis(state); Axis axis = ((IRotate) state.getBlock()).getRotationAxis(state);
Vector3d vec = Vector3d.atLowerCornerOf(Direction.get(AxisDirection.POSITIVE, axis) Vec3 vec = Vec3.atLowerCornerOf(Direction.get(AxisDirection.POSITIVE, axis)
.getNormal()); .getNormal());
Vector3d center = VecHelper.getCenterOf(te.getBlockPos()); Vec3 center = VecHelper.getCenterOf(te.getBlockPos());
CreateClient.OUTLINER.showLine("rotationAxis", center.add(vec), center.subtract(vec)) CreateClient.OUTLINER.showLine("rotationAxis", center.add(vec), center.subtract(vec))
.lineWidth(1 / 16f); .lineWidth(1 / 16f);
} }
@ -65,17 +65,17 @@ public class KineticDebugger {
} }
public static KineticTileEntity getSelectedTE() { public static KineticTileEntity getSelectedTE() {
RayTraceResult obj = Minecraft.getInstance().hitResult; HitResult obj = Minecraft.getInstance().hitResult;
ClientWorld world = Minecraft.getInstance().level; ClientLevel world = Minecraft.getInstance().level;
if (obj == null) if (obj == null)
return null; return null;
if (world == null) if (world == null)
return null; return null;
if (!(obj instanceof BlockRayTraceResult)) if (!(obj instanceof BlockHitResult))
return null; return null;
BlockRayTraceResult ray = (BlockRayTraceResult) obj; BlockHitResult ray = (BlockHitResult) obj;
TileEntity te = world.getBlockEntity(ray.getBlockPos()); BlockEntity te = world.getBlockEntity(ray.getBlockPos());
if (!(te instanceof KineticTileEntity)) if (!(te instanceof KineticTileEntity))
return null; return null;

View file

@ -2,10 +2,30 @@ package com.simibubi.create.content.contraptions;
import static net.minecraft.state.properties.BlockStateProperties.AXIS; import static net.minecraft.state.properties.BlockStateProperties.AXIS;
import javanet.minimport com.simibubi.create.AllBlocks;
import com.simibubi.create.content.contraptions.base.IRotate;
import com.simibubi.create.content.contraptions.base.KineticTileEntity;
import com.simibubi.create.content.contraptions.relays.advanced.SpeedControllerBlock;
import com.simibubi.create.content.contraptions.relays.advanced.SpeedControllerTileEntity;
import com.simibubi.create.content.contraptions.relays.elementary.CogWheelBlock;
import com.simibubi.create.content.contraptions.relays.elementary.ICogWheel;
import com.simibubi.create.content.contraptions.relays.encased.DirectionalShaftHalvesTileEntity;
import com.simibubi.create.content.contraptions.relays.encased.EncasedBeltBlock;
import com.simibubi.create.content.contraptions.relays.encased.SplitShaftTileEntity;
import com.simibubi.create.content.contraptions.relays.gearbox.GearboxTileEntity;
import com.simibubi.create.foundation.config.AllConfigs;
import com.simibubi.create.foundation.utility.Iterate;
import java.util.LinkedList; import java.util.LinkedList;
import java.util.List; import java.util.List;
import net.minecraft.core.BlockPos;
import net.minecraft.core.Direction;
import net.minecraft.core.Direction.Axis;
import net.minecraft.world.level.Level;
import net.minecraft.world.level.block.Block;
import net.minecraft.world.level.block.entity.BlockEntity;
import net.minecraft.world.level.block.state.BlockState;
import com.simibubi.create.AllBlocks; ecraft.world.level.block.state.properties.BlockStateProperties com.simibubi.create.AllBlocks;
import com.simibubi.create.content.contraptions.base.IRotate; import com.simibubi.create.content.contraptions.base.IRotate;
import com.simibubi.create.content.contraptions.base.KineticTileEntity; import com.simibubi.create.content.contraptions.base.KineticTileEntity;
import com.simibubi.create.content.contraptions.relays.advanced.SpeedControllerBlock; import com.simibubi.create.content.contraptions.relays.advanced.SpeedControllerBlock;
@ -54,7 +74,7 @@ public class RotationPropagator {
final BlockPos diff = to.getBlockPos() final BlockPos diff = to.getBlockPos()
.subtract(from.getBlockPos()); .subtract(from.getBlockPos());
final Direction direction = Direction.getNearest(diff.getX(), diff.getY(), diff.getZ()); final Direction direction = Direction.getNearest(diff.getX(), diff.getY(), diff.getZ());
final World world = from.getLevel(); final Level world = from.getLevel();
boolean alignedAxes = true; boolean alignedAxes = true;
for (Axis axis : Axis.values()) for (Axis axis : Axis.values())
@ -204,7 +224,7 @@ public class RotationPropagator {
* @param worldIn * @param worldIn
* @param pos * @param pos
*/ */
public static void handleAdded(World worldIn, BlockPos pos, KineticTileEntity addedTE) { public static void handleAdded(Level worldIn, BlockPos pos, KineticTileEntity addedTE) {
if (worldIn.isClientSide) if (worldIn.isClientSide)
return; return;
if (!worldIn.isLoaded(pos)) if (!worldIn.isLoaded(pos))
@ -219,7 +239,7 @@ public class RotationPropagator {
*/ */
private static void propagateNewSource(KineticTileEntity currentTE) { private static void propagateNewSource(KineticTileEntity currentTE) {
BlockPos pos = currentTE.getBlockPos(); BlockPos pos = currentTE.getBlockPos();
World world = currentTE.getLevel(); Level world = currentTE.getLevel();
for (KineticTileEntity neighbourTE : getConnectedNeighbours(currentTE)) { for (KineticTileEntity neighbourTE : getConnectedNeighbours(currentTE)) {
float speedOfCurrent = currentTE.getTheoreticalSpeed(); float speedOfCurrent = currentTE.getTheoreticalSpeed();
@ -304,7 +324,7 @@ public class RotationPropagator {
* @param pos * @param pos
* @param removedTE * @param removedTE
*/ */
public static void handleRemoved(World worldIn, BlockPos pos, KineticTileEntity removedTE) { public static void handleRemoved(Level worldIn, BlockPos pos, KineticTileEntity removedTE) {
if (worldIn.isClientSide) if (worldIn.isClientSide)
return; return;
if (removedTE == null) if (removedTE == null)
@ -316,7 +336,7 @@ public class RotationPropagator {
BlockState neighbourState = worldIn.getBlockState(neighbourPos); BlockState neighbourState = worldIn.getBlockState(neighbourPos);
if (!(neighbourState.getBlock() instanceof IRotate)) if (!(neighbourState.getBlock() instanceof IRotate))
continue; continue;
TileEntity tileEntity = worldIn.getBlockEntity(neighbourPos); BlockEntity tileEntity = worldIn.getBlockEntity(neighbourPos);
if (!(tileEntity instanceof KineticTileEntity)) if (!(tileEntity instanceof KineticTileEntity))
continue; continue;
@ -336,7 +356,7 @@ public class RotationPropagator {
* @param updateTE * @param updateTE
*/ */
private static void propagateMissingSource(KineticTileEntity updateTE) { private static void propagateMissingSource(KineticTileEntity updateTE) {
final World world = updateTE.getLevel(); final Level world = updateTE.getLevel();
List<KineticTileEntity> potentialNewSources = new LinkedList<>(); List<KineticTileEntity> potentialNewSources = new LinkedList<>();
List<BlockPos> frontier = new LinkedList<>(); List<BlockPos> frontier = new LinkedList<>();
@ -345,7 +365,7 @@ public class RotationPropagator {
while (!frontier.isEmpty()) { while (!frontier.isEmpty()) {
final BlockPos pos = frontier.remove(0); final BlockPos pos = frontier.remove(0);
TileEntity tileEntity = world.getBlockEntity(pos); BlockEntity tileEntity = world.getBlockEntity(pos);
if (!(tileEntity instanceof KineticTileEntity)) if (!(tileEntity instanceof KineticTileEntity))
continue; continue;
final KineticTileEntity currentTE = (KineticTileEntity) tileEntity; final KineticTileEntity currentTE = (KineticTileEntity) tileEntity;
@ -387,7 +407,7 @@ public class RotationPropagator {
return null; return null;
if (!neighbourState.hasTileEntity()) if (!neighbourState.hasTileEntity())
return null; return null;
TileEntity neighbourTE = currentTE.getLevel() BlockEntity neighbourTE = currentTE.getLevel()
.getBlockEntity(neighbourPos); .getBlockEntity(neighbourPos);
if (!(neighbourTE instanceof KineticTileEntity)) if (!(neighbourTE instanceof KineticTileEntity))
return null; return null;

View file

@ -7,18 +7,18 @@ import com.simibubi.create.Create;
import com.simibubi.create.content.contraptions.base.KineticTileEntity; import com.simibubi.create.content.contraptions.base.KineticTileEntity;
import com.simibubi.create.foundation.utility.WorldHelper; import com.simibubi.create.foundation.utility.WorldHelper;
import net.minecraft.world.IWorld; import net.minecraft.world.level.LevelAccessor;
public class TorquePropagator { public class TorquePropagator {
static Map<IWorld, Map<Long, KineticNetwork>> networks = new HashMap<>(); static Map<LevelAccessor, Map<Long, KineticNetwork>> networks = new HashMap<>();
public void onLoadWorld(IWorld world) { public void onLoadWorld(LevelAccessor world) {
networks.put(world, new HashMap<>()); networks.put(world, new HashMap<>());
Create.LOGGER.debug("Prepared Kinetic Network Space for " + WorldHelper.getDimensionID(world)); Create.LOGGER.debug("Prepared Kinetic Network Space for " + WorldHelper.getDimensionID(world));
} }
public void onUnloadWorld(IWorld world) { public void onUnloadWorld(LevelAccessor world) {
networks.remove(world); networks.remove(world);
Create.LOGGER.debug("Removed Kinetic Network Space for " + WorldHelper.getDimensionID(world)); Create.LOGGER.debug("Removed Kinetic Network Space for " + WorldHelper.getDimensionID(world));
} }

View file

@ -2,8 +2,8 @@ package com.simibubi.create.content.contraptions.base;
import com.jozufozu.flywheel.backend.material.MaterialManager; import com.jozufozu.flywheel.backend.material.MaterialManager;
import net.minecraft.state.properties.BlockStateProperties; import net.minecraft.world.level.block.state.properties.BlockStateProperties;
import net.minecraft.util.Direction; import net.minecraft.core.Direction;
public class BackHalfShaftInstance extends HalfShaftInstance { public class BackHalfShaftInstance extends HalfShaftInstance {
public BackHalfShaftInstance(MaterialManager modelManager, KineticTileEntity tile) { public BackHalfShaftInstance(MaterialManager modelManager, KineticTileEntity tile) {

View file

@ -2,15 +2,17 @@ package com.simibubi.create.content.contraptions.base;
import com.simibubi.create.content.contraptions.wrench.IWrenchable; import com.simibubi.create.content.contraptions.wrench.IWrenchable;
import net.minecraft.block.Block; import net.minecraft.world.level.block.Block;
import net.minecraft.block.BlockState; import net.minecraft.world.level.block.state.BlockState;
import net.minecraft.entity.player.PlayerEntity; import net.minecraft.world.entity.player.Player;
import net.minecraft.item.ItemUseContext; import net.minecraft.world.item.context.UseOnContext;
import net.minecraft.util.ActionResultType; import net.minecraft.world.InteractionResult;
import net.minecraft.util.math.BlockPos; import net.minecraft.core.BlockPos;
import net.minecraft.world.IBlockReader; import net.minecraft.world.level.BlockGetter;
import net.minecraftforge.common.ToolType; import net.minecraftforge.common.ToolType;
import net.minecraft.world.level.block.state.BlockBehaviour.Properties;
public class CasingBlock extends Block implements IWrenchable { public class CasingBlock extends Block implements IWrenchable {
public CasingBlock(Properties p_i48440_1_) { public CasingBlock(Properties p_i48440_1_) {
@ -18,8 +20,8 @@ public class CasingBlock extends Block implements IWrenchable {
} }
@Override @Override
public ActionResultType onWrenched(BlockState state, ItemUseContext context) { public InteractionResult onWrenched(BlockState state, UseOnContext context) {
return ActionResultType.FAIL; return InteractionResult.FAIL;
} }
@Override @Override
@ -28,7 +30,7 @@ public class CasingBlock extends Block implements IWrenchable {
} }
@Override @Override
public boolean canHarvestBlock(BlockState state, IBlockReader world, BlockPos pos, PlayerEntity player) { public boolean canHarvestBlock(BlockState state, BlockGetter world, BlockPos pos, Player player) {
for (ToolType toolType : player.getMainHandItem().getToolTypes()) { for (ToolType toolType : player.getMainHandItem().getToolTypes()) {
if (isToolEffective(state, toolType)) if (isToolEffective(state, toolType))
return true; return true;

View file

@ -4,6 +4,8 @@ import com.jozufozu.flywheel.backend.material.Material;
import com.jozufozu.flywheel.backend.material.MaterialManager; import com.jozufozu.flywheel.backend.material.MaterialManager;
import com.simibubi.create.foundation.render.AllMaterialSpecs; import com.simibubi.create.foundation.render.AllMaterialSpecs;
import Material;
public class CutoutRotatingInstance extends SingleRotatingInstance { public class CutoutRotatingInstance extends SingleRotatingInstance {
public CutoutRotatingInstance(MaterialManager modelManager, KineticTileEntity tile) { public CutoutRotatingInstance(MaterialManager modelManager, KineticTileEntity tile) {
super(modelManager, tile); super(modelManager, tile);

View file

@ -3,17 +3,19 @@ package com.simibubi.create.content.contraptions.base;
import com.simibubi.create.foundation.utility.DirectionHelper; import com.simibubi.create.foundation.utility.DirectionHelper;
import com.simibubi.create.foundation.utility.Iterate; import com.simibubi.create.foundation.utility.Iterate;
import net.minecraft.block.Block; import net.minecraft.world.level.block.Block;
import net.minecraft.block.BlockState; import net.minecraft.world.level.block.state.BlockState;
import net.minecraft.item.BlockItemUseContext; import net.minecraft.world.item.context.BlockPlaceContext;
import net.minecraft.state.BooleanProperty; import net.minecraft.world.level.block.state.properties.BooleanProperty;
import net.minecraft.state.StateContainer.Builder; import net.minecraft.world.level.block.state.StateDefinition.Builder;
import net.minecraft.util.Direction; import net.minecraft.core.Direction;
import net.minecraft.util.Direction.Axis; import net.minecraft.core.Direction.Axis;
import net.minecraft.util.Rotation; import net.minecraft.world.level.block.Rotation;
import net.minecraft.util.math.BlockPos; import net.minecraft.core.BlockPos;
import net.minecraft.world.IWorldReader; import net.minecraft.world.level.LevelReader;
import net.minecraft.world.World; import net.minecraft.world.level.Level;
import net.minecraft.world.level.block.state.BlockBehaviour.Properties;
public abstract class DirectionalAxisKineticBlock extends DirectionalKineticBlock { public abstract class DirectionalAxisKineticBlock extends DirectionalKineticBlock {
@ -29,7 +31,7 @@ public abstract class DirectionalAxisKineticBlock extends DirectionalKineticBloc
super.createBlockStateDefinition(builder); super.createBlockStateDefinition(builder);
} }
protected Direction getFacingForPlacement(BlockItemUseContext context) { protected Direction getFacingForPlacement(BlockPlaceContext context) {
Direction facing = context.getNearestLookingDirection() Direction facing = context.getNearestLookingDirection()
.getOpposite(); .getOpposite();
if (context.getPlayer() != null && context.getPlayer() if (context.getPlayer() != null && context.getPlayer()
@ -38,16 +40,16 @@ public abstract class DirectionalAxisKineticBlock extends DirectionalKineticBloc
return facing; return facing;
} }
protected boolean getAxisAlignmentForPlacement(BlockItemUseContext context) { protected boolean getAxisAlignmentForPlacement(BlockPlaceContext context) {
return context.getHorizontalDirection() return context.getHorizontalDirection()
.getAxis() == Axis.X; .getAxis() == Axis.X;
} }
@Override @Override
public BlockState getStateForPlacement(BlockItemUseContext context) { public BlockState getStateForPlacement(BlockPlaceContext context) {
Direction facing = getFacingForPlacement(context); Direction facing = getFacingForPlacement(context);
BlockPos pos = context.getClickedPos(); BlockPos pos = context.getClickedPos();
World world = context.getLevel(); Level world = context.getLevel();
boolean alongFirst = false; boolean alongFirst = false;
Axis faceAxis = facing.getAxis(); Axis faceAxis = facing.getAxis();
@ -88,7 +90,7 @@ public abstract class DirectionalAxisKineticBlock extends DirectionalKineticBloc
.setValue(AXIS_ALONG_FIRST_COORDINATE, alongFirst); .setValue(AXIS_ALONG_FIRST_COORDINATE, alongFirst);
} }
protected boolean prefersConnectionTo(IWorldReader reader, BlockPos pos, Direction facing, boolean shaftAxis) { protected boolean prefersConnectionTo(LevelReader reader, BlockPos pos, Direction facing, boolean shaftAxis) {
if (!shaftAxis) if (!shaftAxis)
return false; return false;
BlockPos neighbourPos = pos.relative(facing); BlockPos neighbourPos = pos.relative(facing);
@ -122,7 +124,7 @@ public abstract class DirectionalAxisKineticBlock extends DirectionalKineticBloc
} }
@Override @Override
public boolean hasShaftTowards(IWorldReader world, BlockPos pos, BlockState state, Direction face) { public boolean hasShaftTowards(LevelReader world, BlockPos pos, BlockState state, Direction face) {
return face.getAxis() == getRotationAxis(state); return face.getAxis() == getRotationAxis(state);
} }

View file

@ -2,15 +2,17 @@ package com.simibubi.create.content.contraptions.base;
import com.simibubi.create.foundation.utility.Iterate; import com.simibubi.create.foundation.utility.Iterate;
import net.minecraft.block.Block; import net.minecraft.world.level.block.Block;
import net.minecraft.block.BlockState; import net.minecraft.world.level.block.state.BlockState;
import net.minecraft.item.BlockItemUseContext; import net.minecraft.world.item.context.BlockPlaceContext;
import net.minecraft.state.DirectionProperty; import net.minecraft.world.level.block.state.properties.DirectionProperty;
import net.minecraft.state.StateContainer.Builder; import net.minecraft.world.level.block.state.StateDefinition.Builder;
import net.minecraft.state.properties.BlockStateProperties; import net.minecraft.world.level.block.state.properties.BlockStateProperties;
import net.minecraft.util.Direction; import net.minecraft.core.Direction;
import net.minecraft.util.Mirror; import net.minecraft.world.level.block.Mirror;
import net.minecraft.util.Rotation; import net.minecraft.world.level.block.Rotation;
import net.minecraft.world.level.block.state.BlockBehaviour.Properties;
public abstract class DirectionalKineticBlock extends KineticBlock { public abstract class DirectionalKineticBlock extends KineticBlock {
@ -26,7 +28,7 @@ public abstract class DirectionalKineticBlock extends KineticBlock {
super.createBlockStateDefinition(builder); super.createBlockStateDefinition(builder);
} }
public Direction getPreferredFacing(BlockItemUseContext context) { public Direction getPreferredFacing(BlockPlaceContext context) {
Direction prefferedSide = null; Direction prefferedSide = null;
for (Direction side : Iterate.directions) { for (Direction side : Iterate.directions) {
BlockState blockState = context.getLevel() BlockState blockState = context.getLevel()
@ -47,7 +49,7 @@ public abstract class DirectionalKineticBlock extends KineticBlock {
} }
@Override @Override
public BlockState getStateForPlacement(BlockItemUseContext context) { public BlockState getStateForPlacement(BlockPlaceContext context) {
Direction preferred = getPreferredFacing(context); Direction preferred = getPreferredFacing(context);
if (preferred == null || (context.getPlayer() != null && context.getPlayer() if (preferred == null || (context.getPlayer() != null && context.getPlayer()
.isShiftKeyDown())) { .isShiftKeyDown())) {

View file

@ -7,18 +7,18 @@ import com.simibubi.create.content.contraptions.base.IRotate.SpeedLevel;
import com.simibubi.create.content.contraptions.goggles.IHaveGoggleInformation; import com.simibubi.create.content.contraptions.goggles.IHaveGoggleInformation;
import com.simibubi.create.foundation.utility.Lang; import com.simibubi.create.foundation.utility.Lang;
import net.minecraft.tileentity.TileEntity; import net.minecraft.world.level.block.entity.BlockEntity;
import net.minecraft.tileentity.TileEntityType; import net.minecraft.world.level.block.entity.BlockEntityType;
import net.minecraft.util.math.BlockPos; import net.minecraft.core.BlockPos;
import net.minecraft.util.text.ITextComponent; import net.minecraft.network.chat.Component;
import net.minecraft.util.text.StringTextComponent; import net.minecraft.network.chat.TextComponent;
import net.minecraft.util.text.TextFormatting; import net.minecraft.ChatFormatting;
public abstract class GeneratingKineticTileEntity extends KineticTileEntity { public abstract class GeneratingKineticTileEntity extends KineticTileEntity {
public boolean reActivateSource; public boolean reActivateSource;
public GeneratingKineticTileEntity(TileEntityType<?> typeIn) { public GeneratingKineticTileEntity(BlockEntityType<?> typeIn) {
super(typeIn); super(typeIn);
} }
@ -36,7 +36,7 @@ public abstract class GeneratingKineticTileEntity extends KineticTileEntity {
@Override @Override
public void setSource(BlockPos source) { public void setSource(BlockPos source) {
super.setSource(source); super.setSource(source);
TileEntity tileEntity = level.getBlockEntity(source); BlockEntity tileEntity = level.getBlockEntity(source);
if (!(tileEntity instanceof KineticTileEntity)) if (!(tileEntity instanceof KineticTileEntity))
return; return;
KineticTileEntity sourceTe = (KineticTileEntity) tileEntity; KineticTileEntity sourceTe = (KineticTileEntity) tileEntity;
@ -54,13 +54,13 @@ public abstract class GeneratingKineticTileEntity extends KineticTileEntity {
} }
@Override @Override
public boolean addToGoggleTooltip(List<ITextComponent> tooltip, boolean isPlayerSneaking) { public boolean addToGoggleTooltip(List<Component> tooltip, boolean isPlayerSneaking) {
boolean added = super.addToGoggleTooltip(tooltip, isPlayerSneaking); boolean added = super.addToGoggleTooltip(tooltip, isPlayerSneaking);
float stressBase = calculateAddedStressCapacity(); float stressBase = calculateAddedStressCapacity();
if (stressBase != 0 && IRotate.StressImpact.isEnabled()) { if (stressBase != 0 && IRotate.StressImpact.isEnabled()) {
tooltip.add(componentSpacing.plainCopy().append(Lang.translate("gui.goggles.generator_stats"))); tooltip.add(componentSpacing.plainCopy().append(Lang.translate("gui.goggles.generator_stats")));
tooltip.add(componentSpacing.plainCopy().append(Lang.translate("tooltip.capacityProvided").withStyle(TextFormatting.GRAY))); tooltip.add(componentSpacing.plainCopy().append(Lang.translate("tooltip.capacityProvided").withStyle(ChatFormatting.GRAY)));
float speed = getTheoreticalSpeed(); float speed = getTheoreticalSpeed();
if (speed != getGeneratedSpeed() && speed != 0) if (speed != getGeneratedSpeed() && speed != 0)
@ -71,11 +71,11 @@ public abstract class GeneratingKineticTileEntity extends KineticTileEntity {
tooltip.add( tooltip.add(
componentSpacing.plainCopy() componentSpacing.plainCopy()
.append(new StringTextComponent(" " + IHaveGoggleInformation.format(stressTotal)) .append(new TextComponent(" " + IHaveGoggleInformation.format(stressTotal))
.append(Lang.translate("generic.unit.stress")) .append(Lang.translate("generic.unit.stress"))
.withStyle(TextFormatting.AQUA)) .withStyle(ChatFormatting.AQUA))
.append(" ") .append(" ")
.append(Lang.translate("gui.goggles.at_current_speed").withStyle(TextFormatting.DARK_GRAY))); .append(Lang.translate("gui.goggles.at_current_speed").withStyle(ChatFormatting.DARK_GRAY)));
added = true; added = true;
} }

View file

@ -5,7 +5,7 @@ import com.jozufozu.flywheel.backend.material.MaterialManager;
import com.simibubi.create.AllBlockPartials; import com.simibubi.create.AllBlockPartials;
import net.minecraft.state.properties.BlockStateProperties; import net.minecraft.state.properties.BlockStateProperties;
import net.minecraft.util.Direction; import net.minecraft.core.Direction;
public class HalfShaftInstance extends SingleRotatingInstance { public class HalfShaftInstance extends SingleRotatingInstance {
public HalfShaftInstance(MaterialManager modelManager, KineticTileEntity tile) { public HalfShaftInstance(MaterialManager modelManager, KineticTileEntity tile) {

View file

@ -2,19 +2,21 @@ package com.simibubi.create.content.contraptions.base;
import com.simibubi.create.foundation.utility.Iterate; import com.simibubi.create.foundation.utility.Iterate;
import net.minecraft.block.Block; import net.minecraft.world.level.block.Block;
import net.minecraft.block.BlockState; import net.minecraft.world.level.block.state.BlockState;
import net.minecraft.item.BlockItemUseContext; import net.minecraft.world.item.context.BlockPlaceContext;
import net.minecraft.state.Property; import net.minecraft.world.level.block.state.properties.Property;
import net.minecraft.state.StateContainer.Builder; import net.minecraft.world.level.block.state.StateDefinition.Builder;
import net.minecraft.state.properties.BlockStateProperties; import net.minecraft.world.level.block.state.properties.BlockStateProperties;
import net.minecraft.util.Direction; import net.minecraft.core.Direction;
import net.minecraft.util.Direction.Axis; import net.minecraft.core.Direction.Axis;
import net.minecraft.util.Direction.AxisDirection; import net.minecraft.core.Direction.AxisDirection;
import net.minecraft.util.Mirror; import net.minecraft.world.level.block.Mirror;
import net.minecraft.util.Rotation; import net.minecraft.world.level.block.Rotation;
import net.minecraft.util.math.BlockPos; import net.minecraft.core.BlockPos;
import net.minecraft.world.IWorldReader; import net.minecraft.world.level.LevelReader;
import net.minecraft.world.level.block.state.BlockBehaviour.Properties;
public abstract class HorizontalAxisKineticBlock extends KineticBlock { public abstract class HorizontalAxisKineticBlock extends KineticBlock {
@ -31,14 +33,14 @@ public abstract class HorizontalAxisKineticBlock extends KineticBlock {
} }
@Override @Override
public BlockState getStateForPlacement(BlockItemUseContext context) { public BlockState getStateForPlacement(BlockPlaceContext context) {
Axis preferredAxis = getPreferredHorizontalAxis(context); Axis preferredAxis = getPreferredHorizontalAxis(context);
if (preferredAxis != null) if (preferredAxis != null)
return this.defaultBlockState().setValue(HORIZONTAL_AXIS, preferredAxis); return this.defaultBlockState().setValue(HORIZONTAL_AXIS, preferredAxis);
return this.defaultBlockState().setValue(HORIZONTAL_AXIS, context.getHorizontalDirection().getClockWise().getAxis()); return this.defaultBlockState().setValue(HORIZONTAL_AXIS, context.getHorizontalDirection().getClockWise().getAxis());
} }
public static Axis getPreferredHorizontalAxis(BlockItemUseContext context) { public static Axis getPreferredHorizontalAxis(BlockPlaceContext context) {
Direction prefferedSide = null; Direction prefferedSide = null;
for (Direction side : Iterate.horizontalDirections) { for (Direction side : Iterate.horizontalDirections) {
BlockState blockState = context.getLevel().getBlockState(context.getClickedPos().relative(side)); BlockState blockState = context.getLevel().getBlockState(context.getClickedPos().relative(side));
@ -62,7 +64,7 @@ public abstract class HorizontalAxisKineticBlock extends KineticBlock {
} }
@Override @Override
public boolean hasShaftTowards(IWorldReader world, BlockPos pos, BlockState state, Direction face) { public boolean hasShaftTowards(LevelReader world, BlockPos pos, BlockState state, Direction face) {
return face.getAxis() == state.getValue(HORIZONTAL_AXIS); return face.getAxis() == state.getValue(HORIZONTAL_AXIS);
} }

View file

@ -2,8 +2,8 @@ package com.simibubi.create.content.contraptions.base;
import com.jozufozu.flywheel.backend.material.MaterialManager; import com.jozufozu.flywheel.backend.material.MaterialManager;
import net.minecraft.state.properties.BlockStateProperties; import net.minecraft.world.level.block.state.properties.BlockStateProperties;
import net.minecraft.util.Direction; import net.minecraft.core.Direction;
public class HorizontalHalfShaftInstance extends HalfShaftInstance { public class HorizontalHalfShaftInstance extends HalfShaftInstance {

View file

@ -2,15 +2,17 @@ package com.simibubi.create.content.contraptions.base;
import com.simibubi.create.foundation.utility.Iterate; import com.simibubi.create.foundation.utility.Iterate;
import net.minecraft.block.Block; import net.minecraft.world.level.block.Block;
import net.minecraft.block.BlockState; import net.minecraft.world.level.block.state.BlockState;
import net.minecraft.item.BlockItemUseContext; import net.minecraft.world.item.context.BlockPlaceContext;
import net.minecraft.state.Property; import net.minecraft.world.level.block.state.properties.Property;
import net.minecraft.state.StateContainer.Builder; import net.minecraft.world.level.block.state.StateDefinition.Builder;
import net.minecraft.state.properties.BlockStateProperties; import net.minecraft.world.level.block.state.properties.BlockStateProperties;
import net.minecraft.util.Direction; import net.minecraft.core.Direction;
import net.minecraft.util.Mirror; import net.minecraft.world.level.block.Mirror;
import net.minecraft.util.Rotation; import net.minecraft.world.level.block.Rotation;
import net.minecraft.world.level.block.state.BlockBehaviour.Properties;
public abstract class HorizontalKineticBlock extends KineticBlock { public abstract class HorizontalKineticBlock extends KineticBlock {
@ -27,13 +29,13 @@ public abstract class HorizontalKineticBlock extends KineticBlock {
} }
@Override @Override
public BlockState getStateForPlacement(BlockItemUseContext context) { public BlockState getStateForPlacement(BlockPlaceContext context) {
return this.defaultBlockState() return this.defaultBlockState()
.setValue(HORIZONTAL_FACING, context.getHorizontalDirection() .setValue(HORIZONTAL_FACING, context.getHorizontalDirection()
.getOpposite()); .getOpposite());
} }
public Direction getPreferredHorizontalFacing(BlockItemUseContext context) { public Direction getPreferredHorizontalFacing(BlockPlaceContext context) {
Direction prefferedSide = null; Direction prefferedSide = null;
for (Direction side : Iterate.horizontalDirections) { for (Direction side : Iterate.horizontalDirections) {
BlockState blockState = context.getLevel() BlockState blockState = context.getLevel()

View file

@ -6,15 +6,15 @@ import com.simibubi.create.foundation.config.AllConfigs;
import com.simibubi.create.foundation.item.ItemDescription; import com.simibubi.create.foundation.item.ItemDescription;
import com.simibubi.create.foundation.utility.Lang; import com.simibubi.create.foundation.utility.Lang;
import net.minecraft.block.BlockState; import net.minecraft.world.level.block.state.BlockState;
import net.minecraft.util.Direction; import net.minecraft.core.Direction;
import net.minecraft.util.Direction.Axis; import net.minecraft.core.Direction.Axis;
import net.minecraft.util.math.BlockPos; import net.minecraft.core.BlockPos;
import net.minecraft.util.text.IFormattableTextComponent; import net.minecraft.network.chat.MutableComponent;
import net.minecraft.util.text.ITextComponent; import net.minecraft.network.chat.Component;
import net.minecraft.util.text.StringTextComponent; import net.minecraft.network.chat.TextComponent;
import net.minecraft.util.text.TextFormatting; import net.minecraft.ChatFormatting;
import net.minecraft.world.IWorldReader; import net.minecraft.world.level.LevelReader;
public interface IRotate extends IWrenchable { public interface IRotate extends IWrenchable {
@ -23,9 +23,9 @@ public interface IRotate extends IWrenchable {
MEDIUM, MEDIUM,
FAST; FAST;
public TextFormatting getTextColor() { public ChatFormatting getTextColor() {
return this == NONE ? TextFormatting.GREEN return this == NONE ? ChatFormatting.GREEN
: this == MEDIUM ? TextFormatting.AQUA : TextFormatting.LIGHT_PURPLE; : this == MEDIUM ? ChatFormatting.AQUA : ChatFormatting.LIGHT_PURPLE;
} }
public int getColor() { public int getColor() {
@ -59,10 +59,10 @@ public interface IRotate extends IWrenchable {
} }
} }
public static ITextComponent getFormattedSpeedText(float speed, boolean overstressed){ public static Component getFormattedSpeedText(float speed, boolean overstressed){
SpeedLevel speedLevel = of(speed); SpeedLevel speedLevel = of(speed);
IFormattableTextComponent level = new StringTextComponent(ItemDescription.makeProgressBar(3, speedLevel.ordinal())); MutableComponent level = new TextComponent(ItemDescription.makeProgressBar(3, speedLevel.ordinal()));
if (speedLevel == SpeedLevel.MEDIUM) if (speedLevel == SpeedLevel.MEDIUM)
level.append(Lang.translate("tooltip.speedRequirement.medium")); level.append(Lang.translate("tooltip.speedRequirement.medium"));
@ -72,7 +72,7 @@ public interface IRotate extends IWrenchable {
level.append(" (" + IHaveGoggleInformation.format(Math.abs(speed))).append(Lang.translate("generic.unit.rpm")).append(") "); level.append(" (" + IHaveGoggleInformation.format(Math.abs(speed))).append(Lang.translate("generic.unit.rpm")).append(") ");
if (overstressed) if (overstressed)
level.withStyle(TextFormatting.DARK_GRAY, TextFormatting.STRIKETHROUGH); level.withStyle(ChatFormatting.DARK_GRAY, ChatFormatting.STRIKETHROUGH);
else else
level.withStyle(speedLevel.getTextColor()); level.withStyle(speedLevel.getTextColor());
@ -87,12 +87,12 @@ public interface IRotate extends IWrenchable {
HIGH, HIGH,
OVERSTRESSED; OVERSTRESSED;
public TextFormatting getAbsoluteColor() { public ChatFormatting getAbsoluteColor() {
return this == LOW ? TextFormatting.YELLOW : this == MEDIUM ? TextFormatting.GOLD : TextFormatting.RED; return this == LOW ? ChatFormatting.YELLOW : this == MEDIUM ? ChatFormatting.GOLD : ChatFormatting.RED;
} }
public TextFormatting getRelativeColor() { public ChatFormatting getRelativeColor() {
return this == LOW ? TextFormatting.GREEN : this == MEDIUM ? TextFormatting.YELLOW : this == HIGH ? TextFormatting.GOLD : TextFormatting.RED; return this == LOW ? ChatFormatting.GREEN : this == MEDIUM ? ChatFormatting.YELLOW : this == HIGH ? ChatFormatting.GOLD : ChatFormatting.RED;
} }
public static StressImpact of(double stressPercent){ public static StressImpact of(double stressPercent){
@ -106,11 +106,11 @@ public interface IRotate extends IWrenchable {
return !AllConfigs.SERVER.kinetics.disableStress.get(); return !AllConfigs.SERVER.kinetics.disableStress.get();
} }
public static ITextComponent getFormattedStressText(double stressPercent){ public static Component getFormattedStressText(double stressPercent){
StressImpact stressLevel = of(stressPercent); StressImpact stressLevel = of(stressPercent);
TextFormatting color = stressLevel.getRelativeColor(); ChatFormatting color = stressLevel.getRelativeColor();
IFormattableTextComponent level = new StringTextComponent(ItemDescription.makeProgressBar(3, Math.min(stressLevel.ordinal(), 2))); MutableComponent level = new TextComponent(ItemDescription.makeProgressBar(3, Math.min(stressLevel.ordinal(), 2)));
level.append(Lang.translate("tooltip.stressImpact." + Lang.asId(stressLevel.name()))); level.append(Lang.translate("tooltip.stressImpact." + Lang.asId(stressLevel.name())));
level.append(String.format(" (%s%%) ", (int) (stressPercent * 100))); level.append(String.format(" (%s%%) ", (int) (stressPercent * 100)));
@ -119,7 +119,7 @@ public interface IRotate extends IWrenchable {
} }
} }
public boolean hasShaftTowards(IWorldReader world, BlockPos pos, BlockState state, Direction face); public boolean hasShaftTowards(LevelReader world, BlockPos pos, BlockState state, Direction face);
public Axis getRotationAxis(BlockState state); public Axis getRotationAxis(BlockState state);

View file

@ -2,20 +2,22 @@ package com.simibubi.create.content.contraptions.base;
import com.simibubi.create.foundation.item.ItemDescription.Palette; import com.simibubi.create.foundation.item.ItemDescription.Palette;
import net.minecraft.block.Block; import net.minecraft.world.level.block.Block;
import net.minecraft.block.BlockState; import net.minecraft.world.level.block.state.BlockState;
import net.minecraft.entity.LivingEntity; import net.minecraft.world.entity.LivingEntity;
import net.minecraft.entity.player.PlayerEntity; import net.minecraft.world.entity.player.Player;
import net.minecraft.item.ItemStack; import net.minecraft.world.item.ItemStack;
import net.minecraft.tileentity.TileEntity; import net.minecraft.world.level.block.entity.BlockEntity;
import net.minecraft.util.Direction; import net.minecraft.core.Direction;
import net.minecraft.util.math.BlockPos; import net.minecraft.core.BlockPos;
import net.minecraft.world.IBlockReader; import net.minecraft.world.level.BlockGetter;
import net.minecraft.world.IWorld; import net.minecraft.world.level.LevelAccessor;
import net.minecraft.world.IWorldReader; import net.minecraft.world.level.LevelReader;
import net.minecraft.world.World; import net.minecraft.world.level.Level;
import net.minecraftforge.common.ToolType; import net.minecraftforge.common.ToolType;
import net.minecraft.world.level.block.state.BlockBehaviour.Properties;
public abstract class KineticBlock extends Block implements IRotate { public abstract class KineticBlock extends Block implements IRotate {
protected static final Palette color = Palette.Red; protected static final Palette color = Palette.Red;
@ -30,7 +32,7 @@ public abstract class KineticBlock extends Block implements IRotate {
} }
@Override @Override
public boolean canHarvestBlock(BlockState state, IBlockReader world, BlockPos pos, PlayerEntity player) { public boolean canHarvestBlock(BlockState state, BlockGetter world, BlockPos pos, Player player) {
for (ToolType toolType : player.getMainHandItem() for (ToolType toolType : player.getMainHandItem()
.getToolTypes()) { .getToolTypes()) {
if (isToolEffective(state, toolType)) if (isToolEffective(state, toolType))
@ -45,13 +47,13 @@ public abstract class KineticBlock extends Block implements IRotate {
} }
@Override @Override
public void onPlace(BlockState state, World worldIn, BlockPos pos, BlockState oldState, boolean isMoving) { public void onPlace(BlockState state, Level worldIn, BlockPos pos, BlockState oldState, boolean isMoving) {
// onBlockAdded is useless for init, as sometimes the TE gets re-instantiated // onBlockAdded is useless for init, as sometimes the TE gets re-instantiated
// however, if a block change occurs that does not change kinetic connections, // however, if a block change occurs that does not change kinetic connections,
// we can prevent a major re-propagation here // we can prevent a major re-propagation here
TileEntity tileEntity = worldIn.getBlockEntity(pos); BlockEntity tileEntity = worldIn.getBlockEntity(pos);
if (tileEntity instanceof KineticTileEntity) { if (tileEntity instanceof KineticTileEntity) {
KineticTileEntity kineticTileEntity = (KineticTileEntity) tileEntity; KineticTileEntity kineticTileEntity = (KineticTileEntity) tileEntity;
kineticTileEntity.preventSpeedUpdate = 0; kineticTileEntity.preventSpeedUpdate = 0;
@ -68,7 +70,7 @@ public abstract class KineticBlock extends Block implements IRotate {
} }
@Override @Override
public boolean hasShaftTowards(IWorldReader world, BlockPos pos, BlockState state, Direction face) { public boolean hasShaftTowards(LevelReader world, BlockPos pos, BlockState state, Direction face) {
return false; return false;
} }
@ -84,14 +86,14 @@ public abstract class KineticBlock extends Block implements IRotate {
} }
@Override @Override
public abstract TileEntity createTileEntity(BlockState state, IBlockReader world); public abstract BlockEntity createTileEntity(BlockState state, BlockGetter world);
@Override @Override
public void updateIndirectNeighbourShapes(BlockState stateIn, IWorld worldIn, BlockPos pos, int flags, int count) { public void updateIndirectNeighbourShapes(BlockState stateIn, LevelAccessor worldIn, BlockPos pos, int flags, int count) {
if (worldIn.isClientSide()) if (worldIn.isClientSide())
return; return;
TileEntity tileEntity = worldIn.getBlockEntity(pos); BlockEntity tileEntity = worldIn.getBlockEntity(pos);
if (!(tileEntity instanceof KineticTileEntity)) if (!(tileEntity instanceof KineticTileEntity))
return; return;
KineticTileEntity kte = (KineticTileEntity) tileEntity; KineticTileEntity kte = (KineticTileEntity) tileEntity;
@ -108,11 +110,11 @@ public abstract class KineticBlock extends Block implements IRotate {
} }
@Override @Override
public void setPlacedBy(World worldIn, BlockPos pos, BlockState state, LivingEntity placer, ItemStack stack) { public void setPlacedBy(Level worldIn, BlockPos pos, BlockState state, LivingEntity placer, ItemStack stack) {
if (worldIn.isClientSide) if (worldIn.isClientSide)
return; return;
TileEntity tileEntity = worldIn.getBlockEntity(pos); BlockEntity tileEntity = worldIn.getBlockEntity(pos);
if (!(tileEntity instanceof KineticTileEntity)) if (!(tileEntity instanceof KineticTileEntity))
return; return;

View file

@ -4,8 +4,8 @@ import com.jozufozu.flywheel.backend.gl.buffer.VecBuffer;
import com.jozufozu.flywheel.core.materials.BasicData; import com.jozufozu.flywheel.core.materials.BasicData;
import com.simibubi.create.foundation.utility.Color; import com.simibubi.create.foundation.utility.Color;
import net.minecraft.util.math.BlockPos; import net.minecraft.core.BlockPos;
import net.minecraft.util.math.vector.Vector3f; import com.mojang.math.Vector3f;
public class KineticData extends BasicData { public class KineticData extends BasicData {
private float x; private float x;

View file

@ -7,15 +7,15 @@ import com.simibubi.create.content.contraptions.particle.RotationIndicatorPartic
import com.simibubi.create.foundation.advancement.AllTriggers; import com.simibubi.create.foundation.advancement.AllTriggers;
import com.simibubi.create.foundation.utility.VecHelper; import com.simibubi.create.foundation.utility.VecHelper;
import net.minecraft.block.Block; import net.minecraft.world.level.block.Block;
import net.minecraft.block.BlockState; import net.minecraft.world.level.block.state.BlockState;
import net.minecraft.particles.IParticleData; import net.minecraft.core.particles.ParticleOptions;
import net.minecraft.particles.ParticleTypes; import net.minecraft.core.particles.ParticleTypes;
import net.minecraft.util.Direction.Axis; import net.minecraft.core.Direction.Axis;
import net.minecraft.util.math.BlockPos; import net.minecraft.core.BlockPos;
import net.minecraft.util.math.vector.Vector3d; import net.minecraft.world.phys.Vec3;
import net.minecraft.world.World; import net.minecraft.world.level.Level;
import net.minecraft.world.server.ServerWorld; import net.minecraft.server.level.ServerLevel;
public class KineticEffectHandler { public class KineticEffectHandler {
@ -29,7 +29,7 @@ public class KineticEffectHandler {
} }
public void tick() { public void tick() {
World world = kte.getLevel(); Level world = kte.getLevel();
if (world.isClientSide) { if (world.isClientSide) {
if (overStressedTime > 0) if (overStressedTime > 0)
@ -58,16 +58,16 @@ public class KineticEffectHandler {
particleSpawnCountdown = 2; particleSpawnCountdown = 2;
} }
public void spawnEffect(IParticleData particle, float maxMotion, int amount) { public void spawnEffect(ParticleOptions particle, float maxMotion, int amount) {
World world = kte.getLevel(); Level world = kte.getLevel();
if (world == null) if (world == null)
return; return;
if (!world.isClientSide) if (!world.isClientSide)
return; return;
Random r = world.random; Random r = world.random;
for (int i = 0; i < amount; i++) { for (int i = 0; i < amount; i++) {
Vector3d motion = VecHelper.offsetRandomly(Vector3d.ZERO, r, maxMotion); Vec3 motion = VecHelper.offsetRandomly(Vec3.ZERO, r, maxMotion);
Vector3d position = VecHelper.getCenterOf(kte.getBlockPos()); Vec3 position = VecHelper.getCenterOf(kte.getBlockPos());
world.addParticle(particle, position.x, position.y, position.z, motion.x, motion.y, motion.z); world.addParticle(particle, position.x, position.y, position.z, motion.x, motion.y, motion.z);
} }
} }
@ -88,24 +88,24 @@ public class KineticEffectHandler {
Axis axis = kb.getRotationAxis(state); Axis axis = kb.getRotationAxis(state);
BlockPos pos = kte.getBlockPos(); BlockPos pos = kte.getBlockPos();
World world = kte.getLevel(); Level world = kte.getLevel();
if (axis == null) if (axis == null)
return; return;
if (world == null) if (world == null)
return; return;
char axisChar = axis.name().charAt(0); char axisChar = axis.name().charAt(0);
Vector3d vec = VecHelper.getCenterOf(pos); Vec3 vec = VecHelper.getCenterOf(pos);
SpeedLevel speedLevel = SpeedLevel.of(speed); SpeedLevel speedLevel = SpeedLevel.of(speed);
int color = speedLevel.getColor(); int color = speedLevel.getColor();
int particleSpeed = speedLevel.getParticleSpeed(); int particleSpeed = speedLevel.getParticleSpeed();
particleSpeed *= Math.signum(speed); particleSpeed *= Math.signum(speed);
if (world instanceof ServerWorld) { if (world instanceof ServerLevel) {
AllTriggers.triggerForNearbyPlayers(AllTriggers.ROTATION, world, pos, 5); AllTriggers.triggerForNearbyPlayers(AllTriggers.ROTATION, world, pos, 5);
RotationIndicatorParticleData particleData = RotationIndicatorParticleData particleData =
new RotationIndicatorParticleData(color, particleSpeed, radius1, radius2, 10, axisChar); new RotationIndicatorParticleData(color, particleSpeed, radius1, radius2, 10, axisChar);
((ServerWorld) world).sendParticles(particleData, vec.x, vec.y, vec.z, 20, 0, 0, 0, 1); ((ServerLevel) world).sendParticles(particleData, vec.x, vec.y, vec.z, 20, 0, 0, 0, 1);
} }
} }

View file

@ -1,7 +1,7 @@
package com.simibubi.create.content.contraptions.base; package com.simibubi.create.content.contraptions.base;
import static net.minecraft.util.text.TextFormatting.GOLD; import static net.minecraft.util.text.TextFormatting.GOLD;
import static net.minecraft.util.text.TextFormatting.GRAY; import staticnet.minecraft.ChatFormattingg.GRAY;
import java.util.List; import java.util.List;
@ -27,30 +27,30 @@ import com.simibubi.create.foundation.tileEntity.SmartTileEntity;
import com.simibubi.create.foundation.tileEntity.TileEntityBehaviour; import com.simibubi.create.foundation.tileEntity.TileEntityBehaviour;
import com.simibubi.create.foundation.utility.Lang; import com.simibubi.create.foundation.utility.Lang;
import net.minecraft.block.Block; import net.minecraft.world.level.block.Block;
import net.minecraft.block.BlockState; import net.minecraft.world.level.block.state.BlockState;
import net.minecraft.client.resources.I18n; import net.minecraft.client.resources.language.I18n;
import net.minecraft.nbt.CompoundNBT; import net.minecraft.nbt.CompoundTag;
import net.minecraft.nbt.NBTUtil; import net.minecraft.nbt.NbtUtils;
import net.minecraft.tileentity.ITickableTileEntity; import net.minecraft.world.level.block.entity.TickableBlockEntity;
import net.minecraft.tileentity.TileEntity; import net.minecraft.world.level.block.entity.BlockEntity;
import net.minecraft.tileentity.TileEntityType; import net.minecraft.world.level.block.entity.BlockEntityType;
import net.minecraft.util.Direction; import net.minecraft.core.Direction;
import net.minecraft.util.Direction.Axis; import net.minecraft.core.Direction.Axis;
import net.minecraft.util.Direction.AxisDirection; import net.minecraft.core.Direction.AxisDirection;
import net.minecraft.util.math.AxisAlignedBB; import net.minecraft.world.phys.AABB;
import net.minecraft.util.math.BlockPos; import net.minecraft.core.BlockPos;
import net.minecraft.util.math.MathHelper; import net.minecraft.util.Mth;
import net.minecraft.util.text.ITextComponent; import net.minecraft.network.chat.Component;
import net.minecraft.util.text.StringTextComponent; import net.minecraft.network.chat.TextComponent;
import net.minecraft.util.text.TextFormatting; import net.minecraft.util.text.TextFormatting;
import net.minecraft.world.World; import net.minecraft.world.level.Level;
import net.minecraftforge.api.distmarker.Dist; import net.minecraftforge.api.distmarker.Dist;
import net.minecraftforge.api.distmarker.OnlyIn; import net.minecraftforge.api.distmarker.OnlyIn;
import net.minecraftforge.fml.DistExecutor; import net.minecraftforge.fml.DistExecutor;
public abstract class KineticTileEntity extends SmartTileEntity public abstract class KineticTileEntity extends SmartTileEntity
implements ITickableTileEntity, IHaveGoggleInformation, IHaveHoveringInformation, IInstanceRendered { implements TickableBlockEntity, IHaveGoggleInformation, IHaveHoveringInformation, IInstanceRendered {
public @Nullable Long network; public @Nullable Long network;
public @Nullable BlockPos source; public @Nullable BlockPos source;
@ -71,7 +71,7 @@ public abstract class KineticTileEntity extends SmartTileEntity
protected float lastStressApplied; protected float lastStressApplied;
protected float lastCapacityProvided; protected float lastCapacityProvided;
public KineticTileEntity(TileEntityType<?> typeIn) { public KineticTileEntity(BlockEntityType<?> typeIn) {
super(typeIn); super(typeIn);
effects = new KineticEffectHandler(this); effects = new KineticEffectHandler(this);
updateSpeed = true; updateSpeed = true;
@ -128,7 +128,7 @@ public abstract class KineticTileEntity extends SmartTileEntity
if (!level.isLoaded(source)) if (!level.isLoaded(source))
return; return;
TileEntity tileEntity = level.getBlockEntity(source); BlockEntity tileEntity = level.getBlockEntity(source);
KineticTileEntity sourceTe = KineticTileEntity sourceTe =
tileEntity instanceof KineticTileEntity ? (KineticTileEntity) tileEntity : null; tileEntity instanceof KineticTileEntity ? (KineticTileEntity) tileEntity : null;
if (sourceTe == null || sourceTe.speed == 0) { if (sourceTe == null || sourceTe.speed == 0) {
@ -195,17 +195,17 @@ public abstract class KineticTileEntity extends SmartTileEntity
} }
@Override @Override
protected void write(CompoundNBT compound, boolean clientPacket) { protected void write(CompoundTag compound, boolean clientPacket) {
compound.putFloat("Speed", speed); compound.putFloat("Speed", speed);
if (needsSpeedUpdate()) if (needsSpeedUpdate())
compound.putBoolean("NeedsSpeedUpdate", true); compound.putBoolean("NeedsSpeedUpdate", true);
if (hasSource()) if (hasSource())
compound.put("Source", NBTUtil.writeBlockPos(source)); compound.put("Source", NbtUtils.writeBlockPos(source));
if (hasNetwork()) { if (hasNetwork()) {
CompoundNBT networkTag = new CompoundNBT(); CompoundTag networkTag = new CompoundTag();
networkTag.putLong("Id", this.network); networkTag.putLong("Id", this.network);
networkTag.putFloat("Stress", stress); networkTag.putFloat("Stress", stress);
networkTag.putFloat("Capacity", capacity); networkTag.putFloat("Capacity", capacity);
@ -227,7 +227,7 @@ public abstract class KineticTileEntity extends SmartTileEntity
} }
@Override @Override
protected void fromTag(BlockState state, CompoundNBT compound, boolean clientPacket) { protected void fromTag(BlockState state, CompoundTag compound, boolean clientPacket) {
boolean overStressedBefore = overStressed; boolean overStressedBefore = overStressed;
clearKineticInformation(); clearKineticInformation();
@ -240,10 +240,10 @@ public abstract class KineticTileEntity extends SmartTileEntity
speed = compound.getFloat("Speed"); speed = compound.getFloat("Speed");
if (compound.contains("Source")) if (compound.contains("Source"))
source = NBTUtil.readBlockPos(compound.getCompound("Source")); source = NbtUtils.readBlockPos(compound.getCompound("Source"));
if (compound.contains("Network")) { if (compound.contains("Network")) {
CompoundNBT networkTag = compound.getCompound("Network"); CompoundTag networkTag = compound.getCompound("Network");
network = networkTag.getLong("Id"); network = networkTag.getLong("Id");
stress = networkTag.getFloat("Stress"); stress = networkTag.getFloat("Stress");
capacity = networkTag.getFloat("Capacity"); capacity = networkTag.getFloat("Capacity");
@ -293,7 +293,7 @@ public abstract class KineticTileEntity extends SmartTileEntity
if (level == null || level.isClientSide) if (level == null || level.isClientSide)
return; return;
TileEntity tileEntity = level.getBlockEntity(source); BlockEntity tileEntity = level.getBlockEntity(source);
if (!(tileEntity instanceof KineticTileEntity)) { if (!(tileEntity instanceof KineticTileEntity)) {
removeSource(); removeSource();
return; return;
@ -362,11 +362,11 @@ public abstract class KineticTileEntity extends SmartTileEntity
return true; return true;
} }
public static void switchToBlockState(World world, BlockPos pos, BlockState state) { public static void switchToBlockState(Level world, BlockPos pos, BlockState state) {
if (world.isClientSide) if (world.isClientSide)
return; return;
TileEntity tileEntityIn = world.getBlockEntity(pos); BlockEntity tileEntityIn = world.getBlockEntity(pos);
BlockState currentState = world.getBlockState(pos); BlockState currentState = world.getBlockState(pos);
boolean isKinetic = tileEntityIn instanceof KineticTileEntity; boolean isKinetic = tileEntityIn instanceof KineticTileEntity;
@ -394,15 +394,15 @@ public abstract class KineticTileEntity extends SmartTileEntity
public void addBehaviours(List<TileEntityBehaviour> behaviours) {} public void addBehaviours(List<TileEntityBehaviour> behaviours) {}
@Override @Override
public boolean addToTooltip(List<ITextComponent> tooltip, boolean isPlayerSneaking) { public boolean addToTooltip(List<Component> tooltip, boolean isPlayerSneaking) {
boolean notFastEnough = !isSpeedRequirementFulfilled() && getSpeed() != 0; boolean notFastEnough = !isSpeedRequirementFulfilled() && getSpeed() != 0;
if (overStressed && AllConfigs.CLIENT.enableOverstressedTooltip.get()) { if (overStressed && AllConfigs.CLIENT.enableOverstressedTooltip.get()) {
tooltip.add(componentSpacing.plainCopy() tooltip.add(componentSpacing.plainCopy()
.append(Lang.translate("gui.stressometer.overstressed") .append(Lang.translate("gui.stressometer.overstressed")
.withStyle(GOLD))); .withStyle(GOLD)));
ITextComponent hint = Lang.translate("gui.contraptions.network_overstressed"); Component hint = Lang.translate("gui.contraptions.network_overstressed");
List<ITextComponent> cutString = TooltipHelper.cutTextComponent(hint, GRAY, TextFormatting.WHITE); List<Component> cutString = TooltipHelper.cutTextComponent(hint, GRAY, ChatFormatting.WHITE);
for (int i = 0; i < cutString.size(); i++) for (int i = 0; i < cutString.size(); i++)
tooltip.add(componentSpacing.plainCopy() tooltip.add(componentSpacing.plainCopy()
.append(cutString.get(i))); .append(cutString.get(i)));
@ -413,10 +413,10 @@ public abstract class KineticTileEntity extends SmartTileEntity
tooltip.add(componentSpacing.plainCopy() tooltip.add(componentSpacing.plainCopy()
.append(Lang.translate("tooltip.speedRequirement") .append(Lang.translate("tooltip.speedRequirement")
.withStyle(GOLD))); .withStyle(GOLD)));
ITextComponent hint = Component hint =
Lang.translate("gui.contraptions.not_fast_enough", I18n.get(getBlockState().getBlock() Lang.translate("gui.contraptions.not_fast_enough", I18n.get(getBlockState().getBlock()
.getDescriptionId())); .getDescriptionId()));
List<ITextComponent> cutString = TooltipHelper.cutTextComponent(hint, GRAY, TextFormatting.WHITE); List<Component> cutString = TooltipHelper.cutTextComponent(hint, GRAY, ChatFormatting.WHITE);
for (int i = 0; i < cutString.size(); i++) for (int i = 0; i < cutString.size(); i++)
tooltip.add(componentSpacing.plainCopy() tooltip.add(componentSpacing.plainCopy()
.append(cutString.get(i))); .append(cutString.get(i)));
@ -427,7 +427,7 @@ public abstract class KineticTileEntity extends SmartTileEntity
} }
@Override @Override
public boolean addToGoggleTooltip(List<ITextComponent> tooltip, boolean isPlayerSneaking) { public boolean addToGoggleTooltip(List<Component> tooltip, boolean isPlayerSneaking) {
boolean added = false; boolean added = false;
float stressAtBase = calculateStressApplied(); float stressAtBase = calculateStressApplied();
@ -436,17 +436,17 @@ public abstract class KineticTileEntity extends SmartTileEntity
.append(Lang.translate("gui.goggles.kinetic_stats"))); .append(Lang.translate("gui.goggles.kinetic_stats")));
tooltip.add(componentSpacing.plainCopy() tooltip.add(componentSpacing.plainCopy()
.append(Lang.translate("tooltip.stressImpact") .append(Lang.translate("tooltip.stressImpact")
.withStyle(TextFormatting.GRAY))); .withStyle(ChatFormatting.GRAY)));
float stressTotal = stressAtBase * Math.abs(getTheoreticalSpeed()); float stressTotal = stressAtBase * Math.abs(getTheoreticalSpeed());
tooltip.add(componentSpacing.plainCopy() tooltip.add(componentSpacing.plainCopy()
.append(new StringTextComponent(" " + IHaveGoggleInformation.format(stressTotal)) .append(new TextComponent(" " + IHaveGoggleInformation.format(stressTotal))
.append(Lang.translate("generic.unit.stress")) .append(Lang.translate("generic.unit.stress"))
.append(" ") .append(" ")
.withStyle(TextFormatting.AQUA)) .withStyle(ChatFormatting.AQUA))
.append(Lang.translate("gui.goggles.at_current_speed") .append(Lang.translate("gui.goggles.at_current_speed")
.withStyle(TextFormatting.DARK_GRAY))); .withStyle(ChatFormatting.DARK_GRAY)));
added = true; added = true;
} }
@ -565,17 +565,17 @@ public abstract class KineticTileEntity extends SmartTileEntity
DistExecutor.unsafeRunWhenOn(Dist.CLIENT, () -> () -> InstancedRenderDispatcher.enqueueUpdate(this)); DistExecutor.unsafeRunWhenOn(Dist.CLIENT, () -> () -> InstancedRenderDispatcher.enqueueUpdate(this));
} }
protected AxisAlignedBB cachedBoundingBox; protected AABB cachedBoundingBox;
@OnlyIn(Dist.CLIENT) @OnlyIn(Dist.CLIENT)
public AxisAlignedBB getRenderBoundingBox() { public AABB getRenderBoundingBox() {
if (cachedBoundingBox == null) { if (cachedBoundingBox == null) {
cachedBoundingBox = makeRenderBoundingBox(); cachedBoundingBox = makeRenderBoundingBox();
} }
return cachedBoundingBox; return cachedBoundingBox;
} }
protected AxisAlignedBB makeRenderBoundingBox() { protected AABB makeRenderBoundingBox() {
return super.getRenderBoundingBox(); return super.getRenderBoundingBox();
} }
@ -584,7 +584,7 @@ public abstract class KineticTileEntity extends SmartTileEntity
float componentSpeed = Math.abs(getSpeed()); float componentSpeed = Math.abs(getSpeed());
if (componentSpeed == 0) if (componentSpeed == 0)
return; return;
float pitch = MathHelper.clamp((componentSpeed / 256f) + .45f, .85f, 1f); float pitch = Mth.clamp((componentSpeed / 256f) + .45f, .85f, 1f);
if (isNoisy()) if (isNoisy())
SoundScapes.play(AmbienceGroup.KINETIC, worldPosition, pitch); SoundScapes.play(AmbienceGroup.KINETIC, worldPosition, pitch);

View file

@ -1,8 +1,8 @@
package com.simibubi.create.content.contraptions.base; package com.simibubi.create.content.contraptions.base;
import com.jozufozu.flywheel.backend.Backend; import com.jozufozu.flywheel.backend.Backend;
import com.mojang.blaze3d.matrix.MatrixStack; import com.mojang.blaze3d.vertex.PoseStack;
import com.mojang.blaze3d.vertex.IVertexBuilder; import com.mojang.blaze3d.vertex.VertexConsumer;
import com.simibubi.create.AllBlocks; import com.simibubi.create.AllBlocks;
import com.simibubi.create.CreateClient; import com.simibubi.create.CreateClient;
import com.simibubi.create.content.contraptions.KineticDebugger; import com.simibubi.create.content.contraptions.KineticDebugger;
@ -13,16 +13,16 @@ import com.simibubi.create.foundation.tileEntity.renderer.SafeTileEntityRenderer
import com.simibubi.create.foundation.utility.AnimationTickHolder; import com.simibubi.create.foundation.utility.AnimationTickHolder;
import com.simibubi.create.foundation.utility.Color; import com.simibubi.create.foundation.utility.Color;
import net.minecraft.block.BlockState; import net.minecraft.world.level.block.state.BlockState;
import net.minecraft.client.renderer.IRenderTypeBuffer; import net.minecraft.client.renderer.MultiBufferSource;
import net.minecraft.client.renderer.RenderType; import net.minecraft.client.renderer.RenderType;
import net.minecraft.client.renderer.RenderTypeLookup; import net.minecraft.client.renderer.ItemBlockRenderTypes;
import net.minecraft.client.renderer.tileentity.TileEntityRendererDispatcher; import net.minecraft.client.renderer.blockentity.BlockEntityRenderDispatcher;
import net.minecraft.state.properties.BlockStateProperties; import net.minecraft.world.level.block.state.properties.BlockStateProperties;
import net.minecraft.util.Direction; import net.minecraft.core.Direction;
import net.minecraft.util.Direction.Axis; import net.minecraft.core.Direction.Axis;
import net.minecraft.util.Direction.AxisDirection; import net.minecraft.core.Direction.AxisDirection;
import net.minecraft.util.math.BlockPos; import net.minecraft.core.BlockPos;
import net.minecraftforge.api.distmarker.Dist; import net.minecraftforge.api.distmarker.Dist;
import net.minecraftforge.fml.common.Mod.EventBusSubscriber; import net.minecraftforge.fml.common.Mod.EventBusSubscriber;
@ -32,28 +32,28 @@ public class KineticTileEntityRenderer extends SafeTileEntityRenderer<KineticTil
public static final Compartment<BlockState> KINETIC_TILE = new Compartment<>(); public static final Compartment<BlockState> KINETIC_TILE = new Compartment<>();
public static boolean rainbowMode = false; public static boolean rainbowMode = false;
public KineticTileEntityRenderer(TileEntityRendererDispatcher dispatcher) { public KineticTileEntityRenderer(BlockEntityRenderDispatcher dispatcher) {
super(dispatcher); super(dispatcher);
} }
@Override @Override
protected void renderSafe(KineticTileEntity te, float partialTicks, MatrixStack ms, IRenderTypeBuffer buffer, protected void renderSafe(KineticTileEntity te, float partialTicks, PoseStack ms, MultiBufferSource buffer,
int light, int overlay) { int light, int overlay) {
if (Backend.getInstance().canUseInstancing(te.getLevel())) return; if (Backend.getInstance().canUseInstancing(te.getLevel())) return;
for (RenderType type : RenderType.chunkBufferLayers()) for (RenderType type : RenderType.chunkBufferLayers())
if (RenderTypeLookup.canRenderInLayer(te.getBlockState(), type)) if (ItemBlockRenderTypes.canRenderInLayer(te.getBlockState(), type))
renderRotatingBuffer(te, getRotatedModel(te), ms, buffer.getBuffer(type), light); renderRotatingBuffer(te, getRotatedModel(te), ms, buffer.getBuffer(type), light);
} }
public static void renderRotatingKineticBlock(KineticTileEntity te, BlockState renderedState, MatrixStack ms, public static void renderRotatingKineticBlock(KineticTileEntity te, BlockState renderedState, PoseStack ms,
IVertexBuilder buffer, int light) { VertexConsumer buffer, int light) {
SuperByteBuffer superByteBuffer = CreateClient.BUFFER_CACHE.renderBlockIn(KINETIC_TILE, renderedState); SuperByteBuffer superByteBuffer = CreateClient.BUFFER_CACHE.renderBlockIn(KINETIC_TILE, renderedState);
renderRotatingBuffer(te, superByteBuffer, ms, buffer, light); renderRotatingBuffer(te, superByteBuffer, ms, buffer, light);
} }
public static void renderRotatingBuffer(KineticTileEntity te, SuperByteBuffer superBuffer, MatrixStack ms, public static void renderRotatingBuffer(KineticTileEntity te, SuperByteBuffer superBuffer, PoseStack ms,
IVertexBuilder buffer, int light) { VertexConsumer buffer, int light) {
standardKineticRotationTransform(superBuffer, te, light).renderInto(ms, buffer); standardKineticRotationTransform(superBuffer, te, light).renderInto(ms, buffer);
} }

View file

@ -8,8 +8,10 @@ import com.simibubi.create.content.contraptions.relays.elementary.ICogWheel;
import com.simibubi.create.content.contraptions.relays.elementary.ShaftBlock; import com.simibubi.create.content.contraptions.relays.elementary.ShaftBlock;
import com.simibubi.create.foundation.render.AllMaterialSpecs; import com.simibubi.create.foundation.render.AllMaterialSpecs;
import net.minecraft.block.BlockState; import net.minecraft.world.level.block.state.BlockState;
import net.minecraft.util.Direction; import net.minecraft.core.Direction;
import Material;
public abstract class KineticTileInstance<T extends KineticTileEntity> extends TileEntityInstance<T> { public abstract class KineticTileInstance<T extends KineticTileEntity> extends TileEntityInstance<T> {

View file

@ -2,15 +2,17 @@ package com.simibubi.create.content.contraptions.base;
import com.simibubi.create.foundation.utility.Iterate; import com.simibubi.create.foundation.utility.Iterate;
import net.minecraft.block.Block; import net.minecraft.world.level.block.Block;
import net.minecraft.block.BlockState; import net.minecraft.world.level.block.state.BlockState;
import net.minecraft.item.BlockItemUseContext; import net.minecraft.world.item.context.BlockPlaceContext;
import net.minecraft.state.EnumProperty; import net.minecraft.world.level.block.state.properties.EnumProperty;
import net.minecraft.state.StateContainer; import net.minecraft.world.level.block.state.StateDefinition;
import net.minecraft.state.properties.BlockStateProperties; import net.minecraft.world.level.block.state.properties.BlockStateProperties;
import net.minecraft.util.Direction; import net.minecraft.core.Direction;
import net.minecraft.util.Direction.Axis; import net.minecraft.core.Direction.Axis;
import net.minecraft.util.Rotation; import net.minecraft.world.level.block.Rotation;
import net.minecraft.world.level.block.state.BlockBehaviour.Properties;
public abstract class RotatedPillarKineticBlock extends KineticBlock { public abstract class RotatedPillarKineticBlock extends KineticBlock {
@ -40,7 +42,7 @@ public abstract class RotatedPillarKineticBlock extends KineticBlock {
} }
} }
public static Axis getPreferredAxis(BlockItemUseContext context) { public static Axis getPreferredAxis(BlockPlaceContext context) {
Axis prefferedAxis = null; Axis prefferedAxis = null;
for (Direction side : Iterate.directions) { for (Direction side : Iterate.directions) {
BlockState blockState = context.getLevel() BlockState blockState = context.getLevel()
@ -61,12 +63,12 @@ public abstract class RotatedPillarKineticBlock extends KineticBlock {
} }
@Override @Override
protected void createBlockStateDefinition(StateContainer.Builder<Block, BlockState> builder) { protected void createBlockStateDefinition(StateDefinition.Builder<Block, BlockState> builder) {
builder.add(AXIS); builder.add(AXIS);
} }
@Override @Override
public BlockState getStateForPlacement(BlockItemUseContext context) { public BlockState getStateForPlacement(BlockPlaceContext context) {
Axis preferredAxis = getPreferredAxis(context); Axis preferredAxis = getPreferredAxis(context);
if (preferredAxis != null && (context.getPlayer() == null || !context.getPlayer() if (preferredAxis != null && (context.getPlayer() == null || !context.getPlayer()
.isShiftKeyDown())) .isShiftKeyDown()))

View file

@ -2,8 +2,8 @@ package com.simibubi.create.content.contraptions.base;
import com.jozufozu.flywheel.backend.gl.buffer.VecBuffer; import com.jozufozu.flywheel.backend.gl.buffer.VecBuffer;
import net.minecraft.util.Direction; import net.minecraft.core.Direction;
import net.minecraft.util.math.vector.Vector3f; import com.mojang.math.Vector3f;
public class RotatingData extends KineticData { public class RotatingData extends KineticData {
private byte rotationAxisX; private byte rotationAxisX;

View file

@ -3,7 +3,7 @@ package com.simibubi.create.content.contraptions.base;
import com.jozufozu.flywheel.backend.instancing.Instancer; import com.jozufozu.flywheel.backend.instancing.Instancer;
import com.jozufozu.flywheel.backend.material.MaterialManager; import com.jozufozu.flywheel.backend.material.MaterialManager;
import net.minecraft.block.BlockState; import net.minecraft.world.level.block.state.BlockState;
public class SingleRotatingInstance extends KineticTileInstance<KineticTileEntity> { public class SingleRotatingInstance extends KineticTileInstance<KineticTileEntity> {

View file

@ -4,15 +4,17 @@ import com.simibubi.create.AllBlocks;
import com.simibubi.create.content.contraptions.relays.belt.BeltBlock; import com.simibubi.create.content.contraptions.relays.belt.BeltBlock;
import com.simibubi.create.content.contraptions.relays.belt.BeltSlope; import com.simibubi.create.content.contraptions.relays.belt.BeltSlope;
import net.minecraft.block.Block; import net.minecraft.world.level.block.Block;
import net.minecraft.block.BlockState; import net.minecraft.world.level.block.state.BlockState;
import net.minecraft.item.BlockItem; import net.minecraft.world.item.BlockItem;
import net.minecraft.item.BlockItemUseContext; import net.minecraft.world.item.context.BlockPlaceContext;
import net.minecraft.util.ActionResultType; import net.minecraft.world.InteractionResult;
import net.minecraft.util.Direction; import net.minecraft.core.Direction;
import net.minecraft.util.math.BlockPos; import net.minecraft.core.BlockPos;
import net.minecraft.util.math.BlockRayTraceResult; import net.minecraft.world.phys.BlockHitResult;
import net.minecraft.util.math.vector.Vector3d; import net.minecraft.world.phys.Vec3;
import net.minecraft.world.item.Item.Properties;
public class AssemblyOperatorBlockItem extends BlockItem { public class AssemblyOperatorBlockItem extends BlockItem {
@ -21,7 +23,7 @@ public class AssemblyOperatorBlockItem extends BlockItem {
} }
@Override @Override
public ActionResultType place(BlockItemUseContext context) { public InteractionResult place(BlockPlaceContext context) {
BlockPos placedOnPos = context.getClickedPos() BlockPos placedOnPos = context.getClickedPos()
.relative(context.getClickedFace() .relative(context.getClickedFace()
.getOpposite()); .getOpposite());
@ -34,15 +36,15 @@ public class AssemblyOperatorBlockItem extends BlockItem {
.isReplaceable()) .isReplaceable())
context = adjustContext(context, placedOnPos); context = adjustContext(context, placedOnPos);
else else
return ActionResultType.FAIL; return InteractionResult.FAIL;
} }
return super.place(context); return super.place(context);
} }
protected BlockItemUseContext adjustContext(BlockItemUseContext context, BlockPos placedOnPos) { protected BlockPlaceContext adjustContext(BlockPlaceContext context, BlockPos placedOnPos) {
BlockPos up = placedOnPos.above(2); BlockPos up = placedOnPos.above(2);
return new AssemblyOperatorUseContext(context.getLevel(), context.getPlayer(), context.getHand(), context.getItemInHand(), new BlockRayTraceResult(new Vector3d((double)up.getX() + 0.5D + (double) Direction.UP.getStepX() * 0.5D, (double)up.getY() + 0.5D + (double) Direction.UP.getStepY() * 0.5D, (double)up.getZ() + 0.5D + (double) Direction.UP.getStepZ() * 0.5D), Direction.UP, up, false)); return new AssemblyOperatorUseContext(context.getLevel(), context.getPlayer(), context.getHand(), context.getItemInHand(), new BlockHitResult(new Vec3((double)up.getX() + 0.5D + (double) Direction.UP.getStepX() * 0.5D, (double)up.getY() + 0.5D + (double) Direction.UP.getStepY() * 0.5D, (double)up.getZ() + 0.5D + (double) Direction.UP.getStepZ() * 0.5D), Direction.UP, up, false));
} }
protected boolean operatesOn(BlockState placedOnState) { protected boolean operatesOn(BlockState placedOnState) {

View file

@ -2,15 +2,15 @@ package com.simibubi.create.content.contraptions.components;
import javax.annotation.Nullable; import javax.annotation.Nullable;
import net.minecraft.entity.player.PlayerEntity; import net.minecraft.world.entity.player.Player;
import net.minecraft.item.BlockItemUseContext; import net.minecraft.world.item.context.BlockPlaceContext;
import net.minecraft.item.ItemStack; import net.minecraft.world.item.ItemStack;
import net.minecraft.util.Hand; import net.minecraft.world.InteractionHand;
import net.minecraft.util.math.BlockRayTraceResult; import net.minecraft.world.phys.BlockHitResult;
import net.minecraft.world.World; import net.minecraft.world.level.Level;
public class AssemblyOperatorUseContext extends BlockItemUseContext { public class AssemblyOperatorUseContext extends BlockPlaceContext {
public AssemblyOperatorUseContext(World p_i50056_1_, @Nullable PlayerEntity p_i50056_2_, Hand p_i50056_3_, ItemStack p_i50056_4_, BlockRayTraceResult p_i50056_5_) { public AssemblyOperatorUseContext(Level p_i50056_1_, @Nullable Player p_i50056_2_, InteractionHand p_i50056_3_, ItemStack p_i50056_4_, BlockHitResult p_i50056_5_) {
super(p_i50056_1_, p_i50056_2_, p_i50056_3_, p_i50056_4_, p_i50056_5_); super(p_i50056_1_, p_i50056_2_, p_i50056_3_, p_i50056_4_, p_i50056_5_);
} }
} }

View file

@ -3,9 +3,9 @@ package com.simibubi.create.content.contraptions.components.actors;
import com.jozufozu.flywheel.backend.gl.buffer.VecBuffer; import com.jozufozu.flywheel.backend.gl.buffer.VecBuffer;
import com.jozufozu.flywheel.backend.instancing.InstanceData; import com.jozufozu.flywheel.backend.instancing.InstanceData;
import net.minecraft.util.math.BlockPos; import net.minecraft.core.BlockPos;
import net.minecraft.util.math.vector.Quaternion; import com.mojang.math.Quaternion;
import net.minecraft.util.math.vector.Vector3f; import com.mojang.math.Vector3f;
public class ActorData extends InstanceData { public class ActorData extends InstanceData {
private float x; private float x;

View file

@ -7,36 +7,38 @@ import com.simibubi.create.content.contraptions.wrench.IWrenchable;
import com.simibubi.create.foundation.utility.BlockHelper; import com.simibubi.create.foundation.utility.BlockHelper;
import mcp.MethodsReturnNonnullByDefault; import mcp.MethodsReturnNonnullByDefault;
import net.minecraft.block.Block; import net.minecraft.world.level.block.Block;
import net.minecraft.block.BlockState; import net.minecraft.world.level.block.state.BlockState;
import net.minecraft.block.HorizontalBlock; import net.minecraft.world.level.block.HorizontalDirectionalBlock;
import net.minecraft.item.BlockItemUseContext; import net.minecraft.world.item.context.BlockPlaceContext;
import net.minecraft.item.ItemUseContext; import net.minecraft.world.item.context.UseOnContext;
import net.minecraft.pathfinding.PathType; import net.minecraft.world.level.pathfinder.PathComputationType;
import net.minecraft.state.StateContainer.Builder; import net.minecraft.world.level.block.state.StateDefinition.Builder;
import net.minecraft.util.ActionResultType; import net.minecraft.world.InteractionResult;
import net.minecraft.util.Direction; import net.minecraft.core.Direction;
import net.minecraft.util.math.BlockPos; import net.minecraft.core.BlockPos;
import net.minecraft.util.math.shapes.ISelectionContext; import net.minecraft.world.phys.shapes.CollisionContext;
import net.minecraft.util.math.shapes.VoxelShape; import net.minecraft.world.phys.shapes.VoxelShape;
import net.minecraft.world.IBlockReader; import net.minecraft.world.level.BlockGetter;
import net.minecraft.world.IWorldReader; import net.minecraft.world.level.LevelReader;
import net.minecraft.world.level.block.state.BlockBehaviour.Properties;
@ParametersAreNonnullByDefault @ParametersAreNonnullByDefault
@MethodsReturnNonnullByDefault @MethodsReturnNonnullByDefault
public abstract class AttachedActorBlock extends HorizontalBlock implements IWrenchable { public abstract class AttachedActorBlock extends HorizontalDirectionalBlock implements IWrenchable {
protected AttachedActorBlock(Properties p_i48377_1_) { protected AttachedActorBlock(Properties p_i48377_1_) {
super(p_i48377_1_); super(p_i48377_1_);
} }
@Override @Override
public ActionResultType onWrenched(BlockState state, ItemUseContext context) { public InteractionResult onWrenched(BlockState state, UseOnContext context) {
return ActionResultType.FAIL; return InteractionResult.FAIL;
} }
@Override @Override
public VoxelShape getShape(BlockState state, IBlockReader worldIn, BlockPos pos, ISelectionContext context) { public VoxelShape getShape(BlockState state, BlockGetter worldIn, BlockPos pos, CollisionContext context) {
Direction direction = state.getValue(FACING); Direction direction = state.getValue(FACING);
return AllShapes.HARVESTER_BASE.get(direction); return AllShapes.HARVESTER_BASE.get(direction);
} }
@ -48,14 +50,14 @@ public abstract class AttachedActorBlock extends HorizontalBlock implements IWre
} }
@Override @Override
public boolean canSurvive(BlockState state, IWorldReader worldIn, BlockPos pos) { public boolean canSurvive(BlockState state, LevelReader worldIn, BlockPos pos) {
Direction direction = state.getValue(FACING); Direction direction = state.getValue(FACING);
BlockPos offset = pos.relative(direction.getOpposite()); BlockPos offset = pos.relative(direction.getOpposite());
return BlockHelper.hasBlockSolidSide(worldIn.getBlockState(offset), worldIn, offset, direction); return BlockHelper.hasBlockSolidSide(worldIn.getBlockState(offset), worldIn, offset, direction);
} }
@Override @Override
public BlockState getStateForPlacement(BlockItemUseContext context) { public BlockState getStateForPlacement(BlockPlaceContext context) {
Direction facing; Direction facing;
if (context.getClickedFace().getAxis().isVertical()) if (context.getClickedFace().getAxis().isVertical())
facing = context.getHorizontalDirection().getOpposite(); facing = context.getHorizontalDirection().getOpposite();
@ -71,7 +73,7 @@ public abstract class AttachedActorBlock extends HorizontalBlock implements IWre
} }
@Override @Override
public boolean isPathfindable(BlockState state, IBlockReader reader, BlockPos pos, PathType type) { public boolean isPathfindable(BlockState state, BlockGetter reader, BlockPos pos, PathComputationType type) {
return false; return false;
} }

View file

@ -4,12 +4,12 @@ import com.simibubi.create.content.contraptions.components.structureMovement.Mov
import com.simibubi.create.content.contraptions.components.structureMovement.MovementContext; import com.simibubi.create.content.contraptions.components.structureMovement.MovementContext;
import com.simibubi.create.content.curiosities.bell.AbstractBellBlock; import com.simibubi.create.content.curiosities.bell.AbstractBellBlock;
import net.minecraft.block.Block; import net.minecraft.world.level.block.Block;
import net.minecraft.util.SoundCategory; import net.minecraft.sounds.SoundSource;
import net.minecraft.util.SoundEvents; import net.minecraft.sounds.SoundEvents;
import net.minecraft.util.math.BlockPos; import net.minecraft.core.BlockPos;
import net.minecraft.util.math.vector.Vector3d; import net.minecraft.world.phys.Vec3;
import net.minecraft.world.World; import net.minecraft.world.level.Level;
public class BellMovementBehaviour extends MovementBehaviour { public class BellMovementBehaviour extends MovementBehaviour {
@ -19,7 +19,7 @@ public class BellMovementBehaviour extends MovementBehaviour {
} }
@Override @Override
public void onSpeedChanged(MovementContext context, Vector3d oldMotion, Vector3d motion) { public void onSpeedChanged(MovementContext context, Vec3 oldMotion, Vec3 motion) {
double dotProduct = oldMotion.dot(motion); double dotProduct = oldMotion.dot(motion);
if (dotProduct <= 0 && (context.relativeMotion.length() != 0) || context.firstMovement) if (dotProduct <= 0 && (context.relativeMotion.length() != 0) || context.firstMovement)
@ -33,7 +33,7 @@ public class BellMovementBehaviour extends MovementBehaviour {
} }
public static void playSound(MovementContext context) { public static void playSound(MovementContext context) {
World world = context.world; Level world = context.world;
BlockPos pos = new BlockPos(context.position); BlockPos pos = new BlockPos(context.position);
Block block = context.state.getBlock(); Block block = context.state.getBlock();
@ -42,7 +42,7 @@ public class BellMovementBehaviour extends MovementBehaviour {
} else { } else {
// Vanilla bell sound // Vanilla bell sound
world.playSound(null, pos, SoundEvents.BELL_BLOCK, world.playSound(null, pos, SoundEvents.BELL_BLOCK,
SoundCategory.BLOCKS, 2f, 1f); SoundSource.BLOCKS, 2f, 1f);
} }
} }
} }

View file

@ -5,22 +5,22 @@ import java.util.concurrent.atomic.AtomicInteger;
import com.simibubi.create.content.contraptions.base.KineticTileEntity; import com.simibubi.create.content.contraptions.base.KineticTileEntity;
import com.simibubi.create.foundation.utility.VecHelper; import com.simibubi.create.foundation.utility.VecHelper;
import net.minecraft.block.AirBlock; import net.minecraft.world.level.block.AirBlock;
import net.minecraft.block.Block; import net.minecraft.world.level.block.Block;
import net.minecraft.block.BlockState; import net.minecraft.world.level.block.state.BlockState;
import net.minecraft.entity.item.ItemEntity; import net.minecraft.world.entity.item.ItemEntity;
import net.minecraft.fluid.FluidState; import net.minecraft.world.level.material.FluidState;
import net.minecraft.item.ItemStack; import net.minecraft.world.item.ItemStack;
import net.minecraft.nbt.CompoundNBT; import net.minecraft.nbt.CompoundTag;
import net.minecraft.nbt.NBTUtil; import net.minecraft.nbt.NbtUtils;
import net.minecraft.tileentity.TileEntity; import net.minecraft.world.level.block.entity.BlockEntity;
import net.minecraft.tileentity.TileEntityType; import net.minecraft.world.level.block.entity.BlockEntityType;
import net.minecraft.util.SoundCategory; import net.minecraft.sounds.SoundSource;
import net.minecraft.util.math.BlockPos; import net.minecraft.core.BlockPos;
import net.minecraft.util.math.MathHelper; import net.minecraft.util.Mth;
import net.minecraft.util.math.vector.Vector3d; import net.minecraft.world.phys.Vec3;
import net.minecraft.world.GameRules; import net.minecraft.world.level.GameRules;
import net.minecraft.world.server.ServerWorld; import net.minecraft.server.level.ServerLevel;
public abstract class BlockBreakingKineticTileEntity extends KineticTileEntity { public abstract class BlockBreakingKineticTileEntity extends KineticTileEntity {
@ -30,7 +30,7 @@ public abstract class BlockBreakingKineticTileEntity extends KineticTileEntity {
protected int breakerId = -NEXT_BREAKER_ID.incrementAndGet(); protected int breakerId = -NEXT_BREAKER_ID.incrementAndGet();
protected BlockPos breakingPos; protected BlockPos breakingPos;
public BlockBreakingKineticTileEntity(TileEntityType<?> typeIn) { public BlockBreakingKineticTileEntity(BlockEntityType<?> typeIn) {
super(typeIn); super(typeIn);
} }
@ -59,20 +59,20 @@ public abstract class BlockBreakingKineticTileEntity extends KineticTileEntity {
} }
@Override @Override
public void write(CompoundNBT compound, boolean clientPacket) { public void write(CompoundTag compound, boolean clientPacket) {
compound.putInt("Progress", destroyProgress); compound.putInt("Progress", destroyProgress);
compound.putInt("NextTick", ticksUntilNextProgress); compound.putInt("NextTick", ticksUntilNextProgress);
if (breakingPos != null) if (breakingPos != null)
compound.put("Breaking", NBTUtil.writeBlockPos(breakingPos)); compound.put("Breaking", NbtUtils.writeBlockPos(breakingPos));
super.write(compound, clientPacket); super.write(compound, clientPacket);
} }
@Override @Override
protected void fromTag(BlockState state, CompoundNBT compound, boolean clientPacket) { protected void fromTag(BlockState state, CompoundTag compound, boolean clientPacket) {
destroyProgress = compound.getInt("Progress"); destroyProgress = compound.getInt("Progress");
ticksUntilNextProgress = compound.getInt("NextTick"); ticksUntilNextProgress = compound.getInt("NextTick");
if (compound.contains("Breaking")) if (compound.contains("Breaking"))
breakingPos = NBTUtil.readBlockPos(compound.getCompound("Breaking")); breakingPos = NbtUtils.readBlockPos(compound.getCompound("Breaking"));
super.fromTag(state, compound, clientPacket); super.fromTag(state, compound, clientPacket);
} }
@ -113,8 +113,8 @@ public abstract class BlockBreakingKineticTileEntity extends KineticTileEntity {
} }
float breakSpeed = getBreakSpeed(); float breakSpeed = getBreakSpeed();
destroyProgress += MathHelper.clamp((int) (breakSpeed / blockHardness), 1, 10 - destroyProgress); destroyProgress += Mth.clamp((int) (breakSpeed / blockHardness), 1, 10 - destroyProgress);
level.playSound(null, worldPosition, stateToBreak.getSoundType().getHitSound(), SoundCategory.NEUTRAL, .25f, 1); level.playSound(null, worldPosition, stateToBreak.getSoundType().getHitSound(), SoundSource.NEUTRAL, .25f, 1);
if (destroyProgress >= 10) { if (destroyProgress >= 10) {
onBlockBroken(stateToBreak); onBlockBroken(stateToBreak);
@ -140,20 +140,20 @@ public abstract class BlockBreakingKineticTileEntity extends KineticTileEntity {
public void onBlockBroken(BlockState stateToBreak) { public void onBlockBroken(BlockState stateToBreak) {
FluidState FluidState = level.getFluidState(breakingPos); FluidState FluidState = level.getFluidState(breakingPos);
level.levelEvent(2001, breakingPos, Block.getId(stateToBreak)); level.levelEvent(2001, breakingPos, Block.getId(stateToBreak));
TileEntity tileentity = stateToBreak.hasTileEntity() ? level.getBlockEntity(breakingPos) : null; BlockEntity tileentity = stateToBreak.hasTileEntity() ? level.getBlockEntity(breakingPos) : null;
Vector3d vec = VecHelper.offsetRandomly(VecHelper.getCenterOf(breakingPos), level.random, .125f); Vec3 vec = VecHelper.offsetRandomly(VecHelper.getCenterOf(breakingPos), level.random, .125f);
Block.getDrops(stateToBreak, (ServerWorld) level, breakingPos, tileentity).forEach((stack) -> { Block.getDrops(stateToBreak, (ServerLevel) level, breakingPos, tileentity).forEach((stack) -> {
if (!stack.isEmpty() && level.getGameRules().getBoolean(GameRules.RULE_DOBLOCKDROPS) if (!stack.isEmpty() && level.getGameRules().getBoolean(GameRules.RULE_DOBLOCKDROPS)
&& !level.restoringBlockSnapshots) { && !level.restoringBlockSnapshots) {
ItemEntity itementity = new ItemEntity(level, vec.x, vec.y, vec.z, stack); ItemEntity itementity = new ItemEntity(level, vec.x, vec.y, vec.z, stack);
itementity.setDefaultPickUpDelay(); itementity.setDefaultPickUpDelay();
itementity.setDeltaMovement(Vector3d.ZERO); itementity.setDeltaMovement(Vec3.ZERO);
level.addFreshEntity(itementity); level.addFreshEntity(itementity);
} }
}); });
if (level instanceof ServerWorld) if (level instanceof ServerLevel)
stateToBreak.spawnAfterBreak((ServerWorld) level, breakingPos, ItemStack.EMPTY); stateToBreak.spawnAfterBreak((ServerLevel) level, breakingPos, ItemStack.EMPTY);
level.setBlock(breakingPos, FluidState.createLegacyBlock(), 3); level.setBlock(breakingPos, FluidState.createLegacyBlock(), 3);
} }

Some files were not shown because too many files have changed in this diff Show more