Jump to content

Recommended Posts

Posted

How can you teleport a player on single player to a dimension if transferPlayertodimension on works on EntityPlayerMP.

 

    public void onEntityCollidedWithBlock(World par1World, int par2, int par3, int par4, Entity par5Entity)
    {
    if ((par5Entity.ridingEntity == null) && (par5Entity.riddenByEntity == null) && ((par5Entity instanceof EntityPlayerMP)))
    {
    EntityPlayerMP thePlayer = (EntityPlayerMP)par5Entity;
    if (thePlayer.timeUntilPortal > 0)
    {
    thePlayer.timeUntilPortal = 10;
    }
    else if (thePlayer.dimension !=mystical_epicarno_mod.dimension)
    {
    thePlayer.timeUntilPortal = 10;
    
    }
    else {
    thePlayer.timeUntilPortal = 10;
    thePlayer.mcServer.getConfigurationManager().transferPlayerToDimension(thePlayer,0);
    }
    }
    }

 

I've tried this and a few other things and nothing happens (in single player, can't test multiplayer), if you remove the check for EntityPlayerMP it crashes and EntityPlayerSP does not work.

 

 

Sorry about so many noob questions about dimensions in 1.8 but I can't find any information anywhere else to solve my problems so I have to ask.

Posted

Singleplayer runs an integrated server.

When an entity collides with a block, check to see if it's an instance of EntityPlayer rather than EntityPlayerMP, this will work on both sides.

Check all the conditions you are currently checking.

Send (EntityPlayerMP) par5Entity to the dimension you want.

Posted

Thanks for that, I can get to my dimension now but do you think you can help me solve another problem I have now.

When in the dimension (that uses a custom stone block) the custom grass from the biome does not generate (I know it will with normal stone). Do you know anyway to fix this?

 

Also I looks like it creates a nether portal when you get transferred to the dimension so you get sent to the nether as soon as you get there.

Posted

I think it uses the nether portal as I can't use my custom teleport-er (or any other the the stock one)

 

This works and creates a nether portal.

        thePlayer.mcServer.getConfigurationManager().transferPlayerToDimension(thePlayer, mystical_epicarno_mod.dimension);

 

This does not work on 1.8 or whatever reason?

 

        thePlayer.mcServer.getConfigurationManager().transferPlayerToDimension(thePlayer, mystical_epicarno_mod.dimension, new Tele(thePlayer.mcServer.worldServerForDimension(mystical_epicarno_mod.dimension)));

 

the Error: The method transferPlayerToDimension(EntityPlayerMP, int, Teleporter) in the type ServerConfigurationManager is not applicable for the arguments (EntityPlayerMP, int, Tele)

 

Posted

Sorry I don't know anything about world generation. I do however have experience with the nether portal issue.

 

FMLCommonHandler.instance().getMinecraftServerInstance().getConfigurationManager().transferPlayerToDimension(thePlayer, mystical_epicarno_mod.dimension, new TeleporterWithoutPortal((WorldServer) thePlayer.worldObj, mystical_epicarno_mod.dimension, X, Y, Z, 0F, 0F)); // Set the X, Y, Z somehow

 

public class TeleporterWithoutPortal extends Teleporter {
public int dimension;
public int xPos;
public int yPos;
public int zPos;
public float playerYaw;
public float playerPitch;

public TeleporterWithoutPortal(WorldServer par1WorldServer) {
	super(par1WorldServer);
}

public TeleporterWithoutPortal(WorldServer server, int dimensionId, int posX, int posY, int posZ, float yaw, float pitch) {
	this(server);
	dimension = dimensionId;
	xPos = posX;
	yPos = posY;
	zPos = posZ;
	playerYaw = yaw;
	playerPitch = pitch;
}

public void placeInPortal(Entity par1Entity, double par2, double par4, double par6, float par8) {
	par1Entity.setLocationAndAngles((double) xPos + 0.5D, (double) yPos, (double) zPos + 0.5D, playerYaw, playerPitch);
	par1Entity.motionX = par1Entity.motionY = par1Entity.motionZ = 0.0D;
}

@Override public void removeStalePortalLocations(long par1) {}

Posted

It's very late so I have to go, but the TeleportWithoutPortal does work however it still creates a nether portal, while the player spawns stuck (i think I can fix that) but idk why the portal still spawns.

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.