Jump to content

TallYate

Members
  • Posts

    141
  • Joined

  • Last visited

Posts posted by TallYate

  1. So this should work?
     

    @Override
      public ActionResultType onItemUse(ItemUseContext context) {
      if(!context.getWorld().isRemote) {
        if(context.getWorld().getBlockState(context.getPos()).getBlock()==Blocks.BEDROCK) {
          context.getWorld().setBlockState(context.getPos(), BlockInit.busted_bedrock.getDefaultState(), 3);
          context.getItem().damageItem(10000, context.getPlayer(), player -> {});
        }
        return ActionResultType.PASS;
      }
      else
      {
        return ActionResultType.FAIL;
      }
    }

     

  2. @Override
        public ActionResultType onItemUse(ItemUseContext context) {
            if(context.getWorld().getBlockState(context.getPos()).getBlock()==Blocks.BEDROCK) {
                context.getWorld().setBlockState(context.getPos(), BlockInit.busted_bedrock.getDefaultState());
                context.getItem().damageItem(10000, context.getPlayer(), player -> {});
            }
            return ActionResultType.PASS;
       }

    This works fine, but with another player, they don't see the block change unless they left or right click it.

    Not including a flag defaults to 3, which should update the block and send the change to clients.

  3. if addPower() accepts floats, just use a float

    I don't know how that power system works but

    int power = 2500/1600;

    float powerLeft = 2500;
    for(int i=1600; i>0; i--){ //make this run once every tick instead of this for loop, but remember to make i work the same
    power = powerLeft/i;
    addPower(power);
    powerLeft -= power;
    }

  4. 8 hours ago, diesieben07 said:

    Yes, nobody will ask for that recipe type. Vanilla only checks it's own recipe types.

    I put a recipe that implements this in here: https://github.com/TallYate/Bedrock-Things-mod--unfinished-/blob/master/src/main/resources/data/bedrockthings/recipes/charged_diamond_pickaxe.json

     

    The matches part works (I can tell because I made it log stuff),
    the getRecipeOutput works (I can get a preview of the recipe),

    and the getIngredients works (the correct ingredients are in the recipe preview).

    But whenever matches returns true, getCraftingResult doesn't run at all. It doesn't log anything, and the crafting recipe doesn't work.

×
×
  • Create New...

Important Information

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