Posted April 11, 201510 yr Hi there, thanks for opening this topic. I was looking in vanilla source code trying to find a way to change light that block recieves to display shadow... In short, here's my problem: If you have any ideas how i could do this, please tell me... IF you have any questions - just ask! Check out my mods: BTAM Armor sets Avoid Exploding Creepers Tools compressor Anti Id Conflict Key bindings overhaul Colourfull blocks Invisi Zones
April 11, 201510 yr Block#setLightOpacity(0); Apparently I'm a complete and utter jerk and come to this forum just like to make fun of people, be confrontational, and make your personal life miserable. If you think this is the case, JUST REPORT ME. Otherwise you're just going to get reported when you reply to my posts and point it out, because odds are, I was trying to be nice. Exception: If you do not understand Java, I WILL NOT HELP YOU and your thread will get locked. DO NOT PM ME WITH PROBLEMS. No help will be given.
April 11, 201510 yr Author And then new map with light opacities to change it back in certain conditions... Maybe, but there's no other way? (btw, my mod to do this already uses asm, so use it once more somewhere will not be hard... (but where exactly, i can't find...)) EDIT: maybe directly getLightOpacity with coords in block??? Check out my mods: BTAM Armor sets Avoid Exploding Creepers Tools compressor Anti Id Conflict Key bindings overhaul Colourfull blocks Invisi Zones
April 25, 201510 yr Author And then new map with light opacities to change it back in certain conditions... Maybe, but there's no other way? (btw, my mod to do this already uses asm, so use it once more somewhere will not be hard... (but where exactly, i can't find...)) EDIT: maybe directly getLightOpacity with coords in block??? Okay, i tried to pacth it, and now i'm getting very strange error: [12:00:14] [main/INFO] [iZ Core]: ################################################## [12:00:14] [main/INFO] [iZ Core]: Patching Block [12:00:14] [main/INFO] [iZ Core]: ************************************************** [12:00:14] [main/INFO] [iZ Core]: Patching getLightOpacity [12:00:14] [main/INFO] [iZ Core]: Patching getLightOpacity Completed [12:00:14] [main/INFO] [iZ Core]: ************************************************** [12:00:14] [main/ERROR] [LaunchWrapper]: Unable to launch java.lang.reflect.InvocationTargetException at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) ~[?:1.8.0_25] at sun.reflect.NativeMethodAccessorImpl.invoke(Unknown Source) ~[?:1.8.0_25] at sun.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source) ~[?:1.8.0_25] at java.lang.reflect.Method.invoke(Unknown Source) ~[?:1.8.0_25] at net.minecraft.launchwrapper.Launch.launch(Launch.java:135) [launchwrapper-1.11.jar:?] at net.minecraft.launchwrapper.Launch.main(Launch.java:28) [launchwrapper-1.11.jar:?] at net.minecraftforge.gradle.GradleStartCommon.launch(Unknown Source) [start/:?] at GradleStart.main(Unknown Source) [start/:?] Caused by: java.lang.NoClassDefFoundError: net/minecraft/block/Block at net.minecraft.init.Bootstrap.func_151354_b(Bootstrap.java:457) ~[bootstrap.class:?] at net.minecraft.client.Minecraft.<init>(Minecraft.java:323) ~[Minecraft.class:?] at net.minecraft.client.main.Main.main(Main.java:141) ~[Main.class:?] ... 8 more Caused by: java.lang.ClassNotFoundException: net.minecraft.block.Block at net.minecraft.launchwrapper.LaunchClassLoader.findClass(LaunchClassLoader.java:191) ~[launchwrapper-1.11.jar:?] at java.lang.ClassLoader.loadClass(Unknown Source) ~[?:1.8.0_25] at java.lang.ClassLoader.loadClass(Unknown Source) ~[?:1.8.0_25] at net.minecraft.init.Bootstrap.func_151354_b(Bootstrap.java:457) ~[bootstrap.class:?] at net.minecraft.client.Minecraft.<init>(Minecraft.java:323) ~[Minecraft.class:?] at net.minecraft.client.main.Main.main(Main.java:141) ~[Main.class:?] ... 8 more Caused by: java.lang.StringIndexOutOfBoundsException: String index out of range: 66 at java.lang.String.charAt(Unknown Source) ~[?:1.8.0_25] at org.objectweb.asm.Type.getArgumentsAndReturnSizes(Type.java:417) ~[asm-debug-all-5.0.3.jar:5.0.3] at org.objectweb.asm.MethodWriter.visitMethodInsn(MethodWriter.java:906) ~[asm-debug-all-5.0.3.jar:5.0.3] at org.objectweb.asm.tree.MethodInsnNode.accept(MethodInsnNode.java:133) ~[asm-debug-all-5.0.3.jar:5.0.3] at org.objectweb.asm.tree.InsnList.accept(InsnList.java:162) ~[asm-debug-all-5.0.3.jar:5.0.3] at org.objectweb.asm.tree.MethodNode.accept(MethodNode.java:816) ~[asm-debug-all-5.0.3.jar:5.0.3] at org.objectweb.asm.tree.MethodNode.accept(MethodNode.java:726) ~[asm-debug-all-5.0.3.jar:5.0.3] at org.objectweb.asm.tree.ClassNode.accept(ClassNode.java:412) ~[asm-debug-all-5.0.3.jar:5.0.3] at code.elix_x.coremods.invisizones.core.InvisiZonesTransformer.patchBlock(InvisiZonesTransformer.java:98) ~[bin/:?] at code.elix_x.coremods.invisizones.core.InvisiZonesTransformer.transform(InvisiZonesTransformer.java:44) ~[bin/:?] at net.minecraft.launchwrapper.LaunchClassLoader.runTransformers(LaunchClassLoader.java:279) ~[launchwrapper-1.11.jar:?] at net.minecraft.launchwrapper.LaunchClassLoader.findClass(LaunchClassLoader.java:176) ~[launchwrapper-1.11.jar:?] at java.lang.ClassLoader.loadClass(Unknown Source) ~[?:1.8.0_25] at java.lang.ClassLoader.loadClass(Unknown Source) ~[?:1.8.0_25] at net.minecraft.init.Bootstrap.func_151354_b(Bootstrap.java:457) ~[bootstrap.class:?] at net.minecraft.client.Minecraft.<init>(Minecraft.java:323) ~[Minecraft.class:?] at net.minecraft.client.main.Main.main(Main.java:141) ~[Main.class:?] ... 8 more Java HotSpot(TM) 64-Bit Server VM warning: Using incremental CMS is deprecated and will likely be removed in a future release And block transformer method: private byte[] patchBlock(String name, byte[] bytes) { String getLightOpacity = "getLightOpacity"; String getLightOpacityDesc = "(L" + InvisiZonesTranslator.getMapedClassName("world.IBlockAccess").replace(".", "/") + ";III)I"; ClassNode classNode = new ClassNode(); ClassReader classReader = new ClassReader(bytes); classReader.accept(classNode, 0); for(MethodNode method : classNode.methods){ if(method.name.equals(getLightOpacity) && method.desc.equals(getLightOpacityDesc)){ try{ logger.info("**************************************************"); logger.info("Patching getLightOpacity"); InsnList list = new InsnList(); list.add(new VarInsnNode(Opcodes.ALOAD, 0)); list.add(new VarInsnNode(Opcodes.ALOAD, 1)); list.add(new VarInsnNode(Opcodes.ILOAD, 2)); list.add(new VarInsnNode(Opcodes.ILOAD, 3)); list.add(new VarInsnNode(Opcodes.ILOAD, 4)); list.add(new MethodInsnNode(Opcodes.INVOKESTATIC, "code.elix_x.coremods.invisizones.core.InvisiZoneHooks".replace(".", "/"), "getLightOpacity", "(L" + InvisiZonesTranslator.getMapedClassName("block.Block").replace(".", "/") + ";L" + InvisiZonesTranslator.getMapedClassName("world.IBlockAccess").replace(".", "/") + "III)I", false)); list.add(new InsnNode(Opcodes.IRETURN)); list.add(new LabelNode()); method.instructions.insert(list); logger.info("Patching getLightOpacity Completed"); logger.info("**************************************************"); }catch(Exception e){ logger.info("Patching getLightOpacity Failed With Exception:"); e.printStackTrace(); logger.info("**************************************************"); } } } ClassWriter writer = new ClassWriter(ClassWriter.COMPUTE_MAXS); classNode.accept(writer); return writer.toByteArray(); } Any ideas, why is it happening? EDIT: Forgot one semicolon, now this is working... Check out my mods: BTAM Armor sets Avoid Exploding Creepers Tools compressor Anti Id Conflict Key bindings overhaul Colourfull blocks Invisi Zones
April 25, 201510 yr Author Well, i got some progress, but it still isn't as i want... From left to right: air, glass, what i'm doing. As you can see, with glass all looks like air, but what i do is not... What i tried to do: setting (or returning) opacity of blocks in zone to 0. Do you have any ideas??? Check out my mods: BTAM Armor sets Avoid Exploding Creepers Tools compressor Anti Id Conflict Key bindings overhaul Colourfull blocks Invisi Zones
April 25, 201510 yr What are you returning for the isOpaqueCube() function in your block? Check out my tutorials here: http://jabelarminecraft.blogspot.com/
April 25, 201510 yr Author What are you returning for the isOpaqueCube() function in your block? Problem is: these are not my blocks, these not even known blocks... What i'm trying ot do is with selection of zone, make all blocks within invisible... And this ligting is only problem left. I know about isOpaqueCube, and want to know if there's position sensitive version for it (like for opacity for example), Because otherwise it would be too much patching... OR there's other way around??? And also, i misspressed button , pressed thank you instead of quote... well... doesn't matter... Check out my mods: BTAM Armor sets Avoid Exploding Creepers Tools compressor Anti Id Conflict Key bindings overhaul Colourfull blocks Invisi Zones
April 26, 201510 yr Author Well, should i ask forge to add position sensetive isOpaque, or should i patch all occurences manually? Check out my mods: BTAM Armor sets Avoid Exploding Creepers Tools compressor Anti Id Conflict Key bindings overhaul Colourfull blocks Invisi Zones
May 25, 201510 yr Author Well, should i ask forge to add position sensetive isOpaque, or should i patch all occurences manually? There are lots of them... Don't think easy to patch even using asm... Check out my mods: BTAM Armor sets Avoid Exploding Creepers Tools compressor Anti Id Conflict Key bindings overhaul Colourfull blocks Invisi Zones
May 26, 201510 yr Problem is: these are not my blocks, these not even known blocks... What i'm trying ot do is with selection of zone, make all blocks within invisible... If you're not replacing the blocks with your own custom invisible block, how are you making those blocks invisible? Are you intercepting the rendering somehow? Check out my tutorials here: http://jabelarminecraft.blogspot.com/
May 26, 201510 yr Why don't you just replace the blocks with your own custom invisible blocks, and have each invisible block have what block it replaced in its NBT, so you swap them back and forth.
May 26, 201510 yr Author Problem is: these are not my blocks, these not even known blocks... What i'm trying ot do is with selection of zone, make all blocks within invisible... If you're not replacing the blocks with your own custom invisible block, how are you making those blocks invisible? Are you intercepting the rendering somehow? Problem is: these are not my blocks, these not even known blocks... What i'm trying ot do is with selection of zone, make all blocks within invisible... If you're not replacing the blocks with your own custom invisible block, how are you making those blocks invisible? Are you intercepting the rendering somehow? The thing is that if camera is inside zone, it must be rendered, if outside - not. If camera has glasses on and it's zone owner - yes... And mod needs to be server compatible (replacing blocks on client, next sync will break everything)... That's why i can't simply replace blocks with invisible blocks... And actually, this is the last issue that i need to fix before releasing... Oh and yes, i intercept rendring in world renderer... Check out my mods: BTAM Armor sets Avoid Exploding Creepers Tools compressor Anti Id Conflict Key bindings overhaul Colourfull blocks Invisi Zones
May 28, 201510 yr Author Oh, just remembered another reason: if i would replace blocks, tilentities would be down so, i would need to store te data too, but also, while player is outside, everything would stop working... so yeah... Any more ideas of "Changing light value of shadow of block to be displayed..." Check out my mods: BTAM Armor sets Avoid Exploding Creepers Tools compressor Anti Id Conflict Key bindings overhaul Colourfull blocks Invisi Zones
May 28, 201510 yr Not sure if this will help, but to fix shadowing on my stairs I had to useNeighborBrightness = true;
May 29, 201510 yr Author Not sure if this will help, but to fix shadowing on my stairs I had to useNeighborBrightness = true; That's probably not what i'm looking for... Thanks for help, still... Check out my mods: BTAM Armor sets Avoid Exploding Creepers Tools compressor Anti Id Conflict Key bindings overhaul Colourfull blocks Invisi Zones
May 30, 201510 yr Author Sorry for bumping, but anymore ideas??? Because it's only thing that is left to fix in my mod before release... :'( Check out my mods: BTAM Armor sets Avoid Exploding Creepers Tools compressor Anti Id Conflict Key bindings overhaul Colourfull blocks Invisi Zones
June 7, 201510 yr Author I was searching a lot in code, and i haven't found anything else usefull... So any more ideas??? Or this is +-hardly doable? Check out my mods: BTAM Armor sets Avoid Exploding Creepers Tools compressor Anti Id Conflict Key bindings overhaul Colourfull blocks Invisi Zones
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.