I recently started working on a new dimension with forge for my mod. I registered my dimension and my WorldProvider with DimensionManager and I wonder how i can get to this dimension now. I tried this:
////////////////////////////////////////////////
public void onEntityCollidedWithBlock(World par1World, int par2, int par3, int par4, Entity par5Entity)
{
EntityPlayerMP entityplayer=(EntityPlayerMP)par5Entity;
MinecraftServer.getServer().getConfigurationManager().transferPlayerToDimension(entityplayer, 11); // 11=id of my dimension
}
///////////////////////////////////////
But you obviously cant cast EntityClientPlayerMP to EntityPlayerMP , and I cant figure out how I can get the player to the dimension on a differrent way . (Note: my mod isnt smp yet). It would be great if someone can tell me how I can solve the problem , because Im not a very good coder and (as said before)I dont now any other way to get to my dimension.( I am using forge 4.2.5.303)
Thank you in advance
PS:
Do I really have to unregister the Dimensions 0,-1 and 1 to get the DimensionManager to work?
I solved it by doing this:
public void onEntityCollidedWithBlock(World par1World, int par2, int par3, int par4, Entity par5Entity)
{
if (par5Entity instanceof EntityPlayerMP) {
EntityPlayerMP playerMP = (EntityPlayerMP)par5Entity;
playerMP.mcServer.getConfigurationManager().transferPlayerToDimension(playerMP, 11);
}
}