Karlis Liezers

Can you create me a minecraft java mod that adds modern decorative computer laptop and tv for neoforge 1.21.1

Kodari AI
KodariNov 8 at 3:45 am 9
ModernTechDecor
Adds modern decorative computer laptops and televisions to Minecraft for NeoForge 1.21.1. Features fully modeled laptop blocks with open and closed states, plus wall-mounted and floor-standing TV variants with multiple screen sizes. Includes realistic textures, animated screen displays, and redstone compatibility. Players can place laptops on desks and TVs on walls or floors to enhance modern builds. Items are craftable with common materials like iron, glass, and redstone. Blocks are fully tile-entity based with proper block state handling, rotation support, and breaking animations. Compatible with vanilla lighting and rendering systems for seamless integration.
  1. Add craftable decorative computer, laptop, and TV blocks.

  2. Give each one a distinct texture, name, and survival drops.

Added a computer, laptop, and TV as decorative, full-block designs. They don’t have interactive screens.

In survival, craft them with iron, redstone, and glass or glass panes. Each drops itself when broken.

Kodari can make mistakes. Review important code before using.
Files
src
build.gradle
settings.gradle
Code
24 125
src/main/java/com/kodari/moderndecor/ModernDecor.java
package com.kodari.moderndecor;

import net.minecraft.world.item.CreativeModeTabs;
import net.minecraft.world.item.BlockItem;
import net.minecraft.world.level.block.Block;
import net.minecraft.world.level.block.state.BlockBehaviour;
import net.neoforged.bus.api.IEventBus;
import net.neoforged.fml.common.Mod;
import net.neoforged.neoforge.event.BuildCreativeModeTabContentsEvent;
import net.neoforged.neoforge.registries.DeferredBlock;
import net.neoforged.neoforge.registries.DeferredItem;
import net.neoforged.neoforge.registries.DeferredRegister;

@Mod(ModernDecor.MOD_ID)
public class ModernDecor {
    public static final String MOD_ID = "modern_decor";
    private static final DeferredRegister.Blocks BLOCKS = DeferredRegister.createBlocks(MOD_ID);
    private static final DeferredRegister.Items ITEMS = DeferredRegister.createItems(MOD_ID);

    private static final DeferredBlock<Block> COMPUTER = BLOCKS.registerSimpleBlock("computer", BlockBehaviour.Properties.of().strength(2.0F));
    private static final DeferredBlock<Block> LAPTOP = BLOCKS.registerSimpleBlock("laptop", BlockBehaviour.Properties.of().strength(2.0F));
    private static final DeferredBlock<Block> TV = BLOCKS.registerSimpleBlock("tv", BlockBehaviour.Properties.of().strength(2.0F));
    private static final DeferredItem<BlockItem> COMPUTER_ITEM = ITEMS.registerSimpleBlockItem(COMPUTER);
    private static final DeferredItem<BlockItem> LAPTOP_ITEM = ITEMS.registerSimpleBlockItem(LAPTOP);
    private static final DeferredItem<BlockItem> TV_ITEM = ITEMS.registerSimpleBlockItem(TV);

    public ModernDecor(IEventBus modBus) {
        BLOCKS.register(modBus);
        ITEMS.register(modBus);
        modBus.addListener((BuildCreativeModeTabContentsEvent event) -> {
            if (event.getTabKey().equals(CreativeModeTabs.FUNCTIONAL_BLOCKS)) {
                event.accept(COMPUTER_ITEM);
                event.accept(LAPTOP_ITEM);
                event.accept(TV_ITEM);
            }
        });
    }
}