Posted August 4, 20169 yr Hello, I have I mod which adds a world type for starting and staying in the nether. The player respawns there. I want to set the players spawn location to a uncovered netherrack block, but the methods return always the highest block, which is bedrock. In 1.7.10 I used world.provider.getEntrancePortalLocation(). Is there any way to do this in 1.9.4?
August 4, 20169 yr I'm guessing that you are using a WorldProvider. Override WorldProvider#getSpawnPoint(), to return a suitable spawn-point. Checking if it is suitable, you'd best create another method that checks in blocks through x, y & z coords in for-loops. As far as I can see, the WorldProvider no longer provides anything like the getEntrancePortalLocation method, and the Teleporter#makePortal method checks for suitable locations directly. I'm forcing a spawn-point to an already cleared area here: https://github.com/Matryoshika/Underworld/blob/master/src/main/java/se/Matryoshika/Underworld/WorldGen/WorldProviderCaves.java#L41 Bit messy, but been meaning to clear it up since I managed to figure out how to force a spawn-point. Also previously known as eAndPi. "Pi, is there a station coming up where we can board your train of thought?" -Kronnn Published Mods: Underworld Handy links: Vic_'s Forge events Own WIP Tutorials.
August 4, 20169 yr Author Thanks! That helped. Yes, I'm using a own world provider to change the respawn dimension etc. My other problem with this world type is that every time the player creates a new world he starts in the overworld. This seems to be standard so I wrote a method which is called by the net.minecraftforge.event.entity.EntityJoinWorldEvent: In this method the player is send to the nether with the player.changeDimension(-1) method and it crashes every first time of a world. After the first time the player spawns correct. I think that might is a "hard" teleport so that the dimension change doesn't get properly done.
August 4, 20169 yr What is the cause of the crash? Nullpointer? What is your exact code for sending the player to the Nether? Also previously known as eAndPi. "Pi, is there a station coming up where we can board your train of thought?" -Kronnn Published Mods: Underworld Handy links: Vic_'s Forge events Own WIP Tutorials.
August 5, 20169 yr Author The cause of the crash is a Ticking Memory Exception. The Code for my World Handler first spawn event method: package mod.nethertweaks.world; import java.io.*; import mod.chaust.ChaustItems; import mod.nethertweaks.BucketLoader; import mod.nethertweaks.Config; import mod.nethertweaks.ForgeSubscribe; import mod.nethertweaks.RecipeLoader; import net.minecraft.block.Block; import net.minecraft.block.material.Material; import net.minecraft.client.Minecraft; import net.minecraft.client.entity.EntityPlayerSP; import net.minecraft.entity.EnumCreatureType; import net.minecraft.entity.passive.EntityAnimal; import net.minecraft.entity.passive.EntityCow; import net.minecraft.entity.player.EntityPlayer; import net.minecraft.entity.player.EntityPlayerMP; import net.minecraft.init.Blocks; import net.minecraft.item.ItemStack; import net.minecraft.nbt.NBTTagCompound; import net.minecraft.server.MinecraftServer; import net.minecraft.util.math.BlockPos; import net.minecraft.world.DimensionType; import net.minecraft.world.World; import net.minecraft.world.WorldProvider; import net.minecraft.world.WorldProviderEnd; import net.minecraft.world.WorldProviderHell; import net.minecraft.world.WorldProviderSurface; import net.minecraft.world.WorldType; import net.minecraft.world.gen.layer.GenLayer; import net.minecraftforge.common.DimensionManager; import net.minecraftforge.event.entity.EntityJoinWorldEvent; import net.minecraftforge.event.entity.living.LivingSpawnEvent; import net.minecraftforge.event.terraingen.WorldTypeEvent; import net.minecraftforge.event.terraingen.BiomeEvent.GetWaterColor; import net.minecraftforge.event.world.WorldEvent; import net.minecraftforge.fml.common.eventhandler.SubscribeEvent; public class WorldHandler{ boolean isHellworldType; @SubscribeEvent public void changeDimensionByWorldType(WorldTypeEvent event) throws IOException, FileNotFoundException, ArrayIndexOutOfBoundsException { if(event.getWorldType() instanceof WorldTypeHellworld) { this.isHellworldType = true; DimensionManager.unregisterDimension(0); DimensionType.register("Overworld", "Provider", 0, WorldProviderSurfaceNTM.class, true); DimensionManager.registerDimension(0, DimensionType.getById(0)); DimensionManager.unregisterDimension(-1); DimensionType.register("Nether", "Provider", -1, WorldProviderNetherNTM.class, true); DimensionManager.registerDimension(-1, DimensionType.getById(-1)); DimensionManager.unregisterDimension(1); DimensionType.register("End", "Provider", 1, WorldProviderEndNTM.class, true); DimensionManager.registerDimension(1, DimensionType.getById(1)); } } @ForgeSubscribe @SubscribeEvent public void perfectJoin(net.minecraftforge.event.entity.EntityJoinWorldEvent event){ if(event.getEntity() instanceof EntityPlayer){ EntityPlayer player = (EntityPlayer) event.getEntity(); if(player.dimension != -1 && isHellworldType == true) { //player.preparePlayerToSpawn(); player.changeDimension(-1); } if(isHellworldType == false){ if(player.dimension == 0){ player.changeDimension(Config.nethDim); } if(player.dimension == 1){ player.changeDimension(Config.endDim); } } } } } Crashlog http://pastebin.com/6i21c8ar
August 5, 20169 yr The error is happening in your Teleporter class on line 134/38 VANILLA MINECRAFT CLASSES ARE THE BEST RESOURCES WHEN MODDING I will be posting 1.15.2 modding tutorials on this channel. If you want to be notified of it do the normal YouTube stuff like subscribing, ect. Forge and vanilla BlockState generator.
August 5, 20169 yr The error is happening in your Teleporter class on line 134/38 Isn't that referencing the Vanilla Teleporter class? Also, to the OP, it's more helpful if you upload your code to github so we can see line numbers and such.
August 5, 20169 yr Author My Code is now on Github here: https://github.com/BarelyAlive/Nether-Tweaks.
August 5, 20169 yr Navigate to the referenced line that gets a nullpointer (at net.minecraft.world.Teleporter.placeInExistingPortal(Teleporter.java:134)) Place a breakpoint on that line, and test it. You should get all the information passed to that method, before the method itself is run, which should allow you to see exactly what being passed to it, is null. A guide for placing breakpoints in Eclipse: http://help.eclipse.org/mars/index.jsp?topic=%2Forg.eclipse.jdt.doc.user%2Ftasks%2Ftask-add_line_breakpoints.htm If you are using any other IDE, you gotta lookup their breakpoint placement yourself. Also previously known as eAndPi. "Pi, is there a station coming up where we can board your train of thought?" -Kronnn Published Mods: Underworld Handy links: Vic_'s Forge events Own WIP Tutorials.
August 5, 20169 yr Author It seems to be the teleporter class wants the last position of the player in the overworld to get his entrance position for the nether. Can I make the method wait until the player has a overworld position? Or something different?
August 5, 20169 yr Maybe LivingSpawnEvent not sure if that gets called for the player though. VANILLA MINECRAFT CLASSES ARE THE BEST RESOURCES WHEN MODDING I will be posting 1.15.2 modding tutorials on this channel. If you want to be notified of it do the normal YouTube stuff like subscribing, ect. Forge and vanilla BlockState generator.
August 5, 20169 yr Author I tried the LivingSpawn Event but it didn't work. When I looked into the sub events, it seemed that it is for mobs not players.
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.