Jump to content

[1.8] Dimension Problem (SOLVED)


Born2Code

Recommended Posts

Hello. I'm working on a mod that has a specialthing that you walk into and it teleports you inside of it, well I decided to instead of creating the interior inside of the world somewhere, add a whole new dimension for it. Well, everything else is working. I've done all I've figured out so far of adding a new dimension to add it and then tried to port myself to it, by the way I do not expect (or want) the world to have anything generated in it. The problem is, when I collide with my specialthing (that part triggers fine) and tell the player to travel to my dimension it works, and then fails. I put a print to test if I was actually getting put in my dimension because 1 second later I get kicked into the overworld and it spawns a nether portal (???). It does set me in the dimension.. but kicks me out as said above. Any help is appreciated.

 

MainModFile

 

 

/** in init method **/

        DimensionManager.registerProviderType(2, MYWORLDPROVIDER.class, true);

        DimensionManager.registerDimension(2, 2);

 

 

 

MyWorldProvider

 

 

public class MYWORLDPROVIDER extends WorldProvider

{

 

    private static final String __OBFID = "CL_00000389";

 

    /**

    * creates a new world chunk manager for WorldProvider

    */

    public void registerWorldChunkManager()

    {

        this.worldChunkMgr = new WorldChunkManagerMYTHING(BiomeGenBase.ocean, 0.0F);

        this.dimensionId = 2;

        this.hasNoSky = true;

    }

 

    public IChunkProvider createChunkGenerator()

    {

        return new ChunkProviderEnd(this.worldObj, this.worldObj.getSeed());

    }

 

    public float calculateCelestialAngle(long p_76563_1_, float p_76563_3_)

    {

        return 0.0F;

    }

 

    @SideOnly(Side.CLIENT)

    public float[] calcSunriseSunsetColors(float celestialAngle, float partialTicks)

    {

        return null;

    }

 

    @SideOnly(Side.CLIENT)

    public Vec3 getFogColor(float p_76562_1_, float p_76562_2_)

    {

        int i = 10518688;

        float f2 = MathHelper.cos(p_76562_1_ * (float) Math.PI * 2.0F) * 2.0F + 0.5F;

        f2 = MathHelper.clamp_float(f2, 0.0F, 1.0F);

        float f3 = (float)(i >> 16 & 255) / 255.0F;

        float f4 = (float)(i >> 8 & 255) / 255.0F;

        float f5 = (float)(i & 255) / 255.0F;

        f3 *= f2 * 0.0F + 0.15F;

        f4 *= f2 * 0.0F + 0.15F;

        f5 *= f2 * 0.0F + 0.15F;

        return new Vec3((double)f3, (double)f4, (double)f5);

    }

 

    @SideOnly(Side.CLIENT)

    public boolean isSkyColored()

    {

        return false;

    }

 

    public boolean canRespawnHere()

    {

        return true;

    }

 

    public boolean isSurfaceWorld()

    {

        return false;

    }

 

    @SideOnly(Side.CLIENT)

    public float getCloudHeight()

    {

        return 1.0F;

    }

 

    public boolean canCoordinateBeSpawn(int x, int z)

    {

        return this.worldObj.getGroundAboveSeaLevel(new BlockPos(x, 0, z)).getMaterial().blocksMovement();

    }

 

    public BlockPos getSpawnCoordinate()

    {

        return new BlockPos(100, 50, 0);

    }

 

    public int getAverageGroundLevel()

    {

        return 50;

    }

 

    @SideOnly(Side.CLIENT)

    public boolean doesXZShowFog(int x, int z)

    {

        return false;

    }

 

    public String getDimensionName()

    {

        return "MYTHING";

    }

 

    public String getInternalNameSuffix()

    {

        return "MYTHING";

    }

}

 

 

 

BlockClass (aka my portal)

 

 

    public void onEntityCollidedWithBlock(World world, BlockPos pos, IBlockState state, Entity entity)

    {

        if(world.isRemote) return;

        if(!(entity instanceof EntityPlayerMP)) return;

        MinecraftServer.getServer().getConfigurationManager().transferPlayerToDimension((EntityPlayerMP)entity, 2, new MYTELEPORTER(MinecraftServer.getServer().worldServerForDimension(2)));

    }

 

 

 

MyTeleporter

 

 

public class MYTELEPORTER extends Teleporter

{

    private WorldServer server;

    public MYTELEPORTER(WorldServer world)

    {

        super(world);

        this.server = world;

    }

 

    @Override

    public void placeInPortal(Entity entityIn, float rotationYaw)

    {

        return;

    }

 

    @Override

    public boolean placeInExistingPortal(Entity entity, float something)

    {

        return true;

    }

 

    @Override

    public boolean makePortal(Entity entity)

    {

        return true;

    }

}

 

 

Link to comment
Share on other sites

Include the

Teleporter

.

Apparently I'm a complete and utter jerk and come to this forum just like to make fun of people, be confrontational, and make your personal life miserable.  If you think this is the case, JUST REPORT ME.  Otherwise you're just going to get reported when you reply to my posts and point it out, because odds are, I was trying to be nice.

 

Exception: If you do not understand Java, I WILL NOT HELP YOU and your thread will get locked.

 

DO NOT PM ME WITH PROBLEMS. No help will be given.

Link to comment
Share on other sites

I have the block for it working fine.. here it is the part that teleports.

 

    public void onEntityCollidedWithBlock(World world, BlockPos pos, IBlockState state, Entity entity)

    {

            if(!world.isRemote)

            {

                  entity.travelToDimension(2);

                  System.out.println(entity.dimension);

               

            }

    }

Link to comment
Share on other sites

Well, I could be wrong, in which case please correct me, but I don't think the chunk provider has anything to do with the problem. Looking at this https://github.com/Eternaldoom/Realms-of-Chaos/blob/master/com/eternaldoom/realmsofchaos/iceruins/gen/ChunkProviderIceRuins.java which is supposedly updated to 1.8 I can tell little to no difference between his chunk provider and the ChunkProviderEnd (which I'm using also). I looked at his world provider as well as mine and I don't think the problem is there either. Thinking it has something to do with how I'm registering (or not registering) it.

Link to comment
Share on other sites

Okay, turns out I just needed to make my own Teleporter and use that.

Include the

Teleporter

.

 

Thank you for hinting towards that since you capitalized the name of Teleporter. I can now freely travel to my dimension now without it breaking. I will update the OP for anyone else who might have this problem.

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



×
×
  • Create New...

Important Information

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