Compare commits
4 Commits
szar-26.3.
...
szar-26.4.
| Author | SHA1 | Date | |
|---|---|---|---|
| 5dcf4fc221 | |||
| 34b8fccf24 | |||
| 62ad19516b | |||
| c3eb514db7 |
@@ -131,14 +131,16 @@ jobs:
|
||||
|
||||
- name: Upload the mod JAR
|
||||
run: |
|
||||
# Use the artifact downloaded in the previous step
|
||||
JAR_FILE=$(ls ./release-artifacts/*.jar | head -n 1)
|
||||
# Find the largest JAR file (the main mod file is 120 MiB, others are KiB)
|
||||
JAR_FILE=$(ls -S ./release-artifacts/*.jar | head -n 1)
|
||||
|
||||
if [ ! -f "$JAR_FILE" ]; then
|
||||
echo "Error: JAR not found in ./release-artifacts/"
|
||||
echo "Error: Main JAR not found in ./release-artifacts/"
|
||||
exit 1
|
||||
fi
|
||||
|
||||
echo "Uploading largest file: $(basename $JAR_FILE)"
|
||||
|
||||
curl -X POST \
|
||||
-H "Authorization: token ${{ secrets.GITEATOKEN }}" \
|
||||
-H "Content-Type: application/java-archive" \
|
||||
|
||||
@@ -6,7 +6,7 @@ minecraft_version=1.20.1
|
||||
yarn_mappings=1.20.1+build.10
|
||||
loader_version=0.18.3
|
||||
# Mod Properties
|
||||
mod_version=26.3.30
|
||||
mod_version=26.4.1
|
||||
maven_group=dev.tggamesyt
|
||||
archives_base_name=szar
|
||||
# Dependencies
|
||||
|
||||
@@ -58,7 +58,34 @@ public class SzarClient implements ClientModInitializer {
|
||||
// add this field to your client init class
|
||||
public static final int april = Szar.april;
|
||||
public static final int fools = Szar.fools;
|
||||
public static boolean hasBeaten = false;
|
||||
|
||||
// Transition state
|
||||
public static long transitionStartTime = -1L;
|
||||
public static boolean transitioningToNormal = false; // true = flipped->normal, false = normal->flipped
|
||||
public static boolean wasFlipped = false;
|
||||
|
||||
public static final long TRANSITION_DURATION_MS = 2000L;
|
||||
|
||||
private float drogOverlayProgress = 0.0F;
|
||||
public static float getCurrentFlipAngle() {
|
||||
if (transitionStartTime != -1L) {
|
||||
long elapsed = System.currentTimeMillis() - transitionStartTime;
|
||||
if (elapsed >= TRANSITION_DURATION_MS) {
|
||||
transitionStartTime = -1L;
|
||||
wasFlipped = false;
|
||||
return hasBeaten ? 0f : 180f;
|
||||
}
|
||||
float t = (float) elapsed / (float) TRANSITION_DURATION_MS;
|
||||
t = t * t * (3f - 2f * t);
|
||||
if (transitioningToNormal) {
|
||||
return 180f * (1f - t); // 180 -> 0
|
||||
} else {
|
||||
return 180f * t; // 0 -> 180
|
||||
}
|
||||
}
|
||||
return hasBeaten ? 0f : 180f;
|
||||
}
|
||||
private long lastTime = 0;
|
||||
private static final Map<KeyBinding, KeyBinding> activeScramble = new HashMap<>();
|
||||
public static final EntityModelLayer PLANE =
|
||||
@@ -90,6 +117,22 @@ public class SzarClient implements ClientModInitializer {
|
||||
);
|
||||
@Override
|
||||
public void onInitializeClient() {
|
||||
ClientPlayNetworking.registerGlobalReceiver(Szar.APRIL_GAME_BEATEN, (client, handler, buf, responseSender) -> {
|
||||
client.execute(() -> {
|
||||
hasBeaten = true;
|
||||
transitionStartTime = System.currentTimeMillis();
|
||||
transitioningToNormal = true;
|
||||
});
|
||||
});
|
||||
|
||||
ClientPlayNetworking.registerGlobalReceiver(Szar.APRIL_GAME_BEATEN_REVOKED, (client, handler, buf, responseSender) -> {
|
||||
client.execute(() -> {
|
||||
hasBeaten = false;
|
||||
transitionStartTime = System.currentTimeMillis();
|
||||
transitioningToNormal = false;
|
||||
wasFlipped = true;
|
||||
});
|
||||
});
|
||||
BlockEntityRendererFactories.register(BlueprintBlocks.BLUEPRINT_STAIRS_BE_TYPE, BlueprintBlockEntityRenderer::new);
|
||||
BlockEntityRendererFactories.register(BlueprintBlocks.BLUEPRINT_SLAB_BE_TYPE, BlueprintBlockEntityRenderer::new);
|
||||
BlockEntityRendererFactories.register(BlueprintBlocks.BLUEPRINT_DOOR_BE_TYPE, BlueprintBlockEntityRenderer::new);
|
||||
|
||||
@@ -28,6 +28,8 @@ public class MouseFlipMixin {
|
||||
)
|
||||
private double flipMouseY(double pitchDelta) {
|
||||
if (!isAprilFools()) return pitchDelta;
|
||||
return -pitchDelta;
|
||||
// Flip mouse when angle is past 90 degrees (i.e. screen is more flipped than not)
|
||||
if (SzarClient.getCurrentFlipAngle() > 90f) return -pitchDelta;
|
||||
return pitchDelta;
|
||||
}
|
||||
}
|
||||
@@ -26,20 +26,27 @@ public class ScreenFlipMixin {
|
||||
@ModifyReturnValue(method = "getBasicProjectionMatrix", at = @At("RETURN"))
|
||||
private Matrix4f flipProjection(Matrix4f original) {
|
||||
if (!isAprilFools()) return original;
|
||||
return original.scale(1.0f, -1.0f, 1.0f);
|
||||
|
||||
float angle = SzarClient.getCurrentFlipAngle();
|
||||
if (angle == 0f) return original;
|
||||
if (angle == 180f) return original.scale(1.0f, -1.0f, 1.0f);
|
||||
|
||||
return original.rotateZ((float) Math.toRadians(angle));
|
||||
}
|
||||
|
||||
@Inject(method = "renderWorld", at = @At("HEAD"))
|
||||
private void setFrontFaceCW(float tickDelta, long limitTime, MatrixStack matrices, CallbackInfo ci) {
|
||||
if (!isAprilFools()) return;
|
||||
// Y flip reverses winding order, so tell GL that clockwise = front face
|
||||
GL11.glFrontFace(GL11.GL_CW);
|
||||
if (SzarClient.getCurrentFlipAngle() > 90f) {
|
||||
GL11.glFrontFace(GL11.GL_CW);
|
||||
}
|
||||
}
|
||||
|
||||
@Inject(method = "renderWorld", at = @At("TAIL"))
|
||||
private void restoreFrontFaceCCW(float tickDelta, long limitTime, MatrixStack matrices, CallbackInfo ci) {
|
||||
if (!isAprilFools()) return;
|
||||
// Restore default: counter-clockwise = front face
|
||||
GL11.glFrontFace(GL11.GL_CCW);
|
||||
if (SzarClient.getCurrentFlipAngle() > 90f) {
|
||||
GL11.glFrontFace(GL11.GL_CCW);
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -103,6 +103,8 @@ public class Szar implements ModInitializer {
|
||||
public static final Logger LOGGER = LogManager.getLogger(MOD_ID);
|
||||
public static int april = 4;
|
||||
public static int fools = 1;
|
||||
public static final Identifier APRIL_GAME_BEATEN = new Identifier(MOD_ID, "april_game_beaten");
|
||||
public static final Identifier APRIL_GAME_BEATEN_REVOKED = new Identifier("szar", "april_game_beaten_revoked");
|
||||
public static final Identifier DRUNK_TYPE_PACKET = new Identifier(MOD_ID, "drunk_type");
|
||||
public static final Identifier OPEN_DETONATOR_SCREEN = new Identifier(MOD_ID, "open_coord_screen");
|
||||
public static final Identifier DETONATOR_INPUT = new Identifier(MOD_ID, "coord_input");
|
||||
|
||||
@@ -0,0 +1,56 @@
|
||||
package dev.tggamesyt.szar.mixin;
|
||||
|
||||
import dev.tggamesyt.szar.Szar;
|
||||
import net.fabricmc.fabric.api.networking.v1.PacketByteBufs;
|
||||
import net.fabricmc.fabric.api.networking.v1.ServerPlayNetworking;
|
||||
import net.minecraft.advancement.Advancement;
|
||||
import net.minecraft.advancement.PlayerAdvancementTracker;
|
||||
import net.minecraft.server.network.ServerPlayerEntity;
|
||||
import net.minecraft.util.Identifier;
|
||||
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.CallbackInfoReturnable;
|
||||
|
||||
import java.time.LocalDate;
|
||||
|
||||
@Mixin(PlayerAdvancementTracker.class)
|
||||
public class PlayerAdvancementTrackerMixin {
|
||||
|
||||
@Shadow
|
||||
private ServerPlayerEntity owner;
|
||||
|
||||
@Inject(method = "grantCriterion", at = @At("RETURN"))
|
||||
private void onCriterionGranted(Advancement advancement, String criterionName, CallbackInfoReturnable<Boolean> cir) {
|
||||
if (!cir.getReturnValue()) return;
|
||||
if (owner == null) return;
|
||||
|
||||
if (advancement.getId().equals(new Identifier("end", "kill_dragon"))) {
|
||||
if (!owner.getAdvancementTracker().getProgress(advancement).isDone()) return;
|
||||
|
||||
LocalDate today = LocalDate.now();
|
||||
if (today.getMonthValue() != Szar.april || today.getDayOfMonth() != Szar.fools) return;
|
||||
|
||||
Szar.grantAdvancement(owner, "april_game_beaten");
|
||||
return;
|
||||
}
|
||||
|
||||
if (!advancement.getId().equals(new Identifier(Szar.MOD_ID, "april_game_beaten"))) return;
|
||||
if (!owner.getAdvancementTracker().getProgress(advancement).isDone()) return;
|
||||
|
||||
ServerPlayNetworking.send(owner, Szar.APRIL_GAME_BEATEN, PacketByteBufs.empty());
|
||||
}
|
||||
|
||||
@Inject(method = "revokeCriterion", at = @At("RETURN"))
|
||||
private void onCriterionRevoked(Advancement advancement, String criterionName, CallbackInfoReturnable<Boolean> cir) {
|
||||
if (!cir.getReturnValue()) return;
|
||||
if (owner == null) return;
|
||||
|
||||
if (!advancement.getId().equals(new Identifier(Szar.MOD_ID, "april_game_beaten"))) return;
|
||||
// If it's no longer done after revoking, send the revoke packet
|
||||
if (owner.getAdvancementTracker().getProgress(advancement).isDone()) return;
|
||||
|
||||
ServerPlayNetworking.send(owner, Szar.APRIL_GAME_BEATEN_REVOKED, PacketByteBufs.empty());
|
||||
}
|
||||
}
|
||||
@@ -206,5 +206,8 @@
|
||||
"block.szar.ender_obsidian": "Ender Obsidian",
|
||||
"block.szar.ender_ore": "Ender Ore",
|
||||
"item.szar.raw_ender": "Raw Ender",
|
||||
"item.szar.ender_ingot": "Ender Ingot"
|
||||
"item.szar.ender_ingot": "Ender Ingot",
|
||||
|
||||
"advancement.szar.april_game_beaten.title": "We are so back",
|
||||
"advancement.szar.april_game_beaten.description": "Beat the game on april 1st to flip the game back."
|
||||
}
|
||||
|
||||
@@ -0,0 +1,18 @@
|
||||
{
|
||||
"parent": "szar:april",
|
||||
"display": {
|
||||
"icon": {
|
||||
"item": "szar:april"
|
||||
},
|
||||
"title": {"translate": "advancement.szar.april_game_beaten.title"},
|
||||
"description": {"translate": "advancement.szar.april_game_beaten.description"},
|
||||
"show_toast": true,
|
||||
"announce_to_chat": false,
|
||||
"frame": "challenge"
|
||||
},
|
||||
"criteria": {
|
||||
"used_item": {
|
||||
"trigger": "minecraft:impossible"
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -16,6 +16,7 @@
|
||||
"NoClipMixin",
|
||||
"NoiseChunkGeneratorMixin",
|
||||
"PlaneBlockInteractionMixin",
|
||||
"PlayerAdvancementTrackerMixin",
|
||||
"PlayerDropMixin",
|
||||
"PlayerEntityMixin",
|
||||
"PlayerInteractionMixin",
|
||||
|
||||
Reference in New Issue
Block a user