Jump to content

Recommended Posts

Posted

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.

Posted

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.

Posted

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.

Posted

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) {

}



}

Posted

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.

Posted

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

Posted

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;
}

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

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

×
×
  • Create New...

Important Information

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