7 Commits

23 changed files with 74 additions and 62 deletions

View File

@@ -9,7 +9,7 @@ pipeline {
stage("Notify Discord") {
steps {
discordSend webhookURL: env.FDD_WH_ADMIN,
title: "Deploy Started: CraterLib 1.20 Deploy #${BUILD_NUMBER}",
title: "Deploy Started: CraterLib 1.19.3/4 Deploy #${BUILD_NUMBER}",
link: env.BUILD_URL,
result: 'SUCCESS',
description: "Build: [${BUILD_NUMBER}](${env.BUILD_URL})"
@@ -38,7 +38,7 @@ pipeline {
deleteDir()
discordSend webhookURL: env.FDD_WH_ADMIN,
title: "CraterLib 1.20 Deploy #${BUILD_NUMBER}",
title: "CraterLib 1.19.3/4 Deploy #${BUILD_NUMBER}",
link: env.BUILD_URL,
result: currentBuild.currentResult,
description: "Build: [${BUILD_NUMBER}](${env.BUILD_URL})\nStatus: ${currentBuild.currentResult}"

View File

@@ -13,7 +13,7 @@ pipeline {
stage("Notify Discord") {
steps {
discordSend webhookURL: env.SSS_WEBHOOK,
title: "Deploy Started: ${projectName} 1.20.1/2 Deploy #${BUILD_NUMBER}",
title: "Deploy Started: ${projectName} 1.19.3/4 Deploy #${BUILD_NUMBER}",
link: env.BUILD_URL,
result: 'SUCCESS',
description: "Build: [${BUILD_NUMBER}](${env.BUILD_URL})"
@@ -51,10 +51,10 @@ pipeline {
projectSlug: "craterlib",
projectName: "${projectName}",
projectIcon: "${projectIcon}",
versionName: "Snapshot 1.0.${BUILD_NUMBER}",
version: "1.0.${BUILD_NUMBER}",
versionName: "Snapshot 1.1.${BUILD_NUMBER}",
version: "1.1.${BUILD_NUMBER}",
modLoaders: "forge|fabric|quilt",
minecraftVersions: "1.20|1.20.1",
minecraftVersions: "1.19.3|1.19.4",
failWebhook: env.SSS_WEBHOOK,
publishWebhooks: "${env.SSS_WEBHOOK}|${env.FDD_WH}"

View File

@@ -11,11 +11,13 @@ public class MessageBroadcastEvent extends CraterEvent {
private final Component component;
private final Function<ServerPlayer, Component> function;
private final boolean bl;
private final String threadName;
public MessageBroadcastEvent(Component component, Function<ServerPlayer, Component> function, boolean bl) {
public MessageBroadcastEvent(Component component, Function<ServerPlayer, Component> function, boolean bl, String threadName) {
this.component = component;
this.function = function;
this.bl = bl;
this.threadName = threadName;
}
public Component getComponent() {
@@ -30,6 +32,10 @@ public class MessageBroadcastEvent extends CraterEvent {
return function;
}
public String getThreadName() {
return threadName;
}
@Override
public boolean canCancel() {
return false;

View File

@@ -11,7 +11,6 @@ import com.mojang.blaze3d.vertex.*;
import me.hypherionmc.moonconfig.core.conversion.SpecComment;
import net.minecraft.ChatFormatting;
import net.minecraft.client.gui.Font;
import net.minecraft.client.gui.GuiGraphics;
import net.minecraft.client.gui.screens.ConfirmScreen;
import net.minecraft.client.gui.screens.Screen;
import net.minecraft.client.renderer.GameRenderer;
@@ -177,19 +176,19 @@ public class CraterConfigScreen extends Screen {
}
@Override
public void render(@NotNull GuiGraphics matrices, int mouseX, int mouseY, float delta) {
overlayBackground(matrices.pose(), TOP, height - BOTTOM, 32);
public void render(@NotNull PoseStack matrices, int mouseX, int mouseY, float delta) {
overlayBackground(matrices, TOP, height - BOTTOM, 32);
renderScrollBar();
matrices.pose().pushPose();
matrices.pose().translate(0, 0, 500.0);
overlayBackground(matrices.pose(), 0, TOP, 64);
overlayBackground(matrices.pose(), height - BOTTOM, height, 64);
renderShadow(matrices.pose());
matrices.drawCenteredString(font, getTitle(), width / 2, 9, 0xFFFFFF);
matrices.pushPose();
matrices.translate(0, 0, 500.0);
overlayBackground(matrices, 0, TOP, 64);
overlayBackground(matrices, height - BOTTOM, height, 64);
renderShadow(matrices);
drawCenteredString(matrices, font, getTitle(), width / 2, 9, 0xFFFFFF);
super.render(matrices, mouseX, mouseY, delta);
matrices.pose().popPose();
matrices.popPose();
int y = (int) (TOP + 4 - Math.round(scrollerAmount));
for (Option<?> option : options) {
@@ -379,7 +378,7 @@ public class CraterConfigScreen extends Screen {
}
}
private void renderConfigTooltip(GuiGraphics stack, Font font, int mouseX, int mouseY, int startX, int startY, int sizeX, int sizeY, String title, String... description) {
private void renderConfigTooltip(PoseStack stack, Font font, int mouseX, int mouseY, int startX, int startY, int sizeX, int sizeY, String title, String... description) {
if (mouseX > startX && mouseX < startX + sizeX) {
if (mouseY > startY && mouseY < startY + sizeY) {
List<Component> list = new ArrayList<>();
@@ -387,7 +386,7 @@ public class CraterConfigScreen extends Screen {
for (String desc : description) {
list.add(Component.translatable(desc));
}
stack.renderComponentTooltip(font, list, mouseX, mouseY);
renderComponentTooltip(stack, list, mouseX, mouseY);
}
}
}

View File

@@ -1,8 +1,8 @@
package com.hypherionmc.craterlib.client.gui.config.widgets;
import com.mojang.blaze3d.vertex.PoseStack;
import net.minecraft.client.Minecraft;
import net.minecraft.client.gui.Font;
import net.minecraft.client.gui.GuiGraphics;
import net.minecraft.client.gui.components.AbstractWidget;
import net.minecraft.client.gui.components.EditBox;
@@ -17,7 +17,7 @@ public class AbstractConfigWidget<T, W extends AbstractWidget> extends BaseWidge
public W widget;
@Override
public void render(Minecraft minecraft, Font font, int x, int y, int width, int height, GuiGraphics 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) {
super.render(minecraft, font, x, y, width, height, matrices, mouseX, mouseY, delta);
int i = (widget instanceof EditBox ? 1 : 0);
widget.setX(x + width - 200 - resetButtonOffset + i);

View File

@@ -1,9 +1,9 @@
package com.hypherionmc.craterlib.client.gui.config.widgets;
import com.mojang.blaze3d.vertex.PoseStack;
import net.minecraft.ChatFormatting;
import net.minecraft.client.Minecraft;
import net.minecraft.client.gui.Font;
import net.minecraft.client.gui.GuiGraphics;
import net.minecraft.client.gui.components.Button;
import net.minecraft.network.chat.Component;
import net.minecraft.network.chat.MutableComponent;
@@ -39,7 +39,7 @@ public class BaseWidget<T> extends Option<T> {
}
@Override
public void render(Minecraft minecraft, Font font, int x, int y, int width, int height, GuiGraphics 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());
boolean edited = isEdited() || hasErrors;
if (edited) {
@@ -50,7 +50,7 @@ public class BaseWidget<T> extends Option<T> {
} else {
text.withStyle(ChatFormatting.GRAY);
}
matrices.drawString(font, text, x, y, 0xFFFFFF);
font.draw(matrices, text, x, y, 0xFFFFFF);
resetButton.setX(x + width - 46);
resetButton.setY(y + 1);
resetButton.active = isNotDefault();

View File

@@ -1,7 +1,7 @@
package com.hypherionmc.craterlib.client.gui.config.widgets;
import com.hypherionmc.craterlib.client.gui.config.CraterConfigScreen;
import net.minecraft.client.gui.GuiGraphics;
import com.mojang.blaze3d.vertex.PoseStack;
import net.minecraft.client.gui.components.AbstractButton;
import net.minecraft.client.gui.narration.NarratedElementType;
import net.minecraft.client.gui.narration.NarrationElementOutput;
@@ -23,7 +23,7 @@ public class InternalConfigButton extends AbstractButton {
}
@Override
public void render(@NotNull GuiGraphics poseStack, int i, int j, float f) {
public void render(@NotNull PoseStack poseStack, int i, int j, float f) {
if (cancel) {
setMessage(Component.translatable(screen.isEdited() ? "t.clc.cancel_discard" : "gui.cancel"));
} else {

View File

@@ -1,8 +1,8 @@
package com.hypherionmc.craterlib.client.gui.config.widgets;
import com.mojang.blaze3d.vertex.PoseStack;
import net.minecraft.client.Minecraft;
import net.minecraft.client.gui.Font;
import net.minecraft.client.gui.GuiGraphics;
import net.minecraft.client.gui.components.events.AbstractContainerEventHandler;
import net.minecraft.client.gui.components.events.GuiEventListener;
import net.minecraft.network.chat.Component;
@@ -38,7 +38,7 @@ public abstract class Option<T> extends AbstractContainerEventHandler {
this.langKeys = langKeys;
}
public abstract void render(Minecraft minecraft, Font font, int x, int y, int width, int height, GuiGraphics matrices, int mouseX, int mouseY, float delta);
public abstract void render(Minecraft minecraft, Font font, int x, int y, int width, int height, PoseStack matrices, int mouseX, int mouseY, float delta);
public int height() {
return 22;

View File

@@ -2,9 +2,9 @@ package com.hypherionmc.craterlib.client.gui.config.widgets;
import com.hypherionmc.craterlib.client.gui.config.CraterConfigScreen;
import com.hypherionmc.craterlib.core.config.ModuleConfig;
import com.mojang.blaze3d.vertex.PoseStack;
import net.minecraft.client.Minecraft;
import net.minecraft.client.gui.Font;
import net.minecraft.client.gui.GuiGraphics;
import net.minecraft.client.gui.components.Button;
import net.minecraft.client.gui.screens.Screen;
import net.minecraft.network.chat.Component;
@@ -27,7 +27,7 @@ public class SubConfigWidget<T> extends AbstractConfigWidget<T, Button> {
}
@Override
public void render(Minecraft minecraft, Font font, int x, int y, int width, int height, GuiGraphics 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.hideReset();
super.render(minecraft, font, x, y, width, height, matrices, mouseX, mouseY, delta);

View File

@@ -1,8 +1,8 @@
package com.hypherionmc.craterlib.client.gui.config.widgets;
import com.mojang.blaze3d.vertex.PoseStack;
import net.minecraft.client.Minecraft;
import net.minecraft.client.gui.Font;
import net.minecraft.client.gui.GuiGraphics;
import java.util.function.Function;
@@ -29,7 +29,7 @@ public class TextConfigOption<T> extends AbstractConfigWidget<T, WrappedEditBox>
}
@Override
public void render(Minecraft minecraft, Font font, int x, int y, int width, int height, GuiGraphics 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) {
widget.setTextColor(hasErrors ? 16733525 : 14737632);
super.render(minecraft, font, x, y, width, height, matrices, mouseX, mouseY, delta);
}

View File

@@ -21,7 +21,7 @@ public class WrappedEditBox extends EditBox {
for (GuiEventListener child : Minecraft.getInstance().screen.children()) {
if (child instanceof TextConfigOption<?> option) {
WrappedEditBox box = option.widget;
super.setFocused(box == this);
box.setFocused(box == this);
}
}
super.setFocused(bl);

View File

@@ -7,7 +7,7 @@ import net.minecraft.network.chat.MutableComponent;
public class AbstractCommand {
public static void replySuccess(CommandContext<CommandSourceStack> stack, MutableComponent message) {
stack.getSource().sendSuccess(() -> message, false);
stack.getSource().sendSuccess(message, false);
}
public static void replyFailure(CommandContext<CommandSourceStack> stack, MutableComponent message) {

View File

@@ -25,13 +25,13 @@ public class AbstractFakePlayer extends CommandSourceStack {
}
@Override
public void sendSuccess(Supplier<Component> component, boolean bl) {
this.onSuccess(component.get(), bl);
public void sendSuccess(Component component, boolean bl) {
this.onSuccess(component, bl);
}
@Override
public void sendFailure(Component component) {
sendSuccess(() -> component, false);
sendSuccess(component, false);
}
public UUID getUuid() {

View File

@@ -18,10 +18,8 @@ public class PlayerAdvancementsMixin {
@Inject(method = "award", at = @At(value = "INVOKE", target = "Lnet/minecraft/advancements/AdvancementRewards;grant(Lnet/minecraft/server/level/ServerPlayer;)V", shift = At.Shift.AFTER))
private void injectAdvancementEvent(Advancement advancement, String $$1, CallbackInfoReturnable<Boolean> cir) {
CraterAdvancementEvent event = new CraterAdvancementEvent(this.player, advancement);
if (advancement.getDisplay() != null && advancement.getDisplay().shouldAnnounceChat()) {
CraterEventBus.INSTANCE.postEvent(event);
CraterEventBus.INSTANCE.postEvent(new CraterAdvancementEvent(this.player, advancement));
}
}
}

View File

@@ -23,7 +23,8 @@ public class PlayerListMixin {
@Inject(method = "broadcastSystemMessage(Lnet/minecraft/network/chat/Component;Ljava/util/function/Function;Z)V", at = @At("HEAD"))
private void injectBroadcastEvent(Component component, Function<ServerPlayer, Component> function, boolean bl, CallbackInfo ci) {
MessageBroadcastEvent event = new MessageBroadcastEvent(component, function, bl);
String thread = Thread.currentThread().getStackTrace()[3].getClassName();
MessageBroadcastEvent event = new MessageBroadcastEvent(component, function, bl, thread);
CraterEventBus.INSTANCE.postEvent(event);
}

View File

@@ -2,8 +2,10 @@ package com.hypherionmc.craterlib.mixin.events;
import com.hypherionmc.craterlib.api.event.server.CraterServerChatEvent;
import com.hypherionmc.craterlib.core.event.CraterEventBus;
import net.minecraft.network.chat.Component;
import net.minecraft.network.chat.PlayerChatMessage;
import net.minecraft.server.level.ServerPlayer;
import net.minecraft.server.network.FilteredText;
import net.minecraft.server.network.ServerGamePacketListenerImpl;
import org.spongepowered.asm.mixin.Mixin;
import org.spongepowered.asm.mixin.Shadow;
@@ -11,15 +13,21 @@ import org.spongepowered.asm.mixin.injection.At;
import org.spongepowered.asm.mixin.injection.Inject;
import org.spongepowered.asm.mixin.injection.callback.CallbackInfo;
@Mixin(ServerGamePacketListenerImpl.class)
import java.util.concurrent.CompletableFuture;
@Mixin(value = ServerGamePacketListenerImpl.class, priority = Integer.MIN_VALUE)
public class ServerGamePacketListenerImplMixin {
@Shadow
public ServerPlayer player;
@Inject(method = "broadcastChatMessage", at = @At("HEAD"), cancellable = true)
private void injectChatEvent(PlayerChatMessage chatMessage, CallbackInfo ci) {
CraterServerChatEvent event = new CraterServerChatEvent(this.player, chatMessage.decoratedContent().getString(), chatMessage.decoratedContent());
@Inject(
method = "lambda$handleChat$8",
at = @At("HEAD"),
cancellable = true
)
private void injectChatEvent(PlayerChatMessage arg, CompletableFuture completableFuture, CompletableFuture completableFuture2, Void void_, CallbackInfo ci) {
CraterServerChatEvent event = new CraterServerChatEvent(this.player, arg.decoratedContent().getString(), arg.decoratedContent());
CraterEventBus.INSTANCE.postEvent(event);
if (event.wasCancelled())
ci.cancel();

View File

@@ -4,18 +4,18 @@ import com.hypherionmc.craterlib.api.event.client.ScreenEvent;
import com.hypherionmc.craterlib.core.event.CraterEventBus;
import net.minecraft.client.Minecraft;
import net.minecraft.client.gui.screens.Screen;
import org.jetbrains.annotations.Nullable;
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.Inject;
import org.spongepowered.asm.mixin.injection.callback.CallbackInfo;
import org.jetbrains.annotations.Nullable;
@Mixin(Minecraft.class)
public class MinecraftMixin {
@Shadow @Nullable
public Screen screen;
@Shadow @Nullable public Screen screen;
@Inject(method = "setScreen", at = @At(value = "TAIL"))
private void injectScreenOpeningEvent(Screen screen, CallbackInfo ci) {

View File

@@ -42,7 +42,7 @@ public class RenderUtils {
}
public static int renderColorFromDye(DyeColor color) {
return color.getMapColor().col | 0xFF000000;
return color.getMaterialColor().col | 0xFF000000;
}
public static int alphaColorFromDye(DyeColor color, float alpha) {

View File

@@ -116,8 +116,8 @@ publisher {
versionType = "release"
changelog = "https://raw.githubusercontent.com/hypherionmc/changelogs/main/craterlib/changelog-fabric.md"
version = "${minecraft_version}-${project.version}"
displayName = "[FABRIC/QUILT 1.20.1/2] CraterLib - ${project.version}"
gameVersions = ["1.20", "1.20.1"]
displayName = "[FABRIC/QUILT 1.19.3/4] CraterLib - ${project.version}"
gameVersions = ["1.19.3", "1.19.4"]
loaders = ["fabric", "quilt"]
artifact = remapJar

View File

@@ -33,7 +33,7 @@
"depends": {
"fabricloader": ">=0.14.21",
"fabric-api": "*",
"minecraft": ">=1.20",
"minecraft": ">=1.19.3",
"java": ">=17"
}
}

View File

@@ -111,8 +111,8 @@ publisher {
versionType = "release"
changelog = "https://raw.githubusercontent.com/hypherionmc/changelogs/main/craterlib/changelog-forge.md"
version = "${minecraft_version}-${project.version}"
displayName = "[FORGE 1.20.1/2] CraterLib - ${project.version}"
gameVersions = ["1.20", "1.20.1"]
displayName = "[FORGE 1.19.3/4] CraterLib - ${project.version}"
gameVersions = ["1.19.3", "1.19.4"]
loaders = ["forge"]
artifact = remapJar
}

View File

@@ -1,5 +1,5 @@
modLoader = "javafml"
loaderVersion = "[46,)"
loaderVersion = "[44,)"
license = "MIT"
issueTrackerURL = "https://github.com/firstdarkdev/craterLib/issues"
@@ -19,13 +19,13 @@ displayTest = "MATCH_VERSION"
[[dependencies.${mod_id}]]
modId = "forge"
mandatory = true
versionRange = "[46,)"
versionRange = "[44,)"
ordering = "NONE"
side = "BOTH"
[[dependencies.${mod_id}]]
modId = "minecraft"
mandatory = true
versionRange = "[1.20,1.20.2)"
versionRange = "[1.19.3,1.20)"
ordering = "NONE"
side = "BOTH"

View File

@@ -1,7 +1,7 @@
#Project
version_major=1
version_minor=1
version_patch=0
version_patch=1
project_group=com.hypherionmc.craterlib
#Mod
@@ -10,17 +10,17 @@ mod_id=craterlib
mod_name=CraterLib
# Shared
minecraft_version=1.20
minecraft_version=1.19.3
# Fabric
fabric_loader=0.14.21
fabric_api=0.83.0+1.20
fabric_api=0.76.1+1.19.3
# Forge
forge_version=46.0.1
forge_version=44.1.0
# Dependencies
mod_menu_version=7.0.0-beta.2
mod_menu_version=5.1.0-beta.4
moon_config=1.0.9
# Publishing