mirror of
https://github.com/Ellpeck/ActuallyAdditions.git
synced 2024-11-23 23:58:34 +01:00
Unfinished port to 1.20.4 Neo
This commit is contained in:
parent
97532fff5b
commit
63fbbb334e
227 changed files with 2271 additions and 3043 deletions
1
.gitignore
vendored
1
.gitignore
vendored
|
@ -12,6 +12,7 @@
|
||||||
/classes
|
/classes
|
||||||
/bin/
|
/bin/
|
||||||
/run/
|
/run/
|
||||||
|
/runs/
|
||||||
|
|
||||||
*.classpath
|
*.classpath
|
||||||
*.project
|
*.project
|
||||||
|
|
95
build.gradle
95
build.gradle
|
@ -1,9 +1,9 @@
|
||||||
plugins {
|
plugins {
|
||||||
|
id 'java-library'
|
||||||
id 'eclipse'
|
id 'eclipse'
|
||||||
id 'idea'
|
id 'idea'
|
||||||
id 'maven-publish'
|
id 'maven-publish'
|
||||||
id 'net.minecraftforge.gradle' version '[6.0,6.2)'
|
id 'net.neoforged.gradle.userdev' version '7.0.96'
|
||||||
id 'org.parchmentmc.librarian.forgegradle' version '1.+'
|
|
||||||
}
|
}
|
||||||
|
|
||||||
version = "$mod_version"
|
version = "$mod_version"
|
||||||
|
@ -16,44 +16,49 @@ if (System.getenv('BUILD_NUMBER') != null) {
|
||||||
version += "." + System.getenv('BUILD_NUMBER')
|
version += "." + System.getenv('BUILD_NUMBER')
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// Mojang ships Java 17 to end users in 1.18+, so your mod should target Java 17.
|
||||||
java.toolchain.languageVersion = JavaLanguageVersion.of(17)
|
java.toolchain.languageVersion = JavaLanguageVersion.of(17)
|
||||||
|
|
||||||
minecraft {
|
if (rootProject.file('src/main/resources/META-INF/accesstransformer.cfg').exists()) {
|
||||||
mappings channel: 'parchment', version: "${parchment_version}-${game_version}"
|
minecraft.accessTransformers.file rootProject.file('src/main/resources/META-INF/accesstransformer.cfg')
|
||||||
// makeObfSourceJar = false // an Srg named sources jar is made by default. uncomment this to disable.
|
}
|
||||||
|
//minecraft.accessTransformers.entry public net.minecraft.client.Minecraft textureManager # textureManager
|
||||||
|
|
||||||
accessTransformer = file('src/main/resources/META-INF/accesstransformer.cfg')
|
runs {
|
||||||
|
// applies to all the run configs below
|
||||||
|
configureEach { net.neoforged.gradle.dsl.common.runs.run.Run run ->
|
||||||
|
// Recommended logging data for a userdev environment
|
||||||
|
systemProperty 'forge.logging.markers', 'REGISTRIES'
|
||||||
|
|
||||||
runs {
|
// Recommended logging level for the console
|
||||||
client {
|
systemProperty 'forge.logging.console.level', 'debug'
|
||||||
workingDirectory project.file('run')
|
|
||||||
|
//Limit ram usage for the dev environment to 4GB
|
||||||
mods {
|
jvmArgument '-Xmx4G'
|
||||||
actuallyadditions {
|
|
||||||
source sourceSets.main
|
if (run.project.javaToolchains.launcherFor(java.toolchain).map { it.metadata.vendor }.getOrElse("").contains("JetBrains")) {
|
||||||
}
|
run.jvmArgument("-XX:+AllowEnhancedClassRedefinition")
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
server {
|
modSource project.sourceSets.main
|
||||||
workingDirectory project.file('run')
|
}
|
||||||
mods {
|
|
||||||
actuallyadditions {
|
|
||||||
source sourceSets.main
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
data {
|
client {
|
||||||
workingDirectory project.file('run')
|
// Comma-separated list of namespaces to load gametests from. Empty = all namespaces.
|
||||||
args '--mod', 'actuallyadditions', '--all', '--output', file('src/generated/resources/'), '--existing', file('src/main/resources/')
|
systemProperty 'neoforge.enabledGameTestNamespaces', "actuallyadditions"
|
||||||
|
}
|
||||||
|
|
||||||
mods {
|
server {
|
||||||
actuallyadditions {
|
systemProperty 'neoforge.enabledGameTestNamespaces', "actuallyadditions"
|
||||||
source sourceSets.main
|
programArgument '--nogui'
|
||||||
}
|
}
|
||||||
}
|
|
||||||
}
|
data {
|
||||||
|
// example of overriding the workingDirectory set in configureEach above, uncomment if you want to use it
|
||||||
|
// workingDirectory project.file('run-data')
|
||||||
|
|
||||||
|
// Specify the modid for data generation, where to output the resulting resource, and where to look for existing resources.
|
||||||
|
programArguments.addAll '--mod', "actuallyadditions", '--all', '--output', file('src/generated/resources/').getAbsolutePath(), '--existing', file('src/main/resources/').getAbsolutePath()
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -64,20 +69,23 @@ repositories {
|
||||||
url = "https://maven.blamejared.com"
|
url = "https://maven.blamejared.com"
|
||||||
}
|
}
|
||||||
maven {
|
maven {
|
||||||
url = "https://www.cursemaven.com"
|
url "https://cursemaven.com"
|
||||||
|
content {
|
||||||
|
includeGroup "curse.maven"
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
dependencies {
|
dependencies {
|
||||||
minecraft "net.minecraftforge:forge:${game_version}-${forge_version}"
|
implementation "net.neoforged:neoforge:${neo_version}"
|
||||||
|
|
||||||
compileOnly fg.deobf("mezz.jei:jei-${game_version}-common-api:${jei_version}")
|
compileOnly "mezz.jei:jei-${game_version}-common-api:${jei_version}"
|
||||||
compileOnly fg.deobf("mezz.jei:jei-${game_version}-forge-api:${jei_version}")
|
compileOnly "mezz.jei:jei-${game_version}-neoforge-api:${jei_version}"
|
||||||
|
|
||||||
runtimeOnly fg.deobf("mezz.jei:jei-${game_version}-forge:${jei_version}")
|
runtimeOnly "mezz.jei:jei-${game_version}-neoforge:${jei_version}"
|
||||||
|
|
||||||
runtimeOnly fg.deobf("curse.maven:the-one-probe-245211:4629624")
|
runtimeOnly "curse.maven:the-one-probe-245211:5084077"
|
||||||
runtimeOnly fg.deobf("curse.maven:mekanism-268560:5125665")
|
runtimeOnly "curse.maven:mekanism-268560:5155329"
|
||||||
}
|
}
|
||||||
|
|
||||||
// not sure if this is still needed
|
// not sure if this is still needed
|
||||||
|
@ -107,12 +115,6 @@ jar {
|
||||||
from sourceSets.main.output
|
from sourceSets.main.output
|
||||||
}
|
}
|
||||||
|
|
||||||
task deobfJar(type: Jar) {
|
|
||||||
from sourceSets.main.output
|
|
||||||
from sourceSets.main.java
|
|
||||||
archiveClassifier.set('dev')
|
|
||||||
}
|
|
||||||
|
|
||||||
task apiJar(type: Jar) {
|
task apiJar(type: Jar) {
|
||||||
from sourceSets.main.output
|
from sourceSets.main.output
|
||||||
from sourceSets.main.java
|
from sourceSets.main.java
|
||||||
|
@ -135,7 +137,7 @@ task sourcesJar(type: Jar) {
|
||||||
}
|
}
|
||||||
|
|
||||||
artifacts {
|
artifacts {
|
||||||
archives deobfJar, sourcesJar, apiJar, javadocJar
|
archives sourcesJar, apiJar, javadocJar
|
||||||
}
|
}
|
||||||
|
|
||||||
publishing {
|
publishing {
|
||||||
|
@ -148,7 +150,6 @@ publishing {
|
||||||
|
|
||||||
from components.java
|
from components.java
|
||||||
|
|
||||||
artifact deobfJar
|
|
||||||
artifact sourcesJar
|
artifact sourcesJar
|
||||||
artifact apiJar
|
artifact apiJar
|
||||||
artifact javadocJar
|
artifact javadocJar
|
||||||
|
|
|
@ -6,11 +6,12 @@ org.gradle.daemon=false
|
||||||
mod_version=1.1.52
|
mod_version=1.1.52
|
||||||
|
|
||||||
# Forge
|
# Forge
|
||||||
game_version=1.20.1
|
game_version=1.20.4
|
||||||
forge_version=47.1.3
|
neo_version=20.4.190
|
||||||
|
|
||||||
# Parchment (Mappings)
|
# Parchment (Mappings)
|
||||||
parchment_version=2023.09.03
|
neogradle.subsystems.parchment.minecraftVersion=1.20.4
|
||||||
|
neogradle.subsystems.parchment.mappingsVersion=2024.02.25
|
||||||
|
|
||||||
# Other mods
|
# Other mods
|
||||||
jei_version=15.3.0.4
|
jei_version=17.3.0.49
|
||||||
|
|
BIN
gradle/wrapper/gradle-wrapper.jar
vendored
BIN
gradle/wrapper/gradle-wrapper.jar
vendored
Binary file not shown.
3
gradle/wrapper/gradle-wrapper.properties
vendored
3
gradle/wrapper/gradle-wrapper.properties
vendored
|
@ -1,6 +1,7 @@
|
||||||
distributionBase=GRADLE_USER_HOME
|
distributionBase=GRADLE_USER_HOME
|
||||||
distributionPath=wrapper/dists
|
distributionPath=wrapper/dists
|
||||||
distributionUrl=https\://services.gradle.org/distributions/gradle-8.1.1-bin.zip
|
distributionUrl=https\://services.gradle.org/distributions/gradle-8.6-bin.zip
|
||||||
networkTimeout=10000
|
networkTimeout=10000
|
||||||
|
validateDistributionUrl=true
|
||||||
zipStoreBase=GRADLE_USER_HOME
|
zipStoreBase=GRADLE_USER_HOME
|
||||||
zipStorePath=wrapper/dists
|
zipStorePath=wrapper/dists
|
||||||
|
|
29
gradlew
vendored
29
gradlew
vendored
|
@ -83,10 +83,8 @@ done
|
||||||
# This is normally unused
|
# This is normally unused
|
||||||
# shellcheck disable=SC2034
|
# shellcheck disable=SC2034
|
||||||
APP_BASE_NAME=${0##*/}
|
APP_BASE_NAME=${0##*/}
|
||||||
APP_HOME=$( cd "${APP_HOME:-./}" && pwd -P ) || exit
|
# Discard cd standard output in case $CDPATH is set (https://github.com/gradle/gradle/issues/25036)
|
||||||
|
APP_HOME=$( cd "${APP_HOME:-./}" > /dev/null && pwd -P ) || exit
|
||||||
# Add default JVM options here. You can also use JAVA_OPTS and GRADLE_OPTS to pass JVM options to this script.
|
|
||||||
DEFAULT_JVM_OPTS='"-Xmx64m" "-Xms64m"'
|
|
||||||
|
|
||||||
# Use the maximum available, or set MAX_FD != -1 to use that value.
|
# Use the maximum available, or set MAX_FD != -1 to use that value.
|
||||||
MAX_FD=maximum
|
MAX_FD=maximum
|
||||||
|
@ -133,10 +131,13 @@ location of your Java installation."
|
||||||
fi
|
fi
|
||||||
else
|
else
|
||||||
JAVACMD=java
|
JAVACMD=java
|
||||||
which java >/dev/null 2>&1 || die "ERROR: JAVA_HOME is not set and no 'java' command could be found in your PATH.
|
if ! command -v java >/dev/null 2>&1
|
||||||
|
then
|
||||||
|
die "ERROR: JAVA_HOME is not set and no 'java' command could be found in your PATH.
|
||||||
|
|
||||||
Please set the JAVA_HOME variable in your environment to match the
|
Please set the JAVA_HOME variable in your environment to match the
|
||||||
location of your Java installation."
|
location of your Java installation."
|
||||||
|
fi
|
||||||
fi
|
fi
|
||||||
|
|
||||||
# Increase the maximum file descriptors if we can.
|
# Increase the maximum file descriptors if we can.
|
||||||
|
@ -144,7 +145,7 @@ if ! "$cygwin" && ! "$darwin" && ! "$nonstop" ; then
|
||||||
case $MAX_FD in #(
|
case $MAX_FD in #(
|
||||||
max*)
|
max*)
|
||||||
# In POSIX sh, ulimit -H is undefined. That's why the result is checked to see if it worked.
|
# In POSIX sh, ulimit -H is undefined. That's why the result is checked to see if it worked.
|
||||||
# shellcheck disable=SC3045
|
# shellcheck disable=SC2039,SC3045
|
||||||
MAX_FD=$( ulimit -H -n ) ||
|
MAX_FD=$( ulimit -H -n ) ||
|
||||||
warn "Could not query maximum file descriptor limit"
|
warn "Could not query maximum file descriptor limit"
|
||||||
esac
|
esac
|
||||||
|
@ -152,7 +153,7 @@ if ! "$cygwin" && ! "$darwin" && ! "$nonstop" ; then
|
||||||
'' | soft) :;; #(
|
'' | soft) :;; #(
|
||||||
*)
|
*)
|
||||||
# In POSIX sh, ulimit -n is undefined. That's why the result is checked to see if it worked.
|
# In POSIX sh, ulimit -n is undefined. That's why the result is checked to see if it worked.
|
||||||
# shellcheck disable=SC3045
|
# shellcheck disable=SC2039,SC3045
|
||||||
ulimit -n "$MAX_FD" ||
|
ulimit -n "$MAX_FD" ||
|
||||||
warn "Could not set maximum file descriptor limit to $MAX_FD"
|
warn "Could not set maximum file descriptor limit to $MAX_FD"
|
||||||
esac
|
esac
|
||||||
|
@ -197,11 +198,15 @@ if "$cygwin" || "$msys" ; then
|
||||||
done
|
done
|
||||||
fi
|
fi
|
||||||
|
|
||||||
# Collect all arguments for the java command;
|
|
||||||
# * $DEFAULT_JVM_OPTS, $JAVA_OPTS, and $GRADLE_OPTS can contain fragments of
|
# Add default JVM options here. You can also use JAVA_OPTS and GRADLE_OPTS to pass JVM options to this script.
|
||||||
# shell script including quotes and variable substitutions, so put them in
|
DEFAULT_JVM_OPTS='"-Xmx64m" "-Xms64m"'
|
||||||
# double quotes to make sure that they get re-expanded; and
|
|
||||||
# * put everything else in single quotes, so that it's not re-expanded.
|
# Collect all arguments for the java command:
|
||||||
|
# * DEFAULT_JVM_OPTS, JAVA_OPTS, JAVA_OPTS, and optsEnvironmentVar are not allowed to contain shell fragments,
|
||||||
|
# and any embedded shellness will be escaped.
|
||||||
|
# * For example: A user cannot expect ${Hostname} to be expanded, as it is an environment variable and will be
|
||||||
|
# treated as '${Hostname}' itself on the command line.
|
||||||
|
|
||||||
set -- \
|
set -- \
|
||||||
"-Dorg.gradle.appname=$APP_BASE_NAME" \
|
"-Dorg.gradle.appname=$APP_BASE_NAME" \
|
||||||
|
|
20
gradlew.bat
vendored
20
gradlew.bat
vendored
|
@ -43,11 +43,11 @@ set JAVA_EXE=java.exe
|
||||||
%JAVA_EXE% -version >NUL 2>&1
|
%JAVA_EXE% -version >NUL 2>&1
|
||||||
if %ERRORLEVEL% equ 0 goto execute
|
if %ERRORLEVEL% equ 0 goto execute
|
||||||
|
|
||||||
echo.
|
echo. 1>&2
|
||||||
echo ERROR: JAVA_HOME is not set and no 'java' command could be found in your PATH.
|
echo ERROR: JAVA_HOME is not set and no 'java' command could be found in your PATH. 1>&2
|
||||||
echo.
|
echo. 1>&2
|
||||||
echo Please set the JAVA_HOME variable in your environment to match the
|
echo Please set the JAVA_HOME variable in your environment to match the 1>&2
|
||||||
echo location of your Java installation.
|
echo location of your Java installation. 1>&2
|
||||||
|
|
||||||
goto fail
|
goto fail
|
||||||
|
|
||||||
|
@ -57,11 +57,11 @@ set JAVA_EXE=%JAVA_HOME%/bin/java.exe
|
||||||
|
|
||||||
if exist "%JAVA_EXE%" goto execute
|
if exist "%JAVA_EXE%" goto execute
|
||||||
|
|
||||||
echo.
|
echo. 1>&2
|
||||||
echo ERROR: JAVA_HOME is set to an invalid directory: %JAVA_HOME%
|
echo ERROR: JAVA_HOME is set to an invalid directory: %JAVA_HOME% 1>&2
|
||||||
echo.
|
echo. 1>&2
|
||||||
echo Please set the JAVA_HOME variable in your environment to match the
|
echo Please set the JAVA_HOME variable in your environment to match the 1>&2
|
||||||
echo location of your Java installation.
|
echo location of your Java installation. 1>&2
|
||||||
|
|
||||||
goto fail
|
goto fail
|
||||||
|
|
||||||
|
|
|
@ -2,13 +2,12 @@ pluginManagement {
|
||||||
repositories {
|
repositories {
|
||||||
gradlePluginPortal()
|
gradlePluginPortal()
|
||||||
maven {
|
maven {
|
||||||
name = 'MinecraftForge'
|
name = 'Official NeoForge Maven'
|
||||||
url = 'https://maven.minecraftforge.net/'
|
url = 'https://maven.neoforged.net/releases'
|
||||||
}
|
}
|
||||||
maven { url = 'https://maven.parchmentmc.org' }
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
plugins {
|
plugins {
|
||||||
id 'org.gradle.toolchains.foojay-resolver-convention' version '0.5.0'
|
id 'org.gradle.toolchains.foojay-resolver-convention' version '0.8.0'
|
||||||
}
|
}
|
||||||
|
|
|
@ -20,6 +20,7 @@ import de.ellpeck.actuallyadditions.api.lens.Lens;
|
||||||
import de.ellpeck.actuallyadditions.api.lens.LensConversion;
|
import de.ellpeck.actuallyadditions.api.lens.LensConversion;
|
||||||
import de.ellpeck.actuallyadditions.api.recipe.CoffeeIngredient;
|
import de.ellpeck.actuallyadditions.api.recipe.CoffeeIngredient;
|
||||||
import de.ellpeck.actuallyadditions.api.recipe.WeightedOre;
|
import de.ellpeck.actuallyadditions.api.recipe.WeightedOre;
|
||||||
|
import de.ellpeck.actuallyadditions.mod.ActuallyAdditions;
|
||||||
import de.ellpeck.actuallyadditions.mod.crafting.ColorChangeRecipe;
|
import de.ellpeck.actuallyadditions.mod.crafting.ColorChangeRecipe;
|
||||||
import de.ellpeck.actuallyadditions.mod.crafting.CrushingRecipe;
|
import de.ellpeck.actuallyadditions.mod.crafting.CrushingRecipe;
|
||||||
import de.ellpeck.actuallyadditions.mod.crafting.EmpowererRecipe;
|
import de.ellpeck.actuallyadditions.mod.crafting.EmpowererRecipe;
|
||||||
|
@ -35,9 +36,12 @@ import de.ellpeck.actuallyadditions.mod.items.lens.LensDetonation;
|
||||||
import de.ellpeck.actuallyadditions.mod.items.lens.LensDisenchanting;
|
import de.ellpeck.actuallyadditions.mod.items.lens.LensDisenchanting;
|
||||||
import de.ellpeck.actuallyadditions.mod.items.lens.LensKiller;
|
import de.ellpeck.actuallyadditions.mod.items.lens.LensKiller;
|
||||||
import de.ellpeck.actuallyadditions.mod.items.lens.LensMining;
|
import de.ellpeck.actuallyadditions.mod.items.lens.LensMining;
|
||||||
|
import net.minecraft.core.NonNullList;
|
||||||
|
import net.minecraft.core.registries.BuiltInRegistries;
|
||||||
import net.minecraft.resources.ResourceLocation;
|
import net.minecraft.resources.ResourceLocation;
|
||||||
import net.minecraft.world.item.ItemStack;
|
import net.minecraft.world.item.ItemStack;
|
||||||
import net.minecraft.world.item.crafting.Ingredient;
|
import net.minecraft.world.item.crafting.Ingredient;
|
||||||
|
import net.minecraft.world.item.crafting.RecipeHolder;
|
||||||
|
|
||||||
import java.util.ArrayList;
|
import java.util.ArrayList;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
|
@ -48,15 +52,15 @@ public final class ActuallyAdditionsAPI {
|
||||||
public static final String API_ID = MOD_ID + "api";
|
public static final String API_ID = MOD_ID + "api";
|
||||||
public static final String API_VERSION = "34";
|
public static final String API_VERSION = "34";
|
||||||
|
|
||||||
public static final List<CrushingRecipe> CRUSHER_RECIPES = new ArrayList<>();
|
public static final List<RecipeHolder<CrushingRecipe>> CRUSHER_RECIPES = new ArrayList<>();
|
||||||
public static final List<EmpowererRecipe> EMPOWERER_RECIPES = new ArrayList<>();
|
public static final List<RecipeHolder<EmpowererRecipe>> EMPOWERER_RECIPES = new ArrayList<>();
|
||||||
public static final List<ColorChangeRecipe> COLOR_CHANGE_RECIPES = new ArrayList<>();
|
public static final List<RecipeHolder<ColorChangeRecipe>> COLOR_CHANGE_RECIPES = new ArrayList<>();
|
||||||
public static final List<SolidFuelRecipe> SOLID_FUEL_RECIPES = new ArrayList<>();
|
public static final List<RecipeHolder<SolidFuelRecipe>> SOLID_FUEL_RECIPES = new ArrayList<>();
|
||||||
public static final List<LiquidFuelRecipe> LIQUID_FUEL_RECIPES = new ArrayList<>();
|
public static final List<RecipeHolder<LiquidFuelRecipe>> LIQUID_FUEL_RECIPES = new ArrayList<>();
|
||||||
public static final List<PressingRecipe> PRESSING_RECIPES = new ArrayList<>();
|
public static final List<RecipeHolder<PressingRecipe>> PRESSING_RECIPES = new ArrayList<>();
|
||||||
public static final List<FermentingRecipe> FERMENTING_RECIPES = new ArrayList<>();
|
public static final List<RecipeHolder<FermentingRecipe>> FERMENTING_RECIPES = new ArrayList<>();
|
||||||
public static final List<LaserRecipe> CONVERSION_LASER_RECIPES = new ArrayList<>();
|
public static final List<RecipeHolder<LaserRecipe>> CONVERSION_LASER_RECIPES = new ArrayList<>();
|
||||||
public static final List<MiningLensRecipe> MINING_LENS_RECIPES = new ArrayList<>();
|
public static final List<RecipeHolder<MiningLensRecipe>> MINING_LENS_RECIPES = new ArrayList<>();
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Farmer behaviors are sorted when first accessed, this will not be done until after loading, but do not add behaviors at runtime.
|
* Farmer behaviors are sorted when first accessed, this will not be done until after loading, but do not add behaviors at runtime.
|
||||||
|
@ -142,28 +146,30 @@ public final class ActuallyAdditionsAPI {
|
||||||
* Adds a Recipe to the Crusher Recipe Registry
|
* Adds a Recipe to the Crusher Recipe Registry
|
||||||
*
|
*
|
||||||
* @param input The input as an ItemStack
|
* @param input The input as an ItemStack
|
||||||
* @param outputOne The first output as an ItemStack
|
* @param outputOne The first stack as an ItemStack
|
||||||
* @param outputTwo The second output as an ItemStack (can be ItemStack.EMPTY if there should be none)
|
* @param outputTwo The second stack as an ItemStack (can be ItemStack.EMPTY if there should be none)
|
||||||
* @param outputTwoChance The chance of the second output (0 won't occur at all, 100 will all the time)
|
* @param outputTwoChance The chance of the second stack (0 won't occur at all, 100 will all the time)
|
||||||
*/
|
*/
|
||||||
public static void addCrusherRecipe(ItemStack input, ItemStack outputOne, ItemStack outputTwo, int outputTwoChance) {
|
public static void addCrusherRecipe(ItemStack input, ItemStack outputOne, ItemStack outputTwo, int outputTwoChance) {
|
||||||
CRUSHER_RECIPES.add(new CrushingRecipe(Ingredient.of(input), outputOne, 1.0f, outputTwo.isEmpty()
|
ResourceLocation id = new ResourceLocation(ActuallyAdditions.MODID, BuiltInRegistries.ITEM.getKey(input.getItem()).getPath() + "_crushing");
|
||||||
|
CRUSHER_RECIPES.add(new RecipeHolder<>(id, new CrushingRecipe(Ingredient.of(input), outputOne, 1.0f, outputTwo.isEmpty()
|
||||||
? ItemStack.EMPTY
|
? ItemStack.EMPTY
|
||||||
: outputTwo, outputTwoChance));
|
: outputTwo, outputTwoChance)));
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Adds a Recipe to the Crusher Recipe Registry
|
* Adds a Recipe to the Crusher Recipe Registry
|
||||||
*
|
*
|
||||||
* @param input The input as an Ingredient
|
* @param input The input as an Ingredient
|
||||||
* @param outputOne The first output as an ItemStack
|
* @param outputOne The first stack as an ItemStack
|
||||||
* @param outputTwo The second output as an ItemStack (can be ItemStack.EMPTY if there should be none)
|
* @param outputTwo The second stack as an ItemStack (can be ItemStack.EMPTY if there should be none)
|
||||||
* @param outputTwoChance The chance of the second output (0 won't occur at all, 100 will all the time)
|
* @param outputTwoChance The chance of the second stack (0 won't occur at all, 100 will all the time)
|
||||||
*/
|
*/
|
||||||
public static void addCrusherRecipe(Ingredient input, ItemStack outputOne, ItemStack outputTwo, int outputTwoChance) {
|
public static void addCrusherRecipe(Ingredient input, ItemStack outputOne, ItemStack outputTwo, int outputTwoChance) {
|
||||||
CRUSHER_RECIPES.add(new CrushingRecipe(input, outputOne, 1.0f, outputTwo.isEmpty()
|
ResourceLocation id = new ResourceLocation(ActuallyAdditions.MODID, BuiltInRegistries.ITEM.getKey(input.getItems()[0].getItem()).getPath() + "_crushing");
|
||||||
? ItemStack.EMPTY
|
CRUSHER_RECIPES.add(new RecipeHolder<>(id, new CrushingRecipe(input, outputOne, 1.0f, outputTwo.isEmpty()
|
||||||
: outputTwo, outputTwoChance));
|
? ItemStack.EMPTY
|
||||||
|
: outputTwo, outputTwoChance)));
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -172,10 +178,10 @@ public final class ActuallyAdditionsAPI {
|
||||||
*
|
*
|
||||||
* @param inputs The inputs as an ItemStack List, stacksizes are ignored
|
* @param inputs The inputs as an ItemStack List, stacksizes are ignored
|
||||||
* @param outputOnes The first outputs as an ItemStack List, stacksizes are ignored
|
* @param outputOnes The first outputs as an ItemStack List, stacksizes are ignored
|
||||||
* @param outputOneAmounts The amount of the first output, will be equal for all entries in the list
|
* @param outputOneAmounts The amount of the first stack, will be equal for all entries in the list
|
||||||
* @param outputTwos The second outputs as a List (can be null or empty if there should be none)
|
* @param outputTwos The second outputs as a List (can be null or empty if there should be none)
|
||||||
* @param outputTwoAmounts The amount of the second output, will be equal for all entries in the list
|
* @param outputTwoAmounts The amount of the second stack, will be equal for all entries in the list
|
||||||
* @param outputTwoChance The chance of the second output (0 won't occur at all, 100 will all the time)
|
* @param outputTwoChance The chance of the second stack (0 won't occur at all, 100 will all the time)
|
||||||
*/
|
*/
|
||||||
public static boolean addCrusherRecipes(List<ItemStack> inputs, List<ItemStack> outputOnes, int outputOneAmounts, List<ItemStack> outputTwos, int outputTwoAmounts, int outputTwoChance) {
|
public static boolean addCrusherRecipes(List<ItemStack> inputs, List<ItemStack> outputOnes, int outputOneAmounts, List<ItemStack> outputTwos, int outputTwoAmounts, int outputTwoChance) {
|
||||||
return methodHandler.addCrusherRecipes(inputs, outputOnes, outputOneAmounts, outputTwos, outputTwoAmounts, outputTwoChance);
|
return methodHandler.addCrusherRecipes(inputs, outputOnes, outputOneAmounts, outputTwos, outputTwoAmounts, outputTwoChance);
|
||||||
|
@ -188,7 +194,8 @@ public final class ActuallyAdditionsAPI {
|
||||||
}
|
}
|
||||||
|
|
||||||
public static void addEmpowererRecipe(ResourceLocation id, Ingredient input, ItemStack output, Ingredient modifier1, Ingredient modifier2, Ingredient modifier3, Ingredient modifier4, int energyPerStand, int time, int particleColor) {
|
public static void addEmpowererRecipe(ResourceLocation id, Ingredient input, ItemStack output, Ingredient modifier1, Ingredient modifier2, Ingredient modifier3, Ingredient modifier4, int energyPerStand, int time, int particleColor) {
|
||||||
EMPOWERER_RECIPES.add(new EmpowererRecipe(id, output, input, modifier1, modifier2, modifier3, modifier4, energyPerStand, time, particleColor));
|
EmpowererRecipe recipe = new EmpowererRecipe(output, input, NonNullList.of(modifier1, modifier2, modifier3, modifier4), energyPerStand, time, particleColor);
|
||||||
|
EMPOWERER_RECIPES.add(new RecipeHolder<>(id, recipe));
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -196,19 +203,19 @@ public final class ActuallyAdditionsAPI {
|
||||||
* StackSizes can only be 1 and greater ones will be ignored
|
* StackSizes can only be 1 and greater ones will be ignored
|
||||||
*
|
*
|
||||||
* @param input The input as an ItemStack
|
* @param input The input as an ItemStack
|
||||||
* @param output The output as an ItemStack
|
* @param output The stack as an ItemStack
|
||||||
* @param energyUse The amount of RF used per conversion
|
* @param energyUse The amount of RF used per conversion
|
||||||
* @param type The type of lens used for the conversion. To use the default type, use method below.
|
* @param type The type of lens used for the conversion. To use the default type, use method below.
|
||||||
* Note how this always has to be the same instance of the lens type that the item also has for it to work!
|
* Note how this always has to be the same instance of the lens type that the item also has for it to work!
|
||||||
*/
|
*/
|
||||||
@Deprecated
|
@Deprecated
|
||||||
public static void addReconstructorLensConversionRecipe(ItemStack input, ItemStack output, int energyUse, LensConversion type) {
|
public static void addReconstructorLensConversionRecipe(ItemStack input, ItemStack output, int energyUse, LensConversion type) {
|
||||||
//RECONSTRUCTOR_LENS_CONVERSION_RECIPES.add(new LensConversionRecipe(input, output, energyUse, type));
|
//RECONSTRUCTOR_LENS_CONVERSION_RECIPES.add(new LensConversionRecipe(input, stack, energyUse, type));
|
||||||
}
|
}
|
||||||
|
|
||||||
@Deprecated
|
@Deprecated
|
||||||
public static void addReconstructorLensConversionRecipe(ItemStack input, ItemStack output, int energyUse) {
|
public static void addReconstructorLensConversionRecipe(ItemStack input, ItemStack output, int energyUse) {
|
||||||
//addReconstructorLensConversionRecipe(input, output, energyUse, lensDefaultConversion);
|
//addReconstructorLensConversionRecipe(input, stack, energyUse, lensDefaultConversion);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -216,17 +223,17 @@ public final class ActuallyAdditionsAPI {
|
||||||
* StackSizes can only be 1 and greater ones will be ignored
|
* StackSizes can only be 1 and greater ones will be ignored
|
||||||
*
|
*
|
||||||
* @param input The input as an ItemStack
|
* @param input The input as an ItemStack
|
||||||
* @param output The output as an ItemStack
|
* @param output The stack as an ItemStack
|
||||||
* @param energyUse The amount of RF used per conversion
|
* @param energyUse The amount of RF used per conversion
|
||||||
* @param type The type of lens used for the conversion. To use the default type, use method below.
|
* @param type The type of lens used for the conversion. To use the default type, use method below.
|
||||||
* Note how this always has to be the same instance of the lens type that the item also has for it to work!
|
* Note how this always has to be the same instance of the lens type that the item also has for it to work!
|
||||||
*/
|
*/
|
||||||
public static void addReconstructorLensConversionRecipe(Ingredient input, ItemStack output, int energyUse, LensConversion type) {
|
public static void addReconstructorLensConversionRecipe(Ingredient input, ItemStack output, int energyUse, LensConversion type) {
|
||||||
//RECONSTRUCTOR_LENS_CONVERSION_RECIPES.add(new LensConversionRecipe(input, output, energyUse, type));
|
//RECONSTRUCTOR_LENS_CONVERSION_RECIPES.add(new LensConversionRecipe(input, stack, energyUse, type));
|
||||||
}
|
}
|
||||||
|
|
||||||
public static void addReconstructorLensConversionRecipe(Ingredient input, ItemStack output, int energyUse) {
|
public static void addReconstructorLensConversionRecipe(Ingredient input, ItemStack output, int energyUse) {
|
||||||
//addReconstructorLensConversionRecipe(input, output, energyUse, lensDefaultConversion);
|
//addReconstructorLensConversionRecipe(input, stack, energyUse, lensDefaultConversion);
|
||||||
}
|
}
|
||||||
/**
|
/**
|
||||||
* Adds an ingredient to the Coffee Machine ingredient list
|
* Adds an ingredient to the Coffee Machine ingredient list
|
||||||
|
|
|
@ -11,8 +11,8 @@
|
||||||
package de.ellpeck.actuallyadditions.api.booklet;
|
package de.ellpeck.actuallyadditions.api.booklet;
|
||||||
|
|
||||||
import net.minecraft.world.item.ItemStack;
|
import net.minecraft.world.item.ItemStack;
|
||||||
import net.minecraftforge.api.distmarker.Dist;
|
import net.neoforged.api.distmarker.Dist;
|
||||||
import net.minecraftforge.api.distmarker.OnlyIn;
|
import net.neoforged.api.distmarker.OnlyIn;
|
||||||
|
|
||||||
public interface IBookletChapter {
|
public interface IBookletChapter {
|
||||||
|
|
||||||
|
|
|
@ -10,8 +10,8 @@
|
||||||
|
|
||||||
package de.ellpeck.actuallyadditions.api.booklet;
|
package de.ellpeck.actuallyadditions.api.booklet;
|
||||||
|
|
||||||
import net.minecraftforge.api.distmarker.Dist;
|
import net.neoforged.api.distmarker.Dist;
|
||||||
import net.minecraftforge.api.distmarker.OnlyIn;
|
import net.neoforged.api.distmarker.OnlyIn;
|
||||||
|
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
|
|
||||||
|
|
|
@ -13,9 +13,9 @@ package de.ellpeck.actuallyadditions.api.booklet;
|
||||||
import de.ellpeck.actuallyadditions.api.booklet.internal.GuiBookletBase;
|
import de.ellpeck.actuallyadditions.api.booklet.internal.GuiBookletBase;
|
||||||
import net.minecraft.client.gui.components.Button;
|
import net.minecraft.client.gui.components.Button;
|
||||||
import net.minecraft.world.item.ItemStack;
|
import net.minecraft.world.item.ItemStack;
|
||||||
import net.minecraftforge.api.distmarker.Dist;
|
import net.neoforged.api.distmarker.Dist;
|
||||||
import net.minecraftforge.api.distmarker.OnlyIn;
|
import net.neoforged.api.distmarker.OnlyIn;
|
||||||
import net.minecraftforge.fluids.FluidStack;
|
import net.neoforged.neoforge.fluids.FluidStack;
|
||||||
|
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
|
|
||||||
|
|
|
@ -3,6 +3,7 @@ package de.ellpeck.actuallyadditions.data;
|
||||||
import de.ellpeck.actuallyadditions.mod.ActuallyAdditions;
|
import de.ellpeck.actuallyadditions.mod.ActuallyAdditions;
|
||||||
import de.ellpeck.actuallyadditions.mod.config.conditions.BoolConfigCondition;
|
import de.ellpeck.actuallyadditions.mod.config.conditions.BoolConfigCondition;
|
||||||
import de.ellpeck.actuallyadditions.mod.misc.ActuallyDamageTypes;
|
import de.ellpeck.actuallyadditions.mod.misc.ActuallyDamageTypes;
|
||||||
|
import net.minecraft.core.Cloner;
|
||||||
import net.minecraft.core.HolderLookup;
|
import net.minecraft.core.HolderLookup;
|
||||||
import net.minecraft.core.RegistryAccess;
|
import net.minecraft.core.RegistryAccess;
|
||||||
import net.minecraft.core.RegistrySetBuilder;
|
import net.minecraft.core.RegistrySetBuilder;
|
||||||
|
@ -12,12 +13,12 @@ import net.minecraft.data.DataGenerator;
|
||||||
import net.minecraft.data.PackOutput;
|
import net.minecraft.data.PackOutput;
|
||||||
import net.minecraft.data.registries.VanillaRegistries;
|
import net.minecraft.data.registries.VanillaRegistries;
|
||||||
import net.minecraft.world.damagesource.DamageType;
|
import net.minecraft.world.damagesource.DamageType;
|
||||||
import net.minecraftforge.common.crafting.CraftingHelper;
|
import net.neoforged.neoforge.common.crafting.CraftingHelper;
|
||||||
import net.minecraftforge.common.data.DatapackBuiltinEntriesProvider;
|
import net.neoforged.neoforge.common.data.DatapackBuiltinEntriesProvider;
|
||||||
import net.minecraftforge.common.data.ExistingFileHelper;
|
import net.neoforged.neoforge.common.data.ExistingFileHelper;
|
||||||
import net.minecraftforge.data.event.GatherDataEvent;
|
import net.neoforged.neoforge.data.event.GatherDataEvent;
|
||||||
import net.minecraftforge.eventbus.api.SubscribeEvent;
|
import net.neoforged.bus.api.SubscribeEvent;
|
||||||
import net.minecraftforge.fml.common.Mod;
|
import net.neoforged.fml.common.Mod;
|
||||||
|
|
||||||
import java.util.Set;
|
import java.util.Set;
|
||||||
import java.util.concurrent.CompletableFuture;
|
import java.util.concurrent.CompletableFuture;
|
||||||
|
@ -27,10 +28,10 @@ public class ActuallyAdditionsData {
|
||||||
|
|
||||||
@SubscribeEvent
|
@SubscribeEvent
|
||||||
public static void runGenerator(GatherDataEvent event) {
|
public static void runGenerator(GatherDataEvent event) {
|
||||||
CraftingHelper.register(BoolConfigCondition.Serializer.INSTANCE);
|
|
||||||
DataGenerator generator = event.getGenerator();
|
DataGenerator generator = event.getGenerator();
|
||||||
PackOutput packOutput = generator.getPackOutput();
|
PackOutput packOutput = generator.getPackOutput();
|
||||||
CompletableFuture<HolderLookup.Provider> lookupProvider = CompletableFuture.supplyAsync(ActuallyAdditionsData::getProvider);
|
CompletableFuture<RegistrySetBuilder.PatchedRegistries> patchedProvider = CompletableFuture.supplyAsync(ActuallyAdditionsData::getProvider);
|
||||||
|
CompletableFuture<HolderLookup.Provider> lookupProvider = CompletableFuture.supplyAsync(() -> ActuallyAdditionsData.getProvider().full());
|
||||||
ExistingFileHelper helper = event.getExistingFileHelper();
|
ExistingFileHelper helper = event.getExistingFileHelper();
|
||||||
|
|
||||||
// generator.addProvider(new GeneratorLanguage(generator));
|
// generator.addProvider(new GeneratorLanguage(generator));
|
||||||
|
@ -58,18 +59,20 @@ public class ActuallyAdditionsData {
|
||||||
generator.addProvider(true, new SoundsGenerator(packOutput, helper));
|
generator.addProvider(true, new SoundsGenerator(packOutput, helper));
|
||||||
|
|
||||||
generator.addProvider(event.includeServer(), new DatapackBuiltinEntriesProvider(
|
generator.addProvider(event.includeServer(), new DatapackBuiltinEntriesProvider(
|
||||||
packOutput, lookupProvider, Set.of(ActuallyAdditions.MODID)));
|
packOutput, patchedProvider, Set.of(ActuallyAdditions.MODID)));
|
||||||
}
|
}
|
||||||
|
|
||||||
private static HolderLookup.Provider getProvider() {
|
private static RegistrySetBuilder.PatchedRegistries getProvider() {
|
||||||
final RegistrySetBuilder registryBuilder = new RegistrySetBuilder();
|
final RegistrySetBuilder registryBuilder = new RegistrySetBuilder();
|
||||||
registryBuilder.add(Registries.DAMAGE_TYPE, (context) -> {
|
registryBuilder.add(Registries.DAMAGE_TYPE, (context) -> {
|
||||||
context.register(ActuallyDamageTypes.ATOMIC_RECONSTRUCTOR, new DamageType("actuallyadditions.atomic_reconstructor", 0.0F));
|
context.register(ActuallyDamageTypes.ATOMIC_RECONSTRUCTOR, new DamageType("actuallyadditions.atomic_reconstructor", 0.0F));
|
||||||
});
|
});
|
||||||
// We need the BIOME registry to be present, so we can use a biome tag, doesn't matter that it's empty
|
// We need the BIOME registry to be present, so we can use a biome tag, doesn't matter that it's empty
|
||||||
registryBuilder.add(Registries.BIOME, context -> {
|
registryBuilder.add(Registries.BIOME, $ -> {
|
||||||
});
|
});
|
||||||
RegistryAccess.Frozen regAccess = RegistryAccess.fromRegistryOfRegistries(BuiltInRegistries.REGISTRY);
|
RegistryAccess.Frozen regAccess = RegistryAccess.fromRegistryOfRegistries(BuiltInRegistries.REGISTRY);
|
||||||
return registryBuilder.buildPatch(regAccess, VanillaRegistries.createLookup());
|
Cloner.Factory cloner$factory = new Cloner.Factory();
|
||||||
|
net.neoforged.neoforge.registries.DataPackRegistriesHooks.getDataPackRegistriesWithDimensions().forEach(data -> data.runWithArguments(cloner$factory::addCodec));
|
||||||
|
return registryBuilder.buildPatch(regAccess, VanillaRegistries.createLookup(), cloner$factory);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -4,8 +4,10 @@ import de.ellpeck.actuallyadditions.api.ActuallyTags;
|
||||||
import de.ellpeck.actuallyadditions.mod.blocks.ActuallyBlocks;
|
import de.ellpeck.actuallyadditions.mod.blocks.ActuallyBlocks;
|
||||||
import de.ellpeck.actuallyadditions.mod.items.ActuallyItems;
|
import de.ellpeck.actuallyadditions.mod.items.ActuallyItems;
|
||||||
import net.minecraft.advancements.Advancement;
|
import net.minecraft.advancements.Advancement;
|
||||||
|
import net.minecraft.advancements.AdvancementHolder;
|
||||||
|
import net.minecraft.advancements.AdvancementType;
|
||||||
|
import net.minecraft.advancements.CriteriaTriggers;
|
||||||
import net.minecraft.advancements.DisplayInfo;
|
import net.minecraft.advancements.DisplayInfo;
|
||||||
import net.minecraft.advancements.FrameType;
|
|
||||||
import net.minecraft.advancements.critereon.ImpossibleTrigger;
|
import net.minecraft.advancements.critereon.ImpossibleTrigger;
|
||||||
import net.minecraft.advancements.critereon.InventoryChangeTrigger;
|
import net.minecraft.advancements.critereon.InventoryChangeTrigger;
|
||||||
import net.minecraft.advancements.critereon.ItemPredicate;
|
import net.minecraft.advancements.critereon.ItemPredicate;
|
||||||
|
@ -13,37 +15,38 @@ import net.minecraft.core.HolderLookup;
|
||||||
import net.minecraft.data.PackOutput;
|
import net.minecraft.data.PackOutput;
|
||||||
import net.minecraft.network.chat.Component;
|
import net.minecraft.network.chat.Component;
|
||||||
import net.minecraft.resources.ResourceLocation;
|
import net.minecraft.resources.ResourceLocation;
|
||||||
import net.minecraftforge.common.data.ExistingFileHelper;
|
import net.neoforged.neoforge.common.data.AdvancementProvider;
|
||||||
import net.minecraftforge.common.data.ForgeAdvancementProvider;
|
import net.neoforged.neoforge.common.data.ExistingFileHelper;
|
||||||
|
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
|
import java.util.Optional;
|
||||||
import java.util.concurrent.CompletableFuture;
|
import java.util.concurrent.CompletableFuture;
|
||||||
import java.util.function.Consumer;
|
import java.util.function.Consumer;
|
||||||
|
|
||||||
public class AdvancementGenerator extends ForgeAdvancementProvider {
|
public class AdvancementGenerator extends AdvancementProvider {
|
||||||
public AdvancementGenerator(PackOutput packOutput, CompletableFuture<HolderLookup.Provider> registries, ExistingFileHelper existingFileHelper) {
|
public AdvancementGenerator(PackOutput packOutput, CompletableFuture<HolderLookup.Provider> registries, ExistingFileHelper existingFileHelper) {
|
||||||
super(packOutput, registries, existingFileHelper, List.of(new ActuallyAdvancementGenerator()));
|
super(packOutput, registries, existingFileHelper, List.of(new ActuallyAdvancementGenerator()));
|
||||||
}
|
}
|
||||||
|
|
||||||
public static class ActuallyAdvancementGenerator implements AdvancementGenerator {
|
public static class ActuallyAdvancementGenerator implements AdvancementGenerator {
|
||||||
@Override
|
@Override
|
||||||
public void generate(HolderLookup.Provider registries, Consumer<Advancement> consumer, ExistingFileHelper existingFileHelper) {
|
public void generate(HolderLookup.Provider registries, Consumer<AdvancementHolder> consumer, ExistingFileHelper existingFileHelper) {
|
||||||
Advancement root = Advancement.Builder.advancement()
|
AdvancementHolder root = Advancement.Builder.advancement()
|
||||||
.display(new DisplayInfo(ActuallyItems.ITEM_BOOKLET.get().getDefaultInstance(),
|
.display(new DisplayInfo(ActuallyItems.ITEM_BOOKLET.get().getDefaultInstance(),
|
||||||
Component.translatable("achievement.actuallyadditions.openBooklet"),
|
Component.translatable("achievement.actuallyadditions.openBooklet"),
|
||||||
Component.translatable("achievement.actuallyadditions.openBooklet.desc"),
|
Component.translatable("achievement.actuallyadditions.openBooklet.desc"),
|
||||||
new ResourceLocation("textures/gui/advancements/backgrounds/stone.png"), FrameType.TASK, true, true, false))
|
Optional.of(new ResourceLocation("textures/gui/advancements/backgrounds/stone.png")), AdvancementType.TASK, true, true, false))
|
||||||
.addCriterion("right_click", new ImpossibleTrigger.TriggerInstance())
|
.addCriterion("right_click", CriteriaTriggers.IMPOSSIBLE.createCriterion(new ImpossibleTrigger.TriggerInstance()))
|
||||||
.save(consumer, "actuallyadditions:root");
|
.save(consumer, "actuallyadditions:root");
|
||||||
|
|
||||||
//TODO: Underwater Treasure Chest Advancement?
|
//TODO: Underwater Treasure Chest Advancement?
|
||||||
|
|
||||||
Advancement phantomFace = Advancement.Builder.advancement()
|
AdvancementHolder phantomFace = Advancement.Builder.advancement()
|
||||||
.parent(root)
|
.parent(root)
|
||||||
.display(new DisplayInfo(ActuallyBlocks.PHANTOM_ITEMFACE.get().asItem().getDefaultInstance(),
|
.display(new DisplayInfo(ActuallyBlocks.PHANTOM_ITEMFACE.get().asItem().getDefaultInstance(),
|
||||||
Component.translatable("achievement.actuallyadditions.craftPhantomface"),
|
Component.translatable("achievement.actuallyadditions.craftPhantomface"),
|
||||||
Component.translatable("achievement.actuallyadditions.craftPhantomface.desc"),
|
Component.translatable("achievement.actuallyadditions.craftPhantomface.desc"),
|
||||||
new ResourceLocation("textures/blocks/stone.png"), FrameType.TASK, true, true, false))
|
Optional.of(new ResourceLocation("textures/blocks/stone.png")), AdvancementType.TASK, true, true, false))
|
||||||
.addCriterion("phantom_face", InventoryChangeTrigger.TriggerInstance.hasItems(ActuallyBlocks.PHANTOM_ITEMFACE.get()))
|
.addCriterion("phantom_face", InventoryChangeTrigger.TriggerInstance.hasItems(ActuallyBlocks.PHANTOM_ITEMFACE.get()))
|
||||||
.save(consumer, "actuallyadditions:craft_phantom_face");
|
.save(consumer, "actuallyadditions:craft_phantom_face");
|
||||||
|
|
||||||
|
@ -53,7 +56,7 @@ public class AdvancementGenerator extends ForgeAdvancementProvider {
|
||||||
.display(new DisplayInfo(ActuallyBlocks.PHANTOM_LIQUIFACE.get().asItem().getDefaultInstance(),
|
.display(new DisplayInfo(ActuallyBlocks.PHANTOM_LIQUIFACE.get().asItem().getDefaultInstance(),
|
||||||
Component.translatable("achievement.actuallyadditions.craftLiquiface"),
|
Component.translatable("achievement.actuallyadditions.craftLiquiface"),
|
||||||
Component.translatable("achievement.actuallyadditions.craftLiquiface.desc"),
|
Component.translatable("achievement.actuallyadditions.craftLiquiface.desc"),
|
||||||
null, FrameType.TASK, true, true, false))
|
null, AdvancementType.TASK, true, true, false))
|
||||||
.addCriterion("liquiface", InventoryChangeTrigger.TriggerInstance.hasItems(ActuallyBlocks.PHANTOM_LIQUIFACE.get()))
|
.addCriterion("liquiface", InventoryChangeTrigger.TriggerInstance.hasItems(ActuallyBlocks.PHANTOM_LIQUIFACE.get()))
|
||||||
.save(consumer, "actuallyadditions:craft_liquiface");
|
.save(consumer, "actuallyadditions:craft_liquiface");
|
||||||
|
|
||||||
|
@ -62,17 +65,17 @@ public class AdvancementGenerator extends ForgeAdvancementProvider {
|
||||||
.display(new DisplayInfo(ActuallyBlocks.PHANTOM_ENERGYFACE.get().asItem().getDefaultInstance(),
|
.display(new DisplayInfo(ActuallyBlocks.PHANTOM_ENERGYFACE.get().asItem().getDefaultInstance(),
|
||||||
Component.translatable("achievement.actuallyadditions.craftEnergyface"),
|
Component.translatable("achievement.actuallyadditions.craftEnergyface"),
|
||||||
Component.translatable("achievement.actuallyadditions.craftEnergyface.desc"),
|
Component.translatable("achievement.actuallyadditions.craftEnergyface.desc"),
|
||||||
null, FrameType.TASK, true, true, false))
|
null, AdvancementType.TASK, true, true, false))
|
||||||
.addCriterion("energyface", InventoryChangeTrigger.TriggerInstance.hasItems(ActuallyBlocks.PHANTOM_ENERGYFACE.get()))
|
.addCriterion("energyface", InventoryChangeTrigger.TriggerInstance.hasItems(ActuallyBlocks.PHANTOM_ENERGYFACE.get()))
|
||||||
.save(consumer, "actuallyadditions:craft_energyface");
|
.save(consumer, "actuallyadditions:craft_energyface");
|
||||||
|
|
||||||
|
|
||||||
Advancement coalGenerator = Advancement.Builder.advancement()
|
AdvancementHolder coalGenerator = Advancement.Builder.advancement()
|
||||||
.parent(root)
|
.parent(root)
|
||||||
.display(new DisplayInfo(ActuallyBlocks.COAL_GENERATOR.get().asItem().getDefaultInstance(),
|
.display(new DisplayInfo(ActuallyBlocks.COAL_GENERATOR.get().asItem().getDefaultInstance(),
|
||||||
Component.translatable("achievement.actuallyadditions.craftCoalGen"),
|
Component.translatable("achievement.actuallyadditions.craftCoalGen"),
|
||||||
Component.translatable("achievement.actuallyadditions.craftCoalGen.desc"),
|
Component.translatable("achievement.actuallyadditions.craftCoalGen.desc"),
|
||||||
null, FrameType.TASK, true, true, false))
|
null, AdvancementType.TASK, true, true, false))
|
||||||
.addCriterion("coal_generator", InventoryChangeTrigger.TriggerInstance.hasItems(ActuallyBlocks.COAL_GENERATOR.get()))
|
.addCriterion("coal_generator", InventoryChangeTrigger.TriggerInstance.hasItems(ActuallyBlocks.COAL_GENERATOR.get()))
|
||||||
.save(consumer, "actuallyadditions:craft_coal_generator");
|
.save(consumer, "actuallyadditions:craft_coal_generator");
|
||||||
|
|
||||||
|
@ -81,16 +84,16 @@ public class AdvancementGenerator extends ForgeAdvancementProvider {
|
||||||
.display(new DisplayInfo(ActuallyBlocks.LEAF_GENERATOR.get().asItem().getDefaultInstance(),
|
.display(new DisplayInfo(ActuallyBlocks.LEAF_GENERATOR.get().asItem().getDefaultInstance(),
|
||||||
Component.translatable("achievement.actuallyadditions.craftLeafGen"),
|
Component.translatable("achievement.actuallyadditions.craftLeafGen"),
|
||||||
Component.translatable("achievement.actuallyadditions.craftLeafGen.desc"),
|
Component.translatable("achievement.actuallyadditions.craftLeafGen.desc"),
|
||||||
null, FrameType.TASK, true, true, false))
|
null, AdvancementType.TASK, true, true, false))
|
||||||
.addCriterion("leaf_generator", InventoryChangeTrigger.TriggerInstance.hasItems(ActuallyBlocks.LEAF_GENERATOR.get()))
|
.addCriterion("leaf_generator", InventoryChangeTrigger.TriggerInstance.hasItems(ActuallyBlocks.LEAF_GENERATOR.get()))
|
||||||
.save(consumer, "actuallyadditions:craft_leaf_generator");
|
.save(consumer, "actuallyadditions:craft_leaf_generator");
|
||||||
|
|
||||||
Advancement coffeeBeans = Advancement.Builder.advancement()
|
AdvancementHolder coffeeBeans = Advancement.Builder.advancement()
|
||||||
.parent(coalGenerator)
|
.parent(coalGenerator)
|
||||||
.display(new DisplayInfo(ActuallyItems.COFFEE_BEANS.get().getDefaultInstance(),
|
.display(new DisplayInfo(ActuallyItems.COFFEE_BEANS.get().getDefaultInstance(),
|
||||||
Component.translatable("achievement.actuallyadditions.pickUpCoffee"),
|
Component.translatable("achievement.actuallyadditions.pickUpCoffee"),
|
||||||
Component.translatable("achievement.actuallyadditions.pickUpCoffee.desc"),
|
Component.translatable("achievement.actuallyadditions.pickUpCoffee.desc"),
|
||||||
null, FrameType.TASK, true, true, false))
|
null, AdvancementType.TASK, true, true, false))
|
||||||
.addCriterion("coffee_beans", InventoryChangeTrigger.TriggerInstance.hasItems(ActuallyItems.COFFEE_BEANS.get()))
|
.addCriterion("coffee_beans", InventoryChangeTrigger.TriggerInstance.hasItems(ActuallyItems.COFFEE_BEANS.get()))
|
||||||
.save(consumer, "actuallyadditions:pickup_coffee");
|
.save(consumer, "actuallyadditions:pickup_coffee");
|
||||||
|
|
||||||
|
@ -99,25 +102,25 @@ public class AdvancementGenerator extends ForgeAdvancementProvider {
|
||||||
.display(new DisplayInfo(ActuallyBlocks.COFFEE_MACHINE.get().asItem().getDefaultInstance(),
|
.display(new DisplayInfo(ActuallyBlocks.COFFEE_MACHINE.get().asItem().getDefaultInstance(),
|
||||||
Component.translatable("achievement.actuallyadditions.craftCoffeeMachine"),
|
Component.translatable("achievement.actuallyadditions.craftCoffeeMachine"),
|
||||||
Component.translatable("achievement.actuallyadditions.craftCoffeeMachine.desc"),
|
Component.translatable("achievement.actuallyadditions.craftCoffeeMachine.desc"),
|
||||||
null, FrameType.TASK, true, true, false))
|
null, AdvancementType.TASK, true, true, false))
|
||||||
.addCriterion("coffee_machine", InventoryChangeTrigger.TriggerInstance.hasItems(ActuallyBlocks.COFFEE_MACHINE.get()))
|
.addCriterion("coffee_machine", InventoryChangeTrigger.TriggerInstance.hasItems(ActuallyBlocks.COFFEE_MACHINE.get()))
|
||||||
.save(consumer, "actuallyadditions:craft_coffee_machine");
|
.save(consumer, "actuallyadditions:craft_coffee_machine");
|
||||||
|
|
||||||
Advancement reconstructor = Advancement.Builder.advancement()
|
AdvancementHolder reconstructor = Advancement.Builder.advancement()
|
||||||
.parent(coalGenerator)
|
.parent(coalGenerator)
|
||||||
.display(new DisplayInfo(ActuallyBlocks.ATOMIC_RECONSTRUCTOR.get().asItem().getDefaultInstance(),
|
.display(new DisplayInfo(ActuallyBlocks.ATOMIC_RECONSTRUCTOR.get().asItem().getDefaultInstance(),
|
||||||
Component.translatable("achievement.actuallyadditions.craftReconstructor"),
|
Component.translatable("achievement.actuallyadditions.craftReconstructor"),
|
||||||
Component.translatable("achievement.actuallyadditions.craftReconstructor.desc"),
|
Component.translatable("achievement.actuallyadditions.craftReconstructor.desc"),
|
||||||
null, FrameType.TASK, true, true, false))
|
null, AdvancementType.TASK, true, true, false))
|
||||||
.addCriterion("atomic_reconstructor", InventoryChangeTrigger.TriggerInstance.hasItems(ActuallyBlocks.ATOMIC_RECONSTRUCTOR.get()))
|
.addCriterion("atomic_reconstructor", InventoryChangeTrigger.TriggerInstance.hasItems(ActuallyBlocks.ATOMIC_RECONSTRUCTOR.get()))
|
||||||
.save(consumer, "actuallyadditions:craft_reconstructor");
|
.save(consumer, "actuallyadditions:craft_reconstructor");
|
||||||
|
|
||||||
Advancement makeFirstCrystal = Advancement.Builder.advancement()
|
AdvancementHolder makeFirstCrystal = Advancement.Builder.advancement()
|
||||||
.parent(reconstructor)
|
.parent(reconstructor)
|
||||||
.display(new DisplayInfo(ActuallyItems.EMERADIC_CRYSTAL.get().getDefaultInstance(),
|
.display(new DisplayInfo(ActuallyItems.EMERADIC_CRYSTAL.get().getDefaultInstance(),
|
||||||
Component.translatable("achievement.actuallyadditions.makeCrystal"),
|
Component.translatable("achievement.actuallyadditions.makeCrystal"),
|
||||||
Component.translatable("achievement.actuallyadditions.makeCrystal.desc"),
|
Component.translatable("achievement.actuallyadditions.makeCrystal.desc"),
|
||||||
null, FrameType.TASK, true, true, false))
|
null, AdvancementType.TASK, true, true, false))
|
||||||
.addCriterion("crystal", InventoryChangeTrigger.TriggerInstance.hasItems(
|
.addCriterion("crystal", InventoryChangeTrigger.TriggerInstance.hasItems(
|
||||||
ItemPredicate.Builder.item().of(ActuallyTags.Items.CRYSTALS).build())
|
ItemPredicate.Builder.item().of(ActuallyTags.Items.CRYSTALS).build())
|
||||||
)
|
)
|
||||||
|
@ -128,82 +131,82 @@ public class AdvancementGenerator extends ForgeAdvancementProvider {
|
||||||
.display(new DisplayInfo(ActuallyBlocks.EMPOWERER.get().asItem().getDefaultInstance(),
|
.display(new DisplayInfo(ActuallyBlocks.EMPOWERER.get().asItem().getDefaultInstance(),
|
||||||
Component.translatable("achievement.actuallyadditions.craftEmpowerer"),
|
Component.translatable("achievement.actuallyadditions.craftEmpowerer"),
|
||||||
Component.translatable("achievement.actuallyadditions.craftEmpowerer.desc"),
|
Component.translatable("achievement.actuallyadditions.craftEmpowerer.desc"),
|
||||||
null, FrameType.TASK, true, true, false))
|
null, AdvancementType.TASK, true, true, false))
|
||||||
.addCriterion("empowerer", InventoryChangeTrigger.TriggerInstance.hasItems(ActuallyBlocks.EMPOWERER.get()))
|
.addCriterion("empowerer", InventoryChangeTrigger.TriggerInstance.hasItems(ActuallyBlocks.EMPOWERER.get()))
|
||||||
.save(consumer, "actuallyadditions:craft_empowerer");
|
.save(consumer, "actuallyadditions:craft_empowerer");
|
||||||
|
|
||||||
Advancement craftCrusher = Advancement.Builder.advancement()
|
AdvancementHolder craftCrusher = Advancement.Builder.advancement()
|
||||||
.parent(reconstructor)
|
.parent(reconstructor)
|
||||||
.display(new DisplayInfo(ActuallyBlocks.CRUSHER.get().asItem().getDefaultInstance(),
|
.display(new DisplayInfo(ActuallyBlocks.CRUSHER.get().asItem().getDefaultInstance(),
|
||||||
Component.translatable("achievement.actuallyadditions.craftCrusher"),
|
Component.translatable("achievement.actuallyadditions.craftCrusher"),
|
||||||
Component.translatable("achievement.actuallyadditions.craftCrusher.desc"),
|
Component.translatable("achievement.actuallyadditions.craftCrusher.desc"),
|
||||||
null, FrameType.TASK, true, true, false))
|
null, AdvancementType.TASK, true, true, false))
|
||||||
.addCriterion("crystal", InventoryChangeTrigger.TriggerInstance.hasItems(
|
.addCriterion("crystal", InventoryChangeTrigger.TriggerInstance.hasItems(
|
||||||
ItemPredicate.Builder.item().of(ActuallyBlocks.CRUSHER.get()).build())
|
ItemPredicate.Builder.item().of(ActuallyBlocks.CRUSHER.get()).build())
|
||||||
)
|
)
|
||||||
.save(consumer, "actuallyadditions:craft_crusher");
|
.save(consumer, "actuallyadditions:craft_crusher");
|
||||||
|
|
||||||
Advancement craftDoubleCrusher = Advancement.Builder.advancement()
|
AdvancementHolder craftDoubleCrusher = Advancement.Builder.advancement()
|
||||||
.parent(craftCrusher)
|
.parent(craftCrusher)
|
||||||
.display(new DisplayInfo(ActuallyBlocks.CRUSHER_DOUBLE.get().asItem().getDefaultInstance(),
|
.display(new DisplayInfo(ActuallyBlocks.CRUSHER_DOUBLE.get().asItem().getDefaultInstance(),
|
||||||
Component.translatable("achievement.actuallyadditions.craftDoubleCrusher"),
|
Component.translatable("achievement.actuallyadditions.craftDoubleCrusher"),
|
||||||
Component.translatable("achievement.actuallyadditions.craftDoubleCrusher.desc"),
|
Component.translatable("achievement.actuallyadditions.craftDoubleCrusher.desc"),
|
||||||
null, FrameType.TASK, true, true, false))
|
null, AdvancementType.TASK, true, true, false))
|
||||||
.addCriterion("crystal", InventoryChangeTrigger.TriggerInstance.hasItems(
|
.addCriterion("crystal", InventoryChangeTrigger.TriggerInstance.hasItems(
|
||||||
ItemPredicate.Builder.item().of(ActuallyBlocks.CRUSHER_DOUBLE.get()).build())
|
ItemPredicate.Builder.item().of(ActuallyBlocks.CRUSHER_DOUBLE.get()).build())
|
||||||
)
|
)
|
||||||
.save(consumer, "actuallyadditions:craft_double_crusher");
|
.save(consumer, "actuallyadditions:craft_double_crusher");
|
||||||
|
|
||||||
Advancement craftLaserRelay = Advancement.Builder.advancement()
|
AdvancementHolder craftLaserRelay = Advancement.Builder.advancement()
|
||||||
.parent(reconstructor)
|
.parent(reconstructor)
|
||||||
.display(new DisplayInfo(ActuallyBlocks.LASER_RELAY.get().asItem().getDefaultInstance(),
|
.display(new DisplayInfo(ActuallyBlocks.LASER_RELAY.get().asItem().getDefaultInstance(),
|
||||||
Component.translatable("achievement.actuallyadditions.craftLaserRelay"),
|
Component.translatable("achievement.actuallyadditions.craftLaserRelay"),
|
||||||
Component.translatable("achievement.actuallyadditions.craftLaserRelay.desc"),
|
Component.translatable("achievement.actuallyadditions.craftLaserRelay.desc"),
|
||||||
null, FrameType.TASK, true, true, false))
|
null, AdvancementType.TASK, true, true, false))
|
||||||
.addCriterion("laser_relay", InventoryChangeTrigger.TriggerInstance.hasItems(
|
.addCriterion("laser_relay", InventoryChangeTrigger.TriggerInstance.hasItems(
|
||||||
ItemPredicate.Builder.item().of(ActuallyBlocks.LASER_RELAY.get()).build())
|
ItemPredicate.Builder.item().of(ActuallyBlocks.LASER_RELAY.get()).build())
|
||||||
)
|
)
|
||||||
.save(consumer, "actuallyadditions:craft_laser_relay");
|
.save(consumer, "actuallyadditions:craft_laser_relay");
|
||||||
|
|
||||||
Advancement craftLaserRelayAdvanced = Advancement.Builder.advancement()
|
AdvancementHolder craftLaserRelayAdvanced = Advancement.Builder.advancement()
|
||||||
.parent(craftLaserRelay)
|
.parent(craftLaserRelay)
|
||||||
.display(new DisplayInfo(ActuallyBlocks.LASER_RELAY_ADVANCED.get().asItem().getDefaultInstance(),
|
.display(new DisplayInfo(ActuallyBlocks.LASER_RELAY_ADVANCED.get().asItem().getDefaultInstance(),
|
||||||
Component.translatable("achievement.actuallyadditions.craftLaserRelayAdvanced"),
|
Component.translatable("achievement.actuallyadditions.craftLaserRelayAdvanced"),
|
||||||
Component.translatable("achievement.actuallyadditions.craftLaserRelayAdvanced.desc"),
|
Component.translatable("achievement.actuallyadditions.craftLaserRelayAdvanced.desc"),
|
||||||
null, FrameType.TASK, true, true, false))
|
null, AdvancementType.TASK, true, true, false))
|
||||||
.addCriterion("laser_relay_advanced", InventoryChangeTrigger.TriggerInstance.hasItems(
|
.addCriterion("laser_relay_advanced", InventoryChangeTrigger.TriggerInstance.hasItems(
|
||||||
ItemPredicate.Builder.item().of(ActuallyBlocks.LASER_RELAY_ADVANCED.get()).build())
|
ItemPredicate.Builder.item().of(ActuallyBlocks.LASER_RELAY_ADVANCED.get()).build())
|
||||||
)
|
)
|
||||||
.save(consumer, "actuallyadditions:craft_laser_relay_advanced");
|
.save(consumer, "actuallyadditions:craft_laser_relay_advanced");
|
||||||
|
|
||||||
Advancement craftLaserRelayExtreme = Advancement.Builder.advancement()
|
AdvancementHolder craftLaserRelayExtreme = Advancement.Builder.advancement()
|
||||||
.parent(craftLaserRelayAdvanced)
|
.parent(craftLaserRelayAdvanced)
|
||||||
.display(new DisplayInfo(ActuallyBlocks.LASER_RELAY_EXTREME.get().asItem().getDefaultInstance(),
|
.display(new DisplayInfo(ActuallyBlocks.LASER_RELAY_EXTREME.get().asItem().getDefaultInstance(),
|
||||||
Component.translatable("achievement.actuallyadditions.craftLaserRelayExtreme"),
|
Component.translatable("achievement.actuallyadditions.craftLaserRelayExtreme"),
|
||||||
Component.translatable("achievement.actuallyadditions.craftLaserRelayExtreme.desc"),
|
Component.translatable("achievement.actuallyadditions.craftLaserRelayExtreme.desc"),
|
||||||
null, FrameType.TASK, true, true, false))
|
null, AdvancementType.TASK, true, true, false))
|
||||||
.addCriterion("laser_relay_extreme", InventoryChangeTrigger.TriggerInstance.hasItems(
|
.addCriterion("laser_relay_extreme", InventoryChangeTrigger.TriggerInstance.hasItems(
|
||||||
ItemPredicate.Builder.item().of(ActuallyBlocks.LASER_RELAY_EXTREME.get()).build())
|
ItemPredicate.Builder.item().of(ActuallyBlocks.LASER_RELAY_EXTREME.get()).build())
|
||||||
)
|
)
|
||||||
.save(consumer, "actuallyadditions:craft_laser_relay_extreme");
|
.save(consumer, "actuallyadditions:craft_laser_relay_extreme");
|
||||||
|
|
||||||
Advancement craftLaserRelayItem = Advancement.Builder.advancement()
|
AdvancementHolder craftLaserRelayItem = Advancement.Builder.advancement()
|
||||||
.parent(craftLaserRelay)
|
.parent(craftLaserRelay)
|
||||||
.display(new DisplayInfo(ActuallyBlocks.LASER_RELAY_ITEM.get().asItem().getDefaultInstance(),
|
.display(new DisplayInfo(ActuallyBlocks.LASER_RELAY_ITEM.get().asItem().getDefaultInstance(),
|
||||||
Component.translatable("achievement.actuallyadditions.craftLaserRelayItem"),
|
Component.translatable("achievement.actuallyadditions.craftLaserRelayItem"),
|
||||||
Component.translatable("achievement.actuallyadditions.craftLaserRelayItem.desc"),
|
Component.translatable("achievement.actuallyadditions.craftLaserRelayItem.desc"),
|
||||||
null, FrameType.TASK, true, true, false))
|
null, AdvancementType.TASK, true, true, false))
|
||||||
.addCriterion("laser_relay_item", InventoryChangeTrigger.TriggerInstance.hasItems(
|
.addCriterion("laser_relay_item", InventoryChangeTrigger.TriggerInstance.hasItems(
|
||||||
ItemPredicate.Builder.item().of(ActuallyBlocks.LASER_RELAY_ITEM.get()).build())
|
ItemPredicate.Builder.item().of(ActuallyBlocks.LASER_RELAY_ITEM.get()).build())
|
||||||
)
|
)
|
||||||
.save(consumer, "actuallyadditions:craft_laser_relay_item");
|
.save(consumer, "actuallyadditions:craft_laser_relay_item");
|
||||||
|
|
||||||
Advancement craftItemInterface = Advancement.Builder.advancement()
|
AdvancementHolder craftItemInterface = Advancement.Builder.advancement()
|
||||||
.parent(craftLaserRelay)
|
.parent(craftLaserRelay)
|
||||||
.display(new DisplayInfo(ActuallyBlocks.ITEM_INTERFACE.get().asItem().getDefaultInstance(),
|
.display(new DisplayInfo(ActuallyBlocks.ITEM_INTERFACE.get().asItem().getDefaultInstance(),
|
||||||
Component.translatable("achievement.actuallyadditions.craftItemInterface"),
|
Component.translatable("achievement.actuallyadditions.craftItemInterface"),
|
||||||
Component.translatable("achievement.actuallyadditions.craftItemInterface.desc"),
|
Component.translatable("achievement.actuallyadditions.craftItemInterface.desc"),
|
||||||
null, FrameType.TASK, true, true, false))
|
null, AdvancementType.TASK, true, true, false))
|
||||||
.addCriterion("item_interface", InventoryChangeTrigger.TriggerInstance.hasItems(
|
.addCriterion("item_interface", InventoryChangeTrigger.TriggerInstance.hasItems(
|
||||||
ItemPredicate.Builder.item().of(ActuallyBlocks.ITEM_INTERFACE.get()).build())
|
ItemPredicate.Builder.item().of(ActuallyBlocks.ITEM_INTERFACE.get()).build())
|
||||||
)
|
)
|
||||||
|
|
|
@ -1,26 +1,21 @@
|
||||||
package de.ellpeck.actuallyadditions.data;
|
package de.ellpeck.actuallyadditions.data;
|
||||||
|
|
||||||
import com.google.gson.JsonObject;
|
|
||||||
import de.ellpeck.actuallyadditions.api.ActuallyTags;
|
import de.ellpeck.actuallyadditions.api.ActuallyTags;
|
||||||
import de.ellpeck.actuallyadditions.mod.blocks.ActuallyBlocks;
|
import de.ellpeck.actuallyadditions.mod.blocks.ActuallyBlocks;
|
||||||
import de.ellpeck.actuallyadditions.mod.items.ActuallyItems;
|
import de.ellpeck.actuallyadditions.mod.items.ActuallyItems;
|
||||||
import net.minecraft.data.CachedOutput;
|
|
||||||
import net.minecraft.data.PackOutput;
|
import net.minecraft.data.PackOutput;
|
||||||
import net.minecraft.data.recipes.FinishedRecipe;
|
|
||||||
import net.minecraft.data.recipes.RecipeCategory;
|
import net.minecraft.data.recipes.RecipeCategory;
|
||||||
|
import net.minecraft.data.recipes.RecipeOutput;
|
||||||
import net.minecraft.data.recipes.RecipeProvider;
|
import net.minecraft.data.recipes.RecipeProvider;
|
||||||
import net.minecraft.data.recipes.ShapedRecipeBuilder;
|
import net.minecraft.data.recipes.ShapedRecipeBuilder;
|
||||||
import net.minecraft.data.recipes.ShapelessRecipeBuilder;
|
import net.minecraft.data.recipes.ShapelessRecipeBuilder;
|
||||||
import net.minecraft.tags.ItemTags;
|
import net.minecraft.tags.ItemTags;
|
||||||
import net.minecraft.world.item.Items;
|
import net.minecraft.world.item.Items;
|
||||||
import net.minecraft.world.level.ItemLike;
|
import net.minecraft.world.level.ItemLike;
|
||||||
import net.minecraftforge.common.Tags;
|
import net.neoforged.neoforge.common.Tags;
|
||||||
import org.jetbrains.annotations.Nullable;
|
|
||||||
|
|
||||||
import javax.annotation.Nonnull;
|
import javax.annotation.Nonnull;
|
||||||
import java.util.Arrays;
|
import java.util.Arrays;
|
||||||
import java.util.concurrent.CompletableFuture;
|
|
||||||
import java.util.function.Consumer;
|
|
||||||
|
|
||||||
public class BlockRecipeGenerator extends RecipeProvider {
|
public class BlockRecipeGenerator extends RecipeProvider {
|
||||||
public BlockRecipeGenerator(PackOutput packOutput) {
|
public BlockRecipeGenerator(PackOutput packOutput) {
|
||||||
|
@ -28,7 +23,7 @@ public class BlockRecipeGenerator extends RecipeProvider {
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
protected void buildRecipes(@Nonnull Consumer<FinishedRecipe> consumer) {
|
protected void buildRecipes(@Nonnull RecipeOutput consumer) {
|
||||||
//Battery Box
|
//Battery Box
|
||||||
Recipe.shapeless(ActuallyBlocks.BATTERY_BOX.getItem()).ingredients(ActuallyBlocks.ENERGIZER.get(), ActuallyBlocks.ENERVATOR.get(), ActuallyItems.BASIC_COIL.get()).save(consumer);
|
Recipe.shapeless(ActuallyBlocks.BATTERY_BOX.getItem()).ingredients(ActuallyBlocks.ENERGIZER.get(), ActuallyBlocks.ENERVATOR.get(), ActuallyItems.BASIC_COIL.get()).save(consumer);
|
||||||
|
|
||||||
|
@ -232,11 +227,11 @@ public class BlockRecipeGenerator extends RecipeProvider {
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
// @Override //TODO: Flanks do your RecipeOutput wrapper thingy ;)
|
||||||
protected @Nullable CompletableFuture<?> saveAdvancement(CachedOutput output, FinishedRecipe finishedRecipe, JsonObject advancementJson) {
|
// protected @Nullable CompletableFuture<?> saveAdvancement(CachedOutput stack, FinishedRecipe finishedRecipe, JsonObject advancementJson) {
|
||||||
return null;
|
// return null;
|
||||||
//Nope... maybe later...
|
// //Nope... maybe later...
|
||||||
}
|
// }
|
||||||
|
|
||||||
public static class Recipe {
|
public static class Recipe {
|
||||||
public static Shapeless shapeless(ItemLike result) {
|
public static Shapeless shapeless(ItemLike result) {
|
||||||
|
@ -255,15 +250,15 @@ public class BlockRecipeGenerator extends RecipeProvider {
|
||||||
return new Shaped(result, count);
|
return new Shaped(result, count);
|
||||||
}
|
}
|
||||||
|
|
||||||
public static void stairs(ItemLike result, ItemLike resource, Consumer<FinishedRecipe> consumer) {
|
public static void stairs(ItemLike result, ItemLike resource, RecipeOutput consumer) {
|
||||||
Recipe.shaped(result).patternSingleKey('Q', resource, "Q ", "QQ ", "QQQ").save(consumer);
|
Recipe.shaped(result).patternSingleKey('Q', resource, "Q ", "QQ ", "QQQ").save(consumer);
|
||||||
}
|
}
|
||||||
|
|
||||||
public static void wall(ItemLike result, ItemLike resource, Consumer<FinishedRecipe> consumer) {
|
public static void wall(ItemLike result, ItemLike resource, RecipeOutput consumer) {
|
||||||
Recipe.shaped(result).patternSingleKey('Q', resource, "QQQ", "QQQ").save(consumer);
|
Recipe.shaped(result).patternSingleKey('Q', resource, "QQQ", "QQQ").save(consumer);
|
||||||
}
|
}
|
||||||
|
|
||||||
public static void slab(ItemLike result, ItemLike resource, Consumer<FinishedRecipe> consumer) {
|
public static void slab(ItemLike result, ItemLike resource, RecipeOutput consumer) {
|
||||||
Recipe.shaped(result).patternSingleKey('Q', resource, "QQQ").save(consumer);
|
Recipe.shaped(result).patternSingleKey('Q', resource, "QQQ").save(consumer);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -282,7 +277,7 @@ public class BlockRecipeGenerator extends RecipeProvider {
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void save(Consumer<FinishedRecipe> consumer) {
|
public void save(RecipeOutput consumer) {
|
||||||
this.unlockedBy("has_book", has(ActuallyItems.ITEM_BOOKLET.get()));
|
this.unlockedBy("has_book", has(ActuallyItems.ITEM_BOOKLET.get()));
|
||||||
super.save(consumer);
|
super.save(consumer);
|
||||||
}
|
}
|
||||||
|
@ -320,7 +315,7 @@ public class BlockRecipeGenerator extends RecipeProvider {
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void save(Consumer<FinishedRecipe> consumerIn) {
|
public void save(RecipeOutput consumerIn) {
|
||||||
this.unlockedBy("has_book", has(ActuallyItems.ITEM_BOOKLET.get()));
|
this.unlockedBy("has_book", has(ActuallyItems.ITEM_BOOKLET.get()));
|
||||||
super.save(consumerIn);
|
super.save(consumerIn);
|
||||||
}
|
}
|
||||||
|
|
|
@ -4,6 +4,7 @@ import de.ellpeck.actuallyadditions.mod.ActuallyAdditions;
|
||||||
import de.ellpeck.actuallyadditions.mod.blocks.ActuallyBlocks;
|
import de.ellpeck.actuallyadditions.mod.blocks.ActuallyBlocks;
|
||||||
import de.ellpeck.actuallyadditions.mod.blocks.BlockTinyTorch;
|
import de.ellpeck.actuallyadditions.mod.blocks.BlockTinyTorch;
|
||||||
import net.minecraft.core.Direction;
|
import net.minecraft.core.Direction;
|
||||||
|
import net.minecraft.core.registries.BuiltInRegistries;
|
||||||
import net.minecraft.data.PackOutput;
|
import net.minecraft.data.PackOutput;
|
||||||
import net.minecraft.resources.ResourceLocation;
|
import net.minecraft.resources.ResourceLocation;
|
||||||
import net.minecraft.world.level.block.Block;
|
import net.minecraft.world.level.block.Block;
|
||||||
|
@ -12,11 +13,10 @@ import net.minecraft.world.level.block.SlabBlock;
|
||||||
import net.minecraft.world.level.block.StairBlock;
|
import net.minecraft.world.level.block.StairBlock;
|
||||||
import net.minecraft.world.level.block.WallBlock;
|
import net.minecraft.world.level.block.WallBlock;
|
||||||
import net.minecraft.world.level.block.state.properties.BlockStateProperties;
|
import net.minecraft.world.level.block.state.properties.BlockStateProperties;
|
||||||
import net.minecraftforge.client.model.generators.BlockStateProvider;
|
import net.neoforged.neoforge.client.model.generators.BlockStateProvider;
|
||||||
import net.minecraftforge.client.model.generators.ConfiguredModel;
|
import net.neoforged.neoforge.client.model.generators.ConfiguredModel;
|
||||||
import net.minecraftforge.client.model.generators.ModelFile;
|
import net.neoforged.neoforge.client.model.generators.ModelFile;
|
||||||
import net.minecraftforge.common.data.ExistingFileHelper;
|
import net.neoforged.neoforge.common.data.ExistingFileHelper;
|
||||||
import net.minecraftforge.registries.ForgeRegistries;
|
|
||||||
|
|
||||||
import java.util.function.Supplier;
|
import java.util.function.Supplier;
|
||||||
|
|
||||||
|
@ -210,7 +210,7 @@ public class BlockStateGenerator extends BlockStateProvider {
|
||||||
}
|
}
|
||||||
|
|
||||||
private void standardBlock(Supplier<Block> block) {
|
private void standardBlock(Supplier<Block> block) {
|
||||||
ResourceLocation name = ForgeRegistries.BLOCKS.getKey(block.get());
|
ResourceLocation name = BuiltInRegistries.BLOCK.getKey(block.get());
|
||||||
ModelFile model = new ModelFile.UncheckedModelFile(modLoc("block/" + name.getPath()));
|
ModelFile model = new ModelFile.UncheckedModelFile(modLoc("block/" + name.getPath()));
|
||||||
|
|
||||||
assert name != null;
|
assert name != null;
|
||||||
|
@ -218,7 +218,7 @@ public class BlockStateGenerator extends BlockStateProvider {
|
||||||
}
|
}
|
||||||
|
|
||||||
private void standardBlockWithCube(Supplier<Block> block) {
|
private void standardBlockWithCube(Supplier<Block> block) {
|
||||||
ResourceLocation name = ForgeRegistries.BLOCKS.getKey(block.get());
|
ResourceLocation name = BuiltInRegistries.BLOCK.getKey(block.get());
|
||||||
assert name != null;
|
assert name != null;
|
||||||
|
|
||||||
ModelFile model = models().cubeAll(name.toString(), modLoc("block/" + name.getPath()));
|
ModelFile model = models().cubeAll(name.toString(), modLoc("block/" + name.getPath()));
|
||||||
|
@ -226,7 +226,7 @@ public class BlockStateGenerator extends BlockStateProvider {
|
||||||
}
|
}
|
||||||
|
|
||||||
private void buildLitState(Supplier<Block> block) {
|
private void buildLitState(Supplier<Block> block) {
|
||||||
ResourceLocation name = ForgeRegistries.BLOCKS.getKey(block.get());
|
ResourceLocation name = BuiltInRegistries.BLOCK.getKey(block.get());
|
||||||
assert name != null;
|
assert name != null;
|
||||||
|
|
||||||
getVariantBuilder(block.get())
|
getVariantBuilder(block.get())
|
||||||
|
@ -237,7 +237,7 @@ public class BlockStateGenerator extends BlockStateProvider {
|
||||||
}
|
}
|
||||||
|
|
||||||
private void fullyDirectionalBlock(Supplier<Block> block) {
|
private void fullyDirectionalBlock(Supplier<Block> block) {
|
||||||
ResourceLocation name = ForgeRegistries.BLOCKS.getKey(block.get());
|
ResourceLocation name = BuiltInRegistries.BLOCK.getKey(block.get());
|
||||||
ModelFile model = new ModelFile.UncheckedModelFile(modLoc("block/" + name.getPath()));
|
ModelFile model = new ModelFile.UncheckedModelFile(modLoc("block/" + name.getPath()));
|
||||||
ModelFile verModel = new ModelFile.UncheckedModelFile(modLoc("block/" + name.getPath() + "_ver"));
|
ModelFile verModel = new ModelFile.UncheckedModelFile(modLoc("block/" + name.getPath() + "_ver"));
|
||||||
|
|
||||||
|
@ -246,7 +246,7 @@ public class BlockStateGenerator extends BlockStateProvider {
|
||||||
}
|
}
|
||||||
|
|
||||||
private void horizontallyDirectionalBlock(Supplier<Block> block) {
|
private void horizontallyDirectionalBlock(Supplier<Block> block) {
|
||||||
ResourceLocation name = ForgeRegistries.BLOCKS.getKey(block.get());
|
ResourceLocation name = BuiltInRegistries.BLOCK.getKey(block.get());
|
||||||
ModelFile model = new ModelFile.UncheckedModelFile(modLoc("block/" + name.getPath()));
|
ModelFile model = new ModelFile.UncheckedModelFile(modLoc("block/" + name.getPath()));
|
||||||
|
|
||||||
assert name != null;
|
assert name != null;
|
||||||
|
@ -255,7 +255,7 @@ public class BlockStateGenerator extends BlockStateProvider {
|
||||||
|
|
||||||
private void tinyTorchBlock(Supplier<Block> block) {
|
private void tinyTorchBlock(Supplier<Block> block) {
|
||||||
assert block.get() instanceof BlockTinyTorch;
|
assert block.get() instanceof BlockTinyTorch;
|
||||||
ResourceLocation name = ForgeRegistries.BLOCKS.getKey(block.get());
|
ResourceLocation name = BuiltInRegistries.BLOCK.getKey(block.get());
|
||||||
ModelFile model = new ModelFile.UncheckedModelFile(modLoc("block/" + name.getPath()));
|
ModelFile model = new ModelFile.UncheckedModelFile(modLoc("block/" + name.getPath()));
|
||||||
ModelFile wallModel = new ModelFile.UncheckedModelFile(modLoc("block/" + name.getPath() + "_wall"));
|
ModelFile wallModel = new ModelFile.UncheckedModelFile(modLoc("block/" + name.getPath() + "_wall"));
|
||||||
|
|
||||||
|
|
|
@ -6,8 +6,8 @@ import de.ellpeck.actuallyadditions.mod.blocks.ActuallyBlocks;
|
||||||
import net.minecraft.core.HolderLookup;
|
import net.minecraft.core.HolderLookup;
|
||||||
import net.minecraft.data.PackOutput;
|
import net.minecraft.data.PackOutput;
|
||||||
import net.minecraft.tags.BlockTags;
|
import net.minecraft.tags.BlockTags;
|
||||||
import net.minecraftforge.common.data.BlockTagsProvider;
|
import net.neoforged.neoforge.common.data.BlockTagsProvider;
|
||||||
import net.minecraftforge.common.data.ExistingFileHelper;
|
import net.neoforged.neoforge.common.data.ExistingFileHelper;
|
||||||
|
|
||||||
import javax.annotation.Nullable;
|
import javax.annotation.Nullable;
|
||||||
import java.util.concurrent.CompletableFuture;
|
import java.util.concurrent.CompletableFuture;
|
||||||
|
|
|
@ -1,24 +1,19 @@
|
||||||
package de.ellpeck.actuallyadditions.data;
|
package de.ellpeck.actuallyadditions.data;
|
||||||
|
|
||||||
import com.google.gson.JsonObject;
|
|
||||||
import de.ellpeck.actuallyadditions.mod.ActuallyAdditions;
|
import de.ellpeck.actuallyadditions.mod.ActuallyAdditions;
|
||||||
import de.ellpeck.actuallyadditions.mod.blocks.ActuallyBlocks;
|
import de.ellpeck.actuallyadditions.mod.blocks.ActuallyBlocks;
|
||||||
import de.ellpeck.actuallyadditions.mod.crafting.ColorChangeRecipe;
|
import de.ellpeck.actuallyadditions.mod.crafting.ColorChangeRecipe;
|
||||||
import net.minecraft.data.CachedOutput;
|
import net.minecraft.core.registries.BuiltInRegistries;
|
||||||
import net.minecraft.data.PackOutput;
|
import net.minecraft.data.PackOutput;
|
||||||
import net.minecraft.data.recipes.FinishedRecipe;
|
import net.minecraft.data.recipes.RecipeOutput;
|
||||||
import net.minecraft.data.recipes.RecipeProvider;
|
import net.minecraft.data.recipes.RecipeProvider;
|
||||||
import net.minecraft.resources.ResourceLocation;
|
import net.minecraft.resources.ResourceLocation;
|
||||||
import net.minecraft.world.item.ItemStack;
|
import net.minecraft.world.item.ItemStack;
|
||||||
import net.minecraft.world.item.Items;
|
import net.minecraft.world.item.Items;
|
||||||
import net.minecraft.world.item.crafting.Ingredient;
|
import net.minecraft.world.item.crafting.Ingredient;
|
||||||
import net.minecraft.world.level.ItemLike;
|
import net.minecraft.world.level.ItemLike;
|
||||||
import net.minecraftforge.registries.ForgeRegistries;
|
|
||||||
import org.jetbrains.annotations.Nullable;
|
|
||||||
|
|
||||||
import javax.annotation.Nonnull;
|
import javax.annotation.Nonnull;
|
||||||
import java.util.concurrent.CompletableFuture;
|
|
||||||
import java.util.function.Consumer;
|
|
||||||
|
|
||||||
public class ColorChangeGenerator extends RecipeProvider {
|
public class ColorChangeGenerator extends RecipeProvider {
|
||||||
public ColorChangeGenerator(PackOutput packOutput) {
|
public ColorChangeGenerator(PackOutput packOutput) {
|
||||||
|
@ -30,13 +25,14 @@ public class ColorChangeGenerator extends RecipeProvider {
|
||||||
return "Color Change " + super.getName();
|
return "Color Change " + super.getName();
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
// @Override //TODO: Flanks do your RecipeOutput wrapper thingy ;)
|
||||||
protected @Nullable CompletableFuture<?> saveAdvancement(CachedOutput output, FinishedRecipe finishedRecipe, JsonObject advancementJson) {
|
// protected @Nullable CompletableFuture<?> saveAdvancement(CachedOutput stack, FinishedRecipe finishedRecipe, JsonObject advancementJson) {
|
||||||
return null; //Nope...
|
// return null;
|
||||||
}
|
// //Nope... maybe later...
|
||||||
|
// }
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
protected void buildRecipes(@Nonnull Consumer<FinishedRecipe> consumer) {
|
protected void buildRecipes(@Nonnull RecipeOutput consumer) {
|
||||||
buildWool(consumer);
|
buildWool(consumer);
|
||||||
buildStainedGlass(consumer);
|
buildStainedGlass(consumer);
|
||||||
buildStainedGlassPane(consumer);
|
buildStainedGlassPane(consumer);
|
||||||
|
@ -47,7 +43,7 @@ public class ColorChangeGenerator extends RecipeProvider {
|
||||||
buildDye(consumer);
|
buildDye(consumer);
|
||||||
}
|
}
|
||||||
|
|
||||||
private void buildWool(@Nonnull Consumer<FinishedRecipe> c) {
|
private void buildWool(@Nonnull RecipeOutput c) {
|
||||||
//Wool
|
//Wool
|
||||||
changeColor(c, Items.WHITE_WOOL, Items.BLACK_WOOL);
|
changeColor(c, Items.WHITE_WOOL, Items.BLACK_WOOL);
|
||||||
changeColor(c, Items.ORANGE_WOOL, Items.WHITE_WOOL);
|
changeColor(c, Items.ORANGE_WOOL, Items.WHITE_WOOL);
|
||||||
|
@ -67,7 +63,7 @@ public class ColorChangeGenerator extends RecipeProvider {
|
||||||
changeColor(c, Items.BLACK_WOOL, Items.RED_WOOL);
|
changeColor(c, Items.BLACK_WOOL, Items.RED_WOOL);
|
||||||
}
|
}
|
||||||
|
|
||||||
private void buildStainedGlass(@Nonnull Consumer<FinishedRecipe> c) {
|
private void buildStainedGlass(@Nonnull RecipeOutput c) {
|
||||||
changeColor(c, Items.WHITE_STAINED_GLASS, Items.BLACK_STAINED_GLASS);
|
changeColor(c, Items.WHITE_STAINED_GLASS, Items.BLACK_STAINED_GLASS);
|
||||||
changeColor(c, Items.ORANGE_STAINED_GLASS, Items.WHITE_STAINED_GLASS);
|
changeColor(c, Items.ORANGE_STAINED_GLASS, Items.WHITE_STAINED_GLASS);
|
||||||
changeColor(c, Items.MAGENTA_STAINED_GLASS, Items.ORANGE_STAINED_GLASS);
|
changeColor(c, Items.MAGENTA_STAINED_GLASS, Items.ORANGE_STAINED_GLASS);
|
||||||
|
@ -86,7 +82,7 @@ public class ColorChangeGenerator extends RecipeProvider {
|
||||||
changeColor(c, Items.BLACK_STAINED_GLASS, Items.RED_STAINED_GLASS);
|
changeColor(c, Items.BLACK_STAINED_GLASS, Items.RED_STAINED_GLASS);
|
||||||
}
|
}
|
||||||
|
|
||||||
private void buildStainedGlassPane(@Nonnull Consumer<FinishedRecipe> c) {
|
private void buildStainedGlassPane(@Nonnull RecipeOutput c) {
|
||||||
changeColor(c, Items.WHITE_STAINED_GLASS_PANE, Items.BLACK_STAINED_GLASS_PANE);
|
changeColor(c, Items.WHITE_STAINED_GLASS_PANE, Items.BLACK_STAINED_GLASS_PANE);
|
||||||
changeColor(c, Items.ORANGE_STAINED_GLASS_PANE, Items.WHITE_STAINED_GLASS_PANE);
|
changeColor(c, Items.ORANGE_STAINED_GLASS_PANE, Items.WHITE_STAINED_GLASS_PANE);
|
||||||
changeColor(c, Items.MAGENTA_STAINED_GLASS_PANE, Items.ORANGE_STAINED_GLASS_PANE);
|
changeColor(c, Items.MAGENTA_STAINED_GLASS_PANE, Items.ORANGE_STAINED_GLASS_PANE);
|
||||||
|
@ -105,7 +101,7 @@ public class ColorChangeGenerator extends RecipeProvider {
|
||||||
changeColor(c, Items.BLACK_STAINED_GLASS_PANE, Items.RED_STAINED_GLASS_PANE);
|
changeColor(c, Items.BLACK_STAINED_GLASS_PANE, Items.RED_STAINED_GLASS_PANE);
|
||||||
}
|
}
|
||||||
|
|
||||||
private void buildTerracotta(@Nonnull Consumer<FinishedRecipe> c) {
|
private void buildTerracotta(@Nonnull RecipeOutput c) {
|
||||||
changeColor(c, Items.WHITE_TERRACOTTA, Items.BLACK_TERRACOTTA);
|
changeColor(c, Items.WHITE_TERRACOTTA, Items.BLACK_TERRACOTTA);
|
||||||
changeColor(c, Items.ORANGE_TERRACOTTA, Items.WHITE_TERRACOTTA);
|
changeColor(c, Items.ORANGE_TERRACOTTA, Items.WHITE_TERRACOTTA);
|
||||||
changeColor(c, Items.MAGENTA_TERRACOTTA, Items.ORANGE_TERRACOTTA);
|
changeColor(c, Items.MAGENTA_TERRACOTTA, Items.ORANGE_TERRACOTTA);
|
||||||
|
@ -124,7 +120,7 @@ public class ColorChangeGenerator extends RecipeProvider {
|
||||||
changeColor(c, Items.BLACK_TERRACOTTA, Items.RED_TERRACOTTA);
|
changeColor(c, Items.BLACK_TERRACOTTA, Items.RED_TERRACOTTA);
|
||||||
}
|
}
|
||||||
|
|
||||||
private void buildGlazedTerracotta(@Nonnull Consumer<FinishedRecipe> c) {
|
private void buildGlazedTerracotta(@Nonnull RecipeOutput c) {
|
||||||
changeColor(c, Items.WHITE_GLAZED_TERRACOTTA, Items.BLACK_GLAZED_TERRACOTTA);
|
changeColor(c, Items.WHITE_GLAZED_TERRACOTTA, Items.BLACK_GLAZED_TERRACOTTA);
|
||||||
changeColor(c, Items.ORANGE_GLAZED_TERRACOTTA, Items.WHITE_GLAZED_TERRACOTTA);
|
changeColor(c, Items.ORANGE_GLAZED_TERRACOTTA, Items.WHITE_GLAZED_TERRACOTTA);
|
||||||
changeColor(c, Items.MAGENTA_GLAZED_TERRACOTTA, Items.ORANGE_GLAZED_TERRACOTTA);
|
changeColor(c, Items.MAGENTA_GLAZED_TERRACOTTA, Items.ORANGE_GLAZED_TERRACOTTA);
|
||||||
|
@ -143,7 +139,7 @@ public class ColorChangeGenerator extends RecipeProvider {
|
||||||
changeColor(c, Items.BLACK_GLAZED_TERRACOTTA, Items.RED_GLAZED_TERRACOTTA);
|
changeColor(c, Items.BLACK_GLAZED_TERRACOTTA, Items.RED_GLAZED_TERRACOTTA);
|
||||||
}
|
}
|
||||||
|
|
||||||
private void buildCarpet(@Nonnull Consumer<FinishedRecipe> c) {
|
private void buildCarpet(@Nonnull RecipeOutput c) {
|
||||||
changeColor(c, Items.WHITE_CARPET, Items.BLACK_CARPET);
|
changeColor(c, Items.WHITE_CARPET, Items.BLACK_CARPET);
|
||||||
changeColor(c, Items.ORANGE_CARPET, Items.WHITE_CARPET);
|
changeColor(c, Items.ORANGE_CARPET, Items.WHITE_CARPET);
|
||||||
changeColor(c, Items.MAGENTA_CARPET, Items.ORANGE_CARPET);
|
changeColor(c, Items.MAGENTA_CARPET, Items.ORANGE_CARPET);
|
||||||
|
@ -162,7 +158,7 @@ public class ColorChangeGenerator extends RecipeProvider {
|
||||||
changeColor(c, Items.BLACK_CARPET, Items.RED_CARPET);
|
changeColor(c, Items.BLACK_CARPET, Items.RED_CARPET);
|
||||||
}
|
}
|
||||||
|
|
||||||
private void buildLamps(@Nonnull Consumer<FinishedRecipe> c) {
|
private void buildLamps(@Nonnull RecipeOutput c) {
|
||||||
changeColor(c, ActuallyBlocks.LAMP_WHITE.getItem(), ActuallyBlocks.LAMP_BLACK.getItem());
|
changeColor(c, ActuallyBlocks.LAMP_WHITE.getItem(), ActuallyBlocks.LAMP_BLACK.getItem());
|
||||||
changeColor(c, ActuallyBlocks.LAMP_ORANGE.getItem(), ActuallyBlocks.LAMP_WHITE.getItem());
|
changeColor(c, ActuallyBlocks.LAMP_ORANGE.getItem(), ActuallyBlocks.LAMP_WHITE.getItem());
|
||||||
changeColor(c, ActuallyBlocks.LAMP_MAGENTA.getItem(), ActuallyBlocks.LAMP_ORANGE.getItem());
|
changeColor(c, ActuallyBlocks.LAMP_MAGENTA.getItem(), ActuallyBlocks.LAMP_ORANGE.getItem());
|
||||||
|
@ -181,7 +177,7 @@ public class ColorChangeGenerator extends RecipeProvider {
|
||||||
changeColor(c, ActuallyBlocks.LAMP_BLACK.getItem(), ActuallyBlocks.LAMP_RED.getItem());
|
changeColor(c, ActuallyBlocks.LAMP_BLACK.getItem(), ActuallyBlocks.LAMP_RED.getItem());
|
||||||
}
|
}
|
||||||
|
|
||||||
private void buildDye(@Nonnull Consumer<FinishedRecipe> c) {
|
private void buildDye(@Nonnull RecipeOutput c) {
|
||||||
changeColor(c, Items.WHITE_DYE, Items.BLACK_DYE);
|
changeColor(c, Items.WHITE_DYE, Items.BLACK_DYE);
|
||||||
changeColor(c, Items.ORANGE_DYE, Items.WHITE_DYE);
|
changeColor(c, Items.ORANGE_DYE, Items.WHITE_DYE);
|
||||||
changeColor(c, Items.MAGENTA_DYE, Items.ORANGE_DYE);
|
changeColor(c, Items.MAGENTA_DYE, Items.ORANGE_DYE);
|
||||||
|
@ -201,16 +197,16 @@ public class ColorChangeGenerator extends RecipeProvider {
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
private void changeColor(Consumer<FinishedRecipe> consumer, ItemLike output, Ingredient input) {
|
private void changeColor(RecipeOutput consumer, ItemLike output, Ingredient input) {
|
||||||
consumer.accept(new ColorChangeRecipe.Result(new ResourceLocation(ActuallyAdditions.MODID, "colorchange/" + ForgeRegistries.ITEMS.getKey(output.asItem()).getPath()),
|
consumer.accept(new ResourceLocation(ActuallyAdditions.MODID, "colorchange/" + BuiltInRegistries.ITEM.getKey(output.asItem()).getPath()),
|
||||||
input, output));
|
new ColorChangeRecipe(output.asItem().getDefaultInstance(), input), null);
|
||||||
}
|
}
|
||||||
private void changeColor(Consumer<FinishedRecipe> consumer, ItemLike output, ItemLike input) {
|
private void changeColor(RecipeOutput consumer, ItemLike output, ItemLike input) {
|
||||||
consumer.accept(new ColorChangeRecipe.Result(new ResourceLocation(ActuallyAdditions.MODID, "colorchange/" + ForgeRegistries.ITEMS.getKey(output.asItem()).getPath()),
|
consumer.accept(new ResourceLocation(ActuallyAdditions.MODID, "colorchange/" + BuiltInRegistries.ITEM.getKey(output.asItem()).getPath()),
|
||||||
Ingredient.of(input), output));
|
new ColorChangeRecipe(output.asItem().getDefaultInstance(), Ingredient.of(input)), null);
|
||||||
}
|
}
|
||||||
private void changeColor(Consumer<FinishedRecipe> consumer, ItemLike output, ItemStack input) {
|
private void changeColor(RecipeOutput consumer, ItemLike output, ItemStack input) {
|
||||||
consumer.accept(new ColorChangeRecipe.Result(new ResourceLocation(ActuallyAdditions.MODID, "colorchange/" + ForgeRegistries.ITEMS.getKey(output.asItem()).getPath()),
|
consumer.accept(new ResourceLocation(ActuallyAdditions.MODID, "colorchange/" + BuiltInRegistries.ITEM.getKey(output.asItem()).getPath()),
|
||||||
Ingredient.of(input), output));
|
new ColorChangeRecipe(output.asItem().getDefaultInstance(), Ingredient.of(input)), null);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -1,19 +1,14 @@
|
||||||
package de.ellpeck.actuallyadditions.data;
|
package de.ellpeck.actuallyadditions.data;
|
||||||
|
|
||||||
import com.google.gson.JsonObject;
|
|
||||||
import de.ellpeck.actuallyadditions.mod.ActuallyAdditions;
|
import de.ellpeck.actuallyadditions.mod.ActuallyAdditions;
|
||||||
import de.ellpeck.actuallyadditions.mod.crafting.CrushingRecipe;
|
import de.ellpeck.actuallyadditions.mod.crafting.CrushingRecipe;
|
||||||
import net.minecraft.data.CachedOutput;
|
|
||||||
import net.minecraft.data.PackOutput;
|
import net.minecraft.data.PackOutput;
|
||||||
import net.minecraft.data.recipes.FinishedRecipe;
|
import net.minecraft.data.recipes.RecipeOutput;
|
||||||
import net.minecraft.data.recipes.RecipeProvider;
|
import net.minecraft.data.recipes.RecipeProvider;
|
||||||
import net.minecraft.resources.ResourceLocation;
|
import net.minecraft.resources.ResourceLocation;
|
||||||
|
import net.minecraft.world.item.ItemStack;
|
||||||
import net.minecraft.world.item.Items;
|
import net.minecraft.world.item.Items;
|
||||||
import net.minecraft.world.item.crafting.Ingredient;
|
import net.minecraft.world.item.crafting.Ingredient;
|
||||||
import org.jetbrains.annotations.Nullable;
|
|
||||||
|
|
||||||
import java.util.concurrent.CompletableFuture;
|
|
||||||
import java.util.function.Consumer;
|
|
||||||
|
|
||||||
public class CrushingRecipeGenerator extends RecipeProvider {
|
public class CrushingRecipeGenerator extends RecipeProvider {
|
||||||
public CrushingRecipeGenerator(PackOutput packOutput) {
|
public CrushingRecipeGenerator(PackOutput packOutput) {
|
||||||
|
@ -25,14 +20,15 @@ public class CrushingRecipeGenerator extends RecipeProvider {
|
||||||
return "Crushing " + super.getName();
|
return "Crushing " + super.getName();
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
// @Override //TODO: Flanks do your RecipeOutput wrapper thingy ;)
|
||||||
protected @Nullable CompletableFuture<?> saveAdvancement(CachedOutput output, FinishedRecipe finishedRecipe, JsonObject advancementJson) {
|
// protected @Nullable CompletableFuture<?> saveAdvancement(CachedOutput stack, FinishedRecipe finishedRecipe, JsonObject advancementJson) {
|
||||||
return null; //Nope...
|
// return null;
|
||||||
}
|
// //Nope... maybe later...
|
||||||
|
// }
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
protected void buildRecipes(Consumer<FinishedRecipe> consumer) {
|
protected void buildRecipes(RecipeOutput consumer) {
|
||||||
consumer.accept(new CrushingRecipe.Result(new ResourceLocation(ActuallyAdditions.MODID, "crushing/bone_crusher"),
|
CrushingRecipe recipe = new CrushingRecipe(Ingredient.of(Items.BONE), new ItemStack(Items.BONE_MEAL, 6), 1.0f, ItemStack.EMPTY, 0.0f);
|
||||||
Ingredient.of(Items.BONE), Items.BONE_MEAL, 6, 1.0f , Items.AIR, 0, 0.0f));
|
consumer.accept(new ResourceLocation(ActuallyAdditions.MODID, "crushing/iron_crusher"), recipe, null);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -6,7 +6,7 @@ import net.minecraft.core.HolderLookup;
|
||||||
import net.minecraft.data.PackOutput;
|
import net.minecraft.data.PackOutput;
|
||||||
import net.minecraft.data.tags.DamageTypeTagsProvider;
|
import net.minecraft.data.tags.DamageTypeTagsProvider;
|
||||||
import net.minecraft.tags.DamageTypeTags;
|
import net.minecraft.tags.DamageTypeTags;
|
||||||
import net.minecraftforge.common.data.ExistingFileHelper;
|
import net.neoforged.neoforge.common.data.ExistingFileHelper;
|
||||||
import org.jetbrains.annotations.Nullable;
|
import org.jetbrains.annotations.Nullable;
|
||||||
|
|
||||||
import java.util.concurrent.CompletableFuture;
|
import java.util.concurrent.CompletableFuture;
|
||||||
|
|
|
@ -1,14 +1,14 @@
|
||||||
package de.ellpeck.actuallyadditions.data;
|
package de.ellpeck.actuallyadditions.data;
|
||||||
|
|
||||||
import com.google.gson.JsonObject;
|
|
||||||
import de.ellpeck.actuallyadditions.mod.ActuallyAdditions;
|
import de.ellpeck.actuallyadditions.mod.ActuallyAdditions;
|
||||||
import de.ellpeck.actuallyadditions.mod.blocks.ActuallyBlocks;
|
import de.ellpeck.actuallyadditions.mod.blocks.ActuallyBlocks;
|
||||||
import de.ellpeck.actuallyadditions.mod.crafting.EmpowererRecipe;
|
import de.ellpeck.actuallyadditions.mod.crafting.EmpowererRecipe;
|
||||||
import de.ellpeck.actuallyadditions.mod.items.ActuallyItems;
|
import de.ellpeck.actuallyadditions.mod.items.ActuallyItems;
|
||||||
import de.ellpeck.actuallyadditions.mod.items.metalists.Crystals;
|
import de.ellpeck.actuallyadditions.mod.items.metalists.Crystals;
|
||||||
import net.minecraft.data.CachedOutput;
|
import net.minecraft.core.NonNullList;
|
||||||
|
import net.minecraft.core.registries.BuiltInRegistries;
|
||||||
import net.minecraft.data.PackOutput;
|
import net.minecraft.data.PackOutput;
|
||||||
import net.minecraft.data.recipes.FinishedRecipe;
|
import net.minecraft.data.recipes.RecipeOutput;
|
||||||
import net.minecraft.data.recipes.RecipeProvider;
|
import net.minecraft.data.recipes.RecipeProvider;
|
||||||
import net.minecraft.resources.ResourceLocation;
|
import net.minecraft.resources.ResourceLocation;
|
||||||
import net.minecraft.tags.ItemTags;
|
import net.minecraft.tags.ItemTags;
|
||||||
|
@ -18,14 +18,7 @@ import net.minecraft.world.item.ItemStack;
|
||||||
import net.minecraft.world.item.Items;
|
import net.minecraft.world.item.Items;
|
||||||
import net.minecraft.world.item.crafting.Ingredient;
|
import net.minecraft.world.item.crafting.Ingredient;
|
||||||
import net.minecraft.world.level.ItemLike;
|
import net.minecraft.world.level.ItemLike;
|
||||||
import net.minecraftforge.common.Tags;
|
import net.neoforged.neoforge.common.Tags;
|
||||||
import net.minecraftforge.registries.ForgeRegistries;
|
|
||||||
import org.jetbrains.annotations.Nullable;
|
|
||||||
|
|
||||||
import java.util.ArrayList;
|
|
||||||
import java.util.List;
|
|
||||||
import java.util.concurrent.CompletableFuture;
|
|
||||||
import java.util.function.Consumer;
|
|
||||||
|
|
||||||
public class EmpoweringRecipeGenerator extends RecipeProvider {
|
public class EmpoweringRecipeGenerator extends RecipeProvider {
|
||||||
public EmpoweringRecipeGenerator(PackOutput packOutput) {
|
public EmpoweringRecipeGenerator(PackOutput packOutput) {
|
||||||
|
@ -37,13 +30,14 @@ public class EmpoweringRecipeGenerator extends RecipeProvider {
|
||||||
return "Empowering " + super.getName();
|
return "Empowering " + super.getName();
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
// @Override //TODO: Flanks do your RecipeOutput wrapper thingy ;)
|
||||||
protected @Nullable CompletableFuture<?> saveAdvancement(CachedOutput output, FinishedRecipe finishedRecipe, JsonObject advancementJson) {
|
// protected @Nullable CompletableFuture<?> saveAdvancement(CachedOutput stack, FinishedRecipe finishedRecipe, JsonObject advancementJson) {
|
||||||
return null; //Nope...
|
// return null;
|
||||||
}
|
// //Nope... maybe later...
|
||||||
|
// }
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
protected void buildRecipes(Consumer<FinishedRecipe> consumer) {
|
protected void buildRecipes(RecipeOutput consumer) {
|
||||||
EmpoweringBuilder.builder(ActuallyItems.EMPOWERED_RESTONIA_CRYSTAL.get(), ActuallyItems.RESTONIA_CRYSTAL.get(), 5000, 50, Crystals.REDSTONE.conversionColorParticles)
|
EmpoweringBuilder.builder(ActuallyItems.EMPOWERED_RESTONIA_CRYSTAL.get(), ActuallyItems.RESTONIA_CRYSTAL.get(), 5000, 50, Crystals.REDSTONE.conversionColorParticles)
|
||||||
.addModifier(Tags.Items.DYES_RED)
|
.addModifier(Tags.Items.DYES_RED)
|
||||||
.addModifier(Items.NETHER_BRICK)
|
.addModifier(Items.NETHER_BRICK)
|
||||||
|
@ -124,7 +118,7 @@ public class EmpoweringRecipeGenerator extends RecipeProvider {
|
||||||
private final int energy;
|
private final int energy;
|
||||||
private final int time;
|
private final int time;
|
||||||
private final int color;
|
private final int color;
|
||||||
private final List<Ingredient> modifiers = new ArrayList<>();
|
private final NonNullList<Ingredient> modifiers = NonNullList.create();
|
||||||
|
|
||||||
public EmpoweringBuilder(ItemLike resultIn, Ingredient baseIn, int energyIn, int timeIn, int colorIn) {
|
public EmpoweringBuilder(ItemLike resultIn, Ingredient baseIn, int energyIn, int timeIn, int colorIn) {
|
||||||
result = resultIn.asItem();
|
result = resultIn.asItem();
|
||||||
|
@ -140,14 +134,14 @@ public class EmpoweringRecipeGenerator extends RecipeProvider {
|
||||||
|
|
||||||
public EmpoweringBuilder addModifier(ItemLike input) {
|
public EmpoweringBuilder addModifier(ItemLike input) {
|
||||||
if (modifiers.size() >= 4)
|
if (modifiers.size() >= 4)
|
||||||
throw new IllegalStateException("too many modifiers for empowering recipe, input: " + ForgeRegistries.ITEMS.getKey(input.asItem()));
|
throw new IllegalStateException("too many modifiers for empowering recipe, input: " + BuiltInRegistries.ITEM.getKey(input.asItem()));
|
||||||
modifiers.add(Ingredient.of(input));
|
modifiers.add(Ingredient.of(input));
|
||||||
return this;
|
return this;
|
||||||
}
|
}
|
||||||
|
|
||||||
public EmpoweringBuilder addModifier(ItemStack input) {
|
public EmpoweringBuilder addModifier(ItemStack input) {
|
||||||
if (modifiers.size() >= 4)
|
if (modifiers.size() >= 4)
|
||||||
throw new IllegalStateException("too many modifiers for empowering recipe, input: " + ForgeRegistries.ITEMS.getKey(input.getItem()));
|
throw new IllegalStateException("too many modifiers for empowering recipe, input: " + BuiltInRegistries.ITEM.getKey(input.getItem()));
|
||||||
modifiers.add(Ingredient.of(input));
|
modifiers.add(Ingredient.of(input));
|
||||||
return this;
|
return this;
|
||||||
}
|
}
|
||||||
|
@ -159,17 +153,21 @@ public class EmpoweringRecipeGenerator extends RecipeProvider {
|
||||||
return this;
|
return this;
|
||||||
}
|
}
|
||||||
|
|
||||||
public void save(Consumer<FinishedRecipe> consumer, ResourceLocation name) {
|
public void save(RecipeOutput consumer, ResourceLocation name) {
|
||||||
if (modifiers.size() != 4)
|
if (modifiers.size() != 4)
|
||||||
throw new IllegalStateException("invalid modifier count: " + modifiers.size() + ", recipe: " + name.toString());
|
throw new IllegalStateException("invalid modifier count: " + modifiers.size() + ", recipe: " + name.toString());
|
||||||
consumer.accept(new EmpowererRecipe.Result(name, result, base, modifiers.get(0), modifiers.get(1), modifiers.get(2), modifiers.get(3), energy, color, time));
|
|
||||||
|
EmpowererRecipe recipe = new EmpowererRecipe(result.getDefaultInstance(), base, modifiers, energy, color, time);
|
||||||
|
consumer.accept(name, recipe, null);
|
||||||
}
|
}
|
||||||
|
|
||||||
public void save(Consumer<FinishedRecipe> consumer, String name) {
|
public void save(RecipeOutput consumer, String name) {
|
||||||
ResourceLocation res = new ResourceLocation(ActuallyAdditions.MODID, "empowering/" + name);
|
ResourceLocation res = new ResourceLocation(ActuallyAdditions.MODID, "empowering/" + name);
|
||||||
if (modifiers.size() != 4)
|
if (modifiers.size() != 4)
|
||||||
throw new IllegalStateException("invalid modifier count: " + modifiers.size() + ", recipe: " + res);
|
throw new IllegalStateException("invalid modifier count: " + modifiers.size() + ", recipe: " + res);
|
||||||
consumer.accept(new EmpowererRecipe.Result(res, result, base, modifiers.get(0), modifiers.get(1), modifiers.get(2), modifiers.get(3), energy, color, time));
|
|
||||||
|
EmpowererRecipe recipe = new EmpowererRecipe(result.getDefaultInstance(), base, modifiers, energy, color, time);
|
||||||
|
consumer.accept(res, recipe, null);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -1,26 +1,21 @@
|
||||||
package de.ellpeck.actuallyadditions.data;
|
package de.ellpeck.actuallyadditions.data;
|
||||||
|
|
||||||
import com.google.gson.JsonObject;
|
|
||||||
import de.ellpeck.actuallyadditions.api.ActuallyTags;
|
import de.ellpeck.actuallyadditions.api.ActuallyTags;
|
||||||
import de.ellpeck.actuallyadditions.mod.ActuallyAdditions;
|
import de.ellpeck.actuallyadditions.mod.ActuallyAdditions;
|
||||||
import de.ellpeck.actuallyadditions.mod.crafting.LiquidFuelRecipe;
|
import de.ellpeck.actuallyadditions.mod.crafting.LiquidFuelRecipe;
|
||||||
import de.ellpeck.actuallyadditions.mod.crafting.SolidFuelRecipe;
|
import de.ellpeck.actuallyadditions.mod.crafting.SolidFuelRecipe;
|
||||||
import de.ellpeck.actuallyadditions.mod.fluids.InitFluids;
|
import de.ellpeck.actuallyadditions.mod.fluids.InitFluids;
|
||||||
import net.minecraft.data.CachedOutput;
|
|
||||||
import net.minecraft.data.PackOutput;
|
import net.minecraft.data.PackOutput;
|
||||||
import net.minecraft.data.recipes.FinishedRecipe;
|
import net.minecraft.data.recipes.RecipeOutput;
|
||||||
import net.minecraft.data.recipes.RecipeProvider;
|
import net.minecraft.data.recipes.RecipeProvider;
|
||||||
import net.minecraft.resources.ResourceLocation;
|
import net.minecraft.resources.ResourceLocation;
|
||||||
import net.minecraft.tags.TagKey;
|
import net.minecraft.tags.TagKey;
|
||||||
import net.minecraft.world.item.Item;
|
import net.minecraft.world.item.Item;
|
||||||
import net.minecraft.world.item.Items;
|
import net.minecraft.world.item.Items;
|
||||||
import net.minecraft.world.item.crafting.Ingredient;
|
import net.minecraft.world.item.crafting.Ingredient;
|
||||||
import net.minecraftforge.fluids.FluidStack;
|
import net.neoforged.neoforge.fluids.FluidStack;
|
||||||
import org.jetbrains.annotations.Nullable;
|
|
||||||
|
|
||||||
import javax.annotation.Nonnull;
|
import javax.annotation.Nonnull;
|
||||||
import java.util.concurrent.CompletableFuture;
|
|
||||||
import java.util.function.Consumer;
|
|
||||||
|
|
||||||
public class FuelRecipeGenerator extends RecipeProvider {
|
public class FuelRecipeGenerator extends RecipeProvider {
|
||||||
public FuelRecipeGenerator(PackOutput packOutput) {
|
public FuelRecipeGenerator(PackOutput packOutput) {
|
||||||
|
@ -32,13 +27,14 @@ public class FuelRecipeGenerator extends RecipeProvider {
|
||||||
return "Fuel " + super.getName();
|
return "Fuel " + super.getName();
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
// @Override //TODO: Flanks do your RecipeOutput wrapper thingy ;)
|
||||||
protected @Nullable CompletableFuture<?> saveAdvancement(CachedOutput output, FinishedRecipe finishedRecipe, JsonObject advancementJson) {
|
// protected @Nullable CompletableFuture<?> saveAdvancement(CachedOutput stack, FinishedRecipe finishedRecipe, JsonObject advancementJson) {
|
||||||
return null; //Nope...
|
// return null;
|
||||||
}
|
// //Nope... maybe later...
|
||||||
|
// }
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
protected void buildRecipes(@Nonnull Consumer<FinishedRecipe> consumer) {
|
protected void buildRecipes(@Nonnull RecipeOutput consumer) {
|
||||||
addSolid(consumer, "coal", Items.COAL, 32000, 1600);
|
addSolid(consumer, "coal", Items.COAL, 32000, 1600);
|
||||||
addSolid(consumer, "stick", Items.STICK, 2000, 100);
|
addSolid(consumer, "stick", Items.STICK, 2000, 100);
|
||||||
addSolid(consumer, "tiny-coal", ActuallyTags.Items.TINY_COALS, 4000, 200);
|
addSolid(consumer, "tiny-coal", ActuallyTags.Items.TINY_COALS, 4000, 200);
|
||||||
|
@ -46,26 +42,29 @@ public class FuelRecipeGenerator extends RecipeProvider {
|
||||||
addSolid(consumer, "coal-block", Items.COAL_BLOCK, 320000, 16000);
|
addSolid(consumer, "coal-block", Items.COAL_BLOCK, 320000, 16000);
|
||||||
addSolid(consumer, "lava", Items.LAVA_BUCKET, 400000, 20000);
|
addSolid(consumer, "lava", Items.LAVA_BUCKET, 400000, 20000);
|
||||||
|
|
||||||
consumer.accept(new LiquidFuelRecipe.Result(new ResourceLocation(ActuallyAdditions.MODID, "liquid_fuel/canola_oil"),
|
consumer.accept(new ResourceLocation(ActuallyAdditions.MODID, "liquid_fuel/canola_oil"), new LiquidFuelRecipe(
|
||||||
new FluidStack(InitFluids.CANOLA_OIL.get(), 50), 4000, 100));
|
new FluidStack(InitFluids.CANOLA_OIL.get(), 50), 4000, 100), null);
|
||||||
|
|
||||||
consumer.accept(new LiquidFuelRecipe.Result(new ResourceLocation(ActuallyAdditions.MODID, "liquid_fuel/refined_canola_oil"),
|
consumer.accept(new ResourceLocation(ActuallyAdditions.MODID, "liquid_fuel/refined_canola_oil"), new LiquidFuelRecipe(
|
||||||
new FluidStack(InitFluids.REFINED_CANOLA_OIL.get(), 50), 9600, 120));
|
new FluidStack(InitFluids.REFINED_CANOLA_OIL.get(), 50), 9600, 120), null);
|
||||||
|
|
||||||
consumer.accept(new LiquidFuelRecipe.Result(new ResourceLocation(ActuallyAdditions.MODID, "liquid_fuel/crystallized_canola_oil"),
|
consumer.accept(new ResourceLocation(ActuallyAdditions.MODID, "liquid_fuel/crystallized_canola_oil"),new LiquidFuelRecipe(
|
||||||
new FluidStack(InitFluids.CRYSTALLIZED_OIL.get(), 50), 28000, 280));
|
new FluidStack(InitFluids.CRYSTALLIZED_OIL.get(), 50), 28000, 280), null);
|
||||||
|
|
||||||
consumer.accept(new LiquidFuelRecipe.Result(new ResourceLocation(ActuallyAdditions.MODID, "liquid_fuel/empowered_canola_oil"),
|
consumer.accept(new ResourceLocation(ActuallyAdditions.MODID, "liquid_fuel/empowered_canola_oil"), new LiquidFuelRecipe(
|
||||||
new FluidStack(InitFluids.EMPOWERED_OIL.get(), 50), 48000, 400));
|
new FluidStack(InitFluids.EMPOWERED_OIL.get(), 50), 48000, 400), null);
|
||||||
}
|
}
|
||||||
|
|
||||||
private void addSolid(Consumer<FinishedRecipe> consumer, String name, Item item, int energy, int burnTime) {
|
private void addSolid(RecipeOutput consumer, String name, Item item, int energy, int burnTime) {
|
||||||
consumer.accept(new SolidFuelRecipe.Result(new ResourceLocation(ActuallyAdditions.MODID, "solid_fuel/"+name), Ingredient.of(item), energy, burnTime));
|
ResourceLocation id = new ResourceLocation(ActuallyAdditions.MODID, "solid_fuel/"+name);
|
||||||
|
consumer.accept(id, new SolidFuelRecipe(Ingredient.of(item), energy, burnTime), null);
|
||||||
}
|
}
|
||||||
private void addSolid(Consumer<FinishedRecipe> consumer, String name, Ingredient item, int energy, int burnTime) {
|
private void addSolid(RecipeOutput consumer, String name, Ingredient item, int energy, int burnTime) {
|
||||||
consumer.accept(new SolidFuelRecipe.Result(new ResourceLocation(ActuallyAdditions.MODID, "solid_fuel/"+name), item, energy, burnTime));
|
ResourceLocation id = new ResourceLocation(ActuallyAdditions.MODID, "solid_fuel/"+name);
|
||||||
|
consumer.accept(id, new SolidFuelRecipe(item, energy, burnTime), null);
|
||||||
}
|
}
|
||||||
private void addSolid(Consumer<FinishedRecipe> consumer, String name, TagKey<Item> tag, int energy, int burnTime) {
|
private void addSolid(RecipeOutput consumer, String name, TagKey<Item> tag, int energy, int burnTime) {
|
||||||
consumer.accept(new SolidFuelRecipe.Result(new ResourceLocation(ActuallyAdditions.MODID, "solid_fuel/"+name), Ingredient.of(tag), energy, burnTime));
|
ResourceLocation id = new ResourceLocation(ActuallyAdditions.MODID, "solid_fuel/"+name);
|
||||||
|
consumer.accept(id, new SolidFuelRecipe(Ingredient.of(tag), energy, burnTime), null);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -6,17 +6,17 @@ import de.ellpeck.actuallyadditions.mod.blocks.ActuallyBlocks;
|
||||||
import de.ellpeck.actuallyadditions.mod.fluids.FluidAA;
|
import de.ellpeck.actuallyadditions.mod.fluids.FluidAA;
|
||||||
import de.ellpeck.actuallyadditions.mod.fluids.InitFluids;
|
import de.ellpeck.actuallyadditions.mod.fluids.InitFluids;
|
||||||
import de.ellpeck.actuallyadditions.mod.items.ActuallyItems;
|
import de.ellpeck.actuallyadditions.mod.items.ActuallyItems;
|
||||||
|
import net.minecraft.core.registries.BuiltInRegistries;
|
||||||
import net.minecraft.data.PackOutput;
|
import net.minecraft.data.PackOutput;
|
||||||
import net.minecraft.resources.ResourceLocation;
|
import net.minecraft.resources.ResourceLocation;
|
||||||
import net.minecraft.world.item.Item;
|
import net.minecraft.world.item.Item;
|
||||||
import net.minecraft.world.level.block.Block;
|
import net.minecraft.world.level.block.Block;
|
||||||
import net.minecraft.world.level.block.WallBlock;
|
import net.minecraft.world.level.block.WallBlock;
|
||||||
import net.minecraftforge.client.model.generators.ItemModelProvider;
|
import net.neoforged.neoforge.client.model.generators.ItemModelProvider;
|
||||||
import net.minecraftforge.client.model.generators.ModelFile;
|
import net.neoforged.neoforge.client.model.generators.ModelFile;
|
||||||
import net.minecraftforge.client.model.generators.loaders.DynamicFluidContainerModelBuilder;
|
import net.neoforged.neoforge.client.model.generators.loaders.DynamicFluidContainerModelBuilder;
|
||||||
import net.minecraftforge.common.data.ExistingFileHelper;
|
import net.neoforged.neoforge.common.data.ExistingFileHelper;
|
||||||
import net.minecraftforge.registries.ForgeRegistries;
|
import net.neoforged.neoforge.registries.DeferredHolder;
|
||||||
import net.minecraftforge.registries.RegistryObject;
|
|
||||||
|
|
||||||
import java.util.Set;
|
import java.util.Set;
|
||||||
import java.util.function.Supplier;
|
import java.util.function.Supplier;
|
||||||
|
@ -71,16 +71,16 @@ public class ItemModelGenerator extends ItemModelProvider {
|
||||||
.override().predicate(new ResourceLocation(ActuallyAdditions.MODID, "snail"), 1F)
|
.override().predicate(new ResourceLocation(ActuallyAdditions.MODID, "snail"), 1F)
|
||||||
.model(getBuilder("snail").parent(getExistingFile(mcLoc("item/handheld"))).texture("layer0", "item/snail")).end();*/
|
.model(getBuilder("snail").parent(getExistingFile(mcLoc("item/handheld"))).texture("layer0", "item/snail")).end();*/
|
||||||
|
|
||||||
String torchPath = ForgeRegistries.ITEMS.getKey(ActuallyBlocks.TINY_TORCH.getItem()).getPath();
|
String torchPath = BuiltInRegistries.ITEM.getKey(ActuallyBlocks.TINY_TORCH.getItem()).getPath();
|
||||||
singleTexture(torchPath, mcLoc("item/generated"), "layer0", modLoc("block/" + torchPath));
|
singleTexture(torchPath, mcLoc("item/generated"), "layer0", modLoc("block/" + torchPath));
|
||||||
}
|
}
|
||||||
|
|
||||||
private void generateBucket(FluidAA fluidSupplier) {
|
private void generateBucket(FluidAA fluidSupplier) {
|
||||||
withExistingParent(ForgeRegistries.ITEMS.getKey(fluidSupplier.getBucket()).getPath(), "forge:item/bucket")
|
withExistingParent(BuiltInRegistries.ITEM.getKey(fluidSupplier.getBucket()).getPath(), "forge:item/bucket")
|
||||||
.customLoader((builder, template) -> DynamicFluidContainerModelBuilder.begin(builder, template).fluid(fluidSupplier.get()));
|
.customLoader((builder, template) -> DynamicFluidContainerModelBuilder.begin(builder, template).fluid(fluidSupplier.get()));
|
||||||
}
|
}
|
||||||
|
|
||||||
private void registerBlockModel(RegistryObject<Block> block) {
|
private void registerBlockModel(DeferredHolder<Block, ? extends Block> block) {
|
||||||
String path = block.getId().getPath();
|
String path = block.getId().getPath();
|
||||||
if (block.get() instanceof WallBlock) {
|
if (block.get() instanceof WallBlock) {
|
||||||
String name = path;
|
String name = path;
|
||||||
|
@ -93,7 +93,7 @@ public class ItemModelGenerator extends ItemModelProvider {
|
||||||
}
|
}
|
||||||
|
|
||||||
private void simpleItem(Supplier<Item> item) {
|
private void simpleItem(Supplier<Item> item) {
|
||||||
String path = ForgeRegistries.ITEMS.getKey(item.get()).getPath();
|
String path = BuiltInRegistries.ITEM.getKey(item.get()).getPath();
|
||||||
singleTexture(path, mcLoc("item/handheld"), "layer0", modLoc("item/" + path));
|
singleTexture(path, mcLoc("item/handheld"), "layer0", modLoc("item/" + path));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -1,17 +1,13 @@
|
||||||
package de.ellpeck.actuallyadditions.data;
|
package de.ellpeck.actuallyadditions.data;
|
||||||
|
|
||||||
import com.google.gson.JsonObject;
|
|
||||||
import de.ellpeck.actuallyadditions.mod.ActuallyAdditions;
|
import de.ellpeck.actuallyadditions.mod.ActuallyAdditions;
|
||||||
import de.ellpeck.actuallyadditions.mod.blocks.ActuallyBlocks;
|
import de.ellpeck.actuallyadditions.mod.blocks.ActuallyBlocks;
|
||||||
import de.ellpeck.actuallyadditions.mod.config.conditions.BoolConfigCondition;
|
import de.ellpeck.actuallyadditions.mod.config.conditions.BoolConfigCondition;
|
||||||
import de.ellpeck.actuallyadditions.mod.crafting.ActuallyRecipes;
|
|
||||||
import de.ellpeck.actuallyadditions.mod.crafting.TargetNBTIngredient;
|
|
||||||
import de.ellpeck.actuallyadditions.mod.crafting.WrappedRecipe;
|
|
||||||
import de.ellpeck.actuallyadditions.mod.items.ActuallyItems;
|
import de.ellpeck.actuallyadditions.mod.items.ActuallyItems;
|
||||||
import net.minecraft.data.CachedOutput;
|
import net.minecraft.core.registries.BuiltInRegistries;
|
||||||
import net.minecraft.data.PackOutput;
|
import net.minecraft.data.PackOutput;
|
||||||
import net.minecraft.data.recipes.FinishedRecipe;
|
|
||||||
import net.minecraft.data.recipes.RecipeCategory;
|
import net.minecraft.data.recipes.RecipeCategory;
|
||||||
|
import net.minecraft.data.recipes.RecipeOutput;
|
||||||
import net.minecraft.data.recipes.RecipeProvider;
|
import net.minecraft.data.recipes.RecipeProvider;
|
||||||
import net.minecraft.data.recipes.ShapedRecipeBuilder;
|
import net.minecraft.data.recipes.ShapedRecipeBuilder;
|
||||||
import net.minecraft.data.recipes.ShapelessRecipeBuilder;
|
import net.minecraft.data.recipes.ShapelessRecipeBuilder;
|
||||||
|
@ -22,17 +18,12 @@ import net.minecraft.world.item.ItemStack;
|
||||||
import net.minecraft.world.item.Items;
|
import net.minecraft.world.item.Items;
|
||||||
import net.minecraft.world.item.enchantment.Enchantments;
|
import net.minecraft.world.item.enchantment.Enchantments;
|
||||||
import net.minecraft.world.level.ItemLike;
|
import net.minecraft.world.level.ItemLike;
|
||||||
import net.minecraftforge.common.Tags;
|
import net.neoforged.neoforge.common.Tags;
|
||||||
import net.minecraftforge.common.crafting.ConditionalRecipe;
|
import net.neoforged.neoforge.common.crafting.NBTIngredient;
|
||||||
import net.minecraftforge.common.crafting.StrictNBTIngredient;
|
import net.neoforged.neoforge.registries.DeferredItem;
|
||||||
import net.minecraftforge.registries.ForgeRegistries;
|
|
||||||
import net.minecraftforge.registries.RegistryObject;
|
|
||||||
import org.jetbrains.annotations.Nullable;
|
|
||||||
|
|
||||||
import javax.annotation.Nonnull;
|
import javax.annotation.Nonnull;
|
||||||
import java.util.Arrays;
|
import java.util.Arrays;
|
||||||
import java.util.concurrent.CompletableFuture;
|
|
||||||
import java.util.function.Consumer;
|
|
||||||
|
|
||||||
public class ItemRecipeGenerator extends RecipeProvider {
|
public class ItemRecipeGenerator extends RecipeProvider {
|
||||||
public ItemRecipeGenerator(PackOutput packOutput) {
|
public ItemRecipeGenerator(PackOutput packOutput) {
|
||||||
|
@ -45,7 +36,7 @@ public class ItemRecipeGenerator extends RecipeProvider {
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
protected void buildRecipes(Consumer<FinishedRecipe> consumer) {
|
protected void buildRecipes(RecipeOutput consumer) {
|
||||||
generatePaxels(consumer);
|
generatePaxels(consumer);
|
||||||
|
|
||||||
//Goggles
|
//Goggles
|
||||||
|
@ -156,7 +147,7 @@ public class ItemRecipeGenerator extends RecipeProvider {
|
||||||
Recipe.shapeless(ActuallyItems.LENS_OF_THE_KILLER.get())
|
Recipe.shapeless(ActuallyItems.LENS_OF_THE_KILLER.get())
|
||||||
.requires(Items.DIAMOND_SWORD)
|
.requires(Items.DIAMOND_SWORD)
|
||||||
.requires(ActuallyItems.LENS_OF_CERTAIN_DEATH.get())
|
.requires(ActuallyItems.LENS_OF_CERTAIN_DEATH.get())
|
||||||
.requires(StrictNBTIngredient.of(enchantedBook)).save(consumer);
|
.requires(NBTIngredient.of(true, enchantedBook)).save(consumer);
|
||||||
|
|
||||||
|
|
||||||
//Filter
|
//Filter
|
||||||
|
@ -374,45 +365,45 @@ public class ItemRecipeGenerator extends RecipeProvider {
|
||||||
.define('C', ActuallyItems.ADVANCED_COIL.get())
|
.define('C', ActuallyItems.ADVANCED_COIL.get())
|
||||||
.save(consumer);
|
.save(consumer);
|
||||||
|
|
||||||
//Double Battery
|
// //Double Battery TODO: Flanks please fix these :)
|
||||||
Recipe.shaped(ActuallyItems.DOUBLE_BATTERY.get())
|
// Recipe.shaped(ActuallyItems.DOUBLE_BATTERY.get())
|
||||||
.pattern(" R ")
|
// .pattern(" R ")
|
||||||
.pattern("ICI")
|
// .pattern("ICI")
|
||||||
.pattern("III")
|
// .pattern("III")
|
||||||
.define('R', TargetNBTIngredient.of(ActuallyItems.SINGLE_BATTERY.get()))
|
// .define('R', TargetNBTIngredient.of(ActuallyItems.SINGLE_BATTERY.get()))
|
||||||
.define('I', ActuallyItems.ENORI_CRYSTAL.get())
|
// .define('I', ActuallyItems.ENORI_CRYSTAL.get())
|
||||||
.define('C', ActuallyItems.ADVANCED_COIL.get())
|
// .define('C', ActuallyItems.ADVANCED_COIL.get())
|
||||||
.save(WrappedRecipe.Inject(consumer, ActuallyRecipes.KEEP_DATA_SHAPED_RECIPE.get()));
|
// .save(WrappedRecipe.Inject(consumer, ActuallyRecipes.KEEP_DATA_SHAPED_RECIPE.get()));
|
||||||
|
//
|
||||||
//Triple Battery
|
// //Triple Battery
|
||||||
Recipe.shaped(ActuallyItems.TRIPLE_BATTERY.get())
|
// Recipe.shaped(ActuallyItems.TRIPLE_BATTERY.get())
|
||||||
.pattern(" R ")
|
// .pattern(" R ")
|
||||||
.pattern("ICI")
|
// .pattern("ICI")
|
||||||
.pattern("III")
|
// .pattern("III")
|
||||||
.define('R', TargetNBTIngredient.of(ActuallyItems.DOUBLE_BATTERY.get()))
|
// .define('R', TargetNBTIngredient.of(ActuallyItems.DOUBLE_BATTERY.get()))
|
||||||
.define('I', ActuallyItems.EMPOWERED_ENORI_CRYSTAL.get())
|
// .define('I', ActuallyItems.EMPOWERED_ENORI_CRYSTAL.get())
|
||||||
.define('C', ActuallyItems.ADVANCED_COIL.get())
|
// .define('C', ActuallyItems.ADVANCED_COIL.get())
|
||||||
.save(WrappedRecipe.Inject(consumer, ActuallyRecipes.KEEP_DATA_SHAPED_RECIPE.get()));
|
// .save(WrappedRecipe.Inject(consumer, ActuallyRecipes.KEEP_DATA_SHAPED_RECIPE.get()));
|
||||||
|
//
|
||||||
//Quad Battery
|
// //Quad Battery
|
||||||
Recipe.shaped(ActuallyItems.QUADRUPLE_BATTERY.get())
|
// Recipe.shaped(ActuallyItems.QUADRUPLE_BATTERY.get())
|
||||||
.pattern(" R ")
|
// .pattern(" R ")
|
||||||
.pattern("ICI")
|
// .pattern("ICI")
|
||||||
.pattern("III")
|
// .pattern("III")
|
||||||
.define('R', TargetNBTIngredient.of(ActuallyItems.TRIPLE_BATTERY.get()))
|
// .define('R', TargetNBTIngredient.of(ActuallyItems.TRIPLE_BATTERY.get()))
|
||||||
.define('I', ActuallyItems.EMPOWERED_ENORI_CRYSTAL.get())
|
// .define('I', ActuallyItems.EMPOWERED_ENORI_CRYSTAL.get())
|
||||||
.define('C', ActuallyItems.ADVANCED_COIL.get())
|
// .define('C', ActuallyItems.ADVANCED_COIL.get())
|
||||||
.save(WrappedRecipe.Inject(consumer, ActuallyRecipes.KEEP_DATA_SHAPED_RECIPE.get()));
|
// .save(WrappedRecipe.Inject(consumer, ActuallyRecipes.KEEP_DATA_SHAPED_RECIPE.get()));
|
||||||
|
//
|
||||||
//Quintuple Battery
|
// //Quintuple Battery
|
||||||
Recipe.shaped(ActuallyItems.QUINTUPLE_BATTERY.get())
|
// Recipe.shaped(ActuallyItems.QUINTUPLE_BATTERY.get())
|
||||||
.pattern(" R ")
|
// .pattern(" R ")
|
||||||
.pattern("ICI")
|
// .pattern("ICI")
|
||||||
.pattern("III")
|
// .pattern("III")
|
||||||
.define('R', TargetNBTIngredient.of(ActuallyItems.QUADRUPLE_BATTERY.get()))
|
// .define('R', TargetNBTIngredient.of(ActuallyItems.QUADRUPLE_BATTERY.get()))
|
||||||
.define('I', ActuallyItems.EMPOWERED_DIAMATINE_CRYSTAL.get())
|
// .define('I', ActuallyItems.EMPOWERED_DIAMATINE_CRYSTAL.get())
|
||||||
.define('C', ActuallyItems.ADVANCED_COIL.get())
|
// .define('C', ActuallyItems.ADVANCED_COIL.get())
|
||||||
.save(WrappedRecipe.Inject(consumer, ActuallyRecipes.KEEP_DATA_SHAPED_RECIPE.get()));
|
// .save(WrappedRecipe.Inject(consumer, ActuallyRecipes.KEEP_DATA_SHAPED_RECIPE.get()));
|
||||||
|
|
||||||
//Magnet Ring
|
//Magnet Ring
|
||||||
Recipe.shaped(ActuallyItems.RING_OF_MAGNETIZING.get())
|
Recipe.shaped(ActuallyItems.RING_OF_MAGNETIZING.get())
|
||||||
|
@ -433,31 +424,19 @@ public class ItemRecipeGenerator extends RecipeProvider {
|
||||||
|
|
||||||
Recipe.shapeless(ActuallyItems.CRAFTER_ON_A_STICK.get()).requires(Items.CRAFTING_TABLE).requires(ItemTags.SIGNS).save(consumer);
|
Recipe.shapeless(ActuallyItems.CRAFTER_ON_A_STICK.get()).requires(Items.CRAFTING_TABLE).requires(ItemTags.SIGNS).save(consumer);
|
||||||
|
|
||||||
ConditionalRecipe.builder()
|
RecipeOutput boolConsumer = consumer.withConditions(new BoolConfigCondition("tinyCoalStuff"));
|
||||||
.addCondition(new BoolConfigCondition("tinyCoalStuff"))
|
|
||||||
.addRecipe(
|
|
||||||
Recipe.shapeless(ActuallyItems.TINY_COAL.get(), 8)
|
|
||||||
.requires(Items.COAL)::save)
|
|
||||||
.generateAdvancement().build(consumer, new ResourceLocation(ActuallyAdditions.MODID, "coal_to_tiny"));
|
|
||||||
ConditionalRecipe.builder()
|
|
||||||
.addCondition(new BoolConfigCondition("tinyCoalStuff"))
|
|
||||||
.addRecipe(
|
|
||||||
Recipe.shapeless(ActuallyItems.TINY_CHARCOAL.get(), 8)
|
|
||||||
.requires(Items.CHARCOAL)::save)
|
|
||||||
.generateAdvancement().build(consumer, new ResourceLocation(ActuallyAdditions.MODID, "charcoal_to_tiny"));
|
|
||||||
|
|
||||||
ConditionalRecipe.builder()
|
Recipe.shapeless(ActuallyItems.TINY_COAL.get(), 8)
|
||||||
.addCondition(new BoolConfigCondition("tinyCoalStuff"))
|
.requires(Items.COAL)
|
||||||
.addRecipe(
|
.save(boolConsumer, new ResourceLocation(ActuallyAdditions.MODID, "coal_to_tiny"));
|
||||||
Recipe.shaped(Items.COAL)
|
Recipe.shapeless(ActuallyItems.TINY_CHARCOAL.get(), 8)
|
||||||
.pattern("CCC", "C C", "CCC").define('C', ActuallyItems.TINY_COAL.get())::save)
|
.requires(Items.CHARCOAL).save(boolConsumer, new ResourceLocation(ActuallyAdditions.MODID, "charcoal_to_tiny"));
|
||||||
.generateAdvancement().build(consumer, new ResourceLocation(ActuallyAdditions.MODID, "tiny_to_coal"));
|
Recipe.shaped(Items.COAL)
|
||||||
ConditionalRecipe.builder()
|
.pattern("CCC", "C C", "CCC").define('C', ActuallyItems.TINY_COAL.get())
|
||||||
.addCondition(new BoolConfigCondition("tinyCoalStuff"))
|
.save(boolConsumer, new ResourceLocation(ActuallyAdditions.MODID, "tiny_to_coal"));
|
||||||
.addRecipe(
|
Recipe.shaped(Items.CHARCOAL)
|
||||||
Recipe.shaped(Items.CHARCOAL)
|
.pattern("CCC", "C C", "CCC").define('C', ActuallyItems.TINY_CHARCOAL.get())
|
||||||
.pattern("CCC", "C C", "CCC").define('C', ActuallyItems.TINY_CHARCOAL.get())::save)
|
.save(boolConsumer, new ResourceLocation(ActuallyAdditions.MODID, "tiny_to_charcoal"));
|
||||||
.generateAdvancement().build(consumer, new ResourceLocation(ActuallyAdditions.MODID, "tiny_to_charcoal"));
|
|
||||||
|
|
||||||
//Canola Seeds
|
//Canola Seeds
|
||||||
Recipe.shapeless(ActuallyItems.CANOLA_SEEDS.get())
|
Recipe.shapeless(ActuallyItems.CANOLA_SEEDS.get())
|
||||||
|
@ -516,7 +495,7 @@ public class ItemRecipeGenerator extends RecipeProvider {
|
||||||
// GameRegistry.addSmelting(new ItemStack(InitItems.itemDust, 1, TheDusts.COAL.ordinal()), new ItemStack(Items.COAL), 1F);
|
// GameRegistry.addSmelting(new ItemStack(InitItems.itemDust, 1, TheDusts.COAL.ordinal()), new ItemStack(Items.COAL), 1F);
|
||||||
}
|
}
|
||||||
|
|
||||||
protected void generatePaxels(Consumer<FinishedRecipe> consumer) {
|
protected void generatePaxels(RecipeOutput consumer) {
|
||||||
addPaxel(consumer, ActuallyItems.WOODEN_AIOT, Items.WOODEN_AXE, Items.WOODEN_PICKAXE, Items.WOODEN_SWORD, Items.WOODEN_SHOVEL, Items.WOODEN_HOE);
|
addPaxel(consumer, ActuallyItems.WOODEN_AIOT, Items.WOODEN_AXE, Items.WOODEN_PICKAXE, Items.WOODEN_SWORD, Items.WOODEN_SHOVEL, Items.WOODEN_HOE);
|
||||||
addPaxel(consumer, ActuallyItems.STONE_AIOT, Items.STONE_AXE, Items.STONE_PICKAXE, Items.STONE_SWORD, Items.STONE_SHOVEL, Items.STONE_HOE);
|
addPaxel(consumer, ActuallyItems.STONE_AIOT, Items.STONE_AXE, Items.STONE_PICKAXE, Items.STONE_SWORD, Items.STONE_SHOVEL, Items.STONE_HOE);
|
||||||
addPaxel(consumer, ActuallyItems.IRON_AIOT, Items.IRON_AXE, Items.IRON_PICKAXE, Items.IRON_SWORD, Items.IRON_SHOVEL, Items.IRON_HOE);
|
addPaxel(consumer, ActuallyItems.IRON_AIOT, Items.IRON_AXE, Items.IRON_PICKAXE, Items.IRON_SWORD, Items.IRON_SHOVEL, Items.IRON_HOE);
|
||||||
|
@ -525,7 +504,7 @@ public class ItemRecipeGenerator extends RecipeProvider {
|
||||||
addPaxel(consumer, ActuallyItems.NETHERITE_AIOT, Items.NETHERITE_AXE, Items.NETHERITE_PICKAXE, Items.NETHERITE_SWORD, Items.NETHERITE_SHOVEL, Items.NETHERITE_HOE);
|
addPaxel(consumer, ActuallyItems.NETHERITE_AIOT, Items.NETHERITE_AXE, Items.NETHERITE_PICKAXE, Items.NETHERITE_SWORD, Items.NETHERITE_SHOVEL, Items.NETHERITE_HOE);
|
||||||
}
|
}
|
||||||
|
|
||||||
public static void addPaxel(Consumer<FinishedRecipe> consumer, RegistryObject<Item> output, Item axe, Item pickaxe, Item sword, Item shovel, Item hoe) {
|
public static void addPaxel(RecipeOutput consumer, DeferredItem<Item> output, Item axe, Item pickaxe, Item sword, Item shovel, Item hoe) {
|
||||||
Recipe.shapeless(output.get())
|
Recipe.shapeless(output.get())
|
||||||
.requires(axe)
|
.requires(axe)
|
||||||
.requires(pickaxe)
|
.requires(pickaxe)
|
||||||
|
@ -535,7 +514,7 @@ public class ItemRecipeGenerator extends RecipeProvider {
|
||||||
.save(consumer);
|
.save(consumer);
|
||||||
}
|
}
|
||||||
|
|
||||||
public static void addPaxel(Consumer<FinishedRecipe> consumer, RegistryObject<Item> output, RegistryObject<Item> axe, RegistryObject<Item> pickaxe, RegistryObject<Item> sword, RegistryObject<Item> shovel, RegistryObject<Item> hoe) {
|
public static void addPaxel(RecipeOutput consumer, DeferredItem<Item> output, DeferredItem<Item> axe, DeferredItem<Item> pickaxe, DeferredItem<Item> sword, DeferredItem<Item> shovel, DeferredItem<Item> hoe) {
|
||||||
Recipe.shapeless(output.get())
|
Recipe.shapeless(output.get())
|
||||||
.requires(axe.get())
|
.requires(axe.get())
|
||||||
.requires(pickaxe.get())
|
.requires(pickaxe.get())
|
||||||
|
@ -545,25 +524,26 @@ public class ItemRecipeGenerator extends RecipeProvider {
|
||||||
.save(consumer);
|
.save(consumer);
|
||||||
}
|
}
|
||||||
|
|
||||||
public static void decompress(Consumer<FinishedRecipe> consumer, RegistryObject<Item> output, RegistryObject<Item> input) {
|
public static void decompress(RecipeOutput consumer, DeferredItem<Item> output, DeferredItem<Item> input) {
|
||||||
ResourceLocation key = ForgeRegistries.ITEMS.getKey(output.get());
|
ResourceLocation key = BuiltInRegistries.ITEM.getKey(output.get());
|
||||||
Recipe.shapeless(output.get(), 9).requires(input.get()).save(consumer, new ResourceLocation(key.getNamespace(), "decompress/" + key.getPath()));
|
Recipe.shapeless(output.get(), 9).requires(input.get()).save(consumer, new ResourceLocation(key.getNamespace(), "decompress/" + key.getPath()));
|
||||||
}
|
}
|
||||||
public static void compress(Consumer<FinishedRecipe> consumer, RegistryObject<Item> output, RegistryObject<Item> input) {
|
public static void compress(RecipeOutput consumer, DeferredItem<Item> output, DeferredItem<Item> input) {
|
||||||
ResourceLocation key = ForgeRegistries.ITEMS.getKey(output.get());
|
ResourceLocation key = BuiltInRegistries.ITEM.getKey(output.get());
|
||||||
Recipe.shaped(output.get()).pattern("xxx","xxx", "xxx").define('x', input.get()).save(consumer, new ResourceLocation(key.getNamespace(), "compress/" + key.getPath()));
|
Recipe.shaped(output.get()).pattern("xxx","xxx", "xxx").define('x', input.get()).save(consumer, new ResourceLocation(key.getNamespace(), "compress/" + key.getPath()));
|
||||||
}
|
}
|
||||||
public static void addShard(Consumer<FinishedRecipe> consumer, RegistryObject<Item> shard, RegistryObject<Item> crystal) {
|
public static void addShard(RecipeOutput consumer, DeferredItem<Item> shard, DeferredItem<Item> crystal) {
|
||||||
compress(consumer, crystal, shard);
|
compress(consumer, crystal, shard);
|
||||||
decompress(consumer, shard, crystal);
|
decompress(consumer, shard, crystal);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
// @Override //TODO: Flanks do your RecipeOutput wrapper thingy ;)
|
||||||
protected @Nullable CompletableFuture<?> saveAdvancement(CachedOutput output, FinishedRecipe finishedRecipe, JsonObject advancementJson) {
|
// protected @Nullable CompletableFuture<?> saveAdvancement(CachedOutput stack, FinishedRecipe finishedRecipe, JsonObject advancementJson) {
|
||||||
return null; //Nope...
|
// return null;
|
||||||
}
|
// //Nope... maybe later...
|
||||||
|
// }
|
||||||
|
|
||||||
public static void addToolAndArmorRecipes(Consumer<FinishedRecipe> consumer, RegistryObject<Item> base, RegistryObject<Item> pickaxe, RegistryObject<Item> sword, RegistryObject<Item> axe, RegistryObject<Item> shovel, RegistryObject<Item> hoe, RegistryObject<Item> helm, RegistryObject<Item> chest, RegistryObject<Item> pants, RegistryObject<Item> boots) {
|
public static void addToolAndArmorRecipes(RecipeOutput consumer, DeferredItem<Item> base, DeferredItem<Item> pickaxe, DeferredItem<Item> sword, DeferredItem<Item> axe, DeferredItem<Item> shovel, DeferredItem<Item> hoe, DeferredItem<Item> helm, DeferredItem<Item> chest, DeferredItem<Item> pants, DeferredItem<Item> boots) {
|
||||||
//Pickaxe
|
//Pickaxe
|
||||||
Recipe.shaped(pickaxe.get())
|
Recipe.shaped(pickaxe.get())
|
||||||
.pattern("EEE", " S ", " S ")
|
.pattern("EEE", " S ", " S ")
|
||||||
|
@ -662,7 +642,7 @@ public class ItemRecipeGenerator extends RecipeProvider {
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void save(@Nonnull Consumer<FinishedRecipe> consumer) {
|
public void save(@Nonnull RecipeOutput consumer) {
|
||||||
this.unlockedBy("has_book", has(ActuallyItems.ITEM_BOOKLET.get()));
|
this.unlockedBy("has_book", has(ActuallyItems.ITEM_BOOKLET.get()));
|
||||||
if (this.name != null) {
|
if (this.name != null) {
|
||||||
this.save(consumer, this.name);
|
this.save(consumer, this.name);
|
||||||
|
@ -671,7 +651,7 @@ public class ItemRecipeGenerator extends RecipeProvider {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@Override
|
@Override
|
||||||
public void save(@Nonnull Consumer<FinishedRecipe> consumer, @Nonnull ResourceLocation location) {
|
public void save(@Nonnull RecipeOutput consumer, @Nonnull ResourceLocation location) {
|
||||||
this.unlockedBy("", has(Items.AIR));
|
this.unlockedBy("", has(Items.AIR));
|
||||||
super.save(consumer, location);
|
super.save(consumer, location);
|
||||||
}
|
}
|
||||||
|
@ -714,13 +694,13 @@ public class ItemRecipeGenerator extends RecipeProvider {
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void save(@Nonnull Consumer<FinishedRecipe> consumerIn) {
|
public void save(@Nonnull RecipeOutput consumerIn) {
|
||||||
this.unlockedBy("has_book", has(ActuallyItems.ITEM_BOOKLET.get()));
|
this.unlockedBy("has_book", has(ActuallyItems.ITEM_BOOKLET.get()));
|
||||||
super.save(consumerIn);
|
super.save(consumerIn);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void save(@Nonnull Consumer<FinishedRecipe> consumer, @Nonnull ResourceLocation location) {
|
public void save(@Nonnull RecipeOutput consumer, @Nonnull ResourceLocation location) {
|
||||||
this.unlockedBy("", has(Items.AIR));
|
this.unlockedBy("", has(Items.AIR));
|
||||||
super.save(consumer, location);
|
super.save(consumer, location);
|
||||||
}
|
}
|
||||||
|
|
|
@ -8,7 +8,7 @@ import net.minecraft.data.PackOutput;
|
||||||
import net.minecraft.data.tags.ItemTagsProvider;
|
import net.minecraft.data.tags.ItemTagsProvider;
|
||||||
import net.minecraft.data.tags.TagsProvider;
|
import net.minecraft.data.tags.TagsProvider;
|
||||||
import net.minecraft.world.level.block.Block;
|
import net.minecraft.world.level.block.Block;
|
||||||
import net.minecraftforge.common.data.ExistingFileHelper;
|
import net.neoforged.neoforge.common.data.ExistingFileHelper;
|
||||||
|
|
||||||
import java.util.concurrent.CompletableFuture;
|
import java.util.concurrent.CompletableFuture;
|
||||||
|
|
||||||
|
|
|
@ -1,13 +1,12 @@
|
||||||
package de.ellpeck.actuallyadditions.data;
|
package de.ellpeck.actuallyadditions.data;
|
||||||
|
|
||||||
import com.google.gson.JsonObject;
|
|
||||||
import de.ellpeck.actuallyadditions.mod.ActuallyAdditions;
|
import de.ellpeck.actuallyadditions.mod.ActuallyAdditions;
|
||||||
import de.ellpeck.actuallyadditions.mod.blocks.ActuallyBlocks;
|
import de.ellpeck.actuallyadditions.mod.blocks.ActuallyBlocks;
|
||||||
import de.ellpeck.actuallyadditions.mod.crafting.LaserRecipe;
|
import de.ellpeck.actuallyadditions.mod.crafting.LaserRecipe;
|
||||||
import de.ellpeck.actuallyadditions.mod.items.ActuallyItems;
|
import de.ellpeck.actuallyadditions.mod.items.ActuallyItems;
|
||||||
import net.minecraft.data.CachedOutput;
|
import net.minecraft.core.registries.BuiltInRegistries;
|
||||||
import net.minecraft.data.PackOutput;
|
import net.minecraft.data.PackOutput;
|
||||||
import net.minecraft.data.recipes.FinishedRecipe;
|
import net.minecraft.data.recipes.RecipeOutput;
|
||||||
import net.minecraft.data.recipes.RecipeProvider;
|
import net.minecraft.data.recipes.RecipeProvider;
|
||||||
import net.minecraft.resources.ResourceLocation;
|
import net.minecraft.resources.ResourceLocation;
|
||||||
import net.minecraft.tags.ItemTags;
|
import net.minecraft.tags.ItemTags;
|
||||||
|
@ -16,12 +15,7 @@ import net.minecraft.world.item.Item;
|
||||||
import net.minecraft.world.item.Items;
|
import net.minecraft.world.item.Items;
|
||||||
import net.minecraft.world.item.crafting.Ingredient;
|
import net.minecraft.world.item.crafting.Ingredient;
|
||||||
import net.minecraft.world.level.ItemLike;
|
import net.minecraft.world.level.ItemLike;
|
||||||
import net.minecraftforge.common.Tags;
|
import net.neoforged.neoforge.common.Tags;
|
||||||
import net.minecraftforge.registries.ForgeRegistries;
|
|
||||||
import org.jetbrains.annotations.Nullable;
|
|
||||||
|
|
||||||
import java.util.concurrent.CompletableFuture;
|
|
||||||
import java.util.function.Consumer;
|
|
||||||
|
|
||||||
public class LaserRecipeGenerator extends RecipeProvider {
|
public class LaserRecipeGenerator extends RecipeProvider {
|
||||||
public LaserRecipeGenerator(PackOutput packOutput) {
|
public LaserRecipeGenerator(PackOutput packOutput) {
|
||||||
|
@ -33,13 +27,14 @@ public class LaserRecipeGenerator extends RecipeProvider {
|
||||||
return "Laser " + super.getName();
|
return "Laser " + super.getName();
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
// @Override //TODO: Flanks do your RecipeOutput wrapper thingy ;)
|
||||||
protected @Nullable CompletableFuture<?> saveAdvancement(CachedOutput output, FinishedRecipe finishedRecipe, JsonObject advancementJson) {
|
// protected @Nullable CompletableFuture<?> saveAdvancement(CachedOutput stack, FinishedRecipe finishedRecipe, JsonObject advancementJson) {
|
||||||
return null; //Nope...
|
// return null;
|
||||||
}
|
// //Nope... maybe later...
|
||||||
|
// }
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
protected void buildRecipes(Consumer<FinishedRecipe> consumer) {
|
protected void buildRecipes(RecipeOutput consumer) {
|
||||||
//Crystal Blocks
|
//Crystal Blocks
|
||||||
laserCrystalizeRecipe(consumer, ActuallyBlocks.RESTONIA_CRYSTAL.getItem(), Tags.Items.STORAGE_BLOCKS_REDSTONE, 400);
|
laserCrystalizeRecipe(consumer, ActuallyBlocks.RESTONIA_CRYSTAL.getItem(), Tags.Items.STORAGE_BLOCKS_REDSTONE, 400);
|
||||||
laserCrystalizeRecipe(consumer, ActuallyBlocks.PALIS_CRYSTAL.getItem(), Tags.Items.STORAGE_BLOCKS_LAPIS, 400);
|
laserCrystalizeRecipe(consumer, ActuallyBlocks.PALIS_CRYSTAL.getItem(), Tags.Items.STORAGE_BLOCKS_LAPIS, 400);
|
||||||
|
@ -78,28 +73,28 @@ public class LaserRecipeGenerator extends RecipeProvider {
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
private void laserRecipe(Consumer<FinishedRecipe> consumer, ItemLike output, Ingredient input, int energy) {
|
private void laserRecipe(RecipeOutput consumer, ItemLike output, Ingredient input, int energy) {
|
||||||
consumer.accept(new LaserRecipe.Result(new ResourceLocation(ActuallyAdditions.MODID, "laser/" + ForgeRegistries.ITEMS.getKey(output.asItem()).getPath()),
|
ResourceLocation id = new ResourceLocation(ActuallyAdditions.MODID, "laser/" + BuiltInRegistries.ITEM.getKey(output.asItem()).getPath());
|
||||||
input, energy, output));
|
consumer.accept(id, new LaserRecipe(output.asItem().getDefaultInstance(), input, energy), null);
|
||||||
}
|
}
|
||||||
private void laserRecipe(Consumer<FinishedRecipe> consumer, ItemLike output, TagKey<Item> input, int energy) {
|
private void laserRecipe(RecipeOutput consumer, ItemLike output, TagKey<Item> input, int energy) {
|
||||||
consumer.accept(new LaserRecipe.Result(new ResourceLocation(ActuallyAdditions.MODID, "laser/" + ForgeRegistries.ITEMS.getKey(output.asItem()).getPath()),
|
ResourceLocation id = new ResourceLocation(ActuallyAdditions.MODID, "laser/" + BuiltInRegistries.ITEM.getKey(output.asItem()).getPath());
|
||||||
Ingredient.of(input), energy, output));
|
consumer.accept(id, new LaserRecipe(output.asItem().getDefaultInstance(), Ingredient.of(input), energy), null);
|
||||||
}
|
}
|
||||||
private void laserRecipe(Consumer<FinishedRecipe> consumer, ItemLike output, ItemLike input, int energy) {
|
private void laserRecipe(RecipeOutput consumer, ItemLike output, ItemLike input, int energy) {
|
||||||
consumer.accept(new LaserRecipe.Result(new ResourceLocation(ActuallyAdditions.MODID, "laser/" + ForgeRegistries.ITEMS.getKey(output.asItem()).getPath()),
|
ResourceLocation id = new ResourceLocation(ActuallyAdditions.MODID, "laser/" + BuiltInRegistries.ITEM.getKey(output.asItem()).getPath());
|
||||||
Ingredient.of(input), energy, output));
|
consumer.accept(id, new LaserRecipe(output.asItem().getDefaultInstance(), Ingredient.of(input), energy), null);;
|
||||||
}
|
}
|
||||||
private void laserCrystalizeRecipe(Consumer<FinishedRecipe> consumer, ItemLike output, Ingredient input, int energy) {
|
private void laserCrystalizeRecipe(RecipeOutput consumer, ItemLike output, Ingredient input, int energy) {
|
||||||
consumer.accept(new LaserRecipe.Result(new ResourceLocation(ActuallyAdditions.MODID, "laser/crystalize_" + ForgeRegistries.ITEMS.getKey(output.asItem()).getPath()),
|
ResourceLocation id = new ResourceLocation(ActuallyAdditions.MODID, "laser/crystalize_" + BuiltInRegistries.ITEM.getKey(output.asItem()).getPath());
|
||||||
input, energy, output));
|
consumer.accept(id, new LaserRecipe(output.asItem().getDefaultInstance(), input, energy), null);
|
||||||
}
|
}
|
||||||
private void laserCrystalizeRecipe(Consumer<FinishedRecipe> consumer, ItemLike output, TagKey<Item> input, int energy) {
|
private void laserCrystalizeRecipe(RecipeOutput consumer, ItemLike output, TagKey<Item> input, int energy) {
|
||||||
consumer.accept(new LaserRecipe.Result(new ResourceLocation(ActuallyAdditions.MODID, "laser/crystalize_" + ForgeRegistries.ITEMS.getKey(output.asItem()).getPath()),
|
ResourceLocation id = new ResourceLocation(ActuallyAdditions.MODID, "laser/crystalize_" + BuiltInRegistries.ITEM.getKey(output.asItem()).getPath());
|
||||||
Ingredient.of(input), energy, output));
|
consumer.accept(id, new LaserRecipe(output.asItem().getDefaultInstance(), Ingredient.of(input), energy), null);
|
||||||
}
|
}
|
||||||
private void laserCrystalizeRecipe(Consumer<FinishedRecipe> consumer, ItemLike output, ItemLike input, int energy) {
|
private void laserCrystalizeRecipe(RecipeOutput consumer, ItemLike output, ItemLike input, int energy) {
|
||||||
consumer.accept(new LaserRecipe.Result(new ResourceLocation(ActuallyAdditions.MODID, "laser/crystalize_" + ForgeRegistries.ITEMS.getKey(output.asItem()).getPath()),
|
ResourceLocation id = new ResourceLocation(ActuallyAdditions.MODID, "laser/crystalize_" + BuiltInRegistries.ITEM.getKey(output.asItem()).getPath());
|
||||||
Ingredient.of(input), energy, output));
|
consumer.accept(id, new LaserRecipe(output.asItem().getDefaultInstance(), Ingredient.of(input), energy), null);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -24,7 +24,7 @@ import net.minecraft.world.level.storage.loot.parameters.LootContextParamSets;
|
||||||
import net.minecraft.world.level.storage.loot.predicates.LootItemBlockStatePropertyCondition;
|
import net.minecraft.world.level.storage.loot.predicates.LootItemBlockStatePropertyCondition;
|
||||||
import net.minecraft.world.level.storage.loot.providers.nbt.ContextNbtProvider;
|
import net.minecraft.world.level.storage.loot.providers.nbt.ContextNbtProvider;
|
||||||
import net.minecraft.world.level.storage.loot.providers.number.ConstantValue;
|
import net.minecraft.world.level.storage.loot.providers.number.ConstantValue;
|
||||||
import net.minecraftforge.registries.RegistryObject;
|
import net.neoforged.neoforge.registries.DeferredHolder;
|
||||||
|
|
||||||
import javax.annotation.Nonnull;
|
import javax.annotation.Nonnull;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
|
@ -236,7 +236,7 @@ public class LootTableGenerator extends LootTableProvider {
|
||||||
InitFluids.EMPOWERED_OIL.getBlock()
|
InitFluids.EMPOWERED_OIL.getBlock()
|
||||||
);
|
);
|
||||||
|
|
||||||
return ActuallyBlocks.BLOCKS.getEntries().stream().map(RegistryObject::get).filter(e -> !ignoreForNow.contains(e)).collect(Collectors.toList());
|
return ActuallyBlocks.BLOCKS.getEntries().stream().map(DeferredHolder::get).filter(e -> !ignoreForNow.contains(e)).collect(Collectors.toList());
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -1,11 +1,9 @@
|
||||||
package de.ellpeck.actuallyadditions.data;
|
package de.ellpeck.actuallyadditions.data;
|
||||||
|
|
||||||
import com.google.gson.JsonObject;
|
|
||||||
import de.ellpeck.actuallyadditions.mod.ActuallyAdditions;
|
import de.ellpeck.actuallyadditions.mod.ActuallyAdditions;
|
||||||
import de.ellpeck.actuallyadditions.mod.crafting.MiningLensRecipe;
|
import de.ellpeck.actuallyadditions.mod.crafting.MiningLensRecipe;
|
||||||
import net.minecraft.data.CachedOutput;
|
|
||||||
import net.minecraft.data.PackOutput;
|
import net.minecraft.data.PackOutput;
|
||||||
import net.minecraft.data.recipes.FinishedRecipe;
|
import net.minecraft.data.recipes.RecipeOutput;
|
||||||
import net.minecraft.data.recipes.RecipeProvider;
|
import net.minecraft.data.recipes.RecipeProvider;
|
||||||
import net.minecraft.resources.ResourceLocation;
|
import net.minecraft.resources.ResourceLocation;
|
||||||
import net.minecraft.tags.TagKey;
|
import net.minecraft.tags.TagKey;
|
||||||
|
@ -13,11 +11,7 @@ import net.minecraft.world.item.Item;
|
||||||
import net.minecraft.world.item.Items;
|
import net.minecraft.world.item.Items;
|
||||||
import net.minecraft.world.item.crafting.Ingredient;
|
import net.minecraft.world.item.crafting.Ingredient;
|
||||||
import net.minecraft.world.level.ItemLike;
|
import net.minecraft.world.level.ItemLike;
|
||||||
import net.minecraftforge.common.Tags;
|
import net.neoforged.neoforge.common.Tags;
|
||||||
import org.jetbrains.annotations.Nullable;
|
|
||||||
|
|
||||||
import java.util.concurrent.CompletableFuture;
|
|
||||||
import java.util.function.Consumer;
|
|
||||||
|
|
||||||
public class MiningLensGenerator extends RecipeProvider {
|
public class MiningLensGenerator extends RecipeProvider {
|
||||||
public MiningLensGenerator(PackOutput packOutput) {
|
public MiningLensGenerator(PackOutput packOutput) {
|
||||||
|
@ -29,41 +23,41 @@ public class MiningLensGenerator extends RecipeProvider {
|
||||||
return "Mining Lens " + super.getName();
|
return "Mining Lens " + super.getName();
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
// @Override //TODO: Flanks do your RecipeOutput wrapper thingy ;)
|
||||||
protected @Nullable CompletableFuture<?> saveAdvancement(CachedOutput output, FinishedRecipe finishedRecipe, JsonObject advancementJson) {
|
// protected @Nullable CompletableFuture<?> saveAdvancement(CachedOutput stack, FinishedRecipe finishedRecipe, JsonObject advancementJson) {
|
||||||
return null; //Nope...
|
// return null;
|
||||||
}
|
// //Nope... maybe later...
|
||||||
|
// }
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
protected void buildRecipes(Consumer<FinishedRecipe> consumer) {
|
protected void buildRecipes(RecipeOutput consumer) {
|
||||||
buildMiningLens(consumer);
|
buildMiningLens(consumer);
|
||||||
}
|
}
|
||||||
|
|
||||||
// private String getItemName(ItemLike item) {
|
// private String getItemName(ItemLike item) {
|
||||||
// return ForgeRegistries.ITEMS.getKey(item.asItem()).getPath();
|
// return BuiltInRegistries.ITEM.getKey(item.asItem()).getPath();
|
||||||
// }
|
// }
|
||||||
|
|
||||||
private ResourceLocation folderRecipe(String folder, String recipe) {
|
private ResourceLocation folderRecipe(String folder, String recipe) {
|
||||||
return new ResourceLocation(ActuallyAdditions.MODID, folder + "/" + recipe);
|
return new ResourceLocation(ActuallyAdditions.MODID, folder + "/" + recipe);
|
||||||
}
|
}
|
||||||
|
|
||||||
private void buildStoneOre(Consumer<FinishedRecipe> consumer, int weight, ItemLike output) {
|
private void buildStoneOre(RecipeOutput consumer, int weight, ItemLike output) {
|
||||||
buildTagOre(consumer, Tags.Items.STONE, "stone", weight, output);
|
buildTagOre(consumer, Tags.Items.STONE, "stone", weight, output);
|
||||||
}
|
}
|
||||||
private void buildNetherOre(Consumer<FinishedRecipe> consumer, int weight, ItemLike output) {
|
private void buildNetherOre(RecipeOutput consumer, int weight, ItemLike output) {
|
||||||
buildTagOre(consumer, Tags.Items.NETHERRACK, "nether", weight, output);
|
buildTagOre(consumer, Tags.Items.NETHERRACK, "nether", weight, output);
|
||||||
}
|
}
|
||||||
|
|
||||||
private void buildTagOre(Consumer<FinishedRecipe> consumer, TagKey<Item> tag, String prefix, int weight, ItemLike output) {
|
private void buildTagOre(RecipeOutput consumer, TagKey<Item> tag, String prefix, int weight, ItemLike output) {
|
||||||
consumer.accept(new MiningLensRecipe.Result(
|
consumer.accept(folderRecipe("mininglens", prefix + "_" + getItemName(output)), new MiningLensRecipe(
|
||||||
folderRecipe("mininglens", prefix + "_" + getItemName(output)),
|
|
||||||
Ingredient.of(tag),
|
Ingredient.of(tag),
|
||||||
weight,
|
weight,
|
||||||
output
|
output.asItem().getDefaultInstance()
|
||||||
));
|
), null);
|
||||||
}
|
}
|
||||||
|
|
||||||
private void buildMiningLens(Consumer<FinishedRecipe> consumer) {
|
private void buildMiningLens(RecipeOutput consumer) {
|
||||||
buildStoneOre(consumer, 5000, Items.COAL_ORE);
|
buildStoneOre(consumer, 5000, Items.COAL_ORE);
|
||||||
buildStoneOre(consumer, 3000, Items.IRON_ORE);
|
buildStoneOre(consumer, 3000, Items.IRON_ORE);
|
||||||
buildStoneOre(consumer, 500, Items.GOLD_ORE);
|
buildStoneOre(consumer, 500, Items.GOLD_ORE);
|
||||||
|
|
|
@ -1,22 +1,16 @@
|
||||||
package de.ellpeck.actuallyadditions.data;
|
package de.ellpeck.actuallyadditions.data;
|
||||||
|
|
||||||
import com.google.gson.JsonObject;
|
|
||||||
import de.ellpeck.actuallyadditions.mod.ActuallyAdditions;
|
import de.ellpeck.actuallyadditions.mod.ActuallyAdditions;
|
||||||
import de.ellpeck.actuallyadditions.mod.crafting.FermentingRecipe;
|
import de.ellpeck.actuallyadditions.mod.crafting.FermentingRecipe;
|
||||||
import de.ellpeck.actuallyadditions.mod.crafting.PressingRecipe;
|
import de.ellpeck.actuallyadditions.mod.crafting.PressingRecipe;
|
||||||
import de.ellpeck.actuallyadditions.mod.fluids.InitFluids;
|
import de.ellpeck.actuallyadditions.mod.fluids.InitFluids;
|
||||||
import de.ellpeck.actuallyadditions.mod.items.ActuallyItems;
|
import de.ellpeck.actuallyadditions.mod.items.ActuallyItems;
|
||||||
import net.minecraft.data.CachedOutput;
|
|
||||||
import net.minecraft.data.PackOutput;
|
import net.minecraft.data.PackOutput;
|
||||||
import net.minecraft.data.recipes.FinishedRecipe;
|
import net.minecraft.data.recipes.RecipeOutput;
|
||||||
import net.minecraft.data.recipes.RecipeProvider;
|
import net.minecraft.data.recipes.RecipeProvider;
|
||||||
import net.minecraft.resources.ResourceLocation;
|
import net.minecraft.resources.ResourceLocation;
|
||||||
import net.minecraft.world.item.crafting.Ingredient;
|
import net.minecraft.world.item.crafting.Ingredient;
|
||||||
import net.minecraftforge.fluids.FluidStack;
|
import net.neoforged.neoforge.fluids.FluidStack;
|
||||||
import org.jetbrains.annotations.Nullable;
|
|
||||||
|
|
||||||
import java.util.concurrent.CompletableFuture;
|
|
||||||
import java.util.function.Consumer;
|
|
||||||
|
|
||||||
public class MiscMachineRecipeGenerator extends RecipeProvider {
|
public class MiscMachineRecipeGenerator extends RecipeProvider {
|
||||||
public MiscMachineRecipeGenerator(PackOutput packOutput) {
|
public MiscMachineRecipeGenerator(PackOutput packOutput) {
|
||||||
|
@ -28,22 +22,23 @@ public class MiscMachineRecipeGenerator extends RecipeProvider {
|
||||||
return "Misc " + super.getName();
|
return "Misc " + super.getName();
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
// @Override //TODO: Flanks do your RecipeOutput wrapper thingy ;)
|
||||||
protected @Nullable CompletableFuture<?> saveAdvancement(CachedOutput output, FinishedRecipe finishedRecipe, JsonObject advancementJson) {
|
// protected @Nullable CompletableFuture<?> saveAdvancement(CachedOutput stack, FinishedRecipe finishedRecipe, JsonObject advancementJson) {
|
||||||
return null; //Nope...
|
// return null;
|
||||||
}
|
// //Nope... maybe later...
|
||||||
|
// }
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
protected void buildRecipes(Consumer<FinishedRecipe> consumer) {
|
protected void buildRecipes(RecipeOutput consumer) {
|
||||||
consumer.accept(new PressingRecipe.Result(folderRecipe("pressing", "canola"),
|
consumer.accept(folderRecipe("pressing", "canola"), new PressingRecipe(
|
||||||
Ingredient.of(ActuallyItems.CANOLA.get()), new FluidStack(InitFluids.CANOLA_OIL.get(), 80)));
|
Ingredient.of(ActuallyItems.CANOLA.get()), new FluidStack(InitFluids.CANOLA_OIL.get(), 80)), null);
|
||||||
|
|
||||||
consumer.accept(new FermentingRecipe.Result(folderRecipe("fermenting", "refined_canola"),
|
consumer.accept(folderRecipe("fermenting", "refined_canola"), new FermentingRecipe(
|
||||||
new FluidStack(InitFluids.CANOLA_OIL.get(), 80), new FluidStack(InitFluids.REFINED_CANOLA_OIL.get(), 80), 100));
|
new FluidStack(InitFluids.CANOLA_OIL.get(), 80), new FluidStack(InitFluids.REFINED_CANOLA_OIL.get(), 80), 100), null);
|
||||||
}
|
}
|
||||||
|
|
||||||
// private String getItemName(ItemLike item) {
|
// private String getItemName(ItemLike item) {
|
||||||
// return ForgeRegistries.ITEMS.getKey(item.asItem()).getPath();
|
// return BuiltInRegistries.ITEM.getKey(item.asItem()).getPath();
|
||||||
// }
|
// }
|
||||||
|
|
||||||
private ResourceLocation folderRecipe(String folder, String recipe) {
|
private ResourceLocation folderRecipe(String folder, String recipe) {
|
||||||
|
|
|
@ -4,8 +4,8 @@ import de.ellpeck.actuallyadditions.mod.AASounds;
|
||||||
import de.ellpeck.actuallyadditions.mod.ActuallyAdditions;
|
import de.ellpeck.actuallyadditions.mod.ActuallyAdditions;
|
||||||
import net.minecraft.data.PackOutput;
|
import net.minecraft.data.PackOutput;
|
||||||
import net.minecraft.resources.ResourceLocation;
|
import net.minecraft.resources.ResourceLocation;
|
||||||
import net.minecraftforge.common.data.ExistingFileHelper;
|
import net.neoforged.neoforge.common.data.ExistingFileHelper;
|
||||||
import net.minecraftforge.common.data.SoundDefinitionsProvider;
|
import net.neoforged.neoforge.common.data.SoundDefinitionsProvider;
|
||||||
|
|
||||||
public class SoundsGenerator extends SoundDefinitionsProvider {
|
public class SoundsGenerator extends SoundDefinitionsProvider {
|
||||||
|
|
||||||
|
|
|
@ -1,19 +1,19 @@
|
||||||
package de.ellpeck.actuallyadditions.mod;
|
package de.ellpeck.actuallyadditions.mod;
|
||||||
|
|
||||||
|
import net.minecraft.core.registries.BuiltInRegistries;
|
||||||
import net.minecraft.resources.ResourceLocation;
|
import net.minecraft.resources.ResourceLocation;
|
||||||
import net.minecraft.sounds.SoundEvent;
|
import net.minecraft.sounds.SoundEvent;
|
||||||
import net.minecraftforge.eventbus.api.IEventBus;
|
import net.neoforged.bus.api.IEventBus;
|
||||||
import net.minecraftforge.registries.DeferredRegister;
|
import net.neoforged.neoforge.registries.DeferredHolder;
|
||||||
import net.minecraftforge.registries.ForgeRegistries;
|
import net.neoforged.neoforge.registries.DeferredRegister;
|
||||||
import net.minecraftforge.registries.RegistryObject;
|
|
||||||
|
|
||||||
public class AASounds {
|
public class AASounds {
|
||||||
public static final DeferredRegister<SoundEvent> SOUNDS = DeferredRegister.create(ForgeRegistries.SOUND_EVENTS, ActuallyAdditions.MODID);
|
public static final DeferredRegister<SoundEvent> SOUNDS = DeferredRegister.create(BuiltInRegistries.SOUND_EVENT, ActuallyAdditions.MODID);
|
||||||
|
|
||||||
public static RegistryObject<SoundEvent> RECONSTRUCTOR = SOUNDS.register("reconstructor", () -> SoundEvent.createVariableRangeEvent(new ResourceLocation(ActuallyAdditions.MODID, "reconstructor")));
|
public static DeferredHolder<SoundEvent, SoundEvent> RECONSTRUCTOR = SOUNDS.register("reconstructor", () -> SoundEvent.createVariableRangeEvent(new ResourceLocation(ActuallyAdditions.MODID, "reconstructor")));
|
||||||
public static RegistryObject<SoundEvent> CRUSHER = SOUNDS.register("crusher", () -> SoundEvent.createVariableRangeEvent(new ResourceLocation(ActuallyAdditions.MODID, "crusher")));
|
public static DeferredHolder<SoundEvent, SoundEvent> CRUSHER = SOUNDS.register("crusher", () -> SoundEvent.createVariableRangeEvent(new ResourceLocation(ActuallyAdditions.MODID, "crusher")));
|
||||||
public static RegistryObject<SoundEvent> COFFEE_MACHINE = SOUNDS.register("coffee_machine", () -> SoundEvent.createVariableRangeEvent(new ResourceLocation(ActuallyAdditions.MODID, "coffee_machine")));
|
public static DeferredHolder<SoundEvent, SoundEvent> COFFEE_MACHINE = SOUNDS.register("coffee_machine", () -> SoundEvent.createVariableRangeEvent(new ResourceLocation(ActuallyAdditions.MODID, "coffee_machine")));
|
||||||
public static RegistryObject<SoundEvent> DUH_DUH_DUH_DUUUH = SOUNDS.register("duh_duh_duh_duuuh", () -> SoundEvent.createVariableRangeEvent(new ResourceLocation(ActuallyAdditions.MODID, "duh_duh_duh_duuuh")));
|
public static DeferredHolder<SoundEvent, SoundEvent> DUH_DUH_DUH_DUUUH = SOUNDS.register("duh_duh_duh_duuuh", () -> SoundEvent.createVariableRangeEvent(new ResourceLocation(ActuallyAdditions.MODID, "duh_duh_duh_duuuh")));
|
||||||
|
|
||||||
|
|
||||||
public static void init(IEventBus bus) {
|
public static void init(IEventBus bus) {
|
||||||
|
|
|
@ -10,6 +10,7 @@
|
||||||
|
|
||||||
package de.ellpeck.actuallyadditions.mod;
|
package de.ellpeck.actuallyadditions.mod;
|
||||||
|
|
||||||
|
import com.mojang.serialization.Codec;
|
||||||
import de.ellpeck.actuallyadditions.api.ActuallyAdditionsAPI;
|
import de.ellpeck.actuallyadditions.api.ActuallyAdditionsAPI;
|
||||||
import de.ellpeck.actuallyadditions.api.ActuallyTags;
|
import de.ellpeck.actuallyadditions.api.ActuallyTags;
|
||||||
import de.ellpeck.actuallyadditions.api.farmer.IFarmerBehavior;
|
import de.ellpeck.actuallyadditions.api.farmer.IFarmerBehavior;
|
||||||
|
@ -18,7 +19,6 @@ import de.ellpeck.actuallyadditions.mod.config.CommonConfig;
|
||||||
import de.ellpeck.actuallyadditions.mod.config.conditions.BoolConfigCondition;
|
import de.ellpeck.actuallyadditions.mod.config.conditions.BoolConfigCondition;
|
||||||
import de.ellpeck.actuallyadditions.mod.crafting.ActuallyRecipes;
|
import de.ellpeck.actuallyadditions.mod.crafting.ActuallyRecipes;
|
||||||
import de.ellpeck.actuallyadditions.mod.crafting.CrusherCrafting;
|
import de.ellpeck.actuallyadditions.mod.crafting.CrusherCrafting;
|
||||||
import de.ellpeck.actuallyadditions.mod.crafting.TargetNBTIngredient;
|
|
||||||
import de.ellpeck.actuallyadditions.mod.data.WorldData;
|
import de.ellpeck.actuallyadditions.mod.data.WorldData;
|
||||||
import de.ellpeck.actuallyadditions.mod.entity.EntityWorm;
|
import de.ellpeck.actuallyadditions.mod.entity.EntityWorm;
|
||||||
import de.ellpeck.actuallyadditions.mod.entity.InitEntities;
|
import de.ellpeck.actuallyadditions.mod.entity.InitEntities;
|
||||||
|
@ -36,33 +36,34 @@ import de.ellpeck.actuallyadditions.mod.network.PacketHandler;
|
||||||
import de.ellpeck.actuallyadditions.mod.particle.ActuallyParticles;
|
import de.ellpeck.actuallyadditions.mod.particle.ActuallyParticles;
|
||||||
import de.ellpeck.actuallyadditions.mod.update.UpdateChecker;
|
import de.ellpeck.actuallyadditions.mod.update.UpdateChecker;
|
||||||
import de.ellpeck.actuallyadditions.mod.util.ResourceReloader;
|
import de.ellpeck.actuallyadditions.mod.util.ResourceReloader;
|
||||||
|
import net.minecraft.core.registries.BuiltInRegistries;
|
||||||
import net.minecraft.resources.ResourceLocation;
|
import net.minecraft.resources.ResourceLocation;
|
||||||
import net.minecraft.world.entity.EntityType;
|
import net.minecraft.world.entity.EntityType;
|
||||||
import net.minecraft.world.entity.MobCategory;
|
import net.minecraft.world.entity.MobCategory;
|
||||||
import net.minecraft.world.item.Item;
|
import net.minecraft.world.item.Item;
|
||||||
import net.minecraft.world.item.Items;
|
import net.minecraft.world.item.Items;
|
||||||
import net.minecraftforge.api.distmarker.Dist;
|
import net.neoforged.bus.api.IEventBus;
|
||||||
import net.minecraftforge.client.event.RegisterParticleProvidersEvent;
|
import net.neoforged.fml.ModLoadingContext;
|
||||||
import net.minecraftforge.common.MinecraftForge;
|
import net.neoforged.fml.common.Mod;
|
||||||
import net.minecraftforge.common.crafting.CraftingHelper;
|
import net.neoforged.fml.config.ModConfig;
|
||||||
import net.minecraftforge.event.AddReloadListenerEvent;
|
import net.neoforged.fml.event.config.ModConfigEvent;
|
||||||
import net.minecraftforge.event.server.ServerStartedEvent;
|
import net.neoforged.fml.event.lifecycle.FMLClientSetupEvent;
|
||||||
import net.minecraftforge.event.server.ServerStoppedEvent;
|
import net.neoforged.fml.event.lifecycle.FMLCommonSetupEvent;
|
||||||
import net.minecraftforge.eventbus.api.IEventBus;
|
import net.neoforged.fml.loading.FMLEnvironment;
|
||||||
import net.minecraftforge.fml.DistExecutor;
|
import net.neoforged.neoforge.client.event.RegisterParticleProvidersEvent;
|
||||||
import net.minecraftforge.fml.ModLoadingContext;
|
import net.neoforged.neoforge.common.NeoForge;
|
||||||
import net.minecraftforge.fml.common.Mod;
|
import net.neoforged.neoforge.common.conditions.ICondition;
|
||||||
import net.minecraftforge.fml.config.ModConfig;
|
import net.neoforged.neoforge.event.AddReloadListenerEvent;
|
||||||
import net.minecraftforge.fml.event.config.ModConfigEvent;
|
import net.neoforged.neoforge.event.server.ServerStartedEvent;
|
||||||
import net.minecraftforge.fml.event.lifecycle.FMLClientSetupEvent;
|
import net.neoforged.neoforge.event.server.ServerStoppedEvent;
|
||||||
import net.minecraftforge.fml.event.lifecycle.FMLCommonSetupEvent;
|
import net.neoforged.neoforge.registries.DeferredHolder;
|
||||||
import net.minecraftforge.fml.javafmlmod.FMLJavaModLoadingContext;
|
import net.neoforged.neoforge.registries.DeferredRegister;
|
||||||
import net.minecraftforge.registries.DeferredRegister;
|
import net.neoforged.neoforge.registries.NeoForgeRegistries;
|
||||||
import net.minecraftforge.registries.ForgeRegistries;
|
|
||||||
import net.minecraftforge.registries.RegistryObject;
|
|
||||||
import org.apache.logging.log4j.LogManager;
|
import org.apache.logging.log4j.LogManager;
|
||||||
import org.apache.logging.log4j.Logger;
|
import org.apache.logging.log4j.Logger;
|
||||||
|
|
||||||
|
import java.util.function.Supplier;
|
||||||
|
|
||||||
@Mod(ActuallyAdditions.MODID)
|
@Mod(ActuallyAdditions.MODID)
|
||||||
public class ActuallyAdditions {
|
public class ActuallyAdditions {
|
||||||
|
|
||||||
|
@ -78,16 +79,18 @@ public class ActuallyAdditions {
|
||||||
|
|
||||||
public static final Logger LOGGER = LogManager.getLogger(NAME);
|
public static final Logger LOGGER = LogManager.getLogger(NAME);
|
||||||
|
|
||||||
public static final DeferredRegister<EntityType<?>> ENTITIES = DeferredRegister.create(ForgeRegistries.ENTITY_TYPES, MODID);
|
private static final DeferredRegister<EntityType<?>> ENTITIES = DeferredRegister.create(BuiltInRegistries.ENTITY_TYPE, MODID);
|
||||||
public static final RegistryObject<EntityType<EntityWorm>> ENTITY_WORM = ENTITIES.register("worm", () -> EntityType.Builder.of(EntityWorm::new, MobCategory.MISC).build(MODID + ":worm"));
|
public static final Supplier<EntityType<EntityWorm>> ENTITY_WORM = ENTITIES.register("worm", () -> EntityType.Builder.of(EntityWorm::new, MobCategory.MISC).build(MODID + ":worm"));
|
||||||
|
|
||||||
|
private static final DeferredRegister<Codec<? extends ICondition>> CONDITION_CODECS = DeferredRegister.create(NeoForgeRegistries.Keys.CONDITION_CODECS, MODID);
|
||||||
|
public static final DeferredHolder<Codec<? extends ICondition>, Codec<BoolConfigCondition>> BOOL_CONFIG_CONDITION = CONDITION_CODECS.register("bool_config_condition", () -> BoolConfigCondition.CODEC);
|
||||||
|
|
||||||
|
|
||||||
public static boolean commonCapsLoaded;
|
public static boolean commonCapsLoaded;
|
||||||
|
|
||||||
public ActuallyAdditions() {
|
public ActuallyAdditions(IEventBus eventBus) {
|
||||||
ModLoadingContext.get().registerConfig(ModConfig.Type.COMMON, CommonConfig.COMMON_CONFIG);
|
ModLoadingContext.get().registerConfig(ModConfig.Type.COMMON, CommonConfig.COMMON_CONFIG);
|
||||||
|
|
||||||
IEventBus eventBus = FMLJavaModLoadingContext.get().getModEventBus();
|
|
||||||
|
|
||||||
ActuallyBlocks.init(eventBus);
|
ActuallyBlocks.init(eventBus);
|
||||||
ActuallyItems.init(eventBus);
|
ActuallyItems.init(eventBus);
|
||||||
ActuallyTabs.init(eventBus);
|
ActuallyTabs.init(eventBus);
|
||||||
|
@ -95,25 +98,27 @@ public class ActuallyAdditions {
|
||||||
AASounds.init(eventBus);
|
AASounds.init(eventBus);
|
||||||
ActuallyContainers.CONTAINERS.register(eventBus);
|
ActuallyContainers.CONTAINERS.register(eventBus);
|
||||||
ENTITIES.register(eventBus);
|
ENTITIES.register(eventBus);
|
||||||
|
CONDITION_CODECS.register(eventBus);
|
||||||
eventBus.addListener(this::onConfigReload);
|
eventBus.addListener(this::onConfigReload);
|
||||||
ActuallyParticles.init(eventBus);
|
ActuallyParticles.init(eventBus);
|
||||||
ActuallyTags.init();
|
ActuallyTags.init();
|
||||||
|
|
||||||
MinecraftForge.EVENT_BUS.addListener(this::serverStarted);
|
NeoForge.EVENT_BUS.addListener(this::serverStarted);
|
||||||
MinecraftForge.EVENT_BUS.addListener(this::serverStopped);
|
NeoForge.EVENT_BUS.addListener(this::serverStopped);
|
||||||
MinecraftForge.EVENT_BUS.register(new CommonEvents());
|
NeoForge.EVENT_BUS.register(new CommonEvents());
|
||||||
MinecraftForge.EVENT_BUS.register(new DungeonLoot());
|
NeoForge.EVENT_BUS.register(new DungeonLoot());
|
||||||
MinecraftForge.EVENT_BUS.addListener(ActuallyAdditions::reloadEvent);
|
NeoForge.EVENT_BUS.addListener(ActuallyAdditions::reloadEvent);
|
||||||
MinecraftForge.EVENT_BUS.addListener(Worm::onHoe);
|
NeoForge.EVENT_BUS.addListener(Worm::onHoe);
|
||||||
InitFluids.init(eventBus);
|
InitFluids.init(eventBus);
|
||||||
|
|
||||||
|
eventBus.addListener(PacketHandler::register);
|
||||||
eventBus.addListener(this::setup);
|
eventBus.addListener(this::setup);
|
||||||
|
|
||||||
DistExecutor.unsafeRunWhenOn(Dist.CLIENT, () -> () -> {
|
if (FMLEnvironment.dist.isClient()) {
|
||||||
eventBus.addListener(this::clientSetup);
|
eventBus.addListener(this::clientSetup);
|
||||||
eventBus.addListener(ActuallyAdditionsClient::setupSpecialRenders);
|
eventBus.addListener(ActuallyAdditionsClient::setupSpecialRenders);
|
||||||
eventBus.addListener(this::particleFactoryRegister);
|
eventBus.addListener(this::particleFactoryRegister);
|
||||||
});
|
}
|
||||||
IFarmerBehavior.initBehaviors();
|
IFarmerBehavior.initBehaviors();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -122,17 +127,11 @@ public class ActuallyAdditions {
|
||||||
}
|
}
|
||||||
|
|
||||||
private void setup(FMLCommonSetupEvent event) {
|
private void setup(FMLCommonSetupEvent event) {
|
||||||
PacketHandler.init();
|
|
||||||
|
|
||||||
event.enqueueWork(() -> {
|
|
||||||
CraftingHelper.register(BoolConfigCondition.Serializer.INSTANCE);
|
|
||||||
});
|
|
||||||
|
|
||||||
ActuallyAdditionsAPI.methodHandler = new MethodHandler();
|
ActuallyAdditionsAPI.methodHandler = new MethodHandler();
|
||||||
ActuallyAdditionsAPI.connectionHandler = new LaserRelayConnectionHandler();
|
ActuallyAdditionsAPI.connectionHandler = new LaserRelayConnectionHandler();
|
||||||
//Lenses.init();
|
//Lenses.init();
|
||||||
// CompatUtil.registerCraftingTweaks();
|
// CompatUtil.registerCraftingTweaks();
|
||||||
event.enqueueWork(() -> CraftingHelper.register(TargetNBTIngredient.Serializer.NAME, TargetNBTIngredient.SERIALIZER));
|
// event.enqueueWork(() -> CraftingHelper.register(TargetNBTIngredient.Serializer.NAME, TargetNBTIngredient.SERIALIZER)); TODO: Flanks fix the Target NBT ingredient!
|
||||||
|
|
||||||
commonCapsLoaded = false; // Loader.isModLoaded("commoncapabilities");
|
commonCapsLoaded = false; // Loader.isModLoaded("commoncapabilities");
|
||||||
|
|
||||||
|
@ -146,8 +145,8 @@ public class ActuallyAdditions {
|
||||||
}
|
}
|
||||||
|
|
||||||
private void onConfigReload(ModConfigEvent event) {
|
private void onConfigReload(ModConfigEvent event) {
|
||||||
Item item1 = ForgeRegistries.ITEMS.getValue(new ResourceLocation(CommonConfig.Other.REDSTONECONFIGURATOR.get()));
|
Item item1 = BuiltInRegistries.ITEM.get(new ResourceLocation(CommonConfig.Other.REDSTONECONFIGURATOR.get()));
|
||||||
Item item2 = ForgeRegistries.ITEMS.getValue(new ResourceLocation(CommonConfig.Other.RELAYCONFIGURATOR.get()));
|
Item item2 = BuiltInRegistries.ITEM.get(new ResourceLocation(CommonConfig.Other.RELAYCONFIGURATOR.get()));
|
||||||
CommonConfig.Other.redstoneConfigureItem = item1 != null?item1: Items.AIR;
|
CommonConfig.Other.redstoneConfigureItem = item1 != null?item1: Items.AIR;
|
||||||
CommonConfig.Other.relayConfigureItem = item2 != null?item2: Items.AIR;
|
CommonConfig.Other.relayConfigureItem = item2 != null?item2: Items.AIR;
|
||||||
}
|
}
|
||||||
|
|
|
@ -60,9 +60,9 @@ import net.minecraft.core.BlockPos;
|
||||||
import net.minecraft.network.protocol.game.ServerboundPlayerActionPacket;
|
import net.minecraft.network.protocol.game.ServerboundPlayerActionPacket;
|
||||||
import net.minecraft.resources.ResourceLocation;
|
import net.minecraft.resources.ResourceLocation;
|
||||||
import net.minecraft.world.phys.BlockHitResult;
|
import net.minecraft.world.phys.BlockHitResult;
|
||||||
import net.minecraftforge.client.event.EntityRenderersEvent;
|
import net.neoforged.fml.event.lifecycle.FMLClientSetupEvent;
|
||||||
import net.minecraftforge.common.MinecraftForge;
|
import net.neoforged.neoforge.client.event.EntityRenderersEvent;
|
||||||
import net.minecraftforge.fml.event.lifecycle.FMLClientSetupEvent;
|
import net.neoforged.neoforge.common.NeoForge;
|
||||||
|
|
||||||
public class ActuallyAdditionsClient {
|
public class ActuallyAdditionsClient {
|
||||||
|
|
||||||
|
@ -93,9 +93,9 @@ public class ActuallyAdditionsClient {
|
||||||
MenuScreens.register(ActuallyContainers.RANGED_COLLECTOR_CONTAINER.get(), GuiRangedCollector::new);
|
MenuScreens.register(ActuallyContainers.RANGED_COLLECTOR_CONTAINER.get(), GuiRangedCollector::new);
|
||||||
MenuScreens.register(ActuallyContainers.XPSOLIDIFIER_CONTAINER.get(), GuiXPSolidifier::new);
|
MenuScreens.register(ActuallyContainers.XPSOLIDIFIER_CONTAINER.get(), GuiXPSolidifier::new);
|
||||||
// From old proxy
|
// From old proxy
|
||||||
MinecraftForge.EVENT_BUS.register(new ClientEvents());
|
NeoForge.EVENT_BUS.register(new ClientEvents());
|
||||||
MinecraftForge.EVENT_BUS.register(new ClientRegistryHandler());
|
NeoForge.EVENT_BUS.register(new ClientRegistryHandler());
|
||||||
MinecraftForge.EVENT_BUS.register(new SpecialRenderInit());
|
NeoForge.EVENT_BUS.register(new SpecialRenderInit());
|
||||||
|
|
||||||
event.enqueueWork(() ->
|
event.enqueueWork(() ->
|
||||||
ItemProperties.register(ActuallyItems.WORM.get(), new ResourceLocation(ActuallyAdditions.MODID, "snail"),
|
ItemProperties.register(ActuallyItems.WORM.get(), new ResourceLocation(ActuallyAdditions.MODID, "snail"),
|
||||||
|
|
|
@ -7,8 +7,8 @@ import net.minecraft.network.chat.Component;
|
||||||
import net.minecraft.world.item.CreativeModeTab;
|
import net.minecraft.world.item.CreativeModeTab;
|
||||||
import net.minecraft.world.item.CreativeModeTabs;
|
import net.minecraft.world.item.CreativeModeTabs;
|
||||||
import net.minecraft.world.item.ItemStack;
|
import net.minecraft.world.item.ItemStack;
|
||||||
import net.minecraftforge.eventbus.api.IEventBus;
|
import net.neoforged.bus.api.IEventBus;
|
||||||
import net.minecraftforge.registries.DeferredRegister;
|
import net.neoforged.neoforge.registries.DeferredRegister;
|
||||||
|
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
import java.util.function.Supplier;
|
import java.util.function.Supplier;
|
||||||
|
|
|
@ -3,9 +3,9 @@ package de.ellpeck.actuallyadditions.mod;
|
||||||
import net.minecraft.client.resources.model.ModelResourceLocation;
|
import net.minecraft.client.resources.model.ModelResourceLocation;
|
||||||
import net.minecraft.world.item.ItemStack;
|
import net.minecraft.world.item.ItemStack;
|
||||||
import net.minecraft.world.level.material.Fluid;
|
import net.minecraft.world.level.material.Fluid;
|
||||||
import net.minecraftforge.client.event.ModelEvent.BakingCompleted;
|
import net.neoforged.bus.api.SubscribeEvent;
|
||||||
import net.minecraftforge.client.event.ModelEvent.RegisterGeometryLoaders;
|
import net.neoforged.neoforge.client.event.ModelEvent.BakingCompleted;
|
||||||
import net.minecraftforge.eventbus.api.SubscribeEvent;
|
import net.neoforged.neoforge.client.event.ModelEvent.RegisterGeometryLoaders;
|
||||||
|
|
||||||
import java.util.HashMap;
|
import java.util.HashMap;
|
||||||
import java.util.Map;
|
import java.util.Map;
|
||||||
|
|
|
@ -13,6 +13,7 @@ package de.ellpeck.actuallyadditions.mod.blocks;
|
||||||
import de.ellpeck.actuallyadditions.mod.ActuallyAdditions;
|
import de.ellpeck.actuallyadditions.mod.ActuallyAdditions;
|
||||||
import de.ellpeck.actuallyadditions.mod.blocks.base.AACrops;
|
import de.ellpeck.actuallyadditions.mod.blocks.base.AACrops;
|
||||||
import de.ellpeck.actuallyadditions.mod.items.ActuallyItems;
|
import de.ellpeck.actuallyadditions.mod.items.ActuallyItems;
|
||||||
|
import de.ellpeck.actuallyadditions.mod.items.base.ItemEnergy;
|
||||||
import de.ellpeck.actuallyadditions.mod.items.metalists.Crystals;
|
import de.ellpeck.actuallyadditions.mod.items.metalists.Crystals;
|
||||||
import de.ellpeck.actuallyadditions.mod.tile.TileEntityAtomicReconstructor;
|
import de.ellpeck.actuallyadditions.mod.tile.TileEntityAtomicReconstructor;
|
||||||
import de.ellpeck.actuallyadditions.mod.tile.TileEntityBatteryBox;
|
import de.ellpeck.actuallyadditions.mod.tile.TileEntityBatteryBox;
|
||||||
|
@ -62,6 +63,7 @@ import de.ellpeck.actuallyadditions.mod.tile.TileEntityShockSuppressor;
|
||||||
import de.ellpeck.actuallyadditions.mod.tile.TileEntityVerticalDigger;
|
import de.ellpeck.actuallyadditions.mod.tile.TileEntityVerticalDigger;
|
||||||
import de.ellpeck.actuallyadditions.mod.tile.TileEntityXPSolidifier;
|
import de.ellpeck.actuallyadditions.mod.tile.TileEntityXPSolidifier;
|
||||||
import de.ellpeck.actuallyadditions.registration.AABlockReg;
|
import de.ellpeck.actuallyadditions.registration.AABlockReg;
|
||||||
|
import net.minecraft.core.registries.BuiltInRegistries;
|
||||||
import net.minecraft.world.item.Item;
|
import net.minecraft.world.item.Item;
|
||||||
import net.minecraft.world.level.block.Block;
|
import net.minecraft.world.level.block.Block;
|
||||||
import net.minecraft.world.level.block.Blocks;
|
import net.minecraft.world.level.block.Blocks;
|
||||||
|
@ -73,19 +75,20 @@ import net.minecraft.world.level.block.entity.BlockEntityType;
|
||||||
import net.minecraft.world.level.block.state.BlockBehaviour;
|
import net.minecraft.world.level.block.state.BlockBehaviour;
|
||||||
import net.minecraft.world.level.material.MapColor;
|
import net.minecraft.world.level.material.MapColor;
|
||||||
import net.minecraft.world.level.material.PushReaction;
|
import net.minecraft.world.level.material.PushReaction;
|
||||||
import net.minecraftforge.eventbus.api.IEventBus;
|
import net.neoforged.bus.api.IEventBus;
|
||||||
import net.minecraftforge.registries.DeferredRegister;
|
import net.neoforged.neoforge.capabilities.RegisterCapabilitiesEvent;
|
||||||
import net.minecraftforge.registries.ForgeRegistries;
|
import net.neoforged.neoforge.registries.DeferredHolder;
|
||||||
|
import net.neoforged.neoforge.registries.DeferredRegister;
|
||||||
|
|
||||||
import java.util.function.Supplier;
|
import java.util.function.Supplier;
|
||||||
|
|
||||||
public final class ActuallyBlocks {
|
public final class ActuallyBlocks {
|
||||||
public static final DeferredRegister<Block> BLOCKS = DeferredRegister.create(ForgeRegistries.BLOCKS, ActuallyAdditions.MODID);
|
public static final DeferredRegister.Blocks BLOCKS = DeferredRegister.createBlocks(ActuallyAdditions.MODID);
|
||||||
public static final DeferredRegister<BlockEntityType<?>> TILES = DeferredRegister.create(ForgeRegistries.BLOCK_ENTITY_TYPES, ActuallyAdditions.MODID);
|
public static final DeferredRegister<BlockEntityType<?>> TILES = DeferredRegister.create(BuiltInRegistries.BLOCK_ENTITY_TYPE, ActuallyAdditions.MODID);
|
||||||
|
|
||||||
public static final Item.Properties defaultBlockItemProperties = new Item.Properties().stacksTo(64);
|
public static final Item.Properties defaultBlockItemProperties = new Item.Properties().stacksTo(64);
|
||||||
|
|
||||||
public static final BlockBehaviour.Properties miscBlockProperties = BlockBehaviour.Properties.copy(Blocks.STONE).requiresCorrectToolForDrops().strength(1.5f, 10f);
|
public static final BlockBehaviour.Properties miscBlockProperties = BlockBehaviour.Properties.ofFullCopy(Blocks.STONE).requiresCorrectToolForDrops().strength(1.5f, 10f);
|
||||||
|
|
||||||
// Casings
|
// Casings
|
||||||
public static final AABlockReg<ActuallyBlock, AABlockItem, ?> WOOD_CASING = new AABlockReg<>("wood_casing", () -> new ActuallyBlock(miscBlockProperties), ActuallyBlock::createBlockItem);
|
public static final AABlockReg<ActuallyBlock, AABlockItem, ?> WOOD_CASING = new AABlockReg<>("wood_casing", () -> new ActuallyBlock(miscBlockProperties), ActuallyBlock::createBlockItem);
|
||||||
|
@ -274,32 +277,32 @@ public final class ActuallyBlocks {
|
||||||
public static final AABlockReg<ActuallyBlock, AABlockItem, ?> BLACK_QUARTZ_BRICK = new AABlockReg<>("black_quartz_brick_block", () -> new ActuallyBlock(miscBlockProperties), (b) -> new AABlockItem(b, defaultBlockItemProperties));
|
public static final AABlockReg<ActuallyBlock, AABlockItem, ?> BLACK_QUARTZ_BRICK = new AABlockReg<>("black_quartz_brick_block", () -> new ActuallyBlock(miscBlockProperties), (b) -> new AABlockItem(b, defaultBlockItemProperties));
|
||||||
|
|
||||||
//Walls
|
//Walls
|
||||||
public static final AABlockReg<WallBlock, AABlockItem, ?> ETHETIC_GREEN_WALL = new AABlockReg<>("ethetic_green_wall", () -> new WallBlock(BlockBehaviour.Properties.copy(ETHETIC_GREEN_BLOCK.get())), (b) -> new AABlockItem(b, defaultBlockItemProperties));
|
public static final AABlockReg<WallBlock, AABlockItem, ?> ETHETIC_GREEN_WALL = new AABlockReg<>("ethetic_green_wall", () -> new WallBlock(BlockBehaviour.Properties.ofFullCopy(ETHETIC_GREEN_BLOCK.get())), (b) -> new AABlockItem(b, defaultBlockItemProperties));
|
||||||
public static final AABlockReg<WallBlock, AABlockItem, ?> ETHETIC_WHITE_WALL = new AABlockReg<>("ethetic_white_wall", () -> new WallBlock(BlockBehaviour.Properties.copy(ETHETIC_WHITE_BLOCK.get())), (b) -> new AABlockItem(b, defaultBlockItemProperties));
|
public static final AABlockReg<WallBlock, AABlockItem, ?> ETHETIC_WHITE_WALL = new AABlockReg<>("ethetic_white_wall", () -> new WallBlock(BlockBehaviour.Properties.ofFullCopy(ETHETIC_WHITE_BLOCK.get())), (b) -> new AABlockItem(b, defaultBlockItemProperties));
|
||||||
public static final AABlockReg<WallBlock, AABlockItem, ?> BLACK_QUARTZ_WALL = new AABlockReg<>("black_quartz_wall", () -> new WallBlock(BlockBehaviour.Properties.copy(BLACK_QUARTZ.get())), (b) -> new AABlockItem(b, defaultBlockItemProperties));
|
public static final AABlockReg<WallBlock, AABlockItem, ?> BLACK_QUARTZ_WALL = new AABlockReg<>("black_quartz_wall", () -> new WallBlock(BlockBehaviour.Properties.ofFullCopy(BLACK_QUARTZ.get())), (b) -> new AABlockItem(b, defaultBlockItemProperties));
|
||||||
public static final AABlockReg<WallBlock, AABlockItem, ?> CHISELED_BLACK_QUARTZ_WALL = new AABlockReg<>("chiseled_black_quartz_wall", () -> new WallBlock(BlockBehaviour.Properties.copy(CHISELED_BLACK_QUARTZ.get())), (b) -> new AABlockItem(b, defaultBlockItemProperties));
|
public static final AABlockReg<WallBlock, AABlockItem, ?> CHISELED_BLACK_QUARTZ_WALL = new AABlockReg<>("chiseled_black_quartz_wall", () -> new WallBlock(BlockBehaviour.Properties.ofFullCopy(CHISELED_BLACK_QUARTZ.get())), (b) -> new AABlockItem(b, defaultBlockItemProperties));
|
||||||
public static final AABlockReg<WallBlock, AABlockItem, ?> SMOOTH_BLACK_QUARTZ_WALL = new AABlockReg<>("smooth_black_quartz_wall", () -> new WallBlock(BlockBehaviour.Properties.copy(CHISELED_BLACK_QUARTZ.get())), (b) -> new AABlockItem(b, defaultBlockItemProperties));
|
public static final AABlockReg<WallBlock, AABlockItem, ?> SMOOTH_BLACK_QUARTZ_WALL = new AABlockReg<>("smooth_black_quartz_wall", () -> new WallBlock(BlockBehaviour.Properties.ofFullCopy(CHISELED_BLACK_QUARTZ.get())), (b) -> new AABlockItem(b, defaultBlockItemProperties));
|
||||||
public static final AABlockReg<WallBlock, AABlockItem, ?> BLACK_QUARTZ_BRICK_WALL = new AABlockReg<>("black_quartz_brick_wall", () -> new WallBlock(BlockBehaviour.Properties.copy(CHISELED_BLACK_QUARTZ.get())), (b) -> new AABlockItem(b, defaultBlockItemProperties));
|
public static final AABlockReg<WallBlock, AABlockItem, ?> BLACK_QUARTZ_BRICK_WALL = new AABlockReg<>("black_quartz_brick_wall", () -> new WallBlock(BlockBehaviour.Properties.ofFullCopy(CHISELED_BLACK_QUARTZ.get())), (b) -> new AABlockItem(b, defaultBlockItemProperties));
|
||||||
public static final AABlockReg<WallBlock, AABlockItem, ?> BLACK_QUARTZ_PILLAR_WALL = new AABlockReg<>("black_quartz_pillar_wall", () -> new WallBlock(BlockBehaviour.Properties.copy(BLACK_QUARTZ_PILLAR.get())), (b) -> new AABlockItem(b, defaultBlockItemProperties));
|
public static final AABlockReg<WallBlock, AABlockItem, ?> BLACK_QUARTZ_PILLAR_WALL = new AABlockReg<>("black_quartz_pillar_wall", () -> new WallBlock(BlockBehaviour.Properties.ofFullCopy(BLACK_QUARTZ_PILLAR.get())), (b) -> new AABlockItem(b, defaultBlockItemProperties));
|
||||||
|
|
||||||
//Slabs
|
//Slabs
|
||||||
public static final AABlockReg<SlabBlock, AABlockItem, ?> ETHETIC_GREEN_SLAB = new AABlockReg<>("ethetic_green_slab", () -> new SlabBlock(BlockBehaviour.Properties.copy(ETHETIC_GREEN_BLOCK.get())), (b) -> new AABlockItem(b, defaultBlockItemProperties));
|
public static final AABlockReg<SlabBlock, AABlockItem, ?> ETHETIC_GREEN_SLAB = new AABlockReg<>("ethetic_green_slab", () -> new SlabBlock(BlockBehaviour.Properties.ofFullCopy(ETHETIC_GREEN_BLOCK.get())), (b) -> new AABlockItem(b, defaultBlockItemProperties));
|
||||||
public static final AABlockReg<SlabBlock, AABlockItem, ?> ETHETIC_WHITE_SLAB = new AABlockReg<>("ethetic_white_slab", () -> new SlabBlock(BlockBehaviour.Properties.copy(ETHETIC_WHITE_BLOCK.get())), (b) -> new AABlockItem(b, defaultBlockItemProperties));
|
public static final AABlockReg<SlabBlock, AABlockItem, ?> ETHETIC_WHITE_SLAB = new AABlockReg<>("ethetic_white_slab", () -> new SlabBlock(BlockBehaviour.Properties.ofFullCopy(ETHETIC_WHITE_BLOCK.get())), (b) -> new AABlockItem(b, defaultBlockItemProperties));
|
||||||
public static final AABlockReg<SlabBlock, AABlockItem, ?> BLACK_QUARTZ_SLAB = new AABlockReg<>("black_quartz_slab", () -> new SlabBlock(BlockBehaviour.Properties.copy(BLACK_QUARTZ.get())), (b) -> new AABlockItem(b, defaultBlockItemProperties));
|
public static final AABlockReg<SlabBlock, AABlockItem, ?> BLACK_QUARTZ_SLAB = new AABlockReg<>("black_quartz_slab", () -> new SlabBlock(BlockBehaviour.Properties.ofFullCopy(BLACK_QUARTZ.get())), (b) -> new AABlockItem(b, defaultBlockItemProperties));
|
||||||
public static final AABlockReg<SlabBlock, AABlockItem, ?> CHISELED_BLACK_QUARTZ_SLAB = new AABlockReg<>("chiseled_black_quartz_slab", () -> new SlabBlock(BlockBehaviour.Properties.copy(CHISELED_BLACK_QUARTZ.get())), (b) -> new AABlockItem(b, defaultBlockItemProperties));
|
public static final AABlockReg<SlabBlock, AABlockItem, ?> CHISELED_BLACK_QUARTZ_SLAB = new AABlockReg<>("chiseled_black_quartz_slab", () -> new SlabBlock(BlockBehaviour.Properties.ofFullCopy(CHISELED_BLACK_QUARTZ.get())), (b) -> new AABlockItem(b, defaultBlockItemProperties));
|
||||||
public static final AABlockReg<SlabBlock, AABlockItem, ?> BLACK_QUARTZ_PILLAR_SLAB = new AABlockReg<>("black_quartz_pillar_slab", () -> new SlabBlock(BlockBehaviour.Properties.copy(BLACK_QUARTZ_PILLAR.get())), (b) -> new AABlockItem(b, defaultBlockItemProperties));
|
public static final AABlockReg<SlabBlock, AABlockItem, ?> BLACK_QUARTZ_PILLAR_SLAB = new AABlockReg<>("black_quartz_pillar_slab", () -> new SlabBlock(BlockBehaviour.Properties.ofFullCopy(BLACK_QUARTZ_PILLAR.get())), (b) -> new AABlockItem(b, defaultBlockItemProperties));
|
||||||
public static final AABlockReg<SlabBlock, AABlockItem, ?> SMOOTH_BLACK_QUARTZ_SLAB = new AABlockReg<>("smooth_black_quartz_slab", () -> new SlabBlock(BlockBehaviour.Properties.copy(BLACK_QUARTZ_PILLAR.get())), (b) -> new AABlockItem(b, defaultBlockItemProperties));
|
public static final AABlockReg<SlabBlock, AABlockItem, ?> SMOOTH_BLACK_QUARTZ_SLAB = new AABlockReg<>("smooth_black_quartz_slab", () -> new SlabBlock(BlockBehaviour.Properties.ofFullCopy(BLACK_QUARTZ_PILLAR.get())), (b) -> new AABlockItem(b, defaultBlockItemProperties));
|
||||||
public static final AABlockReg<SlabBlock, AABlockItem, ?> BLACK_QUARTZ_BRICK_SLAB = new AABlockReg<>("black_quartz_brick_slab", () -> new SlabBlock(BlockBehaviour.Properties.copy(BLACK_QUARTZ_PILLAR.get())), (b) -> new AABlockItem(b, defaultBlockItemProperties));
|
public static final AABlockReg<SlabBlock, AABlockItem, ?> BLACK_QUARTZ_BRICK_SLAB = new AABlockReg<>("black_quartz_brick_slab", () -> new SlabBlock(BlockBehaviour.Properties.ofFullCopy(BLACK_QUARTZ_PILLAR.get())), (b) -> new AABlockItem(b, defaultBlockItemProperties));
|
||||||
|
|
||||||
|
|
||||||
//Stairs
|
//Stairs
|
||||||
public static final AABlockReg<StairBlock, AABlockItem, ?> ETHETIC_GREEN_STAIRS = new AABlockReg<>("ethetic_green_stairs", () -> new StairBlock(() -> ETHETIC_GREEN_BLOCK.get().defaultBlockState(), BlockBehaviour.Properties.copy(ETHETIC_GREEN_BLOCK.get())), (b) -> new AABlockItem(b, defaultBlockItemProperties));
|
public static final AABlockReg<StairBlock, AABlockItem, ?> ETHETIC_GREEN_STAIRS = new AABlockReg<>("ethetic_green_stairs", () -> new StairBlock(() -> ETHETIC_GREEN_BLOCK.get().defaultBlockState(), BlockBehaviour.Properties.ofFullCopy(ETHETIC_GREEN_BLOCK.get())), (b) -> new AABlockItem(b, defaultBlockItemProperties));
|
||||||
public static final AABlockReg<StairBlock, AABlockItem, ?> ETHETIC_WHITE_STAIRS = new AABlockReg<>("ethetic_white_stairs", () -> new StairBlock(() -> ETHETIC_WHITE_BLOCK.get().defaultBlockState(), BlockBehaviour.Properties.copy(ETHETIC_WHITE_BLOCK.get())), (b) -> new AABlockItem(b, defaultBlockItemProperties));
|
public static final AABlockReg<StairBlock, AABlockItem, ?> ETHETIC_WHITE_STAIRS = new AABlockReg<>("ethetic_white_stairs", () -> new StairBlock(() -> ETHETIC_WHITE_BLOCK.get().defaultBlockState(), BlockBehaviour.Properties.ofFullCopy(ETHETIC_WHITE_BLOCK.get())), (b) -> new AABlockItem(b, defaultBlockItemProperties));
|
||||||
public static final AABlockReg<StairBlock, AABlockItem, ?> BLACK_QUARTZ_STAIR = new AABlockReg<>("black_quartz_stair", () -> new StairBlock(() -> BLACK_QUARTZ.get().defaultBlockState(), BlockBehaviour.Properties.copy(BLACK_QUARTZ.get())), (b) -> new AABlockItem(b, defaultBlockItemProperties));
|
public static final AABlockReg<StairBlock, AABlockItem, ?> BLACK_QUARTZ_STAIR = new AABlockReg<>("black_quartz_stair", () -> new StairBlock(() -> BLACK_QUARTZ.get().defaultBlockState(), BlockBehaviour.Properties.ofFullCopy(BLACK_QUARTZ.get())), (b) -> new AABlockItem(b, defaultBlockItemProperties));
|
||||||
public static final AABlockReg<StairBlock, AABlockItem, ?> CHISELED_BLACK_QUARTZ_STAIR = new AABlockReg<>("chiseled_black_quartz_stair", () -> new StairBlock(() -> CHISELED_BLACK_QUARTZ.get().defaultBlockState(), BlockBehaviour.Properties.copy(CHISELED_BLACK_QUARTZ.get())), (b) -> new AABlockItem(b, defaultBlockItemProperties));
|
public static final AABlockReg<StairBlock, AABlockItem, ?> CHISELED_BLACK_QUARTZ_STAIR = new AABlockReg<>("chiseled_black_quartz_stair", () -> new StairBlock(() -> CHISELED_BLACK_QUARTZ.get().defaultBlockState(), BlockBehaviour.Properties.ofFullCopy(CHISELED_BLACK_QUARTZ.get())), (b) -> new AABlockItem(b, defaultBlockItemProperties));
|
||||||
public static final AABlockReg<StairBlock, AABlockItem, ?> BLACK_QUARTZ_PILLAR_STAIR = new AABlockReg<>("black_quartz_pillar_stair", () -> new StairBlock(() -> BLACK_QUARTZ_PILLAR.get().defaultBlockState(), BlockBehaviour.Properties.copy(BLACK_QUARTZ_PILLAR.get())), (b) -> new AABlockItem(b, defaultBlockItemProperties));
|
public static final AABlockReg<StairBlock, AABlockItem, ?> BLACK_QUARTZ_PILLAR_STAIR = new AABlockReg<>("black_quartz_pillar_stair", () -> new StairBlock(() -> BLACK_QUARTZ_PILLAR.get().defaultBlockState(), BlockBehaviour.Properties.ofFullCopy(BLACK_QUARTZ_PILLAR.get())), (b) -> new AABlockItem(b, defaultBlockItemProperties));
|
||||||
public static final AABlockReg<StairBlock, AABlockItem, ?> SMOOTH_BLACK_QUARTZ_STAIR = new AABlockReg<>("smooth_black_quartz_stair", () -> new StairBlock(() -> BLACK_QUARTZ_PILLAR.get().defaultBlockState(), BlockBehaviour.Properties.copy(BLACK_QUARTZ_PILLAR.get())), (b) -> new AABlockItem(b, defaultBlockItemProperties));
|
public static final AABlockReg<StairBlock, AABlockItem, ?> SMOOTH_BLACK_QUARTZ_STAIR = new AABlockReg<>("smooth_black_quartz_stair", () -> new StairBlock(() -> BLACK_QUARTZ_PILLAR.get().defaultBlockState(), BlockBehaviour.Properties.ofFullCopy(BLACK_QUARTZ_PILLAR.get())), (b) -> new AABlockItem(b, defaultBlockItemProperties));
|
||||||
public static final AABlockReg<StairBlock, AABlockItem, ?> BLACK_QUARTZ_BRICK_STAIR = new AABlockReg<>("black_quartz_brick_stair", () -> new StairBlock(() -> BLACK_QUARTZ_PILLAR.get().defaultBlockState(), BlockBehaviour.Properties.copy(BLACK_QUARTZ_PILLAR.get())), (b) -> new AABlockItem(b, defaultBlockItemProperties));
|
public static final AABlockReg<StairBlock, AABlockItem, ?> BLACK_QUARTZ_BRICK_STAIR = new AABlockReg<>("black_quartz_brick_stair", () -> new StairBlock(() -> BLACK_QUARTZ_PILLAR.get().defaultBlockState(), BlockBehaviour.Properties.ofFullCopy(BLACK_QUARTZ_PILLAR.get())), (b) -> new AABlockItem(b, defaultBlockItemProperties));
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
@ -318,11 +321,11 @@ public final class ActuallyBlocks {
|
||||||
(b) -> new AABlockItem(b, defaultBlockItemProperties));
|
(b) -> new AABlockItem(b, defaultBlockItemProperties));
|
||||||
|
|
||||||
public static BlockBehaviour.Properties defaultPickProps(float hardness, float resistance) {
|
public static BlockBehaviour.Properties defaultPickProps(float hardness, float resistance) {
|
||||||
return BlockBehaviour.Properties.copy(Blocks.STONE).requiresCorrectToolForDrops().strength(hardness, resistance).sound(SoundType.STONE);
|
return BlockBehaviour.Properties.ofFullCopy(Blocks.STONE).requiresCorrectToolForDrops().strength(hardness, resistance).sound(SoundType.STONE);
|
||||||
}
|
}
|
||||||
|
|
||||||
public static BlockBehaviour.Properties defaultPickProps() {
|
public static BlockBehaviour.Properties defaultPickProps() {
|
||||||
return BlockBehaviour.Properties.copy(Blocks.STONE).requiresCorrectToolForDrops().strength(1.5F, 10.0F).sound(SoundType.STONE);
|
return BlockBehaviour.Properties.ofFullCopy(Blocks.STONE).requiresCorrectToolForDrops().strength(1.5F, 10.0F).sound(SoundType.STONE);
|
||||||
}
|
}
|
||||||
|
|
||||||
public static BlockBehaviour.Properties defaultCropProps() {
|
public static BlockBehaviour.Properties defaultCropProps() {
|
||||||
|
@ -332,5 +335,10 @@ public final class ActuallyBlocks {
|
||||||
public static void init(IEventBus evt) {
|
public static void init(IEventBus evt) {
|
||||||
BLOCKS.register(evt);
|
BLOCKS.register(evt);
|
||||||
TILES.register(evt);
|
TILES.register(evt);
|
||||||
|
evt.addListener(ActuallyBlocks::registerCapabilities);
|
||||||
|
}
|
||||||
|
|
||||||
|
public static void registerCapabilities(RegisterCapabilitiesEvent event) {
|
||||||
|
//TODO: Register caps to the BlockEntities that have them
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -39,8 +39,8 @@ import net.minecraft.world.level.block.state.properties.BlockStateProperties;
|
||||||
import net.minecraft.world.level.block.state.properties.DirectionProperty;
|
import net.minecraft.world.level.block.state.properties.DirectionProperty;
|
||||||
import net.minecraft.world.phys.BlockHitResult;
|
import net.minecraft.world.phys.BlockHitResult;
|
||||||
import net.minecraft.world.phys.HitResult;
|
import net.minecraft.world.phys.HitResult;
|
||||||
import net.minecraftforge.api.distmarker.Dist;
|
import net.neoforged.api.distmarker.Dist;
|
||||||
import net.minecraftforge.api.distmarker.OnlyIn;
|
import net.neoforged.api.distmarker.OnlyIn;
|
||||||
|
|
||||||
import javax.annotation.Nonnull;
|
import javax.annotation.Nonnull;
|
||||||
import javax.annotation.Nullable;
|
import javax.annotation.Nullable;
|
||||||
|
|
|
@ -13,7 +13,6 @@ package de.ellpeck.actuallyadditions.mod.blocks;
|
||||||
import de.ellpeck.actuallyadditions.mod.blocks.base.BlockContainerBase;
|
import de.ellpeck.actuallyadditions.mod.blocks.base.BlockContainerBase;
|
||||||
import de.ellpeck.actuallyadditions.mod.tile.TileEntityCanolaPress;
|
import de.ellpeck.actuallyadditions.mod.tile.TileEntityCanolaPress;
|
||||||
import net.minecraft.core.BlockPos;
|
import net.minecraft.core.BlockPos;
|
||||||
import net.minecraft.server.level.ServerPlayer;
|
|
||||||
import net.minecraft.world.InteractionHand;
|
import net.minecraft.world.InteractionHand;
|
||||||
import net.minecraft.world.InteractionResult;
|
import net.minecraft.world.InteractionResult;
|
||||||
import net.minecraft.world.entity.player.Player;
|
import net.minecraft.world.entity.player.Player;
|
||||||
|
@ -26,8 +25,7 @@ import net.minecraft.world.level.block.state.BlockState;
|
||||||
import net.minecraft.world.phys.BlockHitResult;
|
import net.minecraft.world.phys.BlockHitResult;
|
||||||
import net.minecraft.world.phys.shapes.CollisionContext;
|
import net.minecraft.world.phys.shapes.CollisionContext;
|
||||||
import net.minecraft.world.phys.shapes.VoxelShape;
|
import net.minecraft.world.phys.shapes.VoxelShape;
|
||||||
import net.minecraftforge.fluids.FluidUtil;
|
import net.neoforged.neoforge.fluids.FluidUtil;
|
||||||
import net.minecraftforge.network.NetworkHooks;
|
|
||||||
|
|
||||||
import javax.annotation.Nullable;
|
import javax.annotation.Nullable;
|
||||||
|
|
||||||
|
@ -63,7 +61,7 @@ public class BlockCanolaPress extends BlockContainerBase {
|
||||||
return InteractionResult.SUCCESS;
|
return InteractionResult.SUCCESS;
|
||||||
if (!player.isShiftKeyDown()) {
|
if (!player.isShiftKeyDown()) {
|
||||||
if (!FluidUtil.interactWithFluidHandler(player, hand, tile.tank))
|
if (!FluidUtil.interactWithFluidHandler(player, hand, tile.tank))
|
||||||
NetworkHooks.openScreen((ServerPlayer) player, tile, pos);
|
player.openMenu(tile, pos);
|
||||||
return InteractionResult.SUCCESS;
|
return InteractionResult.SUCCESS;
|
||||||
}
|
}
|
||||||
return InteractionResult.PASS;
|
return InteractionResult.PASS;
|
||||||
|
|
|
@ -13,7 +13,6 @@ package de.ellpeck.actuallyadditions.mod.blocks;
|
||||||
import de.ellpeck.actuallyadditions.mod.blocks.base.DirectionalBlock;
|
import de.ellpeck.actuallyadditions.mod.blocks.base.DirectionalBlock;
|
||||||
import de.ellpeck.actuallyadditions.mod.tile.TileEntityCoffeeMachine;
|
import de.ellpeck.actuallyadditions.mod.tile.TileEntityCoffeeMachine;
|
||||||
import net.minecraft.core.BlockPos;
|
import net.minecraft.core.BlockPos;
|
||||||
import net.minecraft.server.level.ServerPlayer;
|
|
||||||
import net.minecraft.world.InteractionHand;
|
import net.minecraft.world.InteractionHand;
|
||||||
import net.minecraft.world.InteractionResult;
|
import net.minecraft.world.InteractionResult;
|
||||||
import net.minecraft.world.entity.player.Player;
|
import net.minecraft.world.entity.player.Player;
|
||||||
|
@ -26,7 +25,6 @@ import net.minecraft.world.level.block.state.BlockState;
|
||||||
import net.minecraft.world.phys.BlockHitResult;
|
import net.minecraft.world.phys.BlockHitResult;
|
||||||
import net.minecraft.world.phys.shapes.CollisionContext;
|
import net.minecraft.world.phys.shapes.CollisionContext;
|
||||||
import net.minecraft.world.phys.shapes.VoxelShape;
|
import net.minecraft.world.phys.shapes.VoxelShape;
|
||||||
import net.minecraftforge.network.NetworkHooks;
|
|
||||||
|
|
||||||
import javax.annotation.Nullable;
|
import javax.annotation.Nullable;
|
||||||
|
|
||||||
|
@ -41,7 +39,7 @@ public class BlockCoffeeMachine extends DirectionalBlock.Container {
|
||||||
TileEntityCoffeeMachine tile = (TileEntityCoffeeMachine) world.getBlockEntity(pos);
|
TileEntityCoffeeMachine tile = (TileEntityCoffeeMachine) world.getBlockEntity(pos);
|
||||||
if (tile != null) {
|
if (tile != null) {
|
||||||
if (!this.tryUseItemOnTank(player, hand, tile.tank)) {
|
if (!this.tryUseItemOnTank(player, hand, tile.tank)) {
|
||||||
NetworkHooks.openScreen((ServerPlayer) player, tile, pos);
|
player.openMenu(tile, pos);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
return InteractionResult.PASS;
|
return InteractionResult.PASS;
|
||||||
|
|
|
@ -13,7 +13,6 @@ package de.ellpeck.actuallyadditions.mod.blocks;
|
||||||
import de.ellpeck.actuallyadditions.mod.blocks.base.BlockContainerBase;
|
import de.ellpeck.actuallyadditions.mod.blocks.base.BlockContainerBase;
|
||||||
import de.ellpeck.actuallyadditions.mod.tile.TileEntityFermentingBarrel;
|
import de.ellpeck.actuallyadditions.mod.tile.TileEntityFermentingBarrel;
|
||||||
import net.minecraft.core.BlockPos;
|
import net.minecraft.core.BlockPos;
|
||||||
import net.minecraft.server.level.ServerPlayer;
|
|
||||||
import net.minecraft.sounds.SoundEvents;
|
import net.minecraft.sounds.SoundEvents;
|
||||||
import net.minecraft.sounds.SoundSource;
|
import net.minecraft.sounds.SoundSource;
|
||||||
import net.minecraft.world.InteractionHand;
|
import net.minecraft.world.InteractionHand;
|
||||||
|
@ -33,8 +32,7 @@ import net.minecraft.world.level.material.MapColor;
|
||||||
import net.minecraft.world.phys.BlockHitResult;
|
import net.minecraft.world.phys.BlockHitResult;
|
||||||
import net.minecraft.world.phys.shapes.CollisionContext;
|
import net.minecraft.world.phys.shapes.CollisionContext;
|
||||||
import net.minecraft.world.phys.shapes.VoxelShape;
|
import net.minecraft.world.phys.shapes.VoxelShape;
|
||||||
import net.minecraftforge.fluids.FluidUtil;
|
import net.neoforged.neoforge.fluids.FluidUtil;
|
||||||
import net.minecraftforge.network.NetworkHooks;
|
|
||||||
|
|
||||||
import javax.annotation.Nullable;
|
import javax.annotation.Nullable;
|
||||||
|
|
||||||
|
@ -68,7 +66,7 @@ public class BlockFermentingBarrel extends BlockContainerBase {
|
||||||
ItemStack stack = player.getItemInHand(hand);
|
ItemStack stack = player.getItemInHand(hand);
|
||||||
world.playSound(null, pos, stack.getItem() == Items.BUCKET ? SoundEvents.BUCKET_EMPTY:SoundEvents.BUCKET_FILL, SoundSource.BLOCKS, 1.0F, 1.0F);
|
world.playSound(null, pos, stack.getItem() == Items.BUCKET ? SoundEvents.BUCKET_EMPTY:SoundEvents.BUCKET_FILL, SoundSource.BLOCKS, 1.0F, 1.0F);
|
||||||
} else
|
} else
|
||||||
NetworkHooks.openScreen((ServerPlayer) player, tile, pos);
|
player.openMenu(tile, pos);
|
||||||
return InteractionResult.SUCCESS;
|
return InteractionResult.SUCCESS;
|
||||||
}
|
}
|
||||||
return InteractionResult.PASS;
|
return InteractionResult.PASS;
|
||||||
|
|
|
@ -26,7 +26,7 @@ import net.minecraft.world.level.block.state.BlockState;
|
||||||
import net.minecraft.world.phys.BlockHitResult;
|
import net.minecraft.world.phys.BlockHitResult;
|
||||||
import net.minecraft.world.phys.shapes.CollisionContext;
|
import net.minecraft.world.phys.shapes.CollisionContext;
|
||||||
import net.minecraft.world.phys.shapes.VoxelShape;
|
import net.minecraft.world.phys.shapes.VoxelShape;
|
||||||
import net.minecraftforge.fluids.FluidUtil;
|
import net.neoforged.neoforge.fluids.FluidUtil;
|
||||||
|
|
||||||
import javax.annotation.Nonnull;
|
import javax.annotation.Nonnull;
|
||||||
import javax.annotation.Nullable;
|
import javax.annotation.Nullable;
|
||||||
|
|
|
@ -49,8 +49,8 @@ import net.minecraft.world.phys.BlockHitResult;
|
||||||
import net.minecraft.world.phys.HitResult;
|
import net.minecraft.world.phys.HitResult;
|
||||||
import net.minecraft.world.phys.shapes.CollisionContext;
|
import net.minecraft.world.phys.shapes.CollisionContext;
|
||||||
import net.minecraft.world.phys.shapes.VoxelShape;
|
import net.minecraft.world.phys.shapes.VoxelShape;
|
||||||
import net.minecraftforge.api.distmarker.Dist;
|
import net.neoforged.api.distmarker.Dist;
|
||||||
import net.minecraftforge.api.distmarker.OnlyIn;
|
import net.neoforged.api.distmarker.OnlyIn;
|
||||||
|
|
||||||
import javax.annotation.Nullable;
|
import javax.annotation.Nullable;
|
||||||
import java.util.ArrayList;
|
import java.util.ArrayList;
|
||||||
|
|
|
@ -31,8 +31,8 @@ import net.minecraft.world.phys.BlockHitResult;
|
||||||
import net.minecraft.world.phys.HitResult;
|
import net.minecraft.world.phys.HitResult;
|
||||||
import net.minecraft.world.phys.shapes.CollisionContext;
|
import net.minecraft.world.phys.shapes.CollisionContext;
|
||||||
import net.minecraft.world.phys.shapes.VoxelShape;
|
import net.minecraft.world.phys.shapes.VoxelShape;
|
||||||
import net.minecraftforge.api.distmarker.Dist;
|
import net.neoforged.api.distmarker.Dist;
|
||||||
import net.minecraftforge.api.distmarker.OnlyIn;
|
import net.neoforged.api.distmarker.OnlyIn;
|
||||||
|
|
||||||
import javax.annotation.Nullable;
|
import javax.annotation.Nullable;
|
||||||
|
|
||||||
|
|
|
@ -15,7 +15,6 @@ import de.ellpeck.actuallyadditions.mod.tile.TileEntityOilGenerator;
|
||||||
import net.minecraft.core.BlockPos;
|
import net.minecraft.core.BlockPos;
|
||||||
import net.minecraft.core.particles.ParticleTypes;
|
import net.minecraft.core.particles.ParticleTypes;
|
||||||
import net.minecraft.server.level.ServerLevel;
|
import net.minecraft.server.level.ServerLevel;
|
||||||
import net.minecraft.server.level.ServerPlayer;
|
|
||||||
import net.minecraft.util.RandomSource;
|
import net.minecraft.util.RandomSource;
|
||||||
import net.minecraft.world.InteractionHand;
|
import net.minecraft.world.InteractionHand;
|
||||||
import net.minecraft.world.InteractionResult;
|
import net.minecraft.world.InteractionResult;
|
||||||
|
@ -29,7 +28,6 @@ import net.minecraft.world.level.block.state.BlockState;
|
||||||
import net.minecraft.world.phys.BlockHitResult;
|
import net.minecraft.world.phys.BlockHitResult;
|
||||||
import net.minecraft.world.phys.shapes.CollisionContext;
|
import net.minecraft.world.phys.shapes.CollisionContext;
|
||||||
import net.minecraft.world.phys.shapes.VoxelShape;
|
import net.minecraft.world.phys.shapes.VoxelShape;
|
||||||
import net.minecraftforge.network.NetworkHooks;
|
|
||||||
|
|
||||||
import javax.annotation.Nullable;
|
import javax.annotation.Nullable;
|
||||||
|
|
||||||
|
@ -70,7 +68,7 @@ public class BlockOilGenerator extends DirectionalBlock.Container {
|
||||||
TileEntityOilGenerator generator = (TileEntityOilGenerator) world.getBlockEntity(pos);
|
TileEntityOilGenerator generator = (TileEntityOilGenerator) world.getBlockEntity(pos);
|
||||||
if (generator != null) {
|
if (generator != null) {
|
||||||
if (!this.tryUseItemOnTank(player, hand, generator.tank)) {
|
if (!this.tryUseItemOnTank(player, hand, generator.tank)) {
|
||||||
NetworkHooks.openScreen((ServerPlayer) player, generator, pos);
|
player.openMenu(generator, pos);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -43,8 +43,8 @@ import net.minecraft.world.level.block.state.BlockState;
|
||||||
import net.minecraft.world.phys.BlockHitResult;
|
import net.minecraft.world.phys.BlockHitResult;
|
||||||
import net.minecraft.world.phys.HitResult;
|
import net.minecraft.world.phys.HitResult;
|
||||||
import net.minecraft.world.phys.Vec3;
|
import net.minecraft.world.phys.Vec3;
|
||||||
import net.minecraftforge.api.distmarker.Dist;
|
import net.neoforged.api.distmarker.Dist;
|
||||||
import net.minecraftforge.api.distmarker.OnlyIn;
|
import net.neoforged.api.distmarker.OnlyIn;
|
||||||
|
|
||||||
import javax.annotation.Nullable;
|
import javax.annotation.Nullable;
|
||||||
|
|
||||||
|
|
|
@ -30,8 +30,8 @@ import net.minecraft.world.phys.BlockHitResult;
|
||||||
import net.minecraft.world.phys.HitResult;
|
import net.minecraft.world.phys.HitResult;
|
||||||
import net.minecraft.world.phys.shapes.CollisionContext;
|
import net.minecraft.world.phys.shapes.CollisionContext;
|
||||||
import net.minecraft.world.phys.shapes.VoxelShape;
|
import net.minecraft.world.phys.shapes.VoxelShape;
|
||||||
import net.minecraftforge.api.distmarker.Dist;
|
import net.neoforged.api.distmarker.Dist;
|
||||||
import net.minecraftforge.api.distmarker.OnlyIn;
|
import net.neoforged.api.distmarker.OnlyIn;
|
||||||
|
|
||||||
import javax.annotation.Nullable;
|
import javax.annotation.Nullable;
|
||||||
|
|
||||||
|
|
|
@ -23,9 +23,9 @@ import net.minecraft.world.level.block.entity.BlockEntityType;
|
||||||
import net.minecraft.world.level.block.state.BlockState;
|
import net.minecraft.world.level.block.state.BlockState;
|
||||||
import net.minecraft.world.phys.shapes.CollisionContext;
|
import net.minecraft.world.phys.shapes.CollisionContext;
|
||||||
import net.minecraft.world.phys.shapes.VoxelShape;
|
import net.minecraft.world.phys.shapes.VoxelShape;
|
||||||
import net.minecraftforge.common.MinecraftForge;
|
import net.neoforged.bus.api.SubscribeEvent;
|
||||||
import net.minecraftforge.event.level.ExplosionEvent;
|
import net.neoforged.neoforge.common.NeoForge;
|
||||||
import net.minecraftforge.eventbus.api.SubscribeEvent;
|
import net.neoforged.neoforge.event.level.ExplosionEvent;
|
||||||
|
|
||||||
import javax.annotation.Nullable;
|
import javax.annotation.Nullable;
|
||||||
import java.util.ArrayList;
|
import java.util.ArrayList;
|
||||||
|
@ -36,7 +36,7 @@ public class BlockShockSuppressor extends Block implements EntityBlock {
|
||||||
|
|
||||||
public BlockShockSuppressor() {
|
public BlockShockSuppressor() {
|
||||||
super(ActuallyBlocks.defaultPickProps(20F, 2000.0F));
|
super(ActuallyBlocks.defaultPickProps(20F, 2000.0F));
|
||||||
MinecraftForge.EVENT_BUS.register(this);
|
NeoForge.EVENT_BUS.register(this);
|
||||||
}
|
}
|
||||||
|
|
||||||
@SubscribeEvent
|
@SubscribeEvent
|
||||||
|
|
|
@ -30,8 +30,8 @@ import net.minecraft.world.phys.BlockHitResult;
|
||||||
import net.minecraft.world.phys.HitResult;
|
import net.minecraft.world.phys.HitResult;
|
||||||
import net.minecraft.world.phys.shapes.CollisionContext;
|
import net.minecraft.world.phys.shapes.CollisionContext;
|
||||||
import net.minecraft.world.phys.shapes.VoxelShape;
|
import net.minecraft.world.phys.shapes.VoxelShape;
|
||||||
import net.minecraftforge.api.distmarker.Dist;
|
import net.neoforged.api.distmarker.Dist;
|
||||||
import net.minecraftforge.api.distmarker.OnlyIn;
|
import net.neoforged.api.distmarker.OnlyIn;
|
||||||
|
|
||||||
import javax.annotation.Nullable;
|
import javax.annotation.Nullable;
|
||||||
|
|
||||||
|
|
|
@ -16,8 +16,8 @@ import net.minecraft.client.gui.GuiGraphics;
|
||||||
import net.minecraft.world.entity.player.Player;
|
import net.minecraft.world.entity.player.Player;
|
||||||
import net.minecraft.world.item.ItemStack;
|
import net.minecraft.world.item.ItemStack;
|
||||||
import net.minecraft.world.phys.HitResult;
|
import net.minecraft.world.phys.HitResult;
|
||||||
import net.minecraftforge.api.distmarker.Dist;
|
import net.neoforged.api.distmarker.Dist;
|
||||||
import net.minecraftforge.api.distmarker.OnlyIn;
|
import net.neoforged.api.distmarker.OnlyIn;
|
||||||
|
|
||||||
public interface IHudDisplay {
|
public interface IHudDisplay {
|
||||||
|
|
||||||
|
|
|
@ -1,7 +1,6 @@
|
||||||
package de.ellpeck.actuallyadditions.mod.blocks;
|
package de.ellpeck.actuallyadditions.mod.blocks;
|
||||||
|
|
||||||
import net.minecraft.world.level.block.Block;
|
import net.minecraft.world.level.block.Block;
|
||||||
import net.minecraft.world.phys.AABB;
|
|
||||||
import net.minecraft.world.phys.shapes.BooleanOp;
|
import net.minecraft.world.phys.shapes.BooleanOp;
|
||||||
import net.minecraft.world.phys.shapes.Shapes;
|
import net.minecraft.world.phys.shapes.Shapes;
|
||||||
import net.minecraft.world.phys.shapes.VoxelShape;
|
import net.minecraft.world.phys.shapes.VoxelShape;
|
||||||
|
|
|
@ -8,8 +8,8 @@ import java.util.function.Supplier;
|
||||||
|
|
||||||
public class AACrops extends CropBlock {
|
public class AACrops extends CropBlock {
|
||||||
Supplier<Item> itemSupplier;
|
Supplier<Item> itemSupplier;
|
||||||
public AACrops(Properties p_i48421_1_, Supplier<Item> seedSupplier) {
|
public AACrops(Properties properties, Supplier<Item> seedSupplier) {
|
||||||
super(p_i48421_1_);
|
super(properties);
|
||||||
this.itemSupplier = seedSupplier;
|
this.itemSupplier = seedSupplier;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -10,11 +10,19 @@
|
||||||
|
|
||||||
package de.ellpeck.actuallyadditions.mod.blocks.base;
|
package de.ellpeck.actuallyadditions.mod.blocks.base;
|
||||||
|
|
||||||
|
import com.mojang.serialization.MapCodec;
|
||||||
import net.minecraft.world.level.block.BushBlock;
|
import net.minecraft.world.level.block.BushBlock;
|
||||||
import net.minecraft.world.level.block.SoundType;
|
import net.minecraft.world.level.block.SoundType;
|
||||||
|
|
||||||
public class BlockBushBase extends BushBlock {
|
public class BlockBushBase extends BushBlock {
|
||||||
|
public static final MapCodec<BlockBushBase> CODEC = simpleCodec(BlockBushBase::new);
|
||||||
|
|
||||||
public BlockBushBase(Properties properties) {
|
public BlockBushBase(Properties properties) {
|
||||||
super(properties.sound(SoundType.GRASS));
|
super(properties.sound(SoundType.GRASS));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
protected MapCodec<? extends BushBlock> codec() {
|
||||||
|
return CODEC;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -20,7 +20,6 @@ import net.minecraft.core.BlockPos;
|
||||||
import net.minecraft.nbt.CompoundTag;
|
import net.minecraft.nbt.CompoundTag;
|
||||||
import net.minecraft.network.chat.Component;
|
import net.minecraft.network.chat.Component;
|
||||||
import net.minecraft.server.level.ServerLevel;
|
import net.minecraft.server.level.ServerLevel;
|
||||||
import net.minecraft.server.level.ServerPlayer;
|
|
||||||
import net.minecraft.util.RandomSource;
|
import net.minecraft.util.RandomSource;
|
||||||
import net.minecraft.world.InteractionHand;
|
import net.minecraft.world.InteractionHand;
|
||||||
import net.minecraft.world.InteractionResult;
|
import net.minecraft.world.InteractionResult;
|
||||||
|
@ -36,9 +35,8 @@ import net.minecraft.world.level.block.EntityBlock;
|
||||||
import net.minecraft.world.level.block.RenderShape;
|
import net.minecraft.world.level.block.RenderShape;
|
||||||
import net.minecraft.world.level.block.entity.BlockEntity;
|
import net.minecraft.world.level.block.entity.BlockEntity;
|
||||||
import net.minecraft.world.level.block.state.BlockState;
|
import net.minecraft.world.level.block.state.BlockState;
|
||||||
import net.minecraftforge.fluids.FluidUtil;
|
import net.neoforged.neoforge.fluids.FluidUtil;
|
||||||
import net.minecraftforge.fluids.capability.templates.FluidTank;
|
import net.neoforged.neoforge.fluids.capability.templates.FluidTank;
|
||||||
import net.minecraftforge.network.NetworkHooks;
|
|
||||||
|
|
||||||
import javax.annotation.Nonnull;
|
import javax.annotation.Nonnull;
|
||||||
import javax.annotation.Nullable;
|
import javax.annotation.Nullable;
|
||||||
|
@ -52,7 +50,7 @@ public abstract class BlockContainerBase extends Block implements EntityBlock {
|
||||||
if (!world.isClientSide) {
|
if (!world.isClientSide) {
|
||||||
BlockEntity tile = world.getBlockEntity(pos);
|
BlockEntity tile = world.getBlockEntity(pos);
|
||||||
if (expectedInstance.isInstance(tile)) {
|
if (expectedInstance.isInstance(tile)) {
|
||||||
NetworkHooks.openScreen((ServerPlayer) player, (MenuProvider) tile, pos);
|
player.openMenu((MenuProvider) tile);
|
||||||
}
|
}
|
||||||
return InteractionResult.SUCCESS;
|
return InteractionResult.SUCCESS;
|
||||||
}
|
}
|
||||||
|
@ -184,14 +182,15 @@ public abstract class BlockContainerBase extends Block implements EntityBlock {
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void playerWillDestroy(@Nonnull Level world, @Nonnull BlockPos pos, @Nonnull BlockState state, Player player) {
|
public BlockState playerWillDestroy(@Nonnull Level world, @Nonnull BlockPos pos, @Nonnull BlockState state, Player player) {
|
||||||
super.playerWillDestroy(world, pos, state, player);
|
BlockState theState = super.playerWillDestroy(world, pos, state, player);
|
||||||
if (!player.isCreative()) {
|
if (!player.isCreative()) {
|
||||||
BlockEntity tile = world.getBlockEntity(pos);
|
BlockEntity tile = world.getBlockEntity(pos);
|
||||||
if (tile instanceof TileEntityBase && ((TileEntityBase) tile).stopFromDropping) {
|
if (tile instanceof TileEntityBase && ((TileEntityBase) tile).stopFromDropping) {
|
||||||
player.displayClientMessage(Component.translatable("info." + ActuallyAdditions.MODID + ".machineBroke").withStyle(ChatFormatting.RED), false);
|
player.displayClientMessage(Component.translatable("info." + ActuallyAdditions.MODID + ".machineBroke").withStyle(ChatFormatting.RED), false);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
return theState;
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
|
|
@ -28,8 +28,8 @@ import net.minecraft.world.level.block.state.BlockState;
|
||||||
import net.minecraft.world.level.material.MapColor;
|
import net.minecraft.world.level.material.MapColor;
|
||||||
import net.minecraft.world.level.material.PushReaction;
|
import net.minecraft.world.level.material.PushReaction;
|
||||||
import net.minecraft.world.phys.BlockHitResult;
|
import net.minecraft.world.phys.BlockHitResult;
|
||||||
import net.minecraftforge.common.PlantType;
|
import net.neoforged.neoforge.common.PlantType;
|
||||||
import net.minecraftforge.items.ItemHandlerHelper;
|
import net.neoforged.neoforge.items.ItemHandlerHelper;
|
||||||
|
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
import java.util.function.Supplier;
|
import java.util.function.Supplier;
|
||||||
|
|
|
@ -21,6 +21,9 @@ import net.minecraft.client.renderer.blockentity.BlockEntityRenderer;
|
||||||
import net.minecraft.client.renderer.blockentity.BlockEntityRendererProvider;
|
import net.minecraft.client.renderer.blockentity.BlockEntityRendererProvider;
|
||||||
import net.minecraft.core.Direction;
|
import net.minecraft.core.Direction;
|
||||||
import net.minecraft.world.item.ItemStack;
|
import net.minecraft.world.item.ItemStack;
|
||||||
|
import net.minecraft.world.level.block.state.properties.BlockStateProperties;
|
||||||
|
import net.minecraft.world.phys.AABB;
|
||||||
|
import net.minecraft.world.phys.Vec3;
|
||||||
|
|
||||||
import javax.annotation.Nonnull;
|
import javax.annotation.Nonnull;
|
||||||
|
|
||||||
|
@ -75,4 +78,12 @@ public class ReconstructorRenderer implements BlockEntityRenderer<TileEntityAtom
|
||||||
public boolean shouldRenderOffScreen(TileEntityAtomicReconstructor tile) {
|
public boolean shouldRenderOffScreen(TileEntityAtomicReconstructor tile) {
|
||||||
return tile.getProgress() > 0.0f;
|
return tile.getProgress() > 0.0f;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public AABB getRenderBoundingBox(TileEntityAtomicReconstructor blockEntity) {
|
||||||
|
if (blockEntity.getProgress() > 0.0f)
|
||||||
|
return new AABB(Vec3.atCenterOf(blockEntity.getBlockPos()), Vec3.atCenterOf(blockEntity.getBlockPos()).add(1,1,1).relative(blockEntity.getBlockState().getValue(BlockStateProperties.FACING), 11));
|
||||||
|
else
|
||||||
|
return BlockEntityRenderer.super.getRenderBoundingBox(blockEntity);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -24,14 +24,16 @@ import net.minecraft.client.renderer.MultiBufferSource;
|
||||||
import net.minecraft.client.renderer.blockentity.BlockEntityRenderer;
|
import net.minecraft.client.renderer.blockentity.BlockEntityRenderer;
|
||||||
import net.minecraft.client.renderer.blockentity.BlockEntityRendererProvider;
|
import net.minecraft.client.renderer.blockentity.BlockEntityRendererProvider;
|
||||||
import net.minecraft.client.resources.language.I18n;
|
import net.minecraft.client.resources.language.I18n;
|
||||||
|
import net.minecraft.core.registries.BuiltInRegistries;
|
||||||
import net.minecraft.world.item.BlockItem;
|
import net.minecraft.world.item.BlockItem;
|
||||||
import net.minecraft.world.item.ItemStack;
|
import net.minecraft.world.item.ItemStack;
|
||||||
import net.minecraftforge.api.distmarker.Dist;
|
import net.neoforged.api.distmarker.Dist;
|
||||||
import net.minecraftforge.api.distmarker.OnlyIn;
|
import net.neoforged.api.distmarker.OnlyIn;
|
||||||
import net.minecraftforge.common.capabilities.ForgeCapabilities;
|
import net.neoforged.neoforge.capabilities.Capabilities;
|
||||||
import net.minecraftforge.registries.ForgeRegistries;
|
|
||||||
import org.joml.Matrix4f;
|
import org.joml.Matrix4f;
|
||||||
|
|
||||||
|
import java.util.Optional;
|
||||||
|
|
||||||
@OnlyIn(Dist.CLIENT)
|
@OnlyIn(Dist.CLIENT)
|
||||||
public class RenderBatteryBox implements BlockEntityRenderer<TileEntityBatteryBox> {
|
public class RenderBatteryBox implements BlockEntityRenderer<TileEntityBatteryBox> {
|
||||||
public RenderBatteryBox(BlockEntityRendererProvider.Context context) {
|
public RenderBatteryBox(BlockEntityRendererProvider.Context context) {
|
||||||
|
@ -52,7 +54,7 @@ public class RenderBatteryBox implements BlockEntityRenderer<TileEntityBatteryBo
|
||||||
matrices.scale(0.0075F, 0.0075F, 0.0075F);
|
matrices.scale(0.0075F, 0.0075F, 0.0075F);
|
||||||
matrices.translate(0F, 0F, -60F);
|
matrices.translate(0F, 0F, -60F);
|
||||||
|
|
||||||
stack.getCapability(ForgeCapabilities.ENERGY).ifPresent(cap -> {
|
Optional.ofNullable(stack.getCapability(Capabilities.EnergyStorage.ITEM)).ifPresent(cap -> {
|
||||||
Font font = Minecraft.getInstance().font;
|
Font font = Minecraft.getInstance().font;
|
||||||
|
|
||||||
String energyTotal = Lang.cleanEnergyValues(cap, false);
|
String energyTotal = Lang.cleanEnergyValues(cap, false);
|
||||||
|
@ -91,7 +93,7 @@ public class RenderBatteryBox implements BlockEntityRenderer<TileEntityBatteryBo
|
||||||
try {
|
try {
|
||||||
AssetUtil.renderItemInWorld(stack, combinedLight, combinedOverlay, matrices, buffer);
|
AssetUtil.renderItemInWorld(stack, combinedLight, combinedOverlay, matrices, buffer);
|
||||||
} catch (Exception e) {
|
} catch (Exception e) {
|
||||||
ActuallyAdditions.LOGGER.error("Something went wrong trying to render an item in a battery box! The item is " + ForgeRegistries.ITEMS.getKey(stack.getItem()) + "!", e);
|
ActuallyAdditions.LOGGER.error("Something went wrong trying to render an item in a battery box! The item is " + BuiltInRegistries.ITEM.getKey(stack.getItem()) + "!", e);
|
||||||
}
|
}
|
||||||
|
|
||||||
matrices.popPose();
|
matrices.popPose();
|
||||||
|
|
|
@ -19,9 +19,9 @@ import net.minecraft.Util;
|
||||||
import net.minecraft.client.renderer.MultiBufferSource;
|
import net.minecraft.client.renderer.MultiBufferSource;
|
||||||
import net.minecraft.client.renderer.blockentity.BlockEntityRenderer;
|
import net.minecraft.client.renderer.blockentity.BlockEntityRenderer;
|
||||||
import net.minecraft.client.renderer.blockentity.BlockEntityRendererProvider;
|
import net.minecraft.client.renderer.blockentity.BlockEntityRendererProvider;
|
||||||
|
import net.minecraft.core.registries.BuiltInRegistries;
|
||||||
import net.minecraft.world.item.BlockItem;
|
import net.minecraft.world.item.BlockItem;
|
||||||
import net.minecraft.world.item.ItemStack;
|
import net.minecraft.world.item.ItemStack;
|
||||||
import net.minecraftforge.registries.ForgeRegistries;
|
|
||||||
|
|
||||||
import javax.annotation.Nonnull;
|
import javax.annotation.Nonnull;
|
||||||
|
|
||||||
|
@ -50,7 +50,7 @@ public class RenderDisplayStand implements BlockEntityRenderer<TileEntityDisplay
|
||||||
try {
|
try {
|
||||||
AssetUtil.renderItemInWorld(stack, combinedLightIn, combinedOverlayIn, matrices, buffer);
|
AssetUtil.renderItemInWorld(stack, combinedLightIn, combinedOverlayIn, matrices, buffer);
|
||||||
} catch (Exception e) {
|
} catch (Exception e) {
|
||||||
ActuallyAdditions.LOGGER.error("Something went wrong trying to render an item in a display stand! The item is " + ForgeRegistries.ITEMS.getKey(stack.getItem()) + "!", e);
|
ActuallyAdditions.LOGGER.error("Something went wrong trying to render an item in a display stand! The item is " + BuiltInRegistries.ITEM.getKey(stack.getItem()) + "!", e);
|
||||||
}
|
}
|
||||||
|
|
||||||
matrices.popPose();
|
matrices.popPose();
|
||||||
|
|
|
@ -23,10 +23,11 @@ import net.minecraft.client.renderer.blockentity.BlockEntityRenderer;
|
||||||
import net.minecraft.client.renderer.blockentity.BlockEntityRendererProvider;
|
import net.minecraft.client.renderer.blockentity.BlockEntityRendererProvider;
|
||||||
import net.minecraft.core.BlockPos;
|
import net.minecraft.core.BlockPos;
|
||||||
import net.minecraft.core.Direction;
|
import net.minecraft.core.Direction;
|
||||||
|
import net.minecraft.core.registries.BuiltInRegistries;
|
||||||
import net.minecraft.world.item.BlockItem;
|
import net.minecraft.world.item.BlockItem;
|
||||||
import net.minecraft.world.item.ItemStack;
|
import net.minecraft.world.item.ItemStack;
|
||||||
|
import net.minecraft.world.item.crafting.RecipeHolder;
|
||||||
import net.minecraft.world.phys.Vec3;
|
import net.minecraft.world.phys.Vec3;
|
||||||
import net.minecraftforge.registries.ForgeRegistries;
|
|
||||||
|
|
||||||
public class RenderEmpowerer implements BlockEntityRenderer<TileEntityEmpowerer> {
|
public class RenderEmpowerer implements BlockEntityRenderer<TileEntityEmpowerer> {
|
||||||
public RenderEmpowerer(BlockEntityRendererProvider.Context context) {
|
public RenderEmpowerer(BlockEntityRendererProvider.Context context) {
|
||||||
|
@ -51,7 +52,7 @@ public class RenderEmpowerer implements BlockEntityRenderer<TileEntityEmpowerer>
|
||||||
try {
|
try {
|
||||||
AssetUtil.renderItemInWorld(stack, combinedLight, combinedOverlay, matrices, buffer);
|
AssetUtil.renderItemInWorld(stack, combinedLight, combinedOverlay, matrices, buffer);
|
||||||
} catch (Exception e) {
|
} catch (Exception e) {
|
||||||
ActuallyAdditions.LOGGER.error("Something went wrong trying to render an item in an empowerer! The item is " + ForgeRegistries.ITEMS.getKey(stack.getItem()) + "!", e);
|
ActuallyAdditions.LOGGER.error("Something went wrong trying to render an item in an empowerer! The item is " + BuiltInRegistries.ITEM.getKey(stack.getItem()) + "!", e);
|
||||||
}
|
}
|
||||||
|
|
||||||
matrices.popPose();
|
matrices.popPose();
|
||||||
|
@ -72,12 +73,12 @@ public class RenderEmpowerer implements BlockEntityRenderer<TileEntityEmpowerer>
|
||||||
|
|
||||||
*/
|
*/
|
||||||
if (tile.getCurrentRecipe() != null) {
|
if (tile.getCurrentRecipe() != null) {
|
||||||
EmpowererRecipe recipe = tile.getCurrentRecipe();
|
RecipeHolder<EmpowererRecipe> holder = tile.getCurrentRecipe();
|
||||||
for (int i = 0; i <= 3; i++) {
|
for (int i = 0; i <= 3; i++) {
|
||||||
Direction facing = Direction.from2DDataValue(i);
|
Direction facing = Direction.from2DDataValue(i);
|
||||||
BlockPos offset = new BlockPos(0,0,0).relative(facing, 3);
|
BlockPos offset = new BlockPos(0,0,0).relative(facing, 3);
|
||||||
|
|
||||||
AssetUtil.renderLaser(matrices, buffer, new Vec3(0.0d, 0.0d, 0.0d), new Vec3(offset.getX(), offset.getY() + 0.45, offset.getZ()), 80, recipe.getParticleColors(), 1.0f ,0.1F);
|
AssetUtil.renderLaser(matrices, buffer, new Vec3(0.0d, 0.0d, 0.0d), new Vec3(offset.getX(), offset.getY() + 0.45, offset.getZ()), 80, holder.value().getParticleColors(), 1.0f ,0.1F);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -108,9 +108,9 @@
|
||||||
// if (!this.recipes.isEmpty()) {
|
// if (!this.recipes.isEmpty()) {
|
||||||
// for (IRecipe recipe : this.recipes) {
|
// for (IRecipe recipe : this.recipes) {
|
||||||
// if (recipe != null) {
|
// if (recipe != null) {
|
||||||
// ItemStack output = recipe.getResultItem();
|
// ItemStack stack = recipe.getResultItem();
|
||||||
// if (StackUtil.isValid(output)) {
|
// if (StackUtil.isValid(stack)) {
|
||||||
// ItemStack copy = output.copy();
|
// ItemStack copy = stack.copy();
|
||||||
// /*
|
// /*
|
||||||
// if (this.isWildcard) {
|
// if (this.isWildcard) {
|
||||||
// copy.setItemDamage(Util.WILDCARD);
|
// copy.setItemDamage(Util.WILDCARD);
|
||||||
|
|
|
@ -27,23 +27,23 @@
|
||||||
//public class PageFurnace extends BookletPage {
|
//public class PageFurnace extends BookletPage {
|
||||||
//
|
//
|
||||||
// private final ItemStack input;
|
// private final ItemStack input;
|
||||||
// private final ItemStack output;
|
// private final ItemStack stack;
|
||||||
//
|
//
|
||||||
// public PageFurnace(int localizationKey, ItemStack output) {
|
// public PageFurnace(int localizationKey, ItemStack stack) {
|
||||||
// this(localizationKey, output, 0);
|
// this(localizationKey, stack, 0);
|
||||||
// }
|
// }
|
||||||
//
|
//
|
||||||
// public PageFurnace(int localizationKey, ItemStack output, int priority) {
|
// public PageFurnace(int localizationKey, ItemStack stack, int priority) {
|
||||||
// super(localizationKey, priority);
|
// super(localizationKey, priority);
|
||||||
// this.output = output;
|
// this.stack = stack;
|
||||||
// this.input = getInputForOutput(output);
|
// this.input = getInputForOutput(stack);
|
||||||
// }
|
// }
|
||||||
//
|
//
|
||||||
// private static ItemStack getInputForOutput(ItemStack output) {
|
// private static ItemStack getInputForOutput(ItemStack stack) {
|
||||||
// for (Map.Entry<ItemStack, ItemStack> entry : FurnaceRecipes.instance().getSmeltingList().entrySet()) {
|
// for (Map.Entry<ItemStack, ItemStack> entry : FurnaceRecipes.instance().getSmeltingList().entrySet()) {
|
||||||
// ItemStack stack = entry.getValue();
|
// ItemStack stack = entry.getValue();
|
||||||
// if (StackUtil.isValid(stack)) {
|
// if (StackUtil.isValid(stack)) {
|
||||||
// if (stack.sameItem(output)) {
|
// if (stack.sameItem(stack)) {
|
||||||
// return entry.getKey();
|
// return entry.getKey();
|
||||||
// }
|
// }
|
||||||
// }
|
// }
|
||||||
|
@ -70,13 +70,13 @@
|
||||||
// super.init(gui, startX, startY);
|
// super.init(gui, startX, startY);
|
||||||
//
|
//
|
||||||
// gui.addOrModifyItemRenderer(this.input, startX + 23 + 1, startY + 10 + 5, 1F, true);
|
// gui.addOrModifyItemRenderer(this.input, startX + 23 + 1, startY + 10 + 5, 1F, true);
|
||||||
// gui.addOrModifyItemRenderer(this.output, startX + 23 + 59, startY + 10 + 5, 1F, false);
|
// gui.addOrModifyItemRenderer(this.stack, startX + 23 + 59, startY + 10 + 5, 1F, false);
|
||||||
// }
|
// }
|
||||||
//
|
//
|
||||||
// @Override
|
// @Override
|
||||||
// public void getItemStacksForPage(List<ItemStack> list) {
|
// public void getItemStacksForPage(List<ItemStack> list) {
|
||||||
// super.getItemStacksForPage(list);
|
// super.getItemStacksForPage(list);
|
||||||
//
|
//
|
||||||
// list.add(this.output);
|
// list.add(this.stack);
|
||||||
// }
|
// }
|
||||||
//}
|
//}
|
||||||
|
|
|
@ -2,14 +2,14 @@ package de.ellpeck.actuallyadditions.mod.config;
|
||||||
|
|
||||||
import net.minecraft.world.item.Item;
|
import net.minecraft.world.item.Item;
|
||||||
import net.minecraft.world.item.Items;
|
import net.minecraft.world.item.Items;
|
||||||
import net.minecraftforge.common.ForgeConfigSpec;
|
import net.neoforged.neoforge.common.ModConfigSpec;
|
||||||
|
|
||||||
import java.util.ArrayList;
|
import java.util.ArrayList;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
|
|
||||||
public class CommonConfig {
|
public class CommonConfig {
|
||||||
private static final ForgeConfigSpec.Builder BUILDER = new ForgeConfigSpec.Builder();
|
private static final ModConfigSpec.Builder BUILDER = new ModConfigSpec.Builder();
|
||||||
public static ForgeConfigSpec COMMON_CONFIG;
|
public static ModConfigSpec COMMON_CONFIG;
|
||||||
|
|
||||||
static {
|
static {
|
||||||
Other.build();
|
Other.build();
|
||||||
|
@ -19,7 +19,7 @@ public class CommonConfig {
|
||||||
}
|
}
|
||||||
|
|
||||||
public static class ItemSettings {
|
public static class ItemSettings {
|
||||||
public static ForgeConfigSpec.ConfigValue<List<String>> DRILL_EXTRA_MINING_WHITELIST;
|
public static ModConfigSpec.ConfigValue<List<String>> DRILL_EXTRA_MINING_WHITELIST;
|
||||||
|
|
||||||
public static void build() {
|
public static void build() {
|
||||||
BUILDER.comment("Item settings").push("itemsSettings");
|
BUILDER.comment("Item settings").push("itemsSettings");
|
||||||
|
@ -35,11 +35,11 @@ public class CommonConfig {
|
||||||
}
|
}
|
||||||
|
|
||||||
public static class Machines {
|
public static class Machines {
|
||||||
public static ForgeConfigSpec.IntValue FARMER_AREA;
|
public static ModConfigSpec.IntValue FARMER_AREA;
|
||||||
public static ForgeConfigSpec.IntValue RECONSTRUCTOR_POWER;
|
public static ModConfigSpec.IntValue RECONSTRUCTOR_POWER;
|
||||||
public static ForgeConfigSpec.IntValue OIL_GENERATOR_TRANSFER;
|
public static ModConfigSpec.IntValue OIL_GENERATOR_TRANSFER;
|
||||||
public static ForgeConfigSpec.IntValue MINER_LENS_ENERGY;
|
public static ModConfigSpec.IntValue MINER_LENS_ENERGY;
|
||||||
public static ForgeConfigSpec.BooleanValue LASER_RELAY_LOSS;
|
public static ModConfigSpec.BooleanValue LASER_RELAY_LOSS;
|
||||||
|
|
||||||
public static void build() {
|
public static void build() {
|
||||||
BUILDER.comment("Machine Settings").push("machineSettings");
|
BUILDER.comment("Machine Settings").push("machineSettings");
|
||||||
|
@ -55,24 +55,24 @@ public class CommonConfig {
|
||||||
}
|
}
|
||||||
|
|
||||||
public static class Other {
|
public static class Other {
|
||||||
public static ForgeConfigSpec.BooleanValue SOLID_XP_ALWAYS_ORBS;
|
public static ModConfigSpec.BooleanValue SOLID_XP_ALWAYS_ORBS;
|
||||||
public static ForgeConfigSpec.BooleanValue DO_UPDATE_CHECK;
|
public static ModConfigSpec.BooleanValue DO_UPDATE_CHECK;
|
||||||
public static ForgeConfigSpec.BooleanValue UPDATE_CHECK_VERSION_SPECIFIC;
|
public static ModConfigSpec.BooleanValue UPDATE_CHECK_VERSION_SPECIFIC;
|
||||||
public static ForgeConfigSpec.BooleanValue DO_CAT_DROPS;
|
public static ModConfigSpec.BooleanValue DO_CAT_DROPS;
|
||||||
public static ForgeConfigSpec.IntValue FUR_CHANCE;
|
public static ModConfigSpec.IntValue FUR_CHANCE;
|
||||||
public static ForgeConfigSpec.BooleanValue WORMS;
|
public static ModConfigSpec.BooleanValue WORMS;
|
||||||
public static ForgeConfigSpec.IntValue WORMS_DIE_TIME;
|
public static ModConfigSpec.IntValue WORMS_DIE_TIME;
|
||||||
public static ForgeConfigSpec.BooleanValue CTRL_EXTRA_INFO;
|
public static ModConfigSpec.BooleanValue CTRL_EXTRA_INFO;
|
||||||
public static ForgeConfigSpec.BooleanValue CTRL_INFO_FOR_EXTRA_INFO;
|
public static ModConfigSpec.BooleanValue CTRL_INFO_FOR_EXTRA_INFO;
|
||||||
public static ForgeConfigSpec.BooleanValue GIVE_BOOKLET_ON_FIRST_CRAFT;
|
public static ModConfigSpec.BooleanValue GIVE_BOOKLET_ON_FIRST_CRAFT;
|
||||||
public static ForgeConfigSpec.BooleanValue DUNGEON_LOOT;
|
public static ModConfigSpec.BooleanValue DUNGEON_LOOT;
|
||||||
public static ForgeConfigSpec.BooleanValue WATER_BOWL;
|
public static ModConfigSpec.BooleanValue WATER_BOWL;
|
||||||
public static ForgeConfigSpec.BooleanValue WATER_BOWL_LOSS;
|
public static ModConfigSpec.BooleanValue WATER_BOWL_LOSS;
|
||||||
public static ForgeConfigSpec.BooleanValue TINY_COAL_STUFF;
|
public static ModConfigSpec.BooleanValue TINY_COAL_STUFF;
|
||||||
public static ForgeConfigSpec.BooleanValue SUPER_DUPER_HARD_MODE;
|
public static ModConfigSpec.BooleanValue SUPER_DUPER_HARD_MODE;
|
||||||
public static ForgeConfigSpec.BooleanValue MOST_BLAND_PERSON_EVER;
|
public static ModConfigSpec.BooleanValue MOST_BLAND_PERSON_EVER;
|
||||||
public static ForgeConfigSpec.ConfigValue<String> REDSTONECONFIGURATOR;
|
public static ModConfigSpec.ConfigValue<String> REDSTONECONFIGURATOR;
|
||||||
public static ForgeConfigSpec.ConfigValue<String> RELAYCONFIGURATOR;
|
public static ModConfigSpec.ConfigValue<String> RELAYCONFIGURATOR;
|
||||||
public static Item redstoneConfigureItem = Items.AIR;
|
public static Item redstoneConfigureItem = Items.AIR;
|
||||||
public static Item relayConfigureItem = Items.AIR;
|
public static Item relayConfigureItem = Items.AIR;
|
||||||
|
|
||||||
|
|
|
@ -1,24 +1,19 @@
|
||||||
package de.ellpeck.actuallyadditions.mod.config.conditions;
|
package de.ellpeck.actuallyadditions.mod.config.conditions;
|
||||||
|
|
||||||
import com.google.gson.JsonObject;
|
import com.mojang.serialization.Codec;
|
||||||
|
import com.mojang.serialization.codecs.RecordCodecBuilder;
|
||||||
import de.ellpeck.actuallyadditions.mod.ActuallyAdditions;
|
import de.ellpeck.actuallyadditions.mod.ActuallyAdditions;
|
||||||
import de.ellpeck.actuallyadditions.mod.config.CommonConfig;
|
import de.ellpeck.actuallyadditions.mod.config.CommonConfig;
|
||||||
import net.minecraft.resources.ResourceLocation;
|
import net.minecraft.resources.ResourceLocation;
|
||||||
import net.minecraftforge.common.crafting.conditions.ICondition;
|
import net.neoforged.neoforge.common.conditions.ICondition;
|
||||||
import net.minecraftforge.common.crafting.conditions.IConditionSerializer;
|
|
||||||
|
|
||||||
public class BoolConfigCondition implements ICondition {
|
public record BoolConfigCondition(String boolConfig) implements ICondition {
|
||||||
|
public static Codec<BoolConfigCondition> CODEC = RecordCodecBuilder.create(
|
||||||
|
builder -> builder
|
||||||
|
.group(
|
||||||
|
Codec.STRING.fieldOf("boolConfig").forGetter(BoolConfigCondition::boolConfig))
|
||||||
|
.apply(builder, BoolConfigCondition::new));
|
||||||
private static final ResourceLocation NAME = new ResourceLocation(ActuallyAdditions.MODID, "bool_config_condition");
|
private static final ResourceLocation NAME = new ResourceLocation(ActuallyAdditions.MODID, "bool_config_condition");
|
||||||
private final String boolConfig;
|
|
||||||
|
|
||||||
public BoolConfigCondition(String config) {
|
|
||||||
this.boolConfig = config;
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public ResourceLocation getID() {
|
|
||||||
return NAME;
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public boolean test(IContext condition) {
|
public boolean test(IContext condition) {
|
||||||
|
@ -30,22 +25,13 @@ public class BoolConfigCondition implements ICondition {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public static class Serializer implements IConditionSerializer<BoolConfigCondition> {
|
@Override
|
||||||
public static final BoolConfigCondition.Serializer INSTANCE = new BoolConfigCondition.Serializer();
|
public Codec<? extends ICondition> codec() {
|
||||||
|
return CODEC;
|
||||||
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void write(JsonObject json, BoolConfigCondition value) {
|
public String toString() {
|
||||||
json.addProperty("config_name", value.boolConfig);
|
return "ConfigEnabled(\"" + boolConfig + "\")";
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public BoolConfigCondition read(JsonObject json) {
|
|
||||||
return new BoolConfigCondition(json.get("config_name").getAsString());
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public ResourceLocation getID() {
|
|
||||||
return BoolConfigCondition.NAME;
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -1,45 +1,46 @@
|
||||||
package de.ellpeck.actuallyadditions.mod.crafting;
|
package de.ellpeck.actuallyadditions.mod.crafting;
|
||||||
|
|
||||||
import de.ellpeck.actuallyadditions.mod.ActuallyAdditions;
|
import de.ellpeck.actuallyadditions.mod.ActuallyAdditions;
|
||||||
|
import net.minecraft.core.registries.BuiltInRegistries;
|
||||||
import net.minecraft.world.item.crafting.RecipeSerializer;
|
import net.minecraft.world.item.crafting.RecipeSerializer;
|
||||||
import net.minecraft.world.item.crafting.RecipeType;
|
import net.minecraft.world.item.crafting.RecipeType;
|
||||||
import net.minecraftforge.eventbus.api.IEventBus;
|
import net.neoforged.bus.api.IEventBus;
|
||||||
import net.minecraftforge.registries.DeferredRegister;
|
import net.neoforged.neoforge.registries.DeferredRegister;
|
||||||
import net.minecraftforge.registries.ForgeRegistries;
|
|
||||||
import net.minecraftforge.registries.RegistryObject;
|
import java.util.function.Supplier;
|
||||||
|
|
||||||
public class ActuallyRecipes {
|
public class ActuallyRecipes {
|
||||||
public static final DeferredRegister<RecipeSerializer<?>> SERIALIZERS = DeferredRegister.create(ForgeRegistries.RECIPE_SERIALIZERS, ActuallyAdditions.MODID);
|
public static final DeferredRegister<RecipeSerializer<?>> SERIALIZERS = DeferredRegister.create(BuiltInRegistries.RECIPE_SERIALIZER, ActuallyAdditions.MODID);
|
||||||
|
|
||||||
public static void init(IEventBus bus) {
|
public static void init(IEventBus bus) {
|
||||||
SERIALIZERS.register(bus);
|
SERIALIZERS.register(bus);
|
||||||
Types.RECIPE_TYPES.register(bus);
|
Types.RECIPE_TYPES.register(bus);
|
||||||
}
|
}
|
||||||
|
|
||||||
public static final RegistryObject<RecipeSerializer<?>> KEEP_DATA_SHAPED_RECIPE = SERIALIZERS.register(RecipeKeepDataShaped.NAME, RecipeKeepDataShaped.Serializer::new);
|
public static final Supplier<RecipeSerializer<?>> KEEP_DATA_SHAPED_RECIPE = SERIALIZERS.register(RecipeKeepDataShaped.NAME, RecipeKeepDataShaped.Serializer::new);
|
||||||
public static final RegistryObject<RecipeSerializer<?>> LASER_RECIPE = SERIALIZERS.register(LaserRecipe.NAME, LaserRecipe.Serializer::new);
|
public static final Supplier<RecipeSerializer<?>> LASER_RECIPE = SERIALIZERS.register(LaserRecipe.NAME, LaserRecipe.Serializer::new);
|
||||||
public static final RegistryObject<RecipeSerializer<?>> EMPOWERING_RECIPE = SERIALIZERS.register(EmpowererRecipe.NAME, EmpowererRecipe.Serializer::new);
|
public static final Supplier<RecipeSerializer<?>> EMPOWERING_RECIPE = SERIALIZERS.register(EmpowererRecipe.NAME, EmpowererRecipe.Serializer::new);
|
||||||
public static final RegistryObject<RecipeSerializer<?>> CRUSHING_RECIPE = SERIALIZERS.register(CrushingRecipe.NAME, CrushingRecipe.Serializer::new);
|
public static final Supplier<RecipeSerializer<?>> CRUSHING_RECIPE = SERIALIZERS.register(CrushingRecipe.NAME, CrushingRecipe.Serializer::new);
|
||||||
public static final RegistryObject<RecipeSerializer<?>> SOLID_FUEL_RECIPE = SERIALIZERS.register(SolidFuelRecipe.NAME, SolidFuelRecipe.Serializer::new);
|
public static final Supplier<RecipeSerializer<?>> SOLID_FUEL_RECIPE = SERIALIZERS.register(SolidFuelRecipe.NAME, SolidFuelRecipe.Serializer::new);
|
||||||
public static final RegistryObject<RecipeSerializer<?>> LIQUID_FUEL_RECIPE = SERIALIZERS.register(LiquidFuelRecipe.NAME, LiquidFuelRecipe.Serializer::new);
|
public static final Supplier<RecipeSerializer<?>> LIQUID_FUEL_RECIPE = SERIALIZERS.register(LiquidFuelRecipe.NAME, LiquidFuelRecipe.Serializer::new);
|
||||||
public static final RegistryObject<RecipeSerializer<?>> PRESSING_RECIPE = SERIALIZERS.register(PressingRecipe.NAME, PressingRecipe.Serializer::new);
|
public static final Supplier<RecipeSerializer<?>> PRESSING_RECIPE = SERIALIZERS.register(PressingRecipe.NAME, PressingRecipe.Serializer::new);
|
||||||
public static final RegistryObject<RecipeSerializer<?>> FERMENTING_RECIPE = SERIALIZERS.register(FermentingRecipe.NAME, FermentingRecipe.Serializer::new);
|
public static final Supplier<RecipeSerializer<?>> FERMENTING_RECIPE = SERIALIZERS.register(FermentingRecipe.NAME, FermentingRecipe.Serializer::new);
|
||||||
public static final RegistryObject<RecipeSerializer<?>> COLOR_CHANGE_RECIPE = SERIALIZERS.register(ColorChangeRecipe.NAME, ColorChangeRecipe.Serializer::new);
|
public static final Supplier<RecipeSerializer<?>> COLOR_CHANGE_RECIPE = SERIALIZERS.register(ColorChangeRecipe.NAME, ColorChangeRecipe.Serializer::new);
|
||||||
public static final RegistryObject<RecipeSerializer<?>> MINING_LENS_RECIPE = SERIALIZERS.register(MiningLensRecipe.NAME, MiningLensRecipe.Serializer::new);
|
public static final Supplier<RecipeSerializer<?>> MINING_LENS_RECIPE = SERIALIZERS.register(MiningLensRecipe.NAME, MiningLensRecipe.Serializer::new);
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
public static class Types {
|
public static class Types {
|
||||||
public static final DeferredRegister<RecipeType<?>> RECIPE_TYPES = DeferredRegister.create(ForgeRegistries.RECIPE_TYPES, ActuallyAdditions.MODID);
|
public static final DeferredRegister<RecipeType<?>> RECIPE_TYPES = DeferredRegister.create(BuiltInRegistries.RECIPE_TYPE, ActuallyAdditions.MODID);
|
||||||
|
|
||||||
public static final RegistryObject<RecipeType<LaserRecipe>> LASER = RECIPE_TYPES.register("laser", () -> new RecipeType<>() {});
|
public static final Supplier<RecipeType<LaserRecipe>> LASER = RECIPE_TYPES.register("laser", () -> new RecipeType<>() {});
|
||||||
public static final RegistryObject<RecipeType<EmpowererRecipe>> EMPOWERING = RECIPE_TYPES.register("empower", () -> new RecipeType<>() {});
|
public static final Supplier<RecipeType<EmpowererRecipe>> EMPOWERING = RECIPE_TYPES.register("empower", () -> new RecipeType<>() {});
|
||||||
public static final RegistryObject<RecipeType<CrushingRecipe>> CRUSHING = RECIPE_TYPES.register("crushing", () -> new RecipeType<>() {});
|
public static final Supplier<RecipeType<CrushingRecipe>> CRUSHING = RECIPE_TYPES.register("crushing", () -> new RecipeType<>() {});
|
||||||
public static final RegistryObject<RecipeType<SolidFuelRecipe>> SOLID_FUEL = RECIPE_TYPES.register("solid_fuel", () -> new RecipeType<>() {});
|
public static final Supplier<RecipeType<SolidFuelRecipe>> SOLID_FUEL = RECIPE_TYPES.register("solid_fuel", () -> new RecipeType<>() {});
|
||||||
public static final RegistryObject<RecipeType<LiquidFuelRecipe>> LIQUID_FUEL = RECIPE_TYPES.register("liquid_fuel", () -> new RecipeType<>() {});
|
public static final Supplier<RecipeType<LiquidFuelRecipe>> LIQUID_FUEL = RECIPE_TYPES.register("liquid_fuel", () -> new RecipeType<>() {});
|
||||||
public static final RegistryObject<RecipeType<PressingRecipe>> PRESSING = RECIPE_TYPES.register("pressing", () -> new RecipeType<>() {});
|
public static final Supplier<RecipeType<PressingRecipe>> PRESSING = RECIPE_TYPES.register("pressing", () -> new RecipeType<>() {});
|
||||||
public static final RegistryObject<RecipeType<FermentingRecipe>> FERMENTING = RECIPE_TYPES.register("fermenting", () -> new RecipeType<>() {});
|
public static final Supplier<RecipeType<FermentingRecipe>> FERMENTING = RECIPE_TYPES.register("fermenting", () -> new RecipeType<>() {});
|
||||||
public static final RegistryObject<RecipeType<ColorChangeRecipe>> COLOR_CHANGE = RECIPE_TYPES.register("color_change", () -> new RecipeType<>() {});
|
public static final Supplier<RecipeType<ColorChangeRecipe>> COLOR_CHANGE = RECIPE_TYPES.register("color_change", () -> new RecipeType<>() {});
|
||||||
public static final RegistryObject<RecipeType<MiningLensRecipe>> MINING_LENS = RECIPE_TYPES.register("mining_lens", () -> new RecipeType<>() {});
|
public static final Supplier<RecipeType<MiningLensRecipe>> MINING_LENS = RECIPE_TYPES.register("mining_lens", () -> new RecipeType<>() {});
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -1,21 +1,18 @@
|
||||||
package de.ellpeck.actuallyadditions.mod.crafting;
|
package de.ellpeck.actuallyadditions.mod.crafting;
|
||||||
|
|
||||||
import com.google.gson.JsonObject;
|
import com.mojang.serialization.Codec;
|
||||||
|
import com.mojang.serialization.codecs.RecordCodecBuilder;
|
||||||
import de.ellpeck.actuallyadditions.api.ActuallyAdditionsAPI;
|
import de.ellpeck.actuallyadditions.api.ActuallyAdditionsAPI;
|
||||||
import net.minecraft.core.RegistryAccess;
|
import net.minecraft.core.RegistryAccess;
|
||||||
import net.minecraft.data.recipes.FinishedRecipe;
|
|
||||||
import net.minecraft.network.FriendlyByteBuf;
|
import net.minecraft.network.FriendlyByteBuf;
|
||||||
import net.minecraft.resources.ResourceLocation;
|
|
||||||
import net.minecraft.util.GsonHelper;
|
|
||||||
import net.minecraft.world.Container;
|
import net.minecraft.world.Container;
|
||||||
import net.minecraft.world.item.ItemStack;
|
import net.minecraft.world.item.ItemStack;
|
||||||
import net.minecraft.world.item.crafting.Ingredient;
|
import net.minecraft.world.item.crafting.Ingredient;
|
||||||
import net.minecraft.world.item.crafting.Recipe;
|
import net.minecraft.world.item.crafting.Recipe;
|
||||||
|
import net.minecraft.world.item.crafting.RecipeHolder;
|
||||||
import net.minecraft.world.item.crafting.RecipeSerializer;
|
import net.minecraft.world.item.crafting.RecipeSerializer;
|
||||||
import net.minecraft.world.item.crafting.RecipeType;
|
import net.minecraft.world.item.crafting.RecipeType;
|
||||||
import net.minecraft.world.level.ItemLike;
|
|
||||||
import net.minecraft.world.level.Level;
|
import net.minecraft.world.level.Level;
|
||||||
import net.minecraftforge.registries.ForgeRegistries;
|
|
||||||
|
|
||||||
import javax.annotation.Nonnull;
|
import javax.annotation.Nonnull;
|
||||||
import javax.annotation.Nullable;
|
import javax.annotation.Nullable;
|
||||||
|
@ -26,12 +23,10 @@ public class ColorChangeRecipe implements Recipe<Container> {
|
||||||
|
|
||||||
private final Ingredient input;
|
private final Ingredient input;
|
||||||
private final ItemStack output;
|
private final ItemStack output;
|
||||||
private final ResourceLocation id;
|
|
||||||
|
|
||||||
public ColorChangeRecipe(ResourceLocation id, ItemStack output, Ingredient input) {
|
public ColorChangeRecipe(ItemStack output, Ingredient input) {
|
||||||
this.input = input;
|
this.input = input;
|
||||||
this.output = output;
|
this.output = output;
|
||||||
this.id = id;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
@ -59,8 +54,8 @@ public class ColorChangeRecipe implements Recipe<Container> {
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
public static Optional<ColorChangeRecipe> getRecipeForStack(ItemStack stack) {
|
public static Optional<RecipeHolder<ColorChangeRecipe>> getRecipeForStack(ItemStack stack) {
|
||||||
return ActuallyAdditionsAPI.COLOR_CHANGE_RECIPES.stream().filter(recipe -> recipe.matches(stack)).findFirst();
|
return ActuallyAdditionsAPI.COLOR_CHANGE_RECIPES.stream().filter(recipe -> recipe.value().matches(stack)).findFirst();
|
||||||
}
|
}
|
||||||
|
|
||||||
@Nonnull
|
@Nonnull
|
||||||
|
@ -69,12 +64,6 @@ public class ColorChangeRecipe implements Recipe<Container> {
|
||||||
return output.copy();
|
return output.copy();
|
||||||
}
|
}
|
||||||
|
|
||||||
@Nonnull
|
|
||||||
@Override
|
|
||||||
public ResourceLocation getId() {
|
|
||||||
return id;
|
|
||||||
}
|
|
||||||
|
|
||||||
@Nonnull
|
@Nonnull
|
||||||
@Override
|
@Override
|
||||||
public RecipeSerializer<?> getSerializer() {
|
public RecipeSerializer<?> getSerializer() {
|
||||||
|
@ -87,21 +76,34 @@ public class ColorChangeRecipe implements Recipe<Container> {
|
||||||
}
|
}
|
||||||
|
|
||||||
public static class Serializer implements RecipeSerializer<ColorChangeRecipe> {
|
public static class Serializer implements RecipeSerializer<ColorChangeRecipe> {
|
||||||
@Override
|
private static final Codec<ColorChangeRecipe> CODEC = RecordCodecBuilder.create(
|
||||||
public ColorChangeRecipe fromJson(@Nonnull ResourceLocation pRecipeId, @Nonnull JsonObject pJson) {
|
instance -> instance.group(
|
||||||
Ingredient ingredient = Ingredient.fromJson(GsonHelper.getAsJsonObject(pJson, "ingredient"));
|
ItemStack.RESULT_CODEC.fieldOf("result").forGetter(recipe -> recipe.output),
|
||||||
JsonObject resultObject = GsonHelper.getAsJsonObject(pJson, "result");
|
Ingredient.CODEC_NONEMPTY.fieldOf("ingredient").forGetter(recipe -> recipe.input)
|
||||||
ItemStack result = new ItemStack(GsonHelper.getAsItem(resultObject, "item"));
|
)
|
||||||
|
.apply(instance, ColorChangeRecipe::new)
|
||||||
|
);
|
||||||
|
|
||||||
return new ColorChangeRecipe(pRecipeId, result, ingredient);
|
// @Override
|
||||||
|
// public ColorChangeRecipe fromJson(@Nonnull ResourceLocation pRecipeId, @Nonnull JsonObject pJson) {
|
||||||
|
// Ingredient ingredient = Ingredient.fromJson(GsonHelper.getAsJsonObject(pJson, "ingredient"));
|
||||||
|
// JsonObject resultObject = GsonHelper.getAsJsonObject(pJson, "result");
|
||||||
|
// ItemStack result = new ItemStack(GsonHelper.getAsItem(resultObject, "item"));
|
||||||
|
//
|
||||||
|
// return new ColorChangeRecipe(pRecipeId, result, ingredient);
|
||||||
|
// }
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public Codec<ColorChangeRecipe> codec() {
|
||||||
|
return CODEC;
|
||||||
}
|
}
|
||||||
|
|
||||||
@Nullable
|
@Nullable
|
||||||
@Override
|
@Override
|
||||||
public ColorChangeRecipe fromNetwork(@Nonnull ResourceLocation pRecipeId, @Nonnull FriendlyByteBuf pBuffer) {
|
public ColorChangeRecipe fromNetwork(@Nonnull FriendlyByteBuf pBuffer) {
|
||||||
Ingredient ingredient = Ingredient.fromNetwork(pBuffer);
|
Ingredient ingredient = Ingredient.fromNetwork(pBuffer);
|
||||||
ItemStack result = pBuffer.readItem();
|
ItemStack result = pBuffer.readItem();
|
||||||
return new ColorChangeRecipe(pRecipeId, result, ingredient);
|
return new ColorChangeRecipe(result, ingredient);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
@ -110,48 +112,4 @@ public class ColorChangeRecipe implements Recipe<Container> {
|
||||||
pBuffer.writeItem(pRecipe.output);
|
pBuffer.writeItem(pRecipe.output);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public static class Result implements FinishedRecipe {
|
|
||||||
private final ResourceLocation id;
|
|
||||||
private final Ingredient itemIngredient;
|
|
||||||
private final ItemLike output;
|
|
||||||
|
|
||||||
public Result(ResourceLocation id, Ingredient itemIngredient, ItemLike output) {
|
|
||||||
this.id = id;
|
|
||||||
this.itemIngredient = itemIngredient;
|
|
||||||
this.output = output;
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public void serializeRecipeData(JsonObject pJson) {
|
|
||||||
pJson.add("ingredient", itemIngredient.toJson());
|
|
||||||
|
|
||||||
JsonObject resultObject = new JsonObject();
|
|
||||||
resultObject.addProperty("item", ForgeRegistries.ITEMS.getKey(output.asItem()).toString());
|
|
||||||
|
|
||||||
pJson.add("result", resultObject);
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public ResourceLocation getId() {
|
|
||||||
return id;
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public RecipeSerializer<?> getType() {
|
|
||||||
return ActuallyRecipes.COLOR_CHANGE_RECIPE.get();
|
|
||||||
}
|
|
||||||
|
|
||||||
@Nullable
|
|
||||||
@Override
|
|
||||||
public JsonObject serializeAdvancement() {
|
|
||||||
return null;
|
|
||||||
}
|
|
||||||
|
|
||||||
@Nullable
|
|
||||||
@Override
|
|
||||||
public ResourceLocation getAdvancementId() {
|
|
||||||
return null;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -1,51 +1,41 @@
|
||||||
package de.ellpeck.actuallyadditions.mod.crafting;
|
package de.ellpeck.actuallyadditions.mod.crafting;
|
||||||
|
|
||||||
import com.google.gson.JsonArray;
|
import com.mojang.serialization.Codec;
|
||||||
import com.google.gson.JsonObject;
|
import com.mojang.serialization.DataResult;
|
||||||
import de.ellpeck.actuallyadditions.mod.ActuallyAdditions;
|
import com.mojang.serialization.codecs.RecordCodecBuilder;
|
||||||
|
import net.minecraft.core.NonNullList;
|
||||||
import net.minecraft.core.RegistryAccess;
|
import net.minecraft.core.RegistryAccess;
|
||||||
import net.minecraft.data.recipes.FinishedRecipe;
|
|
||||||
import net.minecraft.network.FriendlyByteBuf;
|
import net.minecraft.network.FriendlyByteBuf;
|
||||||
import net.minecraft.resources.ResourceLocation;
|
|
||||||
import net.minecraft.util.GsonHelper;
|
|
||||||
import net.minecraft.world.Container;
|
import net.minecraft.world.Container;
|
||||||
import net.minecraft.world.item.ItemStack;
|
import net.minecraft.world.item.ItemStack;
|
||||||
import net.minecraft.world.item.crafting.Ingredient;
|
import net.minecraft.world.item.crafting.Ingredient;
|
||||||
import net.minecraft.world.item.crafting.Recipe;
|
import net.minecraft.world.item.crafting.Recipe;
|
||||||
import net.minecraft.world.item.crafting.RecipeSerializer;
|
import net.minecraft.world.item.crafting.RecipeSerializer;
|
||||||
import net.minecraft.world.item.crafting.RecipeType;
|
import net.minecraft.world.item.crafting.RecipeType;
|
||||||
import net.minecraft.world.level.ItemLike;
|
|
||||||
import net.minecraft.world.level.Level;
|
import net.minecraft.world.level.Level;
|
||||||
import net.minecraftforge.registries.ForgeRegistries;
|
|
||||||
|
|
||||||
import javax.annotation.Nonnull;
|
import javax.annotation.Nonnull;
|
||||||
import javax.annotation.Nullable;
|
|
||||||
|
|
||||||
public class CrushingRecipe implements Recipe<Container> {
|
public class CrushingRecipe implements Recipe<Container> {
|
||||||
public static String NAME = "crushing";
|
public static String NAME = "crushing";
|
||||||
private final ResourceLocation id;
|
|
||||||
protected Ingredient input;
|
protected Ingredient input;
|
||||||
protected ItemStack outputOne;
|
protected NonNullList<CrushingResult> outputs;
|
||||||
protected ItemStack outputTwo;
|
|
||||||
protected float chance1;
|
|
||||||
protected float chance2;
|
|
||||||
|
|
||||||
public CrushingRecipe(ResourceLocation id, Ingredient input, ItemStack outputOne, float chance1, ItemStack outputTwo, float chance2) {
|
public CrushingRecipe(Ingredient input, NonNullList<CrushingResult> outputList) {
|
||||||
this.id = id;
|
|
||||||
this.input = input;
|
this.input = input;
|
||||||
this.outputOne = outputOne;
|
this.outputs = outputList;
|
||||||
this.outputTwo = outputTwo;
|
|
||||||
this.chance1 = chance1;
|
|
||||||
this.chance2 = chance2;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public CrushingRecipe(Ingredient input, ItemStack outputOne, float chance1, ItemStack outputTwo, float chance2) {
|
public CrushingRecipe(Ingredient input, ItemStack outputOne, float chance1, ItemStack outputTwo, float chance2) {
|
||||||
this.id = new ResourceLocation(ActuallyAdditions.MODID, ForgeRegistries.ITEMS.getKey(input.getItems()[0].getItem()).getPath() + "_crushing");
|
this(input, createList(new CrushingResult(outputOne, chance1), new CrushingResult(outputTwo, chance2)));
|
||||||
this.input = input;
|
}
|
||||||
this.outputOne = outputOne;
|
|
||||||
this.outputTwo = outputTwo;
|
private static NonNullList<CrushingResult> createList(CrushingResult... results) {
|
||||||
this.chance1 = chance1;
|
NonNullList<CrushingResult> list = NonNullList.create();
|
||||||
this.chance2 = chance2;
|
for (CrushingResult result : results) {
|
||||||
|
list.add(result);
|
||||||
|
}
|
||||||
|
return list;
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
@ -76,13 +66,7 @@ public class CrushingRecipe implements Recipe<Container> {
|
||||||
@Override
|
@Override
|
||||||
@Nonnull
|
@Nonnull
|
||||||
public ItemStack getResultItem(RegistryAccess pRegistryAccess) {
|
public ItemStack getResultItem(RegistryAccess pRegistryAccess) {
|
||||||
return outputOne;
|
return this.outputs.get(0).stack.copy();
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
@Nonnull
|
|
||||||
public ResourceLocation getId() {
|
|
||||||
return id;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
@ -98,137 +82,119 @@ public class CrushingRecipe implements Recipe<Container> {
|
||||||
}
|
}
|
||||||
|
|
||||||
public ItemStack getOutputOne() {
|
public ItemStack getOutputOne() {
|
||||||
return this.outputOne;
|
return this.outputs.get(0).stack;
|
||||||
}
|
}
|
||||||
|
|
||||||
public ItemStack getOutputTwo() {
|
public ItemStack getOutputTwo() {
|
||||||
return this.outputTwo;
|
return this.outputs.get(1).stack;
|
||||||
}
|
}
|
||||||
|
|
||||||
public float getFirstChance() {
|
public float getFirstChance() {
|
||||||
return this.chance1;
|
return this.outputs.get(0).chance;
|
||||||
}
|
}
|
||||||
public float getSecondChance() {
|
public float getSecondChance() {
|
||||||
return this.chance2;
|
return this.outputs.get(1).chance;
|
||||||
}
|
}
|
||||||
|
|
||||||
public Ingredient getInput() {
|
public Ingredient getInput() {
|
||||||
return this.input;
|
return this.input;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
public record CrushingResult(ItemStack stack, float chance) {
|
||||||
|
public static final CrushingResult EMPTY = new CrushingResult(ItemStack.EMPTY, 0.0F);
|
||||||
|
};
|
||||||
|
|
||||||
public static class Serializer implements RecipeSerializer<CrushingRecipe> {
|
public static class Serializer implements RecipeSerializer<CrushingRecipe> {
|
||||||
|
private static final Codec<CrushingResult> RESULT_CODEC = RecordCodecBuilder.create(
|
||||||
|
instance -> instance.group(
|
||||||
|
ItemStack.ITEM_WITH_COUNT_CODEC.fieldOf("result").forGetter(result -> result.stack),
|
||||||
|
Codec.FLOAT.optionalFieldOf("chance", 1.0F).forGetter(recipe -> recipe.chance)
|
||||||
|
)
|
||||||
|
.apply(instance, CrushingResult::new)
|
||||||
|
);
|
||||||
|
|
||||||
|
private static final Codec<CrushingRecipe> CODEC = RecordCodecBuilder.create(
|
||||||
|
instance -> instance.group(
|
||||||
|
Ingredient.CODEC_NONEMPTY.fieldOf("ingredient").forGetter(recipe -> recipe.input),
|
||||||
|
RESULT_CODEC
|
||||||
|
.listOf()
|
||||||
|
.fieldOf("result")
|
||||||
|
.flatXmap(
|
||||||
|
array -> {
|
||||||
|
CrushingResult[] resultArray = array.toArray(CrushingResult[]::new);
|
||||||
|
NonNullList<CrushingResult> results = NonNullList.withSize(2, CrushingResult.EMPTY);
|
||||||
|
if (resultArray.length < 1) {
|
||||||
|
return DataResult.error(() -> "Recipe must contain at least 1 result");
|
||||||
|
} else if (resultArray.length > 2) {
|
||||||
|
return DataResult.error(() -> "Too many results for crushing recipe. The maximum is: 2");
|
||||||
|
} else {
|
||||||
|
for (int i = 0; i < resultArray.length; i++) {
|
||||||
|
results.set(i, resultArray[i]);
|
||||||
|
}
|
||||||
|
return DataResult.success(results);
|
||||||
|
}
|
||||||
|
},
|
||||||
|
DataResult::success
|
||||||
|
)
|
||||||
|
.forGetter(recipe -> recipe.outputs)
|
||||||
|
)
|
||||||
|
.apply(instance, CrushingRecipe::new)
|
||||||
|
);
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
@Nonnull
|
public Codec<CrushingRecipe> codec() {
|
||||||
public CrushingRecipe fromJson(@Nonnull ResourceLocation pRecipeId, @Nonnull JsonObject pJson) {
|
return CODEC;
|
||||||
Ingredient ingredient = Ingredient.fromJson(GsonHelper.getAsJsonObject(pJson, "ingredient"));
|
|
||||||
|
|
||||||
JsonArray resultList = GsonHelper.getAsJsonArray(pJson, "result");
|
|
||||||
if (resultList.size() < 1)
|
|
||||||
throw new IllegalStateException(pRecipeId.toString() + ": Recipe must contain at least 1 result item");
|
|
||||||
|
|
||||||
JsonObject result1 = resultList.get(0).getAsJsonObject();
|
|
||||||
int count1 = GsonHelper.getAsInt(result1, "count", 0);
|
|
||||||
ItemStack output1 = new ItemStack(GsonHelper.getAsItem(result1, "item"), count1);
|
|
||||||
float chance1 = GsonHelper.getAsFloat(result1, "chance");
|
|
||||||
|
|
||||||
ItemStack output2 = ItemStack.EMPTY;
|
|
||||||
float chance2 = 1.0f;
|
|
||||||
if (resultList.size() > 1) {
|
|
||||||
JsonObject result2 = resultList.get(1).getAsJsonObject();
|
|
||||||
int count2 = GsonHelper.getAsInt(result2, "count", 0);
|
|
||||||
output2 = new ItemStack(GsonHelper.getAsItem(result2, "item"), count2);
|
|
||||||
chance2 = GsonHelper.getAsFloat(result2, "chance");
|
|
||||||
}
|
|
||||||
|
|
||||||
return new CrushingRecipe(pRecipeId, ingredient, output1, chance1, output2, chance2);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
// @Override
|
||||||
public CrushingRecipe fromNetwork(@Nonnull ResourceLocation pRecipeId, @Nonnull FriendlyByteBuf pBuffer) {
|
// @Nonnull
|
||||||
Ingredient ingredient = Ingredient.fromNetwork(pBuffer);
|
// public CrushingRecipe fromJson(@Nonnull ResourceLocation pRecipeId, @Nonnull JsonObject pJson) {
|
||||||
ItemStack output1 = pBuffer.readItem();
|
// Ingredient ingredient = Ingredient.fromJson(GsonHelper.getAsJsonObject(pJson, "ingredient"));
|
||||||
ItemStack output2 = pBuffer.readItem();
|
//
|
||||||
float chance1 = pBuffer.readFloat();
|
// JsonArray resultList = GsonHelper.getAsJsonArray(pJson, "result");
|
||||||
float chance2 = pBuffer.readFloat();
|
// if (resultList.size() < 1)
|
||||||
|
// throw new IllegalStateException(pRecipeId.toString() + ": Recipe must contain at least 1 result item");
|
||||||
|
//
|
||||||
|
// JsonObject result1 = resultList.get(0).getAsJsonObject();
|
||||||
|
// int count1 = GsonHelper.getAsInt(result1, "count", 0);
|
||||||
|
// ItemStack output1 = new ItemStack(GsonHelper.getAsItem(result1, "item"), count1);
|
||||||
|
// float chance1 = GsonHelper.getAsFloat(result1, "chance");
|
||||||
|
//
|
||||||
|
// ItemStack output2 = ItemStack.EMPTY;
|
||||||
|
// float chance2 = 1.0f;
|
||||||
|
// if (resultList.size() > 1) {
|
||||||
|
// JsonObject result2 = resultList.get(1).getAsJsonObject();
|
||||||
|
// int count2 = GsonHelper.getAsInt(result2, "count", 0);
|
||||||
|
// output2 = new ItemStack(GsonHelper.getAsItem(result2, "item"), count2);
|
||||||
|
// chance2 = GsonHelper.getAsFloat(result2, "chance");
|
||||||
|
// }
|
||||||
|
//
|
||||||
|
// return new CrushingRecipe(pRecipeId, ingredient, output1, chance1, output2, chance2);
|
||||||
|
// }
|
||||||
|
|
||||||
return new CrushingRecipe(pRecipeId, ingredient, output1, chance1, output2, chance2);
|
@Override
|
||||||
|
public CrushingRecipe fromNetwork(@Nonnull FriendlyByteBuf pBuffer) {
|
||||||
|
Ingredient ingredient = Ingredient.fromNetwork(pBuffer);
|
||||||
|
|
||||||
|
int i = pBuffer.readVarInt();
|
||||||
|
|
||||||
|
NonNullList<CrushingResult> nonnulllist = NonNullList.withSize(i, CrushingResult.EMPTY);
|
||||||
|
for (int j = 0; j < nonnulllist.size(); ++j) {
|
||||||
|
nonnulllist.set(j, new CrushingResult(pBuffer.readItem(), pBuffer.readFloat()));
|
||||||
|
}
|
||||||
|
|
||||||
|
return new CrushingRecipe(ingredient, nonnulllist);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void toNetwork(@Nonnull FriendlyByteBuf pBuffer, CrushingRecipe pRecipe) {
|
public void toNetwork(@Nonnull FriendlyByteBuf pBuffer, CrushingRecipe pRecipe) {
|
||||||
pRecipe.input.toNetwork(pBuffer);
|
pRecipe.input.toNetwork(pBuffer);
|
||||||
pBuffer.writeItem(pRecipe.outputOne);
|
pBuffer.writeVarInt(pRecipe.outputs.size());
|
||||||
pBuffer.writeItem(pRecipe.outputTwo);
|
for (CrushingResult result : pRecipe.outputs) {
|
||||||
pBuffer.writeFloat(pRecipe.chance1);
|
pBuffer.writeItem(result.stack);
|
||||||
pBuffer.writeFloat(pRecipe.chance2);
|
pBuffer.writeFloat(result.chance);
|
||||||
}
|
}
|
||||||
}
|
|
||||||
|
|
||||||
public static class Result implements FinishedRecipe {
|
|
||||||
private final ResourceLocation id;
|
|
||||||
protected Ingredient input;
|
|
||||||
protected ItemLike outputOne;
|
|
||||||
protected int countOne;
|
|
||||||
protected float outputChance1;
|
|
||||||
protected ItemLike outputTwo;
|
|
||||||
protected int countTwo;
|
|
||||||
protected float outputChance2;
|
|
||||||
|
|
||||||
public Result(ResourceLocation id, Ingredient input, ItemLike outputOne, int countOne, float outputChance1, ItemLike outputTwo, int countTwo, float outputChance2) {
|
|
||||||
this.id = id;
|
|
||||||
this.countOne = countOne;
|
|
||||||
this.countTwo = countTwo;
|
|
||||||
this.input = input;
|
|
||||||
this.outputOne = outputOne;
|
|
||||||
this.outputTwo = outputTwo;
|
|
||||||
this.outputChance1 = outputChance1;
|
|
||||||
this.outputChance2 = outputChance2;
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public void serializeRecipeData(JsonObject pJson) {
|
|
||||||
pJson.add("ingredient", input.toJson());
|
|
||||||
|
|
||||||
JsonObject result1 = new JsonObject();
|
|
||||||
result1.addProperty("item", ForgeRegistries.ITEMS.getKey(outputOne.asItem()).toString());
|
|
||||||
result1.addProperty("count", countOne);
|
|
||||||
result1.addProperty("chance", outputChance1);
|
|
||||||
|
|
||||||
JsonObject result2 = new JsonObject();
|
|
||||||
result2.addProperty("item", ForgeRegistries.ITEMS.getKey(outputTwo.asItem()).toString());
|
|
||||||
result2.addProperty("count", countTwo);
|
|
||||||
result2.addProperty("chance", outputChance2);
|
|
||||||
|
|
||||||
JsonArray resultList = new JsonArray();
|
|
||||||
resultList.add(result1);
|
|
||||||
resultList.add(result2);
|
|
||||||
|
|
||||||
pJson.add("result", resultList);
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
@Nonnull
|
|
||||||
public ResourceLocation getId() {
|
|
||||||
return id;
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
@Nonnull
|
|
||||||
public RecipeSerializer<?> getType() {
|
|
||||||
return ActuallyRecipes.CRUSHING_RECIPE.get();
|
|
||||||
}
|
|
||||||
|
|
||||||
@Nullable
|
|
||||||
@Override
|
|
||||||
public JsonObject serializeAdvancement() {
|
|
||||||
return null;
|
|
||||||
}
|
|
||||||
|
|
||||||
@Nullable
|
|
||||||
@Override
|
|
||||||
public ResourceLocation getAdvancementId() {
|
|
||||||
return null;
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -1,21 +1,18 @@
|
||||||
package de.ellpeck.actuallyadditions.mod.crafting;
|
package de.ellpeck.actuallyadditions.mod.crafting;
|
||||||
|
|
||||||
import com.google.gson.JsonArray;
|
import com.mojang.serialization.Codec;
|
||||||
import com.google.gson.JsonObject;
|
import com.mojang.serialization.DataResult;
|
||||||
|
import com.mojang.serialization.codecs.RecordCodecBuilder;
|
||||||
|
import net.minecraft.core.NonNullList;
|
||||||
import net.minecraft.core.RegistryAccess;
|
import net.minecraft.core.RegistryAccess;
|
||||||
import net.minecraft.data.recipes.FinishedRecipe;
|
|
||||||
import net.minecraft.network.FriendlyByteBuf;
|
import net.minecraft.network.FriendlyByteBuf;
|
||||||
import net.minecraft.resources.ResourceLocation;
|
|
||||||
import net.minecraft.util.GsonHelper;
|
|
||||||
import net.minecraft.world.Container;
|
import net.minecraft.world.Container;
|
||||||
import net.minecraft.world.item.ItemStack;
|
import net.minecraft.world.item.ItemStack;
|
||||||
import net.minecraft.world.item.crafting.Ingredient;
|
import net.minecraft.world.item.crafting.Ingredient;
|
||||||
import net.minecraft.world.item.crafting.Recipe;
|
import net.minecraft.world.item.crafting.Recipe;
|
||||||
import net.minecraft.world.item.crafting.RecipeSerializer;
|
import net.minecraft.world.item.crafting.RecipeSerializer;
|
||||||
import net.minecraft.world.item.crafting.RecipeType;
|
import net.minecraft.world.item.crafting.RecipeType;
|
||||||
import net.minecraft.world.level.ItemLike;
|
|
||||||
import net.minecraft.world.level.Level;
|
import net.minecraft.world.level.Level;
|
||||||
import net.minecraftforge.registries.ForgeRegistries;
|
|
||||||
|
|
||||||
import javax.annotation.Nonnull;
|
import javax.annotation.Nonnull;
|
||||||
import javax.annotation.Nullable;
|
import javax.annotation.Nullable;
|
||||||
|
@ -24,27 +21,19 @@ import java.util.List;
|
||||||
|
|
||||||
public class EmpowererRecipe implements Recipe<Container> {
|
public class EmpowererRecipe implements Recipe<Container> {
|
||||||
public static String NAME = "empowering";
|
public static String NAME = "empowering";
|
||||||
private final ResourceLocation id;
|
|
||||||
protected final Ingredient input;
|
protected final Ingredient input;
|
||||||
protected final ItemStack output;
|
protected final ItemStack output;
|
||||||
|
|
||||||
protected final Ingredient modifier1;
|
protected final NonNullList<Ingredient> modifiers;
|
||||||
protected final Ingredient modifier2;
|
|
||||||
protected final Ingredient modifier3;
|
|
||||||
protected final Ingredient modifier4;
|
|
||||||
|
|
||||||
protected final int energyPerStand;
|
protected final int energyPerStand;
|
||||||
protected final int particleColor;
|
protected final int particleColor;
|
||||||
protected final int time;
|
protected final int time;
|
||||||
|
|
||||||
public EmpowererRecipe(ResourceLocation id, ItemStack output, Ingredient input, Ingredient modifier1, Ingredient modifier2, Ingredient modifier3, Ingredient modifier4, int energyPerStand, int particleColor, int time) {
|
public EmpowererRecipe(ItemStack output, Ingredient input, NonNullList<Ingredient> modifiers, int energyPerStand, int particleColor, int time) {
|
||||||
this.id = id;
|
|
||||||
this.input = input;
|
this.input = input;
|
||||||
this.output = output;
|
this.output = output;
|
||||||
this.modifier1 = modifier1;
|
this.modifiers = modifiers;
|
||||||
this.modifier2 = modifier2;
|
|
||||||
this.modifier3 = modifier3;
|
|
||||||
this.modifier4 = modifier4;
|
|
||||||
this.energyPerStand = energyPerStand;
|
this.energyPerStand = energyPerStand;
|
||||||
this.particleColor = particleColor;
|
this.particleColor = particleColor;
|
||||||
this.time = time;
|
this.time = time;
|
||||||
|
@ -57,17 +46,17 @@ public class EmpowererRecipe implements Recipe<Container> {
|
||||||
ItemStack[] stacks = {stand1, stand2, stand3, stand4};
|
ItemStack[] stacks = {stand1, stand2, stand3, stand4};
|
||||||
boolean[] unused = {true, true, true, true};
|
boolean[] unused = {true, true, true, true};
|
||||||
for (ItemStack s : stacks) {
|
for (ItemStack s : stacks) {
|
||||||
if (unused[0] && this.modifier1.test(s)) {
|
if (unused[0] && this.modifiers.get(0).test(s)) {
|
||||||
matches.add(this.modifier1);
|
matches.add(this.modifiers.get(0));
|
||||||
unused[0] = false;
|
unused[0] = false;
|
||||||
} else if (unused[1] && this.modifier2.test(s)) {
|
} else if (unused[1] && this.modifiers.get(1).test(s)) {
|
||||||
matches.add(this.modifier2);
|
matches.add(this.modifiers.get(1));
|
||||||
unused[1] = false;
|
unused[1] = false;
|
||||||
} else if (unused[2] && this.modifier3.test(s)) {
|
} else if (unused[2] && this.modifiers.get(2).test(s)) {
|
||||||
matches.add(this.modifier3);
|
matches.add(this.modifiers.get(2));
|
||||||
unused[2] = false;
|
unused[2] = false;
|
||||||
} else if (unused[3] && this.modifier4.test(s)) {
|
} else if (unused[3] && this.modifiers.get(3).test(s)) {
|
||||||
matches.add(this.modifier4);
|
matches.add(this.modifiers.get(3));
|
||||||
unused[3] = false;
|
unused[3] = false;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -102,12 +91,6 @@ public class EmpowererRecipe implements Recipe<Container> {
|
||||||
return output;
|
return output;
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
|
||||||
@Nonnull
|
|
||||||
public ResourceLocation getId() {
|
|
||||||
return id;
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
@Nonnull
|
@Nonnull
|
||||||
public RecipeSerializer<?> getSerializer() {
|
public RecipeSerializer<?> getSerializer() {
|
||||||
|
@ -129,19 +112,19 @@ public class EmpowererRecipe implements Recipe<Container> {
|
||||||
}
|
}
|
||||||
|
|
||||||
public Ingredient getStandOne() {
|
public Ingredient getStandOne() {
|
||||||
return this.modifier1;
|
return this.modifiers.get(0);
|
||||||
}
|
}
|
||||||
|
|
||||||
public Ingredient getStandTwo() {
|
public Ingredient getStandTwo() {
|
||||||
return this.modifier2;
|
return this.modifiers.get(1);
|
||||||
}
|
}
|
||||||
|
|
||||||
public Ingredient getStandThree() {
|
public Ingredient getStandThree() {
|
||||||
return this.modifier3;
|
return this.modifiers.get(2);
|
||||||
}
|
}
|
||||||
|
|
||||||
public Ingredient getStandFour() {
|
public Ingredient getStandFour() {
|
||||||
return this.modifier4;
|
return this.modifiers.get(3);
|
||||||
}
|
}
|
||||||
|
|
||||||
public int getTime() {
|
public int getTime() {
|
||||||
|
@ -157,127 +140,92 @@ public class EmpowererRecipe implements Recipe<Container> {
|
||||||
}
|
}
|
||||||
|
|
||||||
public static class Serializer implements RecipeSerializer<EmpowererRecipe> {
|
public static class Serializer implements RecipeSerializer<EmpowererRecipe> {
|
||||||
|
private static final Codec<EmpowererRecipe> CODEC = RecordCodecBuilder.create(
|
||||||
|
instance -> instance.group(
|
||||||
|
ItemStack.RESULT_CODEC.fieldOf("result").forGetter(recipe -> recipe.output),
|
||||||
|
Ingredient.CODEC_NONEMPTY.fieldOf("base").forGetter(recipe -> recipe.input),
|
||||||
|
Ingredient.CODEC_NONEMPTY
|
||||||
|
.listOf()
|
||||||
|
.fieldOf("modifiers")
|
||||||
|
.flatXmap(
|
||||||
|
list -> {
|
||||||
|
Ingredient[] aingredient = list
|
||||||
|
.toArray(Ingredient[]::new);
|
||||||
|
if (aingredient.length == 0) {
|
||||||
|
return DataResult.error(() -> "No modifiers for Empowering recipe");
|
||||||
|
} else {
|
||||||
|
return aingredient.length != 4
|
||||||
|
? DataResult.error(() -> "Must have exactly 4 modifiers. has: %s".formatted(aingredient.length))
|
||||||
|
: DataResult.success(NonNullList.of(Ingredient.EMPTY, aingredient));
|
||||||
|
}
|
||||||
|
},
|
||||||
|
DataResult::success
|
||||||
|
)
|
||||||
|
.forGetter(recipe -> recipe.modifiers),
|
||||||
|
Codec.INT.fieldOf("energy").forGetter(recipe -> recipe.energyPerStand),
|
||||||
|
Codec.INT.fieldOf("color").forGetter(recipe -> recipe.particleColor),
|
||||||
|
Codec.INT.fieldOf("time").forGetter(recipe -> recipe.time)
|
||||||
|
)
|
||||||
|
.apply(instance, EmpowererRecipe::new)
|
||||||
|
);
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
@Nonnull
|
public Codec<EmpowererRecipe> codec() {
|
||||||
public EmpowererRecipe fromJson(@Nonnull ResourceLocation pRecipeId, @Nonnull JsonObject pJson) {
|
return CODEC;
|
||||||
Ingredient base = Ingredient.fromJson(GsonHelper.getAsJsonObject(pJson, "base"));
|
|
||||||
|
|
||||||
JsonArray modifiers = GsonHelper.getAsJsonArray(pJson, "modifiers");
|
|
||||||
if (modifiers.size() != 4)
|
|
||||||
throw new IllegalStateException(pRecipeId.toString() + ": Must have exactly 4 modifiers, has: " + modifiers.size());
|
|
||||||
|
|
||||||
Ingredient mod1 = Ingredient.fromJson(modifiers.get(0));
|
|
||||||
Ingredient mod2 = Ingredient.fromJson(modifiers.get(1));
|
|
||||||
Ingredient mod3 = Ingredient.fromJson(modifiers.get(2));
|
|
||||||
Ingredient mod4 = Ingredient.fromJson(modifiers.get(3));
|
|
||||||
int energy = GsonHelper.getAsInt(pJson, "energy");
|
|
||||||
int color = GsonHelper.getAsInt(pJson, "color");
|
|
||||||
int time = GsonHelper.getAsInt(pJson, "time");
|
|
||||||
JsonObject resultObject = GsonHelper.getAsJsonObject(pJson, "result");
|
|
||||||
ItemStack result = new ItemStack(GsonHelper.getAsItem(resultObject, "item"));
|
|
||||||
|
|
||||||
return new EmpowererRecipe(pRecipeId, result, base, mod1, mod2, mod3, mod4, energy, color, time);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// @Override
|
||||||
|
// @Nonnull
|
||||||
|
// public EmpowererRecipe fromJson(@Nonnull ResourceLocation pRecipeId, @Nonnull JsonObject pJson) {
|
||||||
|
// Ingredient base = Ingredient.fromJson(GsonHelper.getAsJsonObject(pJson, "base"));
|
||||||
|
//
|
||||||
|
// JsonArray modifiers = GsonHelper.getAsJsonArray(pJson, "modifiers");
|
||||||
|
// if (modifiers.size() != 4)
|
||||||
|
// throw new IllegalStateException(pRecipeId.toString() + ": Must have exactly 4 modifiers, has: " + modifiers.size());
|
||||||
|
//
|
||||||
|
// Ingredient mod1 = Ingredient.fromJson(modifiers.get(0));
|
||||||
|
// Ingredient mod2 = Ingredient.fromJson(modifiers.get(1));
|
||||||
|
// Ingredient mod3 = Ingredient.fromJson(modifiers.get(2));
|
||||||
|
// Ingredient mod4 = Ingredient.fromJson(modifiers.get(3));
|
||||||
|
// int energy = GsonHelper.getAsInt(pJson, "energy");
|
||||||
|
// int color = GsonHelper.getAsInt(pJson, "color");
|
||||||
|
// int time = GsonHelper.getAsInt(pJson, "time");
|
||||||
|
// JsonObject resultObject = GsonHelper.getAsJsonObject(pJson, "result");
|
||||||
|
// ItemStack result = new ItemStack(GsonHelper.getAsItem(resultObject, "item"));
|
||||||
|
//
|
||||||
|
// return new EmpowererRecipe(pRecipeId, result, base, mod1, mod2, mod3, mod4, energy, color, time);
|
||||||
|
// }
|
||||||
|
|
||||||
@Nullable
|
@Nullable
|
||||||
@Override
|
@Override
|
||||||
public EmpowererRecipe fromNetwork(@Nonnull ResourceLocation pRecipeId, FriendlyByteBuf pBuffer) {
|
public EmpowererRecipe fromNetwork(FriendlyByteBuf pBuffer) {
|
||||||
ItemStack result = pBuffer.readItem();
|
ItemStack result = pBuffer.readItem();
|
||||||
Ingredient input = Ingredient.fromNetwork(pBuffer);
|
Ingredient input = Ingredient.fromNetwork(pBuffer);
|
||||||
Ingredient mod1 = Ingredient.fromNetwork(pBuffer);
|
|
||||||
Ingredient mod2 = Ingredient.fromNetwork(pBuffer);
|
int i = pBuffer.readVarInt();
|
||||||
Ingredient mod3 = Ingredient.fromNetwork(pBuffer);
|
NonNullList<Ingredient> nonnulllist = NonNullList.withSize(i, Ingredient.EMPTY);
|
||||||
Ingredient mod4 = Ingredient.fromNetwork(pBuffer);
|
for (int j = 0; j < nonnulllist.size(); ++j) {
|
||||||
|
nonnulllist.set(j, Ingredient.fromNetwork(pBuffer));
|
||||||
|
}
|
||||||
|
|
||||||
int energy = pBuffer.readInt();
|
int energy = pBuffer.readInt();
|
||||||
int color = pBuffer.readInt();
|
int color = pBuffer.readInt();
|
||||||
int time = pBuffer.readInt();
|
int time = pBuffer.readInt();
|
||||||
|
|
||||||
return new EmpowererRecipe(pRecipeId, result, input, mod1, mod2, mod3, mod4, energy, color, time);
|
return new EmpowererRecipe(result, input, nonnulllist, energy, color, time);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void toNetwork(FriendlyByteBuf pBuffer, EmpowererRecipe pRecipe) {
|
public void toNetwork(FriendlyByteBuf pBuffer, EmpowererRecipe pRecipe) {
|
||||||
pBuffer.writeItem(pRecipe.output);
|
pBuffer.writeItem(pRecipe.output);
|
||||||
pRecipe.input.toNetwork(pBuffer);
|
pRecipe.input.toNetwork(pBuffer);
|
||||||
pRecipe.modifier1.toNetwork(pBuffer);
|
pBuffer.writeVarInt(pRecipe.modifiers.size());
|
||||||
pRecipe.modifier2.toNetwork(pBuffer);
|
for (Ingredient modifier : pRecipe.modifiers) {
|
||||||
pRecipe.modifier3.toNetwork(pBuffer);
|
modifier.toNetwork(pBuffer);
|
||||||
pRecipe.modifier4.toNetwork(pBuffer);
|
}
|
||||||
pBuffer.writeInt(pRecipe.energyPerStand);
|
pBuffer.writeInt(pRecipe.energyPerStand);
|
||||||
pBuffer.writeInt(pRecipe.particleColor);
|
pBuffer.writeInt(pRecipe.particleColor);
|
||||||
pBuffer.writeInt(pRecipe.time);
|
pBuffer.writeInt(pRecipe.time);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public static class Result implements FinishedRecipe {
|
|
||||||
private final ResourceLocation id;
|
|
||||||
private final Ingredient base;
|
|
||||||
private final Ingredient mod1;
|
|
||||||
private final Ingredient mod2;
|
|
||||||
private final Ingredient mod3;
|
|
||||||
private final Ingredient mod4;
|
|
||||||
private final int energy;
|
|
||||||
private final int color;
|
|
||||||
private final int time;
|
|
||||||
private final ItemLike output;
|
|
||||||
|
|
||||||
public Result(ResourceLocation id, ItemLike output, Ingredient input, Ingredient modifier1, Ingredient modifier2, Ingredient modifier3, Ingredient modifier4, int energyPerStand, int particleColor, int time) {
|
|
||||||
this.id = id;
|
|
||||||
this.base = input;
|
|
||||||
this.output = output;
|
|
||||||
this.mod1 = modifier1;
|
|
||||||
this.mod2 = modifier2;
|
|
||||||
this.mod3 = modifier3;
|
|
||||||
this.mod4 = modifier4;
|
|
||||||
this.energy = energyPerStand;
|
|
||||||
this.color = particleColor;
|
|
||||||
this.time = time;
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public void serializeRecipeData(JsonObject pJson) {
|
|
||||||
pJson.add("base", base.toJson());
|
|
||||||
|
|
||||||
JsonArray modifiers = new JsonArray();
|
|
||||||
|
|
||||||
modifiers.add(mod1.toJson());
|
|
||||||
modifiers.add(mod2.toJson());
|
|
||||||
modifiers.add(mod3.toJson());
|
|
||||||
modifiers.add(mod4.toJson());
|
|
||||||
|
|
||||||
pJson.add("modifiers", modifiers);
|
|
||||||
pJson.addProperty("energy", energy);
|
|
||||||
pJson.addProperty("time", time);
|
|
||||||
pJson.addProperty("color", color);
|
|
||||||
|
|
||||||
JsonObject resultObject = new JsonObject();
|
|
||||||
resultObject.addProperty("item", ForgeRegistries.ITEMS.getKey(output.asItem()).toString());
|
|
||||||
|
|
||||||
pJson.add("result", resultObject);
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
@Nonnull
|
|
||||||
public ResourceLocation getId() {
|
|
||||||
return id;
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
@Nonnull
|
|
||||||
public RecipeSerializer<?> getType() {
|
|
||||||
return ActuallyRecipes.EMPOWERING_RECIPE.get();
|
|
||||||
}
|
|
||||||
|
|
||||||
@Nullable
|
|
||||||
@Override
|
|
||||||
public JsonObject serializeAdvancement() {
|
|
||||||
return null;
|
|
||||||
}
|
|
||||||
|
|
||||||
@Nullable
|
|
||||||
@Override
|
|
||||||
public ResourceLocation getAdvancementId() {
|
|
||||||
return null;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -1,22 +1,17 @@
|
||||||
package de.ellpeck.actuallyadditions.mod.crafting;
|
package de.ellpeck.actuallyadditions.mod.crafting;
|
||||||
|
|
||||||
import com.google.gson.JsonObject;
|
import com.mojang.serialization.Codec;
|
||||||
import com.google.gson.JsonParseException;
|
import com.mojang.serialization.codecs.RecordCodecBuilder;
|
||||||
import de.ellpeck.actuallyadditions.mod.inventory.gui.FluidDisplay;
|
import de.ellpeck.actuallyadditions.mod.inventory.gui.FluidDisplay;
|
||||||
import net.minecraft.core.RegistryAccess;
|
import net.minecraft.core.RegistryAccess;
|
||||||
import net.minecraft.data.recipes.FinishedRecipe;
|
|
||||||
import net.minecraft.network.FriendlyByteBuf;
|
import net.minecraft.network.FriendlyByteBuf;
|
||||||
import net.minecraft.resources.ResourceLocation;
|
|
||||||
import net.minecraft.util.GsonHelper;
|
|
||||||
import net.minecraft.world.Container;
|
import net.minecraft.world.Container;
|
||||||
import net.minecraft.world.item.ItemStack;
|
import net.minecraft.world.item.ItemStack;
|
||||||
import net.minecraft.world.item.crafting.Recipe;
|
import net.minecraft.world.item.crafting.Recipe;
|
||||||
import net.minecraft.world.item.crafting.RecipeSerializer;
|
import net.minecraft.world.item.crafting.RecipeSerializer;
|
||||||
import net.minecraft.world.item.crafting.RecipeType;
|
import net.minecraft.world.item.crafting.RecipeType;
|
||||||
import net.minecraft.world.level.Level;
|
import net.minecraft.world.level.Level;
|
||||||
import net.minecraft.world.level.material.Fluid;
|
import net.neoforged.neoforge.fluids.FluidStack;
|
||||||
import net.minecraftforge.fluids.FluidStack;
|
|
||||||
import net.minecraftforge.registries.ForgeRegistries;
|
|
||||||
|
|
||||||
import javax.annotation.Nonnull;
|
import javax.annotation.Nonnull;
|
||||||
import javax.annotation.Nullable;
|
import javax.annotation.Nullable;
|
||||||
|
@ -24,7 +19,6 @@ import java.util.Optional;
|
||||||
|
|
||||||
public class FermentingRecipe implements Recipe<Container> {
|
public class FermentingRecipe implements Recipe<Container> {
|
||||||
public static final String NAME = "fermenting";
|
public static final String NAME = "fermenting";
|
||||||
private final ResourceLocation ID;
|
|
||||||
private final FluidStack input;
|
private final FluidStack input;
|
||||||
private final FluidStack output;
|
private final FluidStack output;
|
||||||
private final int time;
|
private final int time;
|
||||||
|
@ -32,8 +26,7 @@ public class FermentingRecipe implements Recipe<Container> {
|
||||||
private Optional<FluidDisplay> inputDisplay;
|
private Optional<FluidDisplay> inputDisplay;
|
||||||
private Optional<FluidDisplay> outputDisplay;
|
private Optional<FluidDisplay> outputDisplay;
|
||||||
|
|
||||||
public FermentingRecipe(ResourceLocation ID, FluidStack input, FluidStack output, int timeIn) {
|
public FermentingRecipe(FluidStack input, FluidStack output, int timeIn) {
|
||||||
this.ID = ID;
|
|
||||||
this.input = input;
|
this.input = input;
|
||||||
this.output = output;
|
this.output = output;
|
||||||
this.time = timeIn;
|
this.time = timeIn;
|
||||||
|
@ -102,12 +95,6 @@ public class FermentingRecipe implements Recipe<Container> {
|
||||||
return ItemStack.EMPTY;
|
return ItemStack.EMPTY;
|
||||||
}
|
}
|
||||||
|
|
||||||
@Nonnull
|
|
||||||
@Override
|
|
||||||
public ResourceLocation getId() {
|
|
||||||
return ID;
|
|
||||||
}
|
|
||||||
|
|
||||||
@Nonnull
|
@Nonnull
|
||||||
@Override
|
@Override
|
||||||
public RecipeSerializer<?> getSerializer() {
|
public RecipeSerializer<?> getSerializer() {
|
||||||
|
@ -121,110 +108,62 @@ public class FermentingRecipe implements Recipe<Container> {
|
||||||
}
|
}
|
||||||
|
|
||||||
public static class Serializer implements RecipeSerializer<FermentingRecipe> {
|
public static class Serializer implements RecipeSerializer<FermentingRecipe> {
|
||||||
@Nonnull
|
private static final Codec<FermentingRecipe> CODEC = RecordCodecBuilder.create(
|
||||||
|
instance -> instance.group(
|
||||||
|
FluidStack.CODEC.fieldOf("ingredient").forGetter(recipe -> recipe.input),
|
||||||
|
FluidStack.CODEC.fieldOf("result").forGetter(recipe -> recipe.output),
|
||||||
|
Codec.INT.fieldOf("time").forGetter(recipe -> recipe.time)
|
||||||
|
)
|
||||||
|
.apply(instance, FermentingRecipe::new)
|
||||||
|
);
|
||||||
|
|
||||||
|
// @Nonnull
|
||||||
|
// @Override
|
||||||
|
// public FermentingRecipe fromJson(@Nonnull ResourceLocation pRecipeId, @Nonnull JsonObject pJson) {
|
||||||
|
// JsonObject ingredient = pJson.getAsJsonObject("ingredient");
|
||||||
|
//
|
||||||
|
// ResourceLocation fluidRes = new ResourceLocation(GsonHelper.getAsString(ingredient, "fluid"));
|
||||||
|
// Fluid fluid = BuiltInRegistries.FLUIDS.getValue(fluidRes);
|
||||||
|
// if (fluid == null)
|
||||||
|
// throw new JsonParseException("Unknown fluid '" + fluidRes + "'");
|
||||||
|
// int inputAmount = GsonHelper.getAsInt(ingredient, "amount", 80);
|
||||||
|
// FluidStack input = new FluidStack(fluid, inputAmount);
|
||||||
|
//
|
||||||
|
// JsonObject result = pJson.getAsJsonObject("result");
|
||||||
|
// ResourceLocation fluidOutputRes = new ResourceLocation(GsonHelper.getAsString(result, "fluid"));
|
||||||
|
// int outputAmount = GsonHelper.getAsInt(result, "amount");
|
||||||
|
// Fluid fluidOutput = BuiltInRegistries.FLUIDS.getValue(fluidOutputRes);
|
||||||
|
// if(fluidOutput == null)
|
||||||
|
// throw new JsonParseException("Unknown fluid '" + fluidRes + "'");
|
||||||
|
// FluidStack output = new FluidStack(fluidOutput, outputAmount);
|
||||||
|
//
|
||||||
|
// int time = GsonHelper.getAsInt(pJson, "time", 100);
|
||||||
|
//
|
||||||
|
// return new FermentingRecipe(pRecipeId, input, output, time);
|
||||||
|
// }
|
||||||
|
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public FermentingRecipe fromJson(@Nonnull ResourceLocation pRecipeId, @Nonnull JsonObject pJson) {
|
public Codec<FermentingRecipe> codec() {
|
||||||
JsonObject ingredient = pJson.getAsJsonObject("ingredient");
|
return CODEC;
|
||||||
|
|
||||||
ResourceLocation fluidRes = new ResourceLocation(GsonHelper.getAsString(ingredient, "fluid"));
|
|
||||||
Fluid fluid = ForgeRegistries.FLUIDS.getValue(fluidRes);
|
|
||||||
if (fluid == null)
|
|
||||||
throw new JsonParseException("Unknown fluid '" + fluidRes + "'");
|
|
||||||
int inputAmount = GsonHelper.getAsInt(ingredient, "amount", 80);
|
|
||||||
FluidStack input = new FluidStack(fluid, inputAmount);
|
|
||||||
|
|
||||||
JsonObject result = pJson.getAsJsonObject("result");
|
|
||||||
ResourceLocation fluidOutputRes = new ResourceLocation(GsonHelper.getAsString(result, "fluid"));
|
|
||||||
int outputAmount = GsonHelper.getAsInt(result, "amount");
|
|
||||||
Fluid fluidOutput = ForgeRegistries.FLUIDS.getValue(fluidOutputRes);
|
|
||||||
if(fluidOutput == null)
|
|
||||||
throw new JsonParseException("Unknown fluid '" + fluidRes + "'");
|
|
||||||
FluidStack output = new FluidStack(fluidOutput, outputAmount);
|
|
||||||
|
|
||||||
int time = GsonHelper.getAsInt(pJson, "time", 100);
|
|
||||||
|
|
||||||
return new FermentingRecipe(pRecipeId, input, output, time);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
@Nullable
|
@Nullable
|
||||||
@Override
|
@Override
|
||||||
public FermentingRecipe fromNetwork(@Nonnull ResourceLocation pRecipeId, @Nonnull FriendlyByteBuf pBuffer) {
|
public FermentingRecipe fromNetwork(@Nonnull FriendlyByteBuf pBuffer) {
|
||||||
ResourceLocation inputRes = new ResourceLocation(pBuffer.readUtf());
|
FluidStack input = FluidStack.readFromPacket(pBuffer);
|
||||||
int inputAmount = pBuffer.readInt();
|
FluidStack output = FluidStack.readFromPacket(pBuffer);
|
||||||
Fluid inputFluid = ForgeRegistries.FLUIDS.getValue(inputRes);
|
|
||||||
if(inputFluid == null)
|
|
||||||
throw new JsonParseException("Unknown input fluid '" + inputRes + "'");
|
|
||||||
FluidStack input = new FluidStack(inputFluid, inputAmount);
|
|
||||||
|
|
||||||
ResourceLocation outputRes = new ResourceLocation(pBuffer.readUtf());
|
|
||||||
int outputAmount = pBuffer.readInt();
|
|
||||||
Fluid outputFluid = ForgeRegistries.FLUIDS.getValue(outputRes);
|
|
||||||
if(outputFluid == null)
|
|
||||||
throw new JsonParseException("Unknown output fluid '" + outputRes + "'");
|
|
||||||
FluidStack output = new FluidStack(outputFluid, outputAmount);
|
|
||||||
|
|
||||||
int time = pBuffer.readInt();
|
int time = pBuffer.readInt();
|
||||||
|
|
||||||
return new FermentingRecipe(pRecipeId, input, output, time);
|
return new FermentingRecipe(input, output, time);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void toNetwork(@Nonnull FriendlyByteBuf pBuffer, @Nonnull FermentingRecipe pRecipe) {
|
public void toNetwork(@Nonnull FriendlyByteBuf pBuffer, @Nonnull FermentingRecipe pRecipe) {
|
||||||
pBuffer.writeUtf(ForgeRegistries.FLUIDS.getKey(pRecipe.input.getFluid()).toString());
|
pRecipe.input.writeToPacket(pBuffer);
|
||||||
pBuffer.writeInt(pRecipe.input.getAmount());
|
pRecipe.output.writeToPacket(pBuffer);
|
||||||
pBuffer.writeUtf(ForgeRegistries.FLUIDS.getKey(pRecipe.output.getFluid()).toString());
|
|
||||||
pBuffer.writeInt(pRecipe.output.getAmount());
|
pBuffer.writeInt(pRecipe.output.getAmount());
|
||||||
pBuffer.writeInt(pRecipe.time);
|
pBuffer.writeInt(pRecipe.time);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
public static class Result implements FinishedRecipe {
|
|
||||||
private final ResourceLocation ID;
|
|
||||||
private final FluidStack input;
|
|
||||||
private final FluidStack output;
|
|
||||||
private final int time;
|
|
||||||
|
|
||||||
public Result(ResourceLocation ID, FluidStack input, FluidStack output, int timeIn) {
|
|
||||||
this.ID = ID;
|
|
||||||
this.input = input;
|
|
||||||
this.output = output;
|
|
||||||
this.time = timeIn;
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public void serializeRecipeData(JsonObject pJson) {
|
|
||||||
JsonObject ingredient = new JsonObject();
|
|
||||||
ingredient.addProperty("fluid", ForgeRegistries.FLUIDS.getKey(input.getFluid()).toString());
|
|
||||||
ingredient.addProperty("amount", input.getAmount());
|
|
||||||
|
|
||||||
JsonObject result = new JsonObject();
|
|
||||||
result.addProperty("fluid", ForgeRegistries.FLUIDS.getKey(output.getFluid()).toString());
|
|
||||||
result.addProperty("amount", output.getAmount());
|
|
||||||
|
|
||||||
pJson.add("ingredient", ingredient);
|
|
||||||
pJson.add("result", result);
|
|
||||||
pJson.addProperty("time", time);
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public ResourceLocation getId() {
|
|
||||||
return ID;
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public RecipeSerializer<?> getType() {
|
|
||||||
return ActuallyRecipes.FERMENTING_RECIPE.get();
|
|
||||||
}
|
|
||||||
|
|
||||||
@Nullable
|
|
||||||
@Override
|
|
||||||
public JsonObject serializeAdvancement() {
|
|
||||||
return null;
|
|
||||||
}
|
|
||||||
|
|
||||||
@Nullable
|
|
||||||
@Override
|
|
||||||
public ResourceLocation getAdvancementId() {
|
|
||||||
return null;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -1,21 +1,18 @@
|
||||||
package de.ellpeck.actuallyadditions.mod.crafting;
|
package de.ellpeck.actuallyadditions.mod.crafting;
|
||||||
|
|
||||||
import com.google.gson.JsonObject;
|
import com.mojang.serialization.Codec;
|
||||||
|
import com.mojang.serialization.codecs.RecordCodecBuilder;
|
||||||
import de.ellpeck.actuallyadditions.api.ActuallyAdditionsAPI;
|
import de.ellpeck.actuallyadditions.api.ActuallyAdditionsAPI;
|
||||||
import net.minecraft.core.RegistryAccess;
|
import net.minecraft.core.RegistryAccess;
|
||||||
import net.minecraft.data.recipes.FinishedRecipe;
|
|
||||||
import net.minecraft.network.FriendlyByteBuf;
|
import net.minecraft.network.FriendlyByteBuf;
|
||||||
import net.minecraft.resources.ResourceLocation;
|
|
||||||
import net.minecraft.util.GsonHelper;
|
|
||||||
import net.minecraft.world.Container;
|
import net.minecraft.world.Container;
|
||||||
import net.minecraft.world.item.ItemStack;
|
import net.minecraft.world.item.ItemStack;
|
||||||
import net.minecraft.world.item.crafting.Ingredient;
|
import net.minecraft.world.item.crafting.Ingredient;
|
||||||
import net.minecraft.world.item.crafting.Recipe;
|
import net.minecraft.world.item.crafting.Recipe;
|
||||||
|
import net.minecraft.world.item.crafting.RecipeHolder;
|
||||||
import net.minecraft.world.item.crafting.RecipeSerializer;
|
import net.minecraft.world.item.crafting.RecipeSerializer;
|
||||||
import net.minecraft.world.item.crafting.RecipeType;
|
import net.minecraft.world.item.crafting.RecipeType;
|
||||||
import net.minecraft.world.level.ItemLike;
|
|
||||||
import net.minecraft.world.level.Level;
|
import net.minecraft.world.level.Level;
|
||||||
import net.minecraftforge.registries.ForgeRegistries;
|
|
||||||
|
|
||||||
import javax.annotation.Nonnull;
|
import javax.annotation.Nonnull;
|
||||||
import javax.annotation.Nullable;
|
import javax.annotation.Nullable;
|
||||||
|
@ -27,13 +24,11 @@ public class LaserRecipe implements Recipe<Container> {
|
||||||
private ItemStack result;
|
private ItemStack result;
|
||||||
private Ingredient itemIngredient;
|
private Ingredient itemIngredient;
|
||||||
private int energy;
|
private int energy;
|
||||||
private ResourceLocation id;
|
|
||||||
|
|
||||||
public LaserRecipe(ResourceLocation id, ItemStack result, Ingredient itemIngredient, int energy) {
|
public LaserRecipe(ItemStack result, Ingredient itemIngredient, int energy) {
|
||||||
this.result = result;
|
this.result = result;
|
||||||
this.itemIngredient = itemIngredient;
|
this.itemIngredient = itemIngredient;
|
||||||
this.energy = energy;
|
this.energy = energy;
|
||||||
this.id = id;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public int getEnergy() {
|
public int getEnergy() {
|
||||||
|
@ -78,11 +73,6 @@ public class LaserRecipe implements Recipe<Container> {
|
||||||
return result;
|
return result;
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
|
||||||
public ResourceLocation getId() {
|
|
||||||
return id;
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public RecipeSerializer<?> getSerializer() {
|
public RecipeSerializer<?> getSerializer() {
|
||||||
return ActuallyRecipes.LASER_RECIPE.get();
|
return ActuallyRecipes.LASER_RECIPE.get();
|
||||||
|
@ -93,8 +83,8 @@ public class LaserRecipe implements Recipe<Container> {
|
||||||
return ActuallyRecipes.Types.LASER.get();
|
return ActuallyRecipes.Types.LASER.get();
|
||||||
}
|
}
|
||||||
|
|
||||||
public static Optional<LaserRecipe> getRecipeForStack(ItemStack stack) {
|
public static Optional<RecipeHolder<LaserRecipe>> getRecipeForStack(ItemStack stack) {
|
||||||
return ActuallyAdditionsAPI.CONVERSION_LASER_RECIPES.stream().filter(recipe -> recipe.matches(stack)).findFirst();
|
return ActuallyAdditionsAPI.CONVERSION_LASER_RECIPES.stream().filter(recipe -> recipe.value().matches(stack)).findFirst();
|
||||||
}
|
}
|
||||||
|
|
||||||
public boolean validInput(ItemStack stack) {
|
public boolean validInput(ItemStack stack) {
|
||||||
|
@ -102,23 +92,38 @@ public class LaserRecipe implements Recipe<Container> {
|
||||||
}
|
}
|
||||||
|
|
||||||
public static class Serializer implements RecipeSerializer<LaserRecipe> {
|
public static class Serializer implements RecipeSerializer<LaserRecipe> {
|
||||||
@Override
|
private static final Codec<LaserRecipe> CODEC = RecordCodecBuilder.create(
|
||||||
public LaserRecipe fromJson(@Nonnull ResourceLocation pRecipeId, @Nonnull JsonObject pJson) {
|
instance -> instance.group(
|
||||||
Ingredient ingredient = Ingredient.fromJson(GsonHelper.getAsJsonObject(pJson, "ingredient"));
|
ItemStack.RESULT_CODEC.fieldOf("result").forGetter(recipe -> recipe.result),
|
||||||
int energy = GsonHelper.getAsInt(pJson, "energy");
|
Ingredient.CODEC_NONEMPTY.fieldOf("ingredient").forGetter(recipe -> recipe.itemIngredient),
|
||||||
JsonObject resultObject = GsonHelper.getAsJsonObject(pJson, "result");
|
Codec.INT.fieldOf("energy").forGetter(recipe -> recipe.energy)
|
||||||
ItemStack result = new ItemStack(GsonHelper.getAsItem(resultObject, "item"));
|
)
|
||||||
|
.apply(instance, LaserRecipe::new)
|
||||||
|
);
|
||||||
|
|
||||||
return new LaserRecipe(pRecipeId, result, ingredient, energy);
|
// @Override
|
||||||
|
// public LaserRecipe fromJson(@Nonnull ResourceLocation pRecipeId, @Nonnull JsonObject pJson) {
|
||||||
|
// Ingredient ingredient = Ingredient.fromJson(GsonHelper.getAsJsonObject(pJson, "ingredient"));
|
||||||
|
// int energy = GsonHelper.getAsInt(pJson, "energy");
|
||||||
|
// JsonObject resultObject = GsonHelper.getAsJsonObject(pJson, "result");
|
||||||
|
// ItemStack result = new ItemStack(GsonHelper.getAsItem(resultObject, "item"));
|
||||||
|
//
|
||||||
|
// return new LaserRecipe(pRecipeId, result, ingredient, energy);
|
||||||
|
// }
|
||||||
|
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public Codec<LaserRecipe> codec() {
|
||||||
|
return CODEC;
|
||||||
}
|
}
|
||||||
|
|
||||||
@Nullable
|
@Nullable
|
||||||
@Override
|
@Override
|
||||||
public LaserRecipe fromNetwork(@Nonnull ResourceLocation pRecipeId, @Nonnull FriendlyByteBuf pBuffer) {
|
public LaserRecipe fromNetwork(@Nonnull FriendlyByteBuf pBuffer) {
|
||||||
Ingredient ingredient = Ingredient.fromNetwork(pBuffer);
|
Ingredient ingredient = Ingredient.fromNetwork(pBuffer);
|
||||||
int energy = pBuffer.readInt();
|
int energy = pBuffer.readInt();
|
||||||
ItemStack result = pBuffer.readItem();
|
ItemStack result = pBuffer.readItem();
|
||||||
return new LaserRecipe(pRecipeId, result, ingredient, energy);
|
return new LaserRecipe(result, ingredient, energy);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
@ -128,51 +133,4 @@ public class LaserRecipe implements Recipe<Container> {
|
||||||
pBuffer.writeItem(pRecipe.result);
|
pBuffer.writeItem(pRecipe.result);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public static class Result implements FinishedRecipe {
|
|
||||||
private ResourceLocation id;
|
|
||||||
private Ingredient itemIngredient;
|
|
||||||
private int energy;
|
|
||||||
private ItemLike output;
|
|
||||||
|
|
||||||
public Result(ResourceLocation id, Ingredient itemIngredient, int energy, ItemLike output) {
|
|
||||||
this.id = id;
|
|
||||||
this.itemIngredient = itemIngredient;
|
|
||||||
this.energy = energy;
|
|
||||||
this.output = output;
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public void serializeRecipeData(JsonObject pJson) {
|
|
||||||
pJson.add("ingredient", itemIngredient.toJson());
|
|
||||||
pJson.addProperty("energy", energy);
|
|
||||||
|
|
||||||
JsonObject resultObject = new JsonObject();
|
|
||||||
resultObject.addProperty("item", ForgeRegistries.ITEMS.getKey(output.asItem()).toString());
|
|
||||||
|
|
||||||
pJson.add("result", resultObject);
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public ResourceLocation getId() {
|
|
||||||
return id;
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public RecipeSerializer<?> getType() {
|
|
||||||
return ActuallyRecipes.LASER_RECIPE.get();
|
|
||||||
}
|
|
||||||
|
|
||||||
@Nullable
|
|
||||||
@Override
|
|
||||||
public JsonObject serializeAdvancement() {
|
|
||||||
return null;
|
|
||||||
}
|
|
||||||
|
|
||||||
@Nullable
|
|
||||||
@Override
|
|
||||||
public ResourceLocation getAdvancementId() {
|
|
||||||
return null;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -1,44 +1,35 @@
|
||||||
package de.ellpeck.actuallyadditions.mod.crafting;
|
package de.ellpeck.actuallyadditions.mod.crafting;
|
||||||
|
|
||||||
import com.google.gson.JsonObject;
|
import com.mojang.serialization.Codec;
|
||||||
import com.google.gson.JsonParseException;
|
import com.mojang.serialization.codecs.RecordCodecBuilder;
|
||||||
import net.minecraft.core.RegistryAccess;
|
import net.minecraft.core.RegistryAccess;
|
||||||
import net.minecraft.data.recipes.FinishedRecipe;
|
|
||||||
import net.minecraft.network.FriendlyByteBuf;
|
import net.minecraft.network.FriendlyByteBuf;
|
||||||
import net.minecraft.resources.ResourceLocation;
|
|
||||||
import net.minecraft.util.GsonHelper;
|
|
||||||
import net.minecraft.world.Container;
|
import net.minecraft.world.Container;
|
||||||
import net.minecraft.world.item.ItemStack;
|
import net.minecraft.world.item.ItemStack;
|
||||||
import net.minecraft.world.item.crafting.Recipe;
|
import net.minecraft.world.item.crafting.Recipe;
|
||||||
import net.minecraft.world.item.crafting.RecipeSerializer;
|
import net.minecraft.world.item.crafting.RecipeSerializer;
|
||||||
import net.minecraft.world.item.crafting.RecipeType;
|
import net.minecraft.world.item.crafting.RecipeType;
|
||||||
import net.minecraft.world.level.Level;
|
import net.minecraft.world.level.Level;
|
||||||
import net.minecraft.world.level.material.Fluid;
|
import net.neoforged.neoforge.fluids.FluidStack;
|
||||||
import net.minecraftforge.fluids.FluidStack;
|
|
||||||
import net.minecraftforge.registries.ForgeRegistries;
|
|
||||||
|
|
||||||
import javax.annotation.Nonnull;
|
import javax.annotation.Nonnull;
|
||||||
import javax.annotation.Nullable;
|
|
||||||
|
|
||||||
public class LiquidFuelRecipe implements Recipe<Container> {
|
public class LiquidFuelRecipe implements Recipe<Container> {
|
||||||
public static String NAME = "liquid_fuel";
|
public static String NAME = "liquid_fuel";
|
||||||
private FluidStack fuel;
|
private FluidStack fuel;
|
||||||
private int burnTime;
|
private int burnTime;
|
||||||
private int totalEnergy;
|
private int totalEnergy;
|
||||||
private ResourceLocation id;
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Oil generator recipe
|
* Oil generator recipe
|
||||||
* @param id ResourceLocation of the recipe
|
|
||||||
* @param fuel The fluid
|
* @param fuel The fluid
|
||||||
* @param totalEnergy The total power generated.
|
* @param totalEnergy The total power generated.
|
||||||
* @param burnTime The length the fluid burns for, in ticks.
|
* @param burnTime The length the fluid burns for, in ticks.
|
||||||
*/
|
*/
|
||||||
public LiquidFuelRecipe(ResourceLocation id, FluidStack fuel, int totalEnergy, int burnTime) {
|
public LiquidFuelRecipe( FluidStack fuel, int totalEnergy, int burnTime) {
|
||||||
this.fuel = fuel;
|
this.fuel = fuel;
|
||||||
this.burnTime = burnTime;
|
this.burnTime = burnTime;
|
||||||
this.totalEnergy = totalEnergy;
|
this.totalEnergy = totalEnergy;
|
||||||
this.id = id;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public int getBurnTime() {
|
public int getBurnTime() {
|
||||||
|
@ -88,12 +79,6 @@ public class LiquidFuelRecipe implements Recipe<Container> {
|
||||||
return ItemStack.EMPTY;
|
return ItemStack.EMPTY;
|
||||||
}
|
}
|
||||||
|
|
||||||
@Nonnull
|
|
||||||
@Override
|
|
||||||
public ResourceLocation getId() {
|
|
||||||
return id;
|
|
||||||
}
|
|
||||||
|
|
||||||
@Nonnull
|
@Nonnull
|
||||||
@Override
|
@Override
|
||||||
public RecipeSerializer<?> getSerializer() {
|
public RecipeSerializer<?> getSerializer() {
|
||||||
|
@ -107,96 +92,51 @@ public class LiquidFuelRecipe implements Recipe<Container> {
|
||||||
}
|
}
|
||||||
|
|
||||||
public static class Serializer implements RecipeSerializer<LiquidFuelRecipe> {
|
public static class Serializer implements RecipeSerializer<LiquidFuelRecipe> {
|
||||||
@Nonnull
|
private static final Codec<LiquidFuelRecipe> CODEC = RecordCodecBuilder.create(
|
||||||
|
instance -> instance.group(
|
||||||
|
FluidStack.CODEC.fieldOf("fuel").forGetter(recipe -> recipe.fuel),
|
||||||
|
Codec.INT.fieldOf("total_energy").forGetter(recipe -> recipe.burnTime),
|
||||||
|
Codec.INT.fieldOf("burn_time").forGetter(recipe -> recipe.totalEnergy)
|
||||||
|
)
|
||||||
|
.apply(instance, LiquidFuelRecipe::new)
|
||||||
|
);
|
||||||
|
|
||||||
|
// @Nonnull
|
||||||
|
// @Override
|
||||||
|
// public LiquidFuelRecipe fromJson(@Nonnull ResourceLocation pId, JsonObject pJson) {
|
||||||
|
// JsonObject ingredient = pJson.getAsJsonObject("ingredient");
|
||||||
|
//
|
||||||
|
// ResourceLocation fluidRes = new ResourceLocation(GsonHelper.getAsString(ingredient, "fluid"));
|
||||||
|
// Fluid fluid = BuiltInRegistries.FLUIDS.getValue(fluidRes);
|
||||||
|
// if (fluid == null)
|
||||||
|
// throw new JsonParseException("Unknown fluid '" + fluidRes + "'");
|
||||||
|
// int inputAmount = GsonHelper.getAsInt(ingredient, "amount", 50);
|
||||||
|
// FluidStack input = new FluidStack(fluid, inputAmount);
|
||||||
|
//
|
||||||
|
// JsonObject result = pJson.getAsJsonObject("result");
|
||||||
|
// int totalEnergy = result.get("total_energy").getAsInt();
|
||||||
|
// int burnTime = result.get("burn_time").getAsInt();
|
||||||
|
// return new LiquidFuelRecipe(pId, input, totalEnergy, burnTime);
|
||||||
|
// }
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public LiquidFuelRecipe fromJson(@Nonnull ResourceLocation pId, JsonObject pJson) {
|
public Codec<LiquidFuelRecipe> codec() {
|
||||||
JsonObject ingredient = pJson.getAsJsonObject("ingredient");
|
return CODEC;
|
||||||
|
|
||||||
ResourceLocation fluidRes = new ResourceLocation(GsonHelper.getAsString(ingredient, "fluid"));
|
|
||||||
Fluid fluid = ForgeRegistries.FLUIDS.getValue(fluidRes);
|
|
||||||
if (fluid == null)
|
|
||||||
throw new JsonParseException("Unknown fluid '" + fluidRes + "'");
|
|
||||||
int inputAmount = GsonHelper.getAsInt(ingredient, "amount", 50);
|
|
||||||
FluidStack input = new FluidStack(fluid, inputAmount);
|
|
||||||
|
|
||||||
JsonObject result = pJson.getAsJsonObject("result");
|
|
||||||
int totalEnergy = result.get("total_energy").getAsInt();
|
|
||||||
int burnTime = result.get("burn_time").getAsInt();
|
|
||||||
return new LiquidFuelRecipe(pId, input, totalEnergy, burnTime);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public LiquidFuelRecipe fromNetwork(@Nonnull ResourceLocation pId, @Nonnull FriendlyByteBuf pBuffer) {
|
public LiquidFuelRecipe fromNetwork(@Nonnull FriendlyByteBuf pBuffer) {
|
||||||
ResourceLocation inputRes = new ResourceLocation(pBuffer.readUtf());
|
FluidStack input = FluidStack.readFromPacket(pBuffer);
|
||||||
int inputAmount = pBuffer.readInt();
|
|
||||||
Fluid inputFluid = ForgeRegistries.FLUIDS.getValue(inputRes);
|
|
||||||
if(inputFluid == null)
|
|
||||||
throw new JsonParseException("Unknown input fluid '" + inputRes + "'");
|
|
||||||
FluidStack input = new FluidStack(inputFluid, inputAmount);
|
|
||||||
|
|
||||||
int totalEnergy = pBuffer.readInt();
|
int totalEnergy = pBuffer.readInt();
|
||||||
int burnTime = pBuffer.readInt();
|
int burnTime = pBuffer.readInt();
|
||||||
return new LiquidFuelRecipe(pId, input, totalEnergy, burnTime);
|
return new LiquidFuelRecipe(input, totalEnergy, burnTime);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void toNetwork(@Nonnull FriendlyByteBuf pBuffer, LiquidFuelRecipe pRecipe) {
|
public void toNetwork(@Nonnull FriendlyByteBuf pBuffer, LiquidFuelRecipe pRecipe) {
|
||||||
pBuffer.writeUtf(ForgeRegistries.FLUIDS.getKey(pRecipe.fuel.getFluid()).toString());
|
pRecipe.fuel.writeToPacket(pBuffer);
|
||||||
pBuffer.writeInt(pRecipe.fuel.getAmount());
|
|
||||||
pBuffer.writeInt(pRecipe.totalEnergy);
|
pBuffer.writeInt(pRecipe.totalEnergy);
|
||||||
pBuffer.writeInt(pRecipe.burnTime);
|
pBuffer.writeInt(pRecipe.burnTime);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public static class Result implements FinishedRecipe {
|
|
||||||
private FluidStack fuel;
|
|
||||||
private int burnTime;
|
|
||||||
private int totalEnergy;
|
|
||||||
private ResourceLocation id;
|
|
||||||
|
|
||||||
public Result(ResourceLocation id, FluidStack fuel, int totalEnergy, int burnTime) {
|
|
||||||
this.fuel = fuel;
|
|
||||||
this.burnTime = burnTime;
|
|
||||||
this.totalEnergy = totalEnergy;
|
|
||||||
this.id = id;
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public void serializeRecipeData(JsonObject pJson) {
|
|
||||||
JsonObject ingredient = new JsonObject();
|
|
||||||
ingredient.addProperty("fluid", ForgeRegistries.FLUIDS.getKey(fuel.getFluid()).toString());
|
|
||||||
ingredient.addProperty("amount", fuel.getAmount());
|
|
||||||
|
|
||||||
JsonObject result = new JsonObject();
|
|
||||||
result.addProperty("total_energy", totalEnergy);
|
|
||||||
result.addProperty("burn_time", burnTime);
|
|
||||||
|
|
||||||
pJson.add("ingredient", ingredient);
|
|
||||||
pJson.add("result", result);
|
|
||||||
}
|
|
||||||
|
|
||||||
@Nonnull
|
|
||||||
@Override
|
|
||||||
public ResourceLocation getId() {
|
|
||||||
return id;
|
|
||||||
}
|
|
||||||
|
|
||||||
@Nonnull
|
|
||||||
@Override
|
|
||||||
public RecipeSerializer<?> getType() {
|
|
||||||
return ActuallyRecipes.LIQUID_FUEL_RECIPE.get();
|
|
||||||
}
|
|
||||||
|
|
||||||
@Nullable
|
|
||||||
@Override
|
|
||||||
public JsonObject serializeAdvancement() {
|
|
||||||
return null;
|
|
||||||
}
|
|
||||||
|
|
||||||
@Nullable
|
|
||||||
@Override
|
|
||||||
public ResourceLocation getAdvancementId() {
|
|
||||||
return null;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -1,11 +1,9 @@
|
||||||
package de.ellpeck.actuallyadditions.mod.crafting;
|
package de.ellpeck.actuallyadditions.mod.crafting;
|
||||||
|
|
||||||
import com.google.gson.JsonObject;
|
import com.mojang.serialization.Codec;
|
||||||
|
import com.mojang.serialization.codecs.RecordCodecBuilder;
|
||||||
import net.minecraft.core.RegistryAccess;
|
import net.minecraft.core.RegistryAccess;
|
||||||
import net.minecraft.data.recipes.FinishedRecipe;
|
|
||||||
import net.minecraft.network.FriendlyByteBuf;
|
import net.minecraft.network.FriendlyByteBuf;
|
||||||
import net.minecraft.resources.ResourceLocation;
|
|
||||||
import net.minecraft.util.GsonHelper;
|
|
||||||
import net.minecraft.util.random.Weight;
|
import net.minecraft.util.random.Weight;
|
||||||
import net.minecraft.util.random.WeightedEntry;
|
import net.minecraft.util.random.WeightedEntry;
|
||||||
import net.minecraft.world.Container;
|
import net.minecraft.world.Container;
|
||||||
|
@ -14,9 +12,7 @@ import net.minecraft.world.item.crafting.Ingredient;
|
||||||
import net.minecraft.world.item.crafting.Recipe;
|
import net.minecraft.world.item.crafting.Recipe;
|
||||||
import net.minecraft.world.item.crafting.RecipeSerializer;
|
import net.minecraft.world.item.crafting.RecipeSerializer;
|
||||||
import net.minecraft.world.item.crafting.RecipeType;
|
import net.minecraft.world.item.crafting.RecipeType;
|
||||||
import net.minecraft.world.level.ItemLike;
|
|
||||||
import net.minecraft.world.level.Level;
|
import net.minecraft.world.level.Level;
|
||||||
import net.minecraftforge.registries.ForgeRegistries;
|
|
||||||
|
|
||||||
import javax.annotation.Nonnull;
|
import javax.annotation.Nonnull;
|
||||||
import javax.annotation.Nullable;
|
import javax.annotation.Nullable;
|
||||||
|
@ -24,19 +20,16 @@ import javax.annotation.Nullable;
|
||||||
public class MiningLensRecipe implements Recipe<Container>, WeightedEntry {
|
public class MiningLensRecipe implements Recipe<Container>, WeightedEntry {
|
||||||
public static final String NAME = "mining_lens";
|
public static final String NAME = "mining_lens";
|
||||||
|
|
||||||
private final ResourceLocation id;
|
|
||||||
private final int weight;
|
private final int weight;
|
||||||
private final Ingredient input;
|
private final Ingredient input;
|
||||||
//private final int weight;
|
//private final int weight;
|
||||||
private final ItemStack output;
|
private final ItemStack output;
|
||||||
|
|
||||||
public MiningLensRecipe(ResourceLocation id, Ingredient input, int weight, ItemStack output) {
|
public MiningLensRecipe(Ingredient input, int weight, ItemStack output) {
|
||||||
super();
|
|
||||||
this.weight = weight;
|
this.weight = weight;
|
||||||
this.input = input;
|
this.input = input;
|
||||||
//this.weight = weight;
|
//this.weight = weight;
|
||||||
this.output = output;
|
this.output = output;
|
||||||
this.id = id;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public Weight getWeight() {
|
public Weight getWeight() {
|
||||||
|
@ -77,11 +70,6 @@ public class MiningLensRecipe implements Recipe<Container>, WeightedEntry {
|
||||||
return output;
|
return output;
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
|
||||||
public ResourceLocation getId() {
|
|
||||||
return id;
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public RecipeSerializer<?> getSerializer() {
|
public RecipeSerializer<?> getSerializer() {
|
||||||
return ActuallyRecipes.MINING_LENS_RECIPE.get();
|
return ActuallyRecipes.MINING_LENS_RECIPE.get();
|
||||||
|
@ -93,23 +81,38 @@ public class MiningLensRecipe implements Recipe<Container>, WeightedEntry {
|
||||||
}
|
}
|
||||||
|
|
||||||
public static class Serializer implements RecipeSerializer<MiningLensRecipe> {
|
public static class Serializer implements RecipeSerializer<MiningLensRecipe> {
|
||||||
@Override
|
private static final Codec<MiningLensRecipe> CODEC = RecordCodecBuilder.create(
|
||||||
public MiningLensRecipe fromJson(@Nonnull ResourceLocation pRecipeId, @Nonnull JsonObject pJson) {
|
instance -> instance.group(
|
||||||
Ingredient ingredient = Ingredient.fromJson(GsonHelper.getAsJsonObject(pJson, "ingredient"));
|
Ingredient.CODEC_NONEMPTY.fieldOf("ingredient").forGetter(recipe -> recipe.input),
|
||||||
int weight = GsonHelper.getAsInt(pJson, "weight");
|
Codec.INT.fieldOf("weight").forGetter(recipe -> recipe.weight),
|
||||||
JsonObject resultObject = GsonHelper.getAsJsonObject(pJson, "result");
|
ItemStack.RESULT_CODEC.fieldOf("result").forGetter(recipe -> recipe.output)
|
||||||
ItemStack result = new ItemStack(GsonHelper.getAsItem(resultObject, "item"));
|
)
|
||||||
|
.apply(instance, MiningLensRecipe::new)
|
||||||
|
);
|
||||||
|
|
||||||
return new MiningLensRecipe(pRecipeId, ingredient, weight, result);
|
// @Override
|
||||||
|
// public MiningLensRecipe fromJson(@Nonnull ResourceLocation pRecipeId, @Nonnull JsonObject pJson) {
|
||||||
|
// Ingredient ingredient = Ingredient.fromJson(GsonHelper.getAsJsonObject(pJson, "ingredient"));
|
||||||
|
// int weight = GsonHelper.getAsInt(pJson, "weight");
|
||||||
|
// JsonObject resultObject = GsonHelper.getAsJsonObject(pJson, "result");
|
||||||
|
// ItemStack result = new ItemStack(GsonHelper.getAsItem(resultObject, "item"));
|
||||||
|
//
|
||||||
|
// return new MiningLensRecipe(pRecipeId, ingredient, weight, result);
|
||||||
|
// }
|
||||||
|
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public Codec<MiningLensRecipe> codec() {
|
||||||
|
return CODEC;
|
||||||
}
|
}
|
||||||
|
|
||||||
@Nullable
|
@Nullable
|
||||||
@Override
|
@Override
|
||||||
public MiningLensRecipe fromNetwork(@Nonnull ResourceLocation pRecipeId, @Nonnull FriendlyByteBuf pBuffer) {
|
public MiningLensRecipe fromNetwork(@Nonnull FriendlyByteBuf pBuffer) {
|
||||||
Ingredient ingredient = Ingredient.fromNetwork(pBuffer);
|
Ingredient ingredient = Ingredient.fromNetwork(pBuffer);
|
||||||
int weight = pBuffer.readInt();
|
int weight = pBuffer.readInt();
|
||||||
ItemStack result = pBuffer.readItem();
|
ItemStack result = pBuffer.readItem();
|
||||||
return new MiningLensRecipe(pRecipeId, ingredient, weight, result);
|
return new MiningLensRecipe(ingredient, weight, result);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
@ -119,51 +122,4 @@ public class MiningLensRecipe implements Recipe<Container>, WeightedEntry {
|
||||||
pBuffer.writeItem(pRecipe.output);
|
pBuffer.writeItem(pRecipe.output);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public static class Result implements FinishedRecipe {
|
|
||||||
private final ResourceLocation id;
|
|
||||||
private final Ingredient itemIngredient;
|
|
||||||
private final int weight;
|
|
||||||
private final ItemLike output;
|
|
||||||
|
|
||||||
public Result(ResourceLocation id, Ingredient itemIngredient, int weight, ItemLike output) {
|
|
||||||
this.id = id;
|
|
||||||
this.itemIngredient = itemIngredient;
|
|
||||||
this.weight = weight;
|
|
||||||
this.output = output;
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public void serializeRecipeData(JsonObject pJson) {
|
|
||||||
pJson.add("ingredient", itemIngredient.toJson());
|
|
||||||
pJson.addProperty("weight", weight);
|
|
||||||
|
|
||||||
JsonObject resultObject = new JsonObject();
|
|
||||||
resultObject.addProperty("item", ForgeRegistries.ITEMS.getKey(output.asItem()).toString());
|
|
||||||
|
|
||||||
pJson.add("result", resultObject);
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public ResourceLocation getId() {
|
|
||||||
return id;
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public RecipeSerializer<?> getType() {
|
|
||||||
return ActuallyRecipes.MINING_LENS_RECIPE.get();
|
|
||||||
}
|
|
||||||
|
|
||||||
@Nullable
|
|
||||||
@Override
|
|
||||||
public JsonObject serializeAdvancement() {
|
|
||||||
return null;
|
|
||||||
}
|
|
||||||
|
|
||||||
@Nullable
|
|
||||||
@Override
|
|
||||||
public ResourceLocation getAdvancementId() {
|
|
||||||
return null;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -1,12 +1,9 @@
|
||||||
package de.ellpeck.actuallyadditions.mod.crafting;
|
package de.ellpeck.actuallyadditions.mod.crafting;
|
||||||
|
|
||||||
import com.google.gson.JsonObject;
|
import com.mojang.serialization.Codec;
|
||||||
import com.google.gson.JsonParseException;
|
import com.mojang.serialization.codecs.RecordCodecBuilder;
|
||||||
import net.minecraft.core.RegistryAccess;
|
import net.minecraft.core.RegistryAccess;
|
||||||
import net.minecraft.data.recipes.FinishedRecipe;
|
|
||||||
import net.minecraft.network.FriendlyByteBuf;
|
import net.minecraft.network.FriendlyByteBuf;
|
||||||
import net.minecraft.resources.ResourceLocation;
|
|
||||||
import net.minecraft.util.GsonHelper;
|
|
||||||
import net.minecraft.world.Container;
|
import net.minecraft.world.Container;
|
||||||
import net.minecraft.world.item.ItemStack;
|
import net.minecraft.world.item.ItemStack;
|
||||||
import net.minecraft.world.item.crafting.Ingredient;
|
import net.minecraft.world.item.crafting.Ingredient;
|
||||||
|
@ -14,21 +11,17 @@ import net.minecraft.world.item.crafting.Recipe;
|
||||||
import net.minecraft.world.item.crafting.RecipeSerializer;
|
import net.minecraft.world.item.crafting.RecipeSerializer;
|
||||||
import net.minecraft.world.item.crafting.RecipeType;
|
import net.minecraft.world.item.crafting.RecipeType;
|
||||||
import net.minecraft.world.level.Level;
|
import net.minecraft.world.level.Level;
|
||||||
import net.minecraft.world.level.material.Fluid;
|
import net.neoforged.neoforge.fluids.FluidStack;
|
||||||
import net.minecraftforge.fluids.FluidStack;
|
|
||||||
import net.minecraftforge.registries.ForgeRegistries;
|
|
||||||
|
|
||||||
import javax.annotation.Nonnull;
|
import javax.annotation.Nonnull;
|
||||||
import javax.annotation.Nullable;
|
import javax.annotation.Nullable;
|
||||||
|
|
||||||
public class PressingRecipe implements Recipe<Container> {
|
public class PressingRecipe implements Recipe<Container> {
|
||||||
public static final String NAME = "pressing";
|
public static final String NAME = "pressing";
|
||||||
private final ResourceLocation ID;
|
|
||||||
private final Ingredient input;
|
private final Ingredient input;
|
||||||
private final FluidStack output;
|
private final FluidStack output;
|
||||||
|
|
||||||
public PressingRecipe(ResourceLocation ID, Ingredient input, FluidStack output) {
|
public PressingRecipe(Ingredient input, FluidStack output) {
|
||||||
this.ID = ID;
|
|
||||||
this.input = input;
|
this.input = input;
|
||||||
this.output = output;
|
this.output = output;
|
||||||
}
|
}
|
||||||
|
@ -62,11 +55,6 @@ public class PressingRecipe implements Recipe<Container> {
|
||||||
return ItemStack.EMPTY;
|
return ItemStack.EMPTY;
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
|
||||||
public ResourceLocation getId() {
|
|
||||||
return ID;
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public RecipeSerializer<?> getSerializer() {
|
public RecipeSerializer<?> getSerializer() {
|
||||||
return ActuallyRecipes.PRESSING_RECIPE.get();
|
return ActuallyRecipes.PRESSING_RECIPE.get();
|
||||||
|
@ -78,82 +66,47 @@ public class PressingRecipe implements Recipe<Container> {
|
||||||
}
|
}
|
||||||
|
|
||||||
public static class Serializer implements RecipeSerializer<PressingRecipe> {
|
public static class Serializer implements RecipeSerializer<PressingRecipe> {
|
||||||
@Nonnull
|
private static final Codec<PressingRecipe> CODEC = RecordCodecBuilder.create(
|
||||||
@Override
|
instance -> instance.group(
|
||||||
public PressingRecipe fromJson(@Nonnull ResourceLocation pRecipeId, @Nonnull JsonObject pJson) {
|
Ingredient.CODEC_NONEMPTY.fieldOf("ingredient").forGetter(recipe -> recipe.input),
|
||||||
Ingredient ingredient = Ingredient.fromJson(GsonHelper.getAsJsonObject(pJson, "ingredient"));
|
FluidStack.CODEC.fieldOf("fluid").forGetter(recipe -> recipe.output)
|
||||||
JsonObject result = pJson.getAsJsonObject("result");
|
)
|
||||||
ResourceLocation fluidRes = new ResourceLocation(GsonHelper.getAsString(result, "fluid"));
|
.apply(instance, PressingRecipe::new)
|
||||||
int fluidAmount = GsonHelper.getAsInt(result, "amount");
|
);
|
||||||
Fluid fluid = ForgeRegistries.FLUIDS.getValue(fluidRes);
|
|
||||||
if(fluid == null)
|
|
||||||
throw new JsonParseException("Unknown fluid '" + fluidRes + "'");
|
|
||||||
FluidStack output = new FluidStack(fluid, fluidAmount);
|
|
||||||
|
|
||||||
return new PressingRecipe(pRecipeId, ingredient, output);
|
// @Nonnull
|
||||||
|
// @Override
|
||||||
|
// public PressingRecipe fromJson(@Nonnull ResourceLocation pRecipeId, @Nonnull JsonObject pJson) {
|
||||||
|
// Ingredient ingredient = Ingredient.fromJson(GsonHelper.getAsJsonObject(pJson, "ingredient"));
|
||||||
|
// JsonObject result = pJson.getAsJsonObject("result");
|
||||||
|
// ResourceLocation fluidRes = new ResourceLocation(GsonHelper.getAsString(result, "fluid"));
|
||||||
|
// int fluidAmount = GsonHelper.getAsInt(result, "amount");
|
||||||
|
// Fluid fluid = BuiltInRegistries.FLUIDS.getValue(fluidRes);
|
||||||
|
// if(fluid == null)
|
||||||
|
// throw new JsonParseException("Unknown fluid '" + fluidRes + "'");
|
||||||
|
// FluidStack output = new FluidStack(fluid, fluidAmount);
|
||||||
|
//
|
||||||
|
// return new PressingRecipe(pRecipeId, ingredient, output);
|
||||||
|
// }
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public Codec<PressingRecipe> codec() {
|
||||||
|
return CODEC;
|
||||||
}
|
}
|
||||||
|
|
||||||
@Nullable
|
@Nullable
|
||||||
@Override
|
@Override
|
||||||
public PressingRecipe fromNetwork(@Nonnull ResourceLocation pRecipeId, @Nonnull FriendlyByteBuf pBuffer) {
|
public PressingRecipe fromNetwork(@Nonnull FriendlyByteBuf pBuffer) {
|
||||||
Ingredient ingredient = Ingredient.fromNetwork(pBuffer);
|
Ingredient ingredient = Ingredient.fromNetwork(pBuffer);
|
||||||
ResourceLocation fluidRes = new ResourceLocation(pBuffer.readUtf());
|
FluidStack output = FluidStack.readFromPacket(pBuffer);
|
||||||
int fluidAmount = pBuffer.readInt();
|
|
||||||
Fluid fluid = ForgeRegistries.FLUIDS.getValue(fluidRes);
|
|
||||||
if(fluid == null)
|
|
||||||
throw new JsonParseException("Unknown fluid '" + fluidRes + "'");
|
|
||||||
FluidStack output = new FluidStack(fluid, fluidAmount);
|
|
||||||
|
|
||||||
return new PressingRecipe(pRecipeId, ingredient, output);
|
return new PressingRecipe(ingredient, output);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void toNetwork(@Nonnull FriendlyByteBuf pBuffer, @Nonnull PressingRecipe pRecipe) {
|
public void toNetwork(@Nonnull FriendlyByteBuf pBuffer, @Nonnull PressingRecipe pRecipe) {
|
||||||
pRecipe.input.toNetwork(pBuffer);
|
pRecipe.input.toNetwork(pBuffer);
|
||||||
pBuffer.writeUtf(ForgeRegistries.FLUIDS.getKey(pRecipe.output.getFluid()).toString());
|
pRecipe.output.writeToPacket(pBuffer);
|
||||||
pBuffer.writeInt(pRecipe.output.getAmount());
|
|
||||||
}
|
|
||||||
}
|
|
||||||
public static class Result implements FinishedRecipe {
|
|
||||||
private final ResourceLocation ID;
|
|
||||||
private final Ingredient input;
|
|
||||||
private final FluidStack output;
|
|
||||||
|
|
||||||
public Result(ResourceLocation ID, Ingredient input, FluidStack output) {
|
|
||||||
this.ID = ID;
|
|
||||||
this.input = input;
|
|
||||||
this.output = output;
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public void serializeRecipeData(JsonObject pJson) {
|
|
||||||
pJson.add("ingredient", input.toJson());
|
|
||||||
JsonObject result = new JsonObject();
|
|
||||||
result.addProperty("fluid", ForgeRegistries.FLUIDS.getKey(output.getFluid()).toString());
|
|
||||||
result.addProperty("amount", output.getAmount());
|
|
||||||
pJson.add("result", result);
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public ResourceLocation getId() {
|
|
||||||
return ID;
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public RecipeSerializer<?> getType() {
|
|
||||||
return ActuallyRecipes.PRESSING_RECIPE.get();
|
|
||||||
}
|
|
||||||
|
|
||||||
@Nullable
|
|
||||||
@Override
|
|
||||||
public JsonObject serializeAdvancement() {
|
|
||||||
return null;
|
|
||||||
}
|
|
||||||
|
|
||||||
@Nullable
|
|
||||||
@Override
|
|
||||||
public ResourceLocation getAdvancementId() {
|
|
||||||
return null;
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -1,10 +1,9 @@
|
||||||
package de.ellpeck.actuallyadditions.mod.crafting;
|
package de.ellpeck.actuallyadditions.mod.crafting;
|
||||||
|
|
||||||
import com.google.gson.JsonObject;
|
import com.mojang.serialization.Codec;
|
||||||
|
import com.mojang.serialization.codecs.RecordCodecBuilder;
|
||||||
import net.minecraft.core.RegistryAccess;
|
import net.minecraft.core.RegistryAccess;
|
||||||
import net.minecraft.data.recipes.FinishedRecipe;
|
|
||||||
import net.minecraft.network.FriendlyByteBuf;
|
import net.minecraft.network.FriendlyByteBuf;
|
||||||
import net.minecraft.resources.ResourceLocation;
|
|
||||||
import net.minecraft.world.item.ItemStack;
|
import net.minecraft.world.item.ItemStack;
|
||||||
import net.minecraft.world.item.crafting.Ingredient;
|
import net.minecraft.world.item.crafting.Ingredient;
|
||||||
import net.minecraft.world.item.crafting.Recipe;
|
import net.minecraft.world.item.crafting.Recipe;
|
||||||
|
@ -12,20 +11,16 @@ import net.minecraft.world.item.crafting.RecipeSerializer;
|
||||||
import net.minecraft.world.item.crafting.RecipeType;
|
import net.minecraft.world.item.crafting.RecipeType;
|
||||||
import net.minecraft.world.level.Level;
|
import net.minecraft.world.level.Level;
|
||||||
|
|
||||||
import javax.annotation.Nullable;
|
|
||||||
|
|
||||||
public class SolidFuelRecipe implements Recipe<SingleItem> {
|
public class SolidFuelRecipe implements Recipe<SingleItem> {
|
||||||
public static String NAME = "solid_fuel";
|
public static String NAME = "solid_fuel";
|
||||||
private Ingredient itemIngredient;
|
private Ingredient itemIngredient;
|
||||||
private int burnTime;
|
private int burnTime;
|
||||||
private int totalEnergy;
|
private int totalEnergy;
|
||||||
private ResourceLocation id;
|
|
||||||
|
|
||||||
public SolidFuelRecipe(ResourceLocation id, Ingredient itemIngredient, int totalEnergy, int burnTime) {
|
public SolidFuelRecipe(Ingredient itemIngredient, int totalEnergy, int burnTime) {
|
||||||
this.itemIngredient = itemIngredient;
|
this.itemIngredient = itemIngredient;
|
||||||
this.burnTime = burnTime;
|
this.burnTime = burnTime;
|
||||||
this.totalEnergy = totalEnergy;
|
this.totalEnergy = totalEnergy;
|
||||||
this.id = id;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public int getBurnTime() {
|
public int getBurnTime() {
|
||||||
|
@ -65,11 +60,6 @@ public class SolidFuelRecipe implements Recipe<SingleItem> {
|
||||||
return ItemStack.EMPTY;
|
return ItemStack.EMPTY;
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
|
||||||
public ResourceLocation getId() {
|
|
||||||
return id;
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public RecipeSerializer<?> getSerializer() {
|
public RecipeSerializer<?> getSerializer() {
|
||||||
return ActuallyRecipes.SOLID_FUEL_RECIPE.get();
|
return ActuallyRecipes.SOLID_FUEL_RECIPE.get();
|
||||||
|
@ -81,20 +71,35 @@ public class SolidFuelRecipe implements Recipe<SingleItem> {
|
||||||
}
|
}
|
||||||
|
|
||||||
public static class Serializer implements RecipeSerializer<SolidFuelRecipe> {
|
public static class Serializer implements RecipeSerializer<SolidFuelRecipe> {
|
||||||
|
private static final Codec<SolidFuelRecipe> CODEC = RecordCodecBuilder.create(
|
||||||
|
instance -> instance.group(
|
||||||
|
Ingredient.CODEC_NONEMPTY.fieldOf("item").forGetter(recipe -> recipe.itemIngredient),
|
||||||
|
Codec.INT.fieldOf("total_energy").forGetter(recipe -> recipe.totalEnergy),
|
||||||
|
Codec.INT.fieldOf("burn_time").forGetter(recipe -> recipe.burnTime)
|
||||||
|
)
|
||||||
|
.apply(instance, SolidFuelRecipe::new)
|
||||||
|
);
|
||||||
|
|
||||||
|
// @Override
|
||||||
|
// public SolidFuelRecipe fromJson(ResourceLocation pId, JsonObject pJson) {
|
||||||
|
// Ingredient itemIngredient = Ingredient.fromJson(pJson.get("item"));
|
||||||
|
// int totalEnergy = pJson.get("total_energy").getAsInt();
|
||||||
|
// int burnTime = pJson.get("burn_time").getAsInt();
|
||||||
|
// return new SolidFuelRecipe(pId, itemIngredient, totalEnergy, burnTime);
|
||||||
|
// }
|
||||||
|
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public SolidFuelRecipe fromJson(ResourceLocation pId, JsonObject pJson) {
|
public Codec<SolidFuelRecipe> codec() {
|
||||||
Ingredient itemIngredient = Ingredient.fromJson(pJson.get("item"));
|
return CODEC;
|
||||||
int totalEnergy = pJson.get("total_energy").getAsInt();
|
|
||||||
int burnTime = pJson.get("burn_time").getAsInt();
|
|
||||||
return new SolidFuelRecipe(pId, itemIngredient, totalEnergy, burnTime);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public SolidFuelRecipe fromNetwork(ResourceLocation pId, FriendlyByteBuf pBuffer) {
|
public SolidFuelRecipe fromNetwork(FriendlyByteBuf pBuffer) {
|
||||||
Ingredient itemIngredient = Ingredient.fromNetwork(pBuffer);
|
Ingredient itemIngredient = Ingredient.fromNetwork(pBuffer);
|
||||||
int totalEnergy = pBuffer.readInt();
|
int totalEnergy = pBuffer.readInt();
|
||||||
int burnTime = pBuffer.readInt();
|
int burnTime = pBuffer.readInt();
|
||||||
return new SolidFuelRecipe(pId, itemIngredient, totalEnergy, burnTime);
|
return new SolidFuelRecipe(itemIngredient, totalEnergy, burnTime);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
@ -104,47 +109,4 @@ public class SolidFuelRecipe implements Recipe<SingleItem> {
|
||||||
pBuffer.writeInt(pRecipe.burnTime);
|
pBuffer.writeInt(pRecipe.burnTime);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public static class Result implements FinishedRecipe {
|
|
||||||
private Ingredient itemIngredient;
|
|
||||||
private int burnTime;
|
|
||||||
private int totalEnergy;
|
|
||||||
private ResourceLocation id;
|
|
||||||
|
|
||||||
public Result(ResourceLocation id, Ingredient itemIngredient, int totalEnergy, int burnTime) {
|
|
||||||
this.itemIngredient = itemIngredient;
|
|
||||||
this.burnTime = burnTime;
|
|
||||||
this.totalEnergy = totalEnergy;
|
|
||||||
this.id = id;
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public void serializeRecipeData(JsonObject pJson) {
|
|
||||||
pJson.add("item", itemIngredient.toJson());
|
|
||||||
pJson.addProperty("total_energy", totalEnergy);
|
|
||||||
pJson.addProperty("burn_time", burnTime);
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public ResourceLocation getId() {
|
|
||||||
return id;
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public RecipeSerializer<?> getType() {
|
|
||||||
return ActuallyRecipes.SOLID_FUEL_RECIPE.get();
|
|
||||||
}
|
|
||||||
|
|
||||||
@Nullable
|
|
||||||
@Override
|
|
||||||
public JsonObject serializeAdvancement() {
|
|
||||||
return null;
|
|
||||||
}
|
|
||||||
|
|
||||||
@Nullable
|
|
||||||
@Override
|
|
||||||
public ResourceLocation getAdvancementId() {
|
|
||||||
return null;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -1,75 +1,75 @@
|
||||||
package de.ellpeck.actuallyadditions.mod.crafting;
|
//package de.ellpeck.actuallyadditions.mod.crafting;
|
||||||
|
//
|
||||||
import com.google.gson.JsonElement;
|
//import com.google.gson.JsonElement;
|
||||||
import com.google.gson.JsonObject;
|
//import com.google.gson.JsonObject;
|
||||||
import de.ellpeck.actuallyadditions.mod.ActuallyAdditions;
|
//import de.ellpeck.actuallyadditions.mod.ActuallyAdditions;
|
||||||
import net.minecraft.network.FriendlyByteBuf;
|
//import net.minecraft.network.FriendlyByteBuf;
|
||||||
import net.minecraft.resources.ResourceLocation;
|
//import net.minecraft.resources.ResourceLocation;
|
||||||
import net.minecraft.tags.TagKey;
|
//import net.minecraft.tags.TagKey;
|
||||||
import net.minecraft.world.item.ItemStack;
|
//import net.minecraft.world.item.ItemStack;
|
||||||
import net.minecraft.world.item.crafting.Ingredient;
|
//import net.minecraft.world.item.crafting.Ingredient;
|
||||||
import net.minecraft.world.level.ItemLike;
|
//import net.minecraft.world.level.ItemLike;
|
||||||
import net.minecraftforge.common.crafting.IIngredientSerializer;
|
//import net.neoforged.neoforge.common.crafting.IIngredientSerializer;
|
||||||
|
//
|
||||||
import javax.annotation.Nonnull;
|
//import javax.annotation.Nonnull;
|
||||||
import java.util.stream.Stream;
|
//import java.util.stream.Stream;
|
||||||
|
//
|
||||||
public class TargetNBTIngredient extends Ingredient {
|
//public class TargetNBTIngredient extends Ingredient { TODO: FLANKS PLEASE :D
|
||||||
public TargetNBTIngredient(Stream<? extends Value> itemLists) {
|
// public TargetNBTIngredient(Stream<? extends Value> itemLists) {
|
||||||
super(itemLists);
|
// super(itemLists);
|
||||||
}
|
// }
|
||||||
|
//
|
||||||
@Override
|
// @Override
|
||||||
@Nonnull
|
// @Nonnull
|
||||||
public IIngredientSerializer<? extends Ingredient> getSerializer() {
|
// public IIngredientSerializer<? extends Ingredient> getSerializer() {
|
||||||
return SERIALIZER;
|
// return SERIALIZER;
|
||||||
}
|
// }
|
||||||
|
//
|
||||||
public static TargetNBTIngredient of(ItemLike itemProvider) {
|
// public static TargetNBTIngredient of(ItemLike itemProvider) {
|
||||||
return new TargetNBTIngredient(Stream.of(new ItemValue(new ItemStack(itemProvider))));
|
// return new TargetNBTIngredient(Stream.of(new ItemValue(new ItemStack(itemProvider))));
|
||||||
}
|
// }
|
||||||
public static TargetNBTIngredient of(ItemStack itemStack) {
|
// public static TargetNBTIngredient of(ItemStack itemStack) {
|
||||||
return new TargetNBTIngredient(Stream.of(new ItemValue(itemStack)));
|
// return new TargetNBTIngredient(Stream.of(new ItemValue(itemStack)));
|
||||||
}
|
// }
|
||||||
@Nonnull
|
// @Nonnull
|
||||||
public static TargetNBTIngredient of(@Nonnull TagKey tag) {
|
// public static TargetNBTIngredient of(@Nonnull TagKey tag) {
|
||||||
return new TargetNBTIngredient(Stream.of(new TagValue(tag)));
|
// return new TargetNBTIngredient(Stream.of(new TagValue(tag)));
|
||||||
}
|
// }
|
||||||
|
//
|
||||||
|
//
|
||||||
|
//
|
||||||
@Override
|
// @Override
|
||||||
@Nonnull
|
// @Nonnull
|
||||||
public JsonElement toJson() {
|
// public JsonElement toJson() {
|
||||||
JsonObject tmp = super.toJson().getAsJsonObject();
|
// JsonObject tmp = super.toJson().getAsJsonObject();
|
||||||
tmp.addProperty("type", Serializer.NAME.toString());
|
// tmp.addProperty("type", Serializer.NAME.toString());
|
||||||
return tmp;
|
// return tmp;
|
||||||
}
|
// }
|
||||||
|
//
|
||||||
|
//
|
||||||
public static Serializer SERIALIZER = new Serializer();
|
// public static Serializer SERIALIZER = new Serializer();
|
||||||
public static class Serializer implements IIngredientSerializer<TargetNBTIngredient> {
|
// public static class Serializer implements IIngredientSerializer<TargetNBTIngredient> {
|
||||||
public static ResourceLocation NAME = new ResourceLocation(ActuallyAdditions.MODID, "nbt_target");
|
// public static ResourceLocation NAME = new ResourceLocation(ActuallyAdditions.MODID, "nbt_target");
|
||||||
|
//
|
||||||
@Override
|
// @Override
|
||||||
@Nonnull
|
// @Nonnull
|
||||||
public TargetNBTIngredient parse(FriendlyByteBuf buffer) {
|
// public TargetNBTIngredient parse(FriendlyByteBuf buffer) {
|
||||||
return new TargetNBTIngredient(Stream.generate(() -> new ItemValue(buffer.readItem())).limit(buffer.readVarInt()));
|
// return new TargetNBTIngredient(Stream.generate(() -> new ItemValue(buffer.readItem())).limit(buffer.readVarInt()));
|
||||||
}
|
// }
|
||||||
|
//
|
||||||
@Override
|
// @Override
|
||||||
@Nonnull
|
// @Nonnull
|
||||||
public TargetNBTIngredient parse(@Nonnull JsonObject json) {
|
// public TargetNBTIngredient parse(@Nonnull JsonObject json) {
|
||||||
return new TargetNBTIngredient(Stream.of(Ingredient.valueFromJson(json)));
|
// return new TargetNBTIngredient(Stream.of(Ingredient.valueFromJson(json)));
|
||||||
}
|
// }
|
||||||
|
//
|
||||||
@Override
|
// @Override
|
||||||
public void write(FriendlyByteBuf buffer, TargetNBTIngredient ingredient) {
|
// public void write(FriendlyByteBuf buffer, TargetNBTIngredient ingredient) {
|
||||||
ItemStack[] items = ingredient.getItems();
|
// ItemStack[] items = ingredient.getItems();
|
||||||
buffer.writeVarInt(items.length);
|
// buffer.writeVarInt(items.length);
|
||||||
|
//
|
||||||
for (ItemStack stack : items)
|
// for (ItemStack stack : items)
|
||||||
buffer.writeItem(stack);
|
// buffer.writeItem(stack);
|
||||||
}
|
// }
|
||||||
}
|
// }
|
||||||
}
|
//}
|
||||||
|
|
|
@ -4,7 +4,7 @@ import com.google.gson.JsonObject;
|
||||||
import net.minecraft.data.recipes.FinishedRecipe;
|
import net.minecraft.data.recipes.FinishedRecipe;
|
||||||
import net.minecraft.resources.ResourceLocation;
|
import net.minecraft.resources.ResourceLocation;
|
||||||
import net.minecraft.world.item.crafting.RecipeSerializer;
|
import net.minecraft.world.item.crafting.RecipeSerializer;
|
||||||
import net.minecraftforge.registries.ForgeRegistries;
|
import net.neoforged.neoforge.registries.BuiltInRegistries;
|
||||||
|
|
||||||
import javax.annotation.Nullable;
|
import javax.annotation.Nullable;
|
||||||
import java.util.function.Consumer;
|
import java.util.function.Consumer;
|
||||||
|
@ -36,9 +36,9 @@ public class WrappedRecipe implements FinishedRecipe {
|
||||||
JsonObject jsonObject = new JsonObject();
|
JsonObject jsonObject = new JsonObject();
|
||||||
|
|
||||||
if (serializerOverride != null)
|
if (serializerOverride != null)
|
||||||
jsonObject.addProperty("type", ForgeRegistries.RECIPE_SERIALIZERS.getKey(serializerOverride).toString());
|
jsonObject.addProperty("type", BuiltInRegistries.RECIPE_SERIALIZERS.getKey(serializerOverride).toString());
|
||||||
else
|
else
|
||||||
jsonObject.addProperty("type", ForgeRegistries.RECIPE_SERIALIZERS.getKey(inner.getType()).toString());
|
jsonObject.addProperty("type", BuiltInRegistries.RECIPE_SERIALIZERS.getKey(inner.getType()).toString());
|
||||||
serializeRecipeData(jsonObject);
|
serializeRecipeData(jsonObject);
|
||||||
return jsonObject;
|
return jsonObject;
|
||||||
}
|
}
|
||||||
|
|
|
@ -13,8 +13,6 @@ package de.ellpeck.actuallyadditions.mod.entity;
|
||||||
import de.ellpeck.actuallyadditions.mod.config.CommonConfig;
|
import de.ellpeck.actuallyadditions.mod.config.CommonConfig;
|
||||||
import net.minecraft.core.BlockPos;
|
import net.minecraft.core.BlockPos;
|
||||||
import net.minecraft.nbt.CompoundTag;
|
import net.minecraft.nbt.CompoundTag;
|
||||||
import net.minecraft.network.protocol.Packet;
|
|
||||||
import net.minecraft.network.protocol.game.ClientGamePacketListener;
|
|
||||||
import net.minecraft.server.level.ServerLevel;
|
import net.minecraft.server.level.ServerLevel;
|
||||||
import net.minecraft.world.entity.Entity;
|
import net.minecraft.world.entity.Entity;
|
||||||
import net.minecraft.world.entity.EntityType;
|
import net.minecraft.world.entity.EntityType;
|
||||||
|
@ -27,10 +25,9 @@ import net.minecraft.world.level.block.FarmBlock;
|
||||||
import net.minecraft.world.level.block.GrassBlock;
|
import net.minecraft.world.level.block.GrassBlock;
|
||||||
import net.minecraft.world.level.block.state.BlockState;
|
import net.minecraft.world.level.block.state.BlockState;
|
||||||
import net.minecraft.world.phys.AABB;
|
import net.minecraft.world.phys.AABB;
|
||||||
import net.minecraftforge.common.FarmlandWaterManager;
|
import net.neoforged.neoforge.common.FarmlandWaterManager;
|
||||||
import net.minecraftforge.common.IPlantable;
|
import net.neoforged.neoforge.common.IPlantable;
|
||||||
import net.minecraftforge.common.ticket.AABBTicket;
|
import net.neoforged.neoforge.common.ticket.AABBTicket;
|
||||||
import net.minecraftforge.network.NetworkHooks;
|
|
||||||
|
|
||||||
public class EntityWorm extends Entity {
|
public class EntityWorm extends Entity {
|
||||||
|
|
||||||
|
@ -164,9 +161,4 @@ public class EntityWorm extends Entity {
|
||||||
protected void addAdditionalSaveData(CompoundTag compound) {
|
protected void addAdditionalSaveData(CompoundTag compound) {
|
||||||
compound.putInt("Timer", this.timer);
|
compound.putInt("Timer", this.timer);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
|
||||||
public Packet<ClientGamePacketListener> getAddEntityPacket() {
|
|
||||||
return NetworkHooks.getEntitySpawningPacket(this);
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -11,8 +11,8 @@
|
||||||
package de.ellpeck.actuallyadditions.mod.entity;
|
package de.ellpeck.actuallyadditions.mod.entity;
|
||||||
|
|
||||||
import de.ellpeck.actuallyadditions.mod.ActuallyAdditions;
|
import de.ellpeck.actuallyadditions.mod.ActuallyAdditions;
|
||||||
import net.minecraftforge.api.distmarker.Dist;
|
import net.neoforged.api.distmarker.Dist;
|
||||||
import net.minecraftforge.api.distmarker.OnlyIn;
|
import net.neoforged.api.distmarker.OnlyIn;
|
||||||
|
|
||||||
|
|
||||||
public final class InitEntities {
|
public final class InitEntities {
|
||||||
|
|
|
@ -24,8 +24,8 @@ import net.minecraft.resources.ResourceLocation;
|
||||||
import net.minecraft.world.inventory.InventoryMenu;
|
import net.minecraft.world.inventory.InventoryMenu;
|
||||||
import net.minecraft.world.item.ItemDisplayContext;
|
import net.minecraft.world.item.ItemDisplayContext;
|
||||||
import net.minecraft.world.item.ItemStack;
|
import net.minecraft.world.item.ItemStack;
|
||||||
import net.minecraftforge.api.distmarker.Dist;
|
import net.neoforged.api.distmarker.Dist;
|
||||||
import net.minecraftforge.api.distmarker.OnlyIn;
|
import net.neoforged.api.distmarker.OnlyIn;
|
||||||
|
|
||||||
|
|
||||||
@OnlyIn(Dist.CLIENT)
|
@OnlyIn(Dist.CLIENT)
|
||||||
|
|
|
@ -33,13 +33,13 @@ import net.minecraft.world.level.block.Block;
|
||||||
import net.minecraft.world.level.block.entity.BlockEntity;
|
import net.minecraft.world.level.block.entity.BlockEntity;
|
||||||
import net.minecraft.world.phys.BlockHitResult;
|
import net.minecraft.world.phys.BlockHitResult;
|
||||||
import net.minecraft.world.phys.HitResult;
|
import net.minecraft.world.phys.HitResult;
|
||||||
import net.minecraftforge.api.distmarker.Dist;
|
import net.neoforged.api.distmarker.Dist;
|
||||||
import net.minecraftforge.api.distmarker.OnlyIn;
|
import net.neoforged.api.distmarker.OnlyIn;
|
||||||
import net.minecraftforge.client.event.RenderGuiOverlayEvent;
|
import net.neoforged.bus.api.SubscribeEvent;
|
||||||
import net.minecraftforge.client.gui.overlay.GuiOverlayManager;
|
import net.neoforged.neoforge.client.event.RenderGuiOverlayEvent;
|
||||||
import net.minecraftforge.event.TickEvent;
|
import net.neoforged.neoforge.client.gui.overlay.GuiOverlayManager;
|
||||||
import net.minecraftforge.event.entity.player.ItemTooltipEvent;
|
import net.neoforged.neoforge.event.TickEvent;
|
||||||
import net.minecraftforge.eventbus.api.SubscribeEvent;
|
import net.neoforged.neoforge.event.entity.player.ItemTooltipEvent;
|
||||||
|
|
||||||
@OnlyIn(Dist.CLIENT)
|
@OnlyIn(Dist.CLIENT)
|
||||||
public class ClientEvents {
|
public class ClientEvents {
|
||||||
|
|
|
@ -23,6 +23,7 @@ import de.ellpeck.actuallyadditions.mod.tile.FilterSettings;
|
||||||
import de.ellpeck.actuallyadditions.mod.util.ItemStackHandlerAA;
|
import de.ellpeck.actuallyadditions.mod.util.ItemStackHandlerAA;
|
||||||
import de.ellpeck.actuallyadditions.mod.util.ItemUtil;
|
import de.ellpeck.actuallyadditions.mod.util.ItemUtil;
|
||||||
import de.ellpeck.actuallyadditions.mod.util.StackUtil;
|
import de.ellpeck.actuallyadditions.mod.util.StackUtil;
|
||||||
|
import net.minecraft.core.registries.BuiltInRegistries;
|
||||||
import net.minecraft.server.level.ServerPlayer;
|
import net.minecraft.server.level.ServerPlayer;
|
||||||
import net.minecraft.world.entity.item.ItemEntity;
|
import net.minecraft.world.entity.item.ItemEntity;
|
||||||
import net.minecraft.world.entity.monster.Spider;
|
import net.minecraft.world.entity.monster.Spider;
|
||||||
|
@ -30,13 +31,12 @@ import net.minecraft.world.entity.player.Player;
|
||||||
import net.minecraft.world.item.ItemStack;
|
import net.minecraft.world.item.ItemStack;
|
||||||
import net.minecraft.world.level.block.Blocks;
|
import net.minecraft.world.level.block.Blocks;
|
||||||
import net.minecraft.world.level.block.state.BlockState;
|
import net.minecraft.world.level.block.state.BlockState;
|
||||||
import net.minecraftforge.event.entity.living.LivingDropsEvent;
|
import net.neoforged.bus.api.Event;
|
||||||
import net.minecraftforge.event.entity.player.EntityItemPickupEvent;
|
import net.neoforged.bus.api.SubscribeEvent;
|
||||||
import net.minecraftforge.event.entity.player.PlayerEvent;
|
import net.neoforged.neoforge.event.entity.living.LivingDropsEvent;
|
||||||
import net.minecraftforge.event.level.BlockEvent;
|
import net.neoforged.neoforge.event.entity.player.EntityItemPickupEvent;
|
||||||
import net.minecraftforge.eventbus.api.Event;
|
import net.neoforged.neoforge.event.entity.player.PlayerEvent;
|
||||||
import net.minecraftforge.eventbus.api.SubscribeEvent;
|
import net.neoforged.neoforge.event.level.BlockEvent;
|
||||||
import net.minecraftforge.registries.ForgeRegistries;
|
|
||||||
|
|
||||||
import java.util.Locale;
|
import java.util.Locale;
|
||||||
|
|
||||||
|
@ -168,7 +168,7 @@ public class CommonEvents {
|
||||||
if (CommonConfig.Other.GIVE_BOOKLET_ON_FIRST_CRAFT.get()) {
|
if (CommonConfig.Other.GIVE_BOOKLET_ON_FIRST_CRAFT.get()) {
|
||||||
if (!event.getEntity().level().isClientSide && StackUtil.isValid(event.getCrafting()) && event.getCrafting().getItem() != ActuallyItems.ITEM_BOOKLET.get()) {
|
if (!event.getEntity().level().isClientSide && StackUtil.isValid(event.getCrafting()) && event.getCrafting().getItem() != ActuallyItems.ITEM_BOOKLET.get()) {
|
||||||
|
|
||||||
String name = ForgeRegistries.ITEMS.getKey(event.getCrafting().getItem()).toString();
|
String name = BuiltInRegistries.ITEM.getKey(event.getCrafting().getItem()).toString();
|
||||||
if (name != null && name.toLowerCase(Locale.ROOT).contains(ActuallyAdditions.MODID)) {
|
if (name != null && name.toLowerCase(Locale.ROOT).contains(ActuallyAdditions.MODID)) {
|
||||||
PlayerData.PlayerSave save = PlayerData.getDataFromPlayer(event.getEntity());
|
PlayerData.PlayerSave save = PlayerData.getDataFromPlayer(event.getEntity());
|
||||||
if (save != null && !save.bookGottenAlready) {
|
if (save != null && !save.bookGottenAlready) {
|
||||||
|
|
|
@ -1,7 +1,7 @@
|
||||||
package de.ellpeck.actuallyadditions.mod.fluids;
|
package de.ellpeck.actuallyadditions.mod.fluids;
|
||||||
|
|
||||||
import net.minecraftforge.fluids.FluidStack;
|
import net.neoforged.neoforge.fluids.FluidStack;
|
||||||
import net.minecraftforge.fluids.capability.templates.FluidTank;
|
import net.neoforged.neoforge.fluids.capability.templates.FluidTank;
|
||||||
|
|
||||||
import javax.annotation.Nonnull;
|
import javax.annotation.Nonnull;
|
||||||
import java.util.function.Predicate;
|
import java.util.function.Predicate;
|
||||||
|
|
|
@ -25,11 +25,11 @@ import net.minecraft.world.level.block.state.BlockBehaviour;
|
||||||
import net.minecraft.world.level.material.FlowingFluid;
|
import net.minecraft.world.level.material.FlowingFluid;
|
||||||
import net.minecraft.world.level.material.Fluid;
|
import net.minecraft.world.level.material.Fluid;
|
||||||
import net.minecraft.world.level.pathfinder.BlockPathTypes;
|
import net.minecraft.world.level.pathfinder.BlockPathTypes;
|
||||||
import net.minecraftforge.client.extensions.common.IClientFluidTypeExtensions;
|
import net.neoforged.neoforge.client.extensions.common.IClientFluidTypeExtensions;
|
||||||
import net.minecraftforge.common.SoundActions;
|
import net.neoforged.neoforge.common.SoundActions;
|
||||||
import net.minecraftforge.fluids.FluidType;
|
import net.neoforged.neoforge.fluids.BaseFlowingFluid;
|
||||||
import net.minecraftforge.fluids.ForgeFlowingFluid;
|
import net.neoforged.neoforge.fluids.FluidType;
|
||||||
import net.minecraftforge.registries.RegistryObject;
|
import net.neoforged.neoforge.registries.DeferredItem;
|
||||||
|
|
||||||
import java.util.function.Consumer;
|
import java.util.function.Consumer;
|
||||||
import java.util.function.Supplier;
|
import java.util.function.Supplier;
|
||||||
|
@ -38,19 +38,19 @@ public class FluidAA implements Supplier<Fluid> {
|
||||||
private String name;
|
private String name;
|
||||||
private final ResourceLocation stillTexture;
|
private final ResourceLocation stillTexture;
|
||||||
private final ResourceLocation flowingTexture;
|
private final ResourceLocation flowingTexture;
|
||||||
private RegistryObject<FluidType> fluidType;
|
private Supplier<FluidType> fluidType;
|
||||||
private RegistryObject<ForgeFlowingFluid> source;
|
private Supplier<BaseFlowingFluid> source;
|
||||||
private RegistryObject<ForgeFlowingFluid> flowing;
|
private Supplier<BaseFlowingFluid> flowing;
|
||||||
private RegistryObject<LiquidBlock> fluidBlock;
|
private Supplier<LiquidBlock> fluidBlock;
|
||||||
private RegistryObject<Item> bucket;
|
private DeferredItem<Item> bucket;
|
||||||
|
|
||||||
public String getName() {
|
public String getName() {
|
||||||
return name;
|
return name;
|
||||||
}
|
}
|
||||||
|
|
||||||
public static ForgeFlowingFluid.Properties createProperties(Supplier<FluidType> type, Supplier<ForgeFlowingFluid> still, Supplier<ForgeFlowingFluid> flowing,
|
public static BaseFlowingFluid.Properties createProperties(Supplier<FluidType> type, Supplier<BaseFlowingFluid> still, Supplier<BaseFlowingFluid> flowing,
|
||||||
RegistryObject<Item> bucket, Supplier<LiquidBlock> block) {
|
DeferredItem<Item> bucket, Supplier<LiquidBlock> block) {
|
||||||
return new ForgeFlowingFluid.Properties(type, still, flowing)
|
return new BaseFlowingFluid.Properties(type, still, flowing)
|
||||||
.bucket(bucket).block(block);
|
.bucket(bucket).block(block);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -76,9 +76,9 @@ public class FluidAA implements Supplier<Fluid> {
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
source = InitFluids.FLUIDS.register(name, () -> new ForgeFlowingFluid.Source(createProperties(fluidType, source, flowing, bucket, fluidBlock)));
|
source = InitFluids.FLUIDS.register(name, () -> new BaseFlowingFluid.Source(createProperties(fluidType, source, flowing, bucket, fluidBlock)));
|
||||||
flowing = InitFluids.FLUIDS.register(name + "_flowing", () -> new ForgeFlowingFluid.Flowing(createProperties(fluidType, source, flowing, bucket, fluidBlock)));
|
flowing = InitFluids.FLUIDS.register(name + "_flowing", () -> new BaseFlowingFluid.Flowing(createProperties(fluidType, source, flowing, bucket, fluidBlock)));
|
||||||
fluidBlock = ActuallyBlocks.BLOCKS.register(name, () -> new LiquidBlock(source, BlockBehaviour.Properties.copy(Blocks.WATER)));
|
fluidBlock = ActuallyBlocks.BLOCKS.register(name, () -> new LiquidBlock(source, BlockBehaviour.Properties.ofFullCopy(Blocks.WATER)));
|
||||||
bucket = ActuallyItems.ITEMS.register(name + "_bucket", () -> new BucketItem(source, new Item.Properties().craftRemainder(Items.BUCKET).stacksTo(1)));
|
bucket = ActuallyItems.ITEMS.register(name + "_bucket", () -> new BucketItem(source, new Item.Properties().craftRemainder(Items.BUCKET).stacksTo(1)));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -11,17 +11,17 @@
|
||||||
package de.ellpeck.actuallyadditions.mod.fluids;
|
package de.ellpeck.actuallyadditions.mod.fluids;
|
||||||
|
|
||||||
import de.ellpeck.actuallyadditions.mod.ActuallyAdditions;
|
import de.ellpeck.actuallyadditions.mod.ActuallyAdditions;
|
||||||
import net.minecraft.world.level.block.Block;
|
import net.minecraft.core.registries.BuiltInRegistries;
|
||||||
import net.minecraft.world.level.material.Fluid;
|
import net.minecraft.world.level.material.Fluid;
|
||||||
import net.minecraftforge.eventbus.api.IEventBus;
|
import net.neoforged.bus.api.IEventBus;
|
||||||
import net.minecraftforge.fluids.FluidType;
|
import net.neoforged.neoforge.fluids.FluidType;
|
||||||
import net.minecraftforge.registries.DeferredRegister;
|
import net.neoforged.neoforge.registries.DeferredRegister;
|
||||||
import net.minecraftforge.registries.ForgeRegistries;
|
import net.neoforged.neoforge.registries.NeoForgeRegistries;
|
||||||
|
|
||||||
public final class InitFluids {
|
public final class InitFluids {
|
||||||
public static final DeferredRegister<Fluid> FLUIDS = DeferredRegister.create(ForgeRegistries.FLUIDS, ActuallyAdditions.MODID);
|
public static final DeferredRegister<Fluid> FLUIDS = DeferredRegister.create(BuiltInRegistries.FLUID, ActuallyAdditions.MODID);
|
||||||
public static final DeferredRegister<FluidType> FLUID_TYPES = DeferredRegister.create(ForgeRegistries.Keys.FLUID_TYPES, ActuallyAdditions.MODID);
|
public static final DeferredRegister<FluidType> FLUID_TYPES = DeferredRegister.create(NeoForgeRegistries.Keys.FLUID_TYPES, ActuallyAdditions.MODID);
|
||||||
public static final DeferredRegister<Block> FLUID_BLOCKS = DeferredRegister.create(ForgeRegistries.BLOCKS, ActuallyAdditions.MODID);
|
public static final DeferredRegister.Blocks FLUID_BLOCKS = DeferredRegister.createBlocks(ActuallyAdditions.MODID);
|
||||||
|
|
||||||
public static final FluidAA CANOLA_OIL = new FluidAA("canola_oil", "fluid/canola_oil");
|
public static final FluidAA CANOLA_OIL = new FluidAA("canola_oil", "fluid/canola_oil");
|
||||||
public static final FluidAA REFINED_CANOLA_OIL = new FluidAA("refined_canola_oil", "fluid/refined_canola_oil");
|
public static final FluidAA REFINED_CANOLA_OIL = new FluidAA("refined_canola_oil", "fluid/refined_canola_oil");
|
||||||
|
|
|
@ -1,7 +1,7 @@
|
||||||
package de.ellpeck.actuallyadditions.mod.fluids;
|
package de.ellpeck.actuallyadditions.mod.fluids;
|
||||||
|
|
||||||
import net.minecraftforge.fluids.FluidStack;
|
import net.neoforged.neoforge.fluids.FluidStack;
|
||||||
import net.minecraftforge.fluids.capability.templates.FluidTank;
|
import net.neoforged.neoforge.fluids.capability.templates.FluidTank;
|
||||||
|
|
||||||
import java.util.function.Predicate;
|
import java.util.function.Predicate;
|
||||||
|
|
||||||
|
|
|
@ -24,18 +24,18 @@
|
||||||
//
|
//
|
||||||
// private final ItemStack input;
|
// private final ItemStack input;
|
||||||
// private final PriceInfo inputAmount;
|
// private final PriceInfo inputAmount;
|
||||||
// private final ItemStack output;
|
// private final ItemStack stack;
|
||||||
// private final PriceInfo outputAmount;
|
// private final PriceInfo outputAmount;
|
||||||
//
|
//
|
||||||
// public BasicTradeList(ItemStack input, PriceInfo inputAmount, ItemStack output, PriceInfo outputAmount) {
|
// public BasicTradeList(ItemStack input, PriceInfo inputAmount, ItemStack stack, PriceInfo outputAmount) {
|
||||||
// this.input = input;
|
// this.input = input;
|
||||||
// this.inputAmount = inputAmount;
|
// this.inputAmount = inputAmount;
|
||||||
// this.output = output;
|
// this.stack = stack;
|
||||||
// this.outputAmount = outputAmount;
|
// this.outputAmount = outputAmount;
|
||||||
// }
|
// }
|
||||||
//
|
//
|
||||||
// public BasicTradeList(PriceInfo emeraldInput, ItemStack output, PriceInfo outputAmount) {
|
// public BasicTradeList(PriceInfo emeraldInput, ItemStack stack, PriceInfo outputAmount) {
|
||||||
// this(new ItemStack(Items.EMERALD), emeraldInput, output, outputAmount);
|
// this(new ItemStack(Items.EMERALD), emeraldInput, stack, outputAmount);
|
||||||
// }
|
// }
|
||||||
//
|
//
|
||||||
// public BasicTradeList(ItemStack input, PriceInfo inputAmount, PriceInfo emeraldOutput) {
|
// public BasicTradeList(ItemStack input, PriceInfo inputAmount, PriceInfo emeraldOutput) {
|
||||||
|
@ -46,7 +46,7 @@
|
||||||
// public void addMerchantRecipe(IMerchant merchant, MerchantRecipeList recipeList, Random random) {
|
// public void addMerchantRecipe(IMerchant merchant, MerchantRecipeList recipeList, Random random) {
|
||||||
// ItemStack in = this.input.copy();
|
// ItemStack in = this.input.copy();
|
||||||
// in.setCount(this.inputAmount.getPrice(random));
|
// in.setCount(this.inputAmount.getPrice(random));
|
||||||
// ItemStack out = this.output.copy();
|
// ItemStack out = this.stack.copy();
|
||||||
// out.setCount(this.outputAmount.getPrice(random));
|
// out.setCount(this.outputAmount.getPrice(random));
|
||||||
// recipeList.add(new MerchantRecipe(in, out));
|
// recipeList.add(new MerchantRecipe(in, out));
|
||||||
// }
|
// }
|
||||||
|
|
|
@ -1,41 +1,42 @@
|
||||||
package de.ellpeck.actuallyadditions.mod.inventory;
|
package de.ellpeck.actuallyadditions.mod.inventory;
|
||||||
|
|
||||||
import de.ellpeck.actuallyadditions.mod.ActuallyAdditions;
|
import de.ellpeck.actuallyadditions.mod.ActuallyAdditions;
|
||||||
|
import net.minecraft.core.registries.BuiltInRegistries;
|
||||||
import net.minecraft.world.inventory.MenuType;
|
import net.minecraft.world.inventory.MenuType;
|
||||||
import net.minecraftforge.common.extensions.IForgeMenuType;
|
import net.neoforged.neoforge.common.extensions.IMenuTypeExtension;
|
||||||
import net.minecraftforge.registries.DeferredRegister;
|
import net.neoforged.neoforge.registries.DeferredRegister;
|
||||||
import net.minecraftforge.registries.ForgeRegistries;
|
|
||||||
import net.minecraftforge.registries.RegistryObject;
|
import java.util.function.Supplier;
|
||||||
|
|
||||||
public class ActuallyContainers {
|
public class ActuallyContainers {
|
||||||
public static final DeferredRegister<MenuType<?>> CONTAINERS = DeferredRegister.create(ForgeRegistries.MENU_TYPES, ActuallyAdditions.MODID);
|
public static final DeferredRegister<MenuType<?>> CONTAINERS = DeferredRegister.create(BuiltInRegistries.MENU, ActuallyAdditions.MODID);
|
||||||
|
|
||||||
public static final RegistryObject<MenuType<SackContainer>> BAG_CONTAINER = CONTAINERS.register("bag_container", () -> IForgeMenuType.create(SackContainer::fromNetwork));
|
public static final Supplier<MenuType<SackContainer>> BAG_CONTAINER = CONTAINERS.register("bag_container", () -> IMenuTypeExtension.create(SackContainer::fromNetwork));
|
||||||
public static final RegistryObject<MenuType<ContainerBioReactor>> BIO_REACTOR_CONTAINER = CONTAINERS.register("bioreactor_container", () -> IForgeMenuType.create(ContainerBioReactor::fromNetwork));
|
public static final Supplier<MenuType<ContainerBioReactor>> BIO_REACTOR_CONTAINER = CONTAINERS.register("bioreactor_container", () -> IMenuTypeExtension.create(ContainerBioReactor::fromNetwork));
|
||||||
public static final RegistryObject<MenuType<ContainerBreaker>> BREAKER_CONTAINER = CONTAINERS.register("breaker_container", () -> IForgeMenuType.create(ContainerBreaker::fromNetwork));
|
public static final Supplier<MenuType<ContainerBreaker>> BREAKER_CONTAINER = CONTAINERS.register("breaker_container", () -> IMenuTypeExtension.create(ContainerBreaker::fromNetwork));
|
||||||
public static final RegistryObject<MenuType<ContainerCanolaPress>> CANOLA_PRESS_CONTAINER = CONTAINERS.register("canola_press_container", () -> IForgeMenuType.create(ContainerCanolaPress::fromNetwork));
|
public static final Supplier<MenuType<ContainerCanolaPress>> CANOLA_PRESS_CONTAINER = CONTAINERS.register("canola_press_container", () -> IMenuTypeExtension.create(ContainerCanolaPress::fromNetwork));
|
||||||
public static final RegistryObject<MenuType<ContainerCoalGenerator>> COAL_GENERATOR_CONTAINER = CONTAINERS.register("coal_generator_container", () -> IForgeMenuType.create(ContainerCoalGenerator::fromNetwork));
|
public static final Supplier<MenuType<ContainerCoalGenerator>> COAL_GENERATOR_CONTAINER = CONTAINERS.register("coal_generator_container", () -> IMenuTypeExtension.create(ContainerCoalGenerator::fromNetwork));
|
||||||
public static final RegistryObject<MenuType<ContainerCoffeeMachine>> COFFEE_MACHINE_CONTAINER = CONTAINERS.register("coffee_machine_container", () -> IForgeMenuType.create(ContainerCoffeeMachine::fromNetwork));
|
public static final Supplier<MenuType<ContainerCoffeeMachine>> COFFEE_MACHINE_CONTAINER = CONTAINERS.register("coffee_machine_container", () -> IMenuTypeExtension.create(ContainerCoffeeMachine::fromNetwork));
|
||||||
public static final RegistryObject<MenuType<ContainerDirectionalBreaker>> DIRECTIONAL_BREAKER_CONTAINER = CONTAINERS.register("directional_breaker_container", () -> IForgeMenuType.create(ContainerDirectionalBreaker::fromNetwork));
|
public static final Supplier<MenuType<ContainerDirectionalBreaker>> DIRECTIONAL_BREAKER_CONTAINER = CONTAINERS.register("directional_breaker_container", () -> IMenuTypeExtension.create(ContainerDirectionalBreaker::fromNetwork));
|
||||||
public static final RegistryObject<MenuType<ContainerDrill>> DRILL_CONTAINER = CONTAINERS.register("drill_container", () -> IForgeMenuType.create(ContainerDrill::fromNetwork));
|
public static final Supplier<MenuType<ContainerDrill>> DRILL_CONTAINER = CONTAINERS.register("drill_container", () -> IMenuTypeExtension.create(ContainerDrill::fromNetwork));
|
||||||
public static final RegistryObject<MenuType<ContainerDropper>> DROPPER_CONTAINER = CONTAINERS.register("dropper_container", () -> IForgeMenuType.create(ContainerDropper::fromNetwork));
|
public static final Supplier<MenuType<ContainerDropper>> DROPPER_CONTAINER = CONTAINERS.register("dropper_container", () -> IMenuTypeExtension.create(ContainerDropper::fromNetwork));
|
||||||
public static final RegistryObject<MenuType<ContainerEnervator>> ENERVATOR_CONTAINER = CONTAINERS.register("enervator_container", () -> IForgeMenuType.create(ContainerEnervator::fromNetwork));
|
public static final Supplier<MenuType<ContainerEnervator>> ENERVATOR_CONTAINER = CONTAINERS.register("enervator_container", () -> IMenuTypeExtension.create(ContainerEnervator::fromNetwork));
|
||||||
public static final RegistryObject<MenuType<ContainerEnergizer>> ENERGIZER_CONTAINER = CONTAINERS.register("energizer_container", () -> IForgeMenuType.create(ContainerEnergizer::fromNetwork));
|
public static final Supplier<MenuType<ContainerEnergizer>> ENERGIZER_CONTAINER = CONTAINERS.register("energizer_container", () -> IMenuTypeExtension.create(ContainerEnergizer::fromNetwork));
|
||||||
|
|
||||||
public static final RegistryObject<MenuType<ContainerFarmer>> FARMER_CONTAINER = CONTAINERS.register("farmer_container", () -> IForgeMenuType.create(ContainerFarmer::fromNetwork));
|
public static final Supplier<MenuType<ContainerFarmer>> FARMER_CONTAINER = CONTAINERS.register("farmer_container", () -> IMenuTypeExtension.create(ContainerFarmer::fromNetwork));
|
||||||
public static final RegistryObject<MenuType<ContainerFeeder>> FEEDER_CONTAINER = CONTAINERS.register("feeder_container", () -> IForgeMenuType.create(ContainerFeeder::fromNetwork));
|
public static final Supplier<MenuType<ContainerFeeder>> FEEDER_CONTAINER = CONTAINERS.register("feeder_container", () -> IMenuTypeExtension.create(ContainerFeeder::fromNetwork));
|
||||||
public static final RegistryObject<MenuType<ContainerFermentingBarrel>> FERMENTING_BARREL_CONTAINER = CONTAINERS.register("fermenting_barrel_container", () -> IForgeMenuType.create(ContainerFermentingBarrel::fromNetwork));
|
public static final Supplier<MenuType<ContainerFermentingBarrel>> FERMENTING_BARREL_CONTAINER = CONTAINERS.register("fermenting_barrel_container", () -> IMenuTypeExtension.create(ContainerFermentingBarrel::fromNetwork));
|
||||||
public static final RegistryObject<MenuType<ContainerFilter>> FILTER_CONTAINER = CONTAINERS.register("filter_container", () -> IForgeMenuType.create(ContainerFilter::fromNetwork));
|
public static final Supplier<MenuType<ContainerFilter>> FILTER_CONTAINER = CONTAINERS.register("filter_container", () -> IMenuTypeExtension.create(ContainerFilter::fromNetwork));
|
||||||
public static final RegistryObject<MenuType<ContainerFireworkBox>> FIREWORK_BOX_CONTAINER = CONTAINERS.register("firework_box_container", () -> IForgeMenuType.create(ContainerFireworkBox::fromNetwork));
|
public static final Supplier<MenuType<ContainerFireworkBox>> FIREWORK_BOX_CONTAINER = CONTAINERS.register("firework_box_container", () -> IMenuTypeExtension.create(ContainerFireworkBox::fromNetwork));
|
||||||
public static final RegistryObject<MenuType<ContainerFluidCollector>> FLUID_COLLECTOR_CONTAINER = CONTAINERS.register("fluid_collector_container", () -> IForgeMenuType.create(ContainerFluidCollector::fromNetwork));
|
public static final Supplier<MenuType<ContainerFluidCollector>> FLUID_COLLECTOR_CONTAINER = CONTAINERS.register("fluid_collector_container", () -> IMenuTypeExtension.create(ContainerFluidCollector::fromNetwork));
|
||||||
public static final RegistryObject<MenuType<ContainerFurnaceDouble>> FURNACE_DOUBLE_CONTAINER = CONTAINERS.register("furnace_double_container", () -> IForgeMenuType.create(ContainerFurnaceDouble::fromNetwork));
|
public static final Supplier<MenuType<ContainerFurnaceDouble>> FURNACE_DOUBLE_CONTAINER = CONTAINERS.register("furnace_double_container", () -> IMenuTypeExtension.create(ContainerFurnaceDouble::fromNetwork));
|
||||||
public static final RegistryObject<MenuType<CrusherContainer>> GRINDER_CONTAINER = CONTAINERS.register("grinder_container", () -> IForgeMenuType.create(CrusherContainer::fromNetwork));
|
public static final Supplier<MenuType<CrusherContainer>> GRINDER_CONTAINER = CONTAINERS.register("grinder_container", () -> IMenuTypeExtension.create(CrusherContainer::fromNetwork));
|
||||||
public static final RegistryObject<MenuType<ContainerLaserRelayItemWhitelist>> LASER_RELAY_ITEM_WHITELIST_CONTAINER = CONTAINERS.register("laser_relay_item_whitelist_container", () -> IForgeMenuType.create(ContainerLaserRelayItemWhitelist::fromNetwork));
|
public static final Supplier<MenuType<ContainerLaserRelayItemWhitelist>> LASER_RELAY_ITEM_WHITELIST_CONTAINER = CONTAINERS.register("laser_relay_item_whitelist_container", () -> IMenuTypeExtension.create(ContainerLaserRelayItemWhitelist::fromNetwork));
|
||||||
public static final RegistryObject<MenuType<ContainerMiner>> MINER_CONTAINER = CONTAINERS.register("miner_container", () -> IForgeMenuType.create(ContainerMiner::fromNetwork));
|
public static final Supplier<MenuType<ContainerMiner>> MINER_CONTAINER = CONTAINERS.register("miner_container", () -> IMenuTypeExtension.create(ContainerMiner::fromNetwork));
|
||||||
public static final RegistryObject<MenuType<ContainerOilGenerator>> OIL_GENERATOR_CONTAINER = CONTAINERS.register("oil_generator_container", () -> IForgeMenuType.create(ContainerOilGenerator::fromNetwork));
|
public static final Supplier<MenuType<ContainerOilGenerator>> OIL_GENERATOR_CONTAINER = CONTAINERS.register("oil_generator_container", () -> IMenuTypeExtension.create(ContainerOilGenerator::fromNetwork));
|
||||||
public static final RegistryObject<MenuType<ContainerPhantomPlacer>> PHANTOM_PLACER_CONTAINER = CONTAINERS.register("phantom_placer_container", () -> IForgeMenuType.create(ContainerPhantomPlacer::fromNetwork));
|
public static final Supplier<MenuType<ContainerPhantomPlacer>> PHANTOM_PLACER_CONTAINER = CONTAINERS.register("phantom_placer_container", () -> IMenuTypeExtension.create(ContainerPhantomPlacer::fromNetwork));
|
||||||
public static final RegistryObject<MenuType<ContainerRangedCollector>> RANGED_COLLECTOR_CONTAINER = CONTAINERS.register("ranged_collector_container", () -> IForgeMenuType.create(ContainerRangedCollector::fromNetwork));
|
public static final Supplier<MenuType<ContainerRangedCollector>> RANGED_COLLECTOR_CONTAINER = CONTAINERS.register("ranged_collector_container", () -> IMenuTypeExtension.create(ContainerRangedCollector::fromNetwork));
|
||||||
public static final RegistryObject<MenuType<ContainerXPSolidifier>> XPSOLIDIFIER_CONTAINER = CONTAINERS.register("xpsolidifier_container", () -> IForgeMenuType.create(ContainerXPSolidifier::fromNetwork));
|
public static final Supplier<MenuType<ContainerXPSolidifier>> XPSOLIDIFIER_CONTAINER = CONTAINERS.register("xpsolidifier_container", () -> IMenuTypeExtension.create(ContainerXPSolidifier::fromNetwork));
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -19,7 +19,7 @@ import net.minecraft.world.entity.player.Player;
|
||||||
import net.minecraft.world.inventory.AbstractContainerMenu;
|
import net.minecraft.world.inventory.AbstractContainerMenu;
|
||||||
import net.minecraft.world.inventory.Slot;
|
import net.minecraft.world.inventory.Slot;
|
||||||
import net.minecraft.world.item.ItemStack;
|
import net.minecraft.world.item.ItemStack;
|
||||||
import net.minecraftforge.common.ForgeHooks;
|
import net.neoforged.neoforge.common.CommonHooks;
|
||||||
|
|
||||||
import java.util.Objects;
|
import java.util.Objects;
|
||||||
|
|
||||||
|
@ -63,7 +63,7 @@ public class ContainerCoalGenerator extends AbstractContainerMenu {
|
||||||
//Other Slots in Inventory excluded
|
//Other Slots in Inventory excluded
|
||||||
if (slot >= inventoryStart) {
|
if (slot >= inventoryStart) {
|
||||||
//Shift from Inventory
|
//Shift from Inventory
|
||||||
if (ForgeHooks.getBurnTime(newStack, null) > 0) {
|
if (CommonHooks.getBurnTime(newStack, null) > 0) {
|
||||||
if (!this.moveItemStackTo(newStack, 0, 1, false)) {
|
if (!this.moveItemStackTo(newStack, 0, 1, false)) {
|
||||||
return ItemStack.EMPTY;
|
return ItemStack.EMPTY;
|
||||||
}
|
}
|
||||||
|
|
|
@ -23,7 +23,7 @@ import net.minecraft.world.inventory.Slot;
|
||||||
import net.minecraft.world.item.ArmorItem;
|
import net.minecraft.world.item.ArmorItem;
|
||||||
import net.minecraft.world.item.ItemStack;
|
import net.minecraft.world.item.ItemStack;
|
||||||
import net.minecraft.world.item.enchantment.EnchantmentHelper;
|
import net.minecraft.world.item.enchantment.EnchantmentHelper;
|
||||||
import net.minecraftforge.common.capabilities.ForgeCapabilities;
|
import net.neoforged.neoforge.capabilities.Capabilities;
|
||||||
|
|
||||||
import java.util.Objects;
|
import java.util.Objects;
|
||||||
|
|
||||||
|
@ -43,7 +43,7 @@ public class ContainerEnergizer extends AbstractContainerMenu {
|
||||||
this.addSlot(new SlotItemHandlerUnconditioned(this.energizer.inv, 0, 76, 73) {
|
this.addSlot(new SlotItemHandlerUnconditioned(this.energizer.inv, 0, 76, 73) {
|
||||||
@Override
|
@Override
|
||||||
public boolean mayPlace(ItemStack stack) {
|
public boolean mayPlace(ItemStack stack) {
|
||||||
return super.mayPlace(stack) && stack.getCapability(ForgeCapabilities.ENERGY, null).isPresent();
|
return super.mayPlace(stack) && stack.getCapability(Capabilities.EnergyStorage.ITEM, null) != null;
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
this.addSlot(new SlotOutput(this.energizer.inv, 1, 76, 42));
|
this.addSlot(new SlotOutput(this.energizer.inv, 1, 76, 42));
|
||||||
|
@ -110,7 +110,7 @@ public class ContainerEnergizer extends AbstractContainerMenu {
|
||||||
//Other Slots in Inventory excluded
|
//Other Slots in Inventory excluded
|
||||||
else if (slot >= inventoryStart) {
|
else if (slot >= inventoryStart) {
|
||||||
//Shift from Inventory
|
//Shift from Inventory
|
||||||
if (newStack.getCapability(ForgeCapabilities.ENERGY, null).isPresent()) {
|
if (newStack.getCapability(Capabilities.EnergyStorage.ITEM, null) != null) {
|
||||||
if (!this.moveItemStackTo(newStack, 0, 1, false)) {
|
if (!this.moveItemStackTo(newStack, 0, 1, false)) {
|
||||||
return ItemStack.EMPTY;
|
return ItemStack.EMPTY;
|
||||||
}
|
}
|
||||||
|
|
|
@ -22,7 +22,7 @@ import net.minecraft.world.inventory.AbstractContainerMenu;
|
||||||
import net.minecraft.world.inventory.Slot;
|
import net.minecraft.world.inventory.Slot;
|
||||||
import net.minecraft.world.item.ArmorItem;
|
import net.minecraft.world.item.ArmorItem;
|
||||||
import net.minecraft.world.item.ItemStack;
|
import net.minecraft.world.item.ItemStack;
|
||||||
import net.minecraftforge.common.capabilities.ForgeCapabilities;
|
import net.neoforged.neoforge.capabilities.Capabilities;
|
||||||
|
|
||||||
import java.util.Objects;
|
import java.util.Objects;
|
||||||
|
|
||||||
|
@ -98,7 +98,7 @@ public class ContainerEnervator extends AbstractContainerMenu {
|
||||||
//Other Slots in Inventory excluded
|
//Other Slots in Inventory excluded
|
||||||
else if (slot >= inventoryStart) {
|
else if (slot >= inventoryStart) {
|
||||||
//Shift from Inventory
|
//Shift from Inventory
|
||||||
if (newStack.getCapability(ForgeCapabilities.ENERGY).isPresent()) {
|
if (newStack.getCapability(Capabilities.EnergyStorage.ITEM) != null) {
|
||||||
if (!this.moveItemStackTo(newStack, 0, 1, false)) {
|
if (!this.moveItemStackTo(newStack, 0, 1, false)) {
|
||||||
return ItemStack.EMPTY;
|
return ItemStack.EMPTY;
|
||||||
}
|
}
|
||||||
|
|
|
@ -22,7 +22,9 @@ import net.minecraft.world.inventory.AbstractContainerMenu;
|
||||||
import net.minecraft.world.inventory.Slot;
|
import net.minecraft.world.inventory.Slot;
|
||||||
import net.minecraft.world.item.ItemStack;
|
import net.minecraft.world.item.ItemStack;
|
||||||
import net.minecraft.world.item.crafting.Recipe;
|
import net.minecraft.world.item.crafting.Recipe;
|
||||||
|
import net.minecraft.world.item.crafting.RecipeHolder;
|
||||||
import net.minecraft.world.item.crafting.RecipeType;
|
import net.minecraft.world.item.crafting.RecipeType;
|
||||||
|
import net.minecraft.world.item.crafting.SmeltingRecipe;
|
||||||
|
|
||||||
import javax.annotation.Nonnull;
|
import javax.annotation.Nonnull;
|
||||||
import java.util.Objects;
|
import java.util.Objects;
|
||||||
|
@ -78,12 +80,12 @@ public class ContainerFurnaceDouble extends AbstractContainerMenu {
|
||||||
//Other Slots in Inventory excluded
|
//Other Slots in Inventory excluded
|
||||||
else if (slot >= inventoryStart) {
|
else if (slot >= inventoryStart) {
|
||||||
// TODO: VALIDATE
|
// TODO: VALIDATE
|
||||||
Recipe<?> irecipe = this.furnace.getLevel().getRecipeManager().getRecipeFor(RecipeType.SMELTING, new SingleItem(newStack), this.furnace.getLevel()).orElse(null);
|
RecipeHolder<SmeltingRecipe> recipeHolder = this.furnace.getLevel().getRecipeManager().getRecipeFor(RecipeType.SMELTING, new SingleItem(newStack), this.furnace.getLevel()).orElse(null);
|
||||||
if (irecipe == null) {
|
if (recipeHolder == null) {
|
||||||
return ItemStack.EMPTY;
|
return ItemStack.EMPTY;
|
||||||
}
|
}
|
||||||
|
|
||||||
ItemStack recipeOutput = irecipe.getResultItem(player.level().registryAccess());
|
ItemStack recipeOutput = recipeHolder.value().getResultItem(player.level().registryAccess());
|
||||||
|
|
||||||
//Shift from Inventory
|
//Shift from Inventory
|
||||||
if (StackUtil.isValid(recipeOutput)) {
|
if (StackUtil.isValid(recipeOutput)) {
|
||||||
|
|
|
@ -27,8 +27,8 @@ import net.minecraft.world.inventory.AbstractContainerMenu;
|
||||||
import net.minecraft.world.inventory.ClickType;
|
import net.minecraft.world.inventory.ClickType;
|
||||||
import net.minecraft.world.inventory.Slot;
|
import net.minecraft.world.inventory.Slot;
|
||||||
import net.minecraft.world.item.ItemStack;
|
import net.minecraft.world.item.ItemStack;
|
||||||
import net.minecraftforge.api.distmarker.Dist;
|
import net.neoforged.api.distmarker.Dist;
|
||||||
import net.minecraftforge.api.distmarker.OnlyIn;
|
import net.neoforged.api.distmarker.OnlyIn;
|
||||||
|
|
||||||
import javax.annotation.Nonnull;
|
import javax.annotation.Nonnull;
|
||||||
import java.util.UUID;
|
import java.util.UUID;
|
||||||
|
|
|
@ -8,8 +8,8 @@ import net.minecraft.client.gui.GuiGraphics;
|
||||||
import net.minecraft.client.gui.components.Button;
|
import net.minecraft.client.gui.components.Button;
|
||||||
import net.minecraft.network.chat.Component;
|
import net.minecraft.network.chat.Component;
|
||||||
import net.minecraft.resources.ResourceLocation;
|
import net.minecraft.resources.ResourceLocation;
|
||||||
import net.minecraftforge.api.distmarker.Dist;
|
import net.neoforged.api.distmarker.Dist;
|
||||||
import net.minecraftforge.api.distmarker.OnlyIn;
|
import net.neoforged.api.distmarker.OnlyIn;
|
||||||
|
|
||||||
public class Buttons {
|
public class Buttons {
|
||||||
@OnlyIn(Dist.CLIENT)
|
@OnlyIn(Dist.CLIENT)
|
||||||
|
|
|
@ -20,8 +20,8 @@ import net.minecraft.client.gui.components.Button;
|
||||||
import net.minecraft.network.chat.Component;
|
import net.minecraft.network.chat.Component;
|
||||||
import net.minecraft.resources.ResourceLocation;
|
import net.minecraft.resources.ResourceLocation;
|
||||||
import net.minecraft.world.entity.player.Inventory;
|
import net.minecraft.world.entity.player.Inventory;
|
||||||
import net.minecraftforge.api.distmarker.Dist;
|
import net.neoforged.api.distmarker.Dist;
|
||||||
import net.minecraftforge.api.distmarker.OnlyIn;
|
import net.neoforged.api.distmarker.OnlyIn;
|
||||||
|
|
||||||
import javax.annotation.Nonnull;
|
import javax.annotation.Nonnull;
|
||||||
|
|
||||||
|
|
|
@ -16,8 +16,8 @@ import de.ellpeck.actuallyadditions.mod.util.AssetUtil;
|
||||||
import net.minecraft.client.Minecraft;
|
import net.minecraft.client.Minecraft;
|
||||||
import net.minecraft.client.gui.GuiGraphics;
|
import net.minecraft.client.gui.GuiGraphics;
|
||||||
import net.minecraft.network.chat.Component;
|
import net.minecraft.network.chat.Component;
|
||||||
import net.minecraftforge.api.distmarker.Dist;
|
import net.neoforged.api.distmarker.Dist;
|
||||||
import net.minecraftforge.api.distmarker.OnlyIn;
|
import net.neoforged.api.distmarker.OnlyIn;
|
||||||
|
|
||||||
import java.text.NumberFormat;
|
import java.text.NumberFormat;
|
||||||
import java.util.ArrayList;
|
import java.util.ArrayList;
|
||||||
|
|
|
@ -18,8 +18,8 @@ import net.minecraft.client.gui.GuiGraphics;
|
||||||
import net.minecraft.client.gui.components.Button;
|
import net.minecraft.client.gui.components.Button;
|
||||||
import net.minecraft.client.gui.components.Renderable;
|
import net.minecraft.client.gui.components.Renderable;
|
||||||
import net.minecraft.network.chat.Component;
|
import net.minecraft.network.chat.Component;
|
||||||
import net.minecraftforge.api.distmarker.Dist;
|
import net.neoforged.api.distmarker.Dist;
|
||||||
import net.minecraftforge.api.distmarker.OnlyIn;
|
import net.neoforged.api.distmarker.OnlyIn;
|
||||||
|
|
||||||
import java.util.ArrayList;
|
import java.util.ArrayList;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
|
|
|
@ -17,12 +17,12 @@ import net.minecraft.client.gui.GuiGraphics;
|
||||||
import net.minecraft.network.chat.Component;
|
import net.minecraft.network.chat.Component;
|
||||||
import net.minecraft.resources.ResourceLocation;
|
import net.minecraft.resources.ResourceLocation;
|
||||||
import net.minecraft.world.level.material.Fluid;
|
import net.minecraft.world.level.material.Fluid;
|
||||||
import net.minecraftforge.api.distmarker.Dist;
|
import net.neoforged.api.distmarker.Dist;
|
||||||
import net.minecraftforge.api.distmarker.OnlyIn;
|
import net.neoforged.api.distmarker.OnlyIn;
|
||||||
import net.minecraftforge.client.extensions.common.IClientFluidTypeExtensions;
|
import net.neoforged.neoforge.client.extensions.common.IClientFluidTypeExtensions;
|
||||||
import net.minecraftforge.fluids.FluidStack;
|
import net.neoforged.neoforge.fluids.FluidStack;
|
||||||
import net.minecraftforge.fluids.IFluidTank;
|
import net.neoforged.neoforge.fluids.IFluidTank;
|
||||||
import net.minecraftforge.fluids.capability.IFluidHandler;
|
import net.neoforged.neoforge.fluids.capability.IFluidHandler;
|
||||||
|
|
||||||
import javax.annotation.Nonnull;
|
import javax.annotation.Nonnull;
|
||||||
import java.text.NumberFormat;
|
import java.text.NumberFormat;
|
||||||
|
|
|
@ -18,8 +18,8 @@ import net.minecraft.client.gui.GuiGraphics;
|
||||||
import net.minecraft.network.chat.Component;
|
import net.minecraft.network.chat.Component;
|
||||||
import net.minecraft.resources.ResourceLocation;
|
import net.minecraft.resources.ResourceLocation;
|
||||||
import net.minecraft.world.entity.player.Inventory;
|
import net.minecraft.world.entity.player.Inventory;
|
||||||
import net.minecraftforge.api.distmarker.Dist;
|
import net.neoforged.api.distmarker.Dist;
|
||||||
import net.minecraftforge.api.distmarker.OnlyIn;
|
import net.neoforged.api.distmarker.OnlyIn;
|
||||||
|
|
||||||
import javax.annotation.Nonnull;
|
import javax.annotation.Nonnull;
|
||||||
|
|
||||||
|
|
|
@ -18,8 +18,8 @@ import net.minecraft.client.gui.GuiGraphics;
|
||||||
import net.minecraft.network.chat.Component;
|
import net.minecraft.network.chat.Component;
|
||||||
import net.minecraft.resources.ResourceLocation;
|
import net.minecraft.resources.ResourceLocation;
|
||||||
import net.minecraft.world.entity.player.Inventory;
|
import net.minecraft.world.entity.player.Inventory;
|
||||||
import net.minecraftforge.api.distmarker.Dist;
|
import net.neoforged.api.distmarker.Dist;
|
||||||
import net.minecraftforge.api.distmarker.OnlyIn;
|
import net.neoforged.api.distmarker.OnlyIn;
|
||||||
|
|
||||||
import javax.annotation.Nonnull;
|
import javax.annotation.Nonnull;
|
||||||
|
|
||||||
|
|
|
@ -18,8 +18,8 @@ import net.minecraft.client.gui.GuiGraphics;
|
||||||
import net.minecraft.network.chat.Component;
|
import net.minecraft.network.chat.Component;
|
||||||
import net.minecraft.resources.ResourceLocation;
|
import net.minecraft.resources.ResourceLocation;
|
||||||
import net.minecraft.world.entity.player.Inventory;
|
import net.minecraft.world.entity.player.Inventory;
|
||||||
import net.minecraftforge.api.distmarker.Dist;
|
import net.neoforged.api.distmarker.Dist;
|
||||||
import net.minecraftforge.api.distmarker.OnlyIn;
|
import net.neoforged.api.distmarker.OnlyIn;
|
||||||
|
|
||||||
import javax.annotation.Nonnull;
|
import javax.annotation.Nonnull;
|
||||||
|
|
||||||
|
|
Some files were not shown because too many files have changed in this diff Show more
Loading…
Reference in a new issue