Jump to content

Recommended Posts

Posted (edited)

Hi all!

I want to access the field of the class net.minecraft.world.entity.projectile.FishingHook

   private static final EntityDataAccessor<Boolean> DATA_BITING = SynchedEntityData.defineId(FishingHook.class, EntityDataSerializers.BOOLEAN);

According to documentation 

i created the file src/main/resources/META-INF/accesstransformer.cfg which contains only one line:

public net.minecraft.world.entity.projectile.FishingHook DATA_BITING

And added in forge-1.19.2-43.1.7-mdk/build.gradle

...

minecraft {

	accessTransformer = file('src/main/resources/META-INF/accesstransformer.cfg')

...

Now in my mod i try to access that variable

	private FishingHook fishingHook;

	@SubscribeEvent
	public void onTick(ClientTickEvent event) {
		if (fishingHook != null) {
			if (fishingHook.isRemoved()) {
				fishingHook = null;
				return;
			}
			SynchedEntityData data = fishingHook.getEntityData();
			EntityDataAccessor<Boolean> accessor = FishingHook.DATA_BITING;
			Boolean biting = data.get(accessor);
			System.err.println("biting=" + biting);
		}
	}

But the compiler says the variable is not visible. what else do i need to do to make the access transformers work? Run genEclipseRun or eclipse?

Thx

Edited by Zacomat
solved
Posted

You have to use its runtime name.

There's a bot on forge's discord that helps you do it. Ask there.

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.

  • Zacomat changed the title to [1.19.2][Solved] Access Transformers

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.