Merge pull request #56 from thedarkcolour/custom-materials

Allow defining custom barrel materials in config files
This commit is contained in:
thedarkcolour 2024-02-19 14:26:52 -08:00 committed by GitHub
commit 29178fc374
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
22 changed files with 737 additions and 356 deletions

View File

@ -9,6 +9,8 @@
"exdeorum:mangrove_barrel",
"exdeorum:cherry_barrel",
"exdeorum:bamboo_barrel",
"exdeorum:crimson_barrel",
"exdeorum:warped_barrel",
"exdeorum:fir_barrel",
"exdeorum:redwood_barrel",
"exdeorum:mahogany_barrel",

View File

@ -1,12 +1,12 @@
{
"values": [
"exdeorum:stone_barrel",
"exdeorum:porcelain_crucible",
"exdeorum:unfired_porcelain_crucible",
"exdeorum:crystallized_barrel",
"exdeorum:crystallized_crucible",
"exdeorum:crystallized_sieve",
"exdeorum:mechanical_sieve",
"exdeorum:mechanical_hammer"
"exdeorum:mechanical_hammer",
"exdeorum:stone_barrel",
"exdeorum:crystallized_barrel"
]
}

View File

@ -32,6 +32,7 @@ import org.slf4j.LoggerFactory;
import thedarkcolour.exdeorum.client.ClientHandler;
import thedarkcolour.exdeorum.config.EConfig;
import thedarkcolour.exdeorum.event.EventHandler;
import thedarkcolour.exdeorum.material.DefaultMaterials;
import thedarkcolour.exdeorum.network.NetworkHandler;
import thedarkcolour.exdeorum.registry.EBlockEntities;
import thedarkcolour.exdeorum.registry.EBlocks;
@ -76,8 +77,8 @@ public class ExDeorum {
private static void createRegistries() {
var modBus = FMLJavaModLoadingContext.get().getModEventBus();
EBlockEntities.BLOCK_ENTITIES.register(modBus);
EBlocks.BLOCKS.register(modBus);
EBlockEntities.BLOCK_ENTITIES.register(modBus);
EChunkGenerators.CHUNK_GENERATORS.register(modBus);
ECreativeTabs.CREATIVE_TABS.register(modBus);
EFluids.FLUID_TYPES.register(modBus);
@ -88,6 +89,7 @@ public class ExDeorum {
EMenus.MENUS.register(modBus);
ERecipeSerializers.RECIPE_SERIALIZERS.register(modBus);
ERecipeTypes.RECIPE_TYPES.register(modBus);
DefaultMaterials.registerMaterials();
}
private interface ClientHandlerRegistrar {

View File

@ -59,6 +59,7 @@ import thedarkcolour.exdeorum.block.BarrelBlock;
import thedarkcolour.exdeorum.blockentity.helper.FluidHelper;
import thedarkcolour.exdeorum.client.CompostColors;
import thedarkcolour.exdeorum.config.EConfig;
import thedarkcolour.exdeorum.material.BarrelMaterial;
import thedarkcolour.exdeorum.recipe.RecipeUtil;
import thedarkcolour.exdeorum.recipe.barrel.BarrelFluidMixingRecipe;
import thedarkcolour.exdeorum.registry.EBlockEntities;
@ -75,14 +76,17 @@ public class BarrelBlockEntity extends EBlockEntity {
public short r, g, b;
// Used to avoid triggering obsidian dupes in onContentsChanged, because Forge's FluidUtil actually modifies the tank for some reason
private boolean isBeingFilledByPlayer;
public BarrelBlockEntity(BlockPos pos, BlockState state) {
super(EBlockEntities.BARREL.get(), pos, state);
}
public final boolean transparent;
private final LazyOptional<IItemHandler> itemHandler = LazyOptional.of(() -> this.item);
private final LazyOptional<IFluidHandler> fluidHandler = LazyOptional.of(() -> this.tank);
public BarrelBlockEntity(BlockPos pos, BlockState state) {
super(EBlockEntities.BARREL.get(), pos, state);
this.transparent = BarrelMaterial.TRANSPARENT_BARRELS.contains(state.getBlock());
}
@Override
public <T> LazyOptional<T> getCapability(Capability<T> cap, Direction side) {
if (cap == ForgeCapabilities.FLUID_HANDLER) {

View File

@ -361,7 +361,7 @@ public class CompostColors {
// The given list should be sorted
private static void export(String modid, List<Item> sortedToExport) {
try {
if (createConfigFolder()) {
if (createConfigFolder(COMPOST_COLORS_CONFIGS)) {
var path = COMPOST_COLORS_CONFIGS.resolve(modid + ".txt");
var file = path.toFile();
@ -397,9 +397,9 @@ public class CompostColors {
}
}
private static boolean createConfigFolder() {
var colorsFolder = COMPOST_COLORS_CONFIGS.toFile();
var configFolder = COMPOST_COLORS_CONFIGS.getParent().toFile();
public static boolean createConfigFolder(Path configPath) {
var colorsFolder = configPath.toFile();
var configFolder = configPath.getParent().toFile();
return (configFolder.exists() || configFolder.mkdir()) && (colorsFolder.exists() || colorsFolder.mkdir());
}

View File

@ -49,6 +49,7 @@ import net.minecraftforge.client.extensions.common.IClientFluidTypeExtensions;
import net.minecraftforge.client.model.CompositeModel;
import net.minecraftforge.client.model.data.ModelData;
import net.minecraftforge.registries.ForgeRegistries;
import org.joml.Matrix4f;
import org.joml.Vector3f;
import thedarkcolour.exdeorum.ExDeorum;
import thedarkcolour.exdeorum.client.ter.SieveRenderer;
@ -171,6 +172,70 @@ public class RenderUtil {
RenderUtil.renderFlatSprite(builder, stack, y, r, g, b, RenderUtil.blockAtlas.getSprite(extensions.getStillTexture(state, level, pos)), light, edge);
}
@SuppressWarnings("DuplicatedCode")
public static void renderFluidCube(MultiBufferSource buffers, PoseStack stack, Level level, BlockPos pos, float minY, float maxY, float edge, int light, int r, int g, int b, Fluid fluid) {
var extensions = IClientFluidTypeExtensions.of(fluid);
var state = fluid.defaultFluidState();
var builder = buffers.getBuffer(Sheets.translucentCullBlockSheet());
var pose = stack.last().pose();
var poseNormal = stack.last().normal();
Vector3f normal;
TextureAtlasSprite sprite = RenderUtil.blockAtlas.getSprite(extensions.getStillTexture(state, level, pos));
float uMin = sprite.getU0();
float uMax = sprite.getU1();
float vMin = sprite.getV0();
float vMax = sprite.getV1();
float edgeMin = edge / 16f;
float edgeMax = 1f - edge / 16f;
// Top face
normal = poseNormal.transform(new Vector3f(0, 1, 0));
builder.vertex(pose, edgeMin, maxY, edgeMin).color(r, g, b, 255).uv(uMin, vMin).overlayCoords(0, 10).uv2(light).normal(normal.x, normal.y, normal.z).endVertex();
builder.vertex(pose, edgeMin, maxY, edgeMax).color(r, g, b, 255).uv(uMin, vMax).overlayCoords(0, 10).uv2(light).normal(normal.x, normal.y, normal.z).endVertex();
builder.vertex(pose, edgeMax, maxY, edgeMax).color(r, g, b, 255).uv(uMax, vMax).overlayCoords(0, 10).uv2(light).normal(normal.x, normal.y, normal.z).endVertex();
builder.vertex(pose, edgeMax, maxY, edgeMin).color(r, g, b, 255).uv(uMax, vMin).overlayCoords(0, 10).uv2(light).normal(normal.x, normal.y, normal.z).endVertex();
// Bottom face
normal = poseNormal.transform(new Vector3f(0, -1, 0));
builder.vertex(pose, edgeMin, minY, edgeMin).color(r, g, b, 255).uv(uMin, vMin).overlayCoords(0, 10).uv2(light).normal(normal.x, normal.y, normal.z).endVertex();
builder.vertex(pose, edgeMax, minY, edgeMin).color(r, g, b, 255).uv(uMax, vMin).overlayCoords(0, 10).uv2(light).normal(normal.x, normal.y, normal.z).endVertex();
builder.vertex(pose, edgeMax, minY, edgeMax).color(r, g, b, 255).uv(uMax, vMax).overlayCoords(0, 10).uv2(light).normal(normal.x, normal.y, normal.z).endVertex();
builder.vertex(pose, edgeMin, minY, edgeMax).color(r, g, b, 255).uv(uMin, vMax).overlayCoords(0, 10).uv2(light).normal(normal.x, normal.y, normal.z).endVertex();
// Flowing texture coordinates
//sprite = RenderUtil.blockAtlas.getSprite(extensions.getFlowingTexture(state, level, pos));
//uMin = sprite.getU0();
//uMax = sprite.getU(8);
//vMin = sprite.getV0();
//vMax = sprite.getV(8);
// South face
normal = poseNormal.transform(new Vector3f(0, 0, 1));
builder.vertex(pose, edgeMax, maxY, edgeMax).color(r, g, b, 255).uv(uMax, vMin).overlayCoords(0, 10).uv2(light).normal(normal.x, normal.y, normal.z).endVertex();
builder.vertex(pose, edgeMin, maxY, edgeMax).color(r, g, b, 255).uv(uMin, vMin).overlayCoords(0, 10).uv2(light).normal(normal.x, normal.y, normal.z).endVertex();
builder.vertex(pose, edgeMin, minY, edgeMax).color(r, g, b, 255).uv(uMin, vMax).overlayCoords(0, 10).uv2(light).normal(normal.x, normal.y, normal.z).endVertex();
builder.vertex(pose, edgeMax, minY, edgeMax).color(r, g, b, 255).uv(uMax, vMax).overlayCoords(0, 10).uv2(light).normal(normal.x, normal.y, normal.z).endVertex();
// North face
normal = poseNormal.transform(new Vector3f(0, 0, -1));
builder.vertex(pose, edgeMin, maxY, edgeMin).color(r, g, b, 255).uv(uMin, vMin).overlayCoords(0, 10).uv2(light).normal(normal.x, normal.y, normal.z).endVertex();
builder.vertex(pose, edgeMax, maxY, edgeMin).color(r, g, b, 255).uv(uMax, vMin).overlayCoords(0, 10).uv2(light).normal(normal.x, normal.y, normal.z).endVertex();
builder.vertex(pose, edgeMax, minY, edgeMin).color(r, g, b, 255).uv(uMax, vMax).overlayCoords(0, 10).uv2(light).normal(normal.x, normal.y, normal.z).endVertex();
builder.vertex(pose, edgeMin, minY, edgeMin).color(r, g, b, 255).uv(uMin, vMax).overlayCoords(0, 10).uv2(light).normal(normal.x, normal.y, normal.z).endVertex();
// East face
normal = poseNormal.transform(new Vector3f(1, 0, 0));
builder.vertex(pose, edgeMax, maxY, edgeMin).color(r, g, b, 255).uv(uMin, vMin).overlayCoords(0, 10).uv2(light).normal(normal.x, normal.y, normal.z).endVertex();
builder.vertex(pose, edgeMax, maxY, edgeMax).color(r, g, b, 255).uv(uMax, vMin).overlayCoords(0, 10).uv2(light).normal(normal.x, normal.y, normal.z).endVertex();
builder.vertex(pose, edgeMax, minY, edgeMax).color(r, g, b, 255).uv(uMax, vMax).overlayCoords(0, 10).uv2(light).normal(normal.x, normal.y, normal.z).endVertex();
builder.vertex(pose, edgeMax, minY, edgeMin).color(r, g, b, 255).uv(uMin, vMax).overlayCoords(0, 10).uv2(light).normal(normal.x, normal.y, normal.z).endVertex();
// West face
normal = poseNormal.transform(new Vector3f(-1, 0, 0));
builder.vertex(pose, edgeMin, maxY, edgeMax).color(r, g, b, 255).uv(uMax, vMin).overlayCoords(0, 10).uv2(light).normal(normal.x, normal.y, normal.z).endVertex();
builder.vertex(pose, edgeMin, maxY, edgeMin).color(r, g, b, 255).uv(uMin, vMin).overlayCoords(0, 10).uv2(light).normal(normal.x, normal.y, normal.z).endVertex();
builder.vertex(pose, edgeMin, minY, edgeMin).color(r, g, b, 255).uv(uMin, vMax).overlayCoords(0, 10).uv2(light).normal(normal.x, normal.y, normal.z).endVertex();
builder.vertex(pose, edgeMin, minY, edgeMax).color(r, g, b, 255).uv(uMax, vMax).overlayCoords(0, 10).uv2(light).normal(normal.x, normal.y, normal.z).endVertex();
}
// Renders a sprite inside the barrel with the height determined by how full the barrel is.
public static void renderFlatSpriteLerp(VertexConsumer builder, PoseStack stack, float percentage, int r, int g, int b, TextureAtlasSprite sprite, int light, float edge, float yMin, float yMax) {
float y = Mth.lerp(percentage, yMin, yMax) / 16f;

View File

@ -97,7 +97,11 @@ public class BarrelRenderer implements BlockEntityRenderer<BarrelBlockEntity> {
b = (int) Mth.lerp(progress, b, 65);
}
RenderUtil.renderFlatFluidSprite(buffers, stack, level, pos, y, 2.0f, light, r, g, b, fluid);
if (barrel.transparent) {
RenderUtil.renderFluidCube(buffers, stack, level, pos, 1 / 16f, y, 2.0f, light, r, g, b, fluid);
} else {
RenderUtil.renderFlatFluidSprite(buffers, stack, level, pos, y, 2.0f, light, r, g, b, fluid);
}
}
});

View File

@ -21,6 +21,7 @@ package thedarkcolour.exdeorum.compat;
import com.google.common.collect.Lists;
import net.minecraft.world.item.Item;
import net.minecraftforge.fml.ModList;
import thedarkcolour.exdeorum.material.BarrelMaterial;
import thedarkcolour.exdeorum.registry.EItems;
import java.util.ArrayList;
@ -28,39 +29,12 @@ import java.util.List;
public class CompatHelper {
public static List<Item> getAvailableBarrels(boolean registered) {
// Vanilla barrels
List<Item> barrels = registered ? Lists.newArrayList(EItems.OAK_BARREL.get(), EItems.SPRUCE_BARREL.get(), EItems.BIRCH_BARREL.get(), EItems.JUNGLE_BARREL.get(), EItems.ACACIA_BARREL.get(), EItems.DARK_OAK_BARREL.get(), EItems.MANGROVE_BARREL.get(), EItems.CHERRY_BARREL.get(), EItems.BAMBOO_BARREL.get(), EItems.CRIMSON_BARREL.get(), EItems.WARPED_BARREL.get(), EItems.STONE_BARREL.get()) : new ArrayList<>();
ModList mods = ModList.get();
if (mods.isLoaded(ModIds.BIOMES_O_PLENTY) == registered) {
barrels.add(EItems.FIR_BARREL.get());
barrels.add(EItems.REDWOOD_BARREL.get());
barrels.add(EItems.MAHOGANY_BARREL.get());
barrels.add(EItems.JACARANDA_BARREL.get());
barrels.add(EItems.PALM_BARREL.get());
barrels.add(EItems.WILLOW_BARREL.get());
barrels.add(EItems.DEAD_BARREL.get());
barrels.add(EItems.MAGIC_BARREL.get());
barrels.add(EItems.UMBRAN_BARREL.get());
barrels.add(EItems.HELLBARK_BARREL.get());
List<Item> barrels = new ArrayList<>();
for (var material : BarrelMaterial.REGISTERED_MATERIALS) {
if (registered == ModList.get().isLoaded(material.requiredModId)) {
barrels.add(material.getItem());
}
}
if (mods.isLoaded(ModIds.ARS_NOUVEAU) == registered) {
barrels.add(EItems.ARCHWOOD_BARREL.get());
}
if (mods.isLoaded(ModIds.AETHER) == registered) {
barrels.add(EItems.SKYROOT_BARREL.get());
}
if (mods.isLoaded(ModIds.BLUE_SKIES) == registered) {
barrels.add(EItems.BLUEBRIGHT_BARREL.get());
barrels.add(EItems.STARLIT_BARREL.get());
barrels.add(EItems.FROSTBRIGHT_BARREL.get());
barrels.add(EItems.COMET_BARREL.get());
barrels.add(EItems.LUNAR_BARREL.get());
barrels.add(EItems.DUSK_BARREL.get());
barrels.add(EItems.MAPLE_BARREL.get());
barrels.add(EItems.CRYSTALLIZED_BARREL.get());
}
return barrels;
}

View File

@ -33,8 +33,8 @@ import net.minecraft.network.chat.Component;
import net.minecraft.world.item.ItemStack;
import thedarkcolour.exdeorum.client.ClientHandler;
import thedarkcolour.exdeorum.data.TranslationKeys;
import thedarkcolour.exdeorum.material.DefaultMaterials;
import thedarkcolour.exdeorum.recipe.barrel.BarrelCompostRecipe;
import thedarkcolour.exdeorum.registry.EItems;
class BarrelCompostCategory implements IRecipeCategory<BarrelCompostRecipe> {
public static final int WIDTH = 120;
@ -88,7 +88,7 @@ class BarrelCompostCategory implements IRecipeCategory<BarrelCompostRecipe> {
}
private static class DrawableIcon implements IDrawable {
private final ItemStack oakBarrel = new ItemStack(EItems.OAK_BARREL.get());
private final ItemStack oakBarrel = new ItemStack(DefaultMaterials.OAK_BARREL.getItem());
@Override
public int getWidth() {

View File

@ -33,9 +33,9 @@ import net.minecraft.network.chat.Component;
import net.minecraft.world.item.Item;
import net.minecraft.world.item.ItemStack;
import thedarkcolour.exdeorum.data.TranslationKeys;
import thedarkcolour.exdeorum.material.DefaultMaterials;
import thedarkcolour.exdeorum.recipe.barrel.BarrelFluidMixingRecipe;
import thedarkcolour.exdeorum.recipe.barrel.BarrelMixingRecipe;
import thedarkcolour.exdeorum.registry.EItems;
public abstract class BarrelMixingCategory<T> implements IRecipeCategory<T> {
public static final int WIDTH = 120;
@ -83,7 +83,7 @@ public abstract class BarrelMixingCategory<T> implements IRecipeCategory<T> {
public static class Items extends BarrelMixingCategory<BarrelMixingRecipe> {
public Items(IGuiHelper helper, IDrawable plus, IDrawable arrow) {
super(helper, plus, arrow, TranslationKeys.BARREL_MIXING_CATEGORY_TITLE, EItems.OAK_BARREL.get());
super(helper, plus, arrow, TranslationKeys.BARREL_MIXING_CATEGORY_TITLE, DefaultMaterials.OAK_BARREL.getItem());
}
@Override
@ -103,7 +103,7 @@ public abstract class BarrelMixingCategory<T> implements IRecipeCategory<T> {
private static final Component CONTENTS_ARE_CONSUMED_TOOLTIP = Component.translatable(TranslationKeys.BARREL_FLUID_MIXING_CONTENTS_ARE_CONSUMED).withStyle(ChatFormatting.RED);
public Fluids(IGuiHelper helper, IDrawable plus, IDrawable arrow) {
super(helper, plus, arrow, TranslationKeys.BARREL_FLUID_MIXING_CATEGORY_TITLE, EItems.STONE_BARREL.get());
super(helper, plus, arrow, TranslationKeys.BARREL_FLUID_MIXING_CATEGORY_TITLE, DefaultMaterials.STONE_BARREL.getItem());
}
@Override

View File

@ -29,6 +29,7 @@ import net.minecraft.world.level.block.Blocks;
import net.minecraftforge.common.data.ExistingFileHelper;
import net.minecraftforge.common.data.ForgeAdvancementProvider;
import thedarkcolour.exdeorum.ExDeorum;
import thedarkcolour.exdeorum.material.DefaultMaterials;
import thedarkcolour.exdeorum.registry.EItems;
import thedarkcolour.exdeorum.tag.EItemTags;
@ -83,7 +84,7 @@ class Advancements extends ForgeAdvancementProvider {
var barrel = advancement()
.parent(root)
.display(
EItems.OAK_BARREL.get(),
DefaultMaterials.OAK_BARREL.getItem(),
Component.translatable(TranslationKeys.BARREL_ADVANCEMENT_TITLE),
Component.translatable(TranslationKeys.BARREL_ADVANCEMENT_DESCRIPTION),
null,

View File

@ -24,11 +24,11 @@ import net.minecraft.world.level.block.Blocks;
import net.minecraftforge.client.model.generators.BlockModelBuilder;
import net.minecraftforge.client.model.generators.ConfiguredModel;
import net.minecraftforge.registries.ForgeRegistries;
import thedarkcolour.exdeorum.material.DefaultMaterials;
import thedarkcolour.exdeorum.registry.EBlocks;
import thedarkcolour.modkit.data.MKBlockModelProvider;
import java.util.Objects;
import java.util.function.Supplier;
class BlockModels {
public static void addBlockModels(MKBlockModelProvider models) {
@ -39,18 +39,18 @@ class BlockModels {
models.simpleBlock(EBlocks.CRUSHED_BLACKSTONE.get());
// Barrels
barrel(models, EBlocks.OAK_BARREL, Blocks.OAK_PLANKS);
barrel(models, EBlocks.SPRUCE_BARREL, Blocks.SPRUCE_PLANKS);
barrel(models, EBlocks.BIRCH_BARREL, Blocks.BIRCH_PLANKS);
barrel(models, EBlocks.JUNGLE_BARREL, Blocks.JUNGLE_PLANKS);
barrel(models, EBlocks.ACACIA_BARREL, Blocks.ACACIA_PLANKS);
barrel(models, EBlocks.DARK_OAK_BARREL, Blocks.DARK_OAK_PLANKS);
barrel(models, EBlocks.MANGROVE_BARREL, Blocks.MANGROVE_PLANKS);
barrel(models, EBlocks.CHERRY_BARREL, Blocks.CHERRY_PLANKS);
barrel(models, EBlocks.BAMBOO_BARREL, Blocks.BAMBOO_PLANKS);
barrel(models, EBlocks.CRIMSON_BARREL, Blocks.CRIMSON_PLANKS);
barrel(models, EBlocks.WARPED_BARREL, Blocks.WARPED_PLANKS);
barrel(models, EBlocks.STONE_BARREL, Blocks.STONE);
barrel(models, DefaultMaterials.OAK_BARREL.getBlock(), Blocks.OAK_PLANKS);
barrel(models, DefaultMaterials.SPRUCE_BARREL.getBlock(), Blocks.SPRUCE_PLANKS);
barrel(models, DefaultMaterials.BIRCH_BARREL.getBlock(), Blocks.BIRCH_PLANKS);
barrel(models, DefaultMaterials.JUNGLE_BARREL.getBlock(), Blocks.JUNGLE_PLANKS);
barrel(models, DefaultMaterials.ACACIA_BARREL.getBlock(), Blocks.ACACIA_PLANKS);
barrel(models, DefaultMaterials.DARK_OAK_BARREL.getBlock(), Blocks.DARK_OAK_PLANKS);
barrel(models, DefaultMaterials.MANGROVE_BARREL.getBlock(), Blocks.MANGROVE_PLANKS);
barrel(models, DefaultMaterials.CHERRY_BARREL.getBlock(), Blocks.CHERRY_PLANKS);
barrel(models, DefaultMaterials.BAMBOO_BARREL.getBlock(), Blocks.BAMBOO_PLANKS);
barrel(models, DefaultMaterials.CRIMSON_BARREL.getBlock(), Blocks.CRIMSON_PLANKS);
barrel(models, DefaultMaterials.WARPED_BARREL.getBlock(), Blocks.WARPED_PLANKS);
barrel(models, DefaultMaterials.STONE_BARREL.getBlock(), Blocks.STONE);
sieve(models, EBlocks.OAK_SIEVE.get(), Blocks.OAK_PLANKS);
sieve(models, EBlocks.SPRUCE_SIEVE.get(), Blocks.SPRUCE_PLANKS);
@ -89,7 +89,7 @@ class BlockModels {
}
private static void arsNouveauModels(MKBlockModelProvider models) {
barrel(models, EBlocks.ARCHWOOD_BARREL, ModCompatData.ARCHWOOD_PLANKS.get());
barrel(models, DefaultMaterials.ARCHWOOD_BARREL.getBlock(), ModCompatData.ARCHWOOD_PLANKS.get());
sieve(models, EBlocks.ARCHWOOD_SIEVE.get(), ModCompatData.ARCHWOOD_PLANKS.get());
@ -100,7 +100,7 @@ class BlockModels {
}
private static void aetherModels(MKBlockModelProvider models) {
barrel(models, EBlocks.SKYROOT_BARREL, ModCompatData.SKYROOT_PLANKS.get(), "construction/");
barrel(models, DefaultMaterials.SKYROOT_BARREL.getBlock(), ModCompatData.SKYROOT_PLANKS.get(), "construction/");
sieve(models, EBlocks.SKYROOT_SIEVE.get(), ModCompatData.SKYROOT_PLANKS.get(), "construction/");
@ -112,14 +112,14 @@ class BlockModels {
final String woodPrefix = "wood/";
final String logSuffix = "_side";
barrel(models, EBlocks.BLUEBRIGHT_BARREL, ModCompatData.BLUEBRIGHT_PLANKS.get(), woodPrefix);
barrel(models, EBlocks.STARLIT_BARREL, ModCompatData.STARLIT_PLANKS.get(), woodPrefix);
barrel(models, EBlocks.FROSTBRIGHT_BARREL, ModCompatData.FROSTBRIGHT_PLANKS.get(), woodPrefix);
barrel(models, EBlocks.COMET_BARREL, ModCompatData.COMET_PLANKS.get(), woodPrefix);
barrel(models, EBlocks.LUNAR_BARREL, ModCompatData.LUNAR_PLANKS.get(), woodPrefix);
barrel(models, EBlocks.DUSK_BARREL, ModCompatData.DUSK_PLANKS.get(), woodPrefix);
barrel(models, EBlocks.MAPLE_BARREL, ModCompatData.MAPLE_PLANKS.get(), woodPrefix);
barrel(models, EBlocks.CRYSTALLIZED_BARREL, ModCompatData.CRYSTALLIZED_PLANKS.get(), woodPrefix).renderType("translucent");
barrel(models, DefaultMaterials.BLUEBRIGHT_BARREL.getBlock(), ModCompatData.BLUEBRIGHT_PLANKS.get(), woodPrefix);
barrel(models, DefaultMaterials.STARLIT_BARREL.getBlock(), ModCompatData.STARLIT_PLANKS.get(), woodPrefix);
barrel(models, DefaultMaterials.FROSTBRIGHT_BARREL.getBlock(), ModCompatData.FROSTBRIGHT_PLANKS.get(), woodPrefix);
barrel(models, DefaultMaterials.COMET_BARREL.getBlock(), ModCompatData.COMET_PLANKS.get(), woodPrefix);
barrel(models, DefaultMaterials.LUNAR_BARREL.getBlock(), ModCompatData.LUNAR_PLANKS.get(), woodPrefix);
barrel(models, DefaultMaterials.DUSK_BARREL.getBlock(), ModCompatData.DUSK_PLANKS.get(), woodPrefix);
barrel(models, DefaultMaterials.MAPLE_BARREL.getBlock(), ModCompatData.MAPLE_PLANKS.get(), woodPrefix);
barrel(models, DefaultMaterials.CRYSTALLIZED_BARREL.getBlock(), ModCompatData.CRYSTALLIZED_PLANKS.get(), woodPrefix).renderType("translucent");
sieve(models, EBlocks.BLUEBRIGHT_SIEVE.get(), ModCompatData.BLUEBRIGHT_PLANKS.get(), woodPrefix);
sieve(models, EBlocks.STARLIT_SIEVE.get(), ModCompatData.STARLIT_PLANKS.get(), woodPrefix);
@ -141,16 +141,16 @@ class BlockModels {
}
private static void bopModels(MKBlockModelProvider models) {
barrel(models, EBlocks.FIR_BARREL, ModCompatData.FIR_PLANKS.get());
barrel(models, EBlocks.REDWOOD_BARREL, ModCompatData.REDWOOD_PLANKS.get());
barrel(models, EBlocks.MAHOGANY_BARREL, ModCompatData.MAHOGANY_PLANKS.get());
barrel(models, EBlocks.JACARANDA_BARREL, ModCompatData.JACARANDA_PLANKS.get());
barrel(models, EBlocks.PALM_BARREL, ModCompatData.PALM_PLANKS.get());
barrel(models, EBlocks.WILLOW_BARREL, ModCompatData.WILLOW_PLANKS.get());
barrel(models, EBlocks.DEAD_BARREL, ModCompatData.DEAD_PLANKS.get());
barrel(models, EBlocks.MAGIC_BARREL, ModCompatData.MAGIC_PLANKS.get());
barrel(models, EBlocks.UMBRAN_BARREL, ModCompatData.UMBRAN_PLANKS.get());
barrel(models, EBlocks.HELLBARK_BARREL, ModCompatData.HELLBARK_PLANKS.get());
barrel(models, DefaultMaterials.FIR_BARREL.getBlock(), ModCompatData.FIR_PLANKS.get());
barrel(models, DefaultMaterials.REDWOOD_BARREL.getBlock(), ModCompatData.REDWOOD_PLANKS.get());
barrel(models, DefaultMaterials.MAHOGANY_BARREL.getBlock(), ModCompatData.MAHOGANY_PLANKS.get());
barrel(models, DefaultMaterials.JACARANDA_BARREL.getBlock(), ModCompatData.JACARANDA_PLANKS.get());
barrel(models, DefaultMaterials.PALM_BARREL.getBlock(), ModCompatData.PALM_PLANKS.get());
barrel(models, DefaultMaterials.WILLOW_BARREL.getBlock(), ModCompatData.WILLOW_PLANKS.get());
barrel(models, DefaultMaterials.DEAD_BARREL.getBlock(), ModCompatData.DEAD_PLANKS.get());
barrel(models, DefaultMaterials.MAGIC_BARREL.getBlock(), ModCompatData.MAGIC_PLANKS.get());
barrel(models, DefaultMaterials.UMBRAN_BARREL.getBlock(), ModCompatData.UMBRAN_PLANKS.get());
barrel(models, DefaultMaterials.HELLBARK_BARREL.getBlock(), ModCompatData.HELLBARK_PLANKS.get());
sieve(models, EBlocks.FIR_SIEVE.get(), ModCompatData.FIR_PLANKS.get());
sieve(models, EBlocks.REDWOOD_SIEVE.get(), ModCompatData.REDWOOD_PLANKS.get());
@ -200,12 +200,12 @@ class BlockModels {
return new ResourceLocation(key.getNamespace(), "block/" + prefix + key.getPath() + suffix);
}
public static void barrel(MKBlockModelProvider models, Supplier<? extends Block> block, Block appearance) {
public static void barrel(MKBlockModelProvider models, Block block, Block appearance) {
barrel(models, block, appearance, "");
}
public static BlockModelBuilder barrel(MKBlockModelProvider models, Supplier<? extends Block> block, Block appearance, String pathPrefix) {
return singleModel(models, block.get())
public static BlockModelBuilder barrel(MKBlockModelProvider models, Block block, Block appearance, String pathPrefix) {
return singleModel(models, block)
.parent(models.modFile("template_barrel"))
.texture("barrel", texture(appearance, pathPrefix, ""));
}

View File

@ -32,6 +32,8 @@ import net.minecraft.world.level.levelgen.structure.BuiltinStructureSets;
import net.minecraft.world.level.levelgen.structure.StructureSet;
import net.minecraft.world.level.material.Fluid;
import thedarkcolour.exdeorum.ExDeorum;
import thedarkcolour.exdeorum.material.BarrelMaterial;
import thedarkcolour.exdeorum.material.DefaultMaterials;
import thedarkcolour.exdeorum.registry.EBlocks;
import thedarkcolour.exdeorum.registry.EFluids;
import thedarkcolour.exdeorum.registry.EItems;
@ -40,7 +42,21 @@ import thedarkcolour.exdeorum.tag.EItemTags;
import thedarkcolour.exdeorum.tag.EStructureSetTags;
import thedarkcolour.modkit.data.MKTagsProvider;
import java.util.ArrayList;
import java.util.List;
class ModTags {
private static final List<BarrelMaterial> STONE_MATERIALS = List.of(DefaultMaterials.STONE_BARREL, DefaultMaterials.CRYSTALLIZED_BARREL);
private static final List<BarrelMaterial> WOODEN_BARRELS = new ArrayList<>();
static {
for (var material : BarrelMaterial.REGISTERED_MATERIALS) {
if (!STONE_MATERIALS.contains(material)) {
WOODEN_BARRELS.add(material);
}
}
}
public static void createBlockTags(MKTagsProvider<Block> tags) {
var wateringCanTickable = tags.tag(EBlockTags.WATERING_CAN_TICKABLE);
wateringCanTickable.add(Blocks.GRASS_BLOCK, Blocks.MYCELIUM, Blocks.CRIMSON_FUNGUS, Blocks.WARPED_FUNGUS, Blocks.RED_MUSHROOM, Blocks.BROWN_MUSHROOM, Blocks.CACTUS, Blocks.SUGAR_CANE, Blocks.SWEET_BERRY_BUSH, Blocks.COCOA).addTags(BlockTags.SAPLINGS, BlockTags.NYLIUM, BlockTags.BEE_GROWABLES);
@ -48,17 +64,7 @@ class ModTags {
wateringCanTickable.addOptional(path);
}
tags.tag(BlockTags.MINEABLE_WITH_AXE).add(
// Vanilla barrels
EBlocks.OAK_BARREL.get(), EBlocks.SPRUCE_BARREL.get(), EBlocks.BIRCH_BARREL.get(), EBlocks.JUNGLE_BARREL.get(), EBlocks.ACACIA_BARREL.get(), EBlocks.DARK_OAK_BARREL.get(), EBlocks.MANGROVE_BARREL.get(), EBlocks.CHERRY_BARREL.get(), EBlocks.BAMBOO_BARREL.get(), EBlocks.CRIMSON_BARREL.get(), EBlocks.WARPED_BARREL.get(),
// BOP barrels
EBlocks.FIR_BARREL.get(), EBlocks.REDWOOD_BARREL.get(), EBlocks.MAHOGANY_BARREL.get(), EBlocks.JACARANDA_BARREL.get(), EBlocks.PALM_BARREL.get(), EBlocks.WILLOW_BARREL.get(), EBlocks.DEAD_BARREL.get(), EBlocks.MAGIC_BARREL.get(), EBlocks.UMBRAN_BARREL.get(), EBlocks.HELLBARK_BARREL.get(),
// Ars Nouveau barrels
EBlocks.ARCHWOOD_BARREL.get(),
// Aether barrels
EBlocks.SKYROOT_BARREL.get(),
// Blue Skies barrels
EBlocks.BLUEBRIGHT_BARREL.get(), EBlocks.STARLIT_BARREL.get(), EBlocks.FROSTBRIGHT_BARREL.get(), EBlocks.COMET_BARREL.get(), EBlocks.LUNAR_BARREL.get(), EBlocks.DUSK_BARREL.get(), EBlocks.MAPLE_BARREL.get(),
tags.tag(BlockTags.MINEABLE_WITH_AXE).add(WOODEN_BARRELS.stream().map(BarrelMaterial::getBlock).toArray(Block[]::new)).add(
// Vanilla sieves
EBlocks.OAK_SIEVE.get(), EBlocks.SPRUCE_SIEVE.get(), EBlocks.BIRCH_SIEVE.get(), EBlocks.JUNGLE_SIEVE.get(), EBlocks.ACACIA_SIEVE.get(), EBlocks.DARK_OAK_SIEVE.get(), EBlocks.MANGROVE_SIEVE.get(), EBlocks.CHERRY_SIEVE.get(), EBlocks.BAMBOO_SIEVE.get(), EBlocks.CRIMSON_SIEVE.get(), EBlocks.WARPED_SIEVE.get(),
// BOP sieves
@ -80,7 +86,9 @@ class ModTags {
// Blue Skies crucibles
EBlocks.BLUEBRIGHT_CRUCIBLE.get(), EBlocks.STARLIT_CRUCIBLE.get(), EBlocks.FROSTBRIGHT_CRUCIBLE.get(), EBlocks.COMET_CRUCIBLE.get(), EBlocks.LUNAR_CRUCIBLE.get(), EBlocks.DUSK_CRUCIBLE.get(), EBlocks.MAPLE_CRUCIBLE.get()
);
tags.tag(BlockTags.MINEABLE_WITH_PICKAXE).add(EBlocks.STONE_BARREL, EBlocks.PORCELAIN_CRUCIBLE, EBlocks.UNFIRED_PORCELAIN_CRUCIBLE, EBlocks.CRYSTALLIZED_BARREL, EBlocks.CRYSTALLIZED_CRUCIBLE, EBlocks.CRYSTALLIZED_SIEVE, EBlocks.MECHANICAL_SIEVE, EBlocks.MECHANICAL_HAMMER);
tags.tag(BlockTags.MINEABLE_WITH_PICKAXE)
.add(EBlocks.PORCELAIN_CRUCIBLE, EBlocks.UNFIRED_PORCELAIN_CRUCIBLE, EBlocks.CRYSTALLIZED_CRUCIBLE, EBlocks.CRYSTALLIZED_SIEVE, EBlocks.MECHANICAL_SIEVE, EBlocks.MECHANICAL_HAMMER)
.add(DefaultMaterials.STONE_BARREL.getBlock(), DefaultMaterials.CRYSTALLIZED_BARREL.getBlock());
tags.tag(BlockTags.MINEABLE_WITH_SHOVEL).add(EBlocks.DUST, EBlocks.CRUSHED_NETHERRACK, EBlocks.CRUSHED_END_STONE, EBlocks.CRUSHED_DEEPSLATE, EBlocks.CRUSHED_BLACKSTONE);
tags.tag(BlockTags.MINEABLE_WITH_HOE).add(EBlocks.INFESTED_LEAVES);
tags.tag(BlockTags.LEAVES).add(EBlocks.INFESTED_LEAVES);
@ -92,18 +100,8 @@ class ModTags {
tags.tag(EItemTags.SIEVE_MESHES).add(EItems.STRING_MESH, EItems.FLINT_MESH, EItems.IRON_MESH, EItems.GOLDEN_MESH, EItems.DIAMOND_MESH, EItems.NETHERITE_MESH);
tags.tag(EItemTags.PEBBLES).add(EItems.STONE_PEBBLE, EItems.DIORITE_PEBBLE, EItems.GRANITE_PEBBLE, EItems.ANDESITE_PEBBLE, EItems.DEEPSLATE_PEBBLE, EItems.TUFF_PEBBLE, EItems.CALCITE_PEBBLE, EItems.BLACKSTONE_PEBBLE, EItems.BASALT_PEBBLE);
tags.tag(EItemTags.END_CAKE_MATERIAL).add(Items.ENDER_EYE);
tags.tag(EItemTags.WOODEN_BARRELS).add(
EItems.OAK_BARREL.get(), EItems.SPRUCE_BARREL.get(), EItems.BIRCH_BARREL.get(), EItems.JUNGLE_BARREL.get(), EItems.ACACIA_BARREL.get(), EItems.DARK_OAK_BARREL.get(), EItems.MANGROVE_BARREL.get(), EItems.CHERRY_BARREL.get(), EItems.BAMBOO_BARREL.get(),
// BOP barrels
EItems.FIR_BARREL.get(), EItems.REDWOOD_BARREL.get(), EItems.MAHOGANY_BARREL.get(), EItems.JACARANDA_BARREL.get(), EItems.PALM_BARREL.get(), EItems.WILLOW_BARREL.get(), EItems.DEAD_BARREL.get(), EItems.MAGIC_BARREL.get(), EItems.UMBRAN_BARREL.get(), EItems.HELLBARK_BARREL.get(),
// Ars Nouveau barrels
EItems.ARCHWOOD_BARREL.get(),
// Aether barrels
EItems.SKYROOT_BARREL.get(),
// Blue Skies barrels
EItems.BLUEBRIGHT_BARREL.get(), EItems.STARLIT_BARREL.get(), EItems.FROSTBRIGHT_BARREL.get(), EItems.COMET_BARREL.get(), EItems.LUNAR_BARREL.get(), EItems.DUSK_BARREL.get(), EItems.MAPLE_BARREL.get()
);
tags.tag(EItemTags.STONE_BARRELS).add(EItems.STONE_BARREL, EItems.CRYSTALLIZED_BARREL);
tags.tag(EItemTags.WOODEN_BARRELS).add(WOODEN_BARRELS.stream().map(BarrelMaterial::getItem).toArray(Item[]::new));
tags.tag(EItemTags.STONE_BARRELS).add(DefaultMaterials.STONE_BARREL.getItem(), DefaultMaterials.CRYSTALLIZED_BARREL.getItem());
tags.tag(EItemTags.BARRELS).addTags(EItemTags.WOODEN_BARRELS, EItemTags.STONE_BARRELS);
}

View File

@ -51,6 +51,7 @@ import thedarkcolour.exdeorum.ExDeorum;
import thedarkcolour.exdeorum.block.InfestedLeavesBlock;
import thedarkcolour.exdeorum.compat.ModIds;
import thedarkcolour.exdeorum.data.ModCompatData;
import thedarkcolour.exdeorum.material.DefaultMaterials;
import thedarkcolour.exdeorum.recipe.TagResultRecipe;
import thedarkcolour.exdeorum.recipe.barrel.FinishedBarrelCompostRecipe;
import thedarkcolour.exdeorum.recipe.barrel.FinishedBarrelFluidMixingRecipe;
@ -77,6 +78,7 @@ import static thedarkcolour.modkit.data.MKRecipeProvider.path;
public class Recipes {
private static final Ingredient SPORES_AND_SEEDS = ingredient(EItems.GRASS_SEEDS, EItems.MYCELIUM_SPORES, EItems.WARPED_NYLIUM_SPORES, EItems.CRIMSON_NYLIUM_SPORES);
public static void addRecipes(Consumer<FinishedRecipe> writer, MKRecipeProvider recipes) {
craftingRecipes(writer, recipes);
smeltingRecipes(recipes);
@ -103,81 +105,81 @@ public class Recipes {
recipes.netheriteUpgrade(RecipeCategory.TOOLS, ingredient(EItems.DIAMOND_HAMMER.get()), EItems.NETHERITE_HAMMER.get());
// Crucibles
uShaped(recipes, EItems.OAK_CRUCIBLE, ingredient(Items.OAK_LOG), ingredient(Items.OAK_SLAB));
uShaped(recipes, EItems.SPRUCE_CRUCIBLE, ingredient(Items.SPRUCE_LOG), ingredient(Items.SPRUCE_SLAB));
uShaped(recipes, EItems.BIRCH_CRUCIBLE, ingredient(Items.BIRCH_LOG), ingredient(Items.BIRCH_SLAB));
uShaped(recipes, EItems.JUNGLE_CRUCIBLE, ingredient(Items.JUNGLE_LOG), ingredient(Items.JUNGLE_SLAB));
uShaped(recipes, EItems.ACACIA_CRUCIBLE, ingredient(Items.ACACIA_LOG), ingredient(Items.ACACIA_SLAB));
uShaped(recipes, EItems.DARK_OAK_CRUCIBLE, ingredient(Items.DARK_OAK_LOG), ingredient(Items.DARK_OAK_SLAB));
uShaped(recipes, EItems.MANGROVE_CRUCIBLE, ingredient(Items.MANGROVE_LOG), ingredient(Items.MANGROVE_SLAB));
uShaped(recipes, EItems.CHERRY_CRUCIBLE, ingredient(Items.CHERRY_LOG), ingredient(Items.CHERRY_SLAB));
uShaped(recipes, EItems.BAMBOO_CRUCIBLE, ingredient(Items.BAMBOO_BLOCK), ingredient(Items.BAMBOO_SLAB));
uShaped(recipes, EItems.CRIMSON_CRUCIBLE, ingredient(Items.CRIMSON_STEM), ingredient(Items.CRIMSON_SLAB));
uShaped(recipes, EItems.WARPED_CRUCIBLE, ingredient(Items.WARPED_STEM), ingredient(Items.WARPED_SLAB));
uShaped(recipes, EItems.UNFIRED_PORCELAIN_CRUCIBLE, ingredient(EItems.PORCELAIN_CLAY_BALL.get()), ingredient(EItems.PORCELAIN_CLAY_BALL.get()));
uShaped(recipes, EItems.OAK_CRUCIBLE.get(), ingredient(Items.OAK_LOG), ingredient(Items.OAK_SLAB));
uShaped(recipes, EItems.SPRUCE_CRUCIBLE.get(), ingredient(Items.SPRUCE_LOG), ingredient(Items.SPRUCE_SLAB));
uShaped(recipes, EItems.BIRCH_CRUCIBLE.get(), ingredient(Items.BIRCH_LOG), ingredient(Items.BIRCH_SLAB));
uShaped(recipes, EItems.JUNGLE_CRUCIBLE.get(), ingredient(Items.JUNGLE_LOG), ingredient(Items.JUNGLE_SLAB));
uShaped(recipes, EItems.ACACIA_CRUCIBLE.get(), ingredient(Items.ACACIA_LOG), ingredient(Items.ACACIA_SLAB));
uShaped(recipes, EItems.DARK_OAK_CRUCIBLE.get(), ingredient(Items.DARK_OAK_LOG), ingredient(Items.DARK_OAK_SLAB));
uShaped(recipes, EItems.MANGROVE_CRUCIBLE.get(), ingredient(Items.MANGROVE_LOG), ingredient(Items.MANGROVE_SLAB));
uShaped(recipes, EItems.CHERRY_CRUCIBLE.get(), ingredient(Items.CHERRY_LOG), ingredient(Items.CHERRY_SLAB));
uShaped(recipes, EItems.BAMBOO_CRUCIBLE.get(), ingredient(Items.BAMBOO_BLOCK), ingredient(Items.BAMBOO_SLAB));
uShaped(recipes, EItems.CRIMSON_CRUCIBLE.get(), ingredient(Items.CRIMSON_STEM), ingredient(Items.CRIMSON_SLAB));
uShaped(recipes, EItems.WARPED_CRUCIBLE.get(), ingredient(Items.WARPED_STEM), ingredient(Items.WARPED_SLAB));
uShaped(recipes, EItems.UNFIRED_PORCELAIN_CRUCIBLE.get(), ingredient(EItems.PORCELAIN_CLAY_BALL.get()), ingredient(EItems.PORCELAIN_CLAY_BALL.get()));
// BOP crucibles
modUShaped(recipes, ModIds.BIOMES_O_PLENTY, ModCompatData.FIR_LOG_ITEM, ModCompatData.FIR_SLAB, EItems.FIR_CRUCIBLE);
modUShaped(recipes, ModIds.BIOMES_O_PLENTY, ModCompatData.REDWOOD_LOG_ITEM, ModCompatData.REDWOOD_SLAB, EItems.REDWOOD_CRUCIBLE);
modUShaped(recipes, ModIds.BIOMES_O_PLENTY, ModCompatData.MAHOGANY_LOG_ITEM, ModCompatData.MAHOGANY_SLAB, EItems.MAHOGANY_CRUCIBLE);
modUShaped(recipes, ModIds.BIOMES_O_PLENTY, ModCompatData.JACARANDA_LOG_ITEM, ModCompatData.JACARANDA_SLAB, EItems.JACARANDA_CRUCIBLE);
modUShaped(recipes, ModIds.BIOMES_O_PLENTY, ModCompatData.PALM_LOG_ITEM, ModCompatData.PALM_SLAB, EItems.PALM_CRUCIBLE);
modUShaped(recipes, ModIds.BIOMES_O_PLENTY, ModCompatData.WILLOW_LOG_ITEM, ModCompatData.WILLOW_SLAB, EItems.WILLOW_CRUCIBLE);
modUShaped(recipes, ModIds.BIOMES_O_PLENTY, ModCompatData.DEAD_LOG_ITEM, ModCompatData.DEAD_SLAB, EItems.DEAD_CRUCIBLE);
modUShaped(recipes, ModIds.BIOMES_O_PLENTY, ModCompatData.MAGIC_LOG_ITEM, ModCompatData.MAGIC_SLAB, EItems.MAGIC_CRUCIBLE);
modUShaped(recipes, ModIds.BIOMES_O_PLENTY, ModCompatData.UMBRAN_LOG_ITEM, ModCompatData.UMBRAN_SLAB, EItems.UMBRAN_CRUCIBLE);
modUShaped(recipes, ModIds.BIOMES_O_PLENTY, ModCompatData.HELLBARK_LOG_ITEM, ModCompatData.HELLBARK_SLAB, EItems.HELLBARK_CRUCIBLE);
modUShaped(recipes, ModIds.BIOMES_O_PLENTY, ModCompatData.FIR_LOG_ITEM, ModCompatData.FIR_SLAB, EItems.FIR_CRUCIBLE.get());
modUShaped(recipes, ModIds.BIOMES_O_PLENTY, ModCompatData.REDWOOD_LOG_ITEM, ModCompatData.REDWOOD_SLAB, EItems.REDWOOD_CRUCIBLE.get());
modUShaped(recipes, ModIds.BIOMES_O_PLENTY, ModCompatData.MAHOGANY_LOG_ITEM, ModCompatData.MAHOGANY_SLAB, EItems.MAHOGANY_CRUCIBLE.get());
modUShaped(recipes, ModIds.BIOMES_O_PLENTY, ModCompatData.JACARANDA_LOG_ITEM, ModCompatData.JACARANDA_SLAB, EItems.JACARANDA_CRUCIBLE.get());
modUShaped(recipes, ModIds.BIOMES_O_PLENTY, ModCompatData.PALM_LOG_ITEM, ModCompatData.PALM_SLAB, EItems.PALM_CRUCIBLE.get());
modUShaped(recipes, ModIds.BIOMES_O_PLENTY, ModCompatData.WILLOW_LOG_ITEM, ModCompatData.WILLOW_SLAB, EItems.WILLOW_CRUCIBLE.get());
modUShaped(recipes, ModIds.BIOMES_O_PLENTY, ModCompatData.DEAD_LOG_ITEM, ModCompatData.DEAD_SLAB, EItems.DEAD_CRUCIBLE.get());
modUShaped(recipes, ModIds.BIOMES_O_PLENTY, ModCompatData.MAGIC_LOG_ITEM, ModCompatData.MAGIC_SLAB, EItems.MAGIC_CRUCIBLE.get());
modUShaped(recipes, ModIds.BIOMES_O_PLENTY, ModCompatData.UMBRAN_LOG_ITEM, ModCompatData.UMBRAN_SLAB, EItems.UMBRAN_CRUCIBLE.get());
modUShaped(recipes, ModIds.BIOMES_O_PLENTY, ModCompatData.HELLBARK_LOG_ITEM, ModCompatData.HELLBARK_SLAB, EItems.HELLBARK_CRUCIBLE.get());
// Ars crucibles
modUShaped(recipes, ModIds.ARS_NOUVEAU, ModCompatData.CASCADING_ARCHWOOD_LOG_ITEM, ModCompatData.ARCHWOOD_SLAB, EItems.CASCADING_ARCHWOOD_CRUCIBLE);
modUShaped(recipes, ModIds.ARS_NOUVEAU, ModCompatData.BLAZING_ARCHWOOD_LOG_ITEM, ModCompatData.ARCHWOOD_SLAB, EItems.BLAZING_ARCHWOOD_CRUCIBLE);
modUShaped(recipes, ModIds.ARS_NOUVEAU, ModCompatData.VEXING_ARCHWOOD_LOG_ITEM, ModCompatData.ARCHWOOD_SLAB, EItems.VEXING_ARCHWOOD_CRUCIBLE);
modUShaped(recipes, ModIds.ARS_NOUVEAU, ModCompatData.FLOURISHING_ARCHWOOD_LOG_ITEM, ModCompatData.ARCHWOOD_SLAB, EItems.FLOURISHING_ARCHWOOD_CRUCIBLE);
modUShaped(recipes, ModIds.ARS_NOUVEAU, ModCompatData.CASCADING_ARCHWOOD_LOG_ITEM, ModCompatData.ARCHWOOD_SLAB, EItems.CASCADING_ARCHWOOD_CRUCIBLE.get());
modUShaped(recipes, ModIds.ARS_NOUVEAU, ModCompatData.BLAZING_ARCHWOOD_LOG_ITEM, ModCompatData.ARCHWOOD_SLAB, EItems.BLAZING_ARCHWOOD_CRUCIBLE.get());
modUShaped(recipes, ModIds.ARS_NOUVEAU, ModCompatData.VEXING_ARCHWOOD_LOG_ITEM, ModCompatData.ARCHWOOD_SLAB, EItems.VEXING_ARCHWOOD_CRUCIBLE.get());
modUShaped(recipes, ModIds.ARS_NOUVEAU, ModCompatData.FLOURISHING_ARCHWOOD_LOG_ITEM, ModCompatData.ARCHWOOD_SLAB, EItems.FLOURISHING_ARCHWOOD_CRUCIBLE.get());
// Aether crucibles
modUShaped(recipes, ModIds.AETHER, ModCompatData.GOLDEN_OAK_LOG_ITEM, ModCompatData.SKYROOT_SLAB, EItems.GOLDEN_OAK_CRUCIBLE);
modUShaped(recipes, ModIds.AETHER, ModCompatData.SKYROOT_LOG_ITEM, ModCompatData.SKYROOT_SLAB, EItems.SKYROOT_CRUCIBLE);
modUShaped(recipes, ModIds.AETHER, ModCompatData.GOLDEN_OAK_LOG_ITEM, ModCompatData.SKYROOT_SLAB, EItems.GOLDEN_OAK_CRUCIBLE.get());
modUShaped(recipes, ModIds.AETHER, ModCompatData.SKYROOT_LOG_ITEM, ModCompatData.SKYROOT_SLAB, EItems.SKYROOT_CRUCIBLE.get());
// Blue Skies crucibles
modUShaped(recipes, ModIds.BLUE_SKIES, ModCompatData.BLUEBRIGHT_LOG_ITEM, ModCompatData.BLUEBRIGHT_SLAB, EItems.BLUEBRIGHT_CRUCIBLE);
modUShaped(recipes, ModIds.BLUE_SKIES, ModCompatData.STARLIT_LOG_ITEM, ModCompatData.STARLIT_SLAB, EItems.STARLIT_CRUCIBLE);
modUShaped(recipes, ModIds.BLUE_SKIES, ModCompatData.FROSTBRIGHT_LOG_ITEM, ModCompatData.FROSTBRIGHT_SLAB, EItems.FROSTBRIGHT_CRUCIBLE);
modUShaped(recipes, ModIds.BLUE_SKIES, ModCompatData.COMET_LOG_ITEM, ModCompatData.COMET_SLAB, EItems.COMET_CRUCIBLE);
modUShaped(recipes, ModIds.BLUE_SKIES, ModCompatData.LUNAR_LOG_ITEM, ModCompatData.LUNAR_SLAB, EItems.LUNAR_CRUCIBLE);
modUShaped(recipes, ModIds.BLUE_SKIES, ModCompatData.DUSK_LOG_ITEM, ModCompatData.DUSK_SLAB, EItems.DUSK_CRUCIBLE);
modUShaped(recipes, ModIds.BLUE_SKIES, ModCompatData.MAPLE_LOG_ITEM, ModCompatData.MAPLE_SLAB, EItems.MAPLE_CRUCIBLE);
modUShaped(recipes, ModIds.BLUE_SKIES, ModCompatData.CRYSTALLIZED_LOG_ITEM, ModCompatData.CRYSTALLIZED_SLAB, EItems.CRYSTALLIZED_CRUCIBLE);
modUShaped(recipes, ModIds.BLUE_SKIES, ModCompatData.BLUEBRIGHT_LOG_ITEM, ModCompatData.BLUEBRIGHT_SLAB, EItems.BLUEBRIGHT_CRUCIBLE.get());
modUShaped(recipes, ModIds.BLUE_SKIES, ModCompatData.STARLIT_LOG_ITEM, ModCompatData.STARLIT_SLAB, EItems.STARLIT_CRUCIBLE.get());
modUShaped(recipes, ModIds.BLUE_SKIES, ModCompatData.FROSTBRIGHT_LOG_ITEM, ModCompatData.FROSTBRIGHT_SLAB, EItems.FROSTBRIGHT_CRUCIBLE.get());
modUShaped(recipes, ModIds.BLUE_SKIES, ModCompatData.COMET_LOG_ITEM, ModCompatData.COMET_SLAB, EItems.COMET_CRUCIBLE.get());
modUShaped(recipes, ModIds.BLUE_SKIES, ModCompatData.LUNAR_LOG_ITEM, ModCompatData.LUNAR_SLAB, EItems.LUNAR_CRUCIBLE.get());
modUShaped(recipes, ModIds.BLUE_SKIES, ModCompatData.DUSK_LOG_ITEM, ModCompatData.DUSK_SLAB, EItems.DUSK_CRUCIBLE.get());
modUShaped(recipes, ModIds.BLUE_SKIES, ModCompatData.MAPLE_LOG_ITEM, ModCompatData.MAPLE_SLAB, EItems.MAPLE_CRUCIBLE.get());
modUShaped(recipes, ModIds.BLUE_SKIES, ModCompatData.CRYSTALLIZED_LOG_ITEM, ModCompatData.CRYSTALLIZED_SLAB, EItems.CRYSTALLIZED_CRUCIBLE.get());
// Barrels
uShaped(recipes, EItems.OAK_BARREL, ingredient(Items.OAK_PLANKS), ingredient(Items.OAK_SLAB));
uShaped(recipes, EItems.SPRUCE_BARREL, ingredient(Items.SPRUCE_PLANKS), ingredient(Items.SPRUCE_SLAB));
uShaped(recipes, EItems.BIRCH_BARREL, ingredient(Items.BIRCH_PLANKS), ingredient(Items.BIRCH_SLAB));
uShaped(recipes, EItems.JUNGLE_BARREL, ingredient(Items.JUNGLE_PLANKS), ingredient(Items.JUNGLE_SLAB));
uShaped(recipes, EItems.ACACIA_BARREL, ingredient(Items.ACACIA_PLANKS), ingredient(Items.ACACIA_SLAB));
uShaped(recipes, EItems.DARK_OAK_BARREL, ingredient(Items.DARK_OAK_PLANKS), ingredient(Items.DARK_OAK_SLAB));
uShaped(recipes, EItems.MANGROVE_BARREL, ingredient(Items.MANGROVE_PLANKS), ingredient(Items.MANGROVE_SLAB));
uShaped(recipes, EItems.CHERRY_BARREL, ingredient(Items.CHERRY_PLANKS), ingredient(Items.CHERRY_SLAB));
uShaped(recipes, EItems.BAMBOO_BARREL, ingredient(Items.BAMBOO_PLANKS), ingredient(Items.BAMBOO_SLAB));
uShaped(recipes, EItems.CRIMSON_BARREL, ingredient(Items.CRIMSON_PLANKS), ingredient(Items.CRIMSON_SLAB));
uShaped(recipes, EItems.WARPED_BARREL, ingredient(Items.WARPED_PLANKS), ingredient(Items.WARPED_SLAB));
uShaped(recipes, EItems.STONE_BARREL, ingredient(Items.STONE), ingredient(Items.STONE_SLAB));
uShaped(recipes, DefaultMaterials.OAK_BARREL.getItem(), ingredient(Items.OAK_PLANKS), ingredient(Items.OAK_SLAB));
uShaped(recipes, DefaultMaterials.SPRUCE_BARREL.getItem(), ingredient(Items.SPRUCE_PLANKS), ingredient(Items.SPRUCE_SLAB));
uShaped(recipes, DefaultMaterials.BIRCH_BARREL.getItem(), ingredient(Items.BIRCH_PLANKS), ingredient(Items.BIRCH_SLAB));
uShaped(recipes, DefaultMaterials.JUNGLE_BARREL.getItem(), ingredient(Items.JUNGLE_PLANKS), ingredient(Items.JUNGLE_SLAB));
uShaped(recipes, DefaultMaterials.ACACIA_BARREL.getItem(), ingredient(Items.ACACIA_PLANKS), ingredient(Items.ACACIA_SLAB));
uShaped(recipes, DefaultMaterials.DARK_OAK_BARREL.getItem(), ingredient(Items.DARK_OAK_PLANKS), ingredient(Items.DARK_OAK_SLAB));
uShaped(recipes, DefaultMaterials.MANGROVE_BARREL.getItem(), ingredient(Items.MANGROVE_PLANKS), ingredient(Items.MANGROVE_SLAB));
uShaped(recipes, DefaultMaterials.CHERRY_BARREL.getItem(), ingredient(Items.CHERRY_PLANKS), ingredient(Items.CHERRY_SLAB));
uShaped(recipes, DefaultMaterials.BAMBOO_BARREL.getItem(), ingredient(Items.BAMBOO_PLANKS), ingredient(Items.BAMBOO_SLAB));
uShaped(recipes, DefaultMaterials.CRIMSON_BARREL.getItem(), ingredient(Items.CRIMSON_PLANKS), ingredient(Items.CRIMSON_SLAB));
uShaped(recipes, DefaultMaterials.WARPED_BARREL.getItem(), ingredient(Items.WARPED_PLANKS), ingredient(Items.WARPED_SLAB));
uShaped(recipes, DefaultMaterials.STONE_BARREL.getItem(), ingredient(Items.STONE), ingredient(Items.STONE_SLAB));
// Modded barrels
modUShaped(recipes, ModIds.BIOMES_O_PLENTY, ModCompatData.FIR_PLANKS_ITEM, ModCompatData.FIR_SLAB, EItems.FIR_BARREL);
modUShaped(recipes, ModIds.BIOMES_O_PLENTY, ModCompatData.REDWOOD_PLANKS_ITEM, ModCompatData.REDWOOD_SLAB, EItems.REDWOOD_BARREL);
modUShaped(recipes, ModIds.BIOMES_O_PLENTY, ModCompatData.MAHOGANY_PLANKS_ITEM, ModCompatData.MAHOGANY_SLAB, EItems.MAHOGANY_BARREL);
modUShaped(recipes, ModIds.BIOMES_O_PLENTY, ModCompatData.JACARANDA_PLANKS_ITEM, ModCompatData.JACARANDA_SLAB, EItems.JACARANDA_BARREL);
modUShaped(recipes, ModIds.BIOMES_O_PLENTY, ModCompatData.PALM_PLANKS_ITEM, ModCompatData.PALM_SLAB, EItems.PALM_BARREL);
modUShaped(recipes, ModIds.BIOMES_O_PLENTY, ModCompatData.WILLOW_PLANKS_ITEM, ModCompatData.WILLOW_SLAB, EItems.WILLOW_BARREL);
modUShaped(recipes, ModIds.BIOMES_O_PLENTY, ModCompatData.DEAD_PLANKS_ITEM, ModCompatData.DEAD_SLAB, EItems.DEAD_BARREL);
modUShaped(recipes, ModIds.BIOMES_O_PLENTY, ModCompatData.MAGIC_PLANKS_ITEM, ModCompatData.MAGIC_SLAB, EItems.MAGIC_BARREL);
modUShaped(recipes, ModIds.BIOMES_O_PLENTY, ModCompatData.UMBRAN_PLANKS_ITEM, ModCompatData.UMBRAN_SLAB, EItems.UMBRAN_BARREL);
modUShaped(recipes, ModIds.BIOMES_O_PLENTY, ModCompatData.HELLBARK_PLANKS_ITEM, ModCompatData.HELLBARK_SLAB, EItems.HELLBARK_BARREL);
modUShaped(recipes, ModIds.ARS_NOUVEAU, ModCompatData.ARCHWOOD_PLANKS_ITEM, ModCompatData.ARCHWOOD_SLAB, EItems.ARCHWOOD_BARREL);
modUShaped(recipes, ModIds.AETHER, ModCompatData.SKYROOT_PLANKS_ITEM, ModCompatData.SKYROOT_SLAB, EItems.SKYROOT_BARREL);
modUShaped(recipes, ModIds.BLUE_SKIES, ModCompatData.BLUEBRIGHT_PLANKS_ITEM, ModCompatData.BLUEBRIGHT_SLAB, EItems.BLUEBRIGHT_BARREL);
modUShaped(recipes, ModIds.BLUE_SKIES, ModCompatData.STARLIT_PLANKS_ITEM, ModCompatData.STARLIT_SLAB, EItems.STARLIT_BARREL);
modUShaped(recipes, ModIds.BLUE_SKIES, ModCompatData.FROSTBRIGHT_PLANKS_ITEM, ModCompatData.FROSTBRIGHT_SLAB, EItems.FROSTBRIGHT_BARREL);
modUShaped(recipes, ModIds.BLUE_SKIES, ModCompatData.COMET_PLANKS_ITEM, ModCompatData.COMET_SLAB, EItems.COMET_BARREL);
modUShaped(recipes, ModIds.BLUE_SKIES, ModCompatData.LUNAR_PLANKS_ITEM, ModCompatData.LUNAR_SLAB, EItems.LUNAR_BARREL);
modUShaped(recipes, ModIds.BLUE_SKIES, ModCompatData.DUSK_PLANKS_ITEM, ModCompatData.DUSK_SLAB, EItems.DUSK_BARREL);
modUShaped(recipes, ModIds.BLUE_SKIES, ModCompatData.MAPLE_PLANKS_ITEM, ModCompatData.MAPLE_SLAB, EItems.MAPLE_BARREL);
modUShaped(recipes, ModIds.BLUE_SKIES, ModCompatData.CRYSTALLIZED_PLANKS_ITEM, ModCompatData.CRYSTALLIZED_SLAB, EItems.CRYSTALLIZED_BARREL);
modUShaped(recipes, ModIds.BIOMES_O_PLENTY, ModCompatData.FIR_PLANKS_ITEM, ModCompatData.FIR_SLAB, DefaultMaterials.FIR_BARREL.getItem());
modUShaped(recipes, ModIds.BIOMES_O_PLENTY, ModCompatData.REDWOOD_PLANKS_ITEM, ModCompatData.REDWOOD_SLAB, DefaultMaterials.REDWOOD_BARREL.getItem());
modUShaped(recipes, ModIds.BIOMES_O_PLENTY, ModCompatData.MAHOGANY_PLANKS_ITEM, ModCompatData.MAHOGANY_SLAB, DefaultMaterials.MAHOGANY_BARREL.getItem());
modUShaped(recipes, ModIds.BIOMES_O_PLENTY, ModCompatData.JACARANDA_PLANKS_ITEM, ModCompatData.JACARANDA_SLAB, DefaultMaterials.JACARANDA_BARREL.getItem());
modUShaped(recipes, ModIds.BIOMES_O_PLENTY, ModCompatData.PALM_PLANKS_ITEM, ModCompatData.PALM_SLAB, DefaultMaterials.PALM_BARREL.getItem());
modUShaped(recipes, ModIds.BIOMES_O_PLENTY, ModCompatData.WILLOW_PLANKS_ITEM, ModCompatData.WILLOW_SLAB, DefaultMaterials.WILLOW_BARREL.getItem());
modUShaped(recipes, ModIds.BIOMES_O_PLENTY, ModCompatData.DEAD_PLANKS_ITEM, ModCompatData.DEAD_SLAB, DefaultMaterials.DEAD_BARREL.getItem());
modUShaped(recipes, ModIds.BIOMES_O_PLENTY, ModCompatData.MAGIC_PLANKS_ITEM, ModCompatData.MAGIC_SLAB, DefaultMaterials.MAGIC_BARREL.getItem());
modUShaped(recipes, ModIds.BIOMES_O_PLENTY, ModCompatData.UMBRAN_PLANKS_ITEM, ModCompatData.UMBRAN_SLAB, DefaultMaterials.UMBRAN_BARREL.getItem());
modUShaped(recipes, ModIds.BIOMES_O_PLENTY, ModCompatData.HELLBARK_PLANKS_ITEM, ModCompatData.HELLBARK_SLAB, DefaultMaterials.HELLBARK_BARREL.getItem());
modUShaped(recipes, ModIds.ARS_NOUVEAU, ModCompatData.ARCHWOOD_PLANKS_ITEM, ModCompatData.ARCHWOOD_SLAB, DefaultMaterials.ARCHWOOD_BARREL.getItem());
modUShaped(recipes, ModIds.AETHER, ModCompatData.SKYROOT_PLANKS_ITEM, ModCompatData.SKYROOT_SLAB, DefaultMaterials.SKYROOT_BARREL.getItem());
modUShaped(recipes, ModIds.BLUE_SKIES, ModCompatData.BLUEBRIGHT_PLANKS_ITEM, ModCompatData.BLUEBRIGHT_SLAB, DefaultMaterials.BLUEBRIGHT_BARREL.getItem());
modUShaped(recipes, ModIds.BLUE_SKIES, ModCompatData.STARLIT_PLANKS_ITEM, ModCompatData.STARLIT_SLAB, DefaultMaterials.STARLIT_BARREL.getItem());
modUShaped(recipes, ModIds.BLUE_SKIES, ModCompatData.FROSTBRIGHT_PLANKS_ITEM, ModCompatData.FROSTBRIGHT_SLAB, DefaultMaterials.FROSTBRIGHT_BARREL.getItem());
modUShaped(recipes, ModIds.BLUE_SKIES, ModCompatData.COMET_PLANKS_ITEM, ModCompatData.COMET_SLAB, DefaultMaterials.COMET_BARREL.getItem());
modUShaped(recipes, ModIds.BLUE_SKIES, ModCompatData.LUNAR_PLANKS_ITEM, ModCompatData.LUNAR_SLAB, DefaultMaterials.LUNAR_BARREL.getItem());
modUShaped(recipes, ModIds.BLUE_SKIES, ModCompatData.DUSK_PLANKS_ITEM, ModCompatData.DUSK_SLAB, DefaultMaterials.DUSK_BARREL.getItem());
modUShaped(recipes, ModIds.BLUE_SKIES, ModCompatData.MAPLE_PLANKS_ITEM, ModCompatData.MAPLE_SLAB, DefaultMaterials.MAPLE_BARREL.getItem());
modUShaped(recipes, ModIds.BLUE_SKIES, ModCompatData.CRYSTALLIZED_PLANKS_ITEM, ModCompatData.CRYSTALLIZED_SLAB, DefaultMaterials.CRYSTALLIZED_BARREL.getItem());
// Pebbles and ore chunks
recipes.grid2x2(Items.COBBLESTONE, ingredient(EItems.STONE_PEBBLE));
@ -319,8 +321,8 @@ public class Recipes {
});
}
private static void modUShaped(MKRecipeProvider recipes, String modid, RegistryObject<? extends Item> sides, RegistryObject<? extends Item> middle, RegistryObject<? extends Item> result) {
recipes.conditional(result.getId().getPath(), List.of(modInstalled(modid)), writer1 -> {
private static void modUShaped(MKRecipeProvider recipes, String modid, RegistryObject<? extends Item> sides, RegistryObject<? extends Item> middle, Item result) {
recipes.conditional(path(result), List.of(modInstalled(modid)), writer1 -> {
uShaped(recipes, result, ingredient(sides), ingredient(middle));
});
}
@ -363,8 +365,8 @@ public class Recipes {
});
}
private static void uShaped(MKRecipeProvider recipes, RegistryObject<? extends Item> result, Ingredient sides, Ingredient middle) {
recipes.shapedCrafting(RecipeCategory.MISC, result.get(), recipe -> {
private static void uShaped(MKRecipeProvider recipes, Item result, Ingredient sides, Ingredient middle) {
recipes.shapedCrafting(RecipeCategory.MISC, result, recipe -> {
recipe.define('s', sides);
recipe.define('m', middle);
recipe.pattern("s s");

View File

@ -66,6 +66,7 @@ import thedarkcolour.exdeorum.compat.ModIds;
import thedarkcolour.exdeorum.compat.top.ExDeorumTopCompat;
import thedarkcolour.exdeorum.config.EConfig;
import thedarkcolour.exdeorum.item.WateringCanItem;
import thedarkcolour.exdeorum.material.BarrelMaterial;
import thedarkcolour.exdeorum.network.NetworkHandler;
import thedarkcolour.exdeorum.network.VisualUpdateTracker;
import thedarkcolour.exdeorum.recipe.RecipeUtil;
@ -180,6 +181,8 @@ public final class EventHandler {
(level, pos, relative, state) -> level.getFluidState(relative).getFluidType() == ForgeMod.WATER_TYPE.get() && EConfig.SERVER.witchWaterDirtGenerator.get(),
fluidState -> Util.getRandom(dirtVariants, rng)
));
BarrelMaterial.loadTransparentBlocks();
});
}

View File

@ -0,0 +1,247 @@
/*
* Ex Deorum
* Copyright (c) 2024 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 <http://www.gnu.org/licenses/>.
*/
package thedarkcolour.exdeorum.material;
import com.google.gson.JsonObject;
import com.google.gson.JsonParser;
import com.google.gson.JsonPrimitive;
import net.minecraft.world.item.BlockItem;
import net.minecraft.world.item.Item;
import net.minecraft.world.level.block.Block;
import net.minecraft.world.level.block.SoundType;
import net.minecraft.world.level.block.entity.BlockEntityType;
import net.minecraft.world.level.block.state.BlockBehaviour;
import net.minecraftforge.data.loading.DatagenModLoader;
import net.minecraftforge.registries.RegistryObject;
import org.jetbrains.annotations.Nullable;
import thedarkcolour.exdeorum.ExDeorum;
import thedarkcolour.exdeorum.block.BarrelBlock;
import thedarkcolour.exdeorum.blockentity.BarrelBlockEntity;
import thedarkcolour.exdeorum.client.CompostColors;
import thedarkcolour.exdeorum.registry.EBlocks;
import thedarkcolour.exdeorum.registry.EItems;
import java.io.IOException;
import java.nio.file.Files;
import java.nio.file.Path;
import java.nio.file.Paths;
import java.util.ArrayList;
import java.util.HashSet;
import java.util.List;
import java.util.Set;
public final class BarrelMaterial {
// Use a linked hash map to maintain insertion order
public static final List<BarrelMaterial> REGISTERED_MATERIALS = new ArrayList<>();
public static final Set<Block> TRANSPARENT_BARRELS = new HashSet<>();
private static final Path CUSTOM_BARREL_MATERIAL_CONFIGS = Paths.get("config/exdeorum/barrel_materials");
// The sound this block makes (a string corresponding to a field in SoundType, or an unqualified field reference like me.mymod.block.Sounds.MODDED_SOUND_TYPE)
public final SoundType soundType;
// The hardness of the barrel when harvesting
public final float strength;
// Whether this barrel needs a special tool to be harvested (ex. stone barrel only drops if mined with pickaxe)
public final boolean needsCorrectTool;
// Whether the barrel can hold hot fluids
public final boolean fireproof;
// Numeric ID of map color (these can be found on Minecraft Wiki as well as in MapColor.java)
public final int mapColor;
// ID of mod that should be present
public final String requiredModId;
// Whether fluids should be rendered with sides instead of just the top
public final boolean transparent;
private RegistryObject<BarrelBlock> block;
private RegistryObject<BlockItem> item;
BarrelMaterial(SoundType soundType, float strength, boolean needsCorrectTool, boolean fireproof, int mapColor, String requiredModId, boolean transparent) {
this.soundType = soundType;
this.strength = strength;
this.needsCorrectTool = needsCorrectTool;
this.fireproof = fireproof;
this.mapColor = mapColor;
this.requiredModId = requiredModId;
this.transparent = transparent;
}
public static void findMaterials() {
if (DatagenModLoader.isRunningDataGen()) {
return;
}
if (CompostColors.createConfigFolder(CUSTOM_BARREL_MATERIAL_CONFIGS)) {
var materialsFolder = CUSTOM_BARREL_MATERIAL_CONFIGS.toFile();
var children = materialsFolder.list();
if (children != null) {
for (var child : children) {
if (child.endsWith(".json")) {
Path path = CUSTOM_BARREL_MATERIAL_CONFIGS.resolve(child);
try {
var json = JsonParser.parseString(Files.readString(path));
var material = parseJsonMaterial((JsonObject) json, path);
if (material != null) {
registerMaterial(child.substring(0, child.length() - 5), material);
}
} catch (IOException e) {
ExDeorum.LOGGER.error("Failed to read JSON custom barrel material at {}", path);
}
}
}
} else {
ExDeorum.LOGGER.error("Failed to read custom barrel materials folder {}: not a directory", CUSTOM_BARREL_MATERIAL_CONFIGS);
}
}
}
// Returns either the material or a list of errors that occurred while parsing
@Nullable
private static BarrelMaterial parseJsonMaterial(JsonObject json, Path jsonPath) {
boolean error = false;
SoundType soundType = null;
float strength = 0;
boolean needsCorrectTool = false;
boolean fireproof = false;
int mapColor = 0;
String requiredModId = ExDeorum.ID;
boolean transparent = false;
if (json.has("sound_type")) {
var soundTypeJson = json.get("sound_type");
if (soundTypeJson.isJsonPrimitive()) {
String soundTypeString = soundTypeJson.getAsString();
soundType = SoundTypeResolver.VANILLA_SOUND_TYPES.get(soundTypeString);
if (soundType == null) {
ExDeorum.LOGGER.error("Unknown sound type \"{}\" for barrel material {}", soundTypeString, jsonPath);
error = true;
}
} else if (soundTypeJson instanceof JsonObject soundTypeObj) {
// todo let users define sound types with registry names
} else {
ExDeorum.LOGGER.error("Unable to parse sound type for barrel material {}", jsonPath);
error = true;
}
} else {
ExDeorum.LOGGER.error("Missing sound_type property for barrel material {}", jsonPath);
error = true;
}
if (json.has("strength")) {
var strengthJson = json.get("strength");
if (strengthJson.isJsonPrimitive()) {
try {
strength = strengthJson.getAsFloat();
} catch (NumberFormatException e) {
ExDeorum.LOGGER.error("Failed to parse strength property for barrel material {} with value {}", jsonPath, strengthJson.getAsString());
error = true;
}
} else {
ExDeorum.LOGGER.error("Failed to parse strength property for barrel material {}: not a number", jsonPath);
error = true;
}
} else {
ExDeorum.LOGGER.error("Missing strength property for barrel material {}", jsonPath);
error = true;
}
if (json.has("map_color")) {
if (json.get("map_color") instanceof JsonPrimitive prim) {
mapColor = prim.getAsInt();
if (64 <= mapColor || mapColor < 0) {
ExDeorum.LOGGER.error("Failed to parse map_color property for barrel material {}: value must be in [0,64), found {}", jsonPath, mapColor);
error = true;
}
} else {
ExDeorum.LOGGER.error("Failed to parse map_color property for barrel material {}: not a number", jsonPath);
error = true;
}
} else {
ExDeorum.LOGGER.error("Missing map_color property for barrel material {}", jsonPath);
error = true;
}
if (json.get("needs_correct_tool") instanceof JsonPrimitive prim && prim.isBoolean()) {
needsCorrectTool = prim.getAsBoolean();
}
if (json.get("fireproof") instanceof JsonPrimitive prim && prim.isBoolean()) {
fireproof = prim.getAsBoolean();
}
if (json.get("required_mod_id") instanceof JsonPrimitive prim && prim.isString()) {
requiredModId = prim.getAsString();
}
if (json.get("transparent") instanceof JsonPrimitive prim && prim.isBoolean()) {
transparent = prim.getAsBoolean();
}
if (error) {
return null;
} else {
return new BarrelMaterial(soundType, strength, needsCorrectTool, fireproof, mapColor, requiredModId, transparent);
}
}
public static void registerMaterial(String name, BarrelMaterial material) {
var id = name + "_barrel";
ExDeorum.LOGGER.info("Added barrel \"{}\" for barrel material {}: {}", id, name + ".json", material);
if (material.block != null) {
throw new IllegalStateException("Tried to set block on material" + name + ", but block was already set!");
}
material.block = EBlocks.BLOCKS.register(id, () -> {
BlockBehaviour.Properties props = BlockBehaviour.Properties.of().strength(material.strength).sound(material.soundType);
if (!material.fireproof) props.ignitedByLava();
if (material.needsCorrectTool) props.requiresCorrectToolForDrops();
return new BarrelBlock(props);
});
material.item = EItems.registerItemBlock(material.block);
REGISTERED_MATERIALS.add(material);
}
public static BlockEntityType<BarrelBlockEntity> createBlockEntityType() {
HashSet<Block> validBlocks = new HashSet<>();
for (var material : REGISTERED_MATERIALS) {
validBlocks.add(material.block.get());
}
return new BlockEntityType<>(BarrelBlockEntity::new, validBlocks, null);
}
public static void loadTransparentBlocks() {
for (var material : REGISTERED_MATERIALS) {
if (material.transparent) {
TRANSPARENT_BARRELS.add(material.getBlock());
}
}
}
// Does not check if the mod is registered
public Item getItem() {
return this.item.get();
}
public Block getBlock() {
return this.block.get();
}
}

View File

@ -0,0 +1,80 @@
/*
* Ex Deorum
* Copyright (c) 2024 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 <http://www.gnu.org/licenses/>.
*/
package thedarkcolour.exdeorum.material;
import net.minecraft.world.level.block.SoundType;
import net.minecraft.world.level.material.MapColor;
import thedarkcolour.exdeorum.ExDeorum;
import thedarkcolour.exdeorum.compat.ModIds;
@SuppressWarnings("unused")
public class DefaultMaterials {
// Ex Deorum
public static final BarrelMaterial OAK_BARREL = addDefaultWoodBarrel("oak", SoundType.WOOD, false, MapColor.WOOD, ExDeorum.ID);
public static final BarrelMaterial SPRUCE_BARREL = addDefaultWoodBarrel("spruce", SoundType.WOOD, false, MapColor.PODZOL, ExDeorum.ID);
public static final BarrelMaterial BIRCH_BARREL = addDefaultWoodBarrel("birch", SoundType.WOOD, false, MapColor.SAND, ExDeorum.ID);
public static final BarrelMaterial JUNGLE_BARREL = addDefaultWoodBarrel("jungle", SoundType.WOOD, false, MapColor.DIRT, ExDeorum.ID);
public static final BarrelMaterial ACACIA_BARREL = addDefaultWoodBarrel("acacia", SoundType.WOOD, false, MapColor.COLOR_ORANGE, ExDeorum.ID);
public static final BarrelMaterial DARK_OAK_BARREL = addDefaultWoodBarrel("dark_oak", SoundType.WOOD, false, MapColor.COLOR_BROWN, ExDeorum.ID);
public static final BarrelMaterial MANGROVE_BARREL = addDefaultWoodBarrel("mangrove", SoundType.WOOD, false, MapColor.COLOR_RED, ExDeorum.ID);
public static final BarrelMaterial CHERRY_BARREL = addDefaultWoodBarrel("cherry", SoundType.WOOD, false, MapColor.TERRACOTTA_WHITE, ExDeorum.ID);
public static final BarrelMaterial BAMBOO_BARREL = addDefaultWoodBarrel("bamboo", SoundType.BAMBOO, false, MapColor.COLOR_YELLOW, ExDeorum.ID);
public static final BarrelMaterial CRIMSON_BARREL = addDefaultWoodBarrel("crimson", SoundType.NETHER_WOOD, true, MapColor.CRIMSON_STEM, ExDeorum.ID);
public static final BarrelMaterial WARPED_BARREL = addDefaultWoodBarrel("warped", SoundType.NETHER_WOOD, true, MapColor.WARPED_STEM, ExDeorum.ID);
public static final BarrelMaterial STONE_BARREL = addDefaultBarrel("stone", SoundType.STONE, 4.0f, true, true, MapColor.STONE, ExDeorum.ID, false);
// BOP
public static final BarrelMaterial FIR_BARREL = addDefaultWoodBarrel("fir", SoundType.WOOD, false, MapColor.TERRACOTTA_WHITE, ModIds.BIOMES_O_PLENTY);
public static final BarrelMaterial REDWOOD_BARREL = addDefaultWoodBarrel("redwood", SoundType.WOOD, false, MapColor.TERRACOTTA_ORANGE, ModIds.BIOMES_O_PLENTY);
public static final BarrelMaterial MAHOGANY_BARREL = addDefaultWoodBarrel("mahogany", SoundType.WOOD, false, MapColor.TERRACOTTA_PINK, ModIds.BIOMES_O_PLENTY);
public static final BarrelMaterial JACARANDA_BARREL = addDefaultWoodBarrel("jacaranda", SoundType.WOOD, false, MapColor.QUARTZ, ModIds.BIOMES_O_PLENTY);
public static final BarrelMaterial PALM_BARREL = addDefaultWoodBarrel("palm", SoundType.WOOD, false, MapColor.TERRACOTTA_YELLOW, ModIds.BIOMES_O_PLENTY);
public static final BarrelMaterial WILLOW_BARREL = addDefaultWoodBarrel("willow", SoundType.WOOD, false, MapColor.TERRACOTTA_LIGHT_GREEN, ModIds.BIOMES_O_PLENTY);
public static final BarrelMaterial DEAD_BARREL = addDefaultWoodBarrel("dead", SoundType.WOOD, false, MapColor.STONE, ModIds.BIOMES_O_PLENTY);
public static final BarrelMaterial MAGIC_BARREL = addDefaultWoodBarrel("magic", SoundType.WOOD, false, MapColor.COLOR_BLUE, ModIds.BIOMES_O_PLENTY);
public static final BarrelMaterial UMBRAN_BARREL = addDefaultWoodBarrel("umbran", SoundType.WOOD, false, MapColor.TERRACOTTA_BLUE, ModIds.BIOMES_O_PLENTY);
public static final BarrelMaterial HELLBARK_BARREL = addDefaultWoodBarrel("hellbark", SoundType.WOOD, true, MapColor.TERRACOTTA_GRAY, ModIds.BIOMES_O_PLENTY);
// Ars Nouveau
public static final BarrelMaterial ARCHWOOD_BARREL = addDefaultWoodBarrel("archwood", SoundType.WOOD, false, MapColor.COLOR_GRAY, ModIds.ARS_NOUVEAU);
// Aether
public static final BarrelMaterial SKYROOT_BARREL = addDefaultWoodBarrel("skyroot", SoundType.WOOD, false, MapColor.WOOD, ModIds.AETHER);
// Blue Skies
public static final BarrelMaterial BLUEBRIGHT_BARREL = addDefaultWoodBarrel("bluebright", SoundType.WOOD, false, MapColor.WOOD, ModIds.BLUE_SKIES);
public static final BarrelMaterial STARLIT_BARREL = addDefaultWoodBarrel("starlit", SoundType.WOOD, false, MapColor.WOOD, ModIds.BLUE_SKIES);
public static final BarrelMaterial FROSTBRIGHT_BARREL = addDefaultWoodBarrel("frostbright", SoundType.WOOD, false, MapColor.WOOD, ModIds.BLUE_SKIES);
public static final BarrelMaterial COMET_BARREL = addDefaultWoodBarrel("comet", SoundType.WOOD, false, MapColor.WOOD, ModIds.BLUE_SKIES);
public static final BarrelMaterial LUNAR_BARREL = addDefaultWoodBarrel("lunar", SoundType.WOOD, false, MapColor.WOOD, ModIds.BLUE_SKIES);
public static final BarrelMaterial DUSK_BARREL = addDefaultWoodBarrel("dusk", SoundType.WOOD, false, MapColor.WOOD, ModIds.BLUE_SKIES);
public static final BarrelMaterial MAPLE_BARREL = addDefaultWoodBarrel("maple", SoundType.WOOD, false, MapColor.WOOD, ModIds.BLUE_SKIES);
public static final BarrelMaterial CRYSTALLIZED_BARREL = addDefaultBarrel("crystallized", SoundType.GLASS, 4.0f, true, true, MapColor.TERRACOTTA_WHITE, ModIds.BLUE_SKIES, true);
static BarrelMaterial addDefaultWoodBarrel(String name, SoundType soundType, boolean fireproof, MapColor color, String requiredModId) {
return addDefaultBarrel(name, soundType, 2.0f, false, fireproof, color, requiredModId, false);
}
static BarrelMaterial addDefaultBarrel(String name, SoundType soundType, float strength, boolean needsCorrectTool, boolean fireproof, MapColor color, String requiredModId, boolean transparent) {
var material = new BarrelMaterial(soundType, strength, needsCorrectTool, fireproof, color.id, requiredModId, transparent);
BarrelMaterial.registerMaterial(name, material);
return material;
}
// This call initializes the DefaultMaterials fields as well as searching for user-defined ones in the appropriate places
public static void registerMaterials() {
BarrelMaterial.findMaterials();
}
}

View File

@ -0,0 +1,143 @@
/*
* Ex Deorum
* Copyright (c) 2024 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 <http://www.gnu.org/licenses/>.
*/
package thedarkcolour.exdeorum.material;
import com.google.common.collect.ImmutableMap;
import net.minecraft.world.level.block.SoundType;
import net.minecraftforge.fml.loading.FMLLoader;
import thedarkcolour.exdeorum.ExDeorum;
import java.util.Map;
class SoundTypeResolver {
static final Map<String, SoundType> VANILLA_SOUND_TYPES;
static {
if (ExDeorum.DEBUG && !FMLLoader.versionInfo().mcVersion().equals("1.20.1")) {
throw new RuntimeException("Update the BarrelMaterial map");
}
// Very long line of put calls that put each SoundType field and its lowercase name into the map
ImmutableMap.Builder<String, SoundType> temp = ImmutableMap.builder();
temp.put("empty", SoundType.EMPTY);
temp.put("wood", SoundType.WOOD);
temp.put("gravel", SoundType.GRAVEL);
temp.put("grass", SoundType.GRASS);
temp.put("lily_pad", SoundType.LILY_PAD);
temp.put("stone", SoundType.STONE);
temp.put("metal", SoundType.METAL);
temp.put("glass", SoundType.GLASS);
temp.put("wool", SoundType.WOOL);
temp.put("sand", SoundType.SAND);
temp.put("snow", SoundType.SNOW);
temp.put("powder_snow", SoundType.POWDER_SNOW);
temp.put("ladder", SoundType.LADDER);
temp.put("anvil", SoundType.ANVIL);
temp.put("slime_block", SoundType.SLIME_BLOCK);
temp.put("honey_block", SoundType.HONEY_BLOCK);
temp.put("wet_grass", SoundType.WET_GRASS);
temp.put("coral_block", SoundType.CORAL_BLOCK);
temp.put("bamboo", SoundType.BAMBOO);
temp.put("bamboo_sapling", SoundType.BAMBOO_SAPLING);
temp.put("scaffolding", SoundType.SCAFFOLDING);
temp.put("sweet_berry_bush", SoundType.SWEET_BERRY_BUSH);
temp.put("crop", SoundType.CROP);
temp.put("hard_crop", SoundType.HARD_CROP);
temp.put("vine", SoundType.VINE);
temp.put("nether_wart", SoundType.NETHER_WART);
temp.put("lantern", SoundType.LANTERN);
temp.put("stem", SoundType.STEM);
temp.put("nylium", SoundType.NYLIUM);
temp.put("fungus", SoundType.FUNGUS);
temp.put("roots", SoundType.ROOTS);
temp.put("shroomlight", SoundType.SHROOMLIGHT);
temp.put("weeping_vines", SoundType.WEEPING_VINES);
temp.put("twisting_vines", SoundType.TWISTING_VINES);
temp.put("soul_sand", SoundType.SOUL_SAND);
temp.put("soul_soil", SoundType.SOUL_SOIL);
temp.put("basalt", SoundType.BASALT);
temp.put("wart_block", SoundType.WART_BLOCK);
temp.put("netherrack", SoundType.NETHERRACK);
temp.put("nether_bricks", SoundType.NETHER_BRICKS);
temp.put("nether_sprouts", SoundType.NETHER_SPROUTS);
temp.put("nether_ore", SoundType.NETHER_ORE);
temp.put("bone_block", SoundType.BONE_BLOCK);
temp.put("netherite_block", SoundType.NETHERITE_BLOCK);
temp.put("ancient_debris", SoundType.ANCIENT_DEBRIS);
temp.put("lodestone", SoundType.LODESTONE);
temp.put("chain", SoundType.CHAIN);
temp.put("nether_gold_ore", SoundType.NETHER_GOLD_ORE);
temp.put("gilded_blackstone", SoundType.GILDED_BLACKSTONE);
temp.put("candle", SoundType.CANDLE);
temp.put("amethyst", SoundType.AMETHYST);
temp.put("amethyst_cluster", SoundType.AMETHYST_CLUSTER);
temp.put("small_amethyst_bud", SoundType.SMALL_AMETHYST_BUD);
temp.put("medium_amethyst_bud", SoundType.MEDIUM_AMETHYST_BUD);
temp.put("large_amethyst_bud", SoundType.LARGE_AMETHYST_BUD);
temp.put("tuff", SoundType.TUFF);
temp.put("calcite", SoundType.CALCITE);
temp.put("dripstone_block", SoundType.DRIPSTONE_BLOCK);
temp.put("pointed_dripstone", SoundType.POINTED_DRIPSTONE);
temp.put("copper", SoundType.COPPER);
temp.put("cave_vines", SoundType.CAVE_VINES);
temp.put("spore_blossom", SoundType.SPORE_BLOSSOM);
temp.put("azalea", SoundType.AZALEA);
temp.put("flowering_azalea", SoundType.FLOWERING_AZALEA);
temp.put("moss_carpet", SoundType.MOSS_CARPET);
temp.put("pink_petals", SoundType.PINK_PETALS);
temp.put("moss", SoundType.MOSS);
temp.put("big_dripleaf", SoundType.BIG_DRIPLEAF);
temp.put("small_dripleaf", SoundType.SMALL_DRIPLEAF);
temp.put("rooted_dirt", SoundType.ROOTED_DIRT);
temp.put("hanging_roots", SoundType.HANGING_ROOTS);
temp.put("azalea_leaves", SoundType.AZALEA_LEAVES);
temp.put("sculk_sensor", SoundType.SCULK_SENSOR);
temp.put("sculk_catalyst", SoundType.SCULK_CATALYST);
temp.put("sculk", SoundType.SCULK);
temp.put("sculk_vein", SoundType.SCULK_VEIN);
temp.put("sculk_shrieker", SoundType.SCULK_SHRIEKER);
temp.put("glow_lichen", SoundType.GLOW_LICHEN);
temp.put("deepslate", SoundType.DEEPSLATE);
temp.put("deepslate_bricks", SoundType.DEEPSLATE_BRICKS);
temp.put("deepslate_tiles", SoundType.DEEPSLATE_TILES);
temp.put("polished_deepslate", SoundType.POLISHED_DEEPSLATE);
temp.put("froglight", SoundType.FROGLIGHT);
temp.put("frogspawn", SoundType.FROGSPAWN);
temp.put("mangrove_roots", SoundType.MANGROVE_ROOTS);
temp.put("muddy_mangrove_roots", SoundType.MUDDY_MANGROVE_ROOTS);
temp.put("mud", SoundType.MUD);
temp.put("mud_bricks", SoundType.MUD_BRICKS);
temp.put("packed_mud", SoundType.PACKED_MUD);
temp.put("hanging_sign", SoundType.HANGING_SIGN);
temp.put("nether_wood_hanging_sign", SoundType.NETHER_WOOD_HANGING_SIGN);
temp.put("bamboo_wood_hanging_sign", SoundType.BAMBOO_WOOD_HANGING_SIGN);
temp.put("bamboo_wood", SoundType.BAMBOO_WOOD);
temp.put("nether_wood", SoundType.NETHER_WOOD);
temp.put("cherry_wood", SoundType.CHERRY_WOOD);
temp.put("cherry_sapling", SoundType.CHERRY_SAPLING);
temp.put("cherry_leaves", SoundType.CHERRY_LEAVES);
temp.put("cherry_wood_hanging_sign", SoundType.CHERRY_WOOD_HANGING_SIGN);
temp.put("chiseled_bookshelf", SoundType.CHISELED_BOOKSHELF);
temp.put("suspicious_sand", SoundType.SUSPICIOUS_SAND);
temp.put("suspicious_gravel", SoundType.SUSPICIOUS_GRAVEL);
temp.put("decorated_pot", SoundType.DECORATED_POT);
temp.put("decorated_pot_cracked", SoundType.DECORATED_POT_CRACKED);
VANILLA_SOUND_TYPES = temp.build();
}
}

View File

@ -0,0 +1,21 @@
/*
* Ex Deorum
* Copyright (c) 2024 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 <http://www.gnu.org/licenses/>.
*/
@net.minecraft.MethodsReturnNonnullByDefault
@javax.annotation.ParametersAreNonnullByDefault
package thedarkcolour.exdeorum.material;

View File

@ -30,6 +30,7 @@ import thedarkcolour.exdeorum.blockentity.MechanicalHammerBlockEntity;
import thedarkcolour.exdeorum.blockentity.MechanicalSieveBlockEntity;
import thedarkcolour.exdeorum.blockentity.SieveBlockEntity;
import thedarkcolour.exdeorum.blockentity.WaterCrucibleBlockEntity;
import thedarkcolour.exdeorum.material.BarrelMaterial;
public class EBlockEntities {
public static final DeferredRegister<BlockEntityType<?>> BLOCK_ENTITIES = DeferredRegister.create(ForgeRegistries.BLOCK_ENTITY_TYPES, ExDeorum.ID);
@ -81,44 +82,7 @@ public class EBlockEntities {
EBlocks.DUSK_CRUCIBLE.get(),
EBlocks.MAPLE_CRUCIBLE.get()
).build(null));
public static final RegistryObject<BlockEntityType<BarrelBlockEntity>> BARREL = BLOCK_ENTITIES.register("barrel", () -> BlockEntityType.Builder.of(BarrelBlockEntity::new,
EBlocks.OAK_BARREL.get(),
EBlocks.SPRUCE_BARREL.get(),
EBlocks.BIRCH_BARREL.get(),
EBlocks.JUNGLE_BARREL.get(),
EBlocks.ACACIA_BARREL.get(),
EBlocks.DARK_OAK_BARREL.get(),
EBlocks.MANGROVE_BARREL.get(),
EBlocks.CHERRY_BARREL.get(),
EBlocks.BAMBOO_BARREL.get(),
EBlocks.CRIMSON_BARREL.get(),
EBlocks.WARPED_BARREL.get(),
EBlocks.STONE_BARREL.get(),
// BOP
EBlocks.FIR_BARREL.get(),
EBlocks.REDWOOD_BARREL.get(),
EBlocks.MAHOGANY_BARREL.get(),
EBlocks.JACARANDA_BARREL.get(),
EBlocks.PALM_BARREL.get(),
EBlocks.WILLOW_BARREL.get(),
EBlocks.DEAD_BARREL.get(),
EBlocks.MAGIC_BARREL.get(),
EBlocks.UMBRAN_BARREL.get(),
EBlocks.HELLBARK_BARREL.get(),
// Ars Nouveau
EBlocks.ARCHWOOD_BARREL.get(),
// Aether
EBlocks.SKYROOT_BARREL.get(),
// Blue Skies
EBlocks.BLUEBRIGHT_BARREL.get(),
EBlocks.STARLIT_BARREL.get(),
EBlocks.FROSTBRIGHT_BARREL.get(),
EBlocks.COMET_BARREL.get(),
EBlocks.LUNAR_BARREL.get(),
EBlocks.DUSK_BARREL.get(),
EBlocks.MAPLE_BARREL.get(),
EBlocks.CRYSTALLIZED_BARREL.get()
).build(null));
public static final RegistryObject<BlockEntityType<BarrelBlockEntity>> BARREL = BLOCK_ENTITIES.register("barrel", BarrelMaterial::createBlockEntityType);
public static final RegistryObject<BlockEntityType<SieveBlockEntity>> SIEVE = BLOCK_ENTITIES.register("sieve", () -> BlockEntityType.Builder.of(SieveBlockEntity::new,
EBlocks.OAK_SIEVE.get(),
EBlocks.SPRUCE_SIEVE.get(),

View File

@ -35,6 +35,7 @@ import thedarkcolour.exdeorum.block.*;
import static net.minecraft.world.level.block.state.BlockBehaviour.Properties.copy;
import static net.minecraft.world.level.block.state.BlockBehaviour.Properties.of;
// READER'S NOTE: More blocks are found in DefaultMaterials.java
public class EBlocks {
public static final DeferredRegister<Block> BLOCKS = DeferredRegister.create(ForgeRegistries.BLOCKS, ExDeorum.ID);
@ -45,44 +46,6 @@ public class EBlocks {
public static final RegistryObject<Block> CRUSHED_DEEPSLATE = BLOCKS.register("crushed_deepslate", () -> new FallingBlock(of().mapColor(DyeColor.GRAY).sound(SoundType.SAND).strength(0.8f)));
public static final RegistryObject<Block> CRUSHED_BLACKSTONE = BLOCKS.register("crushed_blackstone", () -> new FallingBlock(of().mapColor(DyeColor.BLACK).sound(SoundType.SAND).strength(0.6f)));
// Barrels
public static final RegistryObject<BarrelBlock> OAK_BARREL = registerBarrel("oak_barrel", false, false, MapColor.WOOD);
public static final RegistryObject<BarrelBlock> SPRUCE_BARREL = registerBarrel("spruce_barrel", false, false, MapColor.PODZOL);
public static final RegistryObject<BarrelBlock> BIRCH_BARREL = registerBarrel("birch_barrel", false, false, MapColor.SAND);
public static final RegistryObject<BarrelBlock> JUNGLE_BARREL = registerBarrel("jungle_barrel", false, false, MapColor.DIRT);
public static final RegistryObject<BarrelBlock> ACACIA_BARREL = registerBarrel("acacia_barrel", false, false, MapColor.COLOR_ORANGE);
public static final RegistryObject<BarrelBlock> DARK_OAK_BARREL = registerBarrel("dark_oak_barrel", false, false, MapColor.COLOR_BROWN);
public static final RegistryObject<BarrelBlock> MANGROVE_BARREL = registerBarrel("mangrove_barrel", false, false, MapColor.COLOR_RED);
public static final RegistryObject<BarrelBlock> CHERRY_BARREL = registerBarrel("cherry_barrel", false, false, MapColor.TERRACOTTA_WHITE);
public static final RegistryObject<BarrelBlock> BAMBOO_BARREL = registerBarrel("bamboo_barrel", false, false, MapColor.COLOR_YELLOW);
public static final RegistryObject<BarrelBlock> CRIMSON_BARREL = registerBarrel("crimson_barrel", false, true, MapColor.CRIMSON_STEM);
public static final RegistryObject<BarrelBlock> WARPED_BARREL = registerBarrel("warped_barrel", false, true, MapColor.WARPED_STEM);
public static final RegistryObject<BarrelBlock> STONE_BARREL = registerBarrel("stone_barrel", true, true, MapColor.STONE);
// BOP Barrels
public static final RegistryObject<BarrelBlock> FIR_BARREL = registerBarrel("fir_barrel", false, false, MapColor.TERRACOTTA_WHITE);
public static final RegistryObject<BarrelBlock> REDWOOD_BARREL = registerBarrel("redwood_barrel", false, false, MapColor.TERRACOTTA_ORANGE);
public static final RegistryObject<BarrelBlock> MAHOGANY_BARREL = registerBarrel("mahogany_barrel", false, false, MapColor.TERRACOTTA_PINK);
public static final RegistryObject<BarrelBlock> JACARANDA_BARREL = registerBarrel("jacaranda_barrel", false, false, MapColor.QUARTZ);
public static final RegistryObject<BarrelBlock> PALM_BARREL = registerBarrel("palm_barrel", false, false, MapColor.TERRACOTTA_YELLOW);
public static final RegistryObject<BarrelBlock> WILLOW_BARREL = registerBarrel("willow_barrel", false, false, MapColor.TERRACOTTA_LIGHT_GREEN);
public static final RegistryObject<BarrelBlock> DEAD_BARREL = registerBarrel("dead_barrel", false, false, MapColor.STONE);
public static final RegistryObject<BarrelBlock> MAGIC_BARREL = registerBarrel("magic_barrel", false, false, MapColor.COLOR_BLUE);
public static final RegistryObject<BarrelBlock> UMBRAN_BARREL = registerBarrel("umbran_barrel", false, false, MapColor.TERRACOTTA_BLUE);
public static final RegistryObject<BarrelBlock> HELLBARK_BARREL = registerBarrel("hellbark_barrel", false, false, MapColor.TERRACOTTA_GRAY);
// Ars Nouveau Barrels
public static final RegistryObject<BarrelBlock> ARCHWOOD_BARREL = registerBarrel("archwood_barrel", false, false, MapColor.COLOR_GRAY);
// Aether Barrels
public static final RegistryObject<BarrelBlock> SKYROOT_BARREL = registerBarrel("skyroot_barrel", false, false, MapColor.WOOD);
// Blue Skies Barrels
public static final RegistryObject<BarrelBlock> BLUEBRIGHT_BARREL = registerBarrel("bluebright_barrel", false, false, MapColor.WOOD);
public static final RegistryObject<BarrelBlock> STARLIT_BARREL = registerBarrel("starlit_barrel", false, false, MapColor.WOOD);
public static final RegistryObject<BarrelBlock> FROSTBRIGHT_BARREL = registerBarrel("frostbright_barrel", false, false, MapColor.WOOD);
public static final RegistryObject<BarrelBlock> COMET_BARREL = registerBarrel("comet_barrel", false, false, MapColor.WOOD);
public static final RegistryObject<BarrelBlock> LUNAR_BARREL = registerBarrel("lunar_barrel", false, false, MapColor.WOOD);
public static final RegistryObject<BarrelBlock> DUSK_BARREL = registerBarrel("dusk_barrel", false, false, MapColor.WOOD);
public static final RegistryObject<BarrelBlock> MAPLE_BARREL = registerBarrel("maple_barrel", false, false, MapColor.WOOD);
public static final RegistryObject<BarrelBlock> CRYSTALLIZED_BARREL = registerBarrel("crystallized_barrel", true, true, MapColor.TERRACOTTA_WHITE);
// Sieves
public static final RegistryObject<SieveBlock> OAK_SIEVE = registerSieve("oak_sieve");
public static final RegistryObject<SieveBlock> SPRUCE_SIEVE = registerSieve("spruce_sieve");
@ -184,24 +147,6 @@ public class EBlocks {
return BLOCKS.register(name, () -> new SieveBlock(of().strength(2.0f).noOcclusion().sound(sound)));
}
public static RegistryObject<BarrelBlock> registerBarrel(String name, boolean stone, boolean fireproof, MapColor color) {
var bamboo = name.equals("bamboo_barrel");
var crystallized = name.equals("crystallized_barrel");
return BLOCKS.register(name, () -> {
var props = of().noOcclusion().strength(stone ? 4.0f : 2.0f).sound(stone ? (crystallized ? SoundType.GLASS : SoundType.STONE) : (bamboo ? SoundType.BAMBOO_WOOD : SoundType.WOOD));
if (!stone) {
if (!fireproof) {
props.ignitedByLava();
}
} else {
props.requiresCorrectToolForDrops();
}
props.mapColor(color);
return new BarrelBlock(props);
});
}
public static RegistryObject<LavaCrucibleBlock> registerLavaCrucible(String name, boolean stone, SoundType sound) {
return BLOCKS.register(name, () -> {
var props = of().noOcclusion().strength(stone ? 2.0f : 1.5f).sound(sound);

View File

@ -34,6 +34,7 @@ import net.minecraftforge.registries.RegistryObject;
import thedarkcolour.exdeorum.ExDeorum;
import thedarkcolour.exdeorum.compat.ModIds;
import thedarkcolour.exdeorum.item.*;
import thedarkcolour.exdeorum.material.BarrelMaterial;
import thedarkcolour.exdeorum.recipe.RecipeUtil;
import thedarkcolour.exdeorum.tag.EItemTags;
@ -149,44 +150,6 @@ public class EItems {
public static final RegistryObject<BlockItem> CRUSHED_DEEPSLATE = registerItemBlock(EBlocks.CRUSHED_DEEPSLATE);
public static final RegistryObject<BlockItem> CRUSHED_BLACKSTONE = registerItemBlock(EBlocks.CRUSHED_BLACKSTONE);
// Barrels
public static final RegistryObject<BlockItem> OAK_BARREL = registerItemBlock(EBlocks.OAK_BARREL);
public static final RegistryObject<BlockItem> SPRUCE_BARREL = registerItemBlock(EBlocks.SPRUCE_BARREL);
public static final RegistryObject<BlockItem> BIRCH_BARREL = registerItemBlock(EBlocks.BIRCH_BARREL);
public static final RegistryObject<BlockItem> JUNGLE_BARREL = registerItemBlock(EBlocks.JUNGLE_BARREL);
public static final RegistryObject<BlockItem> ACACIA_BARREL = registerItemBlock(EBlocks.ACACIA_BARREL);
public static final RegistryObject<BlockItem> DARK_OAK_BARREL = registerItemBlock(EBlocks.DARK_OAK_BARREL);
public static final RegistryObject<BlockItem> MANGROVE_BARREL = registerItemBlock(EBlocks.MANGROVE_BARREL);
public static final RegistryObject<BlockItem> CHERRY_BARREL = registerItemBlock(EBlocks.CHERRY_BARREL);
public static final RegistryObject<BlockItem> BAMBOO_BARREL = registerItemBlock(EBlocks.BAMBOO_BARREL);
public static final RegistryObject<BlockItem> CRIMSON_BARREL = registerItemBlock(EBlocks.CRIMSON_BARREL);
public static final RegistryObject<BlockItem> WARPED_BARREL = registerItemBlock(EBlocks.WARPED_BARREL);
public static final RegistryObject<BlockItem> STONE_BARREL = registerItemBlock(EBlocks.STONE_BARREL);
// BOP Barrels
public static final RegistryObject<BlockItem> FIR_BARREL = registerItemBlock(EBlocks.FIR_BARREL);
public static final RegistryObject<BlockItem> REDWOOD_BARREL = registerItemBlock(EBlocks.REDWOOD_BARREL);
public static final RegistryObject<BlockItem> MAHOGANY_BARREL = registerItemBlock(EBlocks.MAHOGANY_BARREL);
public static final RegistryObject<BlockItem> JACARANDA_BARREL = registerItemBlock(EBlocks.JACARANDA_BARREL);
public static final RegistryObject<BlockItem> PALM_BARREL = registerItemBlock(EBlocks.PALM_BARREL);
public static final RegistryObject<BlockItem> WILLOW_BARREL = registerItemBlock(EBlocks.WILLOW_BARREL);
public static final RegistryObject<BlockItem> DEAD_BARREL = registerItemBlock(EBlocks.DEAD_BARREL);
public static final RegistryObject<BlockItem> MAGIC_BARREL = registerItemBlock(EBlocks.MAGIC_BARREL);
public static final RegistryObject<BlockItem> UMBRAN_BARREL = registerItemBlock(EBlocks.UMBRAN_BARREL);
public static final RegistryObject<BlockItem> HELLBARK_BARREL = registerItemBlock(EBlocks.HELLBARK_BARREL);
// Ars Nouveau Barrels
public static final RegistryObject<BlockItem> ARCHWOOD_BARREL = registerItemBlock(EBlocks.ARCHWOOD_BARREL);
// Aether Barrels
public static final RegistryObject<BlockItem> SKYROOT_BARREL = registerItemBlock(EBlocks.SKYROOT_BARREL);
// Blue Skies Barrels
public static final RegistryObject<BlockItem> BLUEBRIGHT_BARREL = registerItemBlock(EBlocks.BLUEBRIGHT_BARREL);
public static final RegistryObject<BlockItem> STARLIT_BARREL = registerItemBlock(EBlocks.STARLIT_BARREL);
public static final RegistryObject<BlockItem> FROSTBRIGHT_BARREL = registerItemBlock(EBlocks.FROSTBRIGHT_BARREL);
public static final RegistryObject<BlockItem> COMET_BARREL = registerItemBlock(EBlocks.COMET_BARREL);
public static final RegistryObject<BlockItem> LUNAR_BARREL = registerItemBlock(EBlocks.LUNAR_BARREL);
public static final RegistryObject<BlockItem> DUSK_BARREL = registerItemBlock(EBlocks.DUSK_BARREL);
public static final RegistryObject<BlockItem> MAPLE_BARREL = registerItemBlock(EBlocks.MAPLE_BARREL);
public static final RegistryObject<BlockItem> CRYSTALLIZED_BARREL = registerItemBlock(EBlocks.CRYSTALLIZED_BARREL);
// Sieves
public static final RegistryObject<BlockItem> OAK_SIEVE = registerItemBlock(EBlocks.OAK_SIEVE);
public static final RegistryObject<BlockItem> SPRUCE_SIEVE = registerItemBlock(EBlocks.SPRUCE_SIEVE);
@ -284,50 +247,13 @@ public class EItems {
boolean aether = ModList.get().isLoaded(ModIds.AETHER);
boolean blueSkies = ModList.get().isLoaded(ModIds.BLUE_SKIES);
output.accept(OAK_BARREL.get());
output.accept(SPRUCE_BARREL.get());
output.accept(BIRCH_BARREL.get());
output.accept(JUNGLE_BARREL.get());
output.accept(ACACIA_BARREL.get());
output.accept(DARK_OAK_BARREL.get());
output.accept(MANGROVE_BARREL.get());
output.accept(CHERRY_BARREL.get());
output.accept(BAMBOO_BARREL.get());
output.accept(CRIMSON_BARREL.get());
output.accept(WARPED_BARREL.get());
output.accept(STONE_BARREL.get());
if (biomesOPlenty) {
output.accept(FIR_BARREL.get());
output.accept(REDWOOD_BARREL.get());
output.accept(MAHOGANY_BARREL.get());
output.accept(JACARANDA_BARREL.get());
output.accept(PALM_BARREL.get());
output.accept(WILLOW_BARREL.get());
output.accept(DEAD_BARREL.get());
output.accept(MAGIC_BARREL.get());
output.accept(UMBRAN_BARREL.get());
output.accept(HELLBARK_BARREL.get());
}
if (arsNouveau) {
output.accept(ARCHWOOD_BARREL.get());
}
if (aether) {
output.accept(SKYROOT_BARREL.get());
}
if (blueSkies) {
output.accept(BLUEBRIGHT_BARREL.get());
output.accept(STARLIT_BARREL.get());
output.accept(FROSTBRIGHT_BARREL.get());
output.accept(COMET_BARREL.get());
output.accept(LUNAR_BARREL.get());
output.accept(DUSK_BARREL.get());
output.accept(MAPLE_BARREL.get());
output.accept(CRYSTALLIZED_BARREL.get());
for (var material : BarrelMaterial.REGISTERED_MATERIALS) {
if (ModList.get().isLoaded(material.requiredModId)) {
output.accept(material.getItem());
}
}
output.accept(OAK_SIEVE.get());
output.accept(SPRUCE_SIEVE.get());
output.accept(BIRCH_SIEVE.get());
output.accept(JUNGLE_SIEVE.get());