This commit is contained in:
Octol1ttle 2024-01-18 19:52:22 +05:00
parent 2e288d0738
commit 92ce91d05d
Signed by: Octol1ttle
GPG key ID: B77C34313AEE1FFF
9 changed files with 23 additions and 22 deletions

View file

@ -17,7 +17,7 @@ subprojects {
dependencies {
minecraft "com.mojang:minecraft:${rootProject.minecraft_version}"
// The following line declares the yarn mappings you may select this one as well.
mappings "net.fabricmc:yarn:1.20.1+build.10:v2"
mappings "net.fabricmc:yarn:1.19.2+build.28:v2"
}
}

View file

@ -1,5 +1,6 @@
package ru.octol1ttle.knockdowns.common;
import net.minecraft.entity.damage.DamageSource;
import net.minecraft.entity.player.PlayerEntity;
import net.minecraft.server.MinecraftServer;
import ru.octol1ttle.knockdowns.common.api.IKnockableDown;
@ -25,7 +26,7 @@ public class KnockdownsUtils {
public static void hurtTenacity(PlayerEntity player, float damage) {
player.setInvulnerable(false);
//DamageSource recent = player.getRecentDamageSource();
player.damage(/*Objects.requireNonNullElse(recent, */player.getDamageSources().generic()/*)*/, damage);
player.damage(/*Objects.requireNonNullElse(recent, */DamageSource.GENERIC/*)*/, damage);
player.velocityModified = false;
}

View file

@ -14,7 +14,7 @@ public class KnockdownsClientEvents {
}
private static void registerOnHudRender() {
ClientGuiEvent.RENDER_HUD.register((drawContext, tickDelta) -> {
ClientGuiEvent.RENDER_HUD.register((matrices, tickDelta) -> {
IKnockableDown reviving = (IKnockableDown) KnockdownsClient.reviving;
MinecraftClient client = MinecraftClient.getInstance();
if (reviving == null) {
@ -27,17 +27,17 @@ public class KnockdownsClientEvents {
TextRenderer renderer = client.textRenderer;
String timerText = String.format("%.1f", reviving.get_ReviveTimer() / (float) SharedConstants.TICKS_PER_SECOND);
int timerX = (drawContext.getScaledWindowWidth() - renderer.getWidth(timerText)) / 2;
int timerX = (client.getWindow().getScaledWidth() - renderer.getWidth(timerText)) / 2;
int reviverCount = reviving.get_ReviverCount();
Integer color = reviverCount > 1 ? Formatting.GREEN.getColorValue() : Formatting.WHITE.getColorValue();
String reviverCountText = "x" + reviverCount;
int reviveCountX = (drawContext.getScaledWindowWidth() - renderer.getWidth(reviverCountText)) / 2;
int reviveCountX = (client.getWindow().getScaledWidth() - renderer.getWidth(reviverCountText)) / 2;
if (color != null) {
drawContext.drawTextWithShadow(renderer, timerText, timerX, drawContext.getScaledWindowHeight() / 2 + 5, color);
drawContext.drawTextWithShadow(renderer, reviverCountText, reviveCountX, drawContext.getScaledWindowHeight() / 2 + 14, color);
renderer.drawWithShadow(matrices, timerText, timerX, client.getWindow().getScaledHeight() / 2.0f + 5, color);
renderer.drawWithShadow(matrices, reviverCountText, reviveCountX, client.getWindow().getScaledHeight() / 2.0f + 14, color);
}
});
}

View file

@ -62,7 +62,7 @@ public class KnockdownsEvents {
knockable.set_ReviveTimer(KnockdownsCommon.REVIVE_WAIT_TIME);
knockable.set_KnockedAge(0);
KnockdownsNetwork.sendToWorld(player.getServerWorld(), new PlayKnockedDownSoundS2CPacket(player.getX(), player.getY(), player.getZ()));
KnockdownsNetwork.sendToWorld(player.getWorld(), new PlayKnockedDownSoundS2CPacket(player.getX(), player.getY(), player.getZ()));
Text deathMessage = entity.getDamageTracker().getDeathMessage();
TranslatableTextContent deathContent = (TranslatableTextContent) deathMessage.getContent();

View file

@ -3,7 +3,7 @@ package ru.octol1ttle.knockdowns.common.network;
import dev.architectury.networking.NetworkChannel;
import dev.architectury.networking.NetworkManager;
import net.minecraft.entity.player.PlayerEntity;
import net.minecraft.network.packet.Packet;
import net.minecraft.network.Packet;
import net.minecraft.server.network.ServerPlayerEntity;
import net.minecraft.server.world.ServerWorld;
import net.minecraft.util.Identifier;

View file

@ -2,15 +2,15 @@ package ru.octol1ttle.knockdowns.common.registries;
import dev.architectury.registry.registries.DeferredRegister;
import dev.architectury.registry.registries.RegistrySupplier;
import net.minecraft.registry.RegistryKeys;
import net.minecraft.sound.SoundEvent;
import net.minecraft.util.Identifier;
import net.minecraft.util.registry.Registry;
import ru.octol1ttle.knockdowns.common.KnockdownsCommon;
public class KnockdownsSoundEvents {
private static final DeferredRegister<SoundEvent> SOUND_EVENTS = DeferredRegister.create(KnockdownsCommon.MOD_ID, RegistryKeys.SOUND_EVENT);
private static final DeferredRegister<SoundEvent> SOUND_EVENTS = DeferredRegister.create(KnockdownsCommon.MOD_ID, Registry.SOUND_EVENT_KEY);
public static final RegistrySupplier<SoundEvent> KNOCKED_DOWN = SOUND_EVENTS.register(KnockdownsCommon.MOD_ID,
() -> SoundEvent.of(new Identifier(KnockdownsCommon.MOD_ID, "knocked_down")));
() -> new SoundEvent(new Identifier(KnockdownsCommon.MOD_ID, "knocked_down")));
public static void register() {
SOUND_EVENTS.register();

View file

@ -27,7 +27,7 @@
],
"depends": {
"fabric": "*",
"minecraft": ">=1.20.1",
"architectury": ">=9.1.12"
"minecraft": "1.19.*",
"architectury": ">=6.5.85"
}
}

View file

@ -1,5 +1,5 @@
modLoader = "javafml"
loaderVersion = "[47,)"
loaderVersion = "[43,)"
#issueTrackerURL = ""
license = "ARR"
@ -16,20 +16,20 @@ DBNO mechanic from Fortnite, ported to Minecraft
[[dependencies.knockdowns]]
modId = "forge"
mandatory = true
versionRange = "[47,)"
versionRange = "[43,)"
ordering = "NONE"
side = "BOTH"
[[dependencies.knockdowns]]
modId = "minecraft"
mandatory = true
versionRange = "[1.20.1,)"
versionRange = "[1.19.2,1.20)"
ordering = "NONE"
side = "BOTH"
[[dependencies.knockdowns]]
modId = "architectury"
mandatory = true
versionRange = "[9.1.12,)"
versionRange = "[6.5.85,)"
ordering = "AFTER"
side = "BOTH"

View file

@ -1,17 +1,17 @@
org.gradle.jvmargs=-Xmx2048M
minecraft_version=1.20.1
minecraft_version=1.19.2
enabled_platforms=fabric,forge
archives_base_name=knockdowns
mod_version=2.2.2
maven_group=ru.octol1ttle.knockdowns
architectury_version=9.1.12
fabric_api_version=0.90.4+1.20.1
architectury_version=6.5.85
fabric_api_version=0.77.0+1.19.2
fabric_loader_version=0.15.5
forge_version=1.20.1-47.2.0
forge_version=1.19.2-43.3.0