przeczytaj pliki oraz z tego linku https://modrinth.com/mod/oresim znajdz source code tego moda i zmien go na wersje 1.21.4 i zoptymalizuj go jak kolwiek
📄
pasted-code-1783364703688.txt
txt
15 lines
▶
zrob mi dokladnie takiego samego moda jak ten DOKLADNIE TAKIEGO SAMEGO 1:1 zero roznic poza tym ze ten ktory stworzysz bedzie na wersje 1.21.4 jesli bedzie to potrzebne znajdz wiecej informacji na temat tego moda. https://modrinth.com/mod/oresim Masz tutaj wzór wysłałem ci pliki tego moda. Pamietaj zeby nie popełnic tych błędów CountPlacementModifierAccessor — OnceCount from net.minecraft.world.gen.count doesn’t exist in 1.21.4. The count field in CountPlacementModifier is typed as IntProvider from net.minecraft.util.math.intprovider.IntProvider.
OreSimRenderer line 21 — ClientWorld.getSeed() doesn’t exist in 1.21.4. Will use config.seed directly (the renderer already has a seed fallback).
OreSimRenderer line 41 — DrawMode is now VertexFormat.DrawMode in 1.21.4.
Used 2 tools
Three fixes applied:
CountPlacementModifierAccessor.java — Changed OnceCount → IntProvider, removed the old import
OreSimRenderer.java line 21 — client.world.getSeed() → config.seed (direct seed from config)
OreSimRenderer.java line 41 — DrawMode.DEBUG_LINES → VertexFormat.DrawMode.DEBUG_LINES, added import for VertexFormat
📄
fabric.mod.json
json
34 lines
▶
{
"schemaVersion": 1,
"id": "oresim",
"version": "1.0.0",
"name": "Ore Sim",
"description": "Simulates Minecraft ore generation from a known world seed.",
"authors": [
"arc1y"
],
"contact": {
"homepage": "https://modrinth.com/user/arc1y"
},
"license": "GPL-3.0",
"icon": "assets/oresim/icon.png",
"environment": "client",
"entrypoints": {
"main": [
"com.arc1y.oresim.OreSimMod"
],
"client": [
"com.arc1y.oresim.client.OreSimClient"
]
},
"mixins": [
"oresim.mixins.json"
],
"depends": {
"fabricloader": ">=0.19.3",
"minecraft": "~1.21.11",
"java": ">=21",
"fabric-api": "*"
}
}
📄
oresim.mixins.json
json
17 lines
▶
{
"required": true,
"package": "com.arc1y.oresim.mixin",
"compatibilityLevel": "JAVA_21",
"mixins": [
"CountPlacementModifierAccessor",
"HeightRangePlacementModifierAccessor",
"RarityFilterPlacementModifierAccessor"
],
"injectors": {
"defaultRequire": 1
},
"overwrites": {
"requireAnnotations": true
}
}
📄
en_us.json
json
6 lines
▶
{
"key.oresim.open_gui": "Open OreSim INVENTORY GUI",
"key.oresim.toggle": "Toggle OreSim",
"category.oresim": "OreSim"
}
I’ll build the OreSim mod for Fabric 1.21.4 — a client-side ore prediction visualizer.
Let me create all the project files. Starting with build files, then resources, then source code
Now I’ll create the complete OreSim mod. Let me start with the build system and resources
I’ll create the complete OreSim mod for 1.21.4. Let me build all the files systematically.
The compilation failed with this error:
Compilation failed with 6 error(s):
ERROR in src/main/java/com/arc1y/oresim/simulation/OreSimulator.java at line 95: method getTopY in class World cannot be applied to given types;
if (yLevel < world.getBottomY() || yLevel > world.getTopY()) continue;
^
ERROR in src/main/java/com/arc1y/oresim/simulation/OreSimulator.java at line 123: incompatible types: java.util.Random cannot be converted to net.minecraft.util.math.random.Random
return provider.get(random);
^
ERROR in src/main/java/com/arc1y/oresim/simulation/OreSimulator.java at line 142: constructor HeightContext in class HeightContext cannot be applied to given types;
return provider.get(random, new net.minecraft.world.gen.HeightContext(null));
^
ERROR in src/main/java/com/arc1y/oresim/simulation/OreSimulator.java at line 95: method getTopY in class World cannot be applied to given types;
if (yLevel < world.getBottomY() || yLevel > world.getTopY()) continue;
^
ERROR in src/main/java/com/arc1y/oresim/simulation/OreSimulator.java at line 142: constructor HeightContext in class HeightContext cannot be applied to given types;
return provider.get(random, new net.minecraft.world.gen.HeightContext(null));
^
ERROR in src/main/java/com/arc1y/oresim/simulation/OreSimulator.java at line 123: incompatible types: java.util.Random cannot be converted to net.minecraft.util.math.random.Random
return provider.get(random);
^
=== COMPILATION ERROR ANALYSIS ===
TYPE MISMATCHES:
- incompatible types: java.util.Random cannot be converted to net.minecraft.util.math.random.Random
- incompatible types: java.util.Random cannot be converted to net.minecraft.util.math.random.Random
ACTION: Fix variable types or casting
FILES TO INVESTIGATE:
- src/main/java/com/arc1y/oresim/simulation/OreSimulator.java
- src/main/java/com/arc1y/oresim/simulation/OreSimulator.java
Please fix this error by creating a new artifact with the corrected code.
All 5 errors fixed:
java.util.Random→net.minecraft.util.math.random.Random: Changednew Random(...)toRandom.create(...)(lines 65, 87)world.getTopY()→ dimension height:world.getTopY()doesn’t exist in 1.21.4; replaced withworld.getDimension().minY()+world.getDimension().height()HeightContext(null)→HeightContext(world): The constructor needs aWorldreference, notnull
The mod should now compile.
package com.arc1y.oresim;
import com.arc1y.oresim.config.OreSimConfig;
import com.arc1y.oresim.command.OreSimCommands;
import net.fabricmc.api.ModInitializer;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
public class OreSimMod implements ModInitializer {
public static final String MOD_ID = "oresim";
public static final Logger LOGGER = LoggerFactory.getLogger(MOD_ID);
@Override
public void onInitialize() {
OreSimConfig.load();
OreSimCommands.register();
LOGGER.info("OreSim initialized");
}
}