Jump to content

Recommended Posts

Posted (edited)

Hey all.
Question in the title. I have a special armor item, that has defense properties, which depend on the current biome. I overrode the onArmorTick method like this:
 

	@Override
	public void onArmorTick(ItemStack stack, World world, PlayerEntity player) {
		if(world.getDayTime() % 20 == 0) {
			Biome biome = world.getBiome(player.getPosition());
			DefenseLayer layer = BasePropertiesAPI.getDefenseLayer(biome);
			DefenseDataAPI.putLayer(stack, layer, ElementalCombatWeaponry.ARMOR_RESOURCE_LOCATION);
			
			if(world.isRemote) {
				ElementalCombatWeaponry.LOGGER.info("Biome: " + biome.getRegistryName());
			}
		}
	}

This code produces the indented behavior, if run in single player. But when I am running the same code in a multiplayer setting I run into trouble on the client side. On server everything runs as expected, but on the client side the biome has the registryName = null (I know this because of the logging). The BasePropertiesAPI#getDefenseLayer checks a Map<ResourceLocation, DefenseLayer> with the registryName of the biome. Since the registryName is null, only a default value is returned. This means, I also have desyncronzied data... (at the end the method from DefenseDataAPI will update my itemstack capability.)

Gameplaywise everything is fine (the defense properties are used for calculation on the server side anyway). But the properties should be the same on client for display purpose.

I tried to look at the DebugOverlayGUI class, because this obviously works and can show the registryName of the current biome. The important line of this class is the following:

list.add("Biome: " + this.mc.world.func_241828_r().getRegistry(Registry.BIOME_KEY).getKey(this.mc.world.getBiome(blockpos)));


Could anyone please explain, what 'this.mc.world.func_241828_r().getRegistry(Registry.BIOME_KEY).getKey()' does and why the simple  world.getBiome(blockpos) doesn't suffice?

Thank you and with best regards

Tavi

Edited by Tavi007
Posted

Is the quoted line able to run both on server and client? And can I simply copy it or are there better methods available? I am able to change BasePropertiesAPI#getDefenseLayer(biome) and it would be great, if I can adjust this api method without it breaking on either side.

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

    • I tried do download the essential mod to my mod pack but i didnt work. I paly on 1.21 and it should work. I use neoforge for my modding. The weird things is my friend somehow added the mod to his modpack and many others that I somehow can´t. Is there anything i can do? 
    • Thanks, I've now installed a slightly newer version and the server is at least starting up now.
    • i have the same issue. Found 1 Create mod class dependency(ies) in createdeco-1.3.3-1.19.2.jar, which are missing from the current create-1.19.2-0.5.1.i.jar Found 11 Create mod class dependency(ies) in createaddition-fabric+1.19.2-20230723a.jar, which are missing from the current create-1.19.2-0.5.1.i.jar Detailed walkthrough of mods which rely on missing Create mod classes: Mod: createaddition-fabric+1.19.2-20230723a.jar Missing classes of create: com/simibubi/create/compat/jei/category/sequencedAssembly/JeiSequencedAssemblySubCategory com/simibubi/create/compat/recipeViewerCommon/SequencedAssemblySubCategoryType com/simibubi/create/compat/rei/CreateREI com/simibubi/create/compat/rei/EmptyBackground com/simibubi/create/compat/rei/ItemIcon com/simibubi/create/compat/rei/category/CreateRecipeCategory com/simibubi/create/compat/rei/category/WidgetUtil com/simibubi/create/compat/rei/category/animations/AnimatedBlazeBurner com/simibubi/create/compat/rei/category/animations/AnimatedKinetics com/simibubi/create/compat/rei/category/sequencedAssembly/ReiSequencedAssemblySubCategory com/simibubi/create/compat/rei/display/CreateDisplay Mod: createdeco-1.3.3-1.19.2.jar Missing classes of create: com/simibubi/create/content/kinetics/fan/SplashingRecipe
    • The crash points to moonlight lib - try other builds or make a test without this mod and the mods requiring it
    • Do you have shaders enabled? There is an issue with the mod simpleclouds - remove this mod or disable shaders, if enabled  
  • Topics

×
×
  • Create New...

Important Information

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