1. Welcome to the Brawl website! Feel free to look around our forums. Join our growing community by typing /register in-game!

Flagmod: A modification to re-introduce wool to CTF (WIP)

Discussion in 'Capture the Flag' started by Sir_Inge, Feb 19, 2016.

Thread Status:
Please be aware that this thread is more than 30 days old. Do not post unless the topic can still be discussed. Read more...
  1. featherpaw

    featherpaw Your friendly neighborhood kitten! :3

    Joined:
    Aug 16, 2015
    Messages:
    2,548
    Ratings:
    +1,424
  2. GalaThundR

    GalaThundR Mcpvp Veteran

    Joined:
    Jul 18, 2015
    Messages:
    902
    Ratings:
    +721
    Discord:
    GalaThundR#7914
    Couldn't you re-texture the banner in the inv as a wool block?
     
  3. Sir_Inge

    Sir_Inge Well-Known Member

    Joined:
    May 22, 2015
    Messages:
    2,371
    Ratings:
    +527
    No, because the banner in the inventory, as a dropped item, and on the head renders as a builtin entity, which means the codes rendering it are hardwired into the game and cannot be changed via JSON files. I cold override the builtin entity with another JSON, but the wool would be one color, not changing with the colored banners. this is where a modification is needed to stop the rendering of the banner and connect a wool color to a banner color. Wool blocks have individual JSONs for each color, while a banner block has only one JSON. They are aesthetically somewhat similar but the differences in coding are enormous.
     
  4. Codebastian

    Codebastian Well-Known Member

    Joined:
    May 31, 2015
    Messages:
    484
    Ratings:
    +123
    Discord:
    Codebastian#6945
    gl building red wool structures :3
     
  5. draco638

    draco638 Active Member

    Joined:
    May 24, 2015
    Messages:
    81
    Ratings:
    +29
    And there's even the wool fountain... my life is complete.
    @KirbysDreamLand That looks amazing
     
  6. lasertagfighter

    lasertagfighter Well-Known Member

    Joined:
    May 17, 2015
    Messages:
    490
    Ratings:
    +74
    I could probably look into it, I think I know what you're talking about... I think I am an experienced a little with coding...
     
  7. KirbysDreamLand

    KirbysDreamLand Well-Known Member

    Joined:
    May 17, 2015
    Messages:
    260
    Ratings:
    +77
    I am going to try to add Forge compatibility. This is my function to modify one of the classes.
    Code:
        private void transformRenderGlobal(ClassNode classNode, boolean isObf) {
            final String methodName = isObf ? "a" : "renderEntities";
            final String descriptor = isObf ? "(Lpk;Lbia;F)V" : "(Lnet/minecraft/entity/Entity;Lnet/minecraft/client/renderer/culling/ICamera;F)V";
            final String getFieldOwner = isObf ? "bfr" : "net/minecraft/client/renderer/RenderGlobal";
            final String getFieldName = isObf ? "k" : "theWorld";
            final String getFieldDesc = isObf ? "Lbdb;" : "Lnet/minecraft/client/multiplayer/WorldClient;";
            final String nextGetFieldOwner = isObf ? "bdb" : "net/minecraft/client/multiplayer/WorldClient";
            final String nextGetFieldName = isObf ? "B" : "theProfiler";
            final String nextGetFieldDesc = isObf ? "Lnt;" : "Lnet/minecraft/profiler/Profiler;";
            final String cst = "entities";
            AbstractInsnNode insn = null;
            MethodNode mthd = null;
            for(MethodNode method : classNode.methods){
                if(method.name.equals(methodName) && method.desc.equals(descriptor)){
                    for(AbstractInsnNode instruction : method.instructions.toArray()){
                        if(instruction.getOpcode() == ALOAD && ((VarInsnNode)instruction).var == 0 && instruction.getNext().getOpcode() == GETFIELD && ((FieldInsnNode)instruction.getNext()).name.equals("theWorld") && instruction.getNext().getNext().getOpcode() == GETFIELD){
                            FieldInsnNode getField = (FieldInsnNode) instruction.getNext();
                            if(getField.owner.equals(getFieldOwner) && getField.name.equals(getFieldName) && getField.desc.equals(getFieldDesc) && getField.getNext().getOpcode() == GETFIELD){
                                FieldInsnNode nextGetField = (FieldInsnNode) getField.getNext();
                                if(nextGetField.owner.equals(nextGetFieldOwner) && nextGetField.name.equals(nextGetFieldName) && nextGetField.desc.equals(nextGetFieldDesc)){
                                    if(nextGetField.getNext() instanceof LdcInsnNode){
                                        LdcInsnNode ldc = (LdcInsnNode) nextGetField.getNext();
                                        if(ldc.cst.equals("entities")){
                                            //Call all your m80s, we finally found the right instruction!!!!!!!!
                                            //We'll have a party
                                            insn = instruction;
                                            mthd = method;
                                        }
                                    }  
                                }
                            }
                        }
                    }
                }
            }
            if(insn == null || mthd == null){
                log("[CRITICAL] Error while patching RenderGlobal. FlagMod entities will not br rendered.");
            }else{
                //mv.visitMethodInsn(INVOKESTATIC, "FlagMod/FlagMod", "getFlagMod", "()LFlagMod/FlagMod;", false);
                //mv.visitVarInsn(FLOAD, 3);
                //mv.visitMethodInsn(INVOKEVIRTUAL, "FlagMod/FlagMod", "render", "(F)V", false);
                MethodInsnNode getFlagMod = new MethodInsnNode(INVOKESTATIC, "FlagMod/FlagMod", "getFlagMod", "()LFlagMod/FlagMod;", false);
                VarInsnNode partialTicks = new VarInsnNode(FLOAD, 3);
                MethodInsnNode render = new MethodInsnNode(INVOKEVIRTUAL, "FlagMod/FlagMod", "render", "(F)V", false);
                mthd.instructions.insertBefore(insn, render);
                mthd.instructions.insertBefore(render, partialTicks);
                mthd.instructions.insertBefore(partialTicks, getFlagMod);
                log("[SUCCESS] Patched RenderGlobal!");
            }
        }
    This has been the hardest part, but it works!

    All it does is change this
    Code:
    mv.visitFrame(Opcodes.F_SAME, 0, null, 0, null);
    mv.visitVarInsn(ALOAD, 0);
    To this
    Code:
    mv.visitFrame(Opcodes.F_SAME, 0, null, 0, null);
    mv.visitMethodInsn(INVOKESTATIC, "FlagMod/FlagMod", "getFlagMod", "()LFlagMod/FlagMod;", false);
    mv.visitVarInsn(FLOAD, 3);
    mv.visitMethodInsn(INVOKEVIRTUAL, "FlagMod/FlagMod", "render", "(F)V", false);
    mv.visitVarInsn(ALOAD, 0);
     
    • Like Like x 2
    • Informative Informative x 1
  8. wintergreen3

    wintergreen3 Delta Force Leader | Staff Manager | CTF Admin

    Joined:
    May 17, 2015
    Messages:
    1,259
    Ratings:
    +1,167
  9. Sir_Inge

    Sir_Inge Well-Known Member

    Joined:
    May 22, 2015
    Messages:
    2,371
    Ratings:
    +527
    I imagine soon because this will be the most downloaded CTF mod ever.
     
    • Agree Agree x 1
    • Funny Funny x 1
  10. Codebastian

    Codebastian Well-Known Member

    Joined:
    May 31, 2015
    Messages:
    484
    Ratings:
    +123
    Discord:
    Codebastian#6945
    Their shouldn't be the right clicking problem right? Since its just a wool block, if you demonstrated that in your video I may had missed it.
     
  11. The_Sky_Emperor

    The_Sky_Emperor Active Member

    Joined:
    Sep 5, 2015
    Messages:
    125
    Ratings:
    +12
    Just saying, who likes the banners? I have not seen any posts about telling people to stop asking to bring wool back, as far as i'm aware, no one likes the banners :/ not sure what is better about the banners as opposed to the old fashioned wool... It is just annoying when trying to F5 and get more of a better perspective when you are holding the flag as it obstructs your vision, also it seems to be creating more lag than there used to be.
     
  12. KirbysDreamLand

    KirbysDreamLand Well-Known Member

    Joined:
    May 17, 2015
    Messages:
    260
    Ratings:
    +77
    There is still the right click problem. I think it is caused by the armor stand and not the banners.
     
  13. DJ_V5th

    DJ_V5th Well-Known Member

    Joined:
    Jun 11, 2015
    Messages:
    506
    Ratings:
    +94
    its beautiful C:
    the wool is back on ctf
     
  14. Codebastian

    Codebastian Well-Known Member

    Joined:
    May 31, 2015
    Messages:
    484
    Ratings:
    +123
    Discord:
    Codebastian#6945
    ArmorStand ?
     
  15. Tenshirox

    Tenshirox C a p t u r e F l a g

    Joined:
    May 17, 2015
    Messages:
    651
    Ratings:
    +446
    The Banner isnt a banner, it's a banner being worn as an ArmorStand's head. All complaints towards banners are actually because of the AmorStand, which is what prevents right clicking.
    I dont voice my opinion because I consider the whole banner debacle a sign that CTFers will truly complain about some of the stupidest things, but I dont feel any issues against Banners that aren't adjustable.

    Once the mod comes out the complaints will hopefully stop.
     
    • Agree Agree x 1
    • Informative Informative x 1
  16. Sir_Inge

    Sir_Inge Well-Known Member

    Joined:
    May 22, 2015
    Messages:
    2,371
    Ratings:
    +527
    How about the clicking?
    How about the pickup radius?
    How about the obstructed view?
    How about the lack of helmet?
    All valid complaints. You just don't like the negativity because, to be honest, you don't seem to really care about what banners do to CTF.
     
  17. Tenshirox

    Tenshirox C a p t u r e F l a g

    Joined:
    May 17, 2015
    Messages:
    651
    Ratings:
    +446
    Exactly, I don't care. That's why I dont post about the issue because Banner people have valid complaints, but the complaints are so trivial and adaptable that Im dumbfounded that it's been going on for so long.

    I dont know if its commendable that people have stuck to such a cause, or if it's just purely absurd.
     
  18. Sir_Inge

    Sir_Inge Well-Known Member

    Joined:
    May 22, 2015
    Messages:
    2,371
    Ratings:
    +527
    True, it's trivial, but why add to a list of non trivial and hard to fix complaints with some easy fix trivial ones? I mean, if Kirby and I (but really just Kirby) can re add wool on the client side, doing so on the server side must be so much easier.
     
  19. Tenshirox

    Tenshirox C a p t u r e F l a g

    Joined:
    May 17, 2015
    Messages:
    651
    Ratings:
    +446
    Because the fact its so trivial and unimportant to the masses of random players who play CTF that it's not worth reverting.
     
  20. Sir_Inge

    Sir_Inge Well-Known Member

    Joined:
    May 22, 2015
    Messages:
    2,371
    Ratings:
    +527
    It's actually not so trivial. Even playing casually gets annoying with the blocked f5 and clicks. I'm sure other people notice it. It's not adaptable and it's an easy fix. It's horrid compared to the old CTF. HORRID.
     
Loading...
Similar Threads Forum Date
Idea Add shaders to the forbidden modifications list Raid Jan 6, 2018
Damage modification Ideas Mar 15, 2016
Alpha 1.0.1 | Brawl Modular Modification Discussion Dec 25, 2015
Modifications Q & A Aug 25, 2015
Class Modifications Capture the Flag Aug 13, 2015
Thread Status:
Please be aware that this thread is more than 30 days old. Do not post unless the topic can still be discussed. Read more...