MultiMachineBuilder / MultiMachineBuilder/MultiMachineBuilder

Fix chanced outputs

Open
#399 0 comments 0 reactions 1 assignee View on GitHub

@Monniasza is already working on this.

Since Jan 9, 2026.

Type: annoyance
Dominant language
Java
Stars
14
Forks
10
PR merge metrics
No merged PRs in 30d

Description

In the current state, chanced outputs are shown as a wall of text that is prone to wrapping, misplacement and truncation. It also does not have icons, slowing down identification of important items like ores from quarries, and byproducts from ore grinding.

The Plan

  • Create a new record OutputRow with following fields:
    • ItemEntry item - the item to be produced
    • int amount - the amount of item to be produced
    • double chance - propability of the row getting produced. Between 0 and 1.
    • LinearFunction amountBuff - for every voltage tier above the recipe tier, the output amount get enhanced by that.
    • LinearFunction chanceBuff - for every voltage tier above the recipe tier, the output chance get enhanced by that.
  • Create a new record LinearFunction with following fields:
    • double mul - the factor in the equation. Default 1
    • double add - the constant in the equation. Default 0
  • Create ItemChanceIcon to display the OutputRow properly
  • Rename the RecipeOutput to ItemList to avoid confusion
  • Create a new RecipeOutput which is a collection of OutputRow values. The ItemList will become an implementer of RecipeOutput.
  • Delete old Chance since it's too complicated to display.

Examples

Quarry:
    50% Limestone * 2
      + 2x chance, +2 output
    50% Slate * 2
      + 2x chance, +2 output
    50% Granite * 2
      + 2x chance, +2 output
    33% Clay * 2
      + 2x chance, +2 output
    33% Dirt * 2
      + 2x chance, +2 output
    25% Magnetite Ore (Iron) * 2
      + 2x chance, +2 output
    25% Pyrite Ore (Iron) * 2
      + 2x chance, +2 output
    25% Chalcopyrite Ore (Iron + Copper) * 2
      + 2x chance, +2 output
    25% Brown Limonite Ore (Iron) * 2
      + 2x chance, +2 output
    25% Yellow Limonite Ore (Iron) * 2
      + 2x chance, +2 output
    25% Green Limonite Ore (Iron) * 2
      + 2x chance, +2 output
    20% Galena Ore (Lead) * 2
      + 2x chance, +2 output
    20% Laterite Ore (Iron, Aluminum, Nickel) * 2
      + 2x chance, +2 output
    15% Copper Ore * 2
      + 2x chance, +2 output
    15% Cobaltite Ore (Cobalt) * 2
      + 2x chance, +2 output
    8% Silver Ore * 2
      + 2x chance, +2 output
    6% Gold Ore * 2
      + 2x chance, +2 output
    4% Platinum Ore (Platinum Group) * 2
      + 2x chance, +2 output
    4% Rare Earth Ore (Rare Earth Group) * 2
      + 2x chance, +2 output
    2% Diamond Ore * 2
      + 2x chance, +2 output
    1% Tantalite Ore (Tantalum, Manganese) * 2
      + 2x chance, +2 output
    1% Wulfenite Ore (Tungsten, Molybdenum) * 2
      + 2x chance, +2 output
    0.5% Draconite Ore (Draconium) * 2
      + 2x chance, +2 output

Screenshots

Image
    public record OutputRow(
        ItemEntry item, //Item to be produced
        int amount, //Amount of the item produced
        double chance, //Propability between 0 and 1 to get the record
        LinearFunction amountBuff, //Applied to the amount for every voltage tier above the recipe tier
        LinearFunction chanceBuff //Applied to the chance for every voltage tier above the recipe tier
    ){ ... }
    public record LinearFunction(
        double mul, //The factor in the equation. Default 1.
        double add //The constant in the equation. Default 0.
    ) extends DoubleUnaryOperator{
        public static final LinearFunction IDENTITY = new LinearFunction(1, 0);
        public static final LinearFunction ZERO = new LinearFuncion(0, 0);
        public static final LinearFunction ONE = new LinearFunction(0, 1);
        public static LinearFunction fromMultiplier(double mul){
            return new LinearFunction(mul, 0);
        }
        public static LinearFunction fromAdder(double add){
            return new LinearFunction(1, add);
        }
        public static LinearFunction fromConstant(double value){
            return new LinearFunction(0, value);
        }

        public LinearFunction add(LinearFunction other){
            return add(other.mul, other.add);
        }
        public LinearFunction add(double add){
            return new LinearFunction(this.mul, this.add + add);
        }
        public LinearFunction add(double mul, double add){
            return new LinearFunction(this.mul + mul, this.add + add);
        }
        public LinearFunction sub(LinearFunction other){
            return sub(other.mul, other.add);
        }
        public LinearFunction sub(double mul, double add){
            return new LinearFunction(this.mul - mul, this.add - add);
        }
        public LinearFunction sub(double add){
            return new LinearFunction(this.mul, this.add - add);
        }
        public LinearFunction mul(double mul){
            return new LinearFunction(this.mul * mul, this.add * mul);
        }
        public LinearFunction div(double div){
            return new LinearFunction(this.mul / div, this.add / div);
        }
        public LinearFunction andThen(LinearFunction other){
            return new LinearFunction(this.mul * other.mul, other.add + this.mul * this.add);
        }
        public LinearFunction compose(LinearFunction other){
            return other.andThen(this);
        }
        @Override public double applyAsDouble(double operand){
            return (mul * operand) + add;
        }
    }

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.