This commit is contained in:
2026-03-05 18:06:45 +01:00
parent c17629478e
commit a7aa7d36f9
208 changed files with 318 additions and 4 deletions

View File

@@ -18,8 +18,12 @@ import net.fabricmc.fabric.api.networking.v1.PacketByteBufs;
import net.fabricmc.fabric.api.object.builder.v1.client.model.FabricModelPredicateProviderRegistry;
import net.minecraft.client.MinecraftClient;
import net.minecraft.client.gui.screen.ingame.HandledScreens;
import net.minecraft.client.network.AbstractClientPlayerEntity;
import net.minecraft.client.network.OtherClientPlayerEntity;
import net.minecraft.client.option.KeyBinding;
import net.minecraft.client.render.entity.EntityRenderer;
import net.minecraft.client.render.entity.FlyingItemEntityRenderer;
import net.minecraft.client.render.entity.PlayerEntityRenderer;
import net.minecraft.client.render.entity.animation.Animation;
import net.minecraft.client.render.entity.model.EntityModelLayer;
import net.minecraft.client.render.item.BuiltinModelItemRenderer;
@@ -33,6 +37,7 @@ import net.minecraft.client.render.*;
import net.minecraft.client.util.ModelIdentifier;
import net.minecraft.client.world.ClientWorld;
import net.minecraft.entity.Entity;
import net.minecraft.entity.player.PlayerEntity;
import net.minecraft.item.ItemStack;
import net.minecraft.network.PacketByteBuf;
import net.minecraft.sound.SoundCategory;
@@ -56,6 +61,7 @@ import static dev.tggamesyt.szar.client.ClientCosmetics.loadTextureFromURL;
import static dev.tggamesyt.szar.client.UraniumUtils.updateUranium;
public class SzarClient implements ClientModInitializer {
private static boolean addedFeature = false;
private static final Map<KeyBinding, KeyBinding> activeScramble = new HashMap<>();
public static final EntityModelLayer PLANE =
new EntityModelLayer(
@@ -82,6 +88,17 @@ public class SzarClient implements ClientModInitializer {
int loopStart = startOffset + startLength;
@Override
public void onInitializeClient() {
ClientPlayNetworking.registerGlobalReceiver(Szar.PLAY_VIDEO,
(client, handler, buf, responseSender) -> {
String player = buf.readString();
client.execute(() -> {
VideoManager.startVideo(player);
});
});
ClientTickEvents.END_CLIENT_TICK.register(client -> {
VideoManager.tick();
});
ModelLoadingRegistry.INSTANCE.registerModelProvider((manager, out) -> {
ThirdpersonModelRegisterer.getAll().forEach((itemId, modelId) -> {
out.accept(new ModelIdentifier(modelId, "inventory"));
@@ -424,7 +441,19 @@ public class SzarClient implements ClientModInitializer {
(dispatcher, registryAccess) -> PanoramaClientCommand.register(dispatcher)
);
}
ClientTickEvents.END_CLIENT_TICK.register(client -> {
if (addedFeature) return; // only run once
MinecraftClient mc = MinecraftClient.getInstance();
if (mc.getEntityRenderDispatcher() == null) return;
for (EntityRenderer<?> renderer : mc.getEntityRenderDispatcher().renderers.values()) {
if (renderer instanceof PlayerEntityRenderer playerRenderer) {
playerRenderer.addFeature(new VideoHeadFeature(playerRenderer));
}
}
addedFeature = true; // prevent running again
});
}
private boolean isDebugEnabled() {

View File

@@ -0,0 +1,56 @@
package dev.tggamesyt.szar.client;
import com.mojang.blaze3d.systems.RenderSystem;
import net.minecraft.client.network.AbstractClientPlayerEntity;
import net.minecraft.client.render.VertexConsumer;
import net.minecraft.client.render.VertexConsumerProvider;
import net.minecraft.client.render.RenderLayer;
import net.minecraft.client.render.entity.PlayerEntityRenderer;
import net.minecraft.client.render.entity.feature.FeatureRenderer;
import net.minecraft.client.render.entity.feature.FeatureRendererContext;
import net.minecraft.client.render.entity.model.PlayerEntityModel;
import net.minecraft.client.util.math.MatrixStack;
import net.minecraft.util.Identifier;
import org.joml.Matrix4f;
public class VideoHeadFeature extends FeatureRenderer<AbstractClientPlayerEntity, PlayerEntityModel<AbstractClientPlayerEntity>> {
private final PlayerEntityRenderer renderer;
public VideoHeadFeature(PlayerEntityRenderer renderer) {
super(renderer);
this.renderer = renderer;
}
@Override
public void render(MatrixStack matrices, VertexConsumerProvider vertexConsumers, int light,
AbstractClientPlayerEntity player, float limbAngle, float limbDistance,
float tickDelta, float animationProgress, float headYaw, float headPitch) {
// Only render if the player is playing a video
if (!VideoManager.isPlaying(player.getUuid())) return;
Identifier frame = VideoManager.getCurrentFrame(player.getUuid());
if (frame == null) return;
matrices.push();
// Rotate to match the head
this.getContextModel().head.rotate(matrices);
// Position quad slightly in front of the face
float size = 0.5f;
matrices.translate(-size / 2f, -size / 2f, -0.25f);
// Render the video frame
VertexConsumer vc = vertexConsumers.getBuffer(RenderLayer.getEntityCutoutNoCull(frame));
Matrix4f matrix = matrices.peek().getPositionMatrix();
vc.vertex(matrix, 0, 0, 0).texture(0, 1).light(light).next();
vc.vertex(matrix, size, 0, 0).texture(1, 1).light(light).next();
vc.vertex(matrix, size, size, 0).texture(1, 0).light(light).next();
vc.vertex(matrix, 0, size, 0).texture(0, 0).light(light).next();
matrices.pop();
}
}

View File

@@ -0,0 +1,169 @@
package dev.tggamesyt.szar.client;
import net.minecraft.client.MinecraftClient;
import net.minecraft.client.network.ClientPlayerEntity;
import net.minecraft.client.world.ClientWorld;
import net.minecraft.client.sound.PositionedSoundInstance;
import net.minecraft.sound.SoundCategory;
import net.minecraft.sound.SoundEvent;
import net.minecraft.sound.SoundEvents;
import net.minecraft.util.Identifier;
import java.util.*;
import static dev.tggamesyt.szar.Szar.MOD_ID;
public class VideoManager {
private static final MinecraftClient client = MinecraftClient.getInstance();
private static final int TOTAL_FRAMES = 193;
private static final int TICKS_PER_FRAME = 1;
private static final Map<UUID, VideoInstance> activeVideos = new HashMap<>();
private static final List<Identifier> FRAMES = new ArrayList<>();
/*
* Load frames (call once during client init)
*/
public static void init() {
if (!FRAMES.isEmpty()) return;
for (int i = 0; i < TOTAL_FRAMES; i++) {
String frame = String.format("textures/video/frame_%03d.png", i);
FRAMES.add(new Identifier(MOD_ID, frame));
}
}
/*
* Start playing the video on a player
*/
public static void startVideo(String playerUuid) {
if (client.world == null) return;
UUID uuid = UUID.fromString(playerUuid);
activeVideos.put(uuid, new VideoInstance(uuid));
playSound(uuid);
}
/*
* Tick method (call every client tick)
*/
public static void tick() {
if (activeVideos.isEmpty()) return;
Iterator<Map.Entry<UUID, VideoInstance>> iterator = activeVideos.entrySet().iterator();
while (iterator.hasNext()) {
VideoInstance instance = iterator.next().getValue();
instance.tick();
if (instance.finished()) {
iterator.remove();
}
}
}
/*
* Check if a player currently has a video playing
*/
public static boolean isPlaying(UUID player) {
return activeVideos.containsKey(player);
}
/*
* Get current frame texture for player
*/
public static Identifier getCurrentFrame(UUID player) {
VideoInstance instance = activeVideos.get(player);
if (instance == null) return null;
int frameIndex = instance.frame;
if (frameIndex >= FRAMES.size()) return null;
return FRAMES.get(frameIndex);
}
/*
* Play sound from the player's location
*/
private static void playSound(UUID playerUuid) {
ClientWorld world = client.world;
if (world == null) return;
var player = world.getPlayerByUuid(playerUuid);
if (player == null) return;
Identifier soundId = new Identifier(MOD_ID, "firtana");
SoundEvent soundEvent = SoundEvent.of(soundId);
client.getSoundManager().play(
new PositionedSoundInstance(
soundEvent,
SoundCategory.PLAYERS,
1.0f, // volume
1.0f, // pitch
player.getRandom(),
player.getX(),
player.getY(),
player.getZ()
)
);
}
/*
* Video instance for each player
*/
private static class VideoInstance {
UUID player;
int frame = 0;
int tickCounter = 0;
VideoInstance(UUID player) {
this.player = player;
}
void tick() {
tickCounter++;
if (tickCounter >= TICKS_PER_FRAME) {
frame++;
tickCounter = 0;
}
}
boolean finished() {
return frame >= TOTAL_FRAMES;
}
}
}

View File

@@ -0,0 +1,36 @@
package dev.tggamesyt.szar;
import net.fabricmc.fabric.api.networking.v1.PacketByteBufs;
import net.fabricmc.fabric.api.networking.v1.ServerPlayNetworking;
import net.minecraft.entity.player.PlayerEntity;
import net.minecraft.item.Item;
import net.minecraft.item.ItemStack;
import net.minecraft.network.PacketByteBuf;
import net.minecraft.server.network.ServerPlayerEntity;
import net.minecraft.server.world.ServerWorld;
import net.minecraft.util.Hand;
import net.minecraft.util.TypedActionResult;
import net.minecraft.world.World;
public class FirtanaItem extends Item {
public FirtanaItem(Item.Settings settings) {
super(settings);
}
@Override
public TypedActionResult<ItemStack> use(World world, PlayerEntity user, Hand hand) {
if (!world.isClient) {
for (ServerPlayerEntity player : ((ServerWorld) world).getPlayers()) {
PacketByteBuf buf = PacketByteBufs.create();
buf.writeString(user.getUuidAsString());
ServerPlayNetworking.send(player, Szar.PLAY_VIDEO, buf);
}
}
return TypedActionResult.success(user.getStackInHand(hand));
}
}

View File

@@ -165,7 +165,6 @@ public class SlotMachineBlockEntity extends BlockEntity {
// old sendcontentupdates
if (!blockEntity.getSpinning()) {
if (blockEntity.getWorld().getTime() % IDLE_SPEED == 0) {
System.out.println("setting random symbols");
blockEntity.setSymbols(
blockEntity.random.nextInt(7),
blockEntity.random.nextInt(7),

View File

@@ -125,6 +125,8 @@ public class Szar implements ModInitializer {
new Identifier(MOD_ID, "plane_anim");
public static final Identifier NAZI_HAND_GESTURE = new Identifier("szar", "hit_hand");
public static final Identifier OPEN_URL = new Identifier(MOD_ID, "epsteinfiles");
public static final Identifier PLAY_VIDEO =
new Identifier(MOD_ID, "play_video");
public static final Block SZAR_BLOCK =
new SzarBlock();
@@ -320,6 +322,7 @@ public class Szar implements ModInitializer {
entries.add(Szar.EFN_DISK);
entries.add(Szar.SLOT_MACHINE);
entries.add(Szar.ROULETTE);
entries.add(Szar.FIRTANA);
// nsfw
entries.add(Szar.FASZITEM);
entries.add(Szar.CNDM);
@@ -811,6 +814,11 @@ public class Szar implements ModInitializer {
new Identifier(MOD_ID, "towers"),
new BlockItem(OBELISK_CORE, new Item.Settings())
);
public static final Item FIRTANA = Registry.register(
Registries.ITEM,
new Identifier(MOD_ID, "firtana"),
new FirtanaItem(new Item.Settings())
);
static VoxelShape shape23 = VoxelShapes.cuboid(0.25f, 0f, 0f, 0.75f, 0.25f, 0.125f);
static VoxelShape shape24 = VoxelShapes.cuboid(0.125f, 0f, 0.125f, 0.875f, 0.125f, 0.25f);
static VoxelShape shape25 = VoxelShapes.cuboid(0f, 0f, 0.25f, 1f, 0.125f, 0.75f);

View File

@@ -82,5 +82,6 @@
"item.szar.wheel": "Wheel",
"block.szar.slot_machine": "Slot Machine",
"block.szar.casino": "Casino Title",
"block.szar.roulette": "Roulette"
"block.szar.roulette": "Roulette",
"item.szar.firtana": "Firtana"
}

View File

@@ -0,0 +1,6 @@
{
"parent": "minecraft:item/generated",
"textures": {
"layer0": "szar:item/firtana"
}
}

View File

@@ -106,5 +106,13 @@
"stream": true
}
]
},
"firtana": {
"sounds": [
{
"name": "szar:firtana",
"stream": true
}
]
}
}

Binary file not shown.

Binary file not shown.

After

Width:  |  Height:  |  Size: 280 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 310 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 310 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 310 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 307 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 310 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 316 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 322 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 322 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 323 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 326 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 327 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 323 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 322 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 319 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 320 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 320 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 319 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 318 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 322 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 322 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 318 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 318 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 315 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 314 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 312 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 312 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 316 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 316 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 315 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 315 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 314 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 315 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 322 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 322 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 318 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 318 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 319 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 319 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 316 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 316 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 316 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 318 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 315 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 315 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 317 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 319 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 313 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 313 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 312 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 312 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 309 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 309 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 309 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 310 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 312 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 312 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 314 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 311 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 313 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 313 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 311 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 312 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 313 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 313 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 314 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 311 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 310 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 309 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 308 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 310 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 312 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 317 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 316 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 320 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 317 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 316 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 316 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 315 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 311 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 311 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 317 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 318 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 316 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 323 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 323 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 324 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 320 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 319 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 321 KiB

Some files were not shown because too many files have changed in this diff Show More