Jump to content

superminerJG

Members
  • Posts

    47
  • Joined

  • Last visited

Posts posted by superminerJG

  1. Yep. If you're wondering about the functional interfaces, I use them to keep code clean. Blocks are registered in ModBlocks, and suppliers and functions are created using the Suppliers class. When does this happen, and why?

    Logs:

    https://gist.github.com/superminerJG/de17f22335b40f7edcf3fa36c3116a0a

    Mod repo:

    https://github.com/superminerJG/Vanilla-Automation

     

    EDIT: using the registry object as a supplier solved it.

  2. For reference, here's a link to my repo.

     

    I am adding "mercury poisoning" to the game. Starting from when the player grabs an item under the tag "vanauto:contains_mercury", every 20 seconds, they have a chance of receiving the poison effect for 10 seconds. I plan on doing this by storing an NBT tag on the player: "LastHgAcquisition", which is then used to calculated whether to tick the player or not.

     

    The problem is, I'm not sure if this is good practice, since NBT is usually managed by capabilities, and adding an entire capability like "CanHgPoisonCapability" seems kinda clunky. Is there a simpler way to track these sorts of things?

     

    Note: stackable items need to stay stackable.

  3. I'm adding cinnabar (and later, other mercury-related things) and I wanted to add some kind of "mercury poisoning" to these items. The idea is that every 20 seconds, a player holding cinnabar has a 10% chance to receive Poison II for 10 seconds. I've been looking at Extra Utilities' Unstable Ingot, which causes the player holding it to explode 10 seconds after it's been taken out of the crafting grid. However, RWTema hasn't updated it to 1.15.2, so I'm not sure how it might work now. Any ideas?

  4. Reasons Forge isn't coming to Bedrock:

     

    • Bedrock is written in C++, which is much harder to decompile than Java
    • Bedrock runs on Xbox 1, PS4, and Switch. Inserting Forge's code onto a console is even harder (Console makers hate homebrew)
    • Furthermore, the decompiled code is nearly impossible to make sense of (or deobfuscate) so modders won't know what they're doing

    Well there you go. Unless Mojang makes Minecraft open-source, Bedrock modding is very, very, very, very hard to do.

    • Thanks 1
  5. class Ticker extends ITickable{
      static int timer = 0;
      static boolean pressed = false;
      static boolean doublePressed = false;
      static void tick() {
        if (Minecraft.getInstance().gameSettings.keyBindLeft.isKeyDown()) {
          if (!pressed) {
            if (timer < 8) {
              doublePressed = true;
            }
            timer = 10;
            pressed = true;
          }
          if (doublePressed) {
            //do stuff
          }
        }
        else {
          pressed = false;
          if (doublePressed) {
            doublePressed = false;
            timer = 0;
          }
        }
        timer--;
      }
    }

    I honestly don't know if this will work, but this is how I think it should work. Obviously you can improve on this, but the idea is to make sure that the second press doesn't happen too soon.

    • Like 1
  6. On 4/29/2020 at 2:57 AM, Boy132 said:

    This should work:

    
    @Override
    public boolean hasContainerItem()
    {
      return true;
    }
    
    @Override
    public ItemStack getContainerItem(ItemStack itemStack)
    {
      ItemStack stack = itemStack.copy();
      if(stack.attemptDamageItem(1, random, null))
      {
        stack.shrink(1);
        stack.setDamage(0);
      }
      return stack;
    }

     

     

    EDIT: And of course set the max damage in your item's properties. (maxDamage)

    Why not just return a copy of ItemStack.EMPTY instead of setting count to zero and resetting damage?

  7. I have three items involved: a sledgehammer, copper ore and copper dust.

    When you craft the sledgehammer and the copper ore together (shapeless), it should give you copper dust.

    However, the sledgehammer stays on the crafting grid and loses 1 durability.

     

    Can this be done through JSON, or do I have to code it in to get it to work? If I do have to code it in, how?

  8. https://github.com/JGgithub2018/Vanilla-Automation Repo for the mod.

     

    Backstory:

    Spoiler

    I am working on a mod for 1.15.2. In fact, my first mod. I followed a tutorial from TechnoVision (previously Loremaster), but replacing base classes with helper methods, since it's much cleaner to use helper methods. TechnoVision has yet to release a video on making blocks, so I went ahead and tried to do it myself. However, I ran into this issue and I'm not sure why this happens.

    I'm using a helper method on the ModRegistry.Blocks class which registers BlockItems for each block. However, an exception occurs in the for each loop, specifically when getting entries. Since when did the register not have an object that was just registered?

     

    Thanks everyone.

×
×
  • Create New...

Important Information

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