Compare commits
14 Commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
df7c7bbdad | ||
|
|
3ddae57eab | ||
|
|
a0701f55f6 | ||
|
|
b15766dfdb | ||
|
|
19ed068da9 | ||
|
|
d2e21f8723 | ||
|
|
b3f7350de9 | ||
|
|
34408d7a2a | ||
|
|
6e64c7c97d | ||
|
|
bca73c93cc | ||
|
|
913e79fe5b | ||
|
|
b1334a0455 | ||
|
|
ce9495c79c | ||
|
|
ff8270d18a |
10
README.md
@@ -6,7 +6,7 @@
|
|||||||

|

|
||||||
[![Mod loader: Quilt/Fabric]][quilt] <!-- modrinth_exclude.start -->
|
[![Mod loader: Quilt/Fabric]][quilt] <!-- modrinth_exclude.start -->
|
||||||
[](https://github.com/TeamMidnightDust/MidnightControls/releases)
|
[](https://github.com/TeamMidnightDust/MidnightControls/releases)
|
||||||
[](https://www.curseforge.com/minecraft/mc-mods/midnightcontrols)
|
[](https://www.curseforge.com/minecraft/mc-mods/midnightcontrols)
|
||||||
<!-- modrinth_exclude.end -->
|
<!-- modrinth_exclude.end -->
|
||||||
|
|
||||||
A Fabric Minecraft mod which adds better controls, reach-around and controller support.
|
A Fabric Minecraft mod which adds better controls, reach-around and controller support.
|
||||||
@@ -32,16 +32,16 @@ This mod also adds controller support.
|
|||||||
- Front block placing (be careful with this one)
|
- Front block placing (be careful with this one)
|
||||||
- New controls settings!
|
- New controls settings!
|
||||||
- Many options in config to change to your liking.
|
- Many options in config to change to your liking.
|
||||||
- Many controllers supported and in a simply way your own controller mappings.
|
- Many controllers supported and in a simple way your own controller mappings.
|
||||||
- An easy API for developers to add their own button bindings.
|
- An easy API for developers to add their own button bindings.
|
||||||
|
|
||||||
## 🎮 Supported Controllers:
|
## 🎮 Supported Controllers:
|
||||||
|
|
||||||
- Dualshock controllers
|
- DualShock controllers
|
||||||
- Dualsense controllers
|
- DualSense controllers
|
||||||
- Xbox controllers
|
- Xbox controllers
|
||||||
- Switch Pro controllers
|
- Switch Pro controllers
|
||||||
- Joycons
|
- Joy-Cons
|
||||||
- Steam controller and Steam Deck (WIP)
|
- Steam controller and Steam Deck (WIP)
|
||||||
- And many more!
|
- And many more!
|
||||||
|
|
||||||
|
|||||||
@@ -110,7 +110,8 @@ dependencies {
|
|||||||
// modImplementation "io.github.ennuil:LibZoomer:${project.libzoomer_version}"
|
// modImplementation "io.github.ennuil:LibZoomer:${project.libzoomer_version}"
|
||||||
|
|
||||||
modImplementation "org.quiltmc:quilt-json5:1.0.0"
|
modImplementation "org.quiltmc:quilt-json5:1.0.0"
|
||||||
modImplementation("me.shedaniel:RoughlyEnoughItems-runtime-fabric:${project.rei_version}")
|
modApi "maven.modrinth:sodium:${project.sodium_version}"
|
||||||
|
//modImplementation("maven.modrinth:emi:${project.emi_version}")
|
||||||
modImplementation "maven.modrinth:emotecraft:${project.emotecraft_version}"
|
modImplementation "maven.modrinth:emotecraft:${project.emotecraft_version}"
|
||||||
modImplementation "io.github.kosmx:bendy-lib:${project.bendylib_version}"
|
modImplementation "io.github.kosmx:bendy-lib:${project.bendylib_version}"
|
||||||
|
|
||||||
|
|||||||
269
controller_banner.svg
Normal file
@@ -0,0 +1,269 @@
|
|||||||
|
<?xml version="1.0" encoding="UTF-8" standalone="no"?>
|
||||||
|
<!-- Created with Inkscape (http://www.inkscape.org/) -->
|
||||||
|
|
||||||
|
<svg
|
||||||
|
width="1920"
|
||||||
|
height="1080"
|
||||||
|
viewBox="0 0 1920 1080"
|
||||||
|
version="1.1"
|
||||||
|
id="SVGRoot"
|
||||||
|
sodipodi:docname="controller_banner.svg"
|
||||||
|
inkscape:version="1.1.2 (0a00cf5339, 2022-02-04, custom)"
|
||||||
|
inkscape:export-filename="/home/martin/Bilder/Bilder/MidnightControlsBanner.png"
|
||||||
|
inkscape:export-xdpi="96"
|
||||||
|
inkscape:export-ydpi="96"
|
||||||
|
xmlns:inkscape="http://www.inkscape.org/namespaces/inkscape"
|
||||||
|
xmlns:sodipodi="http://sodipodi.sourceforge.net/DTD/sodipodi-0.dtd"
|
||||||
|
xmlns:xlink="http://www.w3.org/1999/xlink"
|
||||||
|
xmlns="http://www.w3.org/2000/svg"
|
||||||
|
xmlns:svg="http://www.w3.org/2000/svg">
|
||||||
|
<sodipodi:namedview
|
||||||
|
id="namedview893"
|
||||||
|
pagecolor="#505050"
|
||||||
|
bordercolor="#eeeeee"
|
||||||
|
borderopacity="1"
|
||||||
|
inkscape:pageshadow="0"
|
||||||
|
inkscape:pageopacity="0"
|
||||||
|
inkscape:pagecheckerboard="0"
|
||||||
|
inkscape:document-units="px"
|
||||||
|
showgrid="true"
|
||||||
|
inkscape:zoom="0.40120419"
|
||||||
|
inkscape:cx="928.45492"
|
||||||
|
inkscape:cy="816.29258"
|
||||||
|
inkscape:window-width="1920"
|
||||||
|
inkscape:window-height="1050"
|
||||||
|
inkscape:window-x="1920"
|
||||||
|
inkscape:window-y="30"
|
||||||
|
inkscape:window-maximized="1"
|
||||||
|
inkscape:current-layer="layer1">
|
||||||
|
<inkscape:grid
|
||||||
|
type="xygrid"
|
||||||
|
id="grid956" />
|
||||||
|
</sodipodi:namedview>
|
||||||
|
<defs
|
||||||
|
id="defs888">
|
||||||
|
<linearGradient
|
||||||
|
inkscape:collect="always"
|
||||||
|
id="linearGradient2059">
|
||||||
|
<stop
|
||||||
|
style="stop-color:#ed02a0;stop-opacity:0.72909278"
|
||||||
|
offset="0"
|
||||||
|
id="stop2055" />
|
||||||
|
<stop
|
||||||
|
style="stop-color:#8900cb;stop-opacity:0.73234183"
|
||||||
|
offset="1"
|
||||||
|
id="stop2057" />
|
||||||
|
</linearGradient>
|
||||||
|
<inkscape:path-effect
|
||||||
|
effect="powerclip"
|
||||||
|
id="path-effect904"
|
||||||
|
is_visible="true"
|
||||||
|
lpeversion="1"
|
||||||
|
inverse="true"
|
||||||
|
flatten="false"
|
||||||
|
hide_clip="false"
|
||||||
|
message="Füllregel Gerade-Ungerade im <b>Füllung und Kontur</b>-Dialog verwenden, wenn das Anwenden des Ausschnitts mit nachfolgendem Umwandeln in Pfade kein Ergebnis bringt" />
|
||||||
|
<inkscape:path-effect
|
||||||
|
effect="powerclip"
|
||||||
|
id="path-effect900"
|
||||||
|
is_visible="true"
|
||||||
|
lpeversion="1"
|
||||||
|
inverse="true"
|
||||||
|
flatten="false"
|
||||||
|
hide_clip="false"
|
||||||
|
message="Füllregel Gerade-Ungerade im <b>Füllung und Kontur</b>-Dialog verwenden, wenn das Anwenden des Ausschnitts mit nachfolgendem Umwandeln in Pfade kein Ergebnis bringt" />
|
||||||
|
<inkscape:path-effect
|
||||||
|
effect="powerclip"
|
||||||
|
id="path-effect896"
|
||||||
|
is_visible="true"
|
||||||
|
lpeversion="1"
|
||||||
|
inverse="true"
|
||||||
|
flatten="false"
|
||||||
|
hide_clip="false"
|
||||||
|
message="Füllregel Gerade-Ungerade im <b>Füllung und Kontur</b>-Dialog verwenden, wenn das Anwenden des Ausschnitts mit nachfolgendem Umwandeln in Pfade kein Ergebnis bringt" />
|
||||||
|
<rect
|
||||||
|
x="500"
|
||||||
|
y="800"
|
||||||
|
width="840"
|
||||||
|
height="220"
|
||||||
|
id="rect7833" />
|
||||||
|
<linearGradient
|
||||||
|
inkscape:collect="always"
|
||||||
|
id="linearGradient1152">
|
||||||
|
<stop
|
||||||
|
style="stop-color:#ed02a0;stop-opacity:1"
|
||||||
|
offset="0"
|
||||||
|
id="stop1148" />
|
||||||
|
<stop
|
||||||
|
style="stop-color:#8900cb;stop-opacity:1"
|
||||||
|
offset="1"
|
||||||
|
id="stop1150" />
|
||||||
|
</linearGradient>
|
||||||
|
<linearGradient
|
||||||
|
inkscape:collect="always"
|
||||||
|
xlink:href="#linearGradient2059"
|
||||||
|
id="linearGradient1154"
|
||||||
|
x1="0"
|
||||||
|
y1="0"
|
||||||
|
x2="1920"
|
||||||
|
y2="1080"
|
||||||
|
gradientUnits="userSpaceOnUse" />
|
||||||
|
<linearGradient
|
||||||
|
inkscape:collect="always"
|
||||||
|
xlink:href="#linearGradient1152"
|
||||||
|
id="linearGradient4289"
|
||||||
|
x1="-398"
|
||||||
|
y1="56"
|
||||||
|
x2="1522"
|
||||||
|
y2="1136"
|
||||||
|
gradientUnits="userSpaceOnUse"
|
||||||
|
gradientTransform="translate(398,-56)" />
|
||||||
|
<linearGradient
|
||||||
|
inkscape:collect="always"
|
||||||
|
xlink:href="#linearGradient1152"
|
||||||
|
id="linearGradient7579"
|
||||||
|
x1="-398"
|
||||||
|
y1="56"
|
||||||
|
x2="1522"
|
||||||
|
y2="1136"
|
||||||
|
gradientUnits="userSpaceOnUse"
|
||||||
|
gradientTransform="translate(398,-56)" />
|
||||||
|
<clipPath
|
||||||
|
clipPathUnits="userSpaceOnUse"
|
||||||
|
id="clipPath878">
|
||||||
|
<path
|
||||||
|
id="path880"
|
||||||
|
style="display:none;fill:url(#linearGradient882);stroke-width:1.00028"
|
||||||
|
d="m 1170.0221,-4.111892 a 21.817197,20.751893 3.393352 0 0 -8.3753,3.68511674 21.817197,20.751893 3.393352 0 0 -4.1775,28.99380526 l 0.2304,0.284584 a 21.817197,20.751893 3.393352 0 0 30.5488,3.770316 21.817197,20.751893 3.393352 0 0 3.9128,-29.0289691 21.817197,20.751893 3.393352 0 0 -22.1392,-7.7048529 z M 858.04762,85.714292 c -7.15183,1.731644 -11.32417,8.932859 -9.35312,16.146398 l 22.2005,81.24794 c 1.97106,7.21354 9.31675,11.62594 16.46858,9.8943 L 1086.714,144.73497 c 7.1518,-1.73163 11.3223,-8.9324 9.3512,-16.14595 l -22.2005,-81.247936 c -1.971,-7.213536 -9.3149,-11.626381 -16.4667,-9.894748 z M 756.02165,124.73884 a 50.906793,48.421082 3.3933293 0 0 -19.54511,8.59585 50.906793,48.421082 3.3933293 0 0 -9.74699,67.65414 l 0.53564,0.66651 a 50.906793,48.421082 3.3933293 0 0 71.28286,8.79621 50.906793,48.421082 3.3933293 0 0 9.13065,-67.73384 50.906793,48.421082 3.3933293 0 0 -51.65705,-17.97887 z M 1139.8366,44.661798 a 21.817197,20.751893 3.393352 0 0 -8.3752,3.685094 21.817197,20.751893 3.393352 0 0 -4.1775,28.993805 l 0.2304,0.284584 a 21.817197,20.751893 3.393352 0 0 30.5487,3.770339 21.817197,20.751893 3.393352 0 0 3.9147,-29.029436 21.817197,20.751893 3.393352 0 0 -22.1411,-7.704386 z m 84.4396,-20.445031 a 21.817197,20.751893 3.393352 0 0 -8.3754,3.685117 21.817197,20.751893 3.393352 0 0 -4.1774,28.993806 l 0.2285,0.285027 a 21.817197,20.751893 3.393352 0 0 30.5488,3.77034 21.817197,20.751893 3.393352 0 0 3.9147,-29.02946 21.817197,20.751893 3.393352 0 0 -22.1392,-7.70483 z M 1193.05,74.672751 a 21.817197,20.751893 3.393352 0 0 -8.3759,3.68321 21.817197,20.751893 3.393352 0 0 -4.1769,28.995709 l 0.2303,0.28458 a 21.817197,20.751893 3.393352 0 0 30.5488,3.77035 21.817197,20.751893 3.393352 0 0 3.9128,-29.029006 21.817197,20.751893 3.393352 0 0 -22.1391,-7.704843 z M 865.52481,226.88685 c -7.36616,1.78355 -11.66248,9.20165 -9.63236,16.63136 l 5.86309,21.45735 -27.90161,6.7557 c -7.15183,1.73165 -11.32229,8.9324 -9.35123,16.14595 l 2.77837,10.1681 c 1.97106,7.21354 9.31487,11.6264 16.46669,9.89476 l 27.90161,-6.75571 6.22966,22.7989 c 2.03012,7.42971 9.59558,11.97577 16.96174,10.19223 l 8.59091,-2.08008 c 7.36616,-1.78354 11.6606,-9.2012 9.63048,-16.63091 l -6.22966,-22.7989 23.68151,-5.73391 c 7.15183,-1.73165 11.32229,-8.93242 9.35123,-16.14595 l -2.77837,-10.16811 c -1.97106,-7.21354 -9.31486,-11.62639 -16.46669,-9.89474 l -23.68151,5.73391 -5.86309,-21.45735 c -2.03012,-7.42971 -9.5937,-11.97623 -16.95987,-10.19269 z m 272.15169,-63.56116 a 50.906793,48.421082 3.3933293 0 0 -19.5432,8.59539 50.906793,48.421082 3.3933293 0 0 -9.747,67.65414 l 0.5356,0.66651 a 50.906793,48.421082 3.3933293 0 0 71.2829,8.79621 50.906793,48.421082 3.3933293 0 0 9.1307,-67.73384 50.906793,48.421082 3.3933293 0 0 -51.659,-17.97841 z" />
|
||||||
|
<path
|
||||||
|
id="lpe_path-effect896"
|
||||||
|
style="fill:url(#linearGradient882);stroke-width:1.00028"
|
||||||
|
class="powerclip"
|
||||||
|
d="M 636.0108,56.943474 H 846.95389 V 569.86886 H 636.0108 Z m 534.0113,-61.055366 a 21.817197,20.751893 3.393352 0 0 -8.3753,3.68511674 21.817197,20.751893 3.393352 0 0 -4.1775,28.99380526 l 0.2304,0.284584 a 21.817197,20.751893 3.393352 0 0 30.5488,3.770316 21.817197,20.751893 3.393352 0 0 3.9128,-29.0289691 21.817197,20.751893 3.393352 0 0 -22.1392,-7.7048529 z M 858.04762,85.714292 c -7.15183,1.731644 -11.32417,8.932859 -9.35312,16.146398 l 22.2005,81.24794 c 1.97106,7.21354 9.31675,11.62594 16.46858,9.8943 L 1086.714,144.73497 c 7.1518,-1.73163 11.3223,-8.9324 9.3512,-16.14595 l -22.2005,-81.247936 c -1.971,-7.213536 -9.3149,-11.626381 -16.4667,-9.894748 z M 756.02165,124.73884 a 50.906793,48.421082 3.3933293 0 0 -19.54511,8.59585 50.906793,48.421082 3.3933293 0 0 -9.74699,67.65414 l 0.53564,0.66651 a 50.906793,48.421082 3.3933293 0 0 71.28286,8.79621 50.906793,48.421082 3.3933293 0 0 9.13065,-67.73384 50.906793,48.421082 3.3933293 0 0 -51.65705,-17.97887 z M 1139.8366,44.661798 a 21.817197,20.751893 3.393352 0 0 -8.3752,3.685094 21.817197,20.751893 3.393352 0 0 -4.1775,28.993805 l 0.2304,0.284584 a 21.817197,20.751893 3.393352 0 0 30.5487,3.770339 21.817197,20.751893 3.393352 0 0 3.9147,-29.029436 21.817197,20.751893 3.393352 0 0 -22.1411,-7.704386 z m 84.4396,-20.445031 a 21.817197,20.751893 3.393352 0 0 -8.3754,3.685117 21.817197,20.751893 3.393352 0 0 -4.1774,28.993806 l 0.2285,0.285027 a 21.817197,20.751893 3.393352 0 0 30.5488,3.77034 21.817197,20.751893 3.393352 0 0 3.9147,-29.02946 21.817197,20.751893 3.393352 0 0 -22.1392,-7.70483 z M 1193.05,74.672751 a 21.817197,20.751893 3.393352 0 0 -8.3759,3.68321 21.817197,20.751893 3.393352 0 0 -4.1769,28.995709 l 0.2303,0.28458 a 21.817197,20.751893 3.393352 0 0 30.5488,3.77035 21.817197,20.751893 3.393352 0 0 3.9128,-29.029006 21.817197,20.751893 3.393352 0 0 -22.1391,-7.704843 z M 865.52481,226.88685 c -7.36616,1.78355 -11.66248,9.20165 -9.63236,16.63136 l 5.86309,21.45735 -27.90161,6.7557 c -7.15183,1.73165 -11.32229,8.9324 -9.35123,16.14595 l 2.77837,10.1681 c 1.97106,7.21354 9.31487,11.6264 16.46669,9.89476 l 27.90161,-6.75571 6.22966,22.7989 c 2.03012,7.42971 9.59558,11.97577 16.96174,10.19223 l 8.59091,-2.08008 c 7.36616,-1.78354 11.6606,-9.2012 9.63048,-16.63091 l -6.22966,-22.7989 23.68151,-5.73391 c 7.15183,-1.73165 11.32229,-8.93242 9.35123,-16.14595 l -2.77837,-10.16811 c -1.97106,-7.21354 -9.31486,-11.62639 -16.46669,-9.89474 l -23.68151,5.73391 -5.86309,-21.45735 c -2.03012,-7.42971 -9.5937,-11.97623 -16.95987,-10.19269 z m 272.15169,-63.56116 a 50.906793,48.421082 3.3933293 0 0 -19.5432,8.59539 50.906793,48.421082 3.3933293 0 0 -9.747,67.65414 l 0.5356,0.66651 a 50.906793,48.421082 3.3933293 0 0 71.2829,8.79621 50.906793,48.421082 3.3933293 0 0 9.1307,-67.73384 50.906793,48.421082 3.3933293 0 0 -51.659,-17.97841 z" />
|
||||||
|
</clipPath>
|
||||||
|
<linearGradient
|
||||||
|
inkscape:collect="always"
|
||||||
|
xlink:href="#linearGradient1152"
|
||||||
|
id="linearGradient882"
|
||||||
|
gradientUnits="userSpaceOnUse"
|
||||||
|
gradientTransform="matrix(0.96459266,-0.23355313,0.26584317,0.97291549,369.02066,-147.43741)"
|
||||||
|
x1="-398"
|
||||||
|
y1="56"
|
||||||
|
x2="1522"
|
||||||
|
y2="1136" />
|
||||||
|
<clipPath
|
||||||
|
clipPathUnits="userSpaceOnUse"
|
||||||
|
id="clipPath884">
|
||||||
|
<path
|
||||||
|
id="path886"
|
||||||
|
style="display:none;fill:url(#linearGradient888);stroke-width:1.00027"
|
||||||
|
d="m 1026.6374,528.82806 a 20.752793,21.815894 86.926601 0 0 -9.2243,-0.58528 20.752793,21.815894 86.926601 0 0 -18.53105,23.48045 l 0.0557,0.35396 a 20.752793,21.815894 86.926601 0 0 24.81605,17.20206 20.752793,21.815894 86.926601 0 0 18.3173,-23.63171 20.752793,21.815894 86.926601 0 0 -15.4337,-16.81948 z M 707.37883,465.4963 c -7.15078,-1.7386 -14.49832,2.66675 -16.47273,9.87849 l -22.23828,81.2277 c -1.97441,7.21175 2.19438,14.41711 9.34515,16.15571 l 199.32113,48.46175 c 7.15073,1.73859 14.49643,-2.66722 16.47084,-9.87896 l 22.23828,-81.2277 c 1.97441,-7.21174 -2.19254,-14.41666 -9.34327,-16.15524 z M 598.02135,453.23104 a 48.423182,50.903752 86.926623 0 0 -21.5241,-1.36927 48.423182,50.903752 86.926623 0 0 -43.23978,54.7896 l 0.12713,0.82721 a 48.423182,50.903752 86.926623 0 0 57.90649,40.13811 48.423182,50.903752 86.926623 0 0 42.74098,-55.13985 48.423182,50.903752 86.926623 0 0 -36.01072,-39.2458 z m 377.16446,104.5578 a 20.752793,21.815894 86.926601 0 0 -9.22414,-0.58526 20.752793,21.815894 86.926601 0 0 -18.53108,23.48045 l 0.0557,0.35396 a 20.752793,21.815894 86.926601 0 0 24.8159,17.20204 20.752793,21.815894 86.926601 0 0 18.31921,-23.63124 20.752793,21.815894 86.926601 0 0 -15.43563,-16.81995 z m 84.42719,20.52712 a 20.752793,21.815894 86.926601 0 0 -9.2243,-0.58529 20.752793,21.815894 86.926601 0 0 -18.531,23.48045 l 0.054,0.35352 a 20.752793,21.815894 86.926601 0 0 24.8159,17.20204 20.752793,21.815894 86.926601 0 0 18.3193,-23.63122 20.752793,21.815894 86.926601 0 0 -15.4338,-16.8195 z m -53.2258,29.9599 a 20.752793,21.815894 86.926601 0 0 -9.22373,-0.58718 20.752793,21.815894 86.926601 0 0 -18.53161,23.48235 l 0.0557,0.35395 a 20.752793,21.815894 86.926601 0 0 24.81584,17.20205 20.752793,21.815894 86.926601 0 0 18.3174,-23.63169 20.752793,21.815894 86.926601 0 0 -15.4337,-16.81948 z M 641.50831,592.48259 c -7.36508,-1.79069 -14.93245,2.74811 -16.96603,10.17597 l -5.87307,21.452 -27.8975,-6.78283 c -7.15078,-1.7386 -14.49644,2.6672 -16.47085,9.87895 l -2.7831,10.16557 c -1.97441,7.21174 2.1925,14.41666 9.34328,16.15525 l 27.8975,6.78284 -6.24026,22.79322 c -2.03358,7.42786 2.25909,14.85024 9.62417,16.64094 l 8.58964,2.08844 c 7.36508,1.7907 14.93057,-2.74856 16.96415,-10.17642 l 6.24026,-22.79322 23.67803,5.75693 c 7.15078,1.7386 14.49644,-2.66722 16.47085,-9.87896 l 2.7831,-10.16557 c 1.97441,-7.21175 -2.1925,-14.41665 -9.34328,-16.15525 l -23.67803,-5.75693 5.87307,-21.45201 c 2.03358,-7.42785 -2.25721,-14.84978 -9.62229,-16.64048 z m 270.91446,68.20272 a 48.423182,50.903752 86.926623 0 0 -21.52221,-1.3688 48.423182,50.903752 86.926623 0 0 -43.23975,54.78961 l 0.12708,0.8272 a 48.423182,50.903752 86.926623 0 0 57.90652,40.13811 48.423182,50.903752 86.926623 0 0 42.74097,-55.13984 48.423182,50.903752 86.926623 0 0 -36.01261,-39.24628 z" />
|
||||||
|
<path
|
||||||
|
id="lpe_path-effect900"
|
||||||
|
style="fill:url(#linearGradient888);stroke-width:1.00027"
|
||||||
|
class="powerclip"
|
||||||
|
d="M 912.35657,483.93158 H 1121.6656 V 998.54486 H 912.35657 Z m 114.28083,44.89648 a 20.752793,21.815894 86.926601 0 0 -9.2243,-0.58528 20.752793,21.815894 86.926601 0 0 -18.53105,23.48045 l 0.0557,0.35396 a 20.752793,21.815894 86.926601 0 0 24.81605,17.20206 20.752793,21.815894 86.926601 0 0 18.3173,-23.63171 20.752793,21.815894 86.926601 0 0 -15.4337,-16.81948 z M 707.37883,465.4963 c -7.15078,-1.7386 -14.49832,2.66675 -16.47273,9.87849 l -22.23828,81.2277 c -1.97441,7.21175 2.19438,14.41711 9.34515,16.15571 l 199.32113,48.46175 c 7.15073,1.73859 14.49643,-2.66722 16.47084,-9.87896 l 22.23828,-81.2277 c 1.97441,-7.21174 -2.19254,-14.41666 -9.34327,-16.15524 z M 598.02135,453.23104 a 48.423182,50.903752 86.926623 0 0 -21.5241,-1.36927 48.423182,50.903752 86.926623 0 0 -43.23978,54.7896 l 0.12713,0.82721 a 48.423182,50.903752 86.926623 0 0 57.90649,40.13811 48.423182,50.903752 86.926623 0 0 42.74098,-55.13985 48.423182,50.903752 86.926623 0 0 -36.01072,-39.2458 z m 377.16446,104.5578 a 20.752793,21.815894 86.926601 0 0 -9.22414,-0.58526 20.752793,21.815894 86.926601 0 0 -18.53108,23.48045 l 0.0557,0.35396 a 20.752793,21.815894 86.926601 0 0 24.8159,17.20204 20.752793,21.815894 86.926601 0 0 18.31921,-23.63124 20.752793,21.815894 86.926601 0 0 -15.43563,-16.81995 z m 84.42719,20.52712 a 20.752793,21.815894 86.926601 0 0 -9.2243,-0.58529 20.752793,21.815894 86.926601 0 0 -18.531,23.48045 l 0.054,0.35352 a 20.752793,21.815894 86.926601 0 0 24.8159,17.20204 20.752793,21.815894 86.926601 0 0 18.3193,-23.63122 20.752793,21.815894 86.926601 0 0 -15.4338,-16.8195 z m -53.2258,29.9599 a 20.752793,21.815894 86.926601 0 0 -9.22373,-0.58718 20.752793,21.815894 86.926601 0 0 -18.53161,23.48235 l 0.0557,0.35395 a 20.752793,21.815894 86.926601 0 0 24.81584,17.20205 20.752793,21.815894 86.926601 0 0 18.3174,-23.63169 20.752793,21.815894 86.926601 0 0 -15.4337,-16.81948 z M 641.50831,592.48259 c -7.36508,-1.79069 -14.93245,2.74811 -16.96603,10.17597 l -5.87307,21.452 -27.8975,-6.78283 c -7.15078,-1.7386 -14.49644,2.6672 -16.47085,9.87895 l -2.7831,10.16557 c -1.97441,7.21174 2.1925,14.41666 9.34328,16.15525 l 27.8975,6.78284 -6.24026,22.79322 c -2.03358,7.42786 2.25909,14.85024 9.62417,16.64094 l 8.58964,2.08844 c 7.36508,1.7907 14.93057,-2.74856 16.96415,-10.17642 l 6.24026,-22.79322 23.67803,5.75693 c 7.15078,1.7386 14.49644,-2.66722 16.47085,-9.87896 l 2.7831,-10.16557 c 1.97441,-7.21175 -2.1925,-14.41665 -9.34328,-16.15525 l -23.67803,-5.75693 5.87307,-21.45201 c 2.03358,-7.42785 -2.25721,-14.84978 -9.62229,-16.64048 z m 270.91446,68.20272 a 48.423182,50.903752 86.926623 0 0 -21.52221,-1.3688 48.423182,50.903752 86.926623 0 0 -43.23975,54.78961 l 0.12708,0.8272 a 48.423182,50.903752 86.926623 0 0 57.90652,40.13811 48.423182,50.903752 86.926623 0 0 42.74097,-55.13984 48.423182,50.903752 86.926623 0 0 -36.01261,-39.24628 z" />
|
||||||
|
</clipPath>
|
||||||
|
<linearGradient
|
||||||
|
inkscape:collect="always"
|
||||||
|
xlink:href="#linearGradient1152"
|
||||||
|
id="linearGradient888"
|
||||||
|
gradientUnits="userSpaceOnUse"
|
||||||
|
gradientTransform="matrix(0.96445087,0.23449084,-0.26629564,0.97267307,398.764,38.857662)"
|
||||||
|
x1="-398"
|
||||||
|
y1="56"
|
||||||
|
x2="1522"
|
||||||
|
y2="1136" />
|
||||||
|
<clipPath
|
||||||
|
clipPathUnits="userSpaceOnUse"
|
||||||
|
id="clipPath890">
|
||||||
|
<path
|
||||||
|
id="path892"
|
||||||
|
style="display:none;fill:url(#linearGradient894)"
|
||||||
|
d="m 1138.793,269.14648 a 21.88452,20.676565 0 0 0 -9.1231,1.59766 21.88452,20.676565 0 0 0 -11.7656,26.97656 l 0.1484,0.32813 a 21.88452,20.676565 0 0 0 28.7032,10.76562 21.88452,20.676565 0 0 0 11.5175,-27.07226 21.88452,20.676565 0 0 0 -19.4804,-12.59571 z m -327.22269,13.7754 c -7.41435,0 -13.38476,5.96846 -13.38476,13.38281 v 83.50976 c 0,7.41436 5.97041,13.38282 13.38476,13.38282 h 206.66799 c 7.4143,0 13.3828,-5.96846 13.3828,-13.38282 v -83.50976 c 0,-7.41435 -5.9685,-13.38281 -13.3828,-13.38281 z m -109.57617,13.80664 a 51.063881,48.245316 0 0 0 -21.28906,3.7246 51.063881,48.245316 0 0 0 -27.45313,62.94727 l 0.34375,0.76758 a 51.063881,48.245316 0 0 0 66.97657,25.11914 51.063881,48.245316 0 0 0 26.875,-63.16797 51.063881,48.245316 0 0 0 -45.45313,-29.39062 z m 394.48826,12.39257 a 21.88452,20.676565 0 0 0 -9.123,1.59766 21.88452,20.676565 0 0 0 -11.7656,26.97656 l 0.1484,0.32813 a 21.88452,20.676565 0 0 0 28.7031,10.76562 21.88452,20.676565 0 0 0 11.5195,-27.07226 21.88452,20.676565 0 0 0 -19.4824,-12.59571 z m 87.5391,0 a 21.88452,20.676565 0 0 0 -9.1231,1.59766 21.88452,20.676565 0 0 0 -11.7656,26.97656 l 0.1465,0.32813 a 21.88452,20.676565 0 0 0 28.7031,10.76562 21.88452,20.676565 0 0 0 11.5196,-27.07226 21.88452,20.676565 0 0 0 -19.4805,-12.59571 z m -43.7695,41.35352 a 21.88452,20.676565 0 0 0 -9.1231,1.5957 21.88452,20.676565 0 0 0 -11.7656,26.97852 l 0.1484,0.32812 a 21.88452,20.676565 0 0 0 28.7031,10.76563 21.88452,20.676565 0 0 0 11.5176,-27.07227 21.88452,20.676565 0 0 0 -19.4804,-12.5957 z m -358.91997,70.29101 c -7.63655,10e-6 -13.78515,6.14862 -13.78515,13.78516 v 22.05469 h -28.92579 c -7.41435,0 -13.38281,5.96845 -13.38281,13.38281 v 10.45117 c 0,7.41435 5.96846,13.38282 13.38281,13.38282 h 28.92579 v 23.43359 c 0,7.63654 6.1486,13.78516 13.78515,13.78516 h 8.90625 c 7.63655,0 13.7832,-6.14862 13.7832,-13.78516 v -23.43359 h 24.55079 c 7.41435,0 13.38281,-5.96847 13.38281,-13.38282 v -10.45117 c 0,-7.41436 -5.96846,-13.38281 -13.38281,-13.38281 h -24.55079 v -22.05469 c 0,-7.63654 -6.14665,-13.78516 -13.7832,-13.78516 z m 281.52147,2.25 a 51.063881,48.245316 0 0 0 -21.2871,3.72461 51.063881,48.245316 0 0 0 -27.4531,62.94727 l 0.3437,0.76758 a 51.063881,48.245316 0 0 0 66.9766,25.11914 51.063881,48.245316 0 0 0 26.875,-63.16797 51.063881,48.245316 0 0 0 -45.4551,-29.39063 z" />
|
||||||
|
<path
|
||||||
|
id="lpe_path-effect904"
|
||||||
|
style="fill:url(#linearGradient894)"
|
||||||
|
class="powerclip"
|
||||||
|
d="M 571.42297,222.78436 H 1252.5483 V 563.60941 H 571.42297 Z m 567.37003,46.36212 a 21.88452,20.676565 0 0 0 -9.1231,1.59766 21.88452,20.676565 0 0 0 -11.7656,26.97656 l 0.1484,0.32813 a 21.88452,20.676565 0 0 0 28.7032,10.76562 21.88452,20.676565 0 0 0 11.5175,-27.07226 21.88452,20.676565 0 0 0 -19.4804,-12.59571 z m -327.22269,13.7754 c -7.41435,0 -13.38476,5.96846 -13.38476,13.38281 v 83.50976 c 0,7.41436 5.97041,13.38282 13.38476,13.38282 h 206.66799 c 7.4143,0 13.3828,-5.96846 13.3828,-13.38282 v -83.50976 c 0,-7.41435 -5.9685,-13.38281 -13.3828,-13.38281 z m -109.57617,13.80664 a 51.063881,48.245316 0 0 0 -21.28906,3.7246 51.063881,48.245316 0 0 0 -27.45313,62.94727 l 0.34375,0.76758 a 51.063881,48.245316 0 0 0 66.97657,25.11914 51.063881,48.245316 0 0 0 26.875,-63.16797 51.063881,48.245316 0 0 0 -45.45313,-29.39062 z m 394.48826,12.39257 a 21.88452,20.676565 0 0 0 -9.123,1.59766 21.88452,20.676565 0 0 0 -11.7656,26.97656 l 0.1484,0.32813 a 21.88452,20.676565 0 0 0 28.7031,10.76562 21.88452,20.676565 0 0 0 11.5195,-27.07226 21.88452,20.676565 0 0 0 -19.4824,-12.59571 z m 87.5391,0 a 21.88452,20.676565 0 0 0 -9.1231,1.59766 21.88452,20.676565 0 0 0 -11.7656,26.97656 l 0.1465,0.32813 a 21.88452,20.676565 0 0 0 28.7031,10.76562 21.88452,20.676565 0 0 0 11.5196,-27.07226 21.88452,20.676565 0 0 0 -19.4805,-12.59571 z m -43.7695,41.35352 a 21.88452,20.676565 0 0 0 -9.1231,1.5957 21.88452,20.676565 0 0 0 -11.7656,26.97852 l 0.1484,0.32812 a 21.88452,20.676565 0 0 0 28.7031,10.76563 21.88452,20.676565 0 0 0 11.5176,-27.07227 21.88452,20.676565 0 0 0 -19.4804,-12.5957 z m -358.91997,70.29101 c -7.63655,10e-6 -13.78515,6.14862 -13.78515,13.78516 v 22.05469 h -28.92579 c -7.41435,0 -13.38281,5.96845 -13.38281,13.38281 v 10.45117 c 0,7.41435 5.96846,13.38282 13.38281,13.38282 h 28.92579 v 23.43359 c 0,7.63654 6.1486,13.78516 13.78515,13.78516 h 8.90625 c 7.63655,0 13.7832,-6.14862 13.7832,-13.78516 v -23.43359 h 24.55079 c 7.41435,0 13.38281,-5.96847 13.38281,-13.38282 v -10.45117 c 0,-7.41436 -5.96846,-13.38281 -13.38281,-13.38281 h -24.55079 v -22.05469 c 0,-7.63654 -6.14665,-13.78516 -13.7832,-13.78516 z m 281.52147,2.25 a 51.063881,48.245316 0 0 0 -21.2871,3.72461 51.063881,48.245316 0 0 0 -27.4531,62.94727 l 0.3437,0.76758 a 51.063881,48.245316 0 0 0 66.9766,25.11914 51.063881,48.245316 0 0 0 26.875,-63.16797 51.063881,48.245316 0 0 0 -45.4551,-29.39063 z" />
|
||||||
|
</clipPath>
|
||||||
|
<linearGradient
|
||||||
|
inkscape:collect="always"
|
||||||
|
xlink:href="#linearGradient1152"
|
||||||
|
id="linearGradient894"
|
||||||
|
gradientUnits="userSpaceOnUse"
|
||||||
|
gradientTransform="translate(398,-56)"
|
||||||
|
x1="-398"
|
||||||
|
y1="56"
|
||||||
|
x2="1522"
|
||||||
|
y2="1136" />
|
||||||
|
</defs>
|
||||||
|
<g
|
||||||
|
inkscape:label="Ebene 1"
|
||||||
|
inkscape:groupmode="layer"
|
||||||
|
id="layer1">
|
||||||
|
<rect
|
||||||
|
style="fill:url(#linearGradient1154);fill-opacity:1"
|
||||||
|
id="rect1033"
|
||||||
|
width="1920"
|
||||||
|
height="1080"
|
||||||
|
x="0"
|
||||||
|
y="0"
|
||||||
|
rx="0"
|
||||||
|
ry="0" />
|
||||||
|
<path
|
||||||
|
style="fill:#ffffff;fill-opacity:1;stroke-width:1.41813"
|
||||||
|
id="rect2078"
|
||||||
|
width="671.12531"
|
||||||
|
height="330.82504"
|
||||||
|
x="576.42297"
|
||||||
|
y="227.78436"
|
||||||
|
ry="110.27502"
|
||||||
|
sodipodi:type="rect"
|
||||||
|
clip-path="url(#clipPath890)"
|
||||||
|
inkscape:path-effect="#path-effect904"
|
||||||
|
d="m 686.69799,227.78436 h 450.57531 c 61.0923,0 110.275,49.18266 110.275,110.27502 v 110.27501 c 0,61.09236 -49.1827,110.27502 -110.275,110.27502 H 686.69799 c -61.09236,0 -110.27502,-49.18266 -110.27502,-110.27502 V 338.05938 c 0,-61.09236 49.18266,-110.27502 110.27502,-110.27502 z" />
|
||||||
|
<path
|
||||||
|
style="fill:#ffffff;fill-opacity:1;stroke-width:1.41852"
|
||||||
|
id="rect2146"
|
||||||
|
width="199.30905"
|
||||||
|
height="504.61328"
|
||||||
|
x="917.35657"
|
||||||
|
y="488.93158"
|
||||||
|
ry="97.030388"
|
||||||
|
transform="matrix(0.97214881,-0.23436445,0.26615211,0.96393104,0,0)"
|
||||||
|
sodipodi:type="rect"
|
||||||
|
clip-path="url(#clipPath884)"
|
||||||
|
inkscape:path-effect="#path-effect900"
|
||||||
|
d="m 1014.387,488.93158 h 5.2482 c 53.7549,0 97.0304,43.27555 97.0304,97.03039 v 310.5525 c 0,53.75484 -43.2755,97.03039 -97.0304,97.03039 h -5.2482 c -53.75488,0 -97.03043,-43.27555 -97.03043,-97.03039 v -310.5525 c 0,-53.75484 43.27555,-97.03039 97.03043,-97.03039 z" />
|
||||||
|
<path
|
||||||
|
style="fill:#ffffff;fill-opacity:1;stroke-width:1.41852"
|
||||||
|
id="rect2146-3"
|
||||||
|
width="200.94308"
|
||||||
|
height="502.92538"
|
||||||
|
x="641.0108"
|
||||||
|
y="61.943474"
|
||||||
|
ry="97.050156"
|
||||||
|
transform="matrix(0.97237519,0.23342343,-0.26569554,0.96405699,0,0)"
|
||||||
|
sodipodi:type="rect"
|
||||||
|
clip-path="url(#clipPath878)"
|
||||||
|
inkscape:path-effect="#path-effect896"
|
||||||
|
d="m 738.06096,61.943474 h 6.84277 c 53.76579,0 97.05016,43.284366 97.05016,97.050156 V 467.8187 c 0,53.76579 -43.28437,97.05016 -97.05016,97.05016 h -6.84277 c -53.76579,0 -97.05016,-43.28437 -97.05016,-97.05016 V 158.99363 c 0,-53.76579 43.28437,-97.050156 97.05016,-97.050156 z" />
|
||||||
|
<rect
|
||||||
|
style="fill:#ffffff;fill-opacity:1;stroke-width:1.41813"
|
||||||
|
id="rect2384"
|
||||||
|
width="87.538078"
|
||||||
|
height="55.137505"
|
||||||
|
x="649.37134"
|
||||||
|
y="214"
|
||||||
|
ry="27.568752" />
|
||||||
|
<rect
|
||||||
|
style="fill:#ffffff;fill-opacity:1;stroke-width:1.41813"
|
||||||
|
id="rect2384-6"
|
||||||
|
width="87.538078"
|
||||||
|
height="55.137505"
|
||||||
|
x="1089.9797"
|
||||||
|
y="214"
|
||||||
|
ry="27.568752" />
|
||||||
|
</g>
|
||||||
|
</svg>
|
||||||
|
After Width: | Height: | Size: 24 KiB |
@@ -3,25 +3,26 @@ org.gradle.jvmargs=-Xmx1G
|
|||||||
|
|
||||||
# Fabric Properties
|
# Fabric Properties
|
||||||
# check these on https://fabricmc.net/use
|
# check these on https://fabricmc.net/use
|
||||||
minecraft_version=1.18.1
|
minecraft_version=1.19
|
||||||
yarn_mappings=1.18.1+build.22
|
yarn_mappings=1.19+build.1
|
||||||
loader_version=0.13.3
|
loader_version=0.14.7
|
||||||
|
|
||||||
# Mod Properties
|
# Mod Properties
|
||||||
mod_version = 0.3.0
|
mod_version = 1.3.0
|
||||||
maven_group = eu.midnightdust
|
maven_group = eu.midnightdust
|
||||||
archives_base_name = midnightcontrols
|
archives_base_name = midnightcontrols
|
||||||
modrinth_id=bXX9h73M
|
modrinth_id=bXX9h73M
|
||||||
|
|
||||||
# Dependencies
|
# Dependencies
|
||||||
# currently not on the main fabric site, check on the maven: https://maven.fabricmc.net/net/fabricmc/fabric-api/fabric-api
|
# currently not on the main fabric site, check on the maven: https://maven.fabricmc.net/net/fabricmc/fabric-api/fabric-api
|
||||||
fabric_version=0.46.6+1.18
|
fabric_version=0.55.2+1.19
|
||||||
spruceui_version=3.3.2+1.17
|
sodium_version=mc1.19-0.4.2
|
||||||
midnightlib_version=0.4.0
|
spruceui_version=4.0.0+1.19
|
||||||
modmenu_version=2.0.2
|
midnightlib_version=0.5.2
|
||||||
emotecraft_version=2.1-MC1.18.1-fabric
|
modmenu_version=4.0.0
|
||||||
|
emotecraft_version=2.1.3-SNAPSHOT-build.29-MC1.19-fabric
|
||||||
bendylib_version=2.0.+
|
bendylib_version=2.0.+
|
||||||
rei_version=7.4.456
|
emi_version=0.1.1+1.18.2
|
||||||
|
|
||||||
# Ok Zoomer and LibZoomer are temporarily disabled for the time being, as we are currently using Reflection at runtime instead in OkZoomerCompat due to there being two major, completely incompatible API versions.
|
# Ok Zoomer and LibZoomer are temporarily disabled for the time being, as we are currently using Reflection at runtime instead in OkZoomerCompat due to there being two major, completely incompatible API versions.
|
||||||
# ok_zoomer_version=5.0.0-beta.3+1.17.1
|
# ok_zoomer_version=5.0.0-beta.3+1.17.1
|
||||||
|
|||||||
@@ -24,7 +24,8 @@ import java.util.Optional;
|
|||||||
*/
|
*/
|
||||||
public enum ControlsMode implements Nameable {
|
public enum ControlsMode implements Nameable {
|
||||||
DEFAULT,
|
DEFAULT,
|
||||||
CONTROLLER;
|
CONTROLLER,
|
||||||
|
TOUCHSCREEN;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Returns the next controls mode available.
|
* Returns the next controls mode available.
|
||||||
|
|||||||
@@ -16,7 +16,7 @@ import net.fabricmc.fabric.api.networking.v1.ServerPlayNetworking;
|
|||||||
import net.fabricmc.loader.api.FabricLoader;
|
import net.fabricmc.loader.api.FabricLoader;
|
||||||
import net.fabricmc.loader.api.ModContainer;
|
import net.fabricmc.loader.api.ModContainer;
|
||||||
import net.minecraft.network.PacketByteBuf;
|
import net.minecraft.network.PacketByteBuf;
|
||||||
import net.minecraft.text.TranslatableText;
|
import net.minecraft.text.Text;
|
||||||
import net.minecraft.util.Identifier;
|
import net.minecraft.util.Identifier;
|
||||||
import org.apache.logging.log4j.LogManager;
|
import org.apache.logging.log4j.LogManager;
|
||||||
import org.apache.logging.log4j.Logger;
|
import org.apache.logging.log4j.Logger;
|
||||||
@@ -37,14 +37,14 @@ public class MidnightControls implements ModInitializer {
|
|||||||
public static final Identifier CONTROLS_MODE_CHANNEL = new Identifier(MidnightControlsConstants.CONTROLS_MODE_CHANNEL.toString());
|
public static final Identifier CONTROLS_MODE_CHANNEL = new Identifier(MidnightControlsConstants.CONTROLS_MODE_CHANNEL.toString());
|
||||||
public static final Identifier FEATURE_CHANNEL = new Identifier(MidnightControlsConstants.FEATURE_CHANNEL.toString());
|
public static final Identifier FEATURE_CHANNEL = new Identifier(MidnightControlsConstants.FEATURE_CHANNEL.toString());
|
||||||
public static final Identifier HELLO_CHANNEL = new Identifier(MidnightControlsConstants.HELLO_CHANNEL.toString());
|
public static final Identifier HELLO_CHANNEL = new Identifier(MidnightControlsConstants.HELLO_CHANNEL.toString());
|
||||||
|
public static boolean isExtrasLoaded;
|
||||||
public static final TranslatableText NOT_BOUND_TEXT = new TranslatableText("midnightcontrols.not_bound");
|
|
||||||
|
|
||||||
public final Logger logger = LogManager.getLogger("MidnightControls");
|
public final Logger logger = LogManager.getLogger("MidnightControls");
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void onInitialize() {
|
public void onInitialize() {
|
||||||
INSTANCE = this;
|
INSTANCE = this;
|
||||||
|
isExtrasLoaded = FabricLoader.getInstance().isModLoaded("midnightcontrols-extra");
|
||||||
this.log("Initializing MidnightControls...");
|
this.log("Initializing MidnightControls...");
|
||||||
|
|
||||||
ServerPlayNetworking.registerGlobalReceiver(HELLO_CHANNEL, (server, player, handler, buf, responseSender) -> {
|
ServerPlayNetworking.registerGlobalReceiver(HELLO_CHANNEL, (server, player, handler, buf, responseSender) -> {
|
||||||
|
|||||||
@@ -61,7 +61,7 @@ public class MidnightControlsFeature implements Nameable {
|
|||||||
* @return {@code true} if this feature is allowed, else {@code false}
|
* @return {@code true} if this feature is allowed, else {@code false}
|
||||||
*/
|
*/
|
||||||
public boolean isAllowed() {
|
public boolean isAllowed() {
|
||||||
return this.allowed;
|
return MidnightControls.isExtrasLoaded && this.allowed;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|||||||
@@ -9,9 +9,7 @@
|
|||||||
|
|
||||||
package eu.midnightdust.midnightcontrols.client;
|
package eu.midnightdust.midnightcontrols.client;
|
||||||
|
|
||||||
import net.minecraft.text.LiteralText;
|
|
||||||
import net.minecraft.text.Text;
|
import net.minecraft.text.Text;
|
||||||
import net.minecraft.text.TranslatableText;
|
|
||||||
import org.aperlambda.lambdacommon.utils.Nameable;
|
import org.aperlambda.lambdacommon.utils.Nameable;
|
||||||
import org.jetbrains.annotations.NotNull;
|
import org.jetbrains.annotations.NotNull;
|
||||||
|
|
||||||
@@ -26,22 +24,22 @@ import java.util.Optional;
|
|||||||
* @since 1.0.0
|
* @since 1.0.0
|
||||||
*/
|
*/
|
||||||
public enum ControllerType implements Nameable {
|
public enum ControllerType implements Nameable {
|
||||||
DEFAULT(0, new LiteralText("Default")),
|
DEFAULT(0, Text.of("Default")),
|
||||||
DUALSHOCK(1, new LiteralText("Dualshock")),
|
DUALSHOCK(1, Text.of("Dualshock")),
|
||||||
DUALSENSE(2, new LiteralText("Dualsense")),
|
DUALSENSE(2, Text.of("Dualsense")),
|
||||||
SWITCH(3, new LiteralText("Switch")),
|
SWITCH(3, Text.of("Switch")),
|
||||||
XBOX_360(4, new LiteralText("Xbox 360")),
|
XBOX_360(4, Text.of("Xbox 360")),
|
||||||
XBOX(5, new LiteralText("Xbox")),
|
XBOX(5, Text.of("Xbox")),
|
||||||
STEAM_DECK(6, new LiteralText("Steam Deck")),
|
STEAM_DECK(6, Text.of("Steam Deck")),
|
||||||
STEAM_CONTROLLER(7, new LiteralText("Steam Controller")),
|
STEAM_CONTROLLER(7, Text.of("Steam Controller")),
|
||||||
OUYA(8, new LiteralText("Ouya"));
|
OUYA(8, Text.of("Ouya"));
|
||||||
|
|
||||||
private final int id;
|
private final int id;
|
||||||
private final Text text;
|
private final Text text;
|
||||||
|
|
||||||
ControllerType(int id) {
|
ControllerType(int id) {
|
||||||
this.id = id;
|
this.id = id;
|
||||||
this.text = new TranslatableText("midnightcontrols.controller_type." + this.getName());
|
this.text = Text.translatable("midnightcontrols.controller_type." + this.getName());
|
||||||
}
|
}
|
||||||
|
|
||||||
ControllerType(int id, @NotNull Text text) {
|
ControllerType(int id, @NotNull Text text) {
|
||||||
|
|||||||
@@ -10,7 +10,6 @@
|
|||||||
package eu.midnightdust.midnightcontrols.client;
|
package eu.midnightdust.midnightcontrols.client;
|
||||||
|
|
||||||
import net.minecraft.text.Text;
|
import net.minecraft.text.Text;
|
||||||
import net.minecraft.text.TranslatableText;
|
|
||||||
import org.aperlambda.lambdacommon.utils.Nameable;
|
import org.aperlambda.lambdacommon.utils.Nameable;
|
||||||
import org.jetbrains.annotations.NotNull;
|
import org.jetbrains.annotations.NotNull;
|
||||||
|
|
||||||
@@ -31,7 +30,7 @@ public enum HudSide implements Nameable {
|
|||||||
private final Text text;
|
private final Text text;
|
||||||
|
|
||||||
HudSide() {
|
HudSide() {
|
||||||
this.text = new TranslatableText(this.getTranslationKey());
|
this.text = Text.translatable(this.getTranslationKey());
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|||||||
@@ -16,10 +16,13 @@ import eu.midnightdust.midnightcontrols.MidnightControlsConstants;
|
|||||||
import eu.midnightdust.midnightcontrols.MidnightControlsFeature;
|
import eu.midnightdust.midnightcontrols.MidnightControlsFeature;
|
||||||
import eu.midnightdust.midnightcontrols.client.compat.MidnightControlsCompat;
|
import eu.midnightdust.midnightcontrols.client.compat.MidnightControlsCompat;
|
||||||
import eu.midnightdust.midnightcontrols.client.controller.ButtonBinding;
|
import eu.midnightdust.midnightcontrols.client.controller.ButtonBinding;
|
||||||
|
import eu.midnightdust.midnightcontrols.client.controller.ButtonCategory;
|
||||||
import eu.midnightdust.midnightcontrols.client.controller.Controller;
|
import eu.midnightdust.midnightcontrols.client.controller.Controller;
|
||||||
import eu.midnightdust.midnightcontrols.client.controller.InputManager;
|
import eu.midnightdust.midnightcontrols.client.controller.InputManager;
|
||||||
import eu.midnightdust.midnightcontrols.client.gui.MidnightControlsHud;
|
import eu.midnightdust.midnightcontrols.client.gui.MidnightControlsHud;
|
||||||
|
import eu.midnightdust.midnightcontrols.client.gui.RingScreen;
|
||||||
import eu.midnightdust.midnightcontrols.client.gui.TouchscreenOverlay;
|
import eu.midnightdust.midnightcontrols.client.gui.TouchscreenOverlay;
|
||||||
|
import eu.midnightdust.midnightcontrols.client.mixin.KeyBindingRegistryImplAccessor;
|
||||||
import eu.midnightdust.midnightcontrols.client.ring.KeyBindingRingAction;
|
import eu.midnightdust.midnightcontrols.client.ring.KeyBindingRingAction;
|
||||||
import eu.midnightdust.midnightcontrols.client.ring.MidnightRing;
|
import eu.midnightdust.midnightcontrols.client.ring.MidnightRing;
|
||||||
import dev.lambdaurora.spruceui.hud.HudManager;
|
import dev.lambdaurora.spruceui.hud.HudManager;
|
||||||
@@ -28,13 +31,15 @@ import net.fabricmc.fabric.api.client.event.lifecycle.v1.ClientTickEvents;
|
|||||||
import net.fabricmc.fabric.api.client.keybinding.v1.KeyBindingHelper;
|
import net.fabricmc.fabric.api.client.keybinding.v1.KeyBindingHelper;
|
||||||
import net.fabricmc.fabric.api.client.networking.v1.ClientPlayConnectionEvents;
|
import net.fabricmc.fabric.api.client.networking.v1.ClientPlayConnectionEvents;
|
||||||
import net.fabricmc.fabric.api.client.networking.v1.ClientPlayNetworking;
|
import net.fabricmc.fabric.api.client.networking.v1.ClientPlayNetworking;
|
||||||
|
import net.fabricmc.fabric.api.resource.ResourceManagerHelper;
|
||||||
|
import net.fabricmc.fabric.api.resource.ResourcePackActivationType;
|
||||||
|
import net.fabricmc.loader.api.FabricLoader;
|
||||||
import net.minecraft.client.MinecraftClient;
|
import net.minecraft.client.MinecraftClient;
|
||||||
import net.minecraft.client.network.ClientPlayNetworkHandler;
|
import net.minecraft.client.network.ClientPlayNetworkHandler;
|
||||||
import net.minecraft.client.option.KeyBinding;
|
import net.minecraft.client.option.KeyBinding;
|
||||||
import net.minecraft.client.toast.SystemToast;
|
import net.minecraft.client.toast.SystemToast;
|
||||||
import net.minecraft.client.util.InputUtil;
|
import net.minecraft.client.util.InputUtil;
|
||||||
import net.minecraft.text.LiteralText;
|
import net.minecraft.text.Text;
|
||||||
import net.minecraft.text.TranslatableText;
|
|
||||||
import net.minecraft.util.Identifier;
|
import net.minecraft.util.Identifier;
|
||||||
import org.jetbrains.annotations.NotNull;
|
import org.jetbrains.annotations.NotNull;
|
||||||
import org.lwjgl.glfw.GLFW;
|
import org.lwjgl.glfw.GLFW;
|
||||||
@@ -49,6 +54,7 @@ import java.io.File;
|
|||||||
* @since 1.1.0
|
* @since 1.1.0
|
||||||
*/
|
*/
|
||||||
public class MidnightControlsClient extends MidnightControls implements ClientModInitializer {
|
public class MidnightControlsClient extends MidnightControls implements ClientModInitializer {
|
||||||
|
public static boolean lateInitDone = false;
|
||||||
private static MidnightControlsClient INSTANCE;
|
private static MidnightControlsClient INSTANCE;
|
||||||
public static final KeyBinding BINDING_LOOK_UP = InputManager.makeKeyBinding(new Identifier(MidnightControlsConstants.NAMESPACE, "look_up"),
|
public static final KeyBinding BINDING_LOOK_UP = InputManager.makeKeyBinding(new Identifier(MidnightControlsConstants.NAMESPACE, "look_up"),
|
||||||
InputUtil.Type.KEYSYM, GLFW.GLFW_KEY_KP_8, "key.categories.movement");
|
InputUtil.Type.KEYSYM, GLFW.GLFW_KEY_KP_8, "key.categories.movement");
|
||||||
@@ -58,8 +64,8 @@ public class MidnightControlsClient extends MidnightControls implements ClientMo
|
|||||||
InputUtil.Type.KEYSYM, GLFW.GLFW_KEY_KP_2, "key.categories.movement");
|
InputUtil.Type.KEYSYM, GLFW.GLFW_KEY_KP_2, "key.categories.movement");
|
||||||
public static final KeyBinding BINDING_LOOK_LEFT = InputManager.makeKeyBinding(new Identifier(MidnightControlsConstants.NAMESPACE, "look_left"),
|
public static final KeyBinding BINDING_LOOK_LEFT = InputManager.makeKeyBinding(new Identifier(MidnightControlsConstants.NAMESPACE, "look_left"),
|
||||||
InputUtil.Type.KEYSYM, GLFW.GLFW_KEY_KP_4, "key.categories.movement");
|
InputUtil.Type.KEYSYM, GLFW.GLFW_KEY_KP_4, "key.categories.movement");
|
||||||
/*public static final KeyBinding BINDING_RING = InputManager.makeKeyBinding(new Identifier(midnightcontrolsConstants.NAMESPACE, "ring"),
|
public static final KeyBinding BINDING_RING = InputManager.makeKeyBinding(new Identifier(MidnightControlsConstants.NAMESPACE, "ring"),
|
||||||
InputUtil.Type.MOUSE, GLFW.GLFW_MOUSE_BUTTON_5, "key.categories.misc");*/
|
InputUtil.Type.KEYSYM, InputUtil.UNKNOWN_KEY.getCode(), "key.categories.misc");
|
||||||
public static final Identifier CONTROLLER_BUTTONS = new Identifier(MidnightControlsConstants.NAMESPACE, "textures/gui/controller_buttons.png");
|
public static final Identifier CONTROLLER_BUTTONS = new Identifier(MidnightControlsConstants.NAMESPACE, "textures/gui/controller_buttons.png");
|
||||||
public static final Identifier CONTROLLER_EXPANDED = new Identifier(MidnightControlsConstants.NAMESPACE, "textures/gui/controller_expanded.png");
|
public static final Identifier CONTROLLER_EXPANDED = new Identifier(MidnightControlsConstants.NAMESPACE, "textures/gui/controller_expanded.png");
|
||||||
public static final Identifier CONTROLLER_AXIS = new Identifier(MidnightControlsConstants.NAMESPACE, "textures/gui/controller_axis.png");
|
public static final Identifier CONTROLLER_AXIS = new Identifier(MidnightControlsConstants.NAMESPACE, "textures/gui/controller_axis.png");
|
||||||
@@ -81,10 +87,10 @@ public class MidnightControlsClient extends MidnightControls implements ClientMo
|
|||||||
//KeyBindingHelper.registerKeyBinding(BINDING_RING);
|
//KeyBindingHelper.registerKeyBinding(BINDING_RING);
|
||||||
|
|
||||||
this.ring.registerAction("keybinding", KeyBindingRingAction.FACTORY);
|
this.ring.registerAction("keybinding", KeyBindingRingAction.FACTORY);
|
||||||
|
this.ring.load();
|
||||||
|
|
||||||
ClientPlayNetworking.registerGlobalReceiver(CONTROLS_MODE_CHANNEL, (client, handler, buf, responseSender) -> {
|
ClientPlayNetworking.registerGlobalReceiver(CONTROLS_MODE_CHANNEL, (client, handler, buf, responseSender) ->
|
||||||
responseSender.sendPacket(CONTROLS_MODE_CHANNEL, this.makeControlsModeBuffer(MidnightControlsConfig.controlsMode));
|
responseSender.sendPacket(CONTROLS_MODE_CHANNEL, this.makeControlsModeBuffer(MidnightControlsConfig.controlsMode)));
|
||||||
});
|
|
||||||
ClientPlayNetworking.registerGlobalReceiver(FEATURE_CHANNEL, (client, handler, buf, responseSender) -> {
|
ClientPlayNetworking.registerGlobalReceiver(FEATURE_CHANNEL, (client, handler, buf, responseSender) -> {
|
||||||
int features = buf.readVarInt();
|
int features = buf.readVarInt();
|
||||||
for (int i = 0; i < features; i++) {
|
for (int i = 0; i < features; i++) {
|
||||||
@@ -100,20 +106,22 @@ public class MidnightControlsClient extends MidnightControls implements ClientMo
|
|||||||
ClientPlayConnectionEvents.DISCONNECT.register(this::onLeave);
|
ClientPlayConnectionEvents.DISCONNECT.register(this::onLeave);
|
||||||
|
|
||||||
ClientTickEvents.START_CLIENT_TICK.register(this.reacharound::tick);
|
ClientTickEvents.START_CLIENT_TICK.register(this.reacharound::tick);
|
||||||
ClientTickEvents.END_CLIENT_TICK.register(this::onTick);
|
ClientTickEvents.START_CLIENT_TICK.register(this::onTick);
|
||||||
|
|
||||||
OpenScreenCallback.EVENT.register((client, screen) -> {
|
OpenScreenCallback.EVENT.register((client, screen) -> {
|
||||||
// if (screen == null && MidnightControlsConfig.controlsMode == ControlsMode.TOUCHSCREEN) {
|
if (screen == null && MidnightControlsConfig.controlsMode == ControlsMode.TOUCHSCREEN) {
|
||||||
// screen = new TouchscreenOverlay(this);
|
screen = new TouchscreenOverlay(this);
|
||||||
// screen.init(client, client.getWindow().getScaledWidth(), client.getWindow().getScaledHeight());
|
screen.init(client, client.getWindow().getScaledWidth(), client.getWindow().getScaledHeight());
|
||||||
// client.skipGameRender = false;
|
client.skipGameRender = false;
|
||||||
// client.currentScreen = screen;
|
client.currentScreen = screen;
|
||||||
// } else if (screen != null) {
|
} else if (screen != null) {
|
||||||
this.input.onScreenOpen(client, client.getWindow().getWidth(), client.getWindow().getHeight());
|
this.input.onScreenOpen(client, client.getWindow().getWidth(), client.getWindow().getHeight());
|
||||||
//}
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
HudManager.register(this.hud = new MidnightControlsHud(this));
|
HudManager.register(this.hud = new MidnightControlsHud(this));
|
||||||
|
FabricLoader.getInstance().getModContainer("midnightcontrols").ifPresent(modContainer ->
|
||||||
|
ResourceManagerHelper.registerBuiltinResourcePack(new Identifier("midnightcontrols","bedrock"), modContainer, ResourcePackActivationType.NORMAL));
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@@ -127,10 +135,10 @@ public class MidnightControlsClient extends MidnightControls implements ClientMo
|
|||||||
GLFW.glfwSetJoystickCallback((jid, event) -> {
|
GLFW.glfwSetJoystickCallback((jid, event) -> {
|
||||||
if (event == GLFW.GLFW_CONNECTED) {
|
if (event == GLFW.GLFW_CONNECTED) {
|
||||||
var controller = Controller.byId(jid);
|
var controller = Controller.byId(jid);
|
||||||
client.getToastManager().add(new SystemToast(SystemToast.Type.TUTORIAL_HINT, new TranslatableText("midnightcontrols.controller.connected", jid),
|
client.getToastManager().add(new SystemToast(SystemToast.Type.TUTORIAL_HINT, Text.translatable("midnightcontrols.controller.connected", jid),
|
||||||
new LiteralText(controller.getName())));
|
Text.literal(controller.getName())));
|
||||||
} else if (event == GLFW.GLFW_DISCONNECTED) {
|
} else if (event == GLFW.GLFW_DISCONNECTED) {
|
||||||
client.getToastManager().add(new SystemToast(SystemToast.Type.TUTORIAL_HINT, new TranslatableText("midnightcontrols.controller.disconnected", jid),
|
client.getToastManager().add(new SystemToast(SystemToast.Type.TUTORIAL_HINT, Text.translatable("midnightcontrols.controller.disconnected", jid),
|
||||||
null));
|
null));
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -139,6 +147,35 @@ public class MidnightControlsClient extends MidnightControls implements ClientMo
|
|||||||
|
|
||||||
MidnightControlsCompat.init(this);
|
MidnightControlsCompat.init(this);
|
||||||
}
|
}
|
||||||
|
ButtonCategory category;
|
||||||
|
/**
|
||||||
|
* This method is called to initialize keybindings
|
||||||
|
*/
|
||||||
|
public void initKeybindings() {
|
||||||
|
if (lateInitDone) return;
|
||||||
|
if (KeyBindingRegistryImplAccessor.getModdedKeyBindings() == null || KeyBindingRegistryImplAccessor.getModdedKeyBindings().isEmpty()) return;
|
||||||
|
for (int i = 0; i < KeyBindingRegistryImplAccessor.getModdedKeyBindings().size(); ++i) {
|
||||||
|
KeyBinding keyBinding = KeyBindingRegistryImplAccessor.getModdedKeyBindings().get(i);
|
||||||
|
if (!keyBinding.getTranslationKey().contains("midnightcontrols") && !keyBinding.getTranslationKey().contains("ok_zoomer") && !keyBinding.getTranslationKey().contains("okzoomer")) {
|
||||||
|
category = null;
|
||||||
|
InputManager.streamCategories().forEach(buttonCategory -> {
|
||||||
|
if (buttonCategory.getIdentifier().equals(new org.aperlambda.lambdacommon.Identifier("minecraft", keyBinding.getCategory())))
|
||||||
|
category = buttonCategory;
|
||||||
|
});
|
||||||
|
if (category == null) {
|
||||||
|
category = new ButtonCategory(new org.aperlambda.lambdacommon.Identifier("minecraft", keyBinding.getCategory()));
|
||||||
|
InputManager.registerCategory(category);
|
||||||
|
}
|
||||||
|
ButtonBinding buttonBinding = new ButtonBinding.Builder(keyBinding.getTranslationKey()).category(category).linkKeybind(keyBinding).register();
|
||||||
|
if (MidnightControlsConfig.debug) {
|
||||||
|
logger.info(keyBinding.getTranslationKey());
|
||||||
|
logger.info(buttonBinding);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
InputManager.loadButtonBindings();
|
||||||
|
lateInitDone = true;
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* This method is called every Minecraft tick.
|
* This method is called every Minecraft tick.
|
||||||
@@ -146,15 +183,15 @@ public class MidnightControlsClient extends MidnightControls implements ClientMo
|
|||||||
* @param client the client instance
|
* @param client the client instance
|
||||||
*/
|
*/
|
||||||
public void onTick(@NotNull MinecraftClient client) {
|
public void onTick(@NotNull MinecraftClient client) {
|
||||||
|
this.initKeybindings();
|
||||||
this.input.tick(client);
|
this.input.tick(client);
|
||||||
if (MidnightControlsConfig.controlsMode == ControlsMode.CONTROLLER && (client.isWindowFocused() || MidnightControlsConfig.unfocusedInput))
|
if (MidnightControlsConfig.controlsMode == ControlsMode.CONTROLLER && (client.isWindowFocused() || MidnightControlsConfig.unfocusedInput))
|
||||||
this.input.tickController(client);
|
this.input.tickController(client);
|
||||||
|
|
||||||
/*if (BINDING_RING.wasPressed()) {
|
// if (BINDING_RING.wasPressed()) {
|
||||||
client.openScreen(new RingScreen());
|
// client.setScreen(new RingScreen());
|
||||||
}*/
|
// }
|
||||||
}
|
}
|
||||||
|
|
||||||
public void onRender(MinecraftClient client) {
|
public void onRender(MinecraftClient client) {
|
||||||
this.input.onRender(client.getTickDelta(), client);
|
this.input.onRender(client.getTickDelta(), client);
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -9,6 +9,7 @@
|
|||||||
|
|
||||||
package eu.midnightdust.midnightcontrols.client;
|
package eu.midnightdust.midnightcontrols.client;
|
||||||
|
|
||||||
|
import com.google.common.collect.Lists;
|
||||||
import eu.midnightdust.lib.config.MidnightConfig;
|
import eu.midnightdust.lib.config.MidnightConfig;
|
||||||
import eu.midnightdust.midnightcontrols.ControlsMode;
|
import eu.midnightdust.midnightcontrols.ControlsMode;
|
||||||
import eu.midnightdust.midnightcontrols.MidnightControlsFeature;
|
import eu.midnightdust.midnightcontrols.MidnightControlsFeature;
|
||||||
@@ -30,39 +31,40 @@ import static org.lwjgl.glfw.GLFW.GLFW_GAMEPAD_AXIS_LEFT_Y;
|
|||||||
*/
|
*/
|
||||||
public class MidnightControlsConfig extends MidnightConfig {
|
public class MidnightControlsConfig extends MidnightConfig {
|
||||||
// General
|
// General
|
||||||
@Entry public static ControlsMode controlsMode = ControlsMode.DEFAULT;
|
@Entry(name = "midnightcontrols.menu.controls_mode") public static ControlsMode controlsMode = ControlsMode.DEFAULT;
|
||||||
@Entry public static boolean autoSwitchMode = true;
|
@Entry(name = "midnightcontrols.menu.auto_switch_mode") public static boolean autoSwitchMode = true;
|
||||||
@Entry public static boolean debug = false;
|
@Entry(name = "Debug") public static boolean debug = false;
|
||||||
// HUD
|
// HUD
|
||||||
@Entry public static boolean hudEnable = true;
|
@Entry(name = "midnightcontrols.menu.hud_enable") public static boolean hudEnable = true;
|
||||||
@Entry public static HudSide hudSide = HudSide.LEFT;
|
@Entry(name = "midnightcontrols.menu.hud_side") public static HudSide hudSide = HudSide.LEFT;
|
||||||
// Gameplay
|
// Gameplay
|
||||||
@Entry public static boolean analogMovement = true;
|
@Entry(name = "midnightcontrols.menu.analog_movement") public static boolean analogMovement = true;
|
||||||
@Entry public static boolean fastBlockPlacing = false; // Disabled by default as this behaviour can be considered cheating on multiplayer servers.
|
@Entry(name = "midnightcontrols.menu.double_tap_to_sprint") public static boolean doubleTapToSprint = true;
|
||||||
@Entry public static boolean flyDrifting = true; // Enabled by default as disabling this behaviour can be considered cheating on multiplayer servers. It can also conflict with some other mods.
|
@Entry(name = "midnightcontrols.menu.fast_block_placing") public static boolean fastBlockPlacing = false; // Disabled by default as this behaviour can be considered cheating on multiplayer servers.
|
||||||
@Entry public static boolean verticalFlyDrifting = true; // Enabled by default as disabling this behaviour can be considered cheating on multiplayer servers.
|
@Entry(name = "midnightcontrols.menu.fly_drifting") public static boolean flyDrifting = true; // Enabled by default as disabling this behaviour can be considered cheating on multiplayer servers. It can also conflict with some other mods.
|
||||||
@Entry public static boolean horizontalReacharound = false; // Disabled by default as this behaviour can be considered cheating on multiplayer servers.
|
@Entry(name = "midnightcontrols.menu.fly_drifting_vertical") public static boolean verticalFlyDrifting = true; // Enabled by default as disabling this behaviour can be considered cheating on multiplayer servers.
|
||||||
@Entry public static boolean verticalReacharound = false; // Disabled by default as this behaviour can be considered cheating on multiplayer servers.
|
@Entry(name = "midnightcontrols.menu.reacharound.horizontal") public static boolean horizontalReacharound = false; // Disabled by default as this behaviour can be considered cheating on multiplayer servers.
|
||||||
@Entry public static boolean shouldRenderReacharoundOutline = true;
|
@Entry(name = "midnightcontrols.menu.reacharound.vertical") public static boolean verticalReacharound = false; // Disabled by default as this behaviour can be considered cheating on multiplayer servers.
|
||||||
@Entry public static int[] reacharoundOutlineColor = new int[]{255, 255, 255, 102};
|
@Entry(name = "Reacharound Outline") public static boolean shouldRenderReacharoundOutline = true;
|
||||||
// Controller
|
@Entry(name = "Reacharound Outline Color") public static int[] reacharoundOutlineColor = new int[]{255, 255, 255, 102};
|
||||||
@Entry public static ControllerType controllerType = ControllerType.DEFAULT;
|
@Entry(name = "midnightcontrols.menu.right_dead_zone") public static double rightDeadZone = 0.25;
|
||||||
@Entry public static double rightDeadZone = 0.25;
|
@Entry(name = "midnightcontrols.menu.left_dead_zone") public static double leftDeadZone = 0.25;
|
||||||
@Entry public static double leftDeadZone = 0.25;
|
@Entry(name = "midnightcontrols.menu.invert_right_y_axis") public static boolean invertRightYAxis = false;
|
||||||
@Entry public static boolean invertRightYAxis = false;
|
@Entry(name = "midnightcontrols.menu.invert_right_x_axis") public static boolean invertRightXAxis = false;
|
||||||
@Entry public static boolean invertRightXAxis = false;
|
@Entry(name = "midnightcontrols.menu.rotation_speed") public static double rotationSpeed = 40.0; //used for x axis, name kept for compatability
|
||||||
@Entry public static double DEFAULT_MAX_VALUE = 1;
|
@Entry(name = "midnightcontrols.menu.y_axis_rotation_speed") public static double yAxisRotationSpeed = rotationSpeed;
|
||||||
@Entry public static double rotationSpeed = 40.0;
|
@Entry(name = "midnightcontrols.menu.mouse_speed") public static double mouseSpeed = 25.0;
|
||||||
@Entry public static double mouseSpeed = 25.0;
|
@Entry(name = "midnightcontrols.menu.unfocused_input") public static boolean unfocusedInput = false;
|
||||||
@Entry public static boolean unfocusedInput = false;
|
@Entry(name = "midnightcontrols.menu.virtual_mouse") public static boolean virtualMouse = false;
|
||||||
@Entry public static boolean virtualMouse = false;
|
@Entry(name = "midnightcontrols.menu.virtual_mouse.skin") public static VirtualMouseSkin virtualMouseSkin = VirtualMouseSkin.DEFAULT_LIGHT;
|
||||||
@Entry public static VirtualMouseSkin virtualMouseSkin = VirtualMouseSkin.DEFAULT_LIGHT;
|
@Entry(name = "Controller ID") public static Object controllerID = 0;
|
||||||
@Entry public static Object controllerID = 0;
|
@Entry(name = "2nd Controller ID") public static Object secondControllerID = -1;
|
||||||
@Entry public static Object secondControllerID = -1;
|
@Entry(name = "midnightcontrols.menu.controller_type") public static ControllerType controllerType = ControllerType.DEFAULT;
|
||||||
@Entry public static Map<String, String> BINDINGS = Map.of();
|
@Entry(name = "Mouse screens") public static List<String> mouseScreens = Lists.newArrayList("me.jellysquid.mods.sodium.client.gui", "net.coderbot.iris.gui", "net.minecraft.client.gui.screen.advancement", "net.minecraft.client.gui.screen.pack.PackScreen", "net.minecraft.class_5375", "net.minecraft.class_457", "net.minecraft.class_408", "me.flashyreese.mods.reeses_sodium_options.client.gui", "dev.emi.emi.screen");
|
||||||
|
@Entry(name = "Keybindings") public static Map<String, String> BINDINGS = new HashMap<>();
|
||||||
|
|
||||||
private static final Pattern BUTTON_BINDING_PATTERN = Pattern.compile("(-?\\d+)\\+?");
|
private static final Pattern BUTTON_BINDING_PATTERN = Pattern.compile("(-?\\d+)\\+?");
|
||||||
@Entry public static double[] maxAnalogValues = new double[]{DEFAULT_MAX_VALUE, DEFAULT_MAX_VALUE, DEFAULT_MAX_VALUE, DEFAULT_MAX_VALUE};
|
@Entry(name = "Max analog values") public static double[] maxAnalogValues = new double[]{1, 1, 1, 1};
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Loads the configuration
|
* Loads the configuration
|
||||||
@@ -153,7 +155,7 @@ public class MidnightControlsConfig extends MidnightConfig {
|
|||||||
|
|
||||||
public static double getAxisMaxValue(int axis) {
|
public static double getAxisMaxValue(int axis) {
|
||||||
if (axis >= MidnightControlsConfig.maxAnalogValues.length)
|
if (axis >= MidnightControlsConfig.maxAnalogValues.length)
|
||||||
return DEFAULT_MAX_VALUE;
|
return 1;
|
||||||
return MidnightControlsConfig.maxAnalogValues[axis];
|
return MidnightControlsConfig.maxAnalogValues[axis];
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -250,4 +252,55 @@ public class MidnightControlsConfig extends MidnightConfig {
|
|||||||
public static boolean isMovementAxis(int axis) {
|
public static boolean isMovementAxis(int axis) {
|
||||||
return axis == GLFW_GAMEPAD_AXIS_LEFT_Y || axis == GLFW_GAMEPAD_AXIS_LEFT_X;
|
return axis == GLFW_GAMEPAD_AXIS_LEFT_Y || axis == GLFW_GAMEPAD_AXIS_LEFT_X;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public static void reset() {
|
||||||
|
controlsMode = ControlsMode.DEFAULT;
|
||||||
|
autoSwitchMode = true;
|
||||||
|
debug = false;
|
||||||
|
hudEnable = true;
|
||||||
|
hudSide = HudSide.LEFT;
|
||||||
|
analogMovement = true;
|
||||||
|
doubleTapToSprint = true;
|
||||||
|
fastBlockPlacing = false;
|
||||||
|
flyDrifting = true;
|
||||||
|
verticalFlyDrifting = true;
|
||||||
|
horizontalReacharound = false;
|
||||||
|
verticalReacharound = false;
|
||||||
|
shouldRenderReacharoundOutline = true;
|
||||||
|
reacharoundOutlineColor = new int[]{255, 255, 255, 102};
|
||||||
|
rightDeadZone = 0.25;
|
||||||
|
leftDeadZone = 0.25;
|
||||||
|
invertRightYAxis = false;
|
||||||
|
invertRightXAxis = false;
|
||||||
|
rotationSpeed = 40.0;
|
||||||
|
yAxisRotationSpeed = rotationSpeed;
|
||||||
|
mouseSpeed = 25.0;
|
||||||
|
unfocusedInput = false;
|
||||||
|
virtualMouse = false;
|
||||||
|
virtualMouseSkin = VirtualMouseSkin.DEFAULT_LIGHT;
|
||||||
|
controllerID = 0;
|
||||||
|
secondControllerID = -1;
|
||||||
|
controllerType = ControllerType.DEFAULT;
|
||||||
|
mouseScreens = Lists.newArrayList("me.jellysquid.mods.sodium.client.gui", "net.coderbot.iris.gui", "net.minecraft.client.gui.screen.advancement", "net.minecraft.client.gui.screen.pack.PackScreen", "net.minecraft.class_5375", "net.minecraft.class_457", "net.minecraft.class_408", "me.flashyreese.mods.reeses_sodium_options.client.gui", "dev.emi.emi.screen");
|
||||||
|
BINDINGS = new HashMap<>();
|
||||||
|
maxAnalogValues = new double[]{1, 1, 1, 1};
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Gets the controller type from the controller's identifier.
|
||||||
|
*
|
||||||
|
* @return the controller name matches a type, else empty
|
||||||
|
*/
|
||||||
|
public static @NotNull ControllerType matchControllerToType() {
|
||||||
|
String controller = getController().getName().toLowerCase();
|
||||||
|
if (controller.contains("xbox 360")) return ControllerType.XBOX_360;
|
||||||
|
else if (controller.contains("xbox") || controller.contains("afterglow")) return ControllerType.XBOX;
|
||||||
|
else if (controller.contains("steam deck")) return ControllerType.STEAM_DECK;
|
||||||
|
else if (controller.contains("steam")) return ControllerType.STEAM_CONTROLLER;
|
||||||
|
else if (controller.contains("dualsense")) return ControllerType.DUALSENSE;
|
||||||
|
else if (controller.contains("dualshock") || controller.contains("ps4")) return ControllerType.DUALSHOCK;
|
||||||
|
else if (controller.contains("switch") || controller.contains("joy-con")) return ControllerType.SWITCH;
|
||||||
|
else if (controller.contains("ouya")) return ControllerType.OUYA;
|
||||||
|
else return ControllerType.DEFAULT;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -10,7 +10,11 @@
|
|||||||
package eu.midnightdust.midnightcontrols.client;
|
package eu.midnightdust.midnightcontrols.client;
|
||||||
|
|
||||||
import com.google.common.collect.ImmutableSet;
|
import com.google.common.collect.ImmutableSet;
|
||||||
|
import dev.lambdaurora.spruceui.widget.container.SpruceEntryListWidget;
|
||||||
|
import dev.lambdaurora.spruceui.widget.container.SpruceOptionListWidget;
|
||||||
|
import eu.midnightdust.midnightcontrols.MidnightControls;
|
||||||
import eu.midnightdust.midnightcontrols.client.compat.MidnightControlsCompat;
|
import eu.midnightdust.midnightcontrols.client.compat.MidnightControlsCompat;
|
||||||
|
import eu.midnightdust.midnightcontrols.client.compat.SodiumCompat;
|
||||||
import eu.midnightdust.midnightcontrols.client.controller.ButtonBinding;
|
import eu.midnightdust.midnightcontrols.client.controller.ButtonBinding;
|
||||||
import eu.midnightdust.midnightcontrols.client.controller.Controller;
|
import eu.midnightdust.midnightcontrols.client.controller.Controller;
|
||||||
import eu.midnightdust.midnightcontrols.client.controller.InputManager;
|
import eu.midnightdust.midnightcontrols.client.controller.InputManager;
|
||||||
@@ -27,6 +31,8 @@ import dev.lambdaurora.spruceui.widget.AbstractSprucePressableButtonWidget;
|
|||||||
import dev.lambdaurora.spruceui.widget.SpruceElement;
|
import dev.lambdaurora.spruceui.widget.SpruceElement;
|
||||||
import dev.lambdaurora.spruceui.widget.SpruceLabelWidget;
|
import dev.lambdaurora.spruceui.widget.SpruceLabelWidget;
|
||||||
import dev.lambdaurora.spruceui.widget.container.SpruceParentWidget;
|
import dev.lambdaurora.spruceui.widget.container.SpruceParentWidget;
|
||||||
|
import net.fabricmc.fabric.impl.item.group.CreativeGuiExtensions;
|
||||||
|
import net.fabricmc.loader.api.FabricLoader;
|
||||||
import net.minecraft.client.MinecraftClient;
|
import net.minecraft.client.MinecraftClient;
|
||||||
import net.minecraft.client.gui.Element;
|
import net.minecraft.client.gui.Element;
|
||||||
import net.minecraft.client.gui.ParentElement;
|
import net.minecraft.client.gui.ParentElement;
|
||||||
@@ -36,9 +42,9 @@ import net.minecraft.client.gui.screen.advancement.AdvancementTab;
|
|||||||
import net.minecraft.client.gui.screen.advancement.AdvancementsScreen;
|
import net.minecraft.client.gui.screen.advancement.AdvancementsScreen;
|
||||||
import net.minecraft.client.gui.screen.ingame.CreativeInventoryScreen;
|
import net.minecraft.client.gui.screen.ingame.CreativeInventoryScreen;
|
||||||
import net.minecraft.client.gui.screen.ingame.HandledScreen;
|
import net.minecraft.client.gui.screen.ingame.HandledScreen;
|
||||||
|
import net.minecraft.client.gui.screen.ingame.MerchantScreen;
|
||||||
import net.minecraft.client.gui.screen.multiplayer.MultiplayerScreen;
|
import net.minecraft.client.gui.screen.multiplayer.MultiplayerScreen;
|
||||||
import net.minecraft.client.gui.screen.multiplayer.MultiplayerServerListWidget;
|
import net.minecraft.client.gui.screen.multiplayer.MultiplayerServerListWidget;
|
||||||
import net.minecraft.client.gui.screen.pack.PackScreen;
|
|
||||||
import net.minecraft.client.gui.screen.world.WorldListWidget;
|
import net.minecraft.client.gui.screen.world.WorldListWidget;
|
||||||
import net.minecraft.client.gui.widget.AlwaysSelectedEntryListWidget;
|
import net.minecraft.client.gui.widget.AlwaysSelectedEntryListWidget;
|
||||||
import net.minecraft.client.gui.widget.EntryListWidget;
|
import net.minecraft.client.gui.widget.EntryListWidget;
|
||||||
@@ -46,7 +52,7 @@ import net.minecraft.client.gui.widget.PressableWidget;
|
|||||||
import net.minecraft.client.gui.widget.SliderWidget;
|
import net.minecraft.client.gui.widget.SliderWidget;
|
||||||
import net.minecraft.screen.slot.Slot;
|
import net.minecraft.screen.slot.Slot;
|
||||||
import net.minecraft.screen.slot.SlotActionType;
|
import net.minecraft.screen.slot.SlotActionType;
|
||||||
import net.minecraft.text.TranslatableText;
|
import net.minecraft.text.Text;
|
||||||
import net.minecraft.util.math.MathHelper;
|
import net.minecraft.util.math.MathHelper;
|
||||||
import org.aperlambda.lambdacommon.utils.Pair;
|
import org.aperlambda.lambdacommon.utils.Pair;
|
||||||
import org.jetbrains.annotations.NotNull;
|
import org.jetbrains.annotations.NotNull;
|
||||||
@@ -54,10 +60,7 @@ import org.jetbrains.annotations.Nullable;
|
|||||||
import org.lwjgl.glfw.GLFW;
|
import org.lwjgl.glfw.GLFW;
|
||||||
import org.lwjgl.glfw.GLFWGamepadState;
|
import org.lwjgl.glfw.GLFWGamepadState;
|
||||||
|
|
||||||
import java.util.Comparator;
|
import java.util.*;
|
||||||
import java.util.HashMap;
|
|
||||||
import java.util.Map;
|
|
||||||
import java.util.Optional;
|
|
||||||
|
|
||||||
import static org.lwjgl.glfw.GLFW.*;
|
import static org.lwjgl.glfw.GLFW.*;
|
||||||
|
|
||||||
@@ -72,7 +75,7 @@ public class MidnightInput {
|
|||||||
private static final Map<Integer, Integer> BUTTON_COOLDOWNS = new HashMap<>();
|
private static final Map<Integer, Integer> BUTTON_COOLDOWNS = new HashMap<>();
|
||||||
// Cooldowns
|
// Cooldowns
|
||||||
public int actionGuiCooldown = 0;
|
public int actionGuiCooldown = 0;
|
||||||
private boolean ignoreNextARelease = false;
|
public boolean ignoreNextARelease = false;
|
||||||
private double targetYaw = 0.0;
|
private double targetYaw = 0.0;
|
||||||
private double targetPitch = 0.0;
|
private double targetPitch = 0.0;
|
||||||
private float prevXAxis = 0.f;
|
private float prevXAxis = 0.f;
|
||||||
@@ -81,7 +84,7 @@ public class MidnightInput {
|
|||||||
private int targetMouseY = 0;
|
private int targetMouseY = 0;
|
||||||
private float mouseSpeedX = 0.f;
|
private float mouseSpeedX = 0.f;
|
||||||
private float mouseSpeedY = 0.f;
|
private float mouseSpeedY = 0.f;
|
||||||
private int inventoryInteractionCooldown = 0;
|
public int inventoryInteractionCooldown = 0;
|
||||||
|
|
||||||
private ControllerControlsWidget controlsInput = null;
|
private ControllerControlsWidget controlsInput = null;
|
||||||
|
|
||||||
@@ -264,7 +267,7 @@ public class MidnightInput {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
private void handleButton(@NotNull MinecraftClient client, int button, int action, boolean state) {
|
public void handleButton(@NotNull MinecraftClient client, int button, int action, boolean state) {
|
||||||
if (this.controlsInput != null && this.controlsInput.focusedBinding != null) {
|
if (this.controlsInput != null && this.controlsInput.focusedBinding != null) {
|
||||||
if (action == 0 && !this.controlsInput.currentButtons.contains(button)) {
|
if (action == 0 && !this.controlsInput.currentButtons.contains(button)) {
|
||||||
this.controlsInput.currentButtons.add(button);
|
this.controlsInput.currentButtons.add(button);
|
||||||
@@ -280,7 +283,7 @@ public class MidnightInput {
|
|||||||
}
|
}
|
||||||
|
|
||||||
if (action == 0 || action == 2) {
|
if (action == 0 || action == 2) {
|
||||||
if (client.currentScreen != null && isScreenInteractive(client.currentScreen)
|
if (client.currentScreen != null
|
||||||
&& (button == GLFW.GLFW_GAMEPAD_BUTTON_DPAD_UP || button == GLFW.GLFW_GAMEPAD_BUTTON_DPAD_DOWN
|
&& (button == GLFW.GLFW_GAMEPAD_BUTTON_DPAD_UP || button == GLFW.GLFW_GAMEPAD_BUTTON_DPAD_DOWN
|
||||||
|| button == GLFW.GLFW_GAMEPAD_BUTTON_DPAD_LEFT || button == GLFW.GLFW_GAMEPAD_BUTTON_DPAD_RIGHT)) {
|
|| button == GLFW.GLFW_GAMEPAD_BUTTON_DPAD_LEFT || button == GLFW.GLFW_GAMEPAD_BUTTON_DPAD_RIGHT)) {
|
||||||
if (this.actionGuiCooldown == 0) {
|
if (this.actionGuiCooldown == 0) {
|
||||||
@@ -307,16 +310,11 @@ public class MidnightInput {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if (this.handleInventory(client, button)) {
|
|
||||||
this.ignoreNextARelease = true;
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
if (button == GLFW.GLFW_GAMEPAD_BUTTON_B) {
|
if (button == GLFW.GLFW_GAMEPAD_BUTTON_B) {
|
||||||
if (client.currentScreen != null && client.currentScreen.getClass() != TitleScreen.class) {
|
if (client.currentScreen != null && client.currentScreen.getClass() != TitleScreen.class) {
|
||||||
if (!MidnightControlsCompat.handleMenuBack(client, client.currentScreen))
|
if (!MidnightControlsCompat.handleMenuBack(client, client.currentScreen))
|
||||||
if (!this.tryGoBack(client.currentScreen))
|
if (!this.tryGoBack(client.currentScreen))
|
||||||
client.currentScreen.onClose();
|
client.currentScreen.close();
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -324,6 +322,9 @@ public class MidnightInput {
|
|||||||
|
|
||||||
if (button == GLFW.GLFW_GAMEPAD_BUTTON_A && client.currentScreen != null && !isScreenInteractive(client.currentScreen)
|
if (button == GLFW.GLFW_GAMEPAD_BUTTON_A && client.currentScreen != null && !isScreenInteractive(client.currentScreen)
|
||||||
&& this.actionGuiCooldown == 0) {
|
&& this.actionGuiCooldown == 0) {
|
||||||
|
if (client.currentScreen instanceof CreativeInventoryScreen creativeScreen && ((HandledScreenAccessor) creativeScreen).midnightcontrols$getSlotAt(
|
||||||
|
client.mouse.getX() * (double) client.getWindow().getScaledWidth() / (double) client.getWindow().getWidth(),
|
||||||
|
client.mouse.getY() * (double) client.getWindow().getScaledHeight() / (double) client.getWindow().getHeight()) != null) return;
|
||||||
if (!this.ignoreNextARelease) {
|
if (!this.ignoreNextARelease) {
|
||||||
double mouseX = client.mouse.getX() * (double) client.getWindow().getScaledWidth() / (double) client.getWindow().getWidth();
|
double mouseX = client.mouse.getX() * (double) client.getWindow().getScaledWidth() / (double) client.getWindow().getWidth();
|
||||||
double mouseY = client.mouse.getY() * (double) client.getWindow().getScaledHeight() / (double) client.getWindow().getHeight();
|
double mouseY = client.mouse.getY() * (double) client.getWindow().getScaledHeight() / (double) client.getWindow().getHeight();
|
||||||
@@ -341,66 +342,6 @@ public class MidnightInput {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
/**
|
/**
|
||||||
* Handles inventory interaction.
|
|
||||||
*
|
|
||||||
* @param client the client instance
|
|
||||||
* @param button the button pressed
|
|
||||||
* @return {@code true} if an inventory interaction was done
|
|
||||||
*/
|
|
||||||
private boolean handleInventory(@NotNull MinecraftClient client, int button) {
|
|
||||||
if (!(client.currentScreen instanceof HandledScreen))
|
|
||||||
return false;
|
|
||||||
|
|
||||||
if (client.interactionManager == null || client.player == null)
|
|
||||||
return false;
|
|
||||||
|
|
||||||
if (this.inventoryInteractionCooldown > 0)
|
|
||||||
return true;
|
|
||||||
|
|
||||||
if (button == GLFW.GLFW_GAMEPAD_BUTTON_B) {
|
|
||||||
client.player.closeHandledScreen();
|
|
||||||
return true;
|
|
||||||
}
|
|
||||||
|
|
||||||
double x = client.mouse.getX() * (double) client.getWindow().getScaledWidth() / (double) client.getWindow().getWidth();
|
|
||||||
double y = client.mouse.getY() * (double) client.getWindow().getScaledHeight() / (double) client.getWindow().getHeight();
|
|
||||||
|
|
||||||
var screen = (HandledScreen) client.currentScreen;
|
|
||||||
var accessor = (HandledScreenAccessor) screen;
|
|
||||||
Slot slot = ((HandledScreenAccessor) client.currentScreen).midnightcontrols$getSlotAt(x, y);
|
|
||||||
|
|
||||||
int slotId;
|
|
||||||
if (slot == null) {
|
|
||||||
if (client.player.currentScreenHandler.getCursorStack().isEmpty())
|
|
||||||
return false;
|
|
||||||
slotId = accessor.midnightcontrols$isClickOutsideBounds(x, y, accessor.getX(), accessor.getY(), GLFW_MOUSE_BUTTON_1) ? -999 : -1;
|
|
||||||
} else {
|
|
||||||
slotId = slot.id;
|
|
||||||
}
|
|
||||||
|
|
||||||
var actionType = SlotActionType.PICKUP;
|
|
||||||
int clickData = GLFW.GLFW_MOUSE_BUTTON_1;
|
|
||||||
switch (button) {
|
|
||||||
case GLFW_GAMEPAD_BUTTON_A:
|
|
||||||
if (screen instanceof CreativeInventoryScreen)
|
|
||||||
if (((CreativeInventoryScreenAccessor) screen).midnightcontrols$isCreativeInventorySlot(slot))
|
|
||||||
actionType = SlotActionType.CLONE;
|
|
||||||
if (slot != null && MidnightControlsCompat.streamCompatHandlers().anyMatch(handler -> handler.isCreativeSlot(screen, slot)))
|
|
||||||
actionType = SlotActionType.CLONE;
|
|
||||||
break;
|
|
||||||
case GLFW.GLFW_GAMEPAD_BUTTON_X:
|
|
||||||
clickData = GLFW_MOUSE_BUTTON_2;
|
|
||||||
break;
|
|
||||||
case GLFW.GLFW_GAMEPAD_BUTTON_Y:
|
|
||||||
actionType = SlotActionType.QUICK_MOVE;
|
|
||||||
break;
|
|
||||||
default:
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
|
|
||||||
accessor.midnightcontrols$onMouseClick(slot, slotId, clickData, actionType);
|
|
||||||
return true;
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Tries to go back.
|
* Tries to go back.
|
||||||
@@ -412,9 +353,9 @@ public class MidnightInput {
|
|||||||
var set = ImmutableSet.of("gui.back", "gui.done", "gui.cancel", "gui.toTitle", "gui.toMenu");
|
var set = ImmutableSet.of("gui.back", "gui.done", "gui.cancel", "gui.toTitle", "gui.toMenu");
|
||||||
return screen.children().stream().filter(element -> element instanceof PressableWidget)
|
return screen.children().stream().filter(element -> element instanceof PressableWidget)
|
||||||
.map(element -> (PressableWidget) element)
|
.map(element -> (PressableWidget) element)
|
||||||
.filter(element -> element.getMessage() instanceof TranslatableText)
|
.filter(element -> element.getMessage() != null && element.getMessage().getContent() != null)
|
||||||
.anyMatch(element -> {
|
.anyMatch(element -> {
|
||||||
if (set.stream().anyMatch(key -> key.equals(((TranslatableText) element.getMessage()).getKey()))) {
|
if (set.stream().anyMatch(key -> element.getMessage().getContent().toString().equals(key))) {
|
||||||
element.onPress();
|
element.onPress();
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
@@ -503,6 +444,14 @@ public class MidnightInput {
|
|||||||
}
|
}
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
} else if (client.currentScreen instanceof MerchantScreen merchantScreen) {
|
||||||
|
if (axis == GLFW_GAMEPAD_AXIS_RIGHT_Y) {
|
||||||
|
// @TODO allow rebinding to left stick
|
||||||
|
if (absValue >= deadZone) {
|
||||||
|
merchantScreen.mouseScrolled(0.0, 0.0, -(value * 1.5f));
|
||||||
|
}
|
||||||
|
return;
|
||||||
|
}
|
||||||
} else if (client.currentScreen instanceof AdvancementsScreen advancementsScreen) {
|
} else if (client.currentScreen instanceof AdvancementsScreen advancementsScreen) {
|
||||||
if (axis == GLFW_GAMEPAD_AXIS_RIGHT_X || axis == GLFW_GAMEPAD_AXIS_RIGHT_Y) {
|
if (axis == GLFW_GAMEPAD_AXIS_RIGHT_X || axis == GLFW_GAMEPAD_AXIS_RIGHT_Y) {
|
||||||
var accessor = (AdvancementsScreenAccessor) advancementsScreen;
|
var accessor = (AdvancementsScreenAccessor) advancementsScreen;
|
||||||
@@ -512,6 +461,25 @@ public class MidnightInput {
|
|||||||
}
|
}
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
} else if (client.currentScreen != null) {
|
||||||
|
if (axis == GLFW_GAMEPAD_AXIS_RIGHT_Y && absValue >= deadZone) {
|
||||||
|
client.currentScreen.children().stream().filter(element -> element instanceof EntryListWidget)
|
||||||
|
.map(element -> (EntryListWidget<?>) element)
|
||||||
|
.filter(element -> element.getType().isFocused())
|
||||||
|
.anyMatch(element -> {
|
||||||
|
element.mouseScrolled(0.0, 0.0, -value);
|
||||||
|
return true;
|
||||||
|
});
|
||||||
|
client.currentScreen.children().stream().filter(element -> element instanceof SpruceEntryListWidget)
|
||||||
|
.map(element -> (SpruceEntryListWidget<?>) element)
|
||||||
|
.filter(element -> element.getType().isFocused())
|
||||||
|
.anyMatch(element -> {
|
||||||
|
MidnightControls.get().log(String.valueOf(value));
|
||||||
|
element.mouseScrolled(0.0, 0.0, -value);
|
||||||
|
return true;
|
||||||
|
});
|
||||||
|
return;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
absValue -= deadZone;
|
absValue -= deadZone;
|
||||||
@@ -581,7 +549,7 @@ public class MidnightInput {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
private boolean handleAButton(@NotNull Screen screen, @NotNull Element focused) {
|
public boolean handleAButton(@NotNull Screen screen, @NotNull Element focused) {
|
||||||
if (focused instanceof PressableWidget widget) {
|
if (focused instanceof PressableWidget widget) {
|
||||||
widget.playDownSound(MinecraftClient.getInstance().getSoundManager());
|
widget.playDownSound(MinecraftClient.getInstance().getSoundManager());
|
||||||
widget.onPress();
|
widget.onPress();
|
||||||
@@ -594,7 +562,7 @@ public class MidnightInput {
|
|||||||
labelWidget.onPress();
|
labelWidget.onPress();
|
||||||
return true;
|
return true;
|
||||||
} else if (focused instanceof WorldListWidget list) {
|
} else if (focused instanceof WorldListWidget list) {
|
||||||
list.getSelectedAsOptional().ifPresent(WorldListWidget.Entry::play);
|
list.getSelectedAsOptional().ifPresent(WorldListWidget.WorldEntry::play);
|
||||||
return true;
|
return true;
|
||||||
} else if (focused instanceof MultiplayerServerListWidget list) {
|
} else if (focused instanceof MultiplayerServerListWidget list) {
|
||||||
var entry = list.getSelectedOrNull();
|
var entry = list.getSelectedOrNull();
|
||||||
@@ -669,9 +637,9 @@ public class MidnightInput {
|
|||||||
double powValue = Math.pow(value, 2.0);
|
double powValue = Math.pow(value, 2.0);
|
||||||
if (axis == GLFW_GAMEPAD_AXIS_RIGHT_Y) {
|
if (axis == GLFW_GAMEPAD_AXIS_RIGHT_Y) {
|
||||||
if (state == 2) {
|
if (state == 2) {
|
||||||
this.targetPitch = -MidnightControlsConfig.getRightYAxisSign() * (MidnightControlsConfig.rotationSpeed * powValue) * 0.11D;
|
this.targetPitch = -MidnightControlsConfig.getRightYAxisSign() * (MidnightControlsConfig.yAxisRotationSpeed * powValue) * 0.11D;
|
||||||
} else if (state == 1) {
|
} else if (state == 1) {
|
||||||
this.targetPitch = MidnightControlsConfig.getRightYAxisSign() * (MidnightControlsConfig.rotationSpeed * powValue) * 0.11D;
|
this.targetPitch = MidnightControlsConfig.getRightYAxisSign() * (MidnightControlsConfig.yAxisRotationSpeed * powValue) * 0.11D;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if (axis == GLFW_GAMEPAD_AXIS_RIGHT_X) {
|
if (axis == GLFW_GAMEPAD_AXIS_RIGHT_X) {
|
||||||
@@ -691,6 +659,7 @@ public class MidnightInput {
|
|||||||
}
|
}
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
if (FabricLoader.getInstance().isModLoaded("sodium")) SodiumCompat.handleInput(screen, direction.isLookingForward());
|
||||||
if (!screen.changeFocus(direction.isLookingForward())) {
|
if (!screen.changeFocus(direction.isLookingForward())) {
|
||||||
if (screen.changeFocus(direction.isLookingForward())) {
|
if (screen.changeFocus(direction.isLookingForward())) {
|
||||||
this.actionGuiCooldown = 5;
|
this.actionGuiCooldown = 5;
|
||||||
@@ -704,7 +673,7 @@ public class MidnightInput {
|
|||||||
}
|
}
|
||||||
|
|
||||||
public static boolean isScreenInteractive(@NotNull Screen screen) {
|
public static boolean isScreenInteractive(@NotNull Screen screen) {
|
||||||
return !(screen instanceof AdvancementsScreen || screen instanceof HandledScreen || screen instanceof PackScreen
|
return !(screen instanceof HandledScreen || MidnightControlsConfig.mouseScreens.stream().anyMatch(a -> screen.getClass().toString().contains(a))
|
||||||
|| (screen instanceof SpruceScreen && ((SpruceScreen) screen).requiresCursor())
|
|| (screen instanceof SpruceScreen && ((SpruceScreen) screen).requiresCursor())
|
||||||
|| MidnightControlsCompat.requireMouseOnScreen(screen));
|
|| MidnightControlsCompat.requireMouseOnScreen(screen));
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -144,7 +144,7 @@ public class MidnightReacharound {
|
|||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
|
|
||||||
return new BlockHitResult(client.crosshairTarget.getPos(), direction, blockPos, false);
|
return new BlockHitResult(new Vec3d(blockPos.getX(),blockPos.getY(),blockPos.getZ()), direction, blockPos, false);
|
||||||
}
|
}
|
||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -10,7 +10,6 @@
|
|||||||
package eu.midnightdust.midnightcontrols.client;
|
package eu.midnightdust.midnightcontrols.client;
|
||||||
|
|
||||||
import net.minecraft.text.Text;
|
import net.minecraft.text.Text;
|
||||||
import net.minecraft.text.TranslatableText;
|
|
||||||
import org.aperlambda.lambdacommon.utils.Nameable;
|
import org.aperlambda.lambdacommon.utils.Nameable;
|
||||||
import org.jetbrains.annotations.NotNull;
|
import org.jetbrains.annotations.NotNull;
|
||||||
|
|
||||||
@@ -34,7 +33,7 @@ public enum VirtualMouseSkin implements Nameable {
|
|||||||
|
|
||||||
VirtualMouseSkin(String name) {
|
VirtualMouseSkin(String name) {
|
||||||
this.name = name;
|
this.name = name;
|
||||||
this.text = new TranslatableText(this.getTranslationKey());
|
this.text = Text.translatable(this.getTranslationKey());
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|||||||
@@ -1,49 +0,0 @@
|
|||||||
/*
|
|
||||||
* Copyright © 2021 LambdAurora <aurora42lambda@gmail.com>
|
|
||||||
*
|
|
||||||
* This file is part of midnightcontrols.
|
|
||||||
*
|
|
||||||
* Licensed under the MIT license. For more information,
|
|
||||||
* see the LICENSE file.
|
|
||||||
*/
|
|
||||||
|
|
||||||
package eu.midnightdust.midnightcontrols.client.compat;
|
|
||||||
|
|
||||||
import eu.midnightdust.midnightcontrols.client.MidnightControlsClient;
|
|
||||||
import eu.midnightdust.midnightcontrols.client.controller.ButtonBinding;
|
|
||||||
import io.github.kosmx.emotes.arch.gui.screen.ingame.FastChosseScreen;
|
|
||||||
import io.github.kosmx.emotes.main.network.ClientEmotePlay;
|
|
||||||
import org.jetbrains.annotations.NotNull;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Represents a compatibility handler for Emotecraft.
|
|
||||||
*
|
|
||||||
* @author Motschen
|
|
||||||
* @version 1.4.3
|
|
||||||
* @since 1.0.0
|
|
||||||
*/
|
|
||||||
public class EmotecraftCompat implements CompatHandler {
|
|
||||||
@Override
|
|
||||||
public void handle(@NotNull MidnightControlsClient mod) {
|
|
||||||
new ButtonBinding.Builder("key.emotecraft.fastchoose")
|
|
||||||
.buttons(16)
|
|
||||||
.onlyInGame()
|
|
||||||
.cooldown(true)
|
|
||||||
.category(ButtonBinding.MISC_CATEGORY)
|
|
||||||
.action((client, button, value, action) -> {
|
|
||||||
client.setScreen(new FastChosseScreen(null));
|
|
||||||
return true;
|
|
||||||
})
|
|
||||||
.register();
|
|
||||||
new ButtonBinding.Builder("key.emotecraft.stop")
|
|
||||||
.buttons(17)
|
|
||||||
.onlyInGame()
|
|
||||||
.cooldown(true)
|
|
||||||
.category(ButtonBinding.MISC_CATEGORY)
|
|
||||||
.action((client, button, value, action) -> {
|
|
||||||
ClientEmotePlay.clientStopLocalEmote();
|
|
||||||
return true;
|
|
||||||
})
|
|
||||||
.register();
|
|
||||||
}
|
|
||||||
}
|
|
||||||
@@ -39,7 +39,9 @@ public class MidnightControlsCompat {
|
|||||||
* @param mod the mod instance
|
* @param mod the mod instance
|
||||||
*/
|
*/
|
||||||
public static void init(@NotNull MidnightControlsClient mod) {
|
public static void init(@NotNull MidnightControlsClient mod) {
|
||||||
if (FabricLoader.getInstance().isModLoaded("okzoomer")) {
|
// "okzoomer" is the mod ID used by Fabric-compatible versions of Ok Zoomer. (5.0.0-beta.6 and below.)
|
||||||
|
// "ok_zoomer" is the mod ID used by Quilt-exclusive versions of Ok Zoomer. (5.0.0-beta.7 and above.)
|
||||||
|
if (FabricLoader.getInstance().isModLoaded("okzoomer") || FabricLoader.getInstance().isModLoaded("ok_zoomer")) {
|
||||||
mod.log("Adding Ok Zoomer compatibility...");
|
mod.log("Adding Ok Zoomer compatibility...");
|
||||||
HANDLERS.add(new OkZoomerCompat());
|
HANDLERS.add(new OkZoomerCompat());
|
||||||
}
|
}
|
||||||
@@ -51,10 +53,6 @@ public class MidnightControlsCompat {
|
|||||||
mod.log("Adding HQM compatibility...");
|
mod.log("Adding HQM compatibility...");
|
||||||
HANDLERS.add(new HQMCompat());
|
HANDLERS.add(new HQMCompat());
|
||||||
}
|
}
|
||||||
if (FabricLoader.getInstance().isModLoaded("emotecraft")) {
|
|
||||||
mod.log("Adding Emotecraft compatibility...");
|
|
||||||
HANDLERS.add(new EmotecraftCompat());
|
|
||||||
}
|
|
||||||
HANDLERS.forEach(handler -> handler.handle(mod));
|
HANDLERS.forEach(handler -> handler.handle(mod));
|
||||||
InputManager.loadButtonBindings();
|
InputManager.loadButtonBindings();
|
||||||
}
|
}
|
||||||
@@ -161,4 +159,12 @@ public class MidnightControlsCompat {
|
|||||||
public static boolean isReiPresent() {
|
public static boolean isReiPresent() {
|
||||||
return FabricLoader.getInstance().isModLoaded("roughlyenoughitems");
|
return FabricLoader.getInstance().isModLoaded("roughlyenoughitems");
|
||||||
}
|
}
|
||||||
|
/**
|
||||||
|
* Returns whether EMI is present.
|
||||||
|
*
|
||||||
|
* @return true if EMI is present, else false
|
||||||
|
*/
|
||||||
|
public static boolean isEMIPresent() {
|
||||||
|
return FabricLoader.getInstance().isModLoaded("emi");
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -9,6 +9,7 @@
|
|||||||
|
|
||||||
package eu.midnightdust.midnightcontrols.client.compat;
|
package eu.midnightdust.midnightcontrols.client.compat;
|
||||||
|
|
||||||
|
import net.fabricmc.loader.api.FabricLoader;
|
||||||
import org.jetbrains.annotations.NotNull;
|
import org.jetbrains.annotations.NotNull;
|
||||||
import org.objectweb.asm.tree.ClassNode;
|
import org.objectweb.asm.tree.ClassNode;
|
||||||
import org.spongepowered.asm.mixin.extensibility.IMixinConfigPlugin;
|
import org.spongepowered.asm.mixin.extensibility.IMixinConfigPlugin;
|
||||||
@@ -29,10 +30,7 @@ public class MidnightControlsMixinPlugin implements IMixinConfigPlugin {
|
|||||||
private final HashMap<String, Boolean> conditionalMixins = new HashMap<>();
|
private final HashMap<String, Boolean> conditionalMixins = new HashMap<>();
|
||||||
|
|
||||||
public MidnightControlsMixinPlugin() {
|
public MidnightControlsMixinPlugin() {
|
||||||
this.putConditionalMixin("EntryListWidgetAccessor", MidnightControlsCompat.isReiPresent());
|
this.putConditionalMixin("SodiumOptionsGUIAccessor", FabricLoader.getInstance().isModLoaded("sodium"));
|
||||||
this.putConditionalMixin("EntryWidgetAccessor", MidnightControlsCompat.isReiPresent());
|
|
||||||
this.putConditionalMixin("RecipeViewingScreenAccessor", MidnightControlsCompat.isReiPresent());
|
|
||||||
this.putConditionalMixin("VillagerRecipeViewingScreenAccessor", MidnightControlsCompat.isReiPresent());
|
|
||||||
}
|
}
|
||||||
|
|
||||||
private void putConditionalMixin(@NotNull String path, boolean condition) {
|
private void putConditionalMixin(@NotNull String path, boolean condition) {
|
||||||
|
|||||||
@@ -71,7 +71,7 @@ public class OkZoomerCompat implements CompatHandler {
|
|||||||
okZoomerAreExtraKeyBindsEnabledMethodNameString = "areExtraKeybindsEnabled";
|
okZoomerAreExtraKeyBindsEnabledMethodNameString = "areExtraKeybindsEnabled";
|
||||||
} else if (LambdaReflection.doesClassExist("io.github.ennuil.okzoomer.key_binds.ZoomKeyBinds")) {
|
} else if (LambdaReflection.doesClassExist("io.github.ennuil.okzoomer.key_binds.ZoomKeyBinds")) {
|
||||||
// https://github.com/EnnuiL/OkZoomer/blob/5.0.0-beta.6+1.18.2/src/main/java/io/github/ennuil/okzoomer/key_binds/ZoomKeyBinds.java
|
// https://github.com/EnnuiL/OkZoomer/blob/5.0.0-beta.6+1.18.2/src/main/java/io/github/ennuil/okzoomer/key_binds/ZoomKeyBinds.java
|
||||||
MidnightControlsClient.get().log("Ok Zoomer version 5.0.0-beta.4 or above detected!");
|
MidnightControlsClient.get().log("Ok Zoomer version 5.0.0-beta.6, 5.0.0-beta.5, or 5.0.0-beta.4 detected!");
|
||||||
|
|
||||||
okZoomerZoomKeybindsClassString = "io.github.ennuil.okzoomer.key_binds.ZoomKeyBinds";
|
okZoomerZoomKeybindsClassString = "io.github.ennuil.okzoomer.key_binds.ZoomKeyBinds";
|
||||||
|
|
||||||
@@ -80,9 +80,21 @@ public class OkZoomerCompat implements CompatHandler {
|
|||||||
okZoomerDecreaseZoomKeyFieldString = "DECREASE_ZOOM_KEY";
|
okZoomerDecreaseZoomKeyFieldString = "DECREASE_ZOOM_KEY";
|
||||||
okZoomerResetZoomKeyFieldString = "RESET_ZOOM_KEY";
|
okZoomerResetZoomKeyFieldString = "RESET_ZOOM_KEY";
|
||||||
|
|
||||||
|
okZoomerAreExtraKeyBindsEnabledMethodNameString = "areExtraKeyBindsEnabled";
|
||||||
|
} else if (LambdaReflection.doesClassExist("io.github.ennuil.ok_zoomer.key_binds.ZoomKeyBinds")) {
|
||||||
|
// https://github.com/EnnuiL/OkZoomer/blob/5.0.0-beta.7+1.18.2/src/main/java/io/github/ennuil/ok_zoomer/key_binds/ZoomKeyBinds.java
|
||||||
|
MidnightControlsClient.get().log("Ok Zoomer version 5.0.0-beta.7 (Quilt) or above detected!");
|
||||||
|
|
||||||
|
okZoomerZoomKeybindsClassString = "io.github.ennuil.ok_zoomer.key_binds.ZoomKeyBinds";
|
||||||
|
|
||||||
|
okZoomerZoomKeyFieldString = "ZOOM_KEY";
|
||||||
|
okZoomerIncreaseZoomKeyFieldString = "INCREASE_ZOOM_KEY";
|
||||||
|
okZoomerDecreaseZoomKeyFieldString = "DECREASE_ZOOM_KEY";
|
||||||
|
okZoomerResetZoomKeyFieldString = "RESET_ZOOM_KEY";
|
||||||
|
|
||||||
okZoomerAreExtraKeyBindsEnabledMethodNameString = "areExtraKeyBindsEnabled";
|
okZoomerAreExtraKeyBindsEnabledMethodNameString = "areExtraKeyBindsEnabled";
|
||||||
} else {
|
} else {
|
||||||
// If both of the above checks fail, then the version of the Ok Zoomer API that the user is trying to use is too new.
|
// If all of the above checks fail, then the version of the Ok Zoomer API that the user is trying to use is too new.
|
||||||
MidnightControlsClient.get().warn("The version of Ok Zoomer that you are currently using is too new, and is not yet supported by MidnightControls!");
|
MidnightControlsClient.get().warn("The version of Ok Zoomer that you are currently using is too new, and is not yet supported by MidnightControls!");
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1,365 +0,0 @@
|
|||||||
/*
|
|
||||||
* Copyright © 2021 LambdAurora <aurora42lambda@gmail.com>
|
|
||||||
*
|
|
||||||
* This file is part of midnightcontrols.
|
|
||||||
*
|
|
||||||
* Licensed under the MIT license. For more information,
|
|
||||||
* see the LICENSE file.
|
|
||||||
*/
|
|
||||||
|
|
||||||
package eu.midnightdust.midnightcontrols.client.compat;
|
|
||||||
|
|
||||||
import eu.midnightdust.midnightcontrols.client.ButtonState;
|
|
||||||
import eu.midnightdust.midnightcontrols.client.MidnightControlsClient;
|
|
||||||
import eu.midnightdust.midnightcontrols.client.compat.mixin.EntryListWidgetAccessor;
|
|
||||||
import eu.midnightdust.midnightcontrols.client.compat.mixin.EntryWidgetAccessor;
|
|
||||||
import eu.midnightdust.midnightcontrols.client.controller.ButtonBinding;
|
|
||||||
import eu.midnightdust.midnightcontrols.client.controller.InputHandlers;
|
|
||||||
import eu.midnightdust.midnightcontrols.client.controller.PressAction;
|
|
||||||
import me.shedaniel.rei.RoughlyEnoughItemsCoreClient;
|
|
||||||
import me.shedaniel.rei.impl.client.ClientHelperImpl;
|
|
||||||
import me.shedaniel.rei.impl.client.REIRuntimeImpl;
|
|
||||||
import me.shedaniel.rei.impl.client.gui.ScreenOverlayImpl;
|
|
||||||
import me.shedaniel.rei.impl.client.gui.screen.CompositeDisplayViewingScreen;
|
|
||||||
import me.shedaniel.rei.impl.client.gui.screen.DefaultDisplayViewingScreen;
|
|
||||||
import me.shedaniel.rei.impl.client.gui.widget.EntryListEntryWidget;
|
|
||||||
import me.shedaniel.rei.impl.client.gui.widget.EntryWidget;
|
|
||||||
import me.shedaniel.rei.impl.client.registry.screen.ScreenRegistryImpl;
|
|
||||||
import me.shedaniel.rei.impl.common.entry.AbstractEntryStack;
|
|
||||||
import net.fabricmc.fabric.api.client.screenhandler.v1.ScreenRegistry;
|
|
||||||
import net.fabricmc.fabric.api.screenhandler.v1.ScreenHandlerRegistry;
|
|
||||||
import net.minecraft.client.MinecraftClient;
|
|
||||||
import net.minecraft.client.gui.Element;
|
|
||||||
import net.minecraft.client.gui.Selectable;
|
|
||||||
import net.minecraft.client.gui.screen.Screen;
|
|
||||||
import net.minecraft.client.gui.widget.ButtonWidget;
|
|
||||||
import net.minecraft.client.gui.widget.EntryListWidget;
|
|
||||||
import net.minecraft.util.Identifier;
|
|
||||||
import net.minecraft.util.Pair;
|
|
||||||
import org.aperlambda.lambdacommon.utils.LambdaReflection;
|
|
||||||
import org.jetbrains.annotations.NotNull;
|
|
||||||
import org.jetbrains.annotations.Nullable;
|
|
||||||
|
|
||||||
import java.util.List;
|
|
||||||
import java.util.Optional;
|
|
||||||
|
|
||||||
import static eu.midnightdust.midnightcontrols.client.compat.CompatHandler.SlotPos.INVALID_SLOT;
|
|
||||||
import static org.lwjgl.glfw.GLFW.*;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Represents a compatibility handler for REI.
|
|
||||||
*
|
|
||||||
* @author LambdAurora
|
|
||||||
* @version 1.7.0
|
|
||||||
* @since 1.2.0
|
|
||||||
*/
|
|
||||||
public class ReiCompat implements CompatHandler {
|
|
||||||
private static EntryListWidget ENTRY_LIST_WIDGET;
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public void handle(@NotNull MidnightControlsClient mod) {
|
|
||||||
/*ButtonBinding.builder(new Identifier("rei", "category_back"))
|
|
||||||
.buttons(GLFW_GAMEPAD_BUTTON_LEFT_BUMPER)
|
|
||||||
.filter((client, binding) -> isViewingScreen(client.currentScreen))
|
|
||||||
.action(handleTab(false))
|
|
||||||
.cooldown(true)
|
|
||||||
.register();
|
|
||||||
ButtonBinding.builder(new Identifier("rei", "category_next"))
|
|
||||||
.buttons(GLFW_GAMEPAD_BUTTON_RIGHT_BUMPER)
|
|
||||||
.filter((client, binding) -> isViewingScreen(client.currentScreen))
|
|
||||||
.action(handleTab(true))
|
|
||||||
.cooldown(true)
|
|
||||||
.register();
|
|
||||||
|
|
||||||
ButtonBinding.builder(new Identifier("rei", "page_back"))
|
|
||||||
.buttons(ButtonBinding.axisAsButton(GLFW_GAMEPAD_AXIS_RIGHT_X, false))
|
|
||||||
.filter((client, binding) -> InputHandlers.inInventory(client, binding) || isViewingScreen(client.currentScreen))
|
|
||||||
.action(handlePage(false))
|
|
||||||
.cooldown(true)
|
|
||||||
.register();
|
|
||||||
ButtonBinding.builder(new Identifier("rei", "page_next"))
|
|
||||||
.buttons(ButtonBinding.axisAsButton(GLFW_GAMEPAD_AXIS_RIGHT_X, true))
|
|
||||||
.filter((client, binding) -> InputHandlers.inInventory(client, binding) || isViewingScreen(client.currentScreen))
|
|
||||||
.action(handlePage(true))
|
|
||||||
.cooldown(true)
|
|
||||||
.register();
|
|
||||||
|
|
||||||
ButtonBinding.builder(new Identifier("rei", "recipe_back"))
|
|
||||||
.buttons(GLFW_GAMEPAD_BUTTON_DPAD_UP)
|
|
||||||
.filter((client, binding) -> isViewingScreen(client.currentScreen))
|
|
||||||
.action(handleRecipe(false))
|
|
||||||
.cooldown(true)
|
|
||||||
.register();
|
|
||||||
ButtonBinding.builder(new Identifier("rei", "recipe_next"))
|
|
||||||
.buttons(GLFW_GAMEPAD_BUTTON_DPAD_DOWN)
|
|
||||||
.filter((client, binding) -> isViewingScreen(client.currentScreen))
|
|
||||||
.action(handleRecipe(true))
|
|
||||||
.cooldown(true)
|
|
||||||
.register();
|
|
||||||
|
|
||||||
// For some reasons this is broken.
|
|
||||||
ButtonBinding.builder(new Identifier("rei", "show_usage"))
|
|
||||||
.buttons(GLFW_GAMEPAD_BUTTON_RIGHT_THUMB)
|
|
||||||
.filter((client, binding) -> InputHandlers.inInventory(client, binding) || isViewingScreen(client.currentScreen))
|
|
||||||
.action(handleShowRecipeUsage(true))
|
|
||||||
.cooldown(true)
|
|
||||||
.register();
|
|
||||||
|
|
||||||
ButtonBinding.builder(new Identifier("rei", "show_recipe"))
|
|
||||||
.buttons(GLFW_GAMEPAD_BUTTON_LEFT_THUMB)
|
|
||||||
.filter((client, binding) -> InputHandlers.inInventory(client, binding) || isViewingScreen(client.currentScreen))
|
|
||||||
.action(handleShowRecipeUsage(false))
|
|
||||||
.cooldown(true)
|
|
||||||
.register();
|
|
||||||
*/
|
|
||||||
}
|
|
||||||
/*
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public boolean requireMouseOnScreen(Screen screen) {
|
|
||||||
return isViewingScreen(screen);
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public @Nullable CompatHandler.SlotPos getSlotAt(@NotNull Screen screen, int mouseX, int mouseY) {
|
|
||||||
|
|
||||||
ScreenOverlayImpl overlay = ScreenOverlayImpl.getInstance();
|
|
||||||
if (overlay.isInside(mouseX, mouseY)) {
|
|
||||||
EntryListWidget widget = getEntryListWidget();
|
|
||||||
if (widget == null)
|
|
||||||
return null;
|
|
||||||
|
|
||||||
return this.getSlotAt(widget, mouseX, mouseY, false);
|
|
||||||
} else if (isViewingScreen(screen)) {
|
|
||||||
for (Element element : screen.children()) {
|
|
||||||
var slot = this.getSlotAt(element, mouseX, mouseY, true);
|
|
||||||
if (slot != null)
|
|
||||||
return slot;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
return null;
|
|
||||||
}
|
|
||||||
|
|
||||||
private @Nullable CompatHandler.SlotPos getSlotAt(@NotNull Element element, int mouseX, int mouseY, boolean allowEmpty) {
|
|
||||||
if (element instanceof EntryWidget) {
|
|
||||||
EntryWidget entry = (EntryWidget) element;
|
|
||||||
if (entry.containsMouse(mouseX, mouseY)) {
|
|
||||||
if (!allowEmpty && entry.getEntries().isEmpty())
|
|
||||||
return INVALID_SLOT;
|
|
||||||
return new SlotPos(entry.getBounds().getX() + 1, entry.getBounds().getY() + 1);
|
|
||||||
}
|
|
||||||
} else if (element instanceof EntryListWidget) {
|
|
||||||
List<EntryListEntryWidget> entries = ((EntryListWidgetAccessor) element).getEntries();
|
|
||||||
for (EntryListEntryWidget entry : entries) {
|
|
||||||
var slot = this.getSlotAt(entry, mouseX, mouseY, allowEmpty);
|
|
||||||
if (slot != null && slot != INVALID_SLOT)
|
|
||||||
return slot;
|
|
||||||
}
|
|
||||||
} else if (!(element instanceof ButtonWidget) && element instanceof WidgetWithBounds widgetWithBounds) {
|
|
||||||
for (var child : widgetWithBounds.children()) {
|
|
||||||
var slot = this.getSlotAt(child, mouseX, mouseY, allowEmpty);
|
|
||||||
if (slot != null && slot != INVALID_SLOT)
|
|
||||||
return slot;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
return null;
|
|
||||||
}
|
|
||||||
|
|
||||||
private static boolean isViewingScreen(Screen screen) {
|
|
||||||
return screen instanceof DefaultDisplayViewingScreen || screen instanceof CompositeDisplayViewingScreen;
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public boolean handleMenuBack(@NotNull MinecraftClient client, @NotNull Screen screen) {
|
|
||||||
if (!isViewingScreen(screen))
|
|
||||||
return false;
|
|
||||||
|
|
||||||
MinecraftClient.getInstance().setScreen(REIRuntimeImpl.getInstance().getPreviousContainerScreen());
|
|
||||||
REIRuntimeImpl.getInstance().getLastOverlay().init();
|
|
||||||
return true;
|
|
||||||
}
|
|
||||||
|
|
||||||
private static EntryListWidget getEntryListWidget() {
|
|
||||||
if (ENTRY_LIST_WIDGET == null) {
|
|
||||||
ENTRY_LIST_WIDGET = LambdaReflection.getFirstFieldOfType(ContainerScreenOverlay.class, EntryListWidget.class)
|
|
||||||
.map(field -> (EntryListWidget) LambdaReflection.getFieldValue(null, field))
|
|
||||||
.orElse(null);
|
|
||||||
}
|
|
||||||
return ENTRY_LIST_WIDGET;
|
|
||||||
}
|
|
||||||
|
|
||||||
private static @Nullable AbstractEntryStack getCurrentStack(@NotNull MinecraftClient client) {
|
|
||||||
double x = client.mouse.getX() * (double) client.getWindow().getScaledWidth() / (double) client.getWindow().getWidth();
|
|
||||||
double y = client.mouse.getY() * (double) client.getWindow().getScaledHeight() / (double) client.getWindow().getHeight();
|
|
||||||
|
|
||||||
if (isViewingScreen(client.currentScreen)) {
|
|
||||||
for (Element element : client.currentScreen.children()) {
|
|
||||||
EntryStack stack = getCurrentStack(element, x, y);
|
|
||||||
if (stack != null)
|
|
||||||
return stack;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
Optional<ContainerScreenOverlay> overlay = REIRuntimeImpl.getInstance().getOverlay(false,false);
|
|
||||||
if (!overlay.isPresent())
|
|
||||||
return RecipeHelper.getInstance().getScreenFocusedStack(client.currentScreen);
|
|
||||||
EntryListWidget widget = getEntryListWidget();
|
|
||||||
if (widget == null)
|
|
||||||
return ScreenOverlayImpl.getInstance().getInstance().getOverlayMenu()..getScreenFocusedStack(client.currentScreen);
|
|
||||||
|
|
||||||
return getCurrentStack(widget, x, y);
|
|
||||||
}
|
|
||||||
|
|
||||||
private static @Nullable EntryStack getCurrentStack(@NotNull Element element, double mouseX, double mouseY) {
|
|
||||||
if (element instanceof EntryWidget) {
|
|
||||||
EntryWidget entry = (EntryWidget) element;
|
|
||||||
if (entry.containsMouse(mouseX, mouseY))
|
|
||||||
return ((EntryWidgetAccessor) entry).lambdacontrols_getCurrentEntry();
|
|
||||||
} else if (element instanceof EntryListWidget) {
|
|
||||||
List<EntryListEntryWidget> entries = ((EntryListWidgetAccessor) element).getEntries();
|
|
||||||
for (EntryListEntryWidget entry : entries) {
|
|
||||||
if (entry.containsMouse(mouseX, mouseY)) {
|
|
||||||
return ((EntryWidgetAccessor) entry).lambdacontrols_getCurrentEntry();
|
|
||||||
}
|
|
||||||
}
|
|
||||||
} else if (!(element instanceof ButtonWidget) && element instanceof WidgetWithBounds) {
|
|
||||||
for (Element child : ((WidgetWithBounds) element).children()) {
|
|
||||||
EntryStack stack = getCurrentStack(child, mouseX, mouseY);
|
|
||||||
if (stack != null)
|
|
||||||
return stack;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
return null;
|
|
||||||
}
|
|
||||||
|
|
||||||
private static PressAction handleShowRecipeUsage(boolean usage) {
|
|
||||||
return (client, button, value, action) -> {
|
|
||||||
if (action.isUnpressed())
|
|
||||||
return false;
|
|
||||||
|
|
||||||
EntryStack stack = RecipeHelper.getInstance().getScreenFocusedStack(client.currentScreen);
|
|
||||||
if (stack == null) {
|
|
||||||
stack = getCurrentStack(client);
|
|
||||||
}
|
|
||||||
|
|
||||||
if (stack != null && !stack.isEmpty()) {
|
|
||||||
stack = stack.copy();
|
|
||||||
if (usage) {
|
|
||||||
return ClientHelper.getInstance().openView(ClientHelper.ViewSearchBuilder.builder().addUsagesFor(stack).setInputNotice(stack).fillPreferredOpenedCategory());
|
|
||||||
} else {
|
|
||||||
return ClientHelper.getInstance().openView(ClientHelper.ViewSearchBuilder.builder().addRecipesFor(stack).setOutputNotice(stack).fillPreferredOpenedCategory());
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
return false;
|
|
||||||
};
|
|
||||||
}
|
|
||||||
|
|
||||||
private static PressAction handlePage(boolean next) {
|
|
||||||
return (client, button, value, action) -> {
|
|
||||||
if (action == ButtonState.RELEASE)
|
|
||||||
return false;
|
|
||||||
|
|
||||||
Optional<ContainerScreenOverlay> overlay = ScreenHelper.getOptionalOverlay();
|
|
||||||
if (!overlay.isPresent())
|
|
||||||
return false;
|
|
||||||
|
|
||||||
EntryListWidget widget = getEntryListWidget();
|
|
||||||
if (widget == null)
|
|
||||||
return false;
|
|
||||||
|
|
||||||
if (next)
|
|
||||||
widget.nextPage();
|
|
||||||
else
|
|
||||||
widget.previousPage();
|
|
||||||
widget.updateEntriesPosition();
|
|
||||||
|
|
||||||
return true;
|
|
||||||
};
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Returns the handler for category tabs buttons.
|
|
||||||
*
|
|
||||||
* @param next True if the action is to switch to the next tab.
|
|
||||||
* @return The handler.
|
|
||||||
*/
|
|
||||||
/*
|
|
||||||
private static PressAction handleTab(boolean next) {
|
|
||||||
return (client, button, value, action) -> {
|
|
||||||
if (action != ButtonState.RELEASE)
|
|
||||||
return false;
|
|
||||||
|
|
||||||
if (client.currentScreen instanceof RecipeViewingScreen) {
|
|
||||||
RecipeViewingScreenAccessor screen = (RecipeViewingScreenAccessor) client.currentScreen;
|
|
||||||
if (next)
|
|
||||||
screen.getCategoryNext().onClick();
|
|
||||||
else
|
|
||||||
screen.getCategoryBack().onClick();
|
|
||||||
return true;
|
|
||||||
} else if (client.currentScreen instanceof VillagerRecipeViewingScreen) {
|
|
||||||
VillagerRecipeViewingScreenAccessor screen = (VillagerRecipeViewingScreenAccessor) client.currentScreen;
|
|
||||||
List<RecipeCategory<?>> categories = screen.getCategories();
|
|
||||||
int currentTab = screen.getSelectedCategoryIndex();
|
|
||||||
screen.setSelectedCategoryIndex(getNextIndex(currentTab, categories.size(), next));
|
|
||||||
screen.setSelectedRecipeIndex(0);
|
|
||||||
screen.lambdacontrols_init();
|
|
||||||
return true;
|
|
||||||
}
|
|
||||||
return false;
|
|
||||||
};
|
|
||||||
}
|
|
||||||
|
|
||||||
private static PressAction handleRecipe(boolean next) {
|
|
||||||
return (client, button, value, action) -> {
|
|
||||||
if (action.isUnpressed())
|
|
||||||
return false;
|
|
||||||
|
|
||||||
if (client.currentScreen instanceof RecipeViewingScreen) {
|
|
||||||
RecipeViewingScreenAccessor screen = (RecipeViewingScreenAccessor) client.currentScreen;
|
|
||||||
if (next)
|
|
||||||
screen.getRecipeNext().onClick();
|
|
||||||
else
|
|
||||||
screen.getRecipeBack().onClick();
|
|
||||||
return true;
|
|
||||||
} else if (client.currentScreen instanceof VillagerRecipeViewingScreen) {
|
|
||||||
VillagerRecipeViewingScreenAccessor screen = (VillagerRecipeViewingScreenAccessor) client.currentScreen;
|
|
||||||
List<RecipeCategory<?>> categories = screen.getCategories();
|
|
||||||
int currentTab = screen.getSelectedCategoryIndex();
|
|
||||||
List<RecipeDisplay> recipes = screen.getCategoryMap().get(categories.get(currentTab));
|
|
||||||
|
|
||||||
if (recipes.size() == 0)
|
|
||||||
return true;
|
|
||||||
|
|
||||||
int currentRecipe = screen.getSelectedRecipeIndex();
|
|
||||||
int nextRecipe = getNextIndex(currentRecipe, recipes.size(), next);
|
|
||||||
|
|
||||||
if (nextRecipe == 0) {
|
|
||||||
screen.getScrolling().scrollTo(0.0, true);
|
|
||||||
} else if (nextRecipe == recipes.size() - 1) {
|
|
||||||
screen.getScrolling().scrollTo(screen.getScrolling().getMaxScroll(), true);
|
|
||||||
} else {
|
|
||||||
double scrollAmount = screen.getScrolling().getMaxScroll() / (float) recipes.size();
|
|
||||||
screen.getScrolling().offset(next ? scrollAmount : -scrollAmount, true);
|
|
||||||
}
|
|
||||||
|
|
||||||
screen.setSelectedRecipeIndex(nextRecipe);
|
|
||||||
screen.lambdacontrols_init();
|
|
||||||
|
|
||||||
return true;
|
|
||||||
}
|
|
||||||
|
|
||||||
return false;
|
|
||||||
};
|
|
||||||
}
|
|
||||||
|
|
||||||
private static int getNextIndex(int currentIndex, int size, boolean next) {
|
|
||||||
int nextIndex = currentIndex + (next ? 1 : -1);
|
|
||||||
if (nextIndex < 0)
|
|
||||||
nextIndex = size - 1;
|
|
||||||
else if (nextIndex >= size)
|
|
||||||
nextIndex = 0;
|
|
||||||
return nextIndex;
|
|
||||||
}
|
|
||||||
*/
|
|
||||||
}
|
|
||||||
@@ -0,0 +1,41 @@
|
|||||||
|
package eu.midnightdust.midnightcontrols.client.compat;
|
||||||
|
|
||||||
|
import eu.midnightdust.midnightcontrols.MidnightControls;
|
||||||
|
import eu.midnightdust.midnightcontrols.client.MidnightControlsClient;
|
||||||
|
import eu.midnightdust.midnightcontrols.client.MidnightControlsConfig;
|
||||||
|
import eu.midnightdust.midnightcontrols.client.compat.mixin.SodiumOptionsGUIAccessor;
|
||||||
|
import eu.midnightdust.midnightcontrols.client.controller.InputManager;
|
||||||
|
import me.jellysquid.mods.sodium.client.gui.SodiumOptionsGUI;
|
||||||
|
import me.jellysquid.mods.sodium.client.gui.options.control.ControlElement;
|
||||||
|
import net.minecraft.client.MinecraftClient;
|
||||||
|
import net.minecraft.client.gui.screen.Screen;
|
||||||
|
|
||||||
|
public class SodiumCompat {
|
||||||
|
private static final MinecraftClient client = MinecraftClient.getInstance();
|
||||||
|
public static void handleInput(Screen screen, boolean direction) {
|
||||||
|
if (screen instanceof SodiumOptionsGUI optionsGUI) {
|
||||||
|
SodiumOptionsGUIAccessor accessor = (SodiumOptionsGUIAccessor) optionsGUI;
|
||||||
|
final int max = accessor.getControls().size()-1;
|
||||||
|
|
||||||
|
var option = accessor.getControls().stream().filter(ControlElement::isHovered).findFirst().orElse(accessor.getControls().get(0));
|
||||||
|
int i = accessor.getControls().indexOf(option);
|
||||||
|
i = (direction ? ((max > i) ? ++i : 0) : (i > 0 ? --i : max));
|
||||||
|
|
||||||
|
var dimensions = accessor.getControls().get(i).getDimensions();
|
||||||
|
InputManager.INPUT_MANAGER.targetMouseX = (int) (client.getWindow().getScaleFactor() * dimensions.getCenterX());
|
||||||
|
InputManager.INPUT_MANAGER.targetMouseY = (int) (client.getWindow().getScaleFactor() * dimensions.getCenterY());
|
||||||
|
MidnightControlsClient.get().input.actionGuiCooldown = 5;
|
||||||
|
if (MidnightControlsConfig.debug) MidnightControls.get().log(i+" "+accessor.getControls().size()+" | " + dimensions.getCenterX() + " " + dimensions.getCenterY());
|
||||||
|
}
|
||||||
|
}
|
||||||
|
public static void handleTabs(Screen screen, boolean direction) {
|
||||||
|
if (screen instanceof SodiumOptionsGUI optionsGUI) {
|
||||||
|
SodiumOptionsGUIAccessor accessor = (SodiumOptionsGUIAccessor) optionsGUI;
|
||||||
|
final int max = accessor.getPages().size()-1;
|
||||||
|
int i = accessor.getPages().indexOf(accessor.getCurrentPage());
|
||||||
|
i = (direction ? ((max > i) ? ++i : 0) : (i > 0 ? --i : max));
|
||||||
|
if (MidnightControlsConfig.debug) MidnightControls.get().log(""+i);
|
||||||
|
optionsGUI.setPage(accessor.getPages().get(i));
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -1,30 +0,0 @@
|
|||||||
/*
|
|
||||||
* Copyright © 2021 LambdAurora <aurora42lambda@gmail.com>
|
|
||||||
*
|
|
||||||
* This file is part of midnightcontrols.
|
|
||||||
*
|
|
||||||
* Licensed under the MIT license. For more information,
|
|
||||||
* see the LICENSE file.
|
|
||||||
*/
|
|
||||||
|
|
||||||
package eu.midnightdust.midnightcontrols.client.compat.mixin;
|
|
||||||
|
|
||||||
import net.minecraft.client.gui.Element;
|
|
||||||
import net.minecraft.client.gui.widget.EntryListWidget;
|
|
||||||
import org.spongepowered.asm.mixin.Mixin;
|
|
||||||
import org.spongepowered.asm.mixin.gen.Accessor;
|
|
||||||
|
|
||||||
import java.util.List;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Represents an accessor to REI's EntryListWidget.
|
|
||||||
*
|
|
||||||
* @author LambdAurora
|
|
||||||
* @version 1.5.0
|
|
||||||
* @since 1.5.0
|
|
||||||
*/
|
|
||||||
@Mixin(value = EntryListWidget.class, remap = false)
|
|
||||||
public interface EntryListWidgetAccessor {
|
|
||||||
@Accessor(value = "children")
|
|
||||||
List<Element> getEntries();
|
|
||||||
}
|
|
||||||
@@ -1,23 +0,0 @@
|
|||||||
/*
|
|
||||||
* Copyright © 2021 LambdAurora <aurora42lambda@gmail.com>
|
|
||||||
*
|
|
||||||
* This file is part of midnightcontrols.
|
|
||||||
*
|
|
||||||
* Licensed under the MIT license. For more information,
|
|
||||||
* see the LICENSE file.
|
|
||||||
*/
|
|
||||||
|
|
||||||
package eu.midnightdust.midnightcontrols.client.compat.mixin;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Represents an accessor to REI's EntryWidget.
|
|
||||||
*
|
|
||||||
* @author LambdAurora
|
|
||||||
* @version 1.5.0
|
|
||||||
* @since 1.5.0
|
|
||||||
*/
|
|
||||||
//@Mixin(value = EntryWidget.class, remap = false)
|
|
||||||
public interface EntryWidgetAccessor {
|
|
||||||
/*@Invoker("getCurrentEntry")
|
|
||||||
EntryStack midnightcontrols_getCurrentEntry();*/
|
|
||||||
}
|
|
||||||
@@ -1,32 +0,0 @@
|
|||||||
/*
|
|
||||||
* Copyright © 2021 LambdAurora <aurora42lambda@gmail.com>
|
|
||||||
*
|
|
||||||
* This file is part of midnightcontrols.
|
|
||||||
*
|
|
||||||
* Licensed under the MIT license. For more information,
|
|
||||||
* see the LICENSE file.
|
|
||||||
*/
|
|
||||||
|
|
||||||
package eu.midnightdust.midnightcontrols.client.compat.mixin;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Represents an accessor to REI's RecipeViewingScreen.
|
|
||||||
*
|
|
||||||
* @author LambdAurora
|
|
||||||
* @version 1.7.0
|
|
||||||
* @since 1.2.0
|
|
||||||
*/
|
|
||||||
//@Mixin(value = DefaultDisplayViewingScreen.class, remap = false)
|
|
||||||
public interface RecipeViewingScreenAccessor {
|
|
||||||
/*@Accessor("categoryBack")
|
|
||||||
Button getCategoryBack();
|
|
||||||
|
|
||||||
@Accessor("categoryNext")
|
|
||||||
Button getCategoryNext();
|
|
||||||
|
|
||||||
@Accessor("recipeBack")
|
|
||||||
Button getRecipeBack();
|
|
||||||
|
|
||||||
@Accessor("recipeNext")
|
|
||||||
Button getRecipeNext();*/
|
|
||||||
}
|
|
||||||
@@ -0,0 +1,19 @@
|
|||||||
|
package eu.midnightdust.midnightcontrols.client.compat.mixin;
|
||||||
|
|
||||||
|
import me.jellysquid.mods.sodium.client.gui.SodiumOptionsGUI;
|
||||||
|
import me.jellysquid.mods.sodium.client.gui.options.OptionPage;
|
||||||
|
import me.jellysquid.mods.sodium.client.gui.options.control.ControlElement;
|
||||||
|
import org.spongepowered.asm.mixin.Mixin;
|
||||||
|
import org.spongepowered.asm.mixin.gen.Accessor;
|
||||||
|
|
||||||
|
import java.util.List;
|
||||||
|
|
||||||
|
@Mixin(value = SodiumOptionsGUI.class, remap = false)
|
||||||
|
public interface SodiumOptionsGUIAccessor {
|
||||||
|
@Accessor
|
||||||
|
List<ControlElement<?>> getControls();
|
||||||
|
@Accessor
|
||||||
|
List<OptionPage> getPages();
|
||||||
|
@Accessor
|
||||||
|
OptionPage getCurrentPage();
|
||||||
|
}
|
||||||
@@ -1,44 +0,0 @@
|
|||||||
/*
|
|
||||||
* Copyright © 2021 LambdAurora <aurora42lambda@gmail.com>
|
|
||||||
*
|
|
||||||
* This file is part of midnightcontrols.
|
|
||||||
*
|
|
||||||
* Licensed under the MIT license. For more information,
|
|
||||||
* see the LICENSE file.
|
|
||||||
*/
|
|
||||||
|
|
||||||
package eu.midnightdust.midnightcontrols.client.compat.mixin;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Represents an accessor to REI's VillagerRecipeViewingScreen.
|
|
||||||
*
|
|
||||||
* @author LambdAurora
|
|
||||||
* @version 1.7.0
|
|
||||||
* @since 1.2.0
|
|
||||||
*/
|
|
||||||
//@Mixin(CompositeDisplayViewingScreen.class)
|
|
||||||
public interface VillagerRecipeViewingScreenAccessor {
|
|
||||||
/*@Accessor(value = "categoryMap", remap = false)
|
|
||||||
Map<DisplayCategory<?>, List<Display>> getCategoryMap();
|
|
||||||
|
|
||||||
@Accessor(value = "categories", remap = false)
|
|
||||||
List<DisplayCategory<?>> getCategories();
|
|
||||||
|
|
||||||
@Accessor(value = "selectedCategoryIndex", remap = false)
|
|
||||||
int getSelectedCategoryIndex();
|
|
||||||
|
|
||||||
@Accessor(value = "selectedCategoryIndex", remap = false)
|
|
||||||
void setSelectedCategoryIndex(int selectedCategoryIndex);
|
|
||||||
|
|
||||||
@Accessor(value = "selectedRecipeIndex", remap = false)
|
|
||||||
int getSelectedRecipeIndex();
|
|
||||||
|
|
||||||
@Accessor(value = "selectedRecipeIndex", remap = false)
|
|
||||||
void setSelectedRecipeIndex(int selectedRecipeIndex);
|
|
||||||
|
|
||||||
@Accessor(value = "scrolling", remap = false)
|
|
||||||
ScrollingContainer getScrolling();
|
|
||||||
|
|
||||||
@Invoker("init")
|
|
||||||
void midnightcontrols_init();*/
|
|
||||||
}
|
|
||||||
@@ -13,8 +13,8 @@ import eu.midnightdust.midnightcontrols.client.ButtonState;
|
|||||||
import net.minecraft.client.MinecraftClient;
|
import net.minecraft.client.MinecraftClient;
|
||||||
import net.minecraft.client.option.GameOptions;
|
import net.minecraft.client.option.GameOptions;
|
||||||
import net.minecraft.client.option.KeyBinding;
|
import net.minecraft.client.option.KeyBinding;
|
||||||
|
import net.minecraft.client.resource.language.I18n;
|
||||||
import net.minecraft.text.Text;
|
import net.minecraft.text.Text;
|
||||||
import net.minecraft.text.TranslatableText;
|
|
||||||
import net.minecraft.util.Identifier;
|
import net.minecraft.util.Identifier;
|
||||||
import org.aperlambda.lambdacommon.utils.function.PairPredicate;
|
import org.aperlambda.lambdacommon.utils.function.PairPredicate;
|
||||||
import org.aperlambda.lambdacommon.utils.function.Predicates;
|
import org.aperlambda.lambdacommon.utils.function.Predicates;
|
||||||
@@ -76,9 +76,19 @@ public class ButtonBinding {
|
|||||||
public static final ButtonBinding SPRINT = new Builder("sprint").buttons(GLFW_GAMEPAD_BUTTON_LEFT_THUMB).onlyInGame().register();
|
public static final ButtonBinding SPRINT = new Builder("sprint").buttons(GLFW_GAMEPAD_BUTTON_LEFT_THUMB).onlyInGame().register();
|
||||||
public static final ButtonBinding SWAP_HANDS = new Builder("swap_hands").buttons(GLFW_GAMEPAD_BUTTON_X).onlyInGame().cooldown().register();
|
public static final ButtonBinding SWAP_HANDS = new Builder("swap_hands").buttons(GLFW_GAMEPAD_BUTTON_X).onlyInGame().cooldown().register();
|
||||||
public static final ButtonBinding TAB_LEFT = new Builder("tab_back").buttons(GLFW_GAMEPAD_BUTTON_LEFT_BUMPER)
|
public static final ButtonBinding TAB_LEFT = new Builder("tab_back").buttons(GLFW_GAMEPAD_BUTTON_LEFT_BUMPER)
|
||||||
.action(InputHandlers.handleHotbar(false)).filter(Predicates.or(InputHandlers::inInventory, InputHandlers::inAdvancements)).cooldown().register();
|
.action(InputHandlers.handleHotbar(false)).filter(Predicates.or(InputHandlers::inInventory, InputHandlers::inAdvancements).or((client, binding) -> client.currentScreen != null && client.currentScreen.getClass().toString().contains("sodium"))).cooldown().register();
|
||||||
public static final ButtonBinding TAB_RIGHT = new Builder("tab_next").buttons(GLFW_GAMEPAD_BUTTON_RIGHT_BUMPER)
|
public static final ButtonBinding TAB_RIGHT = new Builder("tab_next").buttons(GLFW_GAMEPAD_BUTTON_RIGHT_BUMPER)
|
||||||
.action(InputHandlers.handleHotbar(true)).filter(Predicates.or(InputHandlers::inInventory, InputHandlers::inAdvancements)).cooldown().register();
|
.action(InputHandlers.handleHotbar(true)).filter(Predicates.or(InputHandlers::inInventory, InputHandlers::inAdvancements).or((client, binding) -> client.currentScreen != null && client.currentScreen.getClass().toString().contains("sodium"))).cooldown().register();
|
||||||
|
public static final ButtonBinding PAGE_LEFT = new Builder("page_back").buttons(axisAsButton(GLFW_GAMEPAD_AXIS_LEFT_TRIGGER, true))
|
||||||
|
.action(InputHandlers.handlePage(false)).filter(InputHandlers::inInventory).cooldown().register();
|
||||||
|
public static final ButtonBinding PAGE_RIGHT = new Builder("page_next").buttons(axisAsButton(GLFW_GAMEPAD_AXIS_RIGHT_TRIGGER, true))
|
||||||
|
.action(InputHandlers.handlePage(true)).filter(InputHandlers::inInventory).cooldown().register();
|
||||||
|
public static final ButtonBinding TAKE = new Builder("take").buttons(GLFW_GAMEPAD_BUTTON_X)
|
||||||
|
.action(InputHandlers.handleActions()).filter(InputHandlers::inInventory).cooldown().register();
|
||||||
|
public static final ButtonBinding TAKE_ALL = new Builder("take_all").buttons(GLFW_GAMEPAD_BUTTON_A)
|
||||||
|
.action(InputHandlers.handleActions()).filter(InputHandlers::inInventory).cooldown().register();
|
||||||
|
public static final ButtonBinding QUICK_MOVE = new Builder("quick_move").buttons(GLFW_GAMEPAD_BUTTON_Y)
|
||||||
|
.action(InputHandlers.handleActions()).filter(InputHandlers::inInventory).cooldown().register();
|
||||||
public static final ButtonBinding TOGGLE_PERSPECTIVE = new Builder("toggle_perspective").buttons(GLFW_GAMEPAD_BUTTON_DPAD_UP, GLFW_GAMEPAD_BUTTON_Y).cooldown().register();
|
public static final ButtonBinding TOGGLE_PERSPECTIVE = new Builder("toggle_perspective").buttons(GLFW_GAMEPAD_BUTTON_DPAD_UP, GLFW_GAMEPAD_BUTTON_Y).cooldown().register();
|
||||||
public static final ButtonBinding USE = new Builder("use").buttons(axisAsButton(GLFW_GAMEPAD_AXIS_LEFT_TRIGGER, true)).register();
|
public static final ButtonBinding USE = new Builder("use").buttons(axisAsButton(GLFW_GAMEPAD_AXIS_LEFT_TRIGGER, true)).register();
|
||||||
|
|
||||||
@@ -96,7 +106,7 @@ public class ButtonBinding {
|
|||||||
public ButtonBinding(String key, int[] defaultButton, List<PressAction> actions, PairPredicate<MinecraftClient, ButtonBinding> filter, boolean hasCooldown) {
|
public ButtonBinding(String key, int[] defaultButton, List<PressAction> actions, PairPredicate<MinecraftClient, ButtonBinding> filter, boolean hasCooldown) {
|
||||||
this.setButton(this.defaultButton = defaultButton);
|
this.setButton(this.defaultButton = defaultButton);
|
||||||
this.key = key;
|
this.key = key;
|
||||||
this.text = new TranslatableText(this.key);
|
this.text = Text.translatable(this.key);
|
||||||
this.filter = filter;
|
this.filter = filter;
|
||||||
this.actions.addAll(actions);
|
this.actions.addAll(actions);
|
||||||
this.hasCooldown = hasCooldown;
|
this.hasCooldown = hasCooldown;
|
||||||
@@ -239,7 +249,7 @@ public class ButtonBinding {
|
|||||||
* @return the translation key
|
* @return the translation key
|
||||||
*/
|
*/
|
||||||
public @NotNull String getTranslationKey() {
|
public @NotNull String getTranslationKey() {
|
||||||
return "midnightcontrols.action." + this.getName();
|
return I18n.hasTranslation("midnightcontrols.action." + this.getName()) ? "midnightcontrols.action." + this.getName() : this.getName();
|
||||||
}
|
}
|
||||||
|
|
||||||
public @NotNull Text getText() {
|
public @NotNull Text getText() {
|
||||||
@@ -295,24 +305,24 @@ public class ButtonBinding {
|
|||||||
}
|
}
|
||||||
|
|
||||||
public static void init(@NotNull GameOptions options) {
|
public static void init(@NotNull GameOptions options) {
|
||||||
ATTACK.mcKeyBinding = options.keyAttack;
|
ATTACK.mcKeyBinding = options.attackKey;
|
||||||
BACK.mcKeyBinding = options.keyBack;
|
BACK.mcKeyBinding = options.backKey;
|
||||||
CHAT.mcKeyBinding = options.keyChat;
|
CHAT.mcKeyBinding = options.chatKey;
|
||||||
DROP_ITEM.mcKeyBinding = options.keyDrop;
|
DROP_ITEM.mcKeyBinding = options.dropKey;
|
||||||
FORWARD.mcKeyBinding = options.keyForward;
|
FORWARD.mcKeyBinding = options.forwardKey;
|
||||||
INVENTORY.mcKeyBinding = options.keyInventory;
|
INVENTORY.mcKeyBinding = options.inventoryKey;
|
||||||
JUMP.mcKeyBinding = options.keyJump;
|
JUMP.mcKeyBinding = options.jumpKey;
|
||||||
LEFT.mcKeyBinding = options.keyLeft;
|
LEFT.mcKeyBinding = options.leftKey;
|
||||||
PICK_BLOCK.mcKeyBinding = options.keyPickItem;
|
PICK_BLOCK.mcKeyBinding = options.pickItemKey;
|
||||||
PLAYER_LIST.mcKeyBinding = options.keyPlayerList;
|
PLAYER_LIST.mcKeyBinding = options.playerListKey;
|
||||||
RIGHT.mcKeyBinding = options.keyRight;
|
RIGHT.mcKeyBinding = options.rightKey;
|
||||||
SCREENSHOT.mcKeyBinding = options.keyScreenshot;
|
SCREENSHOT.mcKeyBinding = options.screenshotKey;
|
||||||
SMOOTH_CAMERA.mcKeyBinding = options.keySmoothCamera;
|
SMOOTH_CAMERA.mcKeyBinding = options.smoothCameraKey;
|
||||||
SNEAK.mcKeyBinding = options.keySneak;
|
SNEAK.mcKeyBinding = options.sneakKey;
|
||||||
SPRINT.mcKeyBinding = options.keySprint;
|
SPRINT.mcKeyBinding = options.sprintKey;
|
||||||
SWAP_HANDS.mcKeyBinding = options.keySwapHands;
|
SWAP_HANDS.mcKeyBinding = options.swapHandsKey;
|
||||||
TOGGLE_PERSPECTIVE.mcKeyBinding = options.keyTogglePerspective;
|
TOGGLE_PERSPECTIVE.mcKeyBinding = options.togglePerspectiveKey;
|
||||||
USE.mcKeyBinding = options.keyUse;
|
USE.mcKeyBinding = options.useKey;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@@ -323,37 +333,37 @@ public class ButtonBinding {
|
|||||||
*/
|
*/
|
||||||
public static @NotNull Text getLocalizedButtonName(int button) {
|
public static @NotNull Text getLocalizedButtonName(int button) {
|
||||||
return switch (button % 500) {
|
return switch (button % 500) {
|
||||||
case -1 -> new TranslatableText("key.keyboard.unknown");
|
case -1 -> Text.translatable("key.keyboard.unknown");
|
||||||
case GLFW_GAMEPAD_BUTTON_A -> new TranslatableText("midnightcontrols.button.a");
|
case GLFW_GAMEPAD_BUTTON_A -> Text.translatable("midnightcontrols.button.a");
|
||||||
case GLFW_GAMEPAD_BUTTON_B -> new TranslatableText("midnightcontrols.button.b");
|
case GLFW_GAMEPAD_BUTTON_B -> Text.translatable("midnightcontrols.button.b");
|
||||||
case GLFW_GAMEPAD_BUTTON_X -> new TranslatableText("midnightcontrols.button.x");
|
case GLFW_GAMEPAD_BUTTON_X -> Text.translatable("midnightcontrols.button.x");
|
||||||
case GLFW_GAMEPAD_BUTTON_Y -> new TranslatableText("midnightcontrols.button.y");
|
case GLFW_GAMEPAD_BUTTON_Y -> Text.translatable("midnightcontrols.button.y");
|
||||||
case GLFW_GAMEPAD_BUTTON_LEFT_BUMPER -> new TranslatableText("midnightcontrols.button.left_bumper");
|
case GLFW_GAMEPAD_BUTTON_LEFT_BUMPER -> Text.translatable("midnightcontrols.button.left_bumper");
|
||||||
case GLFW_GAMEPAD_BUTTON_RIGHT_BUMPER -> new TranslatableText("midnightcontrols.button.right_bumper");
|
case GLFW_GAMEPAD_BUTTON_RIGHT_BUMPER -> Text.translatable("midnightcontrols.button.right_bumper");
|
||||||
case GLFW_GAMEPAD_BUTTON_BACK -> new TranslatableText("midnightcontrols.button.back");
|
case GLFW_GAMEPAD_BUTTON_BACK -> Text.translatable("midnightcontrols.button.back");
|
||||||
case GLFW_GAMEPAD_BUTTON_START -> new TranslatableText("midnightcontrols.button.start");
|
case GLFW_GAMEPAD_BUTTON_START -> Text.translatable("midnightcontrols.button.start");
|
||||||
case GLFW_GAMEPAD_BUTTON_GUIDE -> new TranslatableText("midnightcontrols.button.guide");
|
case GLFW_GAMEPAD_BUTTON_GUIDE -> Text.translatable("midnightcontrols.button.guide");
|
||||||
case GLFW_GAMEPAD_BUTTON_LEFT_THUMB -> new TranslatableText("midnightcontrols.button.left_thumb");
|
case GLFW_GAMEPAD_BUTTON_LEFT_THUMB -> Text.translatable("midnightcontrols.button.left_thumb");
|
||||||
case GLFW_GAMEPAD_BUTTON_RIGHT_THUMB -> new TranslatableText("midnightcontrols.button.right_thumb");
|
case GLFW_GAMEPAD_BUTTON_RIGHT_THUMB -> Text.translatable("midnightcontrols.button.right_thumb");
|
||||||
case GLFW_GAMEPAD_BUTTON_DPAD_UP -> new TranslatableText("midnightcontrols.button.dpad_up");
|
case GLFW_GAMEPAD_BUTTON_DPAD_UP -> Text.translatable("midnightcontrols.button.dpad_up");
|
||||||
case GLFW_GAMEPAD_BUTTON_DPAD_RIGHT -> new TranslatableText("midnightcontrols.button.dpad_right");
|
case GLFW_GAMEPAD_BUTTON_DPAD_RIGHT -> Text.translatable("midnightcontrols.button.dpad_right");
|
||||||
case GLFW_GAMEPAD_BUTTON_DPAD_DOWN -> new TranslatableText("midnightcontrols.button.dpad_down");
|
case GLFW_GAMEPAD_BUTTON_DPAD_DOWN -> Text.translatable("midnightcontrols.button.dpad_down");
|
||||||
case GLFW_GAMEPAD_BUTTON_DPAD_LEFT -> new TranslatableText("midnightcontrols.button.dpad_left");
|
case GLFW_GAMEPAD_BUTTON_DPAD_LEFT -> Text.translatable("midnightcontrols.button.dpad_left");
|
||||||
case 100 -> new TranslatableText("midnightcontrols.axis.left_x+");
|
case 100 -> Text.translatable("midnightcontrols.axis.left_x+");
|
||||||
case 101 -> new TranslatableText("midnightcontrols.axis.left_y+");
|
case 101 -> Text.translatable("midnightcontrols.axis.left_y+");
|
||||||
case 102 -> new TranslatableText("midnightcontrols.axis.right_x+");
|
case 102 -> Text.translatable("midnightcontrols.axis.right_x+");
|
||||||
case 103 -> new TranslatableText("midnightcontrols.axis.right_y+");
|
case 103 -> Text.translatable("midnightcontrols.axis.right_y+");
|
||||||
case 104 -> new TranslatableText("midnightcontrols.axis.left_trigger");
|
case 104 -> Text.translatable("midnightcontrols.axis.left_trigger");
|
||||||
case 105 -> new TranslatableText("midnightcontrols.axis.right_trigger");
|
case 105 -> Text.translatable("midnightcontrols.axis.right_trigger");
|
||||||
case 200 -> new TranslatableText("midnightcontrols.axis.left_x-");
|
case 200 -> Text.translatable("midnightcontrols.axis.left_x-");
|
||||||
case 201 -> new TranslatableText("midnightcontrols.axis.left_y-");
|
case 201 -> Text.translatable("midnightcontrols.axis.left_y-");
|
||||||
case 202 -> new TranslatableText("midnightcontrols.axis.right_x-");
|
case 202 -> Text.translatable("midnightcontrols.axis.right_x-");
|
||||||
case 203 -> new TranslatableText("midnightcontrols.axis.right_y-");
|
case 203 -> Text.translatable("midnightcontrols.axis.right_y-");
|
||||||
case 15 -> new TranslatableText("midnightcontrols.button.l4");
|
case 15 -> Text.translatable("midnightcontrols.button.l4");
|
||||||
case 16 -> new TranslatableText("midnightcontrols.button.l5");
|
case 16 -> Text.translatable("midnightcontrols.button.l5");
|
||||||
case 17 -> new TranslatableText("midnightcontrols.button.r4");
|
case 17 -> Text.translatable("midnightcontrols.button.r4");
|
||||||
case 18 -> new TranslatableText("midnightcontrols.button.r5");
|
case 18 -> Text.translatable("midnightcontrols.button.r5");
|
||||||
default -> new TranslatableText("midnightcontrols.button.unknown", button);
|
default -> Text.translatable("midnightcontrols.button.unknown", button);
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -376,7 +386,12 @@ public class ButtonBinding {
|
|||||||
ButtonBinding.HOTBAR_LEFT,
|
ButtonBinding.HOTBAR_LEFT,
|
||||||
ButtonBinding.HOTBAR_RIGHT,
|
ButtonBinding.HOTBAR_RIGHT,
|
||||||
ButtonBinding.INVENTORY,
|
ButtonBinding.INVENTORY,
|
||||||
ButtonBinding.SWAP_HANDS
|
ButtonBinding.SWAP_HANDS,
|
||||||
|
ButtonBinding.PAGE_LEFT,
|
||||||
|
ButtonBinding.PAGE_RIGHT,
|
||||||
|
ButtonBinding.TAKE,
|
||||||
|
ButtonBinding.TAKE_ALL,
|
||||||
|
ButtonBinding.QUICK_MOVE
|
||||||
));
|
));
|
||||||
MULTIPLAYER_CATEGORY = InputManager.registerDefaultCategory("key.categories.multiplayer",
|
MULTIPLAYER_CATEGORY = InputManager.registerDefaultCategory("key.categories.multiplayer",
|
||||||
category -> category.registerAllBindings(ButtonBinding.CHAT, ButtonBinding.PLAYER_LIST));
|
category -> category.registerAllBindings(ButtonBinding.CHAT, ButtonBinding.PLAYER_LIST));
|
||||||
@@ -426,7 +441,7 @@ public class ButtonBinding {
|
|||||||
}
|
}
|
||||||
|
|
||||||
public Builder(@NotNull Identifier identifier) {
|
public Builder(@NotNull Identifier identifier) {
|
||||||
this(identifier.getNamespace() + "." + identifier.getNamespace());
|
this(identifier.getNamespace() + "." + identifier.getPath());
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|||||||
@@ -13,9 +13,9 @@ import eu.midnightdust.midnightcontrols.MidnightControls;
|
|||||||
import eu.midnightdust.midnightcontrols.client.MidnightControlsClient;
|
import eu.midnightdust.midnightcontrols.client.MidnightControlsClient;
|
||||||
import eu.midnightdust.midnightcontrols.client.MidnightControlsConfig;
|
import eu.midnightdust.midnightcontrols.client.MidnightControlsConfig;
|
||||||
import net.minecraft.client.MinecraftClient;
|
import net.minecraft.client.MinecraftClient;
|
||||||
|
import net.minecraft.client.resource.language.I18n;
|
||||||
import net.minecraft.client.toast.SystemToast;
|
import net.minecraft.client.toast.SystemToast;
|
||||||
import net.minecraft.text.LiteralText;
|
import net.minecraft.text.Text;
|
||||||
import net.minecraft.text.TranslatableText;
|
|
||||||
import org.aperlambda.lambdacommon.utils.Nameable;
|
import org.aperlambda.lambdacommon.utils.Nameable;
|
||||||
import org.jetbrains.annotations.NotNull;
|
import org.jetbrains.annotations.NotNull;
|
||||||
import org.lwjgl.glfw.GLFW;
|
import org.lwjgl.glfw.GLFW;
|
||||||
@@ -137,7 +137,7 @@ public record Controller(int id) implements Nameable {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
buffer.flip(); // Force Java 8 >.<
|
if (buffer != null) buffer.flip(); // Force Java 8 >.<
|
||||||
return buffer;
|
return buffer;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -150,7 +150,6 @@ public record Controller(int id) implements Nameable {
|
|||||||
File databaseFile = new File("config/gamecontrollerdatabase.txt");
|
File databaseFile = new File("config/gamecontrollerdatabase.txt");
|
||||||
try {
|
try {
|
||||||
BufferedInputStream in = new BufferedInputStream(new URL("https://raw.githubusercontent.com/gabomdq/SDL_GameControllerDB/master/gamecontrollerdb.txt").openStream());
|
BufferedInputStream in = new BufferedInputStream(new URL("https://raw.githubusercontent.com/gabomdq/SDL_GameControllerDB/master/gamecontrollerdb.txt").openStream());
|
||||||
|
|
||||||
BufferedOutputStream out = new BufferedOutputStream(new FileOutputStream(databaseFile));
|
BufferedOutputStream out = new BufferedOutputStream(new FileOutputStream(databaseFile));
|
||||||
byte[] dataBuffer = new byte[1024];
|
byte[] dataBuffer = new byte[1024];
|
||||||
int bytesRead;
|
int bytesRead;
|
||||||
@@ -160,11 +159,11 @@ public record Controller(int id) implements Nameable {
|
|||||||
out.close();
|
out.close();
|
||||||
} catch (Exception ignored) {/* Just continue when internet connection is not available */}
|
} catch (Exception ignored) {/* Just continue when internet connection is not available */}
|
||||||
var database = ioResourceToBuffer(databaseFile.getPath(), 1024);
|
var database = ioResourceToBuffer(databaseFile.getPath(), 1024);
|
||||||
GLFW.glfwUpdateGamepadMappings(database);
|
if (database != null) GLFW.glfwUpdateGamepadMappings(database);
|
||||||
if (!MidnightControlsClient.MAPPINGS_FILE.exists())
|
if (!MidnightControlsClient.MAPPINGS_FILE.exists())
|
||||||
return;
|
return;
|
||||||
var buffer = ioResourceToBuffer(MidnightControlsClient.MAPPINGS_FILE.getPath(), 1024);
|
var buffer = ioResourceToBuffer(MidnightControlsClient.MAPPINGS_FILE.getPath(), 1024);
|
||||||
GLFW.glfwUpdateGamepadMappings(buffer);
|
if (buffer != null) GLFW.glfwUpdateGamepadMappings(buffer);
|
||||||
} catch (IOException e) {
|
} catch (IOException e) {
|
||||||
e.printStackTrace();
|
e.printStackTrace();
|
||||||
}
|
}
|
||||||
@@ -178,7 +177,8 @@ public record Controller(int id) implements Nameable {
|
|||||||
var client = MinecraftClient.getInstance();
|
var client = MinecraftClient.getInstance();
|
||||||
if (client != null) {
|
if (client != null) {
|
||||||
client.getToastManager().add(SystemToast.create(client, SystemToast.Type.TUTORIAL_HINT,
|
client.getToastManager().add(SystemToast.create(client, SystemToast.Type.TUTORIAL_HINT,
|
||||||
new TranslatableText("midnightcontrols.controller.mappings.error"), new LiteralText(string)));
|
Text.translatable("midnightcontrols.controller.mappings.error"), Text.literal(string)));
|
||||||
|
MidnightControls.get().log(I18n.translate("midnightcontrols.controller.mappings.error")+string);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
} catch (Throwable e) {
|
} catch (Throwable e) {
|
||||||
|
|||||||
@@ -10,27 +10,39 @@
|
|||||||
package eu.midnightdust.midnightcontrols.client.controller;
|
package eu.midnightdust.midnightcontrols.client.controller;
|
||||||
|
|
||||||
import eu.midnightdust.midnightcontrols.client.ButtonState;
|
import eu.midnightdust.midnightcontrols.client.ButtonState;
|
||||||
|
import eu.midnightdust.midnightcontrols.client.MidnightControlsClient;
|
||||||
import eu.midnightdust.midnightcontrols.client.MidnightInput;
|
import eu.midnightdust.midnightcontrols.client.MidnightInput;
|
||||||
|
import eu.midnightdust.midnightcontrols.client.compat.MidnightControlsCompat;
|
||||||
|
import eu.midnightdust.midnightcontrols.client.compat.SodiumCompat;
|
||||||
import eu.midnightdust.midnightcontrols.client.mixin.AdvancementsScreenAccessor;
|
import eu.midnightdust.midnightcontrols.client.mixin.AdvancementsScreenAccessor;
|
||||||
import eu.midnightdust.midnightcontrols.client.mixin.CreativeInventoryScreenAccessor;
|
import eu.midnightdust.midnightcontrols.client.mixin.CreativeInventoryScreenAccessor;
|
||||||
import eu.midnightdust.midnightcontrols.client.mixin.RecipeBookWidgetAccessor;
|
import eu.midnightdust.midnightcontrols.client.mixin.RecipeBookWidgetAccessor;
|
||||||
import eu.midnightdust.midnightcontrols.client.util.HandledScreenAccessor;
|
import eu.midnightdust.midnightcontrols.client.util.HandledScreenAccessor;
|
||||||
|
import net.fabricmc.fabric.impl.item.group.CreativeGuiExtensions;
|
||||||
|
import net.fabricmc.loader.api.FabricLoader;
|
||||||
import net.minecraft.client.MinecraftClient;
|
import net.minecraft.client.MinecraftClient;
|
||||||
import net.minecraft.client.gl.Framebuffer;
|
import net.minecraft.client.gl.Framebuffer;
|
||||||
import net.minecraft.client.gui.screen.advancement.AdvancementsScreen;
|
import net.minecraft.client.gui.screen.advancement.AdvancementsScreen;
|
||||||
|
import net.minecraft.client.gui.screen.ingame.CreativeInventoryScreen;
|
||||||
import net.minecraft.client.gui.screen.ingame.HandledScreen;
|
import net.minecraft.client.gui.screen.ingame.HandledScreen;
|
||||||
import net.minecraft.client.gui.screen.ingame.InventoryScreen;
|
import net.minecraft.client.gui.screen.ingame.InventoryScreen;
|
||||||
import net.minecraft.client.util.ScreenshotRecorder;
|
import net.minecraft.client.util.ScreenshotRecorder;
|
||||||
import net.minecraft.item.ItemGroup;
|
import net.minecraft.item.ItemGroup;
|
||||||
|
import net.minecraft.item.Items;
|
||||||
import net.minecraft.screen.slot.Slot;
|
import net.minecraft.screen.slot.Slot;
|
||||||
|
import net.minecraft.screen.slot.SlotActionType;
|
||||||
import org.aperlambda.lambdacommon.utils.Pair;
|
import org.aperlambda.lambdacommon.utils.Pair;
|
||||||
import org.jetbrains.annotations.NotNull;
|
import org.jetbrains.annotations.NotNull;
|
||||||
|
import org.lwjgl.glfw.GLFW;
|
||||||
|
|
||||||
import java.util.Comparator;
|
import java.util.Comparator;
|
||||||
import java.util.Optional;
|
import java.util.Optional;
|
||||||
import java.util.function.Predicate;
|
import java.util.function.Predicate;
|
||||||
import java.util.stream.Collectors;
|
import java.util.stream.Collectors;
|
||||||
|
|
||||||
|
import static org.lwjgl.glfw.GLFW.*;
|
||||||
|
import static org.lwjgl.glfw.GLFW.GLFW_MOUSE_BUTTON_2;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Represents some input handlers.
|
* Represents some input handlers.
|
||||||
*
|
*
|
||||||
@@ -55,7 +67,7 @@ public class InputHandlers {
|
|||||||
client.player.getInventory().selectedSlot = client.player.getInventory().selectedSlot == 0 ? 8 : client.player.getInventory().selectedSlot - 1;
|
client.player.getInventory().selectedSlot = client.player.getInventory().selectedSlot == 0 ? 8 : client.player.getInventory().selectedSlot - 1;
|
||||||
return true;
|
return true;
|
||||||
} else if (client.currentScreen instanceof CreativeInventoryScreenAccessor inventory) {
|
} else if (client.currentScreen instanceof CreativeInventoryScreenAccessor inventory) {
|
||||||
int currentTab = inventory.getSelectedTab();
|
int currentTab = CreativeInventoryScreenAccessor.getSelectedTab();
|
||||||
int nextTab = currentTab + (next ? 1 : -1);
|
int nextTab = currentTab + (next ? 1 : -1);
|
||||||
if (nextTab < 0)
|
if (nextTab < 0)
|
||||||
nextTab = ItemGroup.GROUPS.length - 1;
|
nextTab = ItemGroup.GROUPS.length - 1;
|
||||||
@@ -96,10 +108,78 @@ public class InputHandlers {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
return true;
|
return true;
|
||||||
|
} else if (FabricLoader.getInstance().isModLoaded("sodium")) SodiumCompat.handleTabs(client.currentScreen, next);
|
||||||
|
return false;
|
||||||
|
};
|
||||||
|
}
|
||||||
|
public static PressAction handlePage(boolean next) {
|
||||||
|
return (client, button, value, action) -> {
|
||||||
|
if (client.currentScreen instanceof CreativeInventoryScreen) {
|
||||||
|
var screen = (HandledScreenAccessor) client.currentScreen;
|
||||||
|
try {
|
||||||
|
if (next) {
|
||||||
|
((CreativeGuiExtensions) screen).fabric_nextPage();
|
||||||
|
} else {
|
||||||
|
((CreativeGuiExtensions) screen).fabric_previousPage();
|
||||||
|
}
|
||||||
|
} catch (Exception ignored) {}
|
||||||
}
|
}
|
||||||
return false;
|
return false;
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
public static PressAction handleActions() {
|
||||||
|
return (client, button, value, action) -> {
|
||||||
|
if (!(client.currentScreen instanceof HandledScreen<?> screen)) return false;
|
||||||
|
if (client.interactionManager == null || client.player == null)
|
||||||
|
return false;
|
||||||
|
|
||||||
|
if (MidnightControlsClient.get().input.inventoryInteractionCooldown > 0)
|
||||||
|
return true;
|
||||||
|
double x = client.mouse.getX() * (double) client.getWindow().getScaledWidth() / (double) client.getWindow().getWidth();
|
||||||
|
double y = client.mouse.getY() * (double) client.getWindow().getScaledHeight() / (double) client.getWindow().getHeight();
|
||||||
|
|
||||||
|
var accessor = (HandledScreenAccessor) screen;
|
||||||
|
Slot slot = ((HandledScreenAccessor) screen).midnightcontrols$getSlotAt(x, y);
|
||||||
|
|
||||||
|
int slotId;
|
||||||
|
if (slot == null) {
|
||||||
|
if (button.getName().equals("take_all")) {
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
slotId = accessor.midnightcontrols$isClickOutsideBounds(x, y, accessor.getX(), accessor.getY(), GLFW_MOUSE_BUTTON_1) ? -999 : -1;
|
||||||
|
} else {
|
||||||
|
slotId = slot.id;
|
||||||
|
}
|
||||||
|
var actionType = SlotActionType.PICKUP;
|
||||||
|
int clickData = GLFW.GLFW_MOUSE_BUTTON_1;
|
||||||
|
|
||||||
|
MidnightControlsClient.get().input.inventoryInteractionCooldown = 5;
|
||||||
|
switch (button.getName()) {
|
||||||
|
case "take_all":
|
||||||
|
if (accessor instanceof CreativeInventoryScreen) {
|
||||||
|
if (((CreativeInventoryScreenAccessor) accessor).midnightcontrols$isCreativeInventorySlot(slot))
|
||||||
|
actionType = SlotActionType.CLONE;
|
||||||
|
if (slot != null && MidnightControlsCompat.streamCompatHandlers().anyMatch(handler -> handler.isCreativeSlot(screen, slot)))
|
||||||
|
actionType = SlotActionType.CLONE;
|
||||||
|
} else {
|
||||||
|
if (slot != null && screen.getScreenHandler().getCursorStack() != null) {
|
||||||
|
return screen.mouseReleased(x, y, GLFW.GLFW_MOUSE_BUTTON_1);
|
||||||
|
} else actionType = SlotActionType.PICKUP_ALL;
|
||||||
|
}
|
||||||
|
break;
|
||||||
|
case "take":
|
||||||
|
clickData = GLFW_MOUSE_BUTTON_2;
|
||||||
|
break;
|
||||||
|
case "quick_move":
|
||||||
|
actionType = SlotActionType.QUICK_MOVE;
|
||||||
|
break;
|
||||||
|
default:
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
accessor.midnightcontrols$onMouseClick(slot, slotId, clickData, actionType);
|
||||||
|
return true;
|
||||||
|
};
|
||||||
|
}
|
||||||
|
|
||||||
public static boolean handlePauseGame(@NotNull MinecraftClient client, @NotNull ButtonBinding binding, float value, @NotNull ButtonState action) {
|
public static boolean handlePauseGame(@NotNull MinecraftClient client, @NotNull ButtonBinding binding, float value, @NotNull ButtonState action) {
|
||||||
if (action == ButtonState.PRESS) {
|
if (action == ButtonState.PRESS) {
|
||||||
@@ -109,7 +189,7 @@ public class InputHandlers {
|
|||||||
else if (client.currentScreen instanceof HandledScreen && client.player != null) // If the current screen is a container then close it.
|
else if (client.currentScreen instanceof HandledScreen && client.player != null) // If the current screen is a container then close it.
|
||||||
client.player.closeHandledScreen();
|
client.player.closeHandledScreen();
|
||||||
else // Else just close the current screen.
|
else // Else just close the current screen.
|
||||||
client.currentScreen.onClose();
|
client.currentScreen.close();
|
||||||
}
|
}
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
@@ -131,12 +211,12 @@ public class InputHandlers {
|
|||||||
|
|
||||||
public static boolean handleToggleSneak(@NotNull MinecraftClient client, @NotNull ButtonBinding button, float value, @NotNull ButtonState action) {
|
public static boolean handleToggleSneak(@NotNull MinecraftClient client, @NotNull ButtonBinding button, float value, @NotNull ButtonState action) {
|
||||||
button.asKeyBinding().ifPresent(binding -> {
|
button.asKeyBinding().ifPresent(binding -> {
|
||||||
boolean sneakToggled = client.options.sneakToggled;
|
boolean sneakToggled = client.options.getSneakToggled().getValue();
|
||||||
if (client.player.getAbilities().flying && sneakToggled)
|
if (client.player.getAbilities().flying && sneakToggled)
|
||||||
client.options.sneakToggled = false;
|
client.options.getSneakToggled().setValue(false);
|
||||||
binding.setPressed(button.pressed);
|
binding.setPressed(button.pressed);
|
||||||
if (client.player.getAbilities().flying && sneakToggled)
|
if (client.player.getAbilities().flying && sneakToggled)
|
||||||
client.options.sneakToggled = true;
|
client.options.getSneakToggled().setValue(true);
|
||||||
});
|
});
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -42,10 +42,10 @@ public class InputManager {
|
|||||||
private static final List<ButtonCategory> CATEGORIES = new ArrayList<>();
|
private static final List<ButtonCategory> CATEGORIES = new ArrayList<>();
|
||||||
public static final Int2ObjectMap<ButtonState> STATES = new Int2ObjectOpenHashMap<>();
|
public static final Int2ObjectMap<ButtonState> STATES = new Int2ObjectOpenHashMap<>();
|
||||||
public static final Int2FloatMap BUTTON_VALUES = new Int2FloatOpenHashMap();
|
public static final Int2FloatMap BUTTON_VALUES = new Int2FloatOpenHashMap();
|
||||||
private int prevTargetMouseX = 0;
|
public int prevTargetMouseX = 0;
|
||||||
private int prevTargetMouseY = 0;
|
public int prevTargetMouseY = 0;
|
||||||
private int targetMouseX = 0;
|
public int targetMouseX = 0;
|
||||||
private int targetMouseY = 0;
|
public int targetMouseY = 0;
|
||||||
|
|
||||||
protected InputManager() {
|
protected InputManager() {
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -16,8 +16,7 @@ import dev.lambdaurora.spruceui.option.SpruceOption;
|
|||||||
import dev.lambdaurora.spruceui.widget.container.SpruceContainerWidget;
|
import dev.lambdaurora.spruceui.widget.container.SpruceContainerWidget;
|
||||||
import dev.lambdaurora.spruceui.widget.text.SpruceTextAreaWidget;
|
import dev.lambdaurora.spruceui.widget.text.SpruceTextAreaWidget;
|
||||||
import net.minecraft.client.toast.SystemToast;
|
import net.minecraft.client.toast.SystemToast;
|
||||||
import net.minecraft.text.LiteralText;
|
import net.minecraft.text.Text;
|
||||||
import net.minecraft.text.TranslatableText;
|
|
||||||
|
|
||||||
import java.io.FileWriter;
|
import java.io.FileWriter;
|
||||||
import java.io.IOException;
|
import java.io.IOException;
|
||||||
@@ -65,7 +64,7 @@ public class MappingsStringInputWidget extends SpruceContainerWidget {
|
|||||||
} catch (IOException e) {
|
} catch (IOException e) {
|
||||||
if (this.client != null)
|
if (this.client != null)
|
||||||
this.client.getToastManager().add(SystemToast.create(this.client, SystemToast.Type.TUTORIAL_HINT,
|
this.client.getToastManager().add(SystemToast.create(this.client, SystemToast.Type.TUTORIAL_HINT,
|
||||||
new TranslatableText("midnightcontrols.controller.mappings.error.write"), LiteralText.EMPTY));
|
Text.translatable("midnightcontrols.controller.mappings.error.write"), Text.empty()));
|
||||||
e.printStackTrace();
|
e.printStackTrace();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -90,7 +89,7 @@ public class MappingsStringInputWidget extends SpruceContainerWidget {
|
|||||||
}
|
}
|
||||||
|
|
||||||
int textFieldWidth = (int) (this.width * (5.0 / 6.0));
|
int textFieldWidth = (int) (this.width * (5.0 / 6.0));
|
||||||
this.textArea = new SpruceTextAreaWidget(Position.of(this, this.width / 2 - textFieldWidth / 2, 0), textFieldWidth, this.height - 50, new LiteralText(mappings));
|
this.textArea = new SpruceTextAreaWidget(Position.of(this, this.width / 2 - textFieldWidth / 2, 0), textFieldWidth, this.height - 50, Text.literal(mappings));
|
||||||
this.textArea.setText(mappings);
|
this.textArea.setText(mappings);
|
||||||
// Display as many lines as possible
|
// Display as many lines as possible
|
||||||
this.textArea.setDisplayedLines(this.textArea.getInnerHeight() / this.client.textRenderer.fontHeight);
|
this.textArea.setDisplayedLines(this.textArea.getInnerHeight() / this.client.textRenderer.fontHeight);
|
||||||
|
|||||||
@@ -53,6 +53,7 @@ public class MidnightControlsHud extends Hud {
|
|||||||
private String attackAction = "";
|
private String attackAction = "";
|
||||||
private String placeAction = "";
|
private String placeAction = "";
|
||||||
private int ticksDisplayedCrosshair = 0;
|
private int ticksDisplayedCrosshair = 0;
|
||||||
|
private static float scale = 1f;
|
||||||
|
|
||||||
public MidnightControlsHud(@NotNull MidnightControlsClient mod) {
|
public MidnightControlsHud(@NotNull MidnightControlsClient mod) {
|
||||||
super(new Identifier(MidnightControlsConstants.NAMESPACE, "hud/button_indicator"));
|
super(new Identifier(MidnightControlsConstants.NAMESPACE, "hud/button_indicator"));
|
||||||
@@ -71,19 +72,26 @@ public class MidnightControlsHud extends Hud {
|
|||||||
this.dropItemButtonWidth = MidnightControlsRenderer.getBindingIconWidth(ButtonBinding.DROP_ITEM);
|
this.dropItemButtonWidth = MidnightControlsRenderer.getBindingIconWidth(ButtonBinding.DROP_ITEM);
|
||||||
this.attackButtonWidth = MidnightControlsRenderer.getBindingIconWidth(ButtonBinding.ATTACK);
|
this.attackButtonWidth = MidnightControlsRenderer.getBindingIconWidth(ButtonBinding.ATTACK);
|
||||||
this.useButtonWidth = MidnightControlsRenderer.getBindingIconWidth(ButtonBinding.USE);
|
this.useButtonWidth = MidnightControlsRenderer.getBindingIconWidth(ButtonBinding.USE);
|
||||||
|
if (client.getWindow().getScaleFactor() >= 4) {
|
||||||
|
scale = (float) (0.75f * (client.getWindow().getScaleFactor()-3));
|
||||||
|
} else scale = 1f;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Renders the midnightcontrols' HUD.
|
* Renders the midnightcontrols' HUD.
|
||||||
*/
|
*/
|
||||||
@Override
|
@Override
|
||||||
public void render(MatrixStack matrices, float tickDelta) {
|
public void render(MatrixStack matrices, float tickDelta) {
|
||||||
|
if (this.client == null) return;
|
||||||
if (MidnightControlsConfig.controlsMode == ControlsMode.CONTROLLER && this.client.currentScreen == null) {
|
if (MidnightControlsConfig.controlsMode == ControlsMode.CONTROLLER && this.client.currentScreen == null) {
|
||||||
int y = bottom(2);
|
int y = bottom(2);
|
||||||
this.renderFirstIcons(matrices, MidnightControlsConfig.hudSide == HudSide.LEFT ? 2 : client.getWindow().getScaledWidth() - 2, y);
|
if (scale != 1f) matrices.scale(scale,scale,scale);
|
||||||
this.renderSecondIcons(matrices, MidnightControlsConfig.hudSide == HudSide.RIGHT ? 2 : client.getWindow().getScaledWidth() - 2, y);
|
this.renderFirstIcons(matrices, MidnightControlsConfig.hudSide == HudSide.LEFT ? 2 : (int) ((client.getWindow().getScaledWidth() - 2) * (1 / scale)), y);
|
||||||
this.renderFirstSection(matrices, MidnightControlsConfig.hudSide == HudSide.LEFT ? 2 : client.getWindow().getScaledWidth() - 2, y);
|
this.renderSecondIcons(matrices, MidnightControlsConfig.hudSide == HudSide.RIGHT ? 2 : (int) ((client.getWindow().getScaledWidth() - 2) * (1 / scale)), y);
|
||||||
this.renderSecondSection(matrices, MidnightControlsConfig.hudSide == HudSide.RIGHT ? 2 : client.getWindow().getScaledWidth() - 2, y);
|
this.renderFirstSection(matrices, MidnightControlsConfig.hudSide == HudSide.LEFT ? 2 : (int) ((client.getWindow().getScaledWidth() - 2) * (1 / scale)), y);
|
||||||
|
this.renderSecondSection(matrices, MidnightControlsConfig.hudSide == HudSide.RIGHT ? 2 : (int) ((client.getWindow().getScaledWidth() - 2) * (1 / scale)), y);
|
||||||
|
if (scale != 1f) matrices.scale(1,1,1);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (this.mod.reacharound.isLastReacharoundVertical()) {
|
if (this.mod.reacharound.isLastReacharoundVertical()) {
|
||||||
@@ -106,7 +114,7 @@ public class MidnightControlsHud extends Hud {
|
|||||||
this.drawButton(matrices, currentX, y, ButtonBinding.INVENTORY, true);
|
this.drawButton(matrices, currentX, y, ButtonBinding.INVENTORY, true);
|
||||||
this.drawButton(matrices, currentX += (MidnightControlsConfig.hudSide == HudSide.LEFT ? offset : -offset), y, ButtonBinding.SWAP_HANDS, true);
|
this.drawButton(matrices, currentX += (MidnightControlsConfig.hudSide == HudSide.LEFT ? offset : -offset), y, ButtonBinding.SWAP_HANDS, true);
|
||||||
offset = 2 + this.swapHandsWidth + this.dropItemButtonWidth + 4;
|
offset = 2 + this.swapHandsWidth + this.dropItemButtonWidth + 4;
|
||||||
if (this.client.options.showSubtitles && MidnightControlsConfig.hudSide == HudSide.RIGHT) {
|
if (this.client.options.getShowSubtitles().getValue() && MidnightControlsConfig.hudSide == HudSide.RIGHT) {
|
||||||
currentX += -offset;
|
currentX += -offset;
|
||||||
} else {
|
} else {
|
||||||
currentX = MidnightControlsConfig.hudSide == HudSide.LEFT ? x : x - this.dropItemButtonWidth;
|
currentX = MidnightControlsConfig.hudSide == HudSide.LEFT ? x : x - this.dropItemButtonWidth;
|
||||||
@@ -123,7 +131,7 @@ public class MidnightControlsHud extends Hud {
|
|||||||
currentX -= this.useButtonWidth;
|
currentX -= this.useButtonWidth;
|
||||||
this.drawButton(matrices, currentX, y, ButtonBinding.USE, true);
|
this.drawButton(matrices, currentX, y, ButtonBinding.USE, true);
|
||||||
offset = 2 + this.useWidth + 4;
|
offset = 2 + this.useWidth + 4;
|
||||||
if (this.client.options.showSubtitles && MidnightControlsConfig.hudSide == HudSide.LEFT) {
|
if (this.client.options.getShowSubtitles().getValue() && MidnightControlsConfig.hudSide == HudSide.LEFT) {
|
||||||
currentX -= offset;
|
currentX -= offset;
|
||||||
} else {
|
} else {
|
||||||
currentX = x;
|
currentX = x;
|
||||||
@@ -143,7 +151,7 @@ public class MidnightControlsHud extends Hud {
|
|||||||
currentX += MidnightControlsConfig.hudSide == HudSide.LEFT ? this.inventoryWidth + 4 + this.swapHandsButtonWidth + 2
|
currentX += MidnightControlsConfig.hudSide == HudSide.LEFT ? this.inventoryWidth + 4 + this.swapHandsButtonWidth + 2
|
||||||
: -this.swapHandsWidth - 2 - this.swapHandsButtonWidth - 4;
|
: -this.swapHandsWidth - 2 - this.swapHandsButtonWidth - 4;
|
||||||
this.drawTip(matrices, currentX, y, ButtonBinding.SWAP_HANDS, true);
|
this.drawTip(matrices, currentX, y, ButtonBinding.SWAP_HANDS, true);
|
||||||
if (this.client.options.showSubtitles && MidnightControlsConfig.hudSide == HudSide.RIGHT) {
|
if (this.client.options.getShowSubtitles().getValue() && MidnightControlsConfig.hudSide == HudSide.RIGHT) {
|
||||||
currentX += -this.dropItemWidth - 2 - this.dropItemButtonWidth - 4;
|
currentX += -this.dropItemWidth - 2 - this.dropItemButtonWidth - 4;
|
||||||
} else {
|
} else {
|
||||||
y -= 24;
|
y -= 24;
|
||||||
@@ -160,7 +168,7 @@ public class MidnightControlsHud extends Hud {
|
|||||||
|
|
||||||
this.drawTip(matrices, currentX, y, this.placeAction, true);
|
this.drawTip(matrices, currentX, y, this.placeAction, true);
|
||||||
|
|
||||||
if (this.client.options.showSubtitles && MidnightControlsConfig.hudSide == HudSide.LEFT) {
|
if (this.client.options.getShowSubtitles().getValue() && MidnightControlsConfig.hudSide == HudSide.LEFT) {
|
||||||
currentX -= 4;
|
currentX -= 4;
|
||||||
} else {
|
} else {
|
||||||
currentX = x;
|
currentX = x;
|
||||||
@@ -246,7 +254,7 @@ public class MidnightControlsHud extends Hud {
|
|||||||
}
|
}
|
||||||
|
|
||||||
private int bottom(int y) {
|
private int bottom(int y) {
|
||||||
return this.client.getWindow().getScaledHeight() - y - MidnightControlsRenderer.ICON_SIZE;
|
return (int) ((this.client.getWindow().getScaledHeight() * (1/scale)) - y - MidnightControlsRenderer.ICON_SIZE);
|
||||||
}
|
}
|
||||||
|
|
||||||
private int width(@NotNull ButtonBinding binding) {
|
private int width(@NotNull ButtonBinding binding) {
|
||||||
|
|||||||
@@ -10,6 +10,8 @@
|
|||||||
package eu.midnightdust.midnightcontrols.client.gui;
|
package eu.midnightdust.midnightcontrols.client.gui;
|
||||||
|
|
||||||
import com.mojang.blaze3d.systems.RenderSystem;
|
import com.mojang.blaze3d.systems.RenderSystem;
|
||||||
|
import eu.midnightdust.midnightcontrols.MidnightControls;
|
||||||
|
import eu.midnightdust.midnightcontrols.client.ControllerType;
|
||||||
import eu.midnightdust.midnightcontrols.client.MidnightControlsClient;
|
import eu.midnightdust.midnightcontrols.client.MidnightControlsClient;
|
||||||
import eu.midnightdust.midnightcontrols.client.MidnightControlsConfig;
|
import eu.midnightdust.midnightcontrols.client.MidnightControlsConfig;
|
||||||
import eu.midnightdust.midnightcontrols.client.MidnightInput;
|
import eu.midnightdust.midnightcontrols.client.MidnightInput;
|
||||||
@@ -106,7 +108,7 @@ public class MidnightControlsRenderer {
|
|||||||
second = true;
|
second = true;
|
||||||
}
|
}
|
||||||
|
|
||||||
int controllerType = MidnightControlsConfig.controllerType.getId();
|
int controllerType = MidnightControlsConfig.controllerType == ControllerType.DEFAULT ? MidnightControlsConfig.matchControllerToType().getId() : MidnightControlsConfig.controllerType.getId();
|
||||||
boolean axis = false;
|
boolean axis = false;
|
||||||
int buttonOffset = button * 15;
|
int buttonOffset = button * 15;
|
||||||
switch (button) {
|
switch (button) {
|
||||||
|
|||||||
@@ -34,10 +34,8 @@ import net.minecraft.client.gui.widget.ButtonWidget;
|
|||||||
import net.minecraft.client.render.*;
|
import net.minecraft.client.render.*;
|
||||||
import net.minecraft.client.resource.language.I18n;
|
import net.minecraft.client.resource.language.I18n;
|
||||||
import net.minecraft.client.util.math.MatrixStack;
|
import net.minecraft.client.util.math.MatrixStack;
|
||||||
import net.minecraft.text.LiteralText;
|
|
||||||
import net.minecraft.text.MutableText;
|
import net.minecraft.text.MutableText;
|
||||||
import net.minecraft.text.Text;
|
import net.minecraft.text.Text;
|
||||||
import net.minecraft.text.TranslatableText;
|
|
||||||
import net.minecraft.util.Formatting;
|
import net.minecraft.util.Formatting;
|
||||||
import net.minecraft.util.Util;
|
import net.minecraft.util.Util;
|
||||||
import net.minecraft.util.math.Matrix4f;
|
import net.minecraft.util.math.Matrix4f;
|
||||||
@@ -49,7 +47,7 @@ import java.awt.*;
|
|||||||
* Represents the midnightcontrols settings screen.
|
* Represents the midnightcontrols settings screen.
|
||||||
*/
|
*/
|
||||||
public class MidnightControlsSettingsScreen extends SpruceScreen {
|
public class MidnightControlsSettingsScreen extends SpruceScreen {
|
||||||
private static final Text SDL2_GAMEPAD_TOOL = new LiteralText("SDL2 Gamepad Tool").formatted(Formatting.GREEN);
|
private static final Text SDL2_GAMEPAD_TOOL = Text.literal("SDL2 Gamepad Tool").formatted(Formatting.GREEN);
|
||||||
public static final String GAMEPAD_TOOL_URL = "https://generalarcade.com/gamepadtool/";
|
public static final String GAMEPAD_TOOL_URL = "https://generalarcade.com/gamepadtool/";
|
||||||
final MidnightControlsClient mod = MidnightControlsClient.get();
|
final MidnightControlsClient mod = MidnightControlsClient.get();
|
||||||
private final Screen parent;
|
private final Screen parent;
|
||||||
@@ -57,11 +55,13 @@ public class MidnightControlsSettingsScreen extends SpruceScreen {
|
|||||||
private final SpruceOption inputModeOption;
|
private final SpruceOption inputModeOption;
|
||||||
private final SpruceOption autoSwitchModeOption;
|
private final SpruceOption autoSwitchModeOption;
|
||||||
private final SpruceOption rotationSpeedOption;
|
private final SpruceOption rotationSpeedOption;
|
||||||
|
private final SpruceOption yAxisRotationSpeedOption;
|
||||||
private final SpruceOption mouseSpeedOption;
|
private final SpruceOption mouseSpeedOption;
|
||||||
private final SpruceOption virtualMouseOption;
|
private final SpruceOption virtualMouseOption;
|
||||||
private final SpruceOption resetOption;
|
private final SpruceOption resetOption;
|
||||||
// Gameplay options
|
// Gameplay options
|
||||||
private final SpruceOption analogMovementOption;
|
private final SpruceOption analogMovementOption;
|
||||||
|
private final SpruceOption doubleTapToSprintOption;
|
||||||
private final SpruceOption autoJumpOption;
|
private final SpruceOption autoJumpOption;
|
||||||
private final SpruceOption fastBlockPlacingOption;
|
private final SpruceOption fastBlockPlacingOption;
|
||||||
private final SpruceOption frontBlockPlacingOption;
|
private final SpruceOption frontBlockPlacingOption;
|
||||||
@@ -88,11 +88,11 @@ public class MidnightControlsSettingsScreen extends SpruceScreen {
|
|||||||
var controller = MidnightControlsConfig.getController();
|
var controller = MidnightControlsConfig.getController();
|
||||||
var controllerName = controller.getName();
|
var controllerName = controller.getName();
|
||||||
if (!controller.isConnected())
|
if (!controller.isConnected())
|
||||||
return option.getDisplayText(new LiteralText(controllerName).formatted(Formatting.RED));
|
return option.getDisplayText(Text.literal(controllerName).formatted(Formatting.RED));
|
||||||
else if (!controller.isGamepad())
|
else if (!controller.isGamepad())
|
||||||
return option.getDisplayText(new LiteralText(controllerName).formatted(Formatting.GOLD));
|
return option.getDisplayText(Text.literal(controllerName).formatted(Formatting.GOLD));
|
||||||
else
|
else
|
||||||
return option.getDisplayText(new LiteralText(controllerName));
|
return option.getDisplayText(Text.literal(controllerName));
|
||||||
}, null);
|
}, null);
|
||||||
private final SpruceOption secondControllerOption = new SpruceCyclingOption("midnightcontrols.menu.controller2",
|
private final SpruceOption secondControllerOption = new SpruceCyclingOption("midnightcontrols.menu.controller2",
|
||||||
amount -> {
|
amount -> {
|
||||||
@@ -106,13 +106,13 @@ public class MidnightControlsSettingsScreen extends SpruceScreen {
|
|||||||
option -> MidnightControlsConfig.getSecondController().map(controller -> {
|
option -> MidnightControlsConfig.getSecondController().map(controller -> {
|
||||||
var controllerName = controller.getName();
|
var controllerName = controller.getName();
|
||||||
if (!controller.isConnected())
|
if (!controller.isConnected())
|
||||||
return option.getDisplayText(new LiteralText(controllerName).formatted(Formatting.RED));
|
return option.getDisplayText(Text.literal(controllerName).formatted(Formatting.RED));
|
||||||
else if (!controller.isGamepad())
|
else if (!controller.isGamepad())
|
||||||
return option.getDisplayText(new LiteralText(controllerName).formatted(Formatting.GOLD));
|
return option.getDisplayText(Text.literal(controllerName).formatted(Formatting.GOLD));
|
||||||
else
|
else
|
||||||
return option.getDisplayText(new LiteralText(controllerName));
|
return option.getDisplayText(Text.literal(controllerName));
|
||||||
}).orElse(option.getDisplayText(SpruceTexts.OPTIONS_OFF.shallowCopy().formatted(Formatting.RED))),
|
}).orElse(option.getDisplayText(SpruceTexts.OPTIONS_OFF.copyContentOnly().formatted(Formatting.RED))),
|
||||||
new TranslatableText("midnightcontrols.tooltip.controller2"));
|
Text.translatable("midnightcontrols.tooltip.controller2"));
|
||||||
private final SpruceOption unfocusedInputOption;
|
private final SpruceOption unfocusedInputOption;
|
||||||
private final SpruceOption invertsRightXAxis;
|
private final SpruceOption invertsRightXAxis;
|
||||||
private final SpruceOption invertsRightYAxis;
|
private final SpruceOption invertsRightYAxis;
|
||||||
@@ -129,13 +129,13 @@ public class MidnightControlsSettingsScreen extends SpruceScreen {
|
|||||||
return new SpruceDoubleOption(key, .25f, 1.f, 0.05f,
|
return new SpruceDoubleOption(key, .25f, 1.f, 0.05f,
|
||||||
() -> MidnightControlsConfig.getAxisMaxValue(axis),
|
() -> MidnightControlsConfig.getAxisMaxValue(axis),
|
||||||
newValue -> MidnightControlsConfig.setAxisMaxValue(axis, newValue),
|
newValue -> MidnightControlsConfig.setAxisMaxValue(axis, newValue),
|
||||||
option -> option.getDisplayText(new LiteralText(String.format("%.2f", option.get()))),
|
option -> option.getDisplayText(Text.literal(String.format("%.2f", option.get()))),
|
||||||
new TranslatableText(key.replace("menu", "tooltip"))
|
Text.translatable(key.replace("menu", "tooltip"))
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
private final MutableText controllerMappingsUrlText = new LiteralText("(")
|
private final MutableText controllerMappingsUrlText = Text.literal("(")
|
||||||
.append(new LiteralText(GAMEPAD_TOOL_URL).formatted(Formatting.GOLD))
|
.append(Text.literal(GAMEPAD_TOOL_URL).formatted(Formatting.GOLD))
|
||||||
.append("),");
|
.append("),");
|
||||||
|
|
||||||
private static int searchNextAvailableController(int newId, boolean allowNone) {
|
private static int searchNextAvailableController(int newId, boolean allowNone) {
|
||||||
@@ -153,7 +153,7 @@ public class MidnightControlsSettingsScreen extends SpruceScreen {
|
|||||||
}
|
}
|
||||||
|
|
||||||
public MidnightControlsSettingsScreen(Screen parent, boolean hideControls) {
|
public MidnightControlsSettingsScreen(Screen parent, boolean hideControls) {
|
||||||
super(new TranslatableText("midnightcontrols.title.settings"));
|
super(Text.translatable("midnightcontrols.title.settings"));
|
||||||
this.parent = parent;
|
this.parent = parent;
|
||||||
// General options
|
// General options
|
||||||
this.inputModeOption = new SpruceCyclingOption("midnightcontrols.menu.controls_mode",
|
this.inputModeOption = new SpruceCyclingOption("midnightcontrols.menu.controls_mode",
|
||||||
@@ -165,78 +165,85 @@ public class MidnightControlsSettingsScreen extends SpruceScreen {
|
|||||||
if (this.client.player != null) {
|
if (this.client.player != null) {
|
||||||
ClientPlayNetworking.getSender().sendPacket(MidnightControls.CONTROLS_MODE_CHANNEL, this.mod.makeControlsModeBuffer(next));
|
ClientPlayNetworking.getSender().sendPacket(MidnightControls.CONTROLS_MODE_CHANNEL, this.mod.makeControlsModeBuffer(next));
|
||||||
}
|
}
|
||||||
}, option -> option.getDisplayText(new TranslatableText(MidnightControlsConfig.controlsMode.getTranslationKey())),
|
}, option -> option.getDisplayText(Text.translatable(MidnightControlsConfig.controlsMode.getTranslationKey())),
|
||||||
new TranslatableText("midnightcontrols.tooltip.controls_mode"));
|
Text.translatable("midnightcontrols.tooltip.controls_mode"));
|
||||||
this.autoSwitchModeOption = new SpruceToggleBooleanOption("midnightcontrols.menu.auto_switch_mode", () -> MidnightControlsConfig.autoSwitchMode,
|
this.autoSwitchModeOption = new SpruceToggleBooleanOption("midnightcontrols.menu.auto_switch_mode", () -> MidnightControlsConfig.autoSwitchMode,
|
||||||
value -> MidnightControlsConfig.autoSwitchMode = value, new TranslatableText("midnightcontrols.tooltip.auto_switch_mode"));
|
value -> MidnightControlsConfig.autoSwitchMode = value, Text.translatable("midnightcontrols.tooltip.auto_switch_mode"));
|
||||||
this.rotationSpeedOption = new SpruceDoubleOption("midnightcontrols.menu.rotation_speed", 0.0, 100.0, .5f,
|
this.rotationSpeedOption = new SpruceDoubleOption("midnightcontrols.menu.rotation_speed", 0.0, 100.0, .5f,
|
||||||
() -> MidnightControlsConfig.rotationSpeed,
|
() -> MidnightControlsConfig.rotationSpeed,
|
||||||
value -> MidnightControlsConfig.rotationSpeed = value, option -> option.getDisplayText(new LiteralText(String.valueOf(option.get()))),
|
value -> MidnightControlsConfig.rotationSpeed = value, option -> option.getDisplayText(Text.literal(String.valueOf(option.get()))),
|
||||||
new TranslatableText("midnightcontrols.tooltip.rotation_speed"));
|
Text.translatable("midnightcontrols.tooltip.rotation_speed"));
|
||||||
|
this.yAxisRotationSpeedOption = new SpruceDoubleOption("midnightcontrols.menu.y_axis_rotation_speed", 0.0, 100.0, .5f,
|
||||||
|
() -> MidnightControlsConfig.yAxisRotationSpeed,
|
||||||
|
value -> MidnightControlsConfig.yAxisRotationSpeed = value, option -> option.getDisplayText(Text.literal(String.valueOf(option.get()))),
|
||||||
|
Text.translatable("midnightcontrols.tooltip.y_axis_rotation_speed"));
|
||||||
this.mouseSpeedOption = new SpruceDoubleOption("midnightcontrols.menu.mouse_speed", 0.0, 150.0, .5f,
|
this.mouseSpeedOption = new SpruceDoubleOption("midnightcontrols.menu.mouse_speed", 0.0, 150.0, .5f,
|
||||||
() -> MidnightControlsConfig.mouseSpeed,
|
() -> MidnightControlsConfig.mouseSpeed,
|
||||||
value -> MidnightControlsConfig.mouseSpeed = value, option -> option.getDisplayText(new LiteralText(String.valueOf(option.get()))),
|
value -> MidnightControlsConfig.mouseSpeed = value, option -> option.getDisplayText(Text.literal(String.valueOf(option.get()))),
|
||||||
new TranslatableText("midnightcontrols.tooltip.mouse_speed"));
|
Text.translatable("midnightcontrols.tooltip.mouse_speed"));
|
||||||
this.resetOption = SpruceSimpleActionOption.reset(btn -> {
|
this.resetOption = SpruceSimpleActionOption.reset(btn -> {
|
||||||
// TODO
|
// TODO
|
||||||
MidnightControlsConfig.init("midnightcontrols", MidnightControlsConfig.class);
|
MidnightControlsConfig.reset();
|
||||||
var client = MinecraftClient.getInstance();
|
var client = MinecraftClient.getInstance();
|
||||||
this.init(client, client.getWindow().getScaledWidth(), client.getWindow().getScaledHeight());
|
this.init(client, client.getWindow().getScaledWidth(), client.getWindow().getScaledHeight());
|
||||||
});
|
});
|
||||||
// Gameplay options
|
// Gameplay options
|
||||||
this.analogMovementOption = new SpruceToggleBooleanOption("midnightcontrols.menu.analog_movement",
|
this.analogMovementOption = new SpruceToggleBooleanOption("midnightcontrols.menu.analog_movement",
|
||||||
() -> MidnightControlsConfig.analogMovement, value -> MidnightControlsConfig.analogMovement = value,
|
() -> MidnightControlsConfig.analogMovement, value -> MidnightControlsConfig.analogMovement = value,
|
||||||
new TranslatableText("midnightcontrols.tooltip.analog_movement"));
|
Text.translatable("midnightcontrols.tooltip.analog_movement"));
|
||||||
|
this.doubleTapToSprintOption = new SpruceToggleBooleanOption("midnightcontrols.menu.double_tap_to_sprint",
|
||||||
|
() -> MidnightControlsConfig.doubleTapToSprint, value -> MidnightControlsConfig.doubleTapToSprint = value,
|
||||||
|
Text.translatable("midnightcontrols.tooltip.double_tap_to_sprint"));
|
||||||
this.autoJumpOption = new SpruceToggleBooleanOption("options.autoJump",
|
this.autoJumpOption = new SpruceToggleBooleanOption("options.autoJump",
|
||||||
() -> this.client.options.autoJump,
|
() -> this.client.options.getAutoJump().getValue(),
|
||||||
newValue -> this.client.options.autoJump = newValue,
|
newValue -> this.client.options.getAutoJump().setValue(newValue),
|
||||||
null);
|
null);
|
||||||
this.fastBlockPlacingOption = new SpruceToggleBooleanOption("midnightcontrols.menu.fast_block_placing", () -> MidnightControlsConfig.fastBlockPlacing,
|
this.fastBlockPlacingOption = new SpruceToggleBooleanOption("midnightcontrols.menu.fast_block_placing", () -> MidnightControlsConfig.fastBlockPlacing,
|
||||||
value -> MidnightControlsConfig.fastBlockPlacing = value, new TranslatableText("midnightcontrols.tooltip.fast_block_placing"));
|
value -> MidnightControlsConfig.fastBlockPlacing = value, Text.translatable("midnightcontrols.tooltip.fast_block_placing"));
|
||||||
this.frontBlockPlacingOption = new SpruceToggleBooleanOption("midnightcontrols.menu.reacharound.horizontal", () -> MidnightControlsConfig.horizontalReacharound,
|
this.frontBlockPlacingOption = new SpruceToggleBooleanOption("midnightcontrols.menu.reacharound.horizontal", () -> MidnightControlsConfig.horizontalReacharound,
|
||||||
value -> MidnightControlsConfig.horizontalReacharound = value, new TranslatableText("midnightcontrols.tooltip.reacharound.horizontal"));
|
value -> MidnightControlsConfig.horizontalReacharound = value, Text.translatable("midnightcontrols.tooltip.reacharound.horizontal"));
|
||||||
this.verticalReacharoundOption = new SpruceToggleBooleanOption("midnightcontrols.menu.reacharound.vertical", () -> MidnightControlsConfig.verticalReacharound,
|
this.verticalReacharoundOption = new SpruceToggleBooleanOption("midnightcontrols.menu.reacharound.vertical", () -> MidnightControlsConfig.verticalReacharound,
|
||||||
value -> MidnightControlsConfig.verticalReacharound = value, new TranslatableText("midnightcontrols.tooltip.reacharound.vertical"));
|
value -> MidnightControlsConfig.verticalReacharound = value, Text.translatable("midnightcontrols.tooltip.reacharound.vertical"));
|
||||||
this.flyDriftingOption = new SpruceToggleBooleanOption("midnightcontrols.menu.fly_drifting", () -> MidnightControlsConfig.flyDrifting,
|
this.flyDriftingOption = new SpruceToggleBooleanOption("midnightcontrols.menu.fly_drifting", () -> MidnightControlsConfig.flyDrifting,
|
||||||
value -> MidnightControlsConfig.flyDrifting = value, new TranslatableText("midnightcontrols.tooltip.fly_drifting"));
|
value -> MidnightControlsConfig.flyDrifting = value, Text.translatable("midnightcontrols.tooltip.fly_drifting"));
|
||||||
this.flyVerticalDriftingOption = new SpruceToggleBooleanOption("midnightcontrols.menu.fly_drifting_vertical", () -> MidnightControlsConfig.verticalFlyDrifting,
|
this.flyVerticalDriftingOption = new SpruceToggleBooleanOption("midnightcontrols.menu.fly_drifting_vertical", () -> MidnightControlsConfig.verticalFlyDrifting,
|
||||||
value -> MidnightControlsConfig.verticalFlyDrifting = value, new TranslatableText("midnightcontrols.tooltip.fly_drifting_vertical"));
|
value -> MidnightControlsConfig.verticalFlyDrifting = value, Text.translatable("midnightcontrols.tooltip.fly_drifting_vertical"));
|
||||||
// Appearance options
|
// Appearance options
|
||||||
this.controllerTypeOption = new SpruceCyclingOption("midnightcontrols.menu.controller_type",
|
this.controllerTypeOption = new SpruceCyclingOption("midnightcontrols.menu.controller_type",
|
||||||
amount -> MidnightControlsConfig.controllerType = MidnightControlsConfig.controllerType.next(),
|
amount -> MidnightControlsConfig.controllerType = MidnightControlsConfig.controllerType.next(),
|
||||||
option -> option.getDisplayText(MidnightControlsConfig.controllerType.getTranslatedText()),
|
option -> option.getDisplayText(MidnightControlsConfig.controllerType.getTranslatedText()),
|
||||||
new TranslatableText("midnightcontrols.tooltip.controller_type"));
|
Text.translatable("midnightcontrols.tooltip.controller_type"));
|
||||||
this.virtualMouseSkinOption = new SpruceCyclingOption("midnightcontrols.menu.virtual_mouse.skin",
|
this.virtualMouseSkinOption = new SpruceCyclingOption("midnightcontrols.menu.virtual_mouse.skin",
|
||||||
amount -> MidnightControlsConfig.virtualMouseSkin = MidnightControlsConfig.virtualMouseSkin.next(),
|
amount -> MidnightControlsConfig.virtualMouseSkin = MidnightControlsConfig.virtualMouseSkin.next(),
|
||||||
option -> option.getDisplayText(MidnightControlsConfig.virtualMouseSkin.getTranslatedText()),
|
option -> option.getDisplayText(MidnightControlsConfig.virtualMouseSkin.getTranslatedText()),
|
||||||
null);
|
null);
|
||||||
this.hudEnableOption = new SpruceToggleBooleanOption("midnightcontrols.menu.hud_enable", () -> MidnightControlsConfig.hudEnable,
|
this.hudEnableOption = new SpruceToggleBooleanOption("midnightcontrols.menu.hud_enable", () -> MidnightControlsConfig.hudEnable,
|
||||||
this.mod::setHudEnabled, new TranslatableText("midnightcontrols.tooltip.hud_enable"));
|
this.mod::setHudEnabled, Text.translatable("midnightcontrols.tooltip.hud_enable"));
|
||||||
this.hudSideOption = new SpruceCyclingOption("midnightcontrols.menu.hud_side",
|
this.hudSideOption = new SpruceCyclingOption("midnightcontrols.menu.hud_side",
|
||||||
amount -> MidnightControlsConfig.hudSide = MidnightControlsConfig.hudSide.next(),
|
amount -> MidnightControlsConfig.hudSide = MidnightControlsConfig.hudSide.next(),
|
||||||
option -> option.getDisplayText(MidnightControlsConfig.hudSide.getTranslatedText()),
|
option -> option.getDisplayText(MidnightControlsConfig.hudSide.getTranslatedText()),
|
||||||
new TranslatableText("midnightcontrols.tooltip.hud_side"));
|
Text.translatable("midnightcontrols.tooltip.hud_side"));
|
||||||
// Controller options
|
// Controller options
|
||||||
this.rightDeadZoneOption = new SpruceDoubleOption("midnightcontrols.menu.right_dead_zone", 0.05, 1.0, .05f,
|
this.rightDeadZoneOption = new SpruceDoubleOption("midnightcontrols.menu.right_dead_zone", 0.05, 1.0, .05f,
|
||||||
() -> MidnightControlsConfig.rightDeadZone,
|
() -> MidnightControlsConfig.rightDeadZone,
|
||||||
value -> MidnightControlsConfig.rightDeadZone = value, option -> {
|
value -> MidnightControlsConfig.rightDeadZone = value, option -> {
|
||||||
var value = String.valueOf(option.get());
|
var value = String.valueOf(option.get());
|
||||||
return option.getDisplayText(new LiteralText(value.substring(0, Math.min(value.length(), 5))));
|
return option.getDisplayText(Text.literal(value.substring(0, Math.min(value.length(), 5))));
|
||||||
}, new TranslatableText("midnightcontrols.tooltip.right_dead_zone"));
|
}, Text.translatable("midnightcontrols.tooltip.right_dead_zone"));
|
||||||
this.leftDeadZoneOption = new SpruceDoubleOption("midnightcontrols.menu.left_dead_zone", 0.05, 1.0, .05f,
|
this.leftDeadZoneOption = new SpruceDoubleOption("midnightcontrols.menu.left_dead_zone", 0.05, 1.0, .05f,
|
||||||
() -> MidnightControlsConfig.leftDeadZone,
|
() -> MidnightControlsConfig.leftDeadZone,
|
||||||
value -> MidnightControlsConfig.leftDeadZone = value, option -> {
|
value -> MidnightControlsConfig.leftDeadZone = value, option -> {
|
||||||
var value = String.valueOf(option.get());
|
var value = String.valueOf(option.get());
|
||||||
return option.getDisplayText(new LiteralText(value.substring(0, Math.min(value.length(), 5))));
|
return option.getDisplayText(Text.literal(value.substring(0, Math.min(value.length(), 5))));
|
||||||
}, new TranslatableText("midnightcontrols.tooltip.left_dead_zone"));
|
}, Text.translatable("midnightcontrols.tooltip.left_dead_zone"));
|
||||||
this.invertsRightXAxis = new SpruceToggleBooleanOption("midnightcontrols.menu.invert_right_x_axis", () -> MidnightControlsConfig.invertRightXAxis,
|
this.invertsRightXAxis = new SpruceToggleBooleanOption("midnightcontrols.menu.invert_right_x_axis", () -> MidnightControlsConfig.invertRightXAxis,
|
||||||
value -> MidnightControlsConfig.invertRightXAxis = value, null);
|
value -> MidnightControlsConfig.invertRightXAxis = value, null);
|
||||||
this.invertsRightYAxis = new SpruceToggleBooleanOption("midnightcontrols.menu.invert_right_y_axis", () -> MidnightControlsConfig.invertRightYAxis,
|
this.invertsRightYAxis = new SpruceToggleBooleanOption("midnightcontrols.menu.invert_right_y_axis", () -> MidnightControlsConfig.invertRightYAxis,
|
||||||
value -> MidnightControlsConfig.invertRightYAxis = value, null);
|
value -> MidnightControlsConfig.invertRightYAxis = value, null);
|
||||||
this.unfocusedInputOption = new SpruceToggleBooleanOption("midnightcontrols.menu.unfocused_input", () -> MidnightControlsConfig.unfocusedInput,
|
this.unfocusedInputOption = new SpruceToggleBooleanOption("midnightcontrols.menu.unfocused_input", () -> MidnightControlsConfig.unfocusedInput,
|
||||||
value -> MidnightControlsConfig.unfocusedInput = value, new TranslatableText("midnightcontrols.tooltip.unfocused_input"));
|
value -> MidnightControlsConfig.unfocusedInput = value, Text.translatable("midnightcontrols.tooltip.unfocused_input"));
|
||||||
this.virtualMouseOption = new SpruceToggleBooleanOption("midnightcontrols.menu.virtual_mouse", () -> MidnightControlsConfig.virtualMouse,
|
this.virtualMouseOption = new SpruceToggleBooleanOption("midnightcontrols.menu.virtual_mouse", () -> MidnightControlsConfig.virtualMouse,
|
||||||
value -> MidnightControlsConfig.virtualMouse = value, new TranslatableText("midnightcontrols.tooltip.virtual_mouse"));
|
value -> MidnightControlsConfig.virtualMouse = value, Text.translatable("midnightcontrols.tooltip.virtual_mouse"));
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
@@ -246,9 +253,9 @@ public class MidnightControlsSettingsScreen extends SpruceScreen {
|
|||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void onClose() {
|
public void close() {
|
||||||
MidnightControlsConfig.save();
|
MidnightControlsConfig.save();
|
||||||
super.onClose();
|
super.close();
|
||||||
}
|
}
|
||||||
|
|
||||||
private int getTextHeight() {
|
private int getTextHeight() {
|
||||||
@@ -273,30 +280,32 @@ public class MidnightControlsSettingsScreen extends SpruceScreen {
|
|||||||
tabs.getList().setBackground(new MidnightControlsBackground());
|
tabs.getList().setBackground(new MidnightControlsBackground());
|
||||||
this.addDrawableChild(tabs);
|
this.addDrawableChild(tabs);
|
||||||
|
|
||||||
tabs.addSeparatorEntry(new TranslatableText("midnightcontrols.menu.separator.general"));
|
tabs.addSeparatorEntry(Text.translatable("midnightcontrols.menu.separator.general"));
|
||||||
tabs.addTabEntry(new TranslatableText("midnightcontrols.menu.title.general"), null,
|
tabs.addTabEntry(Text.translatable("midnightcontrols.menu.title.general"), null,
|
||||||
this::buildGeneralTab);
|
this::buildGeneralTab);
|
||||||
tabs.addTabEntry(new TranslatableText("midnightcontrols.menu.title.gameplay"), null,
|
tabs.addTabEntry(Text.translatable("midnightcontrols.menu.title.gameplay"), null,
|
||||||
this::buildGameplayTab);
|
this::buildGameplayTab);
|
||||||
tabs.addTabEntry(new TranslatableText("midnightcontrols.menu.title.visual"), null,
|
tabs.addTabEntry(Text.translatable("midnightcontrols.menu.title.visual"), null,
|
||||||
this::buildVisualTab);
|
this::buildVisualTab);
|
||||||
|
|
||||||
tabs.addSeparatorEntry(new TranslatableText("options.controls"));
|
tabs.addSeparatorEntry(Text.translatable("options.controls"));
|
||||||
tabs.addTabEntry(new TranslatableText("midnightcontrols.menu.title.controller_controls"), null,
|
tabs.addTabEntry(Text.translatable("midnightcontrols.menu.title.controller_controls"), null,
|
||||||
this::buildControllerControlsTab);
|
this::buildControllerControlsTab);
|
||||||
|
|
||||||
tabs.addSeparatorEntry(new TranslatableText("midnightcontrols.menu.separator.controller"));
|
tabs.addSeparatorEntry(Text.translatable("midnightcontrols.menu.separator.controller"));
|
||||||
tabs.addTabEntry(new TranslatableText("midnightcontrols.menu.title.controller"), null,
|
tabs.addTabEntry(Text.translatable("midnightcontrols.menu.title.controller"), null,
|
||||||
this::buildControllerTab);
|
this::buildControllerTab);
|
||||||
tabs.addTabEntry(new TranslatableText("midnightcontrols.menu.title.mappings.string"), null,
|
tabs.addTabEntry(Text.translatable("midnightcontrols.menu.title.mappings.string"), null,
|
||||||
this::buildMappingsStringEditorTab);
|
this::buildMappingsStringEditorTab);
|
||||||
}
|
}
|
||||||
|
|
||||||
public SpruceOptionListWidget buildGeneralTab(int width, int height) {
|
public SpruceOptionListWidget buildGeneralTab(int width, int height) {
|
||||||
var list = new SpruceOptionListWidget(Position.origin(), width, height);
|
var list = new SpruceOptionListWidget(Position.origin(), width, height);
|
||||||
|
list.setBackground(new MidnightControlsBackground(130));
|
||||||
list.addSingleOptionEntry(this.inputModeOption);
|
list.addSingleOptionEntry(this.inputModeOption);
|
||||||
list.addSingleOptionEntry(this.autoSwitchModeOption);
|
list.addSingleOptionEntry(this.autoSwitchModeOption);
|
||||||
list.addSingleOptionEntry(this.rotationSpeedOption);
|
list.addSingleOptionEntry(this.rotationSpeedOption);
|
||||||
|
list.addSingleOptionEntry(this.yAxisRotationSpeedOption);
|
||||||
list.addSingleOptionEntry(this.mouseSpeedOption);
|
list.addSingleOptionEntry(this.mouseSpeedOption);
|
||||||
list.addSingleOptionEntry(this.virtualMouseOption);
|
list.addSingleOptionEntry(this.virtualMouseOption);
|
||||||
return list;
|
return list;
|
||||||
@@ -304,18 +313,21 @@ public class MidnightControlsSettingsScreen extends SpruceScreen {
|
|||||||
|
|
||||||
public SpruceOptionListWidget buildGameplayTab(int width, int height) {
|
public SpruceOptionListWidget buildGameplayTab(int width, int height) {
|
||||||
var list = new SpruceOptionListWidget(Position.origin(), width, height);
|
var list = new SpruceOptionListWidget(Position.origin(), width, height);
|
||||||
|
list.setBackground(new MidnightControlsBackground(130));
|
||||||
list.addSingleOptionEntry(this.analogMovementOption);
|
list.addSingleOptionEntry(this.analogMovementOption);
|
||||||
list.addSingleOptionEntry(this.fastBlockPlacingOption);
|
list.addSingleOptionEntry(this.doubleTapToSprintOption);
|
||||||
list.addSingleOptionEntry(this.frontBlockPlacingOption);
|
if (MidnightControls.isExtrasLoaded) list.addSingleOptionEntry(this.fastBlockPlacingOption);
|
||||||
list.addSingleOptionEntry(this.verticalReacharoundOption);
|
if (MidnightControls.isExtrasLoaded) list.addSingleOptionEntry(this.frontBlockPlacingOption);
|
||||||
list.addSingleOptionEntry(this.flyDriftingOption);
|
if (MidnightControls.isExtrasLoaded) list.addSingleOptionEntry(this.verticalReacharoundOption);
|
||||||
list.addSingleOptionEntry(this.flyVerticalDriftingOption);
|
if (MidnightControls.isExtrasLoaded) list.addSingleOptionEntry(this.flyDriftingOption);
|
||||||
|
if (MidnightControls.isExtrasLoaded) list.addSingleOptionEntry(this.flyVerticalDriftingOption);
|
||||||
list.addSingleOptionEntry(this.autoJumpOption);
|
list.addSingleOptionEntry(this.autoJumpOption);
|
||||||
return list;
|
return list;
|
||||||
}
|
}
|
||||||
|
|
||||||
public SpruceOptionListWidget buildVisualTab(int width, int height) {
|
public SpruceOptionListWidget buildVisualTab(int width, int height) {
|
||||||
var list = new SpruceOptionListWidget(Position.origin(), width, height);
|
var list = new SpruceOptionListWidget(Position.origin(), width, height);
|
||||||
|
list.setBackground(new MidnightControlsBackground(130));
|
||||||
list.addSingleOptionEntry(this.controllerTypeOption);
|
list.addSingleOptionEntry(this.controllerTypeOption);
|
||||||
list.addSingleOptionEntry(this.virtualMouseSkinOption);
|
list.addSingleOptionEntry(this.virtualMouseSkinOption);
|
||||||
list.addSingleOptionEntry(new SpruceSeparatorOption("midnightcontrols.menu.title.hud", true, null));
|
list.addSingleOptionEntry(new SpruceSeparatorOption("midnightcontrols.menu.title.hud", true, null));
|
||||||
@@ -332,17 +344,17 @@ public class MidnightControlsSettingsScreen extends SpruceScreen {
|
|||||||
var root = new SpruceContainerWidget(Position.origin(), width, height);
|
var root = new SpruceContainerWidget(Position.origin(), width, height);
|
||||||
|
|
||||||
var aboutMappings1 = new SpruceLabelWidget(Position.of(0, 2),
|
var aboutMappings1 = new SpruceLabelWidget(Position.of(0, 2),
|
||||||
new TranslatableText("midnightcontrols.controller.mappings.1", SDL2_GAMEPAD_TOOL),
|
Text.translatable("midnightcontrols.controller.mappings.1", SDL2_GAMEPAD_TOOL),
|
||||||
width, true);
|
width, true);
|
||||||
|
|
||||||
var gamepadToolUrlLabel = new SpruceLabelWidget(Position.of(0, aboutMappings1.getHeight() + 4),
|
var gamepadToolUrlLabel = new SpruceLabelWidget(Position.of(0, aboutMappings1.getHeight() + 4),
|
||||||
this.controllerMappingsUrlText, width,
|
this.controllerMappingsUrlText, width,
|
||||||
label -> Util.getOperatingSystem().open(GAMEPAD_TOOL_URL), true);
|
label -> Util.getOperatingSystem().open(GAMEPAD_TOOL_URL), true);
|
||||||
gamepadToolUrlLabel.setTooltip(new TranslatableText("chat.link.open"));
|
gamepadToolUrlLabel.setTooltip(Text.translatable("chat.link.open"));
|
||||||
|
|
||||||
var aboutMappings3 = new SpruceLabelWidget(Position.of(0,
|
var aboutMappings3 = new SpruceLabelWidget(Position.of(0,
|
||||||
aboutMappings1.getHeight() + gamepadToolUrlLabel.getHeight() + 6),
|
aboutMappings1.getHeight() + gamepadToolUrlLabel.getHeight() + 6),
|
||||||
new TranslatableText("midnightcontrols.controller.mappings.3", Formatting.GREEN.toString(), Formatting.RESET.toString()),
|
Text.translatable("midnightcontrols.controller.mappings.3", Formatting.GREEN.toString(), Formatting.RESET.toString()),
|
||||||
width, true);
|
width, true);
|
||||||
|
|
||||||
int listHeight = height - 8 - aboutMappings1.getHeight() - aboutMappings3.getHeight() - gamepadToolUrlLabel.getHeight();
|
int listHeight = height - 8 - aboutMappings1.getHeight() - aboutMappings3.getHeight() - gamepadToolUrlLabel.getHeight();
|
||||||
@@ -354,6 +366,7 @@ public class MidnightControlsSettingsScreen extends SpruceScreen {
|
|||||||
labels.addChild(aboutMappings3);
|
labels.addChild(aboutMappings3);
|
||||||
|
|
||||||
var list = new SpruceOptionListWidget(Position.origin(), width, listHeight);
|
var list = new SpruceOptionListWidget(Position.origin(), width, listHeight);
|
||||||
|
list.setBackground(new MidnightControlsBackground(130));
|
||||||
list.addSingleOptionEntry(this.controllerOption);
|
list.addSingleOptionEntry(this.controllerOption);
|
||||||
list.addSingleOptionEntry(this.secondControllerOption);
|
list.addSingleOptionEntry(this.secondControllerOption);
|
||||||
list.addSingleOptionEntry(this.unfocusedInputOption);
|
list.addSingleOptionEntry(this.unfocusedInputOption);
|
||||||
@@ -379,6 +392,11 @@ public class MidnightControlsSettingsScreen extends SpruceScreen {
|
|||||||
}
|
}
|
||||||
|
|
||||||
public static class MidnightControlsBackground implements Background {
|
public static class MidnightControlsBackground implements Background {
|
||||||
|
private int transparency = 160;
|
||||||
|
public MidnightControlsBackground() {}
|
||||||
|
public MidnightControlsBackground(int transparency) {
|
||||||
|
this.transparency = transparency;
|
||||||
|
}
|
||||||
@Override
|
@Override
|
||||||
public void render(MatrixStack matrixStack, SpruceWidget widget, int vOffset, int mouseX, int mouseY, float delta) {
|
public void render(MatrixStack matrixStack, SpruceWidget widget, int vOffset, int mouseX, int mouseY, float delta) {
|
||||||
fill(matrixStack, widget.getX(), widget.getY(), widget.getX() + widget.getWidth(), widget.getY() + widget.getHeight(), MidnightColorUtil.hex2Rgb("#000000"));
|
fill(matrixStack, widget.getX(), widget.getY(), widget.getX() + widget.getWidth(), widget.getY() + widget.getHeight(), MidnightColorUtil.hex2Rgb("#000000"));
|
||||||
@@ -390,7 +408,7 @@ public class MidnightControlsSettingsScreen extends SpruceScreen {
|
|||||||
float r = (float)(color.getRed()) / 255.0F;
|
float r = (float)(color.getRed()) / 255.0F;
|
||||||
float g = (float)(color.getGreen()) / 255.0F;
|
float g = (float)(color.getGreen()) / 255.0F;
|
||||||
float b = (float)(color.getBlue()) / 255.0F;
|
float b = (float)(color.getBlue()) / 255.0F;
|
||||||
float t = (float)(160) / 255.0F;
|
float t = (float)(transparency) / 255.0F;
|
||||||
BufferBuilder bufferBuilder = Tessellator.getInstance().getBuffer();
|
BufferBuilder bufferBuilder = Tessellator.getInstance().getBuffer();
|
||||||
RenderSystem.enableBlend();
|
RenderSystem.enableBlend();
|
||||||
RenderSystem.disableTexture();
|
RenderSystem.disableTexture();
|
||||||
@@ -401,8 +419,7 @@ public class MidnightControlsSettingsScreen extends SpruceScreen {
|
|||||||
bufferBuilder.vertex(matrix, (float)x2, (float)y2, 0.0F).color(r, g, b, t).next();
|
bufferBuilder.vertex(matrix, (float)x2, (float)y2, 0.0F).color(r, g, b, t).next();
|
||||||
bufferBuilder.vertex(matrix, (float)x2, (float)y1, 0.0F).color(r, g, b, t).next();
|
bufferBuilder.vertex(matrix, (float)x2, (float)y1, 0.0F).color(r, g, b, t).next();
|
||||||
bufferBuilder.vertex(matrix, (float)x1, (float)y1, 0.0F).color(r, g, b, t).next();
|
bufferBuilder.vertex(matrix, (float)x1, (float)y1, 0.0F).color(r, g, b, t).next();
|
||||||
bufferBuilder.end();
|
BufferRenderer.drawWithShader(bufferBuilder.end());
|
||||||
BufferRenderer.draw(bufferBuilder);
|
|
||||||
RenderSystem.enableTexture();
|
RenderSystem.enableTexture();
|
||||||
RenderSystem.disableBlend();
|
RenderSystem.disableBlend();
|
||||||
matrixStack.pop();
|
matrixStack.pop();
|
||||||
|
|||||||
@@ -14,8 +14,7 @@ import dev.lambdaurora.spruceui.option.SpruceSimpleActionOption;
|
|||||||
import dev.lambdaurora.spruceui.widget.SpruceButtonWidget;
|
import dev.lambdaurora.spruceui.widget.SpruceButtonWidget;
|
||||||
import net.minecraft.client.MinecraftClient;
|
import net.minecraft.client.MinecraftClient;
|
||||||
import net.minecraft.client.toast.SystemToast;
|
import net.minecraft.client.toast.SystemToast;
|
||||||
import net.minecraft.text.LiteralText;
|
import net.minecraft.text.Text;
|
||||||
import net.minecraft.text.TranslatableText;
|
|
||||||
import org.jetbrains.annotations.Nullable;
|
import org.jetbrains.annotations.Nullable;
|
||||||
|
|
||||||
import java.util.function.Consumer;
|
import java.util.function.Consumer;
|
||||||
@@ -35,7 +34,7 @@ public class ReloadControllerMappingsOption {
|
|||||||
if (client.currentScreen instanceof MidnightControlsSettingsScreen)
|
if (client.currentScreen instanceof MidnightControlsSettingsScreen)
|
||||||
client.currentScreen.init(client, client.getWindow().getScaledWidth(), client.getWindow().getScaledHeight());
|
client.currentScreen.init(client, client.getWindow().getScaledWidth(), client.getWindow().getScaledHeight());
|
||||||
client.getToastManager().add(SystemToast.create(client, SystemToast.Type.TUTORIAL_HINT,
|
client.getToastManager().add(SystemToast.create(client, SystemToast.Type.TUTORIAL_HINT,
|
||||||
new TranslatableText("midnightcontrols.controller.mappings.updated"), LiteralText.EMPTY));
|
Text.translatable("midnightcontrols.controller.mappings.updated"), Text.empty()));
|
||||||
}, new TranslatableText("midnightcontrols.tooltip.reload_controller_mappings"));
|
}, Text.translatable("midnightcontrols.tooltip.reload_controller_mappings"));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -13,7 +13,7 @@ import eu.midnightdust.midnightcontrols.client.MidnightControlsClient;
|
|||||||
import eu.midnightdust.midnightcontrols.client.ring.RingPage;
|
import eu.midnightdust.midnightcontrols.client.ring.RingPage;
|
||||||
import net.minecraft.client.gui.screen.Screen;
|
import net.minecraft.client.gui.screen.Screen;
|
||||||
import net.minecraft.client.util.math.MatrixStack;
|
import net.minecraft.client.util.math.MatrixStack;
|
||||||
import net.minecraft.text.TranslatableText;
|
import net.minecraft.text.Text;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Represents the controls ring screen.
|
* Represents the controls ring screen.
|
||||||
@@ -26,7 +26,7 @@ public class RingScreen extends Screen {
|
|||||||
protected final MidnightControlsClient mod;
|
protected final MidnightControlsClient mod;
|
||||||
|
|
||||||
public RingScreen() {
|
public RingScreen() {
|
||||||
super(new TranslatableText("midnightcontrols.menu.title.ring"));
|
super(Text.literal("midnightcontrols.menu.title.ring"));
|
||||||
this.mod = MidnightControlsClient.get();
|
this.mod = MidnightControlsClient.get();
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -46,10 +46,10 @@ public class RingScreen extends Screen {
|
|||||||
|
|
||||||
@Override
|
@Override
|
||||||
public boolean mouseReleased(double mouseX, double mouseY, int button) {
|
public boolean mouseReleased(double mouseX, double mouseY, int button) {
|
||||||
/*if (midnightcontrolsClient.BINDING_RING.matchesMouse(button)) {
|
if (mod.ring.getCurrentPage().onClick(client.getWindow().getScaledWidth(), client.getWindow().getScaledHeight(), (int) mouseX, (int) mouseY)) {
|
||||||
this.onClose();
|
this.close();
|
||||||
return true;
|
return true;
|
||||||
}*/
|
}
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -9,20 +9,20 @@
|
|||||||
|
|
||||||
package eu.midnightdust.midnightcontrols.client.gui;
|
package eu.midnightdust.midnightcontrols.client.gui;
|
||||||
|
|
||||||
import dev.lambdaurora.spruceui.widget.SpruceTexturedButtonWidget;
|
import dev.lambdaurora.spruceui.Position;
|
||||||
|
import dev.lambdaurora.spruceui.widget.SpruceButtonWidget;
|
||||||
import eu.midnightdust.midnightcontrols.client.HudSide;
|
import eu.midnightdust.midnightcontrols.client.HudSide;
|
||||||
import eu.midnightdust.midnightcontrols.client.MidnightControlsClient;
|
import eu.midnightdust.midnightcontrols.client.MidnightControlsClient;
|
||||||
import eu.midnightdust.midnightcontrols.client.MidnightControlsConfig;
|
import eu.midnightdust.midnightcontrols.client.MidnightControlsConfig;
|
||||||
|
import eu.midnightdust.midnightcontrols.client.gui.widget.SilentTexturedButtonWidget;
|
||||||
import eu.midnightdust.midnightcontrols.client.util.KeyBindingAccessor;
|
import eu.midnightdust.midnightcontrols.client.util.KeyBindingAccessor;
|
||||||
import net.minecraft.client.gui.screen.ChatScreen;
|
import net.minecraft.client.gui.screen.ChatScreen;
|
||||||
import net.minecraft.client.gui.screen.GameMenuScreen;
|
import net.minecraft.client.gui.screen.GameMenuScreen;
|
||||||
import net.minecraft.client.gui.screen.Screen;
|
import net.minecraft.client.gui.screen.Screen;
|
||||||
import net.minecraft.client.gui.screen.ingame.InventoryScreen;
|
import net.minecraft.client.gui.screen.ingame.InventoryScreen;
|
||||||
import net.minecraft.client.gui.widget.ButtonWidget;
|
|
||||||
import net.minecraft.client.gui.widget.TexturedButtonWidget;
|
import net.minecraft.client.gui.widget.TexturedButtonWidget;
|
||||||
import net.minecraft.client.option.KeyBinding;
|
|
||||||
import net.minecraft.network.packet.c2s.play.PlayerActionC2SPacket;
|
import net.minecraft.network.packet.c2s.play.PlayerActionC2SPacket;
|
||||||
import net.minecraft.text.LiteralText;
|
import net.minecraft.text.Text;
|
||||||
import net.minecraft.util.Arm;
|
import net.minecraft.util.Arm;
|
||||||
import net.minecraft.util.Identifier;
|
import net.minecraft.util.Identifier;
|
||||||
import net.minecraft.util.math.BlockPos;
|
import net.minecraft.util.math.BlockPos;
|
||||||
@@ -37,265 +37,259 @@ import static org.lwjgl.glfw.GLFW.GLFW_GAMEPAD_AXIS_RIGHT_Y;
|
|||||||
* Represents the touchscreen overlay
|
* Represents the touchscreen overlay
|
||||||
*/
|
*/
|
||||||
public class TouchscreenOverlay extends Screen {
|
public class TouchscreenOverlay extends Screen {
|
||||||
public static final Identifier WIDGETS_LOCATION = new Identifier("midnightcontrols", "textures/gui/widgets.png");
|
public static final Identifier WIDGETS_LOCATION = new Identifier("midnightcontrols", "textures/gui/widgets.png");
|
||||||
private MidnightControlsClient mod;
|
private MidnightControlsClient mod;
|
||||||
private SpruceTexturedButtonWidget jumpButton;
|
private SilentTexturedButtonWidget jumpButton;
|
||||||
private SpruceTexturedButtonWidget flyButton;
|
private SilentTexturedButtonWidget flyButton;
|
||||||
private SpruceTexturedButtonWidget flyUpButton;
|
private SilentTexturedButtonWidget flyUpButton;
|
||||||
private SpruceTexturedButtonWidget flyDownButton;
|
private SilentTexturedButtonWidget flyDownButton;
|
||||||
private int flyButtonEnableTicks = 0;
|
private int flyButtonEnableTicks = 0;
|
||||||
private int forwardButtonTick = 0;
|
private int forwardButtonTick = 0;
|
||||||
private SpruceTexturedButtonWidget forwardLeftButton;
|
private SilentTexturedButtonWidget forwardLeftButton;
|
||||||
private SpruceTexturedButtonWidget forwardRightButton;
|
private SilentTexturedButtonWidget forwardRightButton;
|
||||||
private SpruceTexturedButtonWidget startSneakButton;
|
private SilentTexturedButtonWidget startSneakButton;
|
||||||
private SpruceTexturedButtonWidget endSneakButton;
|
private SilentTexturedButtonWidget endSneakButton;
|
||||||
|
|
||||||
public TouchscreenOverlay(@NotNull MidnightControlsClient mod)
|
public TouchscreenOverlay(@NotNull MidnightControlsClient mod) {
|
||||||
{
|
super(Text.literal("Touchscreen overlay"));
|
||||||
super(new LiteralText("Touchscreen overlay"));
|
|
||||||
this.mod = mod;
|
this.mod = mod;
|
||||||
this.passEvents = true;
|
this.passEvents = true;
|
||||||
}
|
}
|
||||||
|
|
||||||
// @Override
|
@Override
|
||||||
// public boolean shouldPause()
|
public boolean shouldPause()
|
||||||
// {
|
{
|
||||||
// return false;
|
return false;
|
||||||
// }
|
}
|
||||||
//
|
|
||||||
// @Override
|
@Override
|
||||||
// public boolean keyPressed(int keyCode, int scanCode, int modifiers)
|
public boolean keyPressed(int keyCode, int scanCode, int modifiers) {
|
||||||
// {
|
super.keyPressed(keyCode,scanCode,modifiers);
|
||||||
// super.keyPressed(keyCode,scanCode,modifiers);
|
//return false;
|
||||||
// //return false;
|
return true;
|
||||||
// return true;
|
}
|
||||||
// }
|
|
||||||
//
|
private void pauseGame(boolean bl) {
|
||||||
// private void pauseGame(boolean bl)
|
if (this.client == null)
|
||||||
// {
|
return;
|
||||||
// if (this.client == null)
|
boolean bl2 = this.client.isIntegratedServerRunning() && !this.client.getServer().isRemote();
|
||||||
// return;
|
if (bl2) {
|
||||||
// boolean bl2 = this.client.isIntegratedServerRunning() && !this.client.getServer().isRemote();
|
this.client.setScreen(new GameMenuScreen(!bl));
|
||||||
// if (bl2) {
|
this.client.getSoundManager().pauseAll();
|
||||||
// this.client.setScreen(new GameMenuScreen(!bl));
|
} else {
|
||||||
// this.client.getSoundManager().pauseAll();
|
this.client.setScreen(new GameMenuScreen(true));
|
||||||
// } else {
|
}
|
||||||
// this.client.setScreen(new GameMenuScreen(true));
|
}
|
||||||
// }
|
|
||||||
// }
|
/**
|
||||||
//
|
* Updates the forward button ticks cooldown.
|
||||||
// /**
|
*
|
||||||
// * Updates the forward button ticks cooldown.
|
* @param state The button state.
|
||||||
// *
|
*
|
||||||
// * @param state The button state.
|
*/
|
||||||
// *
|
private void updateForwardButtonsState(boolean state) {
|
||||||
// */
|
if (state)
|
||||||
// private void updateForwardButtonsState(boolean state)
|
this.forwardButtonTick = -1;
|
||||||
// {
|
else
|
||||||
// if (state)
|
this.forwardButtonTick = 20;
|
||||||
// this.forwardButtonTick = -1;
|
}
|
||||||
// else
|
|
||||||
// this.forwardButtonTick = 20;
|
/**
|
||||||
// }
|
* Updates the jump buttons.
|
||||||
//
|
*/
|
||||||
// /**
|
private void updateJumpButtons() {
|
||||||
// * Updates the jump buttons.
|
if (this.client == null)
|
||||||
// */
|
return;
|
||||||
// private void updateJumpButtons()
|
if (!this.client.interactionManager.isFlyingLocked()) {
|
||||||
// {
|
boolean oldStateFly = this.flyButton.isVisible();
|
||||||
// if (this.client == null)
|
this.jumpButton.setVisible(false);
|
||||||
// return;
|
this.flyButton.setVisible(true);
|
||||||
// if (!this.client.interactionManager.isFlyingLocked()) {
|
this.flyUpButton.setVisible(true);
|
||||||
// boolean oldStateFly = this.flyButton.visible;
|
this.flyDownButton.setVisible(true);
|
||||||
// this.jumpButton.visible = false;
|
if (oldStateFly != this.flyButton.isVisible()) {
|
||||||
// this.flyButton.visible = true;
|
this.flyButtonEnableTicks = 5;
|
||||||
// this.flyUpButton.visible = true;
|
this.setJump(false);
|
||||||
// this.flyDownButton.visible = true;
|
} else if (this.flyButtonEnableTicks > 0)
|
||||||
// if (oldStateFly != this.flyButton.visible) {
|
this.flyButtonEnableTicks--;
|
||||||
// this.flyButtonEnableTicks = 5;
|
} else {
|
||||||
// this.handleJump(null, false);
|
this.jumpButton.setVisible(true);
|
||||||
// } else if (this.flyButtonEnableTicks > 0)
|
this.flyButton.setVisible(false);
|
||||||
// this.flyButtonEnableTicks--;
|
this.flyUpButton.setVisible(false);
|
||||||
// } else {
|
this.flyDownButton.setVisible(false);
|
||||||
// this.jumpButton.visible = true;
|
}
|
||||||
// this.flyButton.visible = false;
|
}
|
||||||
// this.flyUpButton.visible = false;
|
|
||||||
// this.flyDownButton.visible = false;
|
/**
|
||||||
// }
|
* Handles the jump button.
|
||||||
// }
|
*
|
||||||
//
|
* @param btn The pressed button.
|
||||||
// /**
|
*/
|
||||||
// * Handles the jump button.
|
private void handleJump(SpruceButtonWidget btn) {
|
||||||
// *
|
((KeyBindingAccessor) this.client.options.jumpKey).midnightcontrols$handlePressState(btn.isActive());
|
||||||
// * @param btn The pressed button.
|
}
|
||||||
// * @param state The state of the jump button.
|
/**
|
||||||
// */
|
* Handles the jump button.
|
||||||
// private void handleJump(ButtonWidget btn, boolean state)
|
*
|
||||||
// {
|
* @param state The state.
|
||||||
// ((KeyBindingAccessor) this.client.options.keyJump).midnightcontrols$handlePressState(state);
|
*/
|
||||||
// }
|
private void setJump(boolean state) {
|
||||||
//
|
((KeyBindingAccessor) this.client.options.jumpKey).midnightcontrols$handlePressState(state);
|
||||||
// @Override
|
}
|
||||||
// public void tick()
|
|
||||||
// {
|
@Override
|
||||||
// if (this.forwardButtonTick > 0) {
|
public void tick() {
|
||||||
// this.forwardButtonTick--;
|
if (this.forwardButtonTick > 0) {
|
||||||
// } else if (this.forwardButtonTick == 0) {
|
this.forwardButtonTick--;
|
||||||
// if (this.forwardLeftButton.visible)
|
} else if (this.forwardButtonTick == 0) {
|
||||||
// this.forwardLeftButton.visible = false;
|
if (this.forwardLeftButton.isVisible())
|
||||||
// if (this.forwardRightButton.visible)
|
this.forwardLeftButton.setVisible(false);
|
||||||
// this.forwardRightButton.visible = false;
|
if (this.forwardRightButton.isVisible())
|
||||||
// }
|
this.forwardRightButton.setVisible(false);
|
||||||
// this.updateJumpButtons();
|
}
|
||||||
// }
|
this.updateJumpButtons();
|
||||||
//
|
}
|
||||||
// @Override
|
|
||||||
// protected void init()
|
@Override
|
||||||
// {
|
protected void init() {
|
||||||
// super.init();
|
super.init();
|
||||||
// int scaledWidth = this.client.getWindow().getScaledWidth();
|
int scaledWidth = this.client.getWindow().getScaledWidth();
|
||||||
// int scaledHeight = this.client.getWindow().getScaledHeight();
|
int scaledHeight = this.client.getWindow().getScaledHeight();
|
||||||
// this.addDrawableChild(new TexturedButtonWidget(scaledWidth / 2 - 20, 0, 20, 20, 0, 106, 20, ButtonWidget.WIDGETS_LOCATION, 256, 256,
|
this.addDrawableChild(new TexturedButtonWidget(scaledWidth / 2 - 20, 0, 20, 20, 0, 106, 20, new Identifier("textures/gui/widgets.png"), 256, 256,
|
||||||
// btn -> this.client.setScreen(new ChatScreen("")), LiteralText.EMPTY));
|
btn -> this.client.setScreen(new ChatScreen("")), Text.empty()));
|
||||||
// this.addDrawableChild(new TexturedButtonWidget(scaledWidth / 2, 0, 20, 20, 0, 0, 20, WIDGETS_LOCATION, 256, 256,
|
this.addDrawableChild(new TexturedButtonWidget(scaledWidth / 2, 0, 20, 20, 0, 0, 20, WIDGETS_LOCATION, 256, 256,
|
||||||
// btn -> this.pauseGame(false)));
|
btn -> this.pauseGame(false)));
|
||||||
// // Inventory buttons.
|
// Inventory buttons.
|
||||||
// int inventoryButtonX = scaledWidth / 2;
|
int inventoryButtonX = scaledWidth / 2;
|
||||||
// int inventoryButtonY = scaledHeight - 16 - 5;
|
int inventoryButtonY = scaledHeight - 16 - 5;
|
||||||
// if (this.client.options.mainArm == Arm.LEFT) {
|
if (this.client.options.getMainArm().getValue() == Arm.LEFT) {
|
||||||
// inventoryButtonX = inventoryButtonX - 91 - 24;
|
inventoryButtonX = inventoryButtonX - 91 - 24;
|
||||||
// } else {
|
} else {
|
||||||
// inventoryButtonX = inventoryButtonX + 91 + 4;
|
inventoryButtonX = inventoryButtonX + 91 + 4;
|
||||||
// }
|
}
|
||||||
// this.addDrawableChild(new TexturedButtonWidget(inventoryButtonX, inventoryButtonY, 20, 20, 20, 0, 20, WIDGETS_LOCATION, 256, 256,
|
this.addDrawableChild(new TexturedButtonWidget(inventoryButtonX, inventoryButtonY, 20, 20, 20, 0, 20, WIDGETS_LOCATION, 256, 256,
|
||||||
// btn -> {
|
btn -> {
|
||||||
// if (this.client.interactionManager.hasRidingInventory()) {
|
if (this.client.interactionManager.hasRidingInventory()) {
|
||||||
// this.client.player.openRidingInventory();
|
this.client.player.openRidingInventory();
|
||||||
// } else {
|
} else {
|
||||||
// this.client.getTutorialManager().onInventoryOpened();
|
this.client.getTutorialManager().onInventoryOpened();
|
||||||
// this.client.openScreen(new InventoryScreen(this.client.player));
|
this.client.setScreen(new InventoryScreen(this.client.player));
|
||||||
// }
|
}
|
||||||
// }));
|
}));
|
||||||
// int jumpButtonX, swapHandsX, sneakButtonX;
|
int jumpButtonX, swapHandsX, sneakButtonX;
|
||||||
// int sneakButtonY = scaledHeight - 10 - 40 - 5;
|
int sneakButtonY = scaledHeight - 10 - 40 - 5;
|
||||||
// if (MidnightControlsConfig.hudSide == HudSide.LEFT) {
|
if (MidnightControlsConfig.hudSide == HudSide.LEFT) {
|
||||||
// jumpButtonX = scaledWidth - 20 - 20;
|
jumpButtonX = scaledWidth - 20 - 20;
|
||||||
// swapHandsX = jumpButtonX - 5 - 40;
|
swapHandsX = jumpButtonX - 5 - 40;
|
||||||
// sneakButtonX = 10 + 20 + 5;
|
sneakButtonX = 10 + 20 + 5;
|
||||||
// } else {
|
} else {
|
||||||
// jumpButtonX = 20;
|
jumpButtonX = 20;
|
||||||
// swapHandsX = jumpButtonX + 5 + 40;
|
swapHandsX = jumpButtonX + 5 + 40;
|
||||||
// sneakButtonX = scaledWidth - 10 - 40 - 5;
|
sneakButtonX = scaledWidth - 10 - 40 - 5;
|
||||||
// }
|
}
|
||||||
// // Swap items hand.
|
// Swap items hand.
|
||||||
// this.addDrawableChild(new SpruceTexturedButtonWidget(swapHandsX, sneakButtonY, 20, 20, 0, 160, 20, WIDGETS_LOCATION,
|
this.addDrawableChild(new SilentTexturedButtonWidget(Position.of(swapHandsX, sneakButtonY), 20, 20, Text.empty(),
|
||||||
// (btn, state) -> {
|
button -> {
|
||||||
// if (state) {
|
if (button.isActive()) {
|
||||||
// if (!this.client.player.isSpectator()) {
|
if (!this.client.player.isSpectator()) {
|
||||||
// this.client.getNetworkHandler().sendPacket(new PlayerActionC2SPacket(PlayerActionC2SPacket.Action.SWAP_ITEM_WITH_OFFHAND, BlockPos.ORIGIN, Direction.DOWN));
|
this.client.getNetworkHandler().sendPacket(new PlayerActionC2SPacket(PlayerActionC2SPacket.Action.SWAP_ITEM_WITH_OFFHAND, BlockPos.ORIGIN, Direction.DOWN));
|
||||||
// }
|
}
|
||||||
// }
|
}
|
||||||
// }));
|
},0, 160, 20, WIDGETS_LOCATION));
|
||||||
// // Drop
|
// Drop
|
||||||
// this.addDrawableChild(new SpruceTexturedButtonWidget(swapHandsX, sneakButtonY + 5 + 20, 20, 20, 20, 160, 20, WIDGETS_LOCATION,
|
this.addDrawableChild(new SilentTexturedButtonWidget(Position.of(swapHandsX, sneakButtonY + 5 + 20), 20, 20, Text.empty(), btn ->
|
||||||
// (btn, state) -> ((KeyBindingAccessor) this.client.options.keyDrop).midnightcontrols$handlePressState(state)));
|
((KeyBindingAccessor) this.client.options.dropKey).midnightcontrols$handlePressState(btn.isActive()), 0, 160, 20, WIDGETS_LOCATION));
|
||||||
// // Jump keys
|
// Jump keys
|
||||||
// this.addDrawableChild(this.jumpButton = new SpruceTexturedButtonWidget(jumpButtonX, sneakButtonY, 20, 20, 0, 40, 20, WIDGETS_LOCATION,
|
this.addDrawableChild(this.jumpButton = new SilentTexturedButtonWidget(Position.of(jumpButtonX, sneakButtonY), 20, 20, Text.empty(), this::handleJump, 0, 40, 20, WIDGETS_LOCATION));
|
||||||
// this::handleJump));
|
this.addDrawableChild(this.flyButton = new SilentTexturedButtonWidget(Position.of(jumpButtonX, sneakButtonY), 20, 20, Text.empty(),btn -> {
|
||||||
// this.addDrawableChild(this.flyButton = new SpruceTexturedButtonWidget(jumpButtonX, sneakButtonY, 20, 20, 20, 40, 20, WIDGETS_LOCATION,
|
if (this.flyButtonEnableTicks == 0) this.client.player.getAbilities().flying = false;
|
||||||
// (btn, state) -> {
|
}, 20, 40, 20, WIDGETS_LOCATION)
|
||||||
// if (this.flyButtonEnableTicks == 0) this.client..abilities.flying = false;
|
);
|
||||||
// }));
|
this.addDrawableChild(this.flyUpButton = new SilentTexturedButtonWidget(Position.of(jumpButtonX, sneakButtonY - 5 - 20), 20, 20,Text.empty(),
|
||||||
// this.addDrawableChild(this.flyUpButton = new SpruceTexturedButtonWidget(jumpButtonX, sneakButtonY - 5 - 20, 20, 20, 40, 40, 20, WIDGETS_LOCATION,
|
this::handleJump, 40, 40, 20, WIDGETS_LOCATION
|
||||||
// this::handleJump));
|
));
|
||||||
// this.addDrawableChild(this.flyDownButton = new SpruceTexturedButtonWidget(jumpButtonX, sneakButtonY + 20 + 5, 20, 20, 60, 40, 20, WIDGETS_LOCATION,
|
this.addDrawableChild(this.flyDownButton = new SilentTexturedButtonWidget(Position.of(jumpButtonX, sneakButtonY + 20 + 5), 20, 20, Text.empty(),
|
||||||
// (btn, state) -> ((KeyBindingAccessor) this.client.options.keySneak).midnightcontrols$handlePressState(state)));
|
btn -> ((KeyBindingAccessor) this.client.options.sneakKey).midnightcontrols$handlePressState(btn.isActive()), 60, 40, 20, WIDGETS_LOCATION
|
||||||
// this.updateJumpButtons();
|
));
|
||||||
// // Movements keys
|
this.updateJumpButtons();
|
||||||
// this.addDrawableChild((this.startSneakButton = new SpruceTexturedButtonWidget(sneakButtonX, sneakButtonY, 20, 20, 0, 120, 20, WIDGETS_LOCATION,
|
// Movements keys
|
||||||
// (btn, state) -> {
|
this.addDrawableChild((this.startSneakButton = new SilentTexturedButtonWidget(Position.of(sneakButtonX, sneakButtonY), 20, 20, Text.empty(), btn -> {
|
||||||
// if (state) {
|
if (btn.isActive()) {
|
||||||
// ((KeyBindingAccessor) this.client.options.keySneak).midnightcontrols$handlePressState(true);
|
((KeyBindingAccessor) this.client.options.sneakKey).midnightcontrols$handlePressState(true);
|
||||||
// this.startSneakButton.setVisible(false);
|
this.startSneakButton.setVisible(false);
|
||||||
// this.endSneakButton.setVisible(true);
|
this.endSneakButton.setVisible(true);
|
||||||
// }
|
}
|
||||||
// })));
|
}, 0, 120, 20, WIDGETS_LOCATION))
|
||||||
// this.addDrawableChild((this.endSneakButton = new SpruceTexturedButtonWidget(sneakButtonX, sneakButtonY, 20, 20, 20, 120, 20, WIDGETS_LOCATION,
|
);
|
||||||
// (btn, state) -> {
|
this.addDrawableChild((this.endSneakButton = new SilentTexturedButtonWidget(Position.of(sneakButtonX, sneakButtonY), 20, 20, Text.empty(), btn -> {
|
||||||
// if (state) {
|
if (btn.isActive()) {
|
||||||
// ((KeyBindingAccessor) this.client.options.keySneak).midnightcontrols$handlePressState(false);
|
((KeyBindingAccessor) this.client.options.sneakKey).midnightcontrols$handlePressState(false);
|
||||||
// this.endSneakButton.setVisible(false);
|
this.endSneakButton.setVisible(false);
|
||||||
// this.startSneakButton.setVisible(true);
|
this.startSneakButton.setVisible(true);
|
||||||
// }
|
}
|
||||||
// })));
|
}, 20, 120, 20, WIDGETS_LOCATION)));
|
||||||
// this.endSneakButton.setVisible(false);
|
this.endSneakButton.setVisible(false);
|
||||||
// this.addDrawableChild(this.forwardLeftButton = new SpruceTexturedButtonWidget(sneakButtonX - 20 - 5, sneakButtonY - 5 - 20, 20, 20, 80, 80, 20, WIDGETS_LOCATION,
|
this.addDrawableChild(this.forwardLeftButton = new SilentTexturedButtonWidget(Position.of(sneakButtonX - 20 - 5, sneakButtonY - 5 - 20), 20, 20, Text.empty(), btn -> {
|
||||||
// (btn, state) -> {
|
((KeyBindingAccessor) this.client.options.forwardKey).midnightcontrols$handlePressState(btn.isActive());
|
||||||
// ((KeyBindingAccessor) this.client.options.keyForward).midnightcontrols$handlePressState(state);
|
((KeyBindingAccessor) this.client.options.leftKey).midnightcontrols$handlePressState(btn.isActive());
|
||||||
// ((KeyBindingAccessor) this.client.options.keyLeft).midnightcontrols$handlePressState(state);
|
this.updateForwardButtonsState(btn.isActive());
|
||||||
// this.updateForwardButtonsState(state);
|
}, 80, 80, 20, WIDGETS_LOCATION
|
||||||
// }));
|
));
|
||||||
// this.forwardLeftButton.setVisible(false);
|
this.forwardLeftButton.setVisible(false);
|
||||||
// this.addDrawableChild(new SpruceTexturedButtonWidget(sneakButtonX, sneakButtonY - 5 - 20, 20, 20, 0, 80, 20, WIDGETS_LOCATION,
|
this.addDrawableChild(new SilentTexturedButtonWidget(Position.of(sneakButtonX, sneakButtonY - 5 - 20), 20, 20, Text.empty(), btn -> {
|
||||||
// (btn, state) -> {
|
((KeyBindingAccessor) this.client.options.forwardKey).midnightcontrols$handlePressState(btn.isActive());
|
||||||
// ((KeyBindingAccessor) this.client.options.keyForward).midnightcontrols$handlePressState(state);
|
this.updateForwardButtonsState(btn.isActive());
|
||||||
// this.updateForwardButtonsState(state);
|
this.forwardLeftButton.setVisible(true);
|
||||||
// this.forwardLeftButton.setVisible(true);
|
this.forwardRightButton.setVisible(true);
|
||||||
// this.forwardRightButton.setVisible(true);
|
}, 0, 80, 20, WIDGETS_LOCATION
|
||||||
// }));
|
));
|
||||||
// this.addDrawableChild(this.forwardRightButton = new SpruceTexturedButtonWidget(sneakButtonX + 20 + 5, sneakButtonY - 5 - 20, 20, 20, 100, 80, 20, WIDGETS_LOCATION,
|
this.addDrawableChild(this.forwardRightButton = new SilentTexturedButtonWidget(Position.of(sneakButtonX + 20 + 5, sneakButtonY - 5 - 20), 20, 20, Text.empty(), btn -> {
|
||||||
// (btn, state) -> {
|
((KeyBindingAccessor) this.client.options.forwardKey).midnightcontrols$handlePressState(btn.isActive());
|
||||||
// ((KeyBindingAccessor) this.client.options.keyForward).midnightcontrols$handlePressState(state);
|
((KeyBindingAccessor) this.client.options.rightKey).midnightcontrols$handlePressState(btn.isActive());
|
||||||
// ((KeyBindingAccessor) this.client.options.keyRight).midnightcontrols$handlePressState(state);
|
this.updateForwardButtonsState(btn.isActive());
|
||||||
// this.updateForwardButtonsState(state);
|
}, 100, 80, 20, WIDGETS_LOCATION
|
||||||
// }));
|
));
|
||||||
// this.forwardRightButton.setVisible(true);
|
this.forwardRightButton.setVisible(true);
|
||||||
// this.addDrawableChild(new SpruceTexturedButtonWidget(sneakButtonX + 20 + 5, sneakButtonY, 20, 20, 20, 80, 20, WIDGETS_LOCATION,
|
this.addDrawableChild(new SilentTexturedButtonWidget(Position.of(sneakButtonX + 20 + 5, sneakButtonY), 20, 20, Text.empty(),
|
||||||
// (btn, state) -> ((KeyBindingAccessor) this.client.options.keyRight).midnightcontrols$handlePressState(state)));
|
btn -> ((KeyBindingAccessor) this.client.options.rightKey).midnightcontrols$handlePressState(btn.isActive()), 20, 80, 20, WIDGETS_LOCATION
|
||||||
// this.addDrawableChild(new SpruceTexturedButtonWidget(sneakButtonX, sneakButtonY + 20 + 5, 20, 20, 40, 80, 20, WIDGETS_LOCATION,
|
));
|
||||||
// (btn, state) -> ((KeyBindingAccessor) this.client.options.keyBack).midnightcontrols$handlePressState(state)));
|
this.addDrawableChild(new SilentTexturedButtonWidget(Position.of(sneakButtonX, sneakButtonY + 20 + 5), 20, 20, Text.empty(),
|
||||||
// this.addDrawableChild(new SpruceTexturedButtonWidget(sneakButtonX - 20 - 5, sneakButtonY, 20, 20, 60, 80, 20, WIDGETS_LOCATION,
|
btn -> ((KeyBindingAccessor) this.client.options.backKey).midnightcontrols$handlePressState(btn.isActive()), 40, 80, 20, WIDGETS_LOCATION
|
||||||
// (btn, state) -> ((KeyBindingAccessor) this.client.options.keyLeft).midnightcontrols$handlePressState(state)));
|
));
|
||||||
//
|
this.addDrawableChild(new SilentTexturedButtonWidget(Position.of(sneakButtonX - 20 - 5, sneakButtonY), 20, 20, Text.empty(),
|
||||||
// this.children().forEach(button -> {
|
btn -> ((KeyBindingAccessor) this.client.options.leftKey).midnightcontrols$handlePressState(btn.isActive()), 60, 80, 20, WIDGETS_LOCATION
|
||||||
// if (button instanceof SpruceTexturedButtonWidget) {
|
));
|
||||||
// ((SpruceTexturedButtonWidget) button).setSilent(true);
|
}
|
||||||
// }
|
|
||||||
// });
|
@Override
|
||||||
// }
|
public boolean mouseClicked(double mouseX, double mouseY, int button) {
|
||||||
//
|
if (mouseY >= (double) (this.height - 22) && this.client != null && this.client.player != null) {
|
||||||
// @Override
|
int centerX = this.width / 2;
|
||||||
// public boolean mouseClicked(double mouseX, double mouseY, int button)
|
if (mouseX >= (double) (centerX - 90) && mouseX <= (double) (centerX + 90)) {
|
||||||
// {
|
for (int slot = 0; slot < 9; ++slot) {
|
||||||
// if (mouseY >= (double) (this.height - 22) && this.client != null && this.client.player != null) {
|
int slotX = centerX - 90 + slot * 20 + 2;
|
||||||
// int centerX = this.width / 2;
|
if (mouseX >= (double) slotX && mouseX <= (double) (slotX + 20)) {
|
||||||
// if (mouseX >= (double) (centerX - 90) && mouseX <= (double) (centerX + 90)) {
|
this.client.player.getInventory().selectedSlot = slot;
|
||||||
// for (int slot = 0; slot < 9; ++slot) {
|
return true;
|
||||||
// int slotX = centerX - 90 + slot * 20 + 2;
|
}
|
||||||
// if (mouseX >= (double) slotX && mouseX <= (double) (slotX + 20)) {
|
}
|
||||||
// this.client.player.getInventory().selectedSlot = slot;
|
}
|
||||||
// return true;
|
}
|
||||||
// }
|
return super.mouseClicked(mouseX, mouseY, button);
|
||||||
// }
|
}
|
||||||
// }
|
|
||||||
// }
|
@Override
|
||||||
// return super.mouseClicked(mouseX, mouseY, button);
|
public boolean mouseDragged(double mouseX, double mouseY, int button, double deltaX, double deltaY) {
|
||||||
// }
|
if (button == GLFW.GLFW_MOUSE_BUTTON_1 && this.client != null) {
|
||||||
//
|
if (deltaY > 0.01)
|
||||||
// @Override
|
this.mod.input.handleLook(this.client, GLFW_GAMEPAD_AXIS_RIGHT_Y, (float) Math.abs(deltaY / 5.0), 2);
|
||||||
// public boolean mouseDragged(double mouseX, double mouseY, int button, double deltaX, double deltaY)
|
else if (deltaY < 0.01)
|
||||||
// {
|
this.mod.input.handleLook(this.client, GLFW_GAMEPAD_AXIS_RIGHT_Y, (float) Math.abs(deltaY / 5.0), 1);
|
||||||
// if (button == GLFW.GLFW_MOUSE_BUTTON_1 && this.client != null) {
|
|
||||||
// if (deltaY > 0.01)
|
if (deltaX > 0.01)
|
||||||
// this.mod.input.handleLook(this.client, GLFW_GAMEPAD_AXIS_RIGHT_Y, (float) Math.abs(deltaY / 5.0), 2);
|
this.mod.input.handleLook(this.client, GLFW_GAMEPAD_AXIS_RIGHT_X, (float) Math.abs(deltaX / 5.0), 2);
|
||||||
// else if (deltaY < 0.01)
|
else if (deltaX < 0.01)
|
||||||
// this.mod.input.handleLook(this.client, GLFW_GAMEPAD_AXIS_RIGHT_Y, (float) Math.abs(deltaY / 5.0), 1);
|
this.mod.input.handleLook(this.client, GLFW_GAMEPAD_AXIS_RIGHT_X, (float) Math.abs(deltaX / 5.0), 1);
|
||||||
//
|
}
|
||||||
// if (deltaX > 0.01)
|
return super.mouseDragged(mouseX, mouseY, button, deltaX, deltaY);
|
||||||
// this.mod.input.handleLook(this.client, GLFW_GAMEPAD_AXIS_RIGHT_X, (float) Math.abs(deltaX / 5.0), 2);
|
}
|
||||||
// else if (deltaX < 0.01)
|
|
||||||
// this.mod.input.handleLook(this.client, GLFW_GAMEPAD_AXIS_RIGHT_X, (float) Math.abs(deltaX / 5.0), 1);
|
|
||||||
// }
|
|
||||||
// return super.mouseDragged(mouseX, mouseY, button, deltaX, deltaY);
|
|
||||||
// }
|
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -16,7 +16,6 @@ import dev.lambdaurora.spruceui.SpruceTexts;
|
|||||||
import dev.lambdaurora.spruceui.widget.AbstractSpruceIconButtonWidget;
|
import dev.lambdaurora.spruceui.widget.AbstractSpruceIconButtonWidget;
|
||||||
import net.minecraft.client.MinecraftClient;
|
import net.minecraft.client.MinecraftClient;
|
||||||
import net.minecraft.client.util.math.MatrixStack;
|
import net.minecraft.client.util.math.MatrixStack;
|
||||||
import net.minecraft.text.LiteralText;
|
|
||||||
import net.minecraft.text.Text;
|
import net.minecraft.text.Text;
|
||||||
import org.jetbrains.annotations.NotNull;
|
import org.jetbrains.annotations.NotNull;
|
||||||
|
|
||||||
@@ -35,13 +34,13 @@ public class ControllerButtonWidget extends AbstractSpruceIconButtonWidget {
|
|||||||
public void update() {
|
public void update() {
|
||||||
int length = binding.getButton().length;
|
int length = binding.getButton().length;
|
||||||
this.setMessage(this.binding.isNotBound() ? SpruceTexts.NOT_BOUND.copy() :
|
this.setMessage(this.binding.isNotBound() ? SpruceTexts.NOT_BOUND.copy() :
|
||||||
(length > 0 ? ButtonBinding.getLocalizedButtonName(binding.getButton()[0]) : new LiteralText("<>")));
|
(length > 0 ? ButtonBinding.getLocalizedButtonName(binding.getButton()[0]) : Text.literal("<>")));
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public Text getMessage() {
|
public Text getMessage() {
|
||||||
if (this.binding.getButton().length > 1)
|
if (this.binding.getButton().length > 1)
|
||||||
return LiteralText.EMPTY;
|
return Text.empty();
|
||||||
return super.getMessage();
|
return super.getMessage();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -17,9 +17,10 @@ import dev.lambdaurora.spruceui.Position;
|
|||||||
import dev.lambdaurora.spruceui.SpruceTexts;
|
import dev.lambdaurora.spruceui.SpruceTexts;
|
||||||
import dev.lambdaurora.spruceui.widget.SpruceButtonWidget;
|
import dev.lambdaurora.spruceui.widget.SpruceButtonWidget;
|
||||||
import dev.lambdaurora.spruceui.widget.container.SpruceContainerWidget;
|
import dev.lambdaurora.spruceui.widget.container.SpruceContainerWidget;
|
||||||
|
import eu.midnightdust.midnightcontrols.client.gui.MidnightControlsSettingsScreen;
|
||||||
import net.minecraft.client.gui.screen.option.ControlsOptionsScreen;
|
import net.minecraft.client.gui.screen.option.ControlsOptionsScreen;
|
||||||
import net.minecraft.client.util.math.MatrixStack;
|
import net.minecraft.client.util.math.MatrixStack;
|
||||||
import net.minecraft.text.TranslatableText;
|
import net.minecraft.text.Text;
|
||||||
import org.aperlambda.lambdacommon.utils.function.Predicates;
|
import org.aperlambda.lambdacommon.utils.function.Predicates;
|
||||||
|
|
||||||
import java.util.ArrayList;
|
import java.util.ArrayList;
|
||||||
@@ -46,9 +47,10 @@ public class ControllerControlsWidget extends SpruceContainerWidget {
|
|||||||
|
|
||||||
protected void init() {
|
protected void init() {
|
||||||
this.addChild(new SpruceButtonWidget(Position.of(this, this.width / 2 - 155, 18), 310, 20,
|
this.addChild(new SpruceButtonWidget(Position.of(this, this.width / 2 - 155, 18), 310, 20,
|
||||||
new TranslatableText("midnightcontrols.menu.keyboard_controls"),
|
Text.translatable("midnightcontrols.menu.keyboard_controls"),
|
||||||
btn -> this.client.setScreen(new ControlsOptionsScreen(null, this.client.options))));
|
btn -> this.client.setScreen(new ControlsOptionsScreen(null, this.client.options))));
|
||||||
this.bindingsListWidget = new ControlsListWidget(Position.of(this, 0, 43), this.width, this.height - 43 - 35, this);
|
this.bindingsListWidget = new ControlsListWidget(Position.of(this, 0, 43), this.width, this.height - 43 - 35, this);
|
||||||
|
this.bindingsListWidget.setBackground(new MidnightControlsSettingsScreen.MidnightControlsBackground(130));
|
||||||
this.addChild(this.bindingsListWidget);
|
this.addChild(this.bindingsListWidget);
|
||||||
this.addChild(this.resetButton = new SpruceButtonWidget(Position.of(this, this.width / 2 - 155, this.height - 29), 150, 20,
|
this.addChild(this.resetButton = new SpruceButtonWidget(Position.of(this, this.width / 2 - 155, this.height - 29), 150, 20,
|
||||||
SpruceTexts.CONTROLS_RESET_ALL,
|
SpruceTexts.CONTROLS_RESET_ALL,
|
||||||
@@ -57,7 +59,7 @@ public class ControllerControlsWidget extends SpruceContainerWidget {
|
|||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void renderWidget(MatrixStack matrices, int mouseX, int mouseY, float delta) {
|
public void renderWidget(MatrixStack matrices, int mouseX, int mouseY, float delta) {
|
||||||
drawCenteredText(matrices, this.client.textRenderer, new TranslatableText("midnightcontrols.menu.title.controller_controls"),
|
drawCenteredText(matrices, this.client.textRenderer, Text.translatable("midnightcontrols.menu.title.controller_controls"),
|
||||||
this.getX() + this.width / 2, this.getY() + 4, 16777215);
|
this.getX() + this.width / 2, this.getY() + 4, 16777215);
|
||||||
this.resetButton.setActive(InputManager.streamBindings().anyMatch(Predicates.not(ButtonBinding::isDefault)));
|
this.resetButton.setActive(InputManager.streamBindings().anyMatch(Predicates.not(ButtonBinding::isDefault)));
|
||||||
super.renderWidget(matrices, mouseX, mouseY, delta);
|
super.renderWidget(matrices, mouseX, mouseY, delta);
|
||||||
|
|||||||
@@ -27,9 +27,7 @@ import net.fabricmc.api.EnvType;
|
|||||||
import net.fabricmc.api.Environment;
|
import net.fabricmc.api.Environment;
|
||||||
import net.minecraft.client.resource.language.I18n;
|
import net.minecraft.client.resource.language.I18n;
|
||||||
import net.minecraft.client.util.math.MatrixStack;
|
import net.minecraft.client.util.math.MatrixStack;
|
||||||
import net.minecraft.text.LiteralText;
|
|
||||||
import net.minecraft.text.Text;
|
import net.minecraft.text.Text;
|
||||||
import net.minecraft.text.TranslatableText;
|
|
||||||
import net.minecraft.util.Formatting;
|
import net.minecraft.util.Formatting;
|
||||||
import org.jetbrains.annotations.NotNull;
|
import org.jetbrains.annotations.NotNull;
|
||||||
import org.jetbrains.annotations.Nullable;
|
import org.jetbrains.annotations.Nullable;
|
||||||
@@ -93,17 +91,17 @@ public class ControlsListWidget extends SpruceEntryListWidget<ControlsListWidget
|
|||||||
MidnightControlsClient.get().input.beginControlsInput(gui);
|
MidnightControlsClient.get().input.beginControlsInput(gui);
|
||||||
}) {
|
}) {
|
||||||
protected Text getNarrationMessage() {
|
protected Text getNarrationMessage() {
|
||||||
return binding.isNotBound() ? new TranslatableText("narrator.controls.unbound", bindingName)
|
return binding.isNotBound() ? Text.translatable("narrator.controls.unbound", bindingName)
|
||||||
: new TranslatableText("narrator.controls.bound", bindingName, super.getNarrationMessage());
|
: Text.translatable("narrator.controls.bound", bindingName, super.getNarrationMessage());
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
this.children.add(editButton);
|
this.children.add(editButton);
|
||||||
this.resetButton = new SpruceButtonWidget(Position.of(this,
|
this.resetButton = new SpruceButtonWidget(Position.of(this,
|
||||||
this.editButton.getPosition().getRelativeX() + this.editButton.getWidth() + 2, 0),
|
this.editButton.getPosition().getRelativeX() + this.editButton.getWidth() + 2, 0),
|
||||||
44, 20, new TranslatableText("controls.reset"),
|
44, 20, Text.translatable("controls.reset"),
|
||||||
btn -> MidnightControlsConfig.setButtonBinding(binding, binding.getDefaultButton())) {
|
btn -> MidnightControlsConfig.setButtonBinding(binding, binding.getDefaultButton())) {
|
||||||
protected Text getNarrationMessage() {
|
protected Text getNarrationMessage() {
|
||||||
return new TranslatableText("narrator.controls.reset", bindingName);
|
return Text.translatable("narrator.controls.reset", bindingName);
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
this.children.add(this.resetButton);
|
this.children.add(this.resetButton);
|
||||||
@@ -116,7 +114,7 @@ public class ControlsListWidget extends SpruceEntryListWidget<ControlsListWidget
|
|||||||
MidnightControlsClient.get().input.beginControlsInput(null);
|
MidnightControlsClient.get().input.beginControlsInput(null);
|
||||||
}) {
|
}) {
|
||||||
protected Text getNarrationMessage() {
|
protected Text getNarrationMessage() {
|
||||||
return new TranslatableText("midnightcontrols.narrator.unbound", bindingName);
|
return Text.translatable("midnightcontrols.narrator.unbound", bindingName);
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
this.children.add(this.unbindButton);
|
this.children.add(this.unbindButton);
|
||||||
@@ -243,9 +241,9 @@ public class ControlsListWidget extends SpruceEntryListWidget<ControlsListWidget
|
|||||||
|
|
||||||
this.editButton.update();
|
this.editButton.update();
|
||||||
if (focused) {
|
if (focused) {
|
||||||
var text = new LiteralText("> ").formatted(Formatting.WHITE);
|
var text = Text.literal("> ").formatted(Formatting.WHITE);
|
||||||
text.append(this.editButton.getMessage().copy().formatted(Formatting.YELLOW));
|
text.append(this.editButton.getMessage().copy().formatted(Formatting.YELLOW));
|
||||||
this.editButton.setMessage(text.append(new LiteralText(" <").formatted(Formatting.WHITE)));
|
this.editButton.setMessage(text.append(Text.literal(" <").formatted(Formatting.WHITE)));
|
||||||
} else if (!this.binding.isNotBound() && InputManager.hasDuplicatedBindings(this.binding)) {
|
} else if (!this.binding.isNotBound() && InputManager.hasDuplicatedBindings(this.binding)) {
|
||||||
var text = this.editButton.getMessage().copy();
|
var text = this.editButton.getMessage().copy();
|
||||||
this.editButton.setMessage(text.formatted(Formatting.RED));
|
this.editButton.setMessage(text.formatted(Formatting.RED));
|
||||||
@@ -264,7 +262,7 @@ public class ControlsListWidget extends SpruceEntryListWidget<ControlsListWidget
|
|||||||
protected CategoryEntry(ControlsListWidget parent, ButtonCategory category) {
|
protected CategoryEntry(ControlsListWidget parent, ButtonCategory category) {
|
||||||
super(parent);
|
super(parent);
|
||||||
this.separatorWidget = new SpruceSeparatorWidget(Position.of(this, 2, 0), this.getWidth() - 4,
|
this.separatorWidget = new SpruceSeparatorWidget(Position.of(this, 2, 0), this.getWidth() - 4,
|
||||||
new LiteralText(category.getTranslatedName())) {
|
Text.literal(category.getTranslatedName())) {
|
||||||
@Override
|
@Override
|
||||||
public int getWidth() {
|
public int getWidth() {
|
||||||
return CategoryEntry.this.getWidth() - 4;
|
return CategoryEntry.this.getWidth() - 4;
|
||||||
|
|||||||
@@ -0,0 +1,26 @@
|
|||||||
|
package eu.midnightdust.midnightcontrols.client.gui.widget;
|
||||||
|
|
||||||
|
import dev.lambdaurora.spruceui.Position;
|
||||||
|
import dev.lambdaurora.spruceui.widget.SpruceTexturedButtonWidget;
|
||||||
|
import net.minecraft.text.Text;
|
||||||
|
import net.minecraft.util.Identifier;
|
||||||
|
|
||||||
|
public class SilentTexturedButtonWidget extends SpruceTexturedButtonWidget {
|
||||||
|
public SilentTexturedButtonWidget(Position position, int width, int height, Text message, PressAction action, int u, int v, int hoveredVOffset, Identifier texture) {
|
||||||
|
super(position, width, height, message, action, u, v, hoveredVOffset, texture);
|
||||||
|
}
|
||||||
|
|
||||||
|
public SilentTexturedButtonWidget(Position position, int width, int height, Text message, boolean showMessage, PressAction action, int u, int v, int hoveredVOffset, Identifier texture) {
|
||||||
|
super(position, width, height, message, showMessage, action, u, v, hoveredVOffset, texture);
|
||||||
|
}
|
||||||
|
|
||||||
|
public SilentTexturedButtonWidget(Position position, int width, int height, Text message, PressAction action, int u, int v, int hoveredVOffset, Identifier texture, int textureWidth, int textureHeight) {
|
||||||
|
super(position, width, height, message, action, u, v, hoveredVOffset, texture, textureWidth, textureHeight);
|
||||||
|
}
|
||||||
|
|
||||||
|
public SilentTexturedButtonWidget(Position position, int width, int height, Text message, boolean showMessage, PressAction action, int u, int v, int hoveredVOffset, Identifier texture, int textureWidth, int textureHeight) {
|
||||||
|
super(position, width, height, message, showMessage, action, u, v, hoveredVOffset, texture, textureWidth, textureHeight);
|
||||||
|
}
|
||||||
|
@Override
|
||||||
|
public void playDownSound() {}
|
||||||
|
}
|
||||||
@@ -10,6 +10,7 @@
|
|||||||
package eu.midnightdust.midnightcontrols.client.mixin;
|
package eu.midnightdust.midnightcontrols.client.mixin;
|
||||||
|
|
||||||
import com.mojang.authlib.GameProfile;
|
import com.mojang.authlib.GameProfile;
|
||||||
|
import eu.midnightdust.midnightcontrols.MidnightControls;
|
||||||
import eu.midnightdust.midnightcontrols.client.MidnightControlsClient;
|
import eu.midnightdust.midnightcontrols.client.MidnightControlsClient;
|
||||||
import eu.midnightdust.midnightcontrols.client.MidnightControlsConfig;
|
import eu.midnightdust.midnightcontrols.client.MidnightControlsConfig;
|
||||||
import eu.midnightdust.midnightcontrols.client.controller.MovementHandler;
|
import eu.midnightdust.midnightcontrols.client.controller.MovementHandler;
|
||||||
@@ -19,12 +20,15 @@ import net.minecraft.client.network.AbstractClientPlayerEntity;
|
|||||||
import net.minecraft.client.network.ClientPlayerEntity;
|
import net.minecraft.client.network.ClientPlayerEntity;
|
||||||
import net.minecraft.client.world.ClientWorld;
|
import net.minecraft.client.world.ClientWorld;
|
||||||
import net.minecraft.entity.MovementType;
|
import net.minecraft.entity.MovementType;
|
||||||
|
import net.minecraft.network.encryption.PlayerPublicKey;
|
||||||
import net.minecraft.util.math.Vec3d;
|
import net.minecraft.util.math.Vec3d;
|
||||||
|
import org.jetbrains.annotations.Nullable;
|
||||||
import org.spongepowered.asm.mixin.Final;
|
import org.spongepowered.asm.mixin.Final;
|
||||||
import org.spongepowered.asm.mixin.Mixin;
|
import org.spongepowered.asm.mixin.Mixin;
|
||||||
import org.spongepowered.asm.mixin.Shadow;
|
import org.spongepowered.asm.mixin.Shadow;
|
||||||
import org.spongepowered.asm.mixin.injection.At;
|
import org.spongepowered.asm.mixin.injection.At;
|
||||||
import org.spongepowered.asm.mixin.injection.Inject;
|
import org.spongepowered.asm.mixin.injection.Inject;
|
||||||
|
import org.spongepowered.asm.mixin.injection.Redirect;
|
||||||
import org.spongepowered.asm.mixin.injection.callback.CallbackInfo;
|
import org.spongepowered.asm.mixin.injection.callback.CallbackInfo;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@@ -34,6 +38,10 @@ import org.spongepowered.asm.mixin.injection.callback.CallbackInfo;
|
|||||||
public abstract class ClientPlayerEntityMixin extends AbstractClientPlayerEntity {
|
public abstract class ClientPlayerEntityMixin extends AbstractClientPlayerEntity {
|
||||||
private boolean midnightcontrols$driftingPrevented = false;
|
private boolean midnightcontrols$driftingPrevented = false;
|
||||||
|
|
||||||
|
public ClientPlayerEntityMixin(ClientWorld world, GameProfile profile, @Nullable PlayerPublicKey publicKey) {
|
||||||
|
super(world, profile, publicKey);
|
||||||
|
}
|
||||||
|
|
||||||
@Shadow
|
@Shadow
|
||||||
protected abstract boolean hasMovementInput();
|
protected abstract boolean hasMovementInput();
|
||||||
|
|
||||||
@@ -47,13 +55,13 @@ public abstract class ClientPlayerEntityMixin extends AbstractClientPlayerEntity
|
|||||||
@Shadow
|
@Shadow
|
||||||
protected abstract boolean isCamera();
|
protected abstract boolean isCamera();
|
||||||
|
|
||||||
public ClientPlayerEntityMixin(ClientWorld world, GameProfile profile) {
|
@Shadow protected int ticksLeftToDoubleTapSprint;
|
||||||
super(world, profile);
|
|
||||||
}
|
|
||||||
|
|
||||||
@Inject(method = "move(Lnet/minecraft/entity/MovementType;Lnet/minecraft/util/math/Vec3d;)V", at = @At(value = "INVOKE", target = "Lnet/minecraft/client/network/AbstractClientPlayerEntity;move(Lnet/minecraft/entity/MovementType;Lnet/minecraft/util/math/Vec3d;)V"))
|
@Inject(method = "move(Lnet/minecraft/entity/MovementType;Lnet/minecraft/util/math/Vec3d;)V", at = @At(value = "INVOKE", target = "Lnet/minecraft/client/network/AbstractClientPlayerEntity;move(Lnet/minecraft/entity/MovementType;Lnet/minecraft/util/math/Vec3d;)V"))
|
||||||
public void onMove(MovementType type, Vec3d movement, CallbackInfo ci) {
|
public void onMove(MovementType type, Vec3d movement, CallbackInfo ci) {
|
||||||
var mod = MidnightControlsClient.get();
|
if (!MidnightControlsConfig.doubleTapToSprint) ticksLeftToDoubleTapSprint = 0;
|
||||||
|
if (!MidnightControls.isExtrasLoaded) return;
|
||||||
if (type == MovementType.SELF) {
|
if (type == MovementType.SELF) {
|
||||||
if (this.getAbilities().flying && (!MidnightControlsConfig.flyDrifting || !MidnightControlsConfig.verticalFlyDrifting)) {
|
if (this.getAbilities().flying && (!MidnightControlsConfig.flyDrifting || !MidnightControlsConfig.verticalFlyDrifting)) {
|
||||||
if (!this.hasMovementInput()) {
|
if (!this.hasMovementInput()) {
|
||||||
@@ -68,7 +76,7 @@ public abstract class ClientPlayerEntityMixin extends AbstractClientPlayerEntity
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@Inject(method = "tickMovement", at = @At(value = "INVOKE", target = "Lnet/minecraft/client/input/Input;tick(Z)V", shift = At.Shift.AFTER))
|
@Inject(method = "tickMovement", at = @At(value = "INVOKE", target = "Lnet/minecraft/client/input/Input;tick(ZF)V", shift = At.Shift.AFTER))
|
||||||
public void onInputUpdate(CallbackInfo ci) {
|
public void onInputUpdate(CallbackInfo ci) {
|
||||||
MovementHandler.HANDLER.applyMovement((ClientPlayerEntity) (Object) this);
|
MovementHandler.HANDLER.applyMovement((ClientPlayerEntity) (Object) this);
|
||||||
}
|
}
|
||||||
@@ -76,7 +84,7 @@ public abstract class ClientPlayerEntityMixin extends AbstractClientPlayerEntity
|
|||||||
@Inject(method = "tickMovement", at = @At(value = "INVOKE", target = "Lnet/minecraft/client/network/ClientPlayerEntity;isCamera()Z"))
|
@Inject(method = "tickMovement", at = @At(value = "INVOKE", target = "Lnet/minecraft/client/network/ClientPlayerEntity;isCamera()Z"))
|
||||||
public void onTickMovement(CallbackInfo ci) {
|
public void onTickMovement(CallbackInfo ci) {
|
||||||
if (this.getAbilities().flying && this.isCamera()) {
|
if (this.getAbilities().flying && this.isCamera()) {
|
||||||
if (MidnightControlsConfig.verticalFlyDrifting)
|
if (MidnightControlsConfig.verticalFlyDrifting || !MidnightControls.isExtrasLoaded)
|
||||||
return;
|
return;
|
||||||
int moving = 0;
|
int moving = 0;
|
||||||
if (this.input.sneaking) {
|
if (this.input.sneaking) {
|
||||||
|
|||||||
@@ -16,7 +16,6 @@ import net.minecraft.client.gui.screen.option.GameOptionsScreen;
|
|||||||
import net.minecraft.client.gui.widget.ButtonWidget;
|
import net.minecraft.client.gui.widget.ButtonWidget;
|
||||||
import net.minecraft.client.option.GameOptions;
|
import net.minecraft.client.option.GameOptions;
|
||||||
import net.minecraft.text.Text;
|
import net.minecraft.text.Text;
|
||||||
import net.minecraft.text.TranslatableText;
|
|
||||||
import org.spongepowered.asm.mixin.Mixin;
|
import org.spongepowered.asm.mixin.Mixin;
|
||||||
import org.spongepowered.asm.mixin.injection.At;
|
import org.spongepowered.asm.mixin.injection.At;
|
||||||
import org.spongepowered.asm.mixin.injection.Inject;
|
import org.spongepowered.asm.mixin.injection.Inject;
|
||||||
@@ -26,7 +25,7 @@ import org.spongepowered.asm.mixin.injection.callback.CallbackInfo;
|
|||||||
* Injects the new controls settings button.
|
* Injects the new controls settings button.
|
||||||
*/
|
*/
|
||||||
@Mixin(ControlsOptionsScreen.class)
|
@Mixin(ControlsOptionsScreen.class)
|
||||||
public class ControlsOptionsScreenMixin extends GameOptionsScreen {
|
public abstract class ControlsOptionsScreenMixin extends GameOptionsScreen {
|
||||||
public ControlsOptionsScreenMixin(Screen parent, GameOptions gameOptions, Text text) {
|
public ControlsOptionsScreenMixin(Screen parent, GameOptions gameOptions, Text text) {
|
||||||
super(parent, gameOptions, text);
|
super(parent, gameOptions, text);
|
||||||
}
|
}
|
||||||
@@ -35,7 +34,7 @@ public class ControlsOptionsScreenMixin extends GameOptionsScreen {
|
|||||||
int i = this.width / 2 - 155;
|
int i = this.width / 2 - 155;
|
||||||
int j = i + 160;
|
int j = i + 160;
|
||||||
int k = this.height / 6 - 12 + 48;;
|
int k = this.height / 6 - 12 + 48;;
|
||||||
this.addDrawableChild(new ButtonWidget(j, k, 150, 20, new TranslatableText("midnightcontrols.menu.title.controller").append("..."), (button) -> {
|
this.addDrawableChild(new ButtonWidget(j, k, 150, 20, Text.translatable("midnightcontrols.menu.title.controller").append("..."), (button) -> {
|
||||||
this.client.setScreen(new MidnightControlsSettingsScreen(this, false));
|
this.client.setScreen(new MidnightControlsSettingsScreen(this, false));
|
||||||
}));
|
}));
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -29,7 +29,9 @@ public interface CreativeInventoryScreenAccessor {
|
|||||||
* @return the selected tab index
|
* @return the selected tab index
|
||||||
*/
|
*/
|
||||||
@Accessor("selectedTab")
|
@Accessor("selectedTab")
|
||||||
int getSelectedTab();
|
static int getSelectedTab() {
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Sets the selected tab.
|
* Sets the selected tab.
|
||||||
|
|||||||
@@ -10,6 +10,8 @@
|
|||||||
package eu.midnightdust.midnightcontrols.client.mixin;
|
package eu.midnightdust.midnightcontrols.client.mixin;
|
||||||
|
|
||||||
import net.minecraft.client.option.GameOptions;
|
import net.minecraft.client.option.GameOptions;
|
||||||
|
import net.minecraft.client.option.SimpleOption;
|
||||||
|
import org.spongepowered.asm.mixin.Final;
|
||||||
import org.spongepowered.asm.mixin.Mixin;
|
import org.spongepowered.asm.mixin.Mixin;
|
||||||
import org.spongepowered.asm.mixin.Shadow;
|
import org.spongepowered.asm.mixin.Shadow;
|
||||||
import org.spongepowered.asm.mixin.injection.At;
|
import org.spongepowered.asm.mixin.injection.At;
|
||||||
@@ -22,13 +24,13 @@ import org.spongepowered.asm.mixin.injection.callback.CallbackInfo;
|
|||||||
* Sets the default of the Auto-Jump option to false.
|
* Sets the default of the Auto-Jump option to false.
|
||||||
*/
|
*/
|
||||||
@Mixin(GameOptions.class)
|
@Mixin(GameOptions.class)
|
||||||
public class GameOptionsMixin {
|
public abstract class GameOptionsMixin {
|
||||||
@Shadow
|
|
||||||
public boolean autoJump;
|
@Shadow public abstract SimpleOption<Boolean> getAutoJump();
|
||||||
|
|
||||||
@Inject(method = "load", at = @At("HEAD"))
|
@Inject(method = "load", at = @At("HEAD"))
|
||||||
public void onInit(CallbackInfo ci) {
|
public void onInit(CallbackInfo ci) {
|
||||||
// Set default value of the Auto-Jump option to false.
|
// Set default value of the Auto-Jump option to false.
|
||||||
this.autoJump = false;
|
getAutoJump().setValue(false);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -13,6 +13,7 @@ import eu.midnightdust.midnightcontrols.ControlsMode;
|
|||||||
import eu.midnightdust.midnightcontrols.client.MidnightControlsConfig;
|
import eu.midnightdust.midnightcontrols.client.MidnightControlsConfig;
|
||||||
import eu.midnightdust.midnightcontrols.client.MidnightInput;
|
import eu.midnightdust.midnightcontrols.client.MidnightInput;
|
||||||
import eu.midnightdust.midnightcontrols.client.compat.MidnightControlsCompat;
|
import eu.midnightdust.midnightcontrols.client.compat.MidnightControlsCompat;
|
||||||
|
import eu.midnightdust.midnightcontrols.client.controller.ButtonBinding;
|
||||||
import eu.midnightdust.midnightcontrols.client.gui.MidnightControlsRenderer;
|
import eu.midnightdust.midnightcontrols.client.gui.MidnightControlsRenderer;
|
||||||
import eu.midnightdust.midnightcontrols.client.util.HandledScreenAccessor;
|
import eu.midnightdust.midnightcontrols.client.util.HandledScreenAccessor;
|
||||||
import net.minecraft.client.MinecraftClient;
|
import net.minecraft.client.MinecraftClient;
|
||||||
@@ -20,9 +21,11 @@ import net.minecraft.client.gui.screen.ingame.HandledScreen;
|
|||||||
import net.minecraft.client.util.math.MatrixStack;
|
import net.minecraft.client.util.math.MatrixStack;
|
||||||
import net.minecraft.screen.slot.Slot;
|
import net.minecraft.screen.slot.Slot;
|
||||||
import net.minecraft.screen.slot.SlotActionType;
|
import net.minecraft.screen.slot.SlotActionType;
|
||||||
|
import net.minecraft.text.Text;
|
||||||
import org.jetbrains.annotations.Nullable;
|
import org.jetbrains.annotations.Nullable;
|
||||||
import org.lwjgl.glfw.GLFW;
|
import org.lwjgl.glfw.GLFW;
|
||||||
import org.spongepowered.asm.mixin.Mixin;
|
import org.spongepowered.asm.mixin.Mixin;
|
||||||
|
import org.spongepowered.asm.mixin.Unique;
|
||||||
import org.spongepowered.asm.mixin.gen.Accessor;
|
import org.spongepowered.asm.mixin.gen.Accessor;
|
||||||
import org.spongepowered.asm.mixin.gen.Invoker;
|
import org.spongepowered.asm.mixin.gen.Invoker;
|
||||||
import org.spongepowered.asm.mixin.injection.At;
|
import org.spongepowered.asm.mixin.injection.At;
|
||||||
@@ -34,6 +37,7 @@ import org.spongepowered.asm.mixin.injection.callback.CallbackInfo;
|
|||||||
*/
|
*/
|
||||||
@Mixin(HandledScreen.class)
|
@Mixin(HandledScreen.class)
|
||||||
public abstract class HandledScreenMixin implements HandledScreenAccessor {
|
public abstract class HandledScreenMixin implements HandledScreenAccessor {
|
||||||
|
@Unique private static float scale = 1f;
|
||||||
|
|
||||||
@Accessor("x")
|
@Accessor("x")
|
||||||
public abstract int getX();
|
public abstract int getX();
|
||||||
@@ -55,16 +59,26 @@ public abstract class HandledScreenMixin implements HandledScreenAccessor {
|
|||||||
public void onRender(MatrixStack matrices, int mouseX, int mouseY, float delta, CallbackInfo ci) {
|
public void onRender(MatrixStack matrices, int mouseX, int mouseY, float delta, CallbackInfo ci) {
|
||||||
if (MidnightControlsConfig.controlsMode == ControlsMode.CONTROLLER) {
|
if (MidnightControlsConfig.controlsMode == ControlsMode.CONTROLLER) {
|
||||||
var client = MinecraftClient.getInstance();
|
var client = MinecraftClient.getInstance();
|
||||||
int x = 2, y = client.getWindow().getScaledHeight() - 2 - MidnightControlsRenderer.ICON_SIZE;
|
if (client.getWindow().getScaleFactor() >= 4) {
|
||||||
|
scale = (float) (0.75f * (client.getWindow().getScaleFactor()-3));
|
||||||
|
} else scale = 1f;
|
||||||
|
if (scale != 1f) matrices.scale(scale,scale,scale);
|
||||||
|
int x = 2, y = (int) (client.getWindow().getScaledHeight() * (1 / scale) - 2 - MidnightControlsRenderer.ICON_SIZE);
|
||||||
|
if (MidnightControlsCompat.isEMIPresent()) {
|
||||||
|
x += 40 * (1 / scale);
|
||||||
|
}
|
||||||
x = MidnightControlsRenderer.drawButtonTip(matrices, x, y, new int[]{GLFW.GLFW_GAMEPAD_BUTTON_A}, "midnightcontrols.action.pickup_all", true, client) + 2;
|
x = MidnightControlsRenderer.drawButtonTip(matrices, x, y, new int[]{GLFW.GLFW_GAMEPAD_BUTTON_A}, "midnightcontrols.action.pickup_all", true, client) + 2;
|
||||||
x = MidnightControlsRenderer.drawButtonTip(matrices, x, y, new int[]{GLFW.GLFW_GAMEPAD_BUTTON_B}, "midnightcontrols.action.exit", true, client) + 2;
|
x = MidnightControlsRenderer.drawButtonTip(matrices, x, y, new int[]{GLFW.GLFW_GAMEPAD_BUTTON_B}, "midnightcontrols.action.exit", true, client) + 2;
|
||||||
if (MidnightControlsCompat.isReiPresent()) {
|
if (MidnightControlsCompat.isReiPresent()) {
|
||||||
x = 2;
|
x = 2;
|
||||||
y -= 24;
|
y -= 24;
|
||||||
}
|
}
|
||||||
x = MidnightControlsRenderer.drawButtonTip(matrices, x, y, new int[]{GLFW.GLFW_GAMEPAD_BUTTON_X}, "midnightcontrols.action.pickup", true, client) + 2;
|
if (MidnightControlsCompat.isEMIPresent()) {
|
||||||
|
x = (int) (client.getWindow().getScaledWidth() * (1 / scale) - 55 - client.textRenderer.getWidth(Text.translatable("midnightcontrols.action.pickup")) * (1 / scale) - client.textRenderer.getWidth(Text.translatable("midnightcontrols.action.quick_move")) - MidnightControlsRenderer.getBindingIconWidth(ButtonBinding.TAKE) - MidnightControlsRenderer.getBindingIconWidth(ButtonBinding.QUICK_MOVE));
|
||||||
|
}
|
||||||
|
x = MidnightControlsRenderer.drawButtonTip(matrices, x, y, new int[]{GLFW.GLFW_GAMEPAD_BUTTON_X}, "midnightcontrols.action.pickup", true, client);
|
||||||
MidnightControlsRenderer.drawButtonTip(matrices, x, y, new int[]{GLFW.GLFW_GAMEPAD_BUTTON_Y}, "midnightcontrols.action.quick_move", true, client);
|
MidnightControlsRenderer.drawButtonTip(matrices, x, y, new int[]{GLFW.GLFW_GAMEPAD_BUTTON_Y}, "midnightcontrols.action.quick_move", true, client);
|
||||||
|
if (scale != 1f) matrices.scale(1,1,1);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -28,7 +28,7 @@ public class KeyBindingMixin implements KeyBindingAccessor {
|
|||||||
if (!this.pressed)
|
if (!this.pressed)
|
||||||
this.pressed = true;
|
this.pressed = true;
|
||||||
++this.timesPressed;
|
++this.timesPressed;
|
||||||
return oldPressed != this.pressed;
|
return !oldPressed;
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
|||||||
@@ -0,0 +1,17 @@
|
|||||||
|
package eu.midnightdust.midnightcontrols.client.mixin;
|
||||||
|
|
||||||
|
import net.fabricmc.fabric.impl.client.keybinding.KeyBindingRegistryImpl;
|
||||||
|
import net.minecraft.client.option.KeyBinding;
|
||||||
|
import org.spongepowered.asm.mixin.Final;
|
||||||
|
import org.spongepowered.asm.mixin.Mixin;
|
||||||
|
import org.spongepowered.asm.mixin.gen.Accessor;
|
||||||
|
|
||||||
|
import java.util.List;
|
||||||
|
|
||||||
|
@Mixin(value = KeyBindingRegistryImpl.class, remap = false)
|
||||||
|
public interface KeyBindingRegistryImplAccessor {
|
||||||
|
@Accessor @Final
|
||||||
|
static List<KeyBinding> getModdedKeyBindings() {
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -54,10 +54,6 @@ public abstract class MinecraftClientMixin {
|
|||||||
@Nullable
|
@Nullable
|
||||||
public ClientPlayerInteractionManager interactionManager;
|
public ClientPlayerInteractionManager interactionManager;
|
||||||
|
|
||||||
@Shadow
|
|
||||||
@Nullable
|
|
||||||
public ClientWorld world;
|
|
||||||
|
|
||||||
@Shadow
|
@Shadow
|
||||||
@Final
|
@Final
|
||||||
public GameRenderer gameRenderer;
|
public GameRenderer gameRenderer;
|
||||||
@@ -104,18 +100,26 @@ public abstract class MinecraftClientMixin {
|
|||||||
this.midnightcontrols$lastTargetSide = side;
|
this.midnightcontrols$lastTargetSide = side;
|
||||||
}
|
}
|
||||||
// Removed front placing sprinting as way too cheaty.
|
// Removed front placing sprinting as way too cheaty.
|
||||||
/*else if (this.player.isSprinting()) {
|
else if (this.player.isSprinting()) {
|
||||||
hitResult = midnightcontrolsClient.get().reacharound.getLastReacharoundResult();
|
hitResult = MidnightControlsClient.get().reacharound.getLastReacharoundResult();
|
||||||
if (hitResult != null) {
|
if (hitResult != null) {
|
||||||
if (cooldown > 0)
|
if (cooldown > 0)
|
||||||
this.itemUseCooldown = 0;
|
this.itemUseCooldown = 0;
|
||||||
}
|
}
|
||||||
}*/
|
}
|
||||||
this.midnightcontrols$lastPos = this.player.getPos();
|
this.midnightcontrols$lastPos = this.player.getPos();
|
||||||
}
|
}
|
||||||
|
// Applied three times for smooth camera turning even on low FPS
|
||||||
|
@Inject(method = "run", at = @At(value = "INVOKE", target = "Lnet/minecraft/util/profiler/Recorder;startTick()V", shift = At.Shift.AFTER))
|
||||||
|
private void onPreRender(CallbackInfo ci) {
|
||||||
|
MidnightControlsClient.get().onRender((MinecraftClient) (Object) (this));
|
||||||
|
}
|
||||||
@Inject(method = "render", at = @At("HEAD"))
|
@Inject(method = "render", at = @At("HEAD"))
|
||||||
private void onRender(boolean fullRender, CallbackInfo ci) {
|
private void onRender(CallbackInfo ci) {
|
||||||
|
MidnightControlsClient.get().onRender((MinecraftClient) (Object) (this));
|
||||||
|
}
|
||||||
|
@Inject(method = "render", at = @At("TAIL"))
|
||||||
|
private void onPostRender(CallbackInfo ci) {
|
||||||
MidnightControlsClient.get().onRender((MinecraftClient) (Object) (this));
|
MidnightControlsClient.get().onRender((MinecraftClient) (Object) (this));
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -138,7 +142,7 @@ public abstract class MinecraftClientMixin {
|
|||||||
hitResult = mod.reacharound.withSideForReacharound(hitResult, stackInHand);
|
hitResult = mod.reacharound.withSideForReacharound(hitResult, stackInHand);
|
||||||
|
|
||||||
int previousStackCount = stackInHand.getCount();
|
int previousStackCount = stackInHand.getCount();
|
||||||
var result = this.interactionManager.interactBlock(this.player, this.world, hand, hitResult);
|
var result = this.interactionManager.interactBlock(this.player, hand, hitResult);
|
||||||
if (result.isAccepted()) {
|
if (result.isAccepted()) {
|
||||||
if (result.shouldSwingHand()) {
|
if (result.shouldSwingHand()) {
|
||||||
this.player.swingHand(hand);
|
this.player.swingHand(hand);
|
||||||
|
|||||||
@@ -15,7 +15,7 @@ import net.minecraft.client.font.TextRenderer;
|
|||||||
import net.minecraft.client.gui.screen.Screen;
|
import net.minecraft.client.gui.screen.Screen;
|
||||||
import net.minecraft.client.option.KeyBinding;
|
import net.minecraft.client.option.KeyBinding;
|
||||||
import net.minecraft.client.util.math.MatrixStack;
|
import net.minecraft.client.util.math.MatrixStack;
|
||||||
import net.minecraft.text.TranslatableText;
|
import net.minecraft.text.Text;
|
||||||
import org.jetbrains.annotations.NotNull;
|
import org.jetbrains.annotations.NotNull;
|
||||||
import org.jetbrains.annotations.Nullable;
|
import org.jetbrains.annotations.Nullable;
|
||||||
|
|
||||||
@@ -49,7 +49,7 @@ public class KeyBindingRingAction extends RingAction {
|
|||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void drawIcon(@NotNull MatrixStack matrices, @NotNull TextRenderer textRenderer, int x, int y, boolean hovered) {
|
public void drawIcon(@NotNull MatrixStack matrices, @NotNull TextRenderer textRenderer, int x, int y, boolean hovered) {
|
||||||
drawCenteredText(matrices, textRenderer, new TranslatableText(this.getName()), x + 25, y + 25 - textRenderer.fontHeight / 2, 0xffffff);
|
drawCenteredText(matrices, textRenderer, Text.translatable(this.getName()), x + 25, y + 25 - textRenderer.fontHeight / 2, 0xffffff);
|
||||||
}
|
}
|
||||||
|
|
||||||
protected static class Factory implements RingAction.Factory {
|
protected static class Factory implements RingAction.Factory {
|
||||||
|
|||||||
@@ -51,16 +51,16 @@ public final class MidnightRing {
|
|||||||
* Loads the ring from configuration.
|
* Loads the ring from configuration.
|
||||||
*/
|
*/
|
||||||
public void load() {
|
public void load() {
|
||||||
// List<Config> configPages = MidnightControlsConfig.ringPages;
|
List<Config> configPages = null;
|
||||||
// if (configPages != null) {
|
if (configPages != null) {
|
||||||
// this.pages.clear();
|
this.pages.clear();
|
||||||
// for (var configPage : configPages) {
|
for (var configPage : configPages) {
|
||||||
// RingPage.parseRingPage(configPage).ifPresent(this.pages::add);
|
RingPage.parseRingPage(configPage).ifPresent(this.pages::add);
|
||||||
// }
|
}
|
||||||
// }
|
}
|
||||||
// if (this.pages.isEmpty()) {
|
if (this.pages.isEmpty()) {
|
||||||
// this.pages.add(RingPage.DEFAULT);
|
this.pages.add(RingPage.DEFAULT);
|
||||||
// }
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public @NotNull RingPage getCurrentPage() {
|
public @NotNull RingPage getCurrentPage() {
|
||||||
|
|||||||
@@ -15,7 +15,6 @@ import net.minecraft.client.gui.DrawableHelper;
|
|||||||
import net.minecraft.client.gui.screen.Screen;
|
import net.minecraft.client.gui.screen.Screen;
|
||||||
import net.minecraft.client.util.math.MatrixStack;
|
import net.minecraft.client.util.math.MatrixStack;
|
||||||
import net.minecraft.text.Text;
|
import net.minecraft.text.Text;
|
||||||
import net.minecraft.text.TranslatableText;
|
|
||||||
import org.aperlambda.lambdacommon.utils.Nameable;
|
import org.aperlambda.lambdacommon.utils.Nameable;
|
||||||
import org.jetbrains.annotations.NotNull;
|
import org.jetbrains.annotations.NotNull;
|
||||||
import org.jetbrains.annotations.Nullable;
|
import org.jetbrains.annotations.Nullable;
|
||||||
@@ -43,7 +42,7 @@ public abstract class RingAction extends DrawableHelper implements Nameable {
|
|||||||
* @return the text name
|
* @return the text name
|
||||||
*/
|
*/
|
||||||
public Text getTextName() {
|
public Text getTextName() {
|
||||||
return new TranslatableText(this.getName());
|
return Text.translatable(this.getName());
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|||||||
@@ -10,7 +10,6 @@
|
|||||||
package eu.midnightdust.midnightcontrols.client.ring;
|
package eu.midnightdust.midnightcontrols.client.ring;
|
||||||
|
|
||||||
import net.minecraft.text.Text;
|
import net.minecraft.text.Text;
|
||||||
import net.minecraft.text.TranslatableText;
|
|
||||||
import org.aperlambda.lambdacommon.utils.Nameable;
|
import org.aperlambda.lambdacommon.utils.Nameable;
|
||||||
import org.jetbrains.annotations.NotNull;
|
import org.jetbrains.annotations.NotNull;
|
||||||
|
|
||||||
@@ -31,7 +30,7 @@ public enum RingButtonMode implements Nameable {
|
|||||||
|
|
||||||
RingButtonMode(@NotNull String name) {
|
RingButtonMode(@NotNull String name) {
|
||||||
this.name = name;
|
this.name = name;
|
||||||
this.text = new TranslatableText(this.getTranslationKey());
|
this.text = Text.translatable(this.getTranslationKey());
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|||||||
@@ -10,11 +10,15 @@
|
|||||||
package eu.midnightdust.midnightcontrols.client.ring;
|
package eu.midnightdust.midnightcontrols.client.ring;
|
||||||
|
|
||||||
import com.electronwill.nightconfig.core.Config;
|
import com.electronwill.nightconfig.core.Config;
|
||||||
|
import eu.midnightdust.midnightcontrols.client.MidnightControlsClient;
|
||||||
|
import net.minecraft.client.MinecraftClient;
|
||||||
import net.minecraft.client.font.TextRenderer;
|
import net.minecraft.client.font.TextRenderer;
|
||||||
import net.minecraft.client.gui.DrawableHelper;
|
import net.minecraft.client.gui.DrawableHelper;
|
||||||
|
import net.minecraft.client.gui.screen.ChatScreen;
|
||||||
import net.minecraft.client.util.math.MatrixStack;
|
import net.minecraft.client.util.math.MatrixStack;
|
||||||
import org.jetbrains.annotations.NotNull;
|
import org.jetbrains.annotations.NotNull;
|
||||||
|
|
||||||
|
import java.util.Arrays;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
import java.util.Optional;
|
import java.util.Optional;
|
||||||
|
|
||||||
@@ -36,6 +40,11 @@ public class RingPage extends DrawableHelper {
|
|||||||
for (int i = 0; i < 8; i++) {
|
for (int i = 0; i < 8; i++) {
|
||||||
this.actions[i] = null;
|
this.actions[i] = null;
|
||||||
}
|
}
|
||||||
|
this.actions[0] = new DummyRingAction(null);
|
||||||
|
this.actions[1] = new KeyBindingRingAction(null, MidnightControlsClient.BINDING_LOOK_UP);
|
||||||
|
this.actions[2] = new KeyBindingRingAction(null, MidnightControlsClient.BINDING_LOOK_LEFT);
|
||||||
|
this.actions[3] = new KeyBindingRingAction(null, MidnightControlsClient.BINDING_LOOK_RIGHT);
|
||||||
|
this.actions[4] = new KeyBindingRingAction(null, MidnightControlsClient.BINDING_LOOK_DOWN);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@@ -83,6 +92,52 @@ public class RingPage extends DrawableHelper {
|
|||||||
private static boolean isHovered(int x, int y, int mouseX, int mouseY) {
|
private static boolean isHovered(int x, int y, int mouseX, int mouseY) {
|
||||||
return mouseX >= x && mouseY >= y && mouseX <= x + MidnightRing.ELEMENT_SIZE && mouseY <= y + MidnightRing.ELEMENT_SIZE;
|
return mouseX >= x && mouseY >= y && mouseX <= x + MidnightRing.ELEMENT_SIZE && mouseY <= y + MidnightRing.ELEMENT_SIZE;
|
||||||
}
|
}
|
||||||
|
/**
|
||||||
|
* Renders the ring page.
|
||||||
|
*
|
||||||
|
* @param width the screen width
|
||||||
|
* @param height the screen height
|
||||||
|
* @param mouseX the mouse X-coordinate
|
||||||
|
* @param mouseY the mouse Y-coordinate
|
||||||
|
*/
|
||||||
|
public boolean onClick(int width, int height, int mouseX, int mouseY) {
|
||||||
|
int centerX = width / 2;
|
||||||
|
int centerY = height / 2;
|
||||||
|
|
||||||
|
int offset = MidnightRing.ELEMENT_SIZE + (MidnightRing.ELEMENT_SIZE / 2) + 5;
|
||||||
|
|
||||||
|
int y = centerY - offset;
|
||||||
|
int x = centerX - offset;
|
||||||
|
for (int i = 0; i < 3; i++) {
|
||||||
|
var ringAction = this.actions[i];
|
||||||
|
if (ringAction != null && isHovered(x,y,mouseX,mouseY)) {
|
||||||
|
ringAction.activate(RingButtonMode.PRESS);
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
x += 55;
|
||||||
|
}
|
||||||
|
y += 55;
|
||||||
|
x = centerX - offset;
|
||||||
|
for (int i = 3; i < 5; i++) {
|
||||||
|
var ringAction = this.actions[i];
|
||||||
|
if (ringAction != null && isHovered(x,y,mouseX,mouseY)) {
|
||||||
|
ringAction.activate(RingButtonMode.PRESS);
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
x += 55 * 2;
|
||||||
|
}
|
||||||
|
y += 55;
|
||||||
|
x = centerX - offset;
|
||||||
|
for (int i = 5; i < 8; i++) {
|
||||||
|
var ringAction = this.actions[i];
|
||||||
|
if (ringAction != null && isHovered(x,y,mouseX,mouseY)) {
|
||||||
|
ringAction.activate(RingButtonMode.PRESS);
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
x += 55;
|
||||||
|
}
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Tries to parse a ring page configuration.
|
* Tries to parse a ring page configuration.
|
||||||
|
|||||||
@@ -31,6 +31,10 @@
|
|||||||
"midnightcontrols.action.swap_hands": "Hände wechseln",
|
"midnightcontrols.action.swap_hands": "Hände wechseln",
|
||||||
"midnightcontrols.action.toggle_perspective": "Perspektive wechseln",
|
"midnightcontrols.action.toggle_perspective": "Perspektive wechseln",
|
||||||
"midnightcontrols.action.toggle_smooth_camera": "Cinematische Kamera",
|
"midnightcontrols.action.toggle_smooth_camera": "Cinematische Kamera",
|
||||||
|
"midnightcontrols.action.page_back": "Vorherige Seite",
|
||||||
|
"midnightcontrols.action.page_next": "Nächste Seite",
|
||||||
|
"midnightcontrols.action.take": "Item nehmen",
|
||||||
|
"midnightcontrols.action.take_all": "Stack nehmen",
|
||||||
"midnightcontrols.action.use": "Benutzen",
|
"midnightcontrols.action.use": "Benutzen",
|
||||||
"midnightcontrols.action.zoom": "Zoom",
|
"midnightcontrols.action.zoom": "Zoom",
|
||||||
"midnightcontrols.action.zoom_in": "Zoom erhöhen",
|
"midnightcontrols.action.zoom_in": "Zoom erhöhen",
|
||||||
@@ -72,6 +76,11 @@
|
|||||||
"midnightcontrols.controller.mappings.error.write": "Fehler beim Schreiben der Controller Mappings.",
|
"midnightcontrols.controller.mappings.error.write": "Fehler beim Schreiben der Controller Mappings.",
|
||||||
"midnightcontrols.controller.mappings.updated": "Mappings aktualisiert!",
|
"midnightcontrols.controller.mappings.updated": "Mappings aktualisiert!",
|
||||||
"midnightcontrols.controller_type.default": "Standard",
|
"midnightcontrols.controller_type.default": "Standard",
|
||||||
|
"midnightcontrols.controller_type.dualshock": "DualShock",
|
||||||
|
"midnightcontrols.controller_type.switch": "Switch",
|
||||||
|
"midnightcontrols.controller_type.xbox": "Xbox",
|
||||||
|
"midnightcontrols.controller_type.steam": "Steam",
|
||||||
|
"midnightcontrols.controller_type.ouya": "OUYA",
|
||||||
"midnightcontrols.controls_mode.default": "Tastatur/Maus",
|
"midnightcontrols.controls_mode.default": "Tastatur/Maus",
|
||||||
"midnightcontrols.controls_mode.controller": "Controller",
|
"midnightcontrols.controls_mode.controller": "Controller",
|
||||||
"midnightcontrols.controls_mode.touchscreen": "Touchscreen",
|
"midnightcontrols.controls_mode.touchscreen": "Touchscreen",
|
||||||
@@ -83,6 +92,7 @@
|
|||||||
"midnightcontrols.menu.controller2": "Zweiter Controller",
|
"midnightcontrols.menu.controller2": "Zweiter Controller",
|
||||||
"midnightcontrols.menu.controller_type": "Controller-Typ",
|
"midnightcontrols.menu.controller_type": "Controller-Typ",
|
||||||
"midnightcontrols.menu.controls_mode": "Modus",
|
"midnightcontrols.menu.controls_mode": "Modus",
|
||||||
|
"midnightcontrols.menu.double_tap_to_sprint": "Doppel-Tipp zum Sprinten",
|
||||||
"midnightcontrols.menu.fast_block_placing": "Schnelles Bauen",
|
"midnightcontrols.menu.fast_block_placing": "Schnelles Bauen",
|
||||||
"midnightcontrols.menu.fly_drifting": "Flug-Drifting",
|
"midnightcontrols.menu.fly_drifting": "Flug-Drifting",
|
||||||
"midnightcontrols.menu.fly_drifting_vertical": "Vertikales Flug-Drifting",
|
"midnightcontrols.menu.fly_drifting_vertical": "Vertikales Flug-Drifting",
|
||||||
@@ -102,7 +112,8 @@
|
|||||||
"midnightcontrols.menu.reacharound.vertical": "Vertikales Umgreifen",
|
"midnightcontrols.menu.reacharound.vertical": "Vertikales Umgreifen",
|
||||||
"midnightcontrols.menu.reload_controller_mappings": "Controller-Mappings neuladen",
|
"midnightcontrols.menu.reload_controller_mappings": "Controller-Mappings neuladen",
|
||||||
"midnightcontrols.menu.right_dead_zone": "Rechte tote Zone",
|
"midnightcontrols.menu.right_dead_zone": "Rechte tote Zone",
|
||||||
"midnightcontrols.menu.rotation_speed": "Rotationsgeschwindigkeit",
|
"midnightcontrols.menu.rotation_speed": "Rotationsgeschwindigkeit (X-Achse)",
|
||||||
|
"midnightcontrols.menu.y_axis_rotation_speed": "Rotationsgeschwindigkeit (Y-Achse)",
|
||||||
"midnightcontrols.menu.separator.controller": "Controller",
|
"midnightcontrols.menu.separator.controller": "Controller",
|
||||||
"midnightcontrols.menu.separator.general": "Generell",
|
"midnightcontrols.menu.separator.general": "Generell",
|
||||||
"midnightcontrols.menu.title": "MidnightControls - Einstellungen",
|
"midnightcontrols.menu.title": "MidnightControls - Einstellungen",
|
||||||
@@ -138,11 +149,18 @@
|
|||||||
"midnightcontrols.tooltip.reacharound.vertical": "Aktiviert vertikales Platzieren von Blöcken, §cwird von manchen Servern als cheaten eingestuft§r.",
|
"midnightcontrols.tooltip.reacharound.vertical": "Aktiviert vertikales Platzieren von Blöcken, §cwird von manchen Servern als cheaten eingestuft§r.",
|
||||||
"midnightcontrols.tooltip.reload_controller_mappings": "Lädt die Controller-Mappings neu.",
|
"midnightcontrols.tooltip.reload_controller_mappings": "Lädt die Controller-Mappings neu.",
|
||||||
"midnightcontrols.tooltip.right_dead_zone": "Die tote Zone für den rechten Analogstick.",
|
"midnightcontrols.tooltip.right_dead_zone": "Die tote Zone für den rechten Analogstick.",
|
||||||
"midnightcontrols.tooltip.rotation_speed": "Die Kamerarotationsgeschwindigkeit im Controllermodus.",
|
"midnightcontrols.tooltip.rotation_speed": "Die Kamerarotationsgeschwindigkeit im Controllermodus. (X-Achse)",
|
||||||
|
"midnightcontrols.tooltip.y_axis_rotation_speed": "Die Kamerarotationsgeschwindigkeit im Controllermodus. (Y-Achse)",
|
||||||
"midnightcontrols.tooltip.unfocused_input": "Erlaube Controllereingabe auch wenn das Fenster nicht fokussiert ist.",
|
"midnightcontrols.tooltip.unfocused_input": "Erlaube Controllereingabe auch wenn das Fenster nicht fokussiert ist.",
|
||||||
"midnightcontrols.tooltip.virtual_mouse": "Aktiviere die virtuelle Maus.",
|
"midnightcontrols.tooltip.virtual_mouse": "Aktiviere die virtuelle Maus.",
|
||||||
"midnightcontrols.virtual_mouse.skin.default_light": "Standard Light",
|
"midnightcontrols.virtual_mouse.skin.default_light": "Standard Hell",
|
||||||
"midnightcontrols.virtual_mouse.skin.default_dark": "Standard Dark",
|
"midnightcontrols.virtual_mouse.skin.default_dark": "Standard Dunkel",
|
||||||
"midnightcontrols.virtual_mouse.skin.second_light": "Alternativ Light",
|
"midnightcontrols.virtual_mouse.skin.second_light": "Alternativ Hell",
|
||||||
"midnightcontrols.virtual_mouse.skin.second_dark": "Alternativ Dark"
|
"midnightcontrols.virtual_mouse.skin.second_dark": "Alternativ Dunkel",
|
||||||
|
"midnightcontrols.button.a": "A",
|
||||||
|
"midnightcontrols.button.b": "B",
|
||||||
|
"midnightcontrols.button.x": "X",
|
||||||
|
"midnightcontrols.button.y": "Y",
|
||||||
|
"modmenu.descriptionTranslation.midnightcontrols": "Fügt Controller-Unterstützung hinzu und verbessert allgemein die Steuerung.\nBasiert auf der LambdaControls mod, deren Entwicklung leider eingestellt wurde.",
|
||||||
|
"modmenu.summaryTranslation.midnightcontrols": "Fügt Controller-Unterstützung hinzu und verbessert allgemein die Steuerung."
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -31,6 +31,10 @@
|
|||||||
"midnightcontrols.action.swap_hands": "Swap Hands",
|
"midnightcontrols.action.swap_hands": "Swap Hands",
|
||||||
"midnightcontrols.action.toggle_perspective": "Toggle Perspective",
|
"midnightcontrols.action.toggle_perspective": "Toggle Perspective",
|
||||||
"midnightcontrols.action.toggle_smooth_camera": "Toggle Cinematic Camera",
|
"midnightcontrols.action.toggle_smooth_camera": "Toggle Cinematic Camera",
|
||||||
|
"midnightcontrols.action.page_back": "Previous Page",
|
||||||
|
"midnightcontrols.action.page_next": "Next Page",
|
||||||
|
"midnightcontrols.action.take": "Take Item",
|
||||||
|
"midnightcontrols.action.take_all": "Take Stack",
|
||||||
"midnightcontrols.action.use": "Use",
|
"midnightcontrols.action.use": "Use",
|
||||||
"midnightcontrols.action.zoom": "Zoom",
|
"midnightcontrols.action.zoom": "Zoom",
|
||||||
"midnightcontrols.action.zoom_in": "Increase Zoom",
|
"midnightcontrols.action.zoom_in": "Increase Zoom",
|
||||||
@@ -92,6 +96,7 @@
|
|||||||
"midnightcontrols.menu.controller2": "Second Controller",
|
"midnightcontrols.menu.controller2": "Second Controller",
|
||||||
"midnightcontrols.menu.controller_type": "Controller Type",
|
"midnightcontrols.menu.controller_type": "Controller Type",
|
||||||
"midnightcontrols.menu.controls_mode": "Mode",
|
"midnightcontrols.menu.controls_mode": "Mode",
|
||||||
|
"midnightcontrols.menu.double_tap_to_sprint": "Double-Tap to Sprint",
|
||||||
"midnightcontrols.menu.fast_block_placing": "Fast Block Placing",
|
"midnightcontrols.menu.fast_block_placing": "Fast Block Placing",
|
||||||
"midnightcontrols.menu.fly_drifting": "Fly Drifting",
|
"midnightcontrols.menu.fly_drifting": "Fly Drifting",
|
||||||
"midnightcontrols.menu.fly_drifting_vertical": "Vertical Fly Drifting",
|
"midnightcontrols.menu.fly_drifting_vertical": "Vertical Fly Drifting",
|
||||||
@@ -111,7 +116,8 @@
|
|||||||
"midnightcontrols.menu.reacharound.vertical": "Vertical Reacharound",
|
"midnightcontrols.menu.reacharound.vertical": "Vertical Reacharound",
|
||||||
"midnightcontrols.menu.reload_controller_mappings": "Reload Controller Mappings",
|
"midnightcontrols.menu.reload_controller_mappings": "Reload Controller Mappings",
|
||||||
"midnightcontrols.menu.right_dead_zone": "Right Dead Zone",
|
"midnightcontrols.menu.right_dead_zone": "Right Dead Zone",
|
||||||
"midnightcontrols.menu.rotation_speed": "Rotation Speed",
|
"midnightcontrols.menu.rotation_speed": "X Axis Rotation Speed",
|
||||||
|
"midnightcontrols.menu.y_axis_rotation_speed": "Y Axis Rotation Speed",
|
||||||
"midnightcontrols.menu.separator.controller": "Controller",
|
"midnightcontrols.menu.separator.controller": "Controller",
|
||||||
"midnightcontrols.menu.separator.general": "General",
|
"midnightcontrols.menu.separator.general": "General",
|
||||||
"midnightcontrols.menu.title": "MidnightControls - Settings",
|
"midnightcontrols.menu.title": "MidnightControls - Settings",
|
||||||
@@ -147,7 +153,8 @@
|
|||||||
"midnightcontrols.tooltip.reacharound.vertical": "Enables vertical reacharound, §cmight be considered cheating on some servers§r.",
|
"midnightcontrols.tooltip.reacharound.vertical": "Enables vertical reacharound, §cmight be considered cheating on some servers§r.",
|
||||||
"midnightcontrols.tooltip.reload_controller_mappings": "Reloads the controller mappings file.",
|
"midnightcontrols.tooltip.reload_controller_mappings": "Reloads the controller mappings file.",
|
||||||
"midnightcontrols.tooltip.right_dead_zone": "The dead zone for the controller's right analogue stick.",
|
"midnightcontrols.tooltip.right_dead_zone": "The dead zone for the controller's right analogue stick.",
|
||||||
"midnightcontrols.tooltip.rotation_speed": "The camera rotation speed in controller mode.",
|
"midnightcontrols.tooltip.rotation_speed": "The camera X Axis rotation speed in controller mode.",
|
||||||
|
"midnightcontrols.tooltip.y_axis_rotation_speed": "The camera Y Axis rotation speed in controller mode.",
|
||||||
"midnightcontrols.tooltip.unfocused_input": "Allow controller input when the window is not focused.",
|
"midnightcontrols.tooltip.unfocused_input": "Allow controller input when the window is not focused.",
|
||||||
"midnightcontrols.tooltip.virtual_mouse": "Enable the virtual mouse which is handful in the case of a splitscreen.",
|
"midnightcontrols.tooltip.virtual_mouse": "Enable the virtual mouse which is handful in the case of a splitscreen.",
|
||||||
"midnightcontrols.virtual_mouse.skin.default_light": "Default Light",
|
"midnightcontrols.virtual_mouse.skin.default_light": "Default Light",
|
||||||
|
|||||||
@@ -104,7 +104,8 @@
|
|||||||
"midnightcontrols.menu.reacharound.vertical": "Alcance vertical",
|
"midnightcontrols.menu.reacharound.vertical": "Alcance vertical",
|
||||||
"midnightcontrols.menu.reload_controller_mappings": "Recargar asignaciones de controlador",
|
"midnightcontrols.menu.reload_controller_mappings": "Recargar asignaciones de controlador",
|
||||||
"midnightcontrols.menu.right_dead_zone": "Zona muerta derecha",
|
"midnightcontrols.menu.right_dead_zone": "Zona muerta derecha",
|
||||||
"midnightcontrols.menu.rotation_speed": "Velocidad de rotación",
|
"midnightcontrols.menu.rotation_speed": "Velocidad de rotación (eje X)",
|
||||||
|
"midnightcontrols.menu.y_axis_rotation_speed": "Velocidad de rotación (eje Y)",
|
||||||
"midnightcontrols.menu.separator.controller": "Controlador",
|
"midnightcontrols.menu.separator.controller": "Controlador",
|
||||||
"midnightcontrols.menu.separator.general": "General",
|
"midnightcontrols.menu.separator.general": "General",
|
||||||
"midnightcontrols.menu.title": "midnightcontrols - Configuraciones",
|
"midnightcontrols.menu.title": "midnightcontrols - Configuraciones",
|
||||||
@@ -140,7 +141,8 @@
|
|||||||
"midnightcontrols.tooltip.reacharound.vertical": "Habilita el alcance vertical, §cpodría considerarse trampa en algunos servidores§r.",
|
"midnightcontrols.tooltip.reacharound.vertical": "Habilita el alcance vertical, §cpodría considerarse trampa en algunos servidores§r.",
|
||||||
"midnightcontrols.tooltip.reload_controller_mappings": "Vuelve a cargar el archivo de asignaciones del controlador.",
|
"midnightcontrols.tooltip.reload_controller_mappings": "Vuelve a cargar el archivo de asignaciones del controlador.",
|
||||||
"midnightcontrols.tooltip.right_dead_zone": "La zona muerta de la palanca analógica derecha del controlador.",
|
"midnightcontrols.tooltip.right_dead_zone": "La zona muerta de la palanca analógica derecha del controlador.",
|
||||||
"midnightcontrols.tooltip.rotation_speed": "La velocidad de rotación de la cámara en modo controlador.",
|
"midnightcontrols.tooltip.rotation_speed": "La velocidad de rotación de la cámara en modo controlador. (eje X)",
|
||||||
|
"midnightcontrols.tooltip.y_axis_rotation_speed": "La velocidad de rotación de la cámara en modo controlador. (eje Y)",
|
||||||
"midnightcontrols.tooltip.unfocused_input": "Habilita entrada del controlador cuando la ventana no está enfocada.",
|
"midnightcontrols.tooltip.unfocused_input": "Habilita entrada del controlador cuando la ventana no está enfocada.",
|
||||||
"midnightcontrols.tooltip.virtual_mouse": "Habilite el ratón virtual que es útil en el caso de una pantalla dividida.",
|
"midnightcontrols.tooltip.virtual_mouse": "Habilite el ratón virtual que es útil en el caso de una pantalla dividida.",
|
||||||
"midnightcontrols.virtual_mouse.skin.default_light": "Ligera por defecto",
|
"midnightcontrols.virtual_mouse.skin.default_light": "Ligera por defecto",
|
||||||
|
|||||||
@@ -104,7 +104,8 @@
|
|||||||
"midnightcontrols.menu.reacharound.vertical": "Placement vertical",
|
"midnightcontrols.menu.reacharound.vertical": "Placement vertical",
|
||||||
"midnightcontrols.menu.reload_controller_mappings": "Recharger les manettes",
|
"midnightcontrols.menu.reload_controller_mappings": "Recharger les manettes",
|
||||||
"midnightcontrols.menu.right_dead_zone": "Zone morte axe droit",
|
"midnightcontrols.menu.right_dead_zone": "Zone morte axe droit",
|
||||||
"midnightcontrols.menu.rotation_speed": "Vitesse de rotation",
|
"midnightcontrols.menu.rotation_speed": "Vitesse de rotation (X)",
|
||||||
|
"midnightcontrols.menu.y_axis_rotation_speed": "Vitesse de rotation (Y)",
|
||||||
"midnightcontrols.menu.separator.general": "Général",
|
"midnightcontrols.menu.separator.general": "Général",
|
||||||
"midnightcontrols.menu.separator.controller": "Manette",
|
"midnightcontrols.menu.separator.controller": "Manette",
|
||||||
"midnightcontrols.menu.title": "midnightcontrols - Paramètres",
|
"midnightcontrols.menu.title": "midnightcontrols - Paramètres",
|
||||||
@@ -140,7 +141,8 @@
|
|||||||
"midnightcontrols.tooltip.reacharound.vertical": "Active le placement vertical de blocs, c'est-à-dire de blocs en dessous du bloc sur lequel vous êtes placé, §cpeut être considérer comme de la triche sur certains serveurs§r.",
|
"midnightcontrols.tooltip.reacharound.vertical": "Active le placement vertical de blocs, c'est-à-dire de blocs en dessous du bloc sur lequel vous êtes placé, §cpeut être considérer comme de la triche sur certains serveurs§r.",
|
||||||
"midnightcontrols.tooltip.reload_controller_mappings": "Recharge le fichier de configuration des manettes.",
|
"midnightcontrols.tooltip.reload_controller_mappings": "Recharge le fichier de configuration des manettes.",
|
||||||
"midnightcontrols.tooltip.right_dead_zone": "Zone morte de l'axe droit de la manette.",
|
"midnightcontrols.tooltip.right_dead_zone": "Zone morte de l'axe droit de la manette.",
|
||||||
"midnightcontrols.tooltip.rotation_speed": "Change la vitesse de rotation de la caméra.",
|
"midnightcontrols.tooltip.rotation_speed": "Change la vitesse de rotation de la caméra. (X)",
|
||||||
|
"midnightcontrols.tooltip.y_axis_rotation_speed": "Change la vitesse de rotation de la caméra. (Y)",
|
||||||
"midnightcontrols.tooltip.unfocused_input": "Autorise les entrées manette quand la fenêtre n'est pas sélectionnée.",
|
"midnightcontrols.tooltip.unfocused_input": "Autorise les entrées manette quand la fenêtre n'est pas sélectionnée.",
|
||||||
"midnightcontrols.tooltip.virtual_mouse": "Active la souris virtuelle qui est pratique dans le cas d'un écran partagé.",
|
"midnightcontrols.tooltip.virtual_mouse": "Active la souris virtuelle qui est pratique dans le cas d'un écran partagé.",
|
||||||
"midnightcontrols.virtual_mouse.skin.default_light": "défaut clair",
|
"midnightcontrols.virtual_mouse.skin.default_light": "défaut clair",
|
||||||
|
|||||||
@@ -104,7 +104,8 @@
|
|||||||
"midnightcontrols.menu.reacharound.vertical": "Placement vertical",
|
"midnightcontrols.menu.reacharound.vertical": "Placement vertical",
|
||||||
"midnightcontrols.menu.reload_controller_mappings": "Recharger les manettes",
|
"midnightcontrols.menu.reload_controller_mappings": "Recharger les manettes",
|
||||||
"midnightcontrols.menu.right_dead_zone": "Zone morte axe droit",
|
"midnightcontrols.menu.right_dead_zone": "Zone morte axe droit",
|
||||||
"midnightcontrols.menu.rotation_speed": "Vitesse de rotation",
|
"midnightcontrols.menu.rotation_speed": "Vitesse de rotation (X)",
|
||||||
|
"midnightcontrols.menu.y_axis_rotation_speed": "Vitesse de rotation (Y)",
|
||||||
"midnightcontrols.menu.separator.general": "Général",
|
"midnightcontrols.menu.separator.general": "Général",
|
||||||
"midnightcontrols.menu.separator.controller": "Manette",
|
"midnightcontrols.menu.separator.controller": "Manette",
|
||||||
"midnightcontrols.menu.title": "midnightcontrols - Paramètres",
|
"midnightcontrols.menu.title": "midnightcontrols - Paramètres",
|
||||||
@@ -140,7 +141,8 @@
|
|||||||
"midnightcontrols.tooltip.reacharound.vertical": "Active le placement vertical de blocs, c'est-à-dire de blocs en dessous du bloc sur lequel vous êtes placé, §cpeut être considérer comme de la triche sur certains serveurs§r.",
|
"midnightcontrols.tooltip.reacharound.vertical": "Active le placement vertical de blocs, c'est-à-dire de blocs en dessous du bloc sur lequel vous êtes placé, §cpeut être considérer comme de la triche sur certains serveurs§r.",
|
||||||
"midnightcontrols.tooltip.reload_controller_mappings": "Recharge le fichier de configuration des manettes.",
|
"midnightcontrols.tooltip.reload_controller_mappings": "Recharge le fichier de configuration des manettes.",
|
||||||
"midnightcontrols.tooltip.right_dead_zone": "Zone morte de l'axe droit de la manette.",
|
"midnightcontrols.tooltip.right_dead_zone": "Zone morte de l'axe droit de la manette.",
|
||||||
"midnightcontrols.tooltip.rotation_speed": "Change la vitesse de rotation de la caméra.",
|
"midnightcontrols.tooltip.rotation_speed": "Change la vitesse de rotation de la caméra. (X)",
|
||||||
|
"midnightcontrols.tooltip.y_axis_rotation_speed": "Change la vitesse de rotation de la caméra. (Y)",
|
||||||
"midnightcontrols.tooltip.unfocused_input": "Autorise les entrées manette quand la fenêtre n'est pas sélectionnée.",
|
"midnightcontrols.tooltip.unfocused_input": "Autorise les entrées manette quand la fenêtre n'est pas sélectionnée.",
|
||||||
"midnightcontrols.tooltip.virtual_mouse": "Active la souris virtuelle qui est pratique dans le cas d'un écran partagé.",
|
"midnightcontrols.tooltip.virtual_mouse": "Active la souris virtuelle qui est pratique dans le cas d'un écran partagé.",
|
||||||
"midnightcontrols.virtual_mouse.skin.default_light": "défaut clair",
|
"midnightcontrols.virtual_mouse.skin.default_light": "défaut clair",
|
||||||
|
|||||||
158
src/main/resources/assets/midnightcontrols/lang/ko_kr.json
Normal file
@@ -0,0 +1,158 @@
|
|||||||
|
{
|
||||||
|
"midnightcontrols.midnightconfig.title": "MidnightControls 고급 설정",
|
||||||
|
"key.midnightcontrols.look_down": "아래쪽 보기",
|
||||||
|
"key.midnightcontrols.look_left": "왼쪽 보기",
|
||||||
|
"key.midnightcontrols.look_right": "오른쪽 보기",
|
||||||
|
"key.midnightcontrols.look_up": "위쪽 보기",
|
||||||
|
"key.midnightcontrols.ring": "컨트롤 링 표시",
|
||||||
|
"midnightcontrols.action.attack": "공격",
|
||||||
|
"midnightcontrols.action.back": "뒤로",
|
||||||
|
"midnightcontrols.action.chat": "채팅 열기",
|
||||||
|
"midnightcontrols.action.drop_item": "아이템 버리기",
|
||||||
|
"midnightcontrols.action.exit": "종료",
|
||||||
|
"midnightcontrols.action.forward": "앞으로",
|
||||||
|
"midnightcontrols.action.hit": "때리기",
|
||||||
|
"midnightcontrols.action.hotbar_left": "단축 바 왼쪽",
|
||||||
|
"midnightcontrols.action.hotbar_right": "단축 바 오른쪽",
|
||||||
|
"midnightcontrols.action.inventory": "보관함",
|
||||||
|
"midnightcontrols.action.jump": "점프",
|
||||||
|
"midnightcontrols.action.left": "왼쪽",
|
||||||
|
"midnightcontrols.action.pause_game": "게임 일시 중지",
|
||||||
|
"midnightcontrols.action.pick_block": "블록 집기",
|
||||||
|
"midnightcontrols.action.pickup": "집기",
|
||||||
|
"midnightcontrols.action.pickup_all": "모두 집기",
|
||||||
|
"midnightcontrols.action.place": "놓기",
|
||||||
|
"midnightcontrols.action.player_list": "플레이어 목록",
|
||||||
|
"midnightcontrols.action.quick_move": "빠른 이동",
|
||||||
|
"midnightcontrols.action.right": "오른쪽",
|
||||||
|
"midnightcontrols.action.screenshot": "스크린샷 찍기",
|
||||||
|
"midnightcontrols.action.sneak": "은신",
|
||||||
|
"midnightcontrols.action.sprint": "달리기",
|
||||||
|
"midnightcontrols.action.swap_hands": "손 전환",
|
||||||
|
"midnightcontrols.action.toggle_perspective": "시점 토글",
|
||||||
|
"midnightcontrols.action.toggle_smooth_camera": "시네마틱 카메라 토글",
|
||||||
|
"midnightcontrols.action.use": "사용",
|
||||||
|
"midnightcontrols.action.zoom": "확대/축소",
|
||||||
|
"midnightcontrols.action.zoom_in": "확대",
|
||||||
|
"midnightcontrols.action.zoom_out": "축소",
|
||||||
|
"midnightcontrols.action.zoom_reset": "확대/축소 초기화",
|
||||||
|
"midnightcontrols.action.key.emotecraft.fastchoose": "이모트 빠른 선택",
|
||||||
|
"midnightcontrols.action.key.emotecraft.stop": "이모트 중지",
|
||||||
|
"midnightcontrols.button.a": "A",
|
||||||
|
"midnightcontrols.button.b": "B",
|
||||||
|
"midnightcontrols.button.x": "X",
|
||||||
|
"midnightcontrols.button.y": "Y",
|
||||||
|
"midnightcontrols.button.left_bumper": "왼쪽 범퍼",
|
||||||
|
"midnightcontrols.button.right_bumper": "오른쪽 범퍼",
|
||||||
|
"midnightcontrols.button.back": "뒤로",
|
||||||
|
"midnightcontrols.button.start": "시작",
|
||||||
|
"midnightcontrols.button.guide": "가이드",
|
||||||
|
"midnightcontrols.button.left_thumb": "왼쪽 엄지",
|
||||||
|
"midnightcontrols.button.right_thumb": "오른쪽 엄지",
|
||||||
|
"midnightcontrols.button.dpad_up": "DPAD 위",
|
||||||
|
"midnightcontrols.button.dpad_right": "DPAD 오른쪽",
|
||||||
|
"midnightcontrols.button.dpad_down": "DPAD 아래",
|
||||||
|
"midnightcontrols.button.dpad_left": "DPAD 왼쪽",
|
||||||
|
"midnightcontrols.button.l4": "L4",
|
||||||
|
"midnightcontrols.button.l5": "L5",
|
||||||
|
"midnightcontrols.button.r4": "R4",
|
||||||
|
"midnightcontrols.button.r5": "L5",
|
||||||
|
"midnightcontrols.axis.left_x+": "왼쪽 X+",
|
||||||
|
"midnightcontrols.axis.left_y+": "왼쪽 Y+",
|
||||||
|
"midnightcontrols.axis.right_x+": "오른쪽 X+",
|
||||||
|
"midnightcontrols.axis.right_y+": "오른쪽 Y+",
|
||||||
|
"midnightcontrols.axis.left_trigger": "왼쪽 트리거",
|
||||||
|
"midnightcontrols.axis.right_trigger": "오른쪽 트리거",
|
||||||
|
"midnightcontrols.axis.left_x-": "왼쪽 X-",
|
||||||
|
"midnightcontrols.axis.left_y-": "왼쪽 Y-",
|
||||||
|
"midnightcontrols.axis.right_x-": "오른쪽 X-",
|
||||||
|
"midnightcontrols.axis.right_y-": "오른쪽 Y-",
|
||||||
|
"midnightcontrols.button.unknown": "알 수 없음 (%d)",
|
||||||
|
"midnightcontrols.controller.connected": "컨트롤러 %d 연결됨.",
|
||||||
|
"midnightcontrols.controller.disconnected": "컨트롤러 %d 연결 끊김.",
|
||||||
|
"midnightcontrols.controller.mappings.1": "컨트롤러 매핑을 설정하려면, %s을 사용하세요",
|
||||||
|
"midnightcontrols.controller.mappings.3": "그리고 매핑 파일 편집기에 매핑을 붙여 넣으세요.",
|
||||||
|
"midnightcontrols.controller.mappings.error": "매핑을 불러오던 중 오류.",
|
||||||
|
"midnightcontrols.controller.mappings.error.write": "파일에 매핑 작성 중 오류.",
|
||||||
|
"midnightcontrols.controller.mappings.updated": "매핑 업데이트됨!",
|
||||||
|
"midnightcontrols.controller_type.default": "기본",
|
||||||
|
"midnightcontrols.controller_type.dualshock": "듀얼쇼크",
|
||||||
|
"midnightcontrols.controller_type.switch": "스위치",
|
||||||
|
"midnightcontrols.controller_type.xbox": "엑스박스",
|
||||||
|
"midnightcontrols.controller_type.steam": "스팀",
|
||||||
|
"midnightcontrols.controller_type.ouya": "우야",
|
||||||
|
"midnightcontrols.controls_mode.default": "키보드/마우스",
|
||||||
|
"midnightcontrols.controls_mode.controller": "컨트롤러",
|
||||||
|
"midnightcontrols.controls_mode.touchscreen": "터치스크린",
|
||||||
|
"midnightcontrols.hud_side.left": "왼쪽",
|
||||||
|
"midnightcontrols.hud_side.right": "오른쪽",
|
||||||
|
"midnightcontrols.menu.analog_movement": "아날로그 움직임",
|
||||||
|
"midnightcontrols.menu.auto_switch_mode": "자동 전환 모드",
|
||||||
|
"midnightcontrols.menu.controller": "컨트롤러",
|
||||||
|
"midnightcontrols.menu.controller2": "보조 컨트롤러",
|
||||||
|
"midnightcontrols.menu.controller_type": "컨트롤러 종류",
|
||||||
|
"midnightcontrols.menu.controls_mode": "모드",
|
||||||
|
"midnightcontrols.menu.fast_block_placing": "빠른 블록 배치",
|
||||||
|
"midnightcontrols.menu.fly_drifting": "비행 관성",
|
||||||
|
"midnightcontrols.menu.fly_drifting_vertical": "비행 수직 관성",
|
||||||
|
"midnightcontrols.menu.hud_enable": "HUD 사용",
|
||||||
|
"midnightcontrols.menu.hud_side": "HUD 측면",
|
||||||
|
"midnightcontrols.menu.invert_right_x_axis": "오른쪽 X 반전",
|
||||||
|
"midnightcontrols.menu.invert_right_y_axis": "오른쪽 Y 반전",
|
||||||
|
"midnightcontrols.menu.keyboard_controls": "키보드 컨트롤...",
|
||||||
|
"midnightcontrols.menu.left_dead_zone": "왼쪽 데드 존",
|
||||||
|
"midnightcontrols.menu.mappings.open_input_str": "매핑 파일 편집기 열기",
|
||||||
|
"midnightcontrols.menu.max_left_x_value": "왼쪽 X 축 최댓값",
|
||||||
|
"midnightcontrols.menu.max_left_y_value": "왼쪽 Y 축 최댓값",
|
||||||
|
"midnightcontrols.menu.max_right_x_value": "오른쪽 X 축 최댓값",
|
||||||
|
"midnightcontrols.menu.max_right_y_value": "오른쪽 Y 축 최댓값",
|
||||||
|
"midnightcontrols.menu.mouse_speed": "마우스 속도",
|
||||||
|
"midnightcontrols.menu.reacharound.horizontal": "블록 전면 배치",
|
||||||
|
"midnightcontrols.menu.reacharound.vertical": "블록 수직 배치",
|
||||||
|
"midnightcontrols.menu.reload_controller_mappings": "컨트롤러 매핑 다시 불러오기",
|
||||||
|
"midnightcontrols.menu.right_dead_zone": "오른쪽 데드 존",
|
||||||
|
"midnightcontrols.menu.rotation_speed": "회전 속도",
|
||||||
|
"midnightcontrols.menu.separator.controller": "컨트롤러",
|
||||||
|
"midnightcontrols.menu.separator.general": "일반",
|
||||||
|
"midnightcontrols.menu.title": "MidnightControls - 설정",
|
||||||
|
"midnightcontrols.menu.title.controller": "컨트롤러 옵션",
|
||||||
|
"midnightcontrols.menu.title.controller_controls": "컨트롤러 제어",
|
||||||
|
"midnightcontrols.menu.title.gameplay": "게임플레이 옵션",
|
||||||
|
"midnightcontrols.menu.title.general": "일반 옵션",
|
||||||
|
"midnightcontrols.menu.title.hud": "HUD 옵션",
|
||||||
|
"midnightcontrols.menu.title.mappings.string": "매핑 파일 편집기",
|
||||||
|
"midnightcontrols.menu.title.visual": "외형 옵션",
|
||||||
|
"midnightcontrols.menu.unfocused_input": "언포커스 인풋",
|
||||||
|
"midnightcontrols.menu.virtual_mouse": "가상 마우스",
|
||||||
|
"midnightcontrols.menu.virtual_mouse.skin": "가상 마우스 스킨",
|
||||||
|
"midnightcontrols.narrator.unbound": "%s 해제됨",
|
||||||
|
"midnightcontrols.not_bound": "바인딩되지 않음",
|
||||||
|
"midnightcontrols.tooltip.analog_movement": "가능한 경우 아날로그 움직임을 사용합니다.",
|
||||||
|
"midnightcontrols.tooltip.auto_switch_mode": "컨트롤러가 연결되면 자동으로 컨트롤 모드가 컨트롤러로 전환됩니다.",
|
||||||
|
"midnightcontrols.tooltip.controller2": "보조 컨트롤러를 사용하려면 Joy-Cons 지원을 허용하세요.",
|
||||||
|
"midnightcontrols.tooltip.controller_type": "올바른 버튼을 표시할 컨트롤러 종류입니다.",
|
||||||
|
"midnightcontrols.tooltip.controls_mode": "컨트롤 모드.",
|
||||||
|
"midnightcontrols.tooltip.fast_block_placing": "크리에이티브 모드에서 비행하는 동안 사용자 속도에 따른 빠른 블록 배치를 사용합니다. §c일부 서버에선 치팅 행위로 취급될 수 있습니다.",
|
||||||
|
"midnightcontrols.tooltip.fly_drifting": "비행하는 동안 바닐라처럼 관성을 적용합니다.",
|
||||||
|
"midnightcontrols.tooltip.fly_drifting_vertical": "비행하는 동안 바닐라처럼 수직 관성을 적용합니다.",
|
||||||
|
"midnightcontrols.tooltip.hud_enable": "화면 컨트롤러 버튼 표시기 토글",
|
||||||
|
"midnightcontrols.tooltip.hud_side": "HUD 위치.",
|
||||||
|
"midnightcontrols.tooltip.left_dead_zone": "컨트롤러 왼쪽 아날로그 스틱 데드 존.",
|
||||||
|
"midnightcontrols.tooltip.max_left_x_value": "모드가 인식하는 왼쪽 X 축 최댓값을 변경합니다. 사용자의 축이 전체 범위를 사용하지 않고 느리게 보일 경우 유용합니다.",
|
||||||
|
"midnightcontrols.tooltip.max_left_y_value": "모드가 인식하는 왼쪽 Y 축 최댓값을 변경합니다. 사용자의 축이 전체 범위를 사용하지 않고 느리게 보일 경우 유용합니다.",
|
||||||
|
"midnightcontrols.tooltip.max_right_x_value": "모드가 인식하는 오른쪽 X 축 최댓값을 변경합니다. 사용자의 축이 전체 범위를 사용하지 않고 느리게 보일 경우 유용합니다.",
|
||||||
|
"midnightcontrols.tooltip.max_right_y_value": "모드가 인식하는 오른쪽 Y 축 최댓값을 변경합니다. 사용자의 축이 전체 범위를 사용하지 않고 느리게 보일 경우 유용합니다.",
|
||||||
|
"midnightcontrols.tooltip.mouse_speed": "컨트롤러의 에뮬레이트된 마우스 속도.",
|
||||||
|
"midnightcontrols.tooltip.reacharound.horizontal": "블록 전면 배치를 사용합니다. §c일부 서버에선 치팅 행위로 취급될 수 있습니다§r.",
|
||||||
|
"midnightcontrols.tooltip.reacharound.vertical": "블록 수직 배치를 사용합니다. 블록 아래에 다른 블록을 배치할 수 있습니다. §c일부 서버에선 치팅 행위로 취급될 수 있습니다§r.",
|
||||||
|
"midnightcontrols.tooltip.reload_controller_mappings": "컨트롤러 매핑 파일을 다시 불러옵니다.",
|
||||||
|
"midnightcontrols.tooltip.right_dead_zone": "컨트롤러 오른쪽 아날로그 스틱 데드 존",
|
||||||
|
"midnightcontrols.tooltip.rotation_speed": "컨트롤러 모드에서 적용되는 카메라 회전 속도.",
|
||||||
|
"midnightcontrols.tooltip.unfocused_input": "창이 활성화된 상태가 아니여도 컨트롤러 입력 허용.",
|
||||||
|
"midnightcontrols.tooltip.virtual_mouse": "분할 화면에선 도움 되는 가상 마우스를 사용합니다.",
|
||||||
|
"midnightcontrols.virtual_mouse.skin.default_light": "기본 라이트",
|
||||||
|
"midnightcontrols.virtual_mouse.skin.default_dark": "기본 다크",
|
||||||
|
"midnightcontrols.virtual_mouse.skin.second_light": "두 번째 라이트",
|
||||||
|
"midnightcontrols.virtual_mouse.skin.second_dark": "두 번째 다크",
|
||||||
|
"modmenu.descriptionTranslation.midnightcontrols": "컨트롤러 제어 및 전반적인 향상된 제어 기능을 추가합니다.\n안타깝게도 업데이트가 끊긴 LambdaControls의 Fork 버전입니다."
|
||||||
|
}
|
||||||
@@ -98,7 +98,8 @@
|
|||||||
"midnightcontrols.menu.reacharound.horizontal": "Alt Öne Blok Koyma",
|
"midnightcontrols.menu.reacharound.horizontal": "Alt Öne Blok Koyma",
|
||||||
"midnightcontrols.menu.reacharound.vertical": "En Alta Blok Koyma",
|
"midnightcontrols.menu.reacharound.vertical": "En Alta Blok Koyma",
|
||||||
"midnightcontrols.menu.reload_controller_mappings": "Oyun Kolu Eşleştirmelerini Yenile",
|
"midnightcontrols.menu.reload_controller_mappings": "Oyun Kolu Eşleştirmelerini Yenile",
|
||||||
"midnightcontrols.menu.rotation_speed": "Dönme Hızı",
|
"midnightcontrols.menu.rotation_speed": "Dönme Hızı (X)",
|
||||||
|
"midnightcontrols.menu.y_axis_rotation_speed": "Dönme Hızı (Y)",
|
||||||
"midnightcontrols.menu.title": "midnightcontrols - Ayarlar",
|
"midnightcontrols.menu.title": "midnightcontrols - Ayarlar",
|
||||||
"midnightcontrols.menu.title.controller": "Oyun Kolu Seçenekleri",
|
"midnightcontrols.menu.title.controller": "Oyun Kolu Seçenekleri",
|
||||||
"midnightcontrols.menu.title.controller_controls": "Oyun Kolu Kontrolleri",
|
"midnightcontrols.menu.title.controller_controls": "Oyun Kolu Kontrolleri",
|
||||||
@@ -124,7 +125,8 @@
|
|||||||
"midnightcontrols.tooltip.reacharound.horizontal": "Hızlı blok koymayı etkinleştirir. §cBazı sunucular bunun hile olduğunu düşünebilir.§r.",
|
"midnightcontrols.tooltip.reacharound.horizontal": "Hızlı blok koymayı etkinleştirir. §cBazı sunucular bunun hile olduğunu düşünebilir.§r.",
|
||||||
"midnightcontrols.tooltip.reacharound.vertical": "En alta blok koymayı etkinleştirir. §cBazı sunucular bunun hile olduğunu düşünebilir.§r.",
|
"midnightcontrols.tooltip.reacharound.vertical": "En alta blok koymayı etkinleştirir. §cBazı sunucular bunun hile olduğunu düşünebilir.§r.",
|
||||||
"midnightcontrols.tooltip.reload_controller_mappings": "Oyun kolu için eşleştirme dosyasını yeniler.",
|
"midnightcontrols.tooltip.reload_controller_mappings": "Oyun kolu için eşleştirme dosyasını yeniler.",
|
||||||
"midnightcontrols.tooltip.rotation_speed": "Oyun kolu modunda olan kamera dönme hızı",
|
"midnightcontrols.tooltip.rotation_speed": "Oyun kolu modunda olan kamera dönme hızı (X)",
|
||||||
|
"midnightcontrols.tooltip.y_axis_rotation_speed": "Oyun kolu modunda olan kamera dönme hızı (Y)",
|
||||||
"midnightcontrols.tooltip.unfocused_input": "Oyun penceresinde değilken oyun kolu girişine izine verir.",
|
"midnightcontrols.tooltip.unfocused_input": "Oyun penceresinde değilken oyun kolu girişine izine verir.",
|
||||||
"midnightcontrols.tooltip.virtual_mouse": "Sanal fareyi etkinleştirir. Çift ekran oynanılacağı zaman işe yarar.",
|
"midnightcontrols.tooltip.virtual_mouse": "Sanal fareyi etkinleştirir. Çift ekran oynanılacağı zaman işe yarar.",
|
||||||
"midnightcontrols.virtual_mouse.skin.default_light": "Varsayılan Aydınlık Tema",
|
"midnightcontrols.virtual_mouse.skin.default_light": "Varsayılan Aydınlık Tema",
|
||||||
|
|||||||
@@ -104,7 +104,8 @@
|
|||||||
"midnightcontrols.menu.reacharound.vertical": "垂直方向方块放置辅助",
|
"midnightcontrols.menu.reacharound.vertical": "垂直方向方块放置辅助",
|
||||||
"midnightcontrols.menu.reload_controller_mappings": "重新加载手柄按键映射",
|
"midnightcontrols.menu.reload_controller_mappings": "重新加载手柄按键映射",
|
||||||
"midnightcontrols.menu.right_dead_zone": "右摇杆死区",
|
"midnightcontrols.menu.right_dead_zone": "右摇杆死区",
|
||||||
"midnightcontrols.menu.rotation_speed": "镜头旋转速度",
|
"midnightcontrols.menu.rotation_speed": "镜头旋转速度 (X)",
|
||||||
|
"midnightcontrols.menu.y_axis_rotation_speed": "镜头旋转速度 (Y)",
|
||||||
"midnightcontrols.menu.separator.controller": "手柄",
|
"midnightcontrols.menu.separator.controller": "手柄",
|
||||||
"midnightcontrols.menu.separator.general": "通用",
|
"midnightcontrols.menu.separator.general": "通用",
|
||||||
"midnightcontrols.menu.title": "midnightcontrols — 设置",
|
"midnightcontrols.menu.title": "midnightcontrols — 设置",
|
||||||
@@ -140,7 +141,8 @@
|
|||||||
"midnightcontrols.tooltip.reacharound.vertical": "启用垂直方向方块放置辅助,可在脚下方块的下方放置方块。\n§c在部分服务器可能会被认定为作弊。",
|
"midnightcontrols.tooltip.reacharound.vertical": "启用垂直方向方块放置辅助,可在脚下方块的下方放置方块。\n§c在部分服务器可能会被认定为作弊。",
|
||||||
"midnightcontrols.tooltip.reload_controller_mappings": "重新加载手柄的按键映射文件。",
|
"midnightcontrols.tooltip.reload_controller_mappings": "重新加载手柄的按键映射文件。",
|
||||||
"midnightcontrols.tooltip.right_dead_zone": "右摇杆配置的死区。\n死区决定摇杆要偏离中心位置多远才能让摇杆的输入有效。",
|
"midnightcontrols.tooltip.right_dead_zone": "右摇杆配置的死区。\n死区决定摇杆要偏离中心位置多远才能让摇杆的输入有效。",
|
||||||
"midnightcontrols.tooltip.rotation_speed": "手柄操作模式下的镜头旋转速度。",
|
"midnightcontrols.tooltip.rotation_speed": "手柄操作模式下的镜头旋转速度。(X)",
|
||||||
|
"midnightcontrols.tooltip.y_axis_rotation_speed": "手柄操作模式下的镜头旋转速度。(Y)",
|
||||||
"midnightcontrols.tooltip.unfocused_input": "即使游戏窗口处于非活动状态,也允许手柄进行按键输入。",
|
"midnightcontrols.tooltip.unfocused_input": "即使游戏窗口处于非活动状态,也允许手柄进行按键输入。",
|
||||||
"midnightcontrols.tooltip.virtual_mouse": "启用虚拟鼠标,在分屏的情况下很有用。",
|
"midnightcontrols.tooltip.virtual_mouse": "启用虚拟鼠标,在分屏的情况下很有用。",
|
||||||
"midnightcontrols.virtual_mouse.skin.default_light": "默认样式(白色)",
|
"midnightcontrols.virtual_mouse.skin.default_light": "默认样式(白色)",
|
||||||
|
|||||||
|
Before Width: | Height: | Size: 13 KiB After Width: | Height: | Size: 14 KiB |
|
Before Width: | Height: | Size: 25 KiB After Width: | Height: | Size: 25 KiB |
@@ -10,10 +10,11 @@
|
|||||||
],
|
],
|
||||||
"contributors": [
|
"contributors": [
|
||||||
"akemin-dayo",
|
"akemin-dayo",
|
||||||
|
"DioEgizio",
|
||||||
|
"Ivanoks",
|
||||||
"FlashyReese",
|
"FlashyReese",
|
||||||
"Hambaka",
|
"Hambaka",
|
||||||
"joaoh1",
|
"joaoh1",
|
||||||
"DioEgizio",
|
|
||||||
"EnnuiL",
|
"EnnuiL",
|
||||||
"egeesin"
|
"egeesin"
|
||||||
],
|
],
|
||||||
|
|||||||
@@ -16,7 +16,8 @@
|
|||||||
"MinecraftClientMixin",
|
"MinecraftClientMixin",
|
||||||
"MouseMixin",
|
"MouseMixin",
|
||||||
"RecipeBookWidgetAccessor",
|
"RecipeBookWidgetAccessor",
|
||||||
"WorldRendererMixin"
|
"WorldRendererMixin",
|
||||||
|
"KeyBindingRegistryImplAccessor"
|
||||||
],
|
],
|
||||||
"injectors": {
|
"injectors": {
|
||||||
"defaultRequire": 1
|
"defaultRequire": 1
|
||||||
|
|||||||
@@ -4,6 +4,7 @@
|
|||||||
"plugin": "eu.midnightdust.midnightcontrols.client.compat.MidnightControlsMixinPlugin",
|
"plugin": "eu.midnightdust.midnightcontrols.client.compat.MidnightControlsMixinPlugin",
|
||||||
"compatibilityLevel": "JAVA_16",
|
"compatibilityLevel": "JAVA_16",
|
||||||
"client": [
|
"client": [
|
||||||
|
"SodiumOptionsGUIAccessor"
|
||||||
],
|
],
|
||||||
"injectors": {
|
"injectors": {
|
||||||
"defaultRequire": 1
|
"defaultRequire": 1
|
||||||
|
|||||||
4
src/main/resources/resourcepacks/bedrock/CREDITS
Normal file
@@ -0,0 +1,4 @@
|
|||||||
|
Some of the textures in this Resourcepack are directly taken from the Bedrock assets and are therefore © Mojang Studios.
|
||||||
|
Credits go to Ivanoks for redrawing the Bedrock XBox controller icons in 15x15,
|
||||||
|
Motschen for creating the assets for the other controllers
|
||||||
|
and LambdAurora for the original assets, part of which are also included.
|
||||||
|
After Width: | Height: | Size: 18 KiB |
|
After Width: | Height: | Size: 9.7 KiB |
6
src/main/resources/resourcepacks/bedrock/pack.mcmeta
Normal file
@@ -0,0 +1,6 @@
|
|||||||
|
{
|
||||||
|
"pack": {
|
||||||
|
"pack_format": 9,
|
||||||
|
"description": "Makes the controller buttons look like from Bedrock Edition"
|
||||||
|
}
|
||||||
|
}
|
||||||
BIN
src/main/resources/resourcepacks/bedrock/pack.png
Normal file
|
After Width: | Height: | Size: 12 KiB |