Jump to content

trollworkout

Members
  • Posts

    300
  • Joined

Posts posted by trollworkout

  1. generally mc uses    setRotationAngles to control motion and setLivingAnimations to control body parts positioning when say is sitting or sprinting jumping etc

     

    and sometimes the renderer has more fine tuned  connecting entity class with the model

     

    most mobs have a repetitive motion for limbs set rotation angles

     

     

  2. Furnace is a carry over from earlier more badly coded Minecraft that did things the weird way. Furnace i think is in fact 2 different blocks : normal and burning . It switches over to a new burning blockstate and copies inventory over the keepInventory boolean tells it to do that.

     

    You don't have to do this and can in fact  just one multipart block some extra properties and TE variables + nbt .  The second burning block has burning particles built in the model but you can just call then in a multipart add them as a separate burning particles model. If burning property is on spawn burning particles.  etc

  3. package net.minecraft.client.renderer.entity;

     

    look for RenderChicken.class

     

     

    As I said you copypasta the model but not the whole renderer.

     

    Most of the specific motions and animations are done outside the model in the renderer

     

    EDIT : when i made my custom wolf the tail would spin in a circle helicopter  style forever . I had to spend a bit of time with code try to understand how is actually done then I realize I was missing some code cause I made the renderer myself instead of looking what was already there

  4. right . so if you check the vanilla chicken renderer it has this function

     

        protected float handleRotationFloat(EntityChicken livingBase, float partialTicks)

        {

            float f = livingBase.oFlap + (livingBase.wingRotation - livingBase.oFlap) * partialTicks;

            float f1 = livingBase.oFlapSpeed + (livingBase.destPos - livingBase.oFlapSpeed) * partialTicks;

            return (MathHelper.sin(f) + 1.0F) * f1;

        }

     

    which looks to me like it handles wing flapping

  5. this is no easy task because you may get false positives say for ex someone builds 2 log and puts 1 leaves block nearby cause it looks cool.

     

    trees are generally minimum 3 logs high . however modded trees or jungle bushes may be only 1-2 block high but those would be bushes  not trees :D

     

    all trees have leaves near all around the log. but sometimes they may be completely removed by players but then again that's a dead tree so it doesn't really count anymore :D x2

     

     

    most trees spawn above  a certain height say 64 blocks and higher

     

     

    best tree like thing you can check is 1 leaves block and 3 adjacent log blocks down like an inverted L . it may still produce false positives but is the best approximation. this would work on tall trees, wide trees, short trees because they will all have an inverted L shape with 1 leaves and 3 logs in them at the top of the tree. most houses would not have that pattern. once you find such a shape then just move over say 4 blocks and start counting again to make sure you don't count the same tree once more. 4 blocks (2x2) is the widest vanilla trees get so from any side over 1 (L shape) + 3 blocks over will never have another tree trunk nearby

     

    esentially you wanna do this by scanning the environment for leaves block. if leaves block found then see if say N side S E W has a log. if say N has then check N -1 and N -2  to see thos are logs. If true then you got a tree. mark the leaf location as a tree then skip over 4 units and do it again. keep doing this every random tick

     

     

    the OTHER way is to tap into worldgen or  chunkgen or sapling custom world gen events by subscribing to events of that kind and figure out what's being spawned that's a tree and keep a track of all the trees you got in some txt file in your save then you would keep updating it. since this system would be based on gen then it will always run when something multiblock is being spawned in the world so is perpetually running checking things that are spawned for tree purpose.

     

    you can also save this data in an NBT tag in the TileEntity of the tree counter

     

  6. Pretty sure your issue  is what I said above. Putting 2 blocks one inside the other with overlapping faces should cause tex flickering. Maybe your card makes the decision to put both in order in lighter environments and to blend the two textures in darker environments. On my system the texture flickers between the two whenever i have overlapping faces.

     

    Rule of thumb is you cannot have 2 textures occupying the same space. Which you still do even after it works now. . You may still get reports from people that your ore tex is flickering when you release it. Hopefully not. 

     

  7. Well I tried making the model have an extra hood element using addBox but gave that up in favour of a layer. I know how to make a model now but I just don't know how to make layers yet so I decided to try and do a layer instead. Haven't done any work on that atm. Got distracted with making a golem. But I am going back to work on it. 

     

    I jsut wonder how I can produce a cube and take the hood from vilalger type texture  then render that hood as a layer over a villager model type head.

  8. Use the

    BlockEvent.PlaceEvent

    to check if the Blocks below are melon blocks, then remove those and spawn a golem. Look at

    BlockPumpkin#trySpawnGolem

    for how vanilla is doing it.

     

    perf thank you

     

    It is done in line 63 of BlockPumpkin.class.

    i know but i can't do it that way because i am making a CUSTOM golem . pumpkin can only make vanilla iron and snow golem

     

    what larsgerrits said is the only proper way to do this

     

     

  9. JAnaVq8.png

     

    I made a golem but I wanna spawn it like normal BLOCK BLOCK + PUMPKIN like Snow man is done.  Is melon instead of snow block.

     

    I just don't know how that's done.

     

     

    So I managed to make my golem work but now how do i set him face me when I spawn him?

     

    here is what i got so far. works okay except he doesn't face me

    	    	    MelonGolem melonGolem = new MelonGolem(e.getWorld());
        	    melonGolem.moveToBlockPosAndAngles(e.getPos().down().down(), 0.0F, 1.0F);
        	    e.getWorld().spawnEntityInWorld(melonGolem);

  10. I tell my blocks to always kill their own TE just before they get destroyed.

     

    ...You know that vanilla already does that for you, right?

     

        public void breakBlock(World worldIn, BlockPos pos, IBlockState state)
        {
            if (hasTileEntity(state) && !(this instanceof BlockContainer))
            {
                worldIn.removeTileEntity(pos);
            }
        }

     

    :D

  11. Maybe the NBT method  you can probably save it to player NBT since is a gui is gonna be personal then if you need it on server side you can send packets to some array on server to update all the boolean gui settings for all clients.

     

    Maybe someone knows better.

     

    Writing to a file seems much more easy but I don't know how to do that. The file will be kept in the save folder and you can access it at will.

  12. I have already made a config with these values but I dont't know how to override them. (When the boolean changes)

     

    To override them in gui constructor you do something like

     

     

    Gui MyGui {

    Boolean boolean1

    Boolean boolean2

     

    public MyGui() {

    boolean1 = Config.getmyBoolean1

    boolean2 = Config.getmyBoolean2

    }

     

    all other gui code here

     

    }

     

    of course how to set up boolean or what type of boolean you use changes how you assign it. but essentially that's how you do it.

     

    So when you boot up the game again your gui is set to your variables saved from last time.

     

    Everytime the Gui is constructred it will first populate all your variables.

     

    Ideally you wanna do Config load/write before everything then do construction. ALL in preInit()

  13. If your GUI is something you made for a block then  use TileEntity and store your booleans as NBT tags. 

     

     

    However you do this you must realize that ALL variables in the game are reset to 0 every time you restart the game unless you store them periodically such as a file, config, NBT or meta. To get them back you need to set properties at object construction time with the data you get from all those areas you saved them to. All of this requires  extra code to make them restore data .

     

    For ex to restore meta in a block you need to actually have a functions get state from meta and meta from state. To restore NBT you need to read and write NBT .

     

    In short

    Nothing you place there stays placed there unless you save it. 

×
×
  • Create New...

Important Information

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