Skip to content

Commit

Permalink
feat: ✨ Added "Keep Player at Level" option to Xp pump upgrade - as i…
Browse files Browse the repository at this point in the history
…t says on the tin will try to keep the player at set level whether it means taking xp away and putting it in tank or giving player xp back from tank
  • Loading branch information
P3pp3rF1y committed Feb 9, 2025
1 parent 079fa17 commit 91ffbe1
Show file tree
Hide file tree
Showing 6 changed files with 9 additions and 12 deletions.
2 changes: 1 addition & 1 deletion gradle.properties
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ org.gradle.daemon=false

mod_id=sophisticatedcore
mod_group_id=sophisticatedcore
mod_version=1.2.6
mod_version=1.2.7
sonar_project_key=sophisticatedcore:SophisticatedCore
github_package_url=https://maven.pkg.github.com/P3pp3rF1y/SophisticatedCore

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@
public enum AutomationDirection implements StringRepresentable {
INPUT("input"),
OUTPUT("output"),
KEEP("keep"),
OFF("off");

private final String name;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -13,12 +13,7 @@
import net.p3pp3rf1y.sophisticatedcore.client.gui.controls.ButtonDefinition;
import net.p3pp3rf1y.sophisticatedcore.client.gui.controls.ToggleButton;
import net.p3pp3rf1y.sophisticatedcore.client.gui.controls.WidgetBase;
import net.p3pp3rf1y.sophisticatedcore.client.gui.utils.Dimension;
import net.p3pp3rf1y.sophisticatedcore.client.gui.utils.GuiHelper;
import net.p3pp3rf1y.sophisticatedcore.client.gui.utils.Position;
import net.p3pp3rf1y.sophisticatedcore.client.gui.utils.TextureBlitData;
import net.p3pp3rf1y.sophisticatedcore.client.gui.utils.TranslationHelper;
import net.p3pp3rf1y.sophisticatedcore.client.gui.utils.UV;
import net.p3pp3rf1y.sophisticatedcore.client.gui.utils.*;

import java.util.List;
import java.util.Map;
Expand All @@ -35,6 +30,7 @@ public class XpPumpUpgradeTab extends UpgradeSettingsTab<XpPumpUpgradeContainer>
Map.of(
AutomationDirection.INPUT, GuiHelper.getButtonStateData(new UV(144, 0), TranslationHelper.INSTANCE.translUpgradeButton("xp_pump_input"), Dimension.SQUARE_16, new Position(1, 1)),
AutomationDirection.OUTPUT, GuiHelper.getButtonStateData(new UV(128, 16), TranslationHelper.INSTANCE.translUpgradeButton("xp_pump_output"), Dimension.SQUARE_16, new Position(1, 1)),
AutomationDirection.KEEP, GuiHelper.getButtonStateData(new UV(96, 96), TranslationHelper.INSTANCE.translUpgradeButton("xp_pump_keep"), Dimension.SQUARE_16, new Position(1, 1)),
AutomationDirection.OFF, GuiHelper.getButtonStateData(new UV(240, 0), TranslationHelper.INSTANCE.translUpgradeButton("xp_pump_off"), Dimension.SQUARE_16, new Position(1, 1))
));
private static final ButtonDefinition.Toggle<Boolean> MEND_ITEMS = createToggleButtonDefinition(
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -89,11 +89,10 @@ private void interactWithPlayer(Player player) {
return;
}

if (direction == AutomationDirection.INPUT) {
if (level < player.experienceLevel || (level == player.experienceLevel && player.experienceProgress > 0)) {
tryFillTankWithPlayerExperience(player, fluidHandler, level, false);
}
} else if (direction == AutomationDirection.OUTPUT && level > player.experienceLevel) {
if ((direction == AutomationDirection.INPUT || direction == AutomationDirection.KEEP)
&& (level < player.experienceLevel || (level == player.experienceLevel && player.experienceProgress > 0))) {
tryFillTankWithPlayerExperience(player, fluidHandler, level, false);
} else if ((direction == AutomationDirection.OUTPUT || direction == AutomationDirection.KEEP) && level > player.experienceLevel) {
tryGivePlayerExperienceFromTank(player, fluidHandler, level, false);
}
});
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -147,6 +147,7 @@
"gui.sophisticatedcore.upgrades.buttons.do_not_interact_with_hand": "Do Not Interact With\nFluid Container in Hand",
"gui.sophisticatedcore.upgrades.buttons.xp_pump_input": "Pump Experience From Player",
"gui.sophisticatedcore.upgrades.buttons.xp_pump_output": "Pump Experience To Player",
"gui.sophisticatedcore.upgrades.buttons.xp_pump_keep": "Keep Player at Level",
"gui.sophisticatedcore.upgrades.buttons.xp_pump_off": "Pump Off",
"gui.sophisticatedcore.upgrades.buttons.store_all_experience": "Store All Experience",
"gui.sophisticatedcore.upgrades.buttons.take_all_experience": "Take All Experience",
Expand Down
Binary file modified src/main/resources/assets/sophisticatedcore/textures/gui/icons.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.

0 comments on commit 91ffbe1

Please sign in to comment.