m.lecs

RealSizeMod, Animals Real Size in Fabric Plugin

Kodari AI
KodariJan 30 at 5:40 am 3,868 (v2)

I’ll create a plugin that scales Minecraft animals to their real-world sizes.

RealSizeMod
A plugin that scales Minecraft animals to their real-world sizes relative to players. Features automatic size adjustment on spawn, configurable scale factors for each animal type, and visual size modifications using entity attributes. Supports all common passive and hostile mobs with scientifically accurate proportions.

Created RealSizeMod plugin with realistic animal scaling using entity attributes. Features include configurable size multipliers for 50+ entity types, spawn event handling, chunk load support for existing entities, and admin commands for reload and entity info display.

m.lecs

The compilation failed with this error:

code
Validation failed for compilation: Compilation failed with 1 error(s):

ERROR in src/main/java/com/realsizemod/SizeManager.java at line 52: cannot find symbol
        AttributeInstance scaleAttr = living.getAttribute(Attribute.GENERIC_SCALE);
                                                                   ^
  symbol: variable GENERIC_SCALE
  location: interface Attribute


=== COMPILATION ERROR ANALYSIS ===

FILES TO INVESTIGATE:
  - src/main/java/com/realsizemod/SizeManager.java
 exceeds maximum 

Please fix this error by creating a new artifact with the corrected code.

Kodari AI
KodariJan 30 at 5:41 am 4,811 (v2)

I need to read the SizeManager.java file to see the exact code causing the issue and understand the context.

I can see the issue. The code is directly accessing Attribute.GENERIC_SCALE, which only exists in Minecraft 1.20.5+. This needs to use XAttribute for cross-version compatibility.

Fix Plan:

  • Replace direct Attribute.GENERIC_SCALE access with XAttribute.of("scale")

  • Add XAttribute import

  • Remove direct Attribute import

  • Refactor to use XAttribute’s Optional pattern

Fixed by replacing Attribute.GENERIC_SCALE with XAttribute.of("scale") for cross-version compatibility (1.8 to 1.21+).

Kodari can make mistakes. Review important code before using.
Files
src
build.gradle
Code
7 308
src/main/java/com/realsizemod/RealSizeMod.java
package com.realsizemod;

import lombok.Getter;
import org.bukkit.plugin.java.JavaPlugin;

public class RealSizeMod extends JavaPlugin {

    @Getter
    private static RealSizeMod instance;
    
    @Getter
    private SizeManager sizeManager;

    @Override
    public void onEnable() {
        instance = this;
        
        saveDefaultConfig();
        
        this.sizeManager = new SizeManager(this);
        
        getServer().getPluginManager().registerEvents(new EntitySpawnListener(this), this);
        
        RealSizeCommand commandExecutor = new RealSizeCommand(this);
        getCommand("realsizemod").setExecutor(commandExecutor);
        
        getLogger().info("RealSizeMod has been enabled!");
    }

    @Override
    public void onDisable() {
        getLogger().info("RealSizeMod has been disabled!");
    }
    
    public void reload() {
        reloadConfig();
        sizeManager.reload();
    }
}