Jump to content

Lemon Lord

  • Posts

  • Joined

  • Last visited

Recent Profile Visitors

The recent visitors block is disabled and is not being shown to other users.

Lemon Lord's Achievements

Tree Puncher

Tree Puncher (2/8)



  1. I modify the game for fun. The reason for this specifically is I've made some changes to a few server protocols and want to see if they are being processed correctly client-side. I'm very sorry if this wasn't clear from my original post or upset you in some way. For now, looking into auth mods. Going to steal code and build my own just to be sure I'm not giving someone my password, as you suggested. This build should be very helpful so thank you to you both
  2. I recognise this question has been asked a few times over the last two or so years. Since then, to log into Minecraft it has been made mandatory to go through Microsoft's authentication system. It appears that it is possible, I'm looking at a node.js module that manages to do it using some 'clientToken' and the yggdrasil API. I spoke with McJty and they were quite clear that it was "not easy" at present. My question is: since it is impossible to log into a Minecraft account the old way, is there a way for a Forge development clent to be authorised with some configuration, whether that be CLI arguments or some sort of environment variables or external libraries etc and how would I do it? At the moment, I'm just trying to use IntelliJ's debug tool to debug a change I made to the way encryption of packets works (post-"Encryption Key Response") and this does not appear to be possible on an unauthenticated client as they can't even get to the "Encryption Key Request" step. Though, since this question has been asked a few times and if a solution exists for the problem of authentication, I would rather see an answer for that than a workaround for sending relevant encryption setup packets on unauth'd clients. Any help would be appreciated, thank you very much.
  3. Hello, I cannot figure these out. I've failed to find any examples of this code working but I'm trying to implement a sensor so that my entity flees from specific blocks like how piglins do from soul fire. I realise I could use path nodes for this but I want it to behave in accordance with a custom block tag I've set up. My sensor is as such: public class TreemanSensor extends Sensor<LivingEntity> { @Override public Set<MemoryModuleType<?>> getUsedMemories() { // basically just copied over the code from the piglin one until I could spawn TreemanEntity without the game crashing return ImmutableSet.of(MemoryModuleType.VISIBLE_MOBS, MemoryModuleType.MOBS, MemoryModuleType.NEAREST_VISIBLE_NEMESIS, MemoryModuleType.NEAREST_TARGETABLE_PLAYER_NOT_WEARING_GOLD, MemoryModuleType.NEAREST_PLAYER_HOLDING_WANTED_ITEM, MemoryModuleType.NEAREST_VISIBLE_HUNTABLE_HOGLIN, MemoryModuleType.NEAREST_VISIBLE_BABY_HOGLIN, MemoryModuleType.NEAREST_VISIBLE_ADULT_PIGLINS, MemoryModuleType.NEAREST_ADULT_PIGLINS, MemoryModuleType.VISIBLE_ADULT_PIGLIN_COUNT, MemoryModuleType.VISIBLE_ADULT_HOGLIN_COUNT, MemoryModuleType.NEAREST_REPELLENT); } @Override protected void update(ServerWorld world, LivingEntity treeman) { Brain<?> brain = treeman.getBrain(); brain.setMemory(MemoryModuleType.NEAREST_REPELLENT, findNearestFlame(world, treeman)); } public static Optional<BlockPos> findNearestFlame(ServerWorld world, Entity entity) { return BlockPos.getClosestMatchingPosition(entity.getPosition(), 8, 4, (pos) -> isFlame(world, pos)); } private static boolean isFlame(ServerWorld world, BlockPos pos) { BlockState state = world.getBlockState(pos); Block block = state.getBlock(); return AppleBlockTags.TREEMAN_REPELLENTS.contains(block) || block instanceof AbstractFireBlock || (block instanceof CampfireBlock && CampfireBlock.isLit(state)); } } and I have a corresponding SensorType registry object as follows: public static final RegistryObject<SensorType<TreemanSensor>> TREEMAN_SENSOR_TYPE = SENSOR_TYPES.register("treeman_sensor", ()->new SensorType<>(TreemanSensor::new)); and it seems to register fine. To be clear, that 'SENSOR_TYPES' static value is private and is in a completely separate package to the following entity class. I try to add it to my TreemanEntity using: protected static final ImmutableList<? extends SensorType<? extends Sensor<? super TreemanEntity>>> SENSOR_TYPES = ImmutableList.of( SensorType.NEAREST_LIVING_ENTITIES, SensorType.NEAREST_PLAYERS, RegistryHandler.TREEMAN_SENSOR_TYPE.get()); protected static final ImmutableList<? extends MemoryModuleType<?>> MEMORY_MODULE_TYPES = ImmutableList.of( MemoryModuleType.BREED_TARGET, MemoryModuleType.MOBS, MemoryModuleType.VISIBLE_MOBS, MemoryModuleType.NEAREST_VISIBLE_PLAYER, MemoryModuleType.NEAREST_VISIBLE_TARGETABLE_PLAYER, MemoryModuleType.LOOK_TARGET, MemoryModuleType.WALK_TARGET, MemoryModuleType.CANT_REACH_WALK_TARGET_SINCE, MemoryModuleType.PATH, MemoryModuleType.ATTACK_TARGET, MemoryModuleType.ATTACK_COOLING_DOWN, MemoryModuleType.NEAREST_VISIBLE_ADULT_PIGLIN, MemoryModuleType.AVOID_TARGET, MemoryModuleType.VISIBLE_ADULT_PIGLIN_COUNT, MemoryModuleType.VISIBLE_ADULT_HOGLIN_COUNT, MemoryModuleType.NEAREST_VISIBLE_ADULT_HOGLINS, MemoryModuleType.NEAREST_VISIBLE_ADULT, MemoryModuleType.NEAREST_REPELLENT, MemoryModuleType.PACIFIED); @Override protected Brain.BrainCodec<TreemanEntity> getBrainCodec() { return Brain.createCodec(MEMORY_MODULE_TYPES, SENSOR_TYPES); } @Override protected Brain<?> createBrain(Dynamic<?> dynamicIn) { return TreemanTasks.initBrain(this.getBrainCodec().deserialize(dynamicIn)); } @Override @SuppressWarnings("unchecked") public Brain<TreemanEntity> getBrain() { return (Brain<TreemanEntity>) super.getBrain(); } @Override protected void updateAITasks() { this.world.getProfiler().startSection("treemanBrain"); this.getBrain().tick((ServerWorld) this.world, this); this.world.getProfiler().endSection(); } and that TreemanTasks class is just: public class TreemanTasks { protected static Brain<?> initBrain(Brain<TreemanEntity> brain) { initCoreTasks(brain); initIdleTasks(brain); brain.setPersistentActivities(ImmutableSet.of(Activity.CORE)); brain.setFallbackActivity(Activity.IDLE); brain.switchToFallbackActivity(); return brain; } private static void initCoreTasks(Brain<TreemanEntity> brain) { brain.registerActivity(Activity.CORE, 10, ImmutableList.<Task<? super TreemanEntity>>of( RunAwayTask.func_233963_a_(MemoryModuleType.NEAREST_REPELLENT, 1.0F, 8, true)) ); } private static void initIdleTasks(Brain<TreemanEntity> brain) { brain.registerActivity(Activity.IDLE, ImmutableList.of( Pair.<Integer, Task<? super TreemanEntity>>of(1, new DummyTask(30, 60))) ); } } but it just doesn't... do anything. I spawn the mob and it's just 🧍‍♂️. Nothing seems to appear in its memories when I place down a repellent block near it though it doesn't seem piglin entities have anything appear in their memories when fleeing soul flame. Just kinda lost as to where to go from here, sorry if this was a bit of a read.
  4. Oh, a very good suggestion. There's a message here https://discord.com/channels/313125603924639766/733055378371117127/835920536118493184 that had what I needed thank you again, though I don't know how your CameraCraft3 builds without an annotation processor dependency, that seems to be a requirement now, but hell what do I know? Have an excellent day, dude, thanks again
  5. Alright I went back to 4.1.+ because some stuff wasn't working, here's the entire output for the failed build. To honour the JVM settings for this build a single-use Daemon process will be forked. See https://docs.gradle.org/6.8.1/userguide/gradle_daemon.html#sec:disabling_the_daemon. Daemon will be stopped at the end of the build > Configure project : [MixinGradle] Skipping eclipse integration, extension not found Java: 11.0.9 JVM: 11.0.9+7-LTS(Oracle Corporation) Arch: amd64 > Task :compileJava [22:03:29] [main/INFO]: Writing debug log file accesstransform.log [22:03:29] [main/INFO]: Access Transformer processor running version 1.0.5+4+02b7b69 [22:03:29] [main/INFO]: Command line arguments [--inJar, C:\Users\Lemon\Desktop\apple\AppleOfMyEye\build\fg_cache\net\minecraftforge\forge\1.16.5-36.1.16\forge-1.16.5-36.1.16-injected.jar, --outJar, C:\Users\Lemon\Desktop\apple\Appl eOfMyEye\build\fg_cache\net\minecraftforge\forge\1.16.5-36.1.16_mapped_snapshot_20210309-1.16.5\forge-1.16.5-36.1.16_mapped_snapshot_20210309-1.16.5.jar, --logFile, accesstransform.log, --atFile, C:\Users\Lemon\Desktop\apple\AppleOf MyEye\src\main\resources\META-INF\accesstransformer.cfg, --atFile, C:\Users\Lemon\Desktop\apple\AppleOfMyEye\build\_atJar_5\parent_at.cfg] [22:03:29] [main/INFO]: Reading from C:\Users\Lemon\Desktop\apple\AppleOfMyEye\build\fg_cache\net\minecraftforge\forge\1.16.5-36.1.16\forge-1.16.5-36.1.16-injected.jar [22:03:29] [main/INFO]: Writing to C:\Users\Lemon\Desktop\apple\AppleOfMyEye\build\fg_cache\net\minecraftforge\forge\1.16.5-36.1.16_mapped_snapshot_20210309-1.16.5\forge-1.16.5-36.1.16_mapped_snapshot_20210309-1.16.5.jar [22:03:29] [main/INFO]: Transformer file C:\Users\Lemon\Desktop\apple\AppleOfMyEye\src\main\resources\META-INF\accesstransformer.cfg [22:03:29] [main/INFO]: Transformer file C:\Users\Lemon\Desktop\apple\AppleOfMyEye\build\_atJar_5\parent_at.cfg [22:03:29] [main/WARN]: Found existing output jar C:\Users\Lemon\Desktop\apple\AppleOfMyEye\build\fg_cache\net\minecraftforge\forge\1.16.5-36.1.16_mapped_snapshot_20210309-1.16.5\forge-1.16.5-36.1.16_mapped_snapshot_20210309-1.16.5. jar, overwriting [22:03:38] [main/INFO]: JAR transformation complete C:\Users\Lemon\Desktop\apple\AppleOfMyEye\build\fg_cache\net\minecraftforge\forge\1.16.5-36.1.16_mapped_snapshot_20210309-1.16.5\forge-1.16.5-36.1.16_mapped_snapshot_20210309-1.16. 5.jar Creating SRG -> MCP TSRG Note: Some input files use or override a deprecated API. Note: Recompile with -Xlint:deprecation for details. Note: Some input files use unchecked or unsafe operations. Note: Recompile with -Xlint:unchecked for details. > Task :addRefMapToJar FAILED FAILURE: Build failed with an exception. * What went wrong: Execution failed for task ':addRefMapToJar'. > Gradle 6 was detected but the mixin dependency was missing from one or more Annotation Processor configurations: [annotationProcessor]. To enable the Mixin AP please include the mixin processor artefact in each Annotation Processo r configuration. For example if you are using mixin dependency 'org.spongepowered:mixin:0.1.2-SNAPSHOT' you should specify the dependency 'org.spongepowered:mixin:0.1.2-SNAPSHOT:processor'. If you believe you are seeing this message in error, you can disable this check via the disableAnnotationProcessorCheck() directive. * Try: Run with --stacktrace option to get the stack trace. Run with --info or --debug option to get more log output. Run with --scan to get full insights. * Get more help at https://help.gradle.org Deprecated Gradle features were used in this build, making it incompatible with Gradle 7.0. Use '--warning-mode all' to show the individual deprecation warnings. See https://docs.gradle.org/6.8.1/userguide/command_line_interface.html#sec:command_line_warnings BUILD FAILED in 1m 48s 5 actionable tasks: 5 executed This is when I attempt to `gradlew build` after running a `gradlew clean`. I made the spongeforge stuff identical to yours, my wrapper is at version 6.8.1. It seems to be asking me to include an annotation processor with the ability to disable it. Any ideas? Game runs fine, just building seems to not work.
  6. My mistake the player head thing seems to be a problem with vanilla. Doesn't seem you can just enter a player name and have it get the player anymore, you require the full serialised GameProfile. Works though, so that's good news. Can you link me your project's repo? I'd like to see if I'm doing something wrong. If it's private or local-only, obviously don't worry.
  7. Spiffing! Thank you, read somewhere in some old 1.7.10 cookbook it was '--pass' and when that didn't work I gave up trying. Do you know why player heads still aren't working? I can see my own head but all other heads seem to pause the game to download the texture but then just render as Alex. Is there something additional I need to add to the run configuration to make it connect to api.minecraft.net or is that outside of the reach of forge to begin with? I'm sorry, I don't remember. I downgraded to 3.+ and can't remember how to upgrade back to 4.1.+ though I do know it would take a lot of time to redownload, that happens whenever I reload my gradle and the constant impotent waiting is slowly killing me. The only bit that seemed relevant was `Execution failed for task ':addRefMapToJar'` though between that and the contents of the above coe block beginning with "A problem occurred evaluating root project 'AppleOfMyEye'." I don't think there was anything else in the big red error text. My IntelliJ was also highlighting the 'add' command(? method? function?) in my build.gradle (see the code block from the original post) and saying it didn't exist in the org.gradle.api which I think indicates it wasn't applying the spongeforge mixin plugin correctly as 'add' is a spongeforge method. That or IntelliJ was able to pick it up on Gradle 4.9 and not on Gradle 6.8.1... somehow. I can only assume this is a result of MixinGradle not being properly supported for Gradle 6 though I do not understand Gradle in the slightest.
  8. Update: after running `gradlew clean` I was able to run the wrapper change and then building worked but still confused as to why I had to downgrade, maybe I should've posted this topic in ForgeGradle. Would also like to know if it's possible to generate valid session tokens with the Mod Development Kit so I can test online functionality such as my changes to skin downloading for heads.
  9. Hey lovely forge people, I have a gradle problem. Essentially I updated to gradle 6.8.1 so that I could use ForgeGradle 4.1.+ and now I can no longer build my project (edit: I should specify that I mean I can no longer execute `gradlew build` with any success, running the client works fine. I want to be able to do this so I can get the .jar for my mod). I do have spongeforge mixins. The error I'm getting is `Execution failed for task ':addRefMapToJar'.` I assume this is stemming from the line in my build.gradle that goes: mixin { add sourceSets.main, 'mixins.aome.refmap.json' } which is likely something to do with spongeforge and not with forge itself. I've taken a look at some other popular 1.16.5 mod source code that use spongeforge mixins and have noticed that all of them still use ForgeGradle 3.+. My question is as the title presents it but also is there any benefit of upgrading the forge gradle version? Builds worked back on Gradle 4.9 (I think it was 4.9, I can't be sure) so I assume spongeforge just hasn't been updated since. Also how do I downgrade back to 3.+? I cannot reload my gradle in IntelliJ because: A problem occurred evaluating root project 'AppleOfMyEye'. > Failed to apply plugin 'net.minecraftforge.gradle'. > Found Gradle version Gradle 6.8.1. Versions Gradle 6.0.0 and newer are not supported in FG3, FG4 however supports Versions 6.8.1 and newer. Consider upgrading. and I can't change my gradle version with the wrapper using `gradlew wrapper --gradle-version 4.9` as it prints the same as the above. Really lost. The only reason I'm doing this is so I can test if player skins are loading properly and I can't do that with my current dev kit because it always launches in offline mode (i.e. Invalid Session) on a fake account called 'Dev'... so I'm building the mod jar to test in a proper forge client rather than in the MDK. Anyway, thanks for reading all that, I appreciate any help with any of the many branching questions there.
  10. No, as I said, I can add the gamerule just fine I just want to figure out how to put the normal GameRules.BooleanValue methods in my AT rather than have to use reflection. Looks like your mod uses reflection though. Edit: this could be an XY Problem, I just want them in the access transformer so I can invoke them directly rather than with reflection invocations. Any alternative to reflection is good with me.
  11. As title asks. It's not as simple as I'd hoped but if you have an immediate answer, there is no need to read the following. If you'd like to know why it's not as easy as simply getting the SRG name and access transformering, please read on. Story time. So I went into the main GameRules class and looked at how that's implemented. It was as follows: public static final GameRules.RuleKey<GameRules.BooleanValue> DO_FIRE_TICK = register("doFireTick", GameRules.Category.UPDATES, GameRules.BooleanValue.create(true)); Nothing too hard, I pulled this over to my own class and tried it but unfortunately GameRules.BooleanValue.create has private access in that class. "No biggie", I thought, "I'll just AT it." I rebuild my gradle so it can run the AT, it finishes after redownloading everything and I go into the newly downloaded GameRules.java and it still has private access. This confused me a bit so I tried some reflection but kept getting NoSuchMethodExceptions, even using ASMAPI.mapMethod("func_223568_b") as my method name input. I decided to run the following script on it to check what was going on. for (Method m : GameRules.BooleanValue.class.getMethods()) { AppleOfMyEye.LOGGER.info(m.getName()); for (Class<?> c : m.getParameterTypes()) { AppleOfMyEye.LOGGER.debug(c.getName()); } } which didn't show any 'create' methods. I then ran the same again with getDeclaredMethods() and that showed the create method and it's overload. [22:26:25] [Worker-Main-14/INFO] [co.le.ao.AppleOfMyEye/]: create [22:26:25] [Worker-Main-14/DEBUG] [co.le.ao.AppleOfMyEye/]: boolean [22:26:25] [Worker-Main-14/DEBUG] [co.le.ao.AppleOfMyEye/]: java.util.function.BiConsumer [22:26:25] [Worker-Main-14/INFO] [co.le.ao.AppleOfMyEye/]: create [22:26:25] [Worker-Main-14/DEBUG] [co.le.ao.AppleOfMyEye/]: boolean So I've had to use reflection but it's kind of nasty-looking and means I have to crash the game if an exception occurs or risk having the mod run in a not-fully-functional state. This not really preferable to what I could usually achieve with ATs where the code just wouldn't compile if there was a problem with it rather than compiling but with some missing values. Essentially, how do I add GameRules.BooleanValue.create(boolean) to my access transformer? The following doesn't work: public net.minecraft.world.GameRules.BooleanValue func_223568_b(Z)Lnet/minecraft/world/GameRules$RuleType; #create Thank you for your time
  12. Noticed that right after posting and yep that fixed it. Cheers, sorry for wasting your time.
  13. private static final ResourceLocation EMPTY_SWORD_TEXTURE = new ResourceLocation("item/empty_item_slot_sword"); @Override public Pair<ResourceLocation, ResourceLocation> getBackground() { return Pair.of(PlayerContainer.LOCATION_BLOCKS_TEXTURE, EMPTY_SWORD_TEXTURE); } This is the relevant code for the background. The class itself extends SlotItemHandler which is a subclass of Slot. Not sure what else I have to do to make it work
  14. Other posts on this subject seem to be outdated, as mentioned methods no longer exist. I feel like this should be very simple but I need a background for a slot in a custom GUI. I just can't seem to understand how to add an image file from my mod resources to a sprite location. I know sprites have to be within atlas textures and I elected to stitch it to the atlas blocks PNG which I know is publicly referenced in PlayerContainer. I've gone into a TextureStitchEvent.Pre subscriber method and run if(!event.getMap().getTextureLocation().equals(PlayerContainer.LOCATION_BLOCKS_TEXTURE)) return; event.addSprite(new ResourceLocation(MOD_ID,"item/empty_item_slot_sword")); but, unfortunately, this doesn't seem to add the sprite to the map and I think this is because I never give it the proper file location of the image. Very hard to be sure it doesn't work though but it doesn't appear as a background to the slots in my custom GUI both when I use this.setBackground or override getBackground. I'm not sure where I'm supposed to assign a sprite an image file or even if I need to. Vanilla's way of doing this is a bit tricky to understand and I don't see any of the empty_armor_slot PNGs being referenced anywhere except the LegacyPackWrapper (which maps new IDs to old IDs, probably to help with resource packs). Any help would be very cool
  15. Right, so, I've fixed it but as it turns out I was right about something and wrong about something else. In debugging I must've slipped up because whilst the problem I thought still exists, I forgot commands that use NBT are run server-side and came to the wrong conclusions from the debugging I performed. Also CoFH's 'Archer's Paradox' doesn't actually work, I was wrong about that too, so CoFH released a mod that's base mechanics are bugged haha sucked in The owner-not-registering-client-side problem was as such: if you're moving in front of an arrow after firing it (not too difficult in creative, kinda tricky in survival) client-side thinks it bounces off you for about a second before realising it never actually touched you and going to wherever you shot it, syncing up with server-side. This is not just me guessing that there's a desync, I've tested it and the motion Vector3d for the entity is different on remote worlds. Also the ProjectileEntity field_234610_c_ field is null client-side. Fix is as follow: Implement IEntityAdditionalSpawnData in your entity class. Assuming you're extending AbstractArrowEntity or ProjectileEntity @Override public void writeSpawnData(PacketBuffer buffer) { buffer.writeInt(this.field_234610_c_); } @Override public void readSpawnData(PacketBuffer additionalData) { int id = additionalData.readInt(); Entity entity = EntityHelper.getEntityById(id); if (entity != null) { this.setShooter(entity); } } field_234610_c_ is the ID of the shooter entity and is private by default. You could change this with an access transformer (like I did) or get it using reflection, if you have the patience for that. EntityHelper.getEntityById does exactly what you think it would, implement however you like. Profit. Still no idea why this fix is required or how vanilla arrows just don't need any of this. I understand IEntityAdditionalSpawnData is a MinecraftForge interface but there's just nothing, no replacement, no extra methods on the vanilla side and that somehow still works. P.S. thanks The Grey Ghost I'll admit I actually found a lot of code from MBE to be really helpful when I was starting out modding (like 2-4 weeks ago) and am very grateful something like that exists and I also appreciate the assist here but it actually wasn't relevant. I'd already done everything in there that applied to my entity and the problem at hand wasn't anything to do with what you had in example 81.
  • Create New...

Important Information

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