Skip to content

Commit

Permalink
Merge remote-tracking branch 'origin/1.20.1' into 1.20.1
Browse files Browse the repository at this point in the history
  • Loading branch information
ATPStorages committed Aug 30, 2024
2 parents 3a61622 + e458387 commit b592126
Show file tree
Hide file tree
Showing 5 changed files with 17 additions and 16 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -274,11 +274,20 @@ abstract class AbstractMachineBlockEntity<T : AbstractMachineBlockEntity<T>>(
}
} else progress--
}, {
println("before getting recipe")
val recipe = recipeDial.getRecipeFor(craftingManager, pLevel)
recipe.ifPresentOrElse({
if (consumeRecipe(pLevel, pPos, pState, pBlockEntity, it)) {
currentRecipe = recipe
maxProgress = it.time
try {
println("after getting recipe: $recipe")
println("recipe id: ${recipe.get().id.path}")
println("item requirement: ${recipe.get().itemsRequired}")
println("time required: ${recipe.get().time}")
} catch (e: Exception) {
println(e)
}
}
}, {
if (pState.getValue(BlockStateProperties.POWERED))
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,7 @@ class DoughMachineBlockEntity(
1 to StorageDirection.BIDIRECTIONAL
)
) to mutableListOf(null, Direction.WEST, Direction.EAST, Direction.DOWN),
listOf(0),
listOf(0, 1, 2),
1 to 1,
EnergyBattery(50000, 2000) to mutableListOf(null, Direction.NORTH),
ForgeCapabilities.FLUID_HANDLER to (FluidContainer(
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@ class WheatCrusherBlockEntity(
64 to StorageDirection.EMPTY_ONLY
)
) to ACCEPT_ALL,
listOf(0),
listOf(0, 1),
1 to 1,
EnergyBattery(50000, 2000) to ACCEPT_ALL
), MenuProvider {
Expand Down
16 changes: 4 additions & 12 deletions src/main/kotlin/breadmod/recipe/fluidEnergy/WheatCrushingRecipe.kt
Original file line number Diff line number Diff line change
Expand Up @@ -8,29 +8,21 @@ import net.minecraft.tags.TagKey
import net.minecraft.world.item.Item
import net.minecraft.world.item.ItemStack
import net.minecraft.world.item.crafting.RecipeType
import net.minecraft.world.level.material.Fluid
import net.minecraftforge.fluids.FluidStack

class WheatCrushingRecipe(
pId: ResourceLocation,
time: Int = 0,
energy: Int? = null,
fluidsRequired: List<FluidStack>? = null,
fluidsRequiredTagged: List<Pair<TagKey<Fluid>, Int>>? = null,
itemsRequired: List<ItemStack>? = null,
itemsRequiredTagged: List<Pair<TagKey<Item>, Int>>? = null,
fluidsOutput: List<FluidStack>? = null,
itemsOutput: List<ItemStack>? = null,
) : FluidEnergyRecipe(
pId,
time,
energy,
fluidsRequired,
fluidsRequiredTagged,
itemsRequired,
itemsRequiredTagged,
fluidsOutput,
itemsOutput
energy = energy,
itemsRequired = itemsRequired,
itemsRequiredTagged = itemsRequiredTagged,
itemsOutput = itemsOutput
) {
override fun getType(): RecipeType<*> = ModRecipeTypes.WHEAT_CRUSHING.get()
override fun getSerializer(): SimpleFluidEnergyRecipeSerializer<*> = ModRecipeSerializers.WHEAT_CRUSHER.get()
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -45,9 +45,9 @@ object ModRecipeSerializers {
}
val WHEAT_CRUSHER: RegistryObject<SimpleFluidEnergyRecipeSerializer<WheatCrushingRecipe>> =
deferredRegister.register("wheat_crusher") {
SimpleFluidEnergyRecipeSerializer { pId, pTime, pEnergy, pFluids, pFluidsTagged, pItems, pItemsTagged, pFluidsOut, pItemsOut ->
SimpleFluidEnergyRecipeSerializer { pId, pTime, pEnergy, _, _, pItems, pItemsTagged, _, pItemsOut ->
WheatCrushingRecipe(
pId, pTime, pEnergy, pFluids, pFluidsTagged, pItems, pItemsTagged, pFluidsOut, pItemsOut
pId, pTime, pEnergy, pItems, pItemsTagged
)
}
}
Expand Down

0 comments on commit b592126

Please sign in to comment.