Posted November 23, 20222 yr 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 November 26, 20222 yr by Zacomat solved
November 23, 20222 yr 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.
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.