-
Notifications
You must be signed in to change notification settings - Fork 50
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #106 from VDPineapple/main
1.20+ Advancements Support
- Loading branch information
Showing
43 changed files
with
442 additions
and
167 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
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
43 changes: 38 additions & 5 deletions
43
src/main/java/ninjabrainbot/gui/mainwindow/alladvancements/AllAdvancementsPanel.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 |
---|---|---|
@@ -1,31 +1,64 @@ | ||
package ninjabrainbot.gui.mainwindow.alladvancements; | ||
|
||
import java.awt.Dimension; | ||
import java.util.Objects; | ||
import java.util.ArrayList; | ||
|
||
import javax.swing.BoxLayout; | ||
import javax.swing.ImageIcon; | ||
|
||
import ninjabrainbot.Main; | ||
import ninjabrainbot.event.IDisposable; | ||
import ninjabrainbot.event.Subscription; | ||
import ninjabrainbot.model.datastate.alladvancements.IAllAdvancementsDataState; | ||
import ninjabrainbot.gui.components.panels.ThemedPanel; | ||
import ninjabrainbot.gui.style.StyleManager; | ||
import ninjabrainbot.io.preferences.NinjabrainBotPreferences; | ||
import ninjabrainbot.model.input.IButtonInputHandler; | ||
|
||
public class AllAdvancementsPanel extends ThemedPanel { | ||
|
||
private final NinjabrainBotPreferences preferences; | ||
private static final ImageIcon strongholdIcon = new ImageIcon(Objects.requireNonNull(Main.class.getResource("/stronghold_icon.png"))); | ||
private static final ImageIcon shulkerIcon = new ImageIcon(Objects.requireNonNull(Main.class.getResource("/spawn_icon.png"))); | ||
private static final ImageIcon outpostIcon = new ImageIcon(Objects.requireNonNull(Main.class.getResource("/outpost_icon.png"))); | ||
private static final ImageIcon monumentIcon = new ImageIcon(Objects.requireNonNull(Main.class.getResource("/monument_icon.png"))); | ||
private static final ImageIcon deepDarkIcon = new ImageIcon(Objects.requireNonNull(Main.class.getResource("/deep_dark_icon.png"))); | ||
private static final ImageIcon shulkerTransportIcon = new ImageIcon(Objects.requireNonNull(Main.class.getResource("/shulker_transport_icon.png"))); | ||
private static final ImageIcon cityQueryIcon = new ImageIcon(Objects.requireNonNull(Main.class.getResource("/city_query_icon.png"))); | ||
private static final ImageIcon generalLocationIcon = new ImageIcon(Objects.requireNonNull(Main.class.getResource("/general_location_icon.png"))); | ||
|
||
public AllAdvancementsPanel(StyleManager styleManager, IButtonInputHandler buttonInputHandler, IAllAdvancementsDataState allAdvancementsDataState) { | ||
private final ArrayList<StructurePanel> oneDotTwentyPlusPanels = new ArrayList<>(); | ||
|
||
public AllAdvancementsPanel(StyleManager styleManager, IButtonInputHandler buttonInputHandler, IAllAdvancementsDataState allAdvancementsDataState, NinjabrainBotPreferences preferences) { | ||
super(styleManager); | ||
setLayout(new BoxLayout(this, BoxLayout.Y_AXIS)); | ||
add(new AllAdvancementsHeader(styleManager)); | ||
add(new StructurePanel(styleManager, buttonInputHandler, allAdvancementsDataState.strongholdPosition(), strongholdIcon, false, true)); | ||
add(new StructurePanel(styleManager, buttonInputHandler, allAdvancementsDataState.spawnPosition(), shulkerIcon, true, true)); | ||
add(new StructurePanel(styleManager, buttonInputHandler, allAdvancementsDataState.outpostPosition(), outpostIcon, true, true)); | ||
add(new StructurePanel(styleManager, buttonInputHandler, allAdvancementsDataState.monumentPosition(), monumentIcon, true, false)); | ||
add(new StructurePanel(styleManager, buttonInputHandler, allAdvancementsDataState.strongholdPosition(), strongholdIcon, false, true, true)); | ||
add(new StructurePanel(styleManager, buttonInputHandler, allAdvancementsDataState.spawnPosition(), shulkerIcon, true, true, true)); | ||
add(new StructurePanel(styleManager, buttonInputHandler, allAdvancementsDataState.outpostPosition(), outpostIcon, true, true, true)); | ||
add(new StructurePanel(styleManager, buttonInputHandler, allAdvancementsDataState.monumentPosition(), monumentIcon, true, true, true)); | ||
oneDotTwentyPlusPanels.add(new StructurePanel(styleManager, buttonInputHandler, allAdvancementsDataState.deepDarkPosition(), deepDarkIcon, true, true, true)); | ||
oneDotTwentyPlusPanels.add(new StructurePanel(styleManager, buttonInputHandler, allAdvancementsDataState.shulkerTransportPosition(), shulkerTransportIcon, true, true, false)); | ||
oneDotTwentyPlusPanels.add(new StructurePanel(styleManager, buttonInputHandler, allAdvancementsDataState.cityQueryPosition(), cityQueryIcon, true, true, false)); | ||
oneDotTwentyPlusPanels.add(new StructurePanel(styleManager, buttonInputHandler, allAdvancementsDataState.generalLocationPosition(), generalLocationIcon, true, false, false)); | ||
for (StructurePanel panel : oneDotTwentyPlusPanels) { | ||
add(panel); | ||
} | ||
for (StructurePanel panel : oneDotTwentyPlusPanels) { | ||
panel.setEnabled(preferences.oneDotTwentyPlusAA.get()); | ||
panel.setVisible(preferences.oneDotTwentyPlusAA.get()); | ||
} | ||
this.preferences = preferences; | ||
} | ||
|
||
public void updateOneDotTwentyPlusAAEnabled() { | ||
for (StructurePanel panel : oneDotTwentyPlusPanels) { | ||
panel.setEnabled(preferences.oneDotTwentyPlusAA.get()); | ||
panel.setVisible(preferences.oneDotTwentyPlusAA.get()); | ||
} | ||
|
||
this.revalidate(); | ||
this.repaint(); | ||
} | ||
} |
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
22 changes: 22 additions & 0 deletions
22
.../ninjabrainbot/model/actions/alladvancements/SetAllAdvancementsGeneralLocationAction.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,22 @@ | ||
package ninjabrainbot.model.actions.alladvancements; | ||
|
||
import ninjabrainbot.model.actions.IAction; | ||
import ninjabrainbot.model.datastate.alladvancements.IAllAdvancementsDataState; | ||
import ninjabrainbot.model.datastate.common.StructurePosition; | ||
import ninjabrainbot.model.datastate.endereye.F3IData; | ||
|
||
public class SetAllAdvancementsGeneralLocationAction implements IAction { | ||
|
||
private final IAllAdvancementsDataState allAdvancementsDataState; | ||
private final StructurePosition structurePosition; | ||
|
||
public SetAllAdvancementsGeneralLocationAction(IAllAdvancementsDataState allAdvancementsDataState, F3IData f3iData) { | ||
this.allAdvancementsDataState = allAdvancementsDataState; | ||
this.structurePosition = new StructurePosition(f3iData.x, f3iData.z); | ||
} | ||
|
||
@Override | ||
public void execute() { | ||
allAdvancementsDataState.generalLocationPosition().set(structurePosition); | ||
} | ||
} |
Oops, something went wrong.