Update for 1.19

This commit is contained in:
Johannes Frohnmeyer 2022-06-08 11:46:10 +02:00
parent 524b561539
commit 2702bab886
Signed by: Johannes
GPG Key ID: E76429612C2929F4
4 changed files with 30 additions and 39 deletions

View File

@ -1,13 +1,11 @@
apply from: "https://jfmods.gitlab.io/scripts/jfmod.gradle" apply from: "https://jfmods.gitlab.io/scripts/jfmod.gradle"
dependencies { dependencies {
include modImplementation("io.gitlab.jfronny.libjf:libjf-config-v0:${project.jfapi_version}") modImplementation("io.gitlab.jfronny.libjf:libjf-config-v0:${project.jfapi_version}")
include("io.gitlab.jfronny.libjf:libjf-unsafe-v0:${project.jfapi_version}")
include("io.gitlab.jfronny.libjf:libjf-base:${project.jfapi_version}")
modRuntimeOnly("io.gitlab.jfronny.libjf:libjf-devutil-v0:${project.jfapi_version}") modRuntimeOnly("io.gitlab.jfronny.libjf:libjf-devutil-v0:${project.jfapi_version}")
modImplementation "com.terraformersmc:modmenu:3.1.0" modImplementation "com.terraformersmc:modmenu:4.0.0-beta.4"
// Compat fix // Compat fix
include modImplementation(fabricApi.module("fabric-command-api-v1", "${project.fabric_version}")) include modImplementation(fabricApi.module("fabric-command-api-v2", "${project.fabric_version}"))
} }

View File

@ -1,15 +1,17 @@
# https://fabricmc.net/develop/ # https://fabricmc.net/develop/
minecraft_version=1.18.2 minecraft_version=1.19
yarn_mappings=build.2 yarn_mappings=build.1
loader_version=0.13.3 loader_version=0.14.6
maven_group=io.gitlab.jfronny maven_group=io.gitlab.jfronny
archives_base_name=combit archives_base_name=combit
fabric_version=0.48.0+1.18.2 fabric_version=0.55.1+1.19
jfapi_version=2.7.2 jfapi_version=2.9.1
modrinth_id=oPRrsg3M modrinth_id=oPRrsg3M
modrinth_required_dependencies=WKwQAwke
modrinth_optional_dependencies=mOgUt4GM modrinth_optional_dependencies=mOgUt4GM
curseforge_id=561742 curseforge_id=561742
curseforge_required_dependencies=libjf
curseforge_optional_dependencies=modmenu, cloth-config curseforge_optional_dependencies=modmenu, cloth-config

View File

@ -1,21 +1,15 @@
package io.gitlab.jfronny.combit; package io.gitlab.jfronny.combit;
import io.gitlab.jfronny.combit.events.EntityHurtEvent; import io.gitlab.jfronny.combit.events.*;
import io.gitlab.jfronny.combit.events.EntityKnockbackEvent; import net.fabricmc.api.*;
import io.gitlab.jfronny.combit.events.PlayerAttackEvent; import net.minecraft.entity.*;
import net.fabricmc.api.ModInitializer; import net.minecraft.entity.player.*;
import net.minecraft.entity.Entity; import net.minecraft.text.*;
import net.minecraft.entity.EntityType; import net.minecraft.util.*;
import net.minecraft.entity.LivingEntity;
import net.minecraft.entity.player.PlayerEntity;
import net.minecraft.text.LiteralText;
import net.minecraft.util.ActionResult;
import java.util.Set; import java.util.*;
import java.util.UUID;
public class Combit implements ModInitializer { public class Combit implements ModInitializer {
private static final UUID debugUUID = new UUID(0L, 0L);
@Override @Override
public void onInitialize() { public void onInitialize() {
EntityHurtEvent.EVENT.register((entity, source, amount) -> { EntityHurtEvent.EVENT.register((entity, source, amount) -> {
@ -30,7 +24,7 @@ public class Combit implements ModInitializer {
} }
String message = String.format("Type of damage received: %s\nAmount: %.3f\nTrue Source (mob id): %s\n", String message = String.format("Type of damage received: %s\nAmount: %.3f\nTrue Source (mob id): %s\n",
source.getName(), amount, debugSource); source.getName(), amount, debugSource);
entity.sendSystemMessage(new LiteralText(message), debugUUID); entity.sendMessage(Text.literal(message));
} }
if (CombitConfig.excludePlayers && entity instanceof PlayerEntity) return ActionResult.PASS; if (CombitConfig.excludePlayers && entity instanceof PlayerEntity) return ActionResult.PASS;
@ -66,7 +60,7 @@ public class Combit implements ModInitializer {
return ActionResult.PASS; return ActionResult.PASS;
if (CombitConfig.debug) { if (CombitConfig.debug) {
player.sendMessage(new LiteralText( player.sendMessage(Text.literal(
target instanceof LivingEntity le target instanceof LivingEntity le
? String.format("LivingEntity attacked: %s (%s/%s)", EntityType.getId(target.getType()), le.getHealth(), le.getMaxHealth()) ? String.format("LivingEntity attacked: %s (%s/%s)", EntityType.getId(target.getType()), le.getHealth(), le.getMaxHealth())
: String.format("Entity attacked: %s", EntityType.getId(target.getType())) : String.format("Entity attacked: %s", EntityType.getId(target.getType()))

View File

@ -1,16 +1,13 @@
package io.gitlab.jfronny.combit.mixin; package io.gitlab.jfronny.combit.mixin;
import io.gitlab.jfronny.combit.CombitConfig; import io.gitlab.jfronny.combit.*;
import net.minecraft.client.MinecraftClient; import net.minecraft.client.*;
import net.minecraft.client.gui.hud.InGameHud; import net.minecraft.client.gui.hud.*;
import net.minecraft.client.option.AttackIndicator; import net.minecraft.client.option.*;
import net.minecraft.client.util.math.MatrixStack; import net.minecraft.client.util.math.*;
import org.spongepowered.asm.mixin.Final; import org.spongepowered.asm.mixin.*;
import org.spongepowered.asm.mixin.Mixin; import org.spongepowered.asm.mixin.injection.*;
import org.spongepowered.asm.mixin.Shadow; import org.spongepowered.asm.mixin.injection.callback.*;
import org.spongepowered.asm.mixin.injection.At;
import org.spongepowered.asm.mixin.injection.Inject;
import org.spongepowered.asm.mixin.injection.callback.CallbackInfo;
@Mixin(InGameHud.class) @Mixin(InGameHud.class)
public class InGameHudMixin { public class InGameHudMixin {
@ -20,15 +17,15 @@ public class InGameHudMixin {
@Inject(at = @At("HEAD"), method = "renderCrosshair(Lnet/minecraft/client/util/math/MatrixStack;)V") @Inject(at = @At("HEAD"), method = "renderCrosshair(Lnet/minecraft/client/util/math/MatrixStack;)V")
private void renderCrosshair(MatrixStack matrices, CallbackInfo info) { private void renderCrosshair(MatrixStack matrices, CallbackInfo info) {
if (CombitConfig.cooldownProgressOverride >= 0) { if (CombitConfig.cooldownProgressOverride >= 0) {
combit$attackIndicator = this.client.options.attackIndicator; combit$attackIndicator = this.client.options.getAttackIndicator().getValue();
this.client.options.attackIndicator = AttackIndicator.OFF; this.client.options.getAttackIndicator().setValue(AttackIndicator.OFF);
} }
} }
@Inject(at = @At("RETURN"), method = "renderCrosshair(Lnet/minecraft/client/util/math/MatrixStack;)V") @Inject(at = @At("RETURN"), method = "renderCrosshair(Lnet/minecraft/client/util/math/MatrixStack;)V")
private void renderCrosshairPost(MatrixStack matrices, CallbackInfo info) { private void renderCrosshairPost(MatrixStack matrices, CallbackInfo info) {
if (CombitConfig.cooldownProgressOverride >= 0) { if (CombitConfig.cooldownProgressOverride >= 0) {
this.client.options.attackIndicator = combit$attackIndicator; this.client.options.getAttackIndicator().setValue(combit$attackIndicator);
} }
} }
} }