Jump to content
View in the app

A better way to browse. Learn more.

Forge Forums

A full-screen app on your home screen with push notifications, badges and more.

To install this app on iOS and iPadOS
  1. Tap the Share icon in Safari
  2. Scroll the menu and tap Add to Home Screen.
  3. Tap Add in the top-right corner.
To install this app on Android
  1. Tap the 3-dot menu (⋮) in the top-right corner of the browser.
  2. Tap Add to Home screen or Install app.
  3. Confirm by tapping Install.

Featured Replies

Posted

How could I make it so that I spawn in my own dimension instead of the overworld. Or at least change the overworld to be completely my biomes.

 

Those are two very different questions. If you want to completely replace the overworld with your own biomes, the only way I can think to do that is to have your generator clear out the entire chunk with air, then re-generate your custom terrain as needed (and register it with a high weight so it comes after other generators). If you want players to just spawn in your custom dimension, but still have a way back to the overworld, you can just check the public Entity.dimension value on all EntityPlayer entities, and if it's not your custom dimension ID, call Entity.travelToDimension(int dimension_id) on them to move them there. You may also want to keep a map of everyone you've done that to, so you don't force them into your dimension every time they try to leave it.

Whatever Minecraft needs, it is most likely not yet another tool tier.

Use a custom

IExtendedEntityProperties

if you need a per player dim id

 

Also use

PlayerEvent.PlayerRespawnEvent

To send them. should work pretty cleanly

I think its my java of the variables.

  • Author

I added the extended properties that stores the dimension stuff, but every time I try to use the .travelToDimension, I get a NullPointerException. Could you explain where I need to put this. I have an Event Handler class, but what event should it go into? Sorry, I'm pretty new to modding, but even more of a noob at EventHandlers.

You need to post the code for your EntityConstructingEvent handler, your PlayerRespawnEvent handler, and your IEEP class

I think its my java of the variables.

  • Author

So, I'm not getting an error anymore, but I still can't get it to work.

This is my player respawn event

        @SubscribeEvent
public void onPlayerRespawn(PlayerRespawnEvent event)
{
	if(event.player.dimension==0)
	{
		event.player.travelToDimension(;
	}
}

and this is how im creating the handler

MinecraftForge.EVENT_BUS.register(new MyEventHandler());

and yet I still can't get the onPlayerRespawn event to actually run.

This is my entity constructing class

@SubscribeEvent
public void onEntityConstructing(EntityConstructing event)
{
	if(event.entity instanceof EntityPlayer && ExtendedPlayer.get((EntityPlayer) event.entity)==null)
	{
		ExtendedPlayer.register((EntityPlayer) event.entity);
	}
	if(event.entity instanceof EntityPlayer && event.entity.getExtendedProperties(ExtendedPlayer.DIM)==null)
	{
		event.entity.registerExtendedProperties(ExtendedPlayer.DIM, new ExtendedPlayer((EntityPlayer) event.entity));
	}		
}

and this is my IEEP class

public class ExtendedPlayer implements IExtendedEntityProperties{

public final static String DIM = "dimension";
private final EntityPlayer player;
private int currDim;
public ExtendedPlayer(EntityPlayer player)
{
	this.player=player;
	currDim = player.dimension;

}

public static final void register(EntityPlayer player)
{
	player.registerExtendedProperties(ExtendedPlayer.DIM, new ExtendedPlayer(player));
}

public static final ExtendedPlayer get(EntityPlayer player)
{
	return (ExtendedPlayer) player.getExtendedProperties(DIM);
}

@Override
public void saveNBTData(NBTTagCompound compound) {
	NBTTagCompound properties = new NBTTagCompound();
	properties.setInteger("Current Dimension", currDim);
	compound.setTag(DIM, properties);
}

@Override
public void loadNBTData(NBTTagCompound compound) {
	NBTTagCompound properties = (NBTTagCompound) compound.getTag(DIM);
	this.currDim = properties.getInteger("Current Dimension");
}

@Override
public void init(Entity entity, World world) {

}



}

PlayerRespawnEvent is on the FML event bus, not the MinecraftForge event bus:

FMLCommonHandler.instance().bus().register(new YourFmlEventHandler());

I believe they are merging all of the event buses into one for Forge 1.8.8, so eventually you won't have to worry about that anymore.

 

EDIT: Pretty standard day - ninja'd by diesieben.

  • Author

While I'm here, could someone tell me how I could load obj into my mod. I've googled stuff, but I can't figure out how to apply the obj to my item.

It is probably simple, but I'm a noob. :D

  • Author

The player respawn works, but only if i kill myself not on joining the world, and it loads my dimension, but I spawn in the nether, then in the console it says my dimension unloaded.

 

EDIT: Also what chunk manager should I use?

 

EDIT #2: My createChunkGenereator was misspelled.... oops, but now I get teleported into void world and I can't move.

It is like the terrain is there, I just can't see it or interact with it....

  • Author

Can someone help me, I don't know why this is happening.

 

Here is my World Provider Class

public void registerWorldChunkManager()
{
	this.worldChunkMgr = new WorldChunkManagerHell(BiomeGenBase.desert, 0.1f);
	this.dimensionId = MyMod.dimensioId;
}
@Override
public IChunkProvider createChunkGenerator()
{
	return new ChunkProviderMyMod(worldObj, worldObj.getSeed(), true, null);
}

@Override
public String getDimensionName() {
	return "MyDimension";
}

@Override
public String getInternalNameSuffix() {
	return null;
}

@Override
public boolean canRespawnHere()
{
	return true;
}

  • Author

I got it to let me be in my dimension, but when I changed it to generate my biome instead of a desert, I get teleported to the Nether again.

  • 4 weeks later...

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...

Important Information

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

Configure browser push notifications

Chrome (Android)
  1. Tap the lock icon next to the address bar.
  2. Tap Permissions → Notifications.
  3. Adjust your preference.
Chrome (Desktop)
  1. Click the padlock icon in the address bar.
  2. Select Site settings.
  3. Find Notifications and adjust your preference.