first commit
This commit is contained in:
Binary file not shown.
Binary file not shown.
Binary file not shown.
BIN
Binary file not shown.
BIN
Binary file not shown.
+8
@@ -0,0 +1,8 @@
|
|||||||
|
<?xml version="1.0" encoding="UTF-8"?>
|
||||||
|
<project xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd" xmlns="http://maven.apache.org/POM/4.0.0"
|
||||||
|
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
|
||||||
|
<modelVersion>4.0.0</modelVersion>
|
||||||
|
<groupId>net.minecraft</groupId>
|
||||||
|
<artifactId>minecraft-merged-043a8b3edf</artifactId>
|
||||||
|
<version>26.1.2</version>
|
||||||
|
</project>
|
||||||
+8
@@ -0,0 +1,8 @@
|
|||||||
|
<?xml version="1.0" encoding="UTF-8"?>
|
||||||
|
<project xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd" xmlns="http://maven.apache.org/POM/4.0.0"
|
||||||
|
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
|
||||||
|
<modelVersion>4.0.0</modelVersion>
|
||||||
|
<groupId>remapped.net.fabricmc.fabric-api</groupId>
|
||||||
|
<artifactId>fabric-api-lookup-api-v1-4a1da960</artifactId>
|
||||||
|
<version>2.0.12+d5a053b64c</version>
|
||||||
|
</project>
|
||||||
+8
@@ -0,0 +1,8 @@
|
|||||||
|
<?xml version="1.0" encoding="UTF-8"?>
|
||||||
|
<project xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd" xmlns="http://maven.apache.org/POM/4.0.0"
|
||||||
|
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
|
||||||
|
<modelVersion>4.0.0</modelVersion>
|
||||||
|
<groupId>remapped.net.fabricmc.fabric-api</groupId>
|
||||||
|
<artifactId>fabric-biome-api-v1-4a1da960</artifactId>
|
||||||
|
<version>18.0.5+2fa62b4e4c</version>
|
||||||
|
</project>
|
||||||
BIN
Binary file not shown.
+8
@@ -0,0 +1,8 @@
|
|||||||
|
<?xml version="1.0" encoding="UTF-8"?>
|
||||||
|
<project xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd" xmlns="http://maven.apache.org/POM/4.0.0"
|
||||||
|
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
|
||||||
|
<modelVersion>4.0.0</modelVersion>
|
||||||
|
<groupId>remapped.net.fabricmc.fabric-api</groupId>
|
||||||
|
<artifactId>fabric-block-getter-api-v2-4a1da960</artifactId>
|
||||||
|
<version>2.0.6+ec56b6014c</version>
|
||||||
|
</project>
|
||||||
+8
@@ -0,0 +1,8 @@
|
|||||||
|
<?xml version="1.0" encoding="UTF-8"?>
|
||||||
|
<project xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd" xmlns="http://maven.apache.org/POM/4.0.0"
|
||||||
|
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
|
||||||
|
<modelVersion>4.0.0</modelVersion>
|
||||||
|
<groupId>remapped.net.fabricmc.fabric-api</groupId>
|
||||||
|
<artifactId>fabric-client-gametest-api-v1-4a1da960</artifactId>
|
||||||
|
<version>5.1.0+0a5283664c</version>
|
||||||
|
</project>
|
||||||
BIN
Binary file not shown.
+8
@@ -0,0 +1,8 @@
|
|||||||
|
<?xml version="1.0" encoding="UTF-8"?>
|
||||||
|
<project xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd" xmlns="http://maven.apache.org/POM/4.0.0"
|
||||||
|
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
|
||||||
|
<modelVersion>4.0.0</modelVersion>
|
||||||
|
<groupId>remapped.net.fabricmc.fabric-api</groupId>
|
||||||
|
<artifactId>fabric-convention-tags-v2-4a1da960</artifactId>
|
||||||
|
<version>4.6.2+4f11f7994c</version>
|
||||||
|
</project>
|
||||||
BIN
Binary file not shown.
+8
@@ -0,0 +1,8 @@
|
|||||||
|
<?xml version="1.0" encoding="UTF-8"?>
|
||||||
|
<project xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd" xmlns="http://maven.apache.org/POM/4.0.0"
|
||||||
|
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
|
||||||
|
<modelVersion>4.0.0</modelVersion>
|
||||||
|
<groupId>remapped.net.fabricmc.fabric-api</groupId>
|
||||||
|
<artifactId>fabric-events-interaction-v0-4a1da960</artifactId>
|
||||||
|
<version>5.2.2+07b380be4c</version>
|
||||||
|
</project>
|
||||||
BIN
Binary file not shown.
BIN
Binary file not shown.
+8
@@ -0,0 +1,8 @@
|
|||||||
|
<?xml version="1.0" encoding="UTF-8"?>
|
||||||
|
<project xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd" xmlns="http://maven.apache.org/POM/4.0.0"
|
||||||
|
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
|
||||||
|
<modelVersion>4.0.0</modelVersion>
|
||||||
|
<groupId>remapped.net.fabricmc.fabric-api</groupId>
|
||||||
|
<artifactId>fabric-menu-api-v1-4a1da960</artifactId>
|
||||||
|
<version>2.0.14+d871b99e4c</version>
|
||||||
|
</project>
|
||||||
+8
@@ -0,0 +1,8 @@
|
|||||||
|
<?xml version="1.0" encoding="UTF-8"?>
|
||||||
|
<project xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd" xmlns="http://maven.apache.org/POM/4.0.0"
|
||||||
|
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
|
||||||
|
<modelVersion>4.0.0</modelVersion>
|
||||||
|
<groupId>remapped.net.fabricmc.fabric-api</groupId>
|
||||||
|
<artifactId>fabric-permission-api-v1-4a1da960</artifactId>
|
||||||
|
<version>1.0.1+c3369b134c</version>
|
||||||
|
</project>
|
||||||
BIN
Binary file not shown.
+8
@@ -0,0 +1,8 @@
|
|||||||
|
<?xml version="1.0" encoding="UTF-8"?>
|
||||||
|
<project xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd" xmlns="http://maven.apache.org/POM/4.0.0"
|
||||||
|
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
|
||||||
|
<modelVersion>4.0.0</modelVersion>
|
||||||
|
<groupId>remapped.net.fabricmc.fabric-api</groupId>
|
||||||
|
<artifactId>fabric-rendering-v1-4a1da960</artifactId>
|
||||||
|
<version>23.3.0+e9207d814c</version>
|
||||||
|
</project>
|
||||||
BIN
Binary file not shown.
BIN
Binary file not shown.
+8
@@ -0,0 +1,8 @@
|
|||||||
|
<?xml version="1.0" encoding="UTF-8"?>
|
||||||
|
<project xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd" xmlns="http://maven.apache.org/POM/4.0.0"
|
||||||
|
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
|
||||||
|
<modelVersion>4.0.0</modelVersion>
|
||||||
|
<groupId>remapped.net.fabricmc.fabric-api</groupId>
|
||||||
|
<artifactId>fabric-screen-api-v1-4a1da960</artifactId>
|
||||||
|
<version>5.1.0+981dd9b24c</version>
|
||||||
|
</project>
|
||||||
BIN
Binary file not shown.
+8
@@ -0,0 +1,8 @@
|
|||||||
|
<?xml version="1.0" encoding="UTF-8"?>
|
||||||
|
<project xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd" xmlns="http://maven.apache.org/POM/4.0.0"
|
||||||
|
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
|
||||||
|
<modelVersion>4.0.0</modelVersion>
|
||||||
|
<groupId>remapped.net.fabricmc.fabric-api</groupId>
|
||||||
|
<artifactId>fabric-serialization-api-v1-4a1da960</artifactId>
|
||||||
|
<version>2.0.3+11a26f314c</version>
|
||||||
|
</project>
|
||||||
BIN
Binary file not shown.
BIN
Binary file not shown.
+8
@@ -0,0 +1,8 @@
|
|||||||
|
<?xml version="1.0" encoding="UTF-8"?>
|
||||||
|
<project xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd" xmlns="http://maven.apache.org/POM/4.0.0"
|
||||||
|
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
|
||||||
|
<modelVersion>4.0.0</modelVersion>
|
||||||
|
<groupId>remapped.net.fabricmc.fabric-api</groupId>
|
||||||
|
<artifactId>fabric-transfer-api-v1-4a1da960</artifactId>
|
||||||
|
<version>8.0.6+357ea7334c</version>
|
||||||
|
</project>
|
||||||
Generated
+12
@@ -0,0 +1,12 @@
|
|||||||
|
<?xml version="1.0" encoding="UTF-8"?>
|
||||||
|
<project version="4">
|
||||||
|
<component name="MaterialThemeProjectNewConfig">
|
||||||
|
<option name="metadata">
|
||||||
|
<MTProjectMetadataState>
|
||||||
|
<option name="migrated" value="true" />
|
||||||
|
<option name="pristineConfig" value="false" />
|
||||||
|
<option name="userId" value="48f43b95:19a7461046a:-7ffe" />
|
||||||
|
</MTProjectMetadataState>
|
||||||
|
</option>
|
||||||
|
</component>
|
||||||
|
</project>
|
||||||
Generated
+19
@@ -0,0 +1,19 @@
|
|||||||
|
<?xml version="1.0" encoding="UTF-8"?>
|
||||||
|
<module version="4">
|
||||||
|
<component name="FacetManager">
|
||||||
|
<facet type="minecraft" name="Minecraft">
|
||||||
|
<configuration>
|
||||||
|
<autoDetectTypes>
|
||||||
|
<platformType>ARCHITECTURY</platformType>
|
||||||
|
<platformType>FABRIC</platformType>
|
||||||
|
<platformType>MIXIN</platformType>
|
||||||
|
<platformType>MCP</platformType>
|
||||||
|
</autoDetectTypes>
|
||||||
|
<projectReimportVersion>1</projectReimportVersion>
|
||||||
|
</configuration>
|
||||||
|
</facet>
|
||||||
|
</component>
|
||||||
|
<component name="McpModuleSettings">
|
||||||
|
<option name="minecraftVersion" value="26.1.2" />
|
||||||
|
</component>
|
||||||
|
</module>
|
||||||
+16
@@ -0,0 +1,16 @@
|
|||||||
|
<component name="ProjectRunConfigurationManager">
|
||||||
|
<configuration default="false" factoryName="Application" name="Minecraft Client" type="Application">
|
||||||
|
<option name="MAIN_CLASS_NAME" value="net.fabricmc.devlaunchinjector.Main"/>
|
||||||
|
<module name="citrus-dev.main"/>
|
||||||
|
<option name="PROGRAM_PARAMETERS" value=""/>
|
||||||
|
<option name="VM_PARAMETERS" value="-Dfabric.dli.config=C:\Users\FullRisk\Documents\citrus-dev\.gradle\loom-cache\launch.cfg -Dfabric.dli.env=client -Dfabric.dli.main=net.fabricmc.loader.impl.launch.knot.KnotClient --sun-misc-unsafe-memory-access=allow --enable-native-access=ALL-UNNAMED"/>
|
||||||
|
<option name="WORKING_DIRECTORY" value="$PROJECT_DIR$/run/"/>
|
||||||
|
<method v="2">
|
||||||
|
<option enabled="true" name="Make"/>
|
||||||
|
</method>
|
||||||
|
<envs>
|
||||||
|
|
||||||
|
</envs>
|
||||||
|
<shortenClasspath name="ARGS_FILE"/>
|
||||||
|
<classpathModifications/></configuration>
|
||||||
|
</component>
|
||||||
+16
@@ -0,0 +1,16 @@
|
|||||||
|
<component name="ProjectRunConfigurationManager">
|
||||||
|
<configuration default="false" factoryName="Application" name="Minecraft Server" type="Application">
|
||||||
|
<option name="MAIN_CLASS_NAME" value="net.fabricmc.devlaunchinjector.Main"/>
|
||||||
|
<module name="citrus-dev.main"/>
|
||||||
|
<option name="PROGRAM_PARAMETERS" value="nogui"/>
|
||||||
|
<option name="VM_PARAMETERS" value="-Dfabric.dli.config=C:\Users\FullRisk\Documents\citrus-dev\.gradle\loom-cache\launch.cfg -Dfabric.dli.env=server -Dfabric.dli.main=net.fabricmc.loader.impl.launch.knot.KnotServer --sun-misc-unsafe-memory-access=allow --enable-native-access=ALL-UNNAMED"/>
|
||||||
|
<option name="WORKING_DIRECTORY" value="$PROJECT_DIR$/run/"/>
|
||||||
|
<method v="2">
|
||||||
|
<option enabled="true" name="Make"/>
|
||||||
|
</method>
|
||||||
|
<envs>
|
||||||
|
|
||||||
|
</envs>
|
||||||
|
<shortenClasspath name="ARGS_FILE"/>
|
||||||
|
<classpathModifications><entry exclude="true" path="C:\Users\FullRisk\.gradle\caches\modules-2\files-2.1\org.lwjgl\lwjgl\3.4.1\6105690714874b995aa7812e4f7732a21109276c\lwjgl-3.4.1.jar"/><entry exclude="true" path="C:\Users\FullRisk\.gradle\caches\modules-2\files-2.1\com.mojang\patchy\2.2.10\da05971b07cbb379d002cf7eaec6a2048211fefc\patchy-2.2.10.jar"/><entry exclude="true" path="C:\Users\FullRisk\.gradle\caches\modules-2\files-2.1\org.lwjgl\lwjgl-jemalloc\3.4.1\16b663092854fc6adfe0a941e61cae2bb2e437b6\lwjgl-jemalloc-3.4.1.jar"/><entry exclude="true" path="C:\Users\FullRisk\.gradle\caches\modules-2\files-2.1\org.lwjgl\lwjgl-openal\3.4.1\8508bd60589de0539aa465b78fcf838efd07ae9a\lwjgl-openal-3.4.1.jar"/><entry exclude="true" path="C:\Users\FullRisk\.gradle\caches\modules-2\files-2.1\org.lwjgl\lwjgl-opengl\3.4.1\830412cab823c029cda6b9729f9d2ed36cf79959\lwjgl-opengl-3.4.1.jar"/><entry exclude="true" path="C:\Users\FullRisk\.gradle\caches\modules-2\files-2.1\org.lwjgl\lwjgl-glfw\3.4.1\a782b1ddd175c9107bf300fd92920579ea65e2a4\lwjgl-glfw-3.4.1.jar"/><entry exclude="true" path="C:\Users\FullRisk\.gradle\caches\modules-2\files-2.1\com.ibm.icu\icu4j\77.1\38693cf0b1d7362a8b726af74dc06026a7c23809\icu4j-77.1.jar"/><entry exclude="true" path="C:\Users\FullRisk\.gradle\caches\modules-2\files-2.1\org.lwjgl\lwjgl-tinyfd\3.4.1\562697d40dbd2ed0424bf24dcf65d51170f81adf\lwjgl-tinyfd-3.4.1.jar"/><entry exclude="true" path="C:\Users\FullRisk\.gradle\caches\modules-2\files-2.1\org.jcraft\jorbis\0.0.17\8872d22b293e8f5d7d56ff92be966e6dc28ebdc6\jorbis-0.0.17.jar"/><entry exclude="true" path="C:\Users\FullRisk\.gradle\caches\modules-2\files-2.1\org.lwjgl\lwjgl-freetype\3.4.1\caa75a37e857efc9b0686e434d708d6420c5b6ea\lwjgl-freetype-3.4.1.jar"/><entry exclude="true" path="C:\Users\FullRisk\.gradle\caches\modules-2\files-2.1\org.apache.commons\commons-compress\1.28.0\e482f2c7a88dac3c497e96aa420b6a769f59c8d7\commons-compress-1.28.0.jar"/><entry exclude="true" path="C:\Users\FullRisk\.gradle\caches\modules-2\files-2.1\com.mojang\text2speech\1.18.11\e853a12cdd6ba4f4836e8f4bf3b37844a13482b6\text2speech-1.18.11.jar"/><entry exclude="true" path="C:\Users\FullRisk\.gradle\caches\modules-2\files-2.1\commons-codec\commons-codec\1.19.0\8c0dbe3ae883fceda9b50a6c76e745e548073388\commons-codec-1.19.0.jar"/><entry exclude="true" path="C:\Users\FullRisk\.gradle\caches\modules-2\files-2.1\org.lwjgl\lwjgl-stb\3.4.1\f077c3dafc31924fbe8acb0b913f08977ba27f8e\lwjgl-stb-3.4.1.jar"/><entry exclude="true" path="C:\Users\FullRisk\.gradle\caches\modules-2\files-2.1\com.mojang\blocklist\1.0.10\5c685c5ffa94c4cd39496c7184c1d122e515ecef\blocklist-1.0.10.jar"/></classpathModifications></configuration>
|
||||||
|
</component>
|
||||||
Binary file not shown.
BIN
Binary file not shown.
BIN
Binary file not shown.
BIN
Binary file not shown.
BIN
Binary file not shown.
BIN
Binary file not shown.
BIN
Binary file not shown.
BIN
Binary file not shown.
BIN
Binary file not shown.
BIN
Binary file not shown.
BIN
Binary file not shown.
BIN
Binary file not shown.
BIN
Binary file not shown.
BIN
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
|
After Width: | Height: | Size: 9.0 KiB |
@@ -0,0 +1,82 @@
|
|||||||
|
package de.fullrisk.citrusDev;
|
||||||
|
|
||||||
|
import io.wispforest.owo.ui.base.BaseOwoScreen;
|
||||||
|
import io.wispforest.owo.ui.component.UIComponents;
|
||||||
|
import io.wispforest.owo.ui.container.FlowLayout;
|
||||||
|
import io.wispforest.owo.ui.container.UIContainers;
|
||||||
|
import io.wispforest.owo.ui.core.*;
|
||||||
|
import net.minecraft.client.Minecraft;
|
||||||
|
import net.minecraft.client.resources.sounds.SimpleSoundInstance;
|
||||||
|
import net.minecraft.network.chat.Component;
|
||||||
|
import net.minecraft.sounds.SoundEvents;
|
||||||
|
import de.fullrisk.citrusDev.ScalableLabel;
|
||||||
|
import de.fullrisk.citrusDev.ScalableButton;
|
||||||
|
import de.fullrisk.citrusDev.ScaleValue;
|
||||||
|
|
||||||
|
public class MyScreen extends BaseOwoScreen<FlowLayout> {
|
||||||
|
|
||||||
|
public MyScreen() {
|
||||||
|
super(Component.literal("Citrus Dev"));
|
||||||
|
Minecraft.getInstance().getSoundManager().play(
|
||||||
|
SimpleSoundInstance.forUI(SoundEvents.UI_TOAST_IN, 1.5F, 2)
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
protected OwoUIAdapter<FlowLayout> createAdapter() {
|
||||||
|
return OwoUIAdapter.create(this, UIContainers::verticalFlow);
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
protected void build(FlowLayout rootComponent) {
|
||||||
|
rootComponent
|
||||||
|
.horizontalAlignment(HorizontalAlignment.CENTER)
|
||||||
|
.verticalAlignment(VerticalAlignment.CENTER);
|
||||||
|
|
||||||
|
FlowLayout panel = UIContainers.verticalFlow(Sizing.content(), Sizing.content());
|
||||||
|
panel.gap(6);
|
||||||
|
panel.padding(Insets.of(12));
|
||||||
|
|
||||||
|
panel.horizontalAlignment(HorizontalAlignment.CENTER);
|
||||||
|
panel.verticalAlignment(VerticalAlignment.CENTER);
|
||||||
|
panel.horizontalSizing(Sizing.fixed(0));
|
||||||
|
panel.verticalSizing(Sizing.fixed(0));
|
||||||
|
panel.horizontalSizing().animate(300, Easing.CUBIC, Sizing.fixed(250)).forwards();
|
||||||
|
panel.verticalSizing().animate(300, Easing.CUBIC, Sizing.fixed(150)).forwards();
|
||||||
|
|
||||||
|
var header = new ScalableLabel(Component.literal("Citrus Dev"));
|
||||||
|
panel.child(header);
|
||||||
|
|
||||||
|
var header_button = new ScalableButton(Component.literal("Click me"), btn -> {
|
||||||
|
btn.setMessage(Component.literal("Clicked!"));
|
||||||
|
Minecraft.getInstance().getSoundManager().play(
|
||||||
|
SimpleSoundInstance.forUI(SoundEvents.UI_BUTTON_CLICK.value(), 2.0F, 2)
|
||||||
|
);
|
||||||
|
});
|
||||||
|
|
||||||
|
header_button.scale().animate(300, Easing.CUBIC, new ScaleValue(1f)).forwards();
|
||||||
|
panel.child(header_button);
|
||||||
|
header.scale().animate(300, Easing.CUBIC, new ScaleValue(2f)).forwards();
|
||||||
|
|
||||||
|
|
||||||
|
Surface glassPanel = Surface.blur(5f, 15f)
|
||||||
|
.and(Surface.flat(0x40FFFFFF))
|
||||||
|
.and(Surface.outline(0xFFFFFFFF));
|
||||||
|
|
||||||
|
panel.surface(glassPanel);
|
||||||
|
|
||||||
|
var version = new ScalableLabel(Component.literal("Citrus-Dev v2.0"))
|
||||||
|
.horizontalTextAlignment(HorizontalAlignment.RIGHT)
|
||||||
|
.verticalTextAlignment(VerticalAlignment.BOTTOM);
|
||||||
|
|
||||||
|
panel.child(version);
|
||||||
|
rootComponent.child(panel);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public boolean isPauseScreen() {
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -0,0 +1,44 @@
|
|||||||
|
package de.fullrisk.citrusDev;
|
||||||
|
|
||||||
|
import io.wispforest.owo.ui.component.ButtonComponent;
|
||||||
|
import io.wispforest.owo.ui.core.AnimatableProperty;
|
||||||
|
import io.wispforest.owo.ui.core.OwoUIGraphics;
|
||||||
|
import net.minecraft.network.chat.Component;
|
||||||
|
|
||||||
|
import java.util.function.Consumer;
|
||||||
|
|
||||||
|
public class ScalableButton extends ButtonComponent {
|
||||||
|
|
||||||
|
protected final AnimatableProperty<ScaleValue> scale = AnimatableProperty.of(new ScaleValue(0f));
|
||||||
|
|
||||||
|
public ScalableButton(Component message, Consumer<ButtonComponent> onPress) {
|
||||||
|
super(message, onPress);
|
||||||
|
}
|
||||||
|
|
||||||
|
public AnimatableProperty<ScaleValue> scale() {
|
||||||
|
return this.scale;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void update(float delta, int mouseX, int mouseY) {
|
||||||
|
super.update(delta, mouseX, mouseY);
|
||||||
|
this.scale.update(delta);
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void draw(OwoUIGraphics graphics, int mouseX, int mouseY, float partialTicks, float delta) {
|
||||||
|
float s = this.scale.get().value();
|
||||||
|
|
||||||
|
float centerX = this.x() + this.width() / 2f;
|
||||||
|
float centerY = this.y() + this.height() / 2f;
|
||||||
|
|
||||||
|
graphics.pose().pushMatrix();
|
||||||
|
graphics.pose().translate(centerX, centerY);
|
||||||
|
graphics.pose().scale(s, s);
|
||||||
|
graphics.pose().translate(-centerX, -centerY);
|
||||||
|
|
||||||
|
super.draw(graphics, mouseX, mouseY, partialTicks, delta);
|
||||||
|
|
||||||
|
graphics.pose().popMatrix();
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -0,0 +1,11 @@
|
|||||||
|
package de.fullrisk.citrusDev;
|
||||||
|
|
||||||
|
import io.wispforest.owo.ui.core.Animatable;
|
||||||
|
import net.minecraft.util.Mth;
|
||||||
|
|
||||||
|
public record ScaleValue(float value) implements Animatable<ScaleValue> {
|
||||||
|
@Override
|
||||||
|
public ScaleValue interpolate(ScaleValue next, float delta) {
|
||||||
|
return new ScaleValue(Mth.lerp(delta, this.value, next.value));
|
||||||
|
}
|
||||||
|
}
|
||||||
Reference in New Issue
Block a user