Jump to content

World Type Nether


Gaprosys

Recommended Posts

Hello,

I have I mod which adds a world type for starting and staying in the nether. The player respawns there. I want to set the players spawn location to a uncovered netherrack block, but the methods return always the highest block, which is bedrock. In 1.7.10 I used world.provider.getEntrancePortalLocation().

Is there any way to do this in 1.9.4?

Link to comment
Share on other sites

I'm guessing that you are using a WorldProvider. Override  WorldProvider#getSpawnPoint(), to return a suitable spawn-point. Checking if it is suitable, you'd best create another method that checks in blocks through x, y & z coords in for-loops.

 

As far as I can see, the WorldProvider no longer provides anything like the getEntrancePortalLocation method, and the Teleporter#makePortal method checks for suitable locations directly.

 

I'm forcing a spawn-point to an already cleared area here: https://github.com/Matryoshika/Underworld/blob/master/src/main/java/se/Matryoshika/Underworld/WorldGen/WorldProviderCaves.java#L41

Bit messy, but been meaning to clear it up since I managed to figure out how to force a spawn-point.

Also previously known as eAndPi.

"Pi, is there a station coming up where we can board your train of thought?" -Kronnn

Published Mods: Underworld

Handy links: Vic_'s Forge events Own WIP Tutorials.

Link to comment
Share on other sites

Thanks! That helped.

Yes, I'm using a own world provider to change the respawn dimension etc.

My other problem with this world type is that every time the player creates a new world he starts in the overworld.

This seems to be standard so I wrote a method which is called by the net.minecraftforge.event.entity.EntityJoinWorldEvent:

In this method the player is send to the nether with the player.changeDimension(-1) method and it crashes every first time of a world. After the first time the player spawns correct.

 

I think that might is a "hard" teleport so that the dimension change doesn't get properly done.

Link to comment
Share on other sites

The cause of the crash is a Ticking Memory Exception.

The Code for my World Handler first spawn event method:

 

package mod.nethertweaks.world;

import java.io.*;

import mod.chaust.ChaustItems;
import mod.nethertweaks.BucketLoader;
import mod.nethertweaks.Config;
import mod.nethertweaks.ForgeSubscribe;
import mod.nethertweaks.RecipeLoader;
import net.minecraft.block.Block;
import net.minecraft.block.material.Material;
import net.minecraft.client.Minecraft;
import net.minecraft.client.entity.EntityPlayerSP;
import net.minecraft.entity.EnumCreatureType;
import net.minecraft.entity.passive.EntityAnimal;
import net.minecraft.entity.passive.EntityCow;
import net.minecraft.entity.player.EntityPlayer;
import net.minecraft.entity.player.EntityPlayerMP;
import net.minecraft.init.Blocks;
import net.minecraft.item.ItemStack;
import net.minecraft.nbt.NBTTagCompound;
import net.minecraft.server.MinecraftServer;
import net.minecraft.util.math.BlockPos;
import net.minecraft.world.DimensionType;
import net.minecraft.world.World;
import net.minecraft.world.WorldProvider;
import net.minecraft.world.WorldProviderEnd;
import net.minecraft.world.WorldProviderHell;
import net.minecraft.world.WorldProviderSurface;
import net.minecraft.world.WorldType;
import net.minecraft.world.gen.layer.GenLayer;
import net.minecraftforge.common.DimensionManager;
import net.minecraftforge.event.entity.EntityJoinWorldEvent;
import net.minecraftforge.event.entity.living.LivingSpawnEvent;
import net.minecraftforge.event.terraingen.WorldTypeEvent;
import net.minecraftforge.event.terraingen.BiomeEvent.GetWaterColor;
import net.minecraftforge.event.world.WorldEvent;
import net.minecraftforge.fml.common.eventhandler.SubscribeEvent;

public class WorldHandler{
     
    boolean isHellworldType;
         
    @SubscribeEvent
    public void changeDimensionByWorldType(WorldTypeEvent event) throws IOException, FileNotFoundException, ArrayIndexOutOfBoundsException {
         
        if(event.getWorldType() instanceof WorldTypeHellworld) {
             
            this.isHellworldType = true;
             
            DimensionManager.unregisterDimension(0);
            DimensionType.register("Overworld", "Provider", 0, WorldProviderSurfaceNTM.class, true);
            DimensionManager.registerDimension(0, DimensionType.getById(0));
             
            DimensionManager.unregisterDimension(-1);
            DimensionType.register("Nether", "Provider", -1, WorldProviderNetherNTM.class, true);
            DimensionManager.registerDimension(-1, DimensionType.getById(-1));
             
            DimensionManager.unregisterDimension(1);
            DimensionType.register("End", "Provider", 1, WorldProviderEndNTM.class, true);
            DimensionManager.registerDimension(1, DimensionType.getById(1));
             
        }
         
    }    
    
    
    @ForgeSubscribe
    @SubscribeEvent
    public void perfectJoin(net.minecraftforge.event.entity.EntityJoinWorldEvent event){
    if(event.getEntity() instanceof EntityPlayer){
    EntityPlayer player = (EntityPlayer) event.getEntity();
       if(player.dimension != -1 && isHellworldType == true) {
       
       	//player.preparePlayerToSpawn();
           player.changeDimension(-1);
       }
   
   	if(isHellworldType == false){
           
       	if(player.dimension == 0){
       	player.changeDimension(Config.nethDim);
       	}
       	if(player.dimension == 1){
       	player.changeDimension(Config.endDim);
       	}
       }
    }
    }
     
}

 

Crashlog

 

http://pastebin.com/6i21c8ar

Link to comment
Share on other sites

Navigate to the referenced line that gets a nullpointer (at net.minecraft.world.Teleporter.placeInExistingPortal(Teleporter.java:134))

Place a breakpoint on that line, and test it. You should get all the information passed to that method, before the method itself is run, which should allow you to see exactly what being passed to it, is null.

 

A guide for placing breakpoints in Eclipse: http://help.eclipse.org/mars/index.jsp?topic=%2Forg.eclipse.jdt.doc.user%2Ftasks%2Ftask-add_line_breakpoints.htm

If you are using any other IDE, you gotta lookup their breakpoint placement yourself.

Also previously known as eAndPi.

"Pi, is there a station coming up where we can board your train of thought?" -Kronnn

Published Mods: Underworld

Handy links: Vic_'s Forge events Own WIP Tutorials.

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

    • Baba  Serege [[+27-73 590 8989]] has experience of 27 years in helping and guiding many people from all over the world. His psychic abilities may help you answer and resolve many unanswered questions. He specialize in helping women and men from all walks of life.. 1) – Bring back lost lover. even if lost for a long time. 2) – My lover is abusing alcohol, partying and cheating on me I urgently need help” 3) – Divorce or court issues. 4) – Is your love falling apart? 5) – Do you want your love to grow stronger? 6) – Is your partner losing interest in you? 7) – Do you want to catch your partner cheating on you? – We help to keep your partner faithful and loyal to you. 9) – We recover love and happiness when relationship breaks down. 10) – Making your partner loves you alone. 11) – We create loyalty and everlasting love between couples. 12) – Get a divorce settlement quickly from your ex-partner. 13) – We create everlasting love between couples. 14) – We help you look for the best suitable partner. 15) – We bring back lost lover even if lost for a long time. 16) – We strengthen bonds in all love relationship and marriages 17) – Are you an herbalist who wants to get more powers? 18) – Buy a house or car of your dream. 19) – Unfinished jobs by other doctors come to me. 20) – I help those seeking employment. 21) – Pensioners free treatment. 22) – Win business tenders and contracts. 23) – Do you need to recover your lost property? 24) – Promotion at work and better pay. 25) – Do you want to be protected from bad spirits and nightmares? 26) – Financial problems. 27) – Why you can’t keep money or lovers? 28) – Why you have a lot of enemies? 29) – Why you are fired regularly on jobs? 30) – Speed up money claim spell, delayed payments, pension and accident funds 31) – I help students pass their exams/interviews. 33) – Removal of bad luck and debts. 34) – Are struggling to sleep because of a spiritual wife or husband. 35- ) Recover stolen property
    • OLXTOTO adalah situs bandar togel online resmi terbesar dan terpercaya di Indonesia. Bergabunglah dengan OLXTOTO dan nikmati pengalaman bermain togel yang aman dan terjamin. Koleksi toto 4D dan togel toto terlengkap di OLXTOTO membuat para member memiliki pilihan taruhan yang lebih banyak. Sebagai situs togel terpercaya, OLXTOTO menjaga keamanan dan kenyamanan para membernya dengan sistem keamanan terbaik dan enkripsi data. Transaksi yang cepat, aman, dan terpercaya merupakan jaminan dari OLXTOTO. Nikmati layanan situs toto terbaik dari OLXTOTO dengan tampilan yang user-friendly dan mudah digunakan. Layanan pelanggan tersedia 24/7 untuk membantu para member. Bergabunglah dengan OLXTOTO sekarang untuk merasakan pengalaman bermain togel yang menyenangkan dan menguntungkan.
    • Baba  Serege [[+27-73 590 8989]] has experience of 27 years in helping and guiding many people from all over the world. His psychic abilities may help you answer and resolve many unanswered questions. He specialize in helping women and men from all walks of life.. 1) – Bring back lost lover. even if lost for a long time. 2) – My lover is abusing alcohol, partying and cheating on me I urgently need help” 3) – Divorce or court issues. 4) – Is your love falling apart? 5) – Do you want your love to grow stronger? 6) – Is your partner losing interest in you? 7) – Do you want to catch your partner cheating on you? – We help to keep your partner faithful and loyal to you. 9) – We recover love and happiness when relationship breaks down. 10) – Making your partner loves you alone. 11) – We create loyalty and everlasting love between couples. 12) – Get a divorce settlement quickly from your ex-partner. 13) – We create everlasting love between couples. 14) – We help you look for the best suitable partner. 15) – We bring back lost lover even if lost for a long time. 16) – We strengthen bonds in all love relationship and marriages 17) – Are you an herbalist who wants to get more powers? 18) – Buy a house or car of your dream. 19) – Unfinished jobs by other doctors come to me. 20) – I help those seeking employment. 21) – Pensioners free treatment. 22) – Win business tenders and contracts. 23) – Do you need to recover your lost property? 24) – Promotion at work and better pay. 25) – Do you want to be protected from bad spirits and nightmares? 26) – Financial problems. 27) – Why you can’t keep money or lovers? 28) – Why you have a lot of enemies? 29) – Why you are fired regularly on jobs? 30) – Speed up money claim spell, delayed payments, pension and accident funds 31) – I help students pass their exams/interviews. 33) – Removal of bad luck and debts. 34) – Are struggling to sleep because of a spiritual wife or husband. 35- ) Recover stolen property
  • Topics

×
×
  • Create New...

Important Information

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