The Wolf22
📎 1 file 5,396 chars
📄
pasted-code-1787951541111.txt
txt 151 lines
▶
Create a complete, functional Minecraft Forge 1.20.1 mod project from scratch and return it as a ZIP archive ready to build with Gradle.

MOD NAME:
Custom Paintings & TV

MAIN REQUIREMENT:
The mod must be completely standalone. Do NOT require WebDisplays, MCEF, OptiFine, Fabric, or any other Minecraft mod.

FEATURE 1 — CUSTOM PAINTINGS:
- Add a custom painting item.
- It must be placed on walls exactly like a normal Minecraft painting.
- Support NORTH, SOUTH, EAST and WEST wall directions.
- The painting must face the wall correctly.
- The painting must never float one block away from the wall.
- The painting must not crash Minecraft when placed.
- The image must keep its original aspect ratio.
- Automatically calculate painting dimensions from the source image resolution.
- Allow large images without an artificial 2 MB limit.
- Store only the image ID/path in the item/block entity, not huge image data inside the item.
- Store original files in:
  .minecraft/custompaintings/library/
- Use:
  .minecraft/custompaintings/inbox/
  as the media import folder.
- Create an in-game media inbox GUI showing ALL images in the inbox.
- The GUI must have scrolling and preview.
- Do not artificially limit the number of images. If there are 500 images, show all 500 with scrolling.
- Clicking an image should allow creating/placing the painting.

FEATURE 2 — TV:
- Add a functional TV block.
- TV must support NORTH, SOUTH, EAST and WEST directions.
- TV must rotate automatically according to placement direction.
- The TV should visually resemble a clean modern Minecraft/WebDisplay-style screen:
  thin black bezel,
  clean rectangular display,
  no giant floating black cube,
  no z-fighting,
  no flickering lines,
  no noisy/pixelated “snow”.
- The TV screen must render media cleanly.
- The display must preserve the original media aspect ratio.
- VIDEO:
  - Read video files from .minecraft/custompaintings/inbox/
  - Support common formats such as MP4, WEBM, MKV.
  - Show the actual video frames on the TV.
  - Play the video's audio at the same time.
  - Keep playback synchronized.
- AUDIO:
  - Support MP3, WAV, OGG and FLAC where possible.
  - Audio files should work as “radio/music mode”.
  - Use the supplied default music artwork for audio-only files.
- IMAGES:
  - Images from the same inbox must also be playable/displayed on the TV.
  - When an image is selected, show it full-screen inside the TV.
- MEDIA GUI:
  - ALL
  - IMAGES
  - AUDIO
  - VIDEO
  - scrolling list
  - preview panel
  - Play/Pause
  - Stop
  - Previous
  - Next
  - Volume -
  - Volume +
  - Refresh
- The same inbox must be used for paintings and TV media.

FEATURE 3 — AUTOMATIC RESOLUTION:
- Detect the actual source resolution automatically.
- For images use the real pixel width and height.
- For videos use FFprobe or equivalent metadata detection.
- The TV screen must automatically preserve the video's/image's aspect ratio.
- Example:
  1920x1080 = 16:9
  1280x720 = 16:9
  1080x1920 = 9:16
  1440x1080 = 4:3
- The user may change the screen width, but height should automatically follow the source aspect ratio.
- Never stretch or squash the image/video.

FEATURE 4 — MEDIA BACKEND:
- Do not use a fake placeholder video.
- Do not create a slideshow pretending to be video.
- Use a real media decoder/player.
- FFmpeg is acceptable as an external executable.
- The mod itself must NOT depend on another Minecraft mod.
- If external FFmpeg is required, include:
  install_ffmpeg.bat
  README explaining exactly where ffmpeg.exe, ffplay.exe and ffprobe.exe must be placed.
- The mod must safely handle missing FFmpeg and show a clear message instead of crashing Minecraft.
- Do not silently swallow all media errors; show useful error messages in the GUI/log.

FEATURE 5 — DEFAULT MUSIC ARTWORK:
Use the image I provided as the default artwork for audio-only tracks.
Include it in the mod resources and display it whenever a music file does not provide album artwork.

TECHNICAL REQUIREMENTS:
- Minecraft Forge 1.20.1
- Java 17
- Gradle project
- Proper Forge registries
- Proper block entities
- Proper client renderer registration
- Proper networking
- Proper serialization with NBT
- No compile errors
- No missing classes
- No duplicate closing braces
- No invalid Gradle JarJar version declarations
- No references to deleted classes
- No stale imports
- No deprecated API errors that stop compilation
- Build must succeed with:
  .\gradlew.bat clean build --rerun-tasks

IMPORTANT:
Before returning the ZIP, verify the complete source tree for:
1. Java compilation errors
2. Broken imports
3. Broken constructors
4. Missing registry objects
5. Missing packet classes
6. Wrong method signatures
7. Invalid Gradle syntax
8. Client/server class separation problems
9. Renderer crashes
10. Null pointer crashes
11. Texture loading failures
12. Media playback failures

OUTPUT:
Return ONLY a ZIP archive containing the complete project source.
The ZIP must contain:
- build.gradle
- settings.gradle
- gradlew
- gradlew.bat
- gradle/
- src/
- all required resources
- README.md
- install_ffmpeg.bat

Do not return pseudocode.
Do not return partial files.
Do not return explanations instead of the ZIP.
Generate a COMPLETE BUILDABLE PROJECT.
Kodari AI
KodariAug 28 at 9:28 pm 5
CustomPaintingsTV
A standalone Minecraft Forge 1.20.1 mod adding custom wall paintings and functional TVs. Players import images, videos, and audio into an inbox folder, browse them via a scrolling media GUI with preview, and place paintings that auto-calculate dimensions from source resolution. TVs render actual video frames with synchronized audio using FFmpeg, preserve aspect ratios, support directional placement, and include playback controls. Audio files display default music artwork. The mod handles missing FFmpeg gracefully and requires no other mods.
  1. Forge project foundation and registries: created the Gradle/Forge setup, mod metadata, resources, blocks, items, entity, and block entity.

  2. Media backend: add inbox scanning, resolution detection, FFmpeg frame/audio integration, and safe missing-tool handling.

  3. Client experience: add the scrolling media screen, painting/TV renderers, texture loading, controls, and client registration.

  4. Integration hardening: correct 1.20.1 APIs, packet validation, wall placement, and dedicated-server-safe client separation.

Created the complete Forge 1.20.1 Gradle project for Custom Paintings & TV, including:

  • Forge 1.20.1 / Java 17 setup

  • Custom painting item and entity

  • Directional TV block and block entity

  • Inbox/library media folders

  • Image resolution detection

  • FFmpeg/FFprobe/FFplay integration

  • Media browsing GUI with filters, scrolling, preview, and controls

  • Network packets for painting selection and TV controls

  • Client renderers and dynamic textures

  • README and install_ffmpeg.bat

  • Gradle wrapper files and Forge metadata

Kodari can make mistakes. Review important code before using.
Files
gradle
src
build.gradle
gradle.properties
gradlew
gradlew.bat
install_ffmpeg.bat
README.md
settings.gradle
Code
39 1,132
src/main/java/com/kodari/custompaintings/CustomPaintingsMod.java
package com.kodari.custompaintings;

import com.kodari.custompaintings.registry.ModBlockEntities;
import com.kodari.custompaintings.registry.ModBlocks;
import com.kodari.custompaintings.registry.ModEntities;
import com.kodari.custompaintings.registry.ModItems;
import com.kodari.custompaintings.network.ModNetwork;
import com.kodari.custompaintings.media.MediaLibrary;
import com.mojang.brigadier.arguments.StringArgumentType;
import net.minecraft.commands.Commands;
import net.minecraft.server.level.ServerPlayer;
import net.minecraft.world.item.ItemStack;
import net.minecraftforge.common.MinecraftForge;
import net.minecraftforge.event.RegisterCommandsEvent;
import net.minecraftforge.eventbus.api.IEventBus;
import net.minecraftforge.fml.common.Mod;
import net.minecraftforge.fml.javafmlmod.FMLJavaModLoadingContext;

@Mod(CustomPaintingsMod.MOD_ID)
public final class CustomPaintingsMod {
    public static final String MOD_ID = "custompaintings";

    public CustomPaintingsMod() {
        IEventBus bus = FMLJavaModLoadingContext.get().getModEventBus();
        ModBlocks.BLOCKS.register(bus);
        ModItems.ITEMS.register(bus);
        ModBlockEntities.BLOCK_ENTITIES.register(bus);
        ModEntities.ENTITY_TYPES.register(bus);
        ModNetwork.register();
        MediaLibrary.ensureFolders();
        MinecraftForge.EVENT_BUS.addListener(this::registerCommands);
    }

    private void registerCommands(RegisterCommandsEvent event) {
        event.getDispatcher().register(Commands.literal("custompaintings")
                .executes(context -> open(context.getSource().getPlayerOrException(), false))
                .then(Commands.literal("painting")
                        .executes(context -> open(context.getSource().getPlayerOrException(), true))));
    }

    private int open(ServerPlayer player, boolean painting) {
        if (painting) player.addItem(new ItemStack(ModItems.CUSTOM_PAINTING.get()));
        ModNetwork.openMediaScreen(player, null, painting);
        return 1;
    }
}