From 42f29e1779a8351283cbbfde5992d89cb9617576 Mon Sep 17 00:00:00 2001 From: mewacaser <105073512+mewacaser@users.noreply.github.com> Date: Sat, 9 Mar 2024 07:37:11 +0800 Subject: [PATCH] backport the vector mode (part of #7475) --- .../api/gear/config/IHasModeIcon.java | 21 ++++++ .../mekanism/assets/mekanism/lang/en_ud.json | 1 + .../mekanism/assets/mekanism/lang/en_us.json | 1 + .../client/lang/MekanismLangProvider.java | 1 + .../mekanism/client/ClientTickHandler.java | 5 +- .../gui/element/custom/module/EnumToggle.java | 40 ++++++++--- .../common/CommonPlayerTickHandler.java | 6 +- .../java/mekanism/common/MekanismLang.java | 1 + .../mekanism/common/content/gear/Module.java | 7 +- .../common/item/gear/ItemJetpack.java | 5 ++ .../common/item/gear/ItemMekaSuitArmor.java | 6 ++ .../common/item/interfaces/IJetpackItem.java | 67 ++++++++++++------ .../mekanism/common/util/MekanismUtils.java | 1 + .../mekanism/gui/hud/jetpack_vector.png | Bin 0 -> 178 bytes .../mekanism/gui/mode/jetpack_hover.png | Bin 0 -> 130 bytes .../mekanism/gui/mode/jetpack_normal.png | Bin 0 -> 129 bytes .../assets/mekanism/gui/mode/jetpack_off.png | Bin 0 -> 134 bytes .../mekanism/gui/mode/jetpack_vector.png | Bin 0 -> 135 bytes .../resources/assets/mekanism/lang/ca_es.json | 1 + .../resources/assets/mekanism/lang/cs_cz.json | 1 + .../resources/assets/mekanism/lang/de_at.json | 1 + .../resources/assets/mekanism/lang/de_ch.json | 1 + .../resources/assets/mekanism/lang/de_de.json | 1 + .../resources/assets/mekanism/lang/es_ar.json | 1 + .../resources/assets/mekanism/lang/es_cl.json | 1 + .../resources/assets/mekanism/lang/es_es.json | 1 + .../resources/assets/mekanism/lang/es_mx.json | 1 + .../resources/assets/mekanism/lang/fr_fr.json | 1 + .../resources/assets/mekanism/lang/id_id.json | 1 + .../resources/assets/mekanism/lang/it_it.json | 1 + .../resources/assets/mekanism/lang/ja_jp.json | 1 + .../resources/assets/mekanism/lang/ko_kr.json | 1 + .../resources/assets/mekanism/lang/pt_br.json | 1 + .../resources/assets/mekanism/lang/pt_pt.json | 1 + .../resources/assets/mekanism/lang/ru_ru.json | 1 + .../resources/assets/mekanism/lang/sv_se.json | 1 + .../resources/assets/mekanism/lang/tr_tr.json | 1 + .../resources/assets/mekanism/lang/zh_cn.json | 1 + .../resources/assets/mekanism/lang/zh_tw.json | 1 + 39 files changed, 148 insertions(+), 35 deletions(-) create mode 100644 src/api/java/mekanism/api/gear/config/IHasModeIcon.java create mode 100644 src/main/resources/assets/mekanism/gui/hud/jetpack_vector.png create mode 100644 src/main/resources/assets/mekanism/gui/mode/jetpack_hover.png create mode 100644 src/main/resources/assets/mekanism/gui/mode/jetpack_normal.png create mode 100644 src/main/resources/assets/mekanism/gui/mode/jetpack_off.png create mode 100644 src/main/resources/assets/mekanism/gui/mode/jetpack_vector.png diff --git a/src/api/java/mekanism/api/gear/config/IHasModeIcon.java b/src/api/java/mekanism/api/gear/config/IHasModeIcon.java new file mode 100644 index 00000000000..0ccdbb4fba0 --- /dev/null +++ b/src/api/java/mekanism/api/gear/config/IHasModeIcon.java @@ -0,0 +1,21 @@ +package mekanism.api.gear.config; + +import mekanism.api.text.IHasTextComponent; +import net.minecraft.resources.ResourceLocation; + +/** + * Conveys that an option should be represented by the corresponding mode icon when displayed in the module tweaker. + * + * @apiNote Currently only supported for {@link ModuleEnumData}. + * @since 10.5.3 + */ +public interface IHasModeIcon extends IHasTextComponent { + + /** + * @return The icon to use for displaying this mode. + * + * @implNote The file is currently expected to be 16x16, and be 5 wide, down two pixels and eight pixels tall. Ideally this will be made less strict, but for now just + * look at how the jetpack icons are. + */ + ResourceLocation getModeIcon(); +} \ No newline at end of file diff --git a/src/datagen/generated/mekanism/assets/mekanism/lang/en_ud.json b/src/datagen/generated/mekanism/assets/mekanism/lang/en_ud.json index ebe4c28a493..51868799bdf 100644 --- a/src/datagen/generated/mekanism/assets/mekanism/lang/en_ud.json +++ b/src/datagen/generated/mekanism/assets/mekanism/lang/en_ud.json @@ -1220,6 +1220,7 @@ "jetpack.mekanism.hover": "ɹǝʌoH", "jetpack.mekanism.mode_change": "%s :oʇ pǝᵷuɐɥɔ ǝpoɯ ʞɔɐdʇǝՐ", "jetpack.mekanism.normal": "ɹɐꞁnᵷǝᴚ", + "jetpack.mekanism.vector": "ɹoʇɔǝΛ", "key.mekanism.chest_mode": "ɥɔʇᴉʍS ǝpoW ʇsǝɥƆ", "key.mekanism.description": "uoᴉʇdᴉɹɔsǝᗡ ʍoɥS", "key.mekanism.details": "sꞁᴉɐʇǝᗡ ʍoɥS", diff --git a/src/datagen/generated/mekanism/assets/mekanism/lang/en_us.json b/src/datagen/generated/mekanism/assets/mekanism/lang/en_us.json index 1d86331aad7..307f70e6336 100644 --- a/src/datagen/generated/mekanism/assets/mekanism/lang/en_us.json +++ b/src/datagen/generated/mekanism/assets/mekanism/lang/en_us.json @@ -1220,6 +1220,7 @@ "jetpack.mekanism.hover": "Hover", "jetpack.mekanism.mode_change": "Jetpack mode changed to: %1$s", "jetpack.mekanism.normal": "Regular", + "jetpack.mekanism.vector": "Vector", "key.mekanism.chest_mode": "Chest Mode Switch", "key.mekanism.description": "Show Description", "key.mekanism.details": "Show Details", diff --git a/src/datagen/main/java/mekanism/client/lang/MekanismLangProvider.java b/src/datagen/main/java/mekanism/client/lang/MekanismLangProvider.java index ea3e0d7bad9..1014a097f38 100644 --- a/src/datagen/main/java/mekanism/client/lang/MekanismLangProvider.java +++ b/src/datagen/main/java/mekanism/client/lang/MekanismLangProvider.java @@ -1299,6 +1299,7 @@ private void addMisc() { add(MekanismLang.JETPACK_MODE_CHANGE, "Jetpack mode changed to: %1$s"); add(MekanismLang.JETPACK_NORMAL, "Regular"); add(MekanismLang.JETPACK_HOVER, "Hover"); + add(MekanismLang.JETPACK_VECTOR, "Vector"); add(MekanismLang.JETPACK_DISABLED, "Disabled"); //Disassembler Mode add(MekanismLang.DISASSEMBLER_MODE_CHANGE, "Mode toggled to: %1$s (%2$s)"); diff --git a/src/main/java/mekanism/client/ClientTickHandler.java b/src/main/java/mekanism/client/ClientTickHandler.java index 479cf87de23..b4260b0c1c9 100644 --- a/src/main/java/mekanism/client/ClientTickHandler.java +++ b/src/main/java/mekanism/client/ClientTickHandler.java @@ -85,7 +85,7 @@ public static boolean isJetpackInUse(Player player, ItemStack jetpack) { boolean guiOpen = minecraft.screen != null; boolean ascending = minecraft.player.input.jumping; boolean rising = ascending && !guiOpen; - if (mode == JetpackMode.NORMAL) { + if (mode == JetpackMode.NORMAL || mode == JetpackMode.VECTOR) { return rising; } else if (mode == JetpackMode.HOVER) { boolean descending = minecraft.player.input.shiftKeyDown; @@ -203,7 +203,8 @@ public void tickStart() { JetpackMode primaryMode = ((IJetpackItem) primaryJetpack.getItem()).getJetpackMode(primaryJetpack); JetpackMode mode = IJetpackItem.getPlayerJetpackMode(minecraft.player, primaryMode, () -> minecraft.player.input.jumping); MekanismClient.updateKey(minecraft.player.input.jumping, KeySync.ASCEND); - if (jetpackInUse && IJetpackItem.handleJetpackMotion(minecraft.player, mode, () -> minecraft.player.input.jumping)) { + double jetpackThrust = ((IJetpackItem) primaryJetpack.getItem()).getJetpackThrust(primaryJetpack); + if (jetpackInUse && IJetpackItem.handleJetpackMotion(minecraft.player, mode, jetpackThrust, () -> minecraft.player.input.jumping)) { minecraft.player.resetFallDistance(); } } diff --git a/src/main/java/mekanism/client/gui/element/custom/module/EnumToggle.java b/src/main/java/mekanism/client/gui/element/custom/module/EnumToggle.java index 321f14daceb..941757f207b 100644 --- a/src/main/java/mekanism/client/gui/element/custom/module/EnumToggle.java +++ b/src/main/java/mekanism/client/gui/element/custom/module/EnumToggle.java @@ -1,8 +1,12 @@ package mekanism.client.gui.element.custom.module; import java.util.List; + +import mekanism.api.gear.config.IHasModeIcon; import mekanism.api.gear.config.ModuleEnumData; import mekanism.api.text.IHasTextComponent; +import mekanism.client.gui.GuiUtils; +import mekanism.common.MekanismLang; import mekanism.common.content.gear.ModuleConfigItem; import mekanism.common.util.MekanismUtils; import mekanism.common.util.MekanismUtils.ResourceType; @@ -20,18 +24,21 @@ class EnumToggle & IHasTextComponent> extends MiniElemen private final int BAR_LENGTH; private final ModuleConfigItem data; private final int optionDistance; + private final boolean usesIcons; boolean dragging = false; EnumToggle(GuiModuleScreen parent, ModuleConfigItem data, int xPos, int yPos, int dataIndex) { super(parent, xPos, yPos, dataIndex); this.data = data; BAR_LENGTH = this.parent.getScreenWidth() - 24; - this.optionDistance = (BAR_LENGTH / (getData().getEnums().size() - 1)); + List options = getData().getEnums(); + this.optionDistance = (BAR_LENGTH / (options.size() - 1)); + this.usesIcons = options.stream().findFirst().filter(option -> option instanceof IHasModeIcon).isPresent(); } @Override protected int getNeededHeight() { - return 28; + return usesIcons ? 31 : 28; } private ModuleEnumData getData() { @@ -48,25 +55,42 @@ protected void renderBackground(GuiGraphics guiGraphics, int mouseX, int mouseY) @Override protected void renderForeground(GuiGraphics guiGraphics, int mouseX, int mouseY) { int textColor = parent.screenTextColor(); - parent.drawTextWithScale(guiGraphics, data.getDescription(), getRelativeX() + 3, getRelativeY(), textColor, 0.8F); + Component description = data.getDescription(); + if (usesIcons) { + description = MekanismLang.GENERIC_STORED.translate(description, getData().get()); + } + parent.drawTextWithScale(guiGraphics, description, getRelativeX() + 3, getRelativeY(), textColor, usesIcons ? 0.75F : 0.8F); List options = getData().getEnums(); for (int i = 0, count = options.size(); i < count; i++) { int center = optionDistance * i; - Component text = options.get(i).getTextComponent(); + TYPE option = options.get(i); + Component text = option.getTextComponent(); //Similar to logic for drawScaledCenteredText except shifts values slightly if they go past the max length int textWidth = parent.getStringWidth(text); - float widthScaling = (textWidth / 2F) * TEXT_SCALE; - float left = BAR_START + center - widthScaling; + float widthScaling = usesIcons ? 2.5F : (textWidth / 2F) * TEXT_SCALE; + int optionCenter = BAR_START + center; + float left = optionCenter - widthScaling; if (left < 0) { left = 0; } else { int max = parent.getScreenWidth() - 1; - int end = xPos + (int) Math.ceil(left + textWidth * TEXT_SCALE); + float objectWidth = usesIcons ? 5 : textWidth * TEXT_SCALE; + int end = xPos + Mth.ceil(left + objectWidth); if (end > max) { left -= end - max; } } - parent.drawTextWithScale(guiGraphics, text, getRelativeX() + left, getRelativeY() + 20, textColor, TEXT_SCALE); + int color = textColor; + if (text.getStyle().getColor() != null) { + color = 0xFF000000 | text.getStyle().getColor().getValue(); + } + GuiUtils.fill(guiGraphics, getRelativeX() + optionCenter, getRelativeY() + 17, 1, 3, color); + if (usesIcons) { + IHasModeIcon hasModeIcon = (IHasModeIcon) option; + guiGraphics.blit(hasModeIcon.getModeIcon(), (int) (getRelativeX() + optionCenter - 8), getRelativeY() + 19, 0, 0, 16, 16, 16, 16); + } else { + parent.drawTextWithScale(guiGraphics, text, getRelativeX() + left, getRelativeY() + 20, textColor, TEXT_SCALE); + } } } diff --git a/src/main/java/mekanism/common/CommonPlayerTickHandler.java b/src/main/java/mekanism/common/CommonPlayerTickHandler.java index 17246b89e3b..11adc10e914 100644 --- a/src/main/java/mekanism/common/CommonPlayerTickHandler.java +++ b/src/main/java/mekanism/common/CommonPlayerTickHandler.java @@ -126,10 +126,12 @@ private void tickEnd(Player player) { if (!jetpack.isEmpty()) { ItemStack primaryJetpack = IJetpackItem.getPrimaryJetpack(player); if (!primaryJetpack.isEmpty()) { - JetpackMode primaryMode = ((IJetpackItem) primaryJetpack.getItem()).getJetpackMode(primaryJetpack); + IJetpackItem jetpackItem = (IJetpackItem) primaryJetpack.getItem(); + JetpackMode primaryMode = jetpackItem.getJetpackMode(primaryJetpack); JetpackMode mode = IJetpackItem.getPlayerJetpackMode(player, primaryMode, () -> Mekanism.keyMap.has(player.getUUID(), KeySync.ASCEND)); if (mode != JetpackMode.DISABLED) { - if (IJetpackItem.handleJetpackMotion(player, mode, () -> Mekanism.keyMap.has(player.getUUID(), KeySync.ASCEND))) { + double jetpackThrust = jetpackItem.getJetpackThrust(primaryJetpack); + if (IJetpackItem.handleJetpackMotion(player, mode, jetpackThrust, () -> Mekanism.keyMap.has(player.getUUID(), KeySync.ASCEND))) { player.resetFallDistance(); if (player instanceof ServerPlayer serverPlayer) { serverPlayer.connection.aboveGroundTickCount = 0; diff --git a/src/main/java/mekanism/common/MekanismLang.java b/src/main/java/mekanism/common/MekanismLang.java index 007a7644f76..d601c6ce53f 100644 --- a/src/main/java/mekanism/common/MekanismLang.java +++ b/src/main/java/mekanism/common/MekanismLang.java @@ -643,6 +643,7 @@ public enum MekanismLang implements ILangEntry { JETPACK_MODE_CHANGE("jetpack", "mode_change"), JETPACK_NORMAL("jetpack", "normal"), JETPACK_HOVER("jetpack", "hover"), + JETPACK_VECTOR("jetpack", "vector"), JETPACK_DISABLED("jetpack", "disabled"), //Disassembler Mode DISASSEMBLER_MODE_CHANGE("disassembler", "mode_change"), diff --git a/src/main/java/mekanism/common/content/gear/Module.java b/src/main/java/mekanism/common/content/gear/Module.java index 298fc05cf54..521241b5361 100644 --- a/src/main/java/mekanism/common/content/gear/Module.java +++ b/src/main/java/mekanism/common/content/gear/Module.java @@ -370,7 +370,12 @@ public void onRemoved(boolean last) { @Override public void displayModeChange(Player player, Component modeName, IHasTextComponent mode) { - player.sendSystemMessage(MekanismUtils.logFormat(MekanismLang.MODULE_MODE_CHANGE.translate(modeName, EnumColor.INDIGO, mode))); + Component modeComponent = mode.getTextComponent(); + if (modeComponent.getStyle().getColor() != null) { + player.sendSystemMessage(MekanismUtils.logFormat(MekanismLang.MODULE_MODE_CHANGE.translate(modeName, modeComponent))); + } else { + player.sendSystemMessage(MekanismUtils.logFormat(MekanismLang.MODULE_MODE_CHANGE.translate(modeName, EnumColor.INDIGO, modeComponent))); + } } @Override diff --git a/src/main/java/mekanism/common/item/gear/ItemJetpack.java b/src/main/java/mekanism/common/item/gear/ItemJetpack.java index c69cc4889a0..b2f3f5c1741 100644 --- a/src/main/java/mekanism/common/item/gear/ItemJetpack.java +++ b/src/main/java/mekanism/common/item/gear/ItemJetpack.java @@ -82,6 +82,11 @@ public JetpackMode getJetpackMode(ItemStack stack) { return JetpackMode.byIndexStatic(ItemDataUtils.getInt(stack, NBTConstants.MODE)); } + @Override + public double getJetpackThrust(ItemStack stack) { + return 0.15; + } + @Override public void useJetpackFuel(ItemStack stack) { useGas(stack, 1); diff --git a/src/main/java/mekanism/common/item/gear/ItemMekaSuitArmor.java b/src/main/java/mekanism/common/item/gear/ItemMekaSuitArmor.java index bb80bca3566..0512bbc7b24 100644 --- a/src/main/java/mekanism/common/item/gear/ItemMekaSuitArmor.java +++ b/src/main/java/mekanism/common/item/gear/ItemMekaSuitArmor.java @@ -386,6 +386,12 @@ public JetpackMode getJetpackMode(ItemStack stack) { return JetpackMode.DISABLED; } + @Override + public double getJetpackThrust(ItemStack stack) { + //The control mekasuit thrust feature is not available at this time due to large code differences between branches. + return 0.15; + } + @Override public void useJetpackFuel(ItemStack stack) { useGas(stack, MekanismGases.HYDROGEN.get(), 1); diff --git a/src/main/java/mekanism/common/item/interfaces/IJetpackItem.java b/src/main/java/mekanism/common/item/interfaces/IJetpackItem.java index 250c77a1a31..786598ed8b5 100644 --- a/src/main/java/mekanism/common/item/interfaces/IJetpackItem.java +++ b/src/main/java/mekanism/common/item/interfaces/IJetpackItem.java @@ -4,6 +4,7 @@ import java.util.function.Predicate; import mekanism.api.IIncrementalEnum; import mekanism.api.annotations.NothingNullByDefault; +import mekanism.api.gear.config.IHasModeIcon; import mekanism.api.math.MathUtils; import mekanism.api.text.EnumColor; import mekanism.api.text.IHasTextComponent; @@ -29,23 +30,28 @@ public interface IJetpackItem { JetpackMode getJetpackMode(ItemStack stack); + double getJetpackThrust(ItemStack stack); + void useJetpackFuel(ItemStack stack); @NothingNullByDefault - enum JetpackMode implements IIncrementalEnum, IHasTextComponent { - NORMAL(MekanismLang.JETPACK_NORMAL, EnumColor.DARK_GREEN, MekanismUtils.getResource(ResourceType.GUI_HUD, "jetpack_normal.png")), - HOVER(MekanismLang.JETPACK_HOVER, EnumColor.DARK_AQUA, MekanismUtils.getResource(ResourceType.GUI_HUD, "jetpack_hover.png")), - DISABLED(MekanismLang.JETPACK_DISABLED, EnumColor.DARK_RED, MekanismUtils.getResource(ResourceType.GUI_HUD, "jetpack_off.png")); + enum JetpackMode implements IIncrementalEnum, IHasModeIcon { + NORMAL(MekanismLang.JETPACK_NORMAL, EnumColor.DARK_GREEN, "jetpack_normal.png"), + HOVER(MekanismLang.JETPACK_HOVER, EnumColor.DARK_AQUA, "jetpack_hover.png"), + VECTOR(MekanismLang.JETPACK_VECTOR, EnumColor.ORANGE, "jetpack_vector.png"), + DISABLED(MekanismLang.JETPACK_DISABLED, EnumColor.DARK_RED, "jetpack_off.png"); private static final JetpackMode[] MODES = values(); private final ILangEntry langEntry; private final EnumColor color; private final ResourceLocation hudIcon; + private final ResourceLocation modeIcon; - JetpackMode(ILangEntry langEntry, EnumColor color, ResourceLocation hudIcon) { + JetpackMode(ILangEntry langEntry, EnumColor color, String icon) { this.langEntry = langEntry; this.color = color; - this.hudIcon = hudIcon; + this.hudIcon = MekanismUtils.getResource(ResourceType.GUI_HUD, icon); + this.modeIcon = MekanismUtils.getResource(ResourceType.GUI_MODE, icon); } @Override @@ -65,6 +71,12 @@ public ResourceLocation getHUDIcon() { public static JetpackMode byIndexStatic(int index) { return MathUtils.getByIndexMod(MODES, index); } + + @Override + public ResourceLocation getModeIcon() { + return modeIcon; + } + } /** @@ -108,38 +120,49 @@ private static ItemStack getJetpack(LivingEntity entity, Predicate ma /** * @return If fall distance should get reset or not */ - static boolean handleJetpackMotion(Player player, JetpackMode mode, BooleanSupplier ascendingSupplier) { + static boolean handleJetpackMotion(Player player, JetpackMode mode, double thrust, BooleanSupplier ascendingSupplier) { Vec3 motion = player.getDeltaMovement(); - if (mode == JetpackMode.NORMAL) { - if (player.isFallFlying()) { - Vec3 forward = player.getLookAngle(); - Vec3 delta = forward.multiply(forward.scale(0.15)) - .add(forward.scale(1.5).subtract(motion).scale(0.5)); - player.setDeltaMovement(motion.add(delta)); - return false; - } else { - player.setDeltaMovement(motion.x(), Math.min(motion.y() + 0.15D, 0.5D), motion.z()); - } + if (mode == JetpackMode.VECTOR && player.isShiftKeyDown()) { + //TODO: Do we want to expand holding shift to some sort of secondary behavior + mode = JetpackMode.NORMAL; + } + if ((mode == JetpackMode.NORMAL || mode == JetpackMode.VECTOR) && player.isFallFlying()) { + Vec3 forward = player.getLookAngle(); + Vec3 drag = forward.scale(1.5).subtract(motion).scale(0.5); + Vec3 delta = forward.scale(thrust).add(drag); + player.addDeltaMovement(delta); + return false; + } else if (mode == JetpackMode.NORMAL) { + Vec3 delta = new Vec3(0, thrust * getVerticalCoefficient(motion.y()), 0); + player.addDeltaMovement(delta); + } else if (mode == JetpackMode.VECTOR) { + Vec3 thrustVec = player.getUpVector(1F).scale(thrust); + Vec3 delta = new Vec3(thrustVec.x, thrustVec.y * getVerticalCoefficient(motion.y()), thrustVec.z); + player.addDeltaMovement(delta); } else if (mode == JetpackMode.HOVER) { boolean ascending = ascendingSupplier.getAsBoolean(); boolean descending = player.isDescending(); if (ascending == descending) { if (motion.y() > 0) { - player.setDeltaMovement(motion.x(), Math.max(motion.y() - 0.15D, 0), motion.z()); + player.setDeltaMovement(motion.x(), Math.max(motion.y() - thrust, 0), motion.z()); } else if (motion.y() < 0) { if (!CommonPlayerTickHandler.isOnGroundOrSleeping(player)) { - player.setDeltaMovement(motion.x(), Math.min(motion.y() + 0.15D, 0), motion.z()); + player.setDeltaMovement(motion.x(), Math.min(motion.y() + thrust, 0), motion.z()); } } } else if (ascending) { - player.setDeltaMovement(motion.x(), Math.min(motion.y() + 0.15D, 0.2D), motion.z()); + player.setDeltaMovement(motion.x(), Math.min(motion.y() + thrust, 2 * thrust), motion.z()); } else if (!CommonPlayerTickHandler.isOnGroundOrSleeping(player)) { - player.setDeltaMovement(motion.x(), Math.max(motion.y() - 0.15D, -0.2D), motion.z()); + player.setDeltaMovement(motion.x(), Math.max(motion.y() - thrust, -2 * thrust), motion.z()); } } return true; } + private static double getVerticalCoefficient(double currentYVelocity) { + return Math.min(1, Math.exp(-currentYVelocity)); + } + static JetpackMode getPlayerJetpackMode(Player player, JetpackMode mode, BooleanSupplier ascendingSupplier) { if (!player.isSpectator()) { if (mode != JetpackMode.DISABLED) { @@ -148,7 +171,7 @@ static JetpackMode getPlayerJetpackMode(Player player, JetpackMode mode, Boolean if (ascending && !player.isDescending() || !CommonPlayerTickHandler.isOnGroundOrSleeping(player)) { return mode; } - } else if (mode == JetpackMode.NORMAL && ascending) { + } else if (ascending) { return mode; } } diff --git a/src/main/java/mekanism/common/util/MekanismUtils.java b/src/main/java/mekanism/common/util/MekanismUtils.java index 0c84e6f3cef..18edf0e54a2 100644 --- a/src/main/java/mekanism/common/util/MekanismUtils.java +++ b/src/main/java/mekanism/common/util/MekanismUtils.java @@ -852,6 +852,7 @@ public enum ResourceType { GUI_GAUGE("gui/gauge"), GUI_HUD("gui/hud"), GUI_ICONS("gui/icons"), + GUI_MODE("gui/mode"), GUI_PROGRESS("gui/progress"), GUI_RADIAL("gui/radial"), GUI_SLOT("gui/slot"), diff --git a/src/main/resources/assets/mekanism/gui/hud/jetpack_vector.png b/src/main/resources/assets/mekanism/gui/hud/jetpack_vector.png new file mode 100644 index 0000000000000000000000000000000000000000..a97e457845652003f94b5ef4ce89d539a51c3b83 GIT binary patch literal 178 zcmeAS@N?(olHy`uVBq!ia0vp^0wBx*Bp9q_EZ7UAm`Z~Df*BafCZDwc^0GZ$977}| zSr2aHV{{Z@IPmlT{D~PErd6GN|4zQ$w>MhlN#+@#vf`SbDNHJ#%VHxL?4Ko?YaZ~v z|8DwP$%ccw?DK3G@^#NIPoLZnCl)5!aO{u*gR;^KLB;^isSHyCI29b3Gy;GoFfjbv WaohfAFW-U|5XaNi&t;ucLK6UUQaR}W literal 0 HcmV?d00001 diff --git a/src/main/resources/assets/mekanism/gui/mode/jetpack_hover.png b/src/main/resources/assets/mekanism/gui/mode/jetpack_hover.png new file mode 100644 index 0000000000000000000000000000000000000000..73c683773cc385850d328a2f90aaa444586ce6df GIT binary patch literal 130 zcmeAS@N?(olHy`uVBq!ia0vp^0wB!93?!50ihlx9oB=)|t_&Z}{r~?TNLIYBeGU|4 zDhcunW?(3reAWWUQ}c9j4B?1Q=3r%FQ&GxNozU@sMR2Zxl82yMivd%ofdKbHiK7e* XLENHBP7Wb_KphO8u6{1-oD!MrXa|cW_l<> agN=b9?2Ra6kGCSoCI(MeKbLh*2~7a0Umptq literal 0 HcmV?d00001 diff --git a/src/main/resources/assets/mekanism/gui/mode/jetpack_vector.png b/src/main/resources/assets/mekanism/gui/mode/jetpack_vector.png new file mode 100644 index 0000000000000000000000000000000000000000..6118a59246f2f683fc6c002cdfe0d7309b5a805d GIT binary patch literal 135 zcmeAS@N?(olHy`uVBq!ia0vp^0wB!93?!50ihlx9oB=)|u7Bpo|Ns9VNKSlp=Lb-b zsU*lRn1P{e@>vTYPutVQF@z&JnS+&yO+_h7bwbAj7D3}gmkCNe9EmJKiK`Sk!zLt! diR^V?Uxw^!5_CBCC22WQ%mvv4FO#po&CXoOD literal 0 HcmV?d00001 diff --git a/src/main/resources/assets/mekanism/lang/ca_es.json b/src/main/resources/assets/mekanism/lang/ca_es.json index ce24a5ef699..21eacdda1bb 100644 --- a/src/main/resources/assets/mekanism/lang/ca_es.json +++ b/src/main/resources/assets/mekanism/lang/ca_es.json @@ -1221,6 +1221,7 @@ "jetpack.mekanism.hover": "Flotar", "jetpack.mekanism.mode_change": "Mode de motxilla propulsora canviat a: %1$s", "jetpack.mekanism.normal": "Normal", + "jetpack.mekanism.vector": "Vector", "key.mekanism.chest_mode": "Interruptor de Mode de Cofre", "key.mekanism.description": "Show description", "key.mekanism.details": "Show details", diff --git a/src/main/resources/assets/mekanism/lang/cs_cz.json b/src/main/resources/assets/mekanism/lang/cs_cz.json index a37d0e1640f..5ef7e36e4ce 100644 --- a/src/main/resources/assets/mekanism/lang/cs_cz.json +++ b/src/main/resources/assets/mekanism/lang/cs_cz.json @@ -831,6 +831,7 @@ "item.mekanism.sulfuric_acid_bucket": "Kbelík tekuté kyseliny sírové", "item.mekanism.yellow_cake_uranium": "Koláč z Žlutého Uranu", "jetpack.mekanism.disabled": "Vypnuto", + "jetpack.mekanism.vector": "Vektor", "key.mekanism.chest_mode": "Přepínání Módů Brnění", "key.mekanism.description": "Show description", "key.mekanism.details": "Show details", diff --git a/src/main/resources/assets/mekanism/lang/de_at.json b/src/main/resources/assets/mekanism/lang/de_at.json index a24ee796a1e..624133c61a9 100644 --- a/src/main/resources/assets/mekanism/lang/de_at.json +++ b/src/main/resources/assets/mekanism/lang/de_at.json @@ -1220,6 +1220,7 @@ "jetpack.mekanism.hover": "Schweben", "jetpack.mekanism.mode_change": "Jetpack-Modus geändert zu: %1$s", "jetpack.mekanism.normal": "Regulär", + "jetpack.mekanism.vector": "Vektor", "key.mekanism.chest_mode": "Brust Modus wechseln", "key.mekanism.description": "Show description", "key.mekanism.details": "Show details", diff --git a/src/main/resources/assets/mekanism/lang/de_ch.json b/src/main/resources/assets/mekanism/lang/de_ch.json index 6ca169e6623..a95271625b7 100644 --- a/src/main/resources/assets/mekanism/lang/de_ch.json +++ b/src/main/resources/assets/mekanism/lang/de_ch.json @@ -1220,6 +1220,7 @@ "jetpack.mekanism.hover": "Schweben", "jetpack.mekanism.mode_change": "Jetpack-Modus geändert zu: %1$s", "jetpack.mekanism.normal": "Regulär", + "jetpack.mekanism.vector": "Vektor", "key.mekanism.chest_mode": "Brust Modus wechseln", "key.mekanism.description": "Show description", "key.mekanism.details": "Show details", diff --git a/src/main/resources/assets/mekanism/lang/de_de.json b/src/main/resources/assets/mekanism/lang/de_de.json index bd84d03fe9a..9f05990c879 100644 --- a/src/main/resources/assets/mekanism/lang/de_de.json +++ b/src/main/resources/assets/mekanism/lang/de_de.json @@ -1220,6 +1220,7 @@ "jetpack.mekanism.hover": "Schweben", "jetpack.mekanism.mode_change": "Jetpack-Modus geändert zu: %1$s", "jetpack.mekanism.normal": "Regulär", + "jetpack.mekanism.vector": "Vektor", "key.mekanism.chest_mode": "Brust Modus wechseln", "key.mekanism.description": "Zeige Beschreibung", "key.mekanism.details": "Zeige Details", diff --git a/src/main/resources/assets/mekanism/lang/es_ar.json b/src/main/resources/assets/mekanism/lang/es_ar.json index 5c9403be192..71a7d53b965 100644 --- a/src/main/resources/assets/mekanism/lang/es_ar.json +++ b/src/main/resources/assets/mekanism/lang/es_ar.json @@ -1220,6 +1220,7 @@ "jetpack.mekanism.hover": "Flotar", "jetpack.mekanism.mode_change": "Modo del Jetpack cambiado a: %1$s", "jetpack.mekanism.normal": "Normal", + "jetpack.mekanism.vector": "Vector", "key.mekanism.chest_mode": "Interruptor de Modo de cofre", "key.mekanism.description": "Mostrar descripción", "key.mekanism.details": "Mostrar detalles", diff --git a/src/main/resources/assets/mekanism/lang/es_cl.json b/src/main/resources/assets/mekanism/lang/es_cl.json index 6eafc18e791..0cef603d3cf 100644 --- a/src/main/resources/assets/mekanism/lang/es_cl.json +++ b/src/main/resources/assets/mekanism/lang/es_cl.json @@ -1220,6 +1220,7 @@ "jetpack.mekanism.hover": "Flotar", "jetpack.mekanism.mode_change": "Modo del Jetpack cambiado a: %1$s", "jetpack.mekanism.normal": "Normal", + "jetpack.mekanism.vector": "Vector", "key.mekanism.chest_mode": "Interruptor de Modo de cofre", "key.mekanism.description": "Mostrar descripción", "key.mekanism.details": "Mostrar detalles", diff --git a/src/main/resources/assets/mekanism/lang/es_es.json b/src/main/resources/assets/mekanism/lang/es_es.json index d3f08b7fd2e..9c22326ca91 100644 --- a/src/main/resources/assets/mekanism/lang/es_es.json +++ b/src/main/resources/assets/mekanism/lang/es_es.json @@ -1220,6 +1220,7 @@ "jetpack.mekanism.hover": "Flotar", "jetpack.mekanism.mode_change": "Modo del Jetpack cambiado a: %1$s", "jetpack.mekanism.normal": "Normal", + "jetpack.mekanism.vector": "Vector", "key.mekanism.chest_mode": "Interruptor de Modo Cofre", "key.mekanism.description": "Mostrar Descripción", "key.mekanism.details": "Mostrar Detalles", diff --git a/src/main/resources/assets/mekanism/lang/es_mx.json b/src/main/resources/assets/mekanism/lang/es_mx.json index e445dc84243..db812a3d4dc 100644 --- a/src/main/resources/assets/mekanism/lang/es_mx.json +++ b/src/main/resources/assets/mekanism/lang/es_mx.json @@ -1220,6 +1220,7 @@ "jetpack.mekanism.hover": "Flotar", "jetpack.mekanism.mode_change": "Modo Jetpack cambiado a: %1$s", "jetpack.mekanism.normal": "Normal", + "jetpack.mekanism.vector": "Vector", "key.mekanism.chest_mode": "Interruptor de Modo Cofre", "key.mekanism.description": "Mostrar Descripción", "key.mekanism.details": "Mostrar Detalles", diff --git a/src/main/resources/assets/mekanism/lang/fr_fr.json b/src/main/resources/assets/mekanism/lang/fr_fr.json index d73051b17b7..b460aa14854 100644 --- a/src/main/resources/assets/mekanism/lang/fr_fr.json +++ b/src/main/resources/assets/mekanism/lang/fr_fr.json @@ -1220,6 +1220,7 @@ "jetpack.mekanism.hover": "Survoler", "jetpack.mekanism.mode_change": "Mode du Jetpack changé sur: %1$s", "jetpack.mekanism.normal": "Régulier", + "jetpack.mekanism.vector": "Vecteur", "key.mekanism.chest_mode": "Commutateur de mode du buste", "key.mekanism.description": "Afficher la description", "key.mekanism.details": "Afficher les détails", diff --git a/src/main/resources/assets/mekanism/lang/id_id.json b/src/main/resources/assets/mekanism/lang/id_id.json index 946e96788e7..fa94545e4de 100644 --- a/src/main/resources/assets/mekanism/lang/id_id.json +++ b/src/main/resources/assets/mekanism/lang/id_id.json @@ -1220,6 +1220,7 @@ "jetpack.mekanism.hover": "Melayang", "jetpack.mekanism.mode_change": "Mode jetpack dirubah menjadi: %1$s", "jetpack.mekanism.normal": "Reguler", + "jetpack.mekanism.vector": "Vektor", "key.mekanism.chest_mode": "Rubah Mode Dada", "key.mekanism.description": "Show description", "key.mekanism.details": "Show details", diff --git a/src/main/resources/assets/mekanism/lang/it_it.json b/src/main/resources/assets/mekanism/lang/it_it.json index 68e61a84b78..9d4401b44d9 100644 --- a/src/main/resources/assets/mekanism/lang/it_it.json +++ b/src/main/resources/assets/mekanism/lang/it_it.json @@ -1220,6 +1220,7 @@ "jetpack.mekanism.hover": "Volo stazionario", "jetpack.mekanism.mode_change": "Modalità Jetpack cambiata in: %1$s", "jetpack.mekanism.normal": "Regolare", + "jetpack.mekanism.vector": "Vector", "key.mekanism.chest_mode": "Cambia modalità cassa", "key.mekanism.description": "Mostra descrizione", "key.mekanism.details": "Visualizza dettagli", diff --git a/src/main/resources/assets/mekanism/lang/ja_jp.json b/src/main/resources/assets/mekanism/lang/ja_jp.json index 4dc5eaf96d3..8c4b03cf45b 100644 --- a/src/main/resources/assets/mekanism/lang/ja_jp.json +++ b/src/main/resources/assets/mekanism/lang/ja_jp.json @@ -1220,6 +1220,7 @@ "jetpack.mekanism.hover": "ホバー", "jetpack.mekanism.mode_change": "ジェットパックのモードを%1$sに変更しました", "jetpack.mekanism.normal": "通常", + "jetpack.mekanism.vector": "ベクトル", "key.mekanism.chest_mode": "胴装備モードの切り替え", "key.mekanism.description": "説明を表示", "key.mekanism.details": "詳細を表示", diff --git a/src/main/resources/assets/mekanism/lang/ko_kr.json b/src/main/resources/assets/mekanism/lang/ko_kr.json index 3b0a31a4fde..4c88bfcccce 100644 --- a/src/main/resources/assets/mekanism/lang/ko_kr.json +++ b/src/main/resources/assets/mekanism/lang/ko_kr.json @@ -1204,6 +1204,7 @@ "jetpack.mekanism.hover": "비행 유지", "jetpack.mekanism.mode_change": "제트팩의 모드가 다음으로 변경됨: %1$s", "jetpack.mekanism.normal": "일반", + "jetpack.mekanism.vector": "벡터", "key.mekanism.chest_mode": "몸통 방어구 모드 전환", "key.mekanism.description": "설명 보기", "key.mekanism.details": "세부 정보 보기", diff --git a/src/main/resources/assets/mekanism/lang/pt_br.json b/src/main/resources/assets/mekanism/lang/pt_br.json index f0453a35a8d..8f8086bd804 100644 --- a/src/main/resources/assets/mekanism/lang/pt_br.json +++ b/src/main/resources/assets/mekanism/lang/pt_br.json @@ -1220,6 +1220,7 @@ "jetpack.mekanism.hover": "Flutuar", "jetpack.mekanism.mode_change": "Modo da mochila a jato alterado para: %1$s", "jetpack.mekanism.normal": "Regular", + "jetpack.mekanism.vector": "Vetor", "key.mekanism.chest_mode": "Alternar Modo do Peitoral", "key.mekanism.description": "Mostrar Descrição", "key.mekanism.details": "Mostrar detalhes", diff --git a/src/main/resources/assets/mekanism/lang/pt_pt.json b/src/main/resources/assets/mekanism/lang/pt_pt.json index 88f469a6f3b..0b1e127c0ae 100644 --- a/src/main/resources/assets/mekanism/lang/pt_pt.json +++ b/src/main/resources/assets/mekanism/lang/pt_pt.json @@ -1220,6 +1220,7 @@ "jetpack.mekanism.hover": "Pairar", "jetpack.mekanism.mode_change": "Modo Jetpack alterado para: %1$s", "jetpack.mekanism.normal": "Padrão", + "jetpack.mekanism.vector": "Vetor", "key.mekanism.chest_mode": "Alternar modo de Baú", "key.mekanism.description": "Exibir descrição", "key.mekanism.details": "Exibir detalhes", diff --git a/src/main/resources/assets/mekanism/lang/ru_ru.json b/src/main/resources/assets/mekanism/lang/ru_ru.json index 3ebca4cf238..79ef35f7055 100644 --- a/src/main/resources/assets/mekanism/lang/ru_ru.json +++ b/src/main/resources/assets/mekanism/lang/ru_ru.json @@ -1220,6 +1220,7 @@ "jetpack.mekanism.hover": "Зависание", "jetpack.mekanism.mode_change": "Режим ранца изменён на: %1$s", "jetpack.mekanism.normal": "Обычный", + "jetpack.mekanism.vector": "Вектор", "key.mekanism.chest_mode": "Переключить режим ранца", "key.mekanism.description": "Показать описание", "key.mekanism.details": "Подробности", diff --git a/src/main/resources/assets/mekanism/lang/sv_se.json b/src/main/resources/assets/mekanism/lang/sv_se.json index 6fce062dd5f..0f19421dbf7 100644 --- a/src/main/resources/assets/mekanism/lang/sv_se.json +++ b/src/main/resources/assets/mekanism/lang/sv_se.json @@ -1220,6 +1220,7 @@ "jetpack.mekanism.hover": "Hovring", "jetpack.mekanism.mode_change": "Ryggraketens läge ändrades till: %1$s", "jetpack.mekanism.normal": "Vanlig", + "jetpack.mekanism.vector": "Vektor", "key.mekanism.chest_mode": "Byt läge för utrustning på kroppen", "key.mekanism.description": "Visa beskrivning", "key.mekanism.details": "Visa detaljer", diff --git a/src/main/resources/assets/mekanism/lang/tr_tr.json b/src/main/resources/assets/mekanism/lang/tr_tr.json index 4e2ed8a3d57..0cbb8dcf374 100644 --- a/src/main/resources/assets/mekanism/lang/tr_tr.json +++ b/src/main/resources/assets/mekanism/lang/tr_tr.json @@ -1220,6 +1220,7 @@ "jetpack.mekanism.hover": "Duraksama", "jetpack.mekanism.mode_change": "Jetpack modu %1$s olarak değiştirildi", "jetpack.mekanism.normal": "Normal", + "jetpack.mekanism.vector": "Vektör", "key.mekanism.chest_mode": "Göğüslük Modu Değiştirme", "key.mekanism.description": "Açıklamayı Göster", "key.mekanism.details": "Detayları Göster", diff --git a/src/main/resources/assets/mekanism/lang/zh_cn.json b/src/main/resources/assets/mekanism/lang/zh_cn.json index daab27e6512..f6e75890763 100644 --- a/src/main/resources/assets/mekanism/lang/zh_cn.json +++ b/src/main/resources/assets/mekanism/lang/zh_cn.json @@ -1220,6 +1220,7 @@ "jetpack.mekanism.hover": "悬浮", "jetpack.mekanism.mode_change": "喷气背包模式更改为:%1$s", "jetpack.mekanism.normal": "标准", + "jetpack.mekanism.vector": "向量", "key.mekanism.chest_mode": "胸甲模式开关", "key.mekanism.description": "显示描述", "key.mekanism.details": "显示详细信息", diff --git a/src/main/resources/assets/mekanism/lang/zh_tw.json b/src/main/resources/assets/mekanism/lang/zh_tw.json index 3dd998722ed..95a54bda11f 100644 --- a/src/main/resources/assets/mekanism/lang/zh_tw.json +++ b/src/main/resources/assets/mekanism/lang/zh_tw.json @@ -1220,6 +1220,7 @@ "jetpack.mekanism.hover": "懸浮", "jetpack.mekanism.mode_change": "噴射背包模式更改為: %1$s", "jetpack.mekanism.normal": "標準", + "jetpack.mekanism.vector": "向量", "key.mekanism.chest_mode": "胸甲模式切換", "key.mekanism.description": "顯示描述", "key.mekanism.details": "顯示詳情",