Jump to content

Elix_x

Members
  • Posts

    878
  • Joined

  • Last visited

Everything posted by Elix_x

  1. Nope it is not... And what you're doing is (can be better) done in completely other way...
  2. GlStateManager? Where? I don't have one... Ok, i guess i can replace it with that: GL11.glDisable(GL11.GL_LIGHTING); GL11.glEnable(GL11.GL_BLEND); But is not working too... And also, here's modifed WorldRenderer's update renderer with method calls marked with //*****\\: public void updateRenderer(EntityLivingBase p_147892_1_) { if (this.needsUpdate) { this.needsUpdate = false; int i = this.posX; int j = this.posY; int k = this.posZ; int l = this.posX + 16; int i1 = this.posY + 16; int j1 = this.posZ + 16; for (int k1 = 0; k1 < 2; ++k1) { this.skipRenderPass[k1] = true; } Chunk.isLit = false; HashSet hashset = new HashSet(); hashset.addAll(this.tileEntityRenderers); this.tileEntityRenderers.clear(); Minecraft minecraft = Minecraft.getMinecraft(); EntityLivingBase entitylivingbase1 = minecraft.renderViewEntity; int l1 = MathHelper.floor_double(entitylivingbase1.posX); int i2 = MathHelper.floor_double(entitylivingbase1.posY); int j2 = MathHelper.floor_double(entitylivingbase1.posZ); byte b0 = 1; ChunkCache chunkcache = new ChunkCache(this.worldObj, i - b0, j - b0, k - b0, l + b0, i1 + b0, j1 + b0, b0); if (!chunkcache.extendedLevelsInChunkCache()) { ++chunksUpdated; RenderBlocks renderblocks = new RenderBlocks(chunkcache); net.minecraftforge.client.ForgeHooksClient.setWorldRendererRB(renderblocks); this.bytesDrawn = 0; this.vertexState = null; for (int k2 = 0; k2 < 2; ++k2) { boolean flag = false; boolean flag1 = false; boolean flag2 = false; for (int l2 = j; l2 < i1; ++l2) { for (int i3 = k; i3 < j1; ++i3) { for (int j3 = i; j3 < l; ++j3) { Block block = chunkcache.getBlock(j3, l2, i3); //*************************\\ ColourfullBlocksHooks.renderBlock(this, renderblocks, p_147892_1_, j3, l2, i3); //*************************\\ if (block.getMaterial() != Material.air) { if (!flag2) { flag2 = true; this.preRenderBlocks(k2); } if (k2 == 0 && block.hasTileEntity(chunkcache.getBlockMetadata(j3, l2, i3))) { TileEntity tileentity = chunkcache.getTileEntity(j3, l2, i3); if (TileEntityRendererDispatcher.instance.hasSpecialRenderer(tileentity)) { this.tileEntityRenderers.add(tileentity); } } int k3 = block.getRenderBlockPass(); if (k3 > k2) { flag = true; } if (!block.canRenderInPass(k2)) continue; { flag1 |= renderblocks.renderBlockByRenderType(block, j3, l2, i3); if (block.getRenderType() == 0 && j3 == l1 && l2 == i2 && i3 == j2) { renderblocks.setRenderFromInside(true); renderblocks.setRenderAllFaces(true); renderblocks.renderBlockByRenderType(block, j3, l2, i3); renderblocks.setRenderFromInside(false); renderblocks.setRenderAllFaces(false); } } } //*************************\\ ColourfullBlocksHooks.postRenderBlock(this, renderblocks, p_147892_1_, j3, l2, i3); //*************************\\ } } } if (flag1) { this.skipRenderPass[k2] = false; } if (flag2) { this.postRenderBlocks(k2, p_147892_1_); } else { flag1 = false; } if (!flag) { break; } } net.minecraftforge.client.ForgeHooksClient.setWorldRendererRB(null); } HashSet hashset1 = new HashSet(); hashset1.addAll(this.tileEntityRenderers); hashset1.removeAll(hashset); this.tileEntities.addAll(hashset1); hashset.removeAll(this.tileEntityRenderers); this.tileEntities.removeAll(hashset); this.isChunkLit = Chunk.isLit; this.isInitialized = true; } }
  3. What you choosed as directory? If you want to view mod's source, place it's source in src/api/java
  4. For mcp dir, you need to select: C:\Users\you\.gradle\caches\minecraft\net\minecraftforge\forge\forge version\unpacked\conf What do you mean they are garbage text? How did you even open this???
  5. - If you have dev version of mod, just throw it in moddingdir/eclipse/mods - If you don't have one, download Code Chicken Core - dev, and put it in moddingdir/eclipse/mods with your mod...
  6. AND add before print in to console of all args (world, x, y, z), and come back with log...
  7. Thanks for the response but I don't think thermal expansion has an api. There is the COFH api, however all other addon mods source code i've seen references thermal expansion classes themselves and I was wondering how this specifically could be achieved. If you want to add recipes, there's Pulses, Pulse Managers and FMLInterModComms. Managers register pulsars, pulsar's methods are getting called only if mod is loaded and Inter Mod Comms, "send" data between mods...
  8. Also, i don't think you need any of it's source excluding te-api... So download it and put it in src/api/java and than for testing download code chicken core - dev, cofth core, thermal foundation, thermal expansion and put all these in eclipse/mods...
  9. Will this mod need thermal expansion, or not must. If yes, create new source folder in eclipse called srs/api/java and src/api/resources, and in first put te source, in second te resources... Than when you will compile, te will not be compiled...
  10. You have not understood what i mean, and color4f works on custom rendered tileentities... 1) i tried using tessellator.setColorRGBA too, same result... 2) if inserting gl11.color4f in custom tile entity renderer, it works 3) but doing this before block rendering (asm used for call), it does not...
  11. Good day, so: I used coremod to integrate code call before each block rendering and after, because i want to change color of certain blocks at certain positions, but using gl11.glolor4f does not do anything. I know exactly that: -Methods are getting called and code reaches color4f (known via console output) -Gl11.color4f woks if applied on tileentit custom render in render code, even with same args -Coloring is not working even on custom rendered tileentities And also, i'm pushing new matrix before colored block is rendered and colored and popping after... Nor block nor position are 'unknown' for me and are decided by user... Thanks for help, and if you need anything - just ask! (i don't know if you need code, because i already wrote that i'm using GL11.glColor4f)
  12. Option one: use nbt, and send it... Option two: write to bytebuf int of lenght of array, then write one by one string. To read, read integer, and then read string times integer...
  13. Thank you, it solved the problem!
  14. Hi there, so: I'm using map to assign one object to another, and to find assigned value, i'm creating new first object and trying to find it in map with get, and as it is another object, in it's class i specified equals method to compare it... So, i tested and for the moment: equals method is working succesfully with 2 different objects, that are not the same but stored ints are equal... map.get is not working with condition above, even know that map.get description says that .equals counts... And also: minecraft uses same kind of system to assign tileentities to position, and it works... DimBlockPos: public int dim; public int x; public int y; public int z; public DimBlockPos(int dim, int x, int y, int z) { this.dim = dim; this.x = x; this.y = y; this.z = z; } @Override public boolean equals(Object obj) { if(obj instanceof DimBlockPos){ DimBlockPos pos = (DimBlockPos) obj; System.out.println("Comparing " + this + " with " + pos); return dim == pos.dim && x == pos.x && y == pos.y && z == pos.z; } return super.equals(obj); } @Override public String toString() { return "DimBlockPos{ " + dim + ", " + x + ", " + y + ", " + z + "}"; } Map map: private static Map<DimBlockPos, RGBO> map = new HashMap<DimBlockPos, RGBO>(); Method that retrieves: DimBlockPos pos = new DimBlockPos(player.worldObj.provider.dimensionId, x, y, z); RGBO rgbo = map.get(pos); System.out.println(map); System.out.println(pos); System.out.println(rgbo); System.out.println(new DimBlockPos(player.worldObj.provider.dimensionId, x, y, z).equals(new DimBlockPos(player.worldObj.provider.dimensionId, x, y, z))); System.out.println(pos.equals(new DimBlockPos(player.worldObj.provider.dimensionId, x, y, z))); And finally what console prints: [19:14:55] [Client thread/INFO] [sTDOUT]: [code.elix_x.coremods.colourfullblocks.color.ColourfullBlocksManager:renderBlock:27]: {DimBlockPos{ 0, 180, 68, 248}=RGBO{ 50.0, 0.0, -50.0, 15.0}, DimBlockPos{ 0, 180, 68, 248}=RGBO{ 50.0, 0.0, -50.0, 15.0}, DimBlockPos{ 0, 179, 68, 246}=RGBO{ 50.0, 0.0, -50.0, 15.0}, DimBlockPos{ 0, 179, 68, 246}=RGBO{ 50.0, 0.0, -50.0, 15.0}} [19:14:55] [Client thread/INFO] [sTDOUT]: [code.elix_x.coremods.colourfullblocks.color.ColourfullBlocksManager:renderBlock:28]: DimBlockPos{ 0, 180, 68, 248} [19:14:55] [Client thread/INFO] [sTDOUT]: [code.elix_x.coremods.colourfullblocks.color.ColourfullBlocksManager:renderBlock:29]: null [19:14:55] [Client thread/INFO] [sTDOUT]: [code.elix_x.coremods.colourfullblocks.util.DimBlockPos:equals:22]: Comparing DimBlockPos{ 0, 180, 68, 248} with DimBlockPos{ 0, 180, 68, 248} true [19:14:55] [Client thread/INFO] [sTDOUT]: [code.elix_x.coremods.colourfullblocks.util.DimBlockPos:equals:22]: Comparing DimBlockPos{ 0, 180, 68, 248} with DimBlockPos{ 0, 180, 68, 248} true Any help is appreciated, andif you have any questions - just ask!
  15. 4 impossible in 1.8 for the moment
  16. Okay, i tried what i found, and it not seems to be working: patch succesfull, method not called... 1) So, iinc that i'm interested in is second in whole method, that's why there's boolean and if else... 2) Instead of redirecting each label redirection to new, i tried to insert my code below this label and move old code one label below Transofmer's part responsible for this: boolean b = false; for(AbstractInsnNode currentNode : method.instructions.toArray()){ if(currentNode.getOpcode() == Opcodes.IINC){ if(!b){ b = true; } else { targetNode2 = currentNode.getPrevious(); break; } } } InsnList l = new InsnList(); l.add(new VarInsnNode(Opcodes.ALOAD, 0)); l.add(new VarInsnNode(Opcodes.ALOAD, 16)); l.add(new VarInsnNode(Opcodes.ALOAD, 1)); l.add(new VarInsnNode(Opcodes.ILOAD, 23)); l.add(new VarInsnNode(Opcodes.ILOAD, 21)); l.add(new VarInsnNode(Opcodes.ILOAD, 22)); l.add(new MethodInsnNode(Opcodes.INVOKESTATIC, "code.elix_x.coremods.colourfullblocks.core.ColourfullBlocksHooks".replace(".", "/"), "postRenderBlock", "(L" + ColourfullBlocksTranslator.getMapedClassName("client.renderer.WorldRenderer").replace(".", "/") + ";L" + ColourfullBlocksTranslator.getMapedClassName("client.renderer.RenderBlocks").replace(".", "/") + ";L" + ColourfullBlocksTranslator.getMapedClassName("entity.EntityLivingBase").replace(".", "/") + ";III)V", false)); l.add(new LabelNode()); method.instructions.insert(targetNode2, l); And this label's bytecode: L48 LINENUMBER 175 L48 FRAME CHOP 2 IINC 23 1 GOTO L44 Any help is appreciated... If you have any questions - just ask! EDIT: changed transformer once more, now it's working!!!
  17. direction -=-> te nbt ----\ \-> metadata -=->Rotation dependent on it... (Gl.rotatef, ...)
  18. Thanks, i'm already inserting one call in beginning, but i need one in the end (for different purpose, for different mod). So it will be easier easier to replace them... Okay, but there's 3 "final" ifs and one continue... Ok, i'll try it... EDIT: Hmm, this is end of loop, and has first in method IINC, probably i can use it as mark of where i can insert code...
  19. First: i understand that in bytecode there's no such thing as {}, there are labels and ifs are represented like "if true - continue, if not - goto l254"... And that poses problems, because last "}" redirects it directly to end (in this case back to loop) without passing via additional labels (and it must not). I know that i could manually change redirection to new label, but will not it be too much redirections to apply? So i was thinking if there's easier way??? Second: why i want coremod: disable rendering of certain blocks (any) in certain positions (any)...
  20. Good day, i have a quastion: how can i insert my method call between multiple } So, here's the code that i'm modifiying (i'm not posting whole method, it's too long) and insertion parts are marked by //INSERTION:, because i'm inserting 2 calls: for (int k2 = 0; k2 < 2; ++k2) { boolean flag = false; boolean flag1 = false; boolean flag2 = false; for (int l2 = j; l2 < i1; ++l2) { for (int i3 = k; i3 < j1; ++i3) { for (int j3 = i; j3 < l; ++j3) { Block block = chunkcache.getBlock(j3, l2, i3); //INSERTION: SUCCESFULL if (block.getMaterial() != Material.air) { if (!flag2) { flag2 = true; this.preRenderBlocks(k2); } if (k2 == 0 && block.hasTileEntity(chunkcache.getBlockMetadata(j3, l2, i3))) { TileEntity tileentity = chunkcache.getTileEntity(j3, l2, i3); if (TileEntityRendererDispatcher.instance.hasSpecialRenderer(tileentity)) { this.tileEntityRenderers.add(tileentity); } } int k3 = block.getRenderBlockPass(); if (k3 > k2) { flag = true; } if (!block.canRenderInPass(k2)) continue; { flag1 |= renderblocks.renderBlockByRenderType(block, j3, l2, i3); if (block.getRenderType() == 0 && j3 == l1 && l2 == i2 && i3 == j2) { renderblocks.setRenderFromInside(true); renderblocks.setRenderAllFaces(true); renderblocks.renderBlockByRenderType(block, j3, l2, i3); renderblocks.setRenderFromInside(false); renderblocks.setRenderAllFaces(false); } } } //INSERTION: UNSUCCESFULL, CODE MOVES TO 3 LINES ABOVE (i think, because it is called, but not always...) } } } What i also tried: in first insertion create ifeq redirecting to labale node above second statement, to which called method will always return true, but it is not working either... And if you want, method to patch it (not sure if needed, but): private byte[] patchWorldRenderer(String name, byte[] bytes) { String updateRenderer = ColourfullBlocksTranslator.getMapedMethodName("WorldRenderer", "func_147892_a", "updateRenderer"); String updateRendererDesc = ColourfullBlocksTranslator.getMapedMethodDesc("WorldRenderer", "func_147892_a", "(Lnet/minecraft/entity/EntityLivingBase;)V"); ClassNode classNode = new ClassNode(); ClassReader classReader = new ClassReader(bytes); classReader.accept(classNode, 0); for(MethodNode method : classNode.methods){ if(method.name.equals(updateRenderer) && method.desc.equals(updateRendererDesc)){ try{ logger.info("**************************************************"); logger.info("Patching updateRenderer"); /* * INVOKEVIRTUAL net/minecraft/world/ChunkCache.getBlock (III)Lnet/minecraft/block/Block; * ASTORE 24 */ AbstractInsnNode targetNode = null; AbstractInsnNode targetNode2 = null; for(AbstractInsnNode currentNode : method.instructions.toArray()){ if(currentNode.getOpcode() == Opcodes.INVOKEVIRTUAL){ MethodInsnNode m = (MethodInsnNode) currentNode; if(m.owner.replace("/", ".").equals(ColourfullBlocksTranslator.getMapedClassName("world.ChunkCache")) && m.name.equals(ColourfullBlocksTranslator.getMapedMethodName("ChunkCache", "func_147439_a", "getBlock"))){ /*if(m.getNext().getOpcode() == Opcodes.ASTORE){ VarInsnNode var = (VarInsnNode) m.getNext(); if(var.var == 24){*/ targetNode = currentNode.getNext(); break; /*} }*/ } } } /* * ICONST_0 * INVOKEVIRTUAL net/minecraft/client/renderer/RenderBlocks.setRenderAllFaces (Z)V */ for(AbstractInsnNode currentNode : method.instructions.toArray()){ if(currentNode.getOpcode() == Opcodes.INVOKEVIRTUAL){ MethodInsnNode m = (MethodInsnNode) currentNode; if(m.owner.replace("/", ".").equals(ColourfullBlocksTranslator.getMapedClassName("client.renderer.RenderBlocks")) && m.name.equals(ColourfullBlocksTranslator.getMapedMethodName("RenderBlocks", "func_147753_b", "setRenderAllFaces"))){ if(m.getPrevious().getOpcode() == Opcodes.ICONST_0){ targetNode2 = currentNode; break; } } } } LabelNode goToEnd = new LabelNode(); InsnList list = new InsnList(); list.add(new VarInsnNode(Opcodes.ALOAD, 0)); list.add(new VarInsnNode(Opcodes.ALOAD, 16)); list.add(new VarInsnNode(Opcodes.ALOAD, 1)); list.add(new VarInsnNode(Opcodes.ILOAD, 23)); list.add(new VarInsnNode(Opcodes.ILOAD, 21)); list.add(new VarInsnNode(Opcodes.ILOAD, 22)); list.add(new MethodInsnNode(Opcodes.INVOKESTATIC, "code.elix_x.coremods.colourfullblocks.core.ColourfullBlocksHooks".replace(".", "/"), "renderBlock", "(L" + ColourfullBlocksTranslator.getMapedClassName("client.renderer.WorldRenderer").replace(".", "/") + ";L" + ColourfullBlocksTranslator.getMapedClassName("client.renderer.RenderBlocks").replace(".", "/") + ";L" + ColourfullBlocksTranslator.getMapedClassName("entity.EntityLivingBase").replace(".", "/") + ";III)Z", false)); list.add(new JumpInsnNode(Opcodes.IFEQ, goToEnd)); method.instructions.insert(targetNode, list); InsnList l = new InsnList(); l.add(goToEnd); l.add(new VarInsnNode(Opcodes.ALOAD, 0)); l.add(new VarInsnNode(Opcodes.ALOAD, 16)); l.add(new VarInsnNode(Opcodes.ALOAD, 1)); l.add(new VarInsnNode(Opcodes.ILOAD, 23)); l.add(new VarInsnNode(Opcodes.ILOAD, 21)); l.add(new VarInsnNode(Opcodes.ILOAD, 22)); l.add(new MethodInsnNode(Opcodes.INVOKESTATIC, "code.elix_x.coremods.colourfullblocks.core.ColourfullBlocksHooks".replace(".", "/"), "postRenderBlock", "(L" + ColourfullBlocksTranslator.getMapedClassName("client.renderer.WorldRenderer").replace(".", "/") + ";L" + ColourfullBlocksTranslator.getMapedClassName("client.renderer.RenderBlocks").replace(".", "/") + ";L" + ColourfullBlocksTranslator.getMapedClassName("entity.EntityLivingBase").replace(".", "/") + ";III)V", false)); method.instructions.insert(targetNode2, l); logger.info("Patching updateRenderer Completed"); logger.info("**************************************************"); }catch(Exception e){ logger.info("Patching updateRenderer Failed With Exception:"); e.printStackTrace(); logger.info("**************************************************"); } } } ClassWriter writer = new ClassWriter(ClassWriter.COMPUTE_MAXS); classNode.accept(writer); return writer.toByteArray(); } Any help is appreciated. If you want any code - just ask.
  21. Well, should i ask forge to add position sensetive isOpaque, or should i patch all occurences manually?
  22. Yes, but use it instead... It's better... Are you sure that you are using same tool. Now, please, if you can, post your final code and console log (with print in stack tag)...
  23. One more thing: for your item, no need for event, use onBlockDestroyed method instead!!!
  24. add print in stackTag in on created after fix tags, and see what it gives. Also, nbt manipulations must be server side only. Check that...
×
×
  • Create New...

Important Information

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