Jump to content

Recommended Posts

Posted

Hello again,

it is me, SlimingHD, and I am once again asking for your support! I am currently successfully changing biomes in a chunk. However I need a way to update these chunks so that people won't have to rejoin their world to see the effect (Or worse, the chunks stop rendering all together). I have now tried all different kinds of Packets (mainly ClientboundLevelChunkWithLightPacket) but none seem to work. Am I doing something very simple very wrong or is there an obvious solution I am once again missing?

Thank you in advance!

Posted
if(player instanceof ServerPlayer sPlayer) {
	sPlayer.connection.send(new ClientboundLevelChunkWithLightPacket(level.getChunkAt(new BlockPos(x, y, z)), level.getLightEngine(),
	new BitSet(), new BitSet(), false));
}

x, y and z are also the values I use to change the biome in the first place and when rejoining the world every chunk does have the correct biome.

Posted

Are you sure the player is correct? You should really be sending to all players that have that chunk loaded.

Maybe get the list using something like (I am not sure this is correct)?

        List<ServerPlayer> list = serverLevel.getChunkSource().chunkMap.getPlayers(chunkPos, false);

 

You should also be able to see if your chunk packet is actually received on the client if you listen for forge's ChunkEvent.Load

Boilerplate:

If you don't post your logs/debug.log we can't help you. For curseforge you need to enable the forge debug.log in its minecraft settings. You should also post your crash report if you have one.

If there is no error in the log file and you don't have a crash report then post the launcher_log.txt from the minecraft folder. Again for curseforge this will be in your curseforge/minecraft/Install

Large files should be posted to a file sharing site like https://gist.github.com  You should also read the support forum sticky post.

Posted

Can you confirm the packet is received by the client.

If it is, I would guess there is something about the way you are updating the data that means the code that creates the packet cannot see your change?

You should try deserialising the packet after you create it to see if the data it contains is correct.

Boilerplate:

If you don't post your logs/debug.log we can't help you. For curseforge you need to enable the forge debug.log in its minecraft settings. You should also post your crash report if you have one.

If there is no error in the log file and you don't have a crash report then post the launcher_log.txt from the minecraft folder. Again for curseforge this will be in your curseforge/minecraft/Install

Large files should be posted to a file sharing site like https://gist.github.com  You should also read the support forum sticky post.

Posted

I could. I get an IllegalArgumentException with the following message:

"No value with id -1"

But the stacktrace doesn't give me any useful information. It has to do something with an ID-map I guess

Posted (edited)

You don't know how many combinations of variables I alredy tried, but nonetheless, here is the error:

[13:01:58] [Render thread/ERROR] [minecraft/BlockableEventLoop]: Error executing task on Client
java.lang.IllegalArgumentException: No value with id -1
	at net.minecraft.core.IdMap.byIdOrThrow(IdMap.java:16) ~[forge-1.18.2-40.1.51_mapped_official_1.18.2-recomp.jar%2376!/:?] {re:classloading}
	at net.minecraft.world.level.chunk.LinearPalette.read(LinearPalette.java:81) ~[forge-1.18.2-40.1.51_mapped_official_1.18.2-recomp.jar%2376!/:?] {re:classloading}
	at net.minecraft.world.level.chunk.PalettedContainer.read(PalettedContainer.java:150) ~[forge-1.18.2-40.1.51_mapped_official_1.18.2-recomp.jar%2376!/:?] {re:classloading}
	at net.minecraft.world.level.chunk.LevelChunkSection.read(LevelChunkSection.java:164) ~[forge-1.18.2-40.1.51_mapped_official_1.18.2-recomp.jar%2376!/:?] {re:classloading}
	at net.minecraft.world.level.chunk.LevelChunk.replaceWithPacketData(LevelChunk.java:431) ~[forge-1.18.2-40.1.51_mapped_official_1.18.2-recomp.jar%2376!/:?] {re:classloading}
	at net.minecraft.client.multiplayer.ClientChunkCache.replaceWithPacketData(ClientChunkCache.java:100) ~[forge-1.18.2-40.1.51_mapped_official_1.18.2-recomp.jar%2376!/:?] {re:classloading,pl:runtimedistcleaner:A}
	at net.minecraft.client.multiplayer.ClientPacketListener.updateLevelChunk(ClientPacketListener.java:605) ~[forge-1.18.2-40.1.51_mapped_official_1.18.2-recomp.jar%2376!/:?] {re:classloading,pl:accesstransformer:B,pl:runtimedistcleaner:A}
	at net.minecraft.client.multiplayer.ClientPacketListener.handleLevelChunkWithLight(ClientPacketListener.java:600) ~[forge-1.18.2-40.1.51_mapped_official_1.18.2-recomp.jar%2376!/:?] {re:classloading,pl:accesstransformer:B,pl:runtimedistcleaner:A}
	at net.minecraft.network.protocol.game.ClientboundLevelChunkWithLightPacket.handle(ClientboundLevelChunkWithLightPacket.java:40) ~[forge-1.18.2-40.1.51_mapped_official_1.18.2-recomp.jar%2376!/:?] {re:classloading}
	at net.minecraft.network.protocol.game.ClientboundLevelChunkWithLightPacket.handle(ClientboundLevelChunkWithLightPacket.java:11) ~[forge-1.18.2-40.1.51_mapped_official_1.18.2-recomp.jar%2376!/:?] {re:classloading}
	at net.minecraft.network.protocol.PacketUtils.lambda$ensureRunningOnSameThread$0(PacketUtils.java:22) ~[forge-1.18.2-40.1.51_mapped_official_1.18.2-recomp.jar%2376!/:?] {re:classloading}
	at net.minecraft.util.thread.BlockableEventLoop.doRunTask(BlockableEventLoop.java:143) ~[forge-1.18.2-40.1.51_mapped_official_1.18.2-recomp.jar%2376!/:?] {re:classloading,pl:accesstransformer:B}
	at net.minecraft.util.thread.ReentrantBlockableEventLoop.doRunTask(ReentrantBlockableEventLoop.java:22) ~[forge-1.18.2-40.1.51_mapped_official_1.18.2-recomp.jar%2376!/:?] {re:classloading}
	at net.minecraft.util.thread.BlockableEventLoop.pollTask(BlockableEventLoop.java:116) ~[forge-1.18.2-40.1.51_mapped_official_1.18.2-recomp.jar%2376!/:?] {re:classloading,pl:accesstransformer:B}
	at net.minecraft.util.thread.BlockableEventLoop.runAllTasks(BlockableEventLoop.java:104) ~[forge-1.18.2-40.1.51_mapped_official_1.18.2-recomp.jar%2376!/:?] {re:classloading,pl:accesstransformer:B}
	at net.minecraft.client.Minecraft.runTick(Minecraft.java:1013) ~[forge-1.18.2-40.1.51_mapped_official_1.18.2-recomp.jar%2376!/:?] {re:classloading,pl:accesstransformer:B,pl:runtimedistcleaner:A}
	at net.minecraft.client.Minecraft.run(Minecraft.java:663) ~[forge-1.18.2-40.1.51_mapped_official_1.18.2-recomp.jar%2376!/:?] {re:classloading,pl:accesstransformer:B,pl:runtimedistcleaner:A}
	at net.minecraft.client.main.Main.main(Main.java:205) ~[forge-1.18.2-40.1.51_mapped_official_1.18.2-recomp.jar%2376!/:?] {re:classloading,pl:runtimedistcleaner:A}
	at jdk.internal.reflect.NativeMethodAccessorImpl.invoke0(Native Method) ~[?:?] {}
	at jdk.internal.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:77) ~[?:?] {}
	at jdk.internal.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43) ~[?:?] {}
	at java.lang.reflect.Method.invoke(Method.java:568) ~[?:?] {}
	at net.minecraftforge.fml.loading.targets.ForgeClientUserdevLaunchHandler.lambda$launchService$0(ForgeClientUserdevLaunchHandler.java:24) ~[fmlloader-1.18.2-40.1.51.jar%230!/:?] {}
	at cpw.mods.modlauncher.LaunchServiceHandlerDecorator.launch(LaunchServiceHandlerDecorator.java:37) [modlauncher-9.1.3.jar%2310!/:?] {}
	at cpw.mods.modlauncher.LaunchServiceHandler.launch(LaunchServiceHandler.java:53) [modlauncher-9.1.3.jar%2310!/:?] {}
	at cpw.mods.modlauncher.LaunchServiceHandler.launch(LaunchServiceHandler.java:71) [modlauncher-9.1.3.jar%2310!/:?] {}
	at cpw.mods.modlauncher.Launcher.run(Launcher.java:106) [modlauncher-9.1.3.jar%2310!/:?] {}
	at cpw.mods.modlauncher.Launcher.main(Launcher.java:77) [modlauncher-9.1.3.jar%2310!/:?] {}
	at cpw.mods.modlauncher.BootstrapLaunchConsumer.accept(BootstrapLaunchConsumer.java:26) [modlauncher-9.1.3.jar%2310!/:?] {}
	at cpw.mods.modlauncher.BootstrapLaunchConsumer.accept(BootstrapLaunchConsumer.java:23) [modlauncher-9.1.3.jar%2310!/:?] {}
	at cpw.mods.bootstraplauncher.BootstrapLauncher.main(BootstrapLauncher.java:149) [bootstraplauncher-1.0.0.jar:?] {}

 

Edited by SlimingHD
Posted

I already know it has something to do with the way I set the new Biome. So if you wonder what exactly I am doing, here you go:

for(double offX = -32; offX <= 32; offX += 16) {
								for(double offZ = -32; offZ <= 32; offZ += 16) {
									double distance = Math.sqrt(offX * offX + offZ * offZ);
									if(distance <= 32) {
										for(LevelChunkSection section : level.getChunk(new BlockPos(x + offX, 0, z + offZ)).getSections()) {
											for(int i = 0; i < 4; ++i) {
												for(int j = 0; j < 4; ++j) {
													for(int k = 0; k < 4; ++k) {
														Holder<Biome> biome =
                                                        	BuiltinRegistries.BIOME.getHolderOrThrow(net.minecraft.world.level.biome.Biomes.SNOWY_TAIGA);
														if(Math.sqrt(offX * offX + 4 * i + offZ * offZ + 4 * k) < 32 
                                                            && section.getBiomes().get(i, j, k) != net.minecraft.world.level.biome.Biomes.SNOWY_TAIGA) {
																section.getBiomes().getAndSetUnchecked(i, j, k, biome);
														}
													}
												}
											}
										}
									}
								}
							}

Maybe something right here is wrong?

Posted

You won't be able to use the builtin registries for biomes at runtime. They are just templates.

The ones actually used are found using MinecraftServer.registryAccess().registryOrThrow()

These are copies of the builtin ones augmented with the stuff from datapacks.

Boilerplate:

If you don't post your logs/debug.log we can't help you. For curseforge you need to enable the forge debug.log in its minecraft settings. You should also post your crash report if you have one.

If there is no error in the log file and you don't have a crash report then post the launcher_log.txt from the minecraft folder. Again for curseforge this will be in your curseforge/minecraft/Install

Large files should be posted to a file sharing site like https://gist.github.com  You should also read the support forum sticky post.

Posted (edited)

For the same reason, you can't use 

net.minecraft.world.level.biome.Biomes.SNOWY_TAIGA

You have to look it up in the registry.

 

Sorry, its a ResourceKey not the actual biome. 🙂

Edited by warjort

Boilerplate:

If you don't post your logs/debug.log we can't help you. For curseforge you need to enable the forge debug.log in its minecraft settings. You should also post your crash report if you have one.

If there is no error in the log file and you don't have a crash report then post the launcher_log.txt from the minecraft folder. Again for curseforge this will be in your curseforge/minecraft/Install

Large files should be posted to a file sharing site like https://gist.github.com  You should also read the support forum sticky post.

Posted

By the way, the method you are using to change the biomes won't work in 1.19

The biomes are now stored in a PalettedContainerRO (RO = read only)

Boilerplate:

If you don't post your logs/debug.log we can't help you. For curseforge you need to enable the forge debug.log in its minecraft settings. You should also post your crash report if you have one.

If there is no error in the log file and you don't have a crash report then post the launcher_log.txt from the minecraft folder. Again for curseforge this will be in your curseforge/minecraft/Install

Large files should be posted to a file sharing site like https://gist.github.com  You should also read the support forum sticky post.

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



×
×
  • Create New...

Important Information

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