Jump to content

MFMods

Members
  • Posts

    370
  • Joined

  • Days Won

    13

Posts posted by MFMods

  1. of the top of my head (it's been many years and i will not set up the 1.8 workspace):
    there is a method getBlockMetaSomething (maybe getBlockMetadata or getBlockMeta, not sure); call it after the getBlock call, printout metadata (integer, 0-15). find the values for colors that interest you.

  2. if you have a location (BlockPos type, get it from your entity) and a world (Level, also available in any entity), ask the world for light level at that location. you can also ask if the "block" at location can see the sky, etc.

    • Thanks 1
  3. no. world generation is now done through resources (json files). good news: modpack makers can change most things; bad news: it's a nightmare for devs and you picked a horible task for an inexperienced modder.

    i'd switch to another plan if you have plans for multiple mods. if you must go forth, check out mcjty on youtube. there are online generators for worldgen jsons, use those (after you go through a tutorial).

  4. 1) figure out how to use events. (find forge community wiki or forge docs)
    2) subscribe to level tick event.
    3) check that the level in event is overworld. overworld is always loaded.
    4) check the side (level.isClient). you likely want to do thing only on server side.
    5) get the total time in ticks from the level. compare with saved value and be sure that at least 20 ticks (1 second) have passed. (obviously there are multiple ways to do this part).

  5. you did it on client only. all changes need to happen on the server. client only actions can be particles, toasts, etc.

    in useOn(), first check the side - if not client then printBlocks. outside of the check, return proper value (see below).

    do not call super.useOn - let's say you right-clicked a lever. you do not want to generate your island in front of the lever and then flip it as a bonus. have one or the other. you may want to support both via crouching check but i wouldn't. return InteractionResult.sidedSuccess(level_is_client). that will give you a hand animation on client.

    if you're in a good mood, don't make a hundred BlockPos objects. make one BlockPos.Mutable, call set to move it around before use.

  6. what he said.

    ...except instead of state.getBlock() == Blocks.grass you should say state.is(BlockTags.DIRT)     . tags are not a new thing and people need to use them.

    also, instead of that BlockPos constructor use above() call in BlockPos.

  7. so, your wish is to be a real boy?

    good. first follow a tutorial on how to start dev environment. do not edit anything in the example mod. only after the game starts with example mod, start editing it.

    vanilla block types are accessible through Blocks class (Blocks.something). find one that matches your block type, follow it to  creation to discover the block class. have your block extend that. things like bonemeal, etc. will work but you can override all. loot table (block dropping item) won't work. copy from the most similar block or (not easier) follow a tutorial.

  8. On 8/15/2023 at 7:08 PM, Luckydel said:

    I've looked at the Door and Bed classes

    it's a simple problem, that's why solution is easy to miss.

    you will have one main block (if you have a block entity, attach it to that one) and 4 secondary blocks (adjacent to the center one) and 4 tertiary blocks (in corners, adjacent to two secondary ones). you will have block properties (accessed via blockState.getValue) which need to be enough for you to locate the main block. for example if current block is secondary and its "facing" is south, main block is one to the north.

    override canSurvive
    if block is tertiary
      check two adjacent positions (according to blockState); if either is not secondary, return false.
    if block is secondary
      get a position of main, get block, if it isn't primary return false.
    if block is primary and was just placed
      return true
    if block is primary
      get 4 adjacent postitions, return false if either isnt secondary block
    return true.

    that's basically it. you may keep canSurvive() it in one block class or split into two (or three if you must), but that method is the only thing that you need to break multiblocks.

    you also need this one (identical in all of my multiblocks):
    @Override
        public void neighborChanged(BlockState state, Level level, BlockPos rackPos, Block block, BlockPos wallPos, boolean something)
        {
            super.neighborChanged(state, level, rackPos, block, wallPos, something);
            if (!this.canSurvive(state, level, rackPos))
            {
                level.destroyBlock(rackPos, true);
            }
        }

  9. 1)  there is a player tick event. it fires 20x per second for each player. obviously you don't need that precision, skip 19/20 ticks or even 39/40. check items in inventory there. first check that it's a server player.

    2) player has a field holding remaining air. just reset it to max. there are ways of preventing that field from being reduced but those are far more difficult that just setting the field to the max value.

  10. go to forge community wiki and read about config files.

    short version: server configs are per-world. common configs are singular (one value for all worlds and all players), client configs are per-players (reserved for visual details).

     

    edit: and ffs, do not ask a guessing machine anything. there are forums with real modders, discord servers with real modders, youtube (with 5 real modders and 995 dumbass kids (if you hear a squeaky voice, stop and leave) ), there is FCW... do not ask a guessing machine.

  11. that is not how we do it in modern era. you probably found decade old instructions on mc forum...

    if your dependency mod is on curseforge or modrinth, just pull it from there. go to curseforge page of your mod, if there is "legacy" prefix in address bar delete it. find the file, click the copy button. paste into dependencies section (where the jei example line is).

    if it's not on curseforge/modrinth, use a flat dir dependency (see community wiki).

    repositories {
        maven {
            url = "https://www.cursemaven.com"
        }
    }

    dependencies {
        minecraft '...'
        implementation fg.deobf("curse.maven:SOMETHING:SOMETHING")
    }

×
×
  • Create New...

Important Information

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