Compare commits
4 Commits
old/1.19.2
...
old/1.18.2
Author | SHA1 | Date | |
---|---|---|---|
9d9217485b | |||
eda7bf4bf2 | |||
0e4a46f98a | |||
9c05bec9a0 |
@@ -9,7 +9,7 @@ pipeline {
|
|||||||
stage("Notify Discord") {
|
stage("Notify Discord") {
|
||||||
steps {
|
steps {
|
||||||
discordSend webhookURL: env.FDD_WH_ADMIN,
|
discordSend webhookURL: env.FDD_WH_ADMIN,
|
||||||
title: "Deploy Started: CraterLib 1.19.2 Deploy #${BUILD_NUMBER}",
|
title: "Deploy Started: CraterLib 1.18.2 Deploy #${BUILD_NUMBER}",
|
||||||
link: env.BUILD_URL,
|
link: env.BUILD_URL,
|
||||||
result: 'SUCCESS',
|
result: 'SUCCESS',
|
||||||
description: "Build: [${BUILD_NUMBER}](${env.BUILD_URL})"
|
description: "Build: [${BUILD_NUMBER}](${env.BUILD_URL})"
|
||||||
@@ -38,7 +38,7 @@ pipeline {
|
|||||||
deleteDir()
|
deleteDir()
|
||||||
|
|
||||||
discordSend webhookURL: env.FDD_WH_ADMIN,
|
discordSend webhookURL: env.FDD_WH_ADMIN,
|
||||||
title: "CraterLib 1.19.2 Deploy #${BUILD_NUMBER}",
|
title: "CraterLib 1.18.2 Deploy #${BUILD_NUMBER}",
|
||||||
link: env.BUILD_URL,
|
link: env.BUILD_URL,
|
||||||
result: currentBuild.currentResult,
|
result: currentBuild.currentResult,
|
||||||
description: "Build: [${BUILD_NUMBER}](${env.BUILD_URL})\nStatus: ${currentBuild.currentResult}"
|
description: "Build: [${BUILD_NUMBER}](${env.BUILD_URL})\nStatus: ${currentBuild.currentResult}"
|
||||||
|
@@ -13,7 +13,7 @@ pipeline {
|
|||||||
stage("Notify Discord") {
|
stage("Notify Discord") {
|
||||||
steps {
|
steps {
|
||||||
discordSend webhookURL: env.SSS_WEBHOOK,
|
discordSend webhookURL: env.SSS_WEBHOOK,
|
||||||
title: "Deploy Started: ${projectName} 1.19.2 Deploy #${BUILD_NUMBER}",
|
title: "Deploy Started: ${projectName} 1.18.2 Deploy #${BUILD_NUMBER}",
|
||||||
link: env.BUILD_URL,
|
link: env.BUILD_URL,
|
||||||
result: 'SUCCESS',
|
result: 'SUCCESS',
|
||||||
description: "Build: [${BUILD_NUMBER}](${env.BUILD_URL})"
|
description: "Build: [${BUILD_NUMBER}](${env.BUILD_URL})"
|
||||||
@@ -54,7 +54,7 @@ pipeline {
|
|||||||
versionName: "Snapshot 1.1.${BUILD_NUMBER}",
|
versionName: "Snapshot 1.1.${BUILD_NUMBER}",
|
||||||
version: "1.1.${BUILD_NUMBER}",
|
version: "1.1.${BUILD_NUMBER}",
|
||||||
modLoaders: "forge|fabric|quilt",
|
modLoaders: "forge|fabric|quilt",
|
||||||
minecraftVersions: "1.19.2",
|
minecraftVersions: "1.18.2",
|
||||||
failWebhook: env.SSS_WEBHOOK,
|
failWebhook: env.SSS_WEBHOOK,
|
||||||
publishWebhooks: "${env.SSS_WEBHOOK}|${env.FDD_WH}"
|
publishWebhooks: "${env.SSS_WEBHOOK}|${env.FDD_WH}"
|
||||||
|
|
||||||
|
@@ -2,7 +2,7 @@ archivesBaseName = "${mod_name.replace(" ", "")}-Common-${minecraft_version}"
|
|||||||
|
|
||||||
dependencies {
|
dependencies {
|
||||||
implementation "com.hypherionmc:rpcsdk:1.0"
|
implementation "com.hypherionmc:rpcsdk:1.0"
|
||||||
implementation("me.hypherionmc.sdlink:mcdiscordformatter-1.19.1:2.0.0")
|
implementation("me.hypherionmc.sdlink:mcdiscordformatter-1.18.1:2.0.0")
|
||||||
}
|
}
|
||||||
|
|
||||||
shadowJar {
|
shadowJar {
|
||||||
@@ -10,7 +10,7 @@ shadowJar {
|
|||||||
dependencies {
|
dependencies {
|
||||||
include(dependency("me.hypherionmc.moon-config:core:${moon_config}"))
|
include(dependency("me.hypherionmc.moon-config:core:${moon_config}"))
|
||||||
include(dependency("me.hypherionmc.moon-config:toml:${moon_config}"))
|
include(dependency("me.hypherionmc.moon-config:toml:${moon_config}"))
|
||||||
include(dependency("me.hypherionmc.sdlink:mcdiscordformatter-1.19.1:2.0.0"))
|
include(dependency("me.hypherionmc.sdlink:mcdiscordformatter-1.18.1:2.0.0"))
|
||||||
|
|
||||||
relocate 'me.hypherionmc.moonconfig', 'shadow.hypherionmc.moonconfig'
|
relocate 'me.hypherionmc.moonconfig', 'shadow.hypherionmc.moonconfig'
|
||||||
relocate 'me.hypherionmc.mcdiscordformatter', 'shadow.hypherionmc.mcdiscordformatter'
|
relocate 'me.hypherionmc.mcdiscordformatter', 'shadow.hypherionmc.mcdiscordformatter'
|
||||||
|
@@ -1,21 +1,21 @@
|
|||||||
package com.hypherionmc.craterlib.api.event.server;
|
package com.hypherionmc.craterlib.api.event.server;
|
||||||
|
|
||||||
import com.hypherionmc.craterlib.core.event.CraterEvent;
|
import com.hypherionmc.craterlib.core.event.CraterEvent;
|
||||||
|
import net.minecraft.network.chat.ChatType;
|
||||||
import net.minecraft.network.chat.Component;
|
import net.minecraft.network.chat.Component;
|
||||||
import net.minecraft.server.level.ServerPlayer;
|
|
||||||
|
|
||||||
import java.util.function.Function;
|
import java.util.UUID;
|
||||||
|
|
||||||
public class MessageBroadcastEvent extends CraterEvent {
|
public class MessageBroadcastEvent extends CraterEvent {
|
||||||
|
|
||||||
private final Component component;
|
private final Component component;
|
||||||
private final Function<ServerPlayer, Component> function;
|
private final UUID uuid;
|
||||||
private final boolean bl;
|
private final ChatType bl;
|
||||||
private final String threadName;
|
private final String threadName;
|
||||||
|
|
||||||
public MessageBroadcastEvent(Component component, Function<ServerPlayer, Component> function, boolean bl, String threadName) {
|
public MessageBroadcastEvent(Component component, UUID uuid, ChatType bl, String threadName) {
|
||||||
this.component = component;
|
this.component = component;
|
||||||
this.function = function;
|
this.uuid = uuid;
|
||||||
this.bl = bl;
|
this.bl = bl;
|
||||||
this.threadName = threadName;
|
this.threadName = threadName;
|
||||||
}
|
}
|
||||||
@@ -24,12 +24,12 @@ public class MessageBroadcastEvent extends CraterEvent {
|
|||||||
return component;
|
return component;
|
||||||
}
|
}
|
||||||
|
|
||||||
public boolean isBl() {
|
public ChatType getChatType() {
|
||||||
return bl;
|
return this.bl;
|
||||||
}
|
}
|
||||||
|
|
||||||
public Function<ServerPlayer, Component> getFunction() {
|
public UUID getUuid() {
|
||||||
return function;
|
return uuid;
|
||||||
}
|
}
|
||||||
|
|
||||||
public String getThreadName() {
|
public String getThreadName() {
|
||||||
|
@@ -2,6 +2,7 @@ package com.hypherionmc.craterlib.client.gui.config;
|
|||||||
|
|
||||||
import com.hypherionmc.craterlib.CraterConstants;
|
import com.hypherionmc.craterlib.CraterConstants;
|
||||||
import com.hypherionmc.craterlib.client.gui.config.widgets.*;
|
import com.hypherionmc.craterlib.client.gui.config.widgets.*;
|
||||||
|
import com.hypherionmc.craterlib.core.abstraction.text.AbstractComponent;
|
||||||
import com.hypherionmc.craterlib.core.config.ModuleConfig;
|
import com.hypherionmc.craterlib.core.config.ModuleConfig;
|
||||||
import com.hypherionmc.craterlib.core.config.annotations.HideFromScreen;
|
import com.hypherionmc.craterlib.core.config.annotations.HideFromScreen;
|
||||||
import com.hypherionmc.craterlib.core.config.annotations.SubConfig;
|
import com.hypherionmc.craterlib.core.config.annotations.SubConfig;
|
||||||
@@ -48,7 +49,7 @@ public class CraterConfigScreen extends Screen {
|
|||||||
private boolean dragging;
|
private boolean dragging;
|
||||||
|
|
||||||
public CraterConfigScreen(ModuleConfig config, Screen parent, Object subConfig) {
|
public CraterConfigScreen(ModuleConfig config, Screen parent, Object subConfig) {
|
||||||
super(Component.translatable("cl." + config.getClass().getSimpleName().toLowerCase() + ".title"));
|
super(AbstractComponent.translatable("cl." + config.getClass().getSimpleName().toLowerCase() + ".title"));
|
||||||
this.parent = parent;
|
this.parent = parent;
|
||||||
this.config = config;
|
this.config = config;
|
||||||
if (subConfig != null) {
|
if (subConfig != null) {
|
||||||
@@ -63,11 +64,11 @@ public class CraterConfigScreen extends Screen {
|
|||||||
}
|
}
|
||||||
|
|
||||||
private static Component toText(Enum<?> val) {
|
private static Component toText(Enum<?> val) {
|
||||||
return Component.translatable(val.toString());
|
return AbstractComponent.translatable(val.toString());
|
||||||
}
|
}
|
||||||
|
|
||||||
private static Component toText(Boolean bool) {
|
private static Component toText(Boolean bool) {
|
||||||
return Component.translatable(bool.toString());
|
return AbstractComponent.translatable(bool.toString());
|
||||||
}
|
}
|
||||||
|
|
||||||
private void setupScreenFromConfig(Object object, Class<?> clazz) {
|
private void setupScreenFromConfig(Object object, Class<?> clazz) {
|
||||||
@@ -93,7 +94,7 @@ public class CraterConfigScreen extends Screen {
|
|||||||
tooltipLang = field.getAnnotation(Tooltip.class).value();
|
tooltipLang = field.getAnnotation(Tooltip.class).value();
|
||||||
}
|
}
|
||||||
|
|
||||||
add(Component.translatable(baseLangKey),
|
add(AbstractComponent.translatable(baseLangKey),
|
||||||
val,
|
val,
|
||||||
() -> val,
|
() -> val,
|
||||||
(ret) -> {
|
(ret) -> {
|
||||||
@@ -171,8 +172,8 @@ public class CraterConfigScreen extends Screen {
|
|||||||
((List) children()).addAll(options);
|
((List) children()).addAll(options);
|
||||||
|
|
||||||
int buttonWidths = Math.min(200, (width - 50 - 12) / 3);
|
int buttonWidths = Math.min(200, (width - 50 - 12) / 3);
|
||||||
addRenderableWidget(new InternalConfigButton(this, width / 2 - buttonWidths - 3, height - 22, buttonWidths, 20, Component.empty(), true));
|
addRenderableWidget(new InternalConfigButton(this, width / 2 - buttonWidths - 3, height - 22, buttonWidths, 20, AbstractComponent.empty(), true));
|
||||||
addRenderableWidget(new InternalConfigButton(this, width / 2 + 3, height - 22, buttonWidths, 20, Component.empty(), false));
|
addRenderableWidget(new InternalConfigButton(this, width / 2 + 3, height - 22, buttonWidths, 20, AbstractComponent.empty(), false));
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
@@ -324,10 +325,10 @@ public class CraterConfigScreen extends Screen {
|
|||||||
@Override
|
@Override
|
||||||
public void onClose() {
|
public void onClose() {
|
||||||
if (isEdited()) {
|
if (isEdited()) {
|
||||||
minecraft.setScreen(new ConfirmScreen(this::acceptConfirm, Component.translatable("t.clc.quit_config"),
|
minecraft.setScreen(new ConfirmScreen(this::acceptConfirm, AbstractComponent.translatable("t.clc.quit_config"),
|
||||||
Component.translatable("t.clc.quit_config_sure"),
|
AbstractComponent.translatable("t.clc.quit_config_sure"),
|
||||||
Component.translatable("t.clc.quit_discard"),
|
AbstractComponent.translatable("t.clc.quit_discard"),
|
||||||
Component.translatable("gui.cancel")));
|
AbstractComponent.translatable("gui.cancel")));
|
||||||
} else {
|
} else {
|
||||||
minecraft.setScreen(parent);
|
minecraft.setScreen(parent);
|
||||||
}
|
}
|
||||||
@@ -382,9 +383,9 @@ public class CraterConfigScreen extends Screen {
|
|||||||
if (mouseX > startX && mouseX < startX + sizeX) {
|
if (mouseX > startX && mouseX < startX + sizeX) {
|
||||||
if (mouseY > startY && mouseY < startY + sizeY) {
|
if (mouseY > startY && mouseY < startY + sizeY) {
|
||||||
List<Component> list = new ArrayList<>();
|
List<Component> list = new ArrayList<>();
|
||||||
list.add(Component.translatable(ChatFormatting.BOLD + "" + ChatFormatting.YELLOW + title));
|
list.add(AbstractComponent.translatable(ChatFormatting.BOLD + "" + ChatFormatting.YELLOW + title));
|
||||||
for (String desc : description) {
|
for (String desc : description) {
|
||||||
list.add(Component.translatable(desc));
|
list.add(AbstractComponent.translatable(desc));
|
||||||
}
|
}
|
||||||
renderComponentTooltip(stack, list, mouseX, mouseY);
|
renderComponentTooltip(stack, list, mouseX, mouseY);
|
||||||
}
|
}
|
||||||
|
@@ -1,11 +1,11 @@
|
|||||||
package com.hypherionmc.craterlib.client.gui.config.widgets;
|
package com.hypherionmc.craterlib.client.gui.config.widgets;
|
||||||
|
|
||||||
|
import com.hypherionmc.craterlib.core.abstraction.text.AbstractComponent;
|
||||||
import com.mojang.blaze3d.vertex.PoseStack;
|
import com.mojang.blaze3d.vertex.PoseStack;
|
||||||
import net.minecraft.ChatFormatting;
|
import net.minecraft.ChatFormatting;
|
||||||
import net.minecraft.client.Minecraft;
|
import net.minecraft.client.Minecraft;
|
||||||
import net.minecraft.client.gui.Font;
|
import net.minecraft.client.gui.Font;
|
||||||
import net.minecraft.client.gui.components.Button;
|
import net.minecraft.client.gui.components.Button;
|
||||||
import net.minecraft.network.chat.Component;
|
|
||||||
import net.minecraft.network.chat.MutableComponent;
|
import net.minecraft.network.chat.MutableComponent;
|
||||||
import net.minecraft.network.chat.TextColor;
|
import net.minecraft.network.chat.TextColor;
|
||||||
|
|
||||||
@@ -16,7 +16,7 @@ import net.minecraft.network.chat.TextColor;
|
|||||||
public class BaseWidget<T> extends Option<T> {
|
public class BaseWidget<T> extends Option<T> {
|
||||||
|
|
||||||
public static final int resetButtonOffset = 48;
|
public static final int resetButtonOffset = 48;
|
||||||
private final Button resetButton = addChild(new Button(0, 0, 46, 20, Component.literal("Reset"), this::onResetPressed));
|
private final Button resetButton = addChild(new Button(0, 0, 46, 20, AbstractComponent.literal("Reset"), this::onResetPressed));
|
||||||
private boolean hideReset = false;
|
private boolean hideReset = false;
|
||||||
|
|
||||||
private boolean isSubConfig = false;
|
private boolean isSubConfig = false;
|
||||||
@@ -40,7 +40,7 @@ public class BaseWidget<T> extends Option<T> {
|
|||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void render(Minecraft minecraft, Font font, int x, int y, int width, int height, PoseStack matrices, int mouseX, int mouseY, float delta) {
|
public void render(Minecraft minecraft, Font font, int x, int y, int width, int height, PoseStack matrices, int mouseX, int mouseY, float delta) {
|
||||||
MutableComponent text = Component.literal(this.text.getString());
|
MutableComponent text = AbstractComponent.literal(this.text.getString());
|
||||||
boolean edited = isEdited() || hasErrors;
|
boolean edited = isEdited() || hasErrors;
|
||||||
if (edited) {
|
if (edited) {
|
||||||
text.withStyle(ChatFormatting.ITALIC);
|
text.withStyle(ChatFormatting.ITALIC);
|
||||||
|
@@ -1,6 +1,7 @@
|
|||||||
package com.hypherionmc.craterlib.client.gui.config.widgets;
|
package com.hypherionmc.craterlib.client.gui.config.widgets;
|
||||||
|
|
||||||
import com.hypherionmc.craterlib.client.gui.config.CraterConfigScreen;
|
import com.hypherionmc.craterlib.client.gui.config.CraterConfigScreen;
|
||||||
|
import com.hypherionmc.craterlib.core.abstraction.text.AbstractComponent;
|
||||||
import com.mojang.blaze3d.vertex.PoseStack;
|
import com.mojang.blaze3d.vertex.PoseStack;
|
||||||
import net.minecraft.client.gui.components.AbstractButton;
|
import net.minecraft.client.gui.components.AbstractButton;
|
||||||
import net.minecraft.client.gui.narration.NarratedElementType;
|
import net.minecraft.client.gui.narration.NarratedElementType;
|
||||||
@@ -25,11 +26,11 @@ public class InternalConfigButton extends AbstractButton {
|
|||||||
@Override
|
@Override
|
||||||
public void render(@NotNull PoseStack poseStack, int i, int j, float f) {
|
public void render(@NotNull PoseStack poseStack, int i, int j, float f) {
|
||||||
if (cancel) {
|
if (cancel) {
|
||||||
setMessage(Component.translatable(screen.isEdited() ? "t.clc.cancel_discard" : "gui.cancel"));
|
setMessage(AbstractComponent.translatable(screen.isEdited() ? "t.clc.cancel_discard" : "gui.cancel"));
|
||||||
} else {
|
} else {
|
||||||
boolean hasErrors = screen.hasErrors();
|
boolean hasErrors = screen.hasErrors();
|
||||||
active = screen.isEdited() && !hasErrors;
|
active = screen.isEdited() && !hasErrors;
|
||||||
setMessage(Component.translatable(hasErrors ? "t.clc.error" : "t.clc.save"));
|
setMessage(AbstractComponent.translatable(hasErrors ? "t.clc.error" : "t.clc.save"));
|
||||||
}
|
}
|
||||||
super.render(poseStack, i, j, f);
|
super.render(poseStack, i, j, f);
|
||||||
}
|
}
|
||||||
|
@@ -1,13 +1,13 @@
|
|||||||
package com.hypherionmc.craterlib.client.gui.config.widgets;
|
package com.hypherionmc.craterlib.client.gui.config.widgets;
|
||||||
|
|
||||||
import com.hypherionmc.craterlib.client.gui.config.CraterConfigScreen;
|
import com.hypherionmc.craterlib.client.gui.config.CraterConfigScreen;
|
||||||
|
import com.hypherionmc.craterlib.core.abstraction.text.AbstractComponent;
|
||||||
import com.hypherionmc.craterlib.core.config.ModuleConfig;
|
import com.hypherionmc.craterlib.core.config.ModuleConfig;
|
||||||
import com.mojang.blaze3d.vertex.PoseStack;
|
import com.mojang.blaze3d.vertex.PoseStack;
|
||||||
import net.minecraft.client.Minecraft;
|
import net.minecraft.client.Minecraft;
|
||||||
import net.minecraft.client.gui.Font;
|
import net.minecraft.client.gui.Font;
|
||||||
import net.minecraft.client.gui.components.Button;
|
import net.minecraft.client.gui.components.Button;
|
||||||
import net.minecraft.client.gui.screens.Screen;
|
import net.minecraft.client.gui.screens.Screen;
|
||||||
import net.minecraft.network.chat.Component;
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @author HypherionSA
|
* @author HypherionSA
|
||||||
@@ -23,12 +23,12 @@ public class SubConfigWidget<T> extends AbstractConfigWidget<T, Button> {
|
|||||||
this.subConfig = subConfig;
|
this.subConfig = subConfig;
|
||||||
this.screen = screen;
|
this.screen = screen;
|
||||||
|
|
||||||
this.widget = addChild(new Button(0, 0, 200, buttonHeight, Component.translatable("t.clc.opensubconfig"), this::openSubConfig));
|
this.widget = addChild(new Button(0, 0, 200, buttonHeight, AbstractComponent.translatable("t.clc.opensubconfig"), this::openSubConfig));
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void render(Minecraft minecraft, Font font, int x, int y, int width, int height, PoseStack matrices, int mouseX, int mouseY, float delta) {
|
public void render(Minecraft minecraft, Font font, int x, int y, int width, int height, PoseStack matrices, int mouseX, int mouseY, float delta) {
|
||||||
this.text = Component.literal(subConfig.getClass().getSimpleName().toLowerCase());
|
this.text = AbstractComponent.literal(subConfig.getClass().getSimpleName().toLowerCase());
|
||||||
this.hideReset();
|
this.hideReset();
|
||||||
super.render(minecraft, font, x, y, width, height, matrices, mouseX, mouseY, delta);
|
super.render(minecraft, font, x, y, width, height, matrices, mouseX, mouseY, delta);
|
||||||
}
|
}
|
||||||
|
@@ -1,5 +1,6 @@
|
|||||||
package com.hypherionmc.craterlib.client.gui.config.widgets;
|
package com.hypherionmc.craterlib.client.gui.config.widgets;
|
||||||
|
|
||||||
|
import com.hypherionmc.craterlib.core.abstraction.text.AbstractComponent;
|
||||||
import net.minecraft.client.gui.components.Button;
|
import net.minecraft.client.gui.components.Button;
|
||||||
import net.minecraft.network.chat.Component;
|
import net.minecraft.network.chat.Component;
|
||||||
|
|
||||||
@@ -18,7 +19,7 @@ public class ToggleButton<T> extends AbstractConfigWidget<T, Button> {
|
|||||||
public ToggleButton(List<T> options, Function<T, Component> toComponent) {
|
public ToggleButton(List<T> options, Function<T, Component> toComponent) {
|
||||||
this.options = options;
|
this.options = options;
|
||||||
this.toComponent = toComponent;
|
this.toComponent = toComponent;
|
||||||
this.widget = addChild(new Button(0, 0, buttonWidth, buttonHeight, Component.empty(), this::switchNext));
|
this.widget = addChild(new Button(0, 0, buttonWidth, buttonHeight, AbstractComponent.empty(), this::switchNext));
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
@@ -1,5 +1,6 @@
|
|||||||
package com.hypherionmc.craterlib.client.gui.widgets;
|
package com.hypherionmc.craterlib.client.gui.widgets;
|
||||||
|
|
||||||
|
import com.hypherionmc.craterlib.core.abstraction.text.AbstractComponent;
|
||||||
import net.minecraft.client.gui.components.AbstractSliderButton;
|
import net.minecraft.client.gui.components.AbstractSliderButton;
|
||||||
import net.minecraft.network.chat.Component;
|
import net.minecraft.network.chat.Component;
|
||||||
|
|
||||||
@@ -35,9 +36,9 @@ public class TimeSliderWidget extends AbstractSliderButton {
|
|||||||
if (this.value * this.maxValue >= 1200) {
|
if (this.value * this.maxValue >= 1200) {
|
||||||
String appendString = (minutes == 1) ? "Minute" : "Minutes";
|
String appendString = (minutes == 1) ? "Minute" : "Minutes";
|
||||||
String doSeconds = ((seconds - (minutes * 60)) > 0) ? ", " + (seconds - (minutes * 60)) + " Seconds" : "";
|
String doSeconds = ((seconds - (minutes * 60)) > 0) ? ", " + (seconds - (minutes * 60)) + " Seconds" : "";
|
||||||
return Component.literal(minutes + " " + appendString + doSeconds);
|
return AbstractComponent.literal(minutes + " " + appendString + doSeconds);
|
||||||
} else {
|
} else {
|
||||||
return Component.literal(seconds + " Seconds");
|
return AbstractComponent.literal(seconds + " Seconds");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@@ -1,12 +1,14 @@
|
|||||||
package com.hypherionmc.craterlib.core.abstraction.server;
|
package com.hypherionmc.craterlib.core.abstraction.server;
|
||||||
|
|
||||||
|
import net.minecraft.Util;
|
||||||
|
import net.minecraft.network.chat.ChatType;
|
||||||
import net.minecraft.network.chat.MutableComponent;
|
import net.minecraft.network.chat.MutableComponent;
|
||||||
import net.minecraft.server.MinecraftServer;
|
import net.minecraft.server.MinecraftServer;
|
||||||
|
|
||||||
public class AbstractServer {
|
public class AbstractServer {
|
||||||
|
|
||||||
public static void broadcastMessage(MinecraftServer server, MutableComponent message) {
|
public static void broadcastMessage(MinecraftServer server, MutableComponent message) {
|
||||||
server.getPlayerList().broadcastSystemMessage(message, false);
|
server.getPlayerList().broadcastMessage(message, ChatType.CHAT, Util.NIL_UUID);
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
@@ -1,23 +1,29 @@
|
|||||||
package com.hypherionmc.craterlib.core.abstraction.text;
|
package com.hypherionmc.craterlib.core.abstraction.text;
|
||||||
|
|
||||||
import net.minecraft.network.chat.Component;
|
import net.minecraft.network.chat.*;
|
||||||
import net.minecraft.network.chat.MutableComponent;
|
|
||||||
import net.minecraft.network.chat.Style;
|
|
||||||
|
|
||||||
public class AbstractComponent {
|
public class AbstractComponent {
|
||||||
|
|
||||||
public static MutableComponent literal(String component) {
|
public static MutableComponent literal(String component) {
|
||||||
return Component.literal(component);
|
return new TextComponent(component);
|
||||||
}
|
}
|
||||||
|
|
||||||
public static MutableComponent translatable(String component) {
|
public static MutableComponent translatable(String component) {
|
||||||
return Component.translatable(component);
|
return new TranslatableComponent(component);
|
||||||
|
}
|
||||||
|
|
||||||
|
public static MutableComponent translatable(String component, Object... objects) {
|
||||||
|
return new TranslatableComponent(component, objects);
|
||||||
}
|
}
|
||||||
|
|
||||||
public static Component safeCopy(Component inComponent) {
|
public static Component safeCopy(Component inComponent) {
|
||||||
String value = inComponent.getString();
|
String value = inComponent.getString();
|
||||||
Style style = inComponent.getStyle();
|
Style style = inComponent.getStyle();
|
||||||
return Component.literal(value).withStyle(style);
|
return new TextComponent(value).withStyle(style);
|
||||||
|
}
|
||||||
|
|
||||||
|
public static Component empty() {
|
||||||
|
return new TextComponent("");
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
@@ -3,10 +3,14 @@ package com.hypherionmc.craterlib.mixin.events;
|
|||||||
import com.google.common.base.Throwables;
|
import com.google.common.base.Throwables;
|
||||||
import com.hypherionmc.craterlib.api.event.server.CraterCommandEvent;
|
import com.hypherionmc.craterlib.api.event.server.CraterCommandEvent;
|
||||||
import com.hypherionmc.craterlib.core.event.CraterEventBus;
|
import com.hypherionmc.craterlib.core.event.CraterEventBus;
|
||||||
|
import com.mojang.brigadier.CommandDispatcher;
|
||||||
import com.mojang.brigadier.ParseResults;
|
import com.mojang.brigadier.ParseResults;
|
||||||
|
import com.mojang.brigadier.StringReader;
|
||||||
import net.minecraft.commands.CommandSourceStack;
|
import net.minecraft.commands.CommandSourceStack;
|
||||||
import net.minecraft.commands.Commands;
|
import net.minecraft.commands.Commands;
|
||||||
|
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.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.callback.CallbackInfoReturnable;
|
import org.spongepowered.asm.mixin.injection.callback.CallbackInfoReturnable;
|
||||||
@@ -14,24 +18,38 @@ import org.spongepowered.asm.mixin.injection.callback.CallbackInfoReturnable;
|
|||||||
@Mixin(Commands.class)
|
@Mixin(Commands.class)
|
||||||
public class CommandMixin {
|
public class CommandMixin {
|
||||||
|
|
||||||
@Inject(method = "performCommand",
|
@Shadow @Final private CommandDispatcher<CommandSourceStack> dispatcher;
|
||||||
at = @At(value = "INVOKE",
|
|
||||||
target = "Lcom/mojang/brigadier/CommandDispatcher;execute(Lcom/mojang/brigadier/ParseResults;)I",
|
@Inject(
|
||||||
shift = At.Shift.BEFORE
|
method = "performCommand",
|
||||||
), cancellable = true
|
at = @At(
|
||||||
|
value = "INVOKE",
|
||||||
|
target = "Lnet/minecraft/util/profiling/ProfilerFiller;push(Ljava/lang/String;)V",
|
||||||
|
shift = At.Shift.AFTER
|
||||||
|
),
|
||||||
|
cancellable = true
|
||||||
)
|
)
|
||||||
private void injectCommandEvent(ParseResults<CommandSourceStack> stackParseResults, String command, CallbackInfoReturnable<Integer> cir) {
|
private void injectCommandEvent(CommandSourceStack stack, String command, CallbackInfoReturnable<Integer> cir) {
|
||||||
CraterCommandEvent commandEvent = new CraterCommandEvent(stackParseResults, command);
|
StringReader stringreader = new StringReader(command);
|
||||||
CraterEventBus.INSTANCE.postEvent(commandEvent);
|
if (stringreader.canRead() && stringreader.peek() == '/') {
|
||||||
if (commandEvent.wasCancelled()) {
|
stringreader.skip();
|
||||||
cir.setReturnValue(1);
|
|
||||||
return;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
if (commandEvent.getException() != null) {
|
try {
|
||||||
Throwables.throwIfUnchecked(commandEvent.getException());
|
ParseResults<CommandSourceStack> parse = dispatcher.parse(stringreader, stack);
|
||||||
cir.setReturnValue(1);
|
|
||||||
}
|
CraterCommandEvent commandEvent = new CraterCommandEvent(parse, command);
|
||||||
|
CraterEventBus.INSTANCE.postEvent(commandEvent);
|
||||||
|
if (commandEvent.wasCancelled()) {
|
||||||
|
cir.setReturnValue(1);
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (commandEvent.getException() != null) {
|
||||||
|
Throwables.throwIfUnchecked(commandEvent.getException());
|
||||||
|
cir.setReturnValue(1);
|
||||||
|
}
|
||||||
|
} catch (Exception ignored) {}
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
@@ -6,6 +6,7 @@ import com.hypherionmc.craterlib.api.event.server.PlayerPreLoginEvent;
|
|||||||
import com.hypherionmc.craterlib.core.event.CraterEventBus;
|
import com.hypherionmc.craterlib.core.event.CraterEventBus;
|
||||||
import com.mojang.authlib.GameProfile;
|
import com.mojang.authlib.GameProfile;
|
||||||
import net.minecraft.network.Connection;
|
import net.minecraft.network.Connection;
|
||||||
|
import net.minecraft.network.chat.ChatType;
|
||||||
import net.minecraft.network.chat.Component;
|
import net.minecraft.network.chat.Component;
|
||||||
import net.minecraft.server.level.ServerPlayer;
|
import net.minecraft.server.level.ServerPlayer;
|
||||||
import net.minecraft.server.players.PlayerList;
|
import net.minecraft.server.players.PlayerList;
|
||||||
@@ -16,15 +17,15 @@ import org.spongepowered.asm.mixin.injection.callback.CallbackInfo;
|
|||||||
import org.spongepowered.asm.mixin.injection.callback.CallbackInfoReturnable;
|
import org.spongepowered.asm.mixin.injection.callback.CallbackInfoReturnable;
|
||||||
|
|
||||||
import java.net.SocketAddress;
|
import java.net.SocketAddress;
|
||||||
import java.util.function.Function;
|
import java.util.UUID;
|
||||||
|
|
||||||
@Mixin(PlayerList.class)
|
@Mixin(PlayerList.class)
|
||||||
public class PlayerListMixin {
|
public class PlayerListMixin {
|
||||||
|
|
||||||
@Inject(method = "broadcastSystemMessage(Lnet/minecraft/network/chat/Component;Ljava/util/function/Function;Z)V", at = @At("HEAD"))
|
@Inject(method = "broadcastMessage(Lnet/minecraft/network/chat/Component;Lnet/minecraft/network/chat/ChatType;Ljava/util/UUID;)V", at = @At("HEAD"))
|
||||||
private void injectBroadcastEvent(Component component, Function<ServerPlayer, Component> function, boolean bl, CallbackInfo ci) {
|
private void injectBroadcast(Component component, ChatType chatType, UUID uUID, CallbackInfo ci) {
|
||||||
String thread = Thread.currentThread().getStackTrace()[3].getClassName();
|
String thread = Thread.currentThread().getStackTrace()[3].getClassName();
|
||||||
MessageBroadcastEvent event = new MessageBroadcastEvent(component, function, bl, thread);
|
MessageBroadcastEvent event = new MessageBroadcastEvent(component, uUID, chatType, thread);
|
||||||
CraterEventBus.INSTANCE.postEvent(event);
|
CraterEventBus.INSTANCE.postEvent(event);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@@ -14,7 +14,7 @@ public class PlayerMixin {
|
|||||||
|
|
||||||
@Inject(method = "die", at = @At("HEAD"), cancellable = true)
|
@Inject(method = "die", at = @At("HEAD"), cancellable = true)
|
||||||
private void injectPlayerDeathEvent(DamageSource damageSource, CallbackInfo ci) {
|
private void injectPlayerDeathEvent(DamageSource damageSource, CallbackInfo ci) {
|
||||||
CraterLivingDeathEvent event = new CraterLivingDeathEvent(((Player) (Object) this), damageSource);
|
CraterLivingDeathEvent event = new CraterLivingDeathEvent(((Player)(Object) this), damageSource);
|
||||||
CraterEventBus.INSTANCE.postEvent(event);
|
CraterEventBus.INSTANCE.postEvent(event);
|
||||||
if (event.wasCancelled())
|
if (event.wasCancelled())
|
||||||
ci.cancel();
|
ci.cancel();
|
||||||
|
@@ -3,18 +3,15 @@ package com.hypherionmc.craterlib.mixin.events;
|
|||||||
import com.hypherionmc.craterlib.api.event.server.CraterServerChatEvent;
|
import com.hypherionmc.craterlib.api.event.server.CraterServerChatEvent;
|
||||||
import com.hypherionmc.craterlib.core.event.CraterEventBus;
|
import com.hypherionmc.craterlib.core.event.CraterEventBus;
|
||||||
import net.minecraft.network.chat.Component;
|
import net.minecraft.network.chat.Component;
|
||||||
import net.minecraft.network.chat.PlayerChatMessage;
|
import net.minecraft.network.chat.TextComponent;
|
||||||
import net.minecraft.server.level.ServerPlayer;
|
import net.minecraft.server.level.ServerPlayer;
|
||||||
import net.minecraft.server.network.FilteredText;
|
|
||||||
import net.minecraft.server.network.ServerGamePacketListenerImpl;
|
import net.minecraft.server.network.ServerGamePacketListenerImpl;
|
||||||
|
import net.minecraft.server.network.TextFilter;
|
||||||
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.callback.CallbackInfo;
|
import org.spongepowered.asm.mixin.injection.callback.CallbackInfo;
|
||||||
import org.spongepowered.asm.mixin.injection.callback.CallbackInfoReturnable;
|
|
||||||
|
|
||||||
import java.util.concurrent.CompletableFuture;
|
|
||||||
|
|
||||||
@Mixin(value = ServerGamePacketListenerImpl.class, priority = Integer.MIN_VALUE)
|
@Mixin(value = ServerGamePacketListenerImpl.class, priority = Integer.MIN_VALUE)
|
||||||
public class ServerGamePacketListenerImplMixin {
|
public class ServerGamePacketListenerImplMixin {
|
||||||
@@ -23,12 +20,16 @@ public class ServerGamePacketListenerImplMixin {
|
|||||||
public ServerPlayer player;
|
public ServerPlayer player;
|
||||||
|
|
||||||
@Inject(
|
@Inject(
|
||||||
method = "lambda$handleChat$9",
|
method = "handleChat(Lnet/minecraft/server/network/TextFilter$FilteredText;)V",
|
||||||
at = @At("HEAD"),
|
at = @At(value = "INVOKE", target = "Lnet/minecraft/server/network/TextFilter$FilteredText;getFiltered()Ljava/lang/String;"),
|
||||||
cancellable = true
|
cancellable = true
|
||||||
)
|
)
|
||||||
private void injectChatEvent(PlayerChatMessage arg, CallbackInfoReturnable<CompletableFuture> ci) {
|
private void injectChatEvent(TextFilter.FilteredText arg, CallbackInfo ci) {
|
||||||
CraterServerChatEvent event = new CraterServerChatEvent(this.player, arg.serverContent().getString(), arg.serverContent());
|
Component message = new TextComponent(arg.getRaw());
|
||||||
|
if (message.getString().startsWith("/"))
|
||||||
|
return;
|
||||||
|
|
||||||
|
CraterServerChatEvent event = new CraterServerChatEvent(this.player, arg.getFiltered(), message);
|
||||||
CraterEventBus.INSTANCE.postEvent(event);
|
CraterEventBus.INSTANCE.postEvent(event);
|
||||||
if (event.wasCancelled())
|
if (event.wasCancelled())
|
||||||
ci.cancel();
|
ci.cancel();
|
||||||
|
@@ -1,5 +1,6 @@
|
|||||||
package com.hypherionmc.craterlib.util;
|
package com.hypherionmc.craterlib.util;
|
||||||
|
|
||||||
|
import com.hypherionmc.craterlib.core.abstraction.text.AbstractComponent;
|
||||||
import net.minecraft.ChatFormatting;
|
import net.minecraft.ChatFormatting;
|
||||||
import net.minecraft.network.chat.Component;
|
import net.minecraft.network.chat.Component;
|
||||||
|
|
||||||
@@ -10,19 +11,19 @@ import net.minecraft.network.chat.Component;
|
|||||||
public class LangUtils {
|
public class LangUtils {
|
||||||
|
|
||||||
public static Component getTooltipTitle(String key) {
|
public static Component getTooltipTitle(String key) {
|
||||||
return Component.literal(ChatFormatting.YELLOW + Component.translatable(key).getString());
|
return AbstractComponent.literal(ChatFormatting.YELLOW + AbstractComponent.translatable(key).getString());
|
||||||
}
|
}
|
||||||
|
|
||||||
public static String resolveTranslation(String key) {
|
public static String resolveTranslation(String key) {
|
||||||
return Component.translatable(key).getString();
|
return AbstractComponent.translatable(key).getString();
|
||||||
}
|
}
|
||||||
|
|
||||||
public static Component getTranslation(String key) {
|
public static Component getTranslation(String key) {
|
||||||
return Component.translatable(key);
|
return AbstractComponent.translatable(key);
|
||||||
}
|
}
|
||||||
|
|
||||||
public static Component makeComponent(String text) {
|
public static Component makeComponent(String text) {
|
||||||
return Component.translatable(text);
|
return AbstractComponent.translatable(text);
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
@@ -1,5 +1,6 @@
|
|||||||
package com.hypherionmc.craterlib.util;
|
package com.hypherionmc.craterlib.util;
|
||||||
|
|
||||||
|
import com.hypherionmc.craterlib.core.abstraction.text.AbstractComponent;
|
||||||
import com.mojang.math.Vector4f;
|
import com.mojang.math.Vector4f;
|
||||||
import net.minecraft.ChatFormatting;
|
import net.minecraft.ChatFormatting;
|
||||||
import net.minecraft.network.chat.Component;
|
import net.minecraft.network.chat.Component;
|
||||||
@@ -26,7 +27,7 @@ public class RenderUtils {
|
|||||||
amount = amount / 81;
|
amount = amount / 81;
|
||||||
capacity = capacity / 81;
|
capacity = capacity / 81;
|
||||||
String text = String.valueOf((int) (((float) amount / capacity) * 100));
|
String text = String.valueOf((int) (((float) amount / capacity) * 100));
|
||||||
return amount > 0 ? Component.literal(ChatFormatting.AQUA + text + "%") : Component.literal(text + "%");
|
return amount > 0 ? AbstractComponent.literal(ChatFormatting.AQUA + text + "%") : AbstractComponent.literal(text + "%");
|
||||||
}
|
}
|
||||||
|
|
||||||
public static Component getTimeDisplayString(double value) {
|
public static Component getTimeDisplayString(double value) {
|
||||||
@@ -35,21 +36,12 @@ public class RenderUtils {
|
|||||||
if (seconds >= 60) {
|
if (seconds >= 60) {
|
||||||
String appendString = (minutes == 1) ? "Minute" : "Minutes";
|
String appendString = (minutes == 1) ? "Minute" : "Minutes";
|
||||||
String doSeconds = ((seconds - (minutes * 60)) > 0) ? ", " + (seconds - (minutes * 60)) + " Seconds" : "";
|
String doSeconds = ((seconds - (minutes * 60)) > 0) ? ", " + (seconds - (minutes * 60)) + " Seconds" : "";
|
||||||
return Component.literal(minutes + " " + appendString + doSeconds);
|
return AbstractComponent.literal(minutes + " " + appendString + doSeconds);
|
||||||
} else {
|
} else {
|
||||||
return Component.literal(seconds + " Seconds");
|
return AbstractComponent.literal(seconds + " Seconds");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public static int renderColorFromDye(DyeColor color) {
|
|
||||||
return color.getMaterialColor().col | 0xFF000000;
|
|
||||||
}
|
|
||||||
|
|
||||||
public static int alphaColorFromDye(DyeColor color, float alpha) {
|
|
||||||
float[] colors = color.getTextureDiffuseColors();
|
|
||||||
return new Color(colors[0], colors[1], colors[2], alpha).getRGB();
|
|
||||||
}
|
|
||||||
|
|
||||||
public static class ARGB32 {
|
public static class ARGB32 {
|
||||||
public static int alpha(int pPackedColor) {
|
public static int alpha(int pPackedColor) {
|
||||||
return pPackedColor >>> 24;
|
return pPackedColor >>> 24;
|
||||||
@@ -67,4 +59,13 @@ public class RenderUtils {
|
|||||||
return pPackedColor & 255;
|
return pPackedColor & 255;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public static int renderColorFromDye(DyeColor color) {
|
||||||
|
return color.getMaterialColor().col | 0xFF000000;
|
||||||
|
}
|
||||||
|
|
||||||
|
public static int alphaColorFromDye(DyeColor color, float alpha) {
|
||||||
|
float[] colors = color.getTextureDiffuseColors();
|
||||||
|
return new Color(colors[0], colors[1], colors[2], alpha).getRGB();
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
@@ -1,6 +1,6 @@
|
|||||||
{
|
{
|
||||||
"pack": {
|
"pack": {
|
||||||
"description": "${mod_name}",
|
"description": "${mod_name}",
|
||||||
"pack_format": 18
|
"pack_format": 8
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@@ -7,7 +7,7 @@ dependencies {
|
|||||||
shade "me.hypherionmc.moon-config:core:${moon_config}"
|
shade "me.hypherionmc.moon-config:core:${moon_config}"
|
||||||
shade "me.hypherionmc.moon-config:toml:${moon_config}"
|
shade "me.hypherionmc.moon-config:toml:${moon_config}"
|
||||||
shade "com.hypherionmc:rpcsdk:1.0"
|
shade "com.hypherionmc:rpcsdk:1.0"
|
||||||
shade ("me.hypherionmc.sdlink:mcdiscordformatter-1.19.1:2.0.0")
|
shade ("me.hypherionmc.sdlink:mcdiscordformatter-1.18.1:2.0.0")
|
||||||
|
|
||||||
modImplementation("com.terraformersmc:modmenu:${mod_menu_version}") {
|
modImplementation("com.terraformersmc:modmenu:${mod_menu_version}") {
|
||||||
exclude(group: "net.fabricmc.fabric-api")
|
exclude(group: "net.fabricmc.fabric-api")
|
||||||
@@ -116,8 +116,8 @@ publisher {
|
|||||||
versionType = "release"
|
versionType = "release"
|
||||||
changelog = "https://raw.githubusercontent.com/hypherionmc/changelogs/main/craterlib/changelog-fabric.md"
|
changelog = "https://raw.githubusercontent.com/hypherionmc/changelogs/main/craterlib/changelog-fabric.md"
|
||||||
version = "${minecraft_version}-${project.version}"
|
version = "${minecraft_version}-${project.version}"
|
||||||
displayName = "[FABRIC/QUILT 1.19.2] CraterLib - ${project.version}"
|
displayName = "[FABRIC/QUILT 1.18.2] CraterLib - ${project.version}"
|
||||||
gameVersions = ["1.19.2"]
|
gameVersions = ["1.18.2"]
|
||||||
loaders = ["fabric", "quilt"]
|
loaders = ["fabric", "quilt"]
|
||||||
artifact = remapJar
|
artifact = remapJar
|
||||||
|
|
||||||
|
@@ -5,7 +5,7 @@ import com.hypherionmc.craterlib.api.event.server.CraterServerLifecycleEvent;
|
|||||||
import com.hypherionmc.craterlib.common.FabricCommonPlatform;
|
import com.hypherionmc.craterlib.common.FabricCommonPlatform;
|
||||||
import com.hypherionmc.craterlib.core.event.CraterEventBus;
|
import com.hypherionmc.craterlib.core.event.CraterEventBus;
|
||||||
import net.fabricmc.api.ModInitializer;
|
import net.fabricmc.api.ModInitializer;
|
||||||
import net.fabricmc.fabric.api.command.v2.CommandRegistrationCallback;
|
import net.fabricmc.fabric.api.command.v1.CommandRegistrationCallback;
|
||||||
import net.fabricmc.fabric.api.event.lifecycle.v1.ServerLifecycleEvents;
|
import net.fabricmc.fabric.api.event.lifecycle.v1.ServerLifecycleEvents;
|
||||||
|
|
||||||
public class CraterLibInitializer implements ModInitializer {
|
public class CraterLibInitializer implements ModInitializer {
|
||||||
@@ -13,7 +13,7 @@ public class CraterLibInitializer implements ModInitializer {
|
|||||||
@Override
|
@Override
|
||||||
public void onInitialize() {
|
public void onInitialize() {
|
||||||
CommandRegistrationCallback.EVENT.register(
|
CommandRegistrationCallback.EVENT.register(
|
||||||
(dispatcher, registryAccess, environment) -> CraterEventBus.INSTANCE.postEvent(new CraterRegisterCommandEvent(dispatcher)));
|
(dispatcher, registryAccess) -> CraterEventBus.INSTANCE.postEvent(new CraterRegisterCommandEvent(dispatcher)));
|
||||||
|
|
||||||
|
|
||||||
ServerLifecycleEvents.SERVER_STARTING.register(server -> {
|
ServerLifecycleEvents.SERVER_STARTING.register(server -> {
|
||||||
|
@@ -33,7 +33,7 @@
|
|||||||
"depends": {
|
"depends": {
|
||||||
"fabricloader": ">=0.14.21",
|
"fabricloader": ">=0.14.21",
|
||||||
"fabric-api": "*",
|
"fabric-api": "*",
|
||||||
"minecraft": "1.19.2",
|
"minecraft": "1.18.2",
|
||||||
"java": ">=17"
|
"java": ">=17"
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@@ -5,7 +5,7 @@ dependencies {
|
|||||||
shade "me.hypherionmc.moon-config:core:${moon_config}"
|
shade "me.hypherionmc.moon-config:core:${moon_config}"
|
||||||
shade "me.hypherionmc.moon-config:toml:${moon_config}"
|
shade "me.hypherionmc.moon-config:toml:${moon_config}"
|
||||||
shade "com.hypherionmc:rpcsdk:1.0"
|
shade "com.hypherionmc:rpcsdk:1.0"
|
||||||
shade ("me.hypherionmc.sdlink:mcdiscordformatter-1.19.1:2.0.0")
|
shade ("me.hypherionmc.sdlink:mcdiscordformatter-1.18.1:2.0.0")
|
||||||
|
|
||||||
// Do not edit or remove
|
// Do not edit or remove
|
||||||
implementation project(":Common")
|
implementation project(":Common")
|
||||||
@@ -111,8 +111,8 @@ publisher {
|
|||||||
versionType = "release"
|
versionType = "release"
|
||||||
changelog = "https://raw.githubusercontent.com/hypherionmc/changelogs/main/craterlib/changelog-forge.md"
|
changelog = "https://raw.githubusercontent.com/hypherionmc/changelogs/main/craterlib/changelog-forge.md"
|
||||||
version = "${minecraft_version}-${project.version}"
|
version = "${minecraft_version}-${project.version}"
|
||||||
displayName = "[FORGE 1.19.2] CraterLib - ${project.version}"
|
displayName = "[FORGE 1.18.2] CraterLib - ${project.version}"
|
||||||
gameVersions = ["1.19.2"]
|
gameVersions = ["1.18.2"]
|
||||||
loaders = ["forge"]
|
loaders = ["forge"]
|
||||||
artifact = remapJar
|
artifact = remapJar
|
||||||
}
|
}
|
@@ -13,7 +13,7 @@ import net.minecraftforge.fml.common.Mod;
|
|||||||
public class ForgeClientEvents {
|
public class ForgeClientEvents {
|
||||||
|
|
||||||
@SubscribeEvent
|
@SubscribeEvent
|
||||||
public static void clientTick(TickEvent.LevelTickEvent event) {
|
public static void clientTick(TickEvent.WorldTickEvent event) {
|
||||||
CraterClientTickEvent craterClientTickEvent = new CraterClientTickEvent(Minecraft.getInstance().level);
|
CraterClientTickEvent craterClientTickEvent = new CraterClientTickEvent(Minecraft.getInstance().level);
|
||||||
CraterEventBus.INSTANCE.postEvent(craterClientTickEvent);
|
CraterEventBus.INSTANCE.postEvent(craterClientTickEvent);
|
||||||
}
|
}
|
||||||
|
@@ -6,7 +6,7 @@ import com.hypherionmc.craterlib.core.config.ModuleConfig;
|
|||||||
import com.hypherionmc.craterlib.core.config.annotations.NoConfigScreen;
|
import com.hypherionmc.craterlib.core.config.annotations.NoConfigScreen;
|
||||||
import net.minecraft.client.Minecraft;
|
import net.minecraft.client.Minecraft;
|
||||||
import net.minecraft.client.gui.screens.Screen;
|
import net.minecraft.client.gui.screens.Screen;
|
||||||
import net.minecraftforge.client.ConfigScreenHandler;
|
import net.minecraftforge.client.ConfigGuiHandler;
|
||||||
import net.minecraftforge.forgespi.language.IModInfo;
|
import net.minecraftforge.forgespi.language.IModInfo;
|
||||||
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;
|
||||||
@@ -19,7 +19,7 @@ import java.util.function.BiFunction;
|
|||||||
/**
|
/**
|
||||||
* @author HypherionSA
|
* @author HypherionSA
|
||||||
*/
|
*/
|
||||||
@Mixin(ConfigScreenHandler.class)
|
@Mixin(ConfigGuiHandler.class)
|
||||||
public class ConfigScreenHandlerMixin {
|
public class ConfigScreenHandlerMixin {
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@@ -28,7 +28,7 @@ public class ConfigScreenHandlerMixin {
|
|||||||
* @param selectedMod
|
* @param selectedMod
|
||||||
* @param cir
|
* @param cir
|
||||||
*/
|
*/
|
||||||
@Inject(at = @At("RETURN"), method = "getScreenFactoryFor", cancellable = true, remap = false)
|
@Inject(at = @At("RETURN"), method = "getGuiFactoryFor", cancellable = true, remap = false)
|
||||||
private static void injectConfigScreen(IModInfo selectedMod, CallbackInfoReturnable<Optional<BiFunction<Minecraft, Screen, Screen>>> cir) {
|
private static void injectConfigScreen(IModInfo selectedMod, CallbackInfoReturnable<Optional<BiFunction<Minecraft, Screen, Screen>>> cir) {
|
||||||
ConfigController.getMonitoredConfigs().forEach((conf, watcher) -> {
|
ConfigController.getMonitoredConfigs().forEach((conf, watcher) -> {
|
||||||
if (!conf.getClass().isAnnotationPresent(NoConfigScreen.class)) {
|
if (!conf.getClass().isAnnotationPresent(NoConfigScreen.class)) {
|
||||||
|
@@ -1,5 +1,5 @@
|
|||||||
modLoader = "javafml"
|
modLoader = "javafml"
|
||||||
loaderVersion = "[43,)"
|
loaderVersion = "[40,)"
|
||||||
license = "MIT"
|
license = "MIT"
|
||||||
issueTrackerURL = "https://github.com/firstdarkdev/craterLib/issues"
|
issueTrackerURL = "https://github.com/firstdarkdev/craterLib/issues"
|
||||||
|
|
||||||
@@ -19,13 +19,13 @@ displayTest = "MATCH_VERSION"
|
|||||||
[[dependencies.${mod_id}]]
|
[[dependencies.${mod_id}]]
|
||||||
modId = "forge"
|
modId = "forge"
|
||||||
mandatory = true
|
mandatory = true
|
||||||
versionRange = "[43,)"
|
versionRange = "[40,)"
|
||||||
ordering = "NONE"
|
ordering = "NONE"
|
||||||
side = "BOTH"
|
side = "BOTH"
|
||||||
|
|
||||||
[[dependencies.${mod_id}]]
|
[[dependencies.${mod_id}]]
|
||||||
modId = "minecraft"
|
modId = "minecraft"
|
||||||
mandatory = true
|
mandatory = true
|
||||||
versionRange = "[1.19.2,1.19.3)"
|
versionRange = "[1.18.2,1.19)"
|
||||||
ordering = "NONE"
|
ordering = "NONE"
|
||||||
side = "BOTH"
|
side = "BOTH"
|
||||||
|
@@ -10,17 +10,17 @@ mod_id=craterlib
|
|||||||
mod_name=CraterLib
|
mod_name=CraterLib
|
||||||
|
|
||||||
# Shared
|
# Shared
|
||||||
minecraft_version=1.19.2
|
minecraft_version=1.18.2
|
||||||
|
|
||||||
# Fabric
|
# Fabric
|
||||||
fabric_api=0.76.0+1.19.2
|
fabric_api=0.76.0+1.18.2
|
||||||
fabric_loader=0.14.21
|
fabric_loader=0.14.21
|
||||||
|
|
||||||
# Forge
|
# Forge
|
||||||
forge_version=43.2.0
|
forge_version=40.2.0
|
||||||
|
|
||||||
# Dependencies
|
# Dependencies
|
||||||
mod_menu_version=4.2.0-beta.2
|
mod_menu_version=3.2.5
|
||||||
moon_config=1.0.9
|
moon_config=1.0.9
|
||||||
|
|
||||||
# Publishing
|
# Publishing
|
||||||
|
Reference in New Issue
Block a user