Initial port to 1.21 (WIP)

This commit is contained in:
Mrbysco 2024-07-08 13:17:57 +02:00
parent 0ebbd811fd
commit 23815b70b3
319 changed files with 2431 additions and 2623 deletions

View file

@ -3,7 +3,7 @@ plugins {
id 'eclipse'
id 'idea'
id 'maven-publish'
id 'net.neoforged.gradle.userdev' version '7.0.134'
id 'net.neoforged.gradle.userdev' version '7.0.153'
}
def buildSuffix = System.getenv('BUILD_NUMBER') ? "-b${System.getenv('BUILD_NUMBER')}" : ""
@ -14,7 +14,7 @@ base {
archivesName = "ActuallyAdditions"
}
java.toolchain.languageVersion = JavaLanguageVersion.of(17)
java.toolchain.languageVersion = JavaLanguageVersion.of(21)
if (rootProject.file('src/main/resources/META-INF/accesstransformer.cfg').exists()) {
minecraft.accessTransformers.file rootProject.file('src/main/resources/META-INF/accesstransformer.cfg')
@ -83,12 +83,12 @@ dependencies {
runtimeOnly "mezz.jei:jei-${game_version}-neoforge:${jei_version}"
compileOnly "vazkii.patchouli:Patchouli:${patchouli_version}"
runtimeOnly "vazkii.patchouli:Patchouli:${patchouli_version}"
// runtimeOnly "vazkii.patchouli:Patchouli:${patchouli_version}"
compileOnly "xyz.brassgoggledcoders:PatchouliProvider:${patchouli_provider_version}"
runtimeOnly "xyz.brassgoggledcoders:PatchouliProvider:${patchouli_provider_version}"
// runtimeOnly "xyz.brassgoggledcoders:PatchouliProvider:${patchouli_provider_version}"
runtimeOnly "curse.maven:jade-324717:5109393"
runtimeOnly "curse.maven:mekanism-268560:5155329"
runtimeOnly "curse.maven:jade-324717:5427817"
runtimeOnly "curse.maven:mekanism-268560:5433143"
}
jar {
@ -172,6 +172,10 @@ publishing {
}
}
tasks.withType(JavaCompile).configureEach {
options.encoding = 'UTF-8' // Use the UTF-8 charset for Java compilation
// IDEA no longer automatically downloads sources/javadoc jars for dependencies, so we need to explicitly enable the behavior.
idea {
module {
downloadSources = true
downloadJavadoc = true
}
}

View file

@ -5,19 +5,20 @@ org.gradle.daemon=false
mod_version=1.2.14
# Forge
game_version=1.20.4
neo_version=20.4.232
game_version=1.21
neo_version=21.0.76-beta
# mods.toml
loader=2
neo_version_range=[20.4.212,)
minecraft_version_range=[1.20.4,1.21)
loader=4
neo_version_range=[21.0.75-beta,)
minecraft_version_range=[1.21,1.22)
# Parchment (Mappings)
neogradle.subsystems.parchment.minecraftVersion=1.20.4
neogradle.subsystems.parchment.mappingsVersion=2024.04.14
neogradle.subsystems.parchment.minecraftVersion=1.21
neogradle.subsystems.parchment.mappingsVersion=2024.06.23
neogradle.subsystems.conventions.runs.create-default-run-per-type=false
# Other mods
jei_version=17.3.0.49
jei_version=19.3.1.23
patchouli_version=1.20.4-85-NEOFORGE
patchouli_provider_version=1.20.4-1.0.10-Snapshot.7

View file

@ -1,6 +1,6 @@
distributionBase=GRADLE_USER_HOME
distributionPath=wrapper/dists
distributionUrl=https\://services.gradle.org/distributions/gradle-8.7-bin.zip
distributionUrl=https\://services.gradle.org/distributions/gradle-8.8-bin.zip
networkTimeout=10000
validateDistributionUrl=true
zipStoreBase=GRADLE_USER_HOME

2
gradlew vendored
View file

@ -55,7 +55,7 @@
# Darwin, MinGW, and NonStop.
#
# (3) This script is generated from the Groovy template
# https://github.com/gradle/gradle/blob/HEAD/subprojects/plugins/src/main/resources/org/gradle/api/internal/plugins/unixStartScript.txt
# https://github.com/gradle/gradle/blob/HEAD/platforms/jvm/plugins-application/src/main/resources/org/gradle/api/internal/plugins/unixStartScript.txt
# within the Gradle project.
#
# You can find Gradle at https://github.com/gradle/gradle/.

View file

@ -152,7 +152,7 @@ public final class ActuallyAdditionsAPI {
* @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) {
ResourceLocation id = new ResourceLocation(ActuallyAdditions.MODID, BuiltInRegistries.ITEM.getKey(input.getItem()).getPath() + "_crushing");
ResourceLocation id = ActuallyAdditions.modLoc(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)));
@ -167,7 +167,7 @@ public final class ActuallyAdditionsAPI {
* @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) {
ResourceLocation id = new ResourceLocation(ActuallyAdditions.MODID, BuiltInRegistries.ITEM.getKey(input.getItems()[0].getItem()).getPath() + "_crushing");
ResourceLocation id = ActuallyAdditions.modLoc(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)));

View file

@ -24,23 +24,23 @@ public final class ActuallyTags {
public static final TagKey<Item> DRILLS = tag("drills");
public static final TagKey<Item> COFFEE_BEANS = tag("coffee_beans");
public static final TagKey<Item> TINY_COALS = tag("tiny_coals");
public static final TagKey<Item> HOLDS_ITEMS = ItemTags.create(new ResourceLocation("forge", "holds_items"));
public static final TagKey<Item> HOLDS_ITEMS = ItemTags.create(ResourceLocation.fromNamespaceAndPath("c", "holds_items"));
public static final TagKey<Item> CRYSTALS = tag("crystals");
public static final TagKey<Item> CRYSTAL_BLOCKS = tag("crystal_blocks");
public static final TagKey<Item> SEEDS_RICE = ItemTags.create(new ResourceLocation("forge", "seeds/rice"));
public static final TagKey<Item> SEEDS_COFFEE = ItemTags.create(new ResourceLocation("forge", "seeds/coffee"));
public static final TagKey<Item> SEEDS_CANOLA = ItemTags.create(new ResourceLocation("forge", "seeds/canola"));
public static final TagKey<Item> SEEDS_FLAX = ItemTags.create(new ResourceLocation("forge", "seeds/flax"));
public static final TagKey<Item> CROPS_RICE = ItemTags.create(new ResourceLocation("forge", "crops/rice"));
public static final TagKey<Item> CROPS_COFFEE = ItemTags.create(new ResourceLocation("forge", "crops/coffee"));
public static final TagKey<Item> CROPS_CANOLA = ItemTags.create(new ResourceLocation("forge", "crops/canola"));
public static final TagKey<Item> CROPS_FLAX = ItemTags.create(new ResourceLocation("forge", "crops/flax"));
public static final TagKey<Item> GEMS_BLACK_QUARTZ = ItemTags.create(new ResourceLocation("forge", "gems/black_quartz"));
public static final TagKey<Item> ORES_BLACK_QUARTZ = ItemTags.create(new ResourceLocation("forge", "ores/black_quartz"));
public static final TagKey<Item> STORAGE_BLOCKS_BLACK_QUARTZ = ItemTags.create(new ResourceLocation("forge", "storage_blocks/black_quartz"));
public static final TagKey<Item> SEEDS_RICE = ItemTags.create(ResourceLocation.fromNamespaceAndPath("c", "seeds/rice"));
public static final TagKey<Item> SEEDS_COFFEE = ItemTags.create(ResourceLocation.fromNamespaceAndPath("c", "seeds/coffee"));
public static final TagKey<Item> SEEDS_CANOLA = ItemTags.create(ResourceLocation.fromNamespaceAndPath("c", "seeds/canola"));
public static final TagKey<Item> SEEDS_FLAX = ItemTags.create(ResourceLocation.fromNamespaceAndPath("c", "seeds/flax"));
public static final TagKey<Item> CROPS_RICE = ItemTags.create(ResourceLocation.fromNamespaceAndPath("c", "crops/rice"));
public static final TagKey<Item> CROPS_COFFEE = ItemTags.create(ResourceLocation.fromNamespaceAndPath("c", "crops/coffee"));
public static final TagKey<Item> CROPS_CANOLA = ItemTags.create(ResourceLocation.fromNamespaceAndPath("c", "crops/canola"));
public static final TagKey<Item> CROPS_FLAX = ItemTags.create(ResourceLocation.fromNamespaceAndPath("c", "crops/flax"));
public static final TagKey<Item> GEMS_BLACK_QUARTZ = ItemTags.create(ResourceLocation.fromNamespaceAndPath("c", "gems/black_quartz"));
public static final TagKey<Item> ORES_BLACK_QUARTZ = ItemTags.create(ResourceLocation.fromNamespaceAndPath("c", "ores/black_quartz"));
public static final TagKey<Item> STORAGE_BLOCKS_BLACK_QUARTZ = ItemTags.create(ResourceLocation.fromNamespaceAndPath("c", "storage_blocks/black_quartz"));
private static TagKey<Item> tag(String name) {
return TagKey.create(Registries.ITEM, new ResourceLocation(ActuallyAdditions.MODID, name));
return TagKey.create(Registries.ITEM, ActuallyAdditions.modLoc(name));
}
}
@ -58,12 +58,12 @@ public final class ActuallyTags {
public static final TagKey<Block> NEEDS_VOID_TOOL = tag("needs_void_tool");
public static final TagKey<Block> NEEDS_EMERADIC_TOOL = tag("needs_emeradic_tool");
public static final TagKey<Block> NEEDS_ENORI_TOOL = tag("needs_enori_tool");
public static final TagKey<Block> ORES_BLACK_QUARTZ = BlockTags.create(new ResourceLocation("forge", "ores/black_quartz"));
public static final TagKey<Block> STORAGE_BLOCKS_BLACK_QUARTZ = BlockTags.create(new ResourceLocation("forge", "storage_blocks/black_quartz"));
public static final TagKey<Block> ORES_BLACK_QUARTZ = BlockTags.create(ResourceLocation.fromNamespaceAndPath("c", "ores/black_quartz"));
public static final TagKey<Block> STORAGE_BLOCKS_BLACK_QUARTZ = BlockTags.create(ResourceLocation.fromNamespaceAndPath("c", "storage_blocks/black_quartz"));
private static TagKey<Block> tag(String name) {
return TagKey.create(Registries.BLOCK, new ResourceLocation(ActuallyAdditions.MODID, name));
return TagKey.create(Registries.BLOCK, ActuallyAdditions.modLoc(name));
}
}
@ -78,7 +78,7 @@ public final class ActuallyTags {
public static final TagKey<BannerPattern> PATTERN_BOOK = tag("pattern_item/book");
private static TagKey<BannerPattern> tag(String name) {
return TagKey.create(Registries.BANNER_PATTERN, new ResourceLocation(ActuallyAdditions.MODID, name));
return TagKey.create(Registries.BANNER_PATTERN, ActuallyAdditions.modLoc(name));
}
}
}

View file

@ -11,18 +11,16 @@
package de.ellpeck.actuallyadditions.api.booklet;
import net.minecraft.world.item.ItemStack;
import net.neoforged.api.distmarker.Dist;
import net.neoforged.api.distmarker.OnlyIn;
//TODO: We're using Patchouli API for the new booklets. Do we still need this?
public interface IBookletChapter {
IBookletPage[] getAllPages();
@OnlyIn(Dist.CLIENT)
String getLocalizedName();
@OnlyIn(Dist.CLIENT)
String getLocalizedNameWithFormatting();
IBookletEntry getEntry();

View file

@ -10,9 +10,6 @@
package de.ellpeck.actuallyadditions.api.booklet;
import net.neoforged.api.distmarker.Dist;
import net.neoforged.api.distmarker.OnlyIn;
import java.util.List;
//TODO: We're using Patchouli API for the new booklets. Do we still need this?
@ -22,19 +19,19 @@ public interface IBookletEntry {
String getIdentifier();
@OnlyIn(Dist.CLIENT)
String getLocalizedName();
@OnlyIn(Dist.CLIENT)
String getLocalizedNameWithFormatting();
void addChapter(IBookletChapter chapter);
@OnlyIn(Dist.CLIENT)
List<IBookletChapter> getChaptersForDisplay(String searchBarText);
int getSortingPriority();
@OnlyIn(Dist.CLIENT)
boolean visibleOnFrontPage();
}

View file

@ -13,8 +13,6 @@ 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.neoforged.api.distmarker.Dist;
import net.neoforged.api.distmarker.OnlyIn;
import net.neoforged.neoforge.fluids.FluidStack;
import java.util.List;
@ -30,31 +28,31 @@ public interface IBookletPage {
void setChapter(IBookletChapter chapter);
@OnlyIn(Dist.CLIENT)
String getInfoText();
@OnlyIn(Dist.CLIENT)
void mouseClicked(GuiBookletBase gui, int mouseX, int mouseY, int mouseButton);
@OnlyIn(Dist.CLIENT)
void mouseReleased(GuiBookletBase gui, int mouseX, int mouseY, int state);
@OnlyIn(Dist.CLIENT)
void mouseClickMove(GuiBookletBase gui, int mouseX, int mouseY, int clickedMouseButton, long timeSinceLastClick);
@OnlyIn(Dist.CLIENT)
void actionPerformed(GuiBookletBase gui, Button button);
@OnlyIn(Dist.CLIENT)
void init(GuiBookletBase gui, int startX, int startY);
@OnlyIn(Dist.CLIENT)
void updateScreen(GuiBookletBase gui, int startX, int startY, int pageTimer);
@OnlyIn(Dist.CLIENT)
void drawScreenPre(GuiBookletBase gui, int startX, int startY, int mouseX, int mouseY, float partialTicks);
@OnlyIn(Dist.CLIENT)
void drawScreenPost(GuiBookletBase gui, int startX, int startY, int mouseX, int mouseY, float partialTicks);
boolean shouldBeOnLeftSide();

View file

@ -1,12 +1,12 @@
package de.ellpeck.actuallyadditions.data;
import de.ellpeck.actuallyadditions.data.patchouli.PachouliGenerator;
import de.ellpeck.actuallyadditions.mod.ActuallyAdditions;
import de.ellpeck.actuallyadditions.mod.gen.ActuallyBiomeModifiers;
import de.ellpeck.actuallyadditions.mod.gen.ActuallyConfiguredFeatures;
import de.ellpeck.actuallyadditions.mod.gen.ActuallyPlacedFeatures;
import de.ellpeck.actuallyadditions.mod.gen.ActuallyProcessorLists;
import de.ellpeck.actuallyadditions.mod.misc.ActuallyDamageTypes;
import de.ellpeck.actuallyadditions.mod.misc.BannerHelper;
import net.minecraft.core.Cloner;
import net.minecraft.core.HolderLookup;
import net.minecraft.core.RegistryAccess;
@ -18,7 +18,7 @@ import net.minecraft.data.PackOutput;
import net.minecraft.data.registries.VanillaRegistries;
import net.minecraft.world.damagesource.DamageType;
import net.neoforged.bus.api.SubscribeEvent;
import net.neoforged.fml.common.Mod;
import net.neoforged.fml.common.EventBusSubscriber;
import net.neoforged.neoforge.common.data.DatapackBuiltinEntriesProvider;
import net.neoforged.neoforge.common.data.ExistingFileHelper;
import net.neoforged.neoforge.data.event.GatherDataEvent;
@ -27,7 +27,7 @@ import net.neoforged.neoforge.registries.NeoForgeRegistries;
import java.util.Set;
import java.util.concurrent.CompletableFuture;
@Mod.EventBusSubscriber(modid = ActuallyAdditions.MODID, bus = Mod.EventBusSubscriber.Bus.MOD)
@EventBusSubscriber(modid = ActuallyAdditions.MODID, bus = EventBusSubscriber.Bus.MOD)
public class ActuallyAdditionsData {
@SubscribeEvent
@ -41,9 +41,9 @@ public class ActuallyAdditionsData {
// generator.addProvider(new GeneratorLanguage(generator));
BlockTagsGenerator generatorBlockTags = new BlockTagsGenerator(packOutput, lookupProvider, helper);
generator.addProvider(true, new LootTableGenerator(packOutput));
generator.addProvider(true, new BlockRecipeGenerator(packOutput));
generator.addProvider(true, new ItemRecipeGenerator(packOutput));
generator.addProvider(true, new LootTableGenerator(packOutput, lookupProvider));
generator.addProvider(true, new BlockRecipeGenerator(packOutput, lookupProvider));
generator.addProvider(true, new ItemRecipeGenerator(packOutput, lookupProvider));
generator.addProvider(true, generatorBlockTags);
generator.addProvider(true, new ItemTagsGenerator(packOutput, lookupProvider, generatorBlockTags, helper));
generator.addProvider(true, new PoiTypeTagsGenerator(packOutput, lookupProvider, helper));
@ -54,20 +54,20 @@ public class ActuallyAdditionsData {
generator.addProvider(true, new ItemModelGenerator(packOutput, helper));
generator.addProvider(true, new AdvancementGenerator(packOutput, lookupProvider, helper));
generator.addProvider(true, new LaserRecipeGenerator(packOutput));
generator.addProvider(true, new ColorChangeGenerator(packOutput));
generator.addProvider(true, new EmpoweringRecipeGenerator(packOutput));
generator.addProvider(true, new CrushingRecipeGenerator(packOutput));
generator.addProvider(true, new FuelRecipeGenerator(packOutput));
generator.addProvider(true, new MiscMachineRecipeGenerator(packOutput));
generator.addProvider(true, new MiningLensGenerator(packOutput));
generator.addProvider(true, new CoffeeIngredientGenerator(packOutput));
generator.addProvider(true, new LaserRecipeGenerator(packOutput, lookupProvider));
generator.addProvider(true, new ColorChangeGenerator(packOutput, lookupProvider));
generator.addProvider(true, new EmpoweringRecipeGenerator(packOutput, lookupProvider));
generator.addProvider(true, new CrushingRecipeGenerator(packOutput, lookupProvider));
generator.addProvider(true, new FuelRecipeGenerator(packOutput, lookupProvider));
generator.addProvider(true, new MiscMachineRecipeGenerator(packOutput, lookupProvider));
generator.addProvider(true, new MiningLensGenerator(packOutput, lookupProvider));
generator.addProvider(true, new CoffeeIngredientGenerator(packOutput, lookupProvider));
generator.addProvider(true, new SoundsGenerator(packOutput, helper));
generator.addProvider(true, new PachouliGenerator(packOutput));
// generator.addProvider(true, new PachouliGenerator(packOutput));
generator.addProvider(true, new GlobalLootModifierGenerator(packOutput));
generator.addProvider(true, new GlobalLootModifierGenerator(packOutput, lookupProvider));
generator.addProvider(event.includeServer(), new DatapackBuiltinEntriesProvider(
packOutput, patchedProvider, Set.of(ActuallyAdditions.MODID)));
@ -81,6 +81,7 @@ public class ActuallyAdditionsData {
registryBuilder.add(Registries.CONFIGURED_FEATURE, ActuallyConfiguredFeatures::bootstrap);
registryBuilder.add(Registries.PLACED_FEATURE, ActuallyPlacedFeatures::bootstrap);
registryBuilder.add(Registries.PROCESSOR_LIST, ActuallyProcessorLists::bootstrap);
registryBuilder.add(Registries.BANNER_PATTERN, BannerHelper::bootstrap);
registryBuilder.add(NeoForgeRegistries.Keys.BIOME_MODIFIERS, ActuallyBiomeModifiers::bootstrap);
// 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, $ -> {

View file

@ -35,7 +35,7 @@ public class AdvancementGenerator extends AdvancementProvider {
.display(new DisplayInfo(ActuallyItems.ITEM_BOOKLET.get().getDefaultInstance(),
Component.translatable("achievement.actuallyadditions.openBooklet"),
Component.translatable("achievement.actuallyadditions.openBooklet.desc"),
Optional.of(new ResourceLocation("textures/gui/advancements/backgrounds/stone.png")), AdvancementType.TASK, true, true, false))
Optional.of(ResourceLocation.tryParse("textures/gui/advancements/backgrounds/stone.png")), AdvancementType.TASK, true, true, false))
.addCriterion("right_click", CriteriaTriggers.IMPOSSIBLE.createCriterion(new ImpossibleTrigger.TriggerInstance()))
.save(consumer, "actuallyadditions:root");
@ -46,7 +46,7 @@ public class AdvancementGenerator extends AdvancementProvider {
.display(new DisplayInfo(ActuallyBlocks.PHANTOM_ITEMFACE.get().asItem().getDefaultInstance(),
Component.translatable("achievement.actuallyadditions.craftPhantomface"),
Component.translatable("achievement.actuallyadditions.craftPhantomface.desc"),
Optional.of(new ResourceLocation("textures/blocks/stone.png")), AdvancementType.TASK, true, true, false))
Optional.of(ResourceLocation.tryParse("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");

View file

@ -18,9 +18,9 @@ public class BannerPatternTagsGenerator extends BannerPatternTagsProvider {
@Override
protected void addTags(HolderLookup.Provider pProvider) {
this.tag(ActuallyTags.BannerPatterns.PATTERN_DRILL).add(BannerHelper.DRILL.getKey());
this.tag(ActuallyTags.BannerPatterns.PATTERN_LEAF_BLO).add(BannerHelper.LEAF_BLO.getKey());
this.tag(ActuallyTags.BannerPatterns.PATTERN_PHAN_CON).add(BannerHelper.PHAN_CON.getKey());
this.tag(ActuallyTags.BannerPatterns.PATTERN_BOOK).add(BannerHelper.BOOK.getKey());
this.tag(ActuallyTags.BannerPatterns.PATTERN_DRILL).add(BannerHelper.DRILL);
this.tag(ActuallyTags.BannerPatterns.PATTERN_LEAF_BLO).add(BannerHelper.LEAF_BLO);
this.tag(ActuallyTags.BannerPatterns.PATTERN_PHAN_CON).add(BannerHelper.PHAN_CON);
this.tag(ActuallyTags.BannerPatterns.PATTERN_BOOK).add(BannerHelper.BOOK);
}
}

View file

@ -4,6 +4,7 @@ import de.ellpeck.actuallyadditions.api.ActuallyTags;
import de.ellpeck.actuallyadditions.mod.blocks.ActuallyBlocks;
import de.ellpeck.actuallyadditions.mod.items.ActuallyItems;
import de.ellpeck.actuallyadditions.mod.util.NoAdvRecipeOutput;
import net.minecraft.core.HolderLookup;
import net.minecraft.data.PackOutput;
import net.minecraft.data.recipes.RecipeCategory;
import net.minecraft.data.recipes.RecipeOutput;
@ -17,10 +18,11 @@ import net.neoforged.neoforge.common.Tags;
import javax.annotation.Nonnull;
import java.util.Arrays;
import java.util.concurrent.CompletableFuture;
public class BlockRecipeGenerator extends RecipeProvider {
public BlockRecipeGenerator(PackOutput packOutput) {
super(packOutput);
public BlockRecipeGenerator(PackOutput packOutput, CompletableFuture<HolderLookup.Provider> lookupProvider) {
super(packOutput, lookupProvider);
}
@Override
@ -57,7 +59,7 @@ public class BlockRecipeGenerator extends RecipeProvider {
//Fireworks Box
Recipe.shaped(ActuallyBlocks.FIREWORK_BOX.getItem())
.pattern("GFG", "SAS", "CCC")
.define('G', Tags.Items.GUNPOWDER)
.define('G', Tags.Items.GUNPOWDERS)
.define('S', Tags.Items.RODS_WOODEN)
.define('A', ActuallyBlocks.IRON_CASING.get())
.define('F', Items.FIREWORK_ROCKET)
@ -68,7 +70,7 @@ public class BlockRecipeGenerator extends RecipeProvider {
Recipe.shaped(ActuallyBlocks.SHOCK_SUPPRESSOR.getItem())
.pattern("OAO", "ACA", "OAO")
.define('A', ActuallyItems.EMPOWERED_VOID_CRYSTAL.get())
.define('O', Tags.Items.OBSIDIAN)
.define('O', Tags.Items.OBSIDIANS)
.define('C', ActuallyItems.ADVANCED_COIL.get())
.save(recipeOutput);
@ -173,7 +175,7 @@ public class BlockRecipeGenerator extends RecipeProvider {
Recipe.shaped(ActuallyBlocks.LASER_RELAY.getItem(), 4)
.pattern("OBO", "RCR", "OBO")
.define('B', Tags.Items.STORAGE_BLOCKS_REDSTONE)
.define('O', Tags.Items.OBSIDIAN)
.define('O', Tags.Items.OBSIDIANS)
.define('R', ActuallyItems.RESTONIA_CRYSTAL.get())
.define('C', ActuallyItems.ADVANCED_COIL.get())
.save(recipeOutput);
@ -247,7 +249,7 @@ public class BlockRecipeGenerator extends RecipeProvider {
//Canola Press
Recipe.shaped(ActuallyBlocks.CANOLA_PRESS.getItem())
.pattern("CEC","CXC","CAC")
.define('C', Tags.Items.COBBLESTONE)
.define('C', Tags.Items.COBBLESTONES)
.define('E', ActuallyItems.ENORI_CRYSTAL)
.define('X', ActuallyItems.CANOLA)
.define('A', ActuallyItems.ADVANCED_COIL)
@ -265,7 +267,7 @@ public class BlockRecipeGenerator extends RecipeProvider {
//Oil Generator
Recipe.shaped(ActuallyBlocks.OIL_GENERATOR.getItem())
.pattern("CIC","CAC","CIC")
.define('C', Tags.Items.COBBLESTONE)
.define('C', Tags.Items.COBBLESTONES)
.define('A', ActuallyItems.CANOLA)
.define('I', ActuallyBlocks.IRON_CASING.getItem())
.save(recipeOutput);
@ -273,7 +275,7 @@ public class BlockRecipeGenerator extends RecipeProvider {
//Coal generator.
Recipe.shaped(ActuallyBlocks.COAL_GENERATOR.getItem())
.pattern("CIC","CAC","CIC")
.define('C', Tags.Items.COBBLESTONE)
.define('C', Tags.Items.COBBLESTONES)
.define('A', Items.COAL)
.define('I', ActuallyBlocks.IRON_CASING.getItem())
.save(recipeOutput);
@ -281,7 +283,7 @@ public class BlockRecipeGenerator extends RecipeProvider {
// Auto breaker.
Recipe.shaped(ActuallyBlocks.BREAKER.getItem())
.pattern("CCC","CXV","CCC")
.define('C', Tags.Items.COBBLESTONE)
.define('C', Tags.Items.COBBLESTONES)
.define('V', ActuallyItems.VOID_CRYSTAL)
.define('X', ActuallyItems.BASIC_COIL)
.save(recipeOutput);
@ -289,7 +291,7 @@ public class BlockRecipeGenerator extends RecipeProvider {
// Auto placer.
Recipe.shaped(ActuallyBlocks.PLACER.getItem())
.pattern("CCC", "CXP", "CCC")
.define('C', Tags.Items.COBBLESTONE)
.define('C', Tags.Items.COBBLESTONES)
.define('P', ActuallyItems.PALIS_CRYSTAL)
.define('X', ActuallyItems.BASIC_COIL)
.save(recipeOutput);
@ -297,7 +299,7 @@ public class BlockRecipeGenerator extends RecipeProvider {
// Dropper
Recipe.shaped(ActuallyBlocks.DROPPER.getItem())
.pattern("CPC", "CDA", "CPC")
.define('C', Tags.Items.COBBLESTONE)
.define('C', Tags.Items.COBBLESTONES)
.define('P', ActuallyItems.PALIS_CRYSTAL)
.define('D', Items.DROPPER)
.define('A', ActuallyItems.ADVANCED_COIL)
@ -332,7 +334,7 @@ public class BlockRecipeGenerator extends RecipeProvider {
.pattern("EXC", "FIF", "CXE")
.define('E', ActuallyItems.ENORI_CRYSTAL)
.define('X', ActuallyItems.BASIC_COIL)
.define('C', Tags.Items.COBBLESTONE)
.define('C', Tags.Items.COBBLESTONES)
.define('F', Items.FURNACE)
.define('I', ActuallyBlocks.IRON_CASING.getItem())
.save(recipeOutput);
@ -340,7 +342,7 @@ public class BlockRecipeGenerator extends RecipeProvider {
// Greenhouse glass
Recipe.shaped(ActuallyBlocks.GREENHOUSE_GLASS.getItem(), 2)
.pattern("GSG", "SES", "GSG")
.define('G', Tags.Items.GLASS)
.define('G', Tags.Items.GLASS_BLOCKS)
.define('S', ItemTags.SAPLINGS)
.define('E', ActuallyItems.EMPOWERED_PALIS_CRYSTAL)
.save(recipeOutput);
@ -393,7 +395,7 @@ public class BlockRecipeGenerator extends RecipeProvider {
.pattern("RFC", "BIB", "CFR")
.define('R', ActuallyItems.RESTONIA_CRYSTAL.get())
.define('F', Items.FLINT)
.define('C', Tags.Items.COBBLESTONE)
.define('C', Tags.Items.COBBLESTONES)
.define('I', ActuallyBlocks.IRON_CASING.get())
.define('B', ActuallyItems.BASIC_COIL.get())
.save(recipeOutput);
@ -401,7 +403,7 @@ public class BlockRecipeGenerator extends RecipeProvider {
// Double Crusher
Recipe.shaped(ActuallyBlocks.CRUSHER_DOUBLE.getItem())
.pattern("SAS", "CIC", "SAS")
.define('S', Tags.Items.COBBLESTONE)
.define('S', Tags.Items.COBBLESTONES)
.define('A', ActuallyItems.ADVANCED_COIL.get())
.define('C', ActuallyBlocks.CRUSHER.get())
.define('I', ActuallyBlocks.IRON_CASING.get())

View file

@ -2,6 +2,7 @@ package de.ellpeck.actuallyadditions.data;
import de.ellpeck.actuallyadditions.mod.ActuallyAdditions;
import de.ellpeck.actuallyadditions.mod.crafting.CoffeeIngredientRecipe;
import net.minecraft.core.HolderLookup;
import net.minecraft.core.NonNullList;
import net.minecraft.data.PackOutput;
import net.minecraft.data.recipes.RecipeOutput;
@ -19,10 +20,11 @@ import net.neoforged.neoforge.common.conditions.NotCondition;
import net.neoforged.neoforge.common.conditions.TagEmptyCondition;
import javax.annotation.Nonnull;
import java.util.concurrent.CompletableFuture;
public class CoffeeIngredientGenerator extends RecipeProvider {
public CoffeeIngredientGenerator(PackOutput packOutput) {
super(packOutput);
public CoffeeIngredientGenerator(PackOutput packOutput, CompletableFuture<HolderLookup.Provider> lookupProvider) {
super(packOutput, lookupProvider);
}
@Override
@ -35,9 +37,9 @@ public class CoffeeIngredientGenerator extends RecipeProvider {
buildIngredient(recipeOutput, Items.MILK_BUCKET, 0, "jei.actuallyadditions.coffee.extra.milk");
//Pam's puts milk in a tag, so we'll use that
TagKey<Item> milkTag = ItemTags.create(new ResourceLocation("forge", "milk"));
TagKey<Item> milkTag = ItemTags.create(ResourceLocation.fromNamespaceAndPath("c", "milk"));
RecipeOutput tagOutput = recipeOutput.withConditions(new NotCondition(new TagEmptyCondition(milkTag.location())));
buildIngredient(tagOutput, new ResourceLocation(ActuallyAdditions.MODID, "coffee_ingredient/milk_tagged"),
buildIngredient(tagOutput, ActuallyAdditions.modLoc("coffee_ingredient/milk_tagged"),
Ingredient.of(milkTag), 0, "jei.actuallyadditions.coffee.extra.milk");
buildIngredient(recipeOutput, Items.SUGAR, 4, new MobEffectInstance(MobEffects.MOVEMENT_SPEED, 30, 0));
@ -54,7 +56,7 @@ public class CoffeeIngredientGenerator extends RecipeProvider {
}
private void buildIngredient(RecipeOutput recipeOutput, ItemLike ingredient, int maxAmplifier, String extraText, MobEffectInstance... effects) {
ResourceLocation id = new ResourceLocation(ActuallyAdditions.MODID, "coffee_ingredient/" + getItemName(ingredient));
ResourceLocation id = ActuallyAdditions.modLoc("coffee_ingredient/" + getItemName(ingredient));
NonNullList<CoffeeIngredientRecipe.EffectInstance> instances = NonNullList.create();
for (MobEffectInstance effect : effects) {
instances.add(new CoffeeIngredientRecipe.EffectInstance(effect));

View file

@ -4,21 +4,22 @@ import de.ellpeck.actuallyadditions.mod.ActuallyAdditions;
import de.ellpeck.actuallyadditions.mod.blocks.ActuallyBlocks;
import de.ellpeck.actuallyadditions.mod.crafting.ColorChangeRecipe;
import de.ellpeck.actuallyadditions.mod.util.NoAdvRecipeOutput;
import net.minecraft.core.HolderLookup;
import net.minecraft.core.registries.BuiltInRegistries;
import net.minecraft.data.PackOutput;
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 javax.annotation.Nonnull;
import java.util.concurrent.CompletableFuture;
public class ColorChangeGenerator extends RecipeProvider {
public ColorChangeGenerator(PackOutput packOutput) {
super(packOutput);
public ColorChangeGenerator(PackOutput packOutput, CompletableFuture<HolderLookup.Provider> lookupProvider) {
super(packOutput, lookupProvider);
}
@Override
@ -195,15 +196,15 @@ public class ColorChangeGenerator extends RecipeProvider {
private void changeColor(RecipeOutput consumer, ItemLike output, Ingredient input) {
consumer.accept(new ResourceLocation(ActuallyAdditions.MODID, "colorchange/" + BuiltInRegistries.ITEM.getKey(output.asItem()).getPath()),
consumer.accept(ActuallyAdditions.modLoc("colorchange/" + BuiltInRegistries.ITEM.getKey(output.asItem()).getPath()),
new ColorChangeRecipe(output.asItem().getDefaultInstance(), input), null);
}
private void changeColor(RecipeOutput consumer, ItemLike output, ItemLike input) {
consumer.accept(new ResourceLocation(ActuallyAdditions.MODID, "colorchange/" + BuiltInRegistries.ITEM.getKey(output.asItem()).getPath()),
consumer.accept(ActuallyAdditions.modLoc("colorchange/" + BuiltInRegistries.ITEM.getKey(output.asItem()).getPath()),
new ColorChangeRecipe(output.asItem().getDefaultInstance(), Ingredient.of(input)), null);
}
private void changeColor(RecipeOutput consumer, ItemLike output, ItemStack input) {
consumer.accept(new ResourceLocation(ActuallyAdditions.MODID, "colorchange/" + BuiltInRegistries.ITEM.getKey(output.asItem()).getPath()),
consumer.accept(ActuallyAdditions.modLoc("colorchange/" + BuiltInRegistries.ITEM.getKey(output.asItem()).getPath()),
new ColorChangeRecipe(output.asItem().getDefaultInstance(), Ingredient.of(input)), null);
}
}

View file

@ -5,6 +5,7 @@ import de.ellpeck.actuallyadditions.mod.blocks.ActuallyBlocks;
import de.ellpeck.actuallyadditions.mod.crafting.CrushingRecipe;
import de.ellpeck.actuallyadditions.mod.items.ActuallyItems;
import de.ellpeck.actuallyadditions.mod.util.NoAdvRecipeOutput;
import net.minecraft.core.HolderLookup;
import net.minecraft.core.NonNullList;
import net.minecraft.data.PackOutput;
import net.minecraft.data.recipes.RecipeOutput;
@ -15,10 +16,11 @@ import net.minecraft.world.item.Items;
import net.minecraft.world.item.crafting.Ingredient;
import javax.annotation.Nonnull;
import java.util.concurrent.CompletableFuture;
public class CrushingRecipeGenerator extends RecipeProvider {
public CrushingRecipeGenerator(PackOutput packOutput) {
super(packOutput);
public CrushingRecipeGenerator(PackOutput packOutput, CompletableFuture<HolderLookup.Provider> lookupProvider) {
super(packOutput, lookupProvider);
}
@Override
@ -163,7 +165,7 @@ public class CrushingRecipeGenerator extends RecipeProvider {
}
public void save(RecipeOutput consumer, String name) {
ResourceLocation res = new ResourceLocation(ActuallyAdditions.MODID, "crushing/" + name);
ResourceLocation res = ActuallyAdditions.modLoc("crushing/" + name);
if (results.size() != 2)
throw new IllegalStateException("invalid result count: " + results.size() + ", recipe: " + name.toString());

View file

@ -6,6 +6,7 @@ import de.ellpeck.actuallyadditions.mod.crafting.EmpowererRecipe;
import de.ellpeck.actuallyadditions.mod.items.ActuallyItems;
import de.ellpeck.actuallyadditions.mod.items.metalists.Crystals;
import de.ellpeck.actuallyadditions.mod.util.NoAdvRecipeOutput;
import net.minecraft.core.HolderLookup;
import net.minecraft.core.NonNullList;
import net.minecraft.core.registries.BuiltInRegistries;
import net.minecraft.data.PackOutput;
@ -21,9 +22,11 @@ import net.minecraft.world.item.crafting.Ingredient;
import net.minecraft.world.level.ItemLike;
import net.neoforged.neoforge.common.Tags;
import java.util.concurrent.CompletableFuture;
public class EmpoweringRecipeGenerator extends RecipeProvider {
public EmpoweringRecipeGenerator(PackOutput packOutput) {
super(packOutput);
public EmpoweringRecipeGenerator(PackOutput packOutput, CompletableFuture<HolderLookup.Provider> lookupProvider) {
super(packOutput, lookupProvider);
}
@Override
@ -72,23 +75,23 @@ public class EmpoweringRecipeGenerator extends RecipeProvider {
.addModifier(Tags.Items.DYES_GRAY)
.addModifier(Items.SNOWBALL)
.addModifier(Items.STONE_BUTTON)
.addModifier(Tags.Items.COBBLESTONE).save(recipeOutput, "enori");
.addModifier(Tags.Items.COBBLESTONES).save(recipeOutput, "enori");
EmpoweringBuilder.builder(ActuallyBlocks.EMPOWERED_ENORI_CRYSTAL.get(), ActuallyBlocks.ENORI_CRYSTAL.get(), 50000, 500, Crystals.IRON.conversionColorParticles)
.addModifier(Tags.Items.DYES_GRAY)
.addModifier(Items.SNOWBALL)
.addModifier(Items.STONE_BUTTON)
.addModifier(Tags.Items.COBBLESTONE).save(recipeOutput, "enori_block");
.addModifier(Tags.Items.COBBLESTONES).save(recipeOutput, "enori_block");
EmpoweringBuilder.builder(ActuallyItems.EMPOWERED_VOID_CRYSTAL.get(), ActuallyItems.VOID_CRYSTAL.get(), 5000, 50, Crystals.COAL.conversionColorParticles)
.addModifier(Tags.Items.DYES_BLACK)
.addModifier(ItemTags.COALS)
.addModifier(Items.FLINT)
.addModifier(Tags.Items.STONE).save(recipeOutput, "void");
.addModifier(Tags.Items.STONES).save(recipeOutput, "void");
EmpoweringBuilder.builder(ActuallyBlocks.EMPOWERED_VOID_CRYSTAL.get(), ActuallyBlocks.VOID_CRYSTAL.get(), 50000, 500, Crystals.COAL.conversionColorParticles)
.addModifier(Tags.Items.DYES_BLACK)
.addModifier(ItemTags.COALS)
.addModifier(Items.FLINT)
.addModifier(Tags.Items.STONE).save(recipeOutput, "void_block");
.addModifier(Tags.Items.STONES).save(recipeOutput, "void_block");
EmpoweringBuilder.builder(ActuallyItems.EMPOWERED_EMERADIC_CRYSTAL.get(), ActuallyItems.EMERADIC_CRYSTAL.get(), 5000, 50, Crystals.EMERALD.conversionColorParticles)
.addModifier(Tags.Items.DYES_LIME)
@ -159,7 +162,7 @@ public class EmpoweringRecipeGenerator extends RecipeProvider {
}
public void save(RecipeOutput consumer, String name) {
ResourceLocation res = new ResourceLocation(ActuallyAdditions.MODID, "empowering/" + name);
ResourceLocation res = ActuallyAdditions.modLoc("empowering/" + name);
if (modifiers.size() != 4)
throw new IllegalStateException("invalid modifier count: " + modifiers.size() + ", recipe: " + res);

View file

@ -6,6 +6,7 @@ import de.ellpeck.actuallyadditions.mod.crafting.LiquidFuelRecipe;
import de.ellpeck.actuallyadditions.mod.crafting.SolidFuelRecipe;
import de.ellpeck.actuallyadditions.mod.fluids.InitFluids;
import de.ellpeck.actuallyadditions.mod.util.NoAdvRecipeOutput;
import net.minecraft.core.HolderLookup;
import net.minecraft.data.PackOutput;
import net.minecraft.data.recipes.RecipeOutput;
import net.minecraft.data.recipes.RecipeProvider;
@ -17,10 +18,11 @@ import net.minecraft.world.item.crafting.Ingredient;
import net.neoforged.neoforge.fluids.FluidStack;
import javax.annotation.Nonnull;
import java.util.concurrent.CompletableFuture;
public class FuelRecipeGenerator extends RecipeProvider {
public FuelRecipeGenerator(PackOutput packOutput) {
super(packOutput);
public FuelRecipeGenerator(PackOutput packOutput, CompletableFuture<HolderLookup.Provider> lookupProvider) {
super(packOutput, lookupProvider);
}
@Override
@ -39,29 +41,29 @@ public class FuelRecipeGenerator extends RecipeProvider {
addSolid(recipeOutput, "coal-block", Items.COAL_BLOCK, 320000, 16000);
addSolid(recipeOutput, "lava", Items.LAVA_BUCKET, 400000, 20000);
recipeOutput.accept(new ResourceLocation(ActuallyAdditions.MODID, "liquid_fuel/canola_oil"), new LiquidFuelRecipe(
recipeOutput.accept(ActuallyAdditions.modLoc("liquid_fuel/canola_oil"), new LiquidFuelRecipe(
new FluidStack(InitFluids.CANOLA_OIL.get(), 50), 4000, 100), null);
recipeOutput.accept(new ResourceLocation(ActuallyAdditions.MODID, "liquid_fuel/refined_canola_oil"), new LiquidFuelRecipe(
recipeOutput.accept(ActuallyAdditions.modLoc("liquid_fuel/refined_canola_oil"), new LiquidFuelRecipe(
new FluidStack(InitFluids.REFINED_CANOLA_OIL.get(), 50), 9600, 120), null);
recipeOutput.accept(new ResourceLocation(ActuallyAdditions.MODID, "liquid_fuel/crystallized_canola_oil"),new LiquidFuelRecipe(
recipeOutput.accept(ActuallyAdditions.modLoc("liquid_fuel/crystallized_canola_oil"),new LiquidFuelRecipe(
new FluidStack(InitFluids.CRYSTALLIZED_OIL.get(), 50), 28000, 280), null);
recipeOutput.accept(new ResourceLocation(ActuallyAdditions.MODID, "liquid_fuel/empowered_canola_oil"), new LiquidFuelRecipe(
recipeOutput.accept(ActuallyAdditions.modLoc("liquid_fuel/empowered_canola_oil"), new LiquidFuelRecipe(
new FluidStack(InitFluids.EMPOWERED_OIL.get(), 50), 48000, 400), null);
}
private void addSolid(RecipeOutput consumer, String name, Item item, int energy, int burnTime) {
ResourceLocation id = new ResourceLocation(ActuallyAdditions.MODID, "solid_fuel/"+name);
ResourceLocation id = ActuallyAdditions.modLoc("solid_fuel/"+name);
consumer.accept(id, new SolidFuelRecipe(Ingredient.of(item), energy, burnTime), null);
}
private void addSolid(RecipeOutput consumer, String name, Ingredient item, int energy, int burnTime) {
ResourceLocation id = new ResourceLocation(ActuallyAdditions.MODID, "solid_fuel/"+name);
ResourceLocation id = ActuallyAdditions.modLoc("solid_fuel/"+name);
consumer.accept(id, new SolidFuelRecipe(item, energy, burnTime), null);
}
private void addSolid(RecipeOutput consumer, String name, TagKey<Item> tag, int energy, int burnTime) {
ResourceLocation id = new ResourceLocation(ActuallyAdditions.MODID, "solid_fuel/"+name);
ResourceLocation id = ActuallyAdditions.modLoc("solid_fuel/"+name);
consumer.accept(id, new SolidFuelRecipe(Ingredient.of(tag), energy, burnTime), null);
}
}

View file

@ -3,6 +3,7 @@ package de.ellpeck.actuallyadditions.data;
import de.ellpeck.actuallyadditions.mod.ActuallyAdditions;
import de.ellpeck.actuallyadditions.mod.lootmodifier.BatLootModifier;
import de.ellpeck.actuallyadditions.mod.lootmodifier.DungeonLootModifier;
import net.minecraft.core.HolderLookup;
import net.minecraft.data.PackOutput;
import net.minecraft.world.entity.EntityType;
import net.minecraft.world.level.storage.loot.BuiltInLootTables;
@ -12,9 +13,11 @@ import net.minecraft.world.level.storage.loot.predicates.LootItemKilledByPlayerC
import net.neoforged.neoforge.common.data.GlobalLootModifierProvider;
import net.neoforged.neoforge.common.loot.LootTableIdCondition;
import java.util.concurrent.CompletableFuture;
public class GlobalLootModifierGenerator extends GlobalLootModifierProvider {
public GlobalLootModifierGenerator(PackOutput packOutput) {
super(packOutput, ActuallyAdditions.MODID);
public GlobalLootModifierGenerator(PackOutput packOutput, CompletableFuture<HolderLookup.Provider> lookupProvider) {
super(packOutput, lookupProvider, ActuallyAdditions.MODID);
}
@Override
@ -22,20 +25,20 @@ public class GlobalLootModifierGenerator extends GlobalLootModifierProvider {
this.add("bat_loot", new BatLootModifier(
new LootItemCondition[]{
LootItemKilledByPlayerCondition.killedByPlayer().build(),
LootTableIdCondition.builder(EntityType.BAT.getDefaultLootTable()).build()
LootTableIdCondition.builder(EntityType.BAT.getDefaultLootTable().location()).build()
}));
this.add("dungeon_loot", new DungeonLootModifier(
new LootItemCondition[]{
AnyOfCondition.anyOf(
LootTableIdCondition.builder(BuiltInLootTables.SIMPLE_DUNGEON),
LootTableIdCondition.builder(BuiltInLootTables.ABANDONED_MINESHAFT),
LootTableIdCondition.builder(BuiltInLootTables.VILLAGE_WEAPONSMITH),
LootTableIdCondition.builder(BuiltInLootTables.STRONGHOLD_LIBRARY),
LootTableIdCondition.builder(BuiltInLootTables.IGLOO_CHEST),
LootTableIdCondition.builder(BuiltInLootTables.DESERT_PYRAMID),
LootTableIdCondition.builder(BuiltInLootTables.NETHER_BRIDGE),
LootTableIdCondition.builder(BuiltInLootTables.END_CITY_TREASURE),
LootTableIdCondition.builder(BuiltInLootTables.WOODLAND_MANSION)
LootTableIdCondition.builder(BuiltInLootTables.SIMPLE_DUNGEON.location()),
LootTableIdCondition.builder(BuiltInLootTables.ABANDONED_MINESHAFT.location()),
LootTableIdCondition.builder(BuiltInLootTables.VILLAGE_WEAPONSMITH.location()),
LootTableIdCondition.builder(BuiltInLootTables.STRONGHOLD_LIBRARY.location()),
LootTableIdCondition.builder(BuiltInLootTables.IGLOO_CHEST.location()),
LootTableIdCondition.builder(BuiltInLootTables.DESERT_PYRAMID.location()),
LootTableIdCondition.builder(BuiltInLootTables.NETHER_BRIDGE.location()),
LootTableIdCondition.builder(BuiltInLootTables.END_CITY_TREASURE.location()),
LootTableIdCondition.builder(BuiltInLootTables.WOODLAND_MANSION.location())
).build()
}));
}

View file

@ -66,11 +66,11 @@ public class ItemModelGenerator extends ItemModelProvider {
String wormpath = ActuallyItems.WORM.getId().getPath();
singleTexture(wormpath, mcLoc("item/handheld"), "layer0", modLoc("item/" + wormpath))
.override().predicate(new ResourceLocation(ActuallyAdditions.MODID, "snail"), 1F)
.override().predicate(ActuallyAdditions.modLoc("snail"), 1F)
.model(singleTexture("snail", mcLoc("item/handheld"), "layer0", modLoc("item/snail"))).end();
/* withExistingParent(wormpath, mcLoc("item/handheld"))
.texture("layer0", modLoc("item/" + wormpath))
.override().predicate(new ResourceLocation(ActuallyAdditions.MODID, "snail"), 1F)
.override().predicate(ActuallyAdditions.modLoc("snail"), 1F)
.model(getBuilder("snail").parent(getExistingFile(mcLoc("item/handheld"))).texture("layer0", "item/snail")).end();*/
String torchPath = BuiltInRegistries.ITEM.getKey(ActuallyBlocks.TINY_TORCH.getItem()).getPath();
@ -87,7 +87,7 @@ public class ItemModelGenerator extends ItemModelProvider {
if (block.get() instanceof WallBlock) {
String name = path;
path = "block/" + path.replace("_wall", "_block");
withExistingParent(name, new ResourceLocation("block/wall_inventory"))
withExistingParent(name, ResourceLocation.tryParse("block/wall_inventory"))
.texture("wall", modLoc(path));
return;
}

View file

@ -10,7 +10,9 @@ import de.ellpeck.actuallyadditions.mod.crafting.TargetNBTIngredient;
import de.ellpeck.actuallyadditions.mod.items.ActuallyItems;
import de.ellpeck.actuallyadditions.mod.util.NoAdvRecipeOutput;
import de.ellpeck.actuallyadditions.mod.util.RecipeInjector;
import net.minecraft.core.HolderLookup;
import net.minecraft.core.registries.BuiltInRegistries;
import net.minecraft.core.registries.Registries;
import net.minecraft.data.PackOutput;
import net.minecraft.data.recipes.RecipeCategory;
import net.minecraft.data.recipes.RecipeOutput;
@ -29,16 +31,18 @@ import net.minecraft.world.item.crafting.ShapedRecipe;
import net.minecraft.world.item.crafting.ShapelessRecipe;
import net.minecraft.world.item.enchantment.Enchantments;
import net.minecraft.world.level.ItemLike;
import net.neoforged.neoforge.common.CommonHooks;
import net.neoforged.neoforge.common.Tags;
import net.neoforged.neoforge.common.crafting.NBTIngredient;
import net.neoforged.neoforge.common.crafting.DataComponentIngredient;
import net.neoforged.neoforge.registries.DeferredItem;
import javax.annotation.Nonnull;
import java.util.Arrays;
import java.util.concurrent.CompletableFuture;
public class ItemRecipeGenerator extends RecipeProvider {
public ItemRecipeGenerator(PackOutput packOutput) {
super(packOutput);
public ItemRecipeGenerator(PackOutput packOutput, CompletableFuture<HolderLookup.Provider> lookupProvider) {
super(packOutput, lookupProvider);
}
@Override
@ -48,6 +52,7 @@ public class ItemRecipeGenerator extends RecipeProvider {
@Override
protected void buildRecipes(@Nonnull RecipeOutput output) {
var enchantmentLookup = CommonHooks.resolveLookup(Registries.ENCHANTMENT);
var recipeOutput = new NoAdvRecipeOutput(output);
generateAOIT(recipeOutput);
@ -58,7 +63,7 @@ public class ItemRecipeGenerator extends RecipeProvider {
.pattern("IGI")
.define('R', ActuallyItems.RESTONIA_CRYSTAL.get())
.define('I', Items.IRON_BARS)
.define('G', Tags.Items.GLASS).save(recipeOutput);
.define('G', Tags.Items.GLASS_BLOCKS).save(recipeOutput);
//Advanced Goggles
Recipe.shaped(ActuallyItems.ENGINEERS_GOGGLES_ADVANCED.get())
@ -74,7 +79,7 @@ public class ItemRecipeGenerator extends RecipeProvider {
.pattern("GGG")
.pattern("RCR")
.pattern("GGG")
.define('G', Tags.Items.GLASS_BLACK)
.define('G', Items.BLACK_STAINED_GLASS)
.define('R', ActuallyItems.VOID_CRYSTAL.get())
.define('C', ActuallyItems.ADVANCED_COIL.get()).save(recipeOutput);
@ -103,8 +108,8 @@ public class ItemRecipeGenerator extends RecipeProvider {
.pattern("SLS")
.pattern("SCS")
.pattern("LVL")
.define('S', Tags.Items.STRING)
.define('L', Tags.Items.LEATHER)
.define('S', Tags.Items.STRINGS)
.define('L', Tags.Items.LEATHERS)
.define('C', Tags.Items.CHESTS_WOODEN)
.define('V', ActuallyBlocks.VOID_CRYSTAL.getItem()).save(recipeOutput);
@ -112,7 +117,7 @@ public class ItemRecipeGenerator extends RecipeProvider {
Recipe.shapeless(ActuallyItems.VOID_SACK.get())
.requires(ActuallyItems.TRAVELERS_SACK.get())
.requires(Tags.Items.ENDER_PEARLS)
.requires(Tags.Items.OBSIDIAN)
.requires(Tags.Items.OBSIDIANS)
.requires(ActuallyBlocks.VOID_CRYSTAL.getItem())
.save(recipeOutput);
@ -121,7 +126,7 @@ public class ItemRecipeGenerator extends RecipeProvider {
.pattern("GGG")
.pattern("GBG")
.pattern("GGG")
.define('G', Tags.Items.GLASS)
.define('G', Tags.Items.GLASS_BLOCKS)
.define('B', ActuallyItems.BLACK_QUARTZ.get()).save(recipeOutput);
//Booklet
@ -130,8 +135,8 @@ public class ItemRecipeGenerator extends RecipeProvider {
//Clearing NBT Storage
Recipe.shapeless(ActuallyItems.LASER_WRENCH.get()).ingredients(ActuallyItems.LASER_WRENCH.get()).name(new ResourceLocation(ActuallyAdditions.MODID, "laser_wrench_nbt")).save(recipeOutput);
Recipe.shapeless(ActuallyItems.PHANTOM_CONNECTOR.get()).ingredients(ActuallyItems.PHANTOM_CONNECTOR.get()).name(new ResourceLocation(ActuallyAdditions.MODID, "phantom_clearing")).save(recipeOutput);
Recipe.shapeless(ActuallyItems.LASER_WRENCH.get()).ingredients(ActuallyItems.LASER_WRENCH.get()).name(ActuallyAdditions.modLoc("laser_wrench_nbt")).save(recipeOutput);
Recipe.shapeless(ActuallyItems.PHANTOM_CONNECTOR.get()).ingredients(ActuallyItems.PHANTOM_CONNECTOR.get()).name(ActuallyAdditions.modLoc("phantom_clearing")).save(recipeOutput);
//Disenchanting Lens
Recipe.shapeless(ActuallyItems.LENS_OF_DISENCHANTING.get())
@ -156,12 +161,13 @@ public class ItemRecipeGenerator extends RecipeProvider {
//Killer Lens
ItemStack enchantedBook = new ItemStack(Items.ENCHANTED_BOOK);
enchantedBook.enchant(Enchantments.SHARPNESS, 5);
if (enchantmentLookup != null) {
enchantedBook.enchant(enchantmentLookup.getOrThrow(Enchantments.SHARPNESS), 5);
}
Recipe.shapeless(ActuallyItems.LENS_OF_THE_KILLER.get())
.requires(Items.DIAMOND_SWORD)
.requires(ActuallyItems.LENS_OF_CERTAIN_DEATH.get())
.requires(NBTIngredient.of(true, enchantedBook)).save(recipeOutput);
.requires(DataComponentIngredient.of(true, enchantedBook)).save(recipeOutput);
//Filter
Recipe.shaped(ActuallyItems.FILTER.get())
@ -194,7 +200,7 @@ public class ItemRecipeGenerator extends RecipeProvider {
.pattern("R ")
.pattern(" R ")
.pattern(" R")
.define('R', ActuallyItems.RICE).save(recipeOutput, new ResourceLocation(ActuallyAdditions.MODID, "rice_paper"));
.define('R', ActuallyItems.RICE).save(recipeOutput, ActuallyAdditions.modLoc("rice_paper"));
Recipe.shaped(ActuallyItems.RICE_SLIMEBALL.get())
.requiresBook()
@ -203,7 +209,7 @@ public class ItemRecipeGenerator extends RecipeProvider {
.pattern(" R ")
.define('R', ActuallyItems.RICE_DOUGH.get())
.define('B', Items.WATER_BUCKET)
.save(recipeOutput, new ResourceLocation(ActuallyAdditions.MODID, "rice_slime"));
.save(recipeOutput, ActuallyAdditions.modLoc("rice_slime"));
Recipe.shaped(ActuallyItems.RICE_SLIMEBALL.get())
.requiresBook()
@ -212,7 +218,7 @@ public class ItemRecipeGenerator extends RecipeProvider {
.pattern(" R ")
.define('R', ActuallyItems.RICE_DOUGH.get())
.define('B', Items.POTION)
.save(recipeOutput, new ResourceLocation(ActuallyAdditions.MODID, "rice_slime_potion"));
.save(recipeOutput, ActuallyAdditions.modLoc("rice_slime_potion"));
//Leaf Blower
Recipe.shaped(ActuallyItems.LEAF_BLOWER.get())
@ -357,7 +363,7 @@ public class ItemRecipeGenerator extends RecipeProvider {
.pattern("CEC")
.pattern("RAR")
.pattern("CEC")
.define('C', Tags.Items.COBBLESTONE)
.define('C', Tags.Items.COBBLESTONES)
.define('E', Items.PAPER)
.define('A', ActuallyItems.BASIC_COIL.get())
.define('R', ActuallyItems.ENORI_CRYSTAL.get()).save(recipeOutput);
@ -460,15 +466,15 @@ public class ItemRecipeGenerator extends RecipeProvider {
Recipe.shapeless(ActuallyItems.TINY_COAL.get(), 8)
.requires(Items.COAL)
.save(boolConsumer, new ResourceLocation(ActuallyAdditions.MODID, "coal_to_tiny"));
.save(boolConsumer, ActuallyAdditions.modLoc("coal_to_tiny"));
Recipe.shapeless(ActuallyItems.TINY_CHARCOAL.get(), 8)
.requires(Items.CHARCOAL).save(boolConsumer, new ResourceLocation(ActuallyAdditions.MODID, "charcoal_to_tiny"));
.requires(Items.CHARCOAL).save(boolConsumer, ActuallyAdditions.modLoc("charcoal_to_tiny"));
Recipe.shaped(Items.COAL)
.pattern("CCC", "C C", "CCC").define('C', ActuallyItems.TINY_COAL.get())
.save(boolConsumer, new ResourceLocation(ActuallyAdditions.MODID, "tiny_to_coal"));
.save(boolConsumer, ActuallyAdditions.modLoc("tiny_to_coal"));
Recipe.shaped(Items.CHARCOAL)
.pattern("CCC", "C C", "CCC").define('C', ActuallyItems.TINY_CHARCOAL.get())
.save(boolConsumer, new ResourceLocation(ActuallyAdditions.MODID, "tiny_to_charcoal"));
.save(boolConsumer, ActuallyAdditions.modLoc("tiny_to_charcoal"));
//Canola Seeds
Recipe.shapeless(ActuallyItems.CANOLA_SEEDS.get())
@ -496,7 +502,7 @@ public class ItemRecipeGenerator extends RecipeProvider {
//Cup
Recipe.shaped(ActuallyItems.EMPTY_CUP.get())
.pattern("S S", "SCS", "SSS")
.define('S', Tags.Items.STONE)
.define('S', Tags.Items.STONES)
.define('C', ActuallyItems.COFFEE_BEANS.get())
.save(recipeOutput);
@ -528,13 +534,13 @@ public class ItemRecipeGenerator extends RecipeProvider {
.pattern("R", "P")
.define('R', Tags.Items.SLIMEBALLS)
.define('P', Items.PISTON)
.save(recipeOutput, new ResourceLocation(ActuallyAdditions.MODID, "tagged_sticky_piston"));
.save(recipeOutput, ActuallyAdditions.modLoc("tagged_sticky_piston"));
// Slime block from tagged balls
Recipe.shaped(Items.SLIME_BLOCK)
.pattern("RRR", "RRR", "RRR")
.define('R', Tags.Items.SLIMEBALLS)
.save(recipeOutput, new ResourceLocation(ActuallyAdditions.MODID, "tagged_slime_block"));
.save(recipeOutput, ActuallyAdditions.modLoc("tagged_slime_block"));
//Shards
addShard(recipeOutput, ActuallyItems.VOID_CRYSTAL_SHARD, ActuallyItems.VOID_CRYSTAL);
@ -576,15 +582,15 @@ public class ItemRecipeGenerator extends RecipeProvider {
SimpleCookingRecipeBuilder.smelting(Ingredient.of(ActuallyItems.RICE_DOUGH), RecipeCategory.FOOD, Items.BREAD, 0.35F, 200)
.unlockedBy("", has(Items.AIR))
.save(recipeOutput, new ResourceLocation(ActuallyAdditions.MODID, "rice_dough_smelting"));
.save(recipeOutput, ActuallyAdditions.modLoc("rice_dough_smelting"));
// Black Quartz Ore
SimpleCookingRecipeBuilder.smelting(Ingredient.of(ActuallyBlocks.BLACK_QUARTZ_ORE.getItem()), RecipeCategory.MISC, ActuallyItems.BLACK_QUARTZ.get(), 0.7F, 200)
.unlockedBy("", has(Items.AIR))
.save(recipeOutput, new ResourceLocation(ActuallyAdditions.MODID, "black_quartz_ore_smelting"));
.save(recipeOutput, ActuallyAdditions.modLoc("black_quartz_ore_smelting"));
SimpleCookingRecipeBuilder.blasting(Ingredient.of(ActuallyBlocks.BLACK_QUARTZ_ORE.getItem()), RecipeCategory.MISC, ActuallyItems.BLACK_QUARTZ.get(), 0.7F, 100)
.unlockedBy("", has(Items.AIR))
.save(recipeOutput, new ResourceLocation(ActuallyAdditions.MODID, "black_quartz_ore_blasting"));
.save(recipeOutput, ActuallyAdditions.modLoc("black_quartz_ore_blasting"));
//Patterns
Recipe.shapeless(ActuallyItems.DRILL_PATTERN.get())
@ -616,9 +622,9 @@ public class ItemRecipeGenerator extends RecipeProvider {
private static void dyeDrill(DeferredItem<? extends Item> result, TagKey<Item> dyeItem, RecipeOutput recipeOutput) {
Recipe.shapeless(result.get())
.requires(TargetNBTIngredient.of(ActuallyTags.Items.DRILLS))
.requires(Ingredient.of(ActuallyTags.Items.DRILLS)) //TargetNBTIngredient
.requires(dyeItem)
.save(new RecipeInjector<ShapelessRecipe>(recipeOutput, RecipeKeepDataShapeless::new), new ResourceLocation(ActuallyAdditions.MODID, "drill_coloring/dye_" + BuiltInRegistries.ITEM.getKey(result.get()).getPath()));
.save(new RecipeInjector<ShapelessRecipe>(recipeOutput, RecipeKeepDataShapeless::new), ActuallyAdditions.modLoc("drill_coloring/dye_" + BuiltInRegistries.ITEM.getKey(result.get()).getPath()));
}
public static void addPaxel(RecipeOutput consumer, DeferredItem<? extends Item> output, Item axe, Item pickaxe, Item sword, Item shovel, Item hoe) {
@ -643,11 +649,11 @@ public class ItemRecipeGenerator extends RecipeProvider {
public static void decompress(RecipeOutput consumer, ItemLike output, ItemLike input) {
ResourceLocation key = BuiltInRegistries.ITEM.getKey(output.asItem());
Recipe.shapeless(output, 9).requires(input).save(consumer, new ResourceLocation(key.getNamespace(), "decompress/" + key.getPath()));
Recipe.shapeless(output, 9).requires(input).save(consumer, ResourceLocation.fromNamespaceAndPath(key.getNamespace(), "decompress/" + key.getPath()));
}
public static void compress(RecipeOutput consumer, ItemLike output, ItemLike input) {
ResourceLocation key = BuiltInRegistries.ITEM.getKey(output.asItem());
Recipe.shaped(output).pattern("xxx","xxx", "xxx").define('x', input).save(consumer, new ResourceLocation(key.getNamespace(), "compress/" + key.getPath()));
Recipe.shaped(output).pattern("xxx","xxx", "xxx").define('x', input).save(consumer, ResourceLocation.fromNamespaceAndPath(key.getNamespace(), "compress/" + key.getPath()));
}
public static void addShard(RecipeOutput consumer, DeferredItem<? extends Item> shard, DeferredItem<? extends Item> crystal) {
compress(consumer, crystal, shard);

View file

@ -5,6 +5,7 @@ import de.ellpeck.actuallyadditions.mod.blocks.ActuallyBlocks;
import de.ellpeck.actuallyadditions.mod.crafting.LaserRecipe;
import de.ellpeck.actuallyadditions.mod.items.ActuallyItems;
import de.ellpeck.actuallyadditions.mod.util.NoAdvRecipeOutput;
import net.minecraft.core.HolderLookup;
import net.minecraft.core.registries.BuiltInRegistries;
import net.minecraft.data.PackOutput;
import net.minecraft.data.recipes.RecipeOutput;
@ -19,10 +20,11 @@ import net.minecraft.world.level.ItemLike;
import net.neoforged.neoforge.common.Tags;
import javax.annotation.Nonnull;
import java.util.concurrent.CompletableFuture;
public class LaserRecipeGenerator extends RecipeProvider {
public LaserRecipeGenerator(PackOutput packOutput) {
super(packOutput);
public LaserRecipeGenerator(PackOutput packOutput, CompletableFuture<HolderLookup.Provider> lookupProvider) {
super(packOutput, lookupProvider);
}
@Override
@ -62,7 +64,7 @@ public class LaserRecipeGenerator extends RecipeProvider {
laserRecipe(recipeOutput, ActuallyBlocks.LASER_RELAY.getItem(), ActuallyBlocks.LASER_RELAY_ITEM.getItem(), 2000);
//Misc
laserRecipe(recipeOutput, Items.SOUL_SAND, Tags.Items.SAND, 20000);
laserRecipe(recipeOutput, Items.SOUL_SAND, Tags.Items.SANDS, 20000);
laserRecipe(recipeOutput, Items.LEATHER, Items.ROTTEN_FLESH, 20000);
laserRecipe(recipeOutput, Items.NETHER_WART, Items.RED_MUSHROOM, 150000);
laserRecipe(recipeOutput, Items.PRISMARINE_SHARD, Items.QUARTZ, 30000);
@ -73,27 +75,27 @@ public class LaserRecipeGenerator extends RecipeProvider {
}
private void laserRecipe(RecipeOutput consumer, ItemLike output, Ingredient input, int energy) {
ResourceLocation id = new ResourceLocation(ActuallyAdditions.MODID, "laser/" + BuiltInRegistries.ITEM.getKey(output.asItem()).getPath());
ResourceLocation id = ActuallyAdditions.modLoc("laser/" + BuiltInRegistries.ITEM.getKey(output.asItem()).getPath());
consumer.accept(id, new LaserRecipe(output.asItem().getDefaultInstance(), input, energy), null);
}
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());
ResourceLocation id = ActuallyAdditions.modLoc("laser/" + BuiltInRegistries.ITEM.getKey(output.asItem()).getPath());
consumer.accept(id, new LaserRecipe(output.asItem().getDefaultInstance(), Ingredient.of(input), energy), null);
}
private void laserRecipe(RecipeOutput consumer, ItemLike output, ItemLike input, int energy) {
ResourceLocation id = new ResourceLocation(ActuallyAdditions.MODID, "laser/" + BuiltInRegistries.ITEM.getKey(output.asItem()).getPath());
ResourceLocation id = ActuallyAdditions.modLoc("laser/" + BuiltInRegistries.ITEM.getKey(output.asItem()).getPath());
consumer.accept(id, new LaserRecipe(output.asItem().getDefaultInstance(), Ingredient.of(input), energy), null);;
}
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());
ResourceLocation id = ActuallyAdditions.modLoc("laser/crystalize_" + BuiltInRegistries.ITEM.getKey(output.asItem()).getPath());
consumer.accept(id, new LaserRecipe(output.asItem().getDefaultInstance(), input, energy), null);
}
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());
ResourceLocation id = ActuallyAdditions.modLoc("laser/crystalize_" + BuiltInRegistries.ITEM.getKey(output.asItem()).getPath());
consumer.accept(id, new LaserRecipe(output.asItem().getDefaultInstance(), Ingredient.of(input), energy), null);
}
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());
ResourceLocation id = ActuallyAdditions.modLoc("laser/crystalize_" + BuiltInRegistries.ITEM.getKey(output.asItem()).getPath());
consumer.accept(id, new LaserRecipe(output.asItem().getDefaultInstance(), Ingredient.of(input), energy), null);
}
}

View file

@ -4,15 +4,19 @@ package de.ellpeck.actuallyadditions.data;
import com.google.common.collect.ImmutableSet;
import de.ellpeck.actuallyadditions.api.ActuallyTags;
import de.ellpeck.actuallyadditions.mod.blocks.ActuallyBlocks;
import de.ellpeck.actuallyadditions.mod.components.ActuallyComponents;
import de.ellpeck.actuallyadditions.mod.fluids.InitFluids;
import de.ellpeck.actuallyadditions.mod.items.ActuallyItems;
import de.ellpeck.actuallyadditions.mod.misc.DungeonLoot;
import net.minecraft.advancements.critereon.StatePropertiesPredicate;
import net.minecraft.core.HolderLookup;
import net.minecraft.core.WritableRegistry;
import net.minecraft.data.PackOutput;
import net.minecraft.data.loot.BlockLootSubProvider;
import net.minecraft.data.loot.LootTableProvider;
import net.minecraft.data.loot.LootTableSubProvider;
import net.minecraft.resources.ResourceLocation;
import net.minecraft.resources.ResourceKey;
import net.minecraft.util.ProblemReporter;
import net.minecraft.world.flag.FeatureFlags;
import net.minecraft.world.item.Item;
import net.minecraft.world.item.Items;
@ -23,50 +27,50 @@ import net.minecraft.world.level.storage.loot.LootTable;
import net.minecraft.world.level.storage.loot.ValidationContext;
import net.minecraft.world.level.storage.loot.entries.LootItem;
import net.minecraft.world.level.storage.loot.entries.TagEntry;
import net.minecraft.world.level.storage.loot.functions.CopyNbtFunction;
import net.minecraft.world.level.storage.loot.functions.CopyComponentsFunction;
import net.minecraft.world.level.storage.loot.functions.SetItemCountFunction;
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.minecraft.world.level.storage.loot.providers.number.UniformGenerator;
import net.neoforged.neoforge.registries.DeferredHolder;
import javax.annotation.Nonnull;
import java.util.List;
import java.util.Map;
import java.util.Set;
import java.util.concurrent.CompletableFuture;
import java.util.function.BiConsumer;
import java.util.function.Consumer;
import java.util.function.Supplier;
import java.util.stream.Collectors;
public class LootTableGenerator extends LootTableProvider {
public LootTableGenerator(PackOutput packOutput) {
public LootTableGenerator(PackOutput packOutput, CompletableFuture<HolderLookup.Provider> lookupProvider) {
super(packOutput, Set.of(), List.of(
new SubProviderEntry(Blocks::new, LootContextParamSets.BLOCK),
new SubProviderEntry(Dungeon::new, LootContextParamSets.CHEST)
));
), lookupProvider);
}
@Override
protected void validate(Map<ResourceLocation, LootTable> map, @Nonnull ValidationContext validationtracker) {
map.forEach((name, table) -> table.validate(validationtracker));
protected void validate(WritableRegistry<LootTable> writableregistry, ValidationContext validationcontext, ProblemReporter.Collector problemreporter$collector) {
super.validate(writableregistry, validationcontext, problemreporter$collector);
}
public static class Blocks extends BlockLootSubProvider {
protected Blocks() {
super(Set.of(), FeatureFlags.REGISTRY.allFlags());
protected Blocks(HolderLookup.Provider lookupProvider) {
super(Set.of(), FeatureFlags.REGISTRY.allFlags(), lookupProvider);
}
@Override
protected void generate() {
CopyNbtFunction.Builder copyEnergy = CopyNbtFunction.copyData(ContextNbtProvider.BLOCK_ENTITY).copy("Energy", "BlockEntityTag.Energy");
CopyNbtFunction.Builder copyPulseMode = CopyNbtFunction.copyData(ContextNbtProvider.BLOCK_ENTITY).copy("IsPulseMode", "BlockEntityTag.IsPulseMode");
CopyComponentsFunction.Builder copyEnergy = CopyComponentsFunction.copyComponents(CopyComponentsFunction.Source.BLOCK_ENTITY)
.include(ActuallyComponents.ENERGY_STORAGE.get());
CopyComponentsFunction.Builder copyPulseMode = CopyComponentsFunction.copyComponents(CopyComponentsFunction.Source.BLOCK_ENTITY)
.include(ActuallyComponents.PULSE_MODE.get());
//Special Drops
dropNBT(ActuallyBlocks.ATOMIC_RECONSTRUCTOR, $ -> $.apply(copyEnergy).apply(copyPulseMode));
dropComponents(ActuallyBlocks.ATOMIC_RECONSTRUCTOR, $ -> $.apply(copyEnergy).apply(copyPulseMode));
dropKeepEnergy(ActuallyBlocks.DISPLAY_STAND);
dropKeepEnergy(ActuallyBlocks.COAL_GENERATOR);
dropKeepEnergy(ActuallyBlocks.OIL_GENERATOR);
@ -214,7 +218,7 @@ public class LootTableGenerator extends LootTableProvider {
}
private void dropNBT(Supplier<? extends Block> blockSupplier, Consumer<LootPool.Builder> lootFunctionProvider) {
private void dropComponents(Supplier<? extends Block> blockSupplier, Consumer<LootPool.Builder> lootFunctionProvider) {
LootPool.Builder lootpool = LootPool.lootPool().setRolls(ConstantValue.exactly(1)).add(LootItem.lootTableItem(blockSupplier.get()));
lootFunctionProvider.accept(lootpool);
@ -222,7 +226,8 @@ public class LootTableGenerator extends LootTableProvider {
add(blockSupplier.get(), LootTable.lootTable().withPool(applyExplosionCondition(ActuallyBlocks.ATOMIC_RECONSTRUCTOR.get(), lootpool)));
}
private void dropKeepEnergy(Supplier<? extends Block> blockSupplier) {
dropNBT(blockSupplier, $ -> $.apply(CopyNbtFunction.copyData(ContextNbtProvider.BLOCK_ENTITY).copy("Energy", "BlockEntityTag.Energy")));
dropComponents(blockSupplier, $ -> $.apply(CopyComponentsFunction.copyComponents(CopyComponentsFunction.Source.BLOCK_ENTITY)
.include(ActuallyComponents.ENERGY_STORAGE.get())));
}
/* // This isn't quite right :cry: fortune doesn't change it
@ -251,8 +256,12 @@ public class LootTableGenerator extends LootTableProvider {
}
public static class Dungeon implements LootTableSubProvider {
public Dungeon(HolderLookup.Provider provider) {
}
@Override
public void generate(BiConsumer<ResourceLocation, LootTable.Builder> pOutput) {
public void generate(BiConsumer<ResourceKey<LootTable>, LootTable.Builder> pOutput) {
// addCrystals = true;
pOutput.accept(

View file

@ -4,6 +4,7 @@ import de.ellpeck.actuallyadditions.mod.ActuallyAdditions;
import de.ellpeck.actuallyadditions.mod.blocks.ActuallyBlocks;
import de.ellpeck.actuallyadditions.mod.crafting.MiningLensRecipe;
import de.ellpeck.actuallyadditions.mod.util.NoAdvRecipeOutput;
import net.minecraft.core.HolderLookup;
import net.minecraft.data.PackOutput;
import net.minecraft.data.recipes.RecipeOutput;
import net.minecraft.data.recipes.RecipeProvider;
@ -16,10 +17,11 @@ import net.minecraft.world.level.ItemLike;
import net.neoforged.neoforge.common.Tags;
import javax.annotation.Nonnull;
import java.util.concurrent.CompletableFuture;
public class MiningLensGenerator extends RecipeProvider {
public MiningLensGenerator(PackOutput packOutput) {
super(packOutput);
public MiningLensGenerator(PackOutput packOutput, CompletableFuture<HolderLookup.Provider> lookupProvider) {
super(packOutput, lookupProvider);
}
@Override
@ -37,14 +39,14 @@ public class MiningLensGenerator extends RecipeProvider {
// }
private ResourceLocation folderRecipe(String folder, String recipe) {
return new ResourceLocation(ActuallyAdditions.MODID, folder + "/" + recipe);
return ActuallyAdditions.modLoc(folder + "/" + recipe);
}
private void buildStoneOre(RecipeOutput consumer, int weight, ItemLike output) {
buildTagOre(consumer, Tags.Items.STONE, "stone", weight, output);
buildTagOre(consumer, Tags.Items.STONES, "stone", weight, output);
}
private void buildNetherOre(RecipeOutput consumer, int weight, ItemLike output) {
buildTagOre(consumer, Tags.Items.NETHERRACK, "nether", weight, output);
buildTagOre(consumer, Tags.Items.NETHERRACKS, "nether", weight, output);
}
private void buildDeepSlateOre(RecipeOutput consumer, int weight, ItemLike output) {

View file

@ -6,6 +6,7 @@ import de.ellpeck.actuallyadditions.mod.crafting.PressingRecipe;
import de.ellpeck.actuallyadditions.mod.fluids.InitFluids;
import de.ellpeck.actuallyadditions.mod.items.ActuallyItems;
import de.ellpeck.actuallyadditions.mod.util.NoAdvRecipeOutput;
import net.minecraft.core.HolderLookup;
import net.minecraft.data.PackOutput;
import net.minecraft.data.recipes.RecipeOutput;
import net.minecraft.data.recipes.RecipeProvider;
@ -14,10 +15,11 @@ import net.minecraft.world.item.crafting.Ingredient;
import net.neoforged.neoforge.fluids.FluidStack;
import javax.annotation.Nonnull;
import java.util.concurrent.CompletableFuture;
public class MiscMachineRecipeGenerator extends RecipeProvider {
public MiscMachineRecipeGenerator(PackOutput packOutput) {
super(packOutput);
public MiscMachineRecipeGenerator(PackOutput packOutput, CompletableFuture<HolderLookup.Provider> lookupProvider) {
super(packOutput, lookupProvider);
}
@Override
@ -41,6 +43,6 @@ public class MiscMachineRecipeGenerator extends RecipeProvider {
// }
private ResourceLocation folderRecipe(String folder, String recipe) {
return new ResourceLocation(ActuallyAdditions.MODID, folder + "/" + recipe);
return ActuallyAdditions.modLoc(folder + "/" + recipe);
}
}

View file

@ -3,7 +3,6 @@ package de.ellpeck.actuallyadditions.data;
import de.ellpeck.actuallyadditions.mod.AASounds;
import de.ellpeck.actuallyadditions.mod.ActuallyAdditions;
import net.minecraft.data.PackOutput;
import net.minecraft.resources.ResourceLocation;
import net.neoforged.neoforge.common.data.ExistingFileHelper;
import net.neoforged.neoforge.common.data.SoundDefinitionsProvider;
@ -15,10 +14,10 @@ public class SoundsGenerator extends SoundDefinitionsProvider {
@Override
public void registerSounds() {
add(AASounds.RECONSTRUCTOR, definition().with(sound(new ResourceLocation(ActuallyAdditions.MODID, "reconstructor"))));
add(AASounds.CRUSHER, definition().with(sound(new ResourceLocation(ActuallyAdditions.MODID, "crusher"))));
add(AASounds.COFFEE_MACHINE, definition().with(sound(new ResourceLocation(ActuallyAdditions.MODID, "coffee_machine"))));
add(AASounds.DUH_DUH_DUH_DUUUH, definition().with(sound(new ResourceLocation(ActuallyAdditions.MODID, "duh_duh_duh_duuuh"))));
add(AASounds.VILLAGER_WORK_ENGINEER, definition().with(sound(new ResourceLocation(ActuallyAdditions.MODID, "coffee_machine"))));
add(AASounds.RECONSTRUCTOR, definition().with(sound(ActuallyAdditions.modLoc("reconstructor"))));
add(AASounds.CRUSHER, definition().with(sound(ActuallyAdditions.modLoc("crusher"))));
add(AASounds.COFFEE_MACHINE, definition().with(sound(ActuallyAdditions.modLoc("coffee_machine"))));
add(AASounds.DUH_DUH_DUH_DUUUH, definition().with(sound(ActuallyAdditions.modLoc("duh_duh_duh_duuuh"))));
add(AASounds.VILLAGER_WORK_ENGINEER, definition().with(sound(ActuallyAdditions.modLoc("coffee_machine"))));
}
}

View file

@ -1,125 +1,125 @@
package de.ellpeck.actuallyadditions.data.patchouli;
import de.ellpeck.actuallyadditions.data.patchouli.builder.ReconstructorPageBuilder;
import de.ellpeck.actuallyadditions.mod.ActuallyAdditions;
import de.ellpeck.actuallyadditions.mod.items.ActuallyItems;
import net.minecraft.data.PackOutput;
import net.minecraft.resources.ResourceLocation;
import net.minecraft.world.item.ItemStack;
import xyz.brassgoggledcoders.patchouliprovider.BookBuilder;
import xyz.brassgoggledcoders.patchouliprovider.CategoryBuilder;
import xyz.brassgoggledcoders.patchouliprovider.EntryBuilder;
import xyz.brassgoggledcoders.patchouliprovider.PatchouliBookProvider;
import java.util.function.Consumer;
public class PachouliGenerator extends PatchouliBookProvider {
public PachouliGenerator(PackOutput output) {
super(output, ActuallyAdditions.MODID, "en_us");
}
@Override
protected void addBooks(Consumer<BookBuilder> consumer) {
final ItemStack bookStack = ActuallyItems.ITEM_BOOKLET.get().getDefaultInstance();
BookBuilder bookBuilder = createBookBuilder("booklet",
prefix("item.actuallyadditions.booklet"), "<i>To be perfectly honest, I never actually realized how much content Actually Additions has before.<r><n> - Ellpeck")
.setVersion("153")
.setCreativeTab("actuallyadditions.tab")
.setCustomBookItem(bookStack)
.setBookTexture("actuallyadditions:textures/gui/booklet/booklet.png")
.setShowProgress(false)
.setUseBlockyFont(false)
.setI18n(true)
.setDontGenerateBook(true)
.addMacro("<imp>", "$(2)")
.addMacro("<item>", "$(9)")
.addMacro("<r>", "$()")
.addMacro("<n>", "$(br)")
.addMacro("<i>", "$(o)")
.addMacro("<tifisgrin>", "$(4)$(n)")
.setUseResourcePack(true);
//Getting Started
CategoryBuilder gettingStarted = bookBuilder.addCategory("getting_started", prefix("indexEntry.getting_started"),
"", bookStack);
gettingStarted.addEntry("tutorial", prefix("chapter.book_tutorial"), bookStack)
.addTextPage(prefix("chapter.book_tutorial.text.1")).build()
.addTextPage(prefix("chapter.book_tutorial.text.2")).build()
.addTextPage(prefix("chapter.book_tutorial.text.3")).build()
.addCraftingPage(new ResourceLocation(ActuallyAdditions.MODID, "booklet"))
.setTitle("").setText("booklet.actuallyadditions.shapeless_recipe").build();
gettingStarted.addEntry("guide", prefix("chapter.video_guide"), "actuallyadditions:textures/item/youtube.png")
.addLinkPage("https://www.youtube.com/watch?v=fhjz0Ew56pM", prefix("chapter.video_guide.booty.button"))
.setText(prefix("chapter.video_guide.booty.text.1")).build()
.addTextPage(prefix("chapter.video_guide.booty.text.2")).build()
.addLinkPage("https://www.youtube.com/playlist?list=PLJeFZ64pT89MrTRZYzD_rtHFajPVlt6cF", prefix("chapter.video_guide.booty.button"))
.setText(prefix("chapter.video_guide.dire.text.1")).build()
.addTextPage(prefix("chapter.video_guide.dire.text.2")).build();
gettingStarted.addEntry("intro", prefix("chapter.intro"), bookStack)
.addTextPage(prefix("chapter.intro.text.1")).build()
.addTextPage(prefix("chapter.intro.text.2")).build()
.addTextPage(prefix("chapter.intro.text.3")).build()
.addTextPage(prefix("chapter.intro.text.4")).build();
gettingStarted.addEntry("engineer_house", prefix("chapter.engineer_house"), bookStack)
.addTextPage(prefix("chapter.engineer_house.text.1")).build()
.addImagePage(new ResourceLocation(ActuallyAdditions.MODID, "textures/gui/booklet/page_engineer_house.png"))
.setText("booklet.actuallyadditions.chapter.engineer_house.text.2").build();
EntryBuilder crystalsBuilder = gettingStarted.addEntry("crystals", prefix("chapter.crystals"), bookStack)
.addTextPage(prefix("chapter.crystals.text.1")).build()
.addTextPage(prefix("chapter.crystals.text.2")).build()
.addTextPage(prefix("chapter.crystals.text.3")).build()
.addImagePage(new ResourceLocation(ActuallyAdditions.MODID, "textures/gui/booklet/page_atomic_reconstructor.png")).setBorder(false).build()
.addTextPage(prefix("chapter.crystals.text.5")).build()
.addCraftingPage(new ResourceLocation(ActuallyAdditions.MODID, "atomic_reconstructor"))
.setText(prefix("chapter.crystals.text.6")).build();
crystalsBuilder.addPage(new ReconstructorPageBuilder(new ResourceLocation(ActuallyAdditions.MODID, "laser/crystalize_restonia_crystal_block"), crystalsBuilder))
.setRecipe2(new ResourceLocation(ActuallyAdditions.MODID, "laser/crystalize_restonia_crystal"))
.setText("booklet.actuallyadditions.reconstructor_recipe").build();
crystalsBuilder.addPage(new ReconstructorPageBuilder(new ResourceLocation(ActuallyAdditions.MODID, "laser/crystalize_palis_crystal_block"), crystalsBuilder))
.setRecipe2(new ResourceLocation(ActuallyAdditions.MODID, "laser/crystalize_palis_crystal"))
.setText("booklet.actuallyadditions.reconstructor_recipe").build();
crystalsBuilder.addPage(new ReconstructorPageBuilder(new ResourceLocation(ActuallyAdditions.MODID, "laser/crystalize_diamatine_crystal_block"), crystalsBuilder))
.setRecipe2(new ResourceLocation(ActuallyAdditions.MODID, "laser/crystalize_diamatine_crystal"))
.setText("booklet.actuallyadditions.reconstructor_recipe").build();
crystalsBuilder.addPage(new ReconstructorPageBuilder(new ResourceLocation(ActuallyAdditions.MODID, "laser/crystalize_void_crystal_block"), crystalsBuilder))
.setRecipe2(new ResourceLocation(ActuallyAdditions.MODID, "laser/crystalize_void_crystal"))
.setText("booklet.actuallyadditions.reconstructor_recipe").build();
crystalsBuilder.addPage(new ReconstructorPageBuilder(new ResourceLocation(ActuallyAdditions.MODID, "laser/crystalize_emeradic_crystal_block"), crystalsBuilder))
.setRecipe2(new ResourceLocation(ActuallyAdditions.MODID, "laser/crystalize_emeradic_crystal"))
.setText("booklet.actuallyadditions.reconstructor_recipe").build();
crystalsBuilder.addPage(new ReconstructorPageBuilder(new ResourceLocation(ActuallyAdditions.MODID, "laser/crystalize_enori_crystal_block"), crystalsBuilder))
.setRecipe2(new ResourceLocation(ActuallyAdditions.MODID, "laser/crystalize_enori_crystal"))
.setText("booklet.actuallyadditions.reconstructor_recipe").build();
crystalsBuilder.addCraftingPage(new ResourceLocation(ActuallyAdditions.MODID, "decompress/restonia_crystal"))
.setRecipe2(new ResourceLocation(ActuallyAdditions.MODID, "compress/restonia_crystal_block")).build()
.addCraftingPage(new ResourceLocation(ActuallyAdditions.MODID, "decompress/palis_crystal"))
.setRecipe2(new ResourceLocation(ActuallyAdditions.MODID, "compress/palis_crystal_block")).build()
.addCraftingPage(new ResourceLocation(ActuallyAdditions.MODID, "decompress/diamatine_crystal"))
.setRecipe2(new ResourceLocation(ActuallyAdditions.MODID, "compress/diamatine_crystal_block")).build()
.addCraftingPage(new ResourceLocation(ActuallyAdditions.MODID, "decompress/void_crystal"))
.setRecipe2(new ResourceLocation(ActuallyAdditions.MODID, "compress/void_crystal_block")).build()
.addCraftingPage(new ResourceLocation(ActuallyAdditions.MODID, "decompress/emeradic_crystal"))
.setRecipe2(new ResourceLocation(ActuallyAdditions.MODID, "compress/emeradic_crystal_block")).build()
.addCraftingPage(new ResourceLocation(ActuallyAdditions.MODID, "decompress/enori_crystal"))
.setRecipe2(new ResourceLocation(ActuallyAdditions.MODID, "compress/enori_crystal_block")).build();
crystalsBuilder.build();
//End of Getting Started
//Finish book
bookBuilder.build(consumer);
}
private String prefix(String name) {
return "booklet.actuallyadditions." + name;
}
}
//package de.ellpeck.actuallyadditions.data.patchouli;
//
//import de.ellpeck.actuallyadditions.data.patchouli.builder.ReconstructorPageBuilder;
//import de.ellpeck.actuallyadditions.mod.ActuallyAdditions;
//import de.ellpeck.actuallyadditions.mod.items.ActuallyItems;
//import net.minecraft.data.PackOutput;
//import net.minecraft.resources.ResourceLocation;
//import net.minecraft.world.item.ItemStack;
//import xyz.brassgoggledcoders.patchouliprovider.BookBuilder;
//import xyz.brassgoggledcoders.patchouliprovider.CategoryBuilder;
//import xyz.brassgoggledcoders.patchouliprovider.EntryBuilder;
//import xyz.brassgoggledcoders.patchouliprovider.PatchouliBookProvider;
//
//import java.util.function.Consumer;
//
//public class PachouliGenerator extends PatchouliBookProvider {
//
// public PachouliGenerator(PackOutput output) {
// super(output, ActuallyAdditions.MODID, "en_us");
// }
//
// @Override
// protected void addBooks(Consumer<BookBuilder> consumer) {
// final ItemStack bookStack = ActuallyItems.ITEM_BOOKLET.get().getDefaultInstance();
//
// BookBuilder bookBuilder = createBookBuilder("booklet",
// prefix("item.actuallyadditions.booklet"), "<i>To be perfectly honest, I never actually realized how much content Actually Additions has before.<r><n> - Ellpeck")
// .setVersion("153")
// .setCreativeTab("actuallyadditions.tab")
// .setCustomBookItem(bookStack)
// .setBookTexture("actuallyadditions:textures/gui/booklet/booklet.png")
// .setShowProgress(false)
// .setUseBlockyFont(false)
// .setI18n(true)
// .setDontGenerateBook(true)
// .addMacro("<imp>", "$(2)")
// .addMacro("<item>", "$(9)")
// .addMacro("<r>", "$()")
// .addMacro("<n>", "$(br)")
// .addMacro("<i>", "$(o)")
// .addMacro("<tifisgrin>", "$(4)$(n)")
// .setUseResourcePack(true);
//
//
// //Getting Started
// CategoryBuilder gettingStarted = bookBuilder.addCategory("getting_started", prefix("indexEntry.getting_started"),
// "", bookStack);
//
// gettingStarted.addEntry("tutorial", prefix("chapter.book_tutorial"), bookStack)
// .addTextPage(prefix("chapter.book_tutorial.text.1")).build()
// .addTextPage(prefix("chapter.book_tutorial.text.2")).build()
// .addTextPage(prefix("chapter.book_tutorial.text.3")).build()
// .addCraftingPage(ActuallyAdditions.modLoc("booklet"))
// .setTitle("").setText("booklet.actuallyadditions.shapeless_recipe").build();
//
// gettingStarted.addEntry("guide", prefix("chapter.video_guide"), "actuallyadditions:textures/item/youtube.png")
// .addLinkPage("https://www.youtube.com/watch?v=fhjz0Ew56pM", prefix("chapter.video_guide.booty.button"))
// .setText(prefix("chapter.video_guide.booty.text.1")).build()
// .addTextPage(prefix("chapter.video_guide.booty.text.2")).build()
// .addLinkPage("https://www.youtube.com/playlist?list=PLJeFZ64pT89MrTRZYzD_rtHFajPVlt6cF", prefix("chapter.video_guide.booty.button"))
// .setText(prefix("chapter.video_guide.dire.text.1")).build()
// .addTextPage(prefix("chapter.video_guide.dire.text.2")).build();
//
// gettingStarted.addEntry("intro", prefix("chapter.intro"), bookStack)
// .addTextPage(prefix("chapter.intro.text.1")).build()
// .addTextPage(prefix("chapter.intro.text.2")).build()
// .addTextPage(prefix("chapter.intro.text.3")).build()
// .addTextPage(prefix("chapter.intro.text.4")).build();
//
// gettingStarted.addEntry("engineer_house", prefix("chapter.engineer_house"), bookStack)
// .addTextPage(prefix("chapter.engineer_house.text.1")).build()
// .addImagePage(ActuallyAdditions.modLoc("textures/gui/booklet/page_engineer_house.png"))
// .setText("booklet.actuallyadditions.chapter.engineer_house.text.2").build();
//
// EntryBuilder crystalsBuilder = gettingStarted.addEntry("crystals", prefix("chapter.crystals"), bookStack)
// .addTextPage(prefix("chapter.crystals.text.1")).build()
// .addTextPage(prefix("chapter.crystals.text.2")).build()
// .addTextPage(prefix("chapter.crystals.text.3")).build()
// .addImagePage(ActuallyAdditions.modLoc("textures/gui/booklet/page_atomic_reconstructor.png")).setBorder(false).build()
// .addTextPage(prefix("chapter.crystals.text.5")).build()
// .addCraftingPage(ActuallyAdditions.modLoc("atomic_reconstructor"))
// .setText(prefix("chapter.crystals.text.6")).build();
// crystalsBuilder.addPage(new ReconstructorPageBuilder(ActuallyAdditions.modLoc("laser/crystalize_restonia_crystal_block"), crystalsBuilder))
// .setRecipe2(ActuallyAdditions.modLoc("laser/crystalize_restonia_crystal"))
// .setText("booklet.actuallyadditions.reconstructor_recipe").build();
// crystalsBuilder.addPage(new ReconstructorPageBuilder(ActuallyAdditions.modLoc("laser/crystalize_palis_crystal_block"), crystalsBuilder))
// .setRecipe2(ActuallyAdditions.modLoc("laser/crystalize_palis_crystal"))
// .setText("booklet.actuallyadditions.reconstructor_recipe").build();
// crystalsBuilder.addPage(new ReconstructorPageBuilder(ActuallyAdditions.modLoc("laser/crystalize_diamatine_crystal_block"), crystalsBuilder))
// .setRecipe2(ActuallyAdditions.modLoc("laser/crystalize_diamatine_crystal"))
// .setText("booklet.actuallyadditions.reconstructor_recipe").build();
// crystalsBuilder.addPage(new ReconstructorPageBuilder(ActuallyAdditions.modLoc("laser/crystalize_void_crystal_block"), crystalsBuilder))
// .setRecipe2(ActuallyAdditions.modLoc("laser/crystalize_void_crystal"))
// .setText("booklet.actuallyadditions.reconstructor_recipe").build();
// crystalsBuilder.addPage(new ReconstructorPageBuilder(ActuallyAdditions.modLoc("laser/crystalize_emeradic_crystal_block"), crystalsBuilder))
// .setRecipe2(ActuallyAdditions.modLoc("laser/crystalize_emeradic_crystal"))
// .setText("booklet.actuallyadditions.reconstructor_recipe").build();
// crystalsBuilder.addPage(new ReconstructorPageBuilder(ActuallyAdditions.modLoc("laser/crystalize_enori_crystal_block"), crystalsBuilder))
// .setRecipe2(ActuallyAdditions.modLoc("laser/crystalize_enori_crystal"))
// .setText("booklet.actuallyadditions.reconstructor_recipe").build();
// crystalsBuilder.addCraftingPage(ActuallyAdditions.modLoc("decompress/restonia_crystal"))
// .setRecipe2(ActuallyAdditions.modLoc("compress/restonia_crystal_block")).build()
// .addCraftingPage(ActuallyAdditions.modLoc("decompress/palis_crystal"))
// .setRecipe2(ActuallyAdditions.modLoc("compress/palis_crystal_block")).build()
// .addCraftingPage(ActuallyAdditions.modLoc("decompress/diamatine_crystal"))
// .setRecipe2(ActuallyAdditions.modLoc("compress/diamatine_crystal_block")).build()
// .addCraftingPage(ActuallyAdditions.modLoc("decompress/void_crystal"))
// .setRecipe2(ActuallyAdditions.modLoc("compress/void_crystal_block")).build()
// .addCraftingPage(ActuallyAdditions.modLoc("decompress/emeradic_crystal"))
// .setRecipe2(ActuallyAdditions.modLoc("compress/emeradic_crystal_block")).build()
// .addCraftingPage(ActuallyAdditions.modLoc("decompress/enori_crystal"))
// .setRecipe2(ActuallyAdditions.modLoc("compress/enori_crystal_block")).build();
// crystalsBuilder.build();
//
// //End of Getting Started
//
//
// //Finish book
// bookBuilder.build(consumer);
// }
//
// private String prefix(String name) {
// return "booklet.actuallyadditions." + name;
// }
//}

View file

@ -1,7 +1,6 @@
package de.ellpeck.actuallyadditions.mod;
import net.minecraft.core.registries.BuiltInRegistries;
import net.minecraft.resources.ResourceLocation;
import net.minecraft.sounds.SoundEvent;
import net.neoforged.bus.api.IEventBus;
import net.neoforged.neoforge.registries.DeferredHolder;
@ -10,11 +9,11 @@ import net.neoforged.neoforge.registries.DeferredRegister;
public class AASounds {
public static final DeferredRegister<SoundEvent> SOUNDS = DeferredRegister.create(BuiltInRegistries.SOUND_EVENT, ActuallyAdditions.MODID);
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 DeferredHolder<SoundEvent, SoundEvent> VILLAGER_WORK_ENGINEER = SOUNDS.register("villager.work_engineer", () -> SoundEvent.createVariableRangeEvent(new ResourceLocation(ActuallyAdditions.MODID, "villager.work_engineer")));
public static DeferredHolder<SoundEvent, SoundEvent> RECONSTRUCTOR = SOUNDS.register("reconstructor", () -> SoundEvent.createVariableRangeEvent(ActuallyAdditions.modLoc("reconstructor")));
public static DeferredHolder<SoundEvent, SoundEvent> CRUSHER = SOUNDS.register("crusher", () -> SoundEvent.createVariableRangeEvent(ActuallyAdditions.modLoc("crusher")));
public static DeferredHolder<SoundEvent, SoundEvent> COFFEE_MACHINE = SOUNDS.register("coffee_machine", () -> SoundEvent.createVariableRangeEvent(ActuallyAdditions.modLoc("coffee_machine")));
public static DeferredHolder<SoundEvent, SoundEvent> DUH_DUH_DUH_DUUUH = SOUNDS.register("duh_duh_duh_duuuh", () -> SoundEvent.createVariableRangeEvent(ActuallyAdditions.modLoc("duh_duh_duh_duuuh")));
public static DeferredHolder<SoundEvent, SoundEvent> VILLAGER_WORK_ENGINEER = SOUNDS.register("villager.work_engineer", () -> SoundEvent.createVariableRangeEvent(ActuallyAdditions.modLoc("villager.work_engineer")));
public static void init(IEventBus bus) {

View file

@ -11,12 +11,13 @@
package de.ellpeck.actuallyadditions.mod;
import com.mojang.serialization.Codec;
import com.mojang.serialization.MapCodec;
import com.mojang.serialization.codecs.RecordCodecBuilder;
import de.ellpeck.actuallyadditions.api.ActuallyAdditionsAPI;
import de.ellpeck.actuallyadditions.api.ActuallyTags;
import de.ellpeck.actuallyadditions.api.farmer.IFarmerBehavior;
import de.ellpeck.actuallyadditions.mod.attachments.ActuallyAttachments;
import de.ellpeck.actuallyadditions.mod.blocks.ActuallyBlocks;
import de.ellpeck.actuallyadditions.mod.components.ActuallyComponents;
import de.ellpeck.actuallyadditions.mod.config.CommonConfig;
import de.ellpeck.actuallyadditions.mod.config.conditions.BoolConfigCondition;
import de.ellpeck.actuallyadditions.mod.crafting.ActuallyRecipes;
@ -35,7 +36,6 @@ import de.ellpeck.actuallyadditions.mod.inventory.ActuallyContainers;
import de.ellpeck.actuallyadditions.mod.items.ActuallyItems;
import de.ellpeck.actuallyadditions.mod.items.Worm;
import de.ellpeck.actuallyadditions.mod.lootmodifier.ActuallyLootModifiers;
import de.ellpeck.actuallyadditions.mod.misc.BannerHelper;
import de.ellpeck.actuallyadditions.mod.misc.apiimpl.LaserRelayConnectionHandler;
import de.ellpeck.actuallyadditions.mod.misc.apiimpl.MethodHandler;
import de.ellpeck.actuallyadditions.mod.network.PacketHandler;
@ -51,13 +51,13 @@ import net.minecraft.world.item.Items;
import net.minecraft.world.level.biome.Biome;
import net.minecraft.world.level.levelgen.GenerationStep;
import net.minecraft.world.level.levelgen.placement.PlacedFeature;
import net.neoforged.api.distmarker.Dist;
import net.neoforged.bus.api.IEventBus;
import net.neoforged.fml.ModLoadingContext;
import net.neoforged.fml.ModContainer;
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.FMLCommonSetupEvent;
import net.neoforged.fml.loading.FMLEnvironment;
import net.neoforged.neoforge.common.NeoForge;
import net.neoforged.neoforge.common.conditions.ICondition;
import net.neoforged.neoforge.common.world.BiomeModifier;
@ -90,12 +90,12 @@ public class ActuallyAdditions {
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);
private static final DeferredRegister<MapCodec<? extends ICondition>> CONDITION_CODECS = DeferredRegister.create(NeoForgeRegistries.Keys.CONDITION_CODECS, MODID);
public static final DeferredHolder<MapCodec<? extends ICondition>, MapCodec<BoolConfigCondition>> BOOL_CONFIG_CONDITION = CONDITION_CODECS.register("bool_config_condition", () -> BoolConfigCondition.CODEC);
public static final DeferredRegister<Codec<? extends BiomeModifier>> BIOME_MODIFIER_SERIALIZERS = DeferredRegister.create(NeoForgeRegistries.Keys.BIOME_MODIFIER_SERIALIZERS, MODID);
public static final Supplier<Codec<BoolConfigFeatureBiomeModifier>> BOOL_CONFIG_MODIFIER = BIOME_MODIFIER_SERIALIZERS.register("bool_config_feature_modifier", () ->
RecordCodecBuilder.create(builder -> builder.group(
public static final DeferredRegister<MapCodec<? extends BiomeModifier>> BIOME_MODIFIER_SERIALIZERS = DeferredRegister.create(NeoForgeRegistries.Keys.BIOME_MODIFIER_SERIALIZERS, MODID);
public static final Supplier<MapCodec<BoolConfigFeatureBiomeModifier>> BOOL_CONFIG_MODIFIER = BIOME_MODIFIER_SERIALIZERS.register("bool_config_feature_modifier", () ->
RecordCodecBuilder.mapCodec(builder -> builder.group(
Biome.LIST_CODEC.fieldOf("biomes").forGetter(BoolConfigFeatureBiomeModifier::biomes),
PlacedFeature.LIST_CODEC.fieldOf("features").forGetter(BoolConfigFeatureBiomeModifier::features),
GenerationStep.Decoration.CODEC.fieldOf("step").forGetter(BoolConfigFeatureBiomeModifier::step),
@ -105,8 +105,8 @@ public class ActuallyAdditions {
public static boolean commonCapsLoaded;
public ActuallyAdditions(IEventBus eventBus) {
ModLoadingContext.get().registerConfig(ModConfig.Type.COMMON, CommonConfig.COMMON_CONFIG);
public ActuallyAdditions(IEventBus eventBus, ModContainer container, Dist dist) {
container.registerConfig(ModConfig.Type.COMMON, CommonConfig.COMMON_CONFIG);
ActuallyBlocks.init(eventBus);
ActuallyItems.init(eventBus);
@ -115,9 +115,8 @@ public class ActuallyAdditions {
AASounds.init(eventBus);
ActuallyVillagers.init(eventBus);
ActuallyPOITypes.init(eventBus);
ActuallyAttachments.init(eventBus);
ActuallyComponents.init(eventBus);
ActuallyLootModifiers.init(eventBus);
BannerHelper.init(eventBus);
ActuallyContainers.CONTAINERS.register(eventBus);
ENTITIES.register(eventBus);
CONDITION_CODECS.register(eventBus);
@ -139,7 +138,7 @@ public class ActuallyAdditions {
eventBus.addListener(PacketHandler::register);
eventBus.addListener(this::setup);
if (FMLEnvironment.dist.isClient()) {
if (dist.isClient()) {
eventBus.addListener(ActuallyAdditionsClient::setup);
eventBus.addListener(ActuallyAdditionsClient::setupMenus);
eventBus.addListener(ActuallyAdditionsClient::setupSpecialRenders);
@ -167,8 +166,8 @@ public class ActuallyAdditions {
}
private void onConfigReload(ModConfigEvent event) {
Item item1 = BuiltInRegistries.ITEM.get(new ResourceLocation(CommonConfig.Other.REDSTONECONFIGURATOR.get()));
Item item2 = BuiltInRegistries.ITEM.get(new ResourceLocation(CommonConfig.Other.RELAYCONFIGURATOR.get()));
Item item1 = BuiltInRegistries.ITEM.get(ResourceLocation.tryParse(CommonConfig.Other.REDSTONECONFIGURATOR.get()));
Item item2 = BuiltInRegistries.ITEM.get(ResourceLocation.tryParse(CommonConfig.Other.RELAYCONFIGURATOR.get()));
CommonConfig.Other.redstoneConfigureItem = item1 != null?item1: Items.AIR;
CommonConfig.Other.relayConfigureItem = item2 != null?item2: Items.AIR;
}
@ -188,4 +187,8 @@ public class ActuallyAdditions {
// TODO: [port] check if this is needed
WorldData.clear();
}
public static ResourceLocation modLoc(String path) {
return ResourceLocation.fromNamespaceAndPath(MODID, path);
}
}

View file

@ -11,12 +11,42 @@
package de.ellpeck.actuallyadditions.mod;
import de.ellpeck.actuallyadditions.mod.blocks.ActuallyBlocks;
import de.ellpeck.actuallyadditions.mod.blocks.render.*;
import de.ellpeck.actuallyadditions.mod.blocks.render.ReconstructorRenderer;
import de.ellpeck.actuallyadditions.mod.blocks.render.RenderBatteryBox;
import de.ellpeck.actuallyadditions.mod.blocks.render.RenderDisplayStand;
import de.ellpeck.actuallyadditions.mod.blocks.render.RenderEmpowerer;
import de.ellpeck.actuallyadditions.mod.blocks.render.RenderLaserRelay;
import de.ellpeck.actuallyadditions.mod.entity.RenderWorm;
import de.ellpeck.actuallyadditions.mod.event.ClientEvents;
import de.ellpeck.actuallyadditions.mod.fluids.InitFluids;
import de.ellpeck.actuallyadditions.mod.inventory.ActuallyContainers;
import de.ellpeck.actuallyadditions.mod.inventory.gui.*;
import de.ellpeck.actuallyadditions.mod.inventory.gui.CrusherScreen;
import de.ellpeck.actuallyadditions.mod.inventory.gui.GuiBioReactor;
import de.ellpeck.actuallyadditions.mod.inventory.gui.GuiBreaker;
import de.ellpeck.actuallyadditions.mod.inventory.gui.GuiCanolaPress;
import de.ellpeck.actuallyadditions.mod.inventory.gui.GuiCoalGenerator;
import de.ellpeck.actuallyadditions.mod.inventory.gui.GuiCoffeeMachine;
import de.ellpeck.actuallyadditions.mod.inventory.gui.GuiDirectionalBreaker;
import de.ellpeck.actuallyadditions.mod.inventory.gui.GuiDrill;
import de.ellpeck.actuallyadditions.mod.inventory.gui.GuiDropper;
import de.ellpeck.actuallyadditions.mod.inventory.gui.GuiEnergizer;
import de.ellpeck.actuallyadditions.mod.inventory.gui.GuiEnervator;
import de.ellpeck.actuallyadditions.mod.inventory.gui.GuiFarmer;
import de.ellpeck.actuallyadditions.mod.inventory.gui.GuiFeeder;
import de.ellpeck.actuallyadditions.mod.inventory.gui.GuiFermentingBarrel;
import de.ellpeck.actuallyadditions.mod.inventory.gui.GuiFilter;
import de.ellpeck.actuallyadditions.mod.inventory.gui.GuiFireworkBox;
import de.ellpeck.actuallyadditions.mod.inventory.gui.GuiFluidCollector;
import de.ellpeck.actuallyadditions.mod.inventory.gui.GuiFurnaceDouble;
import de.ellpeck.actuallyadditions.mod.inventory.gui.GuiLaserRelayItemWhitelist;
import de.ellpeck.actuallyadditions.mod.inventory.gui.GuiMiner;
import de.ellpeck.actuallyadditions.mod.inventory.gui.GuiOilGenerator;
import de.ellpeck.actuallyadditions.mod.inventory.gui.GuiPhantomPlacer;
import de.ellpeck.actuallyadditions.mod.inventory.gui.GuiRangedCollector;
import de.ellpeck.actuallyadditions.mod.inventory.gui.GuiXPSolidifier;
import de.ellpeck.actuallyadditions.mod.inventory.gui.ItemTagScreen;
import de.ellpeck.actuallyadditions.mod.inventory.gui.SackGui;
import de.ellpeck.actuallyadditions.mod.inventory.gui.VoidSackGui;
import de.ellpeck.actuallyadditions.mod.items.ActuallyItems;
import de.ellpeck.actuallyadditions.mod.misc.special.SpecialRenderInit;
import de.ellpeck.actuallyadditions.mod.particle.ActuallyParticles;
@ -30,7 +60,6 @@ import net.minecraft.client.renderer.RenderType;
import net.minecraft.client.renderer.item.ItemProperties;
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.neoforged.fml.event.lifecycle.FMLClientSetupEvent;
import net.neoforged.neoforge.client.event.EntityRenderersEvent;
@ -75,7 +104,7 @@ public class ActuallyAdditionsClient {
NeoForge.EVENT_BUS.register(new SpecialRenderInit());
event.enqueueWork(() ->
ItemProperties.register(ActuallyItems.WORM.get(), new ResourceLocation(ActuallyAdditions.MODID, "snail"),
ItemProperties.register(ActuallyItems.WORM.get(), ActuallyAdditions.modLoc("snail"),
(stack, level, entity, tintIndex) -> "snail mail".equalsIgnoreCase(stack.getHoverName().getString()) ? 1F : 0F));
setupRenderLayers();

View file

@ -1,9 +1,7 @@
package de.ellpeck.actuallyadditions.mod;
import de.ellpeck.actuallyadditions.mod.attachments.ActuallyAttachments;
import de.ellpeck.actuallyadditions.mod.items.ActuallyItems;
import de.ellpeck.actuallyadditions.mod.items.base.ItemEnergy;
import de.ellpeck.actuallyadditions.mod.tile.CustomEnergyStorage;
import net.minecraft.core.registries.Registries;
import net.minecraft.network.chat.Component;
import net.minecraft.world.item.CreativeModeTab;
@ -31,10 +29,10 @@ public class ActuallyTabs {
.filter(stack -> stack.getItem() instanceof ItemEnergy).toList();
charged.forEach(stack -> {
if(stack.getItem() instanceof ItemEnergy itemEnergy) {
CustomEnergyStorage storage = new CustomEnergyStorage(itemEnergy.maxPower, itemEnergy.transfer, itemEnergy.transfer);
storage.setEnergyStored(itemEnergy.maxPower);
stack.setData(ActuallyAttachments.ENERGY_STORAGE.get(), storage);
stack.getOrCreateTag().putBoolean("Charged", true);
// CustomEnergyStorage storage = new CustomEnergyStorage(itemEnergy.maxPower, itemEnergy.transfer, itemEnergy.transfer);
// storage.setEnergyStored(itemEnergy.maxPower);
// stack.setData(ActuallyComponents.ENERGY_STORAGE.get(), storage);
// stack.getOrCreateTag().putBoolean("Charged", true); TODO: IMPORTANT: ADD BACK THE CREATIVE ITEMS!
}
});
stacks.addAll(charged);

View file

@ -49,7 +49,7 @@ public class ClientRegistryHandler {
@SubscribeEvent
public void onModelBake(BakingCompleted e) {
// ModelResourceLocation mrl = new ModelResourceLocation(new ResourceLocation(ActuallyAdditions.MODID, "block_compost"), "normal");
// ModelResourceLocation mrl = new ModelResourceLocation(ActuallyAdditions.modLoc("block_compost"), "normal");
// CompostModel.compostBase = e.getModelRegistry().getObject(mrl);
// e.getModelRegistry().putObject(mrl, new ActualCompostModel());
}

View file

@ -1,48 +0,0 @@
package de.ellpeck.actuallyadditions.mod.attachments;
import de.ellpeck.actuallyadditions.mod.ActuallyAdditions;
import de.ellpeck.actuallyadditions.mod.items.base.ItemEnergy;
import de.ellpeck.actuallyadditions.mod.tile.CustomEnergyStorage;
import net.minecraft.world.item.ItemStack;
import net.neoforged.bus.api.IEventBus;
import net.neoforged.neoforge.attachment.AttachmentType;
import net.neoforged.neoforge.registries.DeferredRegister;
import net.neoforged.neoforge.registries.NeoForgeRegistries;
import java.util.function.Supplier;
public class ActuallyAttachments {
private static final DeferredRegister<AttachmentType<?>> ATTACHMENT_TYPES = DeferredRegister.create(NeoForgeRegistries.Keys.ATTACHMENT_TYPES, ActuallyAdditions.MODID);
public static final Supplier<AttachmentType<CustomEnergyStorage>> ENERGY_STORAGE = ATTACHMENT_TYPES.register(
"energy", ActuallyAttachments.itemEnergyStorageAttachment());
public static final Supplier<AttachmentType<ItemTagAttachment>> ITEM_TAG = ATTACHMENT_TYPES.register(
"item_tag", () -> AttachmentType.serializable(ItemTagAttachment::new).build());
/*
* This is a supplier for an attachment type that can be used to attach an energy storage to an item.
* Implementation is based on EnderIO's https://github.com/Team-EnderIO/EnderIO/blob/e1f022df745131ed5fea718bd860880a5785d4c7/src/core/java/com/enderio/core/common/attachment/AttachmentUtil.java#L47-L60
*/
public static Supplier<AttachmentType<CustomEnergyStorage>> itemEnergyStorageAttachment() {
return () -> AttachmentType.serializable(holder -> {
if (holder instanceof ItemStack itemStack) {
int capacity = 1000;
int maxTransfer = 1000;
if (itemStack.getItem() instanceof ItemEnergy itemEnergy) {
capacity = itemEnergy.maxPower;
maxTransfer = itemEnergy.transfer;
}
return new CustomEnergyStorage(capacity, maxTransfer, maxTransfer);
} else {
throw new IllegalStateException("Cannot attach energy handler item to a non-item.");
}
}).build();
}
public static void init(IEventBus evt) {
ATTACHMENT_TYPES.register(evt);
}
}

View file

@ -1,41 +0,0 @@
package de.ellpeck.actuallyadditions.mod.attachments;
import net.minecraft.core.registries.Registries;
import net.minecraft.nbt.CompoundTag;
import net.minecraft.resources.ResourceLocation;
import net.minecraft.tags.TagKey;
import net.minecraft.world.item.Item;
import net.neoforged.neoforge.common.util.INBTSerializable;
import javax.annotation.Nonnull;
import javax.annotation.Nullable;
import java.util.Optional;
public class ItemTagAttachment implements INBTSerializable<CompoundTag> {
private TagKey<Item> tag;
@Override
public CompoundTag serializeNBT() {
CompoundTag nbt = new CompoundTag();
if (tag != null) {
nbt.putString("tag", tag.location().toString());
}
return nbt;
}
@Override
public void deserializeNBT(@Nonnull CompoundTag nbt) {
if (nbt.contains("tag")) {
tag = TagKey.create(Registries.ITEM, new ResourceLocation(nbt.getString("tag")));
}
}
public Optional<TagKey<Item>> getTag() {
return Optional.ofNullable(tag);
}
public void setTag(@Nullable TagKey<Item> tag) {
this.tag = tag;
}
}

View file

@ -1,12 +1,12 @@
package de.ellpeck.actuallyadditions.mod.blocks;
import net.minecraft.nbt.CompoundTag;
import net.minecraft.core.component.DataComponents;
import net.minecraft.network.chat.Component;
import net.minecraft.world.item.BlockItem;
import net.minecraft.world.item.ItemNameBlockItem;
import net.minecraft.world.item.ItemStack;
import net.minecraft.world.item.TooltipFlag;
import net.minecraft.world.level.Level;
import net.minecraft.world.item.component.CustomData;
import net.minecraft.world.level.block.Block;
import javax.annotation.Nullable;
@ -35,14 +35,14 @@ public class AABlockItem extends BlockItem {
}
@Override
public void appendHoverText(ItemStack pStack, @Nullable Level pLevel, List<Component> pTooltip, TooltipFlag pFlag) {
super.appendHoverText(pStack, pLevel, pTooltip, pFlag);
public void appendHoverText(ItemStack pStack, @Nullable TooltipContext pContext, List<Component> pTooltip, TooltipFlag pFlag) {
super.appendHoverText(pStack, pContext, pTooltip, pFlag);
if (pStack.hasTag() && pStack.getTag().contains("BlockEntityTag")) {
CompoundTag BET = pStack.getTag().getCompound("BlockEntityTag");
if (pStack.has(DataComponents.BLOCK_ENTITY_DATA)) {
CustomData customData = pStack.get(DataComponents.BLOCK_ENTITY_DATA);
int energy = 0;
if (BET.contains("Energy")) {
energy = BET.getInt("Energy");
if (customData.contains("Energy")) {
energy = customData.copyTag().getInt("Energy");
}
NumberFormat format = NumberFormat.getInstance();
pTooltip.add(Component.translatable("misc.actuallyadditions.power_single", format.format(energy)));

View file

@ -6,8 +6,6 @@ import net.minecraft.world.level.block.SlabBlock;
import net.minecraft.world.level.block.StairBlock;
import net.minecraft.world.level.block.state.BlockState;
import java.util.function.Supplier;
/**
* Using a custom class here to declare common rules between all of our blocks.
* This also provides a simple instance of check for our blocks.
@ -30,7 +28,7 @@ public class ActuallyBlock extends Block implements IActuallyBlock {
}
public static class Stairs extends StairBlock implements IActuallyBlock {
public Stairs(Supplier<BlockState> state, Properties properties) {
public Stairs(BlockState state, Properties properties) {
super(state, properties);
}

View file

@ -14,7 +14,54 @@ 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.metalists.Crystals;
import de.ellpeck.actuallyadditions.mod.tile.*;
import de.ellpeck.actuallyadditions.mod.tile.CrateBE;
import de.ellpeck.actuallyadditions.mod.tile.TileEntityAtomicReconstructor;
import de.ellpeck.actuallyadditions.mod.tile.TileEntityBase;
import de.ellpeck.actuallyadditions.mod.tile.TileEntityBatteryBox;
import de.ellpeck.actuallyadditions.mod.tile.TileEntityBioReactor;
import de.ellpeck.actuallyadditions.mod.tile.TileEntityBreaker;
import de.ellpeck.actuallyadditions.mod.tile.TileEntityCanolaPress;
import de.ellpeck.actuallyadditions.mod.tile.TileEntityCoalGenerator;
import de.ellpeck.actuallyadditions.mod.tile.TileEntityCoffeeMachine;
import de.ellpeck.actuallyadditions.mod.tile.TileEntityCrusher;
import de.ellpeck.actuallyadditions.mod.tile.TileEntityCrusherDouble;
import de.ellpeck.actuallyadditions.mod.tile.TileEntityDisplayStand;
import de.ellpeck.actuallyadditions.mod.tile.TileEntityDropper;
import de.ellpeck.actuallyadditions.mod.tile.TileEntityEmpowerer;
import de.ellpeck.actuallyadditions.mod.tile.TileEntityEnergizer;
import de.ellpeck.actuallyadditions.mod.tile.TileEntityEnervator;
import de.ellpeck.actuallyadditions.mod.tile.TileEntityFarmer;
import de.ellpeck.actuallyadditions.mod.tile.TileEntityFeeder;
import de.ellpeck.actuallyadditions.mod.tile.TileEntityFermentingBarrel;
import de.ellpeck.actuallyadditions.mod.tile.TileEntityFireworkBox;
import de.ellpeck.actuallyadditions.mod.tile.TileEntityFluidCollector;
import de.ellpeck.actuallyadditions.mod.tile.TileEntityFluidPlacer;
import de.ellpeck.actuallyadditions.mod.tile.TileEntityHeatCollector;
import de.ellpeck.actuallyadditions.mod.tile.TileEntityItemInterface;
import de.ellpeck.actuallyadditions.mod.tile.TileEntityItemInterfaceHopping;
import de.ellpeck.actuallyadditions.mod.tile.TileEntityLaserRelayEnergy;
import de.ellpeck.actuallyadditions.mod.tile.TileEntityLaserRelayEnergyAdvanced;
import de.ellpeck.actuallyadditions.mod.tile.TileEntityLaserRelayEnergyExtreme;
import de.ellpeck.actuallyadditions.mod.tile.TileEntityLaserRelayFluids;
import de.ellpeck.actuallyadditions.mod.tile.TileEntityLaserRelayItem;
import de.ellpeck.actuallyadditions.mod.tile.TileEntityLaserRelayItemAdvanced;
import de.ellpeck.actuallyadditions.mod.tile.TileEntityLavaFactoryController;
import de.ellpeck.actuallyadditions.mod.tile.TileEntityLeafGenerator;
import de.ellpeck.actuallyadditions.mod.tile.TileEntityLongRangeBreaker;
import de.ellpeck.actuallyadditions.mod.tile.TileEntityOilGenerator;
import de.ellpeck.actuallyadditions.mod.tile.TileEntityPhantomBreaker;
import de.ellpeck.actuallyadditions.mod.tile.TileEntityPhantomEnergyface;
import de.ellpeck.actuallyadditions.mod.tile.TileEntityPhantomItemface;
import de.ellpeck.actuallyadditions.mod.tile.TileEntityPhantomLiquiface;
import de.ellpeck.actuallyadditions.mod.tile.TileEntityPhantomPlacer;
import de.ellpeck.actuallyadditions.mod.tile.TileEntityPhantomRedstoneface;
import de.ellpeck.actuallyadditions.mod.tile.TileEntityPlacer;
import de.ellpeck.actuallyadditions.mod.tile.TileEntityPlayerInterface;
import de.ellpeck.actuallyadditions.mod.tile.TileEntityPoweredFurnace;
import de.ellpeck.actuallyadditions.mod.tile.TileEntityRangedCollector;
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;
@ -252,13 +299,13 @@ public final class ActuallyBlocks {
//Stairs
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));
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));

View file

@ -19,17 +19,17 @@ import net.minecraft.ChatFormatting;
import net.minecraft.client.Minecraft;
import net.minecraft.client.gui.GuiGraphics;
import net.minecraft.core.BlockPos;
import net.minecraft.nbt.CompoundTag;
import net.minecraft.core.component.DataComponents;
import net.minecraft.network.chat.Component;
import net.minecraft.util.Mth;
import net.minecraft.util.RandomSource;
import net.minecraft.world.InteractionHand;
import net.minecraft.world.InteractionResult;
import net.minecraft.world.ItemInteractionResult;
import net.minecraft.world.entity.player.Player;
import net.minecraft.world.item.Item;
import net.minecraft.world.item.ItemStack;
import net.minecraft.world.item.TooltipFlag;
import net.minecraft.world.level.BlockGetter;
import net.minecraft.world.item.component.CustomData;
import net.minecraft.world.level.Level;
import net.minecraft.world.level.block.Block;
import net.minecraft.world.level.block.entity.BlockEntity;
@ -40,10 +40,6 @@ 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.minecraft.world.phys.shapes.CollisionContext;
import net.minecraft.world.phys.shapes.VoxelShape;
import net.neoforged.api.distmarker.Dist;
import net.neoforged.api.distmarker.OnlyIn;
import javax.annotation.Nonnull;
import javax.annotation.Nullable;
@ -61,10 +57,10 @@ public class BlockAtomicReconstructor extends FullyDirectionalBlock.Container im
}
@Override
public InteractionResult use(BlockState state, Level world, BlockPos pos, Player player, InteractionHand hand, BlockHitResult hit) {
protected ItemInteractionResult useItemOn(ItemStack pStack, BlockState pState, Level world, BlockPos pos, Player player, InteractionHand hand, BlockHitResult pHitResult) {
ItemStack heldItem = player.getItemInHand(hand);
if (this.tryToggleRedstone(world, pos, player)) {
return InteractionResult.SUCCESS;
return ItemInteractionResult.SUCCESS;
}
if (!world.isClientSide) {
TileEntityAtomicReconstructor reconstructor = (TileEntityAtomicReconstructor) world.getBlockEntity(pos);
@ -78,20 +74,20 @@ public class BlockAtomicReconstructor extends FullyDirectionalBlock.Container im
if (!player.isCreative()) {
heldItem.shrink(1);
}
return InteractionResult.CONSUME;
return ItemInteractionResult.CONSUME;
}
} else {
ItemStack slot = reconstructor.inv.getStackInSlot(0);
if (!slot.isEmpty() && hand == InteractionHand.MAIN_HAND) {
player.setItemInHand(hand, slot.copy());
reconstructor.inv.setStackInSlot(0, ItemStack.EMPTY);
return InteractionResult.CONSUME;
return ItemInteractionResult.CONSUME;
}
}
}
return InteractionResult.FAIL;
return ItemInteractionResult.FAIL;
}
return InteractionResult.CONSUME;
return ItemInteractionResult.CONSUME;
}
/* @Override
@ -125,7 +121,7 @@ public class BlockAtomicReconstructor extends FullyDirectionalBlock.Container im
}
@Override
@OnlyIn(Dist.CLIENT)
public void displayHud(GuiGraphics guiGraphics, Minecraft minecraft, Player player, ItemStack stack, HitResult rayCast, Window resolution) {
if (!(rayCast instanceof BlockHitResult) || minecraft.level == null) {
return;
@ -158,10 +154,10 @@ public class BlockAtomicReconstructor extends FullyDirectionalBlock.Container im
block = blockIn;
}
@OnlyIn(Dist.CLIENT)
@Override
public void appendHoverText(@Nonnull ItemStack pStack, @Nullable Level pLevel, @Nonnull List<Component> pTooltip, @Nonnull TooltipFlag pFlag) {
super.appendHoverText(pStack, pLevel, pTooltip, pFlag);
public void appendHoverText(@Nonnull ItemStack pStack, @Nullable TooltipContext context, @Nonnull List<Component> pTooltip, @Nonnull TooltipFlag pFlag) {
super.appendHoverText(pStack, context, pTooltip, pFlag);
long sysTime = System.currentTimeMillis();
@ -177,18 +173,18 @@ public class BlockAtomicReconstructor extends FullyDirectionalBlock.Container im
String base = block.getDescriptionId() + ".info.";
pTooltip.add(Component.translatable(base + "1." + this.toPick1).append(" ").append(Component.translatable(base + "2." + this.toPick2)).withStyle(s -> s.withColor(ChatFormatting.GRAY)));
if (pStack.hasTag() && pStack.getTag().contains("BlockEntityTag")) {
CompoundTag BET = pStack.getTag().getCompound("BlockEntityTag");
if (pStack.has(DataComponents.CUSTOM_DATA) ) {
CustomData customData = pStack.get(DataComponents.CUSTOM_DATA);
int energy = 0;
if (BET.contains("Energy")) {
energy = BET.getInt("Energy");
if (customData.contains("Energy")) {
energy = customData.copyTag().getInt("Energy");
}
NumberFormat format = NumberFormat.getInstance();
pTooltip.add(Component.translatable("misc.actuallyadditions.power_single", format.format(energy)).withStyle(ChatFormatting.GRAY));
if (BET.contains("IsPulseMode")) {
if (customData.contains("IsPulseMode")) {
pTooltip.add(Component.translatable("info.actuallyadditions.redstoneMode").append(": ")
.append(Component.translatable(BET.getBoolean("IsPulseMode")?"info.actuallyadditions.redstoneMode.pulse":"info.actuallyadditions.redstoneMode.deactivation").withStyle($ -> $.withColor(ChatFormatting.RED))));
.append(Component.translatable(customData.copyTag().getBoolean("IsPulseMode")?"info.actuallyadditions.redstoneMode.pulse":"info.actuallyadditions.redstoneMode.deactivation").withStyle($ -> $.withColor(ChatFormatting.RED))));
}
}
}

View file

@ -15,7 +15,7 @@ import de.ellpeck.actuallyadditions.mod.items.ItemBattery;
import de.ellpeck.actuallyadditions.mod.tile.TileEntityBatteryBox;
import net.minecraft.core.BlockPos;
import net.minecraft.world.InteractionHand;
import net.minecraft.world.InteractionResult;
import net.minecraft.world.ItemInteractionResult;
import net.minecraft.world.entity.player.Player;
import net.minecraft.world.item.ItemStack;
import net.minecraft.world.level.BlockGetter;
@ -58,7 +58,7 @@ public class BlockBatteryBox extends BlockContainerBase {
}
@Override
public InteractionResult use(BlockState state, Level world, BlockPos pos, Player player, InteractionHand hand, BlockHitResult hit) {
protected ItemInteractionResult useItemOn(ItemStack pStack, BlockState pState, Level world, BlockPos pos, Player player, InteractionHand hand, BlockHitResult pHitResult) {
BlockEntity tile = world.getBlockEntity(pos);
if (tile instanceof TileEntityBatteryBox box) {
ItemStack stack = player.getItemInHand(hand);
@ -67,17 +67,17 @@ public class BlockBatteryBox extends BlockContainerBase {
if (stack.getItem() instanceof ItemBattery && box.inv.getStackInSlot(0).isEmpty()) {
box.inv.setStackInSlot(0, stack.copy());
player.setItemInHand(hand, ItemStack.EMPTY);
return InteractionResult.SUCCESS;
return ItemInteractionResult.SUCCESS;
}
} else {
ItemStack inSlot = box.inv.getStackInSlot(0);
if (!inSlot.isEmpty()) {
player.setItemInHand(hand, inSlot.copy());
box.inv.setStackInSlot(0, ItemStack.EMPTY);
return InteractionResult.SUCCESS;
return ItemInteractionResult.SUCCESS;
}
}
}
return InteractionResult.PASS;
return ItemInteractionResult.PASS_TO_DEFAULT_BLOCK_INTERACTION;
}
}

View file

@ -13,23 +13,17 @@ package de.ellpeck.actuallyadditions.mod.blocks;
import de.ellpeck.actuallyadditions.mod.blocks.base.DirectionalBlock;
import de.ellpeck.actuallyadditions.mod.tile.TileEntityBioReactor;
import net.minecraft.core.BlockPos;
import net.minecraft.world.InteractionHand;
import net.minecraft.world.InteractionResult;
import net.minecraft.world.entity.player.Player;
import net.minecraft.world.level.BlockGetter;
import net.minecraft.world.level.Level;
import net.minecraft.world.level.block.entity.BlockEntity;
import net.minecraft.world.level.block.entity.BlockEntityTicker;
import net.minecraft.world.level.block.entity.BlockEntityType;
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 javax.annotation.Nullable;
import static net.minecraft.world.level.block.state.properties.BlockStateProperties.HORIZONTAL_FACING;
public class BlockBioReactor extends DirectionalBlock.Container {
public BlockBioReactor() {
@ -49,7 +43,7 @@ public class BlockBioReactor extends DirectionalBlock.Container {
}
@Override
public InteractionResult use(BlockState state, Level world, BlockPos pos, Player player, InteractionHand hand, BlockHitResult hit) {
protected InteractionResult useWithoutItem(BlockState pState, Level world, BlockPos pos, Player player, BlockHitResult pHitResult) {
return this.openGui(world, player, pos, TileEntityBioReactor.class);
}

View file

@ -14,18 +14,14 @@ import de.ellpeck.actuallyadditions.mod.blocks.base.FullyDirectionalBlock;
import de.ellpeck.actuallyadditions.mod.tile.TileEntityBreaker;
import de.ellpeck.actuallyadditions.mod.tile.TileEntityPlacer;
import net.minecraft.core.BlockPos;
import net.minecraft.world.InteractionHand;
import net.minecraft.world.InteractionResult;
import net.minecraft.world.entity.player.Player;
import net.minecraft.world.level.BlockGetter;
import net.minecraft.world.level.Level;
import net.minecraft.world.level.block.entity.BlockEntity;
import net.minecraft.world.level.block.entity.BlockEntityTicker;
import net.minecraft.world.level.block.entity.BlockEntityType;
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 javax.annotation.Nullable;
@ -55,7 +51,7 @@ public class BlockBreaker extends FullyDirectionalBlock.Container {
}
@Override
public InteractionResult use(BlockState state, Level world, BlockPos pos, Player player, InteractionHand handIn, BlockHitResult hit) {
protected InteractionResult useWithoutItem(BlockState pState, Level world, BlockPos pos, Player player, BlockHitResult pHitResult) {
if (this.tryToggleRedstone(world, pos, player)) {
return InteractionResult.SUCCESS;
}

View file

@ -14,8 +14,9 @@ import de.ellpeck.actuallyadditions.mod.blocks.base.BlockContainerBase;
import de.ellpeck.actuallyadditions.mod.tile.TileEntityCanolaPress;
import net.minecraft.core.BlockPos;
import net.minecraft.world.InteractionHand;
import net.minecraft.world.InteractionResult;
import net.minecraft.world.ItemInteractionResult;
import net.minecraft.world.entity.player.Player;
import net.minecraft.world.item.ItemStack;
import net.minecraft.world.level.BlockGetter;
import net.minecraft.world.level.Level;
import net.minecraft.world.level.block.entity.BlockEntity;
@ -53,18 +54,18 @@ public class BlockCanolaPress extends BlockContainerBase {
}
@Override
public InteractionResult use(BlockState state, Level world, BlockPos pos, Player player, InteractionHand hand, BlockHitResult hit) {
protected ItemInteractionResult useItemOn(ItemStack pStack, BlockState pState, Level world, BlockPos pos, Player player, InteractionHand hand, BlockHitResult pHitResult) {
TileEntityCanolaPress tile = (TileEntityCanolaPress) world.getBlockEntity(pos);
if (tile == null)
return InteractionResult.PASS; //TODO this logic all needs to be rechecked...
return ItemInteractionResult.PASS_TO_DEFAULT_BLOCK_INTERACTION; //TODO this logic all needs to be rechecked...
if (world.isClientSide)
return InteractionResult.SUCCESS;
return ItemInteractionResult.SUCCESS;
if (!player.isShiftKeyDown()) {
if (!FluidUtil.interactWithFluidHandler(player, hand, tile.tank))
player.openMenu(tile, pos);
return InteractionResult.SUCCESS;
return ItemInteractionResult.SUCCESS;
}
return InteractionResult.PASS;
return ItemInteractionResult.PASS_TO_DEFAULT_BLOCK_INTERACTION;
}
@Override

View file

@ -16,7 +16,6 @@ import net.minecraft.core.BlockPos;
import net.minecraft.core.particles.ParticleTypes;
import net.minecraft.server.level.ServerLevel;
import net.minecraft.util.RandomSource;
import net.minecraft.world.InteractionHand;
import net.minecraft.world.InteractionResult;
import net.minecraft.world.entity.player.Player;
import net.minecraft.world.level.BlockGetter;
@ -61,7 +60,7 @@ public class BlockCoalGenerator extends DirectionalBlock.Container {
}
@Override
public InteractionResult use(BlockState state, Level world, BlockPos pos, Player player, InteractionHand hand, BlockHitResult hit) {
protected InteractionResult useWithoutItem(BlockState pState, Level world, BlockPos pos, Player player, BlockHitResult pHitResult) {
return this.openGui(world, player, pos, TileEntityCoalGenerator.class);
}

View file

@ -14,8 +14,9 @@ import de.ellpeck.actuallyadditions.mod.blocks.base.DirectionalBlock;
import de.ellpeck.actuallyadditions.mod.tile.TileEntityCoffeeMachine;
import net.minecraft.core.BlockPos;
import net.minecraft.world.InteractionHand;
import net.minecraft.world.InteractionResult;
import net.minecraft.world.ItemInteractionResult;
import net.minecraft.world.entity.player.Player;
import net.minecraft.world.item.ItemStack;
import net.minecraft.world.level.BlockGetter;
import net.minecraft.world.level.Level;
import net.minecraft.world.level.block.entity.BlockEntity;
@ -34,9 +35,9 @@ public class BlockCoffeeMachine extends DirectionalBlock.Container {
}
@Override
public InteractionResult use(BlockState state, Level world, BlockPos pos, Player player, InteractionHand hand, BlockHitResult hit) {
protected ItemInteractionResult useItemOn(ItemStack pStack, BlockState pState, Level world, BlockPos pos, Player player, InteractionHand hand, BlockHitResult pHitResult) {
if (world.isClientSide) {
return InteractionResult.SUCCESS;
return ItemInteractionResult.SUCCESS;
} else {
TileEntityCoffeeMachine tile = (TileEntityCoffeeMachine) world.getBlockEntity(pos);
if (tile != null) {
@ -44,7 +45,7 @@ public class BlockCoffeeMachine extends DirectionalBlock.Container {
player.openMenu(tile, pos);
}
}
return InteractionResult.CONSUME;
return ItemInteractionResult.CONSUME;
}
}

View file

@ -14,7 +14,7 @@ import de.ellpeck.actuallyadditions.mod.blocks.base.BlockBase;
import de.ellpeck.actuallyadditions.mod.util.StackUtil;
import net.minecraft.core.BlockPos;
import net.minecraft.world.InteractionHand;
import net.minecraft.world.InteractionResult;
import net.minecraft.world.ItemInteractionResult;
import net.minecraft.world.entity.player.Player;
import net.minecraft.world.item.DyeColor;
import net.minecraft.world.item.DyeItem;
@ -66,18 +66,18 @@ public class BlockColoredLamp extends BlockBase {
}
@Override
public InteractionResult use(BlockState state, Level world, BlockPos pos, Player player, InteractionHand hand, BlockHitResult hit) {
protected ItemInteractionResult useItemOn(ItemStack pStack, BlockState state, Level world, BlockPos pos, Player player, InteractionHand hand, BlockHitResult pHitResult) {
ItemStack stack = player.getItemInHand(hand);
//Turning On
if (hand == InteractionHand.MAIN_HAND && stack.isEmpty()) {
world.setBlock(pos, this.defaultBlockState().setValue(LIT, !state.getValue(LIT)), Block.UPDATE_INVISIBLE);
return InteractionResult.PASS;
return ItemInteractionResult.PASS_TO_DEFAULT_BLOCK_INTERACTION;
}
if (StackUtil.isValid(stack) && stack.getItem() instanceof DyeItem) {
DyeColor color = DyeColor.getColor(stack);
if (color == null) {
return InteractionResult.FAIL;
return ItemInteractionResult.FAIL;
}
Block newColor = COLOR_TO_LAMP.get(color).get();
@ -88,7 +88,7 @@ public class BlockColoredLamp extends BlockBase {
}
}
}
return super.use(state, world, pos, player, hand, hit);
return super.useItemOn(pStack, state, world, pos, player, hand, pHitResult);
}
@Override

View file

@ -18,7 +18,6 @@ import net.minecraft.core.Direction;
import net.minecraft.core.particles.ParticleTypes;
import net.minecraft.server.level.ServerLevel;
import net.minecraft.util.RandomSource;
import net.minecraft.world.InteractionHand;
import net.minecraft.world.InteractionResult;
import net.minecraft.world.entity.player.Player;
import net.minecraft.world.item.context.BlockPlaceContext;
@ -32,8 +31,6 @@ import net.minecraft.world.level.block.state.BlockState;
import net.minecraft.world.level.block.state.StateDefinition;
import net.minecraft.world.level.block.state.properties.BlockStateProperties;
import net.minecraft.world.phys.BlockHitResult;
import net.minecraft.world.phys.shapes.CollisionContext;
import net.minecraft.world.phys.shapes.VoxelShape;
import javax.annotation.Nullable;
@ -78,7 +75,7 @@ public class BlockCrusher extends BlockContainerBase {
}
@Override
public InteractionResult use(BlockState state, Level world, BlockPos pos, Player player, InteractionHand handIn, BlockHitResult hit) {
protected InteractionResult useWithoutItem(BlockState pState, Level world, BlockPos pos, Player player, BlockHitResult pHitResult) {
if (this.isDouble) {
return this.openGui(world, player, pos, TileEntityCrusherDouble.class);
}

View file

@ -18,7 +18,7 @@ import de.ellpeck.actuallyadditions.mod.util.ItemUtil;
import de.ellpeck.actuallyadditions.mod.util.StackUtil;
import net.minecraft.core.BlockPos;
import net.minecraft.world.InteractionHand;
import net.minecraft.world.InteractionResult;
import net.minecraft.world.ItemInteractionResult;
import net.minecraft.world.entity.player.Player;
import net.minecraft.world.item.ItemStack;
import net.minecraft.world.level.BlockGetter;
@ -61,7 +61,7 @@ public class BlockDisplayStand extends BlockContainerBase {
}
@Override
public InteractionResult use(BlockState state, Level world, BlockPos pos, Player player, InteractionHand hand, BlockHitResult hit) {
protected ItemInteractionResult useItemOn(ItemStack pStack, BlockState pState, Level world, BlockPos pos, Player player, InteractionHand hand, BlockHitResult pHitResult) {
ItemStack heldItem = player.getItemInHand(hand);
if (!world.isClientSide) {
TileEntityInventoryBase stand = (TileEntityInventoryBase) world.getBlockEntity(pos);
@ -76,7 +76,7 @@ public class BlockDisplayStand extends BlockContainerBase {
heldItem.shrink(1);
else
player.swing(hand, true);
return InteractionResult.SUCCESS;
return ItemInteractionResult.SUCCESS;
} else if (ItemUtil.canBeStacked(heldItem, stackThere)) {
int maxTransfer = Math.min(stackThere.getCount(), heldItem.getMaxStackSize() - heldItem.getCount());
if (maxTransfer > 0) {
@ -87,21 +87,21 @@ public class BlockDisplayStand extends BlockContainerBase {
ItemStack newStackThere = stackThere.copy();
newStackThere.shrink(maxTransfer);
stand.inv.setStackInSlot(0, newStackThere);
return InteractionResult.SUCCESS;
return ItemInteractionResult.SUCCESS;
}
}
} else {
if (!stackThere.isEmpty() && hand == InteractionHand.MAIN_HAND) {
player.setItemInHand(hand, stackThere.copy());
stand.inv.setStackInSlot(0, ItemStack.EMPTY);
return InteractionResult.CONSUME;
return ItemInteractionResult.CONSUME;
}
}
}
return InteractionResult.FAIL;
return ItemInteractionResult.FAIL;
}
return InteractionResult.CONSUME;
return ItemInteractionResult.CONSUME;
}
/* @Override

View file

@ -13,18 +13,14 @@ package de.ellpeck.actuallyadditions.mod.blocks;
import de.ellpeck.actuallyadditions.mod.blocks.base.FullyDirectionalBlock;
import de.ellpeck.actuallyadditions.mod.tile.TileEntityDropper;
import net.minecraft.core.BlockPos;
import net.minecraft.world.InteractionHand;
import net.minecraft.world.InteractionResult;
import net.minecraft.world.entity.player.Player;
import net.minecraft.world.level.BlockGetter;
import net.minecraft.world.level.Level;
import net.minecraft.world.level.block.entity.BlockEntity;
import net.minecraft.world.level.block.entity.BlockEntityTicker;
import net.minecraft.world.level.block.entity.BlockEntityType;
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 javax.annotation.Nullable;
@ -47,7 +43,7 @@ public class BlockDropper extends FullyDirectionalBlock.Container {
}
@Override
public InteractionResult use(BlockState state, Level world, BlockPos pos, Player player, InteractionHand hand, BlockHitResult hit) {
protected InteractionResult useWithoutItem(BlockState pState, Level world, BlockPos pos, Player player, BlockHitResult pHitResult) {
if (this.tryToggleRedstone(world, pos, player)) {
return InteractionResult.SUCCESS;
}

View file

@ -14,18 +14,14 @@ import de.ellpeck.actuallyadditions.mod.blocks.base.BlockContainerBase;
import de.ellpeck.actuallyadditions.mod.tile.TileEntityEnergizer;
import de.ellpeck.actuallyadditions.mod.tile.TileEntityEnervator;
import net.minecraft.core.BlockPos;
import net.minecraft.world.InteractionHand;
import net.minecraft.world.InteractionResult;
import net.minecraft.world.entity.player.Player;
import net.minecraft.world.level.BlockGetter;
import net.minecraft.world.level.Level;
import net.minecraft.world.level.block.entity.BlockEntity;
import net.minecraft.world.level.block.entity.BlockEntityTicker;
import net.minecraft.world.level.block.entity.BlockEntityType;
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 javax.annotation.Nullable;
@ -54,7 +50,7 @@ public class BlockEnergizer extends BlockContainerBase {
}
@Override
public InteractionResult use(BlockState state, Level world, BlockPos pos, Player player, InteractionHand hand, BlockHitResult hit) {
protected InteractionResult useWithoutItem(BlockState pState, Level world, BlockPos pos, Player player, BlockHitResult pHitResult) {
if (this.isEnergizer) {
return this.openGui(world, player, pos, TileEntityEnergizer.class);
} else {

View file

@ -13,18 +13,14 @@ package de.ellpeck.actuallyadditions.mod.blocks;
import de.ellpeck.actuallyadditions.mod.blocks.base.DirectionalBlock;
import de.ellpeck.actuallyadditions.mod.tile.TileEntityFarmer;
import net.minecraft.core.BlockPos;
import net.minecraft.world.InteractionHand;
import net.minecraft.world.InteractionResult;
import net.minecraft.world.entity.player.Player;
import net.minecraft.world.level.BlockGetter;
import net.minecraft.world.level.Level;
import net.minecraft.world.level.block.entity.BlockEntity;
import net.minecraft.world.level.block.entity.BlockEntityTicker;
import net.minecraft.world.level.block.entity.BlockEntityType;
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 javax.annotation.Nullable;
@ -47,8 +43,8 @@ public class BlockFarmer extends DirectionalBlock.Container {
}
@Override
public InteractionResult use(BlockState state, Level worldIn, BlockPos pos, Player player, InteractionHand handIn, BlockHitResult hit) {
return this.openGui(worldIn, player, pos, TileEntityFarmer.class);
protected InteractionResult useWithoutItem(BlockState pState, Level world, BlockPos pos, Player player, BlockHitResult pHitResult) {
return this.openGui(world, player, pos, TileEntityFarmer.class);
}
/* @Override

View file

@ -13,18 +13,14 @@ package de.ellpeck.actuallyadditions.mod.blocks;
import de.ellpeck.actuallyadditions.mod.blocks.base.BlockContainerBase;
import de.ellpeck.actuallyadditions.mod.tile.TileEntityFeeder;
import net.minecraft.core.BlockPos;
import net.minecraft.world.InteractionHand;
import net.minecraft.world.InteractionResult;
import net.minecraft.world.entity.player.Player;
import net.minecraft.world.level.BlockGetter;
import net.minecraft.world.level.Level;
import net.minecraft.world.level.block.entity.BlockEntity;
import net.minecraft.world.level.block.entity.BlockEntityTicker;
import net.minecraft.world.level.block.entity.BlockEntityType;
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 javax.annotation.Nullable;
@ -47,8 +43,8 @@ public class BlockFeeder extends BlockContainerBase {
}
@Override
public InteractionResult use(BlockState state, Level worldIn, BlockPos pos, Player player, InteractionHand handIn, BlockHitResult hit) {
return this.openGui(worldIn, player, pos, TileEntityFeeder.class);
protected InteractionResult useWithoutItem(BlockState pState, Level world, BlockPos pos, Player player, BlockHitResult pHitResult) {
return this.openGui(world, player, pos, TileEntityFeeder.class);
}
/* @Override

View file

@ -16,7 +16,7 @@ import net.minecraft.core.BlockPos;
import net.minecraft.sounds.SoundEvents;
import net.minecraft.sounds.SoundSource;
import net.minecraft.world.InteractionHand;
import net.minecraft.world.InteractionResult;
import net.minecraft.world.ItemInteractionResult;
import net.minecraft.world.entity.player.Player;
import net.minecraft.world.item.ItemStack;
import net.minecraft.world.item.Items;
@ -55,21 +55,21 @@ public class BlockFermentingBarrel extends BlockContainerBase {
}
@Override
public InteractionResult use(BlockState state, Level world, BlockPos pos, Player player, InteractionHand hand, BlockHitResult hit) {
protected ItemInteractionResult useItemOn(ItemStack pStack, BlockState pState, Level world, BlockPos pos, Player player, InteractionHand hand, BlockHitResult pHitResult) {
TileEntityFermentingBarrel tile = (TileEntityFermentingBarrel) world.getBlockEntity(pos);
if (tile == null)
return InteractionResult.PASS; //TODO this logic all needs to be rechecked...
return ItemInteractionResult.PASS_TO_DEFAULT_BLOCK_INTERACTION; //TODO this logic all needs to be rechecked...
if (world.isClientSide)
return InteractionResult.SUCCESS;
return ItemInteractionResult.SUCCESS;
if (!player.isShiftKeyDown()) {
if (FluidUtil.interactWithFluidHandler(player, hand, tile.tanks)) {
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
player.openMenu(tile, pos);
return InteractionResult.SUCCESS;
return ItemInteractionResult.SUCCESS;
}
return InteractionResult.PASS;
return ItemInteractionResult.PASS_TO_DEFAULT_BLOCK_INTERACTION;
}
@Override

View file

@ -13,7 +13,6 @@ package de.ellpeck.actuallyadditions.mod.blocks;
import de.ellpeck.actuallyadditions.mod.blocks.base.BlockContainerBase;
import de.ellpeck.actuallyadditions.mod.tile.TileEntityFireworkBox;
import net.minecraft.core.BlockPos;
import net.minecraft.world.InteractionHand;
import net.minecraft.world.InteractionResult;
import net.minecraft.world.entity.player.Player;
import net.minecraft.world.level.BlockGetter;
@ -34,7 +33,7 @@ public class BlockFireworkBox extends BlockContainerBase {
}
@Override
public InteractionResult use(BlockState state, Level world, BlockPos pos, Player player, InteractionHand handIn, BlockHitResult hit) {
protected InteractionResult useWithoutItem(BlockState pState, Level world, BlockPos pos, Player player, BlockHitResult pHitResult) {
if (this.tryToggleRedstone(world, pos, player)) {
return InteractionResult.SUCCESS;
}

View file

@ -15,17 +15,15 @@ import de.ellpeck.actuallyadditions.mod.tile.TileEntityFluidCollector;
import de.ellpeck.actuallyadditions.mod.tile.TileEntityFluidPlacer;
import net.minecraft.core.BlockPos;
import net.minecraft.world.InteractionHand;
import net.minecraft.world.InteractionResult;
import net.minecraft.world.ItemInteractionResult;
import net.minecraft.world.entity.player.Player;
import net.minecraft.world.level.BlockGetter;
import net.minecraft.world.item.ItemStack;
import net.minecraft.world.level.Level;
import net.minecraft.world.level.block.entity.BlockEntity;
import net.minecraft.world.level.block.entity.BlockEntityTicker;
import net.minecraft.world.level.block.entity.BlockEntityType;
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.neoforged.neoforge.fluids.FluidUtil;
import javax.annotation.Nonnull;
@ -58,18 +56,18 @@ public class BlockFluidCollector extends FullyDirectionalBlock.Container {
@Nonnull
@Override
public InteractionResult use(@Nonnull BlockState state, @Nonnull Level world, @Nonnull BlockPos pos, @Nonnull Player player, @Nonnull InteractionHand handIn, @Nonnull BlockHitResult hit) {
protected ItemInteractionResult useItemOn(ItemStack pStack, BlockState pState, Level world, BlockPos pos, Player player, InteractionHand hand, BlockHitResult pHitResult) {
if (world.isClientSide)
return InteractionResult.SUCCESS;
return ItemInteractionResult.SUCCESS;
if (this.tryToggleRedstone(world, pos, player)) {
return InteractionResult.CONSUME;
return ItemInteractionResult.CONSUME;
}
if (FluidUtil.interactWithFluidHandler(player, handIn, world, pos, hit.getDirection())) {
return InteractionResult.SUCCESS;
if (FluidUtil.interactWithFluidHandler(player, hand, world, pos, pHitResult.getDirection())) {
return ItemInteractionResult.SUCCESS;
}
return this.openGui(world, player, pos, TileEntityFluidCollector.class);
return this.openGui2(world, player, pos, TileEntityFluidCollector.class);
}
/* @Nonnull

View file

@ -13,14 +13,11 @@ package de.ellpeck.actuallyadditions.mod.blocks;
import de.ellpeck.actuallyadditions.mod.blocks.base.BlockContainerBase;
import de.ellpeck.actuallyadditions.mod.tile.TileEntityItemInterface;
import net.minecraft.core.BlockPos;
import net.minecraft.world.level.BlockGetter;
import net.minecraft.world.level.Level;
import net.minecraft.world.level.block.entity.BlockEntity;
import net.minecraft.world.level.block.entity.BlockEntityTicker;
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 javax.annotation.Nullable;

View file

@ -14,13 +14,10 @@ import de.ellpeck.actuallyadditions.mod.blocks.base.FullyDirectionalBlock;
import de.ellpeck.actuallyadditions.mod.util.WorldUtil;
import net.minecraft.core.BlockPos;
import net.minecraft.core.Direction;
import net.minecraft.world.level.BlockGetter;
import net.minecraft.world.level.Level;
import net.minecraft.world.level.block.Block;
import net.minecraft.world.level.block.state.BlockState;
import net.minecraft.world.level.block.state.properties.BlockStateProperties;
import net.minecraft.world.phys.shapes.CollisionContext;
import net.minecraft.world.phys.shapes.VoxelShape;
import java.util.ArrayList;
import java.util.List;

View file

@ -14,7 +14,6 @@ import com.mojang.blaze3d.platform.Window;
import de.ellpeck.actuallyadditions.api.ActuallyAdditionsAPI;
import de.ellpeck.actuallyadditions.api.laser.IConnectionPair;
import de.ellpeck.actuallyadditions.api.laser.Network;
import de.ellpeck.actuallyadditions.mod.ActuallyAdditions;
import de.ellpeck.actuallyadditions.mod.blocks.base.FullyDirectionalBlock;
import de.ellpeck.actuallyadditions.mod.config.CommonConfig;
import de.ellpeck.actuallyadditions.mod.items.ItemEngineerGoggles;
@ -35,7 +34,7 @@ import net.minecraft.client.gui.GuiGraphics;
import net.minecraft.core.BlockPos;
import net.minecraft.network.chat.Component;
import net.minecraft.world.InteractionHand;
import net.minecraft.world.InteractionResult;
import net.minecraft.world.ItemInteractionResult;
import net.minecraft.world.entity.player.Player;
import net.minecraft.world.item.ItemStack;
import net.minecraft.world.item.context.BlockPlaceContext;
@ -49,8 +48,6 @@ 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.neoforged.api.distmarker.Dist;
import net.neoforged.api.distmarker.OnlyIn;
import javax.annotation.Nullable;
import java.util.ArrayList;
@ -99,14 +96,14 @@ public class BlockLaserRelay extends FullyDirectionalBlock.Container implements
}
@Override
public InteractionResult use(BlockState state, Level world, BlockPos pos, Player player, InteractionHand hand, BlockHitResult hit) {
protected ItemInteractionResult useItemOn(ItemStack pStack, BlockState pState, Level world, BlockPos pos, Player player, InteractionHand hand, BlockHitResult pHitResult) {
ItemStack stack = player.getItemInHand(hand);
BlockEntity tile = world.getBlockEntity(pos);
if (tile instanceof TileEntityLaserRelay relay) {
if (!stack.isEmpty()) {
if (stack.getItem() instanceof ItemLaserWrench) {
return InteractionResult.FAIL;
return ItemInteractionResult.FAIL;
} else if (stack.getItem() == CommonConfig.Other.relayConfigureItem) {
if (!world.isClientSide) {
relay.onCompassAction(player);
@ -120,7 +117,7 @@ public class BlockLaserRelay extends FullyDirectionalBlock.Container implements
relay.sendUpdate();
}
return InteractionResult.SUCCESS;
return ItemInteractionResult.SUCCESS;
} else if (stack.getItem() instanceof ItemLaserRelayUpgrade) {
ItemStack inRelay = relay.inv.getStackInSlot(0);
if (inRelay.isEmpty()) {
@ -133,7 +130,7 @@ public class BlockLaserRelay extends FullyDirectionalBlock.Container implements
set.setCount(1);
relay.inv.setStackInSlot(0, set);
}
return InteractionResult.PASS;
return ItemInteractionResult.PASS_TO_DEFAULT_BLOCK_INTERACTION;
}
}
@ -149,15 +146,15 @@ public class BlockLaserRelay extends FullyDirectionalBlock.Container implements
player.spawnAtLocation(inRelay, 0);
}
}
return InteractionResult.PASS;
return ItemInteractionResult.PASS_TO_DEFAULT_BLOCK_INTERACTION;
}
}
if (relay instanceof TileEntityLaserRelayItemAdvanced) {
return this.openGui(world, player, pos, TileEntityLaserRelayItemAdvanced.class);
return this.openGui2(world, player, pos, TileEntityLaserRelayItemAdvanced.class);
}
}
return InteractionResult.FAIL;
return ItemInteractionResult.FAIL;
}
@Nullable
@ -199,7 +196,7 @@ public class BlockLaserRelay extends FullyDirectionalBlock.Container implements
}
@Override
@OnlyIn(Dist.CLIENT)
public void displayHud(GuiGraphics guiGraphics, Minecraft minecraft, Player player, ItemStack stack, HitResult rayCast, Window resolution) {
if (!(rayCast instanceof BlockHitResult)) {
return;

View file

@ -11,7 +11,6 @@
package de.ellpeck.actuallyadditions.mod.blocks;
import com.mojang.blaze3d.platform.Window;
import de.ellpeck.actuallyadditions.mod.ActuallyAdditions;
import de.ellpeck.actuallyadditions.mod.blocks.base.DirectionalBlock;
import de.ellpeck.actuallyadditions.mod.tile.TileEntityLavaFactoryController;
import net.minecraft.client.Minecraft;
@ -20,7 +19,6 @@ import net.minecraft.core.BlockPos;
import net.minecraft.network.chat.Component;
import net.minecraft.world.entity.player.Player;
import net.minecraft.world.item.ItemStack;
import net.minecraft.world.level.BlockGetter;
import net.minecraft.world.level.Level;
import net.minecraft.world.level.block.entity.BlockEntity;
import net.minecraft.world.level.block.entity.BlockEntityTicker;
@ -28,10 +26,6 @@ import net.minecraft.world.level.block.entity.BlockEntityType;
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.shapes.CollisionContext;
import net.minecraft.world.phys.shapes.VoxelShape;
import net.neoforged.api.distmarker.Dist;
import net.neoforged.api.distmarker.OnlyIn;
import javax.annotation.Nullable;
@ -55,7 +49,7 @@ public class BlockLavaFactoryController extends DirectionalBlock.Container imple
}
@Override
@OnlyIn(Dist.CLIENT)
public void displayHud(GuiGraphics guiGraphics, Minecraft minecraft, Player player, ItemStack stack, HitResult rayCast, Window resolution) {
if (!(rayCast instanceof BlockHitResult)) {
return;

View file

@ -13,7 +13,6 @@ package de.ellpeck.actuallyadditions.mod.blocks;
import de.ellpeck.actuallyadditions.mod.blocks.base.DirectionalBlock;
import de.ellpeck.actuallyadditions.mod.tile.TileEntityLeafGenerator;
import net.minecraft.core.BlockPos;
import net.minecraft.world.level.BlockGetter;
import net.minecraft.world.level.Level;
import net.minecraft.world.level.block.SoundType;
import net.minecraft.world.level.block.entity.BlockEntity;
@ -21,8 +20,6 @@ import net.minecraft.world.level.block.entity.BlockEntityTicker;
import net.minecraft.world.level.block.entity.BlockEntityType;
import net.minecraft.world.level.block.state.BlockState;
import net.minecraft.world.level.material.MapColor;
import net.minecraft.world.phys.shapes.CollisionContext;
import net.minecraft.world.phys.shapes.VoxelShape;
import javax.annotation.Nullable;

View file

@ -13,18 +13,14 @@ package de.ellpeck.actuallyadditions.mod.blocks;
import de.ellpeck.actuallyadditions.mod.blocks.base.FullyDirectionalBlock;
import de.ellpeck.actuallyadditions.mod.tile.TileEntityLongRangeBreaker;
import net.minecraft.core.BlockPos;
import net.minecraft.world.InteractionHand;
import net.minecraft.world.InteractionResult;
import net.minecraft.world.entity.player.Player;
import net.minecraft.world.level.BlockGetter;
import net.minecraft.world.level.Level;
import net.minecraft.world.level.block.entity.BlockEntity;
import net.minecraft.world.level.block.entity.BlockEntityTicker;
import net.minecraft.world.level.block.entity.BlockEntityType;
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 javax.annotation.Nullable;
@ -47,7 +43,7 @@ public class BlockLongRangeBreaker extends FullyDirectionalBlock.Container {
}
@Override
public InteractionResult use(BlockState state, Level world, BlockPos pos, Player player, InteractionHand handIn, BlockHitResult hit) {
protected InteractionResult useWithoutItem(BlockState pState, Level world, BlockPos pos, Player player, BlockHitResult pHitResult) {
if (this.tryToggleRedstone(world, pos, player)) {
return InteractionResult.SUCCESS;
}

View file

@ -17,8 +17,9 @@ import net.minecraft.core.particles.ParticleTypes;
import net.minecraft.server.level.ServerLevel;
import net.minecraft.util.RandomSource;
import net.minecraft.world.InteractionHand;
import net.minecraft.world.InteractionResult;
import net.minecraft.world.ItemInteractionResult;
import net.minecraft.world.entity.player.Player;
import net.minecraft.world.item.ItemStack;
import net.minecraft.world.level.BlockGetter;
import net.minecraft.world.level.Level;
import net.minecraft.world.level.block.entity.BlockEntity;
@ -63,7 +64,7 @@ public class BlockOilGenerator extends DirectionalBlock.Container {
}
@Override
public InteractionResult use(BlockState state, Level world, BlockPos pos, Player player, InteractionHand hand, BlockHitResult hit) {
protected ItemInteractionResult useItemOn(ItemStack pStack, BlockState pState, Level world, BlockPos pos, Player player, InteractionHand hand, BlockHitResult pHitResult) {
if (!world.isClientSide) {
TileEntityOilGenerator generator = (TileEntityOilGenerator) world.getBlockEntity(pos);
if (generator != null) {
@ -73,7 +74,7 @@ public class BlockOilGenerator extends DirectionalBlock.Container {
}
}
return InteractionResult.SUCCESS;
return ItemInteractionResult.SUCCESS;
}
/* @Override

View file

@ -12,9 +12,13 @@ package de.ellpeck.actuallyadditions.mod.blocks;
import com.mojang.blaze3d.platform.Window;
import de.ellpeck.actuallyadditions.api.tile.IPhantomTile;
import de.ellpeck.actuallyadditions.mod.ActuallyAdditions;
import de.ellpeck.actuallyadditions.mod.blocks.base.BlockContainerBase;
import de.ellpeck.actuallyadditions.mod.tile.*;
import de.ellpeck.actuallyadditions.mod.tile.TileEntityPhantomBreaker;
import de.ellpeck.actuallyadditions.mod.tile.TileEntityPhantomEnergyface;
import de.ellpeck.actuallyadditions.mod.tile.TileEntityPhantomItemface;
import de.ellpeck.actuallyadditions.mod.tile.TileEntityPhantomLiquiface;
import de.ellpeck.actuallyadditions.mod.tile.TileEntityPhantomPlacer;
import de.ellpeck.actuallyadditions.mod.tile.TileEntityPhantomRedstoneface;
import net.minecraft.ChatFormatting;
import net.minecraft.client.Minecraft;
import net.minecraft.client.gui.Font;
@ -26,7 +30,7 @@ import net.minecraft.network.chat.FormattedText;
import net.minecraft.util.FormattedCharSequence;
import net.minecraft.util.Mth;
import net.minecraft.world.InteractionHand;
import net.minecraft.world.InteractionResult;
import net.minecraft.world.ItemInteractionResult;
import net.minecraft.world.MenuProvider;
import net.minecraft.world.entity.player.Player;
import net.minecraft.world.item.Item;
@ -41,8 +45,6 @@ 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.neoforged.api.distmarker.Dist;
import net.neoforged.api.distmarker.OnlyIn;
import javax.annotation.Nullable;
@ -125,9 +127,9 @@ public class BlockPhantom extends BlockContainerBase implements IHudDisplay {
}
@Override
public InteractionResult use(BlockState state, Level world, BlockPos pos, Player player, InteractionHand handIn, BlockHitResult hit) {
protected ItemInteractionResult useItemOn(ItemStack pStack, BlockState pState, Level world, BlockPos pos, Player player, InteractionHand hand, BlockHitResult pHitResult) {
if (this.tryToggleRedstone(world, pos, player)) {
return InteractionResult.SUCCESS;
return ItemInteractionResult.SUCCESS;
}
if (!world.isClientSide) {
BlockEntity tile = world.getBlockEntity(pos);
@ -135,11 +137,11 @@ public class BlockPhantom extends BlockContainerBase implements IHudDisplay {
player.openMenu(menuProvider, pos);
}
}
return InteractionResult.SUCCESS;
return ItemInteractionResult.SUCCESS;
}
@Override
@OnlyIn(Dist.CLIENT)
public void displayHud(GuiGraphics guiGraphics, Minecraft minecraft, Player player, ItemStack stack, HitResult rayCast, Window resolution) {
if (!(rayCast instanceof BlockHitResult)) {
return;
@ -169,7 +171,7 @@ public class BlockPhantom extends BlockContainerBase implements IHudDisplay {
}
}
@OnlyIn(Dist.CLIENT)
public static void drawWordWrap(GuiGraphics gg, Font font, FormattedText text, int x, int y, int width, int color, boolean shadow) {
for (FormattedCharSequence line : font.split(text, width)) {
gg.drawString(font, line, x, y, color, shadow);

View file

@ -20,7 +20,6 @@ import net.minecraft.core.BlockPos;
import net.minecraft.world.entity.LivingEntity;
import net.minecraft.world.entity.player.Player;
import net.minecraft.world.item.ItemStack;
import net.minecraft.world.level.BlockGetter;
import net.minecraft.world.level.Level;
import net.minecraft.world.level.block.entity.BlockEntity;
import net.minecraft.world.level.block.entity.BlockEntityTicker;
@ -28,10 +27,6 @@ import net.minecraft.world.level.block.entity.BlockEntityType;
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.shapes.CollisionContext;
import net.minecraft.world.phys.shapes.VoxelShape;
import net.neoforged.api.distmarker.Dist;
import net.neoforged.api.distmarker.OnlyIn;
import javax.annotation.Nullable;
@ -69,7 +64,7 @@ public class BlockPlayerInterface extends BlockContainerBase implements IHudDisp
}
@Override
@OnlyIn(Dist.CLIENT)
public void displayHud(GuiGraphics guiGraphics, Minecraft minecraft, Player player, ItemStack stack, HitResult rayCast, Window resolution) {
if (!(rayCast instanceof BlockHitResult)) {
return;

View file

@ -19,13 +19,12 @@ import net.minecraft.core.particles.ParticleTypes;
import net.minecraft.network.chat.Component;
import net.minecraft.server.level.ServerLevel;
import net.minecraft.util.RandomSource;
import net.minecraft.world.InteractionHand;
import net.minecraft.world.InteractionResult;
import net.minecraft.world.entity.player.Player;
import net.minecraft.world.item.Item;
import net.minecraft.world.item.ItemStack;
import net.minecraft.world.item.TooltipFlag;
import net.minecraft.world.item.context.BlockPlaceContext;
import net.minecraft.world.level.BlockGetter;
import net.minecraft.world.level.Level;
import net.minecraft.world.level.block.Block;
import net.minecraft.world.level.block.entity.BlockEntity;
@ -34,8 +33,6 @@ import net.minecraft.world.level.block.entity.BlockEntityType;
import net.minecraft.world.level.block.state.BlockState;
import net.minecraft.world.level.block.state.StateDefinition;
import net.minecraft.world.phys.BlockHitResult;
import net.minecraft.world.phys.shapes.CollisionContext;
import net.minecraft.world.phys.shapes.VoxelShape;
import javax.annotation.Nullable;
import java.util.List;
@ -76,8 +73,8 @@ public class BlockPoweredFurnace extends DirectionalBlock.Container {
@Override
public InteractionResult use(BlockState state, Level worldIn, BlockPos pos, Player player, InteractionHand handIn, BlockHitResult hit) {
return this.openGui(worldIn, player, pos, TileEntityPoweredFurnace.class);
protected InteractionResult useWithoutItem(BlockState pState, Level world, BlockPos pos, Player player, BlockHitResult pHitResult) {
return this.openGui(world, player, pos, TileEntityPoweredFurnace.class);
}
@Override
@ -91,8 +88,8 @@ public class BlockPoweredFurnace extends DirectionalBlock.Container {
}
@Override
public void appendHoverText(ItemStack stack, @Nullable BlockGetter level, List<Component> tooltip, TooltipFlag advanced) {
super.appendHoverText(stack, level, tooltip, advanced);
public void appendHoverText(ItemStack stack, Item.TooltipContext context, List<Component> tooltip, TooltipFlag advanced) {
super.appendHoverText(stack, context, tooltip, advanced);
tooltip.add(Component.translatable("tooltip.actuallyadditions.previouslyDoubleFurnace").withStyle(ChatFormatting.ITALIC));
}

View file

@ -13,18 +13,14 @@ package de.ellpeck.actuallyadditions.mod.blocks;
import de.ellpeck.actuallyadditions.mod.blocks.base.BlockContainerBase;
import de.ellpeck.actuallyadditions.mod.tile.TileEntityRangedCollector;
import net.minecraft.core.BlockPos;
import net.minecraft.world.InteractionHand;
import net.minecraft.world.InteractionResult;
import net.minecraft.world.entity.player.Player;
import net.minecraft.world.level.BlockGetter;
import net.minecraft.world.level.Level;
import net.minecraft.world.level.block.entity.BlockEntity;
import net.minecraft.world.level.block.entity.BlockEntityTicker;
import net.minecraft.world.level.block.entity.BlockEntityType;
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 javax.annotation.Nullable;
@ -47,7 +43,7 @@ public class BlockRangedCollector extends BlockContainerBase {
}
@Override
public InteractionResult use(BlockState state, Level world, BlockPos pos, Player player, InteractionHand handIn, BlockHitResult hit) {
protected InteractionResult useWithoutItem(BlockState pState, Level world, BlockPos pos, Player player, BlockHitResult pHitResult) {
if (this.tryToggleRedstone(world, pos, player)) {
return InteractionResult.SUCCESS;
}

View file

@ -72,7 +72,7 @@ public class BlockShockSuppressor extends Block implements EntityBlock {
for (BlockPos pos : posesToRemove) {
if (suppressor.storage.getEnergyStored() >= use) {
suppressor.storage.extractEnergyInternal(use, false);
suppressor.storage.extractEnergy(use, false);
affectedBlocks.remove(pos);
} else {
break;
@ -80,7 +80,7 @@ public class BlockShockSuppressor extends Block implements EntityBlock {
}
for (Entity entity : entitiesToRemove) {
if (suppressor.storage.getEnergyStored() >= use) {
suppressor.storage.extractEnergyInternal(use, false);
suppressor.storage.extractEnergy(use, false);
affectedEntities.remove(entity);
} else {
break;

View file

@ -145,7 +145,7 @@
// }
//
// @Override
// @OnlyIn(Dist.CLIENT)
//
// public boolean canPlaceBlockOnSide(World worldIn, BlockPos pos, Direction side, PlayerEntity player, ItemStack stack) {
// BlockState state = worldIn.getBlockState(pos);
//

View file

@ -16,11 +16,9 @@ import de.ellpeck.actuallyadditions.mod.tile.TileEntityVerticalDigger;
import net.minecraft.client.Minecraft;
import net.minecraft.client.gui.GuiGraphics;
import net.minecraft.core.BlockPos;
import net.minecraft.world.InteractionHand;
import net.minecraft.world.InteractionResult;
import net.minecraft.world.entity.player.Player;
import net.minecraft.world.item.ItemStack;
import net.minecraft.world.level.BlockGetter;
import net.minecraft.world.level.Level;
import net.minecraft.world.level.block.entity.BlockEntity;
import net.minecraft.world.level.block.entity.BlockEntityTicker;
@ -28,10 +26,6 @@ import net.minecraft.world.level.block.entity.BlockEntityType;
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.shapes.CollisionContext;
import net.minecraft.world.phys.shapes.VoxelShape;
import net.neoforged.api.distmarker.Dist;
import net.neoforged.api.distmarker.OnlyIn;
import javax.annotation.Nullable;
@ -43,8 +37,8 @@ public class BlockVerticalDigger extends DirectionalBlock.Container implements I
}
@Override
public InteractionResult use(BlockState state, Level worldIn, BlockPos pos, Player player, InteractionHand handIn, BlockHitResult hit) {
return this.openGui(worldIn, player, pos, TileEntityVerticalDigger.class);
protected InteractionResult useWithoutItem(BlockState pState, Level world, BlockPos pos, Player player, BlockHitResult pHitResult) {
return this.openGui(world, player, pos, TileEntityVerticalDigger.class);
}
@Nullable
@ -60,7 +54,7 @@ public class BlockVerticalDigger extends DirectionalBlock.Container implements I
}
@Override
@OnlyIn(Dist.CLIENT)
public void displayHud(GuiGraphics guiGraphics, Minecraft minecraft, Player player, ItemStack stack, HitResult rayCast, Window resolution) {
if (!(rayCast instanceof BlockHitResult)) {
return;

View file

@ -84,7 +84,7 @@
// }
//
// @Override
// @OnlyIn(Dist.CLIENT)
//
// @Deprecated
// public boolean shouldSideBeRendered(BlockState blockState, IBlockAccess blockAccess, BlockPos pos, Direction side) {
// return side != Direction.DOWN || super.shouldSideBeRendered(blockState, blockAccess, pos, side);
@ -108,7 +108,7 @@
// }
//
// @Override
// @OnlyIn(Dist.CLIENT)
//
// public void getSubBlocks(CreativeTabs tab, NonNullList<ItemStack> list) {
// list.add(new ItemStack(this, 1, 0));
// }

View file

@ -13,18 +13,14 @@ package de.ellpeck.actuallyadditions.mod.blocks;
import de.ellpeck.actuallyadditions.mod.blocks.base.DirectionalBlock;
import de.ellpeck.actuallyadditions.mod.tile.TileEntityXPSolidifier;
import net.minecraft.core.BlockPos;
import net.minecraft.world.InteractionHand;
import net.minecraft.world.InteractionResult;
import net.minecraft.world.entity.player.Player;
import net.minecraft.world.level.BlockGetter;
import net.minecraft.world.level.Level;
import net.minecraft.world.level.block.entity.BlockEntity;
import net.minecraft.world.level.block.entity.BlockEntityTicker;
import net.minecraft.world.level.block.entity.BlockEntityType;
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 javax.annotation.Nullable;
@ -46,8 +42,8 @@ public class BlockXPSolidifier extends DirectionalBlock.Container {
}
@Override
public InteractionResult use(BlockState state, Level worldIn, BlockPos pos, Player player, InteractionHand handIn, BlockHitResult hit) {
return this.openGui(worldIn, player, pos, TileEntityXPSolidifier.class);
protected InteractionResult useWithoutItem(BlockState pState, Level world, BlockPos pos, Player player, BlockHitResult pHitResult) {
return this.openGui(world, player, pos, TileEntityXPSolidifier.class);
}
/* @Override

View file

@ -21,13 +21,9 @@ import net.minecraft.world.level.block.state.BlockState;
import net.minecraft.world.level.block.state.properties.BlockStateProperties;
import net.minecraft.world.level.block.state.properties.DirectionProperty;
import net.minecraft.world.level.block.state.properties.NoteBlockInstrument;
import net.minecraft.world.phys.shapes.BooleanOp;
import net.minecraft.world.phys.shapes.CollisionContext;
import net.minecraft.world.phys.shapes.Shapes;
import net.minecraft.world.phys.shapes.VoxelShape;
import java.util.stream.Stream;
public class CrystalClusterBlock extends FullyDirectionalBlock {
public static final DirectionProperty FACING = BlockStateProperties.FACING;

View file

@ -16,12 +16,10 @@ 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.neoforged.api.distmarker.Dist;
import net.neoforged.api.distmarker.OnlyIn;
public interface IHudDisplay {
@OnlyIn(Dist.CLIENT)
void displayHud(GuiGraphics guiGraphics, Minecraft minecraft, Player player, ItemStack stack, HitResult rayCast, Window resolution);
}

View file

@ -5,7 +5,6 @@ import net.minecraft.world.phys.shapes.BooleanOp;
import net.minecraft.world.phys.shapes.Shapes;
import net.minecraft.world.phys.shapes.VoxelShape;
import java.awt.*;
import java.util.Optional;
import java.util.stream.Stream;

View file

@ -10,19 +10,18 @@
package de.ellpeck.actuallyadditions.mod.blocks.base;
import de.ellpeck.actuallyadditions.mod.ActuallyAdditions;
import de.ellpeck.actuallyadditions.mod.config.CommonConfig;
import de.ellpeck.actuallyadditions.mod.tile.TileEntityBase;
import de.ellpeck.actuallyadditions.mod.tile.TileEntityInventoryBase;
import de.ellpeck.actuallyadditions.mod.util.StackUtil;
import net.minecraft.ChatFormatting;
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.util.RandomSource;
import net.minecraft.world.InteractionHand;
import net.minecraft.world.InteractionResult;
import net.minecraft.world.ItemInteractionResult;
import net.minecraft.world.MenuProvider;
import net.minecraft.world.entity.LivingEntity;
import net.minecraft.world.entity.item.ItemEntity;
@ -58,6 +57,18 @@ public abstract class BlockContainerBase extends Block implements EntityBlock {
return InteractionResult.SUCCESS;
}
public ItemInteractionResult openGui2(Level world, Player player, BlockPos pos, Class<? extends MenuProvider> expectedInstance) {
if (!world.isClientSide) {
BlockEntity tile = world.getBlockEntity(pos);
if (expectedInstance.isInstance(tile)) {
player.openMenu((MenuProvider) tile, pos);
}
return ItemInteractionResult.SUCCESS;
}
return ItemInteractionResult.SUCCESS;
}
private void dropInventory(Level world, BlockPos position) {
if (!world.isClientSide) {
BlockEntity aTile = world.getBlockEntity(position);
@ -172,13 +183,13 @@ public abstract class BlockContainerBase extends Block implements EntityBlock {
@Override
public void setPlacedBy(Level world, BlockPos pos, BlockState state, @Nullable LivingEntity placer, ItemStack stack) {
if (stack.hasTag()) {
BlockEntity tile = world.getBlockEntity(pos);
if (tile instanceof TileEntityBase base) {
CompoundTag compound = stack.getOrCreateTag().getCompound("Data");
base.readSyncableNBT(compound, TileEntityBase.NBTType.SAVE_BLOCK);
}
}
// if (stack.hasTag()) {
// BlockEntity tile = world.getBlockEntity(pos);
// if (tile instanceof TileEntityBase base) {
// CompoundTag compound = stack.get(DataComponents.BLOCK_ENTITY_DATA).getCompound("Data");
// base.readSyncableNBT(compound, world.registryAccess(), TileEntityBase.NBTType.SAVE_BLOCK); TODO: Check if this is still required
// }
// }
}
@Override

View file

@ -14,7 +14,7 @@ import de.ellpeck.actuallyadditions.mod.util.StackUtil;
import net.minecraft.core.BlockPos;
import net.minecraft.server.level.ServerLevel;
import net.minecraft.world.InteractionHand;
import net.minecraft.world.InteractionResult;
import net.minecraft.world.ItemInteractionResult;
import net.minecraft.world.entity.player.Player;
import net.minecraft.world.item.Item;
import net.minecraft.world.item.ItemStack;
@ -66,9 +66,9 @@ public class BlockPlant extends CropBlock {
@Override
public InteractionResult use(BlockState state, Level world, BlockPos pos, Player player, InteractionHand handIn, BlockHitResult hit) {
protected ItemInteractionResult useItemOn(ItemStack pStack, BlockState state, Level world, BlockPos pos, Player player, InteractionHand hand, BlockHitResult pHitResult) {
if (this.getAge(state) < 7) {
return InteractionResult.PASS;
return ItemInteractionResult.PASS_TO_DEFAULT_BLOCK_INTERACTION;
}
if (!world.isClientSide) {
@ -89,7 +89,7 @@ public class BlockPlant extends CropBlock {
world.setBlockAndUpdate(pos, this.defaultBlockState().setValue(AGE, 0));
}
return super.use(state, world, pos, player, handIn, hit);
return super.useItemOn(pStack, state, world, pos, player, hand, pHitResult);
}
@Override

View file

@ -22,7 +22,6 @@ 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.phys.AABB;
import javax.annotation.Nonnull;

View file

@ -27,14 +27,12 @@ import net.minecraft.core.registries.BuiltInRegistries;
import net.minecraft.network.chat.Component;
import net.minecraft.world.item.BlockItem;
import net.minecraft.world.item.ItemStack;
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) {
}

View file

@ -129,7 +129,7 @@ public class RenderLaserRelay implements BlockEntityRenderer<TileEntityLaserRela
@Override
public AABB getRenderBoundingBox(TileEntityLaserRelay blockEntity) {
return INFINITE_EXTENT_AABB;
return new AABB(Double.NEGATIVE_INFINITY, Double.NEGATIVE_INFINITY, Double.NEGATIVE_INFINITY, Double.POSITIVE_INFINITY, Double.POSITIVE_INFINITY, Double.POSITIVE_INFINITY);
}
@Override

View file

@ -27,7 +27,7 @@
//
//import java.util.Locale;
//
//@OnlyIn(Dist.CLIENT)
//
//public class RenderSmileyCloud extends TileEntitySpecialRenderer<TileEntitySmileyCloud> {
//
// @Override

View file

@ -35,7 +35,7 @@
//import java.util.List;
//import java.util.stream.Collectors;
//
//@OnlyIn(Dist.CLIENT)
//
//public class BookmarkButton extends Button {
//
// private final GuiBooklet booklet;

View file

@ -22,7 +22,7 @@
//import net.minecraftforge.api.distmarker.OnlyIn;
//
//
//@OnlyIn(Dist.CLIENT)
//
//public class EntryButton extends Button {
//
// private final GuiBookletBase gui;

View file

@ -57,13 +57,13 @@
// }
//
// @Override
// @OnlyIn(Dist.CLIENT)
//
// public String getLocalizedName() {
// return StringUtil.localize("booklet.actuallyadditions.chapter." + this.getIdentifier() + ".name");
// }
//
// @Override
// @OnlyIn(Dist.CLIENT)
//
// public String getLocalizedNameWithFormatting() {
// return this.color + this.getLocalizedName();
// }

View file

@ -29,13 +29,13 @@
// }
//
// @Override
// @OnlyIn(Dist.CLIENT)
//
// public String getLocalizedName() {
// return StringUtil.localize("booklet.actuallyadditions.trials." + this.getIdentifier() + ".name");
// }
//
// @Override
// @OnlyIn(Dist.CLIENT)
//
// public String getLocalizedNameWithFormatting() {
// PlayerEntity player = Minecraft.getInstance().player;
// PlayerData.PlayerSave data = PlayerData.getDataFromPlayer(player);

View file

@ -48,7 +48,7 @@
// this.color = TextFormatting.RESET;
// }
//
// @OnlyIn(Dist.CLIENT)
//
// private static boolean fitsFilter(IBookletPage page, String searchBarText) {
// Minecraft mc = Minecraft.getInstance();
//
@ -96,13 +96,13 @@
// }
//
// @Override
// @OnlyIn(Dist.CLIENT)
//
// public String getLocalizedName() {
// return StringUtil.localize("booklet.actuallyadditions.indexEntry." + this.getIdentifier() + ".name");
// }
//
// @Override
// @OnlyIn(Dist.CLIENT)
//
// public String getLocalizedNameWithFormatting() {
// return this.color + this.getLocalizedName();
// }
@ -113,7 +113,7 @@
// }
//
// @Override
// @OnlyIn(Dist.CLIENT)
//
// public List<IBookletChapter> getChaptersForDisplay(String searchBarText) {
// if (searchBarText != null && !searchBarText.isEmpty()) {
// String search = searchBarText.toLowerCase(Locale.ROOT);
@ -144,7 +144,7 @@
// }
//
// @Override
// @OnlyIn(Dist.CLIENT)
//
// public boolean visibleOnFrontPage() {
// return true;
// }

View file

@ -38,7 +38,7 @@
//import java.util.List;
//import java.util.stream.Collectors;
//
//@OnlyIn(Dist.CLIENT)
//
//public abstract class GuiBooklet extends GuiBookletBase {
//
// public static final int BUTTONS_PER_PAGE = 12;

View file

@ -27,7 +27,7 @@
//import java.io.IOException;
//import java.util.List;
//
//@OnlyIn(Dist.CLIENT)
//
//public class GuiEntry extends GuiBooklet {
//
// //The page in the entry. Say you have 2 more chapters than fit on one double page, then those 2 would be displayed on entryPage 1 instead.

View file

@ -35,7 +35,7 @@
//import java.util.List;
//
////TODO Fix achievement button
//@OnlyIn(Dist.CLIENT)
//
//public class GuiMainPage extends GuiBooklet {
//
//

View file

@ -35,7 +35,7 @@
//import java.util.Collections;
//import java.util.List;
//
//@OnlyIn(Dist.CLIENT)
//
//public class GuiPage extends GuiBooklet {
//
// public final IBookletPage[] pages = new IBookletPage[2];

View file

@ -43,7 +43,7 @@
// return null;
// }
//
// @OnlyIn(Dist.CLIENT)
//
// public static GuiPage createBookletGuiFromPage(Screen previousScreen, IBookletPage page) {
// GuiMainPage mainPage = new GuiMainPage(previousScreen);
//
@ -53,7 +53,7 @@
// return createPageGui(previousScreen, entry, page);
// }
//
// @OnlyIn(Dist.CLIENT)
//
// public static GuiPage createPageGui(Screen previousScreen, GuiBookletBase parentPage, IBookletPage page) {
// IBookletChapter chapter = page.getChapter();
//

View file

@ -27,7 +27,7 @@ import java.io.IOException;
/**
* (Partially excerpted from Botania by Vazkii with permission, thanks!)
*
@OnlyIn(Dist.CLIENT)
public class GuiAAAchievements extends GuiAchievements{
public GuiAAAchievements(GuiScreen screen, StatisticsManager statistics){

View file

@ -66,7 +66,7 @@
// }
//
// @Override
// @OnlyIn(Dist.CLIENT)
//
// public String getInfoText() {
// if (this.hasNoText) {
// return null;
@ -86,55 +86,55 @@
// return base;
// }
//
// @OnlyIn(Dist.CLIENT)
//
// protected String getLocalizationKey() {
// return "booklet.actuallyadditions.chapter." + this.chapter.getIdentifier() + ".text." + this.localizationKey;
// }
//
// @Override
// @OnlyIn(Dist.CLIENT)
//
// public void mouseClicked(GuiBookletBase gui, int mouseX, int mouseY, int mouseButton) {
//
// }
//
// @Override
// @OnlyIn(Dist.CLIENT)
//
// public void mouseReleased(GuiBookletBase gui, int mouseX, int mouseY, int state) {
//
// }
//
// @Override
// @OnlyIn(Dist.CLIENT)
//
// public void mouseClickMove(GuiBookletBase gui, int mouseX, int mouseY, int clickedMouseButton, long timeSinceLastClick) {
//
// }
//
// @Override
// @OnlyIn(Dist.CLIENT)
//
// public void actionPerformed(GuiBookletBase gui, Button button) {
//
// }
//
// @Override
// @OnlyIn(Dist.CLIENT)
//
// public void init(GuiBookletBase gui, int startX, int startY) {
//
// }
//
// @Override
// @OnlyIn(Dist.CLIENT)
//
// public void updateScreen(GuiBookletBase gui, int startX, int startY, int pageTimer) {
//
// }
//
// @Override
// @OnlyIn(Dist.CLIENT)
//
// public void drawScreenPre(GuiBookletBase gui, int startX, int startY, int mouseX, int mouseY, float partialTicks) {
//
// }
//
// @Override
// @OnlyIn(Dist.CLIENT)
//
// public void drawScreenPost(GuiBookletBase gui, int startX, int startY, int mouseX, int mouseY, float partialTicks) {
//
// }

View file

@ -48,12 +48,12 @@
// : null;
// }
//
// @OnlyIn(Dist.CLIENT)
//
// public void drawPre() {
// AssetUtil.renderStackToGui(this.stack, this.x, this.y, this.scale);
// }
//
// @OnlyIn(Dist.CLIENT)
//
// public void drawPost(int mouseX, int mouseY) {
// if (this.isHovered(mouseX, mouseY)) {
// Minecraft mc = this.gui.mc;

View file

@ -40,7 +40,7 @@
// }
//
// @Override
// @OnlyIn(Dist.CLIENT)
//
// public void drawScreenPre(GuiBookletBase gui, int startX, int startY, int mouseX, int mouseY, float partialTicks) {
// super.drawScreenPre(gui, startX, startY, mouseX, mouseY, partialTicks);
//
@ -58,7 +58,7 @@
// }
//
// @Override
// @OnlyIn(Dist.CLIENT)
//
// public void init(GuiBookletBase gui, int startX, int startY) {
// super.init(gui, startX, startY);
//

View file

@ -57,7 +57,7 @@
// }
//
// @Override
// @OnlyIn(Dist.CLIENT)
//
// public void drawScreenPre(GuiBookletBase gui, int startX, int startY, int mouseX, int mouseY, float partialTicks) {
// super.drawScreenPre(gui, startX, startY, mouseX, mouseY, partialTicks);
//
@ -72,7 +72,7 @@
// }
//
// @Override
// @OnlyIn(Dist.CLIENT)
//
// public void updateScreen(GuiBookletBase gui, int startX, int startY, int pageTimer) {
// super.updateScreen(gui, startX, startY, pageTimer);
//

View file

@ -37,7 +37,7 @@
// }
//
// @Override
// @OnlyIn(Dist.CLIENT)
//
// public void drawScreenPre(GuiBookletBase gui, int startX, int startY, int mouseX, int mouseY, float partialTicks) {
// super.drawScreenPre(gui, startX, startY, mouseX, mouseY, partialTicks);
//
@ -54,7 +54,7 @@
// }
//
// @Override
// @OnlyIn(Dist.CLIENT)
//
// public void init(GuiBookletBase gui, int startX, int startY) {
// super.init(gui, startX, startY);
//

View file

@ -46,7 +46,7 @@
// }
//
// @Override
// @OnlyIn(Dist.CLIENT)
//
// public void drawScreenPre(GuiBookletBase gui, int startX, int startY, int mouseX, int mouseY, float partialTicks) {
// super.drawScreenPre(gui, startX, startY, mouseX, mouseY, partialTicks);
//
@ -62,7 +62,7 @@
// }
//
// @Override
// @OnlyIn(Dist.CLIENT)
//
// public void init(GuiBookletBase gui, int startX, int startY) {
// super.init(gui, startX, startY);
//

View file

@ -52,7 +52,7 @@
// }
//
// @Override
// @OnlyIn(Dist.CLIENT)
//
// public void drawScreenPre(GuiBookletBase gui, int startX, int startY, int mouseX, int mouseY, float partialTicks) {
// super.drawScreenPre(gui, startX, startY, mouseX, mouseY, partialTicks);
//
@ -65,7 +65,7 @@
// }
//
// @Override
// @OnlyIn(Dist.CLIENT)
//
// public void init(GuiBookletBase gui, int startX, int startY) {
// super.init(gui, startX, startY);
//

View file

@ -36,7 +36,7 @@
// }
//
// @Override
// @OnlyIn(Dist.CLIENT)
//
// public void init(GuiBookletBase gui, int startX, int startY) {
// super.init(gui, startX, startY);
//
@ -44,14 +44,14 @@
// }
//
// @Override
// @OnlyIn(Dist.CLIENT)
//
// public void drawScreenPre(GuiBookletBase gui, int startX, int startY, int mouseX, int mouseY, float partialTicks) {
// super.drawScreenPre(gui, startX, startY, mouseX, mouseY, partialTicks);
// PageTextOnly.renderTextToPage(gui, this, startX + 6, startY + 5);
// }
//
// @Override
// @OnlyIn(Dist.CLIENT)
//
// public void actionPerformed(GuiBookletBase gui, Button button) {
// if (button.id == this.buttonId) {
// if (Desktop.isDesktopSupported()) {

View file

@ -40,7 +40,7 @@
// }
//
// @Override
// @OnlyIn(Dist.CLIENT)
//
// public void drawScreenPre(GuiBookletBase gui, int startX, int startY, int mouseX, int mouseY, float partialTicks) {
// super.drawScreenPre(gui, startX, startY, mouseX, mouseY, partialTicks);
//

View file

@ -40,7 +40,7 @@
// }
//
// @Override
// @OnlyIn(Dist.CLIENT)
//
// public void drawScreenPre(GuiBookletBase gui, int startX, int startY, int mouseX, int mouseY, float partialTicks) {
// super.drawScreenPre(gui, startX, startY, mouseX, mouseY, partialTicks);
//
@ -58,7 +58,7 @@
// }
//
// @Override
// @OnlyIn(Dist.CLIENT)
//
// public void init(GuiBookletBase gui, int startX, int startY) {
// super.init(gui, startX, startY);
//

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