Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
14 changes: 7 additions & 7 deletions gradle.properties
Original file line number Diff line number Diff line change
Expand Up @@ -4,19 +4,19 @@ https.protocols=TLSv1.2,TLSv1.3
org.gradle.parallel=true
# Fabric Properties
# check these on https://fabricmc.net/develop
minecraft_version=1.21.6
yarn_mappings=1.21.6+build.1
minecraft_version=1.21.9
yarn_mappings=1.21.9+build.1
loader_version=0.17.3
loom_version=1.11-SNAPSHOT
loom_version=1.12-SNAPSHOT
# Mod Properties
mod_version=1.0.2-1.21.6
mod_version=1.0.2-1.21.9
maven_group=com.jumpcutfindo
archives_base_name=onmymark
# Dependencies
# Fabric API
fabric_version=0.128.2+1.21.6
fabric_version=0.134.0+1.21.9
# modmenu
modmenu_version=15.0.0-beta.3
modmenu_version=16.0.0-rc.1
# owo-lib
# https://maven.wispforest.io/io/wispforest/owo-lib/
owo_version=0.12.21+1.21.6
owo_version=0.12.22+1.21.9
Original file line number Diff line number Diff line change
Expand Up @@ -57,4 +57,7 @@ public class OnMyMarkConfigModel {
@RangeConstraint(min = 1, max = 86400)
@Sync(Option.SyncMode.OVERRIDE_CLIENT)
public long playerMarkerLifetimeSecs = PlayerMarkerRenderer.DEFAULT_LIFETIME_SECS;

@Sync(Option.SyncMode.OVERRIDE_CLIENT)
public boolean enableReportingMessages = true;
}
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,8 @@
import net.minecraft.client.MinecraftClient;
import net.minecraft.client.gui.DrawContext;
import net.minecraft.client.gui.PlayerSkinDrawer;
import net.minecraft.client.util.SkinTextures;
import net.minecraft.client.util.DefaultSkinHelper;
import net.minecraft.entity.player.SkinTextures;
import net.minecraft.util.Colors;
import net.minecraft.util.math.ColorHelper;
import net.minecraft.util.math.MathHelper;
Expand Down Expand Up @@ -47,9 +48,7 @@ protected MarkerRenderer(MinecraftClient client, Marker marker, PointerShape poi

this.creationTime = Instant.now();

this.playerSkinTextures = MinecraftClient.getInstance()
.getSkinProvider()
.getSkinTextures(
this.playerSkinTextures = DefaultSkinHelper.getSkinTextures(
((ClientPartyMember)marker.owner()).gameProfile()
);
}
Expand Down Expand Up @@ -101,7 +100,7 @@ public void renderTick(DrawContext drawContext, float tickDelta, float fovDegree
screenPosNormal = RenderMath.getNormalToEllipse(centerX, centerY, clampWidth / 2f, clampHeight / 2f, screenPos.x(), screenPos.y());

// Calculate and store distance from player
this.distanceFromPlayer = this.client.player.getPos().distanceTo(this.getWorldPos());
this.distanceFromPlayer = this.client.player.getEntityPos().distanceTo(this.getWorldPos());
}

private void clampScreenPosToCircle(DrawContext drawContext) {
Expand Down Expand Up @@ -255,7 +254,7 @@ private void drawPlayerHead(DrawContext drawContext, float screenX, float screen
int headScreenY = (int) (screenY - headSize / 2);

if (this.playerSkinTextures != null) {
PlayerSkinDrawer.draw(drawContext, this.playerSkinTextures.texture(), headScreenX, headScreenY, (int) headSize, false, false, -1);
PlayerSkinDrawer.draw(drawContext, this.playerSkinTextures.body().texturePath(), headScreenX, headScreenY, (int) headSize, false, false, -1);
}
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -33,11 +33,11 @@ private static ScreenRect createBounds(int x0, int y0, int x1, int y1, int x2, i
}

@Override
public void setupVertices(VertexConsumer vertices, float depth) {
vertices.vertex(this.pose(), (float) this.x0(), (float) this.y0(), depth).color(this.argb());
vertices.vertex(this.pose(), (float) this.x3(), (float) this.y3(), depth).color(this.argb());
vertices.vertex(this.pose(), (float) this.x2(), (float) this.y2(), depth).color(this.argb());
vertices.vertex(this.pose(), (float) this.x1(), (float) this.y1(), depth).color(this.argb());
public void setupVertices(VertexConsumer vertices) {
vertices.vertex(this.pose(), (float) this.x0(), (float) this.y0()).color(this.argb());
vertices.vertex(this.pose(), (float) this.x3(), (float) this.y3()).color(this.argb());
vertices.vertex(this.pose(), (float) this.x2(), (float) this.y2()).color(this.argb());
vertices.vertex(this.pose(), (float) this.x1(), (float) this.y1()).color(this.argb());
}

@Override
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -33,11 +33,11 @@ private static ScreenRect createBounds(int x0, int y0, int x1, int y1, int x2, i
}

@Override
public void setupVertices(VertexConsumer vertices, float depth) {
vertices.vertex(this.pose(), (float) this.x0(), (float) this.y0(), depth).color(this.argb());
vertices.vertex(this.pose(), (float) this.x2(), (float) this.y2(), depth).color(this.argb());
vertices.vertex(this.pose(), (float) this.x1(), (float) this.y1(), depth).color(this.argb());
vertices.vertex(this.pose(), (float) this.x1(), (float) this.y1(), depth).color(this.argb());
public void setupVertices(VertexConsumer vertices) {
vertices.vertex(this.pose(), (float) this.x0(), (float) this.y0()).color(this.argb());
vertices.vertex(this.pose(), (float) this.x2(), (float) this.y2()).color(this.argb());
vertices.vertex(this.pose(), (float) this.x1(), (float) this.y1()).color(this.argb());
vertices.vertex(this.pose(), (float) this.x1(), (float) this.y1()).color(this.argb());
}

@Override
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,8 +3,11 @@
import com.jumpcutfindo.onmymark.client.graphics.screen.utils.ScreenUtils;
import com.jumpcutfindo.onmymark.client.input.InputListener;
import net.fabricmc.fabric.api.client.keybinding.v1.KeyBindingHelper;
import net.minecraft.client.gui.Click;
import net.minecraft.client.gui.DrawContext;
import net.minecraft.client.gui.screen.Screen;
import net.minecraft.client.input.CharInput;
import net.minecraft.client.input.KeyInput;
import net.minecraft.entity.player.PlayerEntity;
import net.minecraft.text.Text;
import org.lwjgl.glfw.GLFW;
Expand Down Expand Up @@ -43,21 +46,21 @@ public void render(DrawContext context, int mouseX, int mouseY, float delta) {
}

@Override
public boolean mouseClicked(double mouseX, double mouseY, int button) {
public boolean mouseClicked(Click click, boolean doubled) {
if (this.activeWindow != null) {
return this.activeWindow.mouseClicked((int) mouseX, (int) mouseY, button);
return this.activeWindow.mouseClicked(click, doubled);
}

return super.mouseClicked(mouseX, mouseY, button);
return super.mouseClicked(click, doubled);
}

@Override
public boolean mouseDragged(double mouseX, double mouseY, int button, double deltaX, double deltaY) {
public boolean mouseDragged(Click click, double offsetX, double offsetY) {
if (this.activeWindow != null) {
return this.activeWindow.mouseDragged(mouseX, mouseY, button, deltaX, deltaY);
return this.activeWindow.mouseDragged(click, offsetX, offsetY);
}

return super.mouseDragged(mouseX, mouseY, button, deltaX, deltaY);
return super.mouseDragged(click, offsetX, offsetY);
}

@Override
Expand All @@ -70,32 +73,32 @@ public boolean mouseScrolled(double mouseX, double mouseY, double horizontalAmou
}

@Override
public boolean keyPressed(int keyCode, int scanCode, int modifiers) {
if (keyCode == GLFW.GLFW_KEY_ESCAPE && this.activeWindow != null) {
public boolean keyPressed(KeyInput input) {
if (input.getKeycode() == GLFW.GLFW_KEY_ESCAPE && this.activeWindow != null) {
if (isStandalone) close();
this.activeWindow = null;
return true;
}

if (keyCode == KeyBindingHelper.getBoundKeyOf(InputListener.GUI_BINDING).getCode() && this.activeWindow == null) {
if (input.getKeycode() == KeyBindingHelper.getBoundKeyOf(InputListener.GUI_BINDING).getCode() && this.activeWindow == null) {
close();
return true;
}

if (this.activeWindow != null) {
return this.activeWindow.keyPressed(keyCode, scanCode, modifiers);
return this.activeWindow.keyPressed(input);
}

return super.keyPressed(keyCode, scanCode, modifiers);
return super.keyPressed(input);
}

@Override
public boolean charTyped(char chr, int modifiers) {
public boolean charTyped(CharInput charInput) {
if (this.activeWindow != null) {
return this.activeWindow.charTyped(chr, modifiers);
return this.activeWindow.charTyped(charInput);
}

return super.charTyped(chr, modifiers);
return super.charTyped(charInput);
}

@Override
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -8,13 +8,13 @@
import com.jumpcutfindo.onmymark.client.network.ClientNetworkSender;
import com.jumpcutfindo.onmymark.client.party.ClientPartyMember;
import com.jumpcutfindo.onmymark.party.PartyInvite;
import net.minecraft.client.MinecraftClient;
import net.minecraft.client.font.TextRenderer;
import net.minecraft.client.gl.RenderPipelines;
import net.minecraft.client.gui.DrawContext;
import net.minecraft.client.gui.Element;
import net.minecraft.client.gui.PlayerSkinDrawer;
import net.minecraft.client.util.SkinTextures;
import net.minecraft.client.util.DefaultSkinHelper;
import net.minecraft.entity.player.SkinTextures;
import net.minecraft.text.OrderedText;
import net.minecraft.text.Text;
import net.minecraft.text.TextColor;
Expand Down Expand Up @@ -50,9 +50,7 @@ public PartyInviteWindow(OnMyMarkScreen screen, PartyInvite<ClientPartyMember> p
this.screen.setActiveWindow(null);
});

this.inviterSkinTextures = MinecraftClient.getInstance()
.getSkinProvider()
.getSkinTextures(
this.inviterSkinTextures = DefaultSkinHelper.getSkinTextures(
partyInvite.from().gameProfile()
);
}
Expand All @@ -70,7 +68,7 @@ public void renderContent(DrawContext context, int mouseX, int mouseY) {
context.getMatrices().pushMatrix();
context.getMatrices().scale(2F, 2F);

PlayerSkinDrawer.draw(context, this.inviterSkinTextures.texture(), (x + (WINDOW_WIDTH - 24) / 2) / 2, (y + 10) / 2, 12, false, false, -1);
PlayerSkinDrawer.draw(context, this.inviterSkinTextures.body().texturePath(), (x + (WINDOW_WIDTH - 24) / 2) / 2, (y + 10) / 2, 12, false, false, -1);
context.getMatrices().popMatrix();

Text inviterName = Text.literal(this.partyInvite.from().displayName()).styled(style -> style.withBold(true));
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@
import net.minecraft.client.gui.PlayerSkinDrawer;
import net.minecraft.client.texture.PlayerSkinProvider;
import net.minecraft.client.util.DefaultSkinHelper;
import net.minecraft.client.util.SkinTextures;
import net.minecraft.entity.player.SkinTextures;
import net.minecraft.text.Text;
import net.minecraft.util.Colors;
import net.minecraft.util.Identifier;
Expand All @@ -38,9 +38,7 @@ public PartyMemberListItem(OnMyMarkScreen screen, ClientPartyMember partyMember,
this.item = partyMember;
this.index = index;

this.playerSkinTextures = MinecraftClient.getInstance()
.getSkinProvider()
.getSkinTextures(
this.playerSkinTextures = DefaultSkinHelper.getSkinTextures(
partyMember.gameProfile()
);
}
Expand All @@ -53,7 +51,7 @@ private static Supplier<SkinTextures> texturesSupplier(GameProfile profile) {
PlayerSkinProvider playerSkinProvider = minecraftClient.getSkinProvider();

CompletableFuture<Optional<SkinTextures>> completableFuture = playerSkinProvider.fetchSkinTextures(profile);
boolean bl = !minecraftClient.uuidEquals(profile.getId());
boolean bl = !minecraftClient.uuidEquals(profile.id());
SkinTextures skinTextures = DefaultSkinHelper.getSkinTextures(profile);

return () -> {
Expand Down Expand Up @@ -83,7 +81,7 @@ public void renderContent(DrawContext context, int x, int y, int mouseX, int mou

// Draw player icon
if (this.playerSkinTextures != null) {
PlayerSkinDrawer.draw(context, this.playerSkinTextures.texture(), x + 11, y + 3, 12, false, false, -1);
PlayerSkinDrawer.draw(context, this.playerSkinTextures.body().texturePath(), x + 11, y + 3, 12, false, false, -1);
}

// Draw crown if party leader
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@
import com.jumpcutfindo.onmymark.party.Party;
import com.jumpcutfindo.onmymark.party.PartyInvite;
import com.jumpcutfindo.onmymark.party.PartyMember;
import net.minecraft.client.gui.Click;
import net.minecraft.client.gui.DrawContext;
import net.minecraft.text.Text;

Expand Down Expand Up @@ -143,44 +144,44 @@ private void drawButtonTooltips(DrawContext context, int mouseX, int mouseY) {
}

@Override
public boolean mouseClicked(double mouseX, double mouseY, int button) {
public boolean mouseClicked(Click click, boolean doubled) {
if (isWindowOpen()) {
return super.mouseClicked(mouseX, mouseY, button);
return super.mouseClicked(click, doubled);
}

if (isMouseInList(mouseX, mouseY)) {
return this.partyMemberListView.mouseClicked((int) mouseX, (int) mouseY, button);
if (isMouseInList(click.x(), click.y())) {
return this.partyMemberListView.mouseClicked((int) click.x(), (int) click.y(), click.button());
}

switch (this.state) {
case NO_PARTY -> {
return this.createPartyButton.mouseClicked((int) mouseX, (int) mouseY, button);
return this.createPartyButton.mouseClicked((int) click.x(), (int) click.y(), click.button());
}
case IN_PARTY_AS_MEMBER -> {
return this.leavePartyButton.mouseClicked((int) mouseX, (int) mouseY, button)
|| this.selectMarkerColorButton.mouseClicked((int) mouseX, (int) mouseY, button);
return this.leavePartyButton.mouseClicked((int) click.x(), (int) click.y(), click.button())
|| this.selectMarkerColorButton.mouseClicked((int) click.x(), (int) click.y(), click.button());
}
case IN_PARTY_AS_LEADER -> {
return this.invitePlayerButton.mouseClicked((int) mouseX, (int) mouseY, button)
|| this.leavePartyButton.mouseClicked((int) mouseX, (int) mouseY, button)
|| this.selectMarkerColorButton.mouseClicked((int) mouseX, (int) mouseY, button);
return this.invitePlayerButton.mouseClicked((int) click.x(), (int) click.y(), click.button())
|| this.leavePartyButton.mouseClicked((int) click.x(), (int) click.y(), click.button())
|| this.selectMarkerColorButton.mouseClicked((int) click.x(), (int) click.y(), click.button());
}
case IN_PARTY_AS_LEADER_MEMBER_SELECTED -> {
return this.kickPlayerButton.mouseClicked((int) mouseX, (int) mouseY, button);
return this.kickPlayerButton.mouseClicked((int) click.x(), (int) click.y(), click.button());
}
}

return false;
}

@Override
public boolean mouseDragged(double mouseX, double mouseY, int button, double deltaX, double deltaY) {
public boolean mouseDragged(Click click, double offsetX, double offsetY) {
if (isWindowOpen()) {
return super.mouseDragged(mouseX, mouseY, button, deltaX, deltaY);
return super.mouseDragged(click, offsetX, offsetY);
}

if (isMouseInList(mouseX, mouseY)) {
return this.partyMemberListView.mouseDragged((int) mouseX, (int) mouseY, button, deltaX, deltaY);
if (isMouseInList(click.x(), click.y())) {
return this.partyMemberListView.mouseDragged((int) click.x(), (int) click.y(), click.button(), offsetX, offsetY);
}

return false;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,9 @@ public static void drawItemTiled(DrawContext drawContext, ItemStack stack, int x
// Draw a square outline
if (OnMyMarkMod.CONFIG.isIconTileVisible()) {
drawContext.fill(x - 1, y - 1, x + 17, y + 17, backgroundColor);
drawContext.drawBorder(x - 1, y - 1, 18, 18, borderColor);
drawContext.drawStrokedRectangle(x - 1, y - 1, 18, 18, borderColor);

drawContext.drawDeferredElements();
}

// Draw item normally
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@
import net.minecraft.client.MinecraftClient;
import net.minecraft.client.option.KeyBinding;
import net.minecraft.client.util.InputUtil;
import net.minecraft.util.Identifier;
import org.lwjgl.glfw.GLFW;

public class InputListener {
Expand All @@ -17,7 +18,7 @@ public class InputListener {
"key.onmymark.party",
InputUtil.Type.KEYSYM,
GLFW.GLFW_KEY_O,
"key.categories.onmymark.onmymark"
new KeyBinding.Category(Identifier.of("key.categories.onmymark.onmymark"))
)
);

Expand All @@ -26,7 +27,7 @@ public class InputListener {
"key.onmymark.mark",
InputUtil.Type.KEYSYM,
GLFW.GLFW_KEY_R,
"key.categories.onmymark.onmymark"
new KeyBinding.Category(Identifier.of("key.categories.onmymark.onmymark"))
)
);

Expand All @@ -35,7 +36,7 @@ public class InputListener {
"key.onmymark.playerReport",
InputUtil.Type.KEYSYM,
GLFW.GLFW_KEY_U,
"key.categories.onmymark.onmymark"
new KeyBinding.Category(Identifier.of("key.categories.onmymark.onmymark"))
)
);

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ public class InvitePlayerInvitationS2CHandler implements ClientPacketHandler<Inv
@Override
public void handle(InvitePlayerInvitationS2CPacket payload, ClientPacketContext context) {
ClientPartyManager partyManager = context.partyManager();
PartyInvite<ClientPartyMember> partyInvite = payload.toPartyInvite(context.player().getWorld(), context.player());
PartyInvite<ClientPartyMember> partyInvite = payload.toPartyInvite(context.player().getEntityWorld(), context.player());

partyManager.setPartyInvite(partyInvite);

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -47,9 +47,9 @@ public Vec3d getExactPosition(World world) {
Entity entity = this.entity();

if (entity != null) {
this.setLastPos(entity.getPos());
this.setLastPos(entity.getEntityPos());
}

return entity != null ? entity.getPos() : this.lastPos();
return entity != null ? entity.getEntityPos() : this.lastPos();
}
}
Loading