writer, String suffix, Ingredient ingredient, Fluid fluidType, Item result) {
+ writer.accept(new FinishedBarrelMixingRecipe(new ResourceLocation(ExDeorum.ID, "barrel_mixing/" + path(result) + suffix), ingredient, fluidType, 1000, result));
}
}
diff --git a/src/main/java/thedarkcolour/exdeorum/data/TranslationKeys.java b/src/main/java/thedarkcolour/exdeorum/data/TranslationKeys.java
index 0447ccd3..bf5f03ab 100644
--- a/src/main/java/thedarkcolour/exdeorum/data/TranslationKeys.java
+++ b/src/main/java/thedarkcolour/exdeorum/data/TranslationKeys.java
@@ -1,3 +1,21 @@
+/*
+ * Ex Deorum
+ * Copyright (c) 2023 thedarkcolour
+ *
+ * This program is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation, either version 3 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program. If not, see .
+ */
+
package thedarkcolour.exdeorum.data;
import thedarkcolour.exdeorum.ExDeorum;
@@ -5,6 +23,7 @@
public class TranslationKeys {
public static final String MAIN_CREATIVE_TAB = "itemGroup." + ExDeorum.ID + ".main";
public static final String VOID_WORLD_TYPE = "generator." + ExDeorum.ID + ".void_world";
+ public static final String WATERING_CAN_FLUID_DISPLAY = "item." + ExDeorum.ID + ".watering_can_fluid_display";
// Advancements
public static final String ROOT_ADVANCEMENT_TITLE = "advancements." + ExDeorum.ID + ".core.root.title";
@@ -21,10 +40,18 @@ public class TranslationKeys {
// JEI descriptions
public static final String SILK_WORM_JEI_INFO = "info." + ExDeorum.ID + ".silk_worm";
public static final String SIEVE_JEI_INFO = "info." + ExDeorum.ID + ".sieve";
+ public static final String WATERING_CAN_JEI_INFO = "info." + ExDeorum.ID + ".watering_can";
+ public static final String WITCH_WATER_JEI_INFO = "info." + ExDeorum.ID + ".witch_water";
+ public static final String MYCELIUM_SPORES_JEI_INFO = "info." + ExDeorum.ID + ".mycelium_spores";
+ public static final String GRASS_SEEDS_JEI_INFO = "info." + ExDeorum.ID + ".grass_seeds";
+ public static final String WARPED_NYLIUM_SPORES_JEI_INFO = "info." + ExDeorum.ID + ".warped_nylium_spores";
+ public static final String CRIMSON_NYLIUM_SPORES_JEI_INFO = "info." + ExDeorum.ID + ".crimson_nylium_spores";
+ public static final String SCULK_CORE_JEI_INFO = "info." + ExDeorum.ID + ".sculk_core";
// JEI recipe categories
public static final String BARREL_COMPOST_CATEGORY_TITLE = "gui." + ExDeorum.ID + ".category.barrel_compost";
public static final String BARREL_COMPOST_RECIPE_VOLUME = "gui." + ExDeorum.ID + ".category.barrel_compost.volume";
+ public static final String BARREL_MIXING_CATEGORY_TITLE = "gui." + ExDeorum.ID + ".category.barrel_mixing";
public static final String WATER_CRUCIBLE_CATEGORY_TITLE = "gui." + ExDeorum.ID + ".category.water_crucible";
public static final String LAVA_CRUCIBLE_CATEGORY_TITLE = "gui." + ExDeorum.ID + ".category.lava_crucible";
public static final String HAMMER_CATEGORY_TITLE = "gui." + ExDeorum.ID + ".category.hammer";
diff --git a/src/main/java/thedarkcolour/exdeorum/data/package-info.java b/src/main/java/thedarkcolour/exdeorum/data/package-info.java
new file mode 100644
index 00000000..62fb7d9f
--- /dev/null
+++ b/src/main/java/thedarkcolour/exdeorum/data/package-info.java
@@ -0,0 +1,27 @@
+/*
+ * Ex Deorum
+ * Copyright (c) 2023 thedarkcolour
+ *
+ * This program is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation, either version 3 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program. If not, see .
+ */
+
+/**
+ * This package contains all data generation for Ex Deorum. It is not to be used outside of data generation.
+ *
+ * Ex Deorum uses the ModKit library, which adds several utilities primarily for data generation
+ * without needing to be shaded or depended upon outside a development environment.
+ */
+@net.minecraft.MethodsReturnNonnullByDefault
+@javax.annotation.ParametersAreNonnullByDefault
+package thedarkcolour.exdeorum.data;
diff --git a/src/main/java/thedarkcolour/exdeorum/event/EventHandler.java b/src/main/java/thedarkcolour/exdeorum/event/EventHandler.java
index 4cf0503a..a04de167 100644
--- a/src/main/java/thedarkcolour/exdeorum/event/EventHandler.java
+++ b/src/main/java/thedarkcolour/exdeorum/event/EventHandler.java
@@ -1,35 +1,65 @@
+/*
+ * Ex Deorum
+ * Copyright (c) 2023 thedarkcolour
+ *
+ * This program is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation, either version 3 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program. If not, see .
+ */
+
package thedarkcolour.exdeorum.event;
+import net.minecraft.client.Minecraft;
import net.minecraft.core.BlockPos;
import net.minecraft.core.Holder;
import net.minecraft.core.registries.Registries;
import net.minecraft.data.worldgen.features.TreeFeatures;
+import net.minecraft.network.chat.Component;
import net.minecraft.resources.ResourceLocation;
import net.minecraft.server.level.ServerLevel;
import net.minecraft.server.level.ServerPlayer;
+import net.minecraft.stats.Stats;
+import net.minecraft.util.Unit;
+import net.minecraft.world.item.ItemStack;
+import net.minecraft.world.item.Items;
import net.minecraft.world.level.GameRules;
import net.minecraft.world.level.block.Blocks;
import net.minecraft.world.level.levelgen.Heightmap;
import net.minecraft.world.level.levelgen.XoroshiroRandomSource;
import net.minecraft.world.level.levelgen.feature.ConfiguredFeature;
import net.minecraftforge.client.event.ClientChatEvent;
+import net.minecraftforge.common.ForgeMod;
import net.minecraftforge.common.MinecraftForge;
import net.minecraftforge.event.AddReloadListenerEvent;
import net.minecraftforge.event.entity.player.PlayerEvent;
import net.minecraftforge.event.level.LevelEvent;
+import net.minecraftforge.eventbus.api.Event;
+import net.minecraftforge.fluids.FluidInteractionRegistry;
import net.minecraftforge.fml.InterModComms;
+import net.minecraftforge.fml.event.lifecycle.FMLCommonSetupEvent;
import net.minecraftforge.fml.event.lifecycle.InterModEnqueueEvent;
import net.minecraftforge.fml.javafmlmod.FMLJavaModLoadingContext;
import thedarkcolour.exdeorum.ExDeorum;
+import thedarkcolour.exdeorum.config.EConfig;
+import thedarkcolour.exdeorum.item.WateringCanItem;
import thedarkcolour.exdeorum.recipe.RecipeUtil;
import thedarkcolour.exdeorum.client.CompostColors;
+import thedarkcolour.exdeorum.registry.EFluids;
+import thedarkcolour.exdeorum.registry.EItems;
import thedarkcolour.exdeorum.voidworld.VoidChunkGenerator;
import thedarkcolour.exdeorum.compat.top.ExDeorumTopCompat;
import thedarkcolour.exdeorum.item.HammerItem;
import thedarkcolour.exdeorum.network.NetworkHandler;
-import java.util.concurrent.CompletableFuture;
-
public final class EventHandler {
public static void register() {
var fmlBus = MinecraftForge.EVENT_BUS;
@@ -39,6 +69,7 @@ public static void register() {
fmlBus.addListener(EventHandler::addReloadListeners);
modBus.addListener(EventHandler::interModEnqueue);
fmlBus.addListener(EventHandler::createSpawnTree);
+ modBus.addListener(EventHandler::onCommonSetup);
if (ExDeorum.DEBUG) {
fmlBus.addListener(EventHandler::handleDebugCommands);
@@ -51,6 +82,7 @@ private static void handleDebugCommands(ClientChatEvent event) {
try {
CompostColors.loadColors();
+ Minecraft.getInstance().player.displayClientMessage(Component.literal("Reloaded " + CompostColors.COLORS.size() + " compost colors!"), false);
} catch (Exception e) {
ExDeorum.LOGGER.error("Failed to load vanilla compost colors", e);
}
@@ -58,7 +90,7 @@ private static void handleDebugCommands(ClientChatEvent event) {
}
private static void createSpawnTree(LevelEvent.CreateSpawnPosition event) {
- if (event.getLevel() instanceof ServerLevel level) {
+ if (event.getLevel() instanceof ServerLevel level && level.getChunkSource().getGenerator() instanceof VoidChunkGenerator) {
// todo have config option for more kinds of platforms
var rand = new XoroshiroRandomSource(level.getSeed());
var pos = new BlockPos.MutableBlockPos(rand.nextIntBetweenInclusive(-200, 200), 64, rand.nextIntBetweenInclusive(-200, 200));
@@ -79,6 +111,15 @@ private static void createSpawnTree(LevelEvent.CreateSpawnPosition event) {
}
}
+ private static void onCommonSetup(FMLCommonSetupEvent event) {
+ event.enqueueWork(() -> {
+ FluidInteractionRegistry.addInteraction(ForgeMod.LAVA_TYPE.get(), new FluidInteractionRegistry.InteractionInformation(
+ ForgeMod.WATER_TYPE.get(),
+ fluidState -> fluidState.isSource() ? Blocks.OBSIDIAN.defaultBlockState() : (EConfig.SERVER.witchWaterNetherrackGenerator.get() ? Blocks.NETHERRACK.defaultBlockState() : Blocks.COBBLESTONE.defaultBlockState())
+ ));
+ });
+ }
+
private static void onPlayerLogin(PlayerEvent.PlayerLoggedInEvent event) {
if (event.getEntity() instanceof ServerPlayer player) {
if (player.serverLevel().getChunkSource().getGenerator() instanceof VoidChunkGenerator) {
@@ -89,6 +130,15 @@ private static void onPlayerLogin(PlayerEvent.PlayerLoggedInEvent event) {
} else {
ExDeorum.LOGGER.error("Unable to grant player the Void World advancement. Ex Nihilo Reborn advancements will not show");
}
+
+ if (player.getStats().getValue(Stats.CUSTOM.get(Stats.DEATHS)) == 0 && player.tickCount == 0) {
+ if (EConfig.SERVER.startingTorch.get()) {
+ player.getInventory().add(new ItemStack(Items.TORCH));
+ }
+ if (EConfig.SERVER.startingWateringCan.get()) {
+ player.getInventory().add(WateringCanItem.getFull(EItems.WOODEN_WATERING_CAN));
+ }
+ }
}
}
}
@@ -101,7 +151,7 @@ public static void interModEnqueue(InterModEnqueueEvent event) {
private static void addReloadListeners(AddReloadListenerEvent event) {
var recipes = event.getServerResources().getRecipeManager();
event.addListener((prepBarrier, resourceManager, prepProfiler, reloadProfiler, backgroundExecutor, gameExecutor) -> {
- return CompletableFuture.allOf().thenCompose(prepBarrier::wait).thenRunAsync(() -> {
+ return prepBarrier.wait(Unit.INSTANCE).thenRunAsync(() -> {
HammerItem.refreshValidBlocks(recipes);
RecipeUtil.reload(recipes);
}, gameExecutor);
diff --git a/src/main/java/thedarkcolour/exdeorum/fluid/WitchWaterFluid.java b/src/main/java/thedarkcolour/exdeorum/fluid/WitchWaterFluid.java
index b085953c..c022c8e3 100644
--- a/src/main/java/thedarkcolour/exdeorum/fluid/WitchWaterFluid.java
+++ b/src/main/java/thedarkcolour/exdeorum/fluid/WitchWaterFluid.java
@@ -1,11 +1,33 @@
+/*
+ * Ex Deorum
+ * Copyright (c) 2023 thedarkcolour
+ *
+ * This program is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation, either version 3 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program. If not, see .
+ */
+
package thedarkcolour.exdeorum.fluid;
+import net.minecraft.client.Camera;
+import net.minecraft.client.multiplayer.ClientLevel;
import net.minecraft.resources.ResourceLocation;
import net.minecraft.sounds.SoundEvents;
import net.minecraftforge.client.extensions.common.IClientFluidTypeExtensions;
import net.minecraftforge.common.SoundActions;
import net.minecraftforge.fluids.FluidType;
import net.minecraftforge.fluids.ForgeFlowingFluid;
+import org.jetbrains.annotations.NotNull;
+import org.joml.Vector3f;
import thedarkcolour.exdeorum.ExDeorum;
import thedarkcolour.exdeorum.registry.EBlocks;
import thedarkcolour.exdeorum.registry.EFluids;
@@ -19,7 +41,7 @@ public class WitchWaterFluid extends FluidType {
private static final ResourceLocation OVERLAY_TEXTURE = new ResourceLocation("block/water_overlay");
public static ForgeFlowingFluid.Properties properties() {
- return new ForgeFlowingFluid.Properties(EFluids.WITCH_WATER_TYPE, EFluids.WITCH_WATER_STILL, EFluids.WITCH_WATER_FLOWING).block(EBlocks.WITCH_WATER).bucket(EItems.WITCH_WATER_BUCKET);
+ return new ForgeFlowingFluid.Properties(EFluids.WITCH_WATER_TYPE, EFluids.WITCH_WATER, EFluids.WITCH_WATER_FLOWING).block(EBlocks.WITCH_WATER).bucket(EItems.WITCH_WATER_BUCKET);
}
public WitchWaterFluid() {
@@ -51,6 +73,11 @@ public ResourceLocation getOverlayTexture() {
return OVERLAY_TEXTURE;
}
+ @Override
+ public @NotNull Vector3f modifyFogColor(Camera camera, float partialTick, ClientLevel level, int renderDistance, float darkenWorldAmount, Vector3f fluidFogColor) {
+ return new Vector3f(32f / 255f, 12f / 255f, 64f / 255f);
+ }
+
@Override
public int getTintColor() {
return 0xFFFFFFFF;
diff --git a/src/main/java/thedarkcolour/exdeorum/item/CookedSilkWormItem.java b/src/main/java/thedarkcolour/exdeorum/item/CookedSilkWormItem.java
new file mode 100644
index 00000000..a1510abd
--- /dev/null
+++ b/src/main/java/thedarkcolour/exdeorum/item/CookedSilkWormItem.java
@@ -0,0 +1,35 @@
+/*
+ * Ex Deorum
+ * Copyright (c) 2023 thedarkcolour
+ *
+ * This program is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation, either version 3 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program. If not, see .
+ */
+
+package thedarkcolour.exdeorum.item;
+
+import net.minecraft.sounds.SoundEvent;
+import net.minecraft.sounds.SoundEvents;
+import net.minecraft.world.item.Item;
+
+public class CookedSilkWormItem extends Item {
+ public CookedSilkWormItem(Properties properties) {
+ super(properties);
+ }
+
+ // Yummy silk worms :)
+ @Override
+ public SoundEvent getEatingSound() {
+ return SoundEvents.WEEPING_VINES_PLACE;
+ }
+}
diff --git a/src/main/java/thedarkcolour/exdeorum/item/CrookItem.java b/src/main/java/thedarkcolour/exdeorum/item/CrookItem.java
index af6c0847..08a97960 100644
--- a/src/main/java/thedarkcolour/exdeorum/item/CrookItem.java
+++ b/src/main/java/thedarkcolour/exdeorum/item/CrookItem.java
@@ -1,6 +1,25 @@
+/*
+ * Ex Deorum
+ * Copyright (c) 2023 thedarkcolour
+ *
+ * This program is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation, either version 3 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program. If not, see .
+ */
+
package thedarkcolour.exdeorum.item;
import net.minecraft.core.BlockPos;
+import net.minecraft.tags.BlockTags;
import net.minecraft.tags.ItemTags;
import net.minecraft.world.InteractionHand;
import net.minecraft.world.InteractionResult;
@@ -20,8 +39,16 @@
// Infested leaves have a 1 in 4 * progress to drop 1 string
// Infested leaves have a 1 in 16 * progress to drop another string
public class CrookItem extends Item {
- public CrookItem(Properties properties) {
+ private final float speed;
+
+ public CrookItem(Properties properties, float speed) {
super(properties);
+ this.speed = speed;
+ }
+
+ @Override
+ public float getDestroySpeed(ItemStack pStack, BlockState pState) {
+ return pState.is(BlockTags.LEAVES) ? speed : 1.0f;
}
@Override
diff --git a/src/main/java/thedarkcolour/exdeorum/item/GrassSpreaderItem.java b/src/main/java/thedarkcolour/exdeorum/item/GrassSpreaderItem.java
index 95634e59..9838ee51 100644
--- a/src/main/java/thedarkcolour/exdeorum/item/GrassSpreaderItem.java
+++ b/src/main/java/thedarkcolour/exdeorum/item/GrassSpreaderItem.java
@@ -1,9 +1,29 @@
+/*
+ * Ex Deorum
+ * Copyright (c) 2023 thedarkcolour
+ *
+ * This program is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation, either version 3 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program. If not, see .
+ */
+
package thedarkcolour.exdeorum.item;
+import net.minecraft.sounds.SoundEvents;
+import net.minecraft.sounds.SoundSource;
+import net.minecraft.tags.BlockTags;
import net.minecraft.world.InteractionResult;
import net.minecraft.world.item.Item;
import net.minecraft.world.item.context.UseOnContext;
-import net.minecraft.world.level.block.Blocks;
import net.minecraft.world.level.block.state.BlockState;
import java.util.function.Supplier;
@@ -11,8 +31,8 @@
public class GrassSpreaderItem extends Item {
private final Supplier grassState;
- public GrassSpreaderItem(Properties pProperties, Supplier grassState) {
- super(pProperties);
+ public GrassSpreaderItem(Properties properties, Supplier grassState) {
+ super(properties);
this.grassState = grassState;
}
@@ -21,22 +41,31 @@ public InteractionResult useOn(UseOnContext ctx) {
var level = ctx.getLevel();
var pos = ctx.getClickedPos();
var player = ctx.getPlayer();
+ var state = level.getBlockState(pos);
+ var grass = grassState.get();
- if (level.getBlockState(pos).is(Blocks.DIRT)) {
+ if (canSpread(state) && grass != state) {
if (!level.isClientSide) {
- level.setBlock(pos, grassState.get(), 3);
+ level.setBlock(pos, grass, 3);
+ level.playSound(null, pos, SoundEvents.ROOTED_DIRT_PLACE, SoundSource.BLOCKS);
+
+ if (player == null || !player.getAbilities().instabuild) {
+ ctx.getItemInHand().shrink(1);
+ }
return InteractionResult.CONSUME;
+ } else {
+ level.addDestroyBlockEffect(pos, grass);
}
- // apparently shrinking is done on both sides?
- if (player == null || !player.getAbilities().instabuild) {
- ctx.getItemInHand().shrink(1);
- }
return InteractionResult.SUCCESS;
}
return InteractionResult.PASS;
}
+
+ public boolean canSpread(BlockState state) {
+ return state.is(BlockTags.DIRT);
+ }
}
diff --git a/src/main/java/thedarkcolour/exdeorum/item/HammerItem.java b/src/main/java/thedarkcolour/exdeorum/item/HammerItem.java
index 18c2b768..49a41ff5 100644
--- a/src/main/java/thedarkcolour/exdeorum/item/HammerItem.java
+++ b/src/main/java/thedarkcolour/exdeorum/item/HammerItem.java
@@ -1,3 +1,21 @@
+/*
+ * Ex Deorum
+ * Copyright (c) 2023 thedarkcolour
+ *
+ * This program is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation, either version 3 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program. If not, see .
+ */
+
package thedarkcolour.exdeorum.item;
import it.unimi.dsi.fastutil.objects.ObjectOpenHashSet;
diff --git a/src/main/java/thedarkcolour/exdeorum/item/MeshItem.java b/src/main/java/thedarkcolour/exdeorum/item/MeshItem.java
index 1490c72e..fbf2f6bf 100644
--- a/src/main/java/thedarkcolour/exdeorum/item/MeshItem.java
+++ b/src/main/java/thedarkcolour/exdeorum/item/MeshItem.java
@@ -1,3 +1,21 @@
+/*
+ * Ex Deorum
+ * Copyright (c) 2023 thedarkcolour
+ *
+ * This program is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation, either version 3 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program. If not, see .
+ */
+
package thedarkcolour.exdeorum.item;
import net.minecraft.world.item.Item;
diff --git a/src/main/java/thedarkcolour/exdeorum/item/NyliumSpreaderItem.java b/src/main/java/thedarkcolour/exdeorum/item/NyliumSpreaderItem.java
new file mode 100644
index 00000000..9b599f0d
--- /dev/null
+++ b/src/main/java/thedarkcolour/exdeorum/item/NyliumSpreaderItem.java
@@ -0,0 +1,36 @@
+/*
+ * Ex Deorum
+ * Copyright (c) 2023 thedarkcolour
+ *
+ * This program is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation, either version 3 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program. If not, see .
+ */
+
+package thedarkcolour.exdeorum.item;
+
+import net.minecraft.tags.BlockTags;
+import net.minecraft.world.level.block.state.BlockState;
+import net.minecraftforge.common.Tags;
+
+import java.util.function.Supplier;
+
+public class NyliumSpreaderItem extends GrassSpreaderItem {
+ public NyliumSpreaderItem(Properties properties, Supplier grassState) {
+ super(properties, grassState);
+ }
+
+ @Override
+ public boolean canSpread(BlockState state) {
+ return state.is(Tags.Blocks.NETHERRACK) || state.is(BlockTags.NYLIUM);
+ }
+}
diff --git a/src/main/java/thedarkcolour/exdeorum/item/PorcelainBucket.java b/src/main/java/thedarkcolour/exdeorum/item/PorcelainBucket.java
new file mode 100644
index 00000000..614a7d39
--- /dev/null
+++ b/src/main/java/thedarkcolour/exdeorum/item/PorcelainBucket.java
@@ -0,0 +1,343 @@
+/*
+ * Ex Deorum
+ * Copyright (c) 2023 thedarkcolour
+ *
+ * This program is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation, either version 3 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program. If not, see .
+ */
+
+package thedarkcolour.exdeorum.item;
+
+import net.minecraft.advancements.CriteriaTriggers;
+import net.minecraft.core.BlockPos;
+import net.minecraft.core.Direction;
+import net.minecraft.core.particles.ParticleTypes;
+import net.minecraft.nbt.CompoundTag;
+import net.minecraft.server.level.ServerPlayer;
+import net.minecraft.sounds.SoundEvents;
+import net.minecraft.sounds.SoundSource;
+import net.minecraft.stats.Stats;
+import net.minecraft.tags.FluidTags;
+import net.minecraft.world.InteractionHand;
+import net.minecraft.world.InteractionResult;
+import net.minecraft.world.InteractionResultHolder;
+import net.minecraft.world.entity.LivingEntity;
+import net.minecraft.world.entity.animal.Cow;
+import net.minecraft.world.entity.player.Player;
+import net.minecraft.world.item.Item;
+import net.minecraft.world.item.ItemStack;
+import net.minecraft.world.item.ItemUtils;
+import net.minecraft.world.level.ClipContext;
+import net.minecraft.world.level.Level;
+import net.minecraft.world.level.LevelAccessor;
+import net.minecraft.world.level.block.BucketPickup;
+import net.minecraft.world.level.block.LiquidBlockContainer;
+import net.minecraft.world.level.block.state.BlockState;
+import net.minecraft.world.level.gameevent.GameEvent;
+import net.minecraft.world.level.material.FlowingFluid;
+import net.minecraft.world.level.material.Fluid;
+import net.minecraft.world.level.material.Fluids;
+import net.minecraft.world.phys.BlockHitResult;
+import net.minecraft.world.phys.HitResult;
+import net.minecraftforge.common.ForgeMod;
+import net.minecraftforge.common.capabilities.Capability;
+import net.minecraftforge.common.capabilities.ForgeCapabilities;
+import net.minecraftforge.common.capabilities.ICapabilityProvider;
+import net.minecraftforge.common.util.LazyOptional;
+import net.minecraftforge.fluids.FluidStack;
+import net.minecraftforge.fluids.capability.IFluidHandler;
+import net.minecraftforge.fluids.capability.IFluidHandlerItem;
+import org.jetbrains.annotations.NotNull;
+import org.jetbrains.annotations.Nullable;
+import thedarkcolour.exdeorum.registry.EFluids;
+import thedarkcolour.exdeorum.registry.EItems;
+
+import java.util.function.Supplier;
+
+public class PorcelainBucket extends Item {
+ private final Supplier extends Fluid> fluid;
+
+ public PorcelainBucket(Supplier extends Fluid> fluid, Properties properties) {
+ super(properties);
+ this.fluid = fluid;
+ }
+
+ @Override
+ public InteractionResult interactLivingEntity(ItemStack stack, Player player, LivingEntity target, InteractionHand hand) {
+ if (target instanceof Cow) {
+ if (!target.isBaby()) {
+ var level = player.level();
+ player.playSound(SoundEvents.COW_MILK, 1.0f, 1.0f);
+ if (!level.isClientSide) {
+ // have to make a copy to prevent player voiding the item stack in line 1056
+ // when it calls interactLivingEntity and checks if the stack is empty afterwards
+ var result = ItemUtils.createFilledResult(stack.getCount() == 1 ? stack.copy() : stack, player, new ItemStack(EItems.PORCELAIN_MILK_BUCKET.get()));
+ player.setItemInHand(hand, result);
+ }
+ return InteractionResult.sidedSuccess(level.isClientSide);
+ }
+ }
+
+ return InteractionResult.PASS;
+ }
+
+ public InteractionResultHolder use(Level level, Player player, InteractionHand pHand) {
+ var stack = player.getItemInHand(pHand);
+ var hitResult = getPlayerPOVHitResult(level, player, this.fluid.get() == Fluids.EMPTY ? ClipContext.Fluid.SOURCE_ONLY : ClipContext.Fluid.NONE);
+ var ret = net.minecraftforge.event.ForgeEventFactory.onBucketUse(player, level, stack, hitResult);
+ if (ret != null) return ret;
+ if (hitResult.getType() == HitResult.Type.MISS) {
+ return InteractionResultHolder.pass(stack);
+ } else if (hitResult.getType() != HitResult.Type.BLOCK) {
+ return InteractionResultHolder.pass(stack);
+ } else {
+ var pos = hitResult.getBlockPos();
+ var face = hitResult.getDirection();
+ var relative = pos.relative(face);
+ if (level.mayInteract(player, pos) && player.mayUseItemAt(relative, face, stack)) {
+ if (this.fluid.get() == Fluids.EMPTY) {
+ var state = level.getBlockState(pos);
+ var fluidType = state.getFluidState().getFluidType();
+
+ if (fluidType == ForgeMod.WATER_TYPE.get() || fluidType == ForgeMod.LAVA_TYPE.get() || fluidType == EFluids.WITCH_WATER_TYPE.get()) {
+ if (state.getBlock() instanceof BucketPickup pickup) {
+ var result = pickup.pickupBlock(level, pos, state);
+
+ if (fluidType == ForgeMod.WATER_TYPE.get()) {
+ result = new ItemStack(EItems.PORCELAIN_WATER_BUCKET.get());
+ } else if (fluidType == ForgeMod.LAVA_TYPE.get()) {
+ result = new ItemStack(EItems.PORCELAIN_LAVA_BUCKET.get());
+ } else {
+ result = new ItemStack(EItems.PORCELAIN_WITCH_WATER_BUCKET.get());
+ }
+
+ if (!result.isEmpty()) {
+ player.awardStat(Stats.ITEM_USED.get(this));
+ pickup.getPickupSound(state).ifPresent(sound -> player.playSound(sound, 1.0F, 1.0F));
+ level.gameEvent(player, GameEvent.FLUID_PICKUP, pos);
+ var filled = ItemUtils.createFilledResult(stack, player, result);
+ if (!level.isClientSide) {
+ CriteriaTriggers.FILLED_BUCKET.trigger((ServerPlayer)player, result);
+ }
+
+ return InteractionResultHolder.sidedSuccess(filled, level.isClientSide());
+ }
+ }
+ }
+
+ return InteractionResultHolder.fail(stack);
+ } else {
+ var state = level.getBlockState(pos);
+ var placePos = canBlockContainFluid(level, pos, state) ? pos : relative;
+
+ if (emptyContents(player, level, placePos, hitResult, stack)) {
+ if (player instanceof ServerPlayer serverPlayer) {
+ CriteriaTriggers.PLACED_BLOCK.trigger(serverPlayer, placePos, stack);
+ }
+
+ player.awardStat(Stats.ITEM_USED.get(this));
+ return InteractionResultHolder.sidedSuccess(getEmptySuccessItem(stack, player), level.isClientSide());
+ } else {
+ return InteractionResultHolder.fail(stack);
+ }
+ }
+ } else {
+ return InteractionResultHolder.fail(stack);
+ }
+ }
+ }
+
+ private ItemStack getEmptySuccessItem(ItemStack stack, Player player) {
+ if (!player.getAbilities().instabuild) {
+ if (fluid.get() == Fluids.LAVA) {
+ return ItemStack.EMPTY;
+ } else {
+ return new ItemStack(EItems.PORCELAIN_BUCKET.get());
+ }
+ } else {
+ return stack;
+ }
+ }
+
+ public boolean emptyContents(@Nullable Player player, Level level, BlockPos pos, @Nullable BlockHitResult hitResult, @Nullable ItemStack container) {
+ if (!(this.fluid.get() instanceof FlowingFluid)) {
+ return false;
+ } else {
+ var state = level.getBlockState(pos);
+ var block = state.getBlock();
+ var replacing = state.canBeReplaced(this.fluid.get());
+ var canPlaceAtPos = state.isAir() || replacing || block instanceof LiquidBlockContainer liquidContainer && liquidContainer.canPlaceLiquid(level, pos, state, this.fluid.get());
+ var containedFluidStack = java.util.Optional.ofNullable(container).flatMap(net.minecraftforge.fluids.FluidUtil::getFluidContained);
+
+ if (!canPlaceAtPos) {
+ return hitResult != null && this.emptyContents(player, level, hitResult.getBlockPos().relative(hitResult.getDirection()), null, container);
+ } else if (containedFluidStack.isPresent() && this.fluid.get().getFluidType().isVaporizedOnPlacement(level, pos, containedFluidStack.get())) {
+ this.fluid.get().getFluidType().onVaporize(player, level, pos, containedFluidStack.get());
+ return true;
+ } else if (level.dimensionType().ultraWarm() && this.fluid.get().is(FluidTags.WATER)) {
+ var i = pos.getX();
+ var j = pos.getY();
+ var k = pos.getZ();
+ level.playSound(player, pos, SoundEvents.FIRE_EXTINGUISH, SoundSource.BLOCKS, 0.5F, 2.6F + (level.random.nextFloat() - level.random.nextFloat()) * 0.8F);
+
+ for(int l = 0; l < 8; ++l) {
+ level.addParticle(ParticleTypes.LARGE_SMOKE, i + Math.random(), j + Math.random(), k + Math.random(), 0, 0, 0);
+ }
+
+ return true;
+ } else if (block instanceof LiquidBlockContainer liquidContainer && liquidContainer.canPlaceLiquid(level, pos, state, this.fluid.get())) {
+ liquidContainer.placeLiquid(level, pos, state, ((FlowingFluid)this.fluid.get()).getSource(false));
+ playEmptySound(player, level, pos);
+ return true;
+ } else {
+ if (!level.isClientSide && replacing && !state.liquid()) {
+ level.destroyBlock(pos, true);
+ }
+
+ if (!level.setBlock(pos, this.fluid.get().defaultFluidState().createLegacyBlock(), 11) && !state.getFluidState().isSource()) {
+ return false;
+ } else {
+ playEmptySound(player, level, pos);
+ return true;
+ }
+ }
+ }
+ }
+
+ protected void playEmptySound(@Nullable Player pPlayer, LevelAccessor pLevel, BlockPos pPos) {
+ var sound = this.fluid.get().getFluidType().getSound(pPlayer, pLevel, pPos, net.minecraftforge.common.SoundActions.BUCKET_EMPTY);
+ if (sound == null) {
+ sound = this.fluid.get().is(FluidTags.LAVA) ? SoundEvents.BUCKET_EMPTY_LAVA : SoundEvents.BUCKET_EMPTY;
+ }
+ pLevel.playSound(pPlayer, pPos, sound, SoundSource.BLOCKS, 1.0F, 1.0F);
+ pLevel.gameEvent(pPlayer, GameEvent.FLUID_PLACE, pPos);
+ }
+
+ protected boolean canBlockContainFluid(Level level, BlockPos pos, BlockState state) {
+ return state.getBlock() instanceof LiquidBlockContainer block && block.canPlaceLiquid(level, pos, state, fluid.get());
+ }
+
+ @Override
+ public @Nullable ICapabilityProvider initCapabilities(ItemStack stack, @Nullable CompoundTag nbt) {
+ return new PorcelainBucket.CapabilityProvider(stack);
+ }
+
+ static class CapabilityProvider implements ICapabilityProvider, IFluidHandlerItem {
+ private final LazyOptional holder = LazyOptional.of(() -> this);
+ private ItemStack container;
+
+ public CapabilityProvider(@NotNull ItemStack container) {
+ this.container = container;
+ }
+
+ @Override
+ public @NotNull LazyOptional getCapability(@NotNull Capability cap, @Nullable Direction side) {
+ return ForgeCapabilities.FLUID_HANDLER_ITEM.orEmpty(cap, this.holder);
+ }
+
+ @Override
+ public @NotNull ItemStack getContainer() {
+ return this.container;
+ }
+
+ @Override
+ public int getTanks() {
+ return 1;
+ }
+
+ @Override
+ public @NotNull FluidStack getFluidInTank(int tank) {
+ return getFluid();
+ }
+
+ @Override
+ public int getTankCapacity(int tank) {
+ return 1000;
+ }
+
+ @Override
+ public boolean isFluidValid(int tank, @NotNull FluidStack stack) {
+ return stack.getFluid() == Fluids.LAVA || stack.getFluid() == Fluids.WATER || stack.getFluid() == EFluids.WITCH_WATER.get();
+ }
+
+ @Override
+ public int fill(FluidStack resource, IFluidHandler.FluidAction action) {
+ if (this.container.getCount() != 1 || resource.getAmount() < 1000 || !getFluid().isEmpty() || !isFluidValid(0, resource)) {
+ return 0;
+ }
+ if (action.execute()) {
+ setFluid(resource);
+ }
+ return 1000;
+ }
+
+ @Override
+ public @NotNull FluidStack drain(FluidStack resource, IFluidHandler.FluidAction action) {
+ if (this.container.getCount() != 1 || resource.getAmount() < 1000) {
+ return FluidStack.EMPTY;
+ }
+ var stack = getFluid();
+ if (!stack.isEmpty() && stack.isFluidEqual(resource)) {
+ if (action.execute()) {
+ setFluid(FluidStack.EMPTY);
+ }
+ return stack;
+ }
+
+ return FluidStack.EMPTY;
+ }
+
+ @Override
+ public @NotNull FluidStack drain(int maxDrain, IFluidHandler.FluidAction action) {
+ if (this.container.getCount() != 1 || maxDrain < 1000) {
+ return FluidStack.EMPTY;
+ }
+
+ FluidStack fluidStack = getFluid();
+ if (!fluidStack.isEmpty()) {
+ if (action.execute()) {
+ setFluid(FluidStack.EMPTY);
+ }
+ return fluidStack;
+ }
+
+ return FluidStack.EMPTY;
+ }
+
+ FluidStack getFluid() {
+ var item = this.container.getItem();
+
+ if (item == EItems.PORCELAIN_LAVA_BUCKET.get()) {
+ return new FluidStack(Fluids.LAVA, 1000);
+ } else if (item == EItems.PORCELAIN_WATER_BUCKET.get()) {
+ return new FluidStack(Fluids.WATER, 1000);
+ } else if (item == EItems.PORCELAIN_WITCH_WATER_BUCKET.get()) {
+ return new FluidStack(EFluids.WITCH_WATER.get(), 1000);
+ }
+
+ return FluidStack.EMPTY;
+ }
+
+ void setFluid(FluidStack fluidStack) {
+ if (fluidStack.isEmpty()) {
+ this.container = new ItemStack(EItems.PORCELAIN_BUCKET.get());
+ } else if (fluidStack.getFluid() == Fluids.LAVA) {
+ this.container = new ItemStack(EItems.PORCELAIN_LAVA_BUCKET.get());
+ } else if (fluidStack.getFluid() == Fluids.WATER) {
+ this.container = new ItemStack(EItems.PORCELAIN_WATER_BUCKET.get());
+ } else if (fluidStack.getFluid() == EFluids.WITCH_WATER.get()) {
+ this.container = new ItemStack(EItems.PORCELAIN_WITCH_WATER_BUCKET.get());
+ }
+ }
+ }
+}
diff --git a/src/main/java/thedarkcolour/exdeorum/item/PorcelainBucketItem.java b/src/main/java/thedarkcolour/exdeorum/item/PorcelainBucketItem.java
deleted file mode 100644
index c9a0996b..00000000
--- a/src/main/java/thedarkcolour/exdeorum/item/PorcelainBucketItem.java
+++ /dev/null
@@ -1,9 +0,0 @@
-package thedarkcolour.exdeorum.item;
-
-import net.minecraft.world.item.Item;
-
-public class PorcelainBucketItem extends Item {
- public PorcelainBucketItem(Properties pProperties) {
- super(pProperties);
- }
-}
diff --git a/src/main/java/thedarkcolour/exdeorum/item/PorcelainMilkBucket.java b/src/main/java/thedarkcolour/exdeorum/item/PorcelainMilkBucket.java
new file mode 100644
index 00000000..d6fd93b0
--- /dev/null
+++ b/src/main/java/thedarkcolour/exdeorum/item/PorcelainMilkBucket.java
@@ -0,0 +1,64 @@
+/*
+ * Ex Deorum
+ * Copyright (c) 2023 thedarkcolour
+ *
+ * This program is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation, either version 3 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program. If not, see .
+ */
+
+package thedarkcolour.exdeorum.item;
+
+import net.minecraft.nbt.CompoundTag;
+import net.minecraft.world.entity.LivingEntity;
+import net.minecraft.world.item.ItemStack;
+import net.minecraft.world.item.Items;
+import net.minecraft.world.item.MilkBucketItem;
+import net.minecraft.world.level.Level;
+import net.minecraftforge.common.capabilities.ICapabilityProvider;
+import net.minecraftforge.fluids.FluidStack;
+import org.jetbrains.annotations.NotNull;
+import org.jetbrains.annotations.Nullable;
+import thedarkcolour.exdeorum.registry.EItems;
+
+public class PorcelainMilkBucket extends MilkBucketItem {
+ public PorcelainMilkBucket(Properties properties) {
+ super(properties);
+ }
+
+ @Override
+ public ItemStack finishUsingItem(ItemStack stack, Level level, LivingEntity living) {
+ var ret = super.finishUsingItem(new ItemStack(Items.MILK_BUCKET), level, living);
+
+ if (ret.getItem() == Items.BUCKET) {
+ return new ItemStack(EItems.PORCELAIN_BUCKET.get());
+ } else {
+ return stack;
+ }
+ }
+
+ @Override
+ public @Nullable ICapabilityProvider initCapabilities(ItemStack stack, @Nullable CompoundTag nbt) {
+ return new CapabilityProvider(stack);
+ }
+
+ private static class CapabilityProvider extends PorcelainBucket.CapabilityProvider {
+ public CapabilityProvider(@NotNull ItemStack container) {
+ super(container);
+ }
+
+ @Override
+ public boolean isFluidValid(int tank, @NotNull FluidStack stack) {
+ return false;
+ }
+ }
+}
diff --git a/src/main/java/thedarkcolour/exdeorum/item/SculkCoreItem.java b/src/main/java/thedarkcolour/exdeorum/item/SculkCoreItem.java
new file mode 100644
index 00000000..68e9e1a0
--- /dev/null
+++ b/src/main/java/thedarkcolour/exdeorum/item/SculkCoreItem.java
@@ -0,0 +1,66 @@
+/*
+ * Ex Deorum
+ * Copyright (c) 2023 thedarkcolour
+ *
+ * This program is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation, either version 3 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program. If not, see .
+ */
+
+package thedarkcolour.exdeorum.item;
+
+import net.minecraft.core.particles.ParticleTypes;
+import net.minecraft.sounds.SoundEvents;
+import net.minecraft.sounds.SoundSource;
+import net.minecraft.world.InteractionResult;
+import net.minecraft.world.item.Item;
+import net.minecraft.world.item.context.UseOnContext;
+import net.minecraft.world.level.block.Blocks;
+import net.minecraft.world.level.block.SculkShriekerBlock;
+import org.joml.Math;
+
+public class SculkCoreItem extends Item {
+ public SculkCoreItem(Properties properties) {
+ super(properties);
+ }
+
+ @Override
+ public InteractionResult useOn(UseOnContext context) {
+ var level = context.getLevel();
+ var pos = context.getClickedPos();
+ var state = level.getBlockState(pos);
+
+ if (state.getBlock() == Blocks.SCULK_SHRIEKER && !state.getValue(SculkShriekerBlock.CAN_SUMMON)) {
+ var stack = context.getItemInHand();
+ var player = context.getPlayer();
+
+ if (!level.isClientSide) {
+ if (!player.getAbilities().instabuild) {
+ stack.shrink(1);
+ }
+ level.setBlock(pos, state.setValue(SculkShriekerBlock.CAN_SUMMON, true), 3);
+ } else {
+ for (int i = 0; i < 10; i++) {
+ int j = i * 36;
+ double radians = Math.toRadians(j);
+ level.addParticle(ParticleTypes.PORTAL, pos.getX() + 0.5, pos.getY() + 0.5625, pos.getZ() + 0.5,
+ Math.cos(radians) * 0.15, 0.15, Math.sin(radians) * 0.15);
+ }
+ }
+ level.playSound(null, pos, SoundEvents.SCULK_SHRIEKER_SHRIEK, SoundSource.BLOCKS, 1.0f, 1.0f);
+
+ return InteractionResult.sidedSuccess(level.isClientSide);
+ }
+
+ return InteractionResult.PASS;
+ }
+}
diff --git a/src/main/java/thedarkcolour/exdeorum/item/SilkWormItem.java b/src/main/java/thedarkcolour/exdeorum/item/SilkWormItem.java
index ea313e01..3352d375 100644
--- a/src/main/java/thedarkcolour/exdeorum/item/SilkWormItem.java
+++ b/src/main/java/thedarkcolour/exdeorum/item/SilkWormItem.java
@@ -1,10 +1,33 @@
+/*
+ * Ex Deorum
+ * Copyright (c) 2023 thedarkcolour
+ *
+ * This program is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation, either version 3 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program. If not, see .
+ */
+
package thedarkcolour.exdeorum.item;
+import net.minecraft.sounds.SoundEvents;
+import net.minecraft.sounds.SoundSource;
import net.minecraft.tags.BlockTags;
import net.minecraft.world.InteractionResult;
+import net.minecraft.world.entity.item.ItemEntity;
import net.minecraft.world.item.Item;
+import net.minecraft.world.item.ItemStack;
import net.minecraft.world.item.context.UseOnContext;
import net.minecraft.world.level.block.LeavesBlock;
+import thedarkcolour.exdeorum.block.EBlock;
import thedarkcolour.exdeorum.blockentity.InfestedLeavesBlockEntity;
import thedarkcolour.exdeorum.registry.EBlocks;
@@ -20,13 +43,15 @@ public InteractionResult useOn(UseOnContext context) {
var state = level.getBlockState(pos);
if (!state.isAir()) {
- if (state.is(BlockTags.LEAVES)) {
+ if (state.is(BlockTags.LEAVES) && state.getBlock() != EBlocks.INFESTED_LEAVES.get()) {
if (!level.isClientSide) {
// Replace with infested block
level.setBlock(pos, EBlocks.INFESTED_LEAVES.get().defaultBlockState()
.setValue(LeavesBlock.DISTANCE, state.getValue(LeavesBlock.DISTANCE))
.setValue(LeavesBlock.PERSISTENT, state.getValue(LeavesBlock.PERSISTENT)), 2);
+ level.playSound(null, pos, SoundEvents.HONEY_BLOCK_HIT, SoundSource.BLOCKS);
+
// Set mimic
if (level.getBlockEntity(pos) instanceof InfestedLeavesBlockEntity leaves) {
leaves.setMimic(state);
@@ -40,4 +65,13 @@ public InteractionResult useOn(UseOnContext context) {
return InteractionResult.PASS;
}
+
+ @Override
+ public boolean onEntityItemUpdate(ItemStack stack, ItemEntity entity) {
+ // play a gross noise when you discover a silk worm
+ if (entity.tickCount == 1 && entity.getOwner() == null) {
+ entity.level().playSound(null, entity, SoundEvents.HONEY_BLOCK_PLACE, SoundSource.BLOCKS, 1.0f, 1.0f);
+ }
+ return false;
+ }
}
diff --git a/src/main/java/thedarkcolour/exdeorum/item/WateringCanItem.java b/src/main/java/thedarkcolour/exdeorum/item/WateringCanItem.java
new file mode 100644
index 00000000..5cd1aab0
--- /dev/null
+++ b/src/main/java/thedarkcolour/exdeorum/item/WateringCanItem.java
@@ -0,0 +1,360 @@
+/*
+ * Ex Deorum
+ * Copyright (c) 2023 thedarkcolour
+ *
+ * This program is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation, either version 3 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program. If not, see .
+ */
+
+package thedarkcolour.exdeorum.item;
+
+import com.mojang.blaze3d.vertex.PoseStack;
+import com.mojang.math.Axis;
+import net.minecraft.ChatFormatting;
+import net.minecraft.client.player.LocalPlayer;
+import net.minecraft.core.BlockPos;
+import net.minecraft.core.Direction;
+import net.minecraft.core.particles.ParticleTypes;
+import net.minecraft.nbt.CompoundTag;
+import net.minecraft.network.chat.Component;
+import net.minecraft.server.level.ServerLevel;
+import net.minecraft.sounds.SoundEvents;
+import net.minecraft.tags.BlockTags;
+import net.minecraft.util.Mth;
+import net.minecraft.world.InteractionHand;
+import net.minecraft.world.InteractionResultHolder;
+import net.minecraft.world.entity.HumanoidArm;
+import net.minecraft.world.entity.LivingEntity;
+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.UseAnim;
+import net.minecraft.world.level.ClipContext;
+import net.minecraft.world.level.Level;
+import net.minecraft.world.level.block.Blocks;
+import net.minecraft.world.level.block.BucketPickup;
+import net.minecraft.world.level.block.FarmBlock;
+import net.minecraft.world.level.block.LevelEvent;
+import net.minecraft.world.level.block.SpreadingSnowyDirtBlock;
+import net.minecraft.world.level.block.state.BlockState;
+import net.minecraft.world.level.material.Fluids;
+import net.minecraft.world.phys.BlockHitResult;
+import net.minecraft.world.phys.HitResult;
+import net.minecraftforge.client.extensions.common.IClientItemExtensions;
+import net.minecraftforge.common.ForgeMod;
+import net.minecraftforge.common.capabilities.ForgeCapabilities;
+import net.minecraftforge.common.capabilities.ICapabilityProvider;
+import net.minecraftforge.common.util.FakePlayer;
+import net.minecraftforge.fluids.FluidStack;
+import net.minecraftforge.fluids.capability.IFluidHandler;
+import net.minecraftforge.fluids.capability.templates.FluidHandlerItemStack;
+import org.jetbrains.annotations.NotNull;
+import org.jetbrains.annotations.Nullable;
+import thedarkcolour.exdeorum.data.TranslationKeys;
+
+import java.util.List;
+import java.util.function.Consumer;
+import java.util.function.Supplier;
+
+public class WateringCanItem extends Item {
+ private static final int WATERING_INTERVAL = 4;
+ private static final int STARTUP_TIME = 10;
+ // only used on the clientside
+ private static boolean isWatering = false;
+
+ private final int capacity;
+ private final boolean renewing;
+ private final boolean usableInMachines;
+
+ public WateringCanItem(int capacity, Properties properties) {
+ super(properties);
+
+ this.capacity = capacity;
+ this.renewing = capacity >= 4000;
+ this.usableInMachines = false;
+ }
+
+ protected WateringCanItem(boolean usableInMachines, Properties properties) {
+ super(properties);
+
+ this.capacity = 4000;
+ this.renewing = true;
+ this.usableInMachines = usableInMachines;
+ }
+
+ public static ItemStack getFull(Supplier extends Item> wateringCan) {
+ var stack = new ItemStack(wateringCan.get());
+ stack.getCapability(ForgeCapabilities.FLUID_HANDLER_ITEM).ifPresent(handler -> handler.fill(new FluidStack(Fluids.WATER, Integer.MAX_VALUE), IFluidHandler.FluidAction.EXECUTE));
+ return stack;
+ }
+
+ @Override
+ public boolean isBarVisible(ItemStack stack) {
+ return renewing ? stack.getCapability(ForgeCapabilities.FLUID_HANDLER_ITEM).map(handler -> handler.getFluidInTank(0).getAmount() < capacity).orElse(true) : true;
+ }
+
+ @Override
+ public int getBarColor(ItemStack pStack) {
+ return 0x3F76E4;
+ }
+
+ @Override
+ public int getBarWidth(ItemStack stack) {
+ return stack.getCapability(ForgeCapabilities.FLUID_HANDLER_ITEM).map(fluidHandler -> {
+ return Math.round((float) fluidHandler.getFluidInTank(0).getAmount() * 13.0F / (float) capacity);
+ }).orElse(0);
+ }
+
+ @Override
+ public int getUseDuration(ItemStack stack) {
+ return 72000;
+ }
+
+ @Override
+ public UseAnim getUseAnimation(ItemStack stack) {
+ return UseAnim.NONE;
+ }
+
+ @Override
+ public void appendHoverText(ItemStack stack, @Nullable Level pLevel, List tooltip, TooltipFlag pIsAdvanced) {
+ stack.getCapability(ForgeCapabilities.FLUID_HANDLER_ITEM).ifPresent(fluidHandler -> {
+ var water = Component.translatable(ForgeMod.WATER_TYPE.get().getDescriptionId());
+
+ tooltip.add(water.append(Component.translatable(TranslationKeys.WATERING_CAN_FLUID_DISPLAY, fluidHandler.getFluidInTank(0).getAmount(), capacity)).withStyle(ChatFormatting.GRAY));
+ });
+ }
+
+ @Override
+ public InteractionResultHolder use(Level level, Player player, InteractionHand hand) {
+ var itemInHand = player.getItemInHand(hand);
+ return itemInHand.getCapability(ForgeCapabilities.FLUID_HANDLER_ITEM).map(fluidHandler -> {
+ if (fluidHandler.getFluidInTank(0).getAmount() < this.capacity) {
+ var hitResult = getPlayerPOVHitResult(level, player, ClipContext.Fluid.SOURCE_ONLY);
+
+ if (hitResult.getType() == HitResult.Type.BLOCK) {
+ var pos = hitResult.getBlockPos();
+ var state = level.getBlockState(pos);
+
+ if (state.getFluidState().getType() == Fluids.WATER && state.getBlock() instanceof BucketPickup pickup) {
+ if (!level.isClientSide) {
+ fluidHandler.fill(new FluidStack(Fluids.WATER, 1000), IFluidHandler.FluidAction.EXECUTE);
+ pickup.pickupBlock(level, pos, state);
+ pickup.getPickupSound(state).ifPresent(sound -> player.playSound(sound, 1.0F, 1.0F));
+ }
+
+ return InteractionResultHolder.sidedSuccess(itemInHand, level.isClientSide);
+ }
+ }
+ }
+
+ if (!fluidHandler.getFluidInTank(0).isEmpty()) {
+ if (usableInMachines || !(player instanceof FakePlayer)) {
+ player.startUsingItem(hand);
+ }
+
+ return InteractionResultHolder.consume(itemInHand);
+ }
+ return InteractionResultHolder.pass(itemInHand);
+ }).orElse(InteractionResultHolder.pass(itemInHand));
+ }
+
+ @Override
+ public void onUseTick(Level level, LivingEntity living, ItemStack stack, int remainingTicks) {
+ var useTicks = 72000 - remainingTicks;
+
+ if (useTicks >= STARTUP_TIME) {
+ stack.getCapability(ForgeCapabilities.FLUID_HANDLER_ITEM).ifPresent(fluidHandler -> {
+ if (!fluidHandler.getFluidInTank(0).isEmpty()) {
+ // do watering can
+ var reachDist = living instanceof Player player ? player.getBlockReach() : living.getAttributeValue(ForgeMod.BLOCK_REACH.get());
+ var hit = living.pick(reachDist, 0, true);
+
+ if (hit instanceof BlockHitResult blockHit && blockHit.getType() == HitResult.Type.BLOCK) {
+ var pos = blockHit.getBlockPos();
+ var state = level.getBlockState(pos);
+
+ if (!level.isClientSide) {
+ if (useTicks % WATERING_INTERVAL == 0) {
+ tryWatering((ServerLevel) level, pos, state);
+
+ if (!renewing || fluidHandler.getFluidInTank(0).getAmount() != capacity) {
+ if (!(living instanceof Player player && player.getAbilities().instabuild)) {
+ ((CapabilityProvider) fluidHandler).drain();
+ }
+ }
+ }
+ if (useTicks % 2 == 0) {
+ waterParticles(level, pos, state);
+ }
+ if ((useTicks - STARTUP_TIME) % 20 == 0) {
+ level.playSound(null, pos, SoundEvents.WEATHER_RAIN, living.getSoundSource(), this.getClass() == WideWateringCanItem.class ? 0.6f : 0.3f, 1.5f);
+ }
+ } else {
+ isWatering = true;
+ }
+ } else {
+ isWatering = false;
+ }
+ } else {
+ living.stopUsingItem();
+ isWatering = false;
+ }
+ });
+ }
+ }
+
+ @Override
+ public void releaseUsing(ItemStack stack, Level level, LivingEntity living, int timeCharged) {
+ if (timeCharged > STARTUP_TIME) {
+ level.playLocalSound(living.getX(), living.getY(), living.getZ(), SoundEvents.BUCKET_FILL, living.getSoundSource(), 0.6f, 0.7f, false);
+ }
+ }
+
+ protected void tryWatering(ServerLevel level, BlockPos pos, BlockState state) {
+ if (state.is(BlockTags.SAPLINGS)) {
+ if (level.random.nextInt(3) == 0) {
+ state.randomTick(level, pos, level.random);
+ level.levelEvent(LevelEvent.PARTICLES_AND_SOUND_PLANT_GROWTH, pos, 0);
+ }
+ } else if (state.is(BlockTags.CROPS) || state.getBlock() instanceof SpreadingSnowyDirtBlock) {
+ state.randomTick(level, pos, level.random);
+ } else if (state.getBlock() == Blocks.LAVA) {
+ level.levelEvent(LevelEvent.LAVA_FIZZ, pos, 0);
+ } else if (state.getBlock() == Blocks.FARMLAND) {
+ hydrateFarmland(level, pos, state);
+ }
+ var below = pos.below();
+ var belowState = level.getBlockState(below);
+ if (belowState.getBlock() == Blocks.FARMLAND) {
+ hydrateFarmland(level, below, belowState);
+ }
+ }
+
+ private static void hydrateFarmland(ServerLevel level, BlockPos pos, BlockState state) {
+ var randomPos = pos.offset(level.random.nextIntBetweenInclusive(-1, 1), 0, level.random.nextIntBetweenInclusive(-1, 1));
+
+ if (randomPos != pos) {
+ pos = randomPos;
+ state = level.getBlockState(pos);
+
+ if (state.getBlock() != Blocks.FARMLAND) {
+ return;
+ }
+ }
+
+ if (state.getValue(FarmBlock.MOISTURE) < 7) {
+ level.setBlockAndUpdate(pos, state.setValue(FarmBlock.MOISTURE, 7));
+ }
+ }
+
+ protected void waterParticles(Level level, BlockPos pos, BlockState state) {
+ if (level instanceof ServerLevel serverLevel) {
+ double x = pos.getX() + 0.5 + level.random.nextGaussian() / 8f;
+ double y = pos.getY();
+ double z = pos.getZ() + 0.5 + level.random.nextGaussian() / 8f;
+ var collisionShape = state.getCollisionShape(level, pos);
+ if (!collisionShape.isEmpty()) {
+ y += collisionShape.max(Direction.Axis.Y);
+ }
+ for (int i = -1; i <= 1; i++) {
+ for (int j = -1; j <= 1; j++) {
+ if (level.random.nextBoolean()) {
+ serverLevel.sendParticles(ParticleTypes.RAIN, x + i * 0.33, y, z + j * 0.33, 2, 0, 0, 0, 0.2);
+ }
+ }
+ }
+ }
+ }
+
+ @Override
+ public ICapabilityProvider initCapabilities(ItemStack stack, @Nullable CompoundTag nbt) {
+ return new CapabilityProvider(stack, this.capacity);
+ }
+
+ @Override
+ public void initializeClient(Consumer consumer) {
+ consumer.accept(ClientExtensions.INSTANCE);
+ }
+
+ private static class CapabilityProvider extends FluidHandlerItemStack {
+ public CapabilityProvider(@NotNull ItemStack container, int capacity) {
+ super(container, capacity);
+ }
+
+ @Override
+ public boolean canFillFluidType(FluidStack fluid) {
+ return fluid.getFluid() == Fluids.WATER;
+ }
+
+ @Override
+ public boolean canDrainFluidType(FluidStack fluid) {
+ return false;
+ }
+
+ public void drain() {
+ var contained = getFluid();
+ var drainAmount = Math.min(contained.getAmount(), 1);
+
+ var drained = contained.copy();
+ drained.setAmount(drainAmount);
+
+ contained.shrink(drainAmount);
+
+ if (contained.isEmpty()) {
+ setContainerToEmpty();
+ } else {
+ setFluid(contained);
+ }
+ }
+ }
+
+ private enum ClientExtensions implements IClientItemExtensions {
+ INSTANCE;
+
+ @Override
+ public boolean applyForgeHandTransform(PoseStack poseStack, LocalPlayer player, HumanoidArm arm, ItemStack itemInHand, float partialTick, float equipProcess, float swingProcess) {
+ if (player.isUsingItem()) {
+ var useTicks = 72000 - 1 - player.getUseItemRemainingTicks();
+ var step = useTicks + partialTick;
+ var startProgress = easeOutCubic(Math.min(step, STARTUP_TIME) / STARTUP_TIME);
+
+ poseStack.translate(-0.2 * startProgress, -0.2 * startProgress, 0);
+
+ if (startProgress == 1.0f && isWatering) {
+ var sin = Mth.sin(0.35f * (step - 10f));
+ poseStack.rotateAround(Axis.XP.rotationDegrees(10 * sin), 0f, 0f, -0.2f);
+ //poseStack.translate(0, 0.2 * sin, 0);
+ }
+
+ var rotate = Mth.lerp(startProgress, 0, Mth.DEG_TO_RAD);
+
+ poseStack.rotateAround(Axis.ZP.rotation(rotate * 15f), -0.75f, 0f, 0);
+
+ int i = arm == HumanoidArm.RIGHT ? 1 : -1;
+ poseStack.translate((float) i * 0.56F, -0.52F + (player.isUsingItem() ? 0 : equipProcess) * -0.6F, -0.72F);
+
+ return true;
+ }
+
+
+ return false;
+ }
+
+ // https://easings.net/#easeOutCubic
+ private static float easeOutCubic(float progress) {
+ var opposite = 1 - progress;
+ return 1 - opposite * opposite * opposite;
+ }
+ }
+}
diff --git a/src/main/java/thedarkcolour/exdeorum/item/WideWateringCanItem.java b/src/main/java/thedarkcolour/exdeorum/item/WideWateringCanItem.java
new file mode 100644
index 00000000..bd87db66
--- /dev/null
+++ b/src/main/java/thedarkcolour/exdeorum/item/WideWateringCanItem.java
@@ -0,0 +1,64 @@
+/*
+ * Ex Deorum
+ * Copyright (c) 2023 thedarkcolour
+ *
+ * This program is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation, either version 3 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program. If not, see .
+ */
+
+package thedarkcolour.exdeorum.item;
+
+import net.minecraft.core.BlockPos;
+import net.minecraft.server.level.ServerLevel;
+import net.minecraft.world.level.Level;
+import net.minecraft.world.level.block.state.BlockState;
+
+public class WideWateringCanItem extends WateringCanItem {
+ public WideWateringCanItem(boolean usableInMachines, Properties properties) {
+ super(usableInMachines, properties);
+ }
+
+ @Override
+ protected void tryWatering(ServerLevel level, BlockPos pos, BlockState state) {
+ for (int i = -1; i <= 1; i++) {
+ for (int j = -1; j <= 1; j++) {
+ if (level.random.nextInt(3) != 0) {
+ var newPos = pos.offset(i, 0, j);
+ var newState = state;
+
+ if (newPos != pos) {
+ newState = level.getBlockState(newPos);
+ }
+
+ super.tryWatering(level, newPos, newState);
+ }
+ }
+ }
+ }
+
+ @Override
+ protected void waterParticles(Level level, BlockPos pos, BlockState state) {
+ for (int i = -1; i <= 1; i++) {
+ for (int j = -1; j <= 1; j++) {
+ var newPos = pos.offset(i, 0, j);
+ var newState = state;
+
+ if (newPos != pos) {
+ newState = level.getBlockState(newPos);
+ }
+
+ super.waterParticles(level, newPos, newState);
+ }
+ }
+ }
+}
diff --git a/src/main/java/thedarkcolour/exdeorum/item/WitchWaterBucketItem.java b/src/main/java/thedarkcolour/exdeorum/item/WitchWaterBucketItem.java
index 0c74f021..e66190ab 100644
--- a/src/main/java/thedarkcolour/exdeorum/item/WitchWaterBucketItem.java
+++ b/src/main/java/thedarkcolour/exdeorum/item/WitchWaterBucketItem.java
@@ -1,3 +1,21 @@
+/*
+ * Ex Deorum
+ * Copyright (c) 2023 thedarkcolour
+ *
+ * This program is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation, either version 3 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program. If not, see .
+ */
+
package thedarkcolour.exdeorum.item;
import net.minecraft.nbt.CompoundTag;
@@ -10,7 +28,7 @@
public class WitchWaterBucketItem extends BucketItem {
public WitchWaterBucketItem(Properties properties) {
- super(EFluids.WITCH_WATER_STILL, properties);
+ super(EFluids.WITCH_WATER, properties);
}
@Override
diff --git a/src/main/java/thedarkcolour/exdeorum/loot/CrookLootModifier.java b/src/main/java/thedarkcolour/exdeorum/loot/CrookLootModifier.java
index f516d4b5..d3759d11 100644
--- a/src/main/java/thedarkcolour/exdeorum/loot/CrookLootModifier.java
+++ b/src/main/java/thedarkcolour/exdeorum/loot/CrookLootModifier.java
@@ -1,3 +1,21 @@
+/*
+ * Ex Deorum
+ * Copyright (c) 2023 thedarkcolour
+ *
+ * This program is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation, either version 3 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program. If not, see .
+ */
+
package thedarkcolour.exdeorum.loot;
import com.mojang.serialization.Codec;
diff --git a/src/main/java/thedarkcolour/exdeorum/loot/HammerLootModifier.java b/src/main/java/thedarkcolour/exdeorum/loot/HammerLootModifier.java
index 95d3eeba..ae48bd87 100644
--- a/src/main/java/thedarkcolour/exdeorum/loot/HammerLootModifier.java
+++ b/src/main/java/thedarkcolour/exdeorum/loot/HammerLootModifier.java
@@ -1,3 +1,21 @@
+/*
+ * Ex Deorum
+ * Copyright (c) 2023 thedarkcolour
+ *
+ * This program is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation, either version 3 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program. If not, see .
+ */
+
package thedarkcolour.exdeorum.loot;
import com.mojang.serialization.Codec;
@@ -28,6 +46,7 @@ protected ObjectArrayList doApply(ObjectArrayList generate
var level = context.getLevel();
var state = context.getParamOrNull(LootContextParams.BLOCK_STATE);
+ // todo incorporate Fortune
if (state != null && state.getBlock().asItem() != Items.AIR) {
var temporaryItem = new SimpleContainer(new ItemStack(state.getBlock().asItem()));
var recipe = level.getRecipeManager().getRecipeFor(ERecipeTypes.HAMMER.get(), temporaryItem, level);
diff --git a/src/main/java/thedarkcolour/exdeorum/loot/InfestedStringCount.java b/src/main/java/thedarkcolour/exdeorum/loot/InfestedStringCount.java
index 87f60269..08d98c57 100644
--- a/src/main/java/thedarkcolour/exdeorum/loot/InfestedStringCount.java
+++ b/src/main/java/thedarkcolour/exdeorum/loot/InfestedStringCount.java
@@ -1,3 +1,21 @@
+/*
+ * Ex Deorum
+ * Copyright (c) 2023 thedarkcolour
+ *
+ * This program is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation, either version 3 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program. If not, see .
+ */
+
package thedarkcolour.exdeorum.loot;
import com.google.gson.JsonDeserializationContext;
diff --git a/src/main/java/thedarkcolour/exdeorum/network/ClientMessageHandler.java b/src/main/java/thedarkcolour/exdeorum/network/ClientMessageHandler.java
index 55e82ab5..e0370c60 100644
--- a/src/main/java/thedarkcolour/exdeorum/network/ClientMessageHandler.java
+++ b/src/main/java/thedarkcolour/exdeorum/network/ClientMessageHandler.java
@@ -1,3 +1,21 @@
+/*
+ * Ex Deorum
+ * Copyright (c) 2023 thedarkcolour
+ *
+ * This program is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation, either version 3 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program. If not, see .
+ */
+
package thedarkcolour.exdeorum.network;
import net.minecraft.client.Minecraft;
diff --git a/src/main/java/thedarkcolour/exdeorum/network/NetworkHandler.java b/src/main/java/thedarkcolour/exdeorum/network/NetworkHandler.java
index 83848d8d..5491075d 100644
--- a/src/main/java/thedarkcolour/exdeorum/network/NetworkHandler.java
+++ b/src/main/java/thedarkcolour/exdeorum/network/NetworkHandler.java
@@ -1,3 +1,21 @@
+/*
+ * Ex Deorum
+ * Copyright (c) 2023 thedarkcolour
+ *
+ * This program is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation, either version 3 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program. If not, see .
+ */
+
package thedarkcolour.exdeorum.network;
import net.minecraft.resources.ResourceLocation;
diff --git a/src/main/java/thedarkcolour/exdeorum/network/VoidWorldMessage.java b/src/main/java/thedarkcolour/exdeorum/network/VoidWorldMessage.java
index 8fb1ccea..c4ecc178 100644
--- a/src/main/java/thedarkcolour/exdeorum/network/VoidWorldMessage.java
+++ b/src/main/java/thedarkcolour/exdeorum/network/VoidWorldMessage.java
@@ -1,3 +1,21 @@
+/*
+ * Ex Deorum
+ * Copyright (c) 2023 thedarkcolour
+ *
+ * This program is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation, either version 3 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program. If not, see .
+ */
+
package thedarkcolour.exdeorum.network;
import net.minecraft.network.FriendlyByteBuf;
diff --git a/src/main/java/thedarkcolour/exdeorum/recipe/CodecUtil.java b/src/main/java/thedarkcolour/exdeorum/recipe/CodecUtil.java
index 3e628e34..9645493e 100644
--- a/src/main/java/thedarkcolour/exdeorum/recipe/CodecUtil.java
+++ b/src/main/java/thedarkcolour/exdeorum/recipe/CodecUtil.java
@@ -1,3 +1,21 @@
+/*
+ * Ex Deorum
+ * Copyright (c) 2023 thedarkcolour
+ *
+ * This program is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation, either version 3 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program. If not, see .
+ */
+
package thedarkcolour.exdeorum.recipe;
import com.google.gson.JsonElement;
diff --git a/src/main/java/thedarkcolour/exdeorum/recipe/EFinishedRecipe.java b/src/main/java/thedarkcolour/exdeorum/recipe/EFinishedRecipe.java
index 789eaa98..31c91ada 100644
--- a/src/main/java/thedarkcolour/exdeorum/recipe/EFinishedRecipe.java
+++ b/src/main/java/thedarkcolour/exdeorum/recipe/EFinishedRecipe.java
@@ -1,3 +1,21 @@
+/*
+ * Ex Deorum
+ * Copyright (c) 2023 thedarkcolour
+ *
+ * This program is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation, either version 3 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program. If not, see .
+ */
+
package thedarkcolour.exdeorum.recipe;
import com.google.gson.JsonObject;
diff --git a/src/main/java/thedarkcolour/exdeorum/recipe/ProbabilityRecipe.java b/src/main/java/thedarkcolour/exdeorum/recipe/ProbabilityRecipe.java
index a761f9c8..0a6a951c 100644
--- a/src/main/java/thedarkcolour/exdeorum/recipe/ProbabilityRecipe.java
+++ b/src/main/java/thedarkcolour/exdeorum/recipe/ProbabilityRecipe.java
@@ -1,3 +1,21 @@
+/*
+ * Ex Deorum
+ * Copyright (c) 2023 thedarkcolour
+ *
+ * This program is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation, either version 3 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program. If not, see .
+ */
+
package thedarkcolour.exdeorum.recipe;
import net.minecraft.resources.ResourceLocation;
diff --git a/src/main/java/thedarkcolour/exdeorum/recipe/RecipeUtil.java b/src/main/java/thedarkcolour/exdeorum/recipe/RecipeUtil.java
index 0e33be54..fb0598c6 100644
--- a/src/main/java/thedarkcolour/exdeorum/recipe/RecipeUtil.java
+++ b/src/main/java/thedarkcolour/exdeorum/recipe/RecipeUtil.java
@@ -1,3 +1,21 @@
+/*
+ * Ex Deorum
+ * Copyright (c) 2023 thedarkcolour
+ *
+ * This program is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation, either version 3 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program. If not, see .
+ */
+
package thedarkcolour.exdeorum.recipe;
import com.google.common.cache.Cache;
@@ -5,6 +23,7 @@
import com.google.common.collect.ImmutableList;
import com.google.common.collect.ImmutableMap;
import com.google.gson.JsonObject;
+import it.unimi.dsi.fastutil.objects.ObjectArrayList;
import net.minecraft.network.FriendlyByteBuf;
import net.minecraft.resources.ResourceLocation;
import net.minecraft.util.GsonHelper;
@@ -155,59 +174,32 @@ public static NumberProvider fromNetworkNumberProvider(FriendlyByteBuf buffer) {
};
}
+ // todo support Forge's ingredient types
public static boolean areIngredientsEqual(Ingredient first, Ingredient second) {
// although unlikely, we should check this anyway
if (first == second) return true;
if (first.isVanilla() && second.isVanilla()) {
- Ingredient.Value[] firstValues = first.values;
- Ingredient.Value[] secondValues = second.values;
-
- // if arrays are same size, check if their contents are equal (order matters)
- if (firstValues.length == secondValues.length) {
- for (int i = 0; i < firstValues.length; i++) {
- Ingredient.Value firstValue = firstValues[i];
- Ingredient.Value secondValue = secondValues[i];
- Class> firstKlass = firstValue.getClass();
- Class> secondKlass = secondValue.getClass();
-
- // if values are the same type of class
- if (firstKlass == secondKlass) {
- if (firstKlass == Ingredient.ItemValue.class) {
- // if items are different, return false
- if (!ItemStack.matches(((Ingredient.ItemValue) firstValue).item, ((Ingredient.ItemValue) secondValue).item)) {
- return false;
- }
- } else if (firstKlass == Ingredient.TagValue.class) {
- // if tags are different, return false
- // identity comparison is okay because tags are always interned in vanilla
- if (((Ingredient.TagValue) firstValue).tag != ((Ingredient.TagValue) secondValue).tag) {
- return false;
- }
- } else {
- var firstItems = firstValue.getItems();
- var secondItems = secondValue.getItems();
- var len = firstItems.size();
-
- if (len == secondItems.size()) {
- Iterator firstIter = firstItems.iterator();
- Iterator secondIter = secondItems.iterator();
-
- while (firstIter.hasNext()) {
- if (!ItemStack.matches(firstIter.next(), secondIter.next())) {
- // if one of the items is different, return false
- return false;
- }
- }
- } else {
- // if values have different amounts of items, return false
- return false;
- }
+ var firstValues = new ObjectArrayList<>(first.values);
+ var secondValues = new ObjectArrayList<>(second.values);
+
+ // if arrays are same size, check if their contents are equal (order does not matter)
+ if (firstValues.size() == secondValues.size()) {
+ outer:
+ for (int i = 0; i < firstValues.size(); i++) {
+ var firstValue = firstValues.get(i);
+
+ for (int j = 0; j < firstValues.size(); j++) {
+ if (areValuesEqual(firstValue, secondValues.get(j))) {
+ firstValues.remove(i);
+ secondValues.remove(j);
+ i--;
+
+ continue outer;
}
- } else {
- // if the values are different types, return false
- return false;
}
+
+ return false;
}
// return true if everything was equal
@@ -218,6 +210,48 @@ public static boolean areIngredientsEqual(Ingredient first, Ingredient second) {
return false;
}
+ private static boolean areValuesEqual(Ingredient.Value firstValue, Ingredient.Value secondValue) {
+ Class> firstKlass = firstValue.getClass();
+ Class> secondKlass = secondValue.getClass();
+
+ // if values are the same type of class
+ if (firstKlass == secondKlass) {
+ if (firstKlass == Ingredient.ItemValue.class) {
+ // if items are different, return false
+ return ItemStack.matches(((Ingredient.ItemValue) firstValue).item, ((Ingredient.ItemValue) secondValue).item);
+ } else if (firstKlass == Ingredient.TagValue.class) {
+ // if tags are different, return false
+ // identity comparison is okay because tags are always interned in vanilla
+ return ((Ingredient.TagValue) firstValue).tag == ((Ingredient.TagValue) secondValue).tag;
+ } else {
+ var firstItems = firstValue.getItems();
+ var secondItems = secondValue.getItems();
+ var len = firstItems.size();
+
+ if (len == secondItems.size()) {
+ Iterator firstIter = firstItems.iterator();
+ Iterator secondIter = secondItems.iterator();
+
+ while (firstIter.hasNext()) {
+ if (!ItemStack.matches(firstIter.next(), secondIter.next())) {
+ // if one of the items is different, return false
+ return false;
+ }
+ }
+ } else {
+ // if values have different amounts of items, return false
+ return false;
+ }
+
+ // if all items are the same, return true
+ return true;
+ }
+ } else {
+ // if the values are different types, return false
+ return false;
+ }
+ }
+
public static boolean hasSieveResult(RecipeManager recipes, Item mesh, ItemStack stack) {
for (var recipe : byType(recipes, ERecipeTypes.SIEVE.get())) {
if (recipe.test(mesh, stack)) {
diff --git a/src/main/java/thedarkcolour/exdeorum/recipe/SingleIngredientRecipe.java b/src/main/java/thedarkcolour/exdeorum/recipe/SingleIngredientRecipe.java
index dc8f2d5e..cedbf5c4 100644
--- a/src/main/java/thedarkcolour/exdeorum/recipe/SingleIngredientRecipe.java
+++ b/src/main/java/thedarkcolour/exdeorum/recipe/SingleIngredientRecipe.java
@@ -1,3 +1,21 @@
+/*
+ * Ex Deorum
+ * Copyright (c) 2023 thedarkcolour
+ *
+ * This program is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation, either version 3 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program. If not, see .
+ */
+
package thedarkcolour.exdeorum.recipe;
import net.minecraft.core.NonNullList;
diff --git a/src/main/java/thedarkcolour/exdeorum/recipe/barrel/BarrelCompostRecipe.java b/src/main/java/thedarkcolour/exdeorum/recipe/barrel/BarrelCompostRecipe.java
index e3e3d8f0..c175d89b 100644
--- a/src/main/java/thedarkcolour/exdeorum/recipe/barrel/BarrelCompostRecipe.java
+++ b/src/main/java/thedarkcolour/exdeorum/recipe/barrel/BarrelCompostRecipe.java
@@ -1,3 +1,21 @@
+/*
+ * Ex Deorum
+ * Copyright (c) 2023 thedarkcolour
+ *
+ * This program is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation, either version 3 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program. If not, see .
+ */
+
package thedarkcolour.exdeorum.recipe.barrel;
import com.google.gson.JsonObject;
diff --git a/src/main/java/thedarkcolour/exdeorum/recipe/barrel/BarrelMixingRecipe.java b/src/main/java/thedarkcolour/exdeorum/recipe/barrel/BarrelMixingRecipe.java
index 62d30258..c2dd07de 100644
--- a/src/main/java/thedarkcolour/exdeorum/recipe/barrel/BarrelMixingRecipe.java
+++ b/src/main/java/thedarkcolour/exdeorum/recipe/barrel/BarrelMixingRecipe.java
@@ -1,3 +1,21 @@
+/*
+ * Ex Deorum
+ * Copyright (c) 2023 thedarkcolour
+ *
+ * This program is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation, either version 3 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program. If not, see .
+ */
+
package thedarkcolour.exdeorum.recipe.barrel;
import com.google.gson.JsonObject;
@@ -11,8 +29,8 @@
import net.minecraft.world.item.crafting.RecipeSerializer;
import net.minecraft.world.item.crafting.RecipeType;
import net.minecraft.world.level.Level;
+import net.minecraft.world.level.material.Fluid;
import net.minecraftforge.fluids.FluidStack;
-import net.minecraftforge.fluids.FluidType;
import net.minecraftforge.registries.ForgeRegistries;
import org.jetbrains.annotations.Nullable;
import thedarkcolour.exdeorum.recipe.RecipeUtil;
@@ -21,13 +39,13 @@
import thedarkcolour.exdeorum.registry.ERecipeTypes;
public class BarrelMixingRecipe extends SingleIngredientRecipe {
- public final FluidType fluidType;
+ public final Fluid fluid;
public final int fluidAmount;
public final Item result;
- public BarrelMixingRecipe(ResourceLocation id, Ingredient ingredient, FluidType fluidType, int fluidAmount, Item result) {
+ public BarrelMixingRecipe(ResourceLocation id, Ingredient ingredient, Fluid fluid, int fluidAmount, Item result) {
super(id, ingredient);
- this.fluidType = fluidType;
+ this.fluid = fluid;
this.fluidAmount = fluidAmount;
this.result = result;
}
@@ -40,7 +58,7 @@ public boolean matches(Container inventory, Level level) {
}
public boolean matches(ItemStack item, FluidStack fluid) {
- return ingredient.test(item) && fluid.getFluid().getFluidType() == fluidType && fluid.getAmount() >= fluidAmount;
+ return ingredient.test(item) && fluid.getFluid() == this.fluid && fluid.getAmount() >= fluidAmount;
}
@Override
@@ -55,31 +73,31 @@ public RecipeType> getType() {
public static class Serializer implements RecipeSerializer {
@Override
- public BarrelMixingRecipe fromJson(ResourceLocation name, JsonObject json) {
+ public BarrelMixingRecipe fromJson(ResourceLocation id, JsonObject json) {
Ingredient ingredient = RecipeUtil.readIngredient(json, "ingredient");
- FluidType fluidType = ForgeRegistries.FLUID_TYPES.get().getValue(new ResourceLocation(GsonHelper.getAsString(json, "fluid_type")));
+ Fluid fluid = ForgeRegistries.FLUIDS.getValue(new ResourceLocation(GsonHelper.getAsString(json, "fluid")));
int fluidAmount = GsonHelper.getAsInt(json, "fluid_amount");
Item result = ForgeRegistries.ITEMS.getValue(new ResourceLocation(GsonHelper.getAsString(json, "result")));
- return new BarrelMixingRecipe(name, ingredient, fluidType, fluidAmount, result);
+ return new BarrelMixingRecipe(id, ingredient, fluid, fluidAmount, result);
}
@Override
public void toNetwork(FriendlyByteBuf buffer, BarrelMixingRecipe recipe) {
recipe.ingredient.toNetwork(buffer);
- buffer.writeRegistryId(ForgeRegistries.FLUID_TYPES.get(), recipe.fluidType);
+ buffer.writeRegistryId(ForgeRegistries.FLUIDS, recipe.fluid);
buffer.writeVarInt(recipe.fluidAmount);
buffer.writeRegistryId(ForgeRegistries.ITEMS, recipe.result);
}
@Override
- public @Nullable BarrelMixingRecipe fromNetwork(ResourceLocation name, FriendlyByteBuf buffer) {
+ public @Nullable BarrelMixingRecipe fromNetwork(ResourceLocation id, FriendlyByteBuf buffer) {
Ingredient ingredient = Ingredient.fromNetwork(buffer);
- FluidType fluidType = buffer.readRegistryId();
+ Fluid fluid = buffer.readRegistryId();
int fluidAmount = buffer.readVarInt();
Item result = buffer.readRegistryId();
- return new BarrelMixingRecipe(name, ingredient, fluidType, fluidAmount, result);
+ return new BarrelMixingRecipe(id, ingredient, fluid, fluidAmount, result);
}
}
}
diff --git a/src/main/java/thedarkcolour/exdeorum/recipe/barrel/FinishedBarrelCompostRecipe.java b/src/main/java/thedarkcolour/exdeorum/recipe/barrel/FinishedBarrelCompostRecipe.java
index 3bd7dcdf..b982a112 100644
--- a/src/main/java/thedarkcolour/exdeorum/recipe/barrel/FinishedBarrelCompostRecipe.java
+++ b/src/main/java/thedarkcolour/exdeorum/recipe/barrel/FinishedBarrelCompostRecipe.java
@@ -1,3 +1,21 @@
+/*
+ * Ex Deorum
+ * Copyright (c) 2023 thedarkcolour
+ *
+ * This program is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation, either version 3 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program. If not, see .
+ */
+
package thedarkcolour.exdeorum.recipe.barrel;
import com.google.gson.JsonObject;
diff --git a/src/main/java/thedarkcolour/exdeorum/recipe/barrel/FinishedBarrelMixingRecipe.java b/src/main/java/thedarkcolour/exdeorum/recipe/barrel/FinishedBarrelMixingRecipe.java
index 5a75262f..e1d23ced 100644
--- a/src/main/java/thedarkcolour/exdeorum/recipe/barrel/FinishedBarrelMixingRecipe.java
+++ b/src/main/java/thedarkcolour/exdeorum/recipe/barrel/FinishedBarrelMixingRecipe.java
@@ -1,3 +1,21 @@
+/*
+ * Ex Deorum
+ * Copyright (c) 2023 thedarkcolour
+ *
+ * This program is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation, either version 3 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program. If not, see .
+ */
+
package thedarkcolour.exdeorum.recipe.barrel;
import com.google.gson.JsonObject;
@@ -5,7 +23,7 @@
import net.minecraft.world.item.Item;
import net.minecraft.world.item.crafting.Ingredient;
import net.minecraft.world.item.crafting.RecipeSerializer;
-import net.minecraftforge.fluids.FluidType;
+import net.minecraft.world.level.material.Fluid;
import net.minecraftforge.registries.ForgeRegistries;
import thedarkcolour.exdeorum.recipe.EFinishedRecipe;
import thedarkcolour.exdeorum.registry.ERecipeSerializers;
@@ -13,14 +31,14 @@
public class FinishedBarrelMixingRecipe implements EFinishedRecipe {
private final ResourceLocation id;
private final Ingredient ingredient;
- private final FluidType fluidType;
+ private final Fluid fluid;
private final int fluidAmount;
private final Item result;
- public FinishedBarrelMixingRecipe(ResourceLocation id, Ingredient ingredient, FluidType fluidType, int fluidAmount, Item result) {
+ public FinishedBarrelMixingRecipe(ResourceLocation id, Ingredient ingredient, Fluid fluid, int fluidAmount, Item result) {
this.id = id;
this.ingredient = ingredient;
- this.fluidType = fluidType;
+ this.fluid = fluid;
this.fluidAmount = fluidAmount;
this.result = result;
}
@@ -28,7 +46,7 @@ public FinishedBarrelMixingRecipe(ResourceLocation id, Ingredient ingredient, Fl
@Override
public void serializeRecipeData(JsonObject json) {
json.add("ingredient", this.ingredient.toJson());
- json.addProperty("fluid_type", ForgeRegistries.FLUID_TYPES.get().getKey(this.fluidType).toString());
+ json.addProperty("fluid", ForgeRegistries.FLUIDS.getKey(this.fluid).toString());
json.addProperty("fluid_amount", this.fluidAmount);
json.addProperty("result", ForgeRegistries.ITEMS.getKey(this.result).toString());
}
diff --git a/src/main/java/thedarkcolour/exdeorum/recipe/crucible/CrucibleRecipe.java b/src/main/java/thedarkcolour/exdeorum/recipe/crucible/CrucibleRecipe.java
index f5b082a7..26045f7e 100644
--- a/src/main/java/thedarkcolour/exdeorum/recipe/crucible/CrucibleRecipe.java
+++ b/src/main/java/thedarkcolour/exdeorum/recipe/crucible/CrucibleRecipe.java
@@ -1,3 +1,21 @@
+/*
+ * Ex Deorum
+ * Copyright (c) 2023 thedarkcolour
+ *
+ * This program is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation, either version 3 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program. If not, see .
+ */
+
package thedarkcolour.exdeorum.recipe.crucible;
import com.google.gson.JsonObject;
diff --git a/src/main/java/thedarkcolour/exdeorum/recipe/crucible/FinishedCrucibleRecipe.java b/src/main/java/thedarkcolour/exdeorum/recipe/crucible/FinishedCrucibleRecipe.java
index b09b2178..f8a0204f 100644
--- a/src/main/java/thedarkcolour/exdeorum/recipe/crucible/FinishedCrucibleRecipe.java
+++ b/src/main/java/thedarkcolour/exdeorum/recipe/crucible/FinishedCrucibleRecipe.java
@@ -1,3 +1,21 @@
+/*
+ * Ex Deorum
+ * Copyright (c) 2023 thedarkcolour
+ *
+ * This program is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation, either version 3 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program. If not, see .
+ */
+
package thedarkcolour.exdeorum.recipe.crucible;
import com.google.gson.JsonObject;
diff --git a/src/main/java/thedarkcolour/exdeorum/recipe/hammer/FinishedHammerRecipe.java b/src/main/java/thedarkcolour/exdeorum/recipe/hammer/FinishedHammerRecipe.java
index 3bdb01fb..80ef84c5 100644
--- a/src/main/java/thedarkcolour/exdeorum/recipe/hammer/FinishedHammerRecipe.java
+++ b/src/main/java/thedarkcolour/exdeorum/recipe/hammer/FinishedHammerRecipe.java
@@ -1,3 +1,21 @@
+/*
+ * Ex Deorum
+ * Copyright (c) 2023 thedarkcolour
+ *
+ * This program is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation, either version 3 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program. If not, see .
+ */
+
package thedarkcolour.exdeorum.recipe.hammer;
import com.google.gson.JsonObject;
diff --git a/src/main/java/thedarkcolour/exdeorum/recipe/hammer/HammerRecipe.java b/src/main/java/thedarkcolour/exdeorum/recipe/hammer/HammerRecipe.java
index 1bdbfe61..e67196a2 100644
--- a/src/main/java/thedarkcolour/exdeorum/recipe/hammer/HammerRecipe.java
+++ b/src/main/java/thedarkcolour/exdeorum/recipe/hammer/HammerRecipe.java
@@ -1,3 +1,21 @@
+/*
+ * Ex Deorum
+ * Copyright (c) 2023 thedarkcolour
+ *
+ * This program is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation, either version 3 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program. If not, see .
+ */
+
package thedarkcolour.exdeorum.recipe.hammer;
import com.google.gson.JsonObject;
diff --git a/src/main/java/thedarkcolour/exdeorum/recipe/sieve/FinishedSieveRecipe.java b/src/main/java/thedarkcolour/exdeorum/recipe/sieve/FinishedSieveRecipe.java
index 0ba7772e..6bbe1c6d 100644
--- a/src/main/java/thedarkcolour/exdeorum/recipe/sieve/FinishedSieveRecipe.java
+++ b/src/main/java/thedarkcolour/exdeorum/recipe/sieve/FinishedSieveRecipe.java
@@ -1,3 +1,21 @@
+/*
+ * Ex Deorum
+ * Copyright (c) 2023 thedarkcolour
+ *
+ * This program is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation, either version 3 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program. If not, see .
+ */
+
package thedarkcolour.exdeorum.recipe.sieve;
import com.google.gson.JsonObject;
diff --git a/src/main/java/thedarkcolour/exdeorum/recipe/sieve/SieveRecipe.java b/src/main/java/thedarkcolour/exdeorum/recipe/sieve/SieveRecipe.java
index c619236e..403612eb 100644
--- a/src/main/java/thedarkcolour/exdeorum/recipe/sieve/SieveRecipe.java
+++ b/src/main/java/thedarkcolour/exdeorum/recipe/sieve/SieveRecipe.java
@@ -1,3 +1,21 @@
+/*
+ * Ex Deorum
+ * Copyright (c) 2023 thedarkcolour
+ *
+ * This program is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation, either version 3 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program. If not, see .
+ */
+
package thedarkcolour.exdeorum.recipe.sieve;
import com.google.gson.JsonObject;
diff --git a/src/main/java/thedarkcolour/exdeorum/registry/EBlockEntities.java b/src/main/java/thedarkcolour/exdeorum/registry/EBlockEntities.java
index c7db9764..74f49407 100644
--- a/src/main/java/thedarkcolour/exdeorum/registry/EBlockEntities.java
+++ b/src/main/java/thedarkcolour/exdeorum/registry/EBlockEntities.java
@@ -1,3 +1,21 @@
+/*
+ * Ex Deorum
+ * Copyright (c) 2023 thedarkcolour
+ *
+ * This program is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation, either version 3 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program. If not, see .
+ */
+
package thedarkcolour.exdeorum.registry;
import net.minecraft.world.level.block.entity.BlockEntityType;
diff --git a/src/main/java/thedarkcolour/exdeorum/registry/EBlocks.java b/src/main/java/thedarkcolour/exdeorum/registry/EBlocks.java
index d12f5271..6c8fedbe 100644
--- a/src/main/java/thedarkcolour/exdeorum/registry/EBlocks.java
+++ b/src/main/java/thedarkcolour/exdeorum/registry/EBlocks.java
@@ -1,5 +1,24 @@
+/*
+ * Ex Deorum
+ * Copyright (c) 2023 thedarkcolour
+ *
+ * This program is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation, either version 3 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program. If not, see .
+ */
+
package thedarkcolour.exdeorum.registry;
+import net.minecraft.world.item.DyeColor;
import net.minecraft.world.level.block.Block;
import net.minecraft.world.level.block.Blocks;
import net.minecraft.world.level.block.LiquidBlock;
@@ -10,6 +29,7 @@
import net.minecraftforge.registries.RegistryObject;
import thedarkcolour.exdeorum.ExDeorum;
import thedarkcolour.exdeorum.block.BarrelBlock;
+import thedarkcolour.exdeorum.block.EndCakeBlock;
import thedarkcolour.exdeorum.block.InfestedLeavesBlock;
import thedarkcolour.exdeorum.block.LavaCrucibleBlock;
import thedarkcolour.exdeorum.block.SieveBlock;
@@ -23,23 +43,25 @@ public class EBlocks {
public static final DeferredRegister BLOCKS = DeferredRegister.create(ForgeRegistries.BLOCKS, ExDeorum.ID);
// Materials
- public static final RegistryObject DUST = BLOCKS.register("dust", () -> new Block(of().sound(SoundType.WOOL).strength(0.4f)));
- public static final RegistryObject CRUSHED_NETHERRACK = BLOCKS.register("crushed_netherrack", () -> new Block(of().sound(SoundType.WOOL).strength(0.6f)));
- public static final RegistryObject CRUSHED_END_STONE = BLOCKS.register("crushed_end_stone", () -> new Block(of().sound(SoundType.WOOL).strength(0.6f)));
+ public static final RegistryObject DUST = BLOCKS.register("dust", () -> new Block(of().sound(SoundType.SAND).strength(0.4f)));
+ public static final RegistryObject CRUSHED_NETHERRACK = BLOCKS.register("crushed_netherrack", () -> new Block(of().mapColor(MapColor.NETHER).sound(SoundType.SAND).strength(0.6f)));
+ public static final RegistryObject CRUSHED_END_STONE = BLOCKS.register("crushed_end_stone", () -> new Block(of().mapColor(MapColor.SAND).sound(SoundType.SAND).strength(0.6f)));
+ public static final RegistryObject CRUSHED_DEEPSLATE = BLOCKS.register("crushed_deepslate", () -> new Block(of().mapColor(DyeColor.GRAY).sound(SoundType.SAND).strength(0.8f)));
+ public static final RegistryObject CRUSHED_BLACKSTONE = BLOCKS.register("crushed_blackstone", () -> new Block(of().mapColor(DyeColor.BLACK).sound(SoundType.SAND).strength(0.6f)));
// Barrels
- public static final RegistryObject OAK_BARREL = registerBarrel("oak_barrel", false, false);
- public static final RegistryObject SPRUCE_BARREL = registerBarrel("spruce_barrel", false, false);
- public static final RegistryObject BIRCH_BARREL = registerBarrel("birch_barrel", false, false);
- public static final RegistryObject JUNGLE_BARREL = registerBarrel("jungle_barrel", false, false);
- public static final RegistryObject ACACIA_BARREL = registerBarrel("acacia_barrel", false, false);
- public static final RegistryObject DARK_OAK_BARREL = registerBarrel("dark_oak_barrel", false, false);
- public static final RegistryObject MANGROVE_BARREL = registerBarrel("mangrove_barrel", false, false);
- public static final RegistryObject CHERRY_BARREL = registerBarrel("cherry_barrel", false, false);
- public static final RegistryObject BAMBOO_BARREL = registerBarrel("bamboo_barrel", false, false);
- public static final RegistryObject CRIMSON_BARREL = registerBarrel("crimson_barrel", false, true);
- public static final RegistryObject WARPED_BARREL = registerBarrel("warped_barrel", false, true);
- public static final RegistryObject STONE_BARREL = registerBarrel("stone_barrel", true, true);
+ public static final RegistryObject OAK_BARREL = registerBarrel("oak_barrel", false, false, MapColor.WOOD);
+ public static final RegistryObject SPRUCE_BARREL = registerBarrel("spruce_barrel", false, false, MapColor.PODZOL);
+ public static final RegistryObject BIRCH_BARREL = registerBarrel("birch_barrel", false, false, MapColor.SAND);
+ public static final RegistryObject JUNGLE_BARREL = registerBarrel("jungle_barrel", false, false, MapColor.DIRT);
+ public static final RegistryObject ACACIA_BARREL = registerBarrel("acacia_barrel", false, false, MapColor.COLOR_ORANGE);
+ public static final RegistryObject DARK_OAK_BARREL = registerBarrel("dark_oak_barrel", false, false, MapColor.COLOR_BROWN);
+ public static final RegistryObject MANGROVE_BARREL = registerBarrel("mangrove_barrel", false, false, MapColor.COLOR_RED);
+ public static final RegistryObject CHERRY_BARREL = registerBarrel("cherry_barrel", false, false, MapColor.TERRACOTTA_WHITE);
+ public static final RegistryObject BAMBOO_BARREL = registerBarrel("bamboo_barrel", false, false, MapColor.COLOR_YELLOW);
+ public static final RegistryObject CRIMSON_BARREL = registerBarrel("crimson_barrel", false, true, MapColor.CRIMSON_STEM);
+ public static final RegistryObject WARPED_BARREL = registerBarrel("warped_barrel", false, true, MapColor.WARPED_STEM);
+ public static final RegistryObject STONE_BARREL = registerBarrel("stone_barrel", true, true, MapColor.STONE);
// Sieves
public static final RegistryObject OAK_SIEVE = registerSieve("oak_sieve");
@@ -58,7 +80,7 @@ public class EBlocks {
public static final RegistryObject PORCELAIN_CRUCIBLE = registerLavaCrucible("porcelain_crucible", false);
public static final RegistryObject WARPED_CRUCIBLE = registerLavaCrucible("warped_crucible", true);
public static final RegistryObject CRIMSON_CRUCIBLE = registerLavaCrucible("crimson_crucible", true);
- public static final RegistryObject UNFIRED_CRUCIBLE = BLOCKS.register("unfired_crucible", () -> new UnfiredCrucibleBlock(of().strength(2.0f)));
+ public static final RegistryObject UNFIRED_PORCELAIN_CRUCIBLE = BLOCKS.register("unfired_porcelain_crucible", () -> new UnfiredCrucibleBlock(of().strength(2.0f)));
// Water Crucibles
public static final RegistryObject OAK_CRUCIBLE = registerWaterCrucible("oak_crucible");
@@ -73,17 +95,14 @@ public class EBlocks {
// Misc
public static final RegistryObject INFESTED_LEAVES = BLOCKS.register("infested_leaves", () -> new InfestedLeavesBlock(copy(Blocks.OAK_LEAVES)));
- public static final RegistryObject WITCH_WATER = BLOCKS.register("witch_water", () -> new LiquidBlock(EFluids.WITCH_WATER_STILL, copy(Blocks.WATER).mapColor(MapColor.COLOR_PURPLE)));
+ public static final RegistryObject WITCH_WATER = BLOCKS.register("witch_water", () -> new LiquidBlock(EFluids.WITCH_WATER, copy(Blocks.WATER).mapColor(MapColor.COLOR_PURPLE)));
+ public static final RegistryObject END_CAKE = BLOCKS.register("end_cake", () -> new EndCakeBlock(of().noLootTable().mapColor(MapColor.COLOR_BLACK)));
public static RegistryObject registerSieve(String name) {
return BLOCKS.register(name, () -> new SieveBlock(of().strength(2.0f).noOcclusion().sound(SoundType.WOOD)));
}
- //public static RegistryObject registerHeavySieve(String name) {
- // return BLOCKS.register(name, () -> new HeavySieveBlock(of(material).strength(2.0f).sound(SoundType.WOOD)));
- //}
-
- public static RegistryObject registerBarrel(String name, boolean stone, boolean fireproof) {
+ public static RegistryObject registerBarrel(String name, boolean stone, boolean fireproof, MapColor color) {
return BLOCKS.register(name, () -> {
var props = of().noOcclusion().strength(stone ? 4.0f : 2.0f).sound(stone ? SoundType.STONE : SoundType.WOOD);
if (!stone) {
@@ -93,6 +112,7 @@ public static RegistryObject registerBarrel(String name, boolean st
} else {
props.requiresCorrectToolForDrops();
}
+ props.mapColor(color);
return new BarrelBlock(props);
});
}
diff --git a/src/main/java/thedarkcolour/exdeorum/registry/EChunkGenerators.java b/src/main/java/thedarkcolour/exdeorum/registry/EChunkGenerators.java
index e409381f..1a898ef4 100644
--- a/src/main/java/thedarkcolour/exdeorum/registry/EChunkGenerators.java
+++ b/src/main/java/thedarkcolour/exdeorum/registry/EChunkGenerators.java
@@ -1,3 +1,21 @@
+/*
+ * Ex Deorum
+ * Copyright (c) 2023 thedarkcolour
+ *
+ * This program is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation, either version 3 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program. If not, see .
+ */
+
package thedarkcolour.exdeorum.registry;
import com.mojang.serialization.Codec;
diff --git a/src/main/java/thedarkcolour/exdeorum/registry/ECreativeTabs.java b/src/main/java/thedarkcolour/exdeorum/registry/ECreativeTabs.java
index d77d9c19..e01b5f9a 100644
--- a/src/main/java/thedarkcolour/exdeorum/registry/ECreativeTabs.java
+++ b/src/main/java/thedarkcolour/exdeorum/registry/ECreativeTabs.java
@@ -1,3 +1,21 @@
+/*
+ * Ex Deorum
+ * Copyright (c) 2023 thedarkcolour
+ *
+ * This program is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation, either version 3 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program. If not, see .
+ */
+
package thedarkcolour.exdeorum.registry;
import net.minecraft.Util;
diff --git a/src/main/java/thedarkcolour/exdeorum/registry/EFluids.java b/src/main/java/thedarkcolour/exdeorum/registry/EFluids.java
index 1e6e7de1..8577fd18 100644
--- a/src/main/java/thedarkcolour/exdeorum/registry/EFluids.java
+++ b/src/main/java/thedarkcolour/exdeorum/registry/EFluids.java
@@ -1,3 +1,21 @@
+/*
+ * Ex Deorum
+ * Copyright (c) 2023 thedarkcolour
+ *
+ * This program is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation, either version 3 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program. If not, see .
+ */
+
package thedarkcolour.exdeorum.registry;
import net.minecraft.world.level.material.Fluid;
@@ -15,6 +33,6 @@ public class EFluids {
public static final RegistryObject WITCH_WATER_TYPE = FLUID_TYPES.register("witch_water", WitchWaterFluid::new);
- public static final RegistryObject WITCH_WATER_STILL = FLUIDS.register("witch_water", () -> new ForgeFlowingFluid.Source(WitchWaterFluid.properties()));
+ public static final RegistryObject WITCH_WATER = FLUIDS.register("witch_water", () -> new ForgeFlowingFluid.Source(WitchWaterFluid.properties()));
public static final RegistryObject WITCH_WATER_FLOWING = FLUIDS.register("flowing_witch_water", () -> new ForgeFlowingFluid.Flowing(WitchWaterFluid.properties()));
}
diff --git a/src/main/java/thedarkcolour/exdeorum/registry/EGlobalLootModifiers.java b/src/main/java/thedarkcolour/exdeorum/registry/EGlobalLootModifiers.java
index 2b1c3154..c302e512 100644
--- a/src/main/java/thedarkcolour/exdeorum/registry/EGlobalLootModifiers.java
+++ b/src/main/java/thedarkcolour/exdeorum/registry/EGlobalLootModifiers.java
@@ -1,3 +1,21 @@
+/*
+ * Ex Deorum
+ * Copyright (c) 2023 thedarkcolour
+ *
+ * This program is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation, either version 3 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program. If not, see .
+ */
+
package thedarkcolour.exdeorum.registry;
import com.mojang.serialization.Codec;
diff --git a/src/main/java/thedarkcolour/exdeorum/registry/EItems.java b/src/main/java/thedarkcolour/exdeorum/registry/EItems.java
index 3a778e26..dd581cc0 100644
--- a/src/main/java/thedarkcolour/exdeorum/registry/EItems.java
+++ b/src/main/java/thedarkcolour/exdeorum/registry/EItems.java
@@ -1,3 +1,21 @@
+/*
+ * Ex Deorum
+ * Copyright (c) 2023 thedarkcolour
+ *
+ * This program is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation, either version 3 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program. If not, see .
+ */
+
package thedarkcolour.exdeorum.registry;
import net.minecraft.world.food.FoodProperties;
@@ -7,35 +25,54 @@
import net.minecraft.world.item.Items;
import net.minecraft.world.item.Tiers;
import net.minecraft.world.level.block.Block;
+import net.minecraft.world.level.block.Blocks;
+import net.minecraft.world.level.material.Fluids;
import net.minecraftforge.registries.DeferredRegister;
import net.minecraftforge.registries.ForgeRegistries;
import net.minecraftforge.registries.RegistryObject;
import thedarkcolour.exdeorum.ExDeorum;
+import thedarkcolour.exdeorum.item.CookedSilkWormItem;
import thedarkcolour.exdeorum.item.CrookItem;
+import thedarkcolour.exdeorum.item.GrassSpreaderItem;
import thedarkcolour.exdeorum.item.HammerItem;
import thedarkcolour.exdeorum.item.MeshItem;
-import thedarkcolour.exdeorum.item.PorcelainBucketItem;
+import thedarkcolour.exdeorum.item.NyliumSpreaderItem;
+import thedarkcolour.exdeorum.item.PorcelainBucket;
+import thedarkcolour.exdeorum.item.PorcelainMilkBucket;
+import thedarkcolour.exdeorum.item.SculkCoreItem;
import thedarkcolour.exdeorum.item.SilkWormItem;
+import thedarkcolour.exdeorum.item.WateringCanItem;
+import thedarkcolour.exdeorum.item.WideWateringCanItem;
import thedarkcolour.exdeorum.item.WitchWaterBucketItem;
+import java.util.List;
+
public class EItems {
public static final DeferredRegister- ITEMS = DeferredRegister.create(ForgeRegistries.ITEMS, ExDeorum.ID);
// Silk Worm
public static final RegistryObject SILK_WORM = ITEMS.register("silk_worm", () -> new SilkWormItem(props()));
- public static final RegistryObject
- COOKED_SILK_WORM = ITEMS.register("cooked_silk_worm", () -> new Item(props().food(new FoodProperties.Builder().nutrition(2).saturationMod(0.6f).build())));
+ public static final RegistryObject
- COOKED_SILK_WORM = ITEMS.register("cooked_silk_worm", () -> new CookedSilkWormItem(props().food(new FoodProperties.Builder().nutrition(2).saturationMod(0.6f).build())));
// Crooks
- public static final RegistryObject
- CROOK = ITEMS.register("crook", () -> new CrookItem(props().durability(128)));
- public static final RegistryObject
- BONE_CROOK = ITEMS.register("bone_crook", () -> new CrookItem(props().durability(312)));
+ public static final RegistryObject
- CROOK = ITEMS.register("crook", () -> new CrookItem(props().durability(128), 2.0f));
+ public static final RegistryObject
- BONE_CROOK = ITEMS.register("bone_crook", () -> new CrookItem(props().durability(312), 4.0f));
+
+ // Watering cans
+ public static final RegistryObject
- WOODEN_WATERING_CAN = ITEMS.register("wooden_watering_can", () -> new WateringCanItem(300, props().stacksTo(1)));
+ public static final RegistryObject
- STONE_WATERING_CAN = ITEMS.register("stone_watering_can", () -> new WateringCanItem(1000, props().stacksTo(1)));
+ public static final RegistryObject
- IRON_WATERING_CAN = ITEMS.register("iron_watering_can", () -> new WateringCanItem(2000, props().stacksTo(1)));
+ public static final RegistryObject
- GOLDEN_WATERING_CAN = ITEMS.register("golden_watering_can", () -> new WateringCanItem(4000, props().stacksTo(1)));
+ public static final RegistryObject
- DIAMOND_WATERING_CAN = ITEMS.register("diamond_watering_can", () -> new WideWateringCanItem(false, props().stacksTo(1)));
+ public static final RegistryObject
- NETHERITE_WATERING_CAN = ITEMS.register("netherite_watering_can", () -> new WideWateringCanItem(true, props().stacksTo(1)));
// Sieve Meshes
- public static final RegistryObject
- STRING_MESH = ITEMS.register("string_mesh", () -> new MeshItem(props().stacksTo(1)));
- public static final RegistryObject
- FLINT_MESH = ITEMS.register("flint_mesh", () -> new MeshItem(props().stacksTo(1)));
- public static final RegistryObject
- IRON_MESH = ITEMS.register("iron_mesh", () -> new MeshItem(props().stacksTo(1)));
- public static final RegistryObject
- GOLDEN_MESH = ITEMS.register("golden_mesh", () -> new MeshItem(props().stacksTo(1)));
- public static final RegistryObject
- DIAMOND_MESH = ITEMS.register("diamond_mesh", () -> new MeshItem(props().stacksTo(1)));
- public static final RegistryObject
- NETHERITE_MESH = ITEMS.register("netherite_mesh", () -> new MeshItem(props().stacksTo(1)));
+ public static final RegistryObject
- STRING_MESH = ITEMS.register("string_mesh", () -> new MeshItem(props().stacksTo(16)));
+ public static final RegistryObject
- FLINT_MESH = ITEMS.register("flint_mesh", () -> new MeshItem(props().stacksTo(16)));
+ public static final RegistryObject
- IRON_MESH = ITEMS.register("iron_mesh", () -> new MeshItem(props().stacksTo(16)));
+ public static final RegistryObject
- GOLDEN_MESH = ITEMS.register("golden_mesh", () -> new MeshItem(props().stacksTo(16)));
+ public static final RegistryObject
- DIAMOND_MESH = ITEMS.register("diamond_mesh", () -> new MeshItem(props().stacksTo(16)));
+ public static final RegistryObject
- NETHERITE_MESH = ITEMS.register("netherite_mesh", () -> new MeshItem(props().stacksTo(16)));
// Hammers
public static final RegistryObject
- WOODEN_HAMMER = ITEMS.register("wooden_hammer", () -> new HammerItem(Tiers.WOOD, props()));
@@ -57,10 +94,25 @@ public class EItems {
public static final RegistryObject
- ANDESITE_PEBBLE = registerSimpleItem("andesite_pebble");
public static final RegistryObject
- DEEPSLATE_PEBBLE = registerSimpleItem("deepslate_pebble");
public static final RegistryObject
- TUFF_PEBBLE = registerSimpleItem("tuff_pebble");
+ public static final RegistryObject
- CALCITE_PEBBLE = registerSimpleItem("calcite_pebble");
+ public static final RegistryObject
- BLACKSTONE_PEBBLE = registerSimpleItem("blackstone_pebble");
+ public static final RegistryObject
- BASALT_PEBBLE = registerSimpleItem("basalt_pebble");
// Misc
- public static final RegistryObject
- PORCELAIN_CLAY = registerSimpleItem("porcelain_clay");
- public static final RegistryObject
- PORCELAIN_BUCKET = ITEMS.register("porcelain_bucket", () -> new PorcelainBucketItem(props().stacksTo(1)));
+ public static final RegistryObject
- PORCELAIN_CLAY_BALL = registerSimpleItem("porcelain_clay_ball");
+ public static final RegistryObject
- GRASS_SEEDS = ITEMS.register("grass_seeds", () -> new GrassSpreaderItem(props(), Blocks.GRASS_BLOCK::defaultBlockState));
+ public static final RegistryObject
- MYCELIUM_SPORES = ITEMS.register("mycelium_spores", () -> new GrassSpreaderItem(props(), Blocks.MYCELIUM::defaultBlockState));
+ public static final RegistryObject
- WARPED_NYLIUM_SPORES = ITEMS.register("warped_nylium_spores", () -> new NyliumSpreaderItem(props(), Blocks.WARPED_NYLIUM::defaultBlockState));
+ public static final RegistryObject
- CRIMSON_NYLIUM_SPORES = ITEMS.register("crimson_nylium_spores", () -> new NyliumSpreaderItem(props(), Blocks.CRIMSON_NYLIUM::defaultBlockState));
+ public static final RegistryObject
- SCULK_CORE = ITEMS.register("sculk_core", () -> new SculkCoreItem(props().stacksTo(1)));
+
+ // Buckets
+ public static final RegistryObject
- UNFIRED_PORCELAIN_BUCKET = registerSimpleItem("unfired_porcelain_bucket");
+ public static final RegistryObject
- PORCELAIN_BUCKET = ITEMS.register("porcelain_bucket", () -> new PorcelainBucket(() -> Fluids.EMPTY, props().stacksTo(16)));
+ public static final RegistryObject
- PORCELAIN_WATER_BUCKET = ITEMS.register("porcelain_water_bucket", () -> new PorcelainBucket(() -> Fluids.WATER, props().craftRemainder(PORCELAIN_BUCKET.get()).stacksTo(1)));
+ public static final RegistryObject
- PORCELAIN_LAVA_BUCKET = ITEMS.register("porcelain_lava_bucket", () -> new PorcelainBucket(() -> Fluids.LAVA, props().stacksTo(1)));
+ public static final RegistryObject
- PORCELAIN_MILK_BUCKET = ITEMS.register("porcelain_milk_bucket", () -> new PorcelainMilkBucket(props().craftRemainder(PORCELAIN_BUCKET.get()).stacksTo(1)));
+ public static final RegistryObject
- PORCELAIN_WITCH_WATER_BUCKET = ITEMS.register("porcelain_witch_water_bucket", () -> new PorcelainBucket(EFluids.WITCH_WATER, props().craftRemainder(PORCELAIN_BUCKET.get()).stacksTo(1)));
// Fluids
public static final RegistryObject
- WITCH_WATER_BUCKET = ITEMS.register("witch_water_bucket", () -> new WitchWaterBucketItem(props().craftRemainder(Items.BUCKET).stacksTo(1)));
@@ -80,53 +132,57 @@ public static RegistryObject registerItemBlock(RegistryObject exten
}
// BlockItems
- public static final RegistryObject DUST;
- public static final RegistryObject CRUSHED_NETHERRACK;
- public static final RegistryObject CRUSHED_END_STONE;
+ public static final RegistryObject DUST = registerItemBlock(EBlocks.DUST);
+ public static final RegistryObject CRUSHED_NETHERRACK = registerItemBlock(EBlocks.CRUSHED_NETHERRACK);
+ public static final RegistryObject CRUSHED_END_STONE = registerItemBlock(EBlocks.CRUSHED_END_STONE);
+ public static final RegistryObject CRUSHED_DEEPSLATE = registerItemBlock(EBlocks.CRUSHED_DEEPSLATE);
+ public static final RegistryObject CRUSHED_BLACKSTONE = registerItemBlock(EBlocks.CRUSHED_BLACKSTONE);
// Barrels
- public static final RegistryObject OAK_BARREL;
- public static final RegistryObject SPRUCE_BARREL;
- public static final RegistryObject BIRCH_BARREL;
- public static final RegistryObject JUNGLE_BARREL;
- public static final RegistryObject ACACIA_BARREL;
- public static final RegistryObject DARK_OAK_BARREL;
- public static final RegistryObject MANGROVE_BARREL;
- public static final RegistryObject CHERRY_BARREL;
- public static final RegistryObject BAMBOO_BARREL;
- public static final RegistryObject CRIMSON_BARREL;
- public static final RegistryObject WARPED_BARREL;
- public static final RegistryObject STONE_BARREL;
+ public static final RegistryObject OAK_BARREL = registerItemBlock(EBlocks.OAK_BARREL);
+ public static final RegistryObject SPRUCE_BARREL = registerItemBlock(EBlocks.SPRUCE_BARREL);
+ public static final RegistryObject BIRCH_BARREL = registerItemBlock(EBlocks.BIRCH_BARREL);
+ public static final RegistryObject JUNGLE_BARREL = registerItemBlock(EBlocks.JUNGLE_BARREL);
+ public static final RegistryObject ACACIA_BARREL = registerItemBlock(EBlocks.ACACIA_BARREL);
+ public static final RegistryObject DARK_OAK_BARREL = registerItemBlock(EBlocks.DARK_OAK_BARREL);
+ public static final RegistryObject MANGROVE_BARREL = registerItemBlock(EBlocks.MANGROVE_BARREL);
+ public static final RegistryObject CHERRY_BARREL = registerItemBlock(EBlocks.CHERRY_BARREL);
+ public static final RegistryObject BAMBOO_BARREL = registerItemBlock(EBlocks.BAMBOO_BARREL);
+ public static final RegistryObject CRIMSON_BARREL = registerItemBlock(EBlocks.CRIMSON_BARREL);
+ public static final RegistryObject WARPED_BARREL = registerItemBlock(EBlocks.WARPED_BARREL);
+ public static final RegistryObject STONE_BARREL = registerItemBlock(EBlocks.STONE_BARREL);
// Sieves
- public static final RegistryObject OAK_SIEVE;
- public static final RegistryObject SPRUCE_SIEVE;
- public static final RegistryObject BIRCH_SIEVE;
- public static final RegistryObject JUNGLE_SIEVE;
- public static final RegistryObject ACACIA_SIEVE;
- public static final RegistryObject DARK_OAK_SIEVE;
- public static final RegistryObject MANGROVE_SIEVE;
- public static final RegistryObject CHERRY_SIEVE;
- public static final RegistryObject BAMBOO_SIEVE;
- public static final RegistryObject CRIMSON_SIEVE;
- public static final RegistryObject WARPED_SIEVE;
+ public static final RegistryObject OAK_SIEVE = registerItemBlock(EBlocks.OAK_SIEVE);
+ public static final RegistryObject SPRUCE_SIEVE = registerItemBlock(EBlocks.SPRUCE_SIEVE);
+ public static final RegistryObject BIRCH_SIEVE = registerItemBlock(EBlocks.BIRCH_SIEVE);
+ public static final RegistryObject JUNGLE_SIEVE = registerItemBlock(EBlocks.JUNGLE_SIEVE);
+ public static final RegistryObject ACACIA_SIEVE = registerItemBlock(EBlocks.ACACIA_SIEVE);
+ public static final RegistryObject DARK_OAK_SIEVE = registerItemBlock(EBlocks.DARK_OAK_SIEVE);
+ public static final RegistryObject MANGROVE_SIEVE = registerItemBlock(EBlocks.MANGROVE_SIEVE);
+ public static final RegistryObject CHERRY_SIEVE = registerItemBlock(EBlocks.CHERRY_SIEVE);
+ public static final RegistryObject BAMBOO_SIEVE = registerItemBlock(EBlocks.BAMBOO_SIEVE);
+ public static final RegistryObject CRIMSON_SIEVE = registerItemBlock(EBlocks.CRIMSON_SIEVE);
+ public static final RegistryObject WARPED_SIEVE = registerItemBlock(EBlocks.WARPED_SIEVE);
// Lava Crucibles
- public static final RegistryObject PORCELAIN_CRUCIBLE;
- public static final RegistryObject WARPED_CRUCIBLE;
- public static final RegistryObject CRIMSON_CRUCIBLE;
- public static final RegistryObject UNFIRED_CRUCIBLE;
+ public static final RegistryObject PORCELAIN_CRUCIBLE = registerItemBlock(EBlocks.PORCELAIN_CRUCIBLE);
+ public static final RegistryObject WARPED_CRUCIBLE = registerItemBlock(EBlocks.WARPED_CRUCIBLE);
+ public static final RegistryObject