Jump to content
View in the app

A better way to browse. Learn more.

Forge Forums

A full-screen app on your home screen with push notifications, badges and more.

To install this app on iOS and iPadOS
  1. Tap the Share icon in Safari
  2. Scroll the menu and tap Add to Home Screen.
  3. Tap Add in the top-right corner.
To install this app on Android
  1. Tap the 3-dot menu (⋮) in the top-right corner of the browser.
  2. Tap Add to Home screen or Install app.
  3. Confirm by tapping Install.

_p1nero

Members
  • Joined

  • Last visited

  1. I want to create a custom village, but it's difficult to program... I found some datapack tutorials that made it. So if I copy the json file and nbt file from the datapack to my mod's data folder, will it work?
  2. I try to use the WorldEdit API follow https://worldedit.enginehub.org/en/latest/api/, but failed to setup environment.When I runClient, there is an error Caused by: java.lang.ClassNotFoundException: com.sk89q.worldedit.extension.platform.Platform but I can access the class Platform in my code. build.gradle buildscript { repositories { maven { url = 'https://repo.spongepowered.org/repository/maven-public/' } } } plugins { id 'eclipse' id 'idea' id 'maven-publish' id 'net.minecraftforge.gradle' version '[6.0,6.2)' // id 'org.parchmentmc.librarian.forgegradle' version '1.+' id 'org.spongepowered.mixin' version '0.7.+' } version = mod_version group = mod_group_id base { archivesName = mod_id } java.toolchain.languageVersion = JavaLanguageVersion.of(17) println "Java: ${System.getProperty 'java.version'}, JVM: ${System.getProperty 'java.vm.version'} (${System.getProperty 'java.vendor'}), Arch: ${System.getProperty 'os.arch'}" minecraft { mappings channel: mapping_channel, version: mapping_version copyIdeResources = true runs { configureEach { workingDirectory project.file('run') property 'forge.logging.markers', 'REGISTRIES' property 'forge.logging.console.level', 'debug' arg "-mixin.config=hdl.mixins.json" mods { "${mod_id}" { source sourceSets.main } } } client { property 'forge.enabledGameTestNamespaces', mod_id arg "-mixin.config=hdl.mixins.json" } server { property 'forge.enabledGameTestNamespaces', mod_id args '--nogui' } gameTestServer { property 'forge.enabledGameTestNamespaces', mod_id } data { workingDirectory project.file('run-data') args '--mod', mod_id, '--all', '--output', file('src/generated/resources/'), '--existing', file('src/main/resources/') } } } sourceSets.main.resources { srcDir 'src/generated/resources' } repositories { maven { name = 'GeckoLib' url 'https://dl.cloudsmith.io/public/geckolib3/geckolib/maven/' } maven { // name = 'worldedit-forge-mc1.20.1' url "https://maven.enginehub.org/repo/" } } dependencies { minecraft "net.minecraftforge:forge:${minecraft_version}-${forge_version}" annotationProcessor 'org.spongepowered:mixin:0.8.5:processor' implementation fg.deobf('software.bernie.geckolib:geckolib-forge-1.20.1:4.2.2') implementation fg.deobf('com.sk89q.worldedit:worldedit-forge-mc1.20:7.2.15') implementation fg.deobf('com.sk89q.worldedit:worldedit-core:7.2.15') } mixin { add sourceSets.main, 'hdl.mixin-refmap.json' config 'hdl.mixins.json' } tasks.named('processResources', ProcessResources).configure { var replaceProperties = [ minecraft_version: minecraft_version, minecraft_version_range: minecraft_version_range, forge_version: forge_version, forge_version_range: forge_version_range, loader_version_range: loader_version_range, mod_id: mod_id, mod_name: mod_name, mod_license: mod_license, mod_version: mod_version, mod_authors: mod_authors, mod_description: mod_description, ] inputs.properties replaceProperties filesMatching(['META-INF/mods.toml', 'pack.mcmeta']) { expand replaceProperties + [project: project] } } tasks.named('jar', Jar).configure { manifest { attributes([ 'Specification-Title' : mod_id, 'Specification-Vendor' : mod_authors, 'Specification-Version' : '1', 'Implementation-Title' : project.name, 'Implementation-Version' : project.jar.archiveVersion, 'Implementation-Vendor' : mod_authors, 'Implementation-Timestamp': new Date().format("yyyy-MM-dd'T'HH:mm:ssZ"), "MixinConfigs": "hdl.mixins.json" ]) } // This is the preferred method to reobfuscate your jar file finalizedBy 'reobfJar' } publishing { publications { register('mavenJava', MavenPublication) { artifact jar } } repositories { maven { url "file://${project.projectDir}/mcmodsrepo" } } } tasks.withType(JavaCompile).configureEach { options.encoding = 'UTF-8' } the key part: repositories { maven { name = 'GeckoLib' url 'https://dl.cloudsmith.io/public/geckolib3/geckolib/maven/' } maven { // name = 'worldedit-forge-mc1.20.1' url "https://maven.enginehub.org/repo/" } } dependencies { minecraft "net.minecraftforge:forge:${minecraft_version}-${forge_version}" annotationProcessor 'org.spongepowered:mixin:0.8.5:processor' implementation fg.deobf('software.bernie.geckolib:geckolib-forge-1.20.1:4.2.2') implementation fg.deobf('com.sk89q.worldedit:worldedit-forge-mc1.20:7.2.15') implementation fg.deobf('com.sk89q.worldedit:worldedit-core:7.2.15') }
  3. Thanks bro, It work well now! I found that it's due to my island generate algorithm. It's possible to generated an island with a height of 0 lol
  4. Sorry for my poor English lol I meant an invisible "barrier" not "barrel".
  5. Thanks bro, I add the check side code and now when I right click it just give me a hand animation and generate nothing, even an invisible barrier... @Override public InteractionResult useOn(UseOnContext context) { Level level = context.getLevel(); if(!level.isClientSide){ SkyIslandGenerator skyIslandGenerator = new SkyIslandGenerator(); skyIslandGenerator.printSkyIsland(context.getClickedPos(),context.getLevel()); } return InteractionResult.sidedSuccess(level.isClientSide); } } public void printSkyIsland(BlockPos bottom, Level level) { double[][] skyIsland = generateSkyIsland(width, length, scale, octaves, persistence, lacunarity, seed, maxHeight*10); int maxHeight = -1; int max_x = 0, max_z = 0; for (int x = 0; x < width; x++) { for (int z = 0; z < length; z++) { if (skyIsland[x][z] > maxHeight) { maxHeight = (int)skyIsland[x][z]; max_x = x; max_z = z; } System.out.print("("+x+','+z+"):"+(int)skyIsland[x][z]+" "); } System.out.println(); } BlockPos.MutableBlockPos blockPos = new BlockPos.MutableBlockPos(0,0,0); for (int x = 0; x < width; x++) { for (int z = 0; z < length; z++) { for(int y = bottom.getY()+maxHeight ; y>bottom.getY()+maxHeight-skyIsland[x][z] ; y--){ blockPos.set(bottom.getX()+x-max_x,y,bottom.getZ()+z-max_z); level.setBlock(blockPos, Blocks.DIRT.defaultBlockState(), 3); } } } }
  6. I created a item when you click on block it will generate a skyisland. But it just generate one dirt on where I click. I'm sure it generated because there is an invisible barrel in which the dirt should be. And when I restart the game, the invisible dirt appear. level.setBlockAndUpdate() is the same. Item.java package net.p1nero.skyislandbuilder.item; import net.minecraft.world.InteractionHand; import net.minecraft.world.InteractionResult; import net.minecraft.world.InteractionResultHolder; import net.minecraft.world.entity.player.Player; import net.minecraft.world.item.Item; import net.minecraft.world.item.ItemStack; import net.minecraft.world.item.context.UseOnContext; import net.minecraft.world.level.Level; import net.p1nero.skyislandbuilder.utils.SkyIslandGenerator; public class PerlinSkyIslandBuilderItem extends Item { public PerlinSkyIslandBuilderItem(Properties properties) { super(properties); } @Override public InteractionResultHolder<ItemStack> use(Level p_41432_, Player p_41433_, InteractionHand p_41434_) { //TODO: Open setting window return super.use(p_41432_, p_41433_, p_41434_); } @Override public InteractionResult useOn(UseOnContext context) { SkyIslandGenerator skyIslandGenerator = new SkyIslandGenerator(context.getClickedPos(),context.getLevel()); skyIslandGenerator.printSkyIsland(); return super.useOn(context); } } SkyIslandGenerator.java public void printSkyIsland() { double[][] skyIsland = generateSkyIsland(width, height, scale, octaves, persistence, lacunarity, seed, maxHeight*10); int maxHeight = -1; int max_x = 0, max_z = 0; for (int x = 0; x < width; x++) { for (int z = 0; z < height; z++) { if (skyIsland[x][z] > maxHeight) { maxHeight = (int)skyIsland[x][z]; max_x = x; max_z = z; } System.out.print("("+x+','+z+"):"+(int)skyIsland[x][z]+" "); } System.out.println(); } for (int x = 0; x < width; x++) { for (int z = 0; z < height; z++) { for(int y = bottom.getY()+maxHeight ; y>bottom.getY()+maxHeight-skyIsland[x][z] ; y--){ level.setBlock(new BlockPos(bottom.getX()+x-max_x,y,bottom.getZ()+z-max_z), Blocks.DIRT.defaultBlockState(),3); } } } }

Important Information

By using this site, you agree to our Terms of Use.

Configure browser push notifications

Chrome (Android)
  1. Tap the lock icon next to the address bar.
  2. Tap Permissions → Notifications.
  3. Adjust your preference.
Chrome (Desktop)
  1. Click the padlock icon in the address bar.
  2. Select Site settings.
  3. Find Notifications and adjust your preference.