mirror of
https://github.com/GTNewHorizons/ForgeMultipart.git
synced 2026-11-19 11:59:08 +00:00
fix: exclude missing placeholder from raw material recipes
This commit is contained in:
1 parent
e2122ad822
commit
4e0d7a684e
3 files changed
+17
No files matched your search
@@ -14,6 +14,7 @@ audit, before extending this list.
|
||||
|
||||
| Area | Difference and consequence |
|
||||
| --- | --- |
|
||||
| Raw microblock recipe material lookup | Skips `MissingMicroMaterial`, whose recovery item is stone, so sawing stone selects the real stone material. Existing missing-material microblocks retain their recovery behavior. This fixes a pre-existing Scala bug. |
|
||||
| `IDWriter` before `setMax` | `read`/`write` throw `IllegalStateException` instead of `NullPointerException`. Uninitialized use is unsupported. |
|
||||
| `PacketScheduler` invalid `maskWidth` | Throws `IllegalArgumentException` instead of `scala.MatchError`. Valid widths remain 1, 2, 4 and 8. |
|
||||
| `NormalOcclusionTest.apply(Traversable, Traversable)` | Materializes both inputs into Java lists before testing instead of nested Scala `forall`. Finite, side-effect-free collections give the same result; eager traversal can change side effects, failure timing and termination for unusual inputs. |
|
||||
|
||||
@@ -29,6 +29,18 @@ import scala.Tuple3;
|
||||
*/
|
||||
class MicroRecipeFunctionalTest {
|
||||
|
||||
@Test
|
||||
void cuttingStoneUsesTheRealMaterialInsteadOfTheMissingPlaceholder() {
|
||||
int material = MicroMaterialRegistry.materialID("minecraft:stone");
|
||||
InventoryCrafting crafting = grid();
|
||||
crafting.setInventorySlotContents(0, new ItemStack(new TestSaw(100)));
|
||||
crafting.setInventorySlotContents(3, new ItemStack(Blocks.stone));
|
||||
assertEquals(material, MicroRecipe.findMaterial(crafting.getStackInSlot(3)));
|
||||
assertMicro(MicroRecipe.getCraftingResult(crafting), 2, 0, 4, material);
|
||||
crafting.setInventorySlotContents(3, MicroRecipe.getCraftingResult(crafting));
|
||||
assertMicro(MicroRecipe.getCraftingResult(crafting), 2, 0, 2, material);
|
||||
}
|
||||
|
||||
@Test
|
||||
void recipeMetadataMaterialLookupAndCreationRoundTrip() {
|
||||
int material = glassMaterial();
|
||||
|
||||
@@ -220,6 +220,10 @@ public final class MicroRecipe$ implements IRecipe {
|
||||
|
||||
public int findMaterial(ItemStack item) {
|
||||
for (Tuple2<String, IMicroMaterial> entry : MicroMaterialRegistry.getIdMap()) {
|
||||
// The recovery placeholder exposes stone, but must never win a raw-material recipe lookup.
|
||||
if (entry._2() == MissingMicroMaterial$.MODULE$) {
|
||||
continue;
|
||||
}
|
||||
ItemStack materialItem = entry._2().getItem();
|
||||
if (Objects.equals(item.getItem(), materialItem.getItem())
|
||||
&& item.getItemDamage() == materialItem.getItemDamage()
|
||||
|
||||
Reference in new issue
Block a user