-
-
Notifications
You must be signed in to change notification settings - Fork 21
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Browse files
Browse the repository at this point in the history
…torage-priority feat: separate insert/extract storage priorities
- Loading branch information
Showing
54 changed files
with
820 additions
and
305 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
61 changes: 61 additions & 0 deletions
61
...s/refinedstorage/common/autocrafting/autocrafter/AutocrafterPrioritySideButtonWidget.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,61 @@ | ||
package com.refinedmods.refinedstorage.common.autocrafting.autocrafter; | ||
|
||
import com.refinedmods.refinedstorage.common.support.amount.PriorityScreen; | ||
import com.refinedmods.refinedstorage.common.support.containermenu.ClientProperty; | ||
import com.refinedmods.refinedstorage.common.support.widget.AbstractSideButtonWidget; | ||
|
||
import java.util.List; | ||
|
||
import net.minecraft.ChatFormatting; | ||
import net.minecraft.client.Minecraft; | ||
import net.minecraft.client.gui.screens.Screen; | ||
import net.minecraft.network.chat.Component; | ||
import net.minecraft.network.chat.MutableComponent; | ||
import net.minecraft.resources.ResourceLocation; | ||
import net.minecraft.world.entity.player.Inventory; | ||
|
||
import static com.refinedmods.refinedstorage.common.util.IdentifierUtil.createIdentifier; | ||
import static com.refinedmods.refinedstorage.common.util.IdentifierUtil.createTranslation; | ||
|
||
class AutocrafterPrioritySideButtonWidget extends AbstractSideButtonWidget { | ||
private static final MutableComponent TITLE = createTranslation("gui", "priority"); | ||
private static final Component HELP = createTranslation("gui", "priority.autocrafter_help"); | ||
private static final ResourceLocation SPRITE = createIdentifier("widget/side_button/priority"); | ||
|
||
private final ClientProperty<Integer> property; | ||
|
||
AutocrafterPrioritySideButtonWidget(final ClientProperty<Integer> property, | ||
final Inventory playerInventory, | ||
final Screen parent) { | ||
super(createPressAction(property, playerInventory, parent)); | ||
this.property = property; | ||
} | ||
|
||
private static OnPress createPressAction(final ClientProperty<Integer> property, | ||
final Inventory playerInventory, | ||
final Screen parent) { | ||
return btn -> Minecraft.getInstance().setScreen( | ||
new PriorityScreen(TITLE, property.get(), property::setValue, parent, playerInventory) | ||
); | ||
} | ||
|
||
@Override | ||
protected ResourceLocation getSprite() { | ||
return SPRITE; | ||
} | ||
|
||
@Override | ||
protected MutableComponent getTitle() { | ||
return TITLE; | ||
} | ||
|
||
@Override | ||
protected List<MutableComponent> getSubText() { | ||
return List.of(Component.literal(String.valueOf(property.getValue())).withStyle(ChatFormatting.GRAY)); | ||
} | ||
|
||
@Override | ||
protected Component getHelpText() { | ||
return HELP; | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.