PolyMc-Extra

Quick rating

PolyMc-Extra

No reviews yet

Automatically patch mods so that regular players don't need to install mods to join your server!

API/Library
Mod Loaders
Fabric
Minecraft

Community voices

Reviews

Versions
Loading versions…
Match includes

Click once to include, again to exclude, again to clear

Rating Any
Any 0.5 1.0 1.5 2.0 2.5 3.0 3.5 4.0 4.5 5.0
Min
Max
Play Status
Reviews
Time Played
hrs+
Verified developers only
Has developer response
List view
Grid view
Compact view
Sort by
Date
Rating
Helpful
Unhelpful
Edited
Sort ascending
Delete this review?

This removes your review from the project. You can write a new review after.

Review submitted for moderation

Your review has been sent to moderators, who will check that it meets our guidelines before it appears publicly.

No reviews yet. Be the first to review this project!

Get it on

Available Platforms

Compatibility

Supported Environments

Dev Environment
Client Unsupported
Server Required

About

Project Details

Type
Mod
License
GNU General Public License v3.0 only
Authors

For authors

Embed Badge

If you're the author of this project, you can embed a live badge anywhere that supports HTML or Markdown. It updates automatically whenever ratings change.

Custom banner text
ModDex rating badge preview

Use HTML for any page that supports it, or Markdown for README files and Markdown-based descriptions.

Identifiers

Platform IDs

Modrinth ID

Resources

External Links

About

Description

PolyMc-Extra

This is a server-side library and a tool for providing automatic patching mods for PolyMc. It functions similarly to PolyMc but is more powerful. It enables automatic patching of certain mods, and its patching functionality can be controlled by modifying configuration files.

The following registry entries were processed by the patch

List: Attribute, EntityType, SoundEvent, ComponentType, EnchantmentEffectComponentType, EnchantmentLocationBaseEffectType, EnchantmentEntityEffectType, StatusEffect, Potion, ScreenHandlers, ConsumeEffectType, StatType, CustomStat, PoiType, ItemGroup, Item, Block, BlockEntityType, Profession

Runtime Lifecycle:

  1. Register the built-in ExtraModelType
  2. Register Special Entity Mappings
  3. Scan and execute all module's "polymc-extra" entry points (PolyMcExtraEntrypoint.class)
  4. Before all static registry entries freeze: Read the configuration file, iterate through the registry, and patch each missing item (server-only)
  5. Verify item components integrity
  6. Scan for required resources in JAR files and generate resource packages

For player/server owners/mod pack makers:

It can automatically repair the state of corresponding polymer blocks for most mods, allowing Vanilla clients to join servers with mods.

For mod developers:

It provides several APIs and tools for developers to patch complex mods; for others, you can ask questions on Discord.

Knowledge required

You should first learn how to use some libraries.

Development Environment

  1. Create a libs folder in your module project directory.
  2. Download the JAR file and place it in the libs folder in your module project directory.
  3. Add the following content to build.gradle:
repositories {
    maven { url "https://maven.nucleoid.xyz" }
    maven { url "https://maven.tomalbrc.de" }
    maven { url "https://api.modrinth.com/maven" }
    maven { url "https://maven.architectury.dev/" }
    maven {
        url "https://maven.theepicblock.nl"
        content { includeGroup("nl.theepicblock") }
    }
    flatDir {
        dirs 'libs'
    }
}
dependencies {
    modImplementation("eu.pb4:polymer-core:[${polymer_version}]")
    modImplementation("eu.pb4:polymer-blocks:[${polymer_version}]")
    modImplementation("eu.pb4:polymer-resource-pack:[${polymer_version}]")
    modImplementation("eu.pb4:polymer-resource-pack-extras:[${polymer_version}]")
    modImplementation("eu.pb4:polymer-virtual-entity:[${polymer_version}]")
    modImplementation("eu.pb4:polymer-autohost:${polymer_version}")
    modImplementation("eu.pb4:polymer-networking:[${polymer_version}]")
    modImplementation("nl.theepicblock:resource-locator-api:${project.resource_locator_version}")
    modImplementation("eu.pb4:factorytools:[${factorytools_version}]")
    modImplementation("eu.pb4:sgui:[${sgui_version}]")
    modImplementation("xyz.nucleoid:server-translations-api:${server_translation_api_version}")
    
    modImplementation files('libs/PolyMc-Extra-XXXXXXX.jar')
    modCompileOnly 'maven.modrinth:polydex:XXXXXX'
}

Patch Code Example

public class PolymerifyRegistry implements PolyMcExtraEntrypoint {

    @Override
    public void onInitialize() {
        PolymerifyRegistry.initialize();
        PolyMcExtraPacks.NAMESPACES.add(getNamespace());
    }
    
    public static void initialize() {
        registerPolymerBlock(BlockRegistry.XXX, XXXPolymerBlock.INSTANCE);
        registerPolymerItem(BlockRegistry.XXX, new PolymerItemImpl(BlockRegistry.XXX.asItem()));
    }

    public static void registerPolymerBlock(Block block, PolymerBlock polymerBlock) {
        ResourceLocation key = BuiltInRegistries.BLOCK.getKey(block);
        PolymerBlock.registerOverlay(block, polymerBlock);
        if (polymerBlock instanceof BlockWithElementHolder elementHolder) {
            BlockWithElementHolder.registerOverlay(block, elementHolder);
        }
        PolyMcExtra.LATE_INIT.add(new Runnable() {
            @Override
            public void run() {
                if (PolymerBlockHelper.testJsonExist(block)) {
                    BlockStateModelManager.addBlock(key, block);
                }
            }
        });
    }

    public static void registerPolymerItem(ItemLike item, PolymerItem polymerItem) {
        PolymerItem.registerOverlay(item.asItem(), polymerItem);
    }
    
    @Override
    public String getNamespace() {
        return MOD_ID;
    }
}

public class XXXPolymerBlock {
    public static final BlockState OVERLAY_0 = PolymerBlockResourceUtils.requestEmpty(BlockModelType.ACTIVE_PRESSURE_PLATE);
    public static final BlockState OVERLAY_1 = PolymerBlockResourceUtils.requestEmpty(BlockModelType.KELP_BLOCK);
    public static final BaseFactoryBlock INSTANCE = new BaseFactoryBlock(OVERLAY_0, false, BlockStateModel::midRange) {
        @Override
        public BlockState getPolymerBlockState(BlockState state, PacketContext context) {
            if (state.hasProperty(BlockStateProperties.WATERLOGGED) && state.getValue(BlockStateProperties.WATERLOGGED)) {
                return OVERLAY_1;
            }
            return super.getPolymerBlockState(state, context);
        }
    };
}

Example Config:

The configuration file is located at /config/polymc-extra.json

{
	"DisabledOpaqueBlocks": [],
	"CustomBlockModelTypeMappings": {
		"citymod:stone_table": "BLOCK_DISPLAY_ENTITY",
		"citymod:road_block": "BLOCK_DISPLAY_ENTITY_NO_COLLISION",
		"citymod:road_yellow": "BLOCK_DISPLAY_ENTITY_NO_COLLISION",
		"citymod:road_yellow_connect": "BLOCK_DISPLAY_ENTITY_NO_COLLISION",
		"citymod:road_white_connect": "BLOCK_DISPLAY_ENTITY_NO_COLLISION",
		"citymod:road_yellow_double": "BLOCK_DISPLAY_ENTITY_NO_COLLISION",
		"citymod:road_zebra_crossing": "BLOCK_DISPLAY_ENTITY_NO_COLLISION",
		"citymod:roadblock_oblique": "BLOCK_DISPLAY_ENTITY_NO_COLLISION",
		"citymod:roadblock_yellow_oblique": "BLOCK_DISPLAY_ENTITY_NO_COLLISION",
		"citymod:roadblock_double_oblique": "BLOCK_DISPLAY_ENTITY_NO_COLLISION",
		"citymod:zebracrossing_oblique": "BLOCK_DISPLAY_ENTITY_NO_COLLISION",
		"citymod:road_straight": "BLOCK_DISPLAY_ENTITY_NO_COLLISION",
		"citymod:road_diamond": "BLOCK_DISPLAY_ENTITY_NO_COLLISION",
		"js_furniture_mod:modern_light": "BLOCK_DISPLAY_ENTITY_NO_COLLISION",
		"js_furniture_mod:computer_mouse": "BLOCK_DISPLAY_ENTITY_NO_COLLISION",
		"js_furniture_mod:black_mirror": "BLOCK_DISPLAY_ENTITY_NO_COLLISION",
		"js_furniture_mod:laptop": "BLOCK_DISPLAY_ENTITY_NO_COLLISION",
		"js_furniture_mod:modern_clock": "BLOCK_DISPLAY_ENTITY_NO_COLLISION",
		"js_furniture_mod:led_floor_lamp": "BLOCK_DISPLAY_ENTITY_NO_COLLISION",
		"js_furniture_mod:shower": "BLOCK_DISPLAY_ENTITY_NO_COLLISION",
		"js_furniture_mod:portable_laptop_stand": "BLOCK_DISPLAY_ENTITY_NO_COLLISION",
		"js_furniture_mod:laptop_closed_portable_laptop_stand": "BLOCK_DISPLAY_ENTITY_NO_COLLISION",
		"js_furniture_mod:cooktop": "BLOCK_DISPLAY_ENTITY_NO_COLLISION",
		"js_furniture_mod:keyboard": "BLOCK_DISPLAY_ENTITY_NO_COLLISION",
		"js_furniture_mod:monitor_setup": "BLOCK_DISPLAY_ENTITY_NO_COLLISION",
		"js_furniture_mod:shower": "BLOCK_DISPLAY_ENTITY_NO_COLLISION",
		"js_furniture_mod:socket": "BLOCK_DISPLAY_ENTITY_NO_COLLISION",
		"js_furniture_mod:modern_chair": "BLOCK_DISPLAY_ENTITY_NO_COLLISION",
		"js_furniture_mod:wood_chair": "BLOCK_DISPLAY_ENTITY_NO_COLLISION",
		"^js_furniture_mod:midi_.+$": "BLOCK_DISPLAY_ENTITY_NO_COLLISION",
		"^js_furniture_mod:.*": "BLOCK_DISPLAY_ENTITY",
		"^skniro_furniture:.*_(drawer|cabinet|fridge|kitchen_sink|oven|tv_stand)$": "BLOCK_DISPLAY_ENTITY",
		"^skniro_furniture:.*_(bed|cushion|sofa|window(?:_style.*)?|plate|chair(?:_.*)?|lamp)$": "BLOCK_DISPLAY_ENTITY_NO_COLLISION",
		"^skniro_furniture:.*_window(_.*)?$": "CLOSEABLE_BLOCK",
		"^skniro_furniture:.*_(door)$": "CLOSEABLE_BLOCK",
		"^skniro_furniture:.*_glass_table": "BLOCK_DISPLAY_ENTITY",
		"terrestria:cattail": "WATER_PLANT",
		"terrestria:andisol_grass_block": "POLYMER:BIOME_TRANSPARENT_BLOCK",
		"^storagedelight:.*$": "BLOCK_DISPLAY_ENTITY",
		"^terrestria:.*_log$": "BLOCK_DISPLAY_ENTITY"
	},
	"CustomEntityModelMappings": {
		"js_furniture_mod:chair_entity": "polymc-extra:chair",
		"js_furniture_mod:sofa_entity": "polymc-extra:chair",
		"skniro_furniture:chair_entity": "polymc-extra:chair",
		"skniro_furniture:sofa_entity": "polymc-extra:chair",
		"skniro_furniture:cushion_entity": "polymc-extra:chair",
		"citymod:explode_bow_projectile": "minecraft:arrow",
		"citymod:rifle_legacy_projectile": "minecraft:arrow"
	},
	"CustomModelExpansionMappings": {
		"js_furniture_mod:sofa": 0.0,
		"js_furniture_mod:wood_light_table": 0.0,
		"js_furniture_mod:led_floor_lamp_rgb_off": 0.0,
		"js_furniture_mod:led_floor_lamp_rgb_off_2": 0.0,
		"js_furniture_mod:studio_light": 0.0,
		"citymod:road_block": 0.0,
		"citymod:road_yellow": 0.0,
		"citymod:road_yellow_connect": 0.0,
		"citymod:road_white_connect": 0.0,
		"citymod:road_yellow_double": 0.0,
		"citymod:road_zebra_crossing": 0.0
	}
}

Commands

  • /polymc-extra:
    • export-extra-block-models-mappings: Export the PolyMc-processed block map to ExtraBlockMapping.txt
    • get-all-model-types: Showing all block mapping types
    • get-client-state: Showing the true mapping and overlay mapping of the square the crosshair is pointing at.
    • get-item-info: Showing the real ID of the item in your hand and its component information.

What this library/mod doesn't do

It does not support client-side rendering.

If the module uses ASM to modify certain enums or replaces Vanilla's registry entries, it will cause some abnormal errors.

License

This mod is partially based on code from enderscape-patch and PolyMc that are licensed with GNU Lesser General Public License v3.0 and GNU Lesser General Public License 3.0

Screenshots

Gallery

Versions

Files

Relations

Project Relations

More like this

Similar Mods

Suggestions use data such as tags, dependencies, dependents, descriptions, titles, and more to rank how much they overlap with this mod.

On ModDex

Community snapshot

0
Ratings
0
Followers
0
In stacks

By the numbers

Statistics

<1,000
Downloads
Last Updated
CurseForge
Created
Last synced
When ModDex last fetched this project from CurseForge or Modrinth. Every project is re-checked on a schedule, and any project that ships a new file is synced automatically within hours of the release.
New file updates sync automatically
How syncing works