Jump to content

[1.4.7]Server side dimension mod


thomas15v

Recommended Posts

Is it possible to make a Dimension in the server without having to change the client?

 

@Override
  public void processCommand(ICommandSender icommandsender, String[] astring)
  {
int id = DimensionManager.getNextFreeDimId();


DimensionManager.registerDimension(id, 0);

    EntityPlayerMP  player = (EntityPlayerMP)icommandsender;
    player.travelToDimension(id);
    
  }

This is the coding i am trying to use. I thought if i used the 0 as provider i could use the normal overworld provider.

 

Any1 an idea :(. I am trying to get multiworld support in an existing modpack (won't tell the name idk if it is hated to here :S).

Link to comment
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.

Guest
Unfortunately, your content contains terms that we do not allow. Please edit your content to remove the highlighted words below.
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

Announcements



  • Recently Browsing

    • No registered users viewing this page.
  • Posts

    • Made a block, copies exactly the soul campfire. But when I start Minecraft, it starts, and right before it goes into full screen, it errors out. That's when I get 2 of these: Caused by: java.lang.IllegalArgumentException: Cannot get property BooleanProperty{name=lit, clazz=class java.lang.Boolean, values=[true, false]} as it does not exist in Block{minecraft:air} And 2 of these: Caused by: java.lang.NullPointerException: Registry Object not present: revive:block_campfire   Thanks!
    • Here is a tutorial; this is what I used. 1.20 Minecraft Forge Modding Tutorial - Packets
    • Corrected item registration code: (for the ModItems class) public static final RegistryObject<Item> LEMON_JUICE_BOTTLE = ITEMS.register("lemon_juice_bottle", () -> new HoneyBottleItem(new Item.Properties().stacksTo(1) .food((new FoodProperties.Builder()).nutrition(3).saturationMod(0.25F) .effect(() -> new MobEffectInstance(MobEffects.DAMAGE_RESISTANCE, 1500), 0.5f).build())));
    • Apologies for the late reply. You'll need to register the item in ModItems; if you're following those tutorials, that's the only place you should ever register items. Otherwise, the mod will fail to register them properly and you'll get all sorts of interesting errors. Looking back at the code snipped I posted, I think that actually has some errors. I'm adding a lemon juice bottle to my mod just to ensure that it works correctly, and I will reply when I have solved the problems.
    • I might have an idea why your original method was causing so much trouble. See this while loop? You're only incrementing the number of blocks you've corrupted if you find one that you can corrupt. What happens if you can't find any? The while loop will run forever (a long time). This could happen if, for instance, the feature generates inside a vein of blocks that aren't marked as STONE_ABERRANTABLE. There are two alternate strategies I'd recommend to fix this.  First, you could simply increment numBlockCorrupted regardless of whether you've actually corrupted the block. This is the simplest and quickest way, and it should ensure that the loop runs no more than numBlocksToCorrupt times.  Alternatively, you could add a "kill switch" that keeps track of how many times the loop runs, and then ends it after a certain limit of your choosing. That could look something like this:  // Keeps track of how many blocks have been checked so far. int numBlocksChecked = 0; // Check up to twice as many blocks as you actually want to corrupt. // This is a good compromise between speed and actually getting the number of blocks // that you want to corrupt. int numBlocksToCheck = numBlocksToCorrupt * 2; // Modified the while loop condition to end after a certain number of blocks are checked. while (numBlocksCorrupted < numBlocksToCorrupt && numBlocksChecked < numBlocksToCheck) {                 // Generate a random position within the area, using the offset origin                 BlockPos randomPos = offsetOrigin.offset(                         ctx.random().nextInt(2 * areaSizeX + 1) - areaSizeX, // between -areaSize and areaSize                         ctx.random().nextInt(2 * areaSizeY + 1) - areaSizeY,                         ctx.random().nextInt(2 * areaSizeZ + 1) - areaSizeZ                 );                 // If the block at the random position is in the IS_ORE_ABERRANTABLE tag, replace it                 if (world.getBlockState(randomPos).is(ModBlockTags.STONE_ABERRANTABLE)) {                     world.setBlock(randomPos, surroundingBlockState, 2);                     numBlocksCorrupted++;                 } // Increment the number of blocks that you've checked. numBlocksChecked++;             } Let me know if you're still running into lag problems or are confused by my explanation.
  • Topics

×
×
  • Create New...

Important Information

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