Update matter scanner interface
This commit is contained in:
parent
4d4caed30d
commit
328bca5982
@ -18,11 +18,11 @@ class MatterScannerScreen(p_97741_: MatterScannerMenu, p_97742_: Inventory, p_97
|
|||||||
|
|
||||||
|
|
||||||
val m = PowerGaugePanel(this, frame, menu.battery_widget, LEFT_MARGIN, GAUGE_TOP_WITH_SLOT)
|
val m = PowerGaugePanel(this, frame, menu.battery_widget, LEFT_MARGIN, GAUGE_TOP_WITH_SLOT)
|
||||||
// PatternGaugePanel(this, frame, menu.patterns, LEFT_MARGIN + m.width, GAUGE_TOP_WITH_SLOT)
|
PatternGaugePanel(this, frame, menu.patterns, LEFT_MARGIN + m.width, GAUGE_TOP_WITH_SLOT)
|
||||||
|
|
||||||
SlotPanel(this, frame, menu.battery_slot, LEFT_MARGIN, SLOT_TOP_UNDER_GAUGE)
|
SlotPanel(this, frame, menu.battery_slot, LEFT_MARGIN, SLOT_TOP_UNDER_GAUGE)
|
||||||
|
|
||||||
ProgressGaugePanel(this, frame, menu.progress, 63f, PROGRESS_ARROW_TOP)
|
ProgressGaugePanel(this, frame, menu.progress, 63f, PROGRESS_ARROW_TOP).flop = true
|
||||||
SlotPanel(this, frame, menu.input, 93f, PROGRESS_SLOT_TOP)
|
SlotPanel(this, frame, menu.input, 93f, PROGRESS_SLOT_TOP)
|
||||||
|
|
||||||
return frame
|
return frame
|
||||||
|
@ -1,55 +1,59 @@
|
|||||||
package ru.dbotthepony.mc.otm.menu;
|
package ru.dbotthepony.mc.otm.menu
|
||||||
|
|
||||||
import net.minecraft.world.Container;
|
import kotlin.jvm.JvmOverloads
|
||||||
import net.minecraft.world.SimpleContainer;
|
import net.minecraft.world.entity.player.Inventory
|
||||||
import net.minecraft.world.entity.player.Inventory;
|
import ru.dbotthepony.mc.otm.block.entity.BlockEntityMatterScanner
|
||||||
import net.minecraft.world.item.ItemStack;
|
import ru.dbotthepony.mc.otm.menu.PoweredMatteryMenu
|
||||||
import ru.dbotthepony.mc.otm.matter.MatterRegistry;
|
import ru.dbotthepony.mc.otm.menu.slot.MatterySlot
|
||||||
import ru.dbotthepony.mc.otm.Registry;
|
import ru.dbotthepony.mc.otm.menu.widget.ProgressGaugeWidget
|
||||||
import ru.dbotthepony.mc.otm.block.entity.BlockEntityMatterScanner;
|
import ru.dbotthepony.mc.otm.menu.widget.LevelGaugeWidget
|
||||||
import ru.dbotthepony.mc.otm.menu.slot.MatterySlot;
|
import net.minecraft.world.SimpleContainer
|
||||||
import ru.dbotthepony.mc.otm.menu.widget.ProgressGaugeWidget;
|
import net.minecraft.world.item.ItemStack
|
||||||
|
import ru.dbotthepony.mc.otm.Registry
|
||||||
|
import ru.dbotthepony.mc.otm.core.Fraction
|
||||||
|
import ru.dbotthepony.mc.otm.matter.MatterRegistry
|
||||||
|
import java.math.BigInteger
|
||||||
|
|
||||||
public class MatterScannerMenu extends PoweredMatteryMenu {
|
class MatterScannerMenu @JvmOverloads constructor(
|
||||||
public MatterScannerMenu(int p_38852_, Inventory inventory) {
|
p_38852_: Int,
|
||||||
this(p_38852_, inventory, null);
|
inventory: Inventory,
|
||||||
|
tile: BlockEntityMatterScanner? = null
|
||||||
|
) : PoweredMatteryMenu(
|
||||||
|
Registry.Menus.MATTER_SCANNER, p_38852_, inventory, tile
|
||||||
|
) {
|
||||||
|
val input: MatterySlot
|
||||||
|
val progress: ProgressGaugeWidget
|
||||||
|
val patterns: LevelGaugeWidget
|
||||||
|
|
||||||
|
init {
|
||||||
|
val container = if (tile != null) tile.input_slot else SimpleContainer(1)
|
||||||
|
input = object : MatterySlot(container, 0, 64, 38) {
|
||||||
|
override fun mayPlace(p_40231_: ItemStack): Boolean {
|
||||||
|
return MatterRegistry.canDecompose(p_40231_)
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public MatterySlot input;
|
addSlot(input)
|
||||||
public ProgressGaugeWidget progress;
|
|
||||||
|
|
||||||
public MatterScannerMenu(int p_38852_, Inventory inventory, BlockEntityMatterScanner tile) {
|
|
||||||
super(Registry.Menus.MATTER_SCANNER, p_38852_, inventory, tile);
|
|
||||||
|
|
||||||
Container container = tile != null ? tile.input_slot : new SimpleContainer(1);
|
|
||||||
|
|
||||||
input = new MatterySlot(container, 0, 64, 38) {
|
|
||||||
@Override
|
|
||||||
public boolean mayPlace(ItemStack p_40231_) {
|
|
||||||
return MatterRegistry.canDecompose(p_40231_);
|
|
||||||
}
|
|
||||||
};
|
|
||||||
|
|
||||||
addSlot(input);
|
|
||||||
|
|
||||||
if (tile != null) {
|
if (tile != null) {
|
||||||
progress = new ProgressGaugeWidget(this, () -> (float) tile.getWorkProgress(), tile::cantProcessJob);
|
progress = ProgressGaugeWidget(this, { tile.workProgress.toFloat() }) { tile.cantProcessJob() }
|
||||||
|
patterns = LevelGaugeWidget(this,
|
||||||
|
{ Fraction(tile.matterGrid?.storedPatternCount?.toBigInteger() ?: BigInteger.ZERO) },
|
||||||
|
{ Fraction(tile.matterGrid?.patternCapacity?.toBigInteger() ?: BigInteger.ZERO) })
|
||||||
} else {
|
} else {
|
||||||
progress = new ProgressGaugeWidget(this);
|
progress = ProgressGaugeWidget(this)
|
||||||
|
patterns = LevelGaugeWidget(this)
|
||||||
}
|
}
|
||||||
|
|
||||||
addBatterySlot();
|
addBatterySlot()
|
||||||
|
addInventorySlots()
|
||||||
addInventorySlots();
|
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
override fun getWorkingSlotStart(): Int {
|
||||||
protected int getWorkingSlotStart() {
|
return 0
|
||||||
return 0;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
override fun getWorkingSlotEnd(): Int {
|
||||||
protected int getWorkingSlotEnd() {
|
return 1
|
||||||
return 1;
|
|
||||||
}
|
}
|
||||||
}
|
}
|
Loading…
Reference in New Issue
Block a user