Skip to content

Commit

Permalink
update: 1.19.4
Browse files Browse the repository at this point in the history
  • Loading branch information
RemainingToast committed Jun 6, 2023
1 parent 15df3c6 commit 4b03d00
Show file tree
Hide file tree
Showing 32 changed files with 162 additions and 121 deletions.
8 changes: 4 additions & 4 deletions gradle.properties
Original file line number Diff line number Diff line change
Expand Up @@ -3,14 +3,14 @@ org.gradle.jvmargs=-Xmx1G

# Fabric Properties
# Check these on https://modmuss50.me/fabric.html
minecraft_version=1.19.2
yarn_mappings=1.19.2+build.28
minecraft_version=1.19.4
yarn_mappings=1.19.4+build.2
loader_version=0.14.21
fabric_version=0.76.0+1.19.2
fabric_version=0.83.0+1.19.4
loom_version=1.2-SNAPSHOT

# Mod Properties
mod_version=2.1.1
mod_version=2.1.2
maven_group=dev.toastmc
archives_base_name=toastclient

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,6 @@
import net.minecraft.client.render.VertexFormat;
import net.minecraft.client.render.VertexFormats;
import org.lwjgl.opengl.GL11;
import org.w3c.dom.CharacterData;

import java.awt.*;
import java.awt.font.GlyphVector;
Expand Down Expand Up @@ -205,7 +204,7 @@ public int drawString(String str, float startX, float startY, int initialColor,

/* Use initial color passed to renderString(); disable texturing to draw solid color lines */
color = initialColor;
GlStateManager._disableTexture();
// GlStateManager._disableTexture();
buffer.begin(VertexFormat.DrawMode.LINES, VertexFormats.POSITION_COLOR);

for (int glyphIndex = 0, colorIndex = 0; glyphIndex < entry.glyphs.length; glyphIndex++)
Expand Down Expand Up @@ -266,7 +265,7 @@ public int drawString(String str, float startX, float startY, int initialColor,

/* Finish drawing the last strikethrough/underline segments */
tessellator.draw();
GlStateManager._enableTexture();
// GlStateManager._enableTexture();
}


Expand Down
Original file line number Diff line number Diff line change
@@ -1,19 +1,15 @@
package dev.toastmc.toastclient.mixin.client;

import net.minecraft.client.gl.ShaderEffect;
import net.minecraft.client.render.GameRenderer;
import net.minecraft.util.Identifier;
import org.spongepowered.asm.mixin.Mixin;
import org.spongepowered.asm.mixin.gen.Accessor;
import org.spongepowered.asm.mixin.gen.Invoker;

@Mixin(GameRenderer.class)
public interface IGameRenderer {

@Invoker
/*@Invoker
void callLoadShader(Identifier identifier);
@Accessor
void setShader(ShaderEffect shader);
void setShader(ShaderEffect shader);*/

}
Original file line number Diff line number Diff line change
Expand Up @@ -2,18 +2,15 @@

import dev.toastmc.toastclient.ToastClient;
import dev.toastmc.toastclient.api.events.PacketEvent;
import io.netty.util.concurrent.GenericFutureListener;
import net.minecraft.network.ClientConnection;
import net.minecraft.network.Packet;
import net.minecraft.network.PacketCallbacks;
import net.minecraft.network.listener.PacketListener;
import net.minecraft.network.packet.Packet;
import org.spongepowered.asm.mixin.Mixin;
import org.spongepowered.asm.mixin.injection.At;
import org.spongepowered.asm.mixin.injection.Inject;
import org.spongepowered.asm.mixin.injection.callback.CallbackInfo;

import java.util.concurrent.Future;

@Mixin(ClientConnection.class)
public class MixinClientConnection {

Expand All @@ -22,16 +19,16 @@ public class MixinClientConnection {
method = {"handlePacket"},
cancellable = true
)
private static void on(Packet<?> packet, PacketListener listener, CallbackInfo info) {
private static <T extends PacketListener> void on(Packet<T> packet, PacketListener listener, CallbackInfo ci) {
PacketEvent.Receive receive = new PacketEvent.Receive(packet);
ToastClient.Companion.getEventBus().post(receive);
if (receive.isCancelled())
info.cancel();
ci.cancel();
}

@Inject(
at = {@At("HEAD")},
method = {"send(Lnet/minecraft/network/Packet;)V"},
method = {"send(Lnet/minecraft/network/packet/Packet;)V"},
cancellable = true
)
private void on(Packet<?> packet, CallbackInfo ci) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ public class MixinGameRenderer {

@Inject(
at = {@At("HEAD")},
method = {"bobViewWhenHurt(Lnet/minecraft/client/util/math/MatrixStack;F)V"},
method = {"bobView"},
cancellable = true
)
private void on(MatrixStack matrixStack, float f, CallbackInfo ci) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@
public class MixinHeldItemRenderer {

@Inject(
at = {@At(value = "INVOKE")},
at = {@At(value = "HEAD")},
method = {"renderFirstPersonItem"},
cancellable = true
)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,7 @@ private void on(MatrixStack matrixStack, float float_1, CallbackInfo info) {
method = {"renderOverlay"},
cancellable = true
)
private void on(Identifier texture, float opacity, CallbackInfo ci) {
private void on(MatrixStack matrices, Identifier texture, float opacity, CallbackInfo ci) {
if (texture == PUMPKIN_BLUR &&
NoRender.INSTANCE.isEnabled() &&
NoRender.INSTANCE.getPumpkin().getValue()) {
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,30 @@
package dev.toastmc.toastclient.mixin.client;

import net.minecraft.client.gui.LogoDrawer;
import net.minecraft.client.util.math.MatrixStack;
import net.minecraft.util.Identifier;
import org.spongepowered.asm.mixin.Final;
import org.spongepowered.asm.mixin.Mixin;
import org.spongepowered.asm.mixin.Mutable;
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;

@Mixin(LogoDrawer.class)
public class MixinLogoDrawer {

@Mutable
@Shadow
@Final
public static Identifier EDITION_TEXTURE;

@Inject(
at = {@At("HEAD")},
method = {"draw(Lnet/minecraft/client/util/math/MatrixStack;IFI)V"}
)
private void on(MatrixStack matrices, int screenWidth, float alpha, int y, CallbackInfo ci) {
EDITION_TEXTURE = new Identifier("toastclient", "title/edition.png");
}

}
Original file line number Diff line number Diff line change
Expand Up @@ -3,14 +3,10 @@
import dev.toastmc.toastclient.ToastClient;
import dev.toastmc.toastclient.api.events.ScreenEvent;
import dev.toastmc.toastclient.api.events.TickEvent;
import dev.toastmc.toastclient.api.util.font.FontAccessor;
import dev.toastmc.toastclient.api.util.font.StringRenderer;
import net.minecraft.client.MinecraftClient;
import net.minecraft.client.gui.screen.Screen;
import net.minecraft.client.network.ClientPlayerEntity;
import net.minecraft.client.util.Session;
import net.minecraft.client.world.ClientWorld;
import org.spongepowered.asm.mixin.Final;
import org.spongepowered.asm.mixin.Mixin;
import org.spongepowered.asm.mixin.Shadow;
import org.spongepowered.asm.mixin.injection.At;
Expand All @@ -27,7 +23,7 @@ public abstract class MixinMinecraftClient {
@Shadow public ClientPlayerEntity player;

@Inject(
at = {@At(value = "INVOKE")},
at = {@At(value = "HEAD")},
method = {"tick"},
cancellable = true
)
Expand All @@ -44,7 +40,8 @@ private void on(CallbackInfo info) {

@ModifyVariable(
at = @At("HEAD"),
method = {"setScreen"}
method = {"setScreen"},
argsOnly = true
)
private Screen setScreen(Screen screen) {
ScreenEvent.Closed closedEvent = new ScreenEvent.Closed(MinecraftClient.getInstance().currentScreen);
Expand Down
Original file line number Diff line number Diff line change
@@ -1,26 +1,40 @@
package dev.toastmc.toastclient.mixin.client;

import dev.toastmc.toastclient.impl.module.misc.ExtraTab;
import net.minecraft.client.MinecraftClient;
import net.minecraft.client.gui.hud.PlayerListHud;
import net.minecraft.client.network.ClientPlayNetworkHandler;
import net.minecraft.client.network.PlayerListEntry;
import net.minecraft.text.Text;
import org.spongepowered.asm.mixin.Final;
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.Redirect;
import org.spongepowered.asm.mixin.injection.callback.CallbackInfoReturnable;

import java.util.List;
import java.util.Collection;
import java.util.Comparator;

@Mixin(PlayerListHud.class)
public class MixinPlayerListHud {

@Shadow @Final private static Comparator<PlayerListEntry> ENTRY_ORDERING;

@Shadow @Final private MinecraftClient client;

@Redirect(
at = @At(value = "INVOKE", target = "Ljava/util/List;subList(II)Ljava/util/List;"),
method = {"render"}
at = @At(value = "INVOKE", target = "Lnet/minecraft/client/network/ClientPlayNetworkHandler;getListedPlayerListEntries()Ljava/util/Collection;"),
method = {"collectPlayerEntries"}
)
public <E> List<E> render(List<E> list, int fromIndex, int toIndex) {
return list.subList(fromIndex, ExtraTab.INSTANCE.isEnabled() ? Math.min(ExtraTab.INSTANCE.getTabSize().getIntValue(), list.size()) : toIndex);
public <E> Collection<PlayerListEntry> render(ClientPlayNetworkHandler instance) {
assert this.client.player != null;
return this.client.player.networkHandler.getListedPlayerListEntries()
.stream()
.sorted(ENTRY_ORDERING)
.limit(ExtraTab.INSTANCE.isEnabled() ? ExtraTab.INSTANCE.getTabSize().getIntValue() : 80L)
.toList();
}

@Inject(
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,18 +2,13 @@

import com.mojang.blaze3d.platform.GlStateManager;
import com.mojang.blaze3d.systems.RenderSystem;
import dev.toastmc.toastclient.api.util.GLSLSandboxShader;
import net.minecraft.client.MinecraftClient;
import net.minecraft.client.gui.RotatingCubeMapRenderer;
import net.minecraft.client.gui.screen.TitleScreen;
import net.minecraft.client.render.GameRenderer;
import net.minecraft.client.util.math.MatrixStack;
import net.minecraft.util.Identifier;
import net.minecraft.util.math.MathHelper;
import org.spongepowered.asm.mixin.Final;
import org.spongepowered.asm.mixin.Mixin;
import org.spongepowered.asm.mixin.Mutable;
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.Redirect;
Expand All @@ -24,17 +19,6 @@
@Mixin(TitleScreen.class)
public class MixinTitleScreen {

@Mutable
@Shadow @Final private static Identifier EDITION_TITLE_TEXTURE;

@Inject(
at = {@At("RETURN")},
method = {"render"}
)
private void on(MatrixStack matrices, int mouseX, int mouseY, float delta, CallbackInfo ci) {
EDITION_TITLE_TEXTURE = new Identifier("toastclient", "title/edition.png");
}

@Redirect(
at = @At(value = "INVOKE", target = "Lnet/minecraft/client/gui/RotatingCubeMapRenderer;render(FF)V"),
method = {"render"}
Expand All @@ -48,12 +32,12 @@ private void on(RotatingCubeMapRenderer rotatingCubeMapRenderer, float delta, fl
private void on1(MatrixStack matrices, int mouseX, int mouseY, float delta, CallbackInfo ci){
Identifier TOAST_CLIENT_TEXTURE = new Identifier("toastclient", "title/background.jpeg");
MinecraftClient.getInstance().getTextureManager().bindTexture(TOAST_CLIENT_TEXTURE);
assert MinecraftClient.getInstance().currentScreen != null; // Shouldn't ever be null, as we are literally rendering screen
RenderSystem.setShader(GameRenderer::getPositionTexShader);
RenderSystem.setShader(GameRenderer::getPositionProgram);
RenderSystem.setShaderTexture(0, TOAST_CLIENT_TEXTURE);
RenderSystem.enableBlend();
RenderSystem.blendFunc(GlStateManager.SrcFactor.SRC_ALPHA, GlStateManager.DstFactor.ONE_MINUS_SRC_ALPHA);
RenderSystem.setShaderColor(1.0F, 1.0F, 1.0F, 1.0F);
assert MinecraftClient.getInstance().currentScreen != null; // Should never be null - java ooga booga
int width = MinecraftClient.getInstance().currentScreen.width;
int height = MinecraftClient.getInstance().currentScreen.height;
drawTexture(
Expand Down
4 changes: 2 additions & 2 deletions src/main/kotlin/dev/toastmc/toastclient/IToastClient.kt
Original file line number Diff line number Diff line change
Expand Up @@ -12,10 +12,10 @@ interface IToastClient {
get() = MinecraftClient.getInstance()

val clientName: String
get() = "ToastClient"
get() = "Toast Client"

val version: String
get() = "b2.1.1"
get() = "b2.1.2"

val capeUrl: String
get() = "https://raw.githubusercontent.com/RemainingToast/ToastClient/dev/capes.json"
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
package dev.toastmc.toastclient.api.events

import net.minecraft.network.Packet
import net.minecraft.network.packet.Packet
import org.quantumclient.energy.Event

open class PacketEvent(val packet: Packet<*>) : Event() {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,6 @@ import net.minecraft.enchantment.EnchantmentHelper
import net.minecraft.entity.DamageUtil
import net.minecraft.entity.LivingEntity
import net.minecraft.entity.attribute.EntityAttributes
import net.minecraft.entity.damage.DamageSource
import net.minecraft.entity.effect.StatusEffects
import net.minecraft.entity.player.PlayerEntity
import net.minecraft.util.math.MathHelper
Expand All @@ -30,7 +29,7 @@ object CrystalUtil {
var damage = incomingDamage
if (this is PlayerEntity) {
val player: PlayerEntity = this
val source = DamageSource.explosion(explosion)
val source = explosion.damageSource

damage = DamageUtil.getDamageLeft(
damage,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -46,4 +46,8 @@ class ToastColor : Color {
fun glColor() {
RenderSystem.setShaderColor(red / 255.0f, green / 255.0f, blue / 255.0f, alpha / 255.0f)
}

fun glClear() {
RenderSystem.clearColor(red / 255.0f, green / 255.0f, blue / 255.0f, alpha / 255.0f)
}
}
12 changes: 6 additions & 6 deletions src/main/kotlin/dev/toastmc/toastclient/api/util/WorldUtil.kt
Original file line number Diff line number Diff line change
Expand Up @@ -8,14 +8,14 @@ import net.minecraft.client.MinecraftClient
import net.minecraft.item.Items
import net.minecraft.network.packet.c2s.play.ClientCommandC2SPacket
import net.minecraft.network.packet.c2s.play.PlayerMoveC2SPacket
import net.minecraft.registry.DefaultedRegistry
import net.minecraft.registry.Registries
import net.minecraft.util.Hand
import net.minecraft.util.hit.BlockHitResult
import net.minecraft.util.math.BlockPos
import net.minecraft.util.math.Box
import net.minecraft.util.math.Direction
import net.minecraft.util.math.Vec3d
import net.minecraft.util.registry.DefaultedRegistry
import net.minecraft.util.registry.Registry
import net.minecraft.world.Heightmap
import net.minecraft.world.World
import net.minecraft.world.chunk.Chunk
Expand Down Expand Up @@ -50,9 +50,9 @@ object WorldUtil {
val map = LinkedHashMap<BlockPos, Block>()
if (!world.isChunkLoaded(
BlockPos(
(chunkX shr 4).toDouble(),
80.0,
(chunkX shr 4).toDouble()
chunkX shr 4,
80,
chunkX shr 4
)
)
) {
Expand Down Expand Up @@ -596,7 +596,7 @@ object WorldUtil {

private val onUseMethod = AbstractBlock::onUse::javaMethod.get()!!

val ALL_BLOCKS: DefaultedRegistry<Block> = Registry.BLOCK
val ALL_BLOCKS: DefaultedRegistry<Block> = Registries.BLOCK
val INTERACTIVE: List<Block> = ALL_BLOCKS.stream().filter {
for (method in it::class.java.declaredMethods) {
if (method.name == onUseMethod.name) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ fun ClientPlayerEntity.clone(): OtherClientPlayerEntity {
}

fun ClientPlayerEntity.clone(gameProfile: GameProfile): OtherClientPlayerEntity {
val clone = OtherClientPlayerEntity(clientWorld, gameProfile, publicKey)
val clone = OtherClientPlayerEntity(clientWorld, gameProfile)
clone.copyPositionAndRotation(this)
clone.setHeadYaw(headYaw)
return clone
Expand Down

0 comments on commit 4b03d00

Please sign in to comment.