Jump to content

Alex_Wells

Members
  • Posts

    22
  • Joined

  • Last visited

Everything posted by Alex_Wells

  1. Oh, I get it now. In dev env, mod classes are compiled and added directly to classpath, meaning the classes are known to the runtime when FMLLoader instantiates LanguageLoader. After that, additional languages are only loaded for mods with FMLModType of LANGPROVIDER. That eliminates the issue, also making it simpler for the dev because they no longer need to specify Forgelin as a dependency.
  2. Hey. So I needed Forgelin to update (kotlin language provider mod) to 1.13 and didn't want to wait, so that's what I did: https://github.com/autaut03/Forgelin/tree/1.13-rewrite Basically, to load IModLanguageLoader, Forge utilizes SerivceLoader, which scans META-INF/services for files with name of specified interface. This is how FMLJavaModLanguageLoader is loaded (the one Forge mod provides), and so I did the exact same thing. When run in IDE, or by a gradle in Forgelin project, it works good. I know that because Forgelin itself is written in Kotlin and wouldn't work without kotlinfml language loaded, plus there's a bunch of debug statements in the log. However, when built and placed into mods/ folder of a normal Forge client, it fails to find requested mod loader. I'll be thankful for any kind of help/information. Also, in case this is needed, here's a built jar: https://drive.google.com/file/d/1cXkSHTV9ZeJfMB3pXapXdykrBWuun3V-/view?usp=sharing Obviously, I'm not asking anyone to run it, but it's here for the reference.
  3. May I ask why is Forge even trying to keep worlds compatible between such major rewrites? I understand why Vanilla does that (because they have full control over their game and they have limited amount of stuff to do), but mods will probably be incompatible anyway, at least when Mojang decides to refactor and rewrite that much code... so why bother? I myself have never successfully migrated a single modded world between versions, because mods always change versions, they always remove and add lots of stuff, many mods just don't update at all, others replace them..
  4. Yea, I haven't even noticed at all) I usually let IDE do the work for me, but this time I probably just wrote it manually and that's what happened
  5. I am an idiot. I've overwritten getBlockState instead of createBlockState in my block class. That's so stupid.. Okay then. I know whom to blame. If getBlockState wasn't protected (which was the reason I even noticed it), I would have never guessed that.
  6. I unded up debugging half of rendering code to find out what's the problem. Still not sure, but.. really? It got null while trying to find an exact same object (well, maybe not the same object, but with same properties, which shouldn't happen at all to my understanding of blockstates): So there's nothing wrong with my assets, rather it is with my code or Forge. I doubt it is the latter, so.. could anyone please explain what the hell is happening?
  7. I also found out that debug log might be needed, so I'll post it just in case: https://gist.github.com/autaut03/98202ff68db5826170dcd879912f303f
  8. I've had problems with model loading in the past, however I managed to fix them all (except this one).
  9. It doesn't, the only warning is about authentication (obv, because not using mojang auth at all). But here it is: https://gist.github.com/autaut03/b9a113e9397727a0be7b8452e9d6db00
  10. Hey there. So I created a block, a blockstate for it, then two models and three textures. For itemBlock, and another item from the mod I used ModelLoader to manually set their model locations - so they are both shown correctly in inventories. However, when placed in the world, it has a missing texture (purple-black). Here's the block I'm talking about: https://github.com/autaut03/roomery/blob/master/src/main/java/net/alexwells/roomery/block/RoomHolderBlock.java It's blockstate: https://github.com/autaut03/roomery/blob/master/src/main/resources/assets/roomery/blockstates/room_holder.json Main model: https://github.com/autaut03/roomery/blob/master/src/main/resources/assets/roomery/models/block/room_holder.json And textures: https://github.com/autaut03/roomery/tree/master/src/main/resources/assets/roomery/textures/blocks I must have missed something in the documentation, but I can't get this to work. There are no errors or warning in the log. What could be the reason for that? Thanks regardless. PS: model was taken from vanilla observer, and modified for my needs. PS2: screenshot:
  11. Uhm, okay, I was wrong about 1.14, sorry. However the original meaning of my message was that they will change it, and that the mod won't work here.
  12. It will. It was confirmed by Mojang in someone's twitter. And yes, I know that they won't revert it how it was, but at least they will actually listen to the PVP community, not just vanilla.
  13. They will. It's official now. 1.14. Mod WON'T WORK for 25 THOUSANDS players online server.
  14. The only reason people use 1.8.9 is because all major servers use 1.7 or 1.8 due to the PVP part of the game. Until Mojang rolls back 1.9 changes, people trying to code 1.8 won't stop coming =/
  15. At first I just wanted to replace couple instructions with my own, but I'm kind of lazy to rewrite my whole "method transformer" system in order to achieve that. And I feel like this won't fix the problem =/
  16. Is there any other way I can get help with coremods?
  17. Hello there. I'm writing a mod, and I need to modify minecraft's code so I can see barrier blocks depending on my method's result. So there's a singleton with one method specifically for this, called like this (returns bool): AlwaysShowBarriersManager.instance().isEnabled() Minecraft code, responsible for displaying barrier particles is in the "net.minecraft.client.multiplayer.WorldClient" class: public void doVoidFogParticles(int p_doVoidFogParticles_1_, int p_doVoidFogParticles_2_, int p_doVoidFogParticles_3_) { int i = 16; Random random = new Random(); ItemStack itemstack = this.mc.thePlayer.getHeldItem(); boolean flag = this.mc.playerController.getCurrentGameType() == GameType.CREATIVE && itemstack != null && Block.getBlockFromItem(itemstack.getItem()) == Blocks.barrier; MutableBlockPos blockpos$mutableblockpos = new MutableBlockPos(); for(int j = 0; j < 1000; ++j) { int k = p_doVoidFogParticles_1_ + this.rand.nextInt(i) - this.rand.nextInt(i); int l = p_doVoidFogParticles_2_ + this.rand.nextInt(i) - this.rand.nextInt(i); int i1 = p_doVoidFogParticles_3_ + this.rand.nextInt(i) - this.rand.nextInt(i); blockpos$mutableblockpos.set(k, l, i1); IBlockState iblockstate = this.getBlockState(blockpos$mutableblockpos); iblockstate.getBlock().randomDisplayTick(this, blockpos$mutableblockpos, iblockstate, random); if (flag && iblockstate.getBlock() == Blocks.barrier) { this.spawnParticle(EnumParticleTypes.BARRIER, (double)((float)k + 0.5F), (double)((float)l + 0.5F), (double)((float)i1 + 0.5F), 0.0D, 0.0D, 0.0D, new int[0]); } } } So what I want to do is alter "flag" variable, like this: boolean flag = (this.mc.playerController.getCurrentGameType() == GameType.CREATIVE && itemstack != null && Block.getBlockFromItem(itemstack.getItem()) == Blocks.barrier) || my.mod.package.AlwaysShowBarriersManager.instance().isEnabled(); or if(!flag) { flag = my.mod.package.AlwaysShowBarriersManager.instance().isEnabled(); } Both solutions would work. What I usually do with coremod's ClassTransformers is I copy the whole class into same package in my mod's src folder, then modify what I need and ASMify it using IDEA plugin. I receive such code in result: mv = cw.visitMethod(ACC_PUBLIC, "doVoidFogParticles", "(III)V", null, null); mv.visitCode(); // blablabla mv.visitEnd(); My ClassTransformer's transform method looks like this (simplified): ClassNode classNode = new ClassNode(); ClassReader classReader = new ClassReader(bytes); ClassWriter classWriter = new ClassWriter(ClassWriter.COMPUTE_FRAMES | ClassWriter.COMPUTE_MAXS); classReader.accept(classNode, ClassReader.EXPAND_FRAMES); // find needed method MethodVisitor mv = classWriter.visitMethod(); // arguments blablabla // visit code classReader.accept(methodReplacer, ClassReader.EXPAND_FRAMES); return classWriter.toByteArray(); If I try to run this, the game crashes: https://pastebin.com/0hp3EsqU Auto-generated "visit code": https://pastebin.com/ivuabcZv What am I missing here? I know that I shouldn't use coremods, but there's no way around it, so I'm forced to use them.
  18. Update isn't real. Until Minecraft rolls out 1.14/1.15, with new PVP changes, none of the servers neither their players will update. Therefore, I just can't use 1.12. Unfortunately, I will have to overwrite EntityLivingBase::handleStatusUpdate in order to make it work. That's the only solution I see for 1.8.9. Anyways, thanks for your help.
  19. Yes, but this will break any compatibility with other mods. Am I wrong? On Forge 1.8.9 latest it does not. What about damage amount and damage source, it doesn't really matter for me. The purpose of this is to send a chat message about other players reach distance on each their hit. I know it will never be precise, that it highly depends on ping, that it's not gonna always send true data. But again, I don't really care about all those And sadly, I can't update my MC version. I would, but PVP was broken in 1.9 and most servers still use 1.8 (and even 1.7) as their main versions. Therefore, I would go for any trick to make it work UPD: Yes, it's fixed only in 1.11 version
  20. Default hasEffect of ItemPotion implementation decides if glinting enchanment effect is rendered on potions or not. I want to set it to always return false. Default attackEntityFrom doesn't emit any Forge events. In EntityLivingBase's attackEntityFrom, livingAttackEvent is emitted. I want this event to be also emitted for EntityPlayerSP, so that after this I'm able to track when player gets damage from other players.
  21. Okay. So how would I replace hasEffect method of ItemPotion class and attackEntityFrom of EntityPlayerSP class? If there's any better solution, I will definitely use it!
  22. Hey there! I'm trying to hook a method of EntityPlayerSP using coremod, but for some reason public byte[] transform(String name, String transformedName, byte[] bytes) is not getting called with needed class name (net.minecraft.client.entity.EntityPlayerSP), but is getting called with all other class names (also modifying ItemPotion's method, and it works great). Here's the full code, if needed: public class ClassTransformer implements IClassTransformer { private Map<String, List<AbstractMethodTransformer>> methodTransformers = new HashMap<>(); public ClassTransformer() { addMethodTransformer(new HasEffectMethodTransformer()); addMethodTransformer(new ReachInfoClassTransformer()); } public void addMethodTransformer(AbstractMethodTransformer transformer) { String className = transformer.getClassName(); addMethodTransformerByName(className, transformer); addMethodTransformerByName(Obfuscations.get(className), transformer); } private void addMethodTransformerByName(String name, AbstractMethodTransformer transformer) { methodTransformers.computeIfAbsent(name, s -> new ArrayList<>()).add(transformer); } public byte[] transform(String name, String transformedName, byte[] bytes) { // DEBUG if(name.contains("Player") || transformedName.contains("Player")) System.out.println(name + " --- " + transformedName); if(! methodTransformers.containsKey(transformedName)) { return bytes; } System.out.println("Contains key: " + name + ", " + transformedName); List<AbstractMethodTransformer> transformers = methodTransformers.get(transformedName); ClassReader classReader = new ClassReader(bytes); ClassNode classNode = new ClassNode(); ClassWriter classWriter = new ClassWriter(ClassWriter.COMPUTE_FRAMES); classReader.accept(classNode, 0); for (MethodNode method : classNode.methods) { for(AbstractMethodTransformer transformer : transformers) { String mappedMethodName = FMLDeobfuscatingRemapper.INSTANCE.mapMethodName(classNode.name, method.name, method.desc); if(! Obfuscations.check(transformer.getMethodName(), mappedMethodName)) { continue; } System.out.println("Found method: " + transformer.getMethodName() + " " + mappedMethodName); MethodReplacer methodReplacer = new MethodReplacer(classWriter, method.name, method.desc, transformer); classReader.accept(methodReplacer, ClassReader.EXPAND_FRAMES); break; } } return classWriter.toByteArray(); } } When looking for EntityPlayerSP in the console I find nothing. What can be the problem and is there any workaround? Here's a link to logs: https://pastebin.com/aEKyucjE
×
×
  • Create New...

Important Information

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