First Push, yay
This commit is contained in:
@@ -0,0 +1,10 @@
|
||||
package de.fullrisk.citrusDev;
|
||||
|
||||
import net.fabricmc.api.ModInitializer;
|
||||
|
||||
public class CitrusDev implements ModInitializer {
|
||||
|
||||
@Override
|
||||
public void onInitialize() {
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,42 @@
|
||||
package de.fullrisk.citrusDev;
|
||||
|
||||
import io.wispforest.owo.ui.component.LabelComponent;
|
||||
import io.wispforest.owo.ui.core.AnimatableProperty;
|
||||
import io.wispforest.owo.ui.core.OwoUIGraphics;
|
||||
import net.minecraft.network.chat.Component;
|
||||
|
||||
public class ScalableLabel extends LabelComponent {
|
||||
|
||||
protected final AnimatableProperty<ScaleValue> scale = AnimatableProperty.of(new ScaleValue(0f));
|
||||
|
||||
public ScalableLabel(Component text) {
|
||||
super(text);
|
||||
}
|
||||
|
||||
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,32 @@
|
||||
package de.fullrisk.citrusDev.client;
|
||||
|
||||
import de.fullrisk.citrusDev.MyScreen;
|
||||
import net.fabricmc.api.ClientModInitializer;
|
||||
import net.fabricmc.fabric.api.client.event.lifecycle.v1.ClientTickEvents;
|
||||
import net.fabricmc.fabric.api.client.keymapping.v1.KeyMappingHelper;
|
||||
import net.minecraft.client.KeyMapping;
|
||||
import net.minecraft.resources.Identifier;
|
||||
import org.lwjgl.glfw.GLFW;
|
||||
|
||||
public class CitrusDevClient implements ClientModInitializer {
|
||||
|
||||
private static KeyMapping openScreenKey;
|
||||
|
||||
@Override
|
||||
public void onInitializeClient() {
|
||||
KeyMapping.Category category = KeyMapping.Category.register(
|
||||
Identifier.fromNamespaceAndPath("citrus-dev", "general"));
|
||||
|
||||
openScreenKey = KeyMappingHelper.registerKeyMapping(new KeyMapping(
|
||||
"key.citrus-dev.open_screen",
|
||||
GLFW.GLFW_KEY_G,
|
||||
category
|
||||
));
|
||||
|
||||
ClientTickEvents.END_CLIENT_TICK.register(client -> {
|
||||
while (openScreenKey.consumeClick()) {
|
||||
client.setScreen(new MyScreen());
|
||||
}
|
||||
});
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user