priyx.me
๐Ÿ“Ž 1 file 13,649 chars
๐Ÿ“„
pasted-code-1782129799080.txt
txt 301 lines
โ–ถ
Create a Fabric 1.20.1 Minecraft mod called "GiantCraftings" (mod id: "giantcraftings").

=======================================================
SECTION 1: GIANT CRAFTING TABLE BLOCK
=======================================================

1.1 BLOCK REGISTRATION:
- Create a new block: GiantCraftingTableBlock (id: "giant_crafting_table")
- Extends Block, has an associated BlockEntity (GiantCraftingTableBlockEntity)
- Hardness: 5.0, Resistance: 10.0, requires iron pickaxe to mine
- Sounds: WOOD sound type
- Visually: custom model that looks like a 2x2x2 oversized crafting table
  with glowing golden border lines on edges (emissive texture layer)
- When placed, it occupies 1 block but renders at 2x scale using BlockEntityRenderer

1.2 GIANT CRAFTING TABLE RECIPE (crafted in normal 3x3 table):
  [CraftingTable] [CraftingTable] [CraftingTable]
  [CraftingTable] [DiamondBlock ] [CraftingTable]
  [CraftingTable] [CraftingTable] [CraftingTable]
  โ†’ Output: 1x Giant Crafting Table

1.3 BLOCK ENTITY: GiantCraftingTableBlockEntity
- Extends BlockEntity, implements MenuProvider
- Internal inventory: 256 input slots (16 rows x 16 columns) + 1 output slot = 257 slots
- Uses ItemStackHandler from NeoForge (capability system)
- Saves/loads all slots to NBT on chunk save/load
- Has a tick() method that:
  a. Scans all 256 slots for a matching GiantRecipe
  b. If a valid recipe is found, places the result in the output slot
  c. If no recipe matches, clears the output slot

1.4 GIANT CRAFTING TABLE MENU: GiantCraftingTableMenu
- Extends AbstractContainerMenu
- Uses a custom MenuType registered with DeferredRegister
- Adds 256 Slot objects mapped to the BlockEntity's ItemStackHandler (16x16 grid)
- Adds 1 output Slot (read-only, player clicks to take result)
- Adds 36 player inventory slots (hotbar + main inventory) as standard
- On output slot taken: calls shrinkIngredients() to consume 1 of each used input slot
- Broadcasts changes via ContainerSynchronizer

1.5 GIANT CRAFTING TABLE SCREEN: GiantCraftingTableScreen
- Extends AbstractContainerScreen
- Background texture: custom texture "textures/INVENTORY GUI/giant_crafting_table.png"
  Size: 512x512 pixels (to fit 16x16 grid)
- Each slot rendered at 9x9 pixels (smaller than normal 18x18 to fit all 256 in the INVENTORY GUI)
- A large arrow in the middle pointing right toward the output slot
- Title: "ยง6โœฆ Giant Crafting Table โœฆ" in golden color
- Scroll support: if screen is too large, add a scroll bar on the right side to scroll through rows
- Output slot rendered large (32x32 pixels) on the right side of the INVENTORY GUI
- Animated sparkle particles rendered inside the INVENTORY GUI screen when a valid recipe is detected

1.6 GIANT RECIPE SYSTEM: GiantRecipe
- Create a custom recipe type: GiantRecipe (id: "giantcraftings:giant_crafting")
- Implements Recipe
- Recipe format in JSON (in data/giantcraftings/recipes/):
  {
    "type": "giantcraftings:giant_crafting",
    "pattern": [
      "AAAAAAAAAAAAAAAA",   โ† 16 characters per row
      "ABBBBBBBBBBBBBBA",
      "ABBBBBBBBBBBBBBA",
      "ABBBBBBBBBBBBBBA",
      "ABBBBBBBBBBBBBBA",
      "ABBBBBBBBBBBBBBA",
      "ABBBBBBBBBBBBBBA",
      "ABBBBBBBBBBBBBBA",
      "ABBBBBBBBBBBBBBA",
      "ABBBBBBBBBBBBBBA",
      "ABBBBBBBBBBBBBBA",
      "ABBBBBBBBBBBBBBA",
      "ABBBBBBBBBBBBBBA",
      "ABBBBBBBBBBBBBBA",
      "ABBBBBBBBBBBBBBA",
      "AAAAAAAAAAAAAAAA"    โ† 16 rows total
    ],
    "key": {
      "A": { "item": "minecraft:diamond_block" },
      "B": { "item": "minecraft:air" }
    },
    "result": { "item": "minecraft:netherite_block", "count": 1 }
  }
- GiantRecipeSerializer: implements RecipeSerializer, parses JSON pattern (16x16)
- GiantRecipeType: implements RecipeType
- Register both with DeferredRegister> and DeferredRegister>
- Recipe matching: iterate all 256 slots, match against pattern (support empty/air slots)
- Support shapeless giant recipes too (type: "giantcraftings:giant_crafting_shapeless")
  where ingredients are just a list and order doesn't matter

1.7 DEFAULT GIANT RECIPES (include these JSON files in the mod's data folder):

GIANT SWORD OF TITANS:
- Fill all 256 slots with Diamond Swords
- Result: 1x Netherite Sword with enchantments: Sharpness X, Fire Aspect V, Looting V
  (apply enchantments via NBT in result JSON)

GIANT GOLDEN APPLE:
- Fill 16x16 with Golden Apples (all 256 slots)
- Result: 1x Enchanted Golden Apple (Notch Apple)

GIANT BEACON:
- Border (60 slots on edges) with Obsidian
- Inner 14x14 (196 slots) with Nether Stars
- Result: 1x Beacon with all effects pre-applied via NBT

GIANT ELYTRA:
- Alternating pattern: Phantom Membrane and Feather in checkerboard across 16x16
- Result: 1x Elytra with Unbreaking X via NBT

GIANT TNT:
- All 256 slots: alternating Gunpowder and Sand (checkerboard)
- Result: 64x TNT

GIANT EXPERIENCE BOTTLE:
- All 256 slots: Glass Bottles
- Result: 1x custom item "Giant XP Bottle" that gives 1000 XP when used

=======================================================
SECTION 2: GIANT ITEM ENTITY
=======================================================

2.1 GiantItemEntity extends Entity (NOT ItemEntity):
- Stores crafted ItemStack in NBT tag "StoredItem"
- Stores size scale float in NBT tag "GiantScale"
- Bobs up/down: Y offset = Math.sin(tickCount * 0.1f) * 0.3f
- Rotates: yRot += 2.0f per tick
- Emits colored particles every 5 ticks based on item rarity (see 2.3)
- setGlowingTag(true) always
- Despawns after despawnTimeSeconds (from config) if not collected
- Collection trigger: any player within 1.5 blocks
  โ†’ Play ENTITY_EXPERIENCE_ORB_PICKUP sound at pitch 0.5 (deep boom)
  โ†’ Give player the stored ItemStack
  โ†’ Apply ability effect (see Section 3)
  โ†’ Show title: "ยง6โœฆ [ItemName] Collected! ยงeโœฆ"
  โ†’ Spawn 30 particles of rarity color
  โ†’ Remove entity

2.2 SIZE SCALING by item material prefix:
- "wooden_"    โ†’ scale 3.0f
- "stone_"     โ†’ scale 3.5f
- "iron_"      โ†’ scale 4.0f
- "golden_"    โ†’ scale 4.5f
- "diamond_"   โ†’ scale 5.0f
- "netherite_" โ†’ scale 6.5f
- Food items   โ†’ scale 4.0f
- Default      โ†’ scale 3.5f
- Apply config multiplier giantItemScale on top

2.3 PARTICLE COLORS by item type:
- Common (wood/stone tools)  โ†’ WHITE  โ†’ ParticleTypes.ITEM_SNOWFLAKE
- Iron tools                 โ†’ GRAY   โ†’ ParticleTypes.ASH
- Food items                 โ†’ GREEN  โ†’ ParticleTypes.COMPOSTER
- Tools/Weapons (gold+)      โ†’ ORANGE โ†’ ParticleTypes.FLAME
- Armor                      โ†’ BLUE   โ†’ ParticleTypes.ENCHANT
- Diamond items              โ†’ CYAN   โ†’ ParticleTypes.DOLPHIN
- Netherite items            โ†’ PURPLE โ†’ ParticleTypes.WITCH
- Enchanted Golden Apple     โ†’ GOLD   โ†’ ParticleTypes.FIREWORK

=======================================================
SECTION 3: SPECIAL COLLECTION ABILITIES
=======================================================

When a player collects a Giant Item Entity, trigger these effects:

- SWORD (any):          Strength II/60s + Speed I/30s + spawn 20 CRIT particles
- AXE (any):            Strength I/45s + Resistance I/20s
- PICKAXE (any):        Haste II/60s + Night Vision/30s
- SHOVEL (any):         Speed III/30s + Jump Boost II/30s
- HOE:                  Luck III/120s + Saturation/10s
- BOW:                  Speed II/30s + drop 10 harmless arrows from sky around player
- CROSSBOW:             Speed II/30s + Slow Falling/15s
- ANY ARMOR:            Resistance II/30s + Regeneration I/15s + play ARMOR_EQUIP_DIAMOND
- BREAD/COOKED MEATS:   Full hunger restore + Regeneration II/10s
- GOLDEN APPLE:         Absorption IV/120s + Regeneration II/30s + Glowing/10s
- ENCHANTED GOLDEN APPLE: Absorption X/300s + Resistance IV/60s + Fire Resistance/60s
                          + Regeneration IV/30s + spawn 5 FireworkRocketEntity with random colors
- SHIELD:               Resistance III/20s + Speed reduced 50% for 5s (Mining Fatigue flavor)
- FISHING ROD:          Teleport to nearest water within 64 blocks OR Luck III/60s
- CLOCK:                Nausea/3s then Night Vision/60s
- COMPASS:              Speed II/30s + show title "ยง6โžค Heading to Spawn!"
- ELYTRA:               Slow Falling/60s + Levitation/3s + play ELYTRA_FLYING sound
- TRIDENT:              Summon cosmetic lightning at player + Resistance I/20s + Speed I/20s
- TNT (crafted):        Giant TNT explodes after 3s countdown (power 6), show title "ยงc3... 2... 1... :boom:"
- BED:                  Regeneration III/30s + set spawn point + play NOTE_BLOCK_HARP
- BOOKSHELF:            Hero of the Village I/60s + give 50 XP
- CHEST:                Spawn floating loot chest entity that drops 3-7 items from SIMPLE_DUNGEON loot table
- DEFAULT:              Luck I/30s + spawn 10 XP orbs

=======================================================
SECTION 4: CRAFTING TABLE INTERCEPT (Normal 3x3)
=======================================================

4.1 Keep the original Giant Item Entity system for NORMAL 3x3 crafting tables:
- Listen to PlayerEvent.ItemCraftedEvent (NeoForge event)
- When fired:
  a. Cancel item going to inventory (set result to ItemStack.EMPTY)
  b. Spawn GiantItemEntity at player pos + (0, 1.5, 0) with the crafted item
  c. Show title: "ยง6โœฆ Giant [ItemName] appeared! ยงeโœฆ"
  d. Subtitle: "ยง7Walk into it to collect!"
  e. Play ENTITY_PLAYER_LEVELUP sound

4.2 Giant Crafting Table does NOT trigger this event โ€” it has its own output slot system.
    When a player takes from the Giant Crafting Table output slot:
  a. Spawn GiantItemEntity at block pos + (0, 2, 0)
  b. Scale is doubled compared to normal (giantScale * 2.0f) because it came from giant table
  c. Show title: "ยง5โœฆโœฆ MEGA Giant [ItemName]! โœฆโœฆ" in dark purple
  d. Play WITHER_SPAWN sound at 0.5 volume (epic feel)
  e. Apply ability effects at DOUBLE duration when collected

=======================================================
SECTION 5: RENDERING
=======================================================

5.1 GiantItemRenderer (Client only, @EventBusSubscriber Dist.CLIENT):
- EntityRenderer
- In render():
  a. PoseStack push
  b. Translate to entity center + bob offset
  c. Scale by entity.giantScale
  d. Rotate Y by entity.yRot
  e. Render item using ItemRenderer.renderStatic() with TransformType.GROUND
  f. Below the item, render a glowing ring (flat disc) using RenderSystem
     Color matches rarity particle color, alpha pulses with sin wave
  g. PoseStack pop
- Shadow radius = giantScale * 0.5f

5.2 GiantCraftingTableBlockEntityRenderer (Client only):
- BlockEntityRenderer
- Renders the block at 2x scale
- Animated golden particle ring orbiting the block
- Small floating "16x16" text label above the block using font renderer

=======================================================
SECTION 6: CONFIG
=======================================================

File: giantcraftings-common.toml

[general]
giantItemScale = 1.0          # float multiplier on top of base scale
abilityEffectsEnabled = true  # enable/disable collection abilities
despawnTimeSeconds = 300       # how long giant items last before despawning
particlesEnabled = true        # enable/disable particles
soundVolume = 1.0              # volume multiplier for all mod sounds
doubleEffectsFromGiantTable = true  # double duration from Giant Table crafts
giantTableRequiresDiamond = true    # require diamond block in center for recipe

=======================================================
SECTION 7: PROJECT STRUCTURE
=======================================================

Package root: com.yourname.giantcraftings

Files to generate:
- GiantCraftingsMod.java               (main mod class, DeferredRegisters)
- block/GiantCraftingTableBlock.java
- block/GiantCraftingTableBlockEntity.java
- menu/GiantCraftingTableMenu.java
- screen/GiantCraftingTableScreen.java
- recipe/GiantRecipe.java
- recipe/GiantRecipeSerializer.java
- recipe/GiantRecipeType.java
- entity/GiantItemEntity.java
- renderer/GiantItemRenderer.java
- renderer/GiantCraftingTableBlockEntityRenderer.java
- event/CraftingEventHandler.java
- event/ClientEventHandler.java
- registry/ModBlocks.java
- registry/ModBlockEntities.java
- registry/ModMenuTypes.java
- registry/ModEntities.java
- registry/ModRecipes.java
- config/GiantCraftingsConfig.java
- data/giantcraftings/recipes/giant_sword_of_titans.json
- data/giantcraftings/recipes/giant_golden_apple.json
- data/giantcraftings/recipes/giant_beacon.json
- data/giantcraftings/recipes/giant_elytra.json
- data/giantcraftings/recipes/giant_tnt.json
- resources/assets/giantcraftings/textures/INVENTORY GUI/giant_crafting_table.png (placeholder note)
- resources/assets/giantcraftings/models/block/giant_crafting_table.json
- resources/assets/giantcraftings/blockstates/giant_crafting_table.json
- resources/META-INF/mods.toml
- build.gradle

=======================================================
SECTION 8: BUILD.GRADLE
=======================================================

- Minecraft version: 1.20.1
- NeoForge version: 47.1.106 (or latest 47.1.x)
- Mappings: official (mojmap)
- Java: 17
- Group: com.yourname
- Mod version: 1.0.0

Generate complete compilable Java source code for ALL files listed above.
Include every import statement.
Use DeferredRegister for all registries.
Use ModLoadingContext.get().registerConfig() for config.
Register client-only renderers inside FMLClientSetupEvent using DistExecutor or @EventBusSubscriber(value = Dist.CLIENT).
Do NOT use deprecated NeoForge APIs.
All event handlers must use @SubscribeEvent and be registered properly on MOD or FORGE bus as appropriate.
Kodari can make mistakes. Review important code before using.
Files

No files in this session

Code