Jump to content

Recommended Posts

Posted

I think the title says everything...(No, im not asking for updates just want to know which versions are stable)

Right now im using version 10.12.0.1024 (recommended) but now i need to add a new dimension, a feature that isn't implemented in that version(if im wrong please correct me aannnddd link me how i can do it)

 

And if a mod is reading this, could he please mark the stable versions on the files page?

Here could be your advertisement!

Posted

Tried to use a modified version of the mojang end/nether code and, after that failed, i tried to follow (and update) wuppy29s 1.6 dimension tutorial.

I will post my code as soon as possible.

 

Here could be your advertisement!

Posted

So, here is my code:

my main class:

 

  Reveal hidden contents

 

 

 

World Provider:

 

  Reveal hidden contents

 

 

 

 

And teleporter:

 

  Reveal hidden contents

 

 

 

And then i have this in my main Block...:

public boolean onBlockActivated(World world, int x, int y, int z, EntityPlayer player, int side, float hitx, float hity, float hitz) {
	if(!world.isRemote) {

		System.out.println("after thread");
		Side sidex = FMLCommonHandler.instance().getEffectiveSide();
		if (sidex == Side.SERVER){
		System.out.println("after sidex");
		if (player instanceof EntityPlayerMP){
		System.out.println("after instace of PlayerMP");	
		WorldServer worldserver = (WorldServer)world;
		EntityPlayerMP playerMP = (EntityPlayerMP)player;
		if (player.ridingEntity == null && player.riddenByEntity == null && player instanceof EntityPlayer){
			System.out.println("after last if");
			playerMP.mcServer.getConfigurationManager().transferPlayerToDimension(playerMP, 9, new net.dimensionshift.mod.dimension.TeleporterDimensionShift(worldserver));
		}
		}
		}



	}
	return true;
}

 

 

Eclipse says that something with:

 


    public TeleporterDimensionShift(WorldServer par1WorldServer){
        this.worldServerInstance = par1WorldServer;
        this.random = new Random(par1WorldServer.getSeed());
    }
[/Code]

is wrong.

But i can't find any mistake in it.

Here could be your advertisement!

Posted

Your teleporter extend Teleporter (which is good), but you copied all its code (which is not good).

 

  Quote

if(!world.isRemote) {

 

System.out.println("after thread");

Side sidex = FMLCommonHandler.instance().getEffectiveSide();

if (sidex == Side.SERVER){

System.out.println("after sidex");

if (player instanceof EntityPlayerMP){

System.out.println("after instace of PlayerMP");

WorldServer worldserver = (WorldServer)world;

EntityPlayerMP playerMP = (EntityPlayerMP)player;

if (player.ridingEntity == null && player.riddenByEntity == null && player instanceof EntityPlayer){

Please, remove the useless checks. The last one ! *facepalm*

Posted

yeah, i have a super in public TeleportXY()...

 

EDIT: Something went wrong copying the code(i posted an old version....), thats what it actually looks like:

 

On block Update thing:

 

  Reveal hidden contents

 

 

 

 

Teleporter class

 

  Reveal hidden contents

 

 

 

 

and my error:

 

  Reveal hidden contents

 

Here could be your advertisement!

Posted

Sorry I can't pinpoint your problem here; it's over my head. I'm still trying to learn the netty and dimension stuff myself. I hope some other learned soul will help you out with it.

Good luck.

Posted
  On 3/30/2014 at 5:15 PM, coolboy4531 said:

Uh oh.

@Override
public Chunk provideChunk(int var1, int var2) {
	// TODO Auto-generated method stub
	return null;
}

 

That looks a little bit...empty

 

Where is the face-again-wall Smiley?

 

 

 

EDIT:

So i modified my code :/ ....

 

Now I am teleported to the nether... am teleported to my dimension,but it is empty(void)...

 

 

My new ChunkProvider:

 

 

  Reveal hidden contents

Here could be your advertisement!

Posted

   @Override
   public boolean chunkExists(int var1, int var2) {
      // TODO Auto-generated method stub
      return false;
   }

   @Override
   public boolean saveChunks(boolean var1, IProgressUpdate var2) {
      // TODO Auto-generated method stub
      return false;
   }

   @Override
   public boolean unloadQueuedChunks() {
      // TODO Auto-generated method stub
      return false;
   }

   @Override
   public boolean canSave() {
      // TODO Auto-generated method stub
      return false;
   }

   @Override
   public ChunkPosition func_147416_a(World var1, String var2, int var3,
         int var4, int var5) {
      // TODO Auto-generated method stub
      return null;
   }

   @Override
   public int getLoadedChunkCount() {
      // TODO Auto-generated method stub
      return 0;
   }

 

According to those codes, your world doesn't exist, cannot be unloaded, cannot be saved, and is not loaded.

 

So basically it is a void.

 

I would suggest that you extend the overworld provider instead of making your own.

Posted

extending was a good idea.....

 

...i really want my i-am-an-idiot-smiley...

 

...but i still have some problems with structures. My Chunk Provider now extends the standart chunk provider(works greate...bash-head.gif) but i don't want to have strongholds and villages generated in my dimension.

How do i get rid of them? (i think that i have to override" createStructure()" but that doesn't work...)

 

I will post what i have already tried as soon as i get to my pc.

Here could be your advertisement!

Posted

A really quick fix if you didn't want to generate any structures would be adding this:

    public ChunkProviderDimenisonShift(World par1World, long par2, boolean par4)
    {
super(par1World, par2, false);
    }

If you want the other structure to generate, then you will have to override:

    public Chunk provideChunk(int par1, int par2);

    public void populate(IChunkProvider par1IChunkProvider, int par2, int par3)

    public void recreateStructures(int par1, int par2)

I suggest copying the code from the overworld provider but removing the

this.strongholdGenerator.(Insert Function Here)(this.worldObj, this.rand, par2, par3);

   

 

 

Posted
  On 4/2/2014 at 1:57 PM, darty11 said:

A really quick fix if you didn't want to generate any structures would be adding this:

    public ChunkProviderDimenisonShift(World par1World, long par2, boolean par4)
    {
super(par1World, par2, false);
    }

If you want the other structure to generate, then you will have to override:

    public Chunk provideChunk(int par1, int par2);

    public void populate(IChunkProvider par1IChunkProvider, int par2, int par3)

    public void recreateStructures(int par1, int par2)

I suggest copying the code from the overworld provider but removing the

this.strongholdGenerator.(Insert Function Here)(this.worldObj, this.rand, par2, par3);

 

 

Thats exactly what i tried...

But forge won't accept the structure types and mc crashes...

Will post my code as soon as possible(idea:forge for Smartphones? :D)

Here could be your advertisement!

Posted

So, thats what i tried:

 

  Reveal hidden contents

 

and my error

 

 

  Reveal hidden contents

 

 

Im sure that (again) i made an extremely stupid mistake and accidentally removed some really important line of code, but i can't find it...

Just added a smash-face-smiley shortcut to my keyboard....

Here could be your advertisement!

Posted

Error is at:

Caused by: java.lang.NullPointerException
   at net.dimensionshift.mod.world.dimensions.ChunkProviderDimenisonShift.provideChunk(ChunkProviderDimenisonShift.java:79) ~[ChunkProviderDimenisonShift.class:?]
   at net.minecraft.world.gen.ChunkProviderServer.loadChunk(ChunkProviderServer.java:133) ~[ChunkProviderServer.class:?]

 

It's still null. Not sure.

Have you tried @Override -ing it?

Posted

Man, it is completely pointless to copy a private field if you are not using it yourself.

In other words, your private fields is your stuff, not something Forge/Minecraft can touch.

All in all, don't copy/paste like a printer, use some brain.

Posted
  On 4/2/2014 at 11:30 PM, GotoLink said:

Man, it is completely pointless to copy a private field if you are not using it yourself.

In other words, your private fields is your stuff, not something Forge/Minecraft can touch.

All in all, don't copy/paste like a printer, use some brain.

 

 

Yeah, it was 2 am when i stopped trying around with my chunkprovider...

(removed them now... ;))

 

Tried around a little bit and now i think that the problem is the Random rand.

 

 

EDIT:

banghead.gifbanghead.gifbanghead.gif

 

No idea why, but in the Mojang code there is

private Random rand;

. Changing this to

private Random rand = new Random();

solved it...Maybe i should sleep more...

Here could be your advertisement!

Posted

Well, i still have some problems with the world generation.

Nearly everywhere i find these huge chunk cliffs:

ueQW8ae.jpg

(Overworld and custom dimension.)

 

Here is my new Chunk Provider:

 

 

  Reveal hidden contents

 

Here could be your advertisement!

Posted

Ok, my earlier idea of extending the overworld generator is causing some problems, so could you try copying the entire overworld chunk provider over and then doing your gen from there? I forgot how many private fields there are in it.

Posted

Yeah, Now everything looks better(but still very "cubic")

 

EDIT:

 

Ahh, think i found the problem...

most likely i was tped before my prepare dimension thread could finish checking the underground and placing blocks...

Now i just have to figure out how i can start the p function from another thread and everything should be fine.

Here could be your advertisement!

Posted

Looks like i can't figure out what im doing wrong on my own.

 

In my onBlockActivated i start a new thread

Thread copy = new Thread(new TeleportSimpleController(world, dWorld, x, y, z, player)); and copy.start();

that places some blocks before you are teleported. In the thread i then (after it placed the blocks) use this:

 

	System.out.println("DONE");




	int dim=0;

	if(world.provider.dimensionId==0) {
	dim=9;
	}


	TeleporterDimensionShift.teleport(player, world, dim);

 

to start:

 

  Reveal hidden contents

 

 

Now my problem is that either nothing happen or that the game crashes.

If i get an error, this is what my log usually looks like:

 

  Reveal hidden contents

 

Here could be your advertisement!

Posted

Instead of placing those blocks with a new thread, could you try placing them with the teleporter?

 

You are going to need somthing like this code:

 

onBlockActivated:

YourClass.StaticTeleportationMethod(9, par3EntityPlayer, new NewTeleporterClass(MinecraftServer.getServer().worldServerForDimension(9)));

 

YourClass:

    	   public static void MPhelperMethod(int par1, EntityPlayerMP player, Teleporter t)
   		    {
    		   player.mcServer.getConfigurationManager().transferPlayerToDimension(player, par1,t);
   		    }
    	   /**
    	    * Teleports the entity to another dimension. Params: Dimension number to teleport to
    	    */
    	   public static void StaticTeleportationMethod(int par1, Entity player, Teleporter t)
    	   {
    		   if (player instanceof EntityPlayerMP)
    		   {
    			   MPhelperMethod(par1, (EntityPlayerMP)player,t);
    			   return;
    		   }
    		   if (!player.worldObj.isRemote && !player.isDead)
    		   {
    			   player.worldObj.theProfiler.startSection("changeDimension");
    			   MinecraftServer minecraftserver = MinecraftServer.getServer();
    			   int j = player.dimension;
    			   WorldServer worldserver = minecraftserver.worldServerForDimension(j);
    			   WorldServer worldserver1 = minecraftserver.worldServerForDimension(par1);
    			   player.dimension = par1;
    			   player.worldObj.removeEntity(player);
    			   player.isDead = false;
    			   player.worldObj.theProfiler.startSection("reposition");
    			   minecraftserver.getConfigurationManager().transferEntityToWorld(player, j, worldserver, worldserver1,t);
    			   player.worldObj.theProfiler.endStartSection("reloading");
    			   Entity entity = EntityList.createEntityByName(EntityList.getEntityString(player), worldserver1);
    			   
    			   if (entity != null)
    			   {
    				   entity.copyDataFrom(player, true);
    				   
    				   if (j == 1 && par1 == 1)
    				   {
    					   ChunkCoordinates chunkcoordinates = worldserver1.getSpawnPoint();
    					   chunkcoordinates.posY = player.worldObj.getTopSolidOrLiquidBlock(chunkcoordinates.posX, chunkcoordinates.posZ);
    					   entity.setLocationAndAngles((double)chunkcoordinates.posX, (double)chunkcoordinates.posY, (double)chunkcoordinates.posZ, entity.rotationYaw, entity.rotationPitch);
    				   }	
    				   
    				   worldserver1.spawnEntityInWorld(entity);
    			   }

    			   player.isDead = true;
    			   player.worldObj.theProfiler.endSection();
    			   worldserver.resetUpdateEntityTick();
    			   worldserver1.resetUpdateEntityTick();
    			   player.worldObj.theProfiler.endSection();
    		   }	
    	   }

And then you will need to make a new teleporter class that actually behaves like a teleporter and makes a portal (the blocks you need to place).

Posted

If i place the blocks without the thread i can call the teleporter after it and everything works fine.

But now my game sometimes crashes while

 

Fixed it. thx.

Here could be your advertisement!

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



  • Recently Browsing

    • No registered users viewing this page.
  • Posts

    • Make a test with another Launcher like the Curseforge Launcher, MultiMC or AT Launcher
    • can anyone help me i am opening forge and add modpacks and then it says unable to update native luancher and i redownlaod java and the luancher it self?
    • The problem occurs also in 1.20.1 Forge, but with an "Error executing task on client" instead. I have "Sinytra Connector" installed. On 1.21.5 Fabric, there is no problem. When this happens, the chat message before the death screen appears gets sent, with an extra dash added.
    • Well, as usual, it was user error. Naming mismatch in sounds.json.  Please delete this post if you find it necessary. 
    • Hello Forge community.  I'm running into an issue with a mod I'm working on.  To preface, I can call /playsound modId:name music @a and I can hear the sound I registered being played in game. Great!  However, I cannot get it to trigger via my mod code.    Registration: public static final RegistryObject<SoundEvent> A_WORLD_OF_MADNESS = SOUND_EVENTS.register("a_world_of_madness", () -> new SoundEvent(new ResourceLocation("tetheredsouls", "a_world_of_madness")));   Playback: Minecraft mc = Minecraft.getInstance(); if (!(mc.player instanceof LocalPlayer) || mc.level == null) return; LocalPlayer player = (LocalPlayer) mc.player; BlockPos pos = player.blockPosition(); SoundEvent track = ModSounds.A_WORLD_OF_MADNESS.get(); System.out.println(track); System.out.println(pos); System.out.println(player); // play exactly like the tutorial: client-only, at the player's position try { mc.level.playLocalSound( player.getX(), player.getY(), player.getZ(), track, SoundSource.MUSIC, // Or MASTER if needed 1f, 1f, false ); System.out.println("[DEBUG] playSound success: " + track.getLocation()); } catch (Exception e) { System.err.println("[ERROR] Failed to play sound: " + track.getLocation()); e.printStackTrace(); } Sounds.json:   { "theme_of_laura": { "category": "music", "sounds": [ { "name": "tetheredsouls:a_world_of_madness", "stream": true } ] } } Things I have tried: - multiple .ogg files. Short .ogg files (5 seconds, <100KB).  - default minecraft sounds imported from import net.minecraft.sounds.SoundEvents; These work given my code. No idea why these are different.  - playSound() method, as well as several others in past iterations that did not work   I would be forever grateful if somebody could point me in the right direction. I've looked at several mod github repositories and found extremely similar code to what I'm doing. I've also found several threads in this forum that did not solve my issue. I just cannot figure out what I'm doing differently, and why I'm able to queue sounds manually with playsound but the code won't play it (despite confirming the code is being run with the debug statements.)
  • Topics

×
×
  • Create New...

Important Information

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