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
|
||||
/bin/
|
||||
/run/
|
||||
/runs/
|
||||
|
||||
*.classpath
|
||||
*.project
|
||||
|
|
87
build.gradle
87
build.gradle
|
@ -1,9 +1,9 @@
|
|||
plugins {
|
||||
id 'java-library'
|
||||
id 'eclipse'
|
||||
id 'idea'
|
||||
id 'maven-publish'
|
||||
id 'net.minecraftforge.gradle' version '[6.0,6.2)'
|
||||
id 'org.parchmentmc.librarian.forgegradle' version '1.+'
|
||||
id 'net.neoforged.gradle.userdev' version '7.0.96'
|
||||
}
|
||||
|
||||
version = "$mod_version"
|
||||
|
@ -16,44 +16,49 @@ if (System.getenv('BUILD_NUMBER') != null) {
|
|||
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)
|
||||
|
||||
minecraft {
|
||||
mappings channel: 'parchment', version: "${parchment_version}-${game_version}"
|
||||
// makeObfSourceJar = false // an Srg named sources jar is made by default. uncomment this to disable.
|
||||
if (rootProject.file('src/main/resources/META-INF/accesstransformer.cfg').exists()) {
|
||||
minecraft.accessTransformers.file rootProject.file('src/main/resources/META-INF/accesstransformer.cfg')
|
||||
}
|
||||
//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'
|
||||
|
||||
// Recommended logging level for the console
|
||||
systemProperty 'forge.logging.console.level', 'debug'
|
||||
|
||||
//Limit ram usage for the dev environment to 4GB
|
||||
jvmArgument '-Xmx4G'
|
||||
|
||||
if (run.project.javaToolchains.launcherFor(java.toolchain).map { it.metadata.vendor }.getOrElse("").contains("JetBrains")) {
|
||||
run.jvmArgument("-XX:+AllowEnhancedClassRedefinition")
|
||||
}
|
||||
|
||||
modSource project.sourceSets.main
|
||||
}
|
||||
|
||||
runs {
|
||||
client {
|
||||
workingDirectory project.file('run')
|
||||
|
||||
mods {
|
||||
actuallyadditions {
|
||||
source sourceSets.main
|
||||
}
|
||||
}
|
||||
// Comma-separated list of namespaces to load gametests from. Empty = all namespaces.
|
||||
systemProperty 'neoforge.enabledGameTestNamespaces', "actuallyadditions"
|
||||
}
|
||||
|
||||
server {
|
||||
workingDirectory project.file('run')
|
||||
mods {
|
||||
actuallyadditions {
|
||||
source sourceSets.main
|
||||
}
|
||||
}
|
||||
systemProperty 'neoforge.enabledGameTestNamespaces', "actuallyadditions"
|
||||
programArgument '--nogui'
|
||||
}
|
||||
|
||||
data {
|
||||
workingDirectory project.file('run')
|
||||
args '--mod', 'actuallyadditions', '--all', '--output', file('src/generated/resources/'), '--existing', file('src/main/resources/')
|
||||
// example of overriding the workingDirectory set in configureEach above, uncomment if you want to use it
|
||||
// workingDirectory project.file('run-data')
|
||||
|
||||
mods {
|
||||
actuallyadditions {
|
||||
source sourceSets.main
|
||||
}
|
||||
}
|
||||
}
|
||||
// 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"
|
||||
}
|
||||
maven {
|
||||
url = "https://www.cursemaven.com"
|
||||
url "https://cursemaven.com"
|
||||
content {
|
||||
includeGroup "curse.maven"
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
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 fg.deobf("mezz.jei:jei-${game_version}-forge-api:${jei_version}")
|
||||
compileOnly "mezz.jei:jei-${game_version}-common-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 fg.deobf("curse.maven:mekanism-268560:5125665")
|
||||
runtimeOnly "curse.maven:the-one-probe-245211:5084077"
|
||||
runtimeOnly "curse.maven:mekanism-268560:5155329"
|
||||
}
|
||||
|
||||
// not sure if this is still needed
|
||||
|
@ -107,12 +115,6 @@ jar {
|
|||
from sourceSets.main.output
|
||||
}
|
||||
|
||||
task deobfJar(type: Jar) {
|
||||
from sourceSets.main.output
|
||||
from sourceSets.main.java
|
||||
archiveClassifier.set('dev')
|
||||
}
|
||||
|
||||
task apiJar(type: Jar) {
|
||||
from sourceSets.main.output
|
||||
from sourceSets.main.java
|
||||
|
@ -135,7 +137,7 @@ task sourcesJar(type: Jar) {
|
|||
}
|
||||
|
||||
artifacts {
|
||||
archives deobfJar, sourcesJar, apiJar, javadocJar
|
||||
archives sourcesJar, apiJar, javadocJar
|
||||
}
|
||||
|
||||
publishing {
|
||||
|
@ -148,7 +150,6 @@ publishing {
|
|||
|
||||
from components.java
|
||||
|
||||
artifact deobfJar
|
||||
artifact sourcesJar
|
||||
artifact apiJar
|
||||
artifact javadocJar
|
||||
|
|
|
@ -6,11 +6,12 @@ org.gradle.daemon=false
|
|||
mod_version=1.1.52
|
||||
|
||||
# Forge
|
||||
game_version=1.20.1
|
||||
forge_version=47.1.3
|
||||
game_version=1.20.4
|
||||
neo_version=20.4.190
|
||||
|
||||
# Parchment (Mappings)
|
||||
parchment_version=2023.09.03
|
||||
neogradle.subsystems.parchment.minecraftVersion=1.20.4
|
||||
neogradle.subsystems.parchment.mappingsVersion=2024.02.25
|
||||
|
||||
# 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
|
||||
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
|
||||
validateDistributionUrl=true
|
||||
zipStoreBase=GRADLE_USER_HOME
|
||||
zipStorePath=wrapper/dists
|
||||
|
|
29
gradlew
vendored
29
gradlew
vendored
|
@ -83,10 +83,8 @@ done
|
|||
# This is normally unused
|
||||
# shellcheck disable=SC2034
|
||||
APP_BASE_NAME=${0##*/}
|
||||
APP_HOME=$( cd "${APP_HOME:-./}" && 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"'
|
||||
# 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
|
||||
|
||||
# Use the maximum available, or set MAX_FD != -1 to use that value.
|
||||
MAX_FD=maximum
|
||||
|
@ -133,10 +131,13 @@ location of your Java installation."
|
|||
fi
|
||||
else
|
||||
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
|
||||
location of your Java installation."
|
||||
fi
|
||||
fi
|
||||
|
||||
# Increase the maximum file descriptors if we can.
|
||||
|
@ -144,7 +145,7 @@ if ! "$cygwin" && ! "$darwin" && ! "$nonstop" ; then
|
|||
case $MAX_FD in #(
|
||||
max*)
|
||||
# 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 ) ||
|
||||
warn "Could not query maximum file descriptor limit"
|
||||
esac
|
||||
|
@ -152,7 +153,7 @@ if ! "$cygwin" && ! "$darwin" && ! "$nonstop" ; then
|
|||
'' | soft) :;; #(
|
||||
*)
|
||||
# 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" ||
|
||||
warn "Could not set maximum file descriptor limit to $MAX_FD"
|
||||
esac
|
||||
|
@ -197,11 +198,15 @@ if "$cygwin" || "$msys" ; then
|
|||
done
|
||||
fi
|
||||
|
||||
# Collect all arguments for the java command;
|
||||
# * $DEFAULT_JVM_OPTS, $JAVA_OPTS, and $GRADLE_OPTS can contain fragments of
|
||||
# shell script including quotes and variable substitutions, so put them in
|
||||
# double quotes to make sure that they get re-expanded; and
|
||||
# * put everything else in single quotes, so that it's not re-expanded.
|
||||
|
||||
# Add default JVM options here. You can also use JAVA_OPTS and GRADLE_OPTS to pass JVM options to this script.
|
||||
DEFAULT_JVM_OPTS='"-Xmx64m" "-Xms64m"'
|
||||
|
||||
# Collect all arguments for the java command:
|
||||
# * DEFAULT_JVM_OPTS, JAVA_OPTS, JAVA_OPTS, and optsEnvironmentVar are not allowed to contain shell fragments,
|
||||
# and any embedded shellness will be escaped.
|
||||
# * For example: A user cannot expect ${Hostname} to be expanded, as it is an environment variable and will be
|
||||
# treated as '${Hostname}' itself on the command line.
|
||||
|
||||
set -- \
|
||||
"-Dorg.gradle.appname=$APP_BASE_NAME" \
|
||||
|
|
20
gradlew.bat
vendored
20
gradlew.bat
vendored
|
@ -43,11 +43,11 @@ set JAVA_EXE=java.exe
|
|||
%JAVA_EXE% -version >NUL 2>&1
|
||||
if %ERRORLEVEL% equ 0 goto execute
|
||||
|
||||
echo.
|
||||
echo ERROR: JAVA_HOME is not set and no 'java' command could be found in your PATH.
|
||||
echo.
|
||||
echo Please set the JAVA_HOME variable in your environment to match the
|
||||
echo location of your Java installation.
|
||||
echo. 1>&2
|
||||
echo ERROR: JAVA_HOME is not set and no 'java' command could be found in your PATH. 1>&2
|
||||
echo. 1>&2
|
||||
echo Please set the JAVA_HOME variable in your environment to match the 1>&2
|
||||
echo location of your Java installation. 1>&2
|
||||
|
||||
goto fail
|
||||
|
||||
|
@ -57,11 +57,11 @@ set JAVA_EXE=%JAVA_HOME%/bin/java.exe
|
|||
|
||||
if exist "%JAVA_EXE%" goto execute
|
||||
|
||||
echo.
|
||||
echo ERROR: JAVA_HOME is set to an invalid directory: %JAVA_HOME%
|
||||
echo.
|
||||
echo Please set the JAVA_HOME variable in your environment to match the
|
||||
echo location of your Java installation.
|
||||
echo. 1>&2
|
||||
echo ERROR: JAVA_HOME is set to an invalid directory: %JAVA_HOME% 1>&2
|
||||
echo. 1>&2
|
||||
echo Please set the JAVA_HOME variable in your environment to match the 1>&2
|
||||
echo location of your Java installation. 1>&2
|
||||
|
||||
goto fail
|
||||
|
||||
|
|
|
@ -2,13 +2,12 @@ pluginManagement {
|
|||
repositories {
|
||||
gradlePluginPortal()
|
||||
maven {
|
||||
name = 'MinecraftForge'
|
||||
url = 'https://maven.minecraftforge.net/'
|
||||
name = 'Official NeoForge Maven'
|
||||
url = 'https://maven.neoforged.net/releases'
|
||||
}
|
||||
maven { url = 'https://maven.parchmentmc.org' }
|
||||
}
|
||||
}
|
||||
|
||||
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.recipe.CoffeeIngredient;
|
||||
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.CrushingRecipe;
|
||||
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.LensKiller;
|
||||
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.world.item.ItemStack;
|
||||
import net.minecraft.world.item.crafting.Ingredient;
|
||||
import net.minecraft.world.item.crafting.RecipeHolder;
|
||||
|
||||
import java.util.ArrayList;
|
||||
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_VERSION = "34";
|
||||
|
||||
public static final List<CrushingRecipe> CRUSHER_RECIPES = new ArrayList<>();
|
||||
public static final List<EmpowererRecipe> EMPOWERER_RECIPES = new ArrayList<>();
|
||||
public static final List<ColorChangeRecipe> COLOR_CHANGE_RECIPES = new ArrayList<>();
|
||||
public static final List<SolidFuelRecipe> SOLID_FUEL_RECIPES = new ArrayList<>();
|
||||
public static final List<LiquidFuelRecipe> LIQUID_FUEL_RECIPES = new ArrayList<>();
|
||||
public static final List<PressingRecipe> PRESSING_RECIPES = new ArrayList<>();
|
||||
public static final List<FermentingRecipe> FERMENTING_RECIPES = new ArrayList<>();
|
||||
public static final List<LaserRecipe> CONVERSION_LASER_RECIPES = new ArrayList<>();
|
||||
public static final List<MiningLensRecipe> MINING_LENS_RECIPES = new ArrayList<>();
|
||||
public static final List<RecipeHolder<CrushingRecipe>> CRUSHER_RECIPES = new ArrayList<>();
|
||||
public static final List<RecipeHolder<EmpowererRecipe>> EMPOWERER_RECIPES = new ArrayList<>();
|
||||
public static final List<RecipeHolder<ColorChangeRecipe>> COLOR_CHANGE_RECIPES = new ArrayList<>();
|
||||
public static final List<RecipeHolder<SolidFuelRecipe>> SOLID_FUEL_RECIPES = new ArrayList<>();
|
||||
public static final List<RecipeHolder<LiquidFuelRecipe>> LIQUID_FUEL_RECIPES = new ArrayList<>();
|
||||
public static final List<RecipeHolder<PressingRecipe>> PRESSING_RECIPES = new ArrayList<>();
|
||||
public static final List<RecipeHolder<FermentingRecipe>> FERMENTING_RECIPES = new ArrayList<>();
|
||||
public static final List<RecipeHolder<LaserRecipe>> CONVERSION_LASER_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.
|
||||
|
@ -142,28 +146,30 @@ public final class ActuallyAdditionsAPI {
|
|||
* Adds a Recipe to the Crusher Recipe Registry
|
||||
*
|
||||
* @param input The input as an ItemStack
|
||||
* @param outputOne The first output as an ItemStack
|
||||
* @param outputTwo The second output 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 outputOne The first stack as an ItemStack
|
||||
* @param outputTwo The second stack as an ItemStack (can be ItemStack.EMPTY if there should be none)
|
||||
* @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) {
|
||||
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
|
||||
: outputTwo, outputTwoChance));
|
||||
: outputTwo, outputTwoChance)));
|
||||
}
|
||||
|
||||
/**
|
||||
* Adds a Recipe to the Crusher Recipe Registry
|
||||
*
|
||||
* @param input The input as an Ingredient
|
||||
* @param outputOne The first output as an ItemStack
|
||||
* @param outputTwo The second output 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 outputOne The first stack as an ItemStack
|
||||
* @param outputTwo The second stack as an ItemStack (can be ItemStack.EMPTY if there should be none)
|
||||
* @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) {
|
||||
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");
|
||||
CRUSHER_RECIPES.add(new RecipeHolder<>(id, new CrushingRecipe(input, outputOne, 1.0f, outputTwo.isEmpty()
|
||||
? ItemStack.EMPTY
|
||||
: outputTwo, outputTwoChance));
|
||||
: outputTwo, outputTwoChance)));
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -172,10 +178,10 @@ public final class ActuallyAdditionsAPI {
|
|||
*
|
||||
* @param inputs The inputs 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 outputTwoAmounts The amount of the second output, 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 outputTwoAmounts The amount of the second stack, will be equal for all entries in the list
|
||||
* @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) {
|
||||
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) {
|
||||
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
|
||||
*
|
||||
* @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 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!
|
||||
*/
|
||||
@Deprecated
|
||||
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
|
||||
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
|
||||
*
|
||||
* @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 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!
|
||||
*/
|
||||
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) {
|
||||
//addReconstructorLensConversionRecipe(input, output, energyUse, lensDefaultConversion);
|
||||
//addReconstructorLensConversionRecipe(input, stack, energyUse, lensDefaultConversion);
|
||||
}
|
||||
/**
|
||||
* Adds an ingredient to the Coffee Machine ingredient list
|
||||
|
|
|
@ -11,8 +11,8 @@
|
|||
package de.ellpeck.actuallyadditions.api.booklet;
|
||||
|
||||
import net.minecraft.world.item.ItemStack;
|
||||
import net.minecraftforge.api.distmarker.Dist;
|
||||
import net.minecraftforge.api.distmarker.OnlyIn;
|
||||
import net.neoforged.api.distmarker.Dist;
|
||||
import net.neoforged.api.distmarker.OnlyIn;
|
||||
|
||||
public interface IBookletChapter {
|
||||
|
||||
|
|
|
@ -10,8 +10,8 @@
|
|||
|
||||
package de.ellpeck.actuallyadditions.api.booklet;
|
||||
|
||||
import net.minecraftforge.api.distmarker.Dist;
|
||||
import net.minecraftforge.api.distmarker.OnlyIn;
|
||||
import net.neoforged.api.distmarker.Dist;
|
||||
import net.neoforged.api.distmarker.OnlyIn;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
|
|
|
@ -13,9 +13,9 @@ package de.ellpeck.actuallyadditions.api.booklet;
|
|||
import de.ellpeck.actuallyadditions.api.booklet.internal.GuiBookletBase;
|
||||
import net.minecraft.client.gui.components.Button;
|
||||
import net.minecraft.world.item.ItemStack;
|
||||
import net.minecraftforge.api.distmarker.Dist;
|
||||
import net.minecraftforge.api.distmarker.OnlyIn;
|
||||
import net.minecraftforge.fluids.FluidStack;
|
||||
import net.neoforged.api.distmarker.Dist;
|
||||
import net.neoforged.api.distmarker.OnlyIn;
|
||||
import net.neoforged.neoforge.fluids.FluidStack;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
|
|
|
@ -3,6 +3,7 @@ package de.ellpeck.actuallyadditions.data;
|
|||
import de.ellpeck.actuallyadditions.mod.ActuallyAdditions;
|
||||
import de.ellpeck.actuallyadditions.mod.config.conditions.BoolConfigCondition;
|
||||
import de.ellpeck.actuallyadditions.mod.misc.ActuallyDamageTypes;
|
||||
import net.minecraft.core.Cloner;
|
||||
import net.minecraft.core.HolderLookup;
|
||||
import net.minecraft.core.RegistryAccess;
|
||||
import net.minecraft.core.RegistrySetBuilder;
|
||||
|
@ -12,12 +13,12 @@ import net.minecraft.data.DataGenerator;
|
|||
import net.minecraft.data.PackOutput;
|
||||
import net.minecraft.data.registries.VanillaRegistries;
|
||||
import net.minecraft.world.damagesource.DamageType;
|
||||
import net.minecraftforge.common.crafting.CraftingHelper;
|
||||
import net.minecraftforge.common.data.DatapackBuiltinEntriesProvider;
|
||||
import net.minecraftforge.common.data.ExistingFileHelper;
|
||||
import net.minecraftforge.data.event.GatherDataEvent;
|
||||
import net.minecraftforge.eventbus.api.SubscribeEvent;
|
||||
import net.minecraftforge.fml.common.Mod;
|
||||
import net.neoforged.neoforge.common.crafting.CraftingHelper;
|
||||
import net.neoforged.neoforge.common.data.DatapackBuiltinEntriesProvider;
|
||||
import net.neoforged.neoforge.common.data.ExistingFileHelper;
|
||||
import net.neoforged.neoforge.data.event.GatherDataEvent;
|
||||
import net.neoforged.bus.api.SubscribeEvent;
|
||||
import net.neoforged.fml.common.Mod;
|
||||
|
||||
import java.util.Set;
|
||||
import java.util.concurrent.CompletableFuture;
|
||||
|
@ -27,10 +28,10 @@ public class ActuallyAdditionsData {
|
|||
|
||||
@SubscribeEvent
|
||||
public static void runGenerator(GatherDataEvent event) {
|
||||
CraftingHelper.register(BoolConfigCondition.Serializer.INSTANCE);
|
||||
DataGenerator generator = event.getGenerator();
|
||||
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();
|
||||
|
||||
// generator.addProvider(new GeneratorLanguage(generator));
|
||||
|
@ -58,18 +59,20 @@ public class ActuallyAdditionsData {
|
|||
generator.addProvider(true, new SoundsGenerator(packOutput, helper));
|
||||
|
||||
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();
|
||||
registryBuilder.add(Registries.DAMAGE_TYPE, (context) -> {
|
||||
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
|
||||
registryBuilder.add(Registries.BIOME, context -> {
|
||||
registryBuilder.add(Registries.BIOME, $ -> {
|
||||
});
|
||||
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.items.ActuallyItems;
|
||||
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.FrameType;
|
||||
import net.minecraft.advancements.critereon.ImpossibleTrigger;
|
||||
import net.minecraft.advancements.critereon.InventoryChangeTrigger;
|
||||
import net.minecraft.advancements.critereon.ItemPredicate;
|
||||
|
@ -13,37 +15,38 @@ import net.minecraft.core.HolderLookup;
|
|||
import net.minecraft.data.PackOutput;
|
||||
import net.minecraft.network.chat.Component;
|
||||
import net.minecraft.resources.ResourceLocation;
|
||||
import net.minecraftforge.common.data.ExistingFileHelper;
|
||||
import net.minecraftforge.common.data.ForgeAdvancementProvider;
|
||||
import net.neoforged.neoforge.common.data.AdvancementProvider;
|
||||
import net.neoforged.neoforge.common.data.ExistingFileHelper;
|
||||
|
||||
import java.util.List;
|
||||
import java.util.Optional;
|
||||
import java.util.concurrent.CompletableFuture;
|
||||
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) {
|
||||
super(packOutput, registries, existingFileHelper, List.of(new ActuallyAdvancementGenerator()));
|
||||
}
|
||||
|
||||
public static class ActuallyAdvancementGenerator implements AdvancementGenerator {
|
||||
@Override
|
||||
public void generate(HolderLookup.Provider registries, Consumer<Advancement> consumer, ExistingFileHelper existingFileHelper) {
|
||||
Advancement root = Advancement.Builder.advancement()
|
||||
public void generate(HolderLookup.Provider registries, Consumer<AdvancementHolder> consumer, ExistingFileHelper existingFileHelper) {
|
||||
AdvancementHolder root = Advancement.Builder.advancement()
|
||||
.display(new DisplayInfo(ActuallyItems.ITEM_BOOKLET.get().getDefaultInstance(),
|
||||
Component.translatable("achievement.actuallyadditions.openBooklet"),
|
||||
Component.translatable("achievement.actuallyadditions.openBooklet.desc"),
|
||||
new ResourceLocation("textures/gui/advancements/backgrounds/stone.png"), FrameType.TASK, true, true, false))
|
||||
.addCriterion("right_click", new ImpossibleTrigger.TriggerInstance())
|
||||
Optional.of(new ResourceLocation("textures/gui/advancements/backgrounds/stone.png")), AdvancementType.TASK, true, true, false))
|
||||
.addCriterion("right_click", CriteriaTriggers.IMPOSSIBLE.createCriterion(new ImpossibleTrigger.TriggerInstance()))
|
||||
.save(consumer, "actuallyadditions:root");
|
||||
|
||||
//TODO: Underwater Treasure Chest Advancement?
|
||||
|
||||
Advancement phantomFace = Advancement.Builder.advancement()
|
||||
AdvancementHolder phantomFace = Advancement.Builder.advancement()
|
||||
.parent(root)
|
||||
.display(new DisplayInfo(ActuallyBlocks.PHANTOM_ITEMFACE.get().asItem().getDefaultInstance(),
|
||||
Component.translatable("achievement.actuallyadditions.craftPhantomface"),
|
||||
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()))
|
||||
.save(consumer, "actuallyadditions:craft_phantom_face");
|
||||
|
||||
|
@ -53,7 +56,7 @@ public class AdvancementGenerator extends ForgeAdvancementProvider {
|
|||
.display(new DisplayInfo(ActuallyBlocks.PHANTOM_LIQUIFACE.get().asItem().getDefaultInstance(),
|
||||
Component.translatable("achievement.actuallyadditions.craftLiquiface"),
|
||||
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()))
|
||||
.save(consumer, "actuallyadditions:craft_liquiface");
|
||||
|
||||
|
@ -62,17 +65,17 @@ public class AdvancementGenerator extends ForgeAdvancementProvider {
|
|||
.display(new DisplayInfo(ActuallyBlocks.PHANTOM_ENERGYFACE.get().asItem().getDefaultInstance(),
|
||||
Component.translatable("achievement.actuallyadditions.craftEnergyface"),
|
||||
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()))
|
||||
.save(consumer, "actuallyadditions:craft_energyface");
|
||||
|
||||
|
||||
Advancement coalGenerator = Advancement.Builder.advancement()
|
||||
AdvancementHolder coalGenerator = Advancement.Builder.advancement()
|
||||
.parent(root)
|
||||
.display(new DisplayInfo(ActuallyBlocks.COAL_GENERATOR.get().asItem().getDefaultInstance(),
|
||||
Component.translatable("achievement.actuallyadditions.craftCoalGen"),
|
||||
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()))
|
||||
.save(consumer, "actuallyadditions:craft_coal_generator");
|
||||
|
||||
|
@ -81,16 +84,16 @@ public class AdvancementGenerator extends ForgeAdvancementProvider {
|
|||
.display(new DisplayInfo(ActuallyBlocks.LEAF_GENERATOR.get().asItem().getDefaultInstance(),
|
||||
Component.translatable("achievement.actuallyadditions.craftLeafGen"),
|
||||
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()))
|
||||
.save(consumer, "actuallyadditions:craft_leaf_generator");
|
||||
|
||||
Advancement coffeeBeans = Advancement.Builder.advancement()
|
||||
AdvancementHolder coffeeBeans = Advancement.Builder.advancement()
|
||||
.parent(coalGenerator)
|
||||
.display(new DisplayInfo(ActuallyItems.COFFEE_BEANS.get().getDefaultInstance(),
|
||||
Component.translatable("achievement.actuallyadditions.pickUpCoffee"),
|
||||
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()))
|
||||
.save(consumer, "actuallyadditions:pickup_coffee");
|
||||
|
||||
|
@ -99,25 +102,25 @@ public class AdvancementGenerator extends ForgeAdvancementProvider {
|
|||
.display(new DisplayInfo(ActuallyBlocks.COFFEE_MACHINE.get().asItem().getDefaultInstance(),
|
||||
Component.translatable("achievement.actuallyadditions.craftCoffeeMachine"),
|
||||
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()))
|
||||
.save(consumer, "actuallyadditions:craft_coffee_machine");
|
||||
|
||||
Advancement reconstructor = Advancement.Builder.advancement()
|
||||
AdvancementHolder reconstructor = Advancement.Builder.advancement()
|
||||
.parent(coalGenerator)
|
||||
.display(new DisplayInfo(ActuallyBlocks.ATOMIC_RECONSTRUCTOR.get().asItem().getDefaultInstance(),
|
||||
Component.translatable("achievement.actuallyadditions.craftReconstructor"),
|
||||
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()))
|
||||
.save(consumer, "actuallyadditions:craft_reconstructor");
|
||||
|
||||
Advancement makeFirstCrystal = Advancement.Builder.advancement()
|
||||
AdvancementHolder makeFirstCrystal = Advancement.Builder.advancement()
|
||||
.parent(reconstructor)
|
||||
.display(new DisplayInfo(ActuallyItems.EMERADIC_CRYSTAL.get().getDefaultInstance(),
|
||||
Component.translatable("achievement.actuallyadditions.makeCrystal"),
|
||||
Component.translatable("achievement.actuallyadditions.makeCrystal.desc"),
|
||||
null, FrameType.TASK, true, true, false))
|
||||
null, AdvancementType.TASK, true, true, false))
|
||||
.addCriterion("crystal", InventoryChangeTrigger.TriggerInstance.hasItems(
|
||||
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(),
|
||||
Component.translatable("achievement.actuallyadditions.craftEmpowerer"),
|
||||
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()))
|
||||
.save(consumer, "actuallyadditions:craft_empowerer");
|
||||
|
||||
Advancement craftCrusher = Advancement.Builder.advancement()
|
||||
AdvancementHolder craftCrusher = Advancement.Builder.advancement()
|
||||
.parent(reconstructor)
|
||||
.display(new DisplayInfo(ActuallyBlocks.CRUSHER.get().asItem().getDefaultInstance(),
|
||||
Component.translatable("achievement.actuallyadditions.craftCrusher"),
|
||||
Component.translatable("achievement.actuallyadditions.craftCrusher.desc"),
|
||||
null, FrameType.TASK, true, true, false))
|
||||
null, AdvancementType.TASK, true, true, false))
|
||||
.addCriterion("crystal", InventoryChangeTrigger.TriggerInstance.hasItems(
|
||||
ItemPredicate.Builder.item().of(ActuallyBlocks.CRUSHER.get()).build())
|
||||
)
|
||||
.save(consumer, "actuallyadditions:craft_crusher");
|
||||
|
||||
Advancement craftDoubleCrusher = Advancement.Builder.advancement()
|
||||
AdvancementHolder craftDoubleCrusher = Advancement.Builder.advancement()
|
||||
.parent(craftCrusher)
|
||||
.display(new DisplayInfo(ActuallyBlocks.CRUSHER_DOUBLE.get().asItem().getDefaultInstance(),
|
||||
Component.translatable("achievement.actuallyadditions.craftDoubleCrusher"),
|
||||
Component.translatable("achievement.actuallyadditions.craftDoubleCrusher.desc"),
|
||||
null, FrameType.TASK, true, true, false))
|
||||
null, AdvancementType.TASK, true, true, false))
|
||||
.addCriterion("crystal", InventoryChangeTrigger.TriggerInstance.hasItems(
|
||||
ItemPredicate.Builder.item().of(ActuallyBlocks.CRUSHER_DOUBLE.get()).build())
|
||||
)
|
||||
.save(consumer, "actuallyadditions:craft_double_crusher");
|
||||
|
||||
Advancement craftLaserRelay = Advancement.Builder.advancement()
|
||||
AdvancementHolder craftLaserRelay = Advancement.Builder.advancement()
|
||||
.parent(reconstructor)
|
||||
.display(new DisplayInfo(ActuallyBlocks.LASER_RELAY.get().asItem().getDefaultInstance(),
|
||||
Component.translatable("achievement.actuallyadditions.craftLaserRelay"),
|
||||
Component.translatable("achievement.actuallyadditions.craftLaserRelay.desc"),
|
||||
null, FrameType.TASK, true, true, false))
|
||||
null, AdvancementType.TASK, true, true, false))
|
||||
.addCriterion("laser_relay", InventoryChangeTrigger.TriggerInstance.hasItems(
|
||||
ItemPredicate.Builder.item().of(ActuallyBlocks.LASER_RELAY.get()).build())
|
||||
)
|
||||
.save(consumer, "actuallyadditions:craft_laser_relay");
|
||||
|
||||
Advancement craftLaserRelayAdvanced = Advancement.Builder.advancement()
|
||||
AdvancementHolder craftLaserRelayAdvanced = Advancement.Builder.advancement()
|
||||
.parent(craftLaserRelay)
|
||||
.display(new DisplayInfo(ActuallyBlocks.LASER_RELAY_ADVANCED.get().asItem().getDefaultInstance(),
|
||||
Component.translatable("achievement.actuallyadditions.craftLaserRelayAdvanced"),
|
||||
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(
|
||||
ItemPredicate.Builder.item().of(ActuallyBlocks.LASER_RELAY_ADVANCED.get()).build())
|
||||
)
|
||||
.save(consumer, "actuallyadditions:craft_laser_relay_advanced");
|
||||
|
||||
Advancement craftLaserRelayExtreme = Advancement.Builder.advancement()
|
||||
AdvancementHolder craftLaserRelayExtreme = Advancement.Builder.advancement()
|
||||
.parent(craftLaserRelayAdvanced)
|
||||
.display(new DisplayInfo(ActuallyBlocks.LASER_RELAY_EXTREME.get().asItem().getDefaultInstance(),
|
||||
Component.translatable("achievement.actuallyadditions.craftLaserRelayExtreme"),
|
||||
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(
|
||||
ItemPredicate.Builder.item().of(ActuallyBlocks.LASER_RELAY_EXTREME.get()).build())
|
||||
)
|
||||
.save(consumer, "actuallyadditions:craft_laser_relay_extreme");
|
||||
|
||||
Advancement craftLaserRelayItem = Advancement.Builder.advancement()
|
||||
AdvancementHolder craftLaserRelayItem = Advancement.Builder.advancement()
|
||||
.parent(craftLaserRelay)
|
||||
.display(new DisplayInfo(ActuallyBlocks.LASER_RELAY_ITEM.get().asItem().getDefaultInstance(),
|
||||
Component.translatable("achievement.actuallyadditions.craftLaserRelayItem"),
|
||||
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(
|
||||
ItemPredicate.Builder.item().of(ActuallyBlocks.LASER_RELAY_ITEM.get()).build())
|
||||
)
|
||||
.save(consumer, "actuallyadditions:craft_laser_relay_item");
|
||||
|
||||
Advancement craftItemInterface = Advancement.Builder.advancement()
|
||||
AdvancementHolder craftItemInterface = Advancement.Builder.advancement()
|
||||
.parent(craftLaserRelay)
|
||||
.display(new DisplayInfo(ActuallyBlocks.ITEM_INTERFACE.get().asItem().getDefaultInstance(),
|
||||
Component.translatable("achievement.actuallyadditions.craftItemInterface"),
|
||||
Component.translatable("achievement.actuallyadditions.craftItemInterface.desc"),
|
||||
null, FrameType.TASK, true, true, false))
|
||||
null, AdvancementType.TASK, true, true, false))
|
||||
.addCriterion("item_interface", InventoryChangeTrigger.TriggerInstance.hasItems(
|
||||
ItemPredicate.Builder.item().of(ActuallyBlocks.ITEM_INTERFACE.get()).build())
|
||||
)
|
||||
|
|
|
@ -1,26 +1,21 @@
|
|||
package de.ellpeck.actuallyadditions.data;
|
||||
|
||||
import com.google.gson.JsonObject;
|
||||
import de.ellpeck.actuallyadditions.api.ActuallyTags;
|
||||
import de.ellpeck.actuallyadditions.mod.blocks.ActuallyBlocks;
|
||||
import de.ellpeck.actuallyadditions.mod.items.ActuallyItems;
|
||||
import net.minecraft.data.CachedOutput;
|
||||
import net.minecraft.data.PackOutput;
|
||||
import net.minecraft.data.recipes.FinishedRecipe;
|
||||
import net.minecraft.data.recipes.RecipeCategory;
|
||||
import net.minecraft.data.recipes.RecipeOutput;
|
||||
import net.minecraft.data.recipes.RecipeProvider;
|
||||
import net.minecraft.data.recipes.ShapedRecipeBuilder;
|
||||
import net.minecraft.data.recipes.ShapelessRecipeBuilder;
|
||||
import net.minecraft.tags.ItemTags;
|
||||
import net.minecraft.world.item.Items;
|
||||
import net.minecraft.world.level.ItemLike;
|
||||
import net.minecraftforge.common.Tags;
|
||||
import org.jetbrains.annotations.Nullable;
|
||||
import net.neoforged.neoforge.common.Tags;
|
||||
|
||||
import javax.annotation.Nonnull;
|
||||
import java.util.Arrays;
|
||||
import java.util.concurrent.CompletableFuture;
|
||||
import java.util.function.Consumer;
|
||||
|
||||
public class BlockRecipeGenerator extends RecipeProvider {
|
||||
public BlockRecipeGenerator(PackOutput packOutput) {
|
||||
|
@ -28,7 +23,7 @@ public class BlockRecipeGenerator extends RecipeProvider {
|
|||
}
|
||||
|
||||
@Override
|
||||
protected void buildRecipes(@Nonnull Consumer<FinishedRecipe> consumer) {
|
||||
protected void buildRecipes(@Nonnull RecipeOutput consumer) {
|
||||
//Battery Box
|
||||
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
|
||||
protected @Nullable CompletableFuture<?> saveAdvancement(CachedOutput output, FinishedRecipe finishedRecipe, JsonObject advancementJson) {
|
||||
return null;
|
||||
//Nope... maybe later...
|
||||
}
|
||||
// @Override //TODO: Flanks do your RecipeOutput wrapper thingy ;)
|
||||
// protected @Nullable CompletableFuture<?> saveAdvancement(CachedOutput stack, FinishedRecipe finishedRecipe, JsonObject advancementJson) {
|
||||
// return null;
|
||||
// //Nope... maybe later...
|
||||
// }
|
||||
|
||||
public static class Recipe {
|
||||
public static Shapeless shapeless(ItemLike result) {
|
||||
|
@ -255,15 +250,15 @@ public class BlockRecipeGenerator extends RecipeProvider {
|
|||
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);
|
||||
}
|
||||
|
||||
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);
|
||||
}
|
||||
|
||||
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);
|
||||
}
|
||||
|
||||
|
@ -282,7 +277,7 @@ public class BlockRecipeGenerator extends RecipeProvider {
|
|||
}
|
||||
|
||||
@Override
|
||||
public void save(Consumer<FinishedRecipe> consumer) {
|
||||
public void save(RecipeOutput consumer) {
|
||||
this.unlockedBy("has_book", has(ActuallyItems.ITEM_BOOKLET.get()));
|
||||
super.save(consumer);
|
||||
}
|
||||
|
@ -320,7 +315,7 @@ public class BlockRecipeGenerator extends RecipeProvider {
|
|||
}
|
||||
|
||||
@Override
|
||||
public void save(Consumer<FinishedRecipe> consumerIn) {
|
||||
public void save(RecipeOutput consumerIn) {
|
||||
this.unlockedBy("has_book", has(ActuallyItems.ITEM_BOOKLET.get()));
|
||||
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.BlockTinyTorch;
|
||||
import net.minecraft.core.Direction;
|
||||
import net.minecraft.core.registries.BuiltInRegistries;
|
||||
import net.minecraft.data.PackOutput;
|
||||
import net.minecraft.resources.ResourceLocation;
|
||||
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.WallBlock;
|
||||
import net.minecraft.world.level.block.state.properties.BlockStateProperties;
|
||||
import net.minecraftforge.client.model.generators.BlockStateProvider;
|
||||
import net.minecraftforge.client.model.generators.ConfiguredModel;
|
||||
import net.minecraftforge.client.model.generators.ModelFile;
|
||||
import net.minecraftforge.common.data.ExistingFileHelper;
|
||||
import net.minecraftforge.registries.ForgeRegistries;
|
||||
import net.neoforged.neoforge.client.model.generators.BlockStateProvider;
|
||||
import net.neoforged.neoforge.client.model.generators.ConfiguredModel;
|
||||
import net.neoforged.neoforge.client.model.generators.ModelFile;
|
||||
import net.neoforged.neoforge.common.data.ExistingFileHelper;
|
||||
|
||||
import java.util.function.Supplier;
|
||||
|
||||
|
@ -210,7 +210,7 @@ public class BlockStateGenerator extends BlockStateProvider {
|
|||
}
|
||||
|
||||
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()));
|
||||
|
||||
assert name != null;
|
||||
|
@ -218,7 +218,7 @@ public class BlockStateGenerator extends BlockStateProvider {
|
|||
}
|
||||
|
||||
private void standardBlockWithCube(Supplier<Block> block) {
|
||||
ResourceLocation name = ForgeRegistries.BLOCKS.getKey(block.get());
|
||||
ResourceLocation name = BuiltInRegistries.BLOCK.getKey(block.get());
|
||||
assert name != null;
|
||||
|
||||
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) {
|
||||
ResourceLocation name = ForgeRegistries.BLOCKS.getKey(block.get());
|
||||
ResourceLocation name = BuiltInRegistries.BLOCK.getKey(block.get());
|
||||
assert name != null;
|
||||
|
||||
getVariantBuilder(block.get())
|
||||
|
@ -237,7 +237,7 @@ public class BlockStateGenerator extends BlockStateProvider {
|
|||
}
|
||||
|
||||
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 verModel = new ModelFile.UncheckedModelFile(modLoc("block/" + name.getPath() + "_ver"));
|
||||
|
||||
|
@ -246,7 +246,7 @@ public class BlockStateGenerator extends BlockStateProvider {
|
|||
}
|
||||
|
||||
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()));
|
||||
|
||||
assert name != null;
|
||||
|
@ -255,7 +255,7 @@ public class BlockStateGenerator extends BlockStateProvider {
|
|||
|
||||
private void tinyTorchBlock(Supplier<Block> block) {
|
||||
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 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.data.PackOutput;
|
||||
import net.minecraft.tags.BlockTags;
|
||||
import net.minecraftforge.common.data.BlockTagsProvider;
|
||||
import net.minecraftforge.common.data.ExistingFileHelper;
|
||||
import net.neoforged.neoforge.common.data.BlockTagsProvider;
|
||||
import net.neoforged.neoforge.common.data.ExistingFileHelper;
|
||||
|
||||
import javax.annotation.Nullable;
|
||||
import java.util.concurrent.CompletableFuture;
|
||||
|
|
|
@ -1,24 +1,19 @@
|
|||
package de.ellpeck.actuallyadditions.data;
|
||||
|
||||
import com.google.gson.JsonObject;
|
||||
import de.ellpeck.actuallyadditions.mod.ActuallyAdditions;
|
||||
import de.ellpeck.actuallyadditions.mod.blocks.ActuallyBlocks;
|
||||
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.recipes.FinishedRecipe;
|
||||
import net.minecraft.data.recipes.RecipeOutput;
|
||||
import net.minecraft.data.recipes.RecipeProvider;
|
||||
import net.minecraft.resources.ResourceLocation;
|
||||
import net.minecraft.world.item.ItemStack;
|
||||
import net.minecraft.world.item.Items;
|
||||
import net.minecraft.world.item.crafting.Ingredient;
|
||||
import net.minecraft.world.level.ItemLike;
|
||||
import net.minecraftforge.registries.ForgeRegistries;
|
||||
import org.jetbrains.annotations.Nullable;
|
||||
|
||||
import javax.annotation.Nonnull;
|
||||
import java.util.concurrent.CompletableFuture;
|
||||
import java.util.function.Consumer;
|
||||
|
||||
public class ColorChangeGenerator extends RecipeProvider {
|
||||
public ColorChangeGenerator(PackOutput packOutput) {
|
||||
|
@ -30,13 +25,14 @@ public class ColorChangeGenerator extends RecipeProvider {
|
|||
return "Color Change " + super.getName();
|
||||
}
|
||||
|
||||
@Override
|
||||
protected @Nullable CompletableFuture<?> saveAdvancement(CachedOutput output, FinishedRecipe finishedRecipe, JsonObject advancementJson) {
|
||||
return null; //Nope...
|
||||
}
|
||||
// @Override //TODO: Flanks do your RecipeOutput wrapper thingy ;)
|
||||
// protected @Nullable CompletableFuture<?> saveAdvancement(CachedOutput stack, FinishedRecipe finishedRecipe, JsonObject advancementJson) {
|
||||
// return null;
|
||||
// //Nope... maybe later...
|
||||
// }
|
||||
|
||||
@Override
|
||||
protected void buildRecipes(@Nonnull Consumer<FinishedRecipe> consumer) {
|
||||
protected void buildRecipes(@Nonnull RecipeOutput consumer) {
|
||||
buildWool(consumer);
|
||||
buildStainedGlass(consumer);
|
||||
buildStainedGlassPane(consumer);
|
||||
|
@ -47,7 +43,7 @@ public class ColorChangeGenerator extends RecipeProvider {
|
|||
buildDye(consumer);
|
||||
}
|
||||
|
||||
private void buildWool(@Nonnull Consumer<FinishedRecipe> c) {
|
||||
private void buildWool(@Nonnull RecipeOutput c) {
|
||||
//Wool
|
||||
changeColor(c, Items.WHITE_WOOL, Items.BLACK_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);
|
||||
}
|
||||
|
||||
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.ORANGE_STAINED_GLASS, Items.WHITE_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);
|
||||
}
|
||||
|
||||
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.ORANGE_STAINED_GLASS_PANE, Items.WHITE_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);
|
||||
}
|
||||
|
||||
private void buildTerracotta(@Nonnull Consumer<FinishedRecipe> c) {
|
||||
private void buildTerracotta(@Nonnull RecipeOutput c) {
|
||||
changeColor(c, Items.WHITE_TERRACOTTA, Items.BLACK_TERRACOTTA);
|
||||
changeColor(c, Items.ORANGE_TERRACOTTA, Items.WHITE_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);
|
||||
}
|
||||
|
||||
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.ORANGE_GLAZED_TERRACOTTA, Items.WHITE_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);
|
||||
}
|
||||
|
||||
private void buildCarpet(@Nonnull Consumer<FinishedRecipe> c) {
|
||||
private void buildCarpet(@Nonnull RecipeOutput c) {
|
||||
changeColor(c, Items.WHITE_CARPET, Items.BLACK_CARPET);
|
||||
changeColor(c, Items.ORANGE_CARPET, Items.WHITE_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);
|
||||
}
|
||||
|
||||
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_ORANGE.getItem(), ActuallyBlocks.LAMP_WHITE.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());
|
||||
}
|
||||
|
||||
private void buildDye(@Nonnull Consumer<FinishedRecipe> c) {
|
||||
private void buildDye(@Nonnull RecipeOutput c) {
|
||||
changeColor(c, Items.WHITE_DYE, Items.BLACK_DYE);
|
||||
changeColor(c, Items.ORANGE_DYE, Items.WHITE_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) {
|
||||
consumer.accept(new ColorChangeRecipe.Result(new ResourceLocation(ActuallyAdditions.MODID, "colorchange/" + ForgeRegistries.ITEMS.getKey(output.asItem()).getPath()),
|
||||
input, output));
|
||||
private void changeColor(RecipeOutput consumer, ItemLike output, Ingredient input) {
|
||||
consumer.accept(new ResourceLocation(ActuallyAdditions.MODID, "colorchange/" + BuiltInRegistries.ITEM.getKey(output.asItem()).getPath()),
|
||||
new ColorChangeRecipe(output.asItem().getDefaultInstance(), input), null);
|
||||
}
|
||||
private void changeColor(Consumer<FinishedRecipe> consumer, ItemLike output, ItemLike input) {
|
||||
consumer.accept(new ColorChangeRecipe.Result(new ResourceLocation(ActuallyAdditions.MODID, "colorchange/" + ForgeRegistries.ITEMS.getKey(output.asItem()).getPath()),
|
||||
Ingredient.of(input), output));
|
||||
private void changeColor(RecipeOutput consumer, ItemLike output, ItemLike input) {
|
||||
consumer.accept(new ResourceLocation(ActuallyAdditions.MODID, "colorchange/" + BuiltInRegistries.ITEM.getKey(output.asItem()).getPath()),
|
||||
new ColorChangeRecipe(output.asItem().getDefaultInstance(), Ingredient.of(input)), null);
|
||||
}
|
||||
private void changeColor(Consumer<FinishedRecipe> consumer, ItemLike output, ItemStack input) {
|
||||
consumer.accept(new ColorChangeRecipe.Result(new ResourceLocation(ActuallyAdditions.MODID, "colorchange/" + ForgeRegistries.ITEMS.getKey(output.asItem()).getPath()),
|
||||
Ingredient.of(input), output));
|
||||
private void changeColor(RecipeOutput consumer, ItemLike output, ItemStack input) {
|
||||
consumer.accept(new ResourceLocation(ActuallyAdditions.MODID, "colorchange/" + BuiltInRegistries.ITEM.getKey(output.asItem()).getPath()),
|
||||
new ColorChangeRecipe(output.asItem().getDefaultInstance(), Ingredient.of(input)), null);
|
||||
}
|
||||
}
|
||||
|
|
|
@ -1,19 +1,14 @@
|
|||
package de.ellpeck.actuallyadditions.data;
|
||||
|
||||
import com.google.gson.JsonObject;
|
||||
import de.ellpeck.actuallyadditions.mod.ActuallyAdditions;
|
||||
import de.ellpeck.actuallyadditions.mod.crafting.CrushingRecipe;
|
||||
import net.minecraft.data.CachedOutput;
|
||||
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.resources.ResourceLocation;
|
||||
import net.minecraft.world.item.ItemStack;
|
||||
import net.minecraft.world.item.Items;
|
||||
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 CrushingRecipeGenerator(PackOutput packOutput) {
|
||||
|
@ -25,14 +20,15 @@ public class CrushingRecipeGenerator extends RecipeProvider {
|
|||
return "Crushing " + super.getName();
|
||||
}
|
||||
|
||||
@Override
|
||||
protected @Nullable CompletableFuture<?> saveAdvancement(CachedOutput output, FinishedRecipe finishedRecipe, JsonObject advancementJson) {
|
||||
return null; //Nope...
|
||||
}
|
||||
// @Override //TODO: Flanks do your RecipeOutput wrapper thingy ;)
|
||||
// protected @Nullable CompletableFuture<?> saveAdvancement(CachedOutput stack, FinishedRecipe finishedRecipe, JsonObject advancementJson) {
|
||||
// return null;
|
||||
// //Nope... maybe later...
|
||||
// }
|
||||
|
||||
@Override
|
||||
protected void buildRecipes(Consumer<FinishedRecipe> consumer) {
|
||||
consumer.accept(new CrushingRecipe.Result(new ResourceLocation(ActuallyAdditions.MODID, "crushing/bone_crusher"),
|
||||
Ingredient.of(Items.BONE), Items.BONE_MEAL, 6, 1.0f , Items.AIR, 0, 0.0f));
|
||||
protected void buildRecipes(RecipeOutput consumer) {
|
||||
CrushingRecipe recipe = new CrushingRecipe(Ingredient.of(Items.BONE), new ItemStack(Items.BONE_MEAL, 6), 1.0f, ItemStack.EMPTY, 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.tags.DamageTypeTagsProvider;
|
||||
import net.minecraft.tags.DamageTypeTags;
|
||||
import net.minecraftforge.common.data.ExistingFileHelper;
|
||||
import net.neoforged.neoforge.common.data.ExistingFileHelper;
|
||||
import org.jetbrains.annotations.Nullable;
|
||||
|
||||
import java.util.concurrent.CompletableFuture;
|
||||
|
|
|
@ -1,14 +1,14 @@
|
|||
package de.ellpeck.actuallyadditions.data;
|
||||
|
||||
import com.google.gson.JsonObject;
|
||||
import de.ellpeck.actuallyadditions.mod.ActuallyAdditions;
|
||||
import de.ellpeck.actuallyadditions.mod.blocks.ActuallyBlocks;
|
||||
import de.ellpeck.actuallyadditions.mod.crafting.EmpowererRecipe;
|
||||
import de.ellpeck.actuallyadditions.mod.items.ActuallyItems;
|
||||
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.recipes.FinishedRecipe;
|
||||
import net.minecraft.data.recipes.RecipeOutput;
|
||||
import net.minecraft.data.recipes.RecipeProvider;
|
||||
import net.minecraft.resources.ResourceLocation;
|
||||
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.crafting.Ingredient;
|
||||
import net.minecraft.world.level.ItemLike;
|
||||
import net.minecraftforge.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;
|
||||
import net.neoforged.neoforge.common.Tags;
|
||||
|
||||
public class EmpoweringRecipeGenerator extends RecipeProvider {
|
||||
public EmpoweringRecipeGenerator(PackOutput packOutput) {
|
||||
|
@ -37,13 +30,14 @@ public class EmpoweringRecipeGenerator extends RecipeProvider {
|
|||
return "Empowering " + super.getName();
|
||||
}
|
||||
|
||||
@Override
|
||||
protected @Nullable CompletableFuture<?> saveAdvancement(CachedOutput output, FinishedRecipe finishedRecipe, JsonObject advancementJson) {
|
||||
return null; //Nope...
|
||||
}
|
||||
// @Override //TODO: Flanks do your RecipeOutput wrapper thingy ;)
|
||||
// protected @Nullable CompletableFuture<?> saveAdvancement(CachedOutput stack, FinishedRecipe finishedRecipe, JsonObject advancementJson) {
|
||||
// return null;
|
||||
// //Nope... maybe later...
|
||||
// }
|
||||
|
||||
@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)
|
||||
.addModifier(Tags.Items.DYES_RED)
|
||||
.addModifier(Items.NETHER_BRICK)
|
||||
|
@ -124,7 +118,7 @@ public class EmpoweringRecipeGenerator extends RecipeProvider {
|
|||
private final int energy;
|
||||
private final int time;
|
||||
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) {
|
||||
result = resultIn.asItem();
|
||||
|
@ -140,14 +134,14 @@ public class EmpoweringRecipeGenerator extends RecipeProvider {
|
|||
|
||||
public EmpoweringBuilder addModifier(ItemLike input) {
|
||||
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));
|
||||
return this;
|
||||
}
|
||||
|
||||
public EmpoweringBuilder addModifier(ItemStack input) {
|
||||
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));
|
||||
return this;
|
||||
}
|
||||
|
@ -159,17 +153,21 @@ public class EmpoweringRecipeGenerator extends RecipeProvider {
|
|||
return this;
|
||||
}
|
||||
|
||||
public void save(Consumer<FinishedRecipe> consumer, ResourceLocation name) {
|
||||
public void save(RecipeOutput consumer, ResourceLocation name) {
|
||||
if (modifiers.size() != 4)
|
||||
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);
|
||||
if (modifiers.size() != 4)
|
||||
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;
|
||||
|
||||
import com.google.gson.JsonObject;
|
||||
import de.ellpeck.actuallyadditions.api.ActuallyTags;
|
||||
import de.ellpeck.actuallyadditions.mod.ActuallyAdditions;
|
||||
import de.ellpeck.actuallyadditions.mod.crafting.LiquidFuelRecipe;
|
||||
import de.ellpeck.actuallyadditions.mod.crafting.SolidFuelRecipe;
|
||||
import de.ellpeck.actuallyadditions.mod.fluids.InitFluids;
|
||||
import net.minecraft.data.CachedOutput;
|
||||
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.resources.ResourceLocation;
|
||||
import net.minecraft.tags.TagKey;
|
||||
import net.minecraft.world.item.Item;
|
||||
import net.minecraft.world.item.Items;
|
||||
import net.minecraft.world.item.crafting.Ingredient;
|
||||
import net.minecraftforge.fluids.FluidStack;
|
||||
import org.jetbrains.annotations.Nullable;
|
||||
import net.neoforged.neoforge.fluids.FluidStack;
|
||||
|
||||
import javax.annotation.Nonnull;
|
||||
import java.util.concurrent.CompletableFuture;
|
||||
import java.util.function.Consumer;
|
||||
|
||||
public class FuelRecipeGenerator extends RecipeProvider {
|
||||
public FuelRecipeGenerator(PackOutput packOutput) {
|
||||
|
@ -32,13 +27,14 @@ public class FuelRecipeGenerator extends RecipeProvider {
|
|||
return "Fuel " + super.getName();
|
||||
}
|
||||
|
||||
@Override
|
||||
protected @Nullable CompletableFuture<?> saveAdvancement(CachedOutput output, FinishedRecipe finishedRecipe, JsonObject advancementJson) {
|
||||
return null; //Nope...
|
||||
}
|
||||
// @Override //TODO: Flanks do your RecipeOutput wrapper thingy ;)
|
||||
// protected @Nullable CompletableFuture<?> saveAdvancement(CachedOutput stack, FinishedRecipe finishedRecipe, JsonObject advancementJson) {
|
||||
// return null;
|
||||
// //Nope... maybe later...
|
||||
// }
|
||||
|
||||
@Override
|
||||
protected void buildRecipes(@Nonnull Consumer<FinishedRecipe> consumer) {
|
||||
protected void buildRecipes(@Nonnull RecipeOutput consumer) {
|
||||
addSolid(consumer, "coal", Items.COAL, 32000, 1600);
|
||||
addSolid(consumer, "stick", Items.STICK, 2000, 100);
|
||||
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, "lava", Items.LAVA_BUCKET, 400000, 20000);
|
||||
|
||||
consumer.accept(new LiquidFuelRecipe.Result(new ResourceLocation(ActuallyAdditions.MODID, "liquid_fuel/canola_oil"),
|
||||
new FluidStack(InitFluids.CANOLA_OIL.get(), 50), 4000, 100));
|
||||
consumer.accept(new ResourceLocation(ActuallyAdditions.MODID, "liquid_fuel/canola_oil"), new LiquidFuelRecipe(
|
||||
new FluidStack(InitFluids.CANOLA_OIL.get(), 50), 4000, 100), null);
|
||||
|
||||
consumer.accept(new LiquidFuelRecipe.Result(new ResourceLocation(ActuallyAdditions.MODID, "liquid_fuel/refined_canola_oil"),
|
||||
new FluidStack(InitFluids.REFINED_CANOLA_OIL.get(), 50), 9600, 120));
|
||||
consumer.accept(new ResourceLocation(ActuallyAdditions.MODID, "liquid_fuel/refined_canola_oil"), new LiquidFuelRecipe(
|
||||
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"),
|
||||
new FluidStack(InitFluids.CRYSTALLIZED_OIL.get(), 50), 28000, 280));
|
||||
consumer.accept(new ResourceLocation(ActuallyAdditions.MODID, "liquid_fuel/crystallized_canola_oil"),new LiquidFuelRecipe(
|
||||
new FluidStack(InitFluids.CRYSTALLIZED_OIL.get(), 50), 28000, 280), null);
|
||||
|
||||
consumer.accept(new LiquidFuelRecipe.Result(new ResourceLocation(ActuallyAdditions.MODID, "liquid_fuel/empowered_canola_oil"),
|
||||
new FluidStack(InitFluids.EMPOWERED_OIL.get(), 50), 48000, 400));
|
||||
consumer.accept(new ResourceLocation(ActuallyAdditions.MODID, "liquid_fuel/empowered_canola_oil"), new LiquidFuelRecipe(
|
||||
new FluidStack(InitFluids.EMPOWERED_OIL.get(), 50), 48000, 400), null);
|
||||
}
|
||||
|
||||
private void addSolid(Consumer<FinishedRecipe> 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));
|
||||
private void addSolid(RecipeOutput consumer, String name, Item item, int energy, int 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) {
|
||||
consumer.accept(new SolidFuelRecipe.Result(new ResourceLocation(ActuallyAdditions.MODID, "solid_fuel/"+name), item, energy, burnTime));
|
||||
private void addSolid(RecipeOutput consumer, String name, Ingredient item, int energy, int 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) {
|
||||
consumer.accept(new SolidFuelRecipe.Result(new ResourceLocation(ActuallyAdditions.MODID, "solid_fuel/"+name), Ingredient.of(tag), energy, burnTime));
|
||||
private void addSolid(RecipeOutput consumer, String name, TagKey<Item> tag, int energy, int 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.InitFluids;
|
||||
import de.ellpeck.actuallyadditions.mod.items.ActuallyItems;
|
||||
import net.minecraft.core.registries.BuiltInRegistries;
|
||||
import net.minecraft.data.PackOutput;
|
||||
import net.minecraft.resources.ResourceLocation;
|
||||
import net.minecraft.world.item.Item;
|
||||
import net.minecraft.world.level.block.Block;
|
||||
import net.minecraft.world.level.block.WallBlock;
|
||||
import net.minecraftforge.client.model.generators.ItemModelProvider;
|
||||
import net.minecraftforge.client.model.generators.ModelFile;
|
||||
import net.minecraftforge.client.model.generators.loaders.DynamicFluidContainerModelBuilder;
|
||||
import net.minecraftforge.common.data.ExistingFileHelper;
|
||||
import net.minecraftforge.registries.ForgeRegistries;
|
||||
import net.minecraftforge.registries.RegistryObject;
|
||||
import net.neoforged.neoforge.client.model.generators.ItemModelProvider;
|
||||
import net.neoforged.neoforge.client.model.generators.ModelFile;
|
||||
import net.neoforged.neoforge.client.model.generators.loaders.DynamicFluidContainerModelBuilder;
|
||||
import net.neoforged.neoforge.common.data.ExistingFileHelper;
|
||||
import net.neoforged.neoforge.registries.DeferredHolder;
|
||||
|
||||
import java.util.Set;
|
||||
import java.util.function.Supplier;
|
||||
|
@ -71,16 +71,16 @@ public class ItemModelGenerator extends ItemModelProvider {
|
|||
.override().predicate(new ResourceLocation(ActuallyAdditions.MODID, "snail"), 1F)
|
||||
.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));
|
||||
}
|
||||
|
||||
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()));
|
||||
}
|
||||
|
||||
private void registerBlockModel(RegistryObject<Block> block) {
|
||||
private void registerBlockModel(DeferredHolder<Block, ? extends Block> block) {
|
||||
String path = block.getId().getPath();
|
||||
if (block.get() instanceof WallBlock) {
|
||||
String name = path;
|
||||
|
@ -93,7 +93,7 @@ public class ItemModelGenerator extends ItemModelProvider {
|
|||
}
|
||||
|
||||
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));
|
||||
}
|
||||
}
|
||||
|
|
|
@ -1,17 +1,13 @@
|
|||
package de.ellpeck.actuallyadditions.data;
|
||||
|
||||
import com.google.gson.JsonObject;
|
||||
import de.ellpeck.actuallyadditions.mod.ActuallyAdditions;
|
||||
import de.ellpeck.actuallyadditions.mod.blocks.ActuallyBlocks;
|
||||
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 net.minecraft.data.CachedOutput;
|
||||
import net.minecraft.core.registries.BuiltInRegistries;
|
||||
import net.minecraft.data.PackOutput;
|
||||
import net.minecraft.data.recipes.FinishedRecipe;
|
||||
import net.minecraft.data.recipes.RecipeCategory;
|
||||
import net.minecraft.data.recipes.RecipeOutput;
|
||||
import net.minecraft.data.recipes.RecipeProvider;
|
||||
import net.minecraft.data.recipes.ShapedRecipeBuilder;
|
||||
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.enchantment.Enchantments;
|
||||
import net.minecraft.world.level.ItemLike;
|
||||
import net.minecraftforge.common.Tags;
|
||||
import net.minecraftforge.common.crafting.ConditionalRecipe;
|
||||
import net.minecraftforge.common.crafting.StrictNBTIngredient;
|
||||
import net.minecraftforge.registries.ForgeRegistries;
|
||||
import net.minecraftforge.registries.RegistryObject;
|
||||
import org.jetbrains.annotations.Nullable;
|
||||
import net.neoforged.neoforge.common.Tags;
|
||||
import net.neoforged.neoforge.common.crafting.NBTIngredient;
|
||||
import net.neoforged.neoforge.registries.DeferredItem;
|
||||
|
||||
import javax.annotation.Nonnull;
|
||||
import java.util.Arrays;
|
||||
import java.util.concurrent.CompletableFuture;
|
||||
import java.util.function.Consumer;
|
||||
|
||||
public class ItemRecipeGenerator extends RecipeProvider {
|
||||
public ItemRecipeGenerator(PackOutput packOutput) {
|
||||
|
@ -45,7 +36,7 @@ public class ItemRecipeGenerator extends RecipeProvider {
|
|||
}
|
||||
|
||||
@Override
|
||||
protected void buildRecipes(Consumer<FinishedRecipe> consumer) {
|
||||
protected void buildRecipes(RecipeOutput consumer) {
|
||||
generatePaxels(consumer);
|
||||
|
||||
//Goggles
|
||||
|
@ -156,7 +147,7 @@ public class ItemRecipeGenerator extends RecipeProvider {
|
|||
Recipe.shapeless(ActuallyItems.LENS_OF_THE_KILLER.get())
|
||||
.requires(Items.DIAMOND_SWORD)
|
||||
.requires(ActuallyItems.LENS_OF_CERTAIN_DEATH.get())
|
||||
.requires(StrictNBTIngredient.of(enchantedBook)).save(consumer);
|
||||
.requires(NBTIngredient.of(true, enchantedBook)).save(consumer);
|
||||
|
||||
|
||||
//Filter
|
||||
|
@ -374,45 +365,45 @@ public class ItemRecipeGenerator extends RecipeProvider {
|
|||
.define('C', ActuallyItems.ADVANCED_COIL.get())
|
||||
.save(consumer);
|
||||
|
||||
//Double Battery
|
||||
Recipe.shaped(ActuallyItems.DOUBLE_BATTERY.get())
|
||||
.pattern(" R ")
|
||||
.pattern("ICI")
|
||||
.pattern("III")
|
||||
.define('R', TargetNBTIngredient.of(ActuallyItems.SINGLE_BATTERY.get()))
|
||||
.define('I', ActuallyItems.ENORI_CRYSTAL.get())
|
||||
.define('C', ActuallyItems.ADVANCED_COIL.get())
|
||||
.save(WrappedRecipe.Inject(consumer, ActuallyRecipes.KEEP_DATA_SHAPED_RECIPE.get()));
|
||||
|
||||
//Triple Battery
|
||||
Recipe.shaped(ActuallyItems.TRIPLE_BATTERY.get())
|
||||
.pattern(" R ")
|
||||
.pattern("ICI")
|
||||
.pattern("III")
|
||||
.define('R', TargetNBTIngredient.of(ActuallyItems.DOUBLE_BATTERY.get()))
|
||||
.define('I', ActuallyItems.EMPOWERED_ENORI_CRYSTAL.get())
|
||||
.define('C', ActuallyItems.ADVANCED_COIL.get())
|
||||
.save(WrappedRecipe.Inject(consumer, ActuallyRecipes.KEEP_DATA_SHAPED_RECIPE.get()));
|
||||
|
||||
//Quad Battery
|
||||
Recipe.shaped(ActuallyItems.QUADRUPLE_BATTERY.get())
|
||||
.pattern(" R ")
|
||||
.pattern("ICI")
|
||||
.pattern("III")
|
||||
.define('R', TargetNBTIngredient.of(ActuallyItems.TRIPLE_BATTERY.get()))
|
||||
.define('I', ActuallyItems.EMPOWERED_ENORI_CRYSTAL.get())
|
||||
.define('C', ActuallyItems.ADVANCED_COIL.get())
|
||||
.save(WrappedRecipe.Inject(consumer, ActuallyRecipes.KEEP_DATA_SHAPED_RECIPE.get()));
|
||||
|
||||
//Quintuple Battery
|
||||
Recipe.shaped(ActuallyItems.QUINTUPLE_BATTERY.get())
|
||||
.pattern(" R ")
|
||||
.pattern("ICI")
|
||||
.pattern("III")
|
||||
.define('R', TargetNBTIngredient.of(ActuallyItems.QUADRUPLE_BATTERY.get()))
|
||||
.define('I', ActuallyItems.EMPOWERED_DIAMATINE_CRYSTAL.get())
|
||||
.define('C', ActuallyItems.ADVANCED_COIL.get())
|
||||
.save(WrappedRecipe.Inject(consumer, ActuallyRecipes.KEEP_DATA_SHAPED_RECIPE.get()));
|
||||
// //Double Battery TODO: Flanks please fix these :)
|
||||
// Recipe.shaped(ActuallyItems.DOUBLE_BATTERY.get())
|
||||
// .pattern(" R ")
|
||||
// .pattern("ICI")
|
||||
// .pattern("III")
|
||||
// .define('R', TargetNBTIngredient.of(ActuallyItems.SINGLE_BATTERY.get()))
|
||||
// .define('I', ActuallyItems.ENORI_CRYSTAL.get())
|
||||
// .define('C', ActuallyItems.ADVANCED_COIL.get())
|
||||
// .save(WrappedRecipe.Inject(consumer, ActuallyRecipes.KEEP_DATA_SHAPED_RECIPE.get()));
|
||||
//
|
||||
// //Triple Battery
|
||||
// Recipe.shaped(ActuallyItems.TRIPLE_BATTERY.get())
|
||||
// .pattern(" R ")
|
||||
// .pattern("ICI")
|
||||
// .pattern("III")
|
||||
// .define('R', TargetNBTIngredient.of(ActuallyItems.DOUBLE_BATTERY.get()))
|
||||
// .define('I', ActuallyItems.EMPOWERED_ENORI_CRYSTAL.get())
|
||||
// .define('C', ActuallyItems.ADVANCED_COIL.get())
|
||||
// .save(WrappedRecipe.Inject(consumer, ActuallyRecipes.KEEP_DATA_SHAPED_RECIPE.get()));
|
||||
//
|
||||
// //Quad Battery
|
||||
// Recipe.shaped(ActuallyItems.QUADRUPLE_BATTERY.get())
|
||||
// .pattern(" R ")
|
||||
// .pattern("ICI")
|
||||
// .pattern("III")
|
||||
// .define('R', TargetNBTIngredient.of(ActuallyItems.TRIPLE_BATTERY.get()))
|
||||
// .define('I', ActuallyItems.EMPOWERED_ENORI_CRYSTAL.get())
|
||||
// .define('C', ActuallyItems.ADVANCED_COIL.get())
|
||||
// .save(WrappedRecipe.Inject(consumer, ActuallyRecipes.KEEP_DATA_SHAPED_RECIPE.get()));
|
||||
//
|
||||
// //Quintuple Battery
|
||||
// Recipe.shaped(ActuallyItems.QUINTUPLE_BATTERY.get())
|
||||
// .pattern(" R ")
|
||||
// .pattern("ICI")
|
||||
// .pattern("III")
|
||||
// .define('R', TargetNBTIngredient.of(ActuallyItems.QUADRUPLE_BATTERY.get()))
|
||||
// .define('I', ActuallyItems.EMPOWERED_DIAMATINE_CRYSTAL.get())
|
||||
// .define('C', ActuallyItems.ADVANCED_COIL.get())
|
||||
// .save(WrappedRecipe.Inject(consumer, ActuallyRecipes.KEEP_DATA_SHAPED_RECIPE.get()));
|
||||
|
||||
//Magnet Ring
|
||||
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);
|
||||
|
||||
ConditionalRecipe.builder()
|
||||
.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"));
|
||||
RecipeOutput boolConsumer = consumer.withConditions(new BoolConfigCondition("tinyCoalStuff"));
|
||||
|
||||
ConditionalRecipe.builder()
|
||||
.addCondition(new BoolConfigCondition("tinyCoalStuff"))
|
||||
.addRecipe(
|
||||
Recipe.shapeless(ActuallyItems.TINY_COAL.get(), 8)
|
||||
.requires(Items.COAL)
|
||||
.save(boolConsumer, new ResourceLocation(ActuallyAdditions.MODID, "coal_to_tiny"));
|
||||
Recipe.shapeless(ActuallyItems.TINY_CHARCOAL.get(), 8)
|
||||
.requires(Items.CHARCOAL).save(boolConsumer, new ResourceLocation(ActuallyAdditions.MODID, "charcoal_to_tiny"));
|
||||
Recipe.shaped(Items.COAL)
|
||||
.pattern("CCC", "C C", "CCC").define('C', ActuallyItems.TINY_COAL.get())::save)
|
||||
.generateAdvancement().build(consumer, new ResourceLocation(ActuallyAdditions.MODID, "tiny_to_coal"));
|
||||
ConditionalRecipe.builder()
|
||||
.addCondition(new BoolConfigCondition("tinyCoalStuff"))
|
||||
.addRecipe(
|
||||
.pattern("CCC", "C C", "CCC").define('C', ActuallyItems.TINY_COAL.get())
|
||||
.save(boolConsumer, new ResourceLocation(ActuallyAdditions.MODID, "tiny_to_coal"));
|
||||
Recipe.shaped(Items.CHARCOAL)
|
||||
.pattern("CCC", "C C", "CCC").define('C', ActuallyItems.TINY_CHARCOAL.get())::save)
|
||||
.generateAdvancement().build(consumer, new ResourceLocation(ActuallyAdditions.MODID, "tiny_to_charcoal"));
|
||||
.pattern("CCC", "C C", "CCC").define('C', ActuallyItems.TINY_CHARCOAL.get())
|
||||
.save(boolConsumer, new ResourceLocation(ActuallyAdditions.MODID, "tiny_to_charcoal"));
|
||||
|
||||
//Canola Seeds
|
||||
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);
|
||||
}
|
||||
|
||||
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.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);
|
||||
|
@ -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);
|
||||
}
|
||||
|
||||
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())
|
||||
.requires(axe)
|
||||
.requires(pickaxe)
|
||||
|
@ -535,7 +514,7 @@ public class ItemRecipeGenerator extends RecipeProvider {
|
|||
.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())
|
||||
.requires(axe.get())
|
||||
.requires(pickaxe.get())
|
||||
|
@ -545,25 +524,26 @@ public class ItemRecipeGenerator extends RecipeProvider {
|
|||
.save(consumer);
|
||||
}
|
||||
|
||||
public static void decompress(Consumer<FinishedRecipe> consumer, RegistryObject<Item> output, RegistryObject<Item> input) {
|
||||
ResourceLocation key = ForgeRegistries.ITEMS.getKey(output.get());
|
||||
public static void decompress(RecipeOutput consumer, DeferredItem<Item> output, DeferredItem<Item> input) {
|
||||
ResourceLocation key = BuiltInRegistries.ITEM.getKey(output.get());
|
||||
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) {
|
||||
ResourceLocation key = ForgeRegistries.ITEMS.getKey(output.get());
|
||||
public static void compress(RecipeOutput consumer, DeferredItem<Item> output, DeferredItem<Item> input) {
|
||||
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()));
|
||||
}
|
||||
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);
|
||||
decompress(consumer, shard, crystal);
|
||||
}
|
||||
|
||||
@Override
|
||||
protected @Nullable CompletableFuture<?> saveAdvancement(CachedOutput output, FinishedRecipe finishedRecipe, JsonObject advancementJson) {
|
||||
return null; //Nope...
|
||||
}
|
||||
// @Override //TODO: Flanks do your RecipeOutput wrapper thingy ;)
|
||||
// protected @Nullable CompletableFuture<?> saveAdvancement(CachedOutput stack, FinishedRecipe finishedRecipe, JsonObject advancementJson) {
|
||||
// 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
|
||||
Recipe.shaped(pickaxe.get())
|
||||
.pattern("EEE", " S ", " S ")
|
||||
|
@ -662,7 +642,7 @@ public class ItemRecipeGenerator extends RecipeProvider {
|
|||
}
|
||||
|
||||
@Override
|
||||
public void save(@Nonnull Consumer<FinishedRecipe> consumer) {
|
||||
public void save(@Nonnull RecipeOutput consumer) {
|
||||
this.unlockedBy("has_book", has(ActuallyItems.ITEM_BOOKLET.get()));
|
||||
if (this.name != null) {
|
||||
this.save(consumer, this.name);
|
||||
|
@ -671,7 +651,7 @@ public class ItemRecipeGenerator extends RecipeProvider {
|
|||
}
|
||||
}
|
||||
@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));
|
||||
super.save(consumer, location);
|
||||
}
|
||||
|
@ -714,13 +694,13 @@ public class ItemRecipeGenerator extends RecipeProvider {
|
|||
}
|
||||
|
||||
@Override
|
||||
public void save(@Nonnull Consumer<FinishedRecipe> consumerIn) {
|
||||
public void save(@Nonnull RecipeOutput consumerIn) {
|
||||
this.unlockedBy("has_book", has(ActuallyItems.ITEM_BOOKLET.get()));
|
||||
super.save(consumerIn);
|
||||
}
|
||||
|
||||
@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));
|
||||
super.save(consumer, location);
|
||||
}
|
||||
|
|
|
@ -8,7 +8,7 @@ import net.minecraft.data.PackOutput;
|
|||
import net.minecraft.data.tags.ItemTagsProvider;
|
||||
import net.minecraft.data.tags.TagsProvider;
|
||||
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;
|
||||
|
||||
|
|
|
@ -1,13 +1,12 @@
|
|||
package de.ellpeck.actuallyadditions.data;
|
||||
|
||||
import com.google.gson.JsonObject;
|
||||
import de.ellpeck.actuallyadditions.mod.ActuallyAdditions;
|
||||
import de.ellpeck.actuallyadditions.mod.blocks.ActuallyBlocks;
|
||||
import de.ellpeck.actuallyadditions.mod.crafting.LaserRecipe;
|
||||
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.recipes.FinishedRecipe;
|
||||
import net.minecraft.data.recipes.RecipeOutput;
|
||||
import net.minecraft.data.recipes.RecipeProvider;
|
||||
import net.minecraft.resources.ResourceLocation;
|
||||
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.crafting.Ingredient;
|
||||
import net.minecraft.world.level.ItemLike;
|
||||
import net.minecraftforge.common.Tags;
|
||||
import net.minecraftforge.registries.ForgeRegistries;
|
||||
import org.jetbrains.annotations.Nullable;
|
||||
|
||||
import java.util.concurrent.CompletableFuture;
|
||||
import java.util.function.Consumer;
|
||||
import net.neoforged.neoforge.common.Tags;
|
||||
|
||||
public class LaserRecipeGenerator extends RecipeProvider {
|
||||
public LaserRecipeGenerator(PackOutput packOutput) {
|
||||
|
@ -33,13 +27,14 @@ public class LaserRecipeGenerator extends RecipeProvider {
|
|||
return "Laser " + super.getName();
|
||||
}
|
||||
|
||||
@Override
|
||||
protected @Nullable CompletableFuture<?> saveAdvancement(CachedOutput output, FinishedRecipe finishedRecipe, JsonObject advancementJson) {
|
||||
return null; //Nope...
|
||||
}
|
||||
// @Override //TODO: Flanks do your RecipeOutput wrapper thingy ;)
|
||||
// protected @Nullable CompletableFuture<?> saveAdvancement(CachedOutput stack, FinishedRecipe finishedRecipe, JsonObject advancementJson) {
|
||||
// return null;
|
||||
// //Nope... maybe later...
|
||||
// }
|
||||
|
||||
@Override
|
||||
protected void buildRecipes(Consumer<FinishedRecipe> consumer) {
|
||||
protected void buildRecipes(RecipeOutput consumer) {
|
||||
//Crystal Blocks
|
||||
laserCrystalizeRecipe(consumer, ActuallyBlocks.RESTONIA_CRYSTAL.getItem(), Tags.Items.STORAGE_BLOCKS_REDSTONE, 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) {
|
||||
consumer.accept(new LaserRecipe.Result(new ResourceLocation(ActuallyAdditions.MODID, "laser/" + ForgeRegistries.ITEMS.getKey(output.asItem()).getPath()),
|
||||
input, energy, output));
|
||||
private void laserRecipe(RecipeOutput consumer, ItemLike output, Ingredient input, int energy) {
|
||||
ResourceLocation id = new ResourceLocation(ActuallyAdditions.MODID, "laser/" + BuiltInRegistries.ITEM.getKey(output.asItem()).getPath());
|
||||
consumer.accept(id, new LaserRecipe(output.asItem().getDefaultInstance(), input, energy), null);
|
||||
}
|
||||
private void laserRecipe(Consumer<FinishedRecipe> consumer, ItemLike output, TagKey<Item> input, int energy) {
|
||||
consumer.accept(new LaserRecipe.Result(new ResourceLocation(ActuallyAdditions.MODID, "laser/" + ForgeRegistries.ITEMS.getKey(output.asItem()).getPath()),
|
||||
Ingredient.of(input), energy, output));
|
||||
private void laserRecipe(RecipeOutput consumer, ItemLike output, TagKey<Item> input, int energy) {
|
||||
ResourceLocation id = new ResourceLocation(ActuallyAdditions.MODID, "laser/" + BuiltInRegistries.ITEM.getKey(output.asItem()).getPath());
|
||||
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) {
|
||||
consumer.accept(new LaserRecipe.Result(new ResourceLocation(ActuallyAdditions.MODID, "laser/" + ForgeRegistries.ITEMS.getKey(output.asItem()).getPath()),
|
||||
Ingredient.of(input), energy, output));
|
||||
private void laserRecipe(RecipeOutput consumer, ItemLike output, ItemLike input, int energy) {
|
||||
ResourceLocation id = new ResourceLocation(ActuallyAdditions.MODID, "laser/" + BuiltInRegistries.ITEM.getKey(output.asItem()).getPath());
|
||||
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) {
|
||||
consumer.accept(new LaserRecipe.Result(new ResourceLocation(ActuallyAdditions.MODID, "laser/crystalize_" + ForgeRegistries.ITEMS.getKey(output.asItem()).getPath()),
|
||||
input, energy, output));
|
||||
private void laserCrystalizeRecipe(RecipeOutput consumer, ItemLike output, Ingredient input, int energy) {
|
||||
ResourceLocation id = new ResourceLocation(ActuallyAdditions.MODID, "laser/crystalize_" + BuiltInRegistries.ITEM.getKey(output.asItem()).getPath());
|
||||
consumer.accept(id, new LaserRecipe(output.asItem().getDefaultInstance(), input, energy), null);
|
||||
}
|
||||
private void laserCrystalizeRecipe(Consumer<FinishedRecipe> 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()),
|
||||
Ingredient.of(input), energy, output));
|
||||
private void laserCrystalizeRecipe(RecipeOutput consumer, ItemLike output, TagKey<Item> input, int energy) {
|
||||
ResourceLocation id = new ResourceLocation(ActuallyAdditions.MODID, "laser/crystalize_" + BuiltInRegistries.ITEM.getKey(output.asItem()).getPath());
|
||||
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) {
|
||||
consumer.accept(new LaserRecipe.Result(new ResourceLocation(ActuallyAdditions.MODID, "laser/crystalize_" + ForgeRegistries.ITEMS.getKey(output.asItem()).getPath()),
|
||||
Ingredient.of(input), energy, output));
|
||||
private void laserCrystalizeRecipe(RecipeOutput consumer, ItemLike output, ItemLike input, int energy) {
|
||||
ResourceLocation id = new ResourceLocation(ActuallyAdditions.MODID, "laser/crystalize_" + BuiltInRegistries.ITEM.getKey(output.asItem()).getPath());
|
||||
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.providers.nbt.ContextNbtProvider;
|
||||
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 java.util.List;
|
||||
|
@ -236,7 +236,7 @@ public class LootTableGenerator extends LootTableProvider {
|
|||
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;
|
||||
|
||||
import com.google.gson.JsonObject;
|
||||
import de.ellpeck.actuallyadditions.mod.ActuallyAdditions;
|
||||
import de.ellpeck.actuallyadditions.mod.crafting.MiningLensRecipe;
|
||||
import net.minecraft.data.CachedOutput;
|
||||
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.resources.ResourceLocation;
|
||||
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.crafting.Ingredient;
|
||||
import net.minecraft.world.level.ItemLike;
|
||||
import net.minecraftforge.common.Tags;
|
||||
import org.jetbrains.annotations.Nullable;
|
||||
|
||||
import java.util.concurrent.CompletableFuture;
|
||||
import java.util.function.Consumer;
|
||||
import net.neoforged.neoforge.common.Tags;
|
||||
|
||||
public class MiningLensGenerator extends RecipeProvider {
|
||||
public MiningLensGenerator(PackOutput packOutput) {
|
||||
|
@ -29,41 +23,41 @@ public class MiningLensGenerator extends RecipeProvider {
|
|||
return "Mining Lens " + super.getName();
|
||||
}
|
||||
|
||||
@Override
|
||||
protected @Nullable CompletableFuture<?> saveAdvancement(CachedOutput output, FinishedRecipe finishedRecipe, JsonObject advancementJson) {
|
||||
return null; //Nope...
|
||||
}
|
||||
// @Override //TODO: Flanks do your RecipeOutput wrapper thingy ;)
|
||||
// protected @Nullable CompletableFuture<?> saveAdvancement(CachedOutput stack, FinishedRecipe finishedRecipe, JsonObject advancementJson) {
|
||||
// return null;
|
||||
// //Nope... maybe later...
|
||||
// }
|
||||
|
||||
@Override
|
||||
protected void buildRecipes(Consumer<FinishedRecipe> consumer) {
|
||||
protected void buildRecipes(RecipeOutput consumer) {
|
||||
buildMiningLens(consumer);
|
||||
}
|
||||
|
||||
// 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) {
|
||||
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);
|
||||
}
|
||||
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);
|
||||
}
|
||||
|
||||
private void buildTagOre(Consumer<FinishedRecipe> consumer, TagKey<Item> tag, String prefix, int weight, ItemLike output) {
|
||||
consumer.accept(new MiningLensRecipe.Result(
|
||||
folderRecipe("mininglens", prefix + "_" + getItemName(output)),
|
||||
private void buildTagOre(RecipeOutput consumer, TagKey<Item> tag, String prefix, int weight, ItemLike output) {
|
||||
consumer.accept(folderRecipe("mininglens", prefix + "_" + getItemName(output)), new MiningLensRecipe(
|
||||
Ingredient.of(tag),
|
||||
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, 3000, Items.IRON_ORE);
|
||||
buildStoneOre(consumer, 500, Items.GOLD_ORE);
|
||||
|
|
|
@ -1,22 +1,16 @@
|
|||
package de.ellpeck.actuallyadditions.data;
|
||||
|
||||
import com.google.gson.JsonObject;
|
||||
import de.ellpeck.actuallyadditions.mod.ActuallyAdditions;
|
||||
import de.ellpeck.actuallyadditions.mod.crafting.FermentingRecipe;
|
||||
import de.ellpeck.actuallyadditions.mod.crafting.PressingRecipe;
|
||||
import de.ellpeck.actuallyadditions.mod.fluids.InitFluids;
|
||||
import de.ellpeck.actuallyadditions.mod.items.ActuallyItems;
|
||||
import net.minecraft.data.CachedOutput;
|
||||
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.resources.ResourceLocation;
|
||||
import net.minecraft.world.item.crafting.Ingredient;
|
||||
import net.minecraftforge.fluids.FluidStack;
|
||||
import org.jetbrains.annotations.Nullable;
|
||||
|
||||
import java.util.concurrent.CompletableFuture;
|
||||
import java.util.function.Consumer;
|
||||
import net.neoforged.neoforge.fluids.FluidStack;
|
||||
|
||||
public class MiscMachineRecipeGenerator extends RecipeProvider {
|
||||
public MiscMachineRecipeGenerator(PackOutput packOutput) {
|
||||
|
@ -28,22 +22,23 @@ public class MiscMachineRecipeGenerator extends RecipeProvider {
|
|||
return "Misc " + super.getName();
|
||||
}
|
||||
|
||||
@Override
|
||||
protected @Nullable CompletableFuture<?> saveAdvancement(CachedOutput output, FinishedRecipe finishedRecipe, JsonObject advancementJson) {
|
||||
return null; //Nope...
|
||||
}
|
||||
// @Override //TODO: Flanks do your RecipeOutput wrapper thingy ;)
|
||||
// protected @Nullable CompletableFuture<?> saveAdvancement(CachedOutput stack, FinishedRecipe finishedRecipe, JsonObject advancementJson) {
|
||||
// return null;
|
||||
// //Nope... maybe later...
|
||||
// }
|
||||
|
||||
@Override
|
||||
protected void buildRecipes(Consumer<FinishedRecipe> consumer) {
|
||||
consumer.accept(new PressingRecipe.Result(folderRecipe("pressing", "canola"),
|
||||
Ingredient.of(ActuallyItems.CANOLA.get()), new FluidStack(InitFluids.CANOLA_OIL.get(), 80)));
|
||||
protected void buildRecipes(RecipeOutput consumer) {
|
||||
consumer.accept(folderRecipe("pressing", "canola"), new PressingRecipe(
|
||||
Ingredient.of(ActuallyItems.CANOLA.get()), new FluidStack(InitFluids.CANOLA_OIL.get(), 80)), null);
|
||||
|
||||
consumer.accept(new FermentingRecipe.Result(folderRecipe("fermenting", "refined_canola"),
|
||||
new FluidStack(InitFluids.CANOLA_OIL.get(), 80), new FluidStack(InitFluids.REFINED_CANOLA_OIL.get(), 80), 100));
|
||||
consumer.accept(folderRecipe("fermenting", "refined_canola"), new FermentingRecipe(
|
||||
new FluidStack(InitFluids.CANOLA_OIL.get(), 80), new FluidStack(InitFluids.REFINED_CANOLA_OIL.get(), 80), 100), null);
|
||||
}
|
||||
|
||||
// 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) {
|
||||
|
|
|
@ -4,8 +4,8 @@ import de.ellpeck.actuallyadditions.mod.AASounds;
|
|||
import de.ellpeck.actuallyadditions.mod.ActuallyAdditions;
|
||||
import net.minecraft.data.PackOutput;
|
||||
import net.minecraft.resources.ResourceLocation;
|
||||
import net.minecraftforge.common.data.ExistingFileHelper;
|
||||
import net.minecraftforge.common.data.SoundDefinitionsProvider;
|
||||
import net.neoforged.neoforge.common.data.ExistingFileHelper;
|
||||
import net.neoforged.neoforge.common.data.SoundDefinitionsProvider;
|
||||
|
||||
public class SoundsGenerator extends SoundDefinitionsProvider {
|
||||
|
||||
|
|
|
@ -1,19 +1,19 @@
|
|||
package de.ellpeck.actuallyadditions.mod;
|
||||
|
||||
import net.minecraft.core.registries.BuiltInRegistries;
|
||||
import net.minecraft.resources.ResourceLocation;
|
||||
import net.minecraft.sounds.SoundEvent;
|
||||
import net.minecraftforge.eventbus.api.IEventBus;
|
||||
import net.minecraftforge.registries.DeferredRegister;
|
||||
import net.minecraftforge.registries.ForgeRegistries;
|
||||
import net.minecraftforge.registries.RegistryObject;
|
||||
import net.neoforged.bus.api.IEventBus;
|
||||
import net.neoforged.neoforge.registries.DeferredHolder;
|
||||
import net.neoforged.neoforge.registries.DeferredRegister;
|
||||
|
||||
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 RegistryObject<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 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> RECONSTRUCTOR = SOUNDS.register("reconstructor", () -> SoundEvent.createVariableRangeEvent(new ResourceLocation(ActuallyAdditions.MODID, "reconstructor")));
|
||||
public static DeferredHolder<SoundEvent, SoundEvent> CRUSHER = SOUNDS.register("crusher", () -> SoundEvent.createVariableRangeEvent(new ResourceLocation(ActuallyAdditions.MODID, "crusher")));
|
||||
public static DeferredHolder<SoundEvent, SoundEvent> COFFEE_MACHINE = SOUNDS.register("coffee_machine", () -> SoundEvent.createVariableRangeEvent(new ResourceLocation(ActuallyAdditions.MODID, "coffee_machine")));
|
||||
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) {
|
||||
|
|
|
@ -10,6 +10,7 @@
|
|||
|
||||
package de.ellpeck.actuallyadditions.mod;
|
||||
|
||||
import com.mojang.serialization.Codec;
|
||||
import de.ellpeck.actuallyadditions.api.ActuallyAdditionsAPI;
|
||||
import de.ellpeck.actuallyadditions.api.ActuallyTags;
|
||||
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.crafting.ActuallyRecipes;
|
||||
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.entity.EntityWorm;
|
||||
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.update.UpdateChecker;
|
||||
import de.ellpeck.actuallyadditions.mod.util.ResourceReloader;
|
||||
import net.minecraft.core.registries.BuiltInRegistries;
|
||||
import net.minecraft.resources.ResourceLocation;
|
||||
import net.minecraft.world.entity.EntityType;
|
||||
import net.minecraft.world.entity.MobCategory;
|
||||
import net.minecraft.world.item.Item;
|
||||
import net.minecraft.world.item.Items;
|
||||
import net.minecraftforge.api.distmarker.Dist;
|
||||
import net.minecraftforge.client.event.RegisterParticleProvidersEvent;
|
||||
import net.minecraftforge.common.MinecraftForge;
|
||||
import net.minecraftforge.common.crafting.CraftingHelper;
|
||||
import net.minecraftforge.event.AddReloadListenerEvent;
|
||||
import net.minecraftforge.event.server.ServerStartedEvent;
|
||||
import net.minecraftforge.event.server.ServerStoppedEvent;
|
||||
import net.minecraftforge.eventbus.api.IEventBus;
|
||||
import net.minecraftforge.fml.DistExecutor;
|
||||
import net.minecraftforge.fml.ModLoadingContext;
|
||||
import net.minecraftforge.fml.common.Mod;
|
||||
import net.minecraftforge.fml.config.ModConfig;
|
||||
import net.minecraftforge.fml.event.config.ModConfigEvent;
|
||||
import net.minecraftforge.fml.event.lifecycle.FMLClientSetupEvent;
|
||||
import net.minecraftforge.fml.event.lifecycle.FMLCommonSetupEvent;
|
||||
import net.minecraftforge.fml.javafmlmod.FMLJavaModLoadingContext;
|
||||
import net.minecraftforge.registries.DeferredRegister;
|
||||
import net.minecraftforge.registries.ForgeRegistries;
|
||||
import net.minecraftforge.registries.RegistryObject;
|
||||
import net.neoforged.bus.api.IEventBus;
|
||||
import net.neoforged.fml.ModLoadingContext;
|
||||
import net.neoforged.fml.common.Mod;
|
||||
import net.neoforged.fml.config.ModConfig;
|
||||
import net.neoforged.fml.event.config.ModConfigEvent;
|
||||
import net.neoforged.fml.event.lifecycle.FMLClientSetupEvent;
|
||||
import net.neoforged.fml.event.lifecycle.FMLCommonSetupEvent;
|
||||
import net.neoforged.fml.loading.FMLEnvironment;
|
||||
import net.neoforged.neoforge.client.event.RegisterParticleProvidersEvent;
|
||||
import net.neoforged.neoforge.common.NeoForge;
|
||||
import net.neoforged.neoforge.common.conditions.ICondition;
|
||||
import net.neoforged.neoforge.event.AddReloadListenerEvent;
|
||||
import net.neoforged.neoforge.event.server.ServerStartedEvent;
|
||||
import net.neoforged.neoforge.event.server.ServerStoppedEvent;
|
||||
import net.neoforged.neoforge.registries.DeferredHolder;
|
||||
import net.neoforged.neoforge.registries.DeferredRegister;
|
||||
import net.neoforged.neoforge.registries.NeoForgeRegistries;
|
||||
import org.apache.logging.log4j.LogManager;
|
||||
import org.apache.logging.log4j.Logger;
|
||||
|
||||
import java.util.function.Supplier;
|
||||
|
||||
@Mod(ActuallyAdditions.MODID)
|
||||
public class ActuallyAdditions {
|
||||
|
||||
|
@ -78,16 +79,18 @@ public class ActuallyAdditions {
|
|||
|
||||
public static final Logger LOGGER = LogManager.getLogger(NAME);
|
||||
|
||||
public static final DeferredRegister<EntityType<?>> ENTITIES = DeferredRegister.create(ForgeRegistries.ENTITY_TYPES, MODID);
|
||||
public static final RegistryObject<EntityType<EntityWorm>> ENTITY_WORM = ENTITIES.register("worm", () -> EntityType.Builder.of(EntityWorm::new, MobCategory.MISC).build(MODID + ":worm"));
|
||||
private static final DeferredRegister<EntityType<?>> ENTITIES = DeferredRegister.create(BuiltInRegistries.ENTITY_TYPE, MODID);
|
||||
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 ActuallyAdditions() {
|
||||
public ActuallyAdditions(IEventBus eventBus) {
|
||||
ModLoadingContext.get().registerConfig(ModConfig.Type.COMMON, CommonConfig.COMMON_CONFIG);
|
||||
|
||||
IEventBus eventBus = FMLJavaModLoadingContext.get().getModEventBus();
|
||||
|
||||
ActuallyBlocks.init(eventBus);
|
||||
ActuallyItems.init(eventBus);
|
||||
ActuallyTabs.init(eventBus);
|
||||
|
@ -95,25 +98,27 @@ public class ActuallyAdditions {
|
|||
AASounds.init(eventBus);
|
||||
ActuallyContainers.CONTAINERS.register(eventBus);
|
||||
ENTITIES.register(eventBus);
|
||||
CONDITION_CODECS.register(eventBus);
|
||||
eventBus.addListener(this::onConfigReload);
|
||||
ActuallyParticles.init(eventBus);
|
||||
ActuallyTags.init();
|
||||
|
||||
MinecraftForge.EVENT_BUS.addListener(this::serverStarted);
|
||||
MinecraftForge.EVENT_BUS.addListener(this::serverStopped);
|
||||
MinecraftForge.EVENT_BUS.register(new CommonEvents());
|
||||
MinecraftForge.EVENT_BUS.register(new DungeonLoot());
|
||||
MinecraftForge.EVENT_BUS.addListener(ActuallyAdditions::reloadEvent);
|
||||
MinecraftForge.EVENT_BUS.addListener(Worm::onHoe);
|
||||
NeoForge.EVENT_BUS.addListener(this::serverStarted);
|
||||
NeoForge.EVENT_BUS.addListener(this::serverStopped);
|
||||
NeoForge.EVENT_BUS.register(new CommonEvents());
|
||||
NeoForge.EVENT_BUS.register(new DungeonLoot());
|
||||
NeoForge.EVENT_BUS.addListener(ActuallyAdditions::reloadEvent);
|
||||
NeoForge.EVENT_BUS.addListener(Worm::onHoe);
|
||||
InitFluids.init(eventBus);
|
||||
|
||||
eventBus.addListener(PacketHandler::register);
|
||||
eventBus.addListener(this::setup);
|
||||
|
||||
DistExecutor.unsafeRunWhenOn(Dist.CLIENT, () -> () -> {
|
||||
if (FMLEnvironment.dist.isClient()) {
|
||||
eventBus.addListener(this::clientSetup);
|
||||
eventBus.addListener(ActuallyAdditionsClient::setupSpecialRenders);
|
||||
eventBus.addListener(this::particleFactoryRegister);
|
||||
});
|
||||
}
|
||||
IFarmerBehavior.initBehaviors();
|
||||
}
|
||||
|
||||
|
@ -122,17 +127,11 @@ public class ActuallyAdditions {
|
|||
}
|
||||
|
||||
private void setup(FMLCommonSetupEvent event) {
|
||||
PacketHandler.init();
|
||||
|
||||
event.enqueueWork(() -> {
|
||||
CraftingHelper.register(BoolConfigCondition.Serializer.INSTANCE);
|
||||
});
|
||||
|
||||
ActuallyAdditionsAPI.methodHandler = new MethodHandler();
|
||||
ActuallyAdditionsAPI.connectionHandler = new LaserRelayConnectionHandler();
|
||||
//Lenses.init();
|
||||
// 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");
|
||||
|
||||
|
@ -146,8 +145,8 @@ public class ActuallyAdditions {
|
|||
}
|
||||
|
||||
private void onConfigReload(ModConfigEvent event) {
|
||||
Item item1 = ForgeRegistries.ITEMS.getValue(new ResourceLocation(CommonConfig.Other.REDSTONECONFIGURATOR.get()));
|
||||
Item item2 = ForgeRegistries.ITEMS.getValue(new ResourceLocation(CommonConfig.Other.RELAYCONFIGURATOR.get()));
|
||||
Item item1 = BuiltInRegistries.ITEM.get(new ResourceLocation(CommonConfig.Other.REDSTONECONFIGURATOR.get()));
|
||||
Item item2 = BuiltInRegistries.ITEM.get(new ResourceLocation(CommonConfig.Other.RELAYCONFIGURATOR.get()));
|
||||
CommonConfig.Other.redstoneConfigureItem = item1 != null?item1: 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.resources.ResourceLocation;
|
||||
import net.minecraft.world.phys.BlockHitResult;
|
||||
import net.minecraftforge.client.event.EntityRenderersEvent;
|
||||
import net.minecraftforge.common.MinecraftForge;
|
||||
import net.minecraftforge.fml.event.lifecycle.FMLClientSetupEvent;
|
||||
import net.neoforged.fml.event.lifecycle.FMLClientSetupEvent;
|
||||
import net.neoforged.neoforge.client.event.EntityRenderersEvent;
|
||||
import net.neoforged.neoforge.common.NeoForge;
|
||||
|
||||
public class ActuallyAdditionsClient {
|
||||
|
||||
|
@ -93,9 +93,9 @@ public class ActuallyAdditionsClient {
|
|||
MenuScreens.register(ActuallyContainers.RANGED_COLLECTOR_CONTAINER.get(), GuiRangedCollector::new);
|
||||
MenuScreens.register(ActuallyContainers.XPSOLIDIFIER_CONTAINER.get(), GuiXPSolidifier::new);
|
||||
// From old proxy
|
||||
MinecraftForge.EVENT_BUS.register(new ClientEvents());
|
||||
MinecraftForge.EVENT_BUS.register(new ClientRegistryHandler());
|
||||
MinecraftForge.EVENT_BUS.register(new SpecialRenderInit());
|
||||
NeoForge.EVENT_BUS.register(new ClientEvents());
|
||||
NeoForge.EVENT_BUS.register(new ClientRegistryHandler());
|
||||
NeoForge.EVENT_BUS.register(new SpecialRenderInit());
|
||||
|
||||
event.enqueueWork(() ->
|
||||
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.CreativeModeTabs;
|
||||
import net.minecraft.world.item.ItemStack;
|
||||
import net.minecraftforge.eventbus.api.IEventBus;
|
||||
import net.minecraftforge.registries.DeferredRegister;
|
||||
import net.neoforged.bus.api.IEventBus;
|
||||
import net.neoforged.neoforge.registries.DeferredRegister;
|
||||
|
||||
import java.util.List;
|
||||
import java.util.function.Supplier;
|
||||
|
|
|
@ -3,9 +3,9 @@ package de.ellpeck.actuallyadditions.mod;
|
|||
import net.minecraft.client.resources.model.ModelResourceLocation;
|
||||
import net.minecraft.world.item.ItemStack;
|
||||
import net.minecraft.world.level.material.Fluid;
|
||||
import net.minecraftforge.client.event.ModelEvent.BakingCompleted;
|
||||
import net.minecraftforge.client.event.ModelEvent.RegisterGeometryLoaders;
|
||||
import net.minecraftforge.eventbus.api.SubscribeEvent;
|
||||
import net.neoforged.bus.api.SubscribeEvent;
|
||||
import net.neoforged.neoforge.client.event.ModelEvent.BakingCompleted;
|
||||
import net.neoforged.neoforge.client.event.ModelEvent.RegisterGeometryLoaders;
|
||||
|
||||
import java.util.HashMap;
|
||||
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.blocks.base.AACrops;
|
||||
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.tile.TileEntityAtomicReconstructor;
|
||||
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.TileEntityXPSolidifier;
|
||||
import de.ellpeck.actuallyadditions.registration.AABlockReg;
|
||||
import net.minecraft.core.registries.BuiltInRegistries;
|
||||
import net.minecraft.world.item.Item;
|
||||
import net.minecraft.world.level.block.Block;
|
||||
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.material.MapColor;
|
||||
import net.minecraft.world.level.material.PushReaction;
|
||||
import net.minecraftforge.eventbus.api.IEventBus;
|
||||
import net.minecraftforge.registries.DeferredRegister;
|
||||
import net.minecraftforge.registries.ForgeRegistries;
|
||||
import net.neoforged.bus.api.IEventBus;
|
||||
import net.neoforged.neoforge.capabilities.RegisterCapabilitiesEvent;
|
||||
import net.neoforged.neoforge.registries.DeferredHolder;
|
||||
import net.neoforged.neoforge.registries.DeferredRegister;
|
||||
|
||||
import java.util.function.Supplier;
|
||||
|
||||
public final class ActuallyBlocks {
|
||||
public static final DeferredRegister<Block> BLOCKS = DeferredRegister.create(ForgeRegistries.BLOCKS, ActuallyAdditions.MODID);
|
||||
public static final DeferredRegister<BlockEntityType<?>> TILES = DeferredRegister.create(ForgeRegistries.BLOCK_ENTITY_TYPES, ActuallyAdditions.MODID);
|
||||
public static final DeferredRegister.Blocks BLOCKS = DeferredRegister.createBlocks(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 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
|
||||
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));
|
||||
|
||||
//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_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, ?> 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, ?> 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, ?> 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, ?> 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_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, ?> 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.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.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.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.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.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.ofFullCopy(BLACK_QUARTZ_PILLAR.get())), (b) -> new AABlockItem(b, defaultBlockItemProperties));
|
||||
|
||||
//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_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, ?> 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, ?> 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, ?> 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, ?> 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, ?> 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, ?> 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.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.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.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.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.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.ofFullCopy(BLACK_QUARTZ_PILLAR.get())), (b) -> new AABlockItem(b, defaultBlockItemProperties));
|
||||
|
||||
|
||||
//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_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, ?> 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, ?> 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, ?> 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, ?> 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, ?> 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, ?> 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.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.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.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.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.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.ofFullCopy(BLACK_QUARTZ_PILLAR.get())), (b) -> new AABlockItem(b, defaultBlockItemProperties));
|
||||
|
||||
|
||||
|
||||
|
@ -318,11 +321,11 @@ public final class ActuallyBlocks {
|
|||
(b) -> new AABlockItem(b, defaultBlockItemProperties));
|
||||
|
||||
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() {
|
||||
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() {
|
||||
|
@ -332,5 +335,10 @@ public final class ActuallyBlocks {
|
|||
public static void init(IEventBus evt) {
|
||||
BLOCKS.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.phys.BlockHitResult;
|
||||
import net.minecraft.world.phys.HitResult;
|
||||
import net.minecraftforge.api.distmarker.Dist;
|
||||
import net.minecraftforge.api.distmarker.OnlyIn;
|
||||
import net.neoforged.api.distmarker.Dist;
|
||||
import net.neoforged.api.distmarker.OnlyIn;
|
||||
|
||||
import javax.annotation.Nonnull;
|
||||
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.tile.TileEntityCanolaPress;
|
||||
import net.minecraft.core.BlockPos;
|
||||
import net.minecraft.server.level.ServerPlayer;
|
||||
import net.minecraft.world.InteractionHand;
|
||||
import net.minecraft.world.InteractionResult;
|
||||
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.shapes.CollisionContext;
|
||||
import net.minecraft.world.phys.shapes.VoxelShape;
|
||||
import net.minecraftforge.fluids.FluidUtil;
|
||||
import net.minecraftforge.network.NetworkHooks;
|
||||
import net.neoforged.neoforge.fluids.FluidUtil;
|
||||
|
||||
import javax.annotation.Nullable;
|
||||
|
||||
|
@ -63,7 +61,7 @@ public class BlockCanolaPress extends BlockContainerBase {
|
|||
return InteractionResult.SUCCESS;
|
||||
if (!player.isShiftKeyDown()) {
|
||||
if (!FluidUtil.interactWithFluidHandler(player, hand, tile.tank))
|
||||
NetworkHooks.openScreen((ServerPlayer) player, tile, pos);
|
||||
player.openMenu(tile, pos);
|
||||
return InteractionResult.SUCCESS;
|
||||
}
|
||||
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.tile.TileEntityCoffeeMachine;
|
||||
import net.minecraft.core.BlockPos;
|
||||
import net.minecraft.server.level.ServerPlayer;
|
||||
import net.minecraft.world.InteractionHand;
|
||||
import net.minecraft.world.InteractionResult;
|
||||
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.shapes.CollisionContext;
|
||||
import net.minecraft.world.phys.shapes.VoxelShape;
|
||||
import net.minecraftforge.network.NetworkHooks;
|
||||
|
||||
import javax.annotation.Nullable;
|
||||
|
||||
|
@ -41,7 +39,7 @@ public class BlockCoffeeMachine extends DirectionalBlock.Container {
|
|||
TileEntityCoffeeMachine tile = (TileEntityCoffeeMachine) world.getBlockEntity(pos);
|
||||
if (tile != null) {
|
||||
if (!this.tryUseItemOnTank(player, hand, tile.tank)) {
|
||||
NetworkHooks.openScreen((ServerPlayer) player, tile, pos);
|
||||
player.openMenu(tile, pos);
|
||||
}
|
||||
}
|
||||
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.tile.TileEntityFermentingBarrel;
|
||||
import net.minecraft.core.BlockPos;
|
||||
import net.minecraft.server.level.ServerPlayer;
|
||||
import net.minecraft.sounds.SoundEvents;
|
||||
import net.minecraft.sounds.SoundSource;
|
||||
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.shapes.CollisionContext;
|
||||
import net.minecraft.world.phys.shapes.VoxelShape;
|
||||
import net.minecraftforge.fluids.FluidUtil;
|
||||
import net.minecraftforge.network.NetworkHooks;
|
||||
import net.neoforged.neoforge.fluids.FluidUtil;
|
||||
|
||||
import javax.annotation.Nullable;
|
||||
|
||||
|
@ -68,7 +66,7 @@ public class BlockFermentingBarrel extends BlockContainerBase {
|
|||
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);
|
||||
} else
|
||||
NetworkHooks.openScreen((ServerPlayer) player, tile, pos);
|
||||
player.openMenu(tile, pos);
|
||||
return InteractionResult.SUCCESS;
|
||||
}
|
||||
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.shapes.CollisionContext;
|
||||
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.Nullable;
|
||||
|
|
|
@ -49,8 +49,8 @@ import net.minecraft.world.phys.BlockHitResult;
|
|||
import net.minecraft.world.phys.HitResult;
|
||||
import net.minecraft.world.phys.shapes.CollisionContext;
|
||||
import net.minecraft.world.phys.shapes.VoxelShape;
|
||||
import net.minecraftforge.api.distmarker.Dist;
|
||||
import net.minecraftforge.api.distmarker.OnlyIn;
|
||||
import net.neoforged.api.distmarker.Dist;
|
||||
import net.neoforged.api.distmarker.OnlyIn;
|
||||
|
||||
import javax.annotation.Nullable;
|
||||
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.shapes.CollisionContext;
|
||||
import net.minecraft.world.phys.shapes.VoxelShape;
|
||||
import net.minecraftforge.api.distmarker.Dist;
|
||||
import net.minecraftforge.api.distmarker.OnlyIn;
|
||||
import net.neoforged.api.distmarker.Dist;
|
||||
import net.neoforged.api.distmarker.OnlyIn;
|
||||
|
||||
import javax.annotation.Nullable;
|
||||
|
||||
|
|
|
@ -15,7 +15,6 @@ import de.ellpeck.actuallyadditions.mod.tile.TileEntityOilGenerator;
|
|||
import net.minecraft.core.BlockPos;
|
||||
import net.minecraft.core.particles.ParticleTypes;
|
||||
import net.minecraft.server.level.ServerLevel;
|
||||
import net.minecraft.server.level.ServerPlayer;
|
||||
import net.minecraft.util.RandomSource;
|
||||
import net.minecraft.world.InteractionHand;
|
||||
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.shapes.CollisionContext;
|
||||
import net.minecraft.world.phys.shapes.VoxelShape;
|
||||
import net.minecraftforge.network.NetworkHooks;
|
||||
|
||||
import javax.annotation.Nullable;
|
||||
|
||||
|
@ -70,7 +68,7 @@ public class BlockOilGenerator extends DirectionalBlock.Container {
|
|||
TileEntityOilGenerator generator = (TileEntityOilGenerator) world.getBlockEntity(pos);
|
||||
if (generator != null) {
|
||||
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.HitResult;
|
||||
import net.minecraft.world.phys.Vec3;
|
||||
import net.minecraftforge.api.distmarker.Dist;
|
||||
import net.minecraftforge.api.distmarker.OnlyIn;
|
||||
import net.neoforged.api.distmarker.Dist;
|
||||
import net.neoforged.api.distmarker.OnlyIn;
|
||||
|
||||
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.shapes.CollisionContext;
|
||||
import net.minecraft.world.phys.shapes.VoxelShape;
|
||||
import net.minecraftforge.api.distmarker.Dist;
|
||||
import net.minecraftforge.api.distmarker.OnlyIn;
|
||||
import net.neoforged.api.distmarker.Dist;
|
||||
import net.neoforged.api.distmarker.OnlyIn;
|
||||
|
||||
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.phys.shapes.CollisionContext;
|
||||
import net.minecraft.world.phys.shapes.VoxelShape;
|
||||
import net.minecraftforge.common.MinecraftForge;
|
||||
import net.minecraftforge.event.level.ExplosionEvent;
|
||||
import net.minecraftforge.eventbus.api.SubscribeEvent;
|
||||
import net.neoforged.bus.api.SubscribeEvent;
|
||||
import net.neoforged.neoforge.common.NeoForge;
|
||||
import net.neoforged.neoforge.event.level.ExplosionEvent;
|
||||
|
||||
import javax.annotation.Nullable;
|
||||
import java.util.ArrayList;
|
||||
|
@ -36,7 +36,7 @@ public class BlockShockSuppressor extends Block implements EntityBlock {
|
|||
|
||||
public BlockShockSuppressor() {
|
||||
super(ActuallyBlocks.defaultPickProps(20F, 2000.0F));
|
||||
MinecraftForge.EVENT_BUS.register(this);
|
||||
NeoForge.EVENT_BUS.register(this);
|
||||
}
|
||||
|
||||
@SubscribeEvent
|
||||
|
|
|
@ -30,8 +30,8 @@ import net.minecraft.world.phys.BlockHitResult;
|
|||
import net.minecraft.world.phys.HitResult;
|
||||
import net.minecraft.world.phys.shapes.CollisionContext;
|
||||
import net.minecraft.world.phys.shapes.VoxelShape;
|
||||
import net.minecraftforge.api.distmarker.Dist;
|
||||
import net.minecraftforge.api.distmarker.OnlyIn;
|
||||
import net.neoforged.api.distmarker.Dist;
|
||||
import net.neoforged.api.distmarker.OnlyIn;
|
||||
|
||||
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.item.ItemStack;
|
||||
import net.minecraft.world.phys.HitResult;
|
||||
import net.minecraftforge.api.distmarker.Dist;
|
||||
import net.minecraftforge.api.distmarker.OnlyIn;
|
||||
import net.neoforged.api.distmarker.Dist;
|
||||
import net.neoforged.api.distmarker.OnlyIn;
|
||||
|
||||
public interface IHudDisplay {
|
||||
|
||||
|
|
|
@ -1,7 +1,6 @@
|
|||
package de.ellpeck.actuallyadditions.mod.blocks;
|
||||
|
||||
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.Shapes;
|
||||
import net.minecraft.world.phys.shapes.VoxelShape;
|
||||
|
|
|
@ -8,8 +8,8 @@ import java.util.function.Supplier;
|
|||
|
||||
public class AACrops extends CropBlock {
|
||||
Supplier<Item> itemSupplier;
|
||||
public AACrops(Properties p_i48421_1_, Supplier<Item> seedSupplier) {
|
||||
super(p_i48421_1_);
|
||||
public AACrops(Properties properties, Supplier<Item> seedSupplier) {
|
||||
super(properties);
|
||||
this.itemSupplier = seedSupplier;
|
||||
}
|
||||
|
||||
|
|
|
@ -10,11 +10,19 @@
|
|||
|
||||
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.SoundType;
|
||||
|
||||
public class BlockBushBase extends BushBlock {
|
||||
public static final MapCodec<BlockBushBase> CODEC = simpleCodec(BlockBushBase::new);
|
||||
|
||||
public BlockBushBase(Properties properties) {
|
||||
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.network.chat.Component;
|
||||
import net.minecraft.server.level.ServerLevel;
|
||||
import net.minecraft.server.level.ServerPlayer;
|
||||
import net.minecraft.util.RandomSource;
|
||||
import net.minecraft.world.InteractionHand;
|
||||
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.entity.BlockEntity;
|
||||
import net.minecraft.world.level.block.state.BlockState;
|
||||
import net.minecraftforge.fluids.FluidUtil;
|
||||
import net.minecraftforge.fluids.capability.templates.FluidTank;
|
||||
import net.minecraftforge.network.NetworkHooks;
|
||||
import net.neoforged.neoforge.fluids.FluidUtil;
|
||||
import net.neoforged.neoforge.fluids.capability.templates.FluidTank;
|
||||
|
||||
import javax.annotation.Nonnull;
|
||||
import javax.annotation.Nullable;
|
||||
|
@ -52,7 +50,7 @@ public abstract class BlockContainerBase extends Block implements EntityBlock {
|
|||
if (!world.isClientSide) {
|
||||
BlockEntity tile = world.getBlockEntity(pos);
|
||||
if (expectedInstance.isInstance(tile)) {
|
||||
NetworkHooks.openScreen((ServerPlayer) player, (MenuProvider) tile, pos);
|
||||
player.openMenu((MenuProvider) tile);
|
||||
}
|
||||
return InteractionResult.SUCCESS;
|
||||
}
|
||||
|
@ -184,14 +182,15 @@ public abstract class BlockContainerBase extends Block implements EntityBlock {
|
|||
}
|
||||
|
||||
@Override
|
||||
public void playerWillDestroy(@Nonnull Level world, @Nonnull BlockPos pos, @Nonnull BlockState state, Player player) {
|
||||
super.playerWillDestroy(world, pos, state, player);
|
||||
public BlockState playerWillDestroy(@Nonnull Level world, @Nonnull BlockPos pos, @Nonnull BlockState state, Player player) {
|
||||
BlockState theState = super.playerWillDestroy(world, pos, state, player);
|
||||
if (!player.isCreative()) {
|
||||
BlockEntity tile = world.getBlockEntity(pos);
|
||||
if (tile instanceof TileEntityBase && ((TileEntityBase) tile).stopFromDropping) {
|
||||
player.displayClientMessage(Component.translatable("info." + ActuallyAdditions.MODID + ".machineBroke").withStyle(ChatFormatting.RED), false);
|
||||
}
|
||||
}
|
||||
return theState;
|
||||
}
|
||||
|
||||
@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.PushReaction;
|
||||
import net.minecraft.world.phys.BlockHitResult;
|
||||
import net.minecraftforge.common.PlantType;
|
||||
import net.minecraftforge.items.ItemHandlerHelper;
|
||||
import net.neoforged.neoforge.common.PlantType;
|
||||
import net.neoforged.neoforge.items.ItemHandlerHelper;
|
||||
|
||||
import java.util.List;
|
||||
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.core.Direction;
|
||||
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;
|
||||
|
||||
|
@ -75,4 +78,12 @@ public class ReconstructorRenderer implements BlockEntityRenderer<TileEntityAtom
|
|||
public boolean shouldRenderOffScreen(TileEntityAtomicReconstructor tile) {
|
||||
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.BlockEntityRendererProvider;
|
||||
import net.minecraft.client.resources.language.I18n;
|
||||
import net.minecraft.core.registries.BuiltInRegistries;
|
||||
import net.minecraft.world.item.BlockItem;
|
||||
import net.minecraft.world.item.ItemStack;
|
||||
import net.minecraftforge.api.distmarker.Dist;
|
||||
import net.minecraftforge.api.distmarker.OnlyIn;
|
||||
import net.minecraftforge.common.capabilities.ForgeCapabilities;
|
||||
import net.minecraftforge.registries.ForgeRegistries;
|
||||
import net.neoforged.api.distmarker.Dist;
|
||||
import net.neoforged.api.distmarker.OnlyIn;
|
||||
import net.neoforged.neoforge.capabilities.Capabilities;
|
||||
import org.joml.Matrix4f;
|
||||
|
||||
import java.util.Optional;
|
||||
|
||||
@OnlyIn(Dist.CLIENT)
|
||||
public class RenderBatteryBox implements BlockEntityRenderer<TileEntityBatteryBox> {
|
||||
public RenderBatteryBox(BlockEntityRendererProvider.Context context) {
|
||||
|
@ -52,7 +54,7 @@ public class RenderBatteryBox implements BlockEntityRenderer<TileEntityBatteryBo
|
|||
matrices.scale(0.0075F, 0.0075F, 0.0075F);
|
||||
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;
|
||||
|
||||
String energyTotal = Lang.cleanEnergyValues(cap, false);
|
||||
|
@ -91,7 +93,7 @@ public class RenderBatteryBox implements BlockEntityRenderer<TileEntityBatteryBo
|
|||
try {
|
||||
AssetUtil.renderItemInWorld(stack, combinedLight, combinedOverlay, matrices, buffer);
|
||||
} 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();
|
||||
|
|
|
@ -19,9 +19,9 @@ import net.minecraft.Util;
|
|||
import net.minecraft.client.renderer.MultiBufferSource;
|
||||
import net.minecraft.client.renderer.blockentity.BlockEntityRenderer;
|
||||
import net.minecraft.client.renderer.blockentity.BlockEntityRendererProvider;
|
||||
import net.minecraft.core.registries.BuiltInRegistries;
|
||||
import net.minecraft.world.item.BlockItem;
|
||||
import net.minecraft.world.item.ItemStack;
|
||||
import net.minecraftforge.registries.ForgeRegistries;
|
||||
|
||||
import javax.annotation.Nonnull;
|
||||
|
||||
|
@ -50,7 +50,7 @@ public class RenderDisplayStand implements BlockEntityRenderer<TileEntityDisplay
|
|||
try {
|
||||
AssetUtil.renderItemInWorld(stack, combinedLightIn, combinedOverlayIn, matrices, buffer);
|
||||
} 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();
|
||||
|
|
|
@ -23,10 +23,11 @@ import net.minecraft.client.renderer.blockentity.BlockEntityRenderer;
|
|||
import net.minecraft.client.renderer.blockentity.BlockEntityRendererProvider;
|
||||
import net.minecraft.core.BlockPos;
|
||||
import net.minecraft.core.Direction;
|
||||
import net.minecraft.core.registries.BuiltInRegistries;
|
||||
import net.minecraft.world.item.BlockItem;
|
||||
import net.minecraft.world.item.ItemStack;
|
||||
import net.minecraft.world.item.crafting.RecipeHolder;
|
||||
import net.minecraft.world.phys.Vec3;
|
||||
import net.minecraftforge.registries.ForgeRegistries;
|
||||
|
||||
public class RenderEmpowerer implements BlockEntityRenderer<TileEntityEmpowerer> {
|
||||
public RenderEmpowerer(BlockEntityRendererProvider.Context context) {
|
||||
|
@ -51,7 +52,7 @@ public class RenderEmpowerer implements BlockEntityRenderer<TileEntityEmpowerer>
|
|||
try {
|
||||
AssetUtil.renderItemInWorld(stack, combinedLight, combinedOverlay, matrices, buffer);
|
||||
} 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();
|
||||
|
@ -72,12 +73,12 @@ public class RenderEmpowerer implements BlockEntityRenderer<TileEntityEmpowerer>
|
|||
|
||||
*/
|
||||
if (tile.getCurrentRecipe() != null) {
|
||||
EmpowererRecipe recipe = tile.getCurrentRecipe();
|
||||
RecipeHolder<EmpowererRecipe> holder = tile.getCurrentRecipe();
|
||||
for (int i = 0; i <= 3; i++) {
|
||||
Direction facing = Direction.from2DDataValue(i);
|
||||
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()) {
|
||||
// for (IRecipe recipe : this.recipes) {
|
||||
// if (recipe != null) {
|
||||
// ItemStack output = recipe.getResultItem();
|
||||
// if (StackUtil.isValid(output)) {
|
||||
// ItemStack copy = output.copy();
|
||||
// ItemStack stack = recipe.getResultItem();
|
||||
// if (StackUtil.isValid(stack)) {
|
||||
// ItemStack copy = stack.copy();
|
||||
// /*
|
||||
// if (this.isWildcard) {
|
||||
// copy.setItemDamage(Util.WILDCARD);
|
||||
|
|
|
@ -27,23 +27,23 @@
|
|||
//public class PageFurnace extends BookletPage {
|
||||
//
|
||||
// private final ItemStack input;
|
||||
// private final ItemStack output;
|
||||
// private final ItemStack stack;
|
||||
//
|
||||
// public PageFurnace(int localizationKey, ItemStack output) {
|
||||
// this(localizationKey, output, 0);
|
||||
// public PageFurnace(int localizationKey, ItemStack stack) {
|
||||
// this(localizationKey, stack, 0);
|
||||
// }
|
||||
//
|
||||
// public PageFurnace(int localizationKey, ItemStack output, int priority) {
|
||||
// public PageFurnace(int localizationKey, ItemStack stack, int priority) {
|
||||
// super(localizationKey, priority);
|
||||
// this.output = output;
|
||||
// this.input = getInputForOutput(output);
|
||||
// this.stack = stack;
|
||||
// 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()) {
|
||||
// ItemStack stack = entry.getValue();
|
||||
// if (StackUtil.isValid(stack)) {
|
||||
// if (stack.sameItem(output)) {
|
||||
// if (stack.sameItem(stack)) {
|
||||
// return entry.getKey();
|
||||
// }
|
||||
// }
|
||||
|
@ -70,13 +70,13 @@
|
|||
// super.init(gui, startX, startY);
|
||||
//
|
||||
// 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
|
||||
// public void getItemStacksForPage(List<ItemStack> 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.Items;
|
||||
import net.minecraftforge.common.ForgeConfigSpec;
|
||||
import net.neoforged.neoforge.common.ModConfigSpec;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
|
||||
public class CommonConfig {
|
||||
private static final ForgeConfigSpec.Builder BUILDER = new ForgeConfigSpec.Builder();
|
||||
public static ForgeConfigSpec COMMON_CONFIG;
|
||||
private static final ModConfigSpec.Builder BUILDER = new ModConfigSpec.Builder();
|
||||
public static ModConfigSpec COMMON_CONFIG;
|
||||
|
||||
static {
|
||||
Other.build();
|
||||
|
@ -19,7 +19,7 @@ public class CommonConfig {
|
|||
}
|
||||
|
||||
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() {
|
||||
BUILDER.comment("Item settings").push("itemsSettings");
|
||||
|
@ -35,11 +35,11 @@ public class CommonConfig {
|
|||
}
|
||||
|
||||
public static class Machines {
|
||||
public static ForgeConfigSpec.IntValue FARMER_AREA;
|
||||
public static ForgeConfigSpec.IntValue RECONSTRUCTOR_POWER;
|
||||
public static ForgeConfigSpec.IntValue OIL_GENERATOR_TRANSFER;
|
||||
public static ForgeConfigSpec.IntValue MINER_LENS_ENERGY;
|
||||
public static ForgeConfigSpec.BooleanValue LASER_RELAY_LOSS;
|
||||
public static ModConfigSpec.IntValue FARMER_AREA;
|
||||
public static ModConfigSpec.IntValue RECONSTRUCTOR_POWER;
|
||||
public static ModConfigSpec.IntValue OIL_GENERATOR_TRANSFER;
|
||||
public static ModConfigSpec.IntValue MINER_LENS_ENERGY;
|
||||
public static ModConfigSpec.BooleanValue LASER_RELAY_LOSS;
|
||||
|
||||
public static void build() {
|
||||
BUILDER.comment("Machine Settings").push("machineSettings");
|
||||
|
@ -55,24 +55,24 @@ public class CommonConfig {
|
|||
}
|
||||
|
||||
public static class Other {
|
||||
public static ForgeConfigSpec.BooleanValue SOLID_XP_ALWAYS_ORBS;
|
||||
public static ForgeConfigSpec.BooleanValue DO_UPDATE_CHECK;
|
||||
public static ForgeConfigSpec.BooleanValue UPDATE_CHECK_VERSION_SPECIFIC;
|
||||
public static ForgeConfigSpec.BooleanValue DO_CAT_DROPS;
|
||||
public static ForgeConfigSpec.IntValue FUR_CHANCE;
|
||||
public static ForgeConfigSpec.BooleanValue WORMS;
|
||||
public static ForgeConfigSpec.IntValue WORMS_DIE_TIME;
|
||||
public static ForgeConfigSpec.BooleanValue CTRL_EXTRA_INFO;
|
||||
public static ForgeConfigSpec.BooleanValue CTRL_INFO_FOR_EXTRA_INFO;
|
||||
public static ForgeConfigSpec.BooleanValue GIVE_BOOKLET_ON_FIRST_CRAFT;
|
||||
public static ForgeConfigSpec.BooleanValue DUNGEON_LOOT;
|
||||
public static ForgeConfigSpec.BooleanValue WATER_BOWL;
|
||||
public static ForgeConfigSpec.BooleanValue WATER_BOWL_LOSS;
|
||||
public static ForgeConfigSpec.BooleanValue TINY_COAL_STUFF;
|
||||
public static ForgeConfigSpec.BooleanValue SUPER_DUPER_HARD_MODE;
|
||||
public static ForgeConfigSpec.BooleanValue MOST_BLAND_PERSON_EVER;
|
||||
public static ForgeConfigSpec.ConfigValue<String> REDSTONECONFIGURATOR;
|
||||
public static ForgeConfigSpec.ConfigValue<String> RELAYCONFIGURATOR;
|
||||
public static ModConfigSpec.BooleanValue SOLID_XP_ALWAYS_ORBS;
|
||||
public static ModConfigSpec.BooleanValue DO_UPDATE_CHECK;
|
||||
public static ModConfigSpec.BooleanValue UPDATE_CHECK_VERSION_SPECIFIC;
|
||||
public static ModConfigSpec.BooleanValue DO_CAT_DROPS;
|
||||
public static ModConfigSpec.IntValue FUR_CHANCE;
|
||||
public static ModConfigSpec.BooleanValue WORMS;
|
||||
public static ModConfigSpec.IntValue WORMS_DIE_TIME;
|
||||
public static ModConfigSpec.BooleanValue CTRL_EXTRA_INFO;
|
||||
public static ModConfigSpec.BooleanValue CTRL_INFO_FOR_EXTRA_INFO;
|
||||
public static ModConfigSpec.BooleanValue GIVE_BOOKLET_ON_FIRST_CRAFT;
|
||||
public static ModConfigSpec.BooleanValue DUNGEON_LOOT;
|
||||
public static ModConfigSpec.BooleanValue WATER_BOWL;
|
||||
public static ModConfigSpec.BooleanValue WATER_BOWL_LOSS;
|
||||
public static ModConfigSpec.BooleanValue TINY_COAL_STUFF;
|
||||
public static ModConfigSpec.BooleanValue SUPER_DUPER_HARD_MODE;
|
||||
public static ModConfigSpec.BooleanValue MOST_BLAND_PERSON_EVER;
|
||||
public static ModConfigSpec.ConfigValue<String> REDSTONECONFIGURATOR;
|
||||
public static ModConfigSpec.ConfigValue<String> RELAYCONFIGURATOR;
|
||||
public static Item redstoneConfigureItem = Items.AIR;
|
||||
public static Item relayConfigureItem = Items.AIR;
|
||||
|
||||
|
|
|
@ -1,24 +1,19 @@
|
|||
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.config.CommonConfig;
|
||||
import net.minecraft.resources.ResourceLocation;
|
||||
import net.minecraftforge.common.crafting.conditions.ICondition;
|
||||
import net.minecraftforge.common.crafting.conditions.IConditionSerializer;
|
||||
import net.neoforged.neoforge.common.conditions.ICondition;
|
||||
|
||||
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 final String boolConfig;
|
||||
|
||||
public BoolConfigCondition(String config) {
|
||||
this.boolConfig = config;
|
||||
}
|
||||
|
||||
@Override
|
||||
public ResourceLocation getID() {
|
||||
return NAME;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean test(IContext condition) {
|
||||
|
@ -30,22 +25,13 @@ public class BoolConfigCondition implements ICondition {
|
|||
}
|
||||
}
|
||||
|
||||
public static class Serializer implements IConditionSerializer<BoolConfigCondition> {
|
||||
public static final BoolConfigCondition.Serializer INSTANCE = new BoolConfigCondition.Serializer();
|
||||
|
||||
@Override
|
||||
public void write(JsonObject json, BoolConfigCondition value) {
|
||||
json.addProperty("config_name", value.boolConfig);
|
||||
public Codec<? extends ICondition> codec() {
|
||||
return CODEC;
|
||||
}
|
||||
|
||||
@Override
|
||||
public BoolConfigCondition read(JsonObject json) {
|
||||
return new BoolConfigCondition(json.get("config_name").getAsString());
|
||||
}
|
||||
|
||||
@Override
|
||||
public ResourceLocation getID() {
|
||||
return BoolConfigCondition.NAME;
|
||||
}
|
||||
public String toString() {
|
||||
return "ConfigEnabled(\"" + boolConfig + "\")";
|
||||
}
|
||||
}
|
||||
|
|
|
@ -1,45 +1,46 @@
|
|||
package de.ellpeck.actuallyadditions.mod.crafting;
|
||||
|
||||
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.RecipeType;
|
||||
import net.minecraftforge.eventbus.api.IEventBus;
|
||||
import net.minecraftforge.registries.DeferredRegister;
|
||||
import net.minecraftforge.registries.ForgeRegistries;
|
||||
import net.minecraftforge.registries.RegistryObject;
|
||||
import net.neoforged.bus.api.IEventBus;
|
||||
import net.neoforged.neoforge.registries.DeferredRegister;
|
||||
|
||||
import java.util.function.Supplier;
|
||||
|
||||
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) {
|
||||
SERIALIZERS.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 RegistryObject<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 RegistryObject<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 RegistryObject<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 RegistryObject<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 RegistryObject<RecipeSerializer<?>> MINING_LENS_RECIPE = SERIALIZERS.register(MiningLensRecipe.NAME, MiningLensRecipe.Serializer::new);
|
||||
public static final Supplier<RecipeSerializer<?>> KEEP_DATA_SHAPED_RECIPE = SERIALIZERS.register(RecipeKeepDataShaped.NAME, RecipeKeepDataShaped.Serializer::new);
|
||||
public static final Supplier<RecipeSerializer<?>> LASER_RECIPE = SERIALIZERS.register(LaserRecipe.NAME, LaserRecipe.Serializer::new);
|
||||
public static final Supplier<RecipeSerializer<?>> EMPOWERING_RECIPE = SERIALIZERS.register(EmpowererRecipe.NAME, EmpowererRecipe.Serializer::new);
|
||||
public static final Supplier<RecipeSerializer<?>> CRUSHING_RECIPE = SERIALIZERS.register(CrushingRecipe.NAME, CrushingRecipe.Serializer::new);
|
||||
public static final Supplier<RecipeSerializer<?>> SOLID_FUEL_RECIPE = SERIALIZERS.register(SolidFuelRecipe.NAME, SolidFuelRecipe.Serializer::new);
|
||||
public static final Supplier<RecipeSerializer<?>> LIQUID_FUEL_RECIPE = SERIALIZERS.register(LiquidFuelRecipe.NAME, LiquidFuelRecipe.Serializer::new);
|
||||
public static final Supplier<RecipeSerializer<?>> PRESSING_RECIPE = SERIALIZERS.register(PressingRecipe.NAME, PressingRecipe.Serializer::new);
|
||||
public static final Supplier<RecipeSerializer<?>> FERMENTING_RECIPE = SERIALIZERS.register(FermentingRecipe.NAME, FermentingRecipe.Serializer::new);
|
||||
public static final Supplier<RecipeSerializer<?>> COLOR_CHANGE_RECIPE = SERIALIZERS.register(ColorChangeRecipe.NAME, ColorChangeRecipe.Serializer::new);
|
||||
public static final Supplier<RecipeSerializer<?>> MINING_LENS_RECIPE = SERIALIZERS.register(MiningLensRecipe.NAME, MiningLensRecipe.Serializer::new);
|
||||
|
||||
|
||||
|
||||
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 RegistryObject<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 RegistryObject<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 RegistryObject<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 RegistryObject<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<LaserRecipe>> LASER = RECIPE_TYPES.register("laser", () -> new RecipeType<>() {});
|
||||
public static final Supplier<RecipeType<EmpowererRecipe>> EMPOWERING = RECIPE_TYPES.register("empower", () -> new RecipeType<>() {});
|
||||
public static final Supplier<RecipeType<CrushingRecipe>> CRUSHING = RECIPE_TYPES.register("crushing", () -> new RecipeType<>() {});
|
||||
public static final Supplier<RecipeType<SolidFuelRecipe>> SOLID_FUEL = RECIPE_TYPES.register("solid_fuel", () -> new RecipeType<>() {});
|
||||
public static final Supplier<RecipeType<LiquidFuelRecipe>> LIQUID_FUEL = RECIPE_TYPES.register("liquid_fuel", () -> new RecipeType<>() {});
|
||||
public static final Supplier<RecipeType<PressingRecipe>> PRESSING = RECIPE_TYPES.register("pressing", () -> new RecipeType<>() {});
|
||||
public static final Supplier<RecipeType<FermentingRecipe>> FERMENTING = RECIPE_TYPES.register("fermenting", () -> new RecipeType<>() {});
|
||||
public static final Supplier<RecipeType<ColorChangeRecipe>> COLOR_CHANGE = RECIPE_TYPES.register("color_change", () -> 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;
|
||||
|
||||
import com.google.gson.JsonObject;
|
||||
import com.mojang.serialization.Codec;
|
||||
import com.mojang.serialization.codecs.RecordCodecBuilder;
|
||||
import de.ellpeck.actuallyadditions.api.ActuallyAdditionsAPI;
|
||||
import net.minecraft.core.RegistryAccess;
|
||||
import net.minecraft.data.recipes.FinishedRecipe;
|
||||
import net.minecraft.network.FriendlyByteBuf;
|
||||
import net.minecraft.resources.ResourceLocation;
|
||||
import net.minecraft.util.GsonHelper;
|
||||
import net.minecraft.world.Container;
|
||||
import net.minecraft.world.item.ItemStack;
|
||||
import net.minecraft.world.item.crafting.Ingredient;
|
||||
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.RecipeType;
|
||||
import net.minecraft.world.level.ItemLike;
|
||||
import net.minecraft.world.level.Level;
|
||||
import net.minecraftforge.registries.ForgeRegistries;
|
||||
|
||||
import javax.annotation.Nonnull;
|
||||
import javax.annotation.Nullable;
|
||||
|
@ -26,12 +23,10 @@ public class ColorChangeRecipe implements Recipe<Container> {
|
|||
|
||||
private final Ingredient input;
|
||||
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.output = output;
|
||||
this.id = id;
|
||||
}
|
||||
|
||||
@Override
|
||||
|
@ -59,8 +54,8 @@ public class ColorChangeRecipe implements Recipe<Container> {
|
|||
return false;
|
||||
}
|
||||
|
||||
public static Optional<ColorChangeRecipe> getRecipeForStack(ItemStack stack) {
|
||||
return ActuallyAdditionsAPI.COLOR_CHANGE_RECIPES.stream().filter(recipe -> recipe.matches(stack)).findFirst();
|
||||
public static Optional<RecipeHolder<ColorChangeRecipe>> getRecipeForStack(ItemStack stack) {
|
||||
return ActuallyAdditionsAPI.COLOR_CHANGE_RECIPES.stream().filter(recipe -> recipe.value().matches(stack)).findFirst();
|
||||
}
|
||||
|
||||
@Nonnull
|
||||
|
@ -69,12 +64,6 @@ public class ColorChangeRecipe implements Recipe<Container> {
|
|||
return output.copy();
|
||||
}
|
||||
|
||||
@Nonnull
|
||||
@Override
|
||||
public ResourceLocation getId() {
|
||||
return id;
|
||||
}
|
||||
|
||||
@Nonnull
|
||||
@Override
|
||||
public RecipeSerializer<?> getSerializer() {
|
||||
|
@ -87,21 +76,34 @@ public class ColorChangeRecipe implements Recipe<Container> {
|
|||
}
|
||||
|
||||
public static class Serializer implements RecipeSerializer<ColorChangeRecipe> {
|
||||
@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"));
|
||||
private static final Codec<ColorChangeRecipe> CODEC = RecordCodecBuilder.create(
|
||||
instance -> instance.group(
|
||||
ItemStack.RESULT_CODEC.fieldOf("result").forGetter(recipe -> recipe.output),
|
||||
Ingredient.CODEC_NONEMPTY.fieldOf("ingredient").forGetter(recipe -> recipe.input)
|
||||
)
|
||||
.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
|
||||
@Override
|
||||
public ColorChangeRecipe fromNetwork(@Nonnull ResourceLocation pRecipeId, @Nonnull FriendlyByteBuf pBuffer) {
|
||||
public ColorChangeRecipe fromNetwork(@Nonnull FriendlyByteBuf pBuffer) {
|
||||
Ingredient ingredient = Ingredient.fromNetwork(pBuffer);
|
||||
ItemStack result = pBuffer.readItem();
|
||||
return new ColorChangeRecipe(pRecipeId, result, ingredient);
|
||||
return new ColorChangeRecipe(result, ingredient);
|
||||
}
|
||||
|
||||
@Override
|
||||
|
@ -110,48 +112,4 @@ public class ColorChangeRecipe implements Recipe<Container> {
|
|||
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;
|
||||
|
||||
import com.google.gson.JsonArray;
|
||||
import com.google.gson.JsonObject;
|
||||
import de.ellpeck.actuallyadditions.mod.ActuallyAdditions;
|
||||
import com.mojang.serialization.Codec;
|
||||
import com.mojang.serialization.DataResult;
|
||||
import com.mojang.serialization.codecs.RecordCodecBuilder;
|
||||
import net.minecraft.core.NonNullList;
|
||||
import net.minecraft.core.RegistryAccess;
|
||||
import net.minecraft.data.recipes.FinishedRecipe;
|
||||
import net.minecraft.network.FriendlyByteBuf;
|
||||
import net.minecraft.resources.ResourceLocation;
|
||||
import net.minecraft.util.GsonHelper;
|
||||
import net.minecraft.world.Container;
|
||||
import net.minecraft.world.item.ItemStack;
|
||||
import net.minecraft.world.item.crafting.Ingredient;
|
||||
import net.minecraft.world.item.crafting.Recipe;
|
||||
import net.minecraft.world.item.crafting.RecipeSerializer;
|
||||
import net.minecraft.world.item.crafting.RecipeType;
|
||||
import net.minecraft.world.level.ItemLike;
|
||||
import net.minecraft.world.level.Level;
|
||||
import net.minecraftforge.registries.ForgeRegistries;
|
||||
|
||||
import javax.annotation.Nonnull;
|
||||
import javax.annotation.Nullable;
|
||||
|
||||
public class CrushingRecipe implements Recipe<Container> {
|
||||
public static String NAME = "crushing";
|
||||
private final ResourceLocation id;
|
||||
protected Ingredient input;
|
||||
protected ItemStack outputOne;
|
||||
protected ItemStack outputTwo;
|
||||
protected float chance1;
|
||||
protected float chance2;
|
||||
protected NonNullList<CrushingResult> outputs;
|
||||
|
||||
public CrushingRecipe(ResourceLocation id, Ingredient input, ItemStack outputOne, float chance1, ItemStack outputTwo, float chance2) {
|
||||
this.id = id;
|
||||
public CrushingRecipe(Ingredient input, NonNullList<CrushingResult> outputList) {
|
||||
this.input = input;
|
||||
this.outputOne = outputOne;
|
||||
this.outputTwo = outputTwo;
|
||||
this.chance1 = chance1;
|
||||
this.chance2 = chance2;
|
||||
this.outputs = outputList;
|
||||
}
|
||||
|
||||
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 = input;
|
||||
this.outputOne = outputOne;
|
||||
this.outputTwo = outputTwo;
|
||||
this.chance1 = chance1;
|
||||
this.chance2 = chance2;
|
||||
this(input, createList(new CrushingResult(outputOne, chance1), new CrushingResult(outputTwo, chance2)));
|
||||
}
|
||||
|
||||
private static NonNullList<CrushingResult> createList(CrushingResult... results) {
|
||||
NonNullList<CrushingResult> list = NonNullList.create();
|
||||
for (CrushingResult result : results) {
|
||||
list.add(result);
|
||||
}
|
||||
return list;
|
||||
}
|
||||
|
||||
@Override
|
||||
|
@ -76,13 +66,7 @@ public class CrushingRecipe implements Recipe<Container> {
|
|||
@Override
|
||||
@Nonnull
|
||||
public ItemStack getResultItem(RegistryAccess pRegistryAccess) {
|
||||
return outputOne;
|
||||
}
|
||||
|
||||
@Override
|
||||
@Nonnull
|
||||
public ResourceLocation getId() {
|
||||
return id;
|
||||
return this.outputs.get(0).stack.copy();
|
||||
}
|
||||
|
||||
@Override
|
||||
|
@ -98,137 +82,119 @@ public class CrushingRecipe implements Recipe<Container> {
|
|||
}
|
||||
|
||||
public ItemStack getOutputOne() {
|
||||
return this.outputOne;
|
||||
return this.outputs.get(0).stack;
|
||||
}
|
||||
|
||||
public ItemStack getOutputTwo() {
|
||||
return this.outputTwo;
|
||||
return this.outputs.get(1).stack;
|
||||
}
|
||||
|
||||
public float getFirstChance() {
|
||||
return this.chance1;
|
||||
return this.outputs.get(0).chance;
|
||||
}
|
||||
public float getSecondChance() {
|
||||
return this.chance2;
|
||||
return this.outputs.get(1).chance;
|
||||
}
|
||||
|
||||
public Ingredient getInput() {
|
||||
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> {
|
||||
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
|
||||
@Nonnull
|
||||
public CrushingRecipe fromJson(@Nonnull ResourceLocation pRecipeId, @Nonnull JsonObject pJson) {
|
||||
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");
|
||||
public Codec<CrushingRecipe> codec() {
|
||||
return CODEC;
|
||||
}
|
||||
|
||||
return new CrushingRecipe(pRecipeId, ingredient, output1, chance1, output2, chance2);
|
||||
}
|
||||
// @Override
|
||||
// @Nonnull
|
||||
// public CrushingRecipe fromJson(@Nonnull ResourceLocation pRecipeId, @Nonnull JsonObject pJson) {
|
||||
// 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
|
||||
public CrushingRecipe fromNetwork(@Nonnull ResourceLocation pRecipeId, @Nonnull FriendlyByteBuf pBuffer) {
|
||||
public CrushingRecipe fromNetwork(@Nonnull FriendlyByteBuf pBuffer) {
|
||||
Ingredient ingredient = Ingredient.fromNetwork(pBuffer);
|
||||
ItemStack output1 = pBuffer.readItem();
|
||||
ItemStack output2 = pBuffer.readItem();
|
||||
float chance1 = pBuffer.readFloat();
|
||||
float chance2 = pBuffer.readFloat();
|
||||
|
||||
return new CrushingRecipe(pRecipeId, ingredient, output1, chance1, output2, chance2);
|
||||
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
|
||||
public void toNetwork(@Nonnull FriendlyByteBuf pBuffer, CrushingRecipe pRecipe) {
|
||||
pRecipe.input.toNetwork(pBuffer);
|
||||
pBuffer.writeItem(pRecipe.outputOne);
|
||||
pBuffer.writeItem(pRecipe.outputTwo);
|
||||
pBuffer.writeFloat(pRecipe.chance1);
|
||||
pBuffer.writeFloat(pRecipe.chance2);
|
||||
pBuffer.writeVarInt(pRecipe.outputs.size());
|
||||
for (CrushingResult result : pRecipe.outputs) {
|
||||
pBuffer.writeItem(result.stack);
|
||||
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;
|
||||
|
||||
import com.google.gson.JsonArray;
|
||||
import com.google.gson.JsonObject;
|
||||
import com.mojang.serialization.Codec;
|
||||
import com.mojang.serialization.DataResult;
|
||||
import com.mojang.serialization.codecs.RecordCodecBuilder;
|
||||
import net.minecraft.core.NonNullList;
|
||||
import net.minecraft.core.RegistryAccess;
|
||||
import net.minecraft.data.recipes.FinishedRecipe;
|
||||
import net.minecraft.network.FriendlyByteBuf;
|
||||
import net.minecraft.resources.ResourceLocation;
|
||||
import net.minecraft.util.GsonHelper;
|
||||
import net.minecraft.world.Container;
|
||||
import net.minecraft.world.item.ItemStack;
|
||||
import net.minecraft.world.item.crafting.Ingredient;
|
||||
import net.minecraft.world.item.crafting.Recipe;
|
||||
import net.minecraft.world.item.crafting.RecipeSerializer;
|
||||
import net.minecraft.world.item.crafting.RecipeType;
|
||||
import net.minecraft.world.level.ItemLike;
|
||||
import net.minecraft.world.level.Level;
|
||||
import net.minecraftforge.registries.ForgeRegistries;
|
||||
|
||||
import javax.annotation.Nonnull;
|
||||
import javax.annotation.Nullable;
|
||||
|
@ -24,27 +21,19 @@ import java.util.List;
|
|||
|
||||
public class EmpowererRecipe implements Recipe<Container> {
|
||||
public static String NAME = "empowering";
|
||||
private final ResourceLocation id;
|
||||
protected final Ingredient input;
|
||||
protected final ItemStack output;
|
||||
|
||||
protected final Ingredient modifier1;
|
||||
protected final Ingredient modifier2;
|
||||
protected final Ingredient modifier3;
|
||||
protected final Ingredient modifier4;
|
||||
protected final NonNullList<Ingredient> modifiers;
|
||||
|
||||
protected final int energyPerStand;
|
||||
protected final int particleColor;
|
||||
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) {
|
||||
this.id = id;
|
||||
public EmpowererRecipe(ItemStack output, Ingredient input, NonNullList<Ingredient> modifiers, int energyPerStand, int particleColor, int time) {
|
||||
this.input = input;
|
||||
this.output = output;
|
||||
this.modifier1 = modifier1;
|
||||
this.modifier2 = modifier2;
|
||||
this.modifier3 = modifier3;
|
||||
this.modifier4 = modifier4;
|
||||
this.modifiers = modifiers;
|
||||
this.energyPerStand = energyPerStand;
|
||||
this.particleColor = particleColor;
|
||||
this.time = time;
|
||||
|
@ -57,17 +46,17 @@ public class EmpowererRecipe implements Recipe<Container> {
|
|||
ItemStack[] stacks = {stand1, stand2, stand3, stand4};
|
||||
boolean[] unused = {true, true, true, true};
|
||||
for (ItemStack s : stacks) {
|
||||
if (unused[0] && this.modifier1.test(s)) {
|
||||
matches.add(this.modifier1);
|
||||
if (unused[0] && this.modifiers.get(0).test(s)) {
|
||||
matches.add(this.modifiers.get(0));
|
||||
unused[0] = false;
|
||||
} else if (unused[1] && this.modifier2.test(s)) {
|
||||
matches.add(this.modifier2);
|
||||
} else if (unused[1] && this.modifiers.get(1).test(s)) {
|
||||
matches.add(this.modifiers.get(1));
|
||||
unused[1] = false;
|
||||
} else if (unused[2] && this.modifier3.test(s)) {
|
||||
matches.add(this.modifier3);
|
||||
} else if (unused[2] && this.modifiers.get(2).test(s)) {
|
||||
matches.add(this.modifiers.get(2));
|
||||
unused[2] = false;
|
||||
} else if (unused[3] && this.modifier4.test(s)) {
|
||||
matches.add(this.modifier4);
|
||||
} else if (unused[3] && this.modifiers.get(3).test(s)) {
|
||||
matches.add(this.modifiers.get(3));
|
||||
unused[3] = false;
|
||||
}
|
||||
}
|
||||
|
@ -102,12 +91,6 @@ public class EmpowererRecipe implements Recipe<Container> {
|
|||
return output;
|
||||
}
|
||||
|
||||
@Override
|
||||
@Nonnull
|
||||
public ResourceLocation getId() {
|
||||
return id;
|
||||
}
|
||||
|
||||
@Override
|
||||
@Nonnull
|
||||
public RecipeSerializer<?> getSerializer() {
|
||||
|
@ -129,19 +112,19 @@ public class EmpowererRecipe implements Recipe<Container> {
|
|||
}
|
||||
|
||||
public Ingredient getStandOne() {
|
||||
return this.modifier1;
|
||||
return this.modifiers.get(0);
|
||||
}
|
||||
|
||||
public Ingredient getStandTwo() {
|
||||
return this.modifier2;
|
||||
return this.modifiers.get(1);
|
||||
}
|
||||
|
||||
public Ingredient getStandThree() {
|
||||
return this.modifier3;
|
||||
return this.modifiers.get(2);
|
||||
}
|
||||
|
||||
public Ingredient getStandFour() {
|
||||
return this.modifier4;
|
||||
return this.modifiers.get(3);
|
||||
}
|
||||
|
||||
public int getTime() {
|
||||
|
@ -157,127 +140,92 @@ public class EmpowererRecipe implements Recipe<Container> {
|
|||
}
|
||||
|
||||
public static class Serializer implements RecipeSerializer<EmpowererRecipe> {
|
||||
@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);
|
||||
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
|
||||
public Codec<EmpowererRecipe> codec() {
|
||||
return CODEC;
|
||||
}
|
||||
|
||||
// @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
|
||||
@Override
|
||||
public EmpowererRecipe fromNetwork(@Nonnull ResourceLocation pRecipeId, FriendlyByteBuf pBuffer) {
|
||||
public EmpowererRecipe fromNetwork(FriendlyByteBuf pBuffer) {
|
||||
ItemStack result = pBuffer.readItem();
|
||||
Ingredient input = Ingredient.fromNetwork(pBuffer);
|
||||
Ingredient mod1 = Ingredient.fromNetwork(pBuffer);
|
||||
Ingredient mod2 = Ingredient.fromNetwork(pBuffer);
|
||||
Ingredient mod3 = Ingredient.fromNetwork(pBuffer);
|
||||
Ingredient mod4 = Ingredient.fromNetwork(pBuffer);
|
||||
|
||||
int i = pBuffer.readVarInt();
|
||||
NonNullList<Ingredient> nonnulllist = NonNullList.withSize(i, Ingredient.EMPTY);
|
||||
for (int j = 0; j < nonnulllist.size(); ++j) {
|
||||
nonnulllist.set(j, Ingredient.fromNetwork(pBuffer));
|
||||
}
|
||||
|
||||
int energy = pBuffer.readInt();
|
||||
int color = 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
|
||||
public void toNetwork(FriendlyByteBuf pBuffer, EmpowererRecipe pRecipe) {
|
||||
pBuffer.writeItem(pRecipe.output);
|
||||
pRecipe.input.toNetwork(pBuffer);
|
||||
pRecipe.modifier1.toNetwork(pBuffer);
|
||||
pRecipe.modifier2.toNetwork(pBuffer);
|
||||
pRecipe.modifier3.toNetwork(pBuffer);
|
||||
pRecipe.modifier4.toNetwork(pBuffer);
|
||||
pBuffer.writeVarInt(pRecipe.modifiers.size());
|
||||
for (Ingredient modifier : pRecipe.modifiers) {
|
||||
modifier.toNetwork(pBuffer);
|
||||
}
|
||||
pBuffer.writeInt(pRecipe.energyPerStand);
|
||||
pBuffer.writeInt(pRecipe.particleColor);
|
||||
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;
|
||||
|
||||
import com.google.gson.JsonObject;
|
||||
import com.google.gson.JsonParseException;
|
||||
import com.mojang.serialization.Codec;
|
||||
import com.mojang.serialization.codecs.RecordCodecBuilder;
|
||||
import de.ellpeck.actuallyadditions.mod.inventory.gui.FluidDisplay;
|
||||
import net.minecraft.core.RegistryAccess;
|
||||
import net.minecraft.data.recipes.FinishedRecipe;
|
||||
import net.minecraft.network.FriendlyByteBuf;
|
||||
import net.minecraft.resources.ResourceLocation;
|
||||
import net.minecraft.util.GsonHelper;
|
||||
import net.minecraft.world.Container;
|
||||
import net.minecraft.world.item.ItemStack;
|
||||
import net.minecraft.world.item.crafting.Recipe;
|
||||
import net.minecraft.world.item.crafting.RecipeSerializer;
|
||||
import net.minecraft.world.item.crafting.RecipeType;
|
||||
import net.minecraft.world.level.Level;
|
||||
import net.minecraft.world.level.material.Fluid;
|
||||
import net.minecraftforge.fluids.FluidStack;
|
||||
import net.minecraftforge.registries.ForgeRegistries;
|
||||
import net.neoforged.neoforge.fluids.FluidStack;
|
||||
|
||||
import javax.annotation.Nonnull;
|
||||
import javax.annotation.Nullable;
|
||||
|
@ -24,7 +19,6 @@ import java.util.Optional;
|
|||
|
||||
public class FermentingRecipe implements Recipe<Container> {
|
||||
public static final String NAME = "fermenting";
|
||||
private final ResourceLocation ID;
|
||||
private final FluidStack input;
|
||||
private final FluidStack output;
|
||||
private final int time;
|
||||
|
@ -32,8 +26,7 @@ public class FermentingRecipe implements Recipe<Container> {
|
|||
private Optional<FluidDisplay> inputDisplay;
|
||||
private Optional<FluidDisplay> outputDisplay;
|
||||
|
||||
public FermentingRecipe(ResourceLocation ID, FluidStack input, FluidStack output, int timeIn) {
|
||||
this.ID = ID;
|
||||
public FermentingRecipe(FluidStack input, FluidStack output, int timeIn) {
|
||||
this.input = input;
|
||||
this.output = output;
|
||||
this.time = timeIn;
|
||||
|
@ -102,12 +95,6 @@ public class FermentingRecipe implements Recipe<Container> {
|
|||
return ItemStack.EMPTY;
|
||||
}
|
||||
|
||||
@Nonnull
|
||||
@Override
|
||||
public ResourceLocation getId() {
|
||||
return ID;
|
||||
}
|
||||
|
||||
@Nonnull
|
||||
@Override
|
||||
public RecipeSerializer<?> getSerializer() {
|
||||
|
@ -121,110 +108,62 @@ public class FermentingRecipe implements Recipe<Container> {
|
|||
}
|
||||
|
||||
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
|
||||
public FermentingRecipe fromJson(@Nonnull ResourceLocation pRecipeId, @Nonnull JsonObject pJson) {
|
||||
JsonObject ingredient = pJson.getAsJsonObject("ingredient");
|
||||
|
||||
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);
|
||||
public Codec<FermentingRecipe> codec() {
|
||||
return CODEC;
|
||||
}
|
||||
|
||||
@Nullable
|
||||
@Override
|
||||
public FermentingRecipe fromNetwork(@Nonnull ResourceLocation pRecipeId, @Nonnull FriendlyByteBuf pBuffer) {
|
||||
ResourceLocation inputRes = new ResourceLocation(pBuffer.readUtf());
|
||||
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);
|
||||
|
||||
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);
|
||||
|
||||
public FermentingRecipe fromNetwork(@Nonnull FriendlyByteBuf pBuffer) {
|
||||
FluidStack input = FluidStack.readFromPacket(pBuffer);
|
||||
FluidStack output = FluidStack.readFromPacket(pBuffer);
|
||||
int time = pBuffer.readInt();
|
||||
|
||||
return new FermentingRecipe(pRecipeId, input, output, time);
|
||||
return new FermentingRecipe(input, output, time);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void toNetwork(@Nonnull FriendlyByteBuf pBuffer, @Nonnull FermentingRecipe pRecipe) {
|
||||
pBuffer.writeUtf(ForgeRegistries.FLUIDS.getKey(pRecipe.input.getFluid()).toString());
|
||||
pBuffer.writeInt(pRecipe.input.getAmount());
|
||||
pBuffer.writeUtf(ForgeRegistries.FLUIDS.getKey(pRecipe.output.getFluid()).toString());
|
||||
pRecipe.input.writeToPacket(pBuffer);
|
||||
pRecipe.output.writeToPacket(pBuffer);
|
||||
pBuffer.writeInt(pRecipe.output.getAmount());
|
||||
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;
|
||||
|
||||
import com.google.gson.JsonObject;
|
||||
import com.mojang.serialization.Codec;
|
||||
import com.mojang.serialization.codecs.RecordCodecBuilder;
|
||||
import de.ellpeck.actuallyadditions.api.ActuallyAdditionsAPI;
|
||||
import net.minecraft.core.RegistryAccess;
|
||||
import net.minecraft.data.recipes.FinishedRecipe;
|
||||
import net.minecraft.network.FriendlyByteBuf;
|
||||
import net.minecraft.resources.ResourceLocation;
|
||||
import net.minecraft.util.GsonHelper;
|
||||
import net.minecraft.world.Container;
|
||||
import net.minecraft.world.item.ItemStack;
|
||||
import net.minecraft.world.item.crafting.Ingredient;
|
||||
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.RecipeType;
|
||||
import net.minecraft.world.level.ItemLike;
|
||||
import net.minecraft.world.level.Level;
|
||||
import net.minecraftforge.registries.ForgeRegistries;
|
||||
|
||||
import javax.annotation.Nonnull;
|
||||
import javax.annotation.Nullable;
|
||||
|
@ -27,13 +24,11 @@ public class LaserRecipe implements Recipe<Container> {
|
|||
private ItemStack result;
|
||||
private Ingredient itemIngredient;
|
||||
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.itemIngredient = itemIngredient;
|
||||
this.energy = energy;
|
||||
this.id = id;
|
||||
}
|
||||
|
||||
public int getEnergy() {
|
||||
|
@ -78,11 +73,6 @@ public class LaserRecipe implements Recipe<Container> {
|
|||
return result;
|
||||
}
|
||||
|
||||
@Override
|
||||
public ResourceLocation getId() {
|
||||
return id;
|
||||
}
|
||||
|
||||
@Override
|
||||
public RecipeSerializer<?> getSerializer() {
|
||||
return ActuallyRecipes.LASER_RECIPE.get();
|
||||
|
@ -93,8 +83,8 @@ public class LaserRecipe implements Recipe<Container> {
|
|||
return ActuallyRecipes.Types.LASER.get();
|
||||
}
|
||||
|
||||
public static Optional<LaserRecipe> getRecipeForStack(ItemStack stack) {
|
||||
return ActuallyAdditionsAPI.CONVERSION_LASER_RECIPES.stream().filter(recipe -> recipe.matches(stack)).findFirst();
|
||||
public static Optional<RecipeHolder<LaserRecipe>> getRecipeForStack(ItemStack stack) {
|
||||
return ActuallyAdditionsAPI.CONVERSION_LASER_RECIPES.stream().filter(recipe -> recipe.value().matches(stack)).findFirst();
|
||||
}
|
||||
|
||||
public boolean validInput(ItemStack stack) {
|
||||
|
@ -102,23 +92,38 @@ public class LaserRecipe implements Recipe<Container> {
|
|||
}
|
||||
|
||||
public static class Serializer implements RecipeSerializer<LaserRecipe> {
|
||||
@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"));
|
||||
private static final Codec<LaserRecipe> CODEC = RecordCodecBuilder.create(
|
||||
instance -> instance.group(
|
||||
ItemStack.RESULT_CODEC.fieldOf("result").forGetter(recipe -> recipe.result),
|
||||
Ingredient.CODEC_NONEMPTY.fieldOf("ingredient").forGetter(recipe -> recipe.itemIngredient),
|
||||
Codec.INT.fieldOf("energy").forGetter(recipe -> recipe.energy)
|
||||
)
|
||||
.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
|
||||
@Override
|
||||
public LaserRecipe fromNetwork(@Nonnull ResourceLocation pRecipeId, @Nonnull FriendlyByteBuf pBuffer) {
|
||||
public LaserRecipe fromNetwork(@Nonnull FriendlyByteBuf pBuffer) {
|
||||
Ingredient ingredient = Ingredient.fromNetwork(pBuffer);
|
||||
int energy = pBuffer.readInt();
|
||||
ItemStack result = pBuffer.readItem();
|
||||
return new LaserRecipe(pRecipeId, result, ingredient, energy);
|
||||
return new LaserRecipe(result, ingredient, energy);
|
||||
}
|
||||
|
||||
@Override
|
||||
|
@ -128,51 +133,4 @@ public class LaserRecipe implements Recipe<Container> {
|
|||
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;
|
||||
|
||||
import com.google.gson.JsonObject;
|
||||
import com.google.gson.JsonParseException;
|
||||
import com.mojang.serialization.Codec;
|
||||
import com.mojang.serialization.codecs.RecordCodecBuilder;
|
||||
import net.minecraft.core.RegistryAccess;
|
||||
import net.minecraft.data.recipes.FinishedRecipe;
|
||||
import net.minecraft.network.FriendlyByteBuf;
|
||||
import net.minecraft.resources.ResourceLocation;
|
||||
import net.minecraft.util.GsonHelper;
|
||||
import net.minecraft.world.Container;
|
||||
import net.minecraft.world.item.ItemStack;
|
||||
import net.minecraft.world.item.crafting.Recipe;
|
||||
import net.minecraft.world.item.crafting.RecipeSerializer;
|
||||
import net.minecraft.world.item.crafting.RecipeType;
|
||||
import net.minecraft.world.level.Level;
|
||||
import net.minecraft.world.level.material.Fluid;
|
||||
import net.minecraftforge.fluids.FluidStack;
|
||||
import net.minecraftforge.registries.ForgeRegistries;
|
||||
import net.neoforged.neoforge.fluids.FluidStack;
|
||||
|
||||
import javax.annotation.Nonnull;
|
||||
import javax.annotation.Nullable;
|
||||
|
||||
public class LiquidFuelRecipe implements Recipe<Container> {
|
||||
public static String NAME = "liquid_fuel";
|
||||
private FluidStack fuel;
|
||||
private int burnTime;
|
||||
private int totalEnergy;
|
||||
private ResourceLocation id;
|
||||
|
||||
/**
|
||||
* Oil generator recipe
|
||||
* @param id ResourceLocation of the recipe
|
||||
* @param fuel The fluid
|
||||
* @param totalEnergy The total power generated.
|
||||
* @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.burnTime = burnTime;
|
||||
this.totalEnergy = totalEnergy;
|
||||
this.id = id;
|
||||
}
|
||||
|
||||
public int getBurnTime() {
|
||||
|
@ -88,12 +79,6 @@ public class LiquidFuelRecipe implements Recipe<Container> {
|
|||
return ItemStack.EMPTY;
|
||||
}
|
||||
|
||||
@Nonnull
|
||||
@Override
|
||||
public ResourceLocation getId() {
|
||||
return id;
|
||||
}
|
||||
|
||||
@Nonnull
|
||||
@Override
|
||||
public RecipeSerializer<?> getSerializer() {
|
||||
|
@ -107,96 +92,51 @@ public class LiquidFuelRecipe implements Recipe<Container> {
|
|||
}
|
||||
|
||||
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
|
||||
public LiquidFuelRecipe fromJson(@Nonnull ResourceLocation pId, JsonObject pJson) {
|
||||
JsonObject ingredient = pJson.getAsJsonObject("ingredient");
|
||||
|
||||
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);
|
||||
public Codec<LiquidFuelRecipe> codec() {
|
||||
return CODEC;
|
||||
}
|
||||
|
||||
@Override
|
||||
public LiquidFuelRecipe fromNetwork(@Nonnull ResourceLocation pId, @Nonnull FriendlyByteBuf pBuffer) {
|
||||
ResourceLocation inputRes = new ResourceLocation(pBuffer.readUtf());
|
||||
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);
|
||||
|
||||
public LiquidFuelRecipe fromNetwork(@Nonnull FriendlyByteBuf pBuffer) {
|
||||
FluidStack input = FluidStack.readFromPacket(pBuffer);
|
||||
int totalEnergy = pBuffer.readInt();
|
||||
int burnTime = pBuffer.readInt();
|
||||
return new LiquidFuelRecipe(pId, input, totalEnergy, burnTime);
|
||||
return new LiquidFuelRecipe(input, totalEnergy, burnTime);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void toNetwork(@Nonnull FriendlyByteBuf pBuffer, LiquidFuelRecipe pRecipe) {
|
||||
pBuffer.writeUtf(ForgeRegistries.FLUIDS.getKey(pRecipe.fuel.getFluid()).toString());
|
||||
pBuffer.writeInt(pRecipe.fuel.getAmount());
|
||||
pRecipe.fuel.writeToPacket(pBuffer);
|
||||
pBuffer.writeInt(pRecipe.totalEnergy);
|
||||
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;
|
||||
|
||||
import com.google.gson.JsonObject;
|
||||
import com.mojang.serialization.Codec;
|
||||
import com.mojang.serialization.codecs.RecordCodecBuilder;
|
||||
import net.minecraft.core.RegistryAccess;
|
||||
import net.minecraft.data.recipes.FinishedRecipe;
|
||||
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.WeightedEntry;
|
||||
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.RecipeSerializer;
|
||||
import net.minecraft.world.item.crafting.RecipeType;
|
||||
import net.minecraft.world.level.ItemLike;
|
||||
import net.minecraft.world.level.Level;
|
||||
import net.minecraftforge.registries.ForgeRegistries;
|
||||
|
||||
import javax.annotation.Nonnull;
|
||||
import javax.annotation.Nullable;
|
||||
|
@ -24,19 +20,16 @@ import javax.annotation.Nullable;
|
|||
public class MiningLensRecipe implements Recipe<Container>, WeightedEntry {
|
||||
public static final String NAME = "mining_lens";
|
||||
|
||||
private final ResourceLocation id;
|
||||
private final int weight;
|
||||
private final Ingredient input;
|
||||
//private final int weight;
|
||||
private final ItemStack output;
|
||||
|
||||
public MiningLensRecipe(ResourceLocation id, Ingredient input, int weight, ItemStack output) {
|
||||
super();
|
||||
public MiningLensRecipe(Ingredient input, int weight, ItemStack output) {
|
||||
this.weight = weight;
|
||||
this.input = input;
|
||||
//this.weight = weight;
|
||||
this.output = output;
|
||||
this.id = id;
|
||||
}
|
||||
|
||||
public Weight getWeight() {
|
||||
|
@ -77,11 +70,6 @@ public class MiningLensRecipe implements Recipe<Container>, WeightedEntry {
|
|||
return output;
|
||||
}
|
||||
|
||||
@Override
|
||||
public ResourceLocation getId() {
|
||||
return id;
|
||||
}
|
||||
|
||||
@Override
|
||||
public RecipeSerializer<?> getSerializer() {
|
||||
return ActuallyRecipes.MINING_LENS_RECIPE.get();
|
||||
|
@ -93,23 +81,38 @@ public class MiningLensRecipe implements Recipe<Container>, WeightedEntry {
|
|||
}
|
||||
|
||||
public static class Serializer implements RecipeSerializer<MiningLensRecipe> {
|
||||
@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"));
|
||||
private static final Codec<MiningLensRecipe> CODEC = RecordCodecBuilder.create(
|
||||
instance -> instance.group(
|
||||
Ingredient.CODEC_NONEMPTY.fieldOf("ingredient").forGetter(recipe -> recipe.input),
|
||||
Codec.INT.fieldOf("weight").forGetter(recipe -> recipe.weight),
|
||||
ItemStack.RESULT_CODEC.fieldOf("result").forGetter(recipe -> recipe.output)
|
||||
)
|
||||
.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
|
||||
@Override
|
||||
public MiningLensRecipe fromNetwork(@Nonnull ResourceLocation pRecipeId, @Nonnull FriendlyByteBuf pBuffer) {
|
||||
public MiningLensRecipe fromNetwork(@Nonnull FriendlyByteBuf pBuffer) {
|
||||
Ingredient ingredient = Ingredient.fromNetwork(pBuffer);
|
||||
int weight = pBuffer.readInt();
|
||||
ItemStack result = pBuffer.readItem();
|
||||
return new MiningLensRecipe(pRecipeId, ingredient, weight, result);
|
||||
return new MiningLensRecipe(ingredient, weight, result);
|
||||
}
|
||||
|
||||
@Override
|
||||
|
@ -119,51 +122,4 @@ public class MiningLensRecipe implements Recipe<Container>, WeightedEntry {
|
|||
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;
|
||||
|
||||
import com.google.gson.JsonObject;
|
||||
import com.google.gson.JsonParseException;
|
||||
import com.mojang.serialization.Codec;
|
||||
import com.mojang.serialization.codecs.RecordCodecBuilder;
|
||||
import net.minecraft.core.RegistryAccess;
|
||||
import net.minecraft.data.recipes.FinishedRecipe;
|
||||
import net.minecraft.network.FriendlyByteBuf;
|
||||
import net.minecraft.resources.ResourceLocation;
|
||||
import net.minecraft.util.GsonHelper;
|
||||
import net.minecraft.world.Container;
|
||||
import net.minecraft.world.item.ItemStack;
|
||||
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.RecipeType;
|
||||
import net.minecraft.world.level.Level;
|
||||
import net.minecraft.world.level.material.Fluid;
|
||||
import net.minecraftforge.fluids.FluidStack;
|
||||
import net.minecraftforge.registries.ForgeRegistries;
|
||||
import net.neoforged.neoforge.fluids.FluidStack;
|
||||
|
||||
import javax.annotation.Nonnull;
|
||||
import javax.annotation.Nullable;
|
||||
|
||||
public class PressingRecipe implements Recipe<Container> {
|
||||
public static final String NAME = "pressing";
|
||||
private final ResourceLocation ID;
|
||||
private final Ingredient input;
|
||||
private final FluidStack output;
|
||||
|
||||
public PressingRecipe(ResourceLocation ID, Ingredient input, FluidStack output) {
|
||||
this.ID = ID;
|
||||
public PressingRecipe(Ingredient input, FluidStack output) {
|
||||
this.input = input;
|
||||
this.output = output;
|
||||
}
|
||||
|
@ -62,11 +55,6 @@ public class PressingRecipe implements Recipe<Container> {
|
|||
return ItemStack.EMPTY;
|
||||
}
|
||||
|
||||
@Override
|
||||
public ResourceLocation getId() {
|
||||
return ID;
|
||||
}
|
||||
|
||||
@Override
|
||||
public RecipeSerializer<?> getSerializer() {
|
||||
return ActuallyRecipes.PRESSING_RECIPE.get();
|
||||
|
@ -78,82 +66,47 @@ public class PressingRecipe implements Recipe<Container> {
|
|||
}
|
||||
|
||||
public static class Serializer implements RecipeSerializer<PressingRecipe> {
|
||||
@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 = ForgeRegistries.FLUIDS.getValue(fluidRes);
|
||||
if(fluid == null)
|
||||
throw new JsonParseException("Unknown fluid '" + fluidRes + "'");
|
||||
FluidStack output = new FluidStack(fluid, fluidAmount);
|
||||
private static final Codec<PressingRecipe> CODEC = RecordCodecBuilder.create(
|
||||
instance -> instance.group(
|
||||
Ingredient.CODEC_NONEMPTY.fieldOf("ingredient").forGetter(recipe -> recipe.input),
|
||||
FluidStack.CODEC.fieldOf("fluid").forGetter(recipe -> recipe.output)
|
||||
)
|
||||
.apply(instance, PressingRecipe::new)
|
||||
);
|
||||
|
||||
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
|
||||
@Override
|
||||
public PressingRecipe fromNetwork(@Nonnull ResourceLocation pRecipeId, @Nonnull FriendlyByteBuf pBuffer) {
|
||||
public PressingRecipe fromNetwork(@Nonnull FriendlyByteBuf pBuffer) {
|
||||
Ingredient ingredient = Ingredient.fromNetwork(pBuffer);
|
||||
ResourceLocation fluidRes = new ResourceLocation(pBuffer.readUtf());
|
||||
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);
|
||||
FluidStack output = FluidStack.readFromPacket(pBuffer);
|
||||
|
||||
return new PressingRecipe(pRecipeId, ingredient, output);
|
||||
return new PressingRecipe(ingredient, output);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void toNetwork(@Nonnull FriendlyByteBuf pBuffer, @Nonnull PressingRecipe pRecipe) {
|
||||
pRecipe.input.toNetwork(pBuffer);
|
||||
pBuffer.writeUtf(ForgeRegistries.FLUIDS.getKey(pRecipe.output.getFluid()).toString());
|
||||
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;
|
||||
pRecipe.output.writeToPacket(pBuffer);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -1,10 +1,9 @@
|
|||
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.data.recipes.FinishedRecipe;
|
||||
import net.minecraft.network.FriendlyByteBuf;
|
||||
import net.minecraft.resources.ResourceLocation;
|
||||
import net.minecraft.world.item.ItemStack;
|
||||
import net.minecraft.world.item.crafting.Ingredient;
|
||||
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.level.Level;
|
||||
|
||||
import javax.annotation.Nullable;
|
||||
|
||||
public class SolidFuelRecipe implements Recipe<SingleItem> {
|
||||
public static String NAME = "solid_fuel";
|
||||
private Ingredient itemIngredient;
|
||||
private int burnTime;
|
||||
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.burnTime = burnTime;
|
||||
this.totalEnergy = totalEnergy;
|
||||
this.id = id;
|
||||
}
|
||||
|
||||
public int getBurnTime() {
|
||||
|
@ -65,11 +60,6 @@ public class SolidFuelRecipe implements Recipe<SingleItem> {
|
|||
return ItemStack.EMPTY;
|
||||
}
|
||||
|
||||
@Override
|
||||
public ResourceLocation getId() {
|
||||
return id;
|
||||
}
|
||||
|
||||
@Override
|
||||
public RecipeSerializer<?> getSerializer() {
|
||||
return ActuallyRecipes.SOLID_FUEL_RECIPE.get();
|
||||
|
@ -81,20 +71,35 @@ public class SolidFuelRecipe implements Recipe<SingleItem> {
|
|||
}
|
||||
|
||||
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
|
||||
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);
|
||||
public Codec<SolidFuelRecipe> codec() {
|
||||
return CODEC;
|
||||
}
|
||||
|
||||
@Override
|
||||
public SolidFuelRecipe fromNetwork(ResourceLocation pId, FriendlyByteBuf pBuffer) {
|
||||
public SolidFuelRecipe fromNetwork(FriendlyByteBuf pBuffer) {
|
||||
Ingredient itemIngredient = Ingredient.fromNetwork(pBuffer);
|
||||
int totalEnergy = pBuffer.readInt();
|
||||
int burnTime = pBuffer.readInt();
|
||||
return new SolidFuelRecipe(pId, itemIngredient, totalEnergy, burnTime);
|
||||
return new SolidFuelRecipe(itemIngredient, totalEnergy, burnTime);
|
||||
}
|
||||
|
||||
@Override
|
||||
|
@ -104,47 +109,4 @@ public class SolidFuelRecipe implements Recipe<SingleItem> {
|
|||
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;
|
||||
|
||||
import com.google.gson.JsonElement;
|
||||
import com.google.gson.JsonObject;
|
||||
import de.ellpeck.actuallyadditions.mod.ActuallyAdditions;
|
||||
import net.minecraft.network.FriendlyByteBuf;
|
||||
import net.minecraft.resources.ResourceLocation;
|
||||
import net.minecraft.tags.TagKey;
|
||||
import net.minecraft.world.item.ItemStack;
|
||||
import net.minecraft.world.item.crafting.Ingredient;
|
||||
import net.minecraft.world.level.ItemLike;
|
||||
import net.minecraftforge.common.crafting.IIngredientSerializer;
|
||||
|
||||
import javax.annotation.Nonnull;
|
||||
import java.util.stream.Stream;
|
||||
|
||||
public class TargetNBTIngredient extends Ingredient {
|
||||
public TargetNBTIngredient(Stream<? extends Value> itemLists) {
|
||||
super(itemLists);
|
||||
}
|
||||
|
||||
@Override
|
||||
@Nonnull
|
||||
public IIngredientSerializer<? extends Ingredient> getSerializer() {
|
||||
return SERIALIZER;
|
||||
}
|
||||
|
||||
public static TargetNBTIngredient of(ItemLike itemProvider) {
|
||||
return new TargetNBTIngredient(Stream.of(new ItemValue(new ItemStack(itemProvider))));
|
||||
}
|
||||
public static TargetNBTIngredient of(ItemStack itemStack) {
|
||||
return new TargetNBTIngredient(Stream.of(new ItemValue(itemStack)));
|
||||
}
|
||||
@Nonnull
|
||||
public static TargetNBTIngredient of(@Nonnull TagKey tag) {
|
||||
return new TargetNBTIngredient(Stream.of(new TagValue(tag)));
|
||||
}
|
||||
|
||||
|
||||
|
||||
@Override
|
||||
@Nonnull
|
||||
public JsonElement toJson() {
|
||||
JsonObject tmp = super.toJson().getAsJsonObject();
|
||||
tmp.addProperty("type", Serializer.NAME.toString());
|
||||
return tmp;
|
||||
}
|
||||
|
||||
|
||||
public static Serializer SERIALIZER = new Serializer();
|
||||
public static class Serializer implements IIngredientSerializer<TargetNBTIngredient> {
|
||||
public static ResourceLocation NAME = new ResourceLocation(ActuallyAdditions.MODID, "nbt_target");
|
||||
|
||||
@Override
|
||||
@Nonnull
|
||||
public TargetNBTIngredient parse(FriendlyByteBuf buffer) {
|
||||
return new TargetNBTIngredient(Stream.generate(() -> new ItemValue(buffer.readItem())).limit(buffer.readVarInt()));
|
||||
}
|
||||
|
||||
@Override
|
||||
@Nonnull
|
||||
public TargetNBTIngredient parse(@Nonnull JsonObject json) {
|
||||
return new TargetNBTIngredient(Stream.of(Ingredient.valueFromJson(json)));
|
||||
}
|
||||
|
||||
@Override
|
||||
public void write(FriendlyByteBuf buffer, TargetNBTIngredient ingredient) {
|
||||
ItemStack[] items = ingredient.getItems();
|
||||
buffer.writeVarInt(items.length);
|
||||
|
||||
for (ItemStack stack : items)
|
||||
buffer.writeItem(stack);
|
||||
}
|
||||
}
|
||||
}
|
||||
//package de.ellpeck.actuallyadditions.mod.crafting;
|
||||
//
|
||||
//import com.google.gson.JsonElement;
|
||||
//import com.google.gson.JsonObject;
|
||||
//import de.ellpeck.actuallyadditions.mod.ActuallyAdditions;
|
||||
//import net.minecraft.network.FriendlyByteBuf;
|
||||
//import net.minecraft.resources.ResourceLocation;
|
||||
//import net.minecraft.tags.TagKey;
|
||||
//import net.minecraft.world.item.ItemStack;
|
||||
//import net.minecraft.world.item.crafting.Ingredient;
|
||||
//import net.minecraft.world.level.ItemLike;
|
||||
//import net.neoforged.neoforge.common.crafting.IIngredientSerializer;
|
||||
//
|
||||
//import javax.annotation.Nonnull;
|
||||
//import java.util.stream.Stream;
|
||||
//
|
||||
//public class TargetNBTIngredient extends Ingredient { TODO: FLANKS PLEASE :D
|
||||
// public TargetNBTIngredient(Stream<? extends Value> itemLists) {
|
||||
// super(itemLists);
|
||||
// }
|
||||
//
|
||||
// @Override
|
||||
// @Nonnull
|
||||
// public IIngredientSerializer<? extends Ingredient> getSerializer() {
|
||||
// return SERIALIZER;
|
||||
// }
|
||||
//
|
||||
// public static TargetNBTIngredient of(ItemLike itemProvider) {
|
||||
// return new TargetNBTIngredient(Stream.of(new ItemValue(new ItemStack(itemProvider))));
|
||||
// }
|
||||
// public static TargetNBTIngredient of(ItemStack itemStack) {
|
||||
// return new TargetNBTIngredient(Stream.of(new ItemValue(itemStack)));
|
||||
// }
|
||||
// @Nonnull
|
||||
// public static TargetNBTIngredient of(@Nonnull TagKey tag) {
|
||||
// return new TargetNBTIngredient(Stream.of(new TagValue(tag)));
|
||||
// }
|
||||
//
|
||||
//
|
||||
//
|
||||
// @Override
|
||||
// @Nonnull
|
||||
// public JsonElement toJson() {
|
||||
// JsonObject tmp = super.toJson().getAsJsonObject();
|
||||
// tmp.addProperty("type", Serializer.NAME.toString());
|
||||
// return tmp;
|
||||
// }
|
||||
//
|
||||
//
|
||||
// public static Serializer SERIALIZER = new Serializer();
|
||||
// public static class Serializer implements IIngredientSerializer<TargetNBTIngredient> {
|
||||
// public static ResourceLocation NAME = new ResourceLocation(ActuallyAdditions.MODID, "nbt_target");
|
||||
//
|
||||
// @Override
|
||||
// @Nonnull
|
||||
// public TargetNBTIngredient parse(FriendlyByteBuf buffer) {
|
||||
// return new TargetNBTIngredient(Stream.generate(() -> new ItemValue(buffer.readItem())).limit(buffer.readVarInt()));
|
||||
// }
|
||||
//
|
||||
// @Override
|
||||
// @Nonnull
|
||||
// public TargetNBTIngredient parse(@Nonnull JsonObject json) {
|
||||
// return new TargetNBTIngredient(Stream.of(Ingredient.valueFromJson(json)));
|
||||
// }
|
||||
//
|
||||
// @Override
|
||||
// public void write(FriendlyByteBuf buffer, TargetNBTIngredient ingredient) {
|
||||
// ItemStack[] items = ingredient.getItems();
|
||||
// buffer.writeVarInt(items.length);
|
||||
//
|
||||
// for (ItemStack stack : items)
|
||||
// buffer.writeItem(stack);
|
||||
// }
|
||||
// }
|
||||
//}
|
||||
|
|
|
@ -4,7 +4,7 @@ import com.google.gson.JsonObject;
|
|||
import net.minecraft.data.recipes.FinishedRecipe;
|
||||
import net.minecraft.resources.ResourceLocation;
|
||||
import net.minecraft.world.item.crafting.RecipeSerializer;
|
||||
import net.minecraftforge.registries.ForgeRegistries;
|
||||
import net.neoforged.neoforge.registries.BuiltInRegistries;
|
||||
|
||||
import javax.annotation.Nullable;
|
||||
import java.util.function.Consumer;
|
||||
|
@ -36,9 +36,9 @@ public class WrappedRecipe implements FinishedRecipe {
|
|||
JsonObject jsonObject = new JsonObject();
|
||||
|
||||
if (serializerOverride != null)
|
||||
jsonObject.addProperty("type", ForgeRegistries.RECIPE_SERIALIZERS.getKey(serializerOverride).toString());
|
||||
jsonObject.addProperty("type", BuiltInRegistries.RECIPE_SERIALIZERS.getKey(serializerOverride).toString());
|
||||
else
|
||||
jsonObject.addProperty("type", ForgeRegistries.RECIPE_SERIALIZERS.getKey(inner.getType()).toString());
|
||||
jsonObject.addProperty("type", BuiltInRegistries.RECIPE_SERIALIZERS.getKey(inner.getType()).toString());
|
||||
serializeRecipeData(jsonObject);
|
||||
return jsonObject;
|
||||
}
|
||||
|
|
|
@ -13,8 +13,6 @@ package de.ellpeck.actuallyadditions.mod.entity;
|
|||
import de.ellpeck.actuallyadditions.mod.config.CommonConfig;
|
||||
import net.minecraft.core.BlockPos;
|
||||
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.world.entity.Entity;
|
||||
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.state.BlockState;
|
||||
import net.minecraft.world.phys.AABB;
|
||||
import net.minecraftforge.common.FarmlandWaterManager;
|
||||
import net.minecraftforge.common.IPlantable;
|
||||
import net.minecraftforge.common.ticket.AABBTicket;
|
||||
import net.minecraftforge.network.NetworkHooks;
|
||||
import net.neoforged.neoforge.common.FarmlandWaterManager;
|
||||
import net.neoforged.neoforge.common.IPlantable;
|
||||
import net.neoforged.neoforge.common.ticket.AABBTicket;
|
||||
|
||||
public class EntityWorm extends Entity {
|
||||
|
||||
|
@ -164,9 +161,4 @@ public class EntityWorm extends Entity {
|
|||
protected void addAdditionalSaveData(CompoundTag compound) {
|
||||
compound.putInt("Timer", this.timer);
|
||||
}
|
||||
|
||||
@Override
|
||||
public Packet<ClientGamePacketListener> getAddEntityPacket() {
|
||||
return NetworkHooks.getEntitySpawningPacket(this);
|
||||
}
|
||||
}
|
||||
|
|
|
@ -11,8 +11,8 @@
|
|||
package de.ellpeck.actuallyadditions.mod.entity;
|
||||
|
||||
import de.ellpeck.actuallyadditions.mod.ActuallyAdditions;
|
||||
import net.minecraftforge.api.distmarker.Dist;
|
||||
import net.minecraftforge.api.distmarker.OnlyIn;
|
||||
import net.neoforged.api.distmarker.Dist;
|
||||
import net.neoforged.api.distmarker.OnlyIn;
|
||||
|
||||
|
||||
public final class InitEntities {
|
||||
|
|
|
@ -24,8 +24,8 @@ import net.minecraft.resources.ResourceLocation;
|
|||
import net.minecraft.world.inventory.InventoryMenu;
|
||||
import net.minecraft.world.item.ItemDisplayContext;
|
||||
import net.minecraft.world.item.ItemStack;
|
||||
import net.minecraftforge.api.distmarker.Dist;
|
||||
import net.minecraftforge.api.distmarker.OnlyIn;
|
||||
import net.neoforged.api.distmarker.Dist;
|
||||
import net.neoforged.api.distmarker.OnlyIn;
|
||||
|
||||
|
||||
@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.phys.BlockHitResult;
|
||||
import net.minecraft.world.phys.HitResult;
|
||||
import net.minecraftforge.api.distmarker.Dist;
|
||||
import net.minecraftforge.api.distmarker.OnlyIn;
|
||||
import net.minecraftforge.client.event.RenderGuiOverlayEvent;
|
||||
import net.minecraftforge.client.gui.overlay.GuiOverlayManager;
|
||||
import net.minecraftforge.event.TickEvent;
|
||||
import net.minecraftforge.event.entity.player.ItemTooltipEvent;
|
||||
import net.minecraftforge.eventbus.api.SubscribeEvent;
|
||||
import net.neoforged.api.distmarker.Dist;
|
||||
import net.neoforged.api.distmarker.OnlyIn;
|
||||
import net.neoforged.bus.api.SubscribeEvent;
|
||||
import net.neoforged.neoforge.client.event.RenderGuiOverlayEvent;
|
||||
import net.neoforged.neoforge.client.gui.overlay.GuiOverlayManager;
|
||||
import net.neoforged.neoforge.event.TickEvent;
|
||||
import net.neoforged.neoforge.event.entity.player.ItemTooltipEvent;
|
||||
|
||||
@OnlyIn(Dist.CLIENT)
|
||||
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.ItemUtil;
|
||||
import de.ellpeck.actuallyadditions.mod.util.StackUtil;
|
||||
import net.minecraft.core.registries.BuiltInRegistries;
|
||||
import net.minecraft.server.level.ServerPlayer;
|
||||
import net.minecraft.world.entity.item.ItemEntity;
|
||||
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.level.block.Blocks;
|
||||
import net.minecraft.world.level.block.state.BlockState;
|
||||
import net.minecraftforge.event.entity.living.LivingDropsEvent;
|
||||
import net.minecraftforge.event.entity.player.EntityItemPickupEvent;
|
||||
import net.minecraftforge.event.entity.player.PlayerEvent;
|
||||
import net.minecraftforge.event.level.BlockEvent;
|
||||
import net.minecraftforge.eventbus.api.Event;
|
||||
import net.minecraftforge.eventbus.api.SubscribeEvent;
|
||||
import net.minecraftforge.registries.ForgeRegistries;
|
||||
import net.neoforged.bus.api.Event;
|
||||
import net.neoforged.bus.api.SubscribeEvent;
|
||||
import net.neoforged.neoforge.event.entity.living.LivingDropsEvent;
|
||||
import net.neoforged.neoforge.event.entity.player.EntityItemPickupEvent;
|
||||
import net.neoforged.neoforge.event.entity.player.PlayerEvent;
|
||||
import net.neoforged.neoforge.event.level.BlockEvent;
|
||||
|
||||
import java.util.Locale;
|
||||
|
||||
|
@ -168,7 +168,7 @@ public class CommonEvents {
|
|||
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()) {
|
||||
|
||||
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)) {
|
||||
PlayerData.PlayerSave save = PlayerData.getDataFromPlayer(event.getEntity());
|
||||
if (save != null && !save.bookGottenAlready) {
|
||||
|
|
|
@ -1,7 +1,7 @@
|
|||
package de.ellpeck.actuallyadditions.mod.fluids;
|
||||
|
||||
import net.minecraftforge.fluids.FluidStack;
|
||||
import net.minecraftforge.fluids.capability.templates.FluidTank;
|
||||
import net.neoforged.neoforge.fluids.FluidStack;
|
||||
import net.neoforged.neoforge.fluids.capability.templates.FluidTank;
|
||||
|
||||
import javax.annotation.Nonnull;
|
||||
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.Fluid;
|
||||
import net.minecraft.world.level.pathfinder.BlockPathTypes;
|
||||
import net.minecraftforge.client.extensions.common.IClientFluidTypeExtensions;
|
||||
import net.minecraftforge.common.SoundActions;
|
||||
import net.minecraftforge.fluids.FluidType;
|
||||
import net.minecraftforge.fluids.ForgeFlowingFluid;
|
||||
import net.minecraftforge.registries.RegistryObject;
|
||||
import net.neoforged.neoforge.client.extensions.common.IClientFluidTypeExtensions;
|
||||
import net.neoforged.neoforge.common.SoundActions;
|
||||
import net.neoforged.neoforge.fluids.BaseFlowingFluid;
|
||||
import net.neoforged.neoforge.fluids.FluidType;
|
||||
import net.neoforged.neoforge.registries.DeferredItem;
|
||||
|
||||
import java.util.function.Consumer;
|
||||
import java.util.function.Supplier;
|
||||
|
@ -38,19 +38,19 @@ public class FluidAA implements Supplier<Fluid> {
|
|||
private String name;
|
||||
private final ResourceLocation stillTexture;
|
||||
private final ResourceLocation flowingTexture;
|
||||
private RegistryObject<FluidType> fluidType;
|
||||
private RegistryObject<ForgeFlowingFluid> source;
|
||||
private RegistryObject<ForgeFlowingFluid> flowing;
|
||||
private RegistryObject<LiquidBlock> fluidBlock;
|
||||
private RegistryObject<Item> bucket;
|
||||
private Supplier<FluidType> fluidType;
|
||||
private Supplier<BaseFlowingFluid> source;
|
||||
private Supplier<BaseFlowingFluid> flowing;
|
||||
private Supplier<LiquidBlock> fluidBlock;
|
||||
private DeferredItem<Item> bucket;
|
||||
|
||||
public String getName() {
|
||||
return name;
|
||||
}
|
||||
|
||||
public static ForgeFlowingFluid.Properties createProperties(Supplier<FluidType> type, Supplier<ForgeFlowingFluid> still, Supplier<ForgeFlowingFluid> flowing,
|
||||
RegistryObject<Item> bucket, Supplier<LiquidBlock> block) {
|
||||
return new ForgeFlowingFluid.Properties(type, still, flowing)
|
||||
public static BaseFlowingFluid.Properties createProperties(Supplier<FluidType> type, Supplier<BaseFlowingFluid> still, Supplier<BaseFlowingFluid> flowing,
|
||||
DeferredItem<Item> bucket, Supplier<LiquidBlock> block) {
|
||||
return new BaseFlowingFluid.Properties(type, still, flowing)
|
||||
.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)));
|
||||
flowing = InitFluids.FLUIDS.register(name + "_flowing", () -> new ForgeFlowingFluid.Flowing(createProperties(fluidType, source, flowing, bucket, fluidBlock)));
|
||||
fluidBlock = ActuallyBlocks.BLOCKS.register(name, () -> new LiquidBlock(source, BlockBehaviour.Properties.copy(Blocks.WATER)));
|
||||
source = InitFluids.FLUIDS.register(name, () -> new BaseFlowingFluid.Source(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.ofFullCopy(Blocks.WATER)));
|
||||
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;
|
||||
|
||||
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.minecraftforge.eventbus.api.IEventBus;
|
||||
import net.minecraftforge.fluids.FluidType;
|
||||
import net.minecraftforge.registries.DeferredRegister;
|
||||
import net.minecraftforge.registries.ForgeRegistries;
|
||||
import net.neoforged.bus.api.IEventBus;
|
||||
import net.neoforged.neoforge.fluids.FluidType;
|
||||
import net.neoforged.neoforge.registries.DeferredRegister;
|
||||
import net.neoforged.neoforge.registries.NeoForgeRegistries;
|
||||
|
||||
public final class InitFluids {
|
||||
public static final DeferredRegister<Fluid> FLUIDS = DeferredRegister.create(ForgeRegistries.FLUIDS, ActuallyAdditions.MODID);
|
||||
public static final DeferredRegister<FluidType> FLUID_TYPES = DeferredRegister.create(ForgeRegistries.Keys.FLUID_TYPES, ActuallyAdditions.MODID);
|
||||
public static final DeferredRegister<Block> FLUID_BLOCKS = DeferredRegister.create(ForgeRegistries.BLOCKS, ActuallyAdditions.MODID);
|
||||
public static final DeferredRegister<Fluid> FLUIDS = DeferredRegister.create(BuiltInRegistries.FLUID, ActuallyAdditions.MODID);
|
||||
public static final DeferredRegister<FluidType> FLUID_TYPES = DeferredRegister.create(NeoForgeRegistries.Keys.FLUID_TYPES, 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 REFINED_CANOLA_OIL = new FluidAA("refined_canola_oil", "fluid/refined_canola_oil");
|
||||
|
|
|
@ -1,7 +1,7 @@
|
|||
package de.ellpeck.actuallyadditions.mod.fluids;
|
||||
|
||||
import net.minecraftforge.fluids.FluidStack;
|
||||
import net.minecraftforge.fluids.capability.templates.FluidTank;
|
||||
import net.neoforged.neoforge.fluids.FluidStack;
|
||||
import net.neoforged.neoforge.fluids.capability.templates.FluidTank;
|
||||
|
||||
import java.util.function.Predicate;
|
||||
|
||||
|
|
|
@ -24,18 +24,18 @@
|
|||
//
|
||||
// private final ItemStack input;
|
||||
// private final PriceInfo inputAmount;
|
||||
// private final ItemStack output;
|
||||
// private final ItemStack stack;
|
||||
// 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.inputAmount = inputAmount;
|
||||
// this.output = output;
|
||||
// this.stack = stack;
|
||||
// this.outputAmount = outputAmount;
|
||||
// }
|
||||
//
|
||||
// public BasicTradeList(PriceInfo emeraldInput, ItemStack output, PriceInfo outputAmount) {
|
||||
// this(new ItemStack(Items.EMERALD), emeraldInput, output, outputAmount);
|
||||
// public BasicTradeList(PriceInfo emeraldInput, ItemStack stack, PriceInfo outputAmount) {
|
||||
// this(new ItemStack(Items.EMERALD), emeraldInput, stack, outputAmount);
|
||||
// }
|
||||
//
|
||||
// public BasicTradeList(ItemStack input, PriceInfo inputAmount, PriceInfo emeraldOutput) {
|
||||
|
@ -46,7 +46,7 @@
|
|||
// public void addMerchantRecipe(IMerchant merchant, MerchantRecipeList recipeList, Random random) {
|
||||
// ItemStack in = this.input.copy();
|
||||
// in.setCount(this.inputAmount.getPrice(random));
|
||||
// ItemStack out = this.output.copy();
|
||||
// ItemStack out = this.stack.copy();
|
||||
// out.setCount(this.outputAmount.getPrice(random));
|
||||
// recipeList.add(new MerchantRecipe(in, out));
|
||||
// }
|
||||
|
|
|
@ -1,41 +1,42 @@
|
|||
package de.ellpeck.actuallyadditions.mod.inventory;
|
||||
|
||||
import de.ellpeck.actuallyadditions.mod.ActuallyAdditions;
|
||||
import net.minecraft.core.registries.BuiltInRegistries;
|
||||
import net.minecraft.world.inventory.MenuType;
|
||||
import net.minecraftforge.common.extensions.IForgeMenuType;
|
||||
import net.minecraftforge.registries.DeferredRegister;
|
||||
import net.minecraftforge.registries.ForgeRegistries;
|
||||
import net.minecraftforge.registries.RegistryObject;
|
||||
import net.neoforged.neoforge.common.extensions.IMenuTypeExtension;
|
||||
import net.neoforged.neoforge.registries.DeferredRegister;
|
||||
|
||||
import java.util.function.Supplier;
|
||||
|
||||
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 RegistryObject<MenuType<ContainerBioReactor>> BIO_REACTOR_CONTAINER = CONTAINERS.register("bioreactor_container", () -> IForgeMenuType.create(ContainerBioReactor::fromNetwork));
|
||||
public static final RegistryObject<MenuType<ContainerBreaker>> BREAKER_CONTAINER = CONTAINERS.register("breaker_container", () -> IForgeMenuType.create(ContainerBreaker::fromNetwork));
|
||||
public static final RegistryObject<MenuType<ContainerCanolaPress>> CANOLA_PRESS_CONTAINER = CONTAINERS.register("canola_press_container", () -> IForgeMenuType.create(ContainerCanolaPress::fromNetwork));
|
||||
public static final RegistryObject<MenuType<ContainerCoalGenerator>> COAL_GENERATOR_CONTAINER = CONTAINERS.register("coal_generator_container", () -> IForgeMenuType.create(ContainerCoalGenerator::fromNetwork));
|
||||
public static final RegistryObject<MenuType<ContainerCoffeeMachine>> COFFEE_MACHINE_CONTAINER = CONTAINERS.register("coffee_machine_container", () -> IForgeMenuType.create(ContainerCoffeeMachine::fromNetwork));
|
||||
public static final RegistryObject<MenuType<ContainerDirectionalBreaker>> DIRECTIONAL_BREAKER_CONTAINER = CONTAINERS.register("directional_breaker_container", () -> IForgeMenuType.create(ContainerDirectionalBreaker::fromNetwork));
|
||||
public static final RegistryObject<MenuType<ContainerDrill>> DRILL_CONTAINER = CONTAINERS.register("drill_container", () -> IForgeMenuType.create(ContainerDrill::fromNetwork));
|
||||
public static final RegistryObject<MenuType<ContainerDropper>> DROPPER_CONTAINER = CONTAINERS.register("dropper_container", () -> IForgeMenuType.create(ContainerDropper::fromNetwork));
|
||||
public static final RegistryObject<MenuType<ContainerEnervator>> ENERVATOR_CONTAINER = CONTAINERS.register("enervator_container", () -> IForgeMenuType.create(ContainerEnervator::fromNetwork));
|
||||
public static final RegistryObject<MenuType<ContainerEnergizer>> ENERGIZER_CONTAINER = CONTAINERS.register("energizer_container", () -> IForgeMenuType.create(ContainerEnergizer::fromNetwork));
|
||||
public static final Supplier<MenuType<SackContainer>> BAG_CONTAINER = CONTAINERS.register("bag_container", () -> IMenuTypeExtension.create(SackContainer::fromNetwork));
|
||||
public static final Supplier<MenuType<ContainerBioReactor>> BIO_REACTOR_CONTAINER = CONTAINERS.register("bioreactor_container", () -> IMenuTypeExtension.create(ContainerBioReactor::fromNetwork));
|
||||
public static final Supplier<MenuType<ContainerBreaker>> BREAKER_CONTAINER = CONTAINERS.register("breaker_container", () -> IMenuTypeExtension.create(ContainerBreaker::fromNetwork));
|
||||
public static final Supplier<MenuType<ContainerCanolaPress>> CANOLA_PRESS_CONTAINER = CONTAINERS.register("canola_press_container", () -> IMenuTypeExtension.create(ContainerCanolaPress::fromNetwork));
|
||||
public static final Supplier<MenuType<ContainerCoalGenerator>> COAL_GENERATOR_CONTAINER = CONTAINERS.register("coal_generator_container", () -> IMenuTypeExtension.create(ContainerCoalGenerator::fromNetwork));
|
||||
public static final Supplier<MenuType<ContainerCoffeeMachine>> COFFEE_MACHINE_CONTAINER = CONTAINERS.register("coffee_machine_container", () -> IMenuTypeExtension.create(ContainerCoffeeMachine::fromNetwork));
|
||||
public static final Supplier<MenuType<ContainerDirectionalBreaker>> DIRECTIONAL_BREAKER_CONTAINER = CONTAINERS.register("directional_breaker_container", () -> IMenuTypeExtension.create(ContainerDirectionalBreaker::fromNetwork));
|
||||
public static final Supplier<MenuType<ContainerDrill>> DRILL_CONTAINER = CONTAINERS.register("drill_container", () -> IMenuTypeExtension.create(ContainerDrill::fromNetwork));
|
||||
public static final Supplier<MenuType<ContainerDropper>> DROPPER_CONTAINER = CONTAINERS.register("dropper_container", () -> IMenuTypeExtension.create(ContainerDropper::fromNetwork));
|
||||
public static final Supplier<MenuType<ContainerEnervator>> ENERVATOR_CONTAINER = CONTAINERS.register("enervator_container", () -> IMenuTypeExtension.create(ContainerEnervator::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 RegistryObject<MenuType<ContainerFeeder>> FEEDER_CONTAINER = CONTAINERS.register("feeder_container", () -> IForgeMenuType.create(ContainerFeeder::fromNetwork));
|
||||
public static final RegistryObject<MenuType<ContainerFermentingBarrel>> FERMENTING_BARREL_CONTAINER = CONTAINERS.register("fermenting_barrel_container", () -> IForgeMenuType.create(ContainerFermentingBarrel::fromNetwork));
|
||||
public static final RegistryObject<MenuType<ContainerFilter>> FILTER_CONTAINER = CONTAINERS.register("filter_container", () -> IForgeMenuType.create(ContainerFilter::fromNetwork));
|
||||
public static final RegistryObject<MenuType<ContainerFireworkBox>> FIREWORK_BOX_CONTAINER = CONTAINERS.register("firework_box_container", () -> IForgeMenuType.create(ContainerFireworkBox::fromNetwork));
|
||||
public static final RegistryObject<MenuType<ContainerFluidCollector>> FLUID_COLLECTOR_CONTAINER = CONTAINERS.register("fluid_collector_container", () -> IForgeMenuType.create(ContainerFluidCollector::fromNetwork));
|
||||
public static final RegistryObject<MenuType<ContainerFurnaceDouble>> FURNACE_DOUBLE_CONTAINER = CONTAINERS.register("furnace_double_container", () -> IForgeMenuType.create(ContainerFurnaceDouble::fromNetwork));
|
||||
public static final RegistryObject<MenuType<CrusherContainer>> GRINDER_CONTAINER = CONTAINERS.register("grinder_container", () -> IForgeMenuType.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 RegistryObject<MenuType<ContainerMiner>> MINER_CONTAINER = CONTAINERS.register("miner_container", () -> IForgeMenuType.create(ContainerMiner::fromNetwork));
|
||||
public static final RegistryObject<MenuType<ContainerOilGenerator>> OIL_GENERATOR_CONTAINER = CONTAINERS.register("oil_generator_container", () -> IForgeMenuType.create(ContainerOilGenerator::fromNetwork));
|
||||
public static final RegistryObject<MenuType<ContainerPhantomPlacer>> PHANTOM_PLACER_CONTAINER = CONTAINERS.register("phantom_placer_container", () -> IForgeMenuType.create(ContainerPhantomPlacer::fromNetwork));
|
||||
public static final RegistryObject<MenuType<ContainerRangedCollector>> RANGED_COLLECTOR_CONTAINER = CONTAINERS.register("ranged_collector_container", () -> IForgeMenuType.create(ContainerRangedCollector::fromNetwork));
|
||||
public static final RegistryObject<MenuType<ContainerXPSolidifier>> XPSOLIDIFIER_CONTAINER = CONTAINERS.register("xpsolidifier_container", () -> IForgeMenuType.create(ContainerXPSolidifier::fromNetwork));
|
||||
public static final Supplier<MenuType<ContainerFarmer>> FARMER_CONTAINER = CONTAINERS.register("farmer_container", () -> IMenuTypeExtension.create(ContainerFarmer::fromNetwork));
|
||||
public static final Supplier<MenuType<ContainerFeeder>> FEEDER_CONTAINER = CONTAINERS.register("feeder_container", () -> IMenuTypeExtension.create(ContainerFeeder::fromNetwork));
|
||||
public static final Supplier<MenuType<ContainerFermentingBarrel>> FERMENTING_BARREL_CONTAINER = CONTAINERS.register("fermenting_barrel_container", () -> IMenuTypeExtension.create(ContainerFermentingBarrel::fromNetwork));
|
||||
public static final Supplier<MenuType<ContainerFilter>> FILTER_CONTAINER = CONTAINERS.register("filter_container", () -> IMenuTypeExtension.create(ContainerFilter::fromNetwork));
|
||||
public static final Supplier<MenuType<ContainerFireworkBox>> FIREWORK_BOX_CONTAINER = CONTAINERS.register("firework_box_container", () -> IMenuTypeExtension.create(ContainerFireworkBox::fromNetwork));
|
||||
public static final Supplier<MenuType<ContainerFluidCollector>> FLUID_COLLECTOR_CONTAINER = CONTAINERS.register("fluid_collector_container", () -> IMenuTypeExtension.create(ContainerFluidCollector::fromNetwork));
|
||||
public static final Supplier<MenuType<ContainerFurnaceDouble>> FURNACE_DOUBLE_CONTAINER = CONTAINERS.register("furnace_double_container", () -> IMenuTypeExtension.create(ContainerFurnaceDouble::fromNetwork));
|
||||
public static final Supplier<MenuType<CrusherContainer>> GRINDER_CONTAINER = CONTAINERS.register("grinder_container", () -> IMenuTypeExtension.create(CrusherContainer::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 Supplier<MenuType<ContainerMiner>> MINER_CONTAINER = CONTAINERS.register("miner_container", () -> IMenuTypeExtension.create(ContainerMiner::fromNetwork));
|
||||
public static final Supplier<MenuType<ContainerOilGenerator>> OIL_GENERATOR_CONTAINER = CONTAINERS.register("oil_generator_container", () -> IMenuTypeExtension.create(ContainerOilGenerator::fromNetwork));
|
||||
public static final Supplier<MenuType<ContainerPhantomPlacer>> PHANTOM_PLACER_CONTAINER = CONTAINERS.register("phantom_placer_container", () -> IMenuTypeExtension.create(ContainerPhantomPlacer::fromNetwork));
|
||||
public static final Supplier<MenuType<ContainerRangedCollector>> RANGED_COLLECTOR_CONTAINER = CONTAINERS.register("ranged_collector_container", () -> IMenuTypeExtension.create(ContainerRangedCollector::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.Slot;
|
||||
import net.minecraft.world.item.ItemStack;
|
||||
import net.minecraftforge.common.ForgeHooks;
|
||||
import net.neoforged.neoforge.common.CommonHooks;
|
||||
|
||||
import java.util.Objects;
|
||||
|
||||
|
@ -63,7 +63,7 @@ public class ContainerCoalGenerator extends AbstractContainerMenu {
|
|||
//Other Slots in Inventory excluded
|
||||
if (slot >= inventoryStart) {
|
||||
//Shift from Inventory
|
||||
if (ForgeHooks.getBurnTime(newStack, null) > 0) {
|
||||
if (CommonHooks.getBurnTime(newStack, null) > 0) {
|
||||
if (!this.moveItemStackTo(newStack, 0, 1, false)) {
|
||||
return ItemStack.EMPTY;
|
||||
}
|
||||
|
|
|
@ -23,7 +23,7 @@ import net.minecraft.world.inventory.Slot;
|
|||
import net.minecraft.world.item.ArmorItem;
|
||||
import net.minecraft.world.item.ItemStack;
|
||||
import net.minecraft.world.item.enchantment.EnchantmentHelper;
|
||||
import net.minecraftforge.common.capabilities.ForgeCapabilities;
|
||||
import net.neoforged.neoforge.capabilities.Capabilities;
|
||||
|
||||
import java.util.Objects;
|
||||
|
||||
|
@ -43,7 +43,7 @@ public class ContainerEnergizer extends AbstractContainerMenu {
|
|||
this.addSlot(new SlotItemHandlerUnconditioned(this.energizer.inv, 0, 76, 73) {
|
||||
@Override
|
||||
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));
|
||||
|
@ -110,7 +110,7 @@ public class ContainerEnergizer extends AbstractContainerMenu {
|
|||
//Other Slots in Inventory excluded
|
||||
else if (slot >= inventoryStart) {
|
||||
//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)) {
|
||||
return ItemStack.EMPTY;
|
||||
}
|
||||
|
|
|
@ -22,7 +22,7 @@ import net.minecraft.world.inventory.AbstractContainerMenu;
|
|||
import net.minecraft.world.inventory.Slot;
|
||||
import net.minecraft.world.item.ArmorItem;
|
||||
import net.minecraft.world.item.ItemStack;
|
||||
import net.minecraftforge.common.capabilities.ForgeCapabilities;
|
||||
import net.neoforged.neoforge.capabilities.Capabilities;
|
||||
|
||||
import java.util.Objects;
|
||||
|
||||
|
@ -98,7 +98,7 @@ public class ContainerEnervator extends AbstractContainerMenu {
|
|||
//Other Slots in Inventory excluded
|
||||
else if (slot >= inventoryStart) {
|
||||
//Shift from Inventory
|
||||
if (newStack.getCapability(ForgeCapabilities.ENERGY).isPresent()) {
|
||||
if (newStack.getCapability(Capabilities.EnergyStorage.ITEM) != null) {
|
||||
if (!this.moveItemStackTo(newStack, 0, 1, false)) {
|
||||
return ItemStack.EMPTY;
|
||||
}
|
||||
|
|
|
@ -22,7 +22,9 @@ import net.minecraft.world.inventory.AbstractContainerMenu;
|
|||
import net.minecraft.world.inventory.Slot;
|
||||
import net.minecraft.world.item.ItemStack;
|
||||
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.SmeltingRecipe;
|
||||
|
||||
import javax.annotation.Nonnull;
|
||||
import java.util.Objects;
|
||||
|
@ -78,12 +80,12 @@ public class ContainerFurnaceDouble extends AbstractContainerMenu {
|
|||
//Other Slots in Inventory excluded
|
||||
else if (slot >= inventoryStart) {
|
||||
// TODO: VALIDATE
|
||||
Recipe<?> irecipe = this.furnace.getLevel().getRecipeManager().getRecipeFor(RecipeType.SMELTING, new SingleItem(newStack), this.furnace.getLevel()).orElse(null);
|
||||
if (irecipe == null) {
|
||||
RecipeHolder<SmeltingRecipe> recipeHolder = this.furnace.getLevel().getRecipeManager().getRecipeFor(RecipeType.SMELTING, new SingleItem(newStack), this.furnace.getLevel()).orElse(null);
|
||||
if (recipeHolder == null) {
|
||||
return ItemStack.EMPTY;
|
||||
}
|
||||
|
||||
ItemStack recipeOutput = irecipe.getResultItem(player.level().registryAccess());
|
||||
ItemStack recipeOutput = recipeHolder.value().getResultItem(player.level().registryAccess());
|
||||
|
||||
//Shift from Inventory
|
||||
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.Slot;
|
||||
import net.minecraft.world.item.ItemStack;
|
||||
import net.minecraftforge.api.distmarker.Dist;
|
||||
import net.minecraftforge.api.distmarker.OnlyIn;
|
||||
import net.neoforged.api.distmarker.Dist;
|
||||
import net.neoforged.api.distmarker.OnlyIn;
|
||||
|
||||
import javax.annotation.Nonnull;
|
||||
import java.util.UUID;
|
||||
|
|
|
@ -8,8 +8,8 @@ import net.minecraft.client.gui.GuiGraphics;
|
|||
import net.minecraft.client.gui.components.Button;
|
||||
import net.minecraft.network.chat.Component;
|
||||
import net.minecraft.resources.ResourceLocation;
|
||||
import net.minecraftforge.api.distmarker.Dist;
|
||||
import net.minecraftforge.api.distmarker.OnlyIn;
|
||||
import net.neoforged.api.distmarker.Dist;
|
||||
import net.neoforged.api.distmarker.OnlyIn;
|
||||
|
||||
public class Buttons {
|
||||
@OnlyIn(Dist.CLIENT)
|
||||
|
|
|
@ -20,8 +20,8 @@ import net.minecraft.client.gui.components.Button;
|
|||
import net.minecraft.network.chat.Component;
|
||||
import net.minecraft.resources.ResourceLocation;
|
||||
import net.minecraft.world.entity.player.Inventory;
|
||||
import net.minecraftforge.api.distmarker.Dist;
|
||||
import net.minecraftforge.api.distmarker.OnlyIn;
|
||||
import net.neoforged.api.distmarker.Dist;
|
||||
import net.neoforged.api.distmarker.OnlyIn;
|
||||
|
||||
import javax.annotation.Nonnull;
|
||||
|
||||
|
|
|
@ -16,8 +16,8 @@ import de.ellpeck.actuallyadditions.mod.util.AssetUtil;
|
|||
import net.minecraft.client.Minecraft;
|
||||
import net.minecraft.client.gui.GuiGraphics;
|
||||
import net.minecraft.network.chat.Component;
|
||||
import net.minecraftforge.api.distmarker.Dist;
|
||||
import net.minecraftforge.api.distmarker.OnlyIn;
|
||||
import net.neoforged.api.distmarker.Dist;
|
||||
import net.neoforged.api.distmarker.OnlyIn;
|
||||
|
||||
import java.text.NumberFormat;
|
||||
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.Renderable;
|
||||
import net.minecraft.network.chat.Component;
|
||||
import net.minecraftforge.api.distmarker.Dist;
|
||||
import net.minecraftforge.api.distmarker.OnlyIn;
|
||||
import net.neoforged.api.distmarker.Dist;
|
||||
import net.neoforged.api.distmarker.OnlyIn;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
|
|
|
@ -17,12 +17,12 @@ import net.minecraft.client.gui.GuiGraphics;
|
|||
import net.minecraft.network.chat.Component;
|
||||
import net.minecraft.resources.ResourceLocation;
|
||||
import net.minecraft.world.level.material.Fluid;
|
||||
import net.minecraftforge.api.distmarker.Dist;
|
||||
import net.minecraftforge.api.distmarker.OnlyIn;
|
||||
import net.minecraftforge.client.extensions.common.IClientFluidTypeExtensions;
|
||||
import net.minecraftforge.fluids.FluidStack;
|
||||
import net.minecraftforge.fluids.IFluidTank;
|
||||
import net.minecraftforge.fluids.capability.IFluidHandler;
|
||||
import net.neoforged.api.distmarker.Dist;
|
||||
import net.neoforged.api.distmarker.OnlyIn;
|
||||
import net.neoforged.neoforge.client.extensions.common.IClientFluidTypeExtensions;
|
||||
import net.neoforged.neoforge.fluids.FluidStack;
|
||||
import net.neoforged.neoforge.fluids.IFluidTank;
|
||||
import net.neoforged.neoforge.fluids.capability.IFluidHandler;
|
||||
|
||||
import javax.annotation.Nonnull;
|
||||
import java.text.NumberFormat;
|
||||
|
|
|
@ -18,8 +18,8 @@ import net.minecraft.client.gui.GuiGraphics;
|
|||
import net.minecraft.network.chat.Component;
|
||||
import net.minecraft.resources.ResourceLocation;
|
||||
import net.minecraft.world.entity.player.Inventory;
|
||||
import net.minecraftforge.api.distmarker.Dist;
|
||||
import net.minecraftforge.api.distmarker.OnlyIn;
|
||||
import net.neoforged.api.distmarker.Dist;
|
||||
import net.neoforged.api.distmarker.OnlyIn;
|
||||
|
||||
import javax.annotation.Nonnull;
|
||||
|
||||
|
|
|
@ -18,8 +18,8 @@ import net.minecraft.client.gui.GuiGraphics;
|
|||
import net.minecraft.network.chat.Component;
|
||||
import net.minecraft.resources.ResourceLocation;
|
||||
import net.minecraft.world.entity.player.Inventory;
|
||||
import net.minecraftforge.api.distmarker.Dist;
|
||||
import net.minecraftforge.api.distmarker.OnlyIn;
|
||||
import net.neoforged.api.distmarker.Dist;
|
||||
import net.neoforged.api.distmarker.OnlyIn;
|
||||
|
||||
import javax.annotation.Nonnull;
|
||||
|
||||
|
|
|
@ -18,8 +18,8 @@ import net.minecraft.client.gui.GuiGraphics;
|
|||
import net.minecraft.network.chat.Component;
|
||||
import net.minecraft.resources.ResourceLocation;
|
||||
import net.minecraft.world.entity.player.Inventory;
|
||||
import net.minecraftforge.api.distmarker.Dist;
|
||||
import net.minecraftforge.api.distmarker.OnlyIn;
|
||||
import net.neoforged.api.distmarker.Dist;
|
||||
import net.neoforged.api.distmarker.OnlyIn;
|
||||
|
||||
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