Merge pull request #6386 from Attack8/mc1.18/PonderRebind

Allow Ponder to be re-bound
This commit is contained in:
simibubi 2024-07-17 13:11:45 +02:00 committed by GitHub
commit 1b34e52363
Failed to generate hash of commit
6 changed files with 32 additions and 25 deletions

View file

@ -582,8 +582,8 @@ bf2b0310500213ff853c748c236eb5d01f61658e assets/create/blockstates/yellow_toolbo
5616dda664dd106d576848124fc0fc1de18d0fd3 assets/create/blockstates/yellow_valve_handle.json
7f39521b211441f5c3e06d60c5978cebe16cacfb assets/create/blockstates/zinc_block.json
b7181bcd8182b2f17088e5aa881f374c9c65470c assets/create/blockstates/zinc_ore.json
390244ea1a4e56fb33c66490a033bd0b4870d0b8 assets/create/lang/en_ud.json
9d2ef7ec16aec62ac33b2c0debb6b368d0fdf7f8 assets/create/lang/en_us.json
9b0b65057342c778e8b442ad820b3400896f17ee assets/create/lang/en_ud.json
a15459832a165e6d082d80b301e4459d3dfecd41 assets/create/lang/en_us.json
487a511a01b2a4531fb672f917922312db78f958 assets/create/models/block/acacia_window.json
b48060cba1a382f373a05bf0039054053eccf076 assets/create/models/block/acacia_window_pane_noside.json
3066db1bf03cffa1a9c7fbacf47ae586632f4eb3 assets/create/models/block/acacia_window_pane_noside_alt.json

View file

@ -1284,6 +1284,7 @@
"create.item_attributes.smokable.inverted": "p\u01DD\u029Eo\u026FS \u01DDq \u0287ouu\u0250\u0254",
"create.item_attributes.washable": "p\u01DD\u0265s\u0250M \u01DDq u\u0250\u0254",
"create.item_attributes.washable.inverted": "p\u01DD\u0265s\u0250M \u01DDq \u0287ouu\u0250\u0254",
"create.keyinfo.ponder": "\u0279\u01DDpuo\u0500",
"create.keyinfo.scrolldown": ")p\u05DF\u0279o\u028Du\u0131( u\u028Do\u15E1 \u05DF\u01DD\u01DD\u0265\u028D\u01DDsnoW \u01DD\u0287\u0250\u05DFn\u026F\u0131S",
"create.keyinfo.scrollup": ")p\u05DF\u0279o\u028Du\u0131( d\u2229 \u05DF\u01DD\u01DD\u0265\u028D\u01DDsnoW \u01DD\u0287\u0250\u05DFn\u026F\u0131S",
"create.keyinfo.toolbelt": "s\u01DDxoq\u05DFoo\u27D8 \u028Eq\u0279\u0250\u01DDN ss\u01DD\u0254\u0254\u2C6F",

View file

@ -1284,6 +1284,7 @@
"create.item_attributes.smokable.inverted": "cannot be Smoked",
"create.item_attributes.washable": "can be Washed",
"create.item_attributes.washable.inverted": "cannot be Washed",
"create.keyinfo.ponder": "Ponder",
"create.keyinfo.scrolldown": "Simulate Mousewheel Down (inworld)",
"create.keyinfo.scrollup": "Simulate Mousewheel Up (inworld)",
"create.keyinfo.toolbelt": "Access Nearby Toolboxes",

View file

@ -9,11 +9,14 @@ import net.minecraft.client.Minecraft;
import net.minecraft.client.gui.screens.Screen;
import net.minecraftforge.client.ClientRegistry;
import org.lwjgl.opengl.GL;
public enum AllKeys {
TOOL_MENU("toolmenu", GLFW.GLFW_KEY_LEFT_ALT),
ACTIVATE_TOOL("", GLFW.GLFW_KEY_LEFT_CONTROL),
TOOLBELT("toolbelt", GLFW.GLFW_KEY_LEFT_ALT),
PONDER("ponder", GLFW.GLFW_KEY_W)
;

View file

@ -4,6 +4,7 @@ import java.util.List;
import com.google.common.base.Strings;
import com.mojang.blaze3d.platform.InputConstants;
import com.simibubi.create.AllKeys;
import com.simibubi.create.foundation.gui.ScreenOpener;
import com.simibubi.create.foundation.ponder.ui.NavigatableSimiScreen;
import com.simibubi.create.foundation.ponder.ui.PonderUI;
@ -28,7 +29,7 @@ public class PonderTooltipHandler {
public static boolean enable = true;
static LerpedFloat holdWProgress = LerpedFloat.linear()
static LerpedFloat holdKeyProgress = LerpedFloat.linear()
.startWithValue(0);
static ItemStack hoveredStack = ItemStack.EMPTY;
static ItemStack trackingStack = ItemStack.EMPTY;
@ -49,11 +50,11 @@ public class PonderTooltipHandler {
if (hoveredStack.isEmpty() || trackingStack.isEmpty()) {
trackingStack = ItemStack.EMPTY;
holdWProgress.startWithValue(0);
holdKeyProgress.startWithValue(0);
return;
}
float value = holdWProgress.getValue();
float value = holdKeyProgress.getValue();
int keyCode = ponderKeybind().getKey()
.getValue();
long window = instance.getWindow()
@ -64,12 +65,12 @@ public class PonderTooltipHandler {
if (currentScreen instanceof NavigatableSimiScreen)
((NavigatableSimiScreen) currentScreen).centerScalingOnMouse();
ScreenOpener.transitionTo(PonderUI.of(trackingStack));
holdWProgress.startWithValue(0);
holdKeyProgress.startWithValue(0);
return;
}
holdWProgress.setValue(Math.min(1, value + Math.max(.25f, value) * .25f));
holdKeyProgress.setValue(Math.min(1, value + Math.max(.25f, value) * .25f));
} else
holdWProgress.setValue(Math.max(0, value - .05f));
holdKeyProgress.setValue(Math.max(0, value - .05f));
hoveredStack = ItemStack.EMPTY;
}
@ -92,7 +93,7 @@ public class PonderTooltipHandler {
.getFrameTime();
Component component = subject ? Lang.translateDirect(SUBJECT)
.withStyle(ChatFormatting.GREEN)
: makeProgressBar(Math.min(1, holdWProgress.getValue(renderPartialTicks) * 8 / 7f));
: makeProgressBar(Math.min(1, holdKeyProgress.getValue(renderPartialTicks) * 8 / 7f));
List<Component> tooltip = event.getToolTip();
if (tooltip.size() < 2)
tooltip.add(component);
@ -121,7 +122,7 @@ public class PonderTooltipHandler {
return;
if (prevStack.isEmpty() || !prevStack.sameItem(stack))
holdWProgress.startWithValue(0);
holdKeyProgress.startWithValue(0);
hoveredStack = stack;
trackingStack = stack;
@ -130,13 +131,13 @@ public class PonderTooltipHandler {
public static void handleTooltipColor(RenderTooltipEvent.Color event) {
if (trackingStack != event.getItemStack())
return;
if (holdWProgress.getValue() == 0)
if (holdKeyProgress.getValue() == 0)
return;
float renderPartialTicks = Minecraft.getInstance()
.getFrameTime();
int start = event.getOriginalBorderStart();
int end = event.getOriginalBorderEnd();
float progress = Math.min(1, holdWProgress.getValue(renderPartialTicks) * 8 / 7f);
float progress = Math.min(1, holdKeyProgress.getValue(renderPartialTicks) * 8 / 7f);
start = getSmoothColorForProgress(progress);
end = getSmoothColorForProgress((progress));
@ -176,7 +177,7 @@ public class PonderTooltipHandler {
}
protected static KeyMapping ponderKeybind() {
return Minecraft.getInstance().options.keyUp;
return AllKeys.PONDER.getKeybind();
}
}

View file

@ -118,7 +118,8 @@
"create.keyinfo.toolmenu": "Focus Schematic Overlay",
"create.keyinfo.toolbelt": "Access Nearby Toolboxes",
"create.keyinfo.scrollup": "Simulate Mousewheel Up (inworld)",
"create.keyinfo.scrolldown": "Simulate Mousewheel Down (inworld)",
"create.keyinfo.scrolldown": "Simulate Mousewheel Down (inworld)",
"create.keyinfo.ponder": "Ponder",
"create.gui.scrollInput.defaultTitle": "Choose an Option:",
"create.gui.scrollInput.scrollToModify": "Scroll to Modify",
@ -179,7 +180,7 @@
"create.terrainzapper.leftClickToSet": "Left-Click a Block to set Material",
"create.large_water_wheel.not_enough_space": "Clear Blocks for Placement",
"create.minecart_coupling.two_couplings_max": "Minecarts cannot have more than two couplings each",
"create.minecart_coupling.unloaded": "Parts of your train seem to be in unloaded chunks",
"create.minecart_coupling.no_loops": "Couplings cannot form a loop",
@ -219,7 +220,7 @@
"create.logistics.fluid_filter": "Fluid Filter",
"create.logistics.firstFrequency": "Frequency #1",
"create.logistics.secondFrequency": "Frequency #2",
"create.logistics.filter.click_to_set": "Click with item to set",
"create.logistics.filter.click_to_replace": "Click with item to replace",
"create.logistics.filter.hold_to_set_amount": "Click and hold for amount",
@ -230,26 +231,26 @@
"create.logistics.filter.up_to": "Up to",
"create.logistics.filter.exactly": "Exactly",
"create.logistics.filter.requires_item_in_inventory": "Requires %1$s item in Inventory",
"create.logistics.creative_crate.supply": "Infinite Supply",
"create.logistics.train_observer.cargo_filter": "Cargo Filter",
"create.kinetics.creative_motor.rotation_speed": "Generated Speed in RPM",
"create.kinetics.speed_controller.rotation_speed": "Targeted Speed in RPM",
"create.kinetics.valve_handle.rotated_angle": "Rotation when used",
"create.logistics.redstone_interval": "Redstone Interval",
"create.contraptions.contoller.target": "Targeted Component",
"create.contraptions.mechanical_roller.pave_material": "Paving Material",
"create.contraptions.chassis.radius": "Radius when Sticky",
"create.contraptions.chassis.range": "Range of Sticky Sides",
"create.contraptions.chassis.distance": "Distance",
"create.gui.value_settings.hold_to_edit": "Click and hold to edit",
"create.gui.value_settings.release_to_confirm": "Release %1$s to Confirm",
"create.gui.goggles.generator_stats": "Generator Stats:",
"create.gui.goggles.kinetic_stats": "Kinetic Stats:",
"create.gui.goggles.at_current_speed": "at current speed",
@ -309,7 +310,7 @@
"create.gui.sequenced_gearshift.speed.back_fast": "Double speed, Reversed",
"create.gui.clipboard.erase_checked": "Erase checked items",
"create.clipboard.actions": "Clipboard Actions",
"create.clipboard.to_copy": "%1$s to Copy settings",
"create.clipboard.to_paste": "%1$s to Paste settings",
@ -872,7 +873,7 @@
"create.contraption.controls.actor_toggle.on": "On",
"create.contraption.controls.actor_toggle.off": "Off",
"create.contraption.controls.floor_unreachable": "Unreachable",
"create.contraption.door_control": "Onboard Door Control",
"create.contraption.door_control.all": "Open All Doors",
"create.contraption.door_control.all.short": "Open All",