This commit is contained in:
thedarkcolour 2024-02-01 18:57:51 -08:00
commit 14e62e00d9
32 changed files with 297 additions and 61 deletions

View File

@ -5,7 +5,7 @@ plugins {
id 'org.spongepowered.mixin' version '0.7.+'
}
version = '1.15'
version = '1.20'
group = 'thedarkcolour.exdeorum'
base {
archivesName = 'exdeorum'
@ -176,6 +176,8 @@ dependencies {
// testing
//implementation fg.deobf("curse.maven:allthecompressed-514045:4938351")
//implementation fg.deobf("curse.maven:inventorysorter-240633:4655091")
implementation fg.deobf("curse.maven:cyclic-239286:4994392")
implementation fg.deobf("curse.maven:flib-661261:4724762")
testImplementation 'org.junit.jupiter:junit-jupiter-api:5.9.2'
testRuntimeOnly 'org.junit.jupiter:junit-jupiter-engine:5.9.2'

View File

@ -1,10 +1,29 @@
## Ex Deorum 1.16
## Ex Deorum 1.20
- Added Mechanical Hammer, a machine that uses FE to hammer blocks automatically. Uses 20 FE a tick by default and takes 200 ticks (10 seconds) to hammer an item with a hammer that has no efficiency.
- Fixed network bug when joining a server (PR #43 by CPearl0)
## Ex Deorum 1.19
- Fixed Cyclic pipes infinitely filling barrels when crafting fluid mixing recipes (ex. obsidian)
- Fixed network issue with fluid mixing recipes (PR #42 by CPearl0)
## Ex Deorum 1.18
- Fixed bug with milk and slime recipe.
- Barrel fluid mixing recipes can now consume the additive fluid using the `consumes_additive` boolean property in the recipe JSON. (ex. Water and Milk making slime)
## Ex Deorum 1.17
- Added Nether Wart as a sieve drop from Soul Sand
- Fixed Frozen Ocean biomes spawning floating icebergs in the void world type
- Fixed Slime Block barrel recipe not working in the barrel when a mod enables the Milk fluid
- Fixed duplication bug with top left player inventory slot in the Mechanical Sieve menu
## Ex Deorum 1.16
- Fixed barrels not correctly rendering their fluid contents when modified by pipes.
- Fixed Mechanical Sieve being instantly breakable with no tool. Now requires a pickaxe to destroy, like machines added by other mods.
## Ex Deorum 1.15
- Fixed not being able to enchant sieve meshes in the Enchanting Table.
- Fixed Barrels not rendering their contents properly
- Fixed Inventory Sorter by voxcpw voiding items when middle clicking slots in the Mechanical Sieve GUI.
- Fixed Inventory Sorter by voxcpw voiding items when middle-clicking slots in the Mechanical Sieve GUI.
- Improved appearance of witch water to better match water so that the transformation animation looks smoother.
## Ex Deorum 1.14

View File

@ -1,7 +1,7 @@
// 1.20.1 2023-11-25T21:07:59.265727 Tags for minecraft:block mod id exdeorum
// 1.20.1 2024-01-16T13:09:09.030463 Tags for minecraft:block mod id exdeorum
77dfab311d3714c77bcac2df0397d23d4707f03b data/exdeorum/tags/blocks/watering_can_tickable.json
f6a9610ebae09549baf17e27200037cd17318055 data/minecraft/tags/blocks/leaves.json
6118dd1a976e5c95335fe0271c784eef3dac5bf5 data/minecraft/tags/blocks/mineable/axe.json
f6a9610ebae09549baf17e27200037cd17318055 data/minecraft/tags/blocks/mineable/hoe.json
bfedafec4139f53d4f5af45596fe448d134c86eb data/minecraft/tags/blocks/mineable/pickaxe.json
04df8bfadf9a85eec21f001c37015bf49fb3c95c data/minecraft/tags/blocks/mineable/pickaxe.json
0fc927ffe01dd23fd511dea057c7894680ae9807 data/minecraft/tags/blocks/mineable/shovel.json

View File

@ -1,4 +1,4 @@
// 1.20.1 2024-01-11T17:10:41.051025 Recipes
// 1.20.1 2024-01-26T13:06:21.1726482 Recipes
e37b64428f17e304e91539ac0513456d7ce40cd1 data/exdeorum/advancements/recipes/building_blocks/sponge.json
5ad481a0c376c1a1785a5d3b992064d0ec0bf3b0 data/exdeorum/advancements/recipes/food/end_cake.json
25dd027e844a72b03c95dbe5e3c3dd8c738ceb00 data/exdeorum/advancements/recipes/misc/acacia_barrel.json
@ -164,10 +164,11 @@ f17f12ac67e700f7838cb3bab740ec254bbfe13c data/exdeorum/recipes/barrel_compost/tw
c4ecb4272c220282de403852031b3ca92651d91c data/exdeorum/recipes/barrel_compost/weeping_vines.json
5677e23fdc74130523d602ebf9e557f659af57c5 data/exdeorum/recipes/barrel_compost/wheat.json
b9a34df74ce0ee9c4247a9a64784c851eb1de58c data/exdeorum/recipes/barrel_compost/wood_chippings.json
d08b7a270dff3f7bb45338798227a69d775e7c32 data/exdeorum/recipes/barrel_fluid_mixing/blackstone.json
1a87de0d21b9677fda38f7a520cbffbdc41d8532 data/exdeorum/recipes/barrel_fluid_mixing/netherrack.json
8b42ca284eaea721e8e7589e5fb0b16ccbe66ee5 data/exdeorum/recipes/barrel_fluid_mixing/obsidian.json
7cfc5db0d6fbb804a7bd1d3bbbbace986d90f3c4 data/exdeorum/recipes/barrel_fluid_mixing/stone.json
2a58c97cdeb49be251c4abc9284ec31d587cda04 data/exdeorum/recipes/barrel_fluid_mixing/blackstone.json
990221ead2f72a9c74b27edfa387c88c7d8da3f8 data/exdeorum/recipes/barrel_fluid_mixing/netherrack.json
6d2469e79cbc88817a4582fa467857d65d9b70ed data/exdeorum/recipes/barrel_fluid_mixing/obsidian.json
4657af4003335ca25d2f92c43fd82dc3b3ad7fb2 data/exdeorum/recipes/barrel_fluid_mixing/slime_block.json
5e2a7bd06a83260c18c007bcf793c336faef264d data/exdeorum/recipes/barrel_fluid_mixing/stone.json
bdcdeae9d06028ce943d06c367b58677efe03fa8 data/exdeorum/recipes/barrel_mixing/clay.json
72f969f4db1f82a627df573c866a1b291e540a0a data/exdeorum/recipes/barrel_mixing/end_stone.json
37f73e219fda3c6f56bf55f8ec7f97586ecdbae1 data/exdeorum/recipes/barrel_mixing/ice.json
@ -1145,12 +1146,14 @@ d93c2410827c81c2dc033cb52ac4cf6af79cfee1 data/exdeorum/recipes/sieve/sand/string
c773bd94981602bdb5a3ed2ce60486e26ecaa4f7 data/exdeorum/recipes/sieve/soul_sand/diamond/ghast_tear.json
69fb6c91d6229c8df9cdb41d5d5e9c7fb04d4907 data/exdeorum/recipes/sieve/soul_sand/diamond/glowstone_dust.json
1ec5f811536c5b23245a60c2b3a6f6fd835a92f7 data/exdeorum/recipes/sieve/soul_sand/diamond/gunpowder.json
f39164c39e7b108fc9c116208d789fdc09208156 data/exdeorum/recipes/sieve/soul_sand/diamond/nether_wart.json
ac2498b96a04af149549b0390c3162a9a1c76b33 data/exdeorum/recipes/sieve/soul_sand/diamond/quartz.json
23e1a8617e4d85bedb0a3baab1d590336ac7513e data/exdeorum/recipes/sieve/soul_sand/flint/bone.json
83e5588c267594a63f8203457209f5b87cbe4b48 data/exdeorum/recipes/sieve/soul_sand/flint/crimson_nylium_spores.json
d089d069430307c89b18484a54671f3dafa58712 data/exdeorum/recipes/sieve/soul_sand/flint/ghast_tear.json
e07e424b7298ad8a6b69878168671cf404f75bc4 data/exdeorum/recipes/sieve/soul_sand/flint/glowstone_dust.json
e58e778a1e441227f1f03eaa9eaa330dc2b95ef9 data/exdeorum/recipes/sieve/soul_sand/flint/gunpowder.json
dcda96bfdc79881fcc740313dfdb14eeb84f45f6 data/exdeorum/recipes/sieve/soul_sand/flint/nether_wart.json
de2e5cfecb7bb764276756e382f2aa72d7276c57 data/exdeorum/recipes/sieve/soul_sand/flint/quartz.json
e127381da2e8116f1525db4387cb7d3ea0c48062 data/exdeorum/recipes/sieve/soul_sand/flint/warped_nylium_spores.json
564b5d6e5e4666d0d0af0acb7b6b5f2ceccb8429 data/exdeorum/recipes/sieve/soul_sand/golden/bone.json
@ -1158,20 +1161,24 @@ e127381da2e8116f1525db4387cb7d3ea0c48062 data/exdeorum/recipes/sieve/soul_sand/f
14b560a232180873720b852253ac8aa1db93e826 data/exdeorum/recipes/sieve/soul_sand/golden/glowstone_dust.json
a9aae4ed59c4d9d257c25aff3c46dca091ec375e data/exdeorum/recipes/sieve/soul_sand/golden/gold_nugget.json
4ee169bf9a649fb624da77931a4389bdfc7ae675 data/exdeorum/recipes/sieve/soul_sand/golden/gunpowder.json
c7696add10509d3411e127d3cbd285b2fe105fe1 data/exdeorum/recipes/sieve/soul_sand/golden/nether_wart.json
eaca2cf33cd025b5b9018a3278f89fa2b17f80d1 data/exdeorum/recipes/sieve/soul_sand/golden/quartz.json
8d9798f1571cf24c13047f641cb4a35d4347388c data/exdeorum/recipes/sieve/soul_sand/iron/bone.json
f94140a871e4b290e1b27839fd13e266a484acc9 data/exdeorum/recipes/sieve/soul_sand/iron/ghast_tear.json
adc67fcc8b6ec1ffbb36a26155af01b015842c46 data/exdeorum/recipes/sieve/soul_sand/iron/glowstone_dust.json
57844114c8cd33cac53af182307d4e143091e18a data/exdeorum/recipes/sieve/soul_sand/iron/gunpowder.json
e5422e5e971bef67f08f97af8cefd732aebd25c1 data/exdeorum/recipes/sieve/soul_sand/iron/nether_wart.json
35f408ac12d41ea636cf81b8a785dba80f0535ce data/exdeorum/recipes/sieve/soul_sand/iron/quartz.json
49199e67cb63ba0f30815c9b090b197a3abac4ee data/exdeorum/recipes/sieve/soul_sand/netherite/ghast_tear.json
4d3804e110f9cb9de11a7548ad72b6a32e10e554 data/exdeorum/recipes/sieve/soul_sand/netherite/glowstone_dust.json
1e78a124a62cd6f1f986023769d32a3a3c08bf6d data/exdeorum/recipes/sieve/soul_sand/netherite/gunpowder.json
dde85c1f2ec293a6d34db925521f13e94b2346a3 data/exdeorum/recipes/sieve/soul_sand/netherite/nether_wart.json
93104291e3221a15c651576b8f7124082978e53a data/exdeorum/recipes/sieve/soul_sand/netherite/quartz.json
40841ef9cb7f318b8aee0a56b8b391109b3df081 data/exdeorum/recipes/sieve/soul_sand/string/bone.json
3ccfe21e5a2d9351a6923c9c3490135ebcb96ba5 data/exdeorum/recipes/sieve/soul_sand/string/ghast_tear.json
584ece6c099a190de75d1d88431c59e5b930dc33 data/exdeorum/recipes/sieve/soul_sand/string/glowstone_dust.json
efa24078ae05e89dcaf7869ed7973e9688456c90 data/exdeorum/recipes/sieve/soul_sand/string/gunpowder.json
e5079fc3f8c018c7f2895eacecba955c2be1ef09 data/exdeorum/recipes/sieve/soul_sand/string/nether_wart.json
fe809175ad8570b7338b3aff029c040ca0fe5095 data/exdeorum/recipes/sieve/soul_sand/string/quartz.json
9ab74f344d31bf2bde6ce9c2aad2d739e7b5f234 data/exdeorum/recipes/skyroot_barrel.json
8e724e34a3107b459a0f6be31c2acd7e9782be97 data/exdeorum/recipes/skyroot_crucible.json

View File

@ -126,6 +126,7 @@
"gui.exdeorum.category.barrel_compost": "Barrel Compost",
"gui.exdeorum.category.barrel_compost.volume": "Compost: %s",
"gui.exdeorum.category.barrel_fluid_mixing": "Barrel Fluid Mixing",
"gui.exdeorum.category.barrel_fluid_mixing.contents_are_consumed": "Contents are consumed",
"gui.exdeorum.category.barrel_mixing": "Barrel Mixing",
"gui.exdeorum.category.crucible_heat_source": "Crucible Heat Sources",
"gui.exdeorum.category.crucible_heat_source.multiplier": "Melt Rate: %sx",

View File

@ -3,5 +3,6 @@
"additive_fluid": "exdeorum:witch_water",
"base_fluid": "minecraft:lava",
"base_fluid_amount": 1000,
"consumes_additive": true,
"result": "minecraft:blackstone"
}

View File

@ -3,5 +3,6 @@
"additive_fluid": "minecraft:lava",
"base_fluid": "exdeorum:witch_water",
"base_fluid_amount": 1000,
"consumes_additive": true,
"result": "minecraft:netherrack"
}

View File

@ -3,5 +3,6 @@
"additive_fluid": "minecraft:water",
"base_fluid": "minecraft:lava",
"base_fluid_amount": 1000,
"consumes_additive": false,
"result": "minecraft:obsidian"
}

View File

@ -0,0 +1,8 @@
{
"type": "exdeorum:barrel_fluid_mixing",
"additive_fluid": "minecraft:milk",
"base_fluid": "minecraft:water",
"base_fluid_amount": 1000,
"consumes_additive": true,
"result": "minecraft:slime_block"
}

View File

@ -3,5 +3,6 @@
"additive_fluid": "minecraft:lava",
"base_fluid": "minecraft:water",
"base_fluid_amount": 1000,
"consumes_additive": false,
"result": "minecraft:stone"
}

View File

@ -0,0 +1,13 @@
{
"type": "exdeorum:sieve",
"ingredient": {
"item": "minecraft:soul_sand"
},
"mesh": "exdeorum:diamond_mesh",
"result": "minecraft:nether_wart",
"result_amount": {
"type": "minecraft:binomial",
"n": 1.0,
"p": 0.1
}
}

View File

@ -0,0 +1,13 @@
{
"type": "exdeorum:sieve",
"ingredient": {
"item": "minecraft:soul_sand"
},
"mesh": "exdeorum:flint_mesh",
"result": "minecraft:nether_wart",
"result_amount": {
"type": "minecraft:binomial",
"n": 1.0,
"p": 0.06
}
}

View File

@ -0,0 +1,13 @@
{
"type": "exdeorum:sieve",
"ingredient": {
"item": "minecraft:soul_sand"
},
"mesh": "exdeorum:golden_mesh",
"result": "minecraft:nether_wart",
"result_amount": {
"type": "minecraft:binomial",
"n": 1.0,
"p": 0.08
}
}

View File

@ -0,0 +1,13 @@
{
"type": "exdeorum:sieve",
"ingredient": {
"item": "minecraft:soul_sand"
},
"mesh": "exdeorum:iron_mesh",
"result": "minecraft:nether_wart",
"result_amount": {
"type": "minecraft:binomial",
"n": 1.0,
"p": 0.05
}
}

View File

@ -0,0 +1,13 @@
{
"type": "exdeorum:sieve",
"ingredient": {
"item": "minecraft:soul_sand"
},
"mesh": "exdeorum:netherite_mesh",
"result": "minecraft:nether_wart",
"result_amount": {
"type": "minecraft:binomial",
"n": 1.0,
"p": 0.12
}
}

View File

@ -0,0 +1,13 @@
{
"type": "exdeorum:sieve",
"ingredient": {
"item": "minecraft:soul_sand"
},
"mesh": "exdeorum:string_mesh",
"result": "minecraft:nether_wart",
"result_amount": {
"type": "minecraft:binomial",
"n": 1.0,
"p": 0.06
}
}

View File

@ -5,6 +5,7 @@
"exdeorum:unfired_porcelain_crucible",
"exdeorum:crystallized_barrel",
"exdeorum:crystallized_crucible",
"exdeorum:crystallized_sieve"
"exdeorum:crystallized_sieve",
"exdeorum:mechanical_sieve"
]
}

View File

@ -19,6 +19,8 @@
package thedarkcolour.exdeorum;
import net.minecraftforge.api.distmarker.Dist;
import net.minecraftforge.common.ForgeMod;
import net.minecraftforge.data.loading.DatagenModLoader;
import net.minecraftforge.fml.DistExecutor;
import net.minecraftforge.fml.ModList;
import net.minecraftforge.fml.ModLoadingContext;
@ -56,6 +58,11 @@ public class ExDeorum {
createRegistries();
NetworkHandler.register();
// Still enabled in Dev environment because KubeJS enables milk fluid
if (DatagenModLoader.isRunningDataGen()) {
ForgeMod.enableMilkFluid();
}
// Game Events
EventHandler.register();
// Client init

View File

@ -37,9 +37,10 @@ import net.minecraft.world.item.alchemy.PotionUtils;
import net.minecraft.world.item.alchemy.Potions;
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.entity.BlockEntityTicker;
import net.minecraft.world.level.block.state.BlockState;
import net.minecraft.world.level.material.Fluid;
import net.minecraft.world.level.material.FlowingFluid;
import net.minecraft.world.level.material.Fluids;
import net.minecraftforge.common.ForgeMod;
import net.minecraftforge.common.capabilities.Capability;
@ -63,9 +64,6 @@ import thedarkcolour.exdeorum.recipe.barrel.BarrelFluidMixingRecipe;
import thedarkcolour.exdeorum.registry.EBlockEntities;
import thedarkcolour.exdeorum.registry.EFluids;
import javax.annotation.Nonnull;
import javax.annotation.Nullable;
public class BarrelBlockEntity extends EBlockEntity {
private static final int MOSS_SPREAD_RANGE = 2;
@ -73,9 +71,9 @@ public class BarrelBlockEntity extends EBlockEntity {
private final BarrelBlockEntity.FluidHandler tank = new BarrelBlockEntity.FluidHandler();
public float progress;
public short compost;
// compost colors
// compost colors (has to be shorts because Java bytes are signed and only go to 127, when need 255)
public short r, g, b;
// used to avoid obsidian dupe
// 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) {
@ -85,9 +83,8 @@ public class BarrelBlockEntity extends EBlockEntity {
private final LazyOptional<IItemHandler> itemHandler = LazyOptional.of(() -> this.item);
private final LazyOptional<IFluidHandler> fluidHandler = LazyOptional.of(() -> this.tank);
@Nonnull
@Override
public <T> LazyOptional<T> getCapability(@Nonnull Capability<T> cap, @Nullable Direction side) {
public <T> LazyOptional<T> getCapability(Capability<T> cap, Direction side) {
if (cap == ForgeCapabilities.FLUID_HANDLER) {
return this.fluidHandler.cast();
} else if (cap == ForgeCapabilities.ITEM_HANDLER) {
@ -257,13 +254,22 @@ public class BarrelBlockEntity extends EBlockEntity {
}
// Otherwise, mix the item's fluid into the barrel's fluid
var itemFluidCap = playerItem.getCapability(ForgeCapabilities.FLUID_HANDLER_ITEM).resolve();
if (itemFluidCap.isPresent()) {
var fluidInTank = itemFluidCap.get().getFluidInTank(0);
var itemFluidCapOptional = playerItem.getCapability(ForgeCapabilities.FLUID_HANDLER_ITEM).resolve();
if (itemFluidCapOptional.isPresent()) {
var itemFluidCap = itemFluidCapOptional.get();
var itemFluid = itemFluidCap.drain(1000, IFluidHandler.FluidAction.SIMULATE);
BarrelFluidMixingRecipe recipe = RecipeUtil.getFluidMixingRecipe(this.tank.getFluid(), itemFluid.getFluid());
if (this.tank.getFluidAmount() >= 1000) {
// If draining item fluid was possible and tank has enough fluid to mix...
if (recipe != null && this.tank.getFluidAmount() >= recipe.baseFluidAmount && itemFluid.getAmount() == 1000) {
if (!level.isClientSide) {
tryFluidMixing(fluidInTank.getFluid());
this.tank.drain(recipe.baseFluidAmount, IFluidHandler.FluidAction.EXECUTE);
setItem(new ItemStack(recipe.result));
if (recipe.consumesAdditive) {
itemFluidCap.drain(1000, IFluidHandler.FluidAction.EXECUTE);
player.setItemInHand(hand, itemFluidCap.getContainer());
}
}
// If a mix was successful, skip rest of logic
return InteractionResult.sidedSuccess(level.isClientSide);
@ -414,24 +420,35 @@ public class BarrelBlockEntity extends EBlockEntity {
* <li> When the fluid in the barrel changes (see {@link FluidHandler#onContentsChanged()}) </li>
*/
public void tryInWorldFluidMixing() {
if (!this.tank.isEmpty() && this.item.getStackInSlot(0).isEmpty()) {
var aboveFluid = this.level.getBlockState(this.worldPosition.above()).getFluidState().getType();
if (!this.level.isClientSide) {
if (!this.tank.isEmpty() && this.item.getStackInSlot(0).isEmpty()) {
var abovePos = this.worldPosition.above();
var aboveBlockState = this.level.getBlockState(abovePos);
var aboveFluidState = aboveBlockState.getFluidState();
var aboveFluid = aboveFluidState.getType();
if (aboveFluid != Fluids.EMPTY) {
tryFluidMixing(aboveFluid);
if (aboveFluid != Fluids.EMPTY) {
BarrelFluidMixingRecipe recipe = RecipeUtil.getFluidMixingRecipe(this.tank.getFluid(), aboveFluid instanceof FlowingFluid flowing ? flowing.getSource() : aboveFluid);
if (recipe != null) {
// If additive is not consumed, just craft
// If additive is consumed, check that the additive can be consumed before crafting
if (!recipe.consumesAdditive) {
this.tank.drain(recipe.baseFluidAmount, IFluidHandler.FluidAction.EXECUTE);
setItem(new ItemStack(recipe.result));
} else if (aboveBlockState.getBlock() instanceof BucketPickup pickup) {
// If something was picked up, we can craft
if (!pickup.pickupBlock(this.level, abovePos, aboveBlockState).isEmpty()) {
this.tank.drain(recipe.baseFluidAmount, IFluidHandler.FluidAction.EXECUTE);
setItem(new ItemStack(recipe.result));
}
}
}
}
}
}
}
private void tryFluidMixing(Fluid additive) {
BarrelFluidMixingRecipe recipe = RecipeUtil.getFluidMixingRecipe(this.tank.getFluid(), additive);
if (recipe != null) {
this.tank.drain(recipe.baseFluidAmount, IFluidHandler.FluidAction.EXECUTE);
setItem(new ItemStack(recipe.result));
}
}
public static class Ticker implements BlockEntityTicker<BarrelBlockEntity> {
@Override
public void tick(Level level, BlockPos pos, BlockState state, BarrelBlockEntity barrel) {
@ -540,12 +557,12 @@ public class BarrelBlockEntity extends EBlockEntity {
// Inner class
private class ItemHandler extends ItemStackHandler {
@Override
protected int getStackLimit(int slot, @Nonnull ItemStack stack) {
protected int getStackLimit(int slot, ItemStack stack) {
return 1;
}
@Override
public boolean isItemValid(int slot, @Nonnull ItemStack stack) {
public boolean isItemValid(int slot, ItemStack stack) {
return tryCrafting(stack, true);
}
@ -565,7 +582,6 @@ public class BarrelBlockEntity extends EBlockEntity {
return ItemHandlerHelper.copyStackWithSize(stack, stack.getCount() - 1);
}
} else {
stack.getCapability(ForgeCapabilities.FLUID_HANDLER_ITEM).ifPresent(itemFluid -> tryFluidMixing(itemFluid.getFluidInTank(0).getFluid()));
return stack;
}
}
@ -602,7 +618,47 @@ public class BarrelBlockEntity extends EBlockEntity {
protected void onContentsChanged() {
if (!BarrelBlockEntity.this.isBeingFilledByPlayer) {
BarrelBlockEntity.this.tryInWorldFluidMixing();
BarrelBlockEntity.this.markUpdated();
}
}
@Override
public int fill(FluidStack resource, FluidAction action) {
if (resource.isEmpty() || !isFluidValid(resource)) {
return 0;
}
if (action.simulate()) {
if (this.fluid.isEmpty()) {
return Math.min(this.capacity, resource.getAmount());
}
if (!this.fluid.isFluidEqual(resource)) {
return 0;
}
return Math.min(this.capacity - this.fluid.getAmount(), resource.getAmount());
}
if (this.fluid.isEmpty()) {
// fix forge's implementation to avoid dupes
int amount = Math.min(this.capacity, resource.getAmount());
this.fluid = new FluidStack(resource, Math.min(this.capacity, amount));
onContentsChanged();
return amount;
}
if (!this.fluid.isFluidEqual(resource))
{
return 0;
}
int filled = this.capacity - this.fluid.getAmount();
if (resource.getAmount() < filled) {
this.fluid.grow(resource.getAmount());
filled = resource.getAmount();
} else {
this.fluid.setAmount(this.capacity);
}
if (filled > 0) {
onContentsChanged();
}
return filled;
}
}
}

View File

@ -152,7 +152,10 @@ public class CompostColors {
if (!readMods.contains(modid)) {
var id = entry.getKey().location().getPath();
var jarFile = ModList.get().getModFileById(modid).getFile();
var modFile = ModList.get().getModFileById(modid);
if (modFile == null)
continue;
var jarFile = modFile.getFile();
var modelPath = jarFile.findResource("assets/" + modid + "/models/item/" + id + ".json");
if (Files.exists(modelPath)) {

View File

@ -19,6 +19,7 @@
package thedarkcolour.exdeorum.compat.jei;
import mezz.jei.api.gui.builder.IRecipeLayoutBuilder;
import mezz.jei.api.gui.builder.IRecipeSlotBuilder;
import mezz.jei.api.gui.drawable.IDrawable;
import mezz.jei.api.gui.ingredient.IRecipeSlotsView;
import mezz.jei.api.helpers.IGuiHelper;
@ -26,6 +27,7 @@ import mezz.jei.api.recipe.IFocusGroup;
import mezz.jei.api.recipe.RecipeIngredientRole;
import mezz.jei.api.recipe.RecipeType;
import mezz.jei.api.recipe.category.IRecipeCategory;
import net.minecraft.ChatFormatting;
import net.minecraft.client.gui.GuiGraphics;
import net.minecraft.network.chat.Component;
import net.minecraft.world.item.Item;
@ -98,6 +100,8 @@ public abstract class BarrelMixingCategory<T> implements IRecipeCategory<T> {
}
public static class Fluids extends BarrelMixingCategory<BarrelFluidMixingRecipe> {
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());
}
@ -105,7 +109,10 @@ public abstract class BarrelMixingCategory<T> implements IRecipeCategory<T> {
@Override
public void setRecipe(IRecipeLayoutBuilder builder, BarrelFluidMixingRecipe recipe, IFocusGroup focuses) {
builder.addSlot(RecipeIngredientRole.INPUT, 1, 1).addFluidStack(recipe.baseFluid, recipe.baseFluidAmount).setFluidRenderer(1000, false, 16, 16);
builder.addSlot(RecipeIngredientRole.INPUT, 33, 1).addFluidStack(recipe.additiveFluid, 1000).setFluidRenderer(1000, false, 16, 16);
IRecipeSlotBuilder additiveSlot = builder.addSlot(RecipeIngredientRole.INPUT, 33, 1).addFluidStack(recipe.additiveFluid, 1000).setFluidRenderer(1000, false, 16, 16);
if (recipe.consumesAdditive) {
additiveSlot.addTooltipCallback((view, tooltip) -> tooltip.add(CONTENTS_ARE_CONSUMED_TOOLTIP));
}
builder.addSlot(RecipeIngredientRole.OUTPUT, 79, 1).addItemStack(new ItemStack(recipe.result));
}
@ -113,5 +120,14 @@ public abstract class BarrelMixingCategory<T> implements IRecipeCategory<T> {
public RecipeType<BarrelFluidMixingRecipe> getRecipeType() {
return ExDeorumJeiPlugin.BARREL_FLUID_MIXING;
}
@Override
public void draw(BarrelFluidMixingRecipe recipe, IRecipeSlotsView recipeSlotsView, GuiGraphics graphics, double mouseX, double mouseY) {
super.draw(recipe, recipeSlotsView, graphics, mouseX, mouseY);
if (recipe.consumesAdditive) {
ClientJeiUtil.renderAsterisk(graphics, 18 + 3 + 3 + 8, 0);
}
}
}
}

View File

@ -30,6 +30,7 @@ import net.minecraft.CrashReport;
import net.minecraft.CrashReportCategory;
import net.minecraft.ReportedException;
import net.minecraft.client.Minecraft;
import net.minecraft.client.gui.Font;
import net.minecraft.client.gui.GuiGraphics;
import net.minecraft.client.renderer.ItemBlockRenderTypes;
import net.minecraft.client.renderer.MultiBufferSource;
@ -119,14 +120,21 @@ class ClientJeiUtil {
poseStack.popPose();
}
static void renderItemWithAsterisk(GuiGraphics graphics, ItemStack stack, int xOffset, int yOffset) {
static void renderItemWithAsterisk(GuiGraphics graphics, ItemStack stack) {
Minecraft mc = Minecraft.getInstance();
BakedModel model = mc.getItemRenderer().getModel(stack, mc.level, null, 0);
renderItemAlternativeModel(graphics, model, stack, xOffset, yOffset);
renderItemAlternativeModel(graphics, model, stack, 0, 0);
renderAsterisk(graphics, 0, 0);
}
static void renderAsterisk(GuiGraphics graphics, int xOffset, int yOffset) {
graphics.pose().pushPose();
graphics.pose().translate(0f, 0f, 200f);
var font = Minecraft.getInstance().font;
// 0xff5555 is Minecraft's red text color.
graphics.drawString(mc.font, "*", xOffset + 19 - 2 - mc.font.width("*"), yOffset + 12, 0xff5555, true);
graphics.drawString(font, "*", xOffset + 19 - 2 - font.width("*"), yOffset + 12, 0xff5555, true);
graphics.pose().popPose();
}
@ -224,14 +232,14 @@ class ClientJeiUtil {
}
}
enum AsteriskRenderer implements IIngredientRenderer<ItemStack> {
enum AsteriskItemRenderer implements IIngredientRenderer<ItemStack> {
INSTANCE;
@Override
public void render(GuiGraphics graphics, ItemStack ingredient) {
// From mezz.jei.library.render.ItemStackRenderer
RenderSystem.enableDepthTest();
ClientJeiUtil.renderItemWithAsterisk(graphics, ingredient, 0, 0);
ClientJeiUtil.renderItemWithAsterisk(graphics, ingredient);
// From end of DrawableIngredient
RenderSystem.disableDepthTest();
}

View File

@ -109,7 +109,7 @@ class SieveCategory implements IRecipeCategory<GroupedSieveRecipe> {
if (byHandOnly) {
tooltipLines.add(BY_HAND_ONLY_LABEL);
slot.setCustomRenderer(VanillaTypes.ITEM_STACK, ClientJeiUtil.AsteriskRenderer.INSTANCE);
slot.setCustomRenderer(VanillaTypes.ITEM_STACK, ClientJeiUtil.AsteriskItemRenderer.INSTANCE);
}
if (provider instanceof BinomialDistributionGenerator binomial) {
if (binomial.n instanceof ConstantValue constant && constant.value == 1) {

View File

@ -62,6 +62,7 @@ class English {
english.add(TranslationKeys.BARREL_COMPOST_RECIPE_VOLUME, "Compost: %s");
english.add(TranslationKeys.BARREL_MIXING_CATEGORY_TITLE, "Barrel Mixing");
english.add(TranslationKeys.BARREL_FLUID_MIXING_CATEGORY_TITLE, "Barrel Fluid Mixing");
english.add(TranslationKeys.BARREL_FLUID_MIXING_CONTENTS_ARE_CONSUMED, "Contents are consumed");
english.add(TranslationKeys.WATER_CRUCIBLE_CATEGORY_TITLE, "Water Crucible");
english.add(TranslationKeys.LAVA_CRUCIBLE_CATEGORY_TITLE, "Lava Crucible");
english.add(TranslationKeys.CRUCIBLE_HEAT_SOURCE_CATEGORY_TITLE, "Crucible Heat Sources");

View File

@ -80,7 +80,7 @@ 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);
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);
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);

View File

@ -61,6 +61,7 @@ public class TranslationKeys {
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 BARREL_FLUID_MIXING_CATEGORY_TITLE = "gui." + ExDeorum.ID + ".category.barrel_fluid_mixing";
public static final String BARREL_FLUID_MIXING_CONTENTS_ARE_CONSUMED = "gui." + ExDeorum.ID + ".category.barrel_fluid_mixing.contents_are_consumed";
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 CRUCIBLE_HEAT_SOURCE_CATEGORY_TITLE = "gui." + ExDeorum.ID + ".category.crucible_heat_source";

View File

@ -29,11 +29,13 @@ import net.minecraft.world.item.Items;
import net.minecraft.world.item.crafting.Ingredient;
import net.minecraft.world.level.ItemLike;
import net.minecraft.world.level.block.Blocks;
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.level.storage.loot.providers.number.ConstantValue;
import net.minecraft.world.level.storage.loot.providers.number.NumberProvider;
import net.minecraft.world.level.storage.loot.providers.number.UniformGenerator;
import net.minecraftforge.common.ForgeMod;
import net.minecraftforge.common.Tags;
import net.minecraftforge.common.crafting.conditions.ICondition;
import net.minecraftforge.common.crafting.conditions.ModLoadedCondition;
@ -559,13 +561,14 @@ public class Recipes {
barrelMixing(writer, ingredient(EItems.DUST.get()), Fluids.WATER, Items.CLAY);
barrelMixing(writer, ingredient(Items.MILK_BUCKET), Fluids.WATER, Items.SLIME_BLOCK);
barrelMixing(writer, "_from_porcelain_bucket", ingredient(EItems.PORCELAIN_MILK_BUCKET.get()), Fluids.WATER, Items.SLIME_BLOCK);
barrelFluidMixing(writer, Fluids.WATER, ForgeMod.MILK.get(), Items.SLIME_BLOCK, true);
barrelMixing(writer, ingredient(Items.SNOWBALL), Fluids.WATER, Items.ICE);
barrelFluidMixing(writer, Fluids.WATER, Fluids.LAVA, Items.STONE);
barrelFluidMixing(writer, Fluids.WATER, Fluids.LAVA, Items.STONE, false);
// lava
barrelFluidMixing(writer, EFluids.WITCH_WATER.get(), Fluids.LAVA, Items.NETHERRACK);
barrelFluidMixing(writer, Fluids.LAVA, EFluids.WITCH_WATER.get(), Items.BLACKSTONE);
barrelFluidMixing(writer, EFluids.WITCH_WATER.get(), Fluids.LAVA, Items.NETHERRACK, true);
barrelFluidMixing(writer, Fluids.LAVA, EFluids.WITCH_WATER.get(), Items.BLACKSTONE, true);
barrelMixing(writer, ingredient(Items.GLOWSTONE_DUST), Fluids.LAVA, Items.END_STONE);
barrelFluidMixing(writer, Fluids.LAVA, Fluids.WATER, Items.OBSIDIAN);
barrelFluidMixing(writer, Fluids.LAVA, Fluids.WATER, Items.OBSIDIAN, false);
barrelMixing(writer, ingredient(Items.SLIME_BALL), Fluids.LAVA, Items.MAGMA_CREAM);
barrelMixing(writer, ingredient(Items.SOUL_SAND), Fluids.LAVA, Items.SOUL_SOIL);
// witch water
@ -580,8 +583,8 @@ public class Recipes {
writer.accept(new FinishedBarrelMixingRecipe(new ResourceLocation(ExDeorum.ID, "barrel_mixing/" + path(result) + suffix), ingredient, fluidType, 1000, result));
}
private static void barrelFluidMixing(Consumer<FinishedRecipe> writer, Fluid base, Fluid additive, Item result) {
writer.accept(new FinishedBarrelFluidMixingRecipe(new ResourceLocation(ExDeorum.ID, "barrel_fluid_mixing/" + path(result)), base, 1000, additive, result));
private static void barrelFluidMixing(Consumer<FinishedRecipe> writer, Fluid base, Fluid additive, Item result, boolean consumesAdditive) {
writer.accept(new FinishedBarrelFluidMixingRecipe(new ResourceLocation(ExDeorum.ID, "barrel_fluid_mixing/" + path(result)), base, 1000, additive, result, consumesAdditive));
}
static ICondition tagNotEmpty(TagKey<Item> tag) {

View File

@ -786,6 +786,7 @@ class SieveRecipes {
addDrop.accept(Items.GUNPOWDER, chance(0.07f));
addDrop.accept(Items.BONE, chance(0.08f));
addDrop.accept(Items.GHAST_TEAR, chance(0.06f));
addDrop.accept(Items.NETHER_WART, chance(0.06f));
addDrop.accept(Items.GLOWSTONE_DUST, chance(0.06f));
});
forMesh(writer, ingredient(Items.SOUL_SAND), EItems.FLINT_MESH, (addDrop, addTagDrop, addConditionalDrop) -> {
@ -794,6 +795,7 @@ class SieveRecipes {
addDrop.accept(Items.BONE, chance(0.1f));
addDrop.accept(Items.GHAST_TEAR, chance(0.07f));
addDrop.accept(Items.GLOWSTONE_DUST, chance(0.07f));
addDrop.accept(Items.NETHER_WART, chance(0.06f));
addDrop.accept(EItems.WARPED_NYLIUM_SPORES.get(), chance(0.03f));
addDrop.accept(EItems.CRIMSON_NYLIUM_SPORES.get(), chance(0.03f));
});
@ -803,6 +805,7 @@ class SieveRecipes {
addDrop.accept(Items.BONE, chance(0.08f));
addDrop.accept(Items.GHAST_TEAR, chance(0.06f));
addDrop.accept(Items.GLOWSTONE_DUST, chance(0.06f));
addDrop.accept(Items.NETHER_WART, chance(0.05f));
});
forMesh(writer, ingredient(Items.SOUL_SAND), EItems.GOLDEN_MESH, (addDrop, addTagDrop, addConditionalDrop) -> {
addDrop.accept(Items.QUARTZ, chance(0.17f));
@ -810,6 +813,7 @@ class SieveRecipes {
addDrop.accept(Items.BONE, chance(0.11f));
addDrop.accept(Items.GHAST_TEAR, chance(0.08f));
addDrop.accept(Items.GLOWSTONE_DUST, chance(0.09f));
addDrop.accept(Items.NETHER_WART, chance(0.08f));
addDrop.accept(Items.GOLD_NUGGET, chance(0.15f));
});
forMesh(writer, ingredient(Items.SOUL_SAND), EItems.DIAMOND_MESH, (addDrop, addTagDrop, addConditionalDrop) -> {
@ -817,12 +821,14 @@ class SieveRecipes {
addDrop.accept(Items.GUNPOWDER, chance(0.11f));
addDrop.accept(Items.GHAST_TEAR, chance(0.09f));
addDrop.accept(Items.GLOWSTONE_DUST, chance(0.11f));
addDrop.accept(Items.NETHER_WART, chance(0.1f));
});
forMesh(writer, ingredient(Items.SOUL_SAND), EItems.NETHERITE_MESH, (addDrop, addTagDrop, addConditionalDrop) -> {
addDrop.accept(Items.QUARTZ, chance(0.21f));
addDrop.accept(Items.GUNPOWDER, chance(0.14f));
addDrop.accept(Items.GHAST_TEAR, chance(0.11f));
addDrop.accept(Items.GLOWSTONE_DUST, chance(0.13f));
addDrop.accept(Items.NETHER_WART, chance(0.12f));
});
forMesh(writer, ingredient(EItems.CRUSHED_END_STONE), EItems.STRING_MESH, (addDrop, addTagDrop, addConditionalDrop) -> {

View File

@ -48,13 +48,15 @@ public class BarrelFluidMixingRecipe implements Recipe<Container> {
public final int baseFluidAmount;
public final Fluid additiveFluid;
public final Item result;
public final boolean consumesAdditive;
public BarrelFluidMixingRecipe(ResourceLocation id, Fluid baseFluid, int baseFluidAmount, Fluid additiveFluid, Item result) {
public BarrelFluidMixingRecipe(ResourceLocation id, Fluid baseFluid, int baseFluidAmount, Fluid additiveFluid, Item result, boolean consumesAdditive) {
this.id = id;
this.baseFluid = baseFluid;
this.baseFluidAmount = baseFluidAmount;
this.additiveFluid = additiveFluid;
this.result = result;
this.consumesAdditive = consumesAdditive;
}
@Override
@ -99,8 +101,9 @@ public class BarrelFluidMixingRecipe implements Recipe<Container> {
int baseFluidAmount = GsonHelper.getAsInt(json, "base_fluid_amount");
Fluid additiveFluid = RecipeUtil.readFluid(json, "additive_fluid");
Item result = RecipeUtil.readItem(json, "result");
boolean consumesAdditive = GsonHelper.getAsBoolean(json, "consumes_additive");
return new BarrelFluidMixingRecipe(id, baseFluid, baseFluidAmount, additiveFluid, result);
return new BarrelFluidMixingRecipe(id, baseFluid, baseFluidAmount, additiveFluid, result, consumesAdditive);
}
@Override
@ -109,6 +112,7 @@ public class BarrelFluidMixingRecipe implements Recipe<Container> {
buffer.writeVarInt(recipe.baseFluidAmount);
buffer.writeRegistryId(ForgeRegistries.FLUIDS, recipe.additiveFluid);
buffer.writeRegistryId(ForgeRegistries.ITEMS, recipe.result);
buffer.writeBoolean(recipe.consumesAdditive);
}
@Override
@ -117,8 +121,9 @@ public class BarrelFluidMixingRecipe implements Recipe<Container> {
int baseFluidAmount = buffer.readVarInt();
Fluid additiveFluid = buffer.readRegistryId();
Item result = buffer.readRegistryId();
boolean consumesAdditive = buffer.readBoolean();
return new BarrelFluidMixingRecipe(id, baseFluid, baseFluidAmount, additiveFluid, result);
return new BarrelFluidMixingRecipe(id, baseFluid, baseFluidAmount, additiveFluid, result, consumesAdditive);
}
}
}

View File

@ -33,13 +33,15 @@ public class FinishedBarrelFluidMixingRecipe implements EFinishedRecipe {
private final int baseFluidAmount;
private final Fluid additiveFluid;
private final Item result;
private final boolean consumesAdditive;
public FinishedBarrelFluidMixingRecipe(ResourceLocation id, Fluid baseFluid, int baseFluidAmount, Fluid additiveFluid, Item result) {
public FinishedBarrelFluidMixingRecipe(ResourceLocation id, Fluid baseFluid, int baseFluidAmount, Fluid additiveFluid, Item result, boolean consumesAdditive) {
this.id = id;
this.baseFluid = baseFluid;
this.baseFluidAmount = baseFluidAmount;
this.additiveFluid = additiveFluid;
this.result = result;
this.consumesAdditive = consumesAdditive;
}
@Override
@ -47,6 +49,7 @@ public class FinishedBarrelFluidMixingRecipe implements EFinishedRecipe {
json.addProperty("base_fluid", ForgeRegistries.FLUIDS.getKey(this.baseFluid).toString());
json.addProperty("base_fluid_amount", this.baseFluidAmount);
json.addProperty("additive_fluid", ForgeRegistries.FLUIDS.getKey(this.additiveFluid).toString());
json.addProperty("consumes_additive", this.consumesAdditive);
json.addProperty("result", ForgeRegistries.ITEMS.getKey(this.result).toString());
}

View File

@ -119,8 +119,8 @@ public class EBlocks {
public static final RegistryObject<SieveBlock> DUSK_SIEVE = registerSieve("dusk_sieve");
public static final RegistryObject<SieveBlock> MAPLE_SIEVE = registerSieve("maple_sieve");
public static final RegistryObject<SieveBlock> CRYSTALLIZED_SIEVE = registerSieve("crystallized_sieve", SoundType.GLASS);
// Mechanical Sieve (todo add properties)
public static final RegistryObject<MechanicalSieveBlock> MECHANICAL_SIEVE = BLOCKS.register("mechanical_sieve", () -> new MechanicalSieveBlock(of()));
// Mechanical Sieve
public static final RegistryObject<MechanicalSieveBlock> MECHANICAL_SIEVE = BLOCKS.register("mechanical_sieve", () -> new MechanicalSieveBlock(of().mapColor(MapColor.METAL).requiresCorrectToolForDrops().strength(5f, 1200f)));
// Mechanical Hammer
public static final RegistryObject<MechanicalHammerBlock> MECHANICAL_HAMMER = BLOCKS.register("mechanical_hammer", () -> new MechanicalHammerBlock(of()));

View File

@ -140,6 +140,13 @@ public class VoidChunkGenerator extends NoiseBasedChunkGenerator {
}
}
@Override
public void applyBiomeDecoration(WorldGenLevel pLevel, ChunkAccess pChunk, StructureManager pStructureManager) {
if (this.generateNormal) {
super.applyBiomeDecoration(pLevel, pChunk, pStructureManager);
}
}
@Override
public void createReferences(WorldGenLevel level, StructureManager pStructureManager, ChunkAccess pChunk) {
if (this.generateNormal || hasStructures(level.registryAccess())) {